]> git.saurik.com Git - apple/libc.git/commitdiff
Libc-825.24.tar.gz mac-os-x-108 mac-os-x-1081 v825.24
authorApple <opensource@apple.com>
Fri, 27 Jul 2012 17:35:30 +0000 (17:35 +0000)
committerApple <opensource@apple.com>
Fri, 27 Jul 2012 17:35:30 +0000 (17:35 +0000)
2128 files changed:
BSDmakefile [deleted file]
GNUmakefile [deleted file]
Info.plist [deleted file]
Libc.xcodeproj/project.pbxproj [new file with mode: 0644]
Libc.xcodeproj/project.xcworkspace/contents.xcworkspacedata [new file with mode: 0644]
Makefile [deleted file]
Makefile.fbsd_begin [deleted file]
Makefile.fbsd_end [deleted file]
Makefile.features [deleted file]
Makefile.inc [deleted file]
Makefile.nbsd_begin [deleted file]
Makefile.nbsd_end [deleted file]
Makefile.obsd_begin [deleted file]
Makefile.obsd_end [deleted file]
Makefile.xbs [deleted file]
Platforms/MacOSX/Makefile.inc [deleted file]
Platforms/iPhone/Makefile.inc [deleted file]
Platforms/iphoneos/Makefile.inc [new file with mode: 0644]
Platforms/macosx/Makefile.inc [new file with mode: 0644]
arm/Makefile.inc [deleted file]
arm/gen/Makefile.inc [deleted file]
arm/pthreads/Makefile.inc [deleted file]
arm/pthreads/get_cpu_capabilities.s [deleted file]
arm/pthreads/start_wqthread.s
arm/pthreads/thread_start.s
arm/stdlib/gdtoa.mk [deleted file]
arm/string/Makefile.inc [deleted file]
arm/string/bcopy_CortexA8.s
arm/string/bcopy_CortexA9.s
arm/string/bcopy_Generic.s
arm/string/bcopy_Swift.s [new file with mode: 0644]
arm/string/bzero_CortexA8.s
arm/string/bzero_CortexA9.s
arm/string/bzero_Generic.s
arm/string/bzero_Swift.s [new file with mode: 0644]
arm/string/dyld_resolvers.c
arm/string/ffs.s
arm/string/memcmp.s
arm/string/memset_pattern.s
arm/string/memset_pattern_Swift.s [new file with mode: 0644]
arm/string/strchr.s
arm/string/strcmp.s
arm/string/strcpy.s [deleted file]
arm/string/strlcpy.s [deleted file]
arm/string/strlen.s
arm/string/strncmp.s
arm/string/strncpy.s [deleted file]
arm/string/strnlen.s
arm/string/strstr.s
arm/sys/Makefile.inc [deleted file]
arm/sys/OSAtomic.c [new file with mode: 0644]
arm/sys/OSAtomic.h [new file with mode: 0644]
arm/sys/OSAtomic.s [deleted file]
arm/sys/OSAtomicUP.c [new file with mode: 0644]
arm/sys/OSAtomic_resolvers.c
arm/sys/Spinlocks.c [new file with mode: 0644]
arm/sys/SpinlocksUP.c [new file with mode: 0644]
arm/sys/SpinlocksWFE.c [new file with mode: 0644]
arm/sys/_longjmp.s
arm/sys/_setjmp.s
arm/sys/gcc_atomic.c
compat-43/FreeBSD/creat.c
compat-43/FreeBSD/creat.c.patch [deleted file]
compat-43/FreeBSD/gethostid.3
compat-43/FreeBSD/gethostid.3.patch [deleted file]
compat-43/FreeBSD/gethostid.c
compat-43/FreeBSD/gethostid.c.patch [deleted file]
compat-43/FreeBSD/killpg.2
compat-43/FreeBSD/killpg.2.patch [deleted file]
compat-43/FreeBSD/killpg.c
compat-43/FreeBSD/killpg.c.patch [deleted file]
compat-43/FreeBSD/setpgrp.c
compat-43/FreeBSD/setpgrp.c.patch [deleted file]
compat-43/Makefile.inc [deleted file]
compat-43/creat-fbsd.c [deleted file]
compat-43/creat.2 [deleted symlink]
compat-43/gethostid-fbsd.c [deleted file]
compat-43/gethostid.3 [deleted file]
compat-43/getwd-fbsd.c [deleted symlink]
compat-43/killpg-fbsd.c [deleted file]
compat-43/killpg.2 [deleted file]
compat-43/sethostid-fbsd.c [deleted symlink]
compat-43/setpgrp-fbsd.c [deleted file]
compat-43/setrgid-fbsd.c [deleted symlink]
compat-43/setruid-fbsd.c [deleted symlink]
compat-43/setruid.3 [deleted symlink]
darwin/Makefile.inc [deleted file]
darwin/OSAtomicLoadStoreEx.c [new file with mode: 0644]
darwin/SpinlocksLoadStoreEx.c [new file with mode: 0644]
darwin/_dirhelper.c
darwin/dirhelper_priv.h
darwin/forceLibcToBuild.c [new file with mode: 0644]
darwin/libproc.c
darwin/libproc.h
darwin/libproc_internal.h
db/Makefile.inc [deleted file]
db/btree/FreeBSD/bt_extern.h [new file with mode: 0644]
db/btree/FreeBSD/bt_overflow.c
db/btree/FreeBSD/bt_overflow.c.patch [deleted file]
db/btree/FreeBSD/bt_seq.c
db/btree/FreeBSD/bt_seq.c.patch [deleted file]
db/btree/FreeBSD/bt_split.c
db/btree/FreeBSD/bt_split.c.patch [deleted file]
db/btree/FreeBSD/btree.h
db/btree/FreeBSD/btree.h.patch [deleted file]
db/btree/FreeBSD/extern.h [deleted file]
db/btree/Makefile.inc [deleted file]
db/btree/bt_close-fbsd.c [deleted symlink]
db/btree/bt_conv-fbsd.c [deleted symlink]
db/btree/bt_delete-fbsd.c [deleted symlink]
db/btree/bt_extern.h [deleted symlink]
db/btree/bt_get-fbsd.c [deleted symlink]
db/btree/bt_open-fbsd.c [deleted symlink]
db/btree/bt_overflow-fbsd.c [deleted file]
db/btree/bt_page-fbsd.c [deleted symlink]
db/btree/bt_put-fbsd.c [deleted symlink]
db/btree/bt_search-fbsd.c [deleted symlink]
db/btree/bt_seq-fbsd.c [deleted file]
db/btree/bt_split-fbsd.c [deleted file]
db/btree/bt_utils-fbsd.c [deleted symlink]
db/btree/btree.h [deleted file]
db/db/Makefile.inc [deleted file]
db/db/db-fbsd.c [deleted symlink]
db/hash/FreeBSD/extern.h [deleted file]
db/hash/FreeBSD/hash.c
db/hash/FreeBSD/hash.c.patch [deleted file]
db/hash/FreeBSD/hash.h
db/hash/FreeBSD/hash.h.patch [deleted file]
db/hash/FreeBSD/hash_bigkey.c
db/hash/FreeBSD/hash_bigkey.c.patch [deleted file]
db/hash/FreeBSD/hash_buf.c
db/hash/FreeBSD/hash_buf.c.patch [deleted file]
db/hash/FreeBSD/hash_extern.h [new file with mode: 0644]
db/hash/FreeBSD/hash_func.c
db/hash/FreeBSD/hash_func.c.patch [deleted file]
db/hash/FreeBSD/hash_log2.c
db/hash/FreeBSD/hash_log2.c.patch [deleted file]
db/hash/FreeBSD/hash_page.c
db/hash/FreeBSD/hash_page.c.patch [deleted file]
db/hash/FreeBSD/ndbm.c
db/hash/FreeBSD/ndbm.c.patch [deleted file]
db/hash/Makefile.inc [deleted file]
db/hash/hash-fbsd.c [deleted file]
db/hash/hash-fbsd.c.orig [deleted file]
db/hash/hash.h [deleted file]
db/hash/hash_bigkey-fbsd.c [deleted file]
db/hash/hash_buf-fbsd.c [deleted file]
db/hash/hash_extern.h [deleted symlink]
db/hash/hash_func-fbsd.c [deleted file]
db/hash/hash_log2-fbsd.c [deleted file]
db/hash/hash_page-fbsd.c [deleted file]
db/hash/ndbm-fbsd.c [deleted file]
db/hash/page.h [deleted symlink]
db/man/FreeBSD/dbm.3
db/man/FreeBSD/dbm.3.patch [deleted file]
db/man/Makefile.inc [deleted file]
db/man/btree.3 [deleted symlink]
db/man/dbm.3 [deleted file]
db/man/dbopen.3 [deleted symlink]
db/man/hash.3 [deleted symlink]
db/man/mpool.3 [deleted symlink]
db/man/recno.3 [deleted symlink]
db/mpool/FreeBSD/mpool.c
db/mpool/FreeBSD/mpool.c.patch [deleted file]
db/mpool/Makefile.inc [deleted file]
db/mpool/mpool-fbsd.c [deleted file]
db/recno/FreeBSD/extern.h [deleted file]
db/recno/FreeBSD/extern.h.patch [deleted file]
db/recno/FreeBSD/rec_extern.h [new file with mode: 0644]
db/recno/FreeBSD/recno.h
db/recno/FreeBSD/recno.h.patch [deleted file]
db/recno/Makefile.inc [deleted file]
db/recno/rec_close-fbsd.c [deleted symlink]
db/recno/rec_delete-fbsd.c [deleted symlink]
db/recno/rec_extern.h [deleted file]
db/recno/rec_get-fbsd.c [deleted symlink]
db/recno/rec_open-fbsd.c [deleted symlink]
db/recno/rec_put-fbsd.c [deleted symlink]
db/recno/rec_search-fbsd.c [deleted symlink]
db/recno/rec_seq-fbsd.c [deleted symlink]
db/recno/rec_utils-fbsd.c [deleted symlink]
db/recno/recno.h [deleted file]
emulated/Makefile.inc [deleted file]
fbsdcompat/_fpmath.h
fbsdcompat/sys/cdefs.h
fixdups.ed [deleted file]
gdtoa/FreeBSD/_hdtoa.c
gdtoa/FreeBSD/_hdtoa.c.patch [deleted file]
gdtoa/FreeBSD/_ldtoa.c
gdtoa/FreeBSD/_ldtoa.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-gethex.c
gdtoa/FreeBSD/gdtoa-gethex.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-hexnan.c
gdtoa/FreeBSD/gdtoa-hexnan.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-misc.c
gdtoa/FreeBSD/gdtoa-misc.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-strtod.c
gdtoa/FreeBSD/gdtoa-strtod.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-strtodg.c
gdtoa/FreeBSD/gdtoa-strtodg.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-strtof.c
gdtoa/FreeBSD/gdtoa-strtof.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-strtopdd.c
gdtoa/FreeBSD/gdtoa-strtopdd.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-strtopx.c
gdtoa/FreeBSD/gdtoa-strtopx.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa-strtord.c
gdtoa/FreeBSD/gdtoa-strtord.c.patch [deleted file]
gdtoa/FreeBSD/gdtoa.h
gdtoa/FreeBSD/gdtoa.h.patch [deleted file]
gdtoa/FreeBSD/gdtoaimp.h
gdtoa/FreeBSD/gdtoaimp.h.patch [deleted file]
gdtoa/FreeBSD/machdep_ldisd.c
gdtoa/FreeBSD/machdep_ldisd.c.patch [deleted file]
gdtoa/FreeBSD/machdep_ldisdd.c
gdtoa/FreeBSD/machdep_ldisdd.c.patch [deleted file]
gdtoa/FreeBSD/machdep_ldisx.c
gdtoa/FreeBSD/machdep_ldisx.c.patch [deleted file]
gdtoa/Makefile.inc [deleted file]
gdtoa/_hdtoa-fbsd.c [deleted file]
gdtoa/_ldtoa-fbsd.c [deleted file]
gdtoa/arith.h
gdtoa/gd_qnan.h
gdtoa/gdtoa-dmisc-fbsd.c [deleted symlink]
gdtoa/gdtoa-dtoa-fbsd.c [deleted symlink]
gdtoa/gdtoa-gdtoa-fbsd.c [deleted symlink]
gdtoa/gdtoa-gethex-fbsd.c [deleted file]
gdtoa/gdtoa-gmisc-fbsd.c [deleted symlink]
gdtoa/gdtoa-hd_init-fbsd.c [deleted symlink]
gdtoa/gdtoa-hexnan-fbsd.c [deleted file]
gdtoa/gdtoa-misc-fbsd.c [deleted file]
gdtoa/gdtoa-smisc-fbsd.c [deleted symlink]
gdtoa/gdtoa-strtod-fbsd.c [deleted file]
gdtoa/gdtoa-strtodg-fbsd.c [deleted file]
gdtoa/gdtoa-strtof-fbsd.c [deleted file]
gdtoa/gdtoa-strtopdd-fbsd.c [deleted file]
gdtoa/gdtoa-strtopx-fbsd.c [deleted file]
gdtoa/gdtoa-strtord-fbsd.c [deleted file]
gdtoa/gdtoa-sum-fbsd.c [deleted symlink]
gdtoa/gdtoa-ulp-fbsd.c [deleted symlink]
gdtoa/gdtoa.h [deleted file]
gdtoa/gdtoa_fltrnds.h [deleted symlink]
gdtoa/gdtoaimp.h [deleted file]
gdtoa/glue-fbsd.c [deleted symlink]
gdtoa/machdep_ldisd-fbsd.c [deleted file]
gdtoa/machdep_ldisdd-fbsd.c [deleted file]
gdtoa/machdep_ldisx-fbsd.c [deleted file]
gen/FreeBSD/_rand48.c
gen/FreeBSD/_rand48.c.patch [deleted file]
gen/FreeBSD/alarm.3
gen/FreeBSD/alarm.3.patch [deleted file]
gen/FreeBSD/arc4random.c.patch [deleted file]
gen/FreeBSD/assert.c
gen/FreeBSD/assert.c.patch [deleted file]
gen/FreeBSD/basename.3
gen/FreeBSD/basename.3.patch [deleted file]
gen/FreeBSD/basename.c
gen/FreeBSD/basename.c.patch [deleted file]
gen/FreeBSD/closedir.c
gen/FreeBSD/closedir.c.patch [deleted file]
gen/FreeBSD/ctermid.3
gen/FreeBSD/ctermid.3.patch [deleted file]
gen/FreeBSD/daemon.3
gen/FreeBSD/daemon.3.patch [deleted file]
gen/FreeBSD/daemon.c
gen/FreeBSD/daemon.c.patch [deleted file]
gen/FreeBSD/dirname.3
gen/FreeBSD/dirname.3.patch [deleted file]
gen/FreeBSD/dirname.c
gen/FreeBSD/dirname.c.patch [deleted file]
gen/FreeBSD/drand48.c
gen/FreeBSD/drand48.c.patch [deleted file]
gen/FreeBSD/erand48.c
gen/FreeBSD/erand48.c.patch [deleted file]
gen/FreeBSD/err.3
gen/FreeBSD/err.3.patch [deleted file]
gen/FreeBSD/err.c
gen/FreeBSD/err.c.patch [deleted file]
gen/FreeBSD/exec.3
gen/FreeBSD/exec.3.patch [deleted file]
gen/FreeBSD/exec.c
gen/FreeBSD/exec.c.patch [deleted file]
gen/FreeBSD/fmtmsg.c
gen/FreeBSD/fmtmsg.c.patch [deleted file]
gen/FreeBSD/fnmatch.3
gen/FreeBSD/fnmatch.3.patch [deleted file]
gen/FreeBSD/fnmatch.c
gen/FreeBSD/fnmatch.c.patch [deleted file]
gen/FreeBSD/ftok.3
gen/FreeBSD/ftok.3.patch [deleted file]
gen/FreeBSD/getcap.c
gen/FreeBSD/getcap.c.patch [deleted file]
gen/FreeBSD/getcwd.c
gen/FreeBSD/getcwd.c.patch [deleted file]
gen/FreeBSD/gethostname.3
gen/FreeBSD/gethostname.3.patch [deleted file]
gen/FreeBSD/gethostname.c
gen/FreeBSD/gethostname.c.patch [deleted file]
gen/FreeBSD/getlogin.c
gen/FreeBSD/getlogin.c.patch [deleted file]
gen/FreeBSD/getmntinfo.3
gen/FreeBSD/getmntinfo.3.patch [deleted file]
gen/FreeBSD/getmntinfo64.c [new file with mode: 0644]
gen/FreeBSD/getmntinfo64.c.patch [deleted file]
gen/FreeBSD/getprogname.3
gen/FreeBSD/getprogname.3.patch [deleted file]
gen/FreeBSD/getprogname.c
gen/FreeBSD/getprogname.c.patch [deleted file]
gen/FreeBSD/glob.3
gen/FreeBSD/glob.3.patch [deleted file]
gen/FreeBSD/glob.c
gen/FreeBSD/glob.c.patch [deleted file]
gen/FreeBSD/isatty.c
gen/FreeBSD/isatty.c.patch [deleted file]
gen/FreeBSD/jrand48.c
gen/FreeBSD/jrand48.c.patch [deleted file]
gen/FreeBSD/lcong48.c
gen/FreeBSD/lcong48.c.patch [deleted file]
gen/FreeBSD/lockf.3
gen/FreeBSD/lockf.3.patch [deleted file]
gen/FreeBSD/lockf.c
gen/FreeBSD/lockf.c.patch [deleted file]
gen/FreeBSD/lrand48.c
gen/FreeBSD/lrand48.c.patch [deleted file]
gen/FreeBSD/makecontext.3
gen/FreeBSD/makecontext.3.patch [deleted file]
gen/FreeBSD/mrand48.c
gen/FreeBSD/mrand48.c.patch [deleted file]
gen/FreeBSD/nice.c
gen/FreeBSD/nice.c.patch [deleted file]
gen/FreeBSD/nrand48.c
gen/FreeBSD/nrand48.c.patch [deleted file]
gen/FreeBSD/opendir.c
gen/FreeBSD/opendir.c.patch [deleted file]
gen/FreeBSD/pause.c
gen/FreeBSD/pause.c.patch [deleted file]
gen/FreeBSD/popen.3
gen/FreeBSD/popen.3.patch [deleted file]
gen/FreeBSD/popen.c
gen/FreeBSD/popen.c.patch [deleted file]
gen/FreeBSD/pselect.3
gen/FreeBSD/pselect.3.patch [deleted file]
gen/FreeBSD/pselect.c
gen/FreeBSD/pselect.c.patch [deleted file]
gen/FreeBSD/psignal.3
gen/FreeBSD/psignal.3.patch [deleted file]
gen/FreeBSD/rand48.3
gen/FreeBSD/rand48.3.patch [deleted file]
gen/FreeBSD/rand48.h
gen/FreeBSD/rand48.h.patch [deleted file]
gen/FreeBSD/readdir.c
gen/FreeBSD/readdir.c.patch [deleted file]
gen/FreeBSD/readpassphrase.c
gen/FreeBSD/readpassphrase.c.patch [deleted file]
gen/FreeBSD/scandir.3
gen/FreeBSD/scandir.3.patch [deleted file]
gen/FreeBSD/scandir.c
gen/FreeBSD/scandir.c.patch [deleted file]
gen/FreeBSD/scandir_b.c [new file with mode: 0644]
gen/FreeBSD/scandir_b.c.patch [deleted file]
gen/FreeBSD/seed48.c
gen/FreeBSD/seed48.c.patch [deleted file]
gen/FreeBSD/setmode.c
gen/FreeBSD/setmode.c.patch [deleted file]
gen/FreeBSD/setprogname.c
gen/FreeBSD/setprogname.c.patch [deleted file]
gen/FreeBSD/siginterrupt.3
gen/FreeBSD/siginterrupt.3.patch [deleted file]
gen/FreeBSD/siglist.c
gen/FreeBSD/siglist.c.patch [deleted file]
gen/FreeBSD/signal.3
gen/FreeBSD/signal.3.patch [deleted file]
gen/FreeBSD/signal.c
gen/FreeBSD/signal.c.patch [deleted file]
gen/FreeBSD/signbit.3
gen/FreeBSD/signbit.3.patch [deleted file]
gen/FreeBSD/sleep.3
gen/FreeBSD/sleep.3.patch [deleted file]
gen/FreeBSD/sleep.c
gen/FreeBSD/sleep.c.patch [deleted file]
gen/FreeBSD/srand48.c
gen/FreeBSD/srand48.c.patch [deleted file]
gen/FreeBSD/sysconf.c
gen/FreeBSD/sysconf.c.patch [deleted file]
gen/FreeBSD/sysctl.3
gen/FreeBSD/sysctl.3.patch [deleted file]
gen/FreeBSD/sysctl.c
gen/FreeBSD/sysctl.c.patch [deleted file]
gen/FreeBSD/telldir.c
gen/FreeBSD/telldir.c.patch [deleted file]
gen/FreeBSD/telldir.h
gen/FreeBSD/telldir.h.patch [deleted file]
gen/FreeBSD/termios.c
gen/FreeBSD/termios.c.patch [deleted file]
gen/FreeBSD/time.3
gen/FreeBSD/time.3.patch [deleted file]
gen/FreeBSD/time.c
gen/FreeBSD/time.c.patch [deleted file]
gen/FreeBSD/times.3
gen/FreeBSD/times.3.patch [deleted file]
gen/FreeBSD/ttyname.3
gen/FreeBSD/ttyname.3.patch [deleted file]
gen/FreeBSD/ttyname.c
gen/FreeBSD/ttyname.c.patch [deleted file]
gen/FreeBSD/ualarm.3
gen/FreeBSD/ualarm.3.patch [deleted file]
gen/FreeBSD/ulimit.3
gen/FreeBSD/ulimit.3.patch [deleted file]
gen/FreeBSD/unvis.c
gen/FreeBSD/unvis.c.patch [deleted file]
gen/FreeBSD/usleep.3
gen/FreeBSD/usleep.3.patch [deleted file]
gen/FreeBSD/usleep.c
gen/FreeBSD/usleep.c.patch [deleted file]
gen/FreeBSD/utime.3
gen/FreeBSD/utime.3.patch [deleted file]
gen/FreeBSD/vis.c
gen/FreeBSD/vis.c.patch [deleted file]
gen/FreeBSD/wait.c
gen/FreeBSD/wait.c.patch [deleted file]
gen/FreeBSD/waitpid.c
gen/FreeBSD/waitpid.c.patch [deleted file]
gen/Makefile.inc [deleted file]
gen/NetBSD/endutxent.3
gen/NetBSD/endutxent.3.patch [deleted file]
gen/NetBSD/getlastlogx.3
gen/NetBSD/getlastlogx.3.patch [deleted file]
gen/NetBSD/utmpx.5
gen/NetBSD/utmpx.5.patch [deleted file]
gen/NetBSD/utmpx.c
gen/NetBSD/utmpx.c.patch [deleted file]
gen/_rand48-fbsd.c [deleted file]
gen/_simple.h
gen/alarm-fbsd.c [deleted symlink]
gen/alarm.3 [deleted file]
gen/arc4random-fbsd.c [deleted file]
gen/arc4random.3 [deleted symlink]
gen/asl.3
gen/asl.c
gen/asl_core.c
gen/asl_core.h
gen/asl_fd.c [new file with mode: 0644]
gen/asl_file.c
gen/asl_file.h
gen/asl_ipc.defs
gen/asl_legacy1.c
gen/asl_legacy1.h
gen/asl_msg.c
gen/asl_msg.h
gen/asl_private.h
gen/asl_store.c
gen/asl_store.h
gen/asl_util.c
gen/assert-fbsd.c [deleted file]
gen/assumes.c
gen/assumes.h
gen/basename-fbsd.c [deleted file]
gen/basename.3 [deleted file]
gen/clock-fbsd.c [deleted symlink]
gen/clock.3 [deleted symlink]
gen/closedir-fbsd.c [deleted file]
gen/confstr.3
gen/confstr.c
gen/ctermid-fbsd.c [deleted symlink]
gen/ctermid.3 [deleted file]
gen/daemon-fbsd.c [deleted file]
gen/daemon.3 [deleted file]
gen/directory.3
gen/dirfd.c [new file with mode: 0644]
gen/dirname-fbsd.c [deleted file]
gen/dirname.3 [deleted file]
gen/drand48-fbsd.c [deleted file]
gen/endutxent.3 [deleted file]
gen/endutxent.3.orig [deleted file]
gen/erand48-fbsd.c [deleted file]
gen/err-fbsd.c [deleted file]
gen/err.3 [deleted file]
gen/errlst.c
gen/exec-fbsd.c [deleted file]
gen/exec.3 [deleted file]
gen/fmtcheck-fbsd.c [deleted symlink]
gen/fmtcheck.3 [deleted symlink]
gen/fmtmsg-fbsd.c [deleted file]
gen/fmtmsg.3 [deleted symlink]
gen/fnmatch-fbsd.c [deleted file]
gen/fnmatch.3 [deleted file]
gen/ftok-fbsd.c [deleted symlink]
gen/ftok.3 [deleted file]
gen/getbsize-fbsd.c [deleted symlink]
gen/getbsize.3 [deleted symlink]
gen/getcap-fbsd.c [deleted file]
gen/getcap-fbsd.c.orig [deleted file]
gen/getcap.3 [deleted symlink]
gen/getcontext.3 [deleted symlink]
gen/getcwd-fbsd.c [deleted file]
gen/getcwd.3 [deleted symlink]
gen/gethostname-fbsd.c [deleted file]
gen/gethostname.3 [deleted file]
gen/getlastlogx.3 [deleted file]
gen/getlastlogx.3.orig [deleted file]
gen/getlogin-fbsd.c [deleted file]
gen/getmntinfo-fbsd.c [deleted symlink]
gen/getmntinfo.3 [deleted file]
gen/getmntinfo64-fbsd.c [deleted file]
gen/getmntinfo64-fbsd.c.orig [deleted file]
gen/getpagesize-fbsd.c [deleted symlink]
gen/getpagesize.3 [deleted symlink]
gen/getpass.3 [deleted symlink]
gen/getpeereid-fbsd.c [deleted symlink]
gen/getpeereid.3 [deleted symlink]
gen/getprogname-fbsd.c [deleted file]
gen/getprogname.3 [deleted file]
gen/glob-fbsd.c [deleted file]
gen/glob.3 [deleted file]
gen/isatty-fbsd.c [deleted file]
gen/jrand48-fbsd.c [deleted file]
gen/lcong48-fbsd.c [deleted file]
gen/lockf-fbsd.c [deleted file]
gen/lockf.3 [deleted file]
gen/lrand48-fbsd.c [deleted file]
gen/magazine_malloc.c
gen/makecontext.3 [deleted file]
gen/malloc.c
gen/mrand48-fbsd.c [deleted file]
gen/nice-fbsd.c [deleted file]
gen/nice.3 [deleted symlink]
gen/nrand48-fbsd.c [deleted file]
gen/opendir-fbsd.c [deleted file]
gen/pause-fbsd.c [deleted file]
gen/pause-fbsd.c.orig [deleted file]
gen/pause.3 [deleted symlink]
gen/platfunc.c
gen/popen-fbsd.c [deleted file]
gen/popen.3 [deleted file]
gen/pselect-fbsd.c [deleted file]
gen/pselect.3 [deleted file]
gen/psignal-fbsd.c [deleted symlink]
gen/psignal.3 [deleted file]
gen/raise-fbsd.c [deleted symlink]
gen/raise.3 [deleted symlink]
gen/rand48.3 [deleted file]
gen/rand48.h [deleted file]
gen/readdir-fbsd.c [deleted file]
gen/readpassphrase-fbsd.c [deleted file]
gen/readpassphrase.3 [deleted symlink]
gen/rewinddir-fbsd.c [deleted symlink]
gen/scandir-fbsd.c [deleted file]
gen/scandir.3 [deleted file]
gen/scandir_b-fbsd.c [deleted file]
gen/seed48-fbsd.c [deleted file]
gen/seekdir-fbsd.c [deleted symlink]
gen/sethostname-fbsd.c [deleted symlink]
gen/setmode-fbsd.c [deleted file]
gen/setmode.3 [deleted symlink]
gen/setprogname-fbsd.c [deleted file]
gen/siginterrupt-fbsd.c [deleted symlink]
gen/siginterrupt.3 [deleted file]
gen/siglist-fbsd.c [deleted file]
gen/signal-fbsd.c [deleted file]
gen/signal.3 [deleted file]
gen/signbit.3 [deleted file]
gen/sleep-fbsd.c [deleted file]
gen/sleep.3 [deleted file]
gen/srand48-fbsd.c [deleted file]
gen/stack_logging.c
gen/stack_logging.h
gen/stack_logging_disk.c
gen/stringlist-fbsd.c [deleted symlink]
gen/stringlist.3 [deleted symlink]
gen/sync_volume_np.3 [new file with mode: 0644]
gen/sync_volume_np.c [new file with mode: 0644]
gen/sysconf-fbsd.c [deleted file]
gen/sysconf.3 [deleted symlink]
gen/sysctl-fbsd.c [deleted file]
gen/sysctl.3 [deleted file]
gen/sysctlbyname-fbsd.c [deleted symlink]
gen/sysctlnametomib-fbsd.c [deleted symlink]
gen/telldir-fbsd.c [deleted file]
gen/telldir.h [deleted file]
gen/termios-fbsd.c [deleted file]
gen/thread_stack_pcs.c
gen/time-fbsd.c [deleted file]
gen/time.3 [deleted file]
gen/times-fbsd.c [deleted symlink]
gen/times.3 [deleted file]
gen/timezone-fbsd.c [deleted symlink]
gen/timezone.3 [deleted symlink]
gen/ttyname-fbsd.c [deleted file]
gen/ttyname.3 [deleted file]
gen/ttyslot-fbsd.c [deleted symlink]
gen/ualarm-fbsd.c [deleted symlink]
gen/ualarm.3 [deleted file]
gen/ucontext.3 [deleted symlink]
gen/ulimit-fbsd.c [deleted symlink]
gen/ulimit.3 [deleted file]
gen/unvis-fbsd.c [deleted file]
gen/unvis.3 [deleted symlink]
gen/usleep-fbsd.c [deleted file]
gen/usleep.3 [deleted file]
gen/utime-fbsd.c [deleted symlink]
gen/utime.3 [deleted file]
gen/utmpx-nbsd.c [deleted file]
gen/utmpx.5 [deleted file]
gen/vis-fbsd.c [deleted file]
gen/vis.3 [deleted symlink]
gen/wait-fbsd.c [deleted file]
gen/wait3-fbsd.c [deleted symlink]
gen/waitpid-fbsd.c [deleted file]
gen/zone.c [deleted file]
gmon/Makefile.inc [deleted file]
gmon/gmon.c
i386/gen/Makefile.inc [deleted file]
i386/pthreads/Makefile.inc [deleted file]
i386/pthreads/get_cpu_capabilities.s [deleted file]
i386/pthreads/pthread_mutex_lock.s
i386/stdlib/gdtoa.mk [deleted file]
i386/string/Makefile.inc [deleted file]
i386/sys/Makefile.inc [deleted file]
i386/sys/OSAtomic.s
include/FreeBSD/nl_types.h
include/FreeBSD/nl_types.h.patch [deleted file]
include/Makefile.inc [deleted file]
include/NetBSD/utmpx.h
include/NetBSD/utmpx.h.patch [deleted file]
include/arpa/Makefile.inc [deleted file]
include/asl.h
include/dirent.h
include/err.h
include/grp.h [deleted file]
include/inttypes.h
include/libkern/Makefile.inc [deleted file]
include/libkern/OSAtomic.h
include/libkern/OSMemoryNotification.h
include/libkern/OSThermalNotification.h
include/limits.h
include/malloc/Makefile.inc [deleted file]
include/nl_types.h [deleted file]
include/objc/Makefile.inc [deleted file]
include/objc/malloc.h [deleted file]
include/objc/zone.h [deleted file]
include/protocols/Makefile.inc [deleted file]
include/pwd.h [deleted file]
include/regex.h
include/secure/Makefile.inc [deleted file]
include/secure/_stdio.h
include/setjmp.h
include/spawn_private.h
include/stdio.h
include/stdlib.h
include/sys/Makefile.inc [deleted file]
include/sys/cdefs.h
include/unistd.h
include/utmpx.h [deleted file]
include/wchar.h
include/xlocale.h
include/xlocale/Makefile.inc [deleted file]
include/xlocale/_regex.h [new file with mode: 0644]
include/xlocale/_stdio.h
include/xlocale/_stdlib.h
include/xlocale/_wchar.h
internat/Makefile.inc [deleted file]
internat/NXCType.c [deleted file]
internat/NXCType.h [deleted file]
internat/NXIsAlNum.c [deleted file]
internat/NXIsAlpha.c [deleted file]
internat/NXIsAscii.c [deleted file]
internat/NXIsCntrl.c [deleted file]
internat/NXIsDigit.c [deleted file]
internat/NXIsGraph.c [deleted file]
internat/NXIsLower.c [deleted file]
internat/NXIsPrint.c [deleted file]
internat/NXIsPunct.c [deleted file]
internat/NXIsSpace.c [deleted file]
internat/NXIsUpper.c [deleted file]
internat/NXIsXDigit.c [deleted file]
internat/NXToAscii.c [deleted file]
internat/NXToLower.c [deleted file]
internat/NXToUpper.c [deleted file]
internat/_NXToLower.c [deleted file]
internat/_NXToUpper.c [deleted file]
interposable.list [deleted file]
locale/FreeBSD/ascii.c
locale/FreeBSD/ascii.c.patch [deleted file]
locale/FreeBSD/big5.c
locale/FreeBSD/big5.c.patch [deleted file]
locale/FreeBSD/btowc.3
locale/FreeBSD/btowc.3.patch [deleted file]
locale/FreeBSD/btowc.c
locale/FreeBSD/btowc.c.patch [deleted file]
locale/FreeBSD/collate.c
locale/FreeBSD/collate.c.patch [deleted file]
locale/FreeBSD/collate.h
locale/FreeBSD/collate.h.patch [deleted file]
locale/FreeBSD/collcmp.c
locale/FreeBSD/collcmp.c.patch [deleted file]
locale/FreeBSD/ctype.3
locale/FreeBSD/ctype.3.patch [deleted file]
locale/FreeBSD/digittoint.3
locale/FreeBSD/digittoint.3.patch [deleted file]
locale/FreeBSD/euc.c
locale/FreeBSD/euc.c.patch [deleted file]
locale/FreeBSD/fix_grouping.c
locale/FreeBSD/fix_grouping.c.patch [deleted file]
locale/FreeBSD/gb18030.c
locale/FreeBSD/gb18030.c.patch [deleted file]
locale/FreeBSD/gb2312.c
locale/FreeBSD/gb2312.c.patch [deleted file]
locale/FreeBSD/gbk.c
locale/FreeBSD/gbk.c.patch [deleted file]
locale/FreeBSD/isalnum.3
locale/FreeBSD/isalnum.3.patch [deleted file]
locale/FreeBSD/isalpha.3
locale/FreeBSD/isalpha.3.patch [deleted file]
locale/FreeBSD/isblank.3
locale/FreeBSD/isblank.3.patch [deleted file]
locale/FreeBSD/iscntrl.3
locale/FreeBSD/iscntrl.3.patch [deleted file]
locale/FreeBSD/isdigit.3
locale/FreeBSD/isdigit.3.patch [deleted file]
locale/FreeBSD/isgraph.3
locale/FreeBSD/isgraph.3.patch [deleted file]
locale/FreeBSD/isideogram.3
locale/FreeBSD/isideogram.3.patch [deleted file]
locale/FreeBSD/islower.3
locale/FreeBSD/islower.3.patch [deleted file]
locale/FreeBSD/isphonogram.3
locale/FreeBSD/isphonogram.3.patch [deleted file]
locale/FreeBSD/isprint.3
locale/FreeBSD/isprint.3.patch [deleted file]
locale/FreeBSD/ispunct.3
locale/FreeBSD/ispunct.3.patch [deleted file]
locale/FreeBSD/isrune.3
locale/FreeBSD/isrune.3.patch [deleted file]
locale/FreeBSD/isspace.3
locale/FreeBSD/isspace.3.patch [deleted file]
locale/FreeBSD/isspecial.3
locale/FreeBSD/isspecial.3.patch [deleted file]
locale/FreeBSD/isupper.3
locale/FreeBSD/isupper.3.patch [deleted file]
locale/FreeBSD/iswalnum.3
locale/FreeBSD/iswalnum.3.patch [deleted file]
locale/FreeBSD/isxdigit.3
locale/FreeBSD/isxdigit.3.patch [deleted file]
locale/FreeBSD/ldpart.c
locale/FreeBSD/ldpart.c.patch [deleted file]
locale/FreeBSD/ldpart.h
locale/FreeBSD/ldpart.h.patch [deleted file]
locale/FreeBSD/lmessages.c
locale/FreeBSD/lmessages.c.patch [deleted file]
locale/FreeBSD/lmessages.h
locale/FreeBSD/lmessages.h.patch [deleted file]
locale/FreeBSD/lmonetary.c
locale/FreeBSD/lmonetary.c.patch [deleted file]
locale/FreeBSD/lmonetary.h
locale/FreeBSD/lmonetary.h.patch [deleted file]
locale/FreeBSD/lnumeric.c
locale/FreeBSD/lnumeric.c.patch [deleted file]
locale/FreeBSD/lnumeric.h
locale/FreeBSD/lnumeric.h.patch [deleted file]
locale/FreeBSD/localeconv.3
locale/FreeBSD/localeconv.3.patch [deleted file]
locale/FreeBSD/localeconv.c
locale/FreeBSD/localeconv.c.patch [deleted file]
locale/FreeBSD/mblen.3
locale/FreeBSD/mblen.3.patch [deleted file]
locale/FreeBSD/mblen.c
locale/FreeBSD/mblen.c.patch [deleted file]
locale/FreeBSD/mblocal.h
locale/FreeBSD/mblocal.h.patch [deleted file]
locale/FreeBSD/mbrlen.3
locale/FreeBSD/mbrlen.3.patch [deleted file]
locale/FreeBSD/mbrlen.c
locale/FreeBSD/mbrlen.c.patch [deleted file]
locale/FreeBSD/mbrtowc.3
locale/FreeBSD/mbrtowc.3.patch [deleted file]
locale/FreeBSD/mbrtowc.c
locale/FreeBSD/mbrtowc.c.patch [deleted file]
locale/FreeBSD/mbsinit.3
locale/FreeBSD/mbsinit.3.patch [deleted file]
locale/FreeBSD/mbsinit.c
locale/FreeBSD/mbsinit.c.patch [deleted file]
locale/FreeBSD/mbsnrtowcs.c
locale/FreeBSD/mbsnrtowcs.c.patch [deleted file]
locale/FreeBSD/mbsrtowcs.3
locale/FreeBSD/mbsrtowcs.3.patch [deleted file]
locale/FreeBSD/mbsrtowcs.c
locale/FreeBSD/mbsrtowcs.c.patch [deleted file]
locale/FreeBSD/mbstowcs.3
locale/FreeBSD/mbstowcs.3.patch [deleted file]
locale/FreeBSD/mbstowcs.c
locale/FreeBSD/mbstowcs.c.patch [deleted file]
locale/FreeBSD/mbtowc.3
locale/FreeBSD/mbtowc.3.patch [deleted file]
locale/FreeBSD/mbtowc.c
locale/FreeBSD/mbtowc.c.patch [deleted file]
locale/FreeBSD/mskanji.c
locale/FreeBSD/mskanji.c.patch [deleted file]
locale/FreeBSD/nextwctype.3
locale/FreeBSD/nextwctype.3.patch [deleted file]
locale/FreeBSD/nextwctype.c
locale/FreeBSD/nextwctype.c.patch [deleted file]
locale/FreeBSD/nl_langinfo.3
locale/FreeBSD/nl_langinfo.3.patch [deleted file]
locale/FreeBSD/nl_langinfo.c
locale/FreeBSD/nl_langinfo.c.patch [deleted file]
locale/FreeBSD/none.c
locale/FreeBSD/none.c.patch [deleted file]
locale/FreeBSD/rune.c
locale/FreeBSD/rune.c.patch [deleted file]
locale/FreeBSD/rune32.h [new file with mode: 0644]
locale/FreeBSD/runetype.c
locale/FreeBSD/runetype.c.patch [deleted file]
locale/FreeBSD/setlocale.3
locale/FreeBSD/setlocale.3.patch [deleted file]
locale/FreeBSD/setlocale.c
locale/FreeBSD/setlocale.c.patch [deleted file]
locale/FreeBSD/setlocale.h
locale/FreeBSD/setlocale.h.patch [deleted file]
locale/FreeBSD/setrunelocale.c
locale/FreeBSD/setrunelocale.c.patch [deleted file]
locale/FreeBSD/table.c
locale/FreeBSD/table.c.patch [deleted file]
locale/FreeBSD/tolower.3
locale/FreeBSD/tolower.3.patch [deleted file]
locale/FreeBSD/tolower.c
locale/FreeBSD/tolower.c.patch [deleted file]
locale/FreeBSD/toupper.3
locale/FreeBSD/toupper.3.patch [deleted file]
locale/FreeBSD/toupper.c
locale/FreeBSD/toupper.c.patch [deleted file]
locale/FreeBSD/towlower.3
locale/FreeBSD/towlower.3.patch [deleted file]
locale/FreeBSD/towupper.3
locale/FreeBSD/towupper.3.patch [deleted file]
locale/FreeBSD/utf2.c [new file with mode: 0644]
locale/FreeBSD/utf2.c.patch [deleted file]
locale/FreeBSD/utf8.c
locale/FreeBSD/utf8.c.patch [deleted file]
locale/FreeBSD/wcrtomb.3
locale/FreeBSD/wcrtomb.3.patch [deleted file]
locale/FreeBSD/wcrtomb.c
locale/FreeBSD/wcrtomb.c.patch [deleted file]
locale/FreeBSD/wcsftime.3
locale/FreeBSD/wcsftime.3.patch [deleted file]
locale/FreeBSD/wcsftime.c
locale/FreeBSD/wcsftime.c.patch [deleted file]
locale/FreeBSD/wcsnrtombs.c
locale/FreeBSD/wcsnrtombs.c.patch [deleted file]
locale/FreeBSD/wcsrtombs.3
locale/FreeBSD/wcsrtombs.3.patch [deleted file]
locale/FreeBSD/wcsrtombs.c
locale/FreeBSD/wcsrtombs.c.patch [deleted file]
locale/FreeBSD/wcstod.3
locale/FreeBSD/wcstod.3.patch [deleted file]
locale/FreeBSD/wcstod.c
locale/FreeBSD/wcstod.c.patch [deleted file]
locale/FreeBSD/wcstof.c
locale/FreeBSD/wcstof.c.patch [deleted file]
locale/FreeBSD/wcstoimax.c
locale/FreeBSD/wcstoimax.c.patch [deleted file]
locale/FreeBSD/wcstol.3
locale/FreeBSD/wcstol.3.patch [deleted file]
locale/FreeBSD/wcstol.c
locale/FreeBSD/wcstol.c.patch [deleted file]
locale/FreeBSD/wcstold.c
locale/FreeBSD/wcstold.c.patch [deleted file]
locale/FreeBSD/wcstoll.c
locale/FreeBSD/wcstoll.c.patch [deleted file]
locale/FreeBSD/wcstombs.3
locale/FreeBSD/wcstombs.3.patch [deleted file]
locale/FreeBSD/wcstombs.c
locale/FreeBSD/wcstombs.c.patch [deleted file]
locale/FreeBSD/wcstoul.c
locale/FreeBSD/wcstoul.c.patch [deleted file]
locale/FreeBSD/wcstoull.c
locale/FreeBSD/wcstoull.c.patch [deleted file]
locale/FreeBSD/wcstoumax.c
locale/FreeBSD/wcstoumax.c.patch [deleted file]
locale/FreeBSD/wctob.c
locale/FreeBSD/wctob.c.patch [deleted file]
locale/FreeBSD/wctomb.3
locale/FreeBSD/wctomb.3.patch [deleted file]
locale/FreeBSD/wctomb.c
locale/FreeBSD/wctomb.c.patch [deleted file]
locale/FreeBSD/wctrans.3
locale/FreeBSD/wctrans.3.patch [deleted file]
locale/FreeBSD/wctrans.c
locale/FreeBSD/wctrans.c.patch [deleted file]
locale/FreeBSD/wctype.3
locale/FreeBSD/wctype.3.patch [deleted file]
locale/FreeBSD/wctype.c
locale/FreeBSD/wctype.c.patch [deleted file]
locale/FreeBSD/wcwidth.3
locale/FreeBSD/wcwidth.3.patch [deleted file]
locale/FreeBSD/wcwidth.c
locale/FreeBSD/wcwidth.c.patch [deleted file]
locale/Makefile.inc [deleted file]
locale/ascii-fbsd.c [deleted file]
locale/big5-fbsd.c [deleted file]
locale/big5.5 [deleted symlink]
locale/btowc-fbsd.c [deleted file]
locale/btowc.3 [deleted file]
locale/collate-fbsd.c [deleted file]
locale/collate.h [deleted file]
locale/collcmp-fbsd.c [deleted file]
locale/ctype.3 [deleted file]
locale/digittoint.3 [deleted file]
locale/euc-fbsd.c [deleted file]
locale/euc.5 [deleted symlink]
locale/fix_grouping-fbsd.c [deleted file]
locale/gb18030-fbsd.c [deleted file]
locale/gb18030.5 [deleted symlink]
locale/gb2312-fbsd.c [deleted file]
locale/gb2312.5 [deleted symlink]
locale/gbk-fbsd.c [deleted file]
locale/gbk.5 [deleted symlink]
locale/isalnum.3 [deleted file]
locale/isalpha.3 [deleted file]
locale/isascii.3 [deleted symlink]
locale/isblank.3 [deleted file]
locale/iscntrl.3 [deleted file]
locale/isdigit.3 [deleted file]
locale/isgraph.3 [deleted file]
locale/isideogram.3 [deleted file]
locale/islower.3 [deleted file]
locale/isphonogram.3 [deleted file]
locale/isprint.3 [deleted file]
locale/ispunct.3 [deleted file]
locale/isrune.3 [deleted file]
locale/isspace.3 [deleted file]
locale/isspecial.3 [deleted file]
locale/isupper.3 [deleted file]
locale/iswalnum.3 [deleted file]
locale/isxdigit.3 [deleted file]
locale/ldpart-fbsd.c [deleted file]
locale/ldpart.h [deleted file]
locale/lmessages-fbsd.c [deleted file]
locale/lmessages.h [deleted file]
locale/lmonetary-fbsd.c [deleted file]
locale/lmonetary.h [deleted file]
locale/lnumeric-fbsd.c [deleted file]
locale/lnumeric.h [deleted file]
locale/localeconv-fbsd.c [deleted file]
locale/localeconv.3 [deleted file]
locale/mblen-fbsd.c [deleted file]
locale/mblen.3 [deleted file]
locale/mblocal.h [deleted file]
locale/mbrlen-fbsd.c [deleted file]
locale/mbrlen.3 [deleted file]
locale/mbrtowc-fbsd.c [deleted file]
locale/mbrtowc.3 [deleted file]
locale/mbsinit-fbsd.c [deleted file]
locale/mbsinit.3 [deleted file]
locale/mbsnrtowcs-fbsd.c [deleted file]
locale/mbsrtowcs-fbsd.c [deleted file]
locale/mbsrtowcs.3 [deleted file]
locale/mbstowcs-fbsd.c [deleted file]
locale/mbstowcs.3 [deleted file]
locale/mbtowc-fbsd.c [deleted file]
locale/mbtowc.3 [deleted file]
locale/mskanji-fbsd.c [deleted file]
locale/mskanji.5 [deleted symlink]
locale/multibyte.3 [deleted symlink]
locale/nextwctype-fbsd.c [deleted file]
locale/nextwctype.3 [deleted file]
locale/nl_langinfo-fbsd.c [deleted file]
locale/nl_langinfo.3 [deleted file]
locale/nomacros-fbsd.c [deleted symlink]
locale/none-fbsd.c [deleted file]
locale/rune-fbsd.c [deleted file]
locale/rune32.h [deleted file]
locale/runetype-fbsd.c [deleted file]
locale/setlocale-fbsd.c [deleted file]
locale/setlocale.3 [deleted file]
locale/setlocale.h [deleted file]
locale/setrunelocale-fbsd.c [deleted file]
locale/table-fbsd.c [deleted file]
locale/toascii.3 [deleted symlink]
locale/tolower-fbsd.c [deleted file]
locale/tolower.3 [deleted file]
locale/toupper-fbsd.c [deleted file]
locale/toupper.3 [deleted file]
locale/towlower.3 [deleted file]
locale/towupper.3 [deleted file]
locale/utf2-fbsd.c [deleted file]
locale/utf8-fbsd.c [deleted file]
locale/utf8.5 [deleted symlink]
locale/wcrtomb-fbsd.c [deleted file]
locale/wcrtomb.3 [deleted file]
locale/wcsftime-fbsd.c [deleted file]
locale/wcsftime.3 [deleted file]
locale/wcsnrtombs-fbsd.c [deleted file]
locale/wcsrtombs-fbsd.c [deleted file]
locale/wcsrtombs.3 [deleted file]
locale/wcstod-fbsd.c [deleted file]
locale/wcstod.3 [deleted file]
locale/wcstof-fbsd.c [deleted file]
locale/wcstoimax-fbsd.c [deleted file]
locale/wcstol-fbsd.c [deleted file]
locale/wcstol.3 [deleted file]
locale/wcstold-fbsd.c [deleted file]
locale/wcstoll-fbsd.c [deleted file]
locale/wcstombs-fbsd.c [deleted file]
locale/wcstombs.3 [deleted file]
locale/wcstoul-fbsd.c [deleted file]
locale/wcstoull-fbsd.c [deleted file]
locale/wcstoumax-fbsd.c [deleted file]
locale/wctob-fbsd.c [deleted file]
locale/wctomb-fbsd.c [deleted file]
locale/wctomb.3 [deleted file]
locale/wctrans-fbsd.c [deleted file]
locale/wctrans.3 [deleted file]
locale/wctype-fbsd.c [deleted file]
locale/wctype.3 [deleted file]
locale/wcwidth-fbsd.c [deleted file]
locale/wcwidth.3 [deleted file]
locale/xlocale.c
makeCombos [deleted file]
man/FreeBSD/stdarg.3
man/FreeBSD/stdarg.3.patch [deleted file]
man/Makefile.inc [deleted file]
man/manpages.lst [new file with mode: 0644]
man/stdarg.3 [deleted file]
net/FreeBSD/inet.3
net/FreeBSD/inet.3.patch [deleted file]
net/FreeBSD/inet_addr.c
net/FreeBSD/inet_addr.c.patch [deleted file]
net/FreeBSD/inet_net.3
net/FreeBSD/inet_net.3.patch [deleted file]
net/FreeBSD/inet_net_pton.c
net/FreeBSD/inet_net_pton.c.patch [deleted file]
net/FreeBSD/inet_network.c
net/FreeBSD/inet_network.c.patch [deleted file]
net/FreeBSD/inet_ntoa.c
net/FreeBSD/inet_ntoa.c.patch [deleted file]
net/FreeBSD/nsap_addr.c
net/FreeBSD/nsap_addr.c.patch [deleted file]
net/FreeBSD/recv.c
net/FreeBSD/recv.c.patch [deleted file]
net/FreeBSD/send.c
net/FreeBSD/send.c.patch [deleted file]
net/FreeBSD/sockatmark.3
net/FreeBSD/sockatmark.3.patch [deleted file]
net/FreeBSD/sourcefilter.3
net/FreeBSD/sourcefilter.3.patch [deleted file]
net/FreeBSD/sourcefilter.c
net/FreeBSD/sourcefilter.c.patch [deleted file]
net/Makefile.inc [deleted file]
net/addr2ascii-fbsd.c [deleted symlink]
net/addr2ascii.3 [deleted symlink]
net/ascii2addr-fbsd.c [deleted symlink]
net/inet.3 [deleted file]
net/inet_addr-fbsd.c [deleted file]
net/inet_lnaof-fbsd.c [deleted symlink]
net/inet_makeaddr-fbsd.c [deleted symlink]
net/inet_net.3 [deleted file]
net/inet_net_ntop-fbsd.c [deleted symlink]
net/inet_net_pton-fbsd.c [deleted file]
net/inet_neta-fbsd.c [deleted symlink]
net/inet_netof-fbsd.c [deleted symlink]
net/inet_network-fbsd.c [deleted file]
net/inet_ntoa-fbsd.c [deleted file]
net/linkaddr-fbsd.c [deleted symlink]
net/linkaddr.3 [deleted symlink]
net/nsap_addr-fbsd.c [deleted file]
net/recv-fbsd.c [deleted file]
net/send-fbsd.c [deleted file]
net/sockatmark-fbsd.c [deleted symlink]
net/sockatmark.3 [deleted file]
net/sourcefilter-fbsd.c [deleted file]
net/sourcefilter.3 [deleted file]
nls/FreeBSD/msgcat.c
nls/FreeBSD/msgcat.c.patch [deleted file]
nls/FreeBSD/msgcat.h
nls/FreeBSD/msgcat.h.patch [deleted file]
nls/Makefile.inc [deleted file]
nls/catclose.3 [deleted symlink]
nls/catgets.3 [deleted symlink]
nls/catopen.3 [deleted symlink]
nls/msgcat-fbsd.c [deleted file]
nls/msgcat.h [deleted file]
patchHeaders [deleted file]
posix1e/Makefile.inc [deleted file]
posix1e/acl_translate.c
ppc/gen/Makefile.inc [deleted file]
ppc/gen/_ctx_start.S [deleted file]
ppc/gen/_setcontext.S [deleted file]
ppc/gen/abs.s [deleted file]
ppc/gen/assymdefs.c [deleted file]
ppc/gen/fp.h [deleted file]
ppc/gen/genassym.c [deleted file]
ppc/gen/genassym.h [deleted file]
ppc/gen/getcontext.S [deleted file]
ppc/gen/getmcontext.c [deleted file]
ppc/gen/icacheinval.s [deleted file]
ppc/gen/makecontext.c [deleted file]
ppc/gen/mcount.s [deleted file]
ppc/gen/setcontext.c [deleted file]
ppc/gen/setjmperr.c [deleted file]
ppc/gen/swapcontext.c [deleted file]
ppc/pthreads/Makefile.inc [deleted file]
ppc/pthreads/get_cpu_capabilities.s [deleted file]
ppc/pthreads/init_cpu_capabilities.c [deleted file]
ppc/pthreads/pthread_getspecific.s [deleted file]
ppc/pthreads/pthread_self.s [deleted file]
ppc/pthreads/pthread_set_self.s [deleted file]
ppc/stdlib/gdtoa.mk [deleted file]
ppc/string/Makefile.inc [deleted file]
ppc/string/bcopy.s [deleted file]
ppc/string/bzero.s [deleted file]
ppc/string/ffs.s [deleted file]
ppc/string/ffsl.s [deleted file]
ppc/string/fls.s [deleted file]
ppc/string/flsl.s [deleted file]
ppc/string/memcmp.s [deleted file]
ppc/string/memset.s [deleted file]
ppc/string/strcat.s [deleted file]
ppc/string/strcmp.s [deleted file]
ppc/string/strcpy.s [deleted file]
ppc/string/strlcat.s [deleted file]
ppc/string/strlcpy.s [deleted file]
ppc/string/strlen.s [deleted file]
ppc/string/strncat.s [deleted file]
ppc/string/strncmp.s [deleted file]
ppc/string/strncpy.s [deleted file]
ppc/sys/Makefile.inc [deleted file]
ppc/sys/OSAtomic.s [deleted file]
ppc/sys/_longjmp.s [deleted file]
ppc/sys/_setjmp.h [deleted file]
ppc/sys/_setjmp.s [deleted file]
ppc/sys/_sigtramp.s [deleted file]
ppc/sys/ldbl64.s [deleted file]
ppc/sys/longjmp.s [deleted file]
ppc/sys/ppc_gettimeofday.s [deleted file]
ppc/sys/setjmp.s [deleted file]
ppc64/gen/Makefile.inc [deleted file]
ppc64/pthreads/Makefile.inc [deleted file]
ppc64/pthreads/pthread_getspecific_64.s [deleted file]
ppc64/pthreads/pthread_self_64.s [deleted file]
ppc64/pthreads/pthread_set_self_64.s [deleted file]
ppc64/stdlib/gdtoa.mk [deleted file]
ppc64/string/Makefile.inc [deleted file]
ppc64/sys/Makefile.inc [deleted file]
pthreads/Makefile.inc [deleted file]
pthreads/plockstat.d
pthreads/pthread.c
pthreads/pthread_cancelable.c
pthreads/pthread_cond.c
pthreads/pthread_internals.h
pthreads/pthread_machdep.h
pthreads/pthread_mutex.c
pthreads/pthread_rwlock.c
pthreads/pthread_workqueue.h
pthreads/thread_setup.c
regex/FreeBSD/cclass.h [deleted file]
regex/FreeBSD/cname.h
regex/FreeBSD/cname.h.patch [deleted file]
regex/FreeBSD/engine.c [deleted file]
regex/FreeBSD/engine.c.patch [deleted file]
regex/FreeBSD/re_format.7
regex/FreeBSD/regcomp.c [deleted file]
regex/FreeBSD/regcomp.c.patch [deleted file]
regex/FreeBSD/regerror.c
regex/FreeBSD/regerror.c.patch [deleted file]
regex/FreeBSD/regex.3
regex/FreeBSD/regex.3.patch [deleted file]
regex/FreeBSD/regex2.h [deleted file]
regex/FreeBSD/regex2.h.patch [deleted file]
regex/FreeBSD/regexec.c [deleted file]
regex/FreeBSD/regexec.c.patch [deleted file]
regex/FreeBSD/regfree.c [deleted file]
regex/FreeBSD/regfree.c.patch [deleted file]
regex/Makefile.inc [deleted file]
regex/TRE/config.h [new file with mode: 0644]
regex/TRE/lib/regcomp.c [new file with mode: 0644]
regex/TRE/lib/regexec.c [new file with mode: 0644]
regex/TRE/lib/tre-ast.c [new file with mode: 0644]
regex/TRE/lib/tre-ast.h [new file with mode: 0644]
regex/TRE/lib/tre-compile.c [new file with mode: 0644]
regex/TRE/lib/tre-compile.h [new file with mode: 0644]
regex/TRE/lib/tre-internal.h [new file with mode: 0644]
regex/TRE/lib/tre-match-backtrack.c [new file with mode: 0644]
regex/TRE/lib/tre-match-parallel.c [new file with mode: 0644]
regex/TRE/lib/tre-match-utils.h [new file with mode: 0644]
regex/TRE/lib/tre-mem.c [new file with mode: 0644]
regex/TRE/lib/tre-mem.h [new file with mode: 0644]
regex/TRE/lib/tre-parse.c [new file with mode: 0644]
regex/TRE/lib/tre-parse.h [new file with mode: 0644]
regex/TRE/lib/tre-stack.c [new file with mode: 0644]
regex/TRE/lib/tre-stack.h [new file with mode: 0644]
regex/TRE/lib/tre.h [new file with mode: 0644]
regex/TRE/lib/xmalloc.h [new file with mode: 0644]
regex/TRE/tre-0.8.0.tar.bz2 [new file with mode: 0644]
regex/TRE/tre-config.h [new file with mode: 0644]
regex/TRE/tre-last-matched.h [new file with mode: 0644]
regex/cclass.h [deleted symlink]
regex/cname.h [deleted file]
regex/cname.h.orig [deleted file]
regex/engine.c [deleted file]
regex/re_format.7 [deleted symlink]
regex/regcomp-fbsd.c [deleted file]
regex/regerror-fbsd.c [deleted file]
regex/regerror-fbsd.c.orig [deleted file]
regex/regex.3 [deleted file]
regex/regex2.h [deleted file]
regex/regexec-fbsd.c [deleted file]
regex/regfree-fbsd.c [deleted file]
regex/utils.h [deleted symlink]
rpc/Makefile.inc [deleted file]
secure/Makefile.inc [deleted file]
secure/snprintf_chk.c
secure/sprintf_chk.c
secure/vsnprintf_chk.c
secure/vsprintf_chk.c
stdio/FreeBSD/asprintf.c
stdio/FreeBSD/asprintf.c.patch [deleted file]
stdio/FreeBSD/dprintf.c
stdio/FreeBSD/dprintf.c.patch [deleted file]
stdio/FreeBSD/fclose.c
stdio/FreeBSD/fclose.c.patch [deleted file]
stdio/FreeBSD/fdopen.c
stdio/FreeBSD/fdopen.c.patch [deleted file]
stdio/FreeBSD/fflush.c
stdio/FreeBSD/fflush.c.patch [deleted file]
stdio/FreeBSD/fgetln.3
stdio/FreeBSD/fgetln.3.patch [deleted file]
stdio/FreeBSD/fgetln.c
stdio/FreeBSD/fgetln.c.patch [deleted file]
stdio/FreeBSD/fgetwc.c
stdio/FreeBSD/fgetwc.c.patch [deleted file]
stdio/FreeBSD/fgetwln.3
stdio/FreeBSD/fgetwln.3.patch [deleted file]
stdio/FreeBSD/fgetwln.c
stdio/FreeBSD/fgetwln.c.patch [deleted file]
stdio/FreeBSD/fgetws.3
stdio/FreeBSD/fgetws.3.patch [deleted file]
stdio/FreeBSD/fgetws.c
stdio/FreeBSD/fgetws.c.patch [deleted file]
stdio/FreeBSD/findfp.c
stdio/FreeBSD/findfp.c.patch [deleted file]
stdio/FreeBSD/flags.c
stdio/FreeBSD/flags.c.patch [deleted file]
stdio/FreeBSD/flockfile.3
stdio/FreeBSD/flockfile.3.patch [deleted file]
stdio/FreeBSD/fopen.3
stdio/FreeBSD/fopen.3.patch [deleted file]
stdio/FreeBSD/fopen.c
stdio/FreeBSD/fopen.c.patch [deleted file]
stdio/FreeBSD/fprintf.c
stdio/FreeBSD/fprintf.c.patch [deleted file]
stdio/FreeBSD/fputs.3
stdio/FreeBSD/fputs.3.patch [deleted file]
stdio/FreeBSD/fputs.c
stdio/FreeBSD/fputs.c.patch [deleted file]
stdio/FreeBSD/fputwc.c
stdio/FreeBSD/fputwc.c.patch [deleted file]
stdio/FreeBSD/fputws.3
stdio/FreeBSD/fputws.3.patch [deleted file]
stdio/FreeBSD/fputws.c
stdio/FreeBSD/fputws.c.patch [deleted file]
stdio/FreeBSD/fread.3
stdio/FreeBSD/fread.3.patch [deleted file]
stdio/FreeBSD/fread.c
stdio/FreeBSD/fread.c.patch [deleted file]
stdio/FreeBSD/freopen.c
stdio/FreeBSD/freopen.c.patch [deleted file]
stdio/FreeBSD/fscanf.c
stdio/FreeBSD/fscanf.c.patch [deleted file]
stdio/FreeBSD/fseek.3
stdio/FreeBSD/fseek.3.patch [deleted file]
stdio/FreeBSD/ftell.c
stdio/FreeBSD/ftell.c.patch [deleted file]
stdio/FreeBSD/funopen.c
stdio/FreeBSD/funopen.c.patch [deleted file]
stdio/FreeBSD/fwide.3
stdio/FreeBSD/fwide.3.patch [deleted file]
stdio/FreeBSD/fwprintf.c
stdio/FreeBSD/fwprintf.c.patch [deleted file]
stdio/FreeBSD/fwrite.c
stdio/FreeBSD/fwrite.c.patch [deleted file]
stdio/FreeBSD/fwscanf.c
stdio/FreeBSD/fwscanf.c.patch [deleted file]
stdio/FreeBSD/getc.3
stdio/FreeBSD/getc.3.patch [deleted file]
stdio/FreeBSD/getline.3
stdio/FreeBSD/getline.3.patch [deleted file]
stdio/FreeBSD/getwc.3
stdio/FreeBSD/getwc.3.patch [deleted file]
stdio/FreeBSD/getwc.c
stdio/FreeBSD/getwc.c.patch [deleted file]
stdio/FreeBSD/getwchar.c
stdio/FreeBSD/getwchar.c.patch [deleted file]
stdio/FreeBSD/local.h
stdio/FreeBSD/local.h.patch [deleted file]
stdio/FreeBSD/makebuf.c
stdio/FreeBSD/makebuf.c.patch [deleted file]
stdio/FreeBSD/mktemp.3
stdio/FreeBSD/mktemp.3.patch [deleted file]
stdio/FreeBSD/mktemp.c
stdio/FreeBSD/mktemp.c.patch [deleted file]
stdio/FreeBSD/printf-pos.c
stdio/FreeBSD/printf-pos.c.patch [deleted file]
stdio/FreeBSD/printf.3
stdio/FreeBSD/printf.3.patch [deleted file]
stdio/FreeBSD/printf.c
stdio/FreeBSD/printf.c.patch [deleted file]
stdio/FreeBSD/printfcommon.h
stdio/FreeBSD/printfcommon.h.patch [deleted file]
stdio/FreeBSD/printflocal.h
stdio/FreeBSD/printflocal.h.patch [deleted file]
stdio/FreeBSD/putc.3
stdio/FreeBSD/putc.3.patch [deleted file]
stdio/FreeBSD/puts.c
stdio/FreeBSD/puts.c.patch [deleted file]
stdio/FreeBSD/putwc.3
stdio/FreeBSD/putwc.3.patch [deleted file]
stdio/FreeBSD/putwc.c
stdio/FreeBSD/putwc.c.patch [deleted file]
stdio/FreeBSD/putwchar.c
stdio/FreeBSD/putwchar.c.patch [deleted file]
stdio/FreeBSD/refill.c
stdio/FreeBSD/refill.c.patch [deleted file]
stdio/FreeBSD/remove.3
stdio/FreeBSD/remove.3.patch [deleted file]
stdio/FreeBSD/rewind.c
stdio/FreeBSD/rewind.c.patch [deleted file]
stdio/FreeBSD/scanf.3
stdio/FreeBSD/scanf.3.patch [deleted file]
stdio/FreeBSD/scanf.c
stdio/FreeBSD/scanf.c.patch [deleted file]
stdio/FreeBSD/setbuf.3
stdio/FreeBSD/setbuf.3.patch [deleted file]
stdio/FreeBSD/snprintf.c
stdio/FreeBSD/snprintf.c.patch [deleted file]
stdio/FreeBSD/sprintf.c
stdio/FreeBSD/sprintf.c.patch [deleted file]
stdio/FreeBSD/sscanf.c
stdio/FreeBSD/sscanf.c.patch [deleted file]
stdio/FreeBSD/stdio.3
stdio/FreeBSD/stdio.3.patch [deleted file]
stdio/FreeBSD/swprintf.c
stdio/FreeBSD/swprintf.c.patch [deleted file]
stdio/FreeBSD/swscanf.c
stdio/FreeBSD/swscanf.c.patch [deleted file]
stdio/FreeBSD/tempnam.c
stdio/FreeBSD/tempnam.c.patch [deleted file]
stdio/FreeBSD/tmpnam.3
stdio/FreeBSD/tmpnam.3.patch [deleted file]
stdio/FreeBSD/tmpnam.c
stdio/FreeBSD/tmpnam.c.patch [deleted file]
stdio/FreeBSD/ungetc.3
stdio/FreeBSD/ungetc.3.patch [deleted file]
stdio/FreeBSD/ungetwc.3
stdio/FreeBSD/ungetwc.3.patch [deleted file]
stdio/FreeBSD/ungetwc.c
stdio/FreeBSD/ungetwc.c.patch [deleted file]
stdio/FreeBSD/vasprintf.c
stdio/FreeBSD/vasprintf.c.patch [deleted file]
stdio/FreeBSD/vdprintf.c
stdio/FreeBSD/vdprintf.c.patch [deleted file]
stdio/FreeBSD/vfprintf.c
stdio/FreeBSD/vfprintf.c.patch [deleted file]
stdio/FreeBSD/vfscanf.c
stdio/FreeBSD/vfscanf.c.patch [deleted file]
stdio/FreeBSD/vfwprintf.c
stdio/FreeBSD/vfwprintf.c.patch [deleted file]
stdio/FreeBSD/vfwscanf.c
stdio/FreeBSD/vfwscanf.c.patch [deleted file]
stdio/FreeBSD/vprintf.c
stdio/FreeBSD/vprintf.c.patch [deleted file]
stdio/FreeBSD/vscanf.c
stdio/FreeBSD/vscanf.c.patch [deleted file]
stdio/FreeBSD/vsnprintf.c
stdio/FreeBSD/vsnprintf.c.patch [deleted file]
stdio/FreeBSD/vsprintf.c
stdio/FreeBSD/vsprintf.c.patch [deleted file]
stdio/FreeBSD/vsscanf.c
stdio/FreeBSD/vsscanf.c.patch [deleted file]
stdio/FreeBSD/vswprintf.c
stdio/FreeBSD/vswprintf.c.patch [deleted file]
stdio/FreeBSD/vswscanf.c
stdio/FreeBSD/vswscanf.c.patch [deleted file]
stdio/FreeBSD/vwprintf.c
stdio/FreeBSD/vwprintf.c.patch [deleted file]
stdio/FreeBSD/vwscanf.c
stdio/FreeBSD/vwscanf.c.patch [deleted file]
stdio/FreeBSD/wbuf.c
stdio/FreeBSD/wbuf.c.patch [deleted file]
stdio/FreeBSD/wprintf.3
stdio/FreeBSD/wprintf.3.patch [deleted file]
stdio/FreeBSD/wprintf.c
stdio/FreeBSD/wprintf.c.patch [deleted file]
stdio/FreeBSD/wscanf.3
stdio/FreeBSD/wscanf.3.patch [deleted file]
stdio/FreeBSD/wscanf.c
stdio/FreeBSD/wscanf.c.patch [deleted file]
stdio/Makefile.inc [deleted file]
stdio/_flock_stub-fbsd.c [deleted symlink]
stdio/asprintf-fbsd.c [deleted file]
stdio/clrerr-fbsd.c [deleted symlink]
stdio/dprintf-fbsd.c [deleted file]
stdio/fclose-fbsd.c [deleted file]
stdio/fclose.3 [deleted symlink]
stdio/fdopen-fbsd.c [deleted file]
stdio/feof-fbsd.c [deleted symlink]
stdio/ferror-fbsd.c [deleted symlink]
stdio/ferror.3 [deleted symlink]
stdio/fflush-fbsd.c [deleted file]
stdio/fflush.3 [deleted symlink]
stdio/fgetc-fbsd.c [deleted symlink]
stdio/fgetln-fbsd.c [deleted file]
stdio/fgetln.3 [deleted file]
stdio/fgetpos-fbsd.c [deleted symlink]
stdio/fgets-fbsd.c [deleted symlink]
stdio/fgets.3 [deleted symlink]
stdio/fgetwc-fbsd.c [deleted file]
stdio/fgetwln-fbsd.c [deleted file]
stdio/fgetwln.3 [deleted file]
stdio/fgetws-fbsd.c [deleted file]
stdio/fgetws.3 [deleted file]
stdio/fileno-fbsd.c [deleted symlink]
stdio/findfp-fbsd.c [deleted file]
stdio/flags-fbsd.c [deleted file]
stdio/floatio.h [deleted symlink]
stdio/flockfile.3 [deleted file]
stdio/fopen-fbsd.c [deleted file]
stdio/fopen.3 [deleted file]
stdio/fprintf-fbsd.c [deleted file]
stdio/fpurge-fbsd.c [deleted symlink]
stdio/fputc-fbsd.c [deleted symlink]
stdio/fputs-fbsd.c [deleted file]
stdio/fputs.3 [deleted file]
stdio/fputwc-fbsd.c [deleted file]
stdio/fputws-fbsd.c [deleted file]
stdio/fputws.3 [deleted file]
stdio/fread-fbsd.c [deleted file]
stdio/fread.3 [deleted file]
stdio/freopen-fbsd.c [deleted file]
stdio/fscanf-fbsd.c [deleted file]
stdio/fseek-fbsd.c [deleted symlink]
stdio/fseek.3 [deleted file]
stdio/fsetpos-fbsd.c [deleted symlink]
stdio/ftell-fbsd.c [deleted file]
stdio/funopen-fbsd.c [deleted file]
stdio/funopen.3 [deleted symlink]
stdio/fvwrite-fbsd.c [deleted symlink]
stdio/fvwrite.h [deleted symlink]
stdio/fwalk-fbsd.c [deleted symlink]
stdio/fwide-fbsd.c [deleted symlink]
stdio/fwide.3 [deleted file]
stdio/fwprintf-fbsd.c [deleted file]
stdio/fwrite-fbsd.c [deleted file]
stdio/fwscanf-fbsd.c [deleted file]
stdio/getc-fbsd.c [deleted symlink]
stdio/getc.3 [deleted file]
stdio/getchar-fbsd.c [deleted symlink]
stdio/getdelim-fbsd.c [deleted symlink]
stdio/getline-fbsd.c [deleted symlink]
stdio/getline.3 [deleted file]
stdio/gets-fbsd.c [deleted symlink]
stdio/getw-fbsd.c [deleted symlink]
stdio/getwc-fbsd.c [deleted file]
stdio/getwc.3 [deleted file]
stdio/getwchar-fbsd.c [deleted file]
stdio/glue.h [deleted symlink]
stdio/local.h [deleted file]
stdio/makebuf-fbsd.c [deleted file]
stdio/mktemp-fbsd.c [deleted file]
stdio/mktemp.3 [deleted file]
stdio/perror-fbsd.c [deleted symlink]
stdio/printf-fbsd.c [deleted file]
stdio/printf-pos-fbsd.c [deleted file]
stdio/printf.3 [deleted file]
stdio/printfcommon.h [deleted file]
stdio/printflocal.h [deleted file]
stdio/putc-fbsd.c [deleted symlink]
stdio/putc.3 [deleted file]
stdio/putchar-fbsd.c [deleted symlink]
stdio/puts-fbsd.c [deleted file]
stdio/putw-fbsd.c [deleted symlink]
stdio/putwc-fbsd.c [deleted file]
stdio/putwc.3 [deleted file]
stdio/putwchar-fbsd.c [deleted file]
stdio/refill-fbsd.c [deleted file]
stdio/remove-fbsd.c [deleted symlink]
stdio/remove.3 [deleted file]
stdio/rewind-fbsd.c [deleted file]
stdio/rget-fbsd.c [deleted symlink]
stdio/scanf-fbsd.c [deleted file]
stdio/scanf.3 [deleted file]
stdio/setbuf-fbsd.c [deleted symlink]
stdio/setbuf.3 [deleted file]
stdio/setbuffer-fbsd.c [deleted symlink]
stdio/setvbuf-fbsd.c [deleted symlink]
stdio/snprintf-fbsd.c [deleted file]
stdio/sprintf-fbsd.c [deleted file]
stdio/sscanf-fbsd.c [deleted file]
stdio/stdio-fbsd.c [deleted symlink]
stdio/stdio.3 [deleted file]
stdio/swprintf-fbsd.c [deleted file]
stdio/swscanf-fbsd.c [deleted file]
stdio/tempnam-fbsd.c [deleted file]
stdio/tmpfile-fbsd.c [deleted symlink]
stdio/tmpnam-fbsd.c [deleted file]
stdio/tmpnam.3 [deleted file]
stdio/ungetc-fbsd.c [deleted symlink]
stdio/ungetc.3 [deleted file]
stdio/ungetwc-fbsd.c [deleted file]
stdio/ungetwc.3 [deleted file]
stdio/vasprintf-fbsd.c [deleted file]
stdio/vdprintf-fbsd.c [deleted file]
stdio/vfprintf-fbsd.c [deleted file]
stdio/vfscanf-fbsd.c [deleted file]
stdio/vfwprintf-fbsd.c [deleted file]
stdio/vfwscanf-fbsd.c [deleted file]
stdio/vprintf-fbsd.c [deleted file]
stdio/vscanf-fbsd.c [deleted file]
stdio/vsnprintf-fbsd.c [deleted file]
stdio/vsprintf-fbsd.c [deleted file]
stdio/vsscanf-fbsd.c [deleted file]
stdio/vswprintf-fbsd.c [deleted file]
stdio/vswscanf-fbsd.c [deleted file]
stdio/vwprintf-fbsd.c [deleted file]
stdio/vwscanf-fbsd.c [deleted file]
stdio/wbuf-fbsd.c [deleted file]
stdio/wprintf-fbsd.c [deleted file]
stdio/wprintf.3 [deleted file]
stdio/wscanf-fbsd.c [deleted file]
stdio/wscanf.3 [deleted file]
stdio/wsetup-fbsd.c [deleted symlink]
stdlib/FreeBSD/abort.3
stdlib/FreeBSD/abort.3.patch [deleted file]
stdlib/FreeBSD/abort.c
stdlib/FreeBSD/abort.c.patch [deleted file]
stdlib/FreeBSD/abs.3
stdlib/FreeBSD/abs.3.patch [deleted file]
stdlib/FreeBSD/alloca.3
stdlib/FreeBSD/alloca.3.patch [deleted file]
stdlib/FreeBSD/atexit.3
stdlib/FreeBSD/atexit.3.patch [deleted file]
stdlib/FreeBSD/atexit.c
stdlib/FreeBSD/atexit.c.patch [deleted file]
stdlib/FreeBSD/atexit.h
stdlib/FreeBSD/atexit.h.patch [deleted file]
stdlib/FreeBSD/atof.3
stdlib/FreeBSD/atof.3.patch [deleted file]
stdlib/FreeBSD/atof.c
stdlib/FreeBSD/atof.c.patch [deleted file]
stdlib/FreeBSD/atoi.3
stdlib/FreeBSD/atoi.3.patch [deleted file]
stdlib/FreeBSD/atoi.c
stdlib/FreeBSD/atoi.c.patch [deleted file]
stdlib/FreeBSD/atol.3
stdlib/FreeBSD/atol.3.patch [deleted file]
stdlib/FreeBSD/atol.c
stdlib/FreeBSD/atol.c.patch [deleted file]
stdlib/FreeBSD/atoll.c
stdlib/FreeBSD/atoll.c.patch [deleted file]
stdlib/FreeBSD/bsearch.3
stdlib/FreeBSD/bsearch.3.patch [deleted file]
stdlib/FreeBSD/bsearch.c
stdlib/FreeBSD/bsearch.c.patch [deleted file]
stdlib/FreeBSD/div.3
stdlib/FreeBSD/div.3.patch [deleted file]
stdlib/FreeBSD/exit.c
stdlib/FreeBSD/exit.c.patch [deleted file]
stdlib/FreeBSD/getenv.3
stdlib/FreeBSD/getenv.3.patch [deleted file]
stdlib/FreeBSD/getenv.c
stdlib/FreeBSD/getenv.c.patch [deleted file]
stdlib/FreeBSD/getopt.c
stdlib/FreeBSD/getopt.c.patch [deleted file]
stdlib/FreeBSD/getsubopt.3
stdlib/FreeBSD/getsubopt.3.patch [deleted file]
stdlib/FreeBSD/heapsort_b.c [new file with mode: 0644]
stdlib/FreeBSD/heapsort_b.c.patch [deleted file]
stdlib/FreeBSD/heapsort_r.c [new file with mode: 0644]
stdlib/FreeBSD/heapsort_r.c.patch [deleted file]
stdlib/FreeBSD/imaxdiv.3
stdlib/FreeBSD/imaxdiv.3.patch [deleted file]
stdlib/FreeBSD/insque.3
stdlib/FreeBSD/insque.3.patch [deleted file]
stdlib/FreeBSD/labs.3
stdlib/FreeBSD/labs.3.patch [deleted file]
stdlib/FreeBSD/ldiv.3
stdlib/FreeBSD/ldiv.3.patch [deleted file]
stdlib/FreeBSD/llabs.3
stdlib/FreeBSD/llabs.3.patch [deleted file]
stdlib/FreeBSD/lldiv.3
stdlib/FreeBSD/lldiv.3.patch [deleted file]
stdlib/FreeBSD/lsearch.3
stdlib/FreeBSD/lsearch.3.patch [deleted file]
stdlib/FreeBSD/memory.3
stdlib/FreeBSD/memory.3.patch [deleted file]
stdlib/FreeBSD/merge.c
stdlib/FreeBSD/merge.c.patch [deleted file]
stdlib/FreeBSD/merge_b.c [new file with mode: 0644]
stdlib/FreeBSD/merge_b.c.patch [deleted file]
stdlib/FreeBSD/psort.3 [new file with mode: 0644]
stdlib/FreeBSD/psort.c [new file with mode: 0644]
stdlib/FreeBSD/psort_b.c [new symlink]
stdlib/FreeBSD/psort_r.c [new symlink]
stdlib/FreeBSD/putenv.c
stdlib/FreeBSD/putenv.c.patch [deleted file]
stdlib/FreeBSD/qsort.3
stdlib/FreeBSD/qsort.3.patch [deleted file]
stdlib/FreeBSD/qsort.c
stdlib/FreeBSD/qsort.c.patch [deleted file]
stdlib/FreeBSD/qsort_r.c.patch [deleted file]
stdlib/FreeBSD/radixsort.c
stdlib/FreeBSD/radixsort.c.patch [deleted file]
stdlib/FreeBSD/rand.3
stdlib/FreeBSD/rand.3.patch [deleted file]
stdlib/FreeBSD/random.3
stdlib/FreeBSD/random.3.patch [deleted file]
stdlib/FreeBSD/random.c
stdlib/FreeBSD/random.c.patch [deleted file]
stdlib/FreeBSD/realpath.3
stdlib/FreeBSD/realpath.3.patch [deleted file]
stdlib/FreeBSD/realpath.c
stdlib/FreeBSD/realpath.c.patch [deleted file]
stdlib/FreeBSD/setenv.c
stdlib/FreeBSD/setenv.c.patch [deleted file]
stdlib/FreeBSD/strhash.c
stdlib/FreeBSD/strhash.c.patch [deleted file]
stdlib/FreeBSD/strtod.3
stdlib/FreeBSD/strtod.3.patch [deleted file]
stdlib/FreeBSD/strtoimax.c
stdlib/FreeBSD/strtoimax.c.patch [deleted file]
stdlib/FreeBSD/strtol.3
stdlib/FreeBSD/strtol.3.patch [deleted file]
stdlib/FreeBSD/strtol.c
stdlib/FreeBSD/strtol.c.patch [deleted file]
stdlib/FreeBSD/strtoll.c
stdlib/FreeBSD/strtoll.c.patch [deleted file]
stdlib/FreeBSD/strtoq.c
stdlib/FreeBSD/strtoq.c.patch [deleted file]
stdlib/FreeBSD/strtoul.3
stdlib/FreeBSD/strtoul.3.patch [deleted file]
stdlib/FreeBSD/strtoul.c
stdlib/FreeBSD/strtoul.c.patch [deleted file]
stdlib/FreeBSD/strtoull.c
stdlib/FreeBSD/strtoull.c.patch [deleted file]
stdlib/FreeBSD/strtoumax.c
stdlib/FreeBSD/strtoumax.c.patch [deleted file]
stdlib/FreeBSD/strtouq.c
stdlib/FreeBSD/strtouq.c.patch [deleted file]
stdlib/FreeBSD/system.3
stdlib/FreeBSD/system.3.patch [deleted file]
stdlib/FreeBSD/system.c
stdlib/FreeBSD/system.c.patch [deleted file]
stdlib/FreeBSD/tsearch.3
stdlib/FreeBSD/tsearch.3.patch [deleted file]
stdlib/Makefile.inc [deleted file]
stdlib/NetBSD/strfmon.3
stdlib/NetBSD/strfmon.3.patch [deleted file]
stdlib/NetBSD/strfmon.c
stdlib/NetBSD/strfmon.c.patch [deleted file]
stdlib/OpenBSD/ecvt.3
stdlib/OpenBSD/ecvt.3.patch [deleted file]
stdlib/OpenBSD/ecvt.c
stdlib/OpenBSD/ecvt.c.patch [deleted file]
stdlib/OpenBSD/gcvt.c
stdlib/OpenBSD/gcvt.c.patch [deleted file]
stdlib/_Exit_-fbsd.c [deleted symlink]
stdlib/abort-fbsd.c [deleted file]
stdlib/abort.3 [deleted file]
stdlib/abs-fbsd.c [deleted symlink]
stdlib/abs.3 [deleted file]
stdlib/alloca.3 [deleted file]
stdlib/atexit-fbsd.c [deleted file]
stdlib/atexit.3 [deleted file]
stdlib/atexit.h [deleted file]
stdlib/atof-fbsd.c [deleted file]
stdlib/atof.3 [deleted file]
stdlib/atoi-fbsd.c [deleted file]
stdlib/atoi.3 [deleted file]
stdlib/atol-fbsd.c [deleted file]
stdlib/atol.3 [deleted file]
stdlib/atoll-fbsd.c [deleted file]
stdlib/bsearch-fbsd.c [deleted file]
stdlib/bsearch.3 [deleted file]
stdlib/div-fbsd.c [deleted symlink]
stdlib/div.3 [deleted file]
stdlib/ecvt-obsd.c [deleted file]
stdlib/ecvt.3 [deleted file]
stdlib/exit-fbsd.c [deleted file]
stdlib/exit.3 [deleted symlink]
stdlib/gcvt-obsd.c [deleted file]
stdlib/getenv-fbsd.c [deleted file]
stdlib/getenv.3 [deleted file]
stdlib/getopt-fbsd.c [deleted file]
stdlib/getopt.3 [deleted symlink]
stdlib/getopt_long-fbsd.c [deleted symlink]
stdlib/getopt_long.3 [deleted symlink]
stdlib/getsubopt-fbsd.c [deleted symlink]
stdlib/getsubopt.3 [deleted file]
stdlib/hcreate-fbsd.c [deleted symlink]
stdlib/hcreate.3 [deleted symlink]
stdlib/heapsort-fbsd.c [deleted symlink]
stdlib/heapsort_b-fbsd.c [deleted file]
stdlib/heapsort_r-fbsd.c [deleted file]
stdlib/imaxabs-fbsd.c [deleted symlink]
stdlib/imaxabs.3 [deleted symlink]
stdlib/imaxdiv-fbsd.c [deleted symlink]
stdlib/imaxdiv.3 [deleted file]
stdlib/insque-fbsd.c [deleted symlink]
stdlib/insque.3 [deleted file]
stdlib/labs-fbsd.c [deleted symlink]
stdlib/labs.3 [deleted file]
stdlib/ldiv-fbsd.c [deleted symlink]
stdlib/ldiv.3 [deleted file]
stdlib/llabs-fbsd.c [deleted symlink]
stdlib/llabs.3 [deleted file]
stdlib/lldiv-fbsd.c [deleted symlink]
stdlib/lldiv.3 [deleted file]
stdlib/lsearch-fbsd.c [deleted symlink]
stdlib/lsearch.3 [deleted file]
stdlib/memory.3 [deleted file]
stdlib/merge-fbsd.c [deleted file]
stdlib/merge_b-fbsd.c [deleted file]
stdlib/psort-fbsd.c [deleted file]
stdlib/psort.3 [deleted file]
stdlib/psort.3.patch [deleted file]
stdlib/psort.c.patch [deleted file]
stdlib/psort_b-fbsd.c [deleted file]
stdlib/psort_r-fbsd.c [deleted file]
stdlib/putenv-fbsd.c [deleted file]
stdlib/qsort-fbsd.c [deleted file]
stdlib/qsort.3 [deleted file]
stdlib/qsort_b-fbsd.c
stdlib/qsort_r-fbsd.c [deleted file]
stdlib/radixsort-fbsd.c [deleted file]
stdlib/radixsort.3 [deleted symlink]
stdlib/rand-fbsd.c [deleted symlink]
stdlib/rand.3 [deleted file]
stdlib/random-fbsd.c [deleted file]
stdlib/random.3 [deleted file]
stdlib/reallocf-fbsd.c [deleted symlink]
stdlib/realpath-fbsd.c [deleted file]
stdlib/realpath.3 [deleted file]
stdlib/remque-fbsd.c [deleted symlink]
stdlib/setenv-fbsd.c [deleted file]
stdlib/strfmon-nbsd.c [deleted file]
stdlib/strfmon.3 [deleted file]
stdlib/strhash-fbsd.c [deleted file]
stdlib/strtod.3 [deleted file]
stdlib/strtoimax-fbsd.c [deleted file]
stdlib/strtol-fbsd.c [deleted file]
stdlib/strtol.3 [deleted file]
stdlib/strtoll-fbsd.c [deleted file]
stdlib/strtoq-fbsd.c [deleted file]
stdlib/strtoul-fbsd.c [deleted file]
stdlib/strtoul.3 [deleted file]
stdlib/strtoull-fbsd.c [deleted file]
stdlib/strtoumax-fbsd.c [deleted file]
stdlib/strtouq-fbsd.c [deleted file]
stdlib/system-fbsd.c [deleted file]
stdlib/system.3 [deleted file]
stdlib/tdelete-fbsd.c [deleted symlink]
stdlib/tfind-fbsd.c [deleted symlink]
stdlib/tsearch-fbsd.c [deleted symlink]
stdlib/tsearch.3 [deleted file]
stdlib/twalk-fbsd.c [deleted symlink]
stdtime/FreeBSD/asctime.c
stdtime/FreeBSD/asctime.c.patch [deleted file]
stdtime/FreeBSD/ctime.3
stdtime/FreeBSD/ctime.3.patch [deleted file]
stdtime/FreeBSD/ftime.3
stdtime/FreeBSD/ftime.3.patch [deleted file]
stdtime/FreeBSD/localtime.c
stdtime/FreeBSD/localtime.c.patch [deleted file]
stdtime/FreeBSD/strftime.3
stdtime/FreeBSD/strftime.3.patch [deleted file]
stdtime/FreeBSD/strftime.c
stdtime/FreeBSD/strftime.c.patch [deleted file]
stdtime/FreeBSD/strptime.3
stdtime/FreeBSD/strptime.3.patch [deleted file]
stdtime/FreeBSD/strptime.c
stdtime/FreeBSD/strptime.c.patch [deleted file]
stdtime/FreeBSD/timelocal.c
stdtime/FreeBSD/timelocal.c.patch [deleted file]
stdtime/FreeBSD/timelocal.h
stdtime/FreeBSD/timelocal.h.patch [deleted file]
stdtime/FreeBSD/tzfile.5
stdtime/FreeBSD/tzfile.5.patch [deleted file]
stdtime/FreeBSD/tzfile.h
stdtime/FreeBSD/tzfile.h.patch [deleted file]
stdtime/Makefile.inc [deleted file]
stdtime/asctime-fbsd.c [deleted file]
stdtime/ctime.3 [deleted file]
stdtime/difftime-fbsd.c [deleted symlink]
stdtime/ftime-fbsd.c [deleted symlink]
stdtime/ftime.3 [deleted file]
stdtime/localtime-fbsd.c [deleted file]
stdtime/private.h [deleted symlink]
stdtime/strftime-fbsd.c [deleted file]
stdtime/strftime.3 [deleted file]
stdtime/strptime-fbsd.c [deleted file]
stdtime/strptime.3 [deleted file]
stdtime/time2posix.3 [deleted symlink]
stdtime/time32-fbsd.c [deleted symlink]
stdtime/timelocal-fbsd.c [deleted file]
stdtime/timelocal.h [deleted file]
stdtime/tzfile.5 [deleted file]
stdtime/tzfile.h [deleted file]
string/FreeBSD/bcmp.3
string/FreeBSD/bcmp.3.patch [deleted file]
string/FreeBSD/bcopy.3
string/FreeBSD/bcopy.3.patch [deleted file]
string/FreeBSD/bcopy.c [new file with mode: 0644]
string/FreeBSD/bstring.3
string/FreeBSD/bstring.3.patch [deleted file]
string/FreeBSD/bzero.3
string/FreeBSD/bzero.3.patch [deleted file]
string/FreeBSD/bzero.c [new file with mode: 0644]
string/FreeBSD/bzero.c.patch [deleted file]
string/FreeBSD/ffs.3
string/FreeBSD/ffs.3.patch [deleted file]
string/FreeBSD/index.3
string/FreeBSD/index.3.patch [deleted file]
string/FreeBSD/memccpy.3
string/FreeBSD/memccpy.3.patch [deleted file]
string/FreeBSD/memchr.3
string/FreeBSD/memchr.3.patch [deleted file]
string/FreeBSD/memcmp.3
string/FreeBSD/memcmp.3.patch [deleted file]
string/FreeBSD/memcpy.3
string/FreeBSD/memcpy.3.patch [deleted file]
string/FreeBSD/memcpy.c [new file with mode: 0644]
string/FreeBSD/memcpy.c.patch [deleted file]
string/FreeBSD/memmove.3
string/FreeBSD/memmove.3.patch [deleted file]
string/FreeBSD/memmove.c [new file with mode: 0644]
string/FreeBSD/memmove.c.patch [deleted file]
string/FreeBSD/memset.3
string/FreeBSD/memset.3.patch [deleted file]
string/FreeBSD/rindex.3
string/FreeBSD/rindex.3.patch [deleted file]
string/FreeBSD/stpcpy.c [deleted file]
string/FreeBSD/stpncpy.c [deleted file]
string/FreeBSD/strcasecmp.3
string/FreeBSD/strcasecmp.3.patch [deleted file]
string/FreeBSD/strcasecmp.c
string/FreeBSD/strcasecmp.c.patch [deleted file]
string/FreeBSD/strcasestr.c
string/FreeBSD/strcasestr.c.patch [deleted file]
string/FreeBSD/strcat.3
string/FreeBSD/strcat.3.patch [deleted file]
string/FreeBSD/strcat.c [deleted file]
string/FreeBSD/strchr.3
string/FreeBSD/strchr.3.patch [deleted file]
string/FreeBSD/strchr.c.patch [deleted file]
string/FreeBSD/strcmp.3
string/FreeBSD/strcmp.3.patch [deleted file]
string/FreeBSD/strcmp.c [new file with mode: 0644]
string/FreeBSD/strcoll.3
string/FreeBSD/strcoll.3.patch [deleted file]
string/FreeBSD/strcoll.c
string/FreeBSD/strcoll.c.patch [deleted file]
string/FreeBSD/strcpy.3
string/FreeBSD/strcpy.3.patch [deleted file]
string/FreeBSD/strcpy.c [deleted file]
string/FreeBSD/strcspn.3
string/FreeBSD/strcspn.3.patch [deleted file]
string/FreeBSD/strdup.3
string/FreeBSD/strdup.3.patch [deleted file]
string/FreeBSD/strerror.3
string/FreeBSD/strerror.3.patch [deleted file]
string/FreeBSD/strerror.c
string/FreeBSD/strerror.c.patch [deleted file]
string/FreeBSD/string.3
string/FreeBSD/string.3.patch [deleted file]
string/FreeBSD/strlcat.c [deleted file]
string/FreeBSD/strlcpy.3
string/FreeBSD/strlcpy.3.patch [deleted file]
string/FreeBSD/strlcpy.c [deleted file]
string/FreeBSD/strlen.c
string/FreeBSD/strmode.3
string/FreeBSD/strmode.3.patch [deleted file]
string/FreeBSD/strncat.c [deleted file]
string/FreeBSD/strncpy.c [deleted file]
string/FreeBSD/strpbrk.3
string/FreeBSD/strpbrk.3.patch [deleted file]
string/FreeBSD/strrchr.3 [deleted file]
string/FreeBSD/strrchr.3.patch [deleted file]
string/FreeBSD/strrchr.c.patch [deleted file]
string/FreeBSD/strsignal.c
string/FreeBSD/strsignal.c.patch [deleted file]
string/FreeBSD/strspn.3
string/FreeBSD/strspn.3.patch [deleted file]
string/FreeBSD/strstr.3
string/FreeBSD/strstr.3.patch [deleted file]
string/FreeBSD/strtok.3
string/FreeBSD/strtok.3.patch [deleted file]
string/FreeBSD/strxfrm.3
string/FreeBSD/strxfrm.3.patch [deleted file]
string/FreeBSD/strxfrm.c
string/FreeBSD/strxfrm.c.patch [deleted file]
string/FreeBSD/swab.3
string/FreeBSD/swab.3.patch [deleted file]
string/FreeBSD/swab.c
string/FreeBSD/swab.c.patch [deleted file]
string/FreeBSD/wcscasecmp.c
string/FreeBSD/wcscasecmp.c.patch [deleted file]
string/FreeBSD/wcscoll.3
string/FreeBSD/wcscoll.3.patch [deleted file]
string/FreeBSD/wcscoll.c
string/FreeBSD/wcscoll.c.patch [deleted file]
string/FreeBSD/wcsncasecmp.c
string/FreeBSD/wcsncasecmp.c.patch [deleted file]
string/FreeBSD/wcstok.3
string/FreeBSD/wcstok.3.patch [deleted file]
string/FreeBSD/wcswidth.3
string/FreeBSD/wcswidth.3.patch [deleted file]
string/FreeBSD/wcswidth.c
string/FreeBSD/wcswidth.c.patch [deleted file]
string/FreeBSD/wcsxfrm.3
string/FreeBSD/wcsxfrm.3.patch [deleted file]
string/FreeBSD/wcsxfrm.c
string/FreeBSD/wcsxfrm.c.patch [deleted file]
string/FreeBSD/wmemchr.3
string/FreeBSD/wmemchr.3.patch [deleted file]
string/Makefile.inc [deleted file]
string/bcmp-fbsd.c [deleted symlink]
string/bcmp.3 [deleted file]
string/bcopy.3 [deleted file]
string/bstring.3 [deleted file]
string/bzero.3 [deleted file]
string/ffs.3 [deleted file]
string/index-fbsd.c [deleted symlink]
string/index.3 [deleted file]
string/memccpy-fbsd.c [deleted symlink]
string/memccpy.3 [deleted file]
string/memchr-fbsd.c [deleted symlink]
string/memchr.3 [deleted file]
string/memcmp-fbsd.c [deleted symlink]
string/memcmp.3 [deleted file]
string/memcpy.3 [deleted file]
string/memmem-fbsd.c [deleted symlink]
string/memmem.3 [deleted symlink]
string/memmove.3 [deleted file]
string/memset-fbsd.c [deleted symlink]
string/memset.3 [deleted file]
string/memset_pattern.c [new file with mode: 0644]
string/rindex-fbsd.c [deleted symlink]
string/rindex.3 [deleted file]
string/stpcpy-fbsd.c [deleted symlink]
string/stpcpy.c [new file with mode: 0644]
string/stpncpy-fbsd.c [deleted symlink]
string/stpncpy.c [new file with mode: 0644]
string/strcasecmp-fbsd.c [deleted file]
string/strcasecmp.3 [deleted file]
string/strcasestr-fbsd.c [deleted file]
string/strcat-fbsd.c [deleted symlink]
string/strcat.3 [deleted file]
string/strcat.c [new file with mode: 0644]
string/strchr-fbsd.c [deleted file]
string/strchr.3 [deleted file]
string/strcmp.3 [deleted file]
string/strcoll-fbsd.c [deleted file]
string/strcoll.3 [deleted file]
string/strcpy-fbsd.c [deleted symlink]
string/strcpy.3 [deleted file]
string/strcpy.c [new file with mode: 0644]
string/strcspn-fbsd.c [deleted symlink]
string/strcspn.3 [deleted file]
string/strdup-fbsd.c [deleted symlink]
string/strdup.3 [deleted file]
string/strerror-fbsd.c [deleted file]
string/strerror.3 [deleted file]
string/string.3 [deleted file]
string/strlcat-fbsd.c [deleted symlink]
string/strlcat.c [new file with mode: 0644]
string/strlcpy-fbsd.c [deleted symlink]
string/strlcpy.3 [deleted file]
string/strlcpy.c [new file with mode: 0644]
string/strlen-fbsd.c [deleted symlink]
string/strlen.3 [deleted symlink]
string/strmode-fbsd.c [deleted symlink]
string/strmode.3 [deleted file]
string/strncat-fbsd.c [deleted symlink]
string/strncat.c [new file with mode: 0644]
string/strncmp-fbsd.c [deleted symlink]
string/strncpy-fbsd.c [deleted symlink]
string/strncpy.c [new file with mode: 0644]
string/strndup-fbsd.c [deleted symlink]
string/strnlen-fbsd.c [deleted symlink]
string/strnstr-fbsd.c [deleted symlink]
string/strpbrk-fbsd.c [deleted symlink]
string/strpbrk.3 [deleted file]
string/strrchr-fbsd.c [deleted file]
string/strrchr.3 [deleted file]
string/strsep-fbsd.c [deleted symlink]
string/strsep.3 [deleted symlink]
string/strsignal-fbsd.c [deleted file]
string/strspn-fbsd.c [deleted symlink]
string/strspn.3 [deleted file]
string/strstr-fbsd.c [deleted symlink]
string/strstr.3 [deleted file]
string/strtok-fbsd.c [deleted symlink]
string/strtok.3 [deleted file]
string/strxfrm-fbsd.c [deleted file]
string/strxfrm.3 [deleted file]
string/swab-fbsd.c [deleted file]
string/swab.3 [deleted file]
string/wcpcpy-fbsd.c [deleted symlink]
string/wcpncpy-fbsd.c [deleted symlink]
string/wcscasecmp-fbsd.c [deleted file]
string/wcscat-fbsd.c [deleted symlink]
string/wcschr-fbsd.c [deleted symlink]
string/wcscmp-fbsd.c [deleted symlink]
string/wcscoll-fbsd.c [deleted file]
string/wcscoll.3 [deleted file]
string/wcscpy-fbsd.c [deleted symlink]
string/wcscspn-fbsd.c [deleted symlink]
string/wcsdup-fbsd.c [deleted symlink]
string/wcslcat-fbsd.c [deleted symlink]
string/wcslcpy-fbsd.c [deleted symlink]
string/wcslen-fbsd.c [deleted symlink]
string/wcsncasecmp-fbsd.c [deleted file]
string/wcsncat-fbsd.c [deleted symlink]
string/wcsncmp-fbsd.c [deleted symlink]
string/wcsncpy-fbsd.c [deleted symlink]
string/wcsnlen-fbsd.c [deleted symlink]
string/wcspbrk-fbsd.c [deleted symlink]
string/wcsrchr-fbsd.c [deleted symlink]
string/wcsspn-fbsd.c [deleted symlink]
string/wcsstr-fbsd.c [deleted symlink]
string/wcstok-fbsd.c [deleted symlink]
string/wcstok.3 [deleted file]
string/wcswidth-fbsd.c [deleted file]
string/wcswidth.3 [deleted file]
string/wcsxfrm-fbsd.c [deleted file]
string/wcsxfrm.3 [deleted file]
string/wmemchr-fbsd.c [deleted symlink]
string/wmemchr.3 [deleted file]
string/wmemcmp-fbsd.c [deleted symlink]
string/wmemcpy-fbsd.c [deleted symlink]
string/wmemmove-fbsd.c [deleted symlink]
string/wmemset-fbsd.c [deleted symlink]
strip-header.ed [deleted file]
sys/Makefile.inc [deleted file]
sys/OSMemoryNotification.c
sys/OSThermalNotification.c
sys/OpenBSD/stack_protector.c
sys/OpenBSD/stack_protector.c.patch [deleted file]
sys/__libc_init.c
sys/getiopolicy_np.3
sys/getiopolicy_np.c
sys/posix_spawn.c
sys/stack_protector-obsd.c [deleted file]
threads/Makefile.inc [deleted file]
threads/cprocs.c
threads/cthreads.h
util/Makefile.inc [deleted file]
util/mkpath_np.3 [new file with mode: 0644]
util/mkpath_np.c [new file with mode: 0644]
uuid/Makefile.inc [deleted file]
uuid/clear-uuid.c [deleted symlink]
uuid/compare-uuid.c [deleted symlink]
uuid/copy-uuid.c [deleted symlink]
uuid/gen_uuid-uuid.c [deleted file]
uuid/isnull-uuid.c [deleted symlink]
uuid/pack-uuid.c [deleted symlink]
uuid/parse-uuid.c [deleted symlink]
uuid/unpack-uuid.c [deleted symlink]
uuid/unparse-uuid.c [deleted file]
uuid/uuid.3 [deleted file]
uuid/uuid.3-uuid.in [deleted symlink]
uuid/uuidP.h [deleted file]
uuid/uuid_clear.3 [deleted file]
uuid/uuid_clear.3-uuid.in [deleted symlink]
uuid/uuid_compare.3 [deleted file]
uuid/uuid_compare.3-uuid.in [deleted symlink]
uuid/uuid_copy.3 [deleted file]
uuid/uuid_copy.3-uuid.in [deleted symlink]
uuid/uuid_generate.3 [deleted file]
uuid/uuid_generate.3-uuid.in [deleted symlink]
uuid/uuid_is_null.3 [deleted file]
uuid/uuid_is_null.3-uuid.in [deleted symlink]
uuid/uuid_parse.3 [deleted file]
uuid/uuid_parse.3-uuid.in [deleted symlink]
uuid/uuid_unparse.3 [deleted file]
uuid/uuid_unparse.3-uuid.in [deleted file]
uuid/uuidsrc/gen_uuid.c
uuid/uuidsrc/gen_uuid.c.patch [deleted file]
uuid/uuidsrc/unparse.c
uuid/uuidsrc/unparse.c.patch [deleted file]
uuid/uuidsrc/uuidP.h
uuid/uuidsrc/uuidP.h.patch [deleted file]
uuid/uuidsrc/uuid_unparse.3.in
uuid/uuidsrc/uuid_unparse.3.in.patch [deleted file]
x86_64/gen/Makefile.inc [deleted file]
x86_64/gen/_setcontext.S
x86_64/gen/setjmperr.c [new file with mode: 0644]
x86_64/pthreads/Makefile.inc [deleted file]
x86_64/pthreads/get_cpu_capabilities.s [deleted file]
x86_64/pthreads/pthread_mutex_lock.s
x86_64/stdlib/gdtoa.mk [deleted file]
x86_64/string/Makefile.inc [deleted file]
x86_64/string/bcopy.c
x86_64/string/bcopy_sse3x.s
x86_64/string/bcopy_sse42.s
x86_64/string/bzero.c
x86_64/string/bzero_sse2.s
x86_64/string/bzero_sse42.s
x86_64/string/memcpy.c
x86_64/string/memmove.c
x86_64/sys/Makefile.inc [deleted file]
x86_64/sys/OSAtomic.s
x86_64/sys/_sigtramp.s
x86_64/sys/atomic.c
x86_64/sys/i386_gettimeofday_asm.s
x86_64/sys/spinlocks.c
x86_64/sys/spinlocks_asm.s
xcodescripts/build_linklists.sh [new file with mode: 0755]
xcodescripts/clean_simulator.sh [new file with mode: 0644]
xcodescripts/force_libc_to_build.sh [new file with mode: 0644]
xcodescripts/generate_features.pl [new file with mode: 0755]
xcodescripts/headers.sh [new file with mode: 0644]
xcodescripts/libc.xcconfig [new file with mode: 0644]
xcodescripts/manpages.sh [new file with mode: 0644]
xcodescripts/mig_headers.sh [new file with mode: 0644]
xcodescripts/patch_headers_variants.pl [new file with mode: 0644]
xcodescripts/sanitise_headers.sh [new file with mode: 0644]
xcodescripts/strip-header.ed [new file with mode: 0644]
xcodescripts/variants.xcconfig [new file with mode: 0644]

diff --git a/BSDmakefile b/BSDmakefile
deleted file mode 100644 (file)
index f787db5..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-.include <CoreOS/Standard/Commands.mk>
-.include <CoreOS/Standard/Variables.mk>
-
-ALLARCHS = arm i386 ppc ppc64 x86_64 # installsrc doesn't set RC_ARCHS
-CODESIGN != xcrun -find codesign
-TOP != ${PWD}
-.ifdef DSTROOT
-DESTDIR = $(DSTROOT)
-.else
-.ifdef DESTDIR
-DSTROOT = $(DESTDIR)
-.else
-DSTROOT = /
-DESTDIR = /
-.endif
-.endif
-.ifndef OBJROOT
-OBJROOT = $(TOP)/OBJROOT
-.endif
-.ifndef SRCROOT
-SRCROOT = $(TOP)
-.endif
-.ifndef SYMROOT
-SYMROOT = $(TOP)/SYMROOT
-.endif
-MYARCH != ${ARCH}
-.ifndef RC_ARCHS
-RC_ARCHS = $(MYARCH)
-RC_$(RC_ARCHS) = 1
-.endif
-FIRST_ARCH != ${PERL} -e 'print $$ARGV[0]' ${RC_ARCHS}
-.ifndef RC_NONARCH_CFLAGS
-RC_NONARCH_CFLAGS = -pipe
-.endif
-.ifdef ALTUSRLOCALLIBSYSTEM
-LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
-.else
-LIBSYS = $(SDKROOT)/usr/local/lib/system
-.endif
-.ifdef ALTUSRLIBSYSTEM
-LSYS = $(ALTUSRLIBSYSTEM)
-.else
-LSYS = $(SDKROOT)/usr/lib/system
-.endif
-NJOBS != ${PERL} -e '$$n = `$(SYSCTL) -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
-.ifdef DEBUG
-MYBSDMAKE = $(BSDMAKE) -f Makefile -P
-.else
-MYBSDMAKE = $(BSDMAKE) -f Makefile
-.endif
-MYBSDMAKEJ = $(MYBSDMAKE) -j $(NJOBS)
-
-# Set the DONT-BUILD-arch-form variable to non-empty to turn off building
-#DONT-BUILD-x86_64-static = 1
-
-# These variables are to guarantee that the left-hand side of an expression is
-# always a variable
-dynamic = dynamic
-static = static
-
-# Map RC_ARCHS to MACHINE_ARCH
-.for A in $(RC_ARCHS) $(MYARCH) # {
-MACHINE_ARCH-$(A) = $(A:C/^armv.*/arm/)
-.endfor # RC_ARCHS }
-
-FORMS := dynamic debug profile static
-
-OBJSUFFIX-dynamic = So
-OBJSUFFIX-debug = do
-OBJSUFFIX-profile = po
-OBJSUFFIX-static = o
-
-all: build
-
-ROOTS := DSTROOT OBJROOT SYMROOT
-.for R in $(ROOTS) # {
-roots: $($(R))
-$($(R)):
-       ${MKDIR} '$($(R))'
-.endfor # ROOTS }
-
-# These are the non B&I defaults
-.ifndef RC_ProjectName
-
-RC_ProjectName = Libc
-
-installhdrs: roots installhdrs-real
-build: roots build-static build-profile build-debug build-dynamic
-install: roots installhdrs install-all
-
-.else # RC_ProjectName
-
-RC_ProjectNameBase := $(RC_ProjectName:%_Sim=%)
-.if $(RC_ProjectName) == $(RC_ProjectNameBase)
-INSTALL_PREFIX =
-.else
-INSTALL_PREFIX = $(SDKROOT)
-.endif
-
-# And these are to deal with B&I building libc differently 
-# based on RC_ProjectName.
-.if $(RC_ProjectNameBase) == Libc
-installhdrs:
-build: roots build-dynamic
-install: roots BI-install-dynamic
-.endif
-.if $(RC_ProjectNameBase) == Libc_headers
-installhdrs: roots installhdrs-real
-build:
-install: roots installhdrs-real
-.endif
-.if $(RC_ProjectNameBase) == Libc_man
-installhdrs:
-build:
-install: roots install-man
-.endif
-.if $(RC_ProjectNameBase) == Libc_static
-installhdrs:
-build: roots build-static
-install: roots BI-install-static
-.endif
-.if $(RC_ProjectNameBase) == Libc_debug
-installhdrs:
-build: roots build-debug
-install: roots BI-install-debug
-.endif
-.if $(RC_ProjectNameBase) == Libc_profile
-installhdrs:
-build: roots build-profile
-install: roots BI-install-profile
-.endif
-.endif # RC_ProjectName
-
-# Make a copy of System.framework/Versions/B/PrivateHeaders, with headers
-# patched so that we can build variant symbols independently
-SYSTEMFRAMEWORK = System.framework
-VERSIONSB = Versions/B
-PRIVATEHEADERPATH = $(SYSTEMFRAMEWORK)/$(VERSIONSB)/PrivateHeaders
-FRAMEWORKS = $(OBJROOT)/Frameworks
-.ifdef ALTFRAMEWORKSPATH
-FRAMEWORKPATH = ${ALTFRAMEWORKSPATH}
-.else
-FRAMEWORKPATH = ${SDKROOT}/System/Library/Frameworks
-.endif
-$(FRAMEWORKS):
-       $(SRCROOT)/patchHeaders $(FRAMEWORKPATH)/$(PRIVATEHEADERPATH) $(FRAMEWORKS)/$(PRIVATEHEADERPATH:H)
-       ${LN} -fs $(VERSIONSB)/PrivateHeaders $(FRAMEWORKS)/$(SYSTEMFRAMEWORK)/PrivateHeaders
-
-AUTOPATCHED = $(SRCROOT)/.autopatched
-PARTIAL = 
-.for F in $(FORMS) # {
-.if $(dynamic) == $(F) # {
-SUFFIX-$(F) =
-.else # } {
-SUFFIX-$(F) = _$(F)
-.endif # }
-PSUFFIX-$(F) = $(PARTIAL)$(SUFFIX-$(F))
-
-.for A in $(RC_ARCHS) # {
-.if empty(DONT-BUILD-$(A)-$(F)) # {
-ARCHS-$(F) += $(A)
-build-$(A)-$(F):
-       ${MKDIR} $(OBJROOT)/obj.$(A) && \
-       MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH=$(MACHINE_ARCH-$(A)) CCARCH=$(A) \
-           DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
-           RC_NONARCH_CFLAGS="$(RC_NONARCH_CFLAGS)" MAKEFLAGS="" \
-           OBJSUFFIX="$(OBJSUFFIX-$(F))" \
-           $(MYBSDMAKEJ) libc$(SUFFIX-$(F)).a
-.else # } {
-build-$(A)-$(F):
-       @echo Not building libc$(PSUFFIX-$(F)).a for $(A)
-.endif # }
-.endfor # RC_ARCHS }
-
-NARCHS-$(F) != ${ECHO} $(ARCHS-$(F)) | ${WC} -w
-
-build-$(F): $(FRAMEWORKS) $(AUTOPATCHED)
-.for A in $(RC_ARCHS) # {
-build-$(F): build-$(A)-$(F)
-.endfor # RC_ARCHS }
-.if $(NARCHS-$(F)) == 0 # {
-build-$(F):
-       @echo No libc$(PSUFFIX-$(F)).a built
-.else # } {
-LIPOARGS-$(F) != ${PERL} -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libc$(SUFFIX-$(F)).a\"), qw($(ARCHS-$(F)))))'
-.if $(dynamic) == $(F) # {
-LIPODYLDARGS-$(F) != ${PERL} -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libc-dyld.a\"), qw($(ARCHS-$(F)))))'
-.endif # }
-build-$(F):
-.if $(NARCHS-$(F)) == 1 # {
-       ${CP} "$(OBJROOT)/obj.$(RC_ARCHS)/libc$(SUFFIX-$(F)).a" "$(SYMROOT)/libc$(PSUFFIX-$(F)).a"
-.if $(dynamic) == $(F) # {
-       ${CP} "$(OBJROOT)/obj.$(RC_ARCHS)/libc-dyld.a" "$(SYMROOT)/libc-dyld.a"
-.endif # }
-.else # } {
-       ${LIPO} -create $(LIPOARGS-$(F)) -output "$(SYMROOT)/libc$(PSUFFIX-$(F)).a"
-.if $(dynamic) == $(F) # {
-       ${LIPO} -create $(LIPODYLDARGS-$(F)) -output "$(SYMROOT)/libc-dyld.a"
-.endif # }
-.endif # }
-.endif # }
-.endfor # FORMS }
-
-# We autopatch the files into the directory containing the Makefile.inc.  This
-# will happen at installsrc.
-$(AUTOPATCHED):
-.for A in $(ALLARCHS) # {
-       MACHINE_ARCH=$(A) SRCROOT="$(SRCROOT)" \
-           $(MYBSDMAKE) -C "$(SRCROOT)" autopatch
-.endfor # ALLARCHS # }
-       touch $(AUTOPATCHED)
-
-copysrc:
-       ${TAR} -cp --exclude .git --exclude .svn --exclude CVS . | ${TAR} -pox -C "$(SRCROOT)"
-
-installsrc: copysrc $(AUTOPATCHED)
-
-installhdrs-real:
-       MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)$(INSTALL_PREFIX)" MAKEFLAGS="" \
-           DSTROOT="$(DSTROOT)$(INSTALL_PREFIX)" OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
-           $(MYBSDMAKEJ) installhdrs
-.for A in $(RC_ARCHS) # {
-       ${MKDIR} "$(OBJROOT)/obj.$(A)" && \
-       MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH=$(MACHINE_ARCH-$(A)) CCARCH=$(A) \
-           DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
-           MAKEFLAGS="" RC_NONARCH_CFLAGS="$(RC_NONARCH_CFLAGS)" \
-           $(MYBSDMAKEJ) installhdrs-md
-.endfor # RC_ARCHS # }
-
-.for F in $(FORMS) # {
-BI-install-$(F): build-$(F)
-       $(CC) -dynamiclib -o $(SYMROOT)/libsystem_c$(SUFFIX-$(F)).dylib $(RC_ARCHS:C/^/-arch /g) \
-               -compatibility_version 1 -current_version $(RC_ProjectSourceVersion) \
-               -install_name /usr/lib/system/libsystem_c$(SUFFIX-$(F)).dylib -nostdlib -Wl,-umbrella,System \
-               -all_load $(SYMROOT)/libc$(PSUFFIX-$(F)).a -Wl,-interposable_list,$(SRCROOT)/interposable.list \
-               -L$(LSYS) -L$(SDKROOT)/usr/lib -lSystem -lgcc
-       ${MKDIR} $(DSTROOT)/usr/local/lib/system
-       ${MKDIR} $(DSTROOT)/usr/lib/system
-       ${INSTALL} $(SYMROOT)/libsystem_c$(SUFFIX-$(F)).dylib $(DSTROOT)/usr/lib/system
-       ${STRIP} -S $(DSTROOT)/usr/lib/system/libsystem_c$(SUFFIX-$(F)).dylib
-       -${CODESIGN} -s - $(DSTROOT)/usr/lib/system/libsystem_c$(SUFFIX-$(F)).dylib
-.if $(dynamic) == $(F) # {
-       if [ -f "$(SYMROOT)/libc-dyld.a" ]; then \
-               ${ECHO} "Installing libc-dyld.a" && \
-               ${MKDIR} $(DSTROOT)/usr/local/lib/dyld && \
-               ${INSTALL} -m 444 "$(SYMROOT)/libc-dyld.a" \
-                       $(DSTROOT)/usr/local/lib/dyld/libc.a && \
-               ${LN} -sf "../dyld/libc.a" "$(DSTROOT)/usr/local/lib/system/libc-dyld.a" && \
-               ${RANLIB} "$(DSTROOT)/usr/local/lib/dyld/libc.a" || exit 1; \
-       fi
-.for A in $(RC_ARCHS) # {
-       MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH=$(MACHINE_ARCH-$(A)) CCARCH=$(A) \
-       DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
-           DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
-           MAKEFLAGS="" RC_NONARCH_CFLAGS="$(RC_NONARCH_CFLAGS)" \
-           $(MYBSDMAKE) copyfiles
-.endfor # RC_ARCHS # }
-.endif # }
-.endfor # FORMS }
-
-# Don't use -j here; it may try to make links before the files are copied
-MANARGS != ${TEST} `id -u` -eq 0 || ${ECHO} MINSTALL=/usr/bin/install
-# Variables.mk defines MANDIR=${SHAREDIR}/man, but bsd.man.mk expects that
-# MANDIR=${SHAREDIR}/man/man, so we override.
-MANARGS += MANDIR=${SHAREDIR}/man/man
-install-man:
-       ${MKDIR} $(DSTROOT)/usr/share/man/man2
-       ${MKDIR} $(DSTROOT)/usr/share/man/man3
-       ${MKDIR} $(DSTROOT)/usr/share/man/man4
-       ${MKDIR} $(DSTROOT)/usr/share/man/man5
-       ${MKDIR} $(DSTROOT)/usr/share/man/man7
-       MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)$(INSTALL_PREFIX)" \
-               DSTROOT='$(DSTROOT)$(INSTALL_PREFIX)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
-               MACHINE_ARCH="$(MACHINE_ARCH-$(FIRST_ARCH))" CCARCH=$(FIRST_ARCH) MAKEFLAGS="" \
-               RC_NONARCH_CFLAGS="$(RC_NONARCH_CFLAGS)" \
-               $(MYBSDMAKE) all-man maninstall $(MANARGS)
-
-install-all: build install-man
-.for F in $(FORMS) # {
-install-all: BI-install-$(F)
-.endfor # FORMS }
-
-clean:
-.for F in $(FORMS) # {
-       ${RM} $(SYMROOT)/libc$(PSUFFIX-$(F)).a
-.endfor # FORMS }
-.for A in $(RC_ARCHS) # {
-       ${RMDIR} $(OBJROOT)/obj.$(A)
-.endfor # RC_ARCHS # }
diff --git a/GNUmakefile b/GNUmakefile
deleted file mode 100644 (file)
index cc5dc9a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Remove any NEXT_ROOT argument
-override MAKEOVERRIDES := $(filter-out NEXT_ROOT=%,$(MAKEOVERRIDES))
-override MAKEFILEPATH := $(subst $(NEXT_ROOT),,$(MAKEFILEPATH))
-unexport NEXT_ROOT
-
-include $(MAKEFILEPATH)/CoreOS/Standard/Commands.make
-
-all:
-       @$(BSDMAKE)
-
-.DEFAULT:
-       @$(BSDMAKE) $@
diff --git a/Info.plist b/Info.plist
deleted file mode 100644 (file)
index 2b4e967..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{NSExecutable = net; NSExtensions = {}; }
diff --git a/Libc.xcodeproj/project.pbxproj b/Libc.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..987a2e0
--- /dev/null
@@ -0,0 +1,15877 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 46;
+       objects = {
+
+/* Begin PBXBuildFile section */
+               3F2208E814358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208E914358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208EA14358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208EB14358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208EC14358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208ED14358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208EE14358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F2208EF14358B4A00386F5B /* asl_fd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F2208E714358B4A00386F5B /* asl_fd.c */; };
+               3F76864713E91CBC00C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864913E91CE800C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864A13E91D3700C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864B13E91D3F00C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864C13E91D4B00C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864D13E91D5500C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864E13E91D5D00C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3F76864F13E91D6700C94D25 /* mkpath_np.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F89F3DD13E9194C00F6856C /* mkpath_np.c */; };
+               3FB7E1B5146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FB7E1B6146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FB7E1B7146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FB7E1B8146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FB7E1B9146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FB7E1BA146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FB7E1BB146EF2E000843438 /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               3FD4D48E1472F4B200075CCE /* dirfd.c in Sources */ = {isa = PBXBuildFile; fileRef = 3FB7E1B4146EF2E000843438 /* dirfd.c */; };
+               6310518713D4D966004F7BA8 /* strcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6310518613D4D966004F7BA8 /* strcpy.c */; };
+               6310518A13D4D9E9004F7BA8 /* strcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6310518613D4D966004F7BA8 /* strcpy.c */; };
+               6310518C13D4DABD004F7BA8 /* strlcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6310518B13D4DABD004F7BA8 /* strlcpy.c */; };
+               6310518D13D4DABD004F7BA8 /* strlcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6310518B13D4DABD004F7BA8 /* strlcpy.c */; };
+               6310518F13D4DAEA004F7BA8 /* strncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6310518E13D4DAEA004F7BA8 /* strncpy.c */; };
+               6310519013D4DAEA004F7BA8 /* strncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 6310518E13D4DAEA004F7BA8 /* strncpy.c */; };
+               634C4C3813BCEADC008CA66D /* memset_pattern_Swift.s in Sources */ = {isa = PBXBuildFile; fileRef = 634C4C3713BCEADC008CA66D /* memset_pattern_Swift.s */; };
+               6358199113B53DD800CDF61C /* bzero_Swift.s in Sources */ = {isa = PBXBuildFile; fileRef = 6358199013B53DD800CDF61C /* bzero_Swift.s */; };
+               6358199313B53ECC00CDF61C /* bcopy_Swift.s in Sources */ = {isa = PBXBuildFile; fileRef = 6358199213B53ECB00CDF61C /* bcopy_Swift.s */; };
+               63D4060613DDEDF10094DD56 /* stpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060513DDEDF10094DD56 /* stpcpy.c */; };
+               63D4060813DDEDFF0094DD56 /* stpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060513DDEDF10094DD56 /* stpcpy.c */; };
+               63D4060A13DDEEA20094DD56 /* stpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060913DDEEA10094DD56 /* stpncpy.c */; };
+               63D4060B13DDEEA20094DD56 /* stpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060913DDEEA10094DD56 /* stpncpy.c */; };
+               63D4060D13DDF26A0094DD56 /* strcat.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060C13DDF26A0094DD56 /* strcat.c */; };
+               63D4060E13DDF26A0094DD56 /* strcat.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060C13DDF26A0094DD56 /* strcat.c */; };
+               63D4061013DDF4340094DD56 /* strncat.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060F13DDF4340094DD56 /* strncat.c */; };
+               63D4061113DDF4340094DD56 /* strncat.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4060F13DDF4340094DD56 /* strncat.c */; };
+               63D4061313DDF6A30094DD56 /* strlcat.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4061213DDF6A20094DD56 /* strlcat.c */; };
+               63D4061413DDF6A30094DD56 /* strlcat.c in Sources */ = {isa = PBXBuildFile; fileRef = 63D4061213DDF6A20094DD56 /* strlcat.c */; };
+               B10BC41C14338AEB005E4366 /* regcomp.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B11432B95B00AF95D0 /* regcomp.c */; settings = {COMPILER_FLAGS = "-DHAVE_CONFIG_H -I$(SRCROOT)/regex/TRE -I$(SRCROOT)/regex/FreeBSD"; }; };
+               B122F2C71432B95B00AF95D0 /* regcomp.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B11432B95B00AF95D0 /* regcomp.c */; };
+               B122F2C91432B95B00AF95D0 /* regexec.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B21432B95B00AF95D0 /* regexec.c */; };
+               B122F2CB1432B95B00AF95D0 /* tre-ast.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B31432B95B00AF95D0 /* tre-ast.c */; };
+               B122F2CD1432B95B00AF95D0 /* tre-compile.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B51432B95B00AF95D0 /* tre-compile.c */; };
+               B122F2CF1432B95B00AF95D0 /* tre-match-backtrack.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B81432B95B00AF95D0 /* tre-match-backtrack.c */; };
+               B122F2D11432B95B00AF95D0 /* tre-match-parallel.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2B91432B95B00AF95D0 /* tre-match-parallel.c */; };
+               B122F2D31432B95B00AF95D0 /* tre-mem.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2BB1432B95B00AF95D0 /* tre-mem.c */; };
+               B122F2D51432B95B00AF95D0 /* tre-parse.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2BD1432B95B00AF95D0 /* tre-parse.c */; };
+               B122F2D71432B95B00AF95D0 /* tre-stack.c in Sources */ = {isa = PBXBuildFile; fileRef = B122F2BF1432B95B00AF95D0 /* tre-stack.c */; };
+               B19C645C1450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C645D1450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C645E1450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C645F1450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C64601450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C64611450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C64621450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B19C64631450F90200032373 /* sync_volume_np.c in Sources */ = {isa = PBXBuildFile; fileRef = B19C645B1450F90200032373 /* sync_volume_np.c */; };
+               B1E96442157E722200FCCEE7 /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               B1E9645F157E722200FCCEE7 /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               B1E96461157E722200FCCEE7 /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C9257ED5138E1C2E00B3107C /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; };
+               C9257ED6138E1C2E00B3107C /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C9257ED7138E1C2E00B3107C /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C9257ED8138E1C2E00B3107C /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; };
+               C9257ED9138E1C2E00B3107C /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C9257EDA138E1C2E00B3107C /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C9257EDB138E1C2E00B3107C /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C9257EDC138E1C2E00B3107C /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C9257EDD138E1C5D00B3107C /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EDE138E1C5D00B3107C /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EDF138E1C5D00B3107C /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE0138E1C5D00B3107C /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE1138E1C5D00B3107C /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE2138E1C5D00B3107C /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EE3138E1C5D00B3107C /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EE4138E1C5D00B3107C /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE5138E1C5D00B3107C /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE6138E1C5D00B3107C /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE7138E1C5D00B3107C /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE8138E1C5D00B3107C /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EE9138E1C5D00B3107C /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EEA138E1C5D00B3107C /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EEB138E1C5D00B3107C /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EEC138E1C5D00B3107C /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EED138E1C5D00B3107C /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EEE138E1C5D00B3107C /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EEF138E1C5D00B3107C /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF0138E1C5D00B3107C /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EF1138E1C5D00B3107C /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF2138E1C5D00B3107C /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -UDEBUG"; }; };
+               C9257EF3138E1C5D00B3107C /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF4138E1C5D00B3107C /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF5138E1C5D00B3107C /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF6138E1C5D00B3107C /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE -D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C9257EF7138E1C5D00B3107C /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF8138E1C5D00B3107C /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EF9138E1C5D00B3107C /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EFA138E1C5D00B3107C /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; settings = {COMPILER_FLAGS = "-D__DBINTERFACE_PRIVATE"; }; };
+               C9257EFB138E1C6A00B3107C /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C9257EFC138E1C6A00B3107C /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C9257EFD138E1C6A00B3107C /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C9257EFE138E1C6A00B3107C /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C9257EFF138E1C6A00B3107C /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C9257F00138E1C6A00B3107C /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C9257F01138E1C6A00B3107C /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C9257F02138E1C6A00B3107C /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C9257F03138E1C6A00B3107C /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C9257F04138E1C6A00B3107C /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C9257F05138E1C6A00B3107C /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C9257F06138E1C6A00B3107C /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C9257F07138E1C6A00B3107C /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C9257F09138E1C6A00B3107C /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C9257F0A138E1C6A00B3107C /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C9257F0B138E1C6A00B3107C /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C9257F0C138E1C6A00B3107C /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C9257F0D138E1C6A00B3107C /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C9257F0E138E1C6A00B3107C /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C9257F0F138E1C8200B3107C /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C9257F10138E1C8200B3107C /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C9257F11138E1C8200B3107C /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C9257F12138E1C8200B3107C /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C9257F13138E1C8200B3107C /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C9257F14138E1C8200B3107C /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; };
+               C9257F15138E1C8200B3107C /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F16138E1C8200B3107C /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C9257F17138E1C8200B3107C /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; };
+               C9257F18138E1C8200B3107C /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; };
+               C9257F19138E1C8200B3107C /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C9257F1A138E1C8200B3107C /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C9257F1B138E1C8200B3107C /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C9257F1C138E1C8200B3107C /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C9257F1D138E1C8200B3107C /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C9257F1E138E1C8200B3107C /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C9257F1F138E1C8200B3107C /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; };
+               C9257F20138E1C8200B3107C /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C9257F21138E1C8200B3107C /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C9257F22138E1C8200B3107C /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C9257F23138E1C8200B3107C /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C9257F24138E1C8200B3107C /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C9257F25138E1C8200B3107C /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C9257F26138E1C8200B3107C /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; };
+               C9257F27138E1C8200B3107C /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C9257F28138E1C8200B3107C /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C9257F29138E1C8200B3107C /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C9257F2A138E1C8200B3107C /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; };
+               C9257F2B138E1C8200B3107C /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C9257F2C138E1C8200B3107C /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C9257F2D138E1C8200B3107C /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C9257F2E138E1C8200B3107C /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; };
+               C9257F2F138E1C8200B3107C /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C9257F30138E1C8200B3107C /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C9257F31138E1C8200B3107C /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; };
+               C9257F32138E1C8200B3107C /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C9257F33138E1C8200B3107C /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F34138E1C8200B3107C /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; };
+               C9257F35138E1C8200B3107C /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; };
+               C9257F36138E1C8200B3107C /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; };
+               C9257F37138E1C8200B3107C /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C9257F38138E1C8200B3107C /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C9257F39138E1C8200B3107C /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F3A138E1C8200B3107C /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C9257F3B138E1C8200B3107C /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F3C138E1C8200B3107C /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F3D138E1C8200B3107C /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C9257F3E138E1C8200B3107C /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F3F138E1C8200B3107C /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C9257F40138E1C8200B3107C /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; };
+               C9257F41138E1C8200B3107C /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C9257F42138E1C8200B3107C /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C9257F43138E1C8200B3107C /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C9257F44138E1C8200B3107C /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C9257F45138E1C8200B3107C /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; };
+               C9257F46138E1C8200B3107C /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C9257F47138E1C8200B3107C /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C9257F48138E1C8200B3107C /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C9257F49138E1C8200B3107C /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C9257F4A138E1C8200B3107C /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C9257F4B138E1C8200B3107C /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C9257F4C138E1C8200B3107C /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; settings = {COMPILER_FLAGS = "-include gen/__dirent.h"; }; };
+               C9257F4D138E1C8200B3107C /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; };
+               C9257F4E138E1C8200B3107C /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C9257F4F138E1C8200B3107C /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C9257F51138E1C8200B3107C /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; };
+               C9257F52138E1C8200B3107C /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C9257F53138E1C8200B3107C /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C9257F54138E1C8200B3107C /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C9257F55138E1C8200B3107C /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C9257F56138E1C8200B3107C /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; };
+               C9257F57138E1C8200B3107C /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C9257F58138E1C8200B3107C /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C9257F59138E1C8200B3107C /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; };
+               C9257F5A138E1C8200B3107C /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C9257F5B138E1C8200B3107C /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; };
+               C9257F5C138E1C9700B3107C /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C9257F5D138E1C9700B3107C /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C9257F5E138E1C9700B3107C /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C9257F5F138E1C9700B3107C /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; settings = {COMPILER_FLAGS = "-D_DARWIN_UNLIMITED_STREAMS $(COLLATE_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C9257F60138E1C9700B3107C /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C9257F61138E1C9700B3107C /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C9257F62138E1C9700B3107C /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C9257F63138E1C9700B3107C /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C9257F64138E1C9700B3107C /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C9257F65138E1C9700B3107C /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C9257F66138E1C9700B3107C /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C9257F67138E1C9700B3107C /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C9257F68138E1C9700B3107C /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C9257F69138E1C9700B3107C /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C9257F6A138E1C9700B3107C /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C9257F6B138E1C9700B3107C /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C9257F6C138E1C9700B3107C /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C9257F6D138E1C9700B3107C /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C9257F6E138E1C9700B3107C /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C9257F6F138E1C9700B3107C /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C9257F70138E1C9700B3107C /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C9257F71138E1C9700B3107C /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C9257F72138E1C9700B3107C /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C9257F73138E1C9700B3107C /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C9257F74138E1C9700B3107C /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C9257F75138E1C9700B3107C /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C9257F76138E1C9700B3107C /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C9257F77138E1C9700B3107C /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C9257F79138E1C9700B3107C /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C9257F7A138E1C9700B3107C /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C9257F7B138E1C9700B3107C /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; settings = {COMPILER_FLAGS = "-D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C9257F7C138E1C9700B3107C /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C9257F7D138E1C9700B3107C /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C9257F7E138E1C9700B3107C /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C9257F7F138E1C9700B3107C /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C9257F80138E1C9700B3107C /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C9257F81138E1C9700B3107C /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; };
+               C9257F82138E1C9700B3107C /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C9257F83138E1C9700B3107C /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C9257F84138E1C9700B3107C /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C9257F85138E1C9700B3107C /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C9257F86138E1C9700B3107C /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C9257F87138E1C9700B3107C /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C9257F88138E1C9700B3107C /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C9257F89138E1C9700B3107C /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C9257F8A138E1C9700B3107C /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C9257F8B138E1C9700B3107C /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C9257F8C138E1C9700B3107C /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C9257F8D138E1C9700B3107C /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C9257F8E138E1C9700B3107C /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C9257F8F138E1C9700B3107C /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C9257F90138E1C9700B3107C /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C9257F91138E1C9700B3107C /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C9257F92138E1C9700B3107C /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C9257F93138E1C9700B3107C /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C9257F94138E1C9700B3107C /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C9257F95138E1C9700B3107C /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C9257F96138E1C9700B3107C /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C9257F97138E1C9700B3107C /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C9257F98138E1C9700B3107C /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C9257F99138E1C9700B3107C /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C9257F9A138E1C9700B3107C /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C9257F9B138E1C9700B3107C /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C9257F9C138E1C9700B3107C /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C9257F9D138E1C9700B3107C /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C9257F9E138E1C9700B3107C /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C9257F9F138E1C9700B3107C /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C9257FA0138E1C9700B3107C /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; };
+               C9257FA1138E1C9700B3107C /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; };
+               C9257FA2138E1C9700B3107C /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C9257FA3138E1C9700B3107C /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C9257FA4138E1C9700B3107C /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C9257FA5138E1CC000B3107C /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C9257FA6138E1CC000B3107C /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C9257FA7138E1CC000B3107C /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C9257FA8138E1CC000B3107C /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C9257FA9138E1CC000B3107C /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C9257FAA138E1CC000B3107C /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; };
+               C9257FAB138E1CC000B3107C /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C9257FAC138E1CC000B3107C /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C9257FAD138E1CC000B3107C /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C9257FAE138E1CC000B3107C /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C9257FAF138E1CC000B3107C /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C9257FB0138E1CC000B3107C /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C9257FB1138E1CC000B3107C /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C9257FB2138E1CC000B3107C /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C9257FB3138E1CC000B3107C /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C9257FB4138E1CC000B3107C /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C9257FB5138E1CC000B3107C /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C9257FB6138E1CC000B3107C /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C9257FB7138E1CC000B3107C /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C9257FB8138E1CC000B3107C /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; };
+               C9257FB9138E1CC000B3107C /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C9257FBA138E1CC000B3107C /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C9257FBB138E1CC000B3107C /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C9257FBC138E1CC000B3107C /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; };
+               C9257FBD138E1CC000B3107C /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C9257FBE138E1CC000B3107C /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C9257FBF138E1CC000B3107C /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C9257FC0138E1CC000B3107C /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; };
+               C9257FC1138E1CC000B3107C /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C9257FC2138E1CC000B3107C /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C9257FC3138E1CC000B3107C /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C9257FC4138E1CC000B3107C /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C9257FC5138E1CC000B3107C /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C9257FC6138E1CC000B3107C /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C9257FC7138E1CC000B3107C /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C9257FC8138E1CC000B3107C /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C9257FC9138E1CC000B3107C /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C9257FCA138E1CC000B3107C /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; };
+               C9257FCB138E1CC000B3107C /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C9257FCC138E1CC000B3107C /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C9257FCD138E1CC000B3107C /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C9257FCE138E1CC000B3107C /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C9257FCF138E1CC000B3107C /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C9257FD0138E1CC000B3107C /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C9257FD1138E1CC000B3107C /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C9257FD2138E1CC000B3107C /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C9257FD3138E1CC000B3107C /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C9257FD4138E1CC000B3107C /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C9257FD5138E1CC000B3107C /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C9257FD6138E1CC000B3107C /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C9257FD8138E1CC000B3107C /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C9257FD9138E1CC000B3107C /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C9257FDA138E1CC000B3107C /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C9257FDB138E1CC000B3107C /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C9257FDC138E1CC000B3107C /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C9257FDD138E1CC000B3107C /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C9257FDE138E1CC000B3107C /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C9257FDF138E1CC000B3107C /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C9257FE0138E1CC000B3107C /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C9257FE1138E1CC000B3107C /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C9257FE2138E1CC000B3107C /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C9257FE3138E1CC000B3107C /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C9257FE4138E1CC000B3107C /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C9257FE5138E1CC000B3107C /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C9257FE6138E1CC000B3107C /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C9257FE7138E1CC000B3107C /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C9257FE8138E1CC000B3107C /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C9257FE9138E1CC000B3107C /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C9257FEA138E1CC000B3107C /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C9257FEB138E1CC000B3107C /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C9257FEC138E1CC000B3107C /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C9257FED138E1CC000B3107C /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; };
+               C9257FEE138E1CC000B3107C /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; };
+               C9257FEF138E1CC000B3107C /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C9257FF0138E1CC000B3107C /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C9257FF1138E1CC000B3107C /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C9257FF2138E1CC000B3107C /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C9257FF3138E1CC000B3107C /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C9257FF5138E1CC000B3107C /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C9257FF7138E1CC000B3107C /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C9257FF8138E1CC000B3107C /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C9257FF9138E1CC000B3107C /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C9257FFA138E1CC000B3107C /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C9257FFB138E1CC000B3107C /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C9257FFC138E1CC000B3107C /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C9257FFD138E1CC000B3107C /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C9257FFE138E1CC000B3107C /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C9257FFF138E1CC000B3107C /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C9258000138E1CC000B3107C /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C9258001138E1CC000B3107C /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C9258002138E1CC000B3107C /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C9258003138E1CC000B3107C /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C9258004138E1CC000B3107C /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C9258005138E1CC000B3107C /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C9258006138E1CC000B3107C /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C9258007138E1CC000B3107C /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C9258008138E1CC000B3107C /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; };
+               C9258009138E1CC000B3107C /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; };
+               C925800A138E1CC000B3107C /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; };
+               C925800B138E1CC000B3107C /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C925800C138E1CC000B3107C /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C925800D138E1CD200B3107C /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C925800E138E1CD200B3107C /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C925800F138E1CD200B3107C /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C9258010138E1CD200B3107C /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C9258011138E1CD200B3107C /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C9258012138E1CD200B3107C /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C9258013138E1CD200B3107C /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C9258014138E1CD200B3107C /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C9258015138E1CD200B3107C /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C9258016138E1CD200B3107C /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C9258017138E1CD200B3107C /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; settings = {COMPILER_FLAGS = "-fno-builtin"; }; };
+               C9258018138E1CD200B3107C /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C925801B138E1CD200B3107C /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C925801C138E1CD200B3107C /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C925801E138E1CD200B3107C /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C925801F138E1CD200B3107C /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C9258020138E1CD200B3107C /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C9258022138E1CD200B3107C /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C9258023138E1CD200B3107C /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C9258024138E1CD200B3107C /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; };
+               C9258027138E1CD200B3107C /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C9258028138E1CD200B3107C /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C925802A138E1CD200B3107C /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C925802C138E1CD200B3107C /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C925802D138E1CD200B3107C /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C925802E138E1CD200B3107C /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C925802F138E1CD200B3107C /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C9258030138E1CD200B3107C /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C9258031138E1CD200B3107C /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C9258032138E1CD200B3107C /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C9258033138E1CD200B3107C /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C9258034138E1CD200B3107C /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C9258035138E1CD200B3107C /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C9258036138E1CD200B3107C /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C9258037138E1CD200B3107C /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C9258038138E1CD200B3107C /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C9258039138E1CD200B3107C /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C925803A138E1CD200B3107C /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C925803B138E1CD200B3107C /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C925803C138E1CD200B3107C /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C925803D138E1CD200B3107C /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C925803E138E1CD200B3107C /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C925803F138E1CD200B3107C /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C9258040138E1CD200B3107C /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C9258041138E1CD200B3107C /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C9258042138E1CD200B3107C /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C9258043138E1CD200B3107C /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C9258044138E1CD200B3107C /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C9258045138E1CD200B3107C /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C9258046138E1CD200B3107C /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C9258047138E1CD200B3107C /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C9258048138E1CD200B3107C /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C9258049138E1CD200B3107C /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C925804A138E1CD200B3107C /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C925804B138E1CD200B3107C /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C925804C138E1CD200B3107C /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C925804D138E1CD200B3107C /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C925804E138E1CD200B3107C /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C925804F138E1CD200B3107C /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C9258050138E1CD200B3107C /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C9258051138E1CD200B3107C /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C9258052138E1CD200B3107C /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C9258053138E1CD200B3107C /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C9258054138E1CD200B3107C /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C9258055138E1CD200B3107C /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C9258058138E1CDD00B3107C /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C92580CC138E2D3100B3107C /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C9258122138E3CA100B3107C /* magmallocProvider.d in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D5138D9E990028D27C /* magmallocProvider.d */; };
+               C932C2D013AB1C73004EDA12 /* SpinlocksWFE.c in Sources */ = {isa = PBXBuildFile; fileRef = C932C2CF13AB1C73004EDA12 /* SpinlocksWFE.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C932C2D313AB20C8004EDA12 /* OSAtomicUP.c in Sources */ = {isa = PBXBuildFile; fileRef = C995462713AAA25000A531B4 /* OSAtomicUP.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C932C2D413AB20C8004EDA12 /* Spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C97C344013AB0E1B00713550 /* Spinlocks.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C932C2D513AB20C8004EDA12 /* SpinlocksUP.c in Sources */ = {isa = PBXBuildFile; fileRef = C980F8EB13AB168D0069AB06 /* SpinlocksUP.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C932C2D613AB20C8004EDA12 /* SpinlocksWFE.c in Sources */ = {isa = PBXBuildFile; fileRef = C932C2CF13AB1C73004EDA12 /* SpinlocksWFE.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C9421014138F23CA004BA536 /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; settings = {COMPILER_FLAGS = "-D__FBSDID=__RCSID"; }; };
+               C9421015138F23CA004BA536 /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; settings = {COMPILER_FLAGS = "-D__FBSDID=__RCSID"; }; };
+               C9421016138F23CA004BA536 /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; settings = {COMPILER_FLAGS = "-D__FBSDID=__RCSID"; }; };
+               C9421017138F23CA004BA536 /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; settings = {COMPILER_FLAGS = "-D__FBSDID=__RCSID"; }; };
+               C9421021138F2602004BA536 /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C9421022138F2661004BA536 /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C9421023138F2661004BA536 /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C9421024138F2661004BA536 /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C9421025138F2661004BA536 /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C942103213900C8A004BA536 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C942103313900C8A004BA536 /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C942103413900C8A004BA536 /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C942103513900C8A004BA536 /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C942103613900C8A004BA536 /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C942103713900C8A004BA536 /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C942103913900C8A004BA536 /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C942103A13900C8A004BA536 /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C942103B13900C8A004BA536 /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C942103C13900C8A004BA536 /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_KILLPG"; }; };
+               C942103D13900C8A004BA536 /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C942103E13900C8A004BA536 /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C942103F13900C8A004BA536 /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C942104013900C8A004BA536 /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C942104113900C8A004BA536 /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREGID"; }; };
+               C942104213900C8A004BA536 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; };
+               C942104313900C8A004BA536 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C942104413900C8A004BA536 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C942104513900C8A004BA536 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C942104613900C8A004BA536 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C942104713900C8A004BA536 /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C942104813900C8A004BA536 /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C942104913900C8A004BA536 /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C942104A13900C8A004BA536 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C942104B13900C8A004BA536 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C942104C13900C8A004BA536 /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C942104D13900C8A004BA536 /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C942104E13900C8A004BA536 /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C942104F13900C8A004BA536 /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C942105013900C8A004BA536 /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C942105113900C8A004BA536 /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C942105213900C8A004BA536 /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C942105313900C8A004BA536 /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C942105413900C8A004BA536 /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C942105513900C8A004BA536 /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C942105613900C8A004BA536 /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C942105713900C8A004BA536 /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C942105813900C8A004BA536 /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C942105913900C8A004BA536 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C942105A13900C8A004BA536 /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C942105B13900C8A004BA536 /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C942105C13900C8A004BA536 /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C942105D13900C8A004BA536 /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C942105E13900C8A004BA536 /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C942105F13900C8A004BA536 /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C942106013900C8A004BA536 /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C942106113900C8A004BA536 /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C942106213900C8A004BA536 /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C942106313900C8A004BA536 /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C942106413900C8A004BA536 /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C942106513900C8A004BA536 /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C942106613900C8A004BA536 /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C942106713900C8A004BA536 /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C942106813900C8A004BA536 /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C942106913900C8A004BA536 /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C942106A13900C8A004BA536 /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C942106B13900C8A004BA536 /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C942106C13900C8A004BA536 /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C942106D13900C8A004BA536 /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C942106E13900C8A004BA536 /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C942106F13900C8A004BA536 /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C942107013900C8A004BA536 /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C942107113900C8A004BA536 /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C942107213900C8A004BA536 /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C942107313900C8A004BA536 /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C942107413900C8A004BA536 /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C942107513900C8A004BA536 /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C942107613900C8A004BA536 /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C942107713900C8A004BA536 /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C942107813900C8A004BA536 /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C942107913900C8A004BA536 /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C942107A13900C8A004BA536 /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C942107B13900C8A004BA536 /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C942107C13900C8A004BA536 /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C942107D13900C8A004BA536 /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C942107E13900C8A004BA536 /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C942107F13900C8A004BA536 /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C942108013900C8A004BA536 /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C942108113900C8A004BA536 /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C942108213900C8A004BA536 /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C942108313900C8A004BA536 /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C942108413900C8A004BA536 /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C942108513900C8A004BA536 /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C942108613900C8A004BA536 /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C942108713900C8A004BA536 /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C942108813900C8A004BA536 /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C942108913900C8A004BA536 /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C942108A13900C8A004BA536 /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C942108B13900C8A004BA536 /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C942108C13900C8A004BA536 /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C942108D13900C8A004BA536 /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C942108E13900C8A004BA536 /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C942108F13900C8A004BA536 /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C942109013900C8A004BA536 /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C942109113900C8A004BA536 /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C942109213900C8A004BA536 /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C942109313900C8A004BA536 /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C942109413900C8A004BA536 /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C942109513900C8A004BA536 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C942109613900C8A004BA536 /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_CONFSTR"; }; };
+               C942109713900C8A004BA536 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_ENCRYPT -DLIBC_ALIAS_SETKEY"; }; };
+               C942109813900C8A004BA536 /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C942109913900C8A004BA536 /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C942109A13900C8A004BA536 /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C942109B13900C8A004BA536 /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C942109C13900C8A004BA536 /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C942109D13900C8A004BA536 /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C942109E13900C8A004BA536 /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942109F13900C8A004BA536 /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C94210A013900C8A004BA536 /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C94210A113900C8A004BA536 /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CLOCK"; }; };
+               C94210A213900C8A004BA536 /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CLOSEDIR -include gen/__dirent.h"; }; };
+               C94210A313900C8A004BA536 /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C94210A413900C8A004BA536 /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210A513900C8A004BA536 /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210A613900C8A004BA536 /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C94210A713900C8A004BA536 /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C94210A813900C8A004BA536 /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C94210A913900C8A004BA536 /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C94210AA13900C8A004BA536 /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C94210AB13900C8A004BA536 /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C94210AC13900C8A004BA536 /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FNMATCH"; }; };
+               C94210AD13900C8A004BA536 /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C94210AE13900C8A004BA536 /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C94210AF13900C8A004BA536 /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C94210B013900C8A004BA536 /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210B113900C8A004BA536 /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C94210B213900C8A004BA536 /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C94210B313900C8A004BA536 /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210B413900C8A004BA536 /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210B513900C8A004BA536 /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C94210B613900C8A004BA536 /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C94210B713900C8A004BA536 /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_GLOB"; }; };
+               C94210B813900C8A004BA536 /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C94210B913900C8A004BA536 /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C94210BA13900C8A004BA536 /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C94210BB13900C8A004BA536 /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C94210BC13900C8A004BA536 /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C94210BD13900C8A004BA536 /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C94210BE13900C8A004BA536 /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_NICE"; }; };
+               C94210BF13900C8A004BA536 /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C94210C013900C8A004BA536 /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS___OPENDIR2 -DLIBC_ALIAS_OPENDIR -include gen/__dirent.h"; }; };
+               C94210C113900C8A004BA536 /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C94210C213900C8A004BA536 /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_POPEN"; }; };
+               C94210C313900C8A004BA536 /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PSELECT $(FreeBSD_CFLAGS)"; }; };
+               C94210C413900C8A004BA536 /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C94210C513900C8A004BA536 /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C94210C613900C8A004BA536 /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C94210C713900C8A004BA536 /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C94210C813900C8A004BA536 /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REWINDDIR -include gen/__dirent.h"; }; };
+               C94210C913900C8A004BA536 /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C94210CA13900C8A004BA536 /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C94210CB13900C8A004BA536 /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEEKDIR -include gen/__dirent.h"; }; };
+               C94210CC13900C8A004BA536 /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C94210CD13900C8A004BA536 /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SETMODE"; }; };
+               C94210CE13900C8A004BA536 /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C94210CF13900C8A004BA536 /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C94210D013900C8A004BA536 /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C94210D113900C8A004BA536 /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C94210D213900C8A004BA536 /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C94210D313900C8A004BA536 /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C94210D413900C8A004BA536 /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C94210D513900C8A004BA536 /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C94210D613900C8A004BA536 /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210D713900C8A004BA536 /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210D813900C8A004BA536 /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C94210D913900C8A004BA536 /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS__SEEKDIR -DLIBC_ALIAS_TELLDIR -include gen/__dirent.h"; }; };
+               C94210DA13900C8A004BA536 /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C94210DB13900C8A004BA536 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C94210DC13900C8A004BA536 /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C94210DD13900C8A004BA536 /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C94210DE13900C8A004BA536 /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TTYNAME_R"; }; };
+               C94210DF13900C8A004BA536 /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C94210E013900C8A004BA536 /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C94210E113900C8A004BA536 /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C94210E213900C8A004BA536 /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C94210E313900C8A004BA536 /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C94210E413900C8A004BA536 /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C94210E513900C8A004BA536 /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C94210E613900C8A004BA536 /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C94210E713900C8A004BA536 /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C94210E813900C8A004BA536 /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C94210E913900C8A004BA536 /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTS_CHILDREN -DLIBC_ALIAS_FTS_CLOSE -DLIBC_ALIAS_FTS_OPEN -DLIBC_ALIAS_FTS_OPEN_B -DLIBC_ALIAS_FTS_READ -DLIBC_ALIAS_FTS_SET"; }; };
+               C94210EA13900C8A004BA536 /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C94210EB13900C8A004BA536 /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C94210EC13900C8A004BA536 /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C94210ED13900C8A004BA536 /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C94210EE13900C8A004BA536 /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C94210EF13900C8A004BA536 /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C94210F013900C8A004BA536 /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C94210F113900C8A004BA536 /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C94210F213900C8A004BA536 /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C94210F313900C8A004BA536 /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C94210F413900C8A004BA536 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C94210F513900C8A004BA536 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; };
+               C94210F613900C8A004BA536 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C94210F713900C8A004BA536 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C94210F813900C8A004BA536 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C94210F913900C8A004BA536 /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C94210FA13900C8A004BA536 /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C94210FB13900C8A004BA536 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C94210FC13900C8A004BA536 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C94210FD13900C8A004BA536 /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C94210FE13900C8A004BA536 /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C94210FF13900C8A004BA536 /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C942110013900C8A004BA536 /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C942110113900C8A004BA536 /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C942110213900C8A004BA536 /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C942110313900C8A004BA536 /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C942110413900C8A004BA536 /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C942110613900C8A004BA536 /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C942110713900C8A004BA536 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C942110813900C8A004BA536 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C942110913900C8A004BA536 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C942110A13900C8A004BA536 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C942110B13900C8A004BA536 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C942110C13900C8A004BA536 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C942110D13900C8A004BA536 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C942110E13900C8A004BA536 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C942110F13900C8A004BA536 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C942111013900C8A004BA536 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C942111113900C8A004BA536 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C942111213900C8A004BA536 /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C942111313900C8A004BA536 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C942112613900C8A004BA536 /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C942112713900C8A004BA536 /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C942112813900C8A004BA536 /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C942112913900C8A004BA536 /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C942112A13900C8A004BA536 /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C942112B13900C8A004BA536 /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C942112C13900C8A004BA536 /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C942112D13900C8A004BA536 /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C942112E13900C8A004BA536 /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C942112F13900C8A004BA536 /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C942113013900C8A004BA536 /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C942113113900C8A004BA536 /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C942113213900C8A004BA536 /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C942113313900C8A004BA536 /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C942113413900C8A004BA536 /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C942113513900C8A004BA536 /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C942113613900C8A004BA536 /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C942113713900C8A004BA536 /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C942113813900C8A004BA536 /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C942113913900C8A004BA536 /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C942113A13900C8A004BA536 /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C942113B13900C8A004BA536 /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C942113C13900C8A004BA536 /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C942113D13900C8A004BA536 /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C942113E13900C8A004BA536 /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C942113F13900C8A004BA536 /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C942114013900C8A004BA536 /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C942114113900C8A004BA536 /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C942114213900C8A004BA536 /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C942114313900C8A004BA536 /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C942114413900C8A004BA536 /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C942114513900C8A004BA536 /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C942114613900C8A004BA536 /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C942114713900C8A004BA536 /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C942114813900C8A004BA536 /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C942114913900C8A004BA536 /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C942114A13900C8A004BA536 /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C942114B13900C8A004BA536 /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C942114C13900C8A004BA536 /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WCSFTIME -DLIBC_ALIAS_WCSFTIME_L"; }; };
+               C942114D13900C8A004BA536 /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C942114E13900C8A004BA536 /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C942114F13900C8A004BA536 /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C942115013900C8A004BA536 /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C942115113900C8A004BA536 /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C942115213900C8A004BA536 /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C942115313900C8A004BA536 /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C942115413900C8A004BA536 /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C942115513900C8A004BA536 /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C942115613900C8A004BA536 /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C942115713900C8A004BA536 /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C942115813900C8A004BA536 /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C942115913900C8A004BA536 /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C942115A13900C8A004BA536 /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C942115B13900C8A004BA536 /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C942115C13900C8A004BA536 /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C942115D13900C8A004BA536 /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C942115E13900C8A004BA536 /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C942115F13900C8A004BA536 /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C942116013900C8A004BA536 /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C942116113900C8A004BA536 /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C942116213900C8A004BA536 /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C942116313900C8A004BA536 /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C942116413900C8A004BA536 /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C942116513900C8A004BA536 /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C942116613900C8A004BA536 /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C942116713900C8A004BA536 /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C942116813900C8A004BA536 /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C942116913900C8A004BA536 /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C942116A13900C8A004BA536 /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C942116B13900C8A004BA536 /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C942116C13900C8A004BA536 /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C942116D13900C8A004BA536 /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C942116E13900C8A004BA536 /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C942116F13900C8A004BA536 /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C942117013900C8A004BA536 /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C942117113900C8A004BA536 /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C942117213900C8A004BA536 /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C942117313900C8A004BA536 /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C942117413900C8A004BA536 /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C942117513900C8A004BA536 /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C942117613900C8A004BA536 /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C942117713900C8A004BA536 /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C942117813900C8A004BA536 /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C942117913900C8A004BA536 /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C942117A13900C8A004BA536 /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C942117B13900C8A004BA536 /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C942117C13900C8A004BA536 /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C942117D13900C8A004BA536 /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C942118613900C8A004BA536 /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C942118713900C8A004BA536 /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_CANCEL -DLIBC_ALIAS_PTHREAD_SETCANCELSTATE -DLIBC_ALIAS_PTHREAD_SETCANCELTYPE -DLIBC_ALIAS_PTHREAD_SIGMASK -DLIBC_ALIAS_PTHREAD_TESTCANCEL"; }; };
+               C942118813900C8A004BA536 /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C942118913900C8A004BA536 /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_INIT"; }; };
+               C942118A13900C8A004BA536 /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY"; }; };
+               C942118B13900C8A004BA536 /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_RWLOCK_DESTROY -DLIBC_ALIAS_PTHREAD_RWLOCK_INIT -DLIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK"; }; };
+               C942118C13900C8A004BA536 /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C942118D13900C8A004BA536 /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C942118E13900C8A004BA536 /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C942119113900C8A004BA536 /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C942119413900C8A004BA536 /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C942119513900C8A004BA536 /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C942119613900C8A004BA536 /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C942119713900C8A004BA536 /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C942119813900C8A004BA536 /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C942119913900C8A004BA536 /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C942119A13900C8A004BA536 /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C942119B13900C8A004BA536 /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C942119C13900C8A004BA536 /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C942119D13900C8A004BA536 /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C942119E13900C8A004BA536 /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C942119F13900C8A004BA536 /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C94211A013900C8A004BA536 /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C94211A113900C8A004BA536 /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C94211A213900C8A004BA536 /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C94211A313900C8A004BA536 /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C94211A413900C8A004BA536 /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C94211A513900C8A004BA536 /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C94211A613900C8A004BA536 /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C94211A713900C8A004BA536 /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FDOPEN"; }; };
+               C94211A813900C8A004BA536 /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C94211A913900C8A004BA536 /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C94211AA13900C8A004BA536 /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C94211AB13900C8A004BA536 /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C94211AC13900C8A004BA536 /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C94211AD13900C8A004BA536 /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C94211AE13900C8A004BA536 /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C94211AF13900C8A004BA536 /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C94211B013900C8A004BA536 /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C94211B113900C8A004BA536 /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C94211B213900C8A004BA536 /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C94211B313900C8A004BA536 /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C94211B413900C8A004BA536 /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C94211B513900C8A004BA536 /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FOPEN"; }; };
+               C94211B613900C8A004BA536 /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C94211B713900C8A004BA536 /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C94211B813900C8A004BA536 /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C94211B913900C8A004BA536 /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FPUTS"; }; };
+               C94211BA13900C8A004BA536 /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C94211BB13900C8A004BA536 /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C94211BC13900C8A004BA536 /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C94211BD13900C8A004BA536 /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FREOPEN"; }; };
+               C94211BE13900C8A004BA536 /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C94211BF13900C8A004BA536 /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C94211C013900C8A004BA536 /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C94211C113900C8A004BA536 /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C94211C213900C8A004BA536 /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C94211C313900C8A004BA536 /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C94211C413900C8A004BA536 /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C94211C513900C8A004BA536 /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C94211C613900C8A004BA536 /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C94211C713900C8A004BA536 /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FWRITE"; }; };
+               C94211C813900C8A004BA536 /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C94211C913900C8A004BA536 /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C94211CA13900C8A004BA536 /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C94211CB13900C8A004BA536 /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C94211CC13900C8A004BA536 /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C94211CD13900C8A004BA536 /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C94211CE13900C8A004BA536 /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C94211CF13900C8A004BA536 /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C94211D013900C8A004BA536 /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C94211D113900C8A004BA536 /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C94211D213900C8A004BA536 /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C94211D313900C8A004BA536 /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C94211D413900C8A004BA536 /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C94211D513900C8A004BA536 /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C94211D613900C8A004BA536 /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C94211D713900C8A004BA536 /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C94211D813900C8A004BA536 /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C94211D913900C8A004BA536 /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C94211DA13900C8A004BA536 /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C94211DB13900C8A004BA536 /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C94211DC13900C8A004BA536 /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C94211DD13900C8A004BA536 /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C94211DE13900C8A004BA536 /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C94211DF13900C8A004BA536 /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C94211E013900C8A004BA536 /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C94211E113900C8A004BA536 /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C94211E213900C8A004BA536 /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C94211E313900C8A004BA536 /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C94211E413900C8A004BA536 /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C94211E513900C8A004BA536 /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C94211E613900C8A004BA536 /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C94211E713900C8A004BA536 /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C94211E813900C8A004BA536 /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C94211E913900C8A004BA536 /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C94211EA13900C8A004BA536 /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TEMPNAM"; }; };
+               C94211EB13900C8A004BA536 /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C94211EC13900C8A004BA536 /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C94211ED13900C8A004BA536 /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C94211EE13900C8A004BA536 /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C94211EF13900C8A004BA536 /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C94211F013900C8A004BA536 /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C94211F113900C8A004BA536 /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C94211F213900C8A004BA536 /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C94211F313900C8A004BA536 /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C94211F413900C8A004BA536 /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C94211F513900C8A004BA536 /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C94211F613900C8A004BA536 /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C94211F713900C8A004BA536 /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C94211F813900C8A004BA536 /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C94211F913900C8A004BA536 /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C94211FA13900C8A004BA536 /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C94211FB13900C8A004BA536 /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C94211FC13900C8A004BA536 /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C94211FD13900C8A004BA536 /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C94211FE13900C8A004BA536 /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C94211FF13900C8A004BA536 /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C942120013900C8A004BA536 /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C942120113900C8A004BA536 /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C942120213900C8A004BA536 /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C942120313900C8A004BA536 /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C942120413900C8A004BA536 /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C942120513900C8A004BA536 /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C942120613900C8A004BA536 /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942120713900C8A004BA536 /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C942120813900C8A004BA536 /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C942120913900C8A004BA536 /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C942120A13900C8A004BA536 /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C942120B13900C8A004BA536 /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C942120C13900C8A004BA536 /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C942120D13900C8A004BA536 /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942120E13900C8A004BA536 /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C942120F13900C8A004BA536 /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_GETOPT"; }; };
+               C942121013900C8A004BA536 /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C942121113900C8A004BA536 /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C942121213900C8A004BA536 /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C942121313900C8A004BA536 /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942121413900C8A004BA536 /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C942121513900C8A004BA536 /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C942121613900C8A004BA536 /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C942121713900C8A004BA536 /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C942121813900C8A004BA536 /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C942121913900C8A004BA536 /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C942121A13900C8A004BA536 /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C942121B13900C8A004BA536 /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C942121C13900C8A004BA536 /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C942121D13900C8A004BA536 /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C942121E13900C8A004BA536 /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942121F13900C8A004BA536 /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PUTENV"; }; };
+               C942122013900C8A004BA536 /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942122113900C8A004BA536 /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C942122213900C8A004BA536 /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C942122313900C8A004BA536 /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C942122413900C8A004BA536 /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C942122513900C8A004BA536 /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942122613900C8A004BA536 /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C942122713900C8A004BA536 /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C942122813900C8A004BA536 /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C942122913900C8A004BA536 /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C942122A13900C8A004BA536 /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C942122B13900C8A004BA536 /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C942122C13900C8A004BA536 /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C942122D13900C8A004BA536 /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C942122E13900C8A004BA536 /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C942122F13900C8A004BA536 /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C942123013900C8A004BA536 /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C942123113900C8A004BA536 /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C942123213900C8A004BA536 /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C942123313900C8A004BA536 /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C942123413900C8A004BA536 /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C942123513900C8A004BA536 /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C942123613900C8A004BA536 /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C942123713900C8A004BA536 /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C942123813900C8A004BA536 /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C942123913900C8A004BA536 /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C942123A13900C8A004BA536 /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C942123B13900C8A004BA536 /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C942123C13900C8A004BA536 /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C942123D13900C8A004BA536 /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C942123E13900C8A004BA536 /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C942123F13900C8A004BA536 /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C942124013900C8A004BA536 /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_MKTIME"; }; };
+               C942124113900C8A004BA536 /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRFTIME -DLIBC_ALIAS_STRFTIME_L"; }; };
+               C942124213900C8A004BA536 /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRPTIME -DLIBC_ALIAS_STRPTIME_L"; }; };
+               C942124313900C8A004BA536 /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C942124413900C8A004BA536 /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C942124513900C8A004BA536 /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; settings = {COMPILER_FLAGS = "-D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C942124613900C8A004BA536 /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C942124713900C8A004BA536 /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C942124813900C8A004BA536 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C942124913900C8A004BA536 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C942124A13900C8A004BA536 /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C942124B13900C8A004BA536 /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C942124C13900C8A004BA536 /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C942124D13900C8A004BA536 /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C942124E13900C8A004BA536 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C942124F13900C8A004BA536 /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C942125013900C8A004BA536 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C942125113900C8A004BA536 /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; settings = {COMPILER_FLAGS = "-fno-builtin"; }; };
+               C942125213900C8A004BA536 /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C942125513900C8A004BA536 /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C942125613900C8A004BA536 /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C942125813900C8A004BA536 /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942125913900C8A004BA536 /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C942125A13900C8A004BA536 /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C942125C13900C8A004BA536 /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C942125D13900C8A004BA536 /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942125E13900C8A004BA536 /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRERROR"; }; };
+               C942126113900C8A004BA536 /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C942126213900C8A004BA536 /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C942126413900C8A004BA536 /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942126613900C8A004BA536 /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C942126713900C8A004BA536 /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C942126813900C8A004BA536 /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C942126913900C8A004BA536 /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C942126A13900C8A004BA536 /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942126B13900C8A004BA536 /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C942126C13900C8A004BA536 /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C942126D13900C8A004BA536 /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C942126E13900C8A004BA536 /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C942126F13900C8A004BA536 /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C942127013900C8A004BA536 /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C942127113900C8A004BA536 /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C942127213900C8A004BA536 /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C942127313900C8A004BA536 /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C942127413900C8A004BA536 /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C942127513900C8A004BA536 /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C942127613900C8A004BA536 /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C942127713900C8A004BA536 /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C942127813900C8A004BA536 /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C942127913900C8A004BA536 /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C942127A13900C8A004BA536 /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C942127B13900C8A004BA536 /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C942127C13900C8A004BA536 /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C942127D13900C8A004BA536 /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C942127E13900C8A004BA536 /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C942127F13900C8A004BA536 /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C942128013900C8A004BA536 /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C942128113900C8A004BA536 /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C942128213900C8A004BA536 /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C942128313900C8A004BA536 /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C942128413900C8A004BA536 /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C942128513900C8A004BA536 /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C942128613900C8A004BA536 /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C942128713900C8A004BA536 /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C942128813900C8A004BA536 /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C942128913900C8A004BA536 /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C942128A13900C8A004BA536 /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C942128B13900C8A004BA536 /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C942128C13900C8A004BA536 /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C942128D13900C8A004BA536 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C942128E13900C8A004BA536 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C942128F13900C8A004BA536 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C942129013900C8A004BA536 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C942129113900C8A004BA536 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C942129213900C8A004BA536 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C942129313900C8A004BA536 /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C942129413900C8A004BA536 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C942129513900C8A004BA536 /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C942129613900C8A004BA536 /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C942129713900C8A004BA536 /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C942129813900C8A004BA536 /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C942129913900C8A004BA536 /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C942129A13900C8A004BA536 /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_MSGCTL -DKERNEL"; }; };
+               C942129B13900C8A004BA536 /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C942129C13900C8A004BA536 /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C942129D13900C8A004BA536 /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C942129E13900C8A004BA536 /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C942129F13900C8A004BA536 /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C94212A013900C8A004BA536 /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SEMCTL -DKERNEL"; }; };
+               C94212A113900C8A004BA536 /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C94212A213900C8A004BA536 /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SHMCTL -DKERNEL"; }; };
+               C94212A313900C8A004BA536 /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C94212A413900C8A004BA536 /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C94212A513900C8A004BA536 /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C94212A613900C8A004BA536 /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C94212A713900C8A004BA536 /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C94212A813900C8A004BA536 /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C94212A913900C8A004BA536 /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C94212AA13900C8A004BA536 /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C94212AB13900C8A004BA536 /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C94212AC13900C8A004BA536 /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C94212AD13900C8A004BA536 /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C94212AE13900C8A004BA536 /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C94212AF13900C8A004BA536 /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C94212B013900C8A004BA536 /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C94212B113900C8A004BA536 /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C94212B213900C8A004BA536 /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C94212B313900C8A004BA536 /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C94212B413900C8A004BA536 /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C94212B513900C8A004BA536 /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C94212B613900C8A004BA536 /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C94212B713900C8A004BA536 /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C94212B813900C8A004BA536 /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C94212B913900C8A004BA536 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C94212BA13900C8A004BA536 /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C94212BB13900C8A004BA536 /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C94212BC13900C8A004BA536 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C94212BD13900C8A004BA536 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C94212BE13900C8A004BA536 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C94212BF13900C8A004BA536 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C94212C013900C8A004BA536 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C94212C113900C8A004BA536 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C94212C213900C8A004BA536 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C94212C313900C8A004BA536 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C94212C413900C8A004BA536 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C94212C513900C8A004BA536 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C94212C613900C8A004BA536 /* scandir_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB350E138F769B0075BB52 /* scandir_b.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C94212D113900ED1004BA536 /* dirhelper.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B53614138D9E980028D27C /* dirhelper.defs */; };
+               C94212D213900ED1004BA536 /* asl_ipc.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CA138D9E990028D27C /* asl_ipc.defs */; };
+               C94212DE13901595004BA536 /* _ctx_start.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF1138D9E9A0028D27C /* _ctx_start.S */; };
+               C94212DF13901595004BA536 /* _setcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF2138D9E9A0028D27C /* _setcontext.S */; };
+               C94212E013901595004BA536 /* cpu_number.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF3138D9E9A0028D27C /* cpu_number.s */; };
+               C94212E113901595004BA536 /* getcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF4138D9E9A0028D27C /* getcontext.S */; };
+               C94212E213901595004BA536 /* icacheinval.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF6138D9E9A0028D27C /* icacheinval.s */; };
+               C94212E413901595004BA536 /* mcount.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF9138D9E9A0028D27C /* mcount.s */; };
+               C94212E513901595004BA536 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB3555138F7F6A0075BB52 /* setjmperr.c */; };
+               C94212E713901595004BA536 /* preempt.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFE138D9E9A0028D27C /* preempt.s */; };
+               C94212E813901595004BA536 /* pthread_getspecific.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFF138D9E9A0028D27C /* pthread_getspecific.s */; };
+               C94212E913901595004BA536 /* pthread_mutex_lock.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E00138D9E9A0028D27C /* pthread_mutex_lock.s */; };
+               C94212EA13901595004BA536 /* pthread_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E01138D9E9A0028D27C /* pthread_self.s */; };
+               C94212EB13901595004BA536 /* pthread_set_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E02138D9E9A0028D27C /* pthread_set_self.s */; };
+               C94212EC13901595004BA536 /* start_wqthread.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E03138D9E9A0028D27C /* start_wqthread.s */; };
+               C94212ED13901595004BA536 /* thread_start.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E04138D9E9A0028D27C /* thread_start.s */; };
+               C94212EF13901595004BA536 /* __bzero.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E08138D9E9A0028D27C /* __bzero.s */; };
+               C94212F013901595004BA536 /* bcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0A138D9E9A0028D27C /* bcopy_sse3x.s */; };
+               C94212F113901595004BA536 /* bcopy_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0B138D9E9A0028D27C /* bcopy_sse42.s */; };
+               C94212F213901595004BA536 /* bzero_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0D138D9E9A0028D27C /* bzero_sse2.s */; };
+               C94212F313901595004BA536 /* bzero_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0E138D9E9A0028D27C /* bzero_sse42.s */; };
+               C94212F413901595004BA536 /* ffs.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0F138D9E9A0028D27C /* ffs.s */; };
+               C94212F513901595004BA536 /* longcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E10138D9E9A0028D27C /* longcopy_sse3x.s */; };
+               C94212F713901595004BA536 /* memcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E12138D9E9A0028D27C /* memcmp.s */; };
+               C94212F813901595004BA536 /* memset.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E15138D9E9A0028D27C /* memset.s */; };
+               C94212F913901595004BA536 /* strcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E16138D9E9A0028D27C /* strcmp.s */; };
+               C94212FA13901595004BA536 /* strcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E17138D9E9A0028D27C /* strcpy.s */; };
+               C94212FB13901595004BA536 /* strlcat.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E18138D9E9A0028D27C /* strlcat.s */; };
+               C94212FC13901595004BA536 /* strlcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E19138D9E9A0028D27C /* strlcpy.s */; };
+               C94212FD13901595004BA536 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1A138D9E9A0028D27C /* strlen.s */; };
+               C94212FE13901595004BA536 /* strncmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1B138D9E9A0028D27C /* strncmp.s */; };
+               C94212FF13901595004BA536 /* strncpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1C138D9E9A0028D27C /* strncpy.s */; };
+               C942130013901595004BA536 /* _setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1E138D9E9A0028D27C /* _setjmp.s */; };
+               C942130113901595004BA536 /* _sigtramp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1F138D9E9A0028D27C /* _sigtramp.s */; };
+               C942130213901595004BA536 /* i386_gettimeofday_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E21138D9E9A0028D27C /* i386_gettimeofday_asm.s */; };
+               C942130413901595004BA536 /* nanotime.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E23138D9E9A0028D27C /* nanotime.s */; };
+               C942130513901595004BA536 /* OSAtomic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E24138D9E9A0028D27C /* OSAtomic.s */; };
+               C942130613901595004BA536 /* setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E25138D9E9A0028D27C /* setjmp.s */; };
+               C942130713901595004BA536 /* spinlocks_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E27138D9E9A0028D27C /* spinlocks_asm.s */; };
+               C942130A13903959004BA536 /* cpu_number.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B1138D9E980028D27C /* cpu_number.s */; };
+               C942130B13903959004BA536 /* icacheinval.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B2138D9E980028D27C /* icacheinval.s */; };
+               C942130C13903959004BA536 /* pthread_getspecific.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B8138D9E980028D27C /* pthread_getspecific.s */; };
+               C942130D13903959004BA536 /* pthread_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B9138D9E980028D27C /* pthread_self.s */; };
+               C942130E13903959004BA536 /* pthread_set_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535BA138D9E980028D27C /* pthread_set_self.s */; };
+               C942130F13903959004BA536 /* start_wqthread.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535BB138D9E980028D27C /* start_wqthread.s */; };
+               C942131013903959004BA536 /* thread_start.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535BC138D9E980028D27C /* thread_start.s */; };
+               C942131313903959004BA536 /* bcopy_Generic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C2138D9E980028D27C /* bcopy_Generic.s */; };
+               C942131613903959004BA536 /* bzero_Generic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C5138D9E980028D27C /* bzero_Generic.s */; };
+               C942131713903959004BA536 /* ffs.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C7138D9E980028D27C /* ffs.s */; };
+               C942131813903959004BA536 /* memcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C9138D9E980028D27C /* memcmp.s */; };
+               C942131913903959004BA536 /* memset_pattern.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CA138D9E980028D27C /* memset_pattern.s */; };
+               C942131A13903959004BA536 /* strchr.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CB138D9E980028D27C /* strchr.s */; };
+               C942131B13903959004BA536 /* strcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CC138D9E980028D27C /* strcmp.s */; };
+               C942131E13903959004BA536 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CF138D9E980028D27C /* strlen.s */; };
+               C942131F13903959004BA536 /* strncmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D0138D9E980028D27C /* strncmp.s */; };
+               C942132113903959004BA536 /* strnlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D2138D9E980028D27C /* strnlen.s */; };
+               C942132213903959004BA536 /* strstr.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D3138D9E980028D27C /* strstr.s */; };
+               C942132313903959004BA536 /* _longjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D5138D9E980028D27C /* _longjmp.s */; };
+               C942132413903959004BA536 /* _setjmp.h in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D6138D9E980028D27C /* _setjmp.h */; };
+               C942132513903959004BA536 /* _setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D7138D9E980028D27C /* _setjmp.s */; };
+               C942132613903959004BA536 /* longjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DA138D9E980028D27C /* longjmp.s */; };
+               C942132713903959004BA536 /* mach_absolute_time.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DB138D9E980028D27C /* mach_absolute_time.s */; };
+               C942132913903959004BA536 /* OSAtomic_resolvers.h in Sources */ = {isa = PBXBuildFile; fileRef = C9B535E0138D9E980028D27C /* OSAtomic_resolvers.h */; };
+               C942132A13903959004BA536 /* setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535E1138D9E980028D27C /* setjmp.s */; };
+               C94213311390396E004BA536 /* _ctx_start.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53811138D9E990028D27C /* _ctx_start.S */; };
+               C94213321390396E004BA536 /* _setcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53812138D9E990028D27C /* _setcontext.S */; };
+               C94213331390396E004BA536 /* cpu_number.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53813138D9E990028D27C /* cpu_number.s */; };
+               C94213341390396E004BA536 /* getcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53814138D9E990028D27C /* getcontext.S */; };
+               C94213351390396E004BA536 /* icacheinval.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53816138D9E990028D27C /* icacheinval.s */; };
+               C94213361390396E004BA536 /* mcount.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53819138D9E990028D27C /* mcount.s */; };
+               C94213371390396E004BA536 /* preempt.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53820138D9E990028D27C /* preempt.s */; };
+               C94213381390396E004BA536 /* pthread_getspecific.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53821138D9E990028D27C /* pthread_getspecific.s */; };
+               C94213391390396E004BA536 /* pthread_mutex_lock.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53822138D9E990028D27C /* pthread_mutex_lock.s */; };
+               C942133A1390396E004BA536 /* pthread_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53823138D9E990028D27C /* pthread_self.s */; };
+               C942133B1390396E004BA536 /* pthread_set_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53824138D9E990028D27C /* pthread_set_self.s */; };
+               C942133C1390396E004BA536 /* start_wqthread.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53825138D9E990028D27C /* start_wqthread.s */; };
+               C942133D1390396E004BA536 /* thread_start.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53826138D9E990028D27C /* thread_start.s */; };
+               C942133E1390396E004BA536 /* __bzero.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382A138D9E990028D27C /* __bzero.s */; };
+               C942133F1390396E004BA536 /* bcopy_scalar.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382C138D9E990028D27C /* bcopy_scalar.s */; };
+               C94213401390396E004BA536 /* bcopy_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382D138D9E990028D27C /* bcopy_sse2.s */; };
+               C94213411390396E004BA536 /* bcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382E138D9E990028D27C /* bcopy_sse3x.s */; };
+               C94213421390396E004BA536 /* bcopy_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382F138D9E990028D27C /* bcopy_sse42.s */; };
+               C94213431390396E004BA536 /* bzero_scalar.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53831138D9E990028D27C /* bzero_scalar.s */; };
+               C94213441390396E004BA536 /* bzero_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53832138D9E990028D27C /* bzero_sse2.s */; };
+               C94213451390396E004BA536 /* bzero_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53833138D9E990028D27C /* bzero_sse42.s */; };
+               C94213461390396E004BA536 /* ffs.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53834138D9E990028D27C /* ffs.s */; };
+               C94213471390396E004BA536 /* longcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53835138D9E990028D27C /* longcopy_sse3x.s */; };
+               C94213481390396E004BA536 /* memcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53837138D9E990028D27C /* memcmp.s */; };
+               C94213491390396E004BA536 /* memset.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383A138D9E990028D27C /* memset.s */; };
+               C942134A1390396E004BA536 /* memset_pattern_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383B138D9E990028D27C /* memset_pattern_sse2.s */; };
+               C942134B1390396E004BA536 /* strcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383C138D9E990028D27C /* strcmp.s */; };
+               C942134C1390396E004BA536 /* strcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383D138D9E990028D27C /* strcpy.s */; };
+               C942134D1390396E004BA536 /* strlcat.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383E138D9E990028D27C /* strlcat.s */; };
+               C942134E1390396E004BA536 /* strlcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383F138D9E990028D27C /* strlcpy.s */; };
+               C942134F1390396E004BA536 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53840138D9E990028D27C /* strlen.s */; };
+               C94213501390396E004BA536 /* strncmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53841138D9E990028D27C /* strncmp.s */; };
+               C94213511390396E004BA536 /* strncpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53842138D9E990028D27C /* strncpy.s */; };
+               C94213521390396E004BA536 /* _setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53844138D9E990028D27C /* _setjmp.s */; };
+               C94213531390396E004BA536 /* _sigtramp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53845138D9E990028D27C /* _sigtramp.s */; };
+               C94213541390396E004BA536 /* i386_gettimeofday_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53847138D9E990028D27C /* i386_gettimeofday_asm.s */; };
+               C94213551390396E004BA536 /* mach_absolute_time_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53849138D9E990028D27C /* mach_absolute_time_asm.s */; };
+               C94213561390396E004BA536 /* OSAtomic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384B138D9E990028D27C /* OSAtomic.s */; };
+               C94213571390396E004BA536 /* setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384C138D9E990028D27C /* setjmp.s */; };
+               C94213581390396E004BA536 /* spinlocks_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384E138D9E990028D27C /* spinlocks_asm.s */; };
+               C95B7ED7138F3BEA004311DA /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C95B7EDD138F3C55004311DA /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C95B7EDE138F3C55004311DA /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C95B7EDF138F3C55004311DA /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C95B7EE0138F3C55004311DA /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C95B7EE1138F3C55004311DA /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C95B7EE2138F3C55004311DA /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C95B7EE4138F3C55004311DA /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C95B7EE5138F3C55004311DA /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C95B7EE6138F3C55004311DA /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C95B7EE7138F3C55004311DA /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; };
+               C95B7EE8138F3C55004311DA /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C95B7EE9138F3C55004311DA /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C95B7EEA138F3C55004311DA /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C95B7EEB138F3C55004311DA /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C95B7EEC138F3C55004311DA /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; };
+               C95B7EED138F3C55004311DA /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; };
+               C95B7EEE138F3C55004311DA /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C95B7EEF138F3C55004311DA /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C95B7EF0138F3C55004311DA /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C95B7EF1138F3C55004311DA /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C95B7EF2138F3C55004311DA /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C95B7EF3138F3C55004311DA /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C95B7EF4138F3C55004311DA /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C95B7EF5138F3C55004311DA /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C95B7EF6138F3C55004311DA /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C95B7EF7138F3C55004311DA /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C95B7EF8138F3C55004311DA /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C95B7EF9138F3C55004311DA /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C95B7EFA138F3C55004311DA /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C95B7EFB138F3C55004311DA /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C95B7EFC138F3C55004311DA /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C95B7EFD138F3C55004311DA /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C95B7EFE138F3C55004311DA /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C95B7EFF138F3C55004311DA /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C95B7F00138F3C55004311DA /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C95B7F01138F3C55004311DA /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C95B7F02138F3C55004311DA /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C95B7F03138F3C55004311DA /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C95B7F04138F3C55004311DA /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C95B7F05138F3C55004311DA /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C95B7F06138F3C55004311DA /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C95B7F07138F3C55004311DA /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C95B7F08138F3C55004311DA /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C95B7F09138F3C55004311DA /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C95B7F0A138F3C55004311DA /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C95B7F0B138F3C55004311DA /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C95B7F0C138F3C55004311DA /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C95B7F0D138F3C55004311DA /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C95B7F0E138F3C55004311DA /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C95B7F0F138F3C55004311DA /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C95B7F10138F3C55004311DA /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C95B7F11138F3C55004311DA /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C95B7F12138F3C55004311DA /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C95B7F13138F3C55004311DA /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C95B7F14138F3C55004311DA /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C95B7F15138F3C55004311DA /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C95B7F16138F3C55004311DA /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C95B7F17138F3C55004311DA /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C95B7F18138F3C55004311DA /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C95B7F19138F3C55004311DA /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C95B7F1A138F3C55004311DA /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C95B7F1B138F3C55004311DA /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C95B7F1C138F3C55004311DA /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C95B7F1D138F3C55004311DA /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C95B7F1E138F3C55004311DA /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C95B7F1F138F3C55004311DA /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C95B7F20138F3C55004311DA /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C95B7F21138F3C55004311DA /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C95B7F22138F3C55004311DA /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C95B7F23138F3C55004311DA /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C95B7F24138F3C55004311DA /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C95B7F25138F3C55004311DA /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C95B7F26138F3C55004311DA /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C95B7F27138F3C55004311DA /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C95B7F28138F3C55004311DA /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C95B7F29138F3C55004311DA /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C95B7F2A138F3C55004311DA /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C95B7F2B138F3C55004311DA /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C95B7F2C138F3C55004311DA /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C95B7F2D138F3C55004311DA /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C95B7F2E138F3C55004311DA /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C95B7F2F138F3C55004311DA /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C95B7F30138F3C55004311DA /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C95B7F31138F3C55004311DA /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C95B7F32138F3C55004311DA /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C95B7F33138F3C55004311DA /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C95B7F34138F3C55004311DA /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C95B7F35138F3C55004311DA /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C95B7F36138F3C55004311DA /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C95B7F37138F3C55004311DA /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C95B7F38138F3C55004311DA /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C95B7F39138F3C55004311DA /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C95B7F3A138F3C55004311DA /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C95B7F3B138F3C55004311DA /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C95B7F3C138F3C55004311DA /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C95B7F3D138F3C55004311DA /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C95B7F3E138F3C55004311DA /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C95B7F3F138F3C55004311DA /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C95B7F40138F3C55004311DA /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C95B7F41138F3C55004311DA /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; };
+               C95B7F42138F3C55004311DA /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; };
+               C95B7F43138F3C55004311DA /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C95B7F44138F3C55004311DA /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C95B7F45138F3C55004311DA /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C95B7F46138F3C55004311DA /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C95B7F47138F3C55004311DA /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C95B7F48138F3C55004311DA /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C95B7F49138F3C55004311DA /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C95B7F4A138F3C55004311DA /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C95B7F4B138F3C55004311DA /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C95B7F4C138F3C55004311DA /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; };
+               C95B7F4D138F3C55004311DA /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; };
+               C95B7F4E138F3C55004311DA /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C95B7F4F138F3C55004311DA /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; };
+               C95B7F50138F3C55004311DA /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; };
+               C95B7F51138F3C55004311DA /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C95B7F52138F3C55004311DA /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C95B7F53138F3C55004311DA /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C95B7F54138F3C55004311DA /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C95B7F55138F3C55004311DA /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C95B7F56138F3C55004311DA /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C95B7F57138F3C55004311DA /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; };
+               C95B7F58138F3C55004311DA /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C95B7F59138F3C55004311DA /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C95B7F5A138F3C55004311DA /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C95B7F5B138F3C55004311DA /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C95B7F5C138F3C55004311DA /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C95B7F5D138F3C55004311DA /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C95B7F5E138F3C55004311DA /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; };
+               C95B7F5F138F3C55004311DA /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C95B7F60138F3C55004311DA /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C95B7F61138F3C55004311DA /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C95B7F62138F3C55004311DA /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; };
+               C95B7F63138F3C55004311DA /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C95B7F64138F3C55004311DA /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C95B7F65138F3C55004311DA /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C95B7F66138F3C55004311DA /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C95B7F67138F3C55004311DA /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C95B7F68138F3C55004311DA /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C95B7F69138F3C55004311DA /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; };
+               C95B7F6A138F3C55004311DA /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C95B7F6B138F3C55004311DA /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; };
+               C95B7F6C138F3C55004311DA /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C95B7F6D138F3C55004311DA /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_POPEN"; }; };
+               C95B7F6E138F3C55004311DA /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PSELECT"; }; };
+               C95B7F6F138F3C55004311DA /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C95B7F70138F3C55004311DA /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C95B7F71138F3C55004311DA /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; };
+               C95B7F72138F3C55004311DA /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C95B7F73138F3C55004311DA /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; };
+               C95B7F74138F3C55004311DA /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; };
+               C95B7F75138F3C55004311DA /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C95B7F76138F3C55004311DA /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; };
+               C95B7F77138F3C55004311DA /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C95B7F78138F3C55004311DA /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; };
+               C95B7F79138F3C55004311DA /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C95B7F7A138F3C55004311DA /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C95B7F7B138F3C55004311DA /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C95B7F7C138F3C55004311DA /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C95B7F7D138F3C55004311DA /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C95B7F7E138F3C55004311DA /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C95B7F7F138F3C55004311DA /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C95B7F80138F3C55004311DA /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C95B7F81138F3C55004311DA /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C95B7F82138F3C55004311DA /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C95B7F83138F3C55004311DA /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C95B7F84138F3C55004311DA /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; };
+               C95B7F85138F3C55004311DA /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C95B7F86138F3C55004311DA /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C95B7F87138F3C55004311DA /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C95B7F88138F3C55004311DA /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; };
+               C95B7F89138F3C55004311DA /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; };
+               C95B7F8A138F3C55004311DA /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C95B7F8B138F3C55004311DA /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C95B7F8C138F3C55004311DA /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C95B7F8D138F3C55004311DA /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C95B7F8E138F3C55004311DA /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C95B7F8F138F3C55004311DA /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C95B7F90138F3C55004311DA /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C95B7F91138F3C55004311DA /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C95B7F92138F3C55004311DA /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C95B7F93138F3C55004311DA /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C95B7F94138F3C55004311DA /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; };
+               C95B7F95138F3C55004311DA /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C95B7F96138F3C55004311DA /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C95B7F97138F3C55004311DA /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C95B7F98138F3C55004311DA /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C95B7F99138F3C55004311DA /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C95B7F9A138F3C55004311DA /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C95B7F9B138F3C55004311DA /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C95B7F9C138F3C55004311DA /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C95B7F9D138F3C55004311DA /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C95B7F9E138F3C55004311DA /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C95B7F9F138F3C55004311DA /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C95B7FA0138F3C55004311DA /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; };
+               C95B7FA1138F3C55004311DA /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C95B7FA2138F3C55004311DA /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C95B7FA3138F3C55004311DA /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C95B7FA4138F3C55004311DA /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C95B7FA5138F3C55004311DA /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C95B7FA6138F3C55004311DA /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C95B7FA7138F3C55004311DA /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C95B7FA8138F3C55004311DA /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C95B7FA9138F3C55004311DA /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C95B7FAA138F3C55004311DA /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C95B7FAB138F3C55004311DA /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C95B7FAC138F3C55004311DA /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C95B7FAD138F3C55004311DA /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C95B7FAE138F3C55004311DA /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C95B7FAF138F3C55004311DA /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C95B7FB1138F3C55004311DA /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C95B7FB2138F3C55004311DA /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C95B7FB3138F3C55004311DA /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C95B7FB4138F3C55004311DA /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C95B7FB5138F3C55004311DA /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C95B7FB6138F3C55004311DA /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C95B7FB7138F3C55004311DA /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C95B7FB8138F3C55004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C95B7FB9138F3C55004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C95B7FBA138F3C55004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C95B7FBB138F3C55004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C95B7FBC138F3C55004311DA /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C95B7FBD138F3C55004311DA /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C95B7FBE138F3C55004311DA /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C95B7FD1138F3C55004311DA /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C95B7FD2138F3C55004311DA /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C95B7FD3138F3C55004311DA /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C95B7FD4138F3C55004311DA /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C95B7FD5138F3C55004311DA /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C95B7FD6138F3C55004311DA /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C95B7FD7138F3C55004311DA /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C95B7FD8138F3C55004311DA /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C95B7FD9138F3C55004311DA /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C95B7FDA138F3C55004311DA /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C95B7FDB138F3C55004311DA /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C95B7FDC138F3C55004311DA /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C95B7FDD138F3C55004311DA /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C95B7FDE138F3C55004311DA /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C95B7FDF138F3C55004311DA /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C95B7FE0138F3C55004311DA /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C95B7FE1138F3C55004311DA /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C95B7FE2138F3C55004311DA /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C95B7FE3138F3C55004311DA /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C95B7FE4138F3C55004311DA /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C95B7FE5138F3C55004311DA /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C95B7FE6138F3C55004311DA /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C95B7FE7138F3C55004311DA /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C95B7FE8138F3C55004311DA /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C95B7FE9138F3C55004311DA /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C95B7FEA138F3C55004311DA /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C95B7FEB138F3C55004311DA /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C95B7FEC138F3C55004311DA /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C95B7FED138F3C55004311DA /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C95B7FEE138F3C55004311DA /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C95B7FEF138F3C55004311DA /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C95B7FF0138F3C55004311DA /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C95B7FF1138F3C55004311DA /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C95B7FF2138F3C55004311DA /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C95B7FF3138F3C55004311DA /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C95B7FF4138F3C55004311DA /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C95B7FF5138F3C55004311DA /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C95B7FF6138F3C55004311DA /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C95B7FF7138F3C55004311DA /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; };
+               C95B7FF8138F3C55004311DA /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C95B7FF9138F3C55004311DA /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C95B7FFA138F3C55004311DA /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C95B7FFB138F3C55004311DA /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C95B7FFC138F3C55004311DA /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C95B7FFD138F3C55004311DA /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C95B7FFE138F3C55004311DA /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C95B7FFF138F3C55004311DA /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C95B8000138F3C55004311DA /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C95B8001138F3C55004311DA /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C95B8002138F3C55004311DA /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C95B8003138F3C55004311DA /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C95B8004138F3C55004311DA /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C95B8005138F3C55004311DA /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C95B8006138F3C55004311DA /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C95B8007138F3C55004311DA /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C95B8008138F3C55004311DA /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C95B8009138F3C55004311DA /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C95B800A138F3C55004311DA /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C95B800B138F3C55004311DA /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C95B800C138F3C55004311DA /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C95B800D138F3C55004311DA /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C95B800E138F3C55004311DA /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C95B800F138F3C55004311DA /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C95B8010138F3C55004311DA /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C95B8011138F3C55004311DA /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C95B8012138F3C55004311DA /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C95B8013138F3C55004311DA /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C95B8014138F3C55004311DA /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C95B8015138F3C55004311DA /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C95B8016138F3C55004311DA /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C95B8017138F3C55004311DA /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C95B8018138F3C55004311DA /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C95B8019138F3C55004311DA /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C95B801A138F3C55004311DA /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C95B801B138F3C55004311DA /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C95B801C138F3C55004311DA /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C95B801D138F3C55004311DA /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C95B801E138F3C55004311DA /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C95B801F138F3C55004311DA /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C95B8020138F3C55004311DA /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C95B8021138F3C55004311DA /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C95B8022138F3C55004311DA /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C95B8023138F3C55004311DA /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C95B8024138F3C55004311DA /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C95B8025138F3C55004311DA /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C95B8026138F3C55004311DA /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C95B8027138F3C55004311DA /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C95B8028138F3C55004311DA /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C95B8031138F3C55004311DA /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C95B8032138F3C55004311DA /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; };
+               C95B8033138F3C55004311DA /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C95B8034138F3C55004311DA /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; };
+               C95B8035138F3C55004311DA /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; };
+               C95B8036138F3C55004311DA /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; };
+               C95B8037138F3C55004311DA /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C95B8038138F3C55004311DA /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C95B8039138F3C55004311DA /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C95B803C138F3C55004311DA /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C95B803F138F3C55004311DA /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C95B8040138F3C55004311DA /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C95B8041138F3C55004311DA /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C95B8042138F3C55004311DA /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C95B8043138F3C55004311DA /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C95B8044138F3C55004311DA /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C95B8045138F3C55004311DA /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C95B8046138F3C55004311DA /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C95B8047138F3C55004311DA /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C95B8048138F3C55004311DA /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C95B8049138F3C55004311DA /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C95B804A138F3C55004311DA /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C95B804B138F3C55004311DA /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C95B804C138F3C55004311DA /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C95B804D138F3C55004311DA /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C95B804E138F3C55004311DA /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C95B804F138F3C55004311DA /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C95B8050138F3C55004311DA /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C95B8051138F3C55004311DA /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C95B8052138F3C55004311DA /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FDOPEN"; }; };
+               C95B8053138F3C55004311DA /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C95B8054138F3C55004311DA /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C95B8055138F3C55004311DA /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C95B8056138F3C55004311DA /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C95B8057138F3C55004311DA /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C95B8058138F3C55004311DA /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C95B8059138F3C55004311DA /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C95B805A138F3C55004311DA /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C95B805B138F3C55004311DA /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C95B805C138F3C55004311DA /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C95B805D138F3C55004311DA /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C95B805E138F3C55004311DA /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C95B805F138F3C55004311DA /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C95B8060138F3C55004311DA /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FOPEN"; }; };
+               C95B8061138F3C55004311DA /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C95B8062138F3C55004311DA /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C95B8063138F3C55004311DA /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C95B8064138F3C55004311DA /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; };
+               C95B8065138F3C55004311DA /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C95B8066138F3C55004311DA /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C95B8067138F3C55004311DA /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C95B8068138F3C55004311DA /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; };
+               C95B8069138F3C55004311DA /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C95B806A138F3C55004311DA /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C95B806B138F3C55004311DA /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C95B806C138F3C55004311DA /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C95B806D138F3C55004311DA /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C95B806E138F3C55004311DA /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C95B806F138F3C55004311DA /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C95B8070138F3C55004311DA /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C95B8071138F3C55004311DA /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C95B8072138F3C55004311DA /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; };
+               C95B8073138F3C55004311DA /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C95B8074138F3C55004311DA /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C95B8075138F3C55004311DA /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C95B8076138F3C55004311DA /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C95B8077138F3C55004311DA /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C95B8078138F3C55004311DA /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C95B8079138F3C55004311DA /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C95B807A138F3C55004311DA /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C95B807B138F3C55004311DA /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C95B807C138F3C55004311DA /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C95B807D138F3C55004311DA /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C95B807E138F3C55004311DA /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C95B807F138F3C55004311DA /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C95B8080138F3C55004311DA /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C95B8081138F3C55004311DA /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C95B8082138F3C55004311DA /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C95B8083138F3C55004311DA /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C95B8084138F3C55004311DA /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C95B8085138F3C55004311DA /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C95B8086138F3C55004311DA /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C95B8087138F3C55004311DA /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C95B8088138F3C55004311DA /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C95B8089138F3C55004311DA /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C95B808A138F3C55004311DA /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C95B808B138F3C55004311DA /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C95B808C138F3C55004311DA /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C95B808D138F3C55004311DA /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C95B808E138F3C55004311DA /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C95B808F138F3C55004311DA /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C95B8090138F3C55004311DA /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C95B8091138F3C55004311DA /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C95B8092138F3C55004311DA /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C95B8093138F3C55004311DA /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C95B8094138F3C55004311DA /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C95B8095138F3C55004311DA /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; };
+               C95B8096138F3C55004311DA /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; };
+               C95B8097138F3C55004311DA /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C95B8098138F3C55004311DA /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C95B8099138F3C55004311DA /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C95B809A138F3C55004311DA /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C95B809B138F3C55004311DA /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C95B809C138F3C55004311DA /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C95B809D138F3C55004311DA /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C95B809E138F3C55004311DA /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C95B809F138F3C55004311DA /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C95B80A0138F3C55004311DA /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C95B80A1138F3C55004311DA /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C95B80A2138F3C55004311DA /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C95B80A3138F3C55004311DA /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C95B80A4138F3C55004311DA /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C95B80A5138F3C55004311DA /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C95B80A6138F3C55004311DA /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C95B80A7138F3C55004311DA /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C95B80A8138F3C55004311DA /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C95B80A9138F3C55004311DA /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C95B80AA138F3C55004311DA /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C95B80AB138F3C55004311DA /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C95B80AC138F3C55004311DA /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C95B80AD138F3C55004311DA /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C95B80AE138F3C55004311DA /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C95B80AF138F3C55004311DA /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C95B80B0138F3C55004311DA /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C95B80B1138F3C55004311DA /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C95B80B2138F3C55004311DA /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C95B80B3138F3C55004311DA /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C95B80B4138F3C55004311DA /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C95B80B5138F3C55004311DA /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C95B80B6138F3C55004311DA /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C95B80B7138F3C55004311DA /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C95B80B8138F3C55004311DA /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C95B80B9138F3C55004311DA /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C95B80BA138F3C55004311DA /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; };
+               C95B80BB138F3C55004311DA /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C95B80BC138F3C55004311DA /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C95B80BD138F3C55004311DA /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C95B80BE138F3C55004311DA /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C95B80BF138F3C55004311DA /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C95B80C0138F3C55004311DA /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C95B80C1138F3C55004311DA /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C95B80C2138F3C55004311DA /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C95B80C3138F3C55004311DA /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C95B80C4138F3C55004311DA /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C95B80C5138F3C55004311DA /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C95B80C6138F3C55004311DA /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C95B80C7138F3C55004311DA /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C95B80C8138F3C55004311DA /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C95B80C9138F3C55004311DA /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C95B80CA138F3C55004311DA /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; };
+               C95B80CB138F3C55004311DA /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C95B80CC138F3C55004311DA /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C95B80CD138F3C55004311DA /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C95B80CE138F3C55004311DA /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C95B80CF138F3C55004311DA /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C95B80D0138F3C55004311DA /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C95B80D1138F3C55004311DA /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C95B80D2138F3C55004311DA /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C95B80D3138F3C55004311DA /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; };
+               C95B80D4138F3C55004311DA /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C95B80D5138F3C55004311DA /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C95B80D6138F3C55004311DA /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C95B80D7138F3C55004311DA /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C95B80D8138F3C55004311DA /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C95B80D9138F3C55004311DA /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C95B80DA138F3C55004311DA /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C95B80DB138F3C55004311DA /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C95B80DC138F3C55004311DA /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C95B80DD138F3C55004311DA /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C95B80DE138F3C55004311DA /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C95B80DF138F3C55004311DA /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C95B80E0138F3C55004311DA /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C95B80E1138F3C55004311DA /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C95B80E2138F3C55004311DA /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C95B80E3138F3C55004311DA /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C95B80E4138F3C55004311DA /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C95B80E5138F3C55004311DA /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C95B80E6138F3C55004311DA /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C95B80E7138F3C55004311DA /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C95B80E8138F3C55004311DA /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C95B80E9138F3C55004311DA /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C95B80EA138F3C55004311DA /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C95B80EB138F3C55004311DA /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; };
+               C95B80EC138F3C55004311DA /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; };
+               C95B80ED138F3C55004311DA /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; };
+               C95B80EE138F3C55004311DA /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C95B80EF138F3C55004311DA /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C95B80F0138F3C55004311DA /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; };
+               C95B80F1138F3C55004311DA /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C95B80F2138F3C55004311DA /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C95B80F3138F3C55004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C95B80F4138F3C55004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C95B80F5138F3C55004311DA /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C95B80F6138F3C55004311DA /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C95B80F7138F3C55004311DA /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C95B80F8138F3C55004311DA /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C95B80F9138F3C55004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C95B80FA138F3C55004311DA /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C95B80FB138F3C55004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C95B80FC138F3C55004311DA /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; };
+               C95B80FD138F3C55004311DA /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C95B8100138F3C55004311DA /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C95B8101138F3C55004311DA /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C95B8103138F3C55004311DA /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C95B8104138F3C55004311DA /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C95B8105138F3C55004311DA /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C95B8107138F3C55004311DA /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C95B8108138F3C55004311DA /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C95B8109138F3C55004311DA /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; };
+               C95B810C138F3C55004311DA /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C95B810D138F3C55004311DA /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C95B810F138F3C55004311DA /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C95B8111138F3C55004311DA /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C95B8112138F3C55004311DA /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C95B8113138F3C55004311DA /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C95B8114138F3C55004311DA /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C95B8115138F3C55004311DA /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C95B8116138F3C55004311DA /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C95B8117138F3C55004311DA /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C95B8118138F3C55004311DA /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C95B8119138F3C55004311DA /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C95B811A138F3C55004311DA /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C95B811B138F3C55004311DA /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C95B811C138F3C55004311DA /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C95B811D138F3C55004311DA /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C95B811E138F3C55004311DA /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C95B811F138F3C55004311DA /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C95B8120138F3C55004311DA /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C95B8121138F3C55004311DA /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C95B8122138F3C55004311DA /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C95B8123138F3C55004311DA /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C95B8124138F3C55004311DA /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C95B8125138F3C55004311DA /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C95B8126138F3C55004311DA /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C95B8127138F3C55004311DA /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C95B8128138F3C55004311DA /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C95B8129138F3C55004311DA /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C95B812A138F3C55004311DA /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C95B812B138F3C55004311DA /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C95B812C138F3C55004311DA /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C95B812D138F3C55004311DA /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C95B812E138F3C55004311DA /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C95B812F138F3C55004311DA /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C95B8130138F3C55004311DA /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C95B8131138F3C55004311DA /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C95B8132138F3C55004311DA /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C95B8133138F3C55004311DA /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C95B8134138F3C55004311DA /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C95B8135138F3C55004311DA /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C95B8136138F3C55004311DA /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C95B8137138F3C55004311DA /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C95B8138138F3C55004311DA /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C95B8139138F3C55004311DA /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C95B813A138F3C55004311DA /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C95B813B138F3C55004311DA /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C95B813C138F3C55004311DA /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C95B813D138F3C55004311DA /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C95B813E138F3C55004311DA /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C95B813F138F3C55004311DA /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C95B8140138F3C55004311DA /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C95B8141138F3C55004311DA /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C95B8142138F3C55004311DA /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C95B8143138F3C55004311DA /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C95B8144138F3C55004311DA /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C95B8145138F3C55004311DA /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; };
+               C95B8146138F3C55004311DA /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C95B8147138F3C55004311DA /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C95B8148138F3C55004311DA /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C95B8149138F3C55004311DA /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C95B814A138F3C55004311DA /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C95B814B138F3C55004311DA /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; };
+               C95B814C138F3C55004311DA /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C95B814D138F3C55004311DA /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; };
+               C95B814E138F3C55004311DA /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C95B814F138F3C55004311DA /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C95B8150138F3C55004311DA /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C95B8151138F3C55004311DA /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C95B8152138F3C55004311DA /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C95B8153138F3C55004311DA /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C95B8154138F3C55004311DA /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C95B8155138F3C55004311DA /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C95B8156138F3C55004311DA /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C95B8157138F3C55004311DA /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C95B8158138F3C55004311DA /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C95B8159138F3C55004311DA /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C95B815A138F3C55004311DA /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C95B815B138F3C55004311DA /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C95B815C138F3C55004311DA /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C95B815D138F3C55004311DA /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C95B815E138F3C55004311DA /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C95B815F138F3C55004311DA /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C95B8160138F3C55004311DA /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C95B8161138F3C55004311DA /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C95B8162138F3C55004311DA /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C95B8163138F3C55004311DA /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C95B8164138F3C55004311DA /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C95B8165138F3C55004311DA /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C95B8166138F3C55004311DA /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C95B8167138F3C55004311DA /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C95B8168138F3C55004311DA /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C95B8169138F3C55004311DA /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C95B816A138F3C55004311DA /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C95B816B138F3C55004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C95B816C138F3C55004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C95B816D138F3C55004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C95B816E138F3C55004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C95B816F138F3C55004311DA /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C95B8170138F3C55004311DA /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C95B8188138F52B0004311DA /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C95B8189138F52B0004311DA /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C95B818A138F52B0004311DA /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C95B818B138F52B0004311DA /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C95B818C138F52B0004311DA /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C95B818D138F52B0004311DA /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C95B818F138F52B0004311DA /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C95B8190138F52B0004311DA /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C95B8191138F52B0004311DA /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C95B8192138F52B0004311DA /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; };
+               C95B8193138F52B0004311DA /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C95B8194138F52B0004311DA /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C95B8195138F52B0004311DA /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C95B8196138F52B0004311DA /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C95B8197138F52B0004311DA /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; };
+               C95B8198138F52B0004311DA /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; };
+               C95B8199138F52B0004311DA /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C95B819A138F52B0004311DA /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C95B819B138F52B0004311DA /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C95B819C138F52B0004311DA /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C95B819D138F52B0004311DA /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C95B819E138F52B0004311DA /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C95B819F138F52B0004311DA /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C95B81A0138F52B0004311DA /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C95B81A1138F52B0004311DA /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C95B81A2138F52B0004311DA /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C95B81A3138F52B0004311DA /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C95B81A4138F52B0004311DA /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C95B81A5138F52B0004311DA /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C95B81A6138F52B0004311DA /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C95B81A7138F52B0004311DA /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C95B81A8138F52B0004311DA /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C95B81A9138F52B0004311DA /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C95B81AA138F52B0004311DA /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C95B81AB138F52B0004311DA /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C95B81AC138F52B0004311DA /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C95B81AD138F52B0004311DA /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C95B81AE138F52B0004311DA /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C95B81AF138F52B0004311DA /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C95B81B0138F52B0004311DA /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C95B81B1138F52B0004311DA /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C95B81B2138F52B0004311DA /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C95B81B3138F52B0004311DA /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C95B81B4138F52B0004311DA /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C95B81B5138F52B0004311DA /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C95B81B6138F52B0004311DA /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C95B81B7138F52B0004311DA /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C95B81B8138F52B0004311DA /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C95B81B9138F52B0004311DA /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C95B81BA138F52B0004311DA /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C95B81BB138F52B0004311DA /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C95B81BC138F52B0004311DA /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C95B81BD138F52B0004311DA /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C95B81BE138F52B0004311DA /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C95B81BF138F52B0004311DA /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C95B81C0138F52B0004311DA /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C95B81C1138F52B0004311DA /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C95B81C2138F52B0004311DA /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C95B81C3138F52B0004311DA /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C95B81C4138F52B0004311DA /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C95B81C5138F52B0004311DA /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C95B81C6138F52B0004311DA /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C95B81C7138F52B0004311DA /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C95B81C8138F52B0004311DA /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C95B81C9138F52B0004311DA /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C95B81CA138F52B0004311DA /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C95B81CB138F52B0004311DA /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C95B81CC138F52B0004311DA /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C95B81CD138F52B0004311DA /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C95B81CE138F52B0004311DA /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C95B81CF138F52B0004311DA /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C95B81D0138F52B0004311DA /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C95B81D1138F52B0004311DA /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C95B81D2138F52B0004311DA /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C95B81D3138F52B0004311DA /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C95B81D4138F52B0004311DA /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C95B81D5138F52B0004311DA /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C95B81D6138F52B0004311DA /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C95B81D7138F52B0004311DA /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C95B81D8138F52B0004311DA /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C95B81D9138F52B0004311DA /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C95B81DA138F52B0004311DA /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C95B81DB138F52B0004311DA /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C95B81DC138F52B0004311DA /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C95B81DD138F52B0004311DA /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C95B81DE138F52B0004311DA /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C95B81DF138F52B0004311DA /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C95B81E0138F52B0004311DA /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C95B81E1138F52B0004311DA /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C95B81E2138F52B0004311DA /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C95B81E3138F52B0004311DA /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C95B81E4138F52B0004311DA /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C95B81E5138F52B0004311DA /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C95B81E6138F52B0004311DA /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C95B81E7138F52B0004311DA /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C95B81E8138F52B0004311DA /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C95B81E9138F52B0004311DA /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C95B81EA138F52B0004311DA /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C95B81EB138F52B0004311DA /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C95B81EC138F52B0004311DA /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; };
+               C95B81ED138F52B0004311DA /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; };
+               C95B81EE138F52B0004311DA /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C95B81EF138F52B0004311DA /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C95B81F0138F52B0004311DA /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C95B81F1138F52B0004311DA /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C95B81F2138F52B0004311DA /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C95B81F3138F52B0004311DA /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C95B81F4138F52B0004311DA /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C95B81F5138F52B0004311DA /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C95B81F6138F52B0004311DA /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C95B81F7138F52B0004311DA /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; };
+               C95B81F8138F52B0004311DA /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; };
+               C95B81F9138F52B0004311DA /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C95B81FA138F52B0004311DA /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; };
+               C95B81FB138F52B0004311DA /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; };
+               C95B81FC138F52B0004311DA /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C95B81FD138F52B0004311DA /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C95B81FE138F52B0004311DA /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C95B81FF138F52B0004311DA /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C95B8200138F52B0004311DA /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C95B8201138F52B0004311DA /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C95B8202138F52B0004311DA /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; };
+               C95B8203138F52B0004311DA /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C95B8204138F52B0004311DA /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C95B8205138F52B0004311DA /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C95B8206138F52B0004311DA /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C95B8207138F52B0004311DA /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C95B8208138F52B0004311DA /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C95B8209138F52B0004311DA /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; };
+               C95B820A138F52B0004311DA /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C95B820B138F52B0004311DA /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C95B820C138F52B0004311DA /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C95B820D138F52B0004311DA /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; };
+               C95B820E138F52B0004311DA /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C95B820F138F52B0004311DA /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C95B8210138F52B0004311DA /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C95B8211138F52B0004311DA /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C95B8212138F52B0004311DA /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C95B8213138F52B0004311DA /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C95B8214138F52B0004311DA /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; };
+               C95B8215138F52B0004311DA /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C95B8216138F52B0004311DA /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; };
+               C95B8217138F52B0004311DA /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C95B8218138F52B0004311DA /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_POPEN"; }; };
+               C95B8219138F52B0004311DA /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PSELECT"; }; };
+               C95B821A138F52B0004311DA /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C95B821B138F52B0004311DA /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C95B821C138F52B0004311DA /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; };
+               C95B821D138F52B0004311DA /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C95B821E138F52B0004311DA /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; };
+               C95B821F138F52B0004311DA /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; };
+               C95B8220138F52B0004311DA /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C95B8221138F52B0004311DA /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; };
+               C95B8222138F52B0004311DA /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C95B8223138F52B0004311DA /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; };
+               C95B8224138F52B0004311DA /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C95B8225138F52B0004311DA /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C95B8226138F52B0004311DA /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C95B8227138F52B0004311DA /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C95B8228138F52B0004311DA /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C95B8229138F52B0004311DA /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C95B822A138F52B0004311DA /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C95B822B138F52B0004311DA /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C95B822C138F52B0004311DA /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C95B822D138F52B0004311DA /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C95B822E138F52B0004311DA /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C95B822F138F52B0004311DA /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; };
+               C95B8230138F52B0004311DA /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C95B8231138F52B0004311DA /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C95B8232138F52B0004311DA /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C95B8233138F52B0004311DA /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; };
+               C95B8234138F52B0004311DA /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; };
+               C95B8235138F52B0004311DA /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C95B8236138F52B0004311DA /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C95B8237138F52B0004311DA /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C95B8238138F52B0004311DA /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C95B8239138F52B0004311DA /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C95B823A138F52B0004311DA /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C95B823B138F52B0004311DA /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C95B823C138F52B0004311DA /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C95B823D138F52B0004311DA /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C95B823E138F52B0004311DA /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C95B823F138F52B0004311DA /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; };
+               C95B8240138F52B0004311DA /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C95B8241138F52B0004311DA /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C95B8242138F52B0004311DA /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C95B8243138F52B0004311DA /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C95B8244138F52B0004311DA /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C95B8245138F52B0004311DA /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C95B8246138F52B0004311DA /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C95B8247138F52B0004311DA /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C95B8248138F52B0004311DA /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C95B8249138F52B0004311DA /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C95B824A138F52B0004311DA /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C95B824B138F52B0004311DA /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; };
+               C95B824C138F52B0004311DA /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C95B824D138F52B0004311DA /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C95B824E138F52B0004311DA /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C95B824F138F52B0004311DA /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C95B8250138F52B0004311DA /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C95B8251138F52B0004311DA /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C95B8252138F52B0004311DA /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C95B8253138F52B0004311DA /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C95B8254138F52B0004311DA /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C95B8255138F52B0004311DA /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C95B8256138F52B0004311DA /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C95B8257138F52B0004311DA /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C95B8258138F52B0004311DA /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C95B8259138F52B0004311DA /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C95B825A138F52B0004311DA /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C95B825C138F52B0004311DA /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C95B825D138F52B0004311DA /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C95B825E138F52B0004311DA /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C95B825F138F52B0004311DA /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C95B8260138F52B0004311DA /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C95B8261138F52B0004311DA /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C95B8262138F52B0004311DA /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C95B8263138F52B0004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C95B8264138F52B0004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C95B8265138F52B0004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C95B8266138F52B0004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C95B8267138F52B0004311DA /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C95B8268138F52B0004311DA /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C95B8269138F52B0004311DA /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C95B827C138F52B0004311DA /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C95B827D138F52B0004311DA /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C95B827E138F52B0004311DA /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C95B827F138F52B0004311DA /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C95B8280138F52B0004311DA /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C95B8281138F52B0004311DA /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C95B8282138F52B0004311DA /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C95B8283138F52B0004311DA /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C95B8284138F52B0004311DA /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C95B8285138F52B0004311DA /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C95B8286138F52B0004311DA /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C95B8287138F52B0004311DA /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C95B8288138F52B0004311DA /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C95B8289138F52B0004311DA /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C95B828A138F52B0004311DA /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C95B828B138F52B0004311DA /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C95B828C138F52B0004311DA /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C95B828D138F52B0004311DA /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C95B828E138F52B0004311DA /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C95B828F138F52B0004311DA /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C95B8290138F52B0004311DA /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C95B8291138F52B0004311DA /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C95B8292138F52B0004311DA /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C95B8293138F52B0004311DA /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C95B8294138F52B0004311DA /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C95B8295138F52B0004311DA /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C95B8296138F52B0004311DA /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C95B8297138F52B0004311DA /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C95B8298138F52B0004311DA /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C95B8299138F52B0004311DA /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C95B829A138F52B0004311DA /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C95B829B138F52B0004311DA /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C95B829C138F52B0004311DA /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C95B829D138F52B0004311DA /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C95B829E138F52B0004311DA /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C95B829F138F52B0004311DA /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C95B82A0138F52B0004311DA /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C95B82A1138F52B0004311DA /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C95B82A2138F52B0004311DA /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; };
+               C95B82A3138F52B0004311DA /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C95B82A4138F52B0004311DA /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C95B82A5138F52B0004311DA /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C95B82A6138F52B0004311DA /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C95B82A7138F52B0004311DA /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C95B82A8138F52B0004311DA /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C95B82A9138F52B0004311DA /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C95B82AA138F52B0004311DA /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C95B82AB138F52B0004311DA /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C95B82AC138F52B0004311DA /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C95B82AD138F52B0004311DA /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C95B82AE138F52B0004311DA /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C95B82AF138F52B0004311DA /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C95B82B0138F52B0004311DA /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C95B82B1138F52B0004311DA /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C95B82B2138F52B0004311DA /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C95B82B3138F52B0004311DA /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C95B82B4138F52B0004311DA /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C95B82B5138F52B0004311DA /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C95B82B6138F52B0004311DA /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C95B82B7138F52B0004311DA /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C95B82B8138F52B0004311DA /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C95B82B9138F52B0004311DA /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C95B82BA138F52B0004311DA /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C95B82BB138F52B0004311DA /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C95B82BC138F52B0004311DA /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C95B82BD138F52B0004311DA /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C95B82BE138F52B0004311DA /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C95B82BF138F52B0004311DA /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C95B82C0138F52B0004311DA /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C95B82C1138F52B0004311DA /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C95B82C2138F52B0004311DA /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C95B82C3138F52B0004311DA /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C95B82C4138F52B0004311DA /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C95B82C5138F52B0004311DA /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C95B82C6138F52B0004311DA /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C95B82C7138F52B0004311DA /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C95B82C8138F52B0004311DA /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C95B82C9138F52B0004311DA /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C95B82CA138F52B0004311DA /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C95B82CB138F52B0004311DA /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C95B82CC138F52B0004311DA /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C95B82CD138F52B0004311DA /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C95B82CE138F52B0004311DA /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C95B82CF138F52B0004311DA /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C95B82D0138F52B0004311DA /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C95B82D1138F52B0004311DA /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C95B82D2138F52B0004311DA /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C95B82D3138F52B0004311DA /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C95B82DC138F52B0004311DA /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C95B82DD138F52B0004311DA /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; };
+               C95B82DE138F52B0004311DA /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C95B82DF138F52B0004311DA /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; };
+               C95B82E0138F52B0004311DA /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; };
+               C95B82E1138F52B0004311DA /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; };
+               C95B82E2138F52B0004311DA /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C95B82E3138F52B0004311DA /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C95B82E4138F52B0004311DA /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C95B82E7138F52B0004311DA /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C95B82EA138F52B0004311DA /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C95B82EB138F52B0004311DA /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C95B82EC138F52B0004311DA /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C95B82ED138F52B0004311DA /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C95B82EE138F52B0004311DA /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C95B82EF138F52B0004311DA /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C95B82F0138F52B0004311DA /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C95B82F1138F52B0004311DA /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C95B82F2138F52B0004311DA /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C95B82F3138F52B0004311DA /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C95B82F4138F52B0004311DA /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C95B82F5138F52B0004311DA /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C95B82F6138F52B0004311DA /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C95B82F7138F52B0004311DA /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C95B82F8138F52B0004311DA /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C95B82F9138F52B0004311DA /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C95B82FA138F52B0004311DA /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C95B82FB138F52B0004311DA /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C95B82FC138F52B0004311DA /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C95B82FD138F52B0004311DA /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FDOPEN"; }; };
+               C95B82FE138F52B0004311DA /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C95B82FF138F52B0004311DA /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C95B8300138F52B0004311DA /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C95B8301138F52B0004311DA /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C95B8302138F52B0004311DA /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C95B8303138F52B0004311DA /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C95B8304138F52B0004311DA /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C95B8305138F52B0004311DA /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C95B8306138F52B0004311DA /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C95B8307138F52B0004311DA /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C95B8308138F52B0004311DA /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C95B8309138F52B0004311DA /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C95B830A138F52B0004311DA /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C95B830B138F52B0004311DA /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FOPEN"; }; };
+               C95B830C138F52B0004311DA /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C95B830D138F52B0004311DA /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C95B830E138F52B0004311DA /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C95B830F138F52B0004311DA /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; };
+               C95B8310138F52B0004311DA /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C95B8311138F52B0004311DA /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C95B8312138F52B0004311DA /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C95B8313138F52B0004311DA /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; };
+               C95B8314138F52B0004311DA /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C95B8315138F52B0004311DA /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C95B8316138F52B0004311DA /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C95B8317138F52B0004311DA /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C95B8318138F52B0004311DA /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C95B8319138F52B0004311DA /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C95B831A138F52B0004311DA /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C95B831B138F52B0004311DA /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C95B831C138F52B0004311DA /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C95B831D138F52B0004311DA /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; };
+               C95B831E138F52B0004311DA /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C95B831F138F52B0004311DA /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C95B8320138F52B0004311DA /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C95B8321138F52B0004311DA /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C95B8322138F52B0004311DA /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C95B8323138F52B0004311DA /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C95B8324138F52B0004311DA /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C95B8325138F52B0004311DA /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C95B8326138F52B0004311DA /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C95B8327138F52B0004311DA /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C95B8328138F52B0004311DA /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C95B8329138F52B0004311DA /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C95B832A138F52B0004311DA /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C95B832B138F52B0004311DA /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C95B832C138F52B0004311DA /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C95B832D138F52B0004311DA /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C95B832E138F52B0004311DA /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C95B832F138F52B0004311DA /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C95B8330138F52B0004311DA /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C95B8331138F52B0004311DA /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C95B8332138F52B0004311DA /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C95B8333138F52B0004311DA /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C95B8334138F52B0004311DA /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C95B8335138F52B0004311DA /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C95B8336138F52B0004311DA /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C95B8337138F52B0004311DA /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C95B8338138F52B0004311DA /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C95B8339138F52B0004311DA /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C95B833A138F52B0004311DA /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C95B833B138F52B0004311DA /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C95B833C138F52B0004311DA /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C95B833D138F52B0004311DA /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C95B833E138F52B0004311DA /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C95B833F138F52B0004311DA /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C95B8340138F52B0004311DA /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; };
+               C95B8341138F52B0004311DA /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; };
+               C95B8342138F52B0004311DA /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C95B8343138F52B0004311DA /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C95B8344138F52B0004311DA /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C95B8345138F52B0004311DA /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C95B8346138F52B0004311DA /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C95B8347138F52B0004311DA /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C95B8348138F52B0004311DA /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C95B8349138F52B0004311DA /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C95B834A138F52B0004311DA /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C95B834B138F52B0004311DA /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C95B834C138F52B0004311DA /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C95B834D138F52B0004311DA /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C95B834E138F52B0004311DA /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C95B834F138F52B0004311DA /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C95B8350138F52B0004311DA /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C95B8351138F52B0004311DA /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C95B8352138F52B0004311DA /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C95B8353138F52B0004311DA /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C95B8354138F52B0004311DA /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C95B8355138F52B0004311DA /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C95B8356138F52B0004311DA /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C95B8357138F52B0004311DA /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C95B8358138F52B0004311DA /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C95B8359138F52B0004311DA /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C95B835A138F52B0004311DA /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C95B835B138F52B0004311DA /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C95B835C138F52B0004311DA /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C95B835D138F52B0004311DA /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C95B835E138F52B0004311DA /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C95B835F138F52B0004311DA /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C95B8360138F52B0004311DA /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C95B8361138F52B0004311DA /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C95B8362138F52B0004311DA /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C95B8363138F52B0004311DA /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C95B8364138F52B0004311DA /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C95B8365138F52B0004311DA /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; };
+               C95B8366138F52B0004311DA /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C95B8367138F52B0004311DA /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C95B8368138F52B0004311DA /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C95B8369138F52B0004311DA /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C95B836A138F52B0004311DA /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C95B836B138F52B0004311DA /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C95B836C138F52B0004311DA /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C95B836D138F52B0004311DA /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C95B836E138F52B0004311DA /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C95B836F138F52B0004311DA /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C95B8370138F52B0004311DA /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C95B8371138F52B0004311DA /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C95B8372138F52B0004311DA /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C95B8373138F52B0004311DA /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C95B8374138F52B0004311DA /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C95B8375138F52B0004311DA /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; };
+               C95B8376138F52B0004311DA /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C95B8377138F52B0004311DA /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C95B8378138F52B0004311DA /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C95B8379138F52B0004311DA /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C95B837A138F52B0004311DA /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C95B837B138F52B0004311DA /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C95B837C138F52B0004311DA /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C95B837D138F52B0004311DA /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C95B837E138F52B0004311DA /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; };
+               C95B837F138F52B0004311DA /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C95B8380138F52B0004311DA /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C95B8381138F52B0004311DA /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C95B8382138F52B0004311DA /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C95B8383138F52B0004311DA /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C95B8384138F52B0004311DA /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C95B8385138F52B0004311DA /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C95B8386138F52B0004311DA /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C95B8387138F52B0004311DA /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C95B8388138F52B0004311DA /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C95B8389138F52B0004311DA /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C95B838A138F52B0004311DA /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C95B838B138F52B0004311DA /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C95B838C138F52B0004311DA /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C95B838D138F52B0004311DA /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C95B838E138F52B0004311DA /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C95B838F138F52B0004311DA /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C95B8390138F52B0004311DA /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C95B8391138F52B0004311DA /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C95B8392138F52B0004311DA /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C95B8393138F52B0004311DA /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C95B8394138F52B0004311DA /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C95B8395138F52B0004311DA /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C95B8396138F52B0004311DA /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; };
+               C95B8397138F52B0004311DA /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; };
+               C95B8398138F52B0004311DA /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; };
+               C95B8399138F52B0004311DA /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C95B839A138F52B0004311DA /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C95B839B138F52B0004311DA /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; };
+               C95B839C138F52B0004311DA /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C95B839D138F52B0004311DA /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C95B839E138F52B0004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C95B839F138F52B0004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C95B83A0138F52B0004311DA /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C95B83A1138F52B0004311DA /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C95B83A2138F52B0004311DA /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C95B83A3138F52B0004311DA /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C95B83A4138F52B0004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C95B83A5138F52B0004311DA /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C95B83A6138F52B0004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C95B83A7138F52B0004311DA /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; };
+               C95B83A8138F52B0004311DA /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C95B83AB138F52B0004311DA /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C95B83AC138F52B0004311DA /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C95B83AE138F52B0004311DA /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C95B83AF138F52B0004311DA /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C95B83B0138F52B0004311DA /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C95B83B2138F52B0004311DA /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C95B83B3138F52B0004311DA /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C95B83B4138F52B0004311DA /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; };
+               C95B83B7138F52B0004311DA /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C95B83B8138F52B0004311DA /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C95B83BA138F52B0004311DA /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C95B83BC138F52B0004311DA /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C95B83BD138F52B0004311DA /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C95B83BE138F52B0004311DA /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C95B83BF138F52B0004311DA /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C95B83C0138F52B0004311DA /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C95B83C1138F52B0004311DA /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C95B83C2138F52B0004311DA /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C95B83C3138F52B0004311DA /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C95B83C4138F52B0004311DA /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C95B83C5138F52B0004311DA /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C95B83C6138F52B0004311DA /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C95B83C7138F52B0004311DA /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C95B83C8138F52B0004311DA /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C95B83C9138F52B0004311DA /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C95B83CA138F52B0004311DA /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C95B83CB138F52B0004311DA /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C95B83CC138F52B0004311DA /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C95B83CD138F52B0004311DA /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C95B83CE138F52B0004311DA /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C95B83CF138F52B0004311DA /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C95B83D0138F52B0004311DA /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C95B83D1138F52B0004311DA /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C95B83D2138F52B0004311DA /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C95B83D3138F52B0004311DA /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C95B83D4138F52B0004311DA /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C95B83D5138F52B0004311DA /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C95B83D6138F52B0004311DA /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C95B83D7138F52B0004311DA /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C95B83D8138F52B0004311DA /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C95B83D9138F52B0004311DA /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C95B83DA138F52B0004311DA /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C95B83DB138F52B0004311DA /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C95B83DC138F52B0004311DA /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C95B83DD138F52B0004311DA /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C95B83DE138F52B0004311DA /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C95B83DF138F52B0004311DA /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C95B83E0138F52B0004311DA /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C95B83E1138F52B0004311DA /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C95B83E2138F52B0004311DA /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C95B83E3138F52B0004311DA /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C95B83E4138F52B0004311DA /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C95B83E5138F52B0004311DA /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C95B83E6138F52B0004311DA /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C95B83E7138F52B0004311DA /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C95B83E8138F52B0004311DA /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C95B83E9138F52B0004311DA /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C95B83EA138F52B0004311DA /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C95B83EB138F52B0004311DA /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C95B83EC138F52B0004311DA /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C95B83ED138F52B0004311DA /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C95B83EE138F52B0004311DA /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C95B83EF138F52B0004311DA /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C95B83F0138F52B0004311DA /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; };
+               C95B83F1138F52B0004311DA /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C95B83F2138F52B0004311DA /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C95B83F3138F52B0004311DA /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C95B83F4138F52B0004311DA /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C95B83F5138F52B0004311DA /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C95B83F6138F52B0004311DA /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; };
+               C95B83F7138F52B0004311DA /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C95B83F8138F52B0004311DA /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; };
+               C95B83F9138F52B0004311DA /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C95B83FA138F52B0004311DA /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C95B83FB138F52B0004311DA /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C95B83FC138F52B0004311DA /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C95B83FD138F52B0004311DA /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C95B83FE138F52B0004311DA /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C95B83FF138F52B0004311DA /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C95B8400138F52B0004311DA /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C95B8401138F52B0004311DA /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C95B8402138F52B0004311DA /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C95B8403138F52B0004311DA /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C95B8404138F52B0004311DA /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C95B8405138F52B0004311DA /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C95B8406138F52B0004311DA /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C95B8407138F52B0004311DA /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C95B8408138F52B0004311DA /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C95B8409138F52B0004311DA /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C95B840A138F52B0004311DA /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C95B840B138F52B0004311DA /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C95B840C138F52B0004311DA /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C95B840D138F52B0004311DA /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C95B840E138F52B0004311DA /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C95B840F138F52B0004311DA /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C95B8410138F52B0004311DA /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C95B8411138F52B0004311DA /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C95B8412138F52B0004311DA /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C95B8413138F52B0004311DA /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C95B8414138F52B0004311DA /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C95B8415138F52B0004311DA /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C95B8416138F52B0004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C95B8417138F52B0004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C95B8418138F52B0004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C95B8419138F52B0004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C95B841A138F52B0004311DA /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C95B841B138F52B0004311DA /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C95B842E138F53DB004311DA /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C95B842F138F53DB004311DA /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C95B8430138F53DB004311DA /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C95B8431138F53DB004311DA /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C95B8432138F53DB004311DA /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C95B8433138F53DB004311DA /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C95B8435138F53DB004311DA /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C95B8436138F53DB004311DA /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C95B8437138F53DB004311DA /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C95B8438138F53DB004311DA /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; };
+               C95B8439138F53DB004311DA /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C95B843A138F53DB004311DA /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C95B843B138F53DB004311DA /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C95B843C138F53DB004311DA /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C95B843D138F53DB004311DA /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; };
+               C95B843E138F53DB004311DA /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; };
+               C95B843F138F53DB004311DA /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C95B8440138F53DB004311DA /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C95B8441138F53DB004311DA /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C95B8442138F53DB004311DA /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C95B8443138F53DB004311DA /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C95B8444138F53DB004311DA /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C95B8445138F53DB004311DA /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C95B8446138F53DB004311DA /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C95B8447138F53DB004311DA /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C95B8448138F53DB004311DA /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C95B8449138F53DB004311DA /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C95B844A138F53DB004311DA /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C95B844B138F53DB004311DA /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C95B844C138F53DB004311DA /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C95B844D138F53DB004311DA /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C95B844E138F53DB004311DA /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C95B844F138F53DB004311DA /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C95B8450138F53DB004311DA /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C95B8451138F53DB004311DA /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C95B8452138F53DB004311DA /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C95B8453138F53DB004311DA /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C95B8454138F53DB004311DA /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C95B8455138F53DB004311DA /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C95B8456138F53DB004311DA /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C95B8457138F53DB004311DA /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C95B8458138F53DB004311DA /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C95B8459138F53DB004311DA /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C95B845A138F53DB004311DA /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C95B845B138F53DB004311DA /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C95B845C138F53DB004311DA /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C95B845D138F53DB004311DA /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C95B845E138F53DB004311DA /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C95B845F138F53DB004311DA /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C95B8460138F53DB004311DA /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C95B8461138F53DB004311DA /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C95B8462138F53DB004311DA /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C95B8463138F53DB004311DA /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C95B8464138F53DB004311DA /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C95B8465138F53DB004311DA /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C95B8466138F53DB004311DA /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C95B8467138F53DB004311DA /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C95B8468138F53DB004311DA /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C95B8469138F53DB004311DA /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C95B846A138F53DB004311DA /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C95B846B138F53DB004311DA /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C95B846C138F53DB004311DA /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C95B846D138F53DB004311DA /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C95B846E138F53DB004311DA /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C95B846F138F53DB004311DA /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C95B8470138F53DB004311DA /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C95B8471138F53DB004311DA /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C95B8472138F53DB004311DA /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C95B8473138F53DB004311DA /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C95B8474138F53DB004311DA /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C95B8475138F53DB004311DA /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C95B8476138F53DB004311DA /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C95B8477138F53DB004311DA /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C95B8478138F53DB004311DA /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C95B8479138F53DB004311DA /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C95B847A138F53DB004311DA /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C95B847B138F53DB004311DA /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C95B847C138F53DB004311DA /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C95B847D138F53DB004311DA /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C95B847E138F53DB004311DA /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C95B847F138F53DB004311DA /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C95B8480138F53DB004311DA /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C95B8481138F53DB004311DA /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C95B8482138F53DB004311DA /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C95B8483138F53DB004311DA /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C95B8484138F53DB004311DA /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C95B8485138F53DB004311DA /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C95B8486138F53DB004311DA /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C95B8487138F53DB004311DA /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C95B8488138F53DB004311DA /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C95B8489138F53DB004311DA /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C95B848A138F53DB004311DA /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C95B848B138F53DB004311DA /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C95B848C138F53DB004311DA /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C95B848D138F53DB004311DA /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C95B848E138F53DB004311DA /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C95B848F138F53DB004311DA /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C95B8490138F53DB004311DA /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C95B8491138F53DB004311DA /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C95B8492138F53DB004311DA /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; };
+               C95B8493138F53DB004311DA /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; };
+               C95B8494138F53DB004311DA /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C95B8495138F53DB004311DA /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C95B8496138F53DB004311DA /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C95B8497138F53DB004311DA /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C95B8498138F53DB004311DA /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C95B8499138F53DB004311DA /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C95B849A138F53DB004311DA /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C95B849B138F53DB004311DA /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C95B849C138F53DB004311DA /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C95B849D138F53DB004311DA /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; };
+               C95B849E138F53DB004311DA /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; };
+               C95B849F138F53DB004311DA /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C95B84A0138F53DB004311DA /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C95B84A1138F53DB004311DA /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; };
+               C95B84A2138F53DB004311DA /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C95B84A3138F53DB004311DA /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C95B84A4138F53DB004311DA /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C95B84A5138F53DB004311DA /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C95B84A6138F53DB004311DA /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C95B84A7138F53DB004311DA /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C95B84A8138F53DB004311DA /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; };
+               C95B84A9138F53DB004311DA /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C95B84AA138F53DB004311DA /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C95B84AB138F53DB004311DA /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C95B84AC138F53DB004311DA /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C95B84AD138F53DB004311DA /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C95B84AE138F53DB004311DA /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C95B84AF138F53DB004311DA /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; };
+               C95B84B0138F53DB004311DA /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C95B84B1138F53DB004311DA /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C95B84B2138F53DB004311DA /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C95B84B3138F53DB004311DA /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; };
+               C95B84B4138F53DB004311DA /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C95B84B5138F53DB004311DA /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C95B84B6138F53DB004311DA /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C95B84B7138F53DB004311DA /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C95B84B8138F53DB004311DA /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C95B84B9138F53DB004311DA /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C95B84BA138F53DB004311DA /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; };
+               C95B84BB138F53DB004311DA /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C95B84BC138F53DB004311DA /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; };
+               C95B84BD138F53DB004311DA /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C95B84BE138F53DB004311DA /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_POPEN"; }; };
+               C95B84BF138F53DB004311DA /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PSELECT $(FreeBSD_CFLAGS)"; }; };
+               C95B84C0138F53DB004311DA /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C95B84C1138F53DB004311DA /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C95B84C2138F53DB004311DA /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; };
+               C95B84C3138F53DB004311DA /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C95B84C4138F53DB004311DA /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; };
+               C95B84C5138F53DB004311DA /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; };
+               C95B84C6138F53DB004311DA /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C95B84C7138F53DB004311DA /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; };
+               C95B84C8138F53DB004311DA /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C95B84C9138F53DB004311DA /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; };
+               C95B84CA138F53DB004311DA /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C95B84CB138F53DB004311DA /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C95B84CC138F53DB004311DA /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C95B84CD138F53DB004311DA /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C95B84CE138F53DB004311DA /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C95B84CF138F53DB004311DA /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C95B84D0138F53DB004311DA /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C95B84D1138F53DB004311DA /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C95B84D2138F53DB004311DA /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C95B84D3138F53DB004311DA /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C95B84D4138F53DB004311DA /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C95B84D5138F53DB004311DA /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; };
+               C95B84D6138F53DB004311DA /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C95B84D7138F53DB004311DA /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C95B84D8138F53DB004311DA /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C95B84D9138F53DB004311DA /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; };
+               C95B84DA138F53DB004311DA /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; };
+               C95B84DB138F53DB004311DA /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C95B84DC138F53DB004311DA /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C95B84DD138F53DB004311DA /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C95B84DE138F53DB004311DA /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C95B84DF138F53DB004311DA /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C95B84E0138F53DB004311DA /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C95B84E1138F53DB004311DA /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C95B84E2138F53DB004311DA /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C95B84E3138F53DB004311DA /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C95B84E4138F53DB004311DA /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C95B84E5138F53DB004311DA /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; };
+               C95B84E6138F53DB004311DA /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C95B84E7138F53DB004311DA /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C95B84E8138F53DB004311DA /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C95B84E9138F53DB004311DA /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C95B84EA138F53DB004311DA /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C95B84EB138F53DB004311DA /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C95B84EC138F53DB004311DA /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C95B84ED138F53DB004311DA /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C95B84EE138F53DB004311DA /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C95B84EF138F53DB004311DA /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C95B84F0138F53DB004311DA /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C95B84F1138F53DB004311DA /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; };
+               C95B84F2138F53DB004311DA /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C95B84F3138F53DB004311DA /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C95B84F4138F53DB004311DA /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C95B84F5138F53DB004311DA /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C95B84F6138F53DB004311DA /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C95B84F7138F53DB004311DA /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C95B84F8138F53DB004311DA /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C95B84F9138F53DB004311DA /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C95B84FA138F53DB004311DA /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C95B84FB138F53DB004311DA /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C95B84FC138F53DB004311DA /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C95B84FD138F53DB004311DA /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C95B84FE138F53DB004311DA /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C95B84FF138F53DB004311DA /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C95B8500138F53DB004311DA /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C95B8502138F53DB004311DA /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C95B8503138F53DB004311DA /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C95B8504138F53DB004311DA /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C95B8505138F53DB004311DA /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C95B8506138F53DB004311DA /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C95B8507138F53DB004311DA /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C95B8508138F53DB004311DA /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C95B8509138F53DB004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C95B850A138F53DB004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C95B850B138F53DB004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C95B850C138F53DB004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C95B850D138F53DB004311DA /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C95B850E138F53DB004311DA /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C95B850F138F53DB004311DA /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C95B8522138F53DB004311DA /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C95B8523138F53DB004311DA /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C95B8524138F53DB004311DA /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C95B8525138F53DB004311DA /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C95B8526138F53DB004311DA /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C95B8527138F53DB004311DA /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C95B8528138F53DB004311DA /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C95B8529138F53DB004311DA /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C95B852A138F53DB004311DA /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C95B852B138F53DB004311DA /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C95B852C138F53DB004311DA /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C95B852D138F53DB004311DA /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C95B852E138F53DB004311DA /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C95B852F138F53DB004311DA /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C95B8530138F53DB004311DA /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C95B8531138F53DB004311DA /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C95B8532138F53DB004311DA /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C95B8533138F53DB004311DA /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C95B8534138F53DB004311DA /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C95B8535138F53DB004311DA /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C95B8536138F53DB004311DA /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C95B8537138F53DB004311DA /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C95B8538138F53DB004311DA /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C95B8539138F53DB004311DA /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C95B853A138F53DB004311DA /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C95B853B138F53DB004311DA /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C95B853C138F53DB004311DA /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C95B853D138F53DB004311DA /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C95B853E138F53DB004311DA /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C95B853F138F53DB004311DA /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C95B8540138F53DB004311DA /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C95B8541138F53DB004311DA /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C95B8542138F53DB004311DA /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C95B8543138F53DB004311DA /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C95B8544138F53DB004311DA /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C95B8545138F53DB004311DA /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C95B8546138F53DB004311DA /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C95B8547138F53DB004311DA /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C95B8548138F53DB004311DA /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; };
+               C95B8549138F53DB004311DA /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C95B854A138F53DB004311DA /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C95B854B138F53DB004311DA /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C95B854C138F53DB004311DA /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C95B854D138F53DB004311DA /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C95B854E138F53DB004311DA /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C95B854F138F53DB004311DA /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C95B8550138F53DB004311DA /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C95B8551138F53DB004311DA /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C95B8552138F53DB004311DA /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C95B8553138F53DB004311DA /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C95B8554138F53DB004311DA /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C95B8555138F53DB004311DA /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C95B8556138F53DB004311DA /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C95B8557138F53DB004311DA /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C95B8558138F53DB004311DA /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C95B8559138F53DB004311DA /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C95B855A138F53DB004311DA /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C95B855B138F53DB004311DA /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C95B855C138F53DB004311DA /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C95B855D138F53DB004311DA /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C95B855E138F53DB004311DA /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C95B855F138F53DB004311DA /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C95B8560138F53DB004311DA /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C95B8561138F53DB004311DA /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C95B8562138F53DB004311DA /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C95B8563138F53DB004311DA /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C95B8564138F53DB004311DA /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C95B8565138F53DB004311DA /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C95B8566138F53DB004311DA /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C95B8567138F53DB004311DA /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C95B8568138F53DB004311DA /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C95B8569138F53DB004311DA /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C95B856A138F53DB004311DA /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C95B856B138F53DB004311DA /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C95B856C138F53DB004311DA /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C95B856D138F53DB004311DA /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C95B856E138F53DB004311DA /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C95B856F138F53DB004311DA /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C95B8570138F53DB004311DA /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C95B8571138F53DB004311DA /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C95B8572138F53DB004311DA /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C95B8573138F53DB004311DA /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C95B8574138F53DB004311DA /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C95B8575138F53DB004311DA /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C95B8576138F53DB004311DA /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C95B8577138F53DB004311DA /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C95B8578138F53DB004311DA /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C95B8579138F53DB004311DA /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C95B8582138F53DB004311DA /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C95B8583138F53DB004311DA /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; };
+               C95B8584138F53DB004311DA /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C95B8585138F53DB004311DA /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; };
+               C95B8586138F53DB004311DA /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; };
+               C95B8587138F53DB004311DA /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; };
+               C95B8588138F53DB004311DA /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C95B8589138F53DB004311DA /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C95B858A138F53DB004311DA /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C95B858D138F53DB004311DA /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C95B8590138F53DB004311DA /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C95B8591138F53DB004311DA /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C95B8592138F53DB004311DA /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C95B8593138F53DB004311DA /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C95B8594138F53DB004311DA /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C95B8595138F53DB004311DA /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C95B8596138F53DB004311DA /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C95B8597138F53DB004311DA /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C95B8598138F53DB004311DA /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C95B8599138F53DB004311DA /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C95B859A138F53DB004311DA /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C95B859B138F53DB004311DA /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C95B859C138F53DB004311DA /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C95B859D138F53DB004311DA /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C95B859E138F53DB004311DA /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C95B859F138F53DB004311DA /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C95B85A0138F53DB004311DA /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C95B85A1138F53DB004311DA /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C95B85A2138F53DB004311DA /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C95B85A3138F53DB004311DA /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FDOPEN"; }; };
+               C95B85A4138F53DB004311DA /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C95B85A5138F53DB004311DA /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C95B85A6138F53DB004311DA /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C95B85A7138F53DB004311DA /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C95B85A8138F53DB004311DA /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C95B85A9138F53DB004311DA /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C95B85AA138F53DB004311DA /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C95B85AB138F53DB004311DA /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C95B85AC138F53DB004311DA /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C95B85AD138F53DB004311DA /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C95B85AE138F53DB004311DA /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C95B85AF138F53DB004311DA /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C95B85B0138F53DB004311DA /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C95B85B1138F53DB004311DA /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FOPEN"; }; };
+               C95B85B2138F53DB004311DA /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C95B85B3138F53DB004311DA /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C95B85B4138F53DB004311DA /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C95B85B5138F53DB004311DA /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; };
+               C95B85B6138F53DB004311DA /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C95B85B7138F53DB004311DA /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C95B85B8138F53DB004311DA /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C95B85B9138F53DB004311DA /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; };
+               C95B85BA138F53DB004311DA /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C95B85BB138F53DB004311DA /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C95B85BC138F53DB004311DA /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C95B85BD138F53DB004311DA /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C95B85BE138F53DB004311DA /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C95B85BF138F53DB004311DA /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C95B85C0138F53DB004311DA /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C95B85C1138F53DB004311DA /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C95B85C2138F53DB004311DA /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C95B85C3138F53DB004311DA /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; };
+               C95B85C4138F53DB004311DA /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C95B85C5138F53DB004311DA /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C95B85C6138F53DB004311DA /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C95B85C7138F53DB004311DA /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C95B85C8138F53DB004311DA /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C95B85C9138F53DB004311DA /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C95B85CA138F53DB004311DA /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C95B85CB138F53DB004311DA /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C95B85CC138F53DB004311DA /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C95B85CD138F53DB004311DA /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C95B85CE138F53DB004311DA /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C95B85CF138F53DB004311DA /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C95B85D0138F53DB004311DA /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C95B85D1138F53DB004311DA /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C95B85D2138F53DB004311DA /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C95B85D3138F53DB004311DA /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C95B85D4138F53DB004311DA /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C95B85D5138F53DB004311DA /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C95B85D6138F53DB004311DA /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C95B85D7138F53DB004311DA /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C95B85D8138F53DB004311DA /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C95B85D9138F53DB004311DA /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C95B85DA138F53DB004311DA /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C95B85DB138F53DB004311DA /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C95B85DC138F53DB004311DA /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C95B85DD138F53DB004311DA /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C95B85DE138F53DB004311DA /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C95B85DF138F53DB004311DA /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C95B85E0138F53DB004311DA /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C95B85E1138F53DB004311DA /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C95B85E2138F53DB004311DA /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C95B85E3138F53DB004311DA /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C95B85E4138F53DB004311DA /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C95B85E5138F53DB004311DA /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C95B85E6138F53DB004311DA /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; };
+               C95B85E7138F53DB004311DA /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; };
+               C95B85E8138F53DB004311DA /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C95B85E9138F53DB004311DA /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C95B85EA138F53DB004311DA /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C95B85EB138F53DB004311DA /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C95B85EC138F53DB004311DA /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C95B85ED138F53DB004311DA /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C95B85EE138F53DB004311DA /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C95B85EF138F53DB004311DA /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C95B85F0138F53DB004311DA /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C95B85F1138F53DB004311DA /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C95B85F2138F53DB004311DA /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C95B85F3138F53DB004311DA /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C95B85F4138F53DB004311DA /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C95B85F5138F53DB004311DA /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C95B85F6138F53DB004311DA /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C95B85F7138F53DB004311DA /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C95B85F8138F53DB004311DA /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C95B85F9138F53DB004311DA /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C95B85FA138F53DB004311DA /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C95B85FB138F53DB004311DA /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C95B85FC138F53DB004311DA /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C95B85FD138F53DB004311DA /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C95B85FE138F53DB004311DA /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C95B85FF138F53DB004311DA /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C95B8600138F53DB004311DA /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C95B8601138F53DB004311DA /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C95B8602138F53DB004311DA /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C95B8603138F53DB004311DA /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C95B8604138F53DB004311DA /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C95B8605138F53DB004311DA /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C95B8606138F53DB004311DA /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C95B8607138F53DB004311DA /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C95B8608138F53DB004311DA /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C95B8609138F53DB004311DA /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C95B860A138F53DB004311DA /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C95B860B138F53DB004311DA /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; };
+               C95B860C138F53DB004311DA /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C95B860D138F53DB004311DA /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C95B860E138F53DB004311DA /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C95B860F138F53DB004311DA /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C95B8610138F53DB004311DA /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C95B8611138F53DB004311DA /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C95B8612138F53DB004311DA /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C95B8613138F53DB004311DA /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C95B8614138F53DB004311DA /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C95B8615138F53DB004311DA /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C95B8616138F53DB004311DA /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C95B8617138F53DB004311DA /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C95B8618138F53DB004311DA /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C95B8619138F53DB004311DA /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C95B861A138F53DB004311DA /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C95B861B138F53DB004311DA /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; };
+               C95B861C138F53DB004311DA /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C95B861D138F53DB004311DA /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C95B861E138F53DB004311DA /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C95B861F138F53DB004311DA /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C95B8620138F53DB004311DA /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C95B8621138F53DB004311DA /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C95B8622138F53DB004311DA /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C95B8623138F53DB004311DA /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C95B8624138F53DB004311DA /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; };
+               C95B8625138F53DB004311DA /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C95B8626138F53DB004311DA /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C95B8627138F53DB004311DA /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C95B8628138F53DB004311DA /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C95B8629138F53DB004311DA /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C95B862A138F53DB004311DA /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C95B862B138F53DB004311DA /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C95B862C138F53DB004311DA /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C95B862D138F53DB004311DA /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C95B862E138F53DB004311DA /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C95B862F138F53DB004311DA /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C95B8630138F53DB004311DA /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C95B8631138F53DB004311DA /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C95B8632138F53DB004311DA /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C95B8633138F53DB004311DA /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C95B8634138F53DB004311DA /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C95B8635138F53DB004311DA /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C95B8636138F53DB004311DA /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C95B8637138F53DB004311DA /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C95B8638138F53DB004311DA /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C95B8639138F53DB004311DA /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C95B863A138F53DB004311DA /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C95B863B138F53DB004311DA /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C95B863C138F53DB004311DA /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; };
+               C95B863D138F53DB004311DA /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; };
+               C95B863E138F53DB004311DA /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; };
+               C95B863F138F53DB004311DA /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C95B8640138F53DB004311DA /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C95B8641138F53DB004311DA /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; };
+               C95B8642138F53DB004311DA /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C95B8643138F53DB004311DA /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C95B8644138F53DB004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C95B8645138F53DB004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C95B8646138F53DB004311DA /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C95B8647138F53DB004311DA /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C95B8648138F53DB004311DA /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C95B8649138F53DB004311DA /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C95B864A138F53DB004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C95B864B138F53DB004311DA /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C95B864C138F53DB004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C95B864D138F53DB004311DA /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; };
+               C95B864E138F53DB004311DA /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C95B8651138F53DB004311DA /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C95B8652138F53DB004311DA /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C95B8654138F53DB004311DA /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C95B8655138F53DB004311DA /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C95B8656138F53DB004311DA /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C95B8658138F53DB004311DA /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C95B8659138F53DB004311DA /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C95B865A138F53DB004311DA /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; };
+               C95B865D138F53DB004311DA /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C95B865E138F53DB004311DA /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C95B8660138F53DB004311DA /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C95B8662138F53DB004311DA /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C95B8663138F53DB004311DA /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C95B8664138F53DB004311DA /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C95B8665138F53DB004311DA /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C95B8666138F53DB004311DA /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C95B8667138F53DB004311DA /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C95B8668138F53DB004311DA /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C95B8669138F53DB004311DA /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C95B866A138F53DB004311DA /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C95B866B138F53DB004311DA /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C95B866C138F53DB004311DA /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C95B866D138F53DB004311DA /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C95B866E138F53DB004311DA /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C95B866F138F53DB004311DA /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C95B8670138F53DB004311DA /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C95B8671138F53DB004311DA /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C95B8672138F53DB004311DA /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C95B8673138F53DB004311DA /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C95B8674138F53DB004311DA /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C95B8675138F53DB004311DA /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C95B8676138F53DB004311DA /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C95B8677138F53DB004311DA /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C95B8678138F53DB004311DA /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C95B8679138F53DB004311DA /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C95B867A138F53DB004311DA /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C95B867B138F53DB004311DA /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C95B867C138F53DB004311DA /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C95B867D138F53DB004311DA /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C95B867E138F53DB004311DA /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C95B867F138F53DB004311DA /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C95B8680138F53DB004311DA /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C95B8681138F53DB004311DA /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C95B8682138F53DB004311DA /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C95B8683138F53DB004311DA /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C95B8684138F53DB004311DA /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C95B8685138F53DB004311DA /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C95B8686138F53DB004311DA /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C95B8687138F53DB004311DA /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C95B8688138F53DB004311DA /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C95B8689138F53DB004311DA /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C95B868A138F53DB004311DA /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C95B868B138F53DB004311DA /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C95B868C138F53DB004311DA /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C95B868D138F53DB004311DA /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C95B868E138F53DB004311DA /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C95B868F138F53DB004311DA /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C95B8690138F53DB004311DA /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C95B8691138F53DB004311DA /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C95B8692138F53DB004311DA /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C95B8693138F53DB004311DA /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C95B8694138F53DB004311DA /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C95B8695138F53DB004311DA /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C95B8696138F53DB004311DA /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; };
+               C95B8697138F53DB004311DA /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C95B8698138F53DB004311DA /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C95B8699138F53DB004311DA /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C95B869A138F53DB004311DA /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C95B869B138F53DB004311DA /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C95B869C138F53DB004311DA /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; };
+               C95B869D138F53DB004311DA /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C95B869E138F53DB004311DA /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; };
+               C95B869F138F53DB004311DA /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C95B86A0138F53DB004311DA /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C95B86A1138F53DB004311DA /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C95B86A2138F53DB004311DA /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C95B86A3138F53DB004311DA /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C95B86A4138F53DB004311DA /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C95B86A5138F53DB004311DA /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C95B86A6138F53DB004311DA /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C95B86A7138F53DB004311DA /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C95B86A8138F53DB004311DA /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C95B86A9138F53DB004311DA /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C95B86AA138F53DB004311DA /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C95B86AB138F53DB004311DA /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C95B86AC138F53DB004311DA /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C95B86AD138F53DB004311DA /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C95B86AE138F53DB004311DA /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C95B86AF138F53DB004311DA /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C95B86B0138F53DB004311DA /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C95B86B1138F53DB004311DA /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C95B86B2138F53DB004311DA /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C95B86B3138F53DB004311DA /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C95B86B4138F53DB004311DA /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C95B86B5138F53DB004311DA /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C95B86B6138F53DB004311DA /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C95B86B7138F53DB004311DA /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C95B86B8138F53DB004311DA /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C95B86B9138F53DB004311DA /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C95B86BA138F53DB004311DA /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C95B86BB138F53DB004311DA /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C95B86BC138F53DB004311DA /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C95B86BD138F53DB004311DA /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C95B86BE138F53DB004311DA /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C95B86BF138F53DB004311DA /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C95B86C0138F53DB004311DA /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C95B86C1138F53DB004311DA /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C965CBF2143BBEC7003912CE /* deps.c in Sources */ = {isa = PBXBuildFile; fileRef = C965CBF1143BBEC7003912CE /* deps.c */; };
+               C9765EB2138EC61900741512 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C9765EB3138EC61900741512 /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C9765EB4138EC61900741512 /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C9765EB5138EC61900741512 /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C9765EB6138EC61900741512 /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C9765EB7138EC61900741512 /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C9765EB9138EC61900741512 /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C9765EBA138EC61900741512 /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C9765EBB138EC61900741512 /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C9765EBC138EC61900741512 /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; };
+               C9765EBD138EC61900741512 /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C9765EBE138EC61900741512 /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C9765EBF138EC61900741512 /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C9765EC0138EC61900741512 /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C9765EC1138EC61900741512 /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; };
+               C9765EC2138EC61900741512 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; };
+               C9765EC3138EC61900741512 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C9765EC4138EC61900741512 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C9765EC5138EC61900741512 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C9765EC6138EC61900741512 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C9765EC7138EC61900741512 /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C9765EC8138EC61900741512 /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C9765EC9138EC61900741512 /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C9765ECA138EC61900741512 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C9765ECB138EC61900741512 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C9765ECC138EC61900741512 /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C9765ECD138EC61900741512 /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C9765ECE138EC61900741512 /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C9765ECF138EC61900741512 /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C9765ED0138EC61900741512 /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C9765ED1138EC61900741512 /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C9765ED2138EC61900741512 /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C9765ED3138EC61900741512 /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C9765ED4138EC61900741512 /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C9765ED5138EC61900741512 /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C9765ED6138EC61900741512 /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C9765ED7138EC61900741512 /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C9765ED8138EC61900741512 /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C9765ED9138EC61900741512 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C9765EDA138EC61900741512 /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C9765EDB138EC61900741512 /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C9765EDC138EC61900741512 /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C9765EDD138EC61900741512 /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C9765EDE138EC61900741512 /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C9765EDF138EC61900741512 /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C9765EE0138EC61900741512 /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C9765EE1138EC61900741512 /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C9765EE2138EC61900741512 /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C9765EE3138EC61900741512 /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C9765EE4138EC61900741512 /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C9765EE5138EC61900741512 /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C9765EE6138EC61900741512 /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C9765EE7138EC61900741512 /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C9765EE8138EC61900741512 /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C9765EE9138EC61900741512 /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C9765EEA138EC61900741512 /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C9765EEB138EC61900741512 /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C9765EEC138EC61900741512 /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C9765EED138EC61900741512 /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C9765EEE138EC61900741512 /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C9765EEF138EC61900741512 /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C9765EF0138EC61900741512 /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C9765EF1138EC61900741512 /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C9765EF2138EC61900741512 /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C9765EF3138EC61900741512 /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C9765EF4138EC61900741512 /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C9765EF5138EC61900741512 /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C9765EF6138EC61900741512 /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C9765EF7138EC61900741512 /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C9765EF8138EC61900741512 /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C9765EF9138EC61900741512 /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C9765EFA138EC61900741512 /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C9765EFB138EC61900741512 /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C9765EFC138EC61900741512 /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C9765EFD138EC61900741512 /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C9765EFE138EC61900741512 /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C9765EFF138EC61900741512 /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C9765F00138EC61900741512 /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C9765F01138EC61900741512 /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C9765F02138EC61900741512 /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C9765F03138EC61900741512 /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C9765F04138EC61900741512 /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C9765F05138EC61900741512 /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C9765F06138EC61900741512 /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C9765F07138EC61900741512 /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C9765F08138EC61900741512 /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C9765F09138EC61900741512 /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C9765F0A138EC61900741512 /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C9765F0B138EC61900741512 /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C9765F0C138EC61900741512 /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C9765F0D138EC61900741512 /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C9765F0E138EC61900741512 /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C9765F0F138EC61900741512 /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C9765F10138EC61900741512 /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C9765F11138EC61900741512 /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C9765F12138EC61900741512 /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C9765F13138EC61900741512 /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C9765F14138EC61900741512 /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C9765F15138EC61900741512 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C9765F16138EC61900741512 /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; };
+               C9765F17138EC61900741512 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; };
+               C9765F18138EC61900741512 /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C9765F19138EC61900741512 /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C9765F1A138EC61900741512 /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C9765F1B138EC61900741512 /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C9765F1C138EC61900741512 /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C9765F1D138EC61900741512 /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C9765F1E138EC61900741512 /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C9765F1F138EC61900741512 /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C9765F20138EC61900741512 /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C9765F21138EC61900741512 /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; };
+               C9765F22138EC61900741512 /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; };
+               C9765F23138EC61900741512 /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C9765F24138EC61900741512 /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; };
+               C9765F25138EC61900741512 /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; };
+               C9765F26138EC61900741512 /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C9765F27138EC61900741512 /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C9765F28138EC61900741512 /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C9765F29138EC61900741512 /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C9765F2A138EC61900741512 /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C9765F2B138EC61900741512 /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C9765F2C138EC61900741512 /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; };
+               C9765F2D138EC61900741512 /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C9765F2E138EC61900741512 /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C9765F2F138EC61900741512 /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C9765F30138EC61900741512 /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C9765F31138EC61900741512 /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C9765F32138EC61900741512 /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C9765F33138EC61900741512 /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; };
+               C9765F34138EC61900741512 /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C9765F35138EC61900741512 /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C9765F36138EC61900741512 /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C9765F37138EC61900741512 /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; };
+               C9765F38138EC61900741512 /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C9765F39138EC61900741512 /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C9765F3A138EC61900741512 /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C9765F3B138EC61900741512 /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C9765F3C138EC61900741512 /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C9765F3D138EC61900741512 /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C9765F3E138EC61900741512 /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; };
+               C9765F3F138EC61900741512 /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C9765F40138EC61900741512 /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; };
+               C9765F41138EC61900741512 /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C9765F42138EC61900741512 /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; };
+               C9765F43138EC61900741512 /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PSELECT"; }; };
+               C9765F44138EC61900741512 /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C9765F45138EC61900741512 /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C9765F46138EC61900741512 /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; };
+               C9765F47138EC61900741512 /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C9765F48138EC61900741512 /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; };
+               C9765F49138EC61900741512 /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; };
+               C9765F4A138EC61900741512 /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C9765F4B138EC61900741512 /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; };
+               C9765F4C138EC61900741512 /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C9765F4D138EC61900741512 /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; };
+               C9765F4E138EC61900741512 /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C9765F4F138EC61900741512 /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C9765F50138EC61900741512 /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C9765F51138EC61900741512 /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C9765F52138EC61900741512 /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C9765F53138EC61900741512 /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C9765F54138EC61900741512 /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C9765F55138EC61900741512 /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C9765F56138EC61900741512 /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C9765F57138EC61900741512 /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C9765F58138EC61900741512 /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C9765F59138EC61900741512 /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; };
+               C9765F5A138EC61900741512 /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C9765F5B138EC61900741512 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C9765F5C138EC61900741512 /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C9765F5D138EC61900741512 /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; };
+               C9765F5E138EC61900741512 /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; };
+               C9765F5F138EC61900741512 /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C9765F60138EC61900741512 /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C9765F61138EC61900741512 /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C9765F62138EC61900741512 /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C9765F63138EC61900741512 /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C9765F64138EC61900741512 /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C9765F65138EC61900741512 /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C9765F66138EC61900741512 /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C9765F67138EC61900741512 /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C9765F68138EC61900741512 /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C9765F69138EC61900741512 /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; };
+               C9765F6A138EC61900741512 /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C9765F6B138EC61900741512 /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C9765F6C138EC61900741512 /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C9765F6D138EC61900741512 /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C9765F6E138EC61900741512 /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C9765F6F138EC61900741512 /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C9765F70138EC61900741512 /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C9765F71138EC61900741512 /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C9765F72138EC61900741512 /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C9765F73138EC61900741512 /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C9765F74138EC61900741512 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C9765F75138EC61900741512 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; };
+               C9765F76138EC61900741512 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C9765F77138EC61900741512 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C9765F78138EC61900741512 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C9765F79138EC61900741512 /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C9765F7A138EC61900741512 /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C9765F7B138EC61900741512 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C9765F7C138EC61900741512 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C9765F7D138EC61900741512 /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C9765F7E138EC61900741512 /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C9765F7F138EC61900741512 /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C9765F80138EC61900741512 /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C9765F81138EC61900741512 /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C9765F82138EC61900741512 /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C9765F83138EC61900741512 /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C9765F84138EC61900741512 /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C9765F86138EC61900741512 /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C9765F87138EC61900741512 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C9765F88138EC61900741512 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C9765F89138EC61900741512 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C9765F8A138EC61900741512 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C9765F8B138EC61900741512 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C9765F8C138EC61900741512 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C9765F8D138EC61900741512 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C9765F8E138EC61900741512 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C9765F8F138EC61900741512 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C9765F90138EC61900741512 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C9765F91138EC61900741512 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C9765F92138EC61900741512 /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C9765F93138EC61900741512 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C9765FA6138EC61900741512 /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C9765FA7138EC61900741512 /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C9765FA8138EC61900741512 /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C9765FA9138EC61900741512 /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C9765FAA138EC61900741512 /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C9765FAB138EC61900741512 /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C9765FAC138EC61900741512 /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C9765FAD138EC61900741512 /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C9765FAE138EC61900741512 /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C9765FAF138EC61900741512 /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C9765FB0138EC61900741512 /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C9765FB1138EC61900741512 /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C9765FB2138EC61900741512 /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C9765FB3138EC61900741512 /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C9765FB4138EC61900741512 /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C9765FB5138EC61900741512 /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C9765FB6138EC61900741512 /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C9765FB7138EC61900741512 /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C9765FB8138EC61900741512 /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C9765FB9138EC61900741512 /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C9765FBA138EC61900741512 /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C9765FBB138EC61900741512 /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C9765FBC138EC61900741512 /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C9765FBD138EC61900741512 /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C9765FBE138EC61900741512 /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C9765FBF138EC61900741512 /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C9765FC0138EC61900741512 /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C9765FC1138EC61900741512 /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C9765FC2138EC61900741512 /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C9765FC3138EC61900741512 /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C9765FC4138EC61900741512 /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C9765FC5138EC61900741512 /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C9765FC6138EC61900741512 /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C9765FC7138EC61900741512 /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C9765FC8138EC61900741512 /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C9765FC9138EC61900741512 /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C9765FCA138EC61900741512 /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C9765FCB138EC61900741512 /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C9765FCC138EC61900741512 /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; };
+               C9765FCD138EC61900741512 /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C9765FCE138EC61900741512 /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C9765FCF138EC61900741512 /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C9765FD0138EC61900741512 /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C9765FD1138EC61900741512 /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C9765FD2138EC61900741512 /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C9765FD3138EC61900741512 /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C9765FD4138EC61900741512 /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C9765FD5138EC61900741512 /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C9765FD6138EC61900741512 /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C9765FD7138EC61900741512 /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C9765FD8138EC61900741512 /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C9765FD9138EC61900741512 /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C9765FDA138EC61900741512 /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C9765FDB138EC61900741512 /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C9765FDC138EC61900741512 /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C9765FDD138EC61900741512 /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C9765FDE138EC61900741512 /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C9765FDF138EC61900741512 /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C9765FE0138EC61900741512 /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C9765FE1138EC61900741512 /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C9765FE2138EC61900741512 /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C9765FE3138EC61900741512 /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C9765FE4138EC61900741512 /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C9765FE5138EC61900741512 /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C9765FE6138EC61900741512 /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C9765FE7138EC61900741512 /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C9765FE8138EC61900741512 /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C9765FE9138EC61900741512 /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C9765FEA138EC61900741512 /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C9765FEB138EC61900741512 /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C9765FEC138EC61900741512 /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C9765FED138EC61900741512 /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C9765FEE138EC61900741512 /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C9765FEF138EC61900741512 /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C9765FF0138EC61900741512 /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C9765FF1138EC61900741512 /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C9765FF2138EC61900741512 /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C9765FF3138EC61900741512 /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C9765FF4138EC61900741512 /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C9765FF5138EC61900741512 /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C9765FF6138EC61900741512 /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C9765FF7138EC61900741512 /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C9765FF8138EC61900741512 /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C9765FF9138EC61900741512 /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C9765FFA138EC61900741512 /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C9765FFB138EC61900741512 /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C9765FFC138EC61900741512 /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C9765FFD138EC61900741512 /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C9766006138EC61900741512 /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C9766007138EC61900741512 /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; };
+               C9766008138EC61900741512 /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C9766009138EC61900741512 /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; };
+               C976600A138EC61900741512 /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; };
+               C976600B138EC61900741512 /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; };
+               C976600C138EC61900741512 /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C976600D138EC61900741512 /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C976600E138EC61900741512 /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C9766011138EC61900741512 /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C9766014138EC61900741512 /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C9766015138EC61900741512 /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C9766016138EC61900741512 /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C9766017138EC61900741512 /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C9766018138EC61900741512 /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C9766019138EC61900741512 /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C976601A138EC61A00741512 /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C976601B138EC61A00741512 /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C976601C138EC61A00741512 /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C976601D138EC61A00741512 /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C976601E138EC61A00741512 /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C976601F138EC61A00741512 /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C9766020138EC61A00741512 /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C9766021138EC61A00741512 /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C9766022138EC61A00741512 /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C9766023138EC61A00741512 /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C9766024138EC61A00741512 /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C9766025138EC61A00741512 /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C9766026138EC61A00741512 /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C9766027138EC61A00741512 /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; };
+               C9766028138EC61A00741512 /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C9766029138EC61A00741512 /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C976602A138EC61A00741512 /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C976602B138EC61A00741512 /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C976602C138EC61A00741512 /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C976602D138EC61A00741512 /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C976602E138EC61A00741512 /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C976602F138EC61A00741512 /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C9766030138EC61A00741512 /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C9766031138EC61A00741512 /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C9766032138EC61A00741512 /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C9766033138EC61A00741512 /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C9766034138EC61A00741512 /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C9766035138EC61A00741512 /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; };
+               C9766036138EC61A00741512 /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C9766037138EC61A00741512 /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C9766038138EC61A00741512 /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C9766039138EC61A00741512 /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; };
+               C976603A138EC61A00741512 /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C976603B138EC61A00741512 /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C976603C138EC61A00741512 /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C976603D138EC61A00741512 /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; };
+               C976603E138EC61A00741512 /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C976603F138EC61A00741512 /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C9766040138EC61A00741512 /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C9766041138EC61A00741512 /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C9766042138EC61A00741512 /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C9766043138EC61A00741512 /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C9766044138EC61A00741512 /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C9766045138EC61A00741512 /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C9766046138EC61A00741512 /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C9766047138EC61A00741512 /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; };
+               C9766048138EC61A00741512 /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C9766049138EC61A00741512 /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C976604A138EC61A00741512 /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C976604B138EC61A00741512 /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C976604C138EC61A00741512 /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C976604D138EC61A00741512 /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C976604E138EC61A00741512 /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C976604F138EC61A00741512 /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C9766050138EC61A00741512 /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C9766051138EC61A00741512 /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C9766052138EC61A00741512 /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C9766053138EC61A00741512 /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C9766054138EC61A00741512 /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C9766055138EC61A00741512 /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C9766056138EC61A00741512 /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C9766057138EC61A00741512 /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C9766058138EC61A00741512 /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C9766059138EC61A00741512 /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C976605A138EC61A00741512 /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C976605B138EC61A00741512 /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C976605C138EC61A00741512 /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C976605D138EC61A00741512 /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C976605E138EC61A00741512 /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C976605F138EC61A00741512 /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C9766060138EC61A00741512 /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C9766061138EC61A00741512 /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C9766062138EC61A00741512 /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C9766063138EC61A00741512 /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C9766064138EC61A00741512 /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C9766065138EC61A00741512 /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C9766066138EC61A00741512 /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C9766067138EC61A00741512 /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C9766068138EC61A00741512 /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C9766069138EC61A00741512 /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C976606A138EC61A00741512 /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; };
+               C976606B138EC61A00741512 /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; };
+               C976606C138EC61A00741512 /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C976606D138EC61A00741512 /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C976606E138EC61A00741512 /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C976606F138EC61A00741512 /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C9766070138EC61A00741512 /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C9766071138EC61A00741512 /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C9766072138EC61A00741512 /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C9766073138EC61A00741512 /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C9766074138EC61A00741512 /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C9766075138EC61A00741512 /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C9766076138EC61A00741512 /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C9766077138EC61A00741512 /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C9766078138EC61A00741512 /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C9766079138EC61A00741512 /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C976607A138EC61A00741512 /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C976607B138EC61A00741512 /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C976607C138EC61A00741512 /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C976607D138EC61A00741512 /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C976607E138EC61A00741512 /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C976607F138EC61A00741512 /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C9766080138EC61A00741512 /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C9766081138EC61A00741512 /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C9766082138EC61A00741512 /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C9766083138EC61A00741512 /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C9766084138EC61A00741512 /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C9766085138EC61A00741512 /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C9766086138EC61A00741512 /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C9766087138EC61A00741512 /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C9766088138EC61A00741512 /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C9766089138EC61A00741512 /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C976608A138EC61A00741512 /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C976608B138EC61A00741512 /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C976608C138EC61A00741512 /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C976608D138EC61A00741512 /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C976608E138EC61A00741512 /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C976608F138EC61A00741512 /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; };
+               C9766090138EC61A00741512 /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C9766091138EC61A00741512 /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C9766092138EC61A00741512 /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C9766093138EC61A00741512 /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C9766094138EC61A00741512 /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C9766095138EC61A00741512 /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C9766096138EC61A00741512 /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C9766097138EC61A00741512 /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C9766098138EC61A00741512 /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C9766099138EC61A00741512 /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C976609A138EC61A00741512 /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C976609B138EC61A00741512 /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C976609C138EC61A00741512 /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C976609D138EC61A00741512 /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C976609E138EC61A00741512 /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C976609F138EC61A00741512 /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; };
+               C97660A0138EC61A00741512 /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C97660A1138EC61A00741512 /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C97660A2138EC61A00741512 /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C97660A3138EC61A00741512 /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C97660A4138EC61A00741512 /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C97660A5138EC61A00741512 /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C97660A6138EC61A00741512 /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; };
+               C97660A7138EC61A00741512 /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C97660A8138EC61A00741512 /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; };
+               C97660A9138EC61A00741512 /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C97660AA138EC61A00741512 /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C97660AB138EC61A00741512 /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C97660AC138EC61A00741512 /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C97660AD138EC61A00741512 /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C97660AE138EC61A00741512 /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C97660AF138EC61A00741512 /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C97660B0138EC61A00741512 /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C97660B1138EC61A00741512 /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C97660B2138EC61A00741512 /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C97660B3138EC61A00741512 /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C97660B4138EC61A00741512 /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C97660B5138EC61A00741512 /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C97660B6138EC61A00741512 /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C97660B7138EC61A00741512 /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C97660B8138EC61A00741512 /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C97660B9138EC61A00741512 /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C97660BA138EC61A00741512 /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C97660BB138EC61A00741512 /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C97660BC138EC61A00741512 /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C97660BD138EC61A00741512 /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C97660BE138EC61A00741512 /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C97660BF138EC61A00741512 /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C97660C0138EC61A00741512 /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; };
+               C97660C1138EC61A00741512 /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; };
+               C97660C2138EC61A00741512 /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; };
+               C97660C3138EC61A00741512 /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C97660C4138EC61A00741512 /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C97660C5138EC61A00741512 /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; };
+               C97660C6138EC61A00741512 /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C97660C7138EC61A00741512 /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C97660C8138EC61A00741512 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C97660C9138EC61A00741512 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C97660CA138EC61A00741512 /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C97660CB138EC61A00741512 /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C97660CC138EC61A00741512 /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C97660CD138EC61A00741512 /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C97660CE138EC61A00741512 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C97660CF138EC61A00741512 /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C97660D0138EC61A00741512 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C97660D1138EC61A00741512 /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; };
+               C97660D2138EC61A00741512 /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C97660D5138EC61A00741512 /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C97660D6138EC61A00741512 /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C97660D8138EC61A00741512 /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C97660D9138EC61A00741512 /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C97660DA138EC61A00741512 /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C97660DC138EC61A00741512 /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C97660DD138EC61A00741512 /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C97660DE138EC61A00741512 /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; };
+               C97660E1138EC61A00741512 /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C97660E2138EC61A00741512 /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C97660E4138EC61A00741512 /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C97660E6138EC61A00741512 /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C97660E7138EC61A00741512 /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C97660E8138EC61A00741512 /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C97660E9138EC61A00741512 /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C97660EA138EC61A00741512 /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C97660EB138EC61A00741512 /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C97660EC138EC61A00741512 /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C97660ED138EC61A00741512 /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C97660EE138EC61A00741512 /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C97660EF138EC61A00741512 /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C97660F0138EC61A00741512 /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C97660F1138EC61A00741512 /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C97660F2138EC61A00741512 /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C97660F3138EC61A00741512 /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C97660F4138EC61A00741512 /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C97660F5138EC61A00741512 /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C97660F6138EC61A00741512 /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C97660F7138EC61A00741512 /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C97660F8138EC61A00741512 /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C97660F9138EC61A00741512 /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C97660FA138EC61A00741512 /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C97660FB138EC61A00741512 /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C97660FC138EC61A00741512 /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C97660FD138EC61A00741512 /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C97660FE138EC61A00741512 /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C97660FF138EC61A00741512 /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C9766100138EC61A00741512 /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C9766101138EC61A00741512 /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C9766102138EC61A00741512 /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C9766103138EC61A00741512 /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C9766104138EC61A00741512 /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C9766105138EC61A00741512 /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C9766106138EC61A00741512 /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C9766107138EC61A00741512 /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C9766108138EC61A00741512 /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C9766109138EC61A00741512 /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C976610A138EC61A00741512 /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C976610B138EC61A00741512 /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C976610C138EC61A00741512 /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C976610D138EC61A00741512 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C976610E138EC61A00741512 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C976610F138EC61A00741512 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C9766110138EC61A00741512 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C9766111138EC61A00741512 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C9766112138EC61A00741512 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C9766113138EC61A00741512 /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C9766114138EC61A00741512 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C9766115138EC61A00741512 /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C9766116138EC61A00741512 /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C9766117138EC61A00741512 /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C9766118138EC61A00741512 /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C9766119138EC61A00741512 /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C976611A138EC61A00741512 /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; };
+               C976611B138EC61A00741512 /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C976611C138EC61A00741512 /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C976611D138EC61A00741512 /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C976611E138EC61A00741512 /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C976611F138EC61A00741512 /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C9766120138EC61A00741512 /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; };
+               C9766121138EC61A00741512 /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C9766122138EC61A00741512 /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; };
+               C9766123138EC61A00741512 /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C9766124138EC61A00741512 /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C9766125138EC61A00741512 /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C9766126138EC61A00741512 /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C9766127138EC61A00741512 /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C9766128138EC61A00741512 /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C9766129138EC61A00741512 /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C976612A138EC61A00741512 /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C976612B138EC61A00741512 /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C976612C138EC61A00741512 /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C976612D138EC61A00741512 /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C976612E138EC61A00741512 /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C976612F138EC61A00741512 /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C9766130138EC61A00741512 /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C9766131138EC61A00741512 /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C9766132138EC61A00741512 /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C9766133138EC61A00741512 /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C9766134138EC61A00741512 /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C9766135138EC61A00741512 /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C9766136138EC61A00741512 /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C9766137138EC61A00741512 /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C9766138138EC61A00741512 /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C9766139138EC61A00741512 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C976613A138EC61A00741512 /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C976613B138EC61A00741512 /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C976613C138EC61A00741512 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C976613D138EC61A00741512 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C976613E138EC61A00741512 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C976613F138EC61A00741512 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C9766140138EC61A00741512 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C9766141138EC61A00741512 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C9766142138EC61A00741512 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C9766143138EC61A00741512 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C9766144138EC61A00741512 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C9766145138EC61A00741512 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C97C344113AB0E1B00713550 /* Spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C97C344013AB0E1B00713550 /* Spinlocks.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C980F8EC13AB168D0069AB06 /* SpinlocksUP.c in Sources */ = {isa = PBXBuildFile; fileRef = C980F8EB13AB168D0069AB06 /* SpinlocksUP.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C98373971395989E00E5C052 /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C98373981395989E00E5C052 /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C995462813AAA25000A531B4 /* OSAtomicUP.c in Sources */ = {isa = PBXBuildFile; fileRef = C995462713AAA25000A531B4 /* OSAtomicUP.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C9A12853138E0BE00003880A /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C9A12854138E0C1C0003880A /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C9A12855138E0C1C0003880A /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C9A12856138E0C1C0003880A /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C9A128A0138E0CD10003880A /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C9A128A1138E0CD10003880A /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C9A128A2138E0CD10003880A /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C9A128A3138E0CD10003880A /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C9A128A4138E0CD10003880A /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C9A128A5138E0CD10003880A /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C9A128A6138E0D0B0003880A /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; };
+               C9A128A7138E0D0B0003880A /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; };
+               C9A128A8138E0D0B0003880A /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; };
+               C9A128A9138E0D0B0003880A /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; };
+               C9A128AA138E0D0B0003880A /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; };
+               C9A128AB138E0D0B0003880A /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C9A128AC138E0D0B0003880A /* stack.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFE138D9E990028D27C /* stack.s */; };
+               C9A128AD138E0D0B0003880A /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; settings = {COMPILER_FLAGS = "-U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0"; }; };
+               C9A128B3138E0D950003880A /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C9A128B4138E0D950003880A /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C9A128B5138E0D950003880A /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C9A128B6138E0D950003880A /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C9A128B7138E0D950003880A /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C9A128B8138E0D950003880A /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C9A128B9138E0D950003880A /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C9A128BA138E0D950003880A /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C9A128BB138E0D950003880A /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C9A128BC138E0D950003880A /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C9A128BD138E0D950003880A /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C9A128BE138E0D950003880A /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C9A128BF138E0D950003880A /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C9A128C0138E0D950003880A /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C9A12929138E0EF00003880A /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; };
+               C9A1292A138E0EF00003880A /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C9A12974138E10AB0003880A /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C9A12975138E10AB0003880A /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C9A12976138E10AB0003880A /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C9A12977138E10C40003880A /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; settings = {COMPILER_FLAGS = " -D__FBSDID=__RCSID"; }; };
+               C9A12978138E10C40003880A /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C9A12979138E10C40003880A /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C9A1297A138E10C40003880A /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C9A1297B138E10C40003880A /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C9A1297C138E10FB0003880A /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A1297D138E10FB0003880A /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A1297E138E10FB0003880A /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A1297F138E10FB0003880A /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A12980138E10FB0003880A /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A12981138E10FB0003880A /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A12982138E10FB0003880A /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A12983138E10FB0003880A /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9A12984138E10FB0003880A /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; settings = {COMPILER_FLAGS = "-include $(SRCROOT)/uuid/uuid-config.h"; }; };
+               C9B4E3D813BBBF2D0008A9BB /* OSAtomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B4E3D713BBBF2D0008A9BB /* OSAtomic.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C9B4E3DE13BBCE5F0008A9BB /* OSAtomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B4E3D713BBBF2D0008A9BB /* OSAtomic.c */; settings = {COMPILER_FLAGS = "$(OSATOMIC_C_CFLAGS_$(PLATFORM_NAME)_$(CURRENT_ARCH))"; }; };
+               C9B53E57138DA5910028D27C /* _ctx_start.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF1138D9E9A0028D27C /* _ctx_start.S */; };
+               C9B53E58138DA5910028D27C /* _setcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF2138D9E9A0028D27C /* _setcontext.S */; };
+               C9B53E59138DA5910028D27C /* cpu_number.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF3138D9E9A0028D27C /* cpu_number.s */; };
+               C9B53E5A138DA5910028D27C /* getcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF4138D9E9A0028D27C /* getcontext.S */; };
+               C9B53E5B138DA5910028D27C /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C9B53E5C138DA5910028D27C /* icacheinval.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF6138D9E9A0028D27C /* icacheinval.s */; };
+               C9B53E5D138DA5910028D27C /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C9B53E5E138DA5910028D27C /* mcount.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF9138D9E9A0028D27C /* mcount.s */; };
+               C9B53E5F138DA5910028D27C /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C9B53E60138DA5910028D27C /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C9B53E62138DA5950028D27C /* preempt.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFE138D9E9A0028D27C /* preempt.s */; };
+               C9B53E63138DA5950028D27C /* pthread_getspecific.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFF138D9E9A0028D27C /* pthread_getspecific.s */; };
+               C9B53E64138DA5950028D27C /* pthread_mutex_lock.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E00138D9E9A0028D27C /* pthread_mutex_lock.s */; };
+               C9B53E65138DA5950028D27C /* pthread_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E01138D9E9A0028D27C /* pthread_self.s */; };
+               C9B53E66138DA5950028D27C /* pthread_set_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E02138D9E9A0028D27C /* pthread_set_self.s */; };
+               C9B53E67138DA5950028D27C /* start_wqthread.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E03138D9E9A0028D27C /* start_wqthread.s */; };
+               C9B53E68138DA5950028D27C /* thread_start.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E04138D9E9A0028D27C /* thread_start.s */; };
+               C9B53E69138DA59F0028D27C /* __bzero.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E08138D9E9A0028D27C /* __bzero.s */; };
+               C9B53E6A138DA59F0028D27C /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C9B53E6B138DA59F0028D27C /* bcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0A138D9E9A0028D27C /* bcopy_sse3x.s */; };
+               C9B53E6C138DA59F0028D27C /* bcopy_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0B138D9E9A0028D27C /* bcopy_sse42.s */; };
+               C9B53E6D138DA59F0028D27C /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C9B53E6E138DA59F0028D27C /* bzero_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0D138D9E9A0028D27C /* bzero_sse2.s */; };
+               C9B53E6F138DA59F0028D27C /* bzero_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0E138D9E9A0028D27C /* bzero_sse42.s */; };
+               C9B53E70138DA59F0028D27C /* ffs.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0F138D9E9A0028D27C /* ffs.s */; };
+               C9B53E71138DA59F0028D27C /* longcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E10138D9E9A0028D27C /* longcopy_sse3x.s */; };
+               C9B53E72138DA59F0028D27C /* memcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E12138D9E9A0028D27C /* memcmp.s */; };
+               C9B53E73138DA59F0028D27C /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C9B53E74138DA59F0028D27C /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C9B53E75138DA59F0028D27C /* memset.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E15138D9E9A0028D27C /* memset.s */; };
+               C9B53E76138DA59F0028D27C /* strcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E16138D9E9A0028D27C /* strcmp.s */; };
+               C9B53E77138DA59F0028D27C /* strcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E17138D9E9A0028D27C /* strcpy.s */; };
+               C9B53E78138DA59F0028D27C /* strlcat.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E18138D9E9A0028D27C /* strlcat.s */; };
+               C9B53E79138DA59F0028D27C /* strlcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E19138D9E9A0028D27C /* strlcpy.s */; };
+               C9B53E7A138DA59F0028D27C /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1A138D9E9A0028D27C /* strlen.s */; };
+               C9B53E7B138DA59F0028D27C /* strncmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1B138D9E9A0028D27C /* strncmp.s */; };
+               C9B53E7C138DA59F0028D27C /* strncpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1C138D9E9A0028D27C /* strncpy.s */; };
+               C9B53E7D138DA5A30028D27C /* _setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1E138D9E9A0028D27C /* _setjmp.s */; };
+               C9B53E7E138DA5A30028D27C /* _sigtramp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E1F138D9E9A0028D27C /* _sigtramp.s */; };
+               C9B53E7F138DA5A30028D27C /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C9B53E80138DA5A30028D27C /* i386_gettimeofday_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E21138D9E9A0028D27C /* i386_gettimeofday_asm.s */; };
+               C9B53E81138DA5A30028D27C /* nanotime.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E23138D9E9A0028D27C /* nanotime.s */; };
+               C9B53E82138DA5A30028D27C /* OSAtomic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E24138D9E9A0028D27C /* OSAtomic.s */; };
+               C9B53E83138DA5A30028D27C /* setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E25138D9E9A0028D27C /* setjmp.s */; };
+               C9B53E84138DA5A30028D27C /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C9B53E85138DA5A30028D27C /* spinlocks_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E27138D9E9A0028D27C /* spinlocks_asm.s */; };
+               C9C2A959138E025700287F00 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C9C2A95A138E025700287F00 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; };
+               C9C2A95B138E03C700287F00 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C9C2A95C138E03C700287F00 /* dirhelper.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B53614138D9E980028D27C /* dirhelper.defs */; };
+               C9C2A95D138E03C700287F00 /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C9C2A95E138E03C700287F00 /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C9C2A97D138E058200287F00 /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C9C2A97E138E058200287F00 /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C9C2A97F138E058200287F00 /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C9C2A980138E058200287F00 /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C9C2A981138E058200287F00 /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C9C2A982138E058200287F00 /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C9C2A983138E058200287F00 /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C9C2A998138E06D900287F00 /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C9C2A999138E06D900287F00 /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C9C2A99A138E06D900287F00 /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C9C2A99B138E06D900287F00 /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C9C2A99C138E06D900287F00 /* asl_ipc.defs in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CA138D9E990028D27C /* asl_ipc.defs */; };
+               C9C2A99D138E06D900287F00 /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C9C2A99E138E06D900287F00 /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C9C2A99F138E06D900287F00 /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C9C2A9A0138E06D900287F00 /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C9C2A9A1138E06D900287F00 /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C9C2A9A2138E06D900287F00 /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C9C2A9A3138E06D900287F00 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C9C2A9A4138E06D900287F00 /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; };
+               C9C2A9A5138E06D900287F00 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; };
+               C9C2A9A6138E06D900287F00 /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C9C2A9A7138E06D900287F00 /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C9C2A9A8138E06D900287F00 /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C9C2A9A9138E06D900287F00 /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C9C2A9AA138E072500287F00 /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; };
+               C9C2A9AB138E072500287F00 /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C9C2A9AC138E072500287F00 /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C9C2A9AD138E072500287F00 /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C9C2A9AE138E072500287F00 /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C9C2A9AF138E072500287F00 /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C9C2A9B0138E072500287F00 /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C9C2A9B1138E072500287F00 /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C9C2A9B2138E072500287F00 /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C9C2A9B4138E072500287F00 /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C9C2A9B5138E072500287F00 /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; };
+               C9C2A9B6138E072500287F00 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; };
+               C9C2A9B7138E072500287F00 /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C9C2A9B8138E072500287F00 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C9C2A9B9138E072600287F00 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C9C2A9BA138E072600287F00 /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C9C2A9BB138E072600287F00 /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C9C2A9BC138E072600287F00 /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C9C2A9BD138E072600287F00 /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C9C2A9BE138E072600287F00 /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C9C2A9BF138E072600287F00 /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C9C2A9C0138E072600287F00 /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C9C2A9C1138E072600287F00 /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C9CF595A13CD0B9600674871 /* memset_pattern.c in Sources */ = {isa = PBXBuildFile; fileRef = C9CF595913CD0B9600674871 /* memset_pattern.c */; };
+               C9D94333138DB75B00FB7ACC /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C9D94359138EC0C600FB7ACC /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C9D9435A138EC0C600FB7ACC /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C9EB2F4C138F68A80075BB52 /* _ctx_start.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53811138D9E990028D27C /* _ctx_start.S */; };
+               C9EB2F4D138F68A80075BB52 /* _setcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53812138D9E990028D27C /* _setcontext.S */; };
+               C9EB2F4E138F68A80075BB52 /* cpu_number.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53813138D9E990028D27C /* cpu_number.s */; };
+               C9EB2F4F138F68A80075BB52 /* getcontext.S in Sources */ = {isa = PBXBuildFile; fileRef = C9B53814138D9E990028D27C /* getcontext.S */; };
+               C9EB2F50138F68A80075BB52 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C9EB2F51138F68A80075BB52 /* icacheinval.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53816138D9E990028D27C /* icacheinval.s */; };
+               C9EB2F52138F68A80075BB52 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C9EB2F53138F68A80075BB52 /* mcount.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53819138D9E990028D27C /* mcount.s */; };
+               C9EB2F54138F68A80075BB52 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C9EB2F55138F68A80075BB52 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C9EB2F56138F68A80075BB52 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C9EB2F57138F68A80075BB52 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C9EB2F58138F68A80075BB52 /* preempt.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53820138D9E990028D27C /* preempt.s */; };
+               C9EB2F59138F68A80075BB52 /* pthread_getspecific.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53821138D9E990028D27C /* pthread_getspecific.s */; };
+               C9EB2F5A138F68A80075BB52 /* pthread_mutex_lock.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53822138D9E990028D27C /* pthread_mutex_lock.s */; };
+               C9EB2F5B138F68A80075BB52 /* pthread_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53823138D9E990028D27C /* pthread_self.s */; };
+               C9EB2F5C138F68A80075BB52 /* pthread_set_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53824138D9E990028D27C /* pthread_set_self.s */; };
+               C9EB2F5D138F68A80075BB52 /* start_wqthread.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53825138D9E990028D27C /* start_wqthread.s */; };
+               C9EB2F5E138F68A80075BB52 /* thread_start.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53826138D9E990028D27C /* thread_start.s */; };
+               C9EB2F60138F68A80075BB52 /* __bzero.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382A138D9E990028D27C /* __bzero.s */; };
+               C9EB2F61138F68A80075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C9EB2F62138F68A80075BB52 /* bcopy_scalar.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382C138D9E990028D27C /* bcopy_scalar.s */; };
+               C9EB2F63138F68A80075BB52 /* bcopy_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382D138D9E990028D27C /* bcopy_sse2.s */; };
+               C9EB2F64138F68A80075BB52 /* bcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382E138D9E990028D27C /* bcopy_sse3x.s */; };
+               C9EB2F65138F68A80075BB52 /* bcopy_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382F138D9E990028D27C /* bcopy_sse42.s */; };
+               C9EB2F66138F68A80075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C9EB2F67138F68A80075BB52 /* bzero_scalar.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53831138D9E990028D27C /* bzero_scalar.s */; };
+               C9EB2F68138F68A80075BB52 /* bzero_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53832138D9E990028D27C /* bzero_sse2.s */; };
+               C9EB2F69138F68A80075BB52 /* bzero_sse42.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53833138D9E990028D27C /* bzero_sse42.s */; };
+               C9EB2F6A138F68A80075BB52 /* ffs.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53834138D9E990028D27C /* ffs.s */; };
+               C9EB2F6B138F68A80075BB52 /* longcopy_sse3x.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53835138D9E990028D27C /* longcopy_sse3x.s */; };
+               C9EB2F6C138F68A80075BB52 /* memcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53837138D9E990028D27C /* memcmp.s */; };
+               C9EB2F6D138F68A80075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C9EB2F6E138F68A80075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C9EB2F6F138F68A80075BB52 /* memset.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383A138D9E990028D27C /* memset.s */; };
+               C9EB2F70138F68A80075BB52 /* memset_pattern_sse2.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383B138D9E990028D27C /* memset_pattern_sse2.s */; };
+               C9EB2F71138F68A80075BB52 /* strcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383C138D9E990028D27C /* strcmp.s */; };
+               C9EB2F72138F68A80075BB52 /* strcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383D138D9E990028D27C /* strcpy.s */; };
+               C9EB2F73138F68A80075BB52 /* strlcat.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383E138D9E990028D27C /* strlcat.s */; };
+               C9EB2F74138F68A80075BB52 /* strlcpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5383F138D9E990028D27C /* strlcpy.s */; };
+               C9EB2F75138F68A80075BB52 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53840138D9E990028D27C /* strlen.s */; };
+               C9EB2F76138F68A80075BB52 /* strncmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53841138D9E990028D27C /* strncmp.s */; };
+               C9EB2F77138F68A80075BB52 /* strncpy.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53842138D9E990028D27C /* strncpy.s */; };
+               C9EB2F78138F68A80075BB52 /* _setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53844138D9E990028D27C /* _setjmp.s */; };
+               C9EB2F79138F68A80075BB52 /* _sigtramp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53845138D9E990028D27C /* _sigtramp.s */; };
+               C9EB2F7A138F68A80075BB52 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C9EB2F7B138F68A80075BB52 /* i386_gettimeofday_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53847138D9E990028D27C /* i386_gettimeofday_asm.s */; };
+               C9EB2F7C138F68A80075BB52 /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C9EB2F7D138F68A80075BB52 /* mach_absolute_time_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B53849138D9E990028D27C /* mach_absolute_time_asm.s */; };
+               C9EB2F7E138F68A80075BB52 /* OSAtomic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384B138D9E990028D27C /* OSAtomic.s */; };
+               C9EB2F7F138F68A80075BB52 /* setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384C138D9E990028D27C /* setjmp.s */; };
+               C9EB2F80138F68A80075BB52 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C9EB2F81138F68A80075BB52 /* spinlocks_asm.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384E138D9E990028D27C /* spinlocks_asm.s */; };
+               C9EB2F82138F68CB0075BB52 /* cpu_number.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B1138D9E980028D27C /* cpu_number.s */; };
+               C9EB2F83138F68CB0075BB52 /* icacheinval.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B2138D9E980028D27C /* icacheinval.s */; };
+               C9EB2F84138F68CB0075BB52 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C9EB2F85138F68CB0075BB52 /* pthread_getspecific.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B8138D9E980028D27C /* pthread_getspecific.s */; };
+               C9EB2F86138F68CB0075BB52 /* pthread_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B9138D9E980028D27C /* pthread_self.s */; };
+               C9EB2F87138F68CB0075BB52 /* pthread_set_self.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535BA138D9E980028D27C /* pthread_set_self.s */; };
+               C9EB2F88138F68CB0075BB52 /* start_wqthread.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535BB138D9E980028D27C /* start_wqthread.s */; };
+               C9EB2F89138F68CB0075BB52 /* thread_start.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535BC138D9E980028D27C /* thread_start.s */; };
+               C9EB2F8B138F68CB0075BB52 /* bcopy_CortexA8.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C0138D9E980028D27C /* bcopy_CortexA8.s */; };
+               C9EB2F8C138F68CB0075BB52 /* bcopy_CortexA9.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C1138D9E980028D27C /* bcopy_CortexA9.s */; };
+               C9EB2F8D138F68CB0075BB52 /* bcopy_Generic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C2138D9E980028D27C /* bcopy_Generic.s */; };
+               C9EB2F8E138F68CB0075BB52 /* bzero_CortexA8.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C3138D9E980028D27C /* bzero_CortexA8.s */; };
+               C9EB2F8F138F68CB0075BB52 /* bzero_CortexA9.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C4138D9E980028D27C /* bzero_CortexA9.s */; };
+               C9EB2F90138F68CB0075BB52 /* bzero_Generic.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C5138D9E980028D27C /* bzero_Generic.s */; };
+               C9EB2F91138F68CB0075BB52 /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C9EB2F92138F68CB0075BB52 /* ffs.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C7138D9E980028D27C /* ffs.s */; };
+               C9EB2F93138F68CB0075BB52 /* memcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C9138D9E980028D27C /* memcmp.s */; };
+               C9EB2F94138F68CB0075BB52 /* memset_pattern.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CA138D9E980028D27C /* memset_pattern.s */; };
+               C9EB2F95138F68CB0075BB52 /* strchr.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CB138D9E980028D27C /* strchr.s */; };
+               C9EB2F96138F68CB0075BB52 /* strcmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CC138D9E980028D27C /* strcmp.s */; };
+               C9EB2F99138F68CB0075BB52 /* strlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535CF138D9E980028D27C /* strlen.s */; };
+               C9EB2F9A138F68CB0075BB52 /* strncmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D0138D9E980028D27C /* strncmp.s */; };
+               C9EB2F9C138F68CB0075BB52 /* strnlen.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D2138D9E980028D27C /* strnlen.s */; };
+               C9EB2F9D138F68CB0075BB52 /* strstr.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D3138D9E980028D27C /* strstr.s */; };
+               C9EB2F9E138F68CB0075BB52 /* _longjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D5138D9E980028D27C /* _longjmp.s */; };
+               C9EB2FA0138F68CB0075BB52 /* _setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D7138D9E980028D27C /* _setjmp.s */; };
+               C9EB2FA1138F68CB0075BB52 /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C9EB2FA2138F68CB0075BB52 /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C9EB2FA3138F68CB0075BB52 /* longjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DA138D9E980028D27C /* longjmp.s */; };
+               C9EB2FA4138F68CB0075BB52 /* mach_absolute_time.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DB138D9E980028D27C /* mach_absolute_time.s */; };
+               C9EB2FA5138F68CB0075BB52 /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C9EB2FA7138F68CB0075BB52 /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C9EB2FA9138F68CB0075BB52 /* setjmp.s in Sources */ = {isa = PBXBuildFile; fileRef = C9B535E1138D9E980028D27C /* setjmp.s */; };
+               C9EB2FBB138F6A920075BB52 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C9EB2FC1138F6BB00075BB52 /* merge_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC0138F6BB00075BB52 /* merge_b.c */; };
+               C9EB2FC4138F6C5C0075BB52 /* psort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC3138F6C5C0075BB52 /* psort.c */; };
+               C9EB2FC7138F6CE10075BB52 /* psort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC5138F6CE10075BB52 /* psort_b.c */; settings = {COMPILER_FLAGS = "-DI_AM_PSORT_B"; }; };
+               C9EB2FC8138F6CE10075BB52 /* psort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB2FC6138F6CE10075BB52 /* psort_r.c */; settings = {COMPILER_FLAGS = "-DI_AM_PSORT_R"; }; };
+               C9EB2FCD138F6D880075BB52 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C9EB2FCE138F6D880075BB52 /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C9EB2FCF138F6D880075BB52 /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C9EB2FD0138F6D880075BB52 /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C9EB2FD1138F6D880075BB52 /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C9EB2FD2138F6D880075BB52 /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C9EB2FD4138F6D880075BB52 /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C9EB2FD5138F6D880075BB52 /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C9EB2FD6138F6D880075BB52 /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C9EB2FD7138F6D880075BB52 /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_KILLPG"; }; };
+               C9EB2FD8138F6D880075BB52 /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C9EB2FD9138F6D880075BB52 /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C9EB2FDA138F6D880075BB52 /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C9EB2FDB138F6D880075BB52 /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C9EB2FDC138F6D880075BB52 /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREGID"; }; };
+               C9EB2FDD138F6D880075BB52 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; };
+               C9EB2FDE138F6D880075BB52 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C9EB2FDF138F6D880075BB52 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C9EB2FE0138F6D880075BB52 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C9EB2FE1138F6D880075BB52 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C9EB2FE2138F6D880075BB52 /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C9EB2FE3138F6D880075BB52 /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C9EB2FE4138F6D880075BB52 /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C9EB2FE5138F6D880075BB52 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C9EB2FE6138F6D880075BB52 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C9EB2FE7138F6D880075BB52 /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C9EB2FE8138F6D880075BB52 /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C9EB2FE9138F6D880075BB52 /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C9EB2FEA138F6D880075BB52 /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C9EB2FEB138F6D880075BB52 /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C9EB2FEC138F6D880075BB52 /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C9EB2FED138F6D880075BB52 /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C9EB2FEE138F6D880075BB52 /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C9EB2FEF138F6D880075BB52 /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C9EB2FF0138F6D880075BB52 /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C9EB2FF1138F6D880075BB52 /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C9EB2FF2138F6D880075BB52 /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C9EB2FF3138F6D880075BB52 /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C9EB2FF4138F6D880075BB52 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C9EB2FF5138F6D880075BB52 /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C9EB2FF6138F6D880075BB52 /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C9EB2FF7138F6D880075BB52 /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C9EB2FF8138F6D880075BB52 /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C9EB2FF9138F6D880075BB52 /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C9EB2FFA138F6D880075BB52 /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C9EB2FFB138F6D880075BB52 /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C9EB2FFC138F6D880075BB52 /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C9EB2FFD138F6D880075BB52 /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C9EB2FFE138F6D880075BB52 /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C9EB2FFF138F6D880075BB52 /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C9EB3000138F6D880075BB52 /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C9EB3001138F6D880075BB52 /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C9EB3002138F6D880075BB52 /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C9EB3003138F6D880075BB52 /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C9EB3004138F6D880075BB52 /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C9EB3005138F6D880075BB52 /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C9EB3006138F6D880075BB52 /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C9EB3007138F6D880075BB52 /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C9EB3008138F6D880075BB52 /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C9EB3009138F6D880075BB52 /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C9EB300A138F6D880075BB52 /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C9EB300B138F6D880075BB52 /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C9EB300C138F6D880075BB52 /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C9EB300D138F6D880075BB52 /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C9EB300E138F6D880075BB52 /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C9EB300F138F6D880075BB52 /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C9EB3010138F6D880075BB52 /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C9EB3011138F6D880075BB52 /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C9EB3012138F6D880075BB52 /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C9EB3013138F6D880075BB52 /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C9EB3014138F6D880075BB52 /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C9EB3015138F6D880075BB52 /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C9EB3016138F6D880075BB52 /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C9EB3017138F6D880075BB52 /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C9EB3018138F6D880075BB52 /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C9EB3019138F6D880075BB52 /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C9EB301A138F6D880075BB52 /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C9EB301B138F6D880075BB52 /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C9EB301C138F6D880075BB52 /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C9EB301D138F6D880075BB52 /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C9EB301E138F6D880075BB52 /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C9EB301F138F6D880075BB52 /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C9EB3020138F6D880075BB52 /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C9EB3021138F6D880075BB52 /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C9EB3022138F6D880075BB52 /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C9EB3023138F6D880075BB52 /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C9EB3024138F6D880075BB52 /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C9EB3025138F6D880075BB52 /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C9EB3026138F6D880075BB52 /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C9EB3027138F6D880075BB52 /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C9EB3028138F6D880075BB52 /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C9EB3029138F6D880075BB52 /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C9EB302A138F6D880075BB52 /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C9EB302B138F6D880075BB52 /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C9EB302C138F6D880075BB52 /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C9EB302D138F6D880075BB52 /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C9EB302E138F6D880075BB52 /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C9EB302F138F6D880075BB52 /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C9EB3030138F6D880075BB52 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C9EB3031138F6D880075BB52 /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_CONFSTR"; }; };
+               C9EB3032138F6D880075BB52 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_ENCRYPT -DLIBC_ALIAS_SETKEY"; }; };
+               C9EB3033138F6D880075BB52 /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C9EB3034138F6D880075BB52 /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C9EB3035138F6D880075BB52 /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C9EB3036138F6D880075BB52 /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C9EB3037138F6D880075BB52 /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C9EB3038138F6D880075BB52 /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C9EB3039138F6D880075BB52 /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C9EB303A138F6D880075BB52 /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C9EB303B138F6D880075BB52 /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C9EB303C138F6D880075BB52 /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CLOCK"; }; };
+               C9EB303D138F6D880075BB52 /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CLOSEDIR -include gen/__dirent.h"; }; };
+               C9EB303E138F6D880075BB52 /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C9EB303F138F6D880075BB52 /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB3040138F6D880075BB52 /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB3041138F6D880075BB52 /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C9EB3042138F6D880075BB52 /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C9EB3043138F6D880075BB52 /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C9EB3044138F6D880075BB52 /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C9EB3045138F6D880075BB52 /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C9EB3046138F6D880075BB52 /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C9EB3047138F6D880075BB52 /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FNMATCH"; }; };
+               C9EB3048138F6D880075BB52 /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C9EB3049138F6D880075BB52 /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C9EB304A138F6D880075BB52 /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C9EB304B138F6D880075BB52 /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C9EB304C138F6D880075BB52 /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C9EB304D138F6D880075BB52 /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C9EB304E138F6D880075BB52 /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; };
+               C9EB304F138F6D880075BB52 /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C9EB3050138F6D880075BB52 /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C9EB3051138F6D880075BB52 /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C9EB3052138F6D880075BB52 /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; };
+               C9EB3053138F6D880075BB52 /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C9EB3054138F6D880075BB52 /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C9EB3055138F6D880075BB52 /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C9EB3056138F6D880075BB52 /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C9EB3057138F6D880075BB52 /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C9EB3058138F6D880075BB52 /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C9EB3059138F6D880075BB52 /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_NICE"; }; };
+               C9EB305A138F6D880075BB52 /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C9EB305B138F6D880075BB52 /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS___OPENDIR2 -DLIBC_ALIAS_OPENDIR -include gen/__dirent.h"; }; };
+               C9EB305C138F6D880075BB52 /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C9EB305D138F6D880075BB52 /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_POPEN"; }; };
+               C9EB305E138F6D880075BB52 /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PSELECT $(FreeBSD_CFLAGS)"; }; };
+               C9EB305F138F6D880075BB52 /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C9EB3060138F6D880075BB52 /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C9EB3061138F6D880075BB52 /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C9EB3062138F6D880075BB52 /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C9EB3063138F6D880075BB52 /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REWINDDIR -include gen/__dirent.h"; }; };
+               C9EB3064138F6D880075BB52 /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C9EB3065138F6D880075BB52 /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C9EB3066138F6D880075BB52 /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEEKDIR -include gen/__dirent.h"; }; };
+               C9EB3067138F6D880075BB52 /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C9EB3068138F6D880075BB52 /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SETMODE"; }; };
+               C9EB3069138F6D880075BB52 /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C9EB306A138F6D880075BB52 /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C9EB306B138F6D880075BB52 /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C9EB306C138F6D880075BB52 /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C9EB306D138F6D880075BB52 /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C9EB306E138F6D880075BB52 /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C9EB306F138F6D880075BB52 /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C9EB3070138F6D880075BB52 /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C9EB3071138F6D880075BB52 /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C9EB3072138F6D880075BB52 /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C9EB3073138F6D880075BB52 /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C9EB3074138F6D880075BB52 /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS__SEEKDIR -DLIBC_ALIAS_TELLDIR -include gen/__dirent.h"; }; };
+               C9EB3075138F6D880075BB52 /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C9EB3076138F6D880075BB52 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C9EB3077138F6D880075BB52 /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C9EB3078138F6D880075BB52 /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB3079138F6D880075BB52 /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TTYNAME_R"; }; };
+               C9EB307A138F6D880075BB52 /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C9EB307B138F6D880075BB52 /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C9EB307C138F6D880075BB52 /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C9EB307D138F6D880075BB52 /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C9EB307E138F6D880075BB52 /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C9EB307F138F6D880075BB52 /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C9EB3080138F6D880075BB52 /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C9EB3081138F6D880075BB52 /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C9EB3082138F6D880075BB52 /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C9EB3083138F6D880075BB52 /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C9EB3084138F6D880075BB52 /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; };
+               C9EB3085138F6D880075BB52 /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C9EB3086138F6D880075BB52 /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C9EB3087138F6D880075BB52 /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C9EB3088138F6D880075BB52 /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C9EB3089138F6D880075BB52 /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C9EB308A138F6D880075BB52 /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C9EB308B138F6D880075BB52 /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C9EB308C138F6D880075BB52 /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C9EB308D138F6D880075BB52 /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C9EB308E138F6D880075BB52 /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C9EB308F138F6D880075BB52 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C9EB3090138F6D880075BB52 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; };
+               C9EB3091138F6D880075BB52 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C9EB3092138F6D880075BB52 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C9EB3093138F6D880075BB52 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C9EB3094138F6D880075BB52 /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C9EB3095138F6D880075BB52 /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C9EB3096138F6D880075BB52 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C9EB3097138F6D880075BB52 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C9EB3098138F6D880075BB52 /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C9EB3099138F6D880075BB52 /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C9EB309A138F6D880075BB52 /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C9EB309B138F6D880075BB52 /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C9EB309C138F6D880075BB52 /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C9EB309D138F6D880075BB52 /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C9EB309E138F6D880075BB52 /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C9EB309F138F6D880075BB52 /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C9EB30A1138F6D880075BB52 /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C9EB30A2138F6D880075BB52 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C9EB30A3138F6D880075BB52 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C9EB30A4138F6D880075BB52 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C9EB30A5138F6D880075BB52 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C9EB30A6138F6D880075BB52 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C9EB30A7138F6D880075BB52 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C9EB30A8138F6D880075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C9EB30A9138F6D880075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C9EB30AA138F6D880075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C9EB30AB138F6D880075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C9EB30AC138F6D880075BB52 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C9EB30AD138F6D880075BB52 /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C9EB30AE138F6D880075BB52 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C9EB30C1138F6D880075BB52 /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C9EB30C2138F6D880075BB52 /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C9EB30C3138F6D880075BB52 /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C9EB30C4138F6D880075BB52 /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C9EB30C5138F6D880075BB52 /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C9EB30C6138F6D880075BB52 /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C9EB30C7138F6D880075BB52 /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C9EB30C8138F6D880075BB52 /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C9EB30C9138F6D880075BB52 /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C9EB30CA138F6D880075BB52 /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C9EB30CB138F6D880075BB52 /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C9EB30CC138F6D880075BB52 /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C9EB30CD138F6D880075BB52 /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C9EB30CE138F6D880075BB52 /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C9EB30CF138F6D880075BB52 /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C9EB30D0138F6D880075BB52 /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C9EB30D1138F6D880075BB52 /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C9EB30D2138F6D880075BB52 /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C9EB30D3138F6D880075BB52 /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C9EB30D4138F6D880075BB52 /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C9EB30D5138F6D880075BB52 /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C9EB30D6138F6D880075BB52 /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C9EB30D7138F6D880075BB52 /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C9EB30D8138F6D880075BB52 /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C9EB30D9138F6D880075BB52 /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C9EB30DA138F6D880075BB52 /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C9EB30DB138F6D880075BB52 /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C9EB30DC138F6D880075BB52 /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C9EB30DD138F6D880075BB52 /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C9EB30DE138F6D880075BB52 /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C9EB30DF138F6D880075BB52 /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C9EB30E0138F6D880075BB52 /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C9EB30E1138F6D880075BB52 /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C9EB30E2138F6D880075BB52 /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C9EB30E3138F6D880075BB52 /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C9EB30E4138F6D880075BB52 /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C9EB30E5138F6D880075BB52 /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C9EB30E6138F6D880075BB52 /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C9EB30E7138F6D880075BB52 /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WCSFTIME -DLIBC_ALIAS_WCSFTIME_L"; }; };
+               C9EB30E8138F6D880075BB52 /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C9EB30E9138F6D880075BB52 /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C9EB30EA138F6D880075BB52 /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C9EB30EB138F6D880075BB52 /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C9EB30EC138F6D880075BB52 /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C9EB30ED138F6D880075BB52 /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C9EB30EE138F6D880075BB52 /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C9EB30EF138F6D880075BB52 /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C9EB30F0138F6D880075BB52 /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C9EB30F1138F6D880075BB52 /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C9EB30F2138F6D880075BB52 /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C9EB30F3138F6D880075BB52 /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C9EB30F4138F6D880075BB52 /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C9EB30F5138F6D880075BB52 /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C9EB30F6138F6D880075BB52 /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C9EB30F7138F6D880075BB52 /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C9EB30F8138F6D880075BB52 /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C9EB30F9138F6D880075BB52 /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C9EB30FA138F6D880075BB52 /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C9EB30FB138F6D880075BB52 /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C9EB30FC138F6D880075BB52 /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C9EB30FD138F6D880075BB52 /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C9EB30FE138F6D880075BB52 /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C9EB30FF138F6D880075BB52 /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C9EB3100138F6D880075BB52 /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C9EB3101138F6D880075BB52 /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C9EB3102138F6D880075BB52 /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C9EB3103138F6D880075BB52 /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C9EB3104138F6D880075BB52 /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C9EB3105138F6D880075BB52 /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C9EB3106138F6D880075BB52 /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C9EB3107138F6D880075BB52 /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C9EB3108138F6D880075BB52 /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C9EB3109138F6D880075BB52 /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C9EB310A138F6D880075BB52 /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C9EB310B138F6D880075BB52 /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C9EB310C138F6D880075BB52 /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C9EB310D138F6D880075BB52 /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C9EB310E138F6D880075BB52 /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C9EB310F138F6D880075BB52 /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C9EB3110138F6D880075BB52 /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C9EB3111138F6D880075BB52 /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C9EB3112138F6D880075BB52 /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C9EB3113138F6D880075BB52 /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C9EB3114138F6D880075BB52 /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C9EB3115138F6D880075BB52 /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C9EB3116138F6D880075BB52 /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C9EB3117138F6D880075BB52 /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C9EB3118138F6D880075BB52 /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C9EB3121138F6D880075BB52 /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C9EB3122138F6D880075BB52 /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_CANCEL -DLIBC_ALIAS_PTHREAD_SETCANCELSTATE -DLIBC_ALIAS_PTHREAD_SETCANCELTYPE -DLIBC_ALIAS_PTHREAD_SIGMASK -DLIBC_ALIAS_PTHREAD_TESTCANCEL"; }; };
+               C9EB3123138F6D880075BB52 /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C9EB3124138F6D880075BB52 /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_INIT"; }; };
+               C9EB3125138F6D880075BB52 /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY"; }; };
+               C9EB3126138F6D880075BB52 /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_RWLOCK_DESTROY -DLIBC_ALIAS_PTHREAD_RWLOCK_INIT -DLIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK"; }; };
+               C9EB3127138F6D880075BB52 /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C9EB3128138F6D880075BB52 /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C9EB3129138F6D880075BB52 /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C9EB312C138F6D880075BB52 /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C9EB312F138F6D880075BB52 /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C9EB3130138F6D880075BB52 /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C9EB3131138F6D880075BB52 /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C9EB3132138F6D880075BB52 /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C9EB3133138F6D880075BB52 /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C9EB3134138F6D880075BB52 /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C9EB3135138F6D880075BB52 /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C9EB3136138F6D880075BB52 /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C9EB3137138F6D880075BB52 /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C9EB3138138F6D880075BB52 /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C9EB3139138F6D880075BB52 /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C9EB313A138F6D880075BB52 /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C9EB313B138F6D880075BB52 /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C9EB313C138F6D880075BB52 /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C9EB313D138F6D880075BB52 /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C9EB313E138F6D880075BB52 /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C9EB313F138F6D880075BB52 /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C9EB3140138F6D880075BB52 /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C9EB3141138F6D880075BB52 /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C9EB3142138F6D880075BB52 /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FDOPEN"; }; };
+               C9EB3143138F6D880075BB52 /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C9EB3144138F6D880075BB52 /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C9EB3145138F6D880075BB52 /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C9EB3146138F6D880075BB52 /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C9EB3147138F6D880075BB52 /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C9EB3148138F6D880075BB52 /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C9EB3149138F6D880075BB52 /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C9EB314A138F6D880075BB52 /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C9EB314B138F6D880075BB52 /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C9EB314C138F6D880075BB52 /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C9EB314D138F6D880075BB52 /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C9EB314E138F6D880075BB52 /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C9EB314F138F6D880075BB52 /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C9EB3150138F6D880075BB52 /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FOPEN"; }; };
+               C9EB3151138F6D880075BB52 /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C9EB3152138F6D880075BB52 /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C9EB3153138F6D880075BB52 /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C9EB3154138F6D880075BB52 /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FPUTS"; }; };
+               C9EB3155138F6D880075BB52 /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C9EB3156138F6D880075BB52 /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C9EB3157138F6D880075BB52 /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C9EB3158138F6D880075BB52 /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FREOPEN"; }; };
+               C9EB3159138F6D880075BB52 /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C9EB315A138F6D880075BB52 /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C9EB315B138F6D880075BB52 /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C9EB315C138F6D880075BB52 /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C9EB315D138F6D880075BB52 /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C9EB315E138F6D880075BB52 /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C9EB315F138F6D880075BB52 /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C9EB3160138F6D880075BB52 /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C9EB3161138F6D880075BB52 /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C9EB3162138F6D880075BB52 /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FWRITE"; }; };
+               C9EB3163138F6D880075BB52 /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C9EB3164138F6D880075BB52 /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C9EB3165138F6D880075BB52 /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C9EB3166138F6D880075BB52 /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C9EB3167138F6D880075BB52 /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C9EB3168138F6D880075BB52 /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C9EB3169138F6D880075BB52 /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C9EB316A138F6D880075BB52 /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C9EB316B138F6D880075BB52 /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C9EB316C138F6D880075BB52 /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C9EB316D138F6D880075BB52 /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C9EB316E138F6D880075BB52 /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C9EB316F138F6D880075BB52 /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C9EB3170138F6D880075BB52 /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C9EB3171138F6D880075BB52 /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C9EB3172138F6D880075BB52 /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C9EB3173138F6D880075BB52 /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C9EB3174138F6D880075BB52 /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C9EB3175138F6D880075BB52 /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C9EB3176138F6D880075BB52 /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C9EB3177138F6D880075BB52 /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C9EB3178138F6D880075BB52 /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C9EB3179138F6D880075BB52 /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C9EB317A138F6D880075BB52 /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C9EB317B138F6D880075BB52 /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C9EB317C138F6D880075BB52 /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C9EB317D138F6D880075BB52 /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C9EB317E138F6D880075BB52 /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C9EB317F138F6D880075BB52 /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C9EB3180138F6D880075BB52 /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C9EB3181138F6D880075BB52 /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C9EB3182138F6D880075BB52 /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C9EB3183138F6D880075BB52 /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C9EB3184138F6D880075BB52 /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C9EB3185138F6D880075BB52 /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TEMPNAM"; }; };
+               C9EB3186138F6D880075BB52 /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C9EB3187138F6D880075BB52 /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C9EB3188138F6D880075BB52 /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C9EB3189138F6D880075BB52 /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C9EB318A138F6D880075BB52 /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C9EB318B138F6D880075BB52 /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C9EB318C138F6D880075BB52 /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C9EB318D138F6D880075BB52 /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C9EB318E138F6D880075BB52 /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C9EB318F138F6D880075BB52 /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C9EB3190138F6D880075BB52 /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C9EB3191138F6D880075BB52 /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C9EB3192138F6D880075BB52 /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C9EB3193138F6D880075BB52 /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C9EB3194138F6D880075BB52 /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C9EB3195138F6D880075BB52 /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C9EB3196138F6D880075BB52 /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C9EB3197138F6D880075BB52 /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C9EB3198138F6D880075BB52 /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C9EB3199138F6D880075BB52 /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C9EB319A138F6D880075BB52 /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C9EB319B138F6D880075BB52 /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C9EB319C138F6D880075BB52 /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C9EB319D138F6D880075BB52 /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C9EB319E138F6D880075BB52 /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C9EB319F138F6D880075BB52 /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C9EB31A0138F6D880075BB52 /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C9EB31A1138F6D880075BB52 /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C9EB31A2138F6D880075BB52 /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C9EB31A3138F6D880075BB52 /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C9EB31A4138F6D880075BB52 /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C9EB31A5138F6D880075BB52 /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C9EB31A6138F6D880075BB52 /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C9EB31A7138F6D880075BB52 /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C9EB31A8138F6D880075BB52 /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C9EB31A9138F6D880075BB52 /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C9EB31AA138F6D880075BB52 /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_GETOPT"; }; };
+               C9EB31AB138F6D880075BB52 /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C9EB31AC138F6D880075BB52 /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C9EB31AD138F6D880075BB52 /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C9EB31AE138F6D880075BB52 /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C9EB31AF138F6D880075BB52 /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C9EB31B0138F6D880075BB52 /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C9EB31B1138F6D880075BB52 /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C9EB31B2138F6D880075BB52 /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C9EB31B3138F6D880075BB52 /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C9EB31B4138F6D880075BB52 /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C9EB31B5138F6D880075BB52 /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C9EB31B6138F6D880075BB52 /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C9EB31B7138F6D880075BB52 /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C9EB31B8138F6D880075BB52 /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C9EB31B9138F6D880075BB52 /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C9EB31BA138F6D880075BB52 /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PUTENV"; }; };
+               C9EB31BB138F6D880075BB52 /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C9EB31BC138F6D880075BB52 /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C9EB31BD138F6D880075BB52 /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C9EB31BE138F6D880075BB52 /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C9EB31BF138F6D880075BB52 /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C9EB31C0138F6D880075BB52 /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C9EB31C1138F6D880075BB52 /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C9EB31C2138F6D880075BB52 /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C9EB31C3138F6D880075BB52 /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C9EB31C4138F6D880075BB52 /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C9EB31C5138F6D880075BB52 /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C9EB31C6138F6D880075BB52 /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C9EB31C7138F6D880075BB52 /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C9EB31C8138F6D880075BB52 /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C9EB31C9138F6D880075BB52 /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C9EB31CA138F6D880075BB52 /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C9EB31CB138F6D880075BB52 /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C9EB31CC138F6D880075BB52 /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C9EB31CD138F6D880075BB52 /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C9EB31CE138F6D880075BB52 /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C9EB31CF138F6D880075BB52 /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C9EB31D0138F6D880075BB52 /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C9EB31D1138F6D880075BB52 /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C9EB31D2138F6D880075BB52 /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C9EB31D3138F6D880075BB52 /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C9EB31D4138F6D880075BB52 /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C9EB31D5138F6D880075BB52 /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C9EB31D6138F6D880075BB52 /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C9EB31D7138F6D880075BB52 /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C9EB31D8138F6D880075BB52 /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C9EB31D9138F6D880075BB52 /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C9EB31DA138F6D880075BB52 /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C9EB31DB138F6D880075BB52 /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_MKTIME"; }; };
+               C9EB31DC138F6D880075BB52 /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRFTIME -DLIBC_ALIAS_STRFTIME_L"; }; };
+               C9EB31DD138F6D880075BB52 /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRPTIME -DLIBC_ALIAS_STRPTIME_L"; }; };
+               C9EB31DE138F6D880075BB52 /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C9EB31DF138F6D880075BB52 /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C9EB31E0138F6D880075BB52 /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; settings = {COMPILER_FLAGS = "-D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C9EB31E1138F6D880075BB52 /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C9EB31E2138F6D880075BB52 /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C9EB31E3138F6D880075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C9EB31E4138F6D880075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C9EB31E5138F6D880075BB52 /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C9EB31E6138F6D880075BB52 /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C9EB31E7138F6D880075BB52 /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C9EB31E8138F6D880075BB52 /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C9EB31E9138F6D880075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C9EB31EA138F6D880075BB52 /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C9EB31EB138F6D880075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C9EB31EC138F6D880075BB52 /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; };
+               C9EB31ED138F6D880075BB52 /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C9EB31F0138F6D880075BB52 /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C9EB31F1138F6D880075BB52 /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C9EB31F3138F6D880075BB52 /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C9EB31F4138F6D880075BB52 /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C9EB31F5138F6D880075BB52 /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C9EB31F7138F6D880075BB52 /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C9EB31F8138F6D880075BB52 /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C9EB31F9138F6D880075BB52 /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRERROR"; }; };
+               C9EB31FC138F6D880075BB52 /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C9EB31FD138F6D880075BB52 /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C9EB31FF138F6D880075BB52 /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C9EB3201138F6D880075BB52 /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C9EB3202138F6D880075BB52 /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C9EB3203138F6D880075BB52 /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C9EB3204138F6D880075BB52 /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C9EB3205138F6D880075BB52 /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C9EB3206138F6D880075BB52 /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C9EB3207138F6D880075BB52 /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C9EB3208138F6D880075BB52 /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C9EB3209138F6D880075BB52 /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C9EB320A138F6D880075BB52 /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C9EB320B138F6D880075BB52 /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C9EB320C138F6D880075BB52 /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C9EB320D138F6D880075BB52 /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C9EB320E138F6D880075BB52 /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C9EB320F138F6D880075BB52 /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C9EB3210138F6D880075BB52 /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C9EB3211138F6D880075BB52 /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C9EB3212138F6D880075BB52 /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C9EB3213138F6D880075BB52 /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C9EB3214138F6D880075BB52 /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C9EB3215138F6D880075BB52 /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C9EB3216138F6D880075BB52 /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C9EB3217138F6D880075BB52 /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C9EB3218138F6D880075BB52 /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C9EB3219138F6D880075BB52 /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C9EB321A138F6D880075BB52 /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C9EB321B138F6D880075BB52 /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C9EB321C138F6D880075BB52 /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C9EB321D138F6D880075BB52 /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C9EB321E138F6D880075BB52 /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C9EB321F138F6D880075BB52 /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C9EB3220138F6D880075BB52 /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C9EB3221138F6D880075BB52 /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C9EB3222138F6D880075BB52 /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C9EB3223138F6D880075BB52 /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C9EB3224138F6D880075BB52 /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C9EB3225138F6D880075BB52 /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C9EB3226138F6D880075BB52 /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C9EB3227138F6D880075BB52 /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C9EB3228138F6D880075BB52 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C9EB3229138F6D880075BB52 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C9EB322A138F6D880075BB52 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C9EB322B138F6D880075BB52 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C9EB322C138F6D880075BB52 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C9EB322D138F6D880075BB52 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C9EB322E138F6D880075BB52 /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C9EB322F138F6D880075BB52 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C9EB3230138F6D880075BB52 /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C9EB3231138F6D880075BB52 /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C9EB3232138F6D880075BB52 /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C9EB3233138F6D880075BB52 /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C9EB3234138F6D880075BB52 /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C9EB3235138F6D880075BB52 /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_MSGCTL -DKERNEL"; }; };
+               C9EB3236138F6D880075BB52 /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C9EB3237138F6D880075BB52 /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C9EB3238138F6D880075BB52 /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C9EB3239138F6D880075BB52 /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C9EB323A138F6D880075BB52 /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C9EB323B138F6D880075BB52 /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SEMCTL -DKERNEL"; }; };
+               C9EB323C138F6D880075BB52 /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C9EB323D138F6D880075BB52 /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SHMCTL -DKERNEL"; }; };
+               C9EB323E138F6D880075BB52 /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C9EB323F138F6D880075BB52 /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C9EB3240138F6D880075BB52 /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C9EB3241138F6D880075BB52 /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C9EB3242138F6D880075BB52 /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C9EB3243138F6D880075BB52 /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C9EB3244138F6D880075BB52 /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C9EB3245138F6D880075BB52 /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C9EB3246138F6D880075BB52 /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C9EB3247138F6D880075BB52 /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C9EB3248138F6D880075BB52 /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C9EB3249138F6D880075BB52 /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C9EB324A138F6D880075BB52 /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C9EB324B138F6D880075BB52 /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C9EB324C138F6D880075BB52 /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C9EB324D138F6D880075BB52 /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C9EB324E138F6D880075BB52 /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C9EB324F138F6D880075BB52 /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C9EB3250138F6D880075BB52 /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C9EB3251138F6D880075BB52 /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C9EB3252138F6D880075BB52 /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C9EB3253138F6D880075BB52 /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C9EB3254138F6D880075BB52 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C9EB3255138F6D880075BB52 /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C9EB3256138F6D880075BB52 /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C9EB3257138F6D880075BB52 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C9EB3258138F6D880075BB52 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C9EB3259138F6D880075BB52 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C9EB325A138F6D880075BB52 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C9EB325B138F6D880075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C9EB325C138F6D880075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C9EB325D138F6D880075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C9EB325E138F6D880075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C9EB325F138F6D880075BB52 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C9EB3260138F6D880075BB52 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C9EB3274138F75580075BB52 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */; };
+               C9EB3275138F75580075BB52 /* dyld_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535C6138D9E980028D27C /* dyld_resolvers.c */; };
+               C9EB3276138F75580075BB52 /* arm_commpage_gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */; };
+               C9EB3277138F75580075BB52 /* gcc_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535D9138D9E980028D27C /* gcc_atomic.c */; };
+               C9EB3278138F75580075BB52 /* OSAtomic-v4.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DD138D9E980028D27C /* OSAtomic-v4.c */; };
+               C9EB3279138F75580075BB52 /* OSAtomic_resolvers.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */; };
+               C9EB327B138F75580075BB52 /* creat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535F8138D9E980028D27C /* creat.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CREAT"; }; };
+               C9EB327C138F75580075BB52 /* gethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FC138D9E980028D27C /* gethostid.c */; };
+               C9EB327D138F75580075BB52 /* getwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B535FE138D9E980028D27C /* getwd.c */; };
+               C9EB327E138F75580075BB52 /* killpg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53601138D9E980028D27C /* killpg.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_KILLPG"; }; };
+               C9EB327F138F75580075BB52 /* sethostid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53603138D9E980028D27C /* sethostid.c */; };
+               C9EB3280138F75580075BB52 /* setpgrp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53604138D9E980028D27C /* setpgrp.c */; };
+               C9EB3281138F75580075BB52 /* setrgid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53606138D9E980028D27C /* setrgid.c */; };
+               C9EB3282138F75580075BB52 /* setruid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53608138D9E980028D27C /* setruid.c */; };
+               C9EB3283138F75580075BB52 /* setregid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360A138D9E980028D27C /* setregid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREGID"; }; };
+               C9EB3284138F75580075BB52 /* setreuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360B138D9E980028D27C /* setreuid.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SETREUID"; }; };
+               C9EB3285138F75580075BB52 /* sigaltstk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360C138D9E980028D27C /* sigaltstk.c */; };
+               C9EB3286138F75580075BB52 /* sigcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5360E138D9E980028D27C /* sigcompat.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SIGPAUSE"; }; };
+               C9EB3287138F75580075BB52 /* _dirhelper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53613138D9E980028D27C /* _dirhelper.c */; };
+               C9EB3288138F75580075BB52 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C9EB3289138F75580075BB52 /* libproc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53617138D9E980028D27C /* libproc.c */; };
+               C9EB328A138F75580075BB52 /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C9EB328B138F75580075BB52 /* proc_listpidspath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361C138D9E980028D27C /* proc_listpidspath.c */; };
+               C9EB328C138F75580075BB52 /* forceLibcToBuild.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */; };
+               C9EB328D138F75580075BB52 /* bt_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53620138D9E980028D27C /* bt_close.c */; };
+               C9EB328E138F75580075BB52 /* bt_conv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53621138D9E980028D27C /* bt_conv.c */; };
+               C9EB328F138F75580075BB52 /* bt_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53622138D9E980028D27C /* bt_debug.c */; };
+               C9EB3290138F75580075BB52 /* bt_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53623138D9E980028D27C /* bt_delete.c */; };
+               C9EB3291138F75580075BB52 /* bt_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53624138D9E980028D27C /* bt_get.c */; };
+               C9EB3292138F75580075BB52 /* bt_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53625138D9E980028D27C /* bt_open.c */; };
+               C9EB3293138F75580075BB52 /* bt_overflow.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53626138D9E980028D27C /* bt_overflow.c */; };
+               C9EB3294138F75580075BB52 /* bt_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53628138D9E980028D27C /* bt_page.c */; };
+               C9EB3295138F75580075BB52 /* bt_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53629138D9E980028D27C /* bt_put.c */; };
+               C9EB3296138F75580075BB52 /* bt_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362A138D9E980028D27C /* bt_search.c */; };
+               C9EB3297138F75580075BB52 /* bt_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362B138D9E980028D27C /* bt_seq.c */; };
+               C9EB3298138F75580075BB52 /* bt_split.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362D138D9E980028D27C /* bt_split.c */; };
+               C9EB3299138F75580075BB52 /* bt_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5362F138D9E980028D27C /* bt_utils.c */; };
+               C9EB329A138F75580075BB52 /* db.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53636138D9E980028D27C /* db.c */; };
+               C9EB329B138F75580075BB52 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363B138D9E980028D27C /* hash.c */; };
+               C9EB329C138F75580075BB52 /* hash_bigkey.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5363F138D9E980028D27C /* hash_bigkey.c */; };
+               C9EB329D138F75580075BB52 /* hash_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53641138D9E980028D27C /* hash_buf.c */; };
+               C9EB329E138F75580075BB52 /* hash_func.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53643138D9E980028D27C /* hash_func.c */; };
+               C9EB329F138F75580075BB52 /* hash_log2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53645138D9E980028D27C /* hash_log2.c */; };
+               C9EB32A0138F75580075BB52 /* hash_page.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53647138D9E980028D27C /* hash_page.c */; };
+               C9EB32A1138F75580075BB52 /* ndbm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53649138D9E980028D27C /* ndbm.c */; };
+               C9EB32A2138F75580075BB52 /* mpool.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5365A138D9E980028D27C /* mpool.c */; };
+               C9EB32A3138F75580075BB52 /* rec_close.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53661138D9E980028D27C /* rec_close.c */; };
+               C9EB32A4138F75580075BB52 /* rec_delete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53662138D9E980028D27C /* rec_delete.c */; };
+               C9EB32A5138F75580075BB52 /* rec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53663138D9E980028D27C /* rec_get.c */; };
+               C9EB32A6138F75580075BB52 /* rec_open.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53664138D9E980028D27C /* rec_open.c */; };
+               C9EB32A7138F75580075BB52 /* rec_put.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53665138D9E980028D27C /* rec_put.c */; };
+               C9EB32A8138F75580075BB52 /* rec_search.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53666138D9E980028D27C /* rec_search.c */; };
+               C9EB32A9138F75580075BB52 /* rec_seq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53667138D9E980028D27C /* rec_seq.c */; };
+               C9EB32AA138F75580075BB52 /* rec_utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53668138D9E980028D27C /* rec_utils.c */; };
+               C9EB32AB138F75580075BB52 /* brk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5366E138D9E980028D27C /* brk.c */; };
+               C9EB32AC138F75580075BB52 /* bsd_signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53670138D9E980028D27C /* bsd_signal.c */; };
+               C9EB32AD138F75580075BB52 /* lchflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53672138D9E980028D27C /* lchflags.c */; };
+               C9EB32AE138F75580075BB52 /* lchmod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53674138D9E980028D27C /* lchmod.c */; };
+               C9EB32AF138F75580075BB52 /* lutimes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53676138D9E980028D27C /* lutimes.c */; };
+               C9EB32B0138F75580075BB52 /* statvfs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53679138D9E980028D27C /* statvfs.c */; };
+               C9EB32B1138F75580075BB52 /* tcgetsid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5367B138D9E980028D27C /* tcgetsid.c */; };
+               C9EB32B2138F75580075BB52 /* _ldbl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5368E138D9E980028D27C /* _ldbl_util.c */; };
+               C9EB32B3138F75580075BB52 /* _hdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53691138D9E980028D27C /* _hdtoa.c */; };
+               C9EB32B4138F75580075BB52 /* _ldtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53693138D9E980028D27C /* _ldtoa.c */; };
+               C9EB32B5138F75580075BB52 /* gdtoa-dmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53695138D9E980028D27C /* gdtoa-dmisc.c */; };
+               C9EB32B6138F75580075BB52 /* gdtoa-dtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53696138D9E980028D27C /* gdtoa-dtoa.c */; };
+               C9EB32B7138F75580075BB52 /* gdtoa-gdtoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */; };
+               C9EB32B8138F75580075BB52 /* gdtoa-gethex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53698138D9E980028D27C /* gdtoa-gethex.c */; };
+               C9EB32B9138F75580075BB52 /* gdtoa-gmisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */; };
+               C9EB32BA138F75580075BB52 /* gdtoa-hd_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */; };
+               C9EB32BB138F75580075BB52 /* gdtoa-hexnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */; };
+               C9EB32BC138F75580075BB52 /* gdtoa-misc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5369E138D9E980028D27C /* gdtoa-misc.c */; };
+               C9EB32BD138F75580075BB52 /* gdtoa-smisc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A0138D9E980028D27C /* gdtoa-smisc.c */; };
+               C9EB32BE138F75580075BB52 /* gdtoa-strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A1138D9E980028D27C /* gdtoa-strtod.c */; };
+               C9EB32BF138F75580075BB52 /* gdtoa-strtodg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */; };
+               C9EB32C0138F75580075BB52 /* gdtoa-strtof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A5138D9E980028D27C /* gdtoa-strtof.c */; };
+               C9EB32C1138F75580075BB52 /* gdtoa-strtoIg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */; };
+               C9EB32C2138F75580075BB52 /* gdtoa-strtopdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */; };
+               C9EB32C3138F75580075BB52 /* gdtoa-strtopx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */; };
+               C9EB32C4138F75580075BB52 /* gdtoa-strtord.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AC138D9E980028D27C /* gdtoa-strtord.c */; };
+               C9EB32C5138F75580075BB52 /* gdtoa-sum.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AE138D9E980028D27C /* gdtoa-sum.c */; };
+               C9EB32C6138F75580075BB52 /* gdtoa-ulp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536AF138D9E980028D27C /* gdtoa-ulp.c */; };
+               C9EB32C7138F75580075BB52 /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B5138D9E980028D27C /* glue.c */; };
+               C9EB32C8138F75580075BB52 /* machdep_ldisd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B6138D9E980028D27C /* machdep_ldisd.c */; };
+               C9EB32C9138F75580075BB52 /* machdep_ldisdd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536B8138D9E980028D27C /* machdep_ldisdd.c */; };
+               C9EB32CA138F75580075BB52 /* machdep_ldisQ.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BA138D9E980028D27C /* machdep_ldisQ.c */; };
+               C9EB32CB138F75580075BB52 /* machdep_ldisx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536BB138D9E980028D27C /* machdep_ldisx.c */; };
+               C9EB32CC138F75580075BB52 /* _simple.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C2138D9E990028D27C /* _simple.c */; };
+               C9EB32CD138F75580075BB52 /* asl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C5138D9E990028D27C /* asl.c */; };
+               C9EB32CE138F75580075BB52 /* asl_core.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C6138D9E990028D27C /* asl_core.c */; };
+               C9EB32CF138F75580075BB52 /* asl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536C8138D9E990028D27C /* asl_file.c */; };
+               C9EB32D0138F75580075BB52 /* asl_legacy1.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CB138D9E990028D27C /* asl_legacy1.c */; };
+               C9EB32D1138F75580075BB52 /* asl_msg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536CD138D9E990028D27C /* asl_msg.c */; };
+               C9EB32D2138F75580075BB52 /* asl_store.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D0138D9E990028D27C /* asl_store.c */; };
+               C9EB32D3138F75580075BB52 /* asl_util.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D2138D9E990028D27C /* asl_util.c */; };
+               C9EB32D4138F75580075BB52 /* assumes.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D3138D9E990028D27C /* assumes.c */; };
+               C9EB32D5138F75580075BB52 /* authentication.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D5138D9E990028D27C /* authentication.c */; };
+               C9EB32D6138F75580075BB52 /* backtrace.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D7138D9E990028D27C /* backtrace.c */; };
+               C9EB32D7138F75580075BB52 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536D8138D9E990028D27C /* cache.c */; };
+               C9EB32D8138F75580075BB52 /* confstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DB138D9E990028D27C /* confstr.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_CONFSTR"; }; };
+               C9EB32D9138F75580075BB52 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DD138D9E990028D27C /* crypt.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_ENCRYPT -DLIBC_ALIAS_SETKEY"; }; };
+               C9EB32DA138F75580075BB52 /* devname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536DF138D9E990028D27C /* devname.c */; };
+               C9EB32DB138F75580075BB52 /* disklabel.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E1138D9E990028D27C /* disklabel.c */; };
+               C9EB32DC138F75580075BB52 /* errlst.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E2138D9E990028D27C /* errlst.c */; };
+               C9EB32DD138F75580075BB52 /* filesec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E4138D9E990028D27C /* filesec.c */; };
+               C9EB32DE138F75580075BB52 /* _rand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536E6138D9E990028D27C /* _rand48.c */; };
+               C9EB32DF138F75580075BB52 /* alarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EA138D9E990028D27C /* alarm.c */; };
+               C9EB32E0138F75580075BB52 /* arc4random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EC138D9E990028D27C /* arc4random.c */; };
+               C9EB32E1138F75580075BB52 /* assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536EE138D9E990028D27C /* assert.c */; };
+               C9EB32E2138F75580075BB52 /* basename.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F2138D9E990028D27C /* basename.c */; };
+               C9EB32E3138F75580075BB52 /* clock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F5138D9E990028D27C /* clock.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CLOCK"; }; };
+               C9EB32E4138F75580075BB52 /* closedir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536F6138D9E990028D27C /* closedir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_CLOSEDIR -include gen/__dirent.h"; }; };
+               C9EB32E5138F75580075BB52 /* ctermid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FA138D9E990028D27C /* ctermid.c */; };
+               C9EB32E6138F75580075BB52 /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B536FD138D9E990028D27C /* daemon.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB32E7138F75580075BB52 /* dirname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53701138D9E990028D27C /* dirname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB32E8138F75580075BB52 /* drand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53703138D9E990028D27C /* drand48.c */; };
+               C9EB32E9138F75580075BB52 /* erand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53705138D9E990028D27C /* erand48.c */; };
+               C9EB32EA138F75580075BB52 /* err.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53709138D9E990028D27C /* err.c */; };
+               C9EB32EB138F75580075BB52 /* exec.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5370D138D9E990028D27C /* exec.c */; };
+               C9EB32EC138F75580075BB52 /* fmtcheck.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53710138D9E990028D27C /* fmtcheck.c */; };
+               C9EB32ED138F75580075BB52 /* fmtmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53712138D9E990028D27C /* fmtmsg.c */; };
+               C9EB32EE138F75580075BB52 /* fnmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53716138D9E990028D27C /* fnmatch.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FNMATCH"; }; };
+               C9EB32EF138F75580075BB52 /* ftok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371A138D9E990028D27C /* ftok.c */; };
+               C9EB32F0138F75580075BB52 /* getbsize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371C138D9E990028D27C /* getbsize.c */; };
+               C9EB32F1138F75580075BB52 /* getcap.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5371E138D9E990028D27C /* getcap.c */; };
+               C9EB32F2138F75580075BB52 /* getcwd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53722138D9E990028D27C /* getcwd.c */; };
+               C9EB32F3138F75580075BB52 /* gethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53726138D9E990028D27C /* gethostname.c */; };
+               C9EB32F4138F75580075BB52 /* getlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53728138D9E990028D27C /* getlogin.c */; };
+               C9EB32F5138F75580075BB52 /* getmntinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372C138D9E990028D27C /* getmntinfo.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB32F6138F75580075BB52 /* getpagesize.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5372F138D9E990028D27C /* getpagesize.c */; };
+               C9EB32F7138F75580075BB52 /* getpeereid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53732138D9E990028D27C /* getpeereid.c */; };
+               C9EB32F8138F75580075BB52 /* getprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53735138D9E990028D27C /* getprogname.c */; };
+               C9EB32F9138F75580075BB52 /* glob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53739138D9E990028D27C /* glob.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_GLOB"; }; };
+               C9EB32FA138F75580075BB52 /* isatty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373B138D9E990028D27C /* isatty.c */; };
+               C9EB32FB138F75580075BB52 /* jrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373D138D9E990028D27C /* jrand48.c */; };
+               C9EB32FC138F75580075BB52 /* lcong48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5373F138D9E990028D27C /* lcong48.c */; };
+               C9EB32FD138F75580075BB52 /* lockf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53743138D9E990028D27C /* lockf.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_LOCKF"; }; };
+               C9EB32FE138F75580075BB52 /* lrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53745138D9E990028D27C /* lrand48.c */; };
+               C9EB32FF138F75580075BB52 /* mrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53749138D9E990028D27C /* mrand48.c */; };
+               C9EB3300138F75580075BB52 /* nice.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374C138D9E990028D27C /* nice.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_NICE"; }; };
+               C9EB3301138F75580075BB52 /* nrand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5374E138D9E990028D27C /* nrand48.c */; };
+               C9EB3302138F75580075BB52 /* opendir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53750138D9E990028D27C /* opendir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS___OPENDIR2 -DLIBC_ALIAS_OPENDIR -include gen/__dirent.h"; }; };
+               C9EB3303138F75580075BB52 /* pause.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53753138D9E990028D27C /* pause.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PAUSE"; }; };
+               C9EB3304138F75580075BB52 /* popen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53757138D9E990028D27C /* popen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_POPEN"; }; };
+               C9EB3305138F75580075BB52 /* pselect.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375B138D9E990028D27C /* pselect.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PSELECT $(FreeBSD_CFLAGS)"; }; };
+               C9EB3306138F75580075BB52 /* psignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5375F138D9E990028D27C /* psignal.c */; };
+               C9EB3307138F75580075BB52 /* raise.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53761138D9E990028D27C /* raise.c */; };
+               C9EB3308138F75580075BB52 /* readdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53766138D9E990028D27C /* readdir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C9EB3309138F75580075BB52 /* readpassphrase.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53769138D9E990028D27C /* readpassphrase.c */; };
+               C9EB330A138F75580075BB52 /* rewinddir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376B138D9E990028D27C /* rewinddir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REWINDDIR -include gen/__dirent.h"; }; };
+               C9EB330B138F75580075BB52 /* scandir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5376E138D9E990028D27C /* scandir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C9EB330C138F75580075BB52 /* seed48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53771138D9E990028D27C /* seed48.c */; };
+               C9EB330D138F75580075BB52 /* seekdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53773138D9E990028D27C /* seekdir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEEKDIR -include gen/__dirent.h"; }; };
+               C9EB330E138F75580075BB52 /* sethostname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53774138D9E990028D27C /* sethostname.c */; };
+               C9EB330F138F75580075BB52 /* setmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53776138D9E990028D27C /* setmode.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SETMODE"; }; };
+               C9EB3310138F75580075BB52 /* setprogname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53778138D9E990028D27C /* setprogname.c */; };
+               C9EB3311138F75580075BB52 /* siginterrupt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377C138D9E990028D27C /* siginterrupt.c */; };
+               C9EB3312138F75580075BB52 /* siglist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5377D138D9E990028D27C /* siglist.c */; };
+               C9EB3313138F75580075BB52 /* signal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53781138D9E990028D27C /* signal.c */; };
+               C9EB3314138F75580075BB52 /* sleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53787138D9E990028D27C /* sleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SLEEP"; }; };
+               C9EB3315138F75580075BB52 /* srand48.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53789138D9E990028D27C /* srand48.c */; };
+               C9EB3316138F75580075BB52 /* stringlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378C138D9E990028D27C /* stringlist.c */; };
+               C9EB3317138F75580075BB52 /* sysconf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5378E138D9E990028D27C /* sysconf.c */; };
+               C9EB3318138F75580075BB52 /* sysctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53792138D9E990028D27C /* sysctl.c */; };
+               C9EB3319138F75580075BB52 /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; };
+               C9EB331A138F75580075BB52 /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; };
+               C9EB331B138F75580075BB52 /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS__SEEKDIR -DLIBC_ALIAS_TELLDIR -include gen/__dirent.h"; }; };
+               C9EB331C138F75580075BB52 /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; };
+               C9EB331D138F75580075BB52 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; };
+               C9EB331E138F75580075BB52 /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; };
+               C9EB331F138F75580075BB52 /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS)"; }; };
+               C9EB3320138F75580075BB52 /* ttyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A7138D9E990028D27C /* ttyname.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TTYNAME_R"; }; };
+               C9EB3321138F75580075BB52 /* ttyslot.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A9138D9E990028D27C /* ttyslot.c */; };
+               C9EB3322138F75580075BB52 /* ualarm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537AC138D9E990028D27C /* ualarm.c */; };
+               C9EB3323138F75580075BB52 /* ulimit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B0138D9E990028D27C /* ulimit.c */; };
+               C9EB3324138F75580075BB52 /* unvis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B2138D9E990028D27C /* unvis.c */; };
+               C9EB3325138F75580075BB52 /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP"; }; };
+               C9EB3326138F75580075BB52 /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; };
+               C9EB3327138F75580075BB52 /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; };
+               C9EB3328138F75580075BB52 /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; };
+               C9EB3329138F75580075BB52 /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; };
+               C9EB332A138F75580075BB52 /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; };
+               C9EB332B138F75580075BB52 /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTS_CHILDREN -DLIBC_ALIAS_FTS_CLOSE -DLIBC_ALIAS_FTS_OPEN -DLIBC_ALIAS_FTS_OPEN_B -DLIBC_ALIAS_FTS_READ -DLIBC_ALIAS_FTS_SET"; }; };
+               C9EB332C138F75580075BB52 /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; };
+               C9EB332D138F75580075BB52 /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; };
+               C9EB332E138F75580075BB52 /* getttyent.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CC138D9E990028D27C /* getttyent.c */; };
+               C9EB332F138F75580075BB52 /* getusershell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CE138D9E990028D27C /* getusershell.c */; };
+               C9EB3330138F75580075BB52 /* getvfsbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D0138D9E990028D27C /* getvfsbyname.c */; };
+               C9EB3331138F75580075BB52 /* isinf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D2138D9E990028D27C /* isinf.c */; };
+               C9EB3332138F75580075BB52 /* isnan.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D3138D9E990028D27C /* isnan.c */; };
+               C9EB3333138F75580075BB52 /* magazine_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D4138D9E990028D27C /* magazine_malloc.c */; };
+               C9EB3334138F75580075BB52 /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537D8138D9E990028D27C /* malloc.c */; };
+               C9EB3335138F75580075BB52 /* nanosleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537DC138D9E990028D27C /* nanosleep.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_NANOSLEEP"; }; };
+               C9EB3336138F75580075BB52 /* utmpx.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E4138D9E990028D27C /* utmpx.c */; };
+               C9EB3337138F75580075BB52 /* nftw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E6138D9E990028D27C /* nftw.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW"; }; };
+               C9EB3338138F75580075BB52 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C9EB3339138F75580075BB52 /* NSSystemDirectories.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E9138D9E990028D27C /* NSSystemDirectories.c */; };
+               C9EB333A138F75580075BB52 /* oldsyslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EA138D9E990028D27C /* oldsyslog.c */; };
+               C9EB333B138F75580075BB52 /* platfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EB138D9E990028D27C /* platfunc.c */; };
+               C9EB333C138F75580075BB52 /* scalable_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537EF138D9E990028D27C /* scalable_malloc.c */; };
+               C9EB333D138F75580075BB52 /* setlogin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F2138D9E990028D27C /* setlogin.c */; };
+               C9EB333E138F75580075BB52 /* sigsetops.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F4138D9E990028D27C /* sigsetops.c */; };
+               C9EB333F138F75580075BB52 /* stack_logging.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F5138D9E990028D27C /* stack_logging.c */; };
+               C9EB3340138F75580075BB52 /* stack_logging_disk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F7138D9E990028D27C /* stack_logging_disk.c */; };
+               C9EB3341138F75580075BB52 /* strtofflags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537F9138D9E990028D27C /* strtofflags.c */; };
+               C9EB3342138F75580075BB52 /* syslog.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537FB138D9E990028D27C /* syslog.c */; };
+               C9EB3343138F75580075BB52 /* thread_stack_pcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53800138D9E990028D27C /* thread_stack_pcs.c */; };
+               C9EB3344138F75580075BB52 /* uname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53803138D9E990028D27C /* uname.c */; };
+               C9EB3345138F75580075BB52 /* utmpx-darwin.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53804138D9E990028D27C /* utmpx-darwin.c */; };
+               C9EB3346138F75580075BB52 /* wordexp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53808138D9E990028D27C /* wordexp.c */; };
+               C9EB3348138F75580075BB52 /* gmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5380B138D9E990028D27C /* gmon.c */; };
+               C9EB3349138F75580075BB52 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53815138D9E990028D27C /* getmcontext.c */; };
+               C9EB334A138F75580075BB52 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53817138D9E990028D27C /* makecontext.c */; };
+               C9EB334B138F75580075BB52 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381A138D9E990028D27C /* setcontext.c */; };
+               C9EB334C138F75580075BB52 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381B138D9E990028D27C /* setjmperr.c */; };
+               C9EB334D138F75580075BB52 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381C138D9E990028D27C /* swapcontext.c */; };
+               C9EB334E138F75580075BB52 /* init_cpu_capabilities.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */; };
+               C9EB334F138F75580075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5382B138D9E990028D27C /* bcopy.c */; };
+               C9EB3350138F75580075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53830138D9E990028D27C /* bzero.c */; };
+               C9EB3351138F75580075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53838138D9E990028D27C /* memcpy.c */; };
+               C9EB3352138F75580075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53839138D9E990028D27C /* memmove.c */; };
+               C9EB3353138F75580075BB52 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53846138D9E990028D27C /* atomic.c */; };
+               C9EB3354138F75580075BB52 /* mach_absolute_time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53848138D9E990028D27C /* mach_absolute_time.c */; };
+               C9EB3355138F75580075BB52 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5384D138D9E990028D27C /* spinlocks.c */; };
+               C9EB3368138F75580075BB52 /* ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53902138D9E990028D27C /* ascii.c */; };
+               C9EB3369138F75580075BB52 /* big5.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53905138D9E990028D27C /* big5.c */; };
+               C9EB336A138F75580075BB52 /* btowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53909138D9E990028D27C /* btowc.c */; };
+               C9EB336B138F75580075BB52 /* collate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390B138D9E990028D27C /* collate.c */; };
+               C9EB336C138F75580075BB52 /* collcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5390F138D9E990028D27C /* collcmp.c */; };
+               C9EB336D138F75580075BB52 /* euc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53916138D9E990028D27C /* euc.c */; };
+               C9EB336E138F75580075BB52 /* fix_grouping.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53918138D9E990028D27C /* fix_grouping.c */; };
+               C9EB336F138F75580075BB52 /* gb18030.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391B138D9E990028D27C /* gb18030.c */; };
+               C9EB3370138F75580075BB52 /* gb2312.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5391E138D9E990028D27C /* gb2312.c */; };
+               C9EB3371138F75580075BB52 /* gbk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53921138D9E990028D27C /* gbk.c */; };
+               C9EB3372138F75580075BB52 /* ldpart.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53946138D9E990028D27C /* ldpart.c */; };
+               C9EB3373138F75580075BB52 /* lmessages.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394A138D9E990028D27C /* lmessages.c */; };
+               C9EB3374138F75580075BB52 /* lmonetary.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5394E138D9E990028D27C /* lmonetary.c */; };
+               C9EB3375138F75580075BB52 /* lnumeric.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53952138D9E990028D27C /* lnumeric.c */; };
+               C9EB3376138F75580075BB52 /* localeconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53958138D9E990028D27C /* localeconv.c */; };
+               C9EB3377138F75580075BB52 /* mblen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5395C138D9E990028D27C /* mblen.c */; };
+               C9EB3378138F75580075BB52 /* mbrlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53962138D9E990028D27C /* mbrlen.c */; };
+               C9EB3379138F75580075BB52 /* mbrtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53966138D9E990028D27C /* mbrtowc.c */; };
+               C9EB337A138F75580075BB52 /* mbsinit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396A138D9E990028D27C /* mbsinit.c */; };
+               C9EB337B138F75580075BB52 /* mbsnrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5396C138D9E990028D27C /* mbsnrtowcs.c */; };
+               C9EB337C138F75580075BB52 /* mbsrtowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53970138D9E990028D27C /* mbsrtowcs.c */; };
+               C9EB337D138F75580075BB52 /* mbstowcs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53974138D9E990028D27C /* mbstowcs.c */; };
+               C9EB337E138F75580075BB52 /* mbtowc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53978138D9E990028D27C /* mbtowc.c */; };
+               C9EB337F138F75580075BB52 /* mskanji.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5397B138D9E990028D27C /* mskanji.c */; };
+               C9EB3380138F75580075BB52 /* nextwctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53980138D9E990028D27C /* nextwctype.c */; };
+               C9EB3381138F75580075BB52 /* nl_langinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53984138D9E990028D27C /* nl_langinfo.c */; };
+               C9EB3382138F75580075BB52 /* nomacros.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53986138D9E990028D27C /* nomacros.c */; };
+               C9EB3383138F75580075BB52 /* none.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53987138D9E990028D27C /* none.c */; };
+               C9EB3384138F75580075BB52 /* rune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53989138D9E990028D27C /* rune.c */; };
+               C9EB3385138F75580075BB52 /* runetype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398B138D9E990028D27C /* runetype.c */; };
+               C9EB3386138F75580075BB52 /* setlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5398F138D9E990028D27C /* setlocale.c */; };
+               C9EB3387138F75580075BB52 /* setrunelocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53993138D9E990028D27C /* setrunelocale.c */; };
+               C9EB3388138F75580075BB52 /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53995138D9E990028D27C /* table.c */; };
+               C9EB3389138F75580075BB52 /* tolower.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399A138D9E990028D27C /* tolower.c */; };
+               C9EB338A138F75580075BB52 /* toupper.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5399E138D9E990028D27C /* toupper.c */; };
+               C9EB338B138F75580075BB52 /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C9EB338C138F75580075BB52 /* utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539A6138D9E990028D27C /* utf8.c */; };
+               C9EB338D138F75580075BB52 /* wcrtomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AA138D9E990028D27C /* wcrtomb.c */; };
+               C9EB338E138F75580075BB52 /* wcsftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539AE138D9E990028D27C /* wcsftime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WCSFTIME -DLIBC_ALIAS_WCSFTIME_L"; }; };
+               C9EB338F138F75580075BB52 /* wcsnrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B0138D9E990028D27C /* wcsnrtombs.c */; };
+               C9EB3390138F75580075BB52 /* wcsrtombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B4138D9E990028D27C /* wcsrtombs.c */; };
+               C9EB3391138F75580075BB52 /* wcstod.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539B8138D9E990028D27C /* wcstod.c */; };
+               C9EB3392138F75580075BB52 /* wcstof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BA138D9E990028D27C /* wcstof.c */; };
+               C9EB3393138F75580075BB52 /* wcstoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539BC138D9E990028D27C /* wcstoimax.c */; };
+               C9EB3394138F75580075BB52 /* wcstol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C0138D9E990028D27C /* wcstol.c */; };
+               C9EB3395138F75580075BB52 /* wcstold.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C2138D9E990028D27C /* wcstold.c */; };
+               C9EB3396138F75580075BB52 /* wcstoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C4138D9E990028D27C /* wcstoll.c */; };
+               C9EB3397138F75580075BB52 /* wcstombs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539C8138D9E990028D27C /* wcstombs.c */; };
+               C9EB3398138F75580075BB52 /* wcstoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CA138D9E990028D27C /* wcstoul.c */; };
+               C9EB3399138F75580075BB52 /* wcstoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CC138D9E990028D27C /* wcstoull.c */; };
+               C9EB339A138F75580075BB52 /* wcstoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539CE138D9E990028D27C /* wcstoumax.c */; };
+               C9EB339B138F75580075BB52 /* wctob.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D0138D9E990028D27C /* wctob.c */; };
+               C9EB339C138F75580075BB52 /* wctomb.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D4138D9E990028D27C /* wctomb.c */; };
+               C9EB339D138F75580075BB52 /* wctrans.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539D8138D9E990028D27C /* wctrans.c */; };
+               C9EB339E138F75580075BB52 /* wctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539DC138D9E990028D27C /* wctype.c */; };
+               C9EB339F138F75580075BB52 /* wcwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E0138D9E990028D27C /* wcwidth.c */; };
+               C9EB33A0138F75580075BB52 /* frune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E3138D9E990028D27C /* frune.c */; };
+               C9EB33A1138F75580075BB52 /* isctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E5138D9E990028D27C /* isctype.c */; };
+               C9EB33A2138F75580075BB52 /* iswctype.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E7138D9E990028D27C /* iswctype.c */; };
+               C9EB33A3138F75580075BB52 /* lconv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539E8138D9E990028D27C /* lconv.c */; };
+               C9EB33A4138F75580075BB52 /* mbrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EB138D9E990028D27C /* mbrune.c */; };
+               C9EB33A5138F75580075BB52 /* runedepreciated.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539EF138D9E990028D27C /* runedepreciated.c */; };
+               C9EB33A6138F75580075BB52 /* setinvalidrune.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F1138D9E990028D27C /* setinvalidrune.c */; };
+               C9EB33A7138F75580075BB52 /* xlocale.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B539F7138D9E990028D27C /* xlocale.c */; };
+               C9EB33A8138F75580075BB52 /* addr2ascii.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A16138D9E990028D27C /* addr2ascii.c */; };
+               C9EB33A9138F75580075BB52 /* ascii2addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A17138D9E990028D27C /* ascii2addr.c */; };
+               C9EB33AA138F75580075BB52 /* inet_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1A138D9E990028D27C /* inet_addr.c */; };
+               C9EB33AB138F75580075BB52 /* inet_lnaof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1C138D9E990028D27C /* inet_lnaof.c */; };
+               C9EB33AC138F75580075BB52 /* inet_makeaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A1D138D9E990028D27C /* inet_makeaddr.c */; };
+               C9EB33AD138F75580075BB52 /* inet_net_ntop.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A20138D9E990028D27C /* inet_net_ntop.c */; };
+               C9EB33AE138F75580075BB52 /* inet_net_pton.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A21138D9E990028D27C /* inet_net_pton.c */; };
+               C9EB33AF138F75580075BB52 /* inet_neta.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A23138D9E990028D27C /* inet_neta.c */; };
+               C9EB33B0138F75580075BB52 /* inet_netof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A24138D9E990028D27C /* inet_netof.c */; };
+               C9EB33B1138F75580075BB52 /* inet_network.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A25138D9E990028D27C /* inet_network.c */; };
+               C9EB33B2138F75580075BB52 /* inet_ntoa.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A27138D9E990028D27C /* inet_ntoa.c */; };
+               C9EB33B3138F75580075BB52 /* linkaddr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2A138D9E990028D27C /* linkaddr.c */; };
+               C9EB33B4138F75580075BB52 /* nsap_addr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2B138D9E990028D27C /* nsap_addr.c */; };
+               C9EB33B5138F75580075BB52 /* recv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2D138D9E990028D27C /* recv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_RECV"; }; };
+               C9EB33B6138F75580075BB52 /* send.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A2F138D9E990028D27C /* send.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SEND"; }; };
+               C9EB33B7138F75580075BB52 /* sockatmark.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A33138D9E990028D27C /* sockatmark.c */; };
+               C9EB33B8138F75580075BB52 /* sourcefilter.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A36138D9E990028D27C /* sourcefilter.c */; };
+               C9EB33B9138F75580075BB52 /* msgcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A3F138D9E990028D27C /* msgcat.c */; };
+               C9EB33BA138F75580075BB52 /* acl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A4C138D9E990028D27C /* acl.c */; };
+               C9EB33BB138F75580075BB52 /* acl_entry.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A59138D9E990028D27C /* acl_entry.c */; };
+               C9EB33BC138F75580075BB52 /* acl_file.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5A138D9E990028D27C /* acl_file.c */; };
+               C9EB33BD138F75580075BB52 /* acl_flag.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A5B138D9E990028D27C /* acl_flag.c */; };
+               C9EB33BE138F75580075BB52 /* acl_perm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A68138D9E990028D27C /* acl_perm.c */; };
+               C9EB33BF138F75580075BB52 /* acl_translate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53A6F138D9E990028D27C /* acl_translate.c */; };
+               C9EB33C8138F75580075BB52 /* mk_pthread_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */; };
+               C9EB33C9138F75580075BB52 /* pthread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AC0138D9E990028D27C /* pthread.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_CANCEL -DLIBC_ALIAS_PTHREAD_SETCANCELSTATE -DLIBC_ALIAS_PTHREAD_SETCANCELTYPE -DLIBC_ALIAS_PTHREAD_SIGMASK -DLIBC_ALIAS_PTHREAD_TESTCANCEL"; }; };
+               C9EB33CA138F75580075BB52 /* pthread_cancelable.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53ACD138D9E990028D27C /* pthread_cancelable.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT"; }; };
+               C9EB33CB138F75580075BB52 /* pthread_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AD0138D9E990028D27C /* pthread_cond.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_COND_INIT"; }; };
+               C9EB33CC138F75580075BB52 /* pthread_mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AE4138D9E990028D27C /* pthread_mutex.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY"; }; };
+               C9EB33CD138F75580075BB52 /* pthread_rwlock.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AEC138D9E990028D27C /* pthread_rwlock.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_PTHREAD_RWLOCK_DESTROY -DLIBC_ALIAS_PTHREAD_RWLOCK_INIT -DLIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK"; }; };
+               C9EB33CE138F75580075BB52 /* pthread_tsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53AFB138D9E990028D27C /* pthread_tsd.c */; };
+               C9EB33CF138F75580075BB52 /* pthread_atfork_test.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B01138D9E990028D27C /* pthread_atfork_test.c */; };
+               C9EB33D0138F75580075BB52 /* thread_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B02138D9E990028D27C /* thread_setup.c */; };
+               C9EB33D3138F75580075BB52 /* regerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B0E138D9E990028D27C /* regerror.c */; };
+               C9EB33D6138F75580075BB52 /* chk_fail.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B1E138D9E990028D27C /* chk_fail.c */; };
+               C9EB33D7138F75580075BB52 /* memcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B20138D9E990028D27C /* memcpy_chk.c */; };
+               C9EB33D8138F75580075BB52 /* memmove_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B21138D9E990028D27C /* memmove_chk.c */; };
+               C9EB33D9138F75580075BB52 /* memset_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B22138D9E990028D27C /* memset_chk.c */; };
+               C9EB33DA138F75580075BB52 /* snprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B23138D9E990028D27C /* snprintf_chk.c */; };
+               C9EB33DB138F75580075BB52 /* sprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B24138D9E990028D27C /* sprintf_chk.c */; };
+               C9EB33DC138F75580075BB52 /* stpcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B25138D9E990028D27C /* stpcpy_chk.c */; };
+               C9EB33DD138F75580075BB52 /* stpncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B26138D9E990028D27C /* stpncpy_chk.c */; };
+               C9EB33DE138F75580075BB52 /* strcat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B27138D9E990028D27C /* strcat_chk.c */; };
+               C9EB33DF138F75580075BB52 /* strcpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B28138D9E990028D27C /* strcpy_chk.c */; };
+               C9EB33E0138F75580075BB52 /* strncat_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B29138D9E990028D27C /* strncat_chk.c */; };
+               C9EB33E1138F75580075BB52 /* strncpy_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2A138D9E990028D27C /* strncpy_chk.c */; };
+               C9EB33E2138F75580075BB52 /* vsnprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */; };
+               C9EB33E3138F75580075BB52 /* vsprintf_chk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2C138D9E990028D27C /* vsprintf_chk.c */; };
+               C9EB33E4138F75580075BB52 /* _flock_stub.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B2F138D9E990028D27C /* _flock_stub.c */; };
+               C9EB33E5138F75580075BB52 /* asprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B30138D9E990028D27C /* asprintf.c */; };
+               C9EB33E6138F75580075BB52 /* clrerr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B32138D9E990028D27C /* clrerr.c */; };
+               C9EB33E7138F75580075BB52 /* dprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B33138D9E990028D27C /* dprintf.c */; };
+               C9EB33E8138F75580075BB52 /* fclose.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B36138D9E990028D27C /* fclose.c */; };
+               C9EB33E9138F75580075BB52 /* fdopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B38138D9E990028D27C /* fdopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FDOPEN"; }; };
+               C9EB33EA138F75580075BB52 /* feof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3A138D9E990028D27C /* feof.c */; };
+               C9EB33EB138F75580075BB52 /* ferror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3C138D9E990028D27C /* ferror.c */; };
+               C9EB33EC138F75580075BB52 /* fflush.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B3E138D9E990028D27C /* fflush.c */; };
+               C9EB33ED138F75580075BB52 /* fgetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B40138D9E990028D27C /* fgetc.c */; };
+               C9EB33EE138F75580075BB52 /* fgetln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B43138D9E990028D27C /* fgetln.c */; };
+               C9EB33EF138F75580075BB52 /* fgetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B45138D9E990028D27C /* fgetpos.c */; };
+               C9EB33F0138F75580075BB52 /* fgets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B47138D9E990028D27C /* fgets.c */; };
+               C9EB33F1138F75580075BB52 /* fgetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B48138D9E990028D27C /* fgetwc.c */; };
+               C9EB33F2138F75580075BB52 /* fgetwln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B4C138D9E990028D27C /* fgetwln.c */; };
+               C9EB33F3138F75580075BB52 /* fgetws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B50138D9E990028D27C /* fgetws.c */; };
+               C9EB33F4138F75580075BB52 /* fileno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B52138D9E990028D27C /* fileno.c */; };
+               C9EB33F5138F75580075BB52 /* findfp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B53138D9E990028D27C /* findfp.c */; };
+               C9EB33F6138F75580075BB52 /* flags.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B55138D9E990028D27C /* flags.c */; };
+               C9EB33F7138F75580075BB52 /* fopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5C138D9E990028D27C /* fopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FOPEN"; }; };
+               C9EB33F8138F75580075BB52 /* fprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B5E138D9E990028D27C /* fprintf.c */; };
+               C9EB33F9138F75580075BB52 /* fpurge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B60138D9E990028D27C /* fpurge.c */; };
+               C9EB33FA138F75580075BB52 /* fputc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B61138D9E990028D27C /* fputc.c */; };
+               C9EB33FB138F75580075BB52 /* fputs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B64138D9E990028D27C /* fputs.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FPUTS"; }; };
+               C9EB33FC138F75580075BB52 /* fputwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B66138D9E990028D27C /* fputwc.c */; };
+               C9EB33FD138F75580075BB52 /* fputws.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6A138D9E990028D27C /* fputws.c */; };
+               C9EB33FE138F75580075BB52 /* fread.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B6E138D9E990028D27C /* fread.c */; };
+               C9EB33FF138F75580075BB52 /* freopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B70138D9E990028D27C /* freopen.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FREOPEN"; }; };
+               C9EB3400138F75580075BB52 /* fscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B72138D9E990028D27C /* fscanf.c */; };
+               C9EB3401138F75580075BB52 /* fseek.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B76138D9E990028D27C /* fseek.c */; };
+               C9EB3402138F75580075BB52 /* fsetpos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B77138D9E990028D27C /* fsetpos.c */; };
+               C9EB3403138F75580075BB52 /* ftell.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B78138D9E990028D27C /* ftell.c */; };
+               C9EB3404138F75580075BB52 /* funopen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7B138D9E990028D27C /* funopen.c */; };
+               C9EB3405138F75580075BB52 /* fvwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7D138D9E990028D27C /* fvwrite.c */; };
+               C9EB3406138F75580075BB52 /* fwalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B7F138D9E990028D27C /* fwalk.c */; };
+               C9EB3407138F75580075BB52 /* fwide.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B82138D9E990028D27C /* fwide.c */; };
+               C9EB3408138F75580075BB52 /* fwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B83138D9E990028D27C /* fwprintf.c */; };
+               C9EB3409138F75580075BB52 /* fwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B85138D9E990028D27C /* fwrite.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_FWRITE"; }; };
+               C9EB340A138F75580075BB52 /* fwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B87138D9E990028D27C /* fwscanf.c */; };
+               C9EB340B138F75580075BB52 /* getc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8B138D9E990028D27C /* getc.c */; };
+               C9EB340C138F75580075BB52 /* getchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8C138D9E990028D27C /* getchar.c */; };
+               C9EB340D138F75580075BB52 /* getdelim.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B8D138D9E990028D27C /* getdelim.c */; };
+               C9EB340E138F75580075BB52 /* getline.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B90138D9E990028D27C /* getline.c */; };
+               C9EB340F138F75580075BB52 /* gets.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B91138D9E990028D27C /* gets.c */; };
+               C9EB3410138F75580075BB52 /* getw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B92138D9E990028D27C /* getw.c */; };
+               C9EB3411138F75580075BB52 /* getwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B95138D9E990028D27C /* getwc.c */; };
+               C9EB3412138F75580075BB52 /* getwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B97138D9E990028D27C /* getwchar.c */; };
+               C9EB3413138F75580075BB52 /* makebuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53B9C138D9E990028D27C /* makebuf.c */; };
+               C9EB3414138F75580075BB52 /* mktemp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA0138D9E990028D27C /* mktemp.c */; };
+               C9EB3415138F75580075BB52 /* perror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA2138D9E990028D27C /* perror.c */; };
+               C9EB3416138F75580075BB52 /* printf-pos.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA3138D9E990028D27C /* printf-pos.c */; };
+               C9EB3417138F75580075BB52 /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BA7138D9E990028D27C /* printf.c */; };
+               C9EB3418138F75580075BB52 /* putc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BAF138D9E990028D27C /* putc.c */; };
+               C9EB3419138F75580075BB52 /* putchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB0138D9E990028D27C /* putchar.c */; };
+               C9EB341A138F75580075BB52 /* puts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB1138D9E990028D27C /* puts.c */; };
+               C9EB341B138F75580075BB52 /* putw.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB3138D9E990028D27C /* putw.c */; };
+               C9EB341C138F75580075BB52 /* putwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB6138D9E990028D27C /* putwc.c */; };
+               C9EB341D138F75580075BB52 /* putwchar.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BB8138D9E990028D27C /* putwchar.c */; };
+               C9EB341E138F75580075BB52 /* refill.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBA138D9E990028D27C /* refill.c */; };
+               C9EB341F138F75580075BB52 /* remove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBE138D9E990028D27C /* remove.c */; };
+               C9EB3420138F75580075BB52 /* rewind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BBF138D9E990028D27C /* rewind.c */; };
+               C9EB3421138F75580075BB52 /* rget.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC1138D9E990028D27C /* rget.c */; };
+               C9EB3422138F75580075BB52 /* scanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC4138D9E990028D27C /* scanf.c */; };
+               C9EB3423138F75580075BB52 /* setbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC8138D9E990028D27C /* setbuf.c */; };
+               C9EB3424138F75580075BB52 /* setbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BC9138D9E990028D27C /* setbuffer.c */; };
+               C9EB3425138F75580075BB52 /* setvbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCA138D9E990028D27C /* setvbuf.c */; };
+               C9EB3426138F75580075BB52 /* snprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCB138D9E990028D27C /* snprintf.c */; };
+               C9EB3427138F75580075BB52 /* sprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCD138D9E990028D27C /* sprintf.c */; };
+               C9EB3428138F75580075BB52 /* sscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BCF138D9E990028D27C /* sscanf.c */; };
+               C9EB3429138F75580075BB52 /* stdio.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD3138D9E990028D27C /* stdio.c */; };
+               C9EB342A138F75580075BB52 /* swprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD4138D9E990028D27C /* swprintf.c */; };
+               C9EB342B138F75580075BB52 /* swscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD6138D9E990028D27C /* swscanf.c */; };
+               C9EB342C138F75580075BB52 /* tempnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BD8138D9E990028D27C /* tempnam.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TEMPNAM"; }; };
+               C9EB342D138F75580075BB52 /* tmpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDA138D9E990028D27C /* tmpfile.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C9EB342E138F75580075BB52 /* tmpnam.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BDD138D9E990028D27C /* tmpnam.c */; };
+               C9EB342F138F75580075BB52 /* ungetc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE1138D9E990028D27C /* ungetc.c */; };
+               C9EB3430138F75580075BB52 /* ungetwc.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE4138D9E990028D27C /* ungetwc.c */; };
+               C9EB3431138F75580075BB52 /* vasprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE6138D9E990028D27C /* vasprintf.c */; };
+               C9EB3432138F75580075BB52 /* vdprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BE8138D9E990028D27C /* vdprintf.c */; };
+               C9EB3433138F75580075BB52 /* vfprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEA138D9E990028D27C /* vfprintf.c */; };
+               C9EB3434138F75580075BB52 /* vfscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEC138D9E990028D27C /* vfscanf.c */; };
+               C9EB3435138F75580075BB52 /* vfwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BEE138D9E9A0028D27C /* vfwprintf.c */; };
+               C9EB3436138F75580075BB52 /* vfwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF0138D9E9A0028D27C /* vfwscanf.c */; };
+               C9EB3437138F75580075BB52 /* vprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF2138D9E9A0028D27C /* vprintf.c */; };
+               C9EB3438138F75580075BB52 /* vscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF4138D9E9A0028D27C /* vscanf.c */; };
+               C9EB3439138F75580075BB52 /* vsnprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF6138D9E9A0028D27C /* vsnprintf.c */; };
+               C9EB343A138F75580075BB52 /* vsprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BF8138D9E9A0028D27C /* vsprintf.c */; };
+               C9EB343B138F75580075BB52 /* vsscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFA138D9E9A0028D27C /* vsscanf.c */; };
+               C9EB343C138F75580075BB52 /* vswprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFC138D9E9A0028D27C /* vswprintf.c */; };
+               C9EB343D138F75580075BB52 /* vswscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53BFE138D9E9A0028D27C /* vswscanf.c */; };
+               C9EB343E138F75580075BB52 /* vwprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C00138D9E9A0028D27C /* vwprintf.c */; };
+               C9EB343F138F75580075BB52 /* vwscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C02138D9E9A0028D27C /* vwscanf.c */; };
+               C9EB3440138F75580075BB52 /* wbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C04138D9E9A0028D27C /* wbuf.c */; };
+               C9EB3441138F75580075BB52 /* wprintf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C08138D9E9A0028D27C /* wprintf.c */; };
+               C9EB3442138F75580075BB52 /* wscanf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0C138D9E9A0028D27C /* wscanf.c */; };
+               C9EB3443138F75580075BB52 /* wsetup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C0E138D9E9A0028D27C /* wsetup.c */; };
+               C9EB3444138F75580075BB52 /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C9EB3445138F75580075BB52 /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C9EB3446138F75580075BB52 /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C9EB3447138F75580075BB52 /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C9EB3448138F75580075BB52 /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C9EB3449138F75580075BB52 /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C9EB344A138F75580075BB52 /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C9EB344B138F75580075BB52 /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C9EB344C138F75580075BB52 /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C9EB344D138F75580075BB52 /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C9EB344E138F75580075BB52 /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C9EB344F138F75580075BB52 /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C9EB3450138F75580075BB52 /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C9EB3451138F75580075BB52 /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_GETOPT"; }; };
+               C9EB3452138F75580075BB52 /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C9EB3453138F75580075BB52 /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C9EB3454138F75580075BB52 /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C9EB3455138F75580075BB52 /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C9EB3456138F75580075BB52 /* heapsort_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94357138EC0C600FB7ACC /* heapsort_b.c */; };
+               C9EB3457138F75580075BB52 /* heapsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9D94358138EC0C600FB7ACC /* heapsort_r.c */; };
+               C9EB3458138F75580075BB52 /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C9EB3459138F75580075BB52 /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C9EB345A138F75580075BB52 /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C9EB345B138F75580075BB52 /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C9EB345C138F75580075BB52 /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C9EB345D138F75580075BB52 /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C9EB345E138F75580075BB52 /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C9EB345F138F75580075BB52 /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C9EB3460138F75580075BB52 /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C9EB3461138F75580075BB52 /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_PUTENV"; }; };
+               C9EB3462138F75580075BB52 /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C9EB3463138F75580075BB52 /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C9EB3464138F75580075BB52 /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C9EB3465138F75580075BB52 /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C9EB3466138F75580075BB52 /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C9EB3467138F75580075BB52 /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C9EB3468138F75580075BB52 /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C9EB3469138F75580075BB52 /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C9EB346A138F75580075BB52 /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_REALPATH"; }; };
+               C9EB346B138F75580075BB52 /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C9EB346C138F75580075BB52 /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C9EB346D138F75580075BB52 /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C9EB346E138F75580075BB52 /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C9EB346F138F75580075BB52 /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C9EB3470138F75580075BB52 /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C9EB3471138F75580075BB52 /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C9EB3472138F75580075BB52 /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C9EB3473138F75580075BB52 /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C9EB3474138F75580075BB52 /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_SYSTEM"; }; };
+               C9EB3475138F75580075BB52 /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C9EB3476138F75580075BB52 /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C9EB3477138F75580075BB52 /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C9EB3478138F75580075BB52 /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C9EB3479138F75580075BB52 /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C9EB347A138F75580075BB52 /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C9EB347B138F75580075BB52 /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+               C9EB347C138F75580075BB52 /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C9EB347D138F75580075BB52 /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C9EB347E138F75580075BB52 /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C9EB347F138F75580075BB52 /* asctime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC2138D9E9A0028D27C /* asctime.c */; };
+               C9EB3480138F75580075BB52 /* difftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC6138D9E9A0028D27C /* difftime.c */; };
+               C9EB3481138F75580075BB52 /* ftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CC9138D9E9A0028D27C /* ftime.c */; };
+               C9EB3482138F75580075BB52 /* localtime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCA138D9E9A0028D27C /* localtime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_MKTIME"; }; };
+               C9EB3483138F75580075BB52 /* strftime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CCF138D9E9A0028D27C /* strftime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRFTIME -DLIBC_ALIAS_STRFTIME_L"; }; };
+               C9EB3484138F75580075BB52 /* strptime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD3138D9E9A0028D27C /* strptime.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRPTIME -DLIBC_ALIAS_STRPTIME_L"; }; };
+               C9EB3485138F75580075BB52 /* time32.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD6138D9E9A0028D27C /* time32.c */; };
+               C9EB3486138F75580075BB52 /* timelocal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CD7138D9E9A0028D27C /* timelocal.c */; };
+               C9EB3487138F75580075BB52 /* getdate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE0138D9E9A0028D27C /* getdate.c */; settings = {COMPILER_FLAGS = "-D_DARWIN_UNLIMITED_STREAMS"; }; };
+               C9EB3488138F75580075BB52 /* timezone_unix03.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */; };
+               C9EB3489138F75580075BB52 /* bcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CE8138D9E9A0028D27C /* bcmp.c */; };
+               C9EB348A138F75580075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CEB138D9E9A0028D27C /* bcopy.c */; };
+               C9EB348B138F75580075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF1138D9E9A0028D27C /* bzero.c */; };
+               C9EB348C138F75580075BB52 /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CF7138D9E9A0028D27C /* index.c */; };
+               C9EB348D138F75580075BB52 /* memccpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFA138D9E9A0028D27C /* memccpy.c */; };
+               C9EB348E138F75580075BB52 /* memchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CFD138D9E9A0028D27C /* memchr.c */; };
+               C9EB348F138F75580075BB52 /* memcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D00138D9E9A0028D27C /* memcmp.c */; };
+               C9EB3490138F75580075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D03138D9E9A0028D27C /* memcpy.c */; };
+               C9EB3491138F75580075BB52 /* memmem.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D06138D9E9A0028D27C /* memmem.c */; };
+               C9EB3492138F75580075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D09138D9E9A0028D27C /* memmove.c */; };
+               C9EB3493138F75580075BB52 /* memset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D0D138D9E9A0028D27C /* memset.c */; };
+               C9EB3494138F75580075BB52 /* rindex.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D10138D9E9A0028D27C /* rindex.c */; };
+               C9EB3497138F75580075BB52 /* strcasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D15138D9E9A0028D27C /* strcasecmp.c */; };
+               C9EB3498138F75580075BB52 /* strcasestr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D17138D9E9A0028D27C /* strcasestr.c */; };
+               C9EB349A138F75580075BB52 /* strchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D1E138D9E9A0028D27C /* strchr.c */; };
+               C9EB349B138F75580075BB52 /* strcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D22138D9E9A0028D27C /* strcmp.c */; };
+               C9EB349C138F75580075BB52 /* strcoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D26138D9E9A0028D27C /* strcoll.c */; };
+               C9EB349E138F75580075BB52 /* strcspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D2D138D9E9A0028D27C /* strcspn.c */; };
+               C9EB349F138F75580075BB52 /* strdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D30138D9E9A0028D27C /* strdup.c */; };
+               C9EB34A0138F75580075BB52 /* strerror.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D33138D9E9A0028D27C /* strerror.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_STRERROR"; }; };
+               C9EB34A3138F75580075BB52 /* strlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D3C138D9E9A0028D27C /* strlen.c */; };
+               C9EB34A4138F75580075BB52 /* strmode.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D40138D9E9A0028D27C /* strmode.c */; };
+               C9EB34A6138F75580075BB52 /* strncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D42138D9E9A0028D27C /* strncmp.c */; };
+               C9EB34A8138F75580075BB52 /* strndup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D44138D9E9A0028D27C /* strndup.c */; };
+               C9EB34A9138F75580075BB52 /* strnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D45138D9E9A0028D27C /* strnlen.c */; };
+               C9EB34AA138F75580075BB52 /* strnstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D46138D9E9A0028D27C /* strnstr.c */; };
+               C9EB34AB138F75580075BB52 /* strpbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D49138D9E9A0028D27C /* strpbrk.c */; };
+               C9EB34AC138F75580075BB52 /* strrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4C138D9E9A0028D27C /* strrchr.c */; };
+               C9EB34AD138F75580075BB52 /* strsep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D4F138D9E9A0028D27C /* strsep.c */; };
+               C9EB34AE138F75580075BB52 /* strsignal.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D50138D9E9A0028D27C /* strsignal.c */; };
+               C9EB34AF138F75580075BB52 /* strspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D54138D9E9A0028D27C /* strspn.c */; };
+               C9EB34B0138F75580075BB52 /* strstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D57138D9E9A0028D27C /* strstr.c */; };
+               C9EB34B1138F75580075BB52 /* strtok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5A138D9E9A0028D27C /* strtok.c */; };
+               C9EB34B2138F75580075BB52 /* strxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D5D138D9E9A0028D27C /* strxfrm.c */; };
+               C9EB34B3138F75580075BB52 /* swab.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D61138D9E9A0028D27C /* swab.c */; };
+               C9EB34B4138F75580075BB52 /* wcpcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D63138D9E9A0028D27C /* wcpcpy.c */; };
+               C9EB34B5138F75580075BB52 /* wcpncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D64138D9E9A0028D27C /* wcpncpy.c */; };
+               C9EB34B6138F75580075BB52 /* wcscasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D65138D9E9A0028D27C /* wcscasecmp.c */; };
+               C9EB34B7138F75580075BB52 /* wcscat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D67138D9E9A0028D27C /* wcscat.c */; };
+               C9EB34B8138F75580075BB52 /* wcschr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D68138D9E9A0028D27C /* wcschr.c */; };
+               C9EB34B9138F75580075BB52 /* wcscmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D69138D9E9A0028D27C /* wcscmp.c */; };
+               C9EB34BA138F75580075BB52 /* wcscoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6C138D9E9A0028D27C /* wcscoll.c */; };
+               C9EB34BB138F75580075BB52 /* wcscpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6E138D9E9A0028D27C /* wcscpy.c */; };
+               C9EB34BC138F75580075BB52 /* wcscspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D6F138D9E9A0028D27C /* wcscspn.c */; };
+               C9EB34BD138F75580075BB52 /* wcsdup.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D70138D9E9A0028D27C /* wcsdup.c */; };
+               C9EB34BE138F75580075BB52 /* wcslcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D71138D9E9A0028D27C /* wcslcat.c */; };
+               C9EB34BF138F75580075BB52 /* wcslcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D72138D9E9A0028D27C /* wcslcpy.c */; };
+               C9EB34C0138F75580075BB52 /* wcslen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D73138D9E9A0028D27C /* wcslen.c */; };
+               C9EB34C1138F75580075BB52 /* wcsncasecmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */; };
+               C9EB34C2138F75580075BB52 /* wcsncat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D76138D9E9A0028D27C /* wcsncat.c */; };
+               C9EB34C3138F75580075BB52 /* wcsncmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D77138D9E9A0028D27C /* wcsncmp.c */; };
+               C9EB34C4138F75580075BB52 /* wcsncpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D78138D9E9A0028D27C /* wcsncpy.c */; };
+               C9EB34C5138F75580075BB52 /* wcsnlen.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D79138D9E9A0028D27C /* wcsnlen.c */; };
+               C9EB34C6138F75580075BB52 /* wcspbrk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7A138D9E9A0028D27C /* wcspbrk.c */; };
+               C9EB34C7138F75580075BB52 /* wcsrchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7B138D9E9A0028D27C /* wcsrchr.c */; };
+               C9EB34C8138F75580075BB52 /* wcsspn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7C138D9E9A0028D27C /* wcsspn.c */; };
+               C9EB34C9138F75580075BB52 /* wcsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D7D138D9E9A0028D27C /* wcsstr.c */; };
+               C9EB34CA138F75580075BB52 /* wcstok.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D80138D9E9A0028D27C /* wcstok.c */; };
+               C9EB34CB138F75580075BB52 /* wcswidth.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D83138D9E9A0028D27C /* wcswidth.c */; };
+               C9EB34CC138F75580075BB52 /* wcsxfrm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D87138D9E9A0028D27C /* wcsxfrm.c */; };
+               C9EB34CD138F75580075BB52 /* wmemchr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8B138D9E9A0028D27C /* wmemchr.c */; };
+               C9EB34CE138F75580075BB52 /* wmemcmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8C138D9E9A0028D27C /* wmemcmp.c */; };
+               C9EB34CF138F75580075BB52 /* wmemcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8D138D9E9A0028D27C /* wmemcpy.c */; };
+               C9EB34D0138F75580075BB52 /* wmemmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8E138D9E9A0028D27C /* wmemmove.c */; };
+               C9EB34D1138F75580075BB52 /* wmemset.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D8F138D9E9A0028D27C /* wmemset.c */; };
+               C9EB34D2138F75580075BB52 /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C9EB34D3138F75580075BB52 /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C9EB34D4138F75580075BB52 /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C9EB34D5138F75580075BB52 /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C9EB34D6138F75580075BB52 /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C9EB34D7138F75580075BB52 /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C9EB34D8138F75580075BB52 /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C9EB34D9138F75580075BB52 /* getgroups.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9F138D9E9A0028D27C /* getgroups.c */; };
+               C9EB34DA138F75580075BB52 /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C9EB34DB138F75580075BB52 /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C9EB34DC138F75580075BB52 /* msgctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA6138D9E9A0028D27C /* msgctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_MSGCTL -DKERNEL"; }; };
+               C9EB34DD138F75580075BB52 /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; };
+               C9EB34DE138F75580075BB52 /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C9EB34DF138F75580075BB52 /* OSMemoryNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */; };
+               C9EB34E0138F75580075BB52 /* OSThermalNotification.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */; };
+               C9EB34E1138F75580075BB52 /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C9EB34E2138F75580075BB52 /* semctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB2138D9E9A0028D27C /* semctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SEMCTL -DKERNEL"; }; };
+               C9EB34E3138F75580075BB52 /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C9EB34E4138F75580075BB52 /* shmctl.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB4138D9E9A0028D27C /* shmctl.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_SHMCTL -DKERNEL"; }; };
+               C9EB34E5138F75580075BB52 /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C9EB34E6138F75580075BB52 /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C9EB34E7138F75580075BB52 /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C9EB34E8138F75580075BB52 /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C9EB34E9138F75580075BB52 /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C9EB34EA138F75580075BB52 /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C9EB34EB138F75580075BB52 /* cprocs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC0138D9E9A0028D27C /* cprocs.c */; };
+               C9EB34EC138F75580075BB52 /* cthreads.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC2138D9E9A0028D27C /* cthreads.c */; };
+               C9EB34ED138F75580075BB52 /* mig_support.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC5138D9E9A0028D27C /* mig_support.c */; };
+               C9EB34EE138F75580075BB52 /* fparseln.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DC8138D9E9A0028D27C /* fparseln.c */; };
+               C9EB34EF138F75580075BB52 /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C9EB34F0138F75580075BB52 /* login_tty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCB138D9E9A0028D27C /* login_tty.c */; };
+               C9EB34F1138F75580075BB52 /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C9EB34F2138F75580075BB52 /* logwtmp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCD138D9E9A0028D27C /* logwtmp.c */; };
+               C9EB34F3138F75580075BB52 /* opendev.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD0138D9E9A0028D27C /* opendev.c */; };
+               C9EB34F4138F75580075BB52 /* pty.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD2138D9E9A0028D27C /* pty.c */; };
+               C9EB34F5138F75580075BB52 /* clear.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DD9138D9E9A0028D27C /* clear.c */; };
+               C9EB34F6138F75580075BB52 /* compare.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDA138D9E9A0028D27C /* compare.c */; };
+               C9EB34F7138F75580075BB52 /* copy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDB138D9E9A0028D27C /* copy.c */; };
+               C9EB34F8138F75580075BB52 /* gen_uuid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDC138D9E9A0028D27C /* gen_uuid.c */; };
+               C9EB34F9138F75580075BB52 /* isnull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DDE138D9E9A0028D27C /* isnull.c */; };
+               C9EB34FA138F75580075BB52 /* pack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE0138D9E9A0028D27C /* pack.c */; };
+               C9EB34FB138F75580075BB52 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE1138D9E9A0028D27C /* parse.c */; };
+               C9EB34FC138F75580075BB52 /* unpack.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE2138D9E9A0028D27C /* unpack.c */; };
+               C9EB34FD138F75580075BB52 /* unparse.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DE3138D9E9A0028D27C /* unparse.c */; };
+               C9EB34FE138F75580075BB52 /* getmcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF5138D9E9A0028D27C /* getmcontext.c */; };
+               C9EB34FF138F75580075BB52 /* makecontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DF7138D9E9A0028D27C /* makecontext.c */; };
+               C9EB3500138F75580075BB52 /* setcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFA138D9E9A0028D27C /* setcontext.c */; };
+               C9EB3501138F75580075BB52 /* swapcontext.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DFB138D9E9A0028D27C /* swapcontext.c */; };
+               C9EB3502138F75580075BB52 /* bcopy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E09138D9E9A0028D27C /* bcopy.c */; };
+               C9EB3503138F75580075BB52 /* bzero.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E0C138D9E9A0028D27C /* bzero.c */; };
+               C9EB3504138F75580075BB52 /* memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E13138D9E9A0028D27C /* memcpy.c */; };
+               C9EB3505138F75580075BB52 /* memmove.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E14138D9E9A0028D27C /* memmove.c */; };
+               C9EB3506138F75580075BB52 /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E20138D9E9A0028D27C /* atomic.c */; };
+               C9EB3507138F75580075BB52 /* spinlocks.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53E26138D9E9A0028D27C /* spinlocks.c */; };
+               C9EB350F138F769B0075BB52 /* scandir_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB350E138F769B0075BB52 /* scandir_b.c */; };
+               C9EB3510138F76A10075BB52 /* scandir_b.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB350E138F769B0075BB52 /* scandir_b.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -include gen/__dirent.h"; }; };
+               C9EB3542138F7D0A0075BB52 /* login.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCA138D9E9A0028D27C /* login.c */; };
+               C9EB3543138F7D0A0075BB52 /* logout.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DCC138D9E9A0028D27C /* logout.c */; };
+               C9EB3550138F7EA50075BB52 /* getmntinfo64.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB354F138F7EA50075BB52 /* getmntinfo64.c */; };
+               C9EB3556138F7F6A0075BB52 /* setjmperr.c in Sources */ = {isa = PBXBuildFile; fileRef = C9EB3555138F7F6A0075BB52 /* setjmperr.c */; };
+               C9EB3558138F7FF40075BB52 /* nlist.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537E8138D9E990028D27C /* nlist.c */; };
+               C9EB355C138F81A40075BB52 /* kvm.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53616138D9E980028D27C /* kvm.c */; };
+               C9EB355E138F81AB0075BB52 /* MKGetTimeBaseInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */; };
+               C9FA32F4138E49550089A94B /* abort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1D138D9E9A0028D27C /* abort.c */; };
+               C9FA32F9138E4A5C0089A94B /* utf2.c in Sources */ = {isa = PBXBuildFile; fileRef = C9FA32F8138E4A5C0089A94B /* utf2.c */; };
+               C9FA32FB138E4BD00089A94B /* __libc_init.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D94138D9E9A0028D27C /* __libc_init.c */; };
+               C9FA32FC138E4BD00089A94B /* _libc_fork_child.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */; };
+               C9FA32FD138E4BD00089A94B /* chmodx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D99138D9E9A0028D27C /* chmodx_np.c */; };
+               C9FA32FE138E4BD00089A94B /* context-stubs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9B138D9E9A0028D27C /* context-stubs.c */; };
+               C9FA32FF138E4BD00089A94B /* crt_externs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9C138D9E9A0028D27C /* crt_externs.c */; };
+               C9FA3300138E4BD00089A94B /* errno.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9D138D9E9A0028D27C /* errno.c */; };
+               C9FA3301138E4BD00089A94B /* fork.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53D9E138D9E9A0028D27C /* fork.c */; };
+               C9FA3302138E4BD00089A94B /* getiopolicy_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */; };
+               C9FA3303138E4BD00089A94B /* gettimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA2138D9E9A0028D27C /* gettimeofday.c */; };
+               C9FA3304138E4BD00089A94B /* openx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAB138D9E9A0028D27C /* openx_np.c */; };
+               C9FA3307138E4BD00089A94B /* posix_spawn.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DAE138D9E9A0028D27C /* posix_spawn.c */; };
+               C9FA3308138E4BD00089A94B /* settimeofday.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB3138D9E9A0028D27C /* settimeofday.c */; };
+               C9FA3309138E4BD00089A94B /* sigaction.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB5138D9E9A0028D27C /* sigaction.c */; };
+               C9FA330A138E4BD00089A94B /* sigcatch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB6138D9E9A0028D27C /* sigcatch.c */; };
+               C9FA330B138E4BD00089A94B /* sigtramp.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DB8138D9E9A0028D27C /* sigtramp.c */; };
+               C9FA330C138E4BD00089A94B /* slot_name.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBA138D9E9A0028D27C /* slot_name.c */; };
+               C9FA330D138E4BD00089A94B /* statx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBC138D9E9A0028D27C /* statx_np.c */; };
+               C9FA330E138E4BD00089A94B /* umaskx_np.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DBE138D9E9A0028D27C /* umaskx_np.c */; };
+               C9FA3312138E4C490089A94B /* stack_protector.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53DA9138D9E9A0028D27C /* stack_protector.c */; settings = {COMPILER_FLAGS = "-fno-stack-protector"; }; };
+               C9FA3315138E4D040089A94B /* a64l.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C18138D9E9A0028D27C /* a64l.c */; };
+               C9FA3316138E4D040089A94B /* _Exit_.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C1A138D9E9A0028D27C /* _Exit_.c */; };
+               C9FA3317138E4D040089A94B /* abs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C21138D9E9A0028D27C /* abs.c */; };
+               C9FA3318138E4D040089A94B /* atexit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C26138D9E9A0028D27C /* atexit.c */; };
+               C9FA3319138E4D040089A94B /* atof.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C2C138D9E9A0028D27C /* atof.c */; };
+               C9FA331A138E4D040089A94B /* atoi.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C30138D9E9A0028D27C /* atoi.c */; };
+               C9FA331B138E4D040089A94B /* atol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C34138D9E9A0028D27C /* atol.c */; };
+               C9FA331C138E4D040089A94B /* atoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C36138D9E9A0028D27C /* atoll.c */; };
+               C9FA331D138E4D040089A94B /* bsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3A138D9E9A0028D27C /* bsearch.c */; };
+               C9FA331E138E4D040089A94B /* div.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C3E138D9E9A0028D27C /* div.c */; };
+               C9FA331F138E4D040089A94B /* exit.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C40138D9E9A0028D27C /* exit.c */; };
+               C9FA3320138E4D040089A94B /* getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C44138D9E9A0028D27C /* getenv.c */; };
+               C9FA3321138E4D040089A94B /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C47138D9E9A0028D27C /* getopt.c */; };
+               C9FA3322138E4D040089A94B /* getopt_long.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4A138D9E9A0028D27C /* getopt_long.c */; };
+               C9FA3323138E4D040089A94B /* getsubopt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4D138D9E9A0028D27C /* getsubopt.c */; };
+               C9FA3324138E4D040089A94B /* hcreate.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C4F138D9E9A0028D27C /* hcreate.c */; };
+               C9FA3325138E4D040089A94B /* heapsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C50138D9E9A0028D27C /* heapsort.c */; };
+               C9FA3326138E4D040089A94B /* imaxabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C54138D9E9A0028D27C /* imaxabs.c */; };
+               C9FA3327138E4D040089A94B /* imaxdiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C57138D9E9A0028D27C /* imaxdiv.c */; };
+               C9FA3328138E4D040089A94B /* insque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5A138D9E9A0028D27C /* insque.c */; };
+               C9FA3329138E4D040089A94B /* labs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C5D138D9E9A0028D27C /* labs.c */; };
+               C9FA332A138E4D040089A94B /* ldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C60138D9E9A0028D27C /* ldiv.c */; };
+               C9FA332B138E4D040089A94B /* llabs.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C63138D9E9A0028D27C /* llabs.c */; };
+               C9FA332C138E4D040089A94B /* lldiv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C66138D9E9A0028D27C /* lldiv.c */; };
+               C9FA332D138E4D040089A94B /* lsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C69138D9E9A0028D27C /* lsearch.c */; };
+               C9FA332E138E4D040089A94B /* merge.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6C138D9E9A0028D27C /* merge.c */; };
+               C9FA332F138E4D040089A94B /* putenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C6F138D9E9A0028D27C /* putenv.c */; };
+               C9FA3330138E4D040089A94B /* qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C73138D9E9A0028D27C /* qsort.c */; };
+               C9FA3331138E4D040089A94B /* qsort_r.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C75138D9E9A0028D27C /* qsort_r.c */; };
+               C9FA3332138E4D040089A94B /* radixsort.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C78138D9E9A0028D27C /* radixsort.c */; };
+               C9FA3333138E4D040089A94B /* rand.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7C138D9E9A0028D27C /* rand.c */; };
+               C9FA3334138E4D040089A94B /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C7F138D9E9A0028D27C /* random.c */; };
+               C9FA3335138E4D040089A94B /* reallocf.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C81138D9E9A0028D27C /* reallocf.c */; };
+               C9FA3336138E4D040089A94B /* realpath.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C84138D9E9A0028D27C /* realpath.c */; settings = {COMPILER_FLAGS = "-DLIBC_ALIAS_REALPATH"; }; };
+               C9FA3337138E4D040089A94B /* remque.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C86138D9E9A0028D27C /* remque.c */; };
+               C9FA3338138E4D040089A94B /* setenv.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C87138D9E9A0028D27C /* setenv.c */; };
+               C9FA3339138E4D040089A94B /* strhash.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C89138D9E9A0028D27C /* strhash.c */; };
+               C9FA333A138E4D040089A94B /* strtoimax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C8D138D9E9A0028D27C /* strtoimax.c */; };
+               C9FA333B138E4D040089A94B /* strtol.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C91138D9E9A0028D27C /* strtol.c */; };
+               C9FA333C138E4D040089A94B /* strtoll.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C93138D9E9A0028D27C /* strtoll.c */; };
+               C9FA333D138E4D040089A94B /* strtoq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C95138D9E9A0028D27C /* strtoq.c */; };
+               C9FA333E138E4D040089A94B /* strtoul.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C99138D9E9A0028D27C /* strtoul.c */; };
+               C9FA333F138E4D040089A94B /* strtoull.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9B138D9E9A0028D27C /* strtoull.c */; };
+               C9FA3340138E4D040089A94B /* strtoumax.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9D138D9E9A0028D27C /* strtoumax.c */; };
+               C9FA3341138E4D040089A94B /* strtouq.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53C9F138D9E9A0028D27C /* strtouq.c */; };
+               C9FA3342138E4D040089A94B /* system.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA3138D9E9A0028D27C /* system.c */; };
+               C9FA3343138E4D040089A94B /* tdelete.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA5138D9E9A0028D27C /* tdelete.c */; };
+               C9FA3344138E4D040089A94B /* tfind.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA6138D9E9A0028D27C /* tfind.c */; };
+               C9FA3345138E4D040089A94B /* tsearch.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CA9138D9E9A0028D27C /* tsearch.c */; };
+               C9FA3346138E4D040089A94B /* twalk.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAA138D9E9A0028D27C /* twalk.c */; };
+               C9FA3347138E4D040089A94B /* grantpt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAC138D9E9A0028D27C /* grantpt.c */; };
+               C9FA3348138E4D040089A94B /* l64a.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CAD138D9E9A0028D27C /* l64a.c */; };
+               C9FA334A138E4D040089A94B /* ecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB7138D9E9A0028D27C /* ecvt.c */; };
+               C9FA334B138E4D040089A94B /* gcvt.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB9138D9E9A0028D27C /* gcvt.c */; };
+               C9FA334C138E4D040089A94B /* qsort_b-fbsd.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */; };
+               C9FA334D138E4D0C0089A94B /* strfmon.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53CB2138D9E9A0028D27C /* strfmon.c */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+               B122F2D81432BA8700AF95D0 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = B122F0E71432B8E600AF95D0;
+                       remoteInfo = TRE;
+               };
+               B1E96508157E749200FCCEE7 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = B1E96340157E722200FCCEE7;
+                       remoteInfo = FreeBSD_gcc;
+               };
+               C942130813901709004BA536 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C942102D13900C8A004BA536;
+                       remoteInfo = libc.a;
+               };
+               C95B817C138F3F72004311DA /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C95B7ED9138F3C55004311DA;
+                       remoteInfo = Variant_DarwinExtsn;
+               };
+               C95B8427138F5388004311DA /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C95B8184138F52B0004311DA;
+                       remoteInfo = Variant_DarwinExtsn_Cancelable;
+               };
+               C95B86CB138F546E004311DA /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C95B842A138F53DB004311DA;
+                       remoteInfo = Variant_Pre1050;
+               };
+               C9BD3C38138F16EE00B389FD /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9D9435F138EC3E300FB7ACC;
+                       remoteInfo = Variant_Cancelable;
+               };
+               C9D94334138DB75F00FB7ACC /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9B53E2B138DA0610028D27C;
+                       remoteInfo = Platform;
+               };
+               C9EB326C138F74D20075BB52 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9EB2FC9138F6D880075BB52;
+                       remoteInfo = Variant_Legacy;
+               };
+               C9EB3514138F771F0075BB52 /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9EB326F138F75580075BB52;
+                       remoteInfo = Variant_Inode32;
+               };
+               C9FA32C7138E41800089A94B /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9C2A94C138DFFD900287F00;
+                       remoteInfo = Base;
+               };
+               C9FA32C9138E41800089A94B /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9257ECF138E1B5000B3107C;
+                       remoteInfo = FreeBSD;
+               };
+               C9FA32CB138E41800089A94B /* PBXContainerItemProxy */ = {
+                       isa = PBXContainerItemProxy;
+                       containerPortal = C9B53597138D9A690028D27C /* Project object */;
+                       proxyType = 1;
+                       remoteGlobalIDString = C9258093138E2D3100B3107C;
+                       remoteInfo = NetBSD;
+               };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+               3F2208E714358B4A00386F5B /* asl_fd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asl_fd.c; sourceTree = "<group>"; };
+               3F89F3DC13E9194C00F6856C /* mkpath_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mkpath_np.3; sourceTree = "<group>"; };
+               3F89F3DD13E9194C00F6856C /* mkpath_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mkpath_np.c; sourceTree = "<group>"; };
+               3FB7E1B4146EF2E000843438 /* dirfd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirfd.c; sourceTree = "<group>"; };
+               6310518613D4D966004F7BA8 /* strcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcpy.c; sourceTree = "<group>"; };
+               6310518B13D4DABD004F7BA8 /* strlcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcpy.c; sourceTree = "<group>"; };
+               6310518E13D4DAEA004F7BA8 /* strncpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strncpy.c; sourceTree = "<group>"; };
+               634C4C3713BCEADC008CA66D /* memset_pattern_Swift.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = memset_pattern_Swift.s; sourceTree = "<group>"; };
+               6358199013B53DD800CDF61C /* bzero_Swift.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bzero_Swift.s; sourceTree = "<group>"; };
+               6358199213B53ECB00CDF61C /* bcopy_Swift.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bcopy_Swift.s; sourceTree = "<group>"; };
+               63D4060513DDEDF10094DD56 /* stpcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stpcpy.c; sourceTree = "<group>"; };
+               63D4060913DDEEA10094DD56 /* stpncpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stpncpy.c; sourceTree = "<group>"; };
+               63D4060C13DDF26A0094DD56 /* strcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcat.c; sourceTree = "<group>"; };
+               63D4060F13DDF4340094DD56 /* strncat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strncat.c; sourceTree = "<group>"; };
+               63D4061213DDF6A20094DD56 /* strlcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcat.c; sourceTree = "<group>"; };
+               B122F2AD1432B8E600AF95D0 /* libTRE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTRE.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               B122F2AF1432B95B00AF95D0 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
+               B122F2B11432B95B00AF95D0 /* regcomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regcomp.c; sourceTree = "<group>"; };
+               B122F2B21432B95B00AF95D0 /* regexec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regexec.c; sourceTree = "<group>"; };
+               B122F2B31432B95B00AF95D0 /* tre-ast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-ast.c"; sourceTree = "<group>"; };
+               B122F2B41432B95B00AF95D0 /* tre-ast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-ast.h"; sourceTree = "<group>"; };
+               B122F2B51432B95B00AF95D0 /* tre-compile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-compile.c"; sourceTree = "<group>"; };
+               B122F2B61432B95B00AF95D0 /* tre-compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-compile.h"; sourceTree = "<group>"; };
+               B122F2B71432B95B00AF95D0 /* tre-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-internal.h"; sourceTree = "<group>"; };
+               B122F2B81432B95B00AF95D0 /* tre-match-backtrack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-match-backtrack.c"; sourceTree = "<group>"; };
+               B122F2B91432B95B00AF95D0 /* tre-match-parallel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-match-parallel.c"; sourceTree = "<group>"; };
+               B122F2BA1432B95B00AF95D0 /* tre-match-utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-match-utils.h"; sourceTree = "<group>"; };
+               B122F2BB1432B95B00AF95D0 /* tre-mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-mem.c"; sourceTree = "<group>"; };
+               B122F2BC1432B95B00AF95D0 /* tre-mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-mem.h"; sourceTree = "<group>"; };
+               B122F2BD1432B95B00AF95D0 /* tre-parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-parse.c"; sourceTree = "<group>"; };
+               B122F2BE1432B95B00AF95D0 /* tre-parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-parse.h"; sourceTree = "<group>"; };
+               B122F2BF1432B95B00AF95D0 /* tre-stack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-stack.c"; sourceTree = "<group>"; };
+               B122F2C01432B95B00AF95D0 /* tre-stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-stack.h"; sourceTree = "<group>"; };
+               B122F2C11432B95B00AF95D0 /* tre.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tre.h; sourceTree = "<group>"; };
+               B122F2C21432B95B00AF95D0 /* xmalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmalloc.h; sourceTree = "<group>"; };
+               B122F2C31432B95B00AF95D0 /* tre-0.8.0.tar.bz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "tre-0.8.0.tar.bz2"; sourceTree = "<group>"; };
+               B122F2C41432B95B00AF95D0 /* tre-config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-config.h"; sourceTree = "<group>"; };
+               B122F2C51432B95B00AF95D0 /* tre-last-matched.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-last-matched.h"; sourceTree = "<group>"; };
+               B19C64591450F8B900032373 /* sync_volume_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sync_volume_np.3; sourceTree = "<group>"; };
+               B19C645B1450F90200032373 /* sync_volume_np.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sync_volume_np.c; sourceTree = "<group>"; };
+               B1E96506157E722200FCCEE7 /* libFreeBSD_gcc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFreeBSD_gcc.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9194B4C140E3BC700BE0C3A /* build_linklists.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = build_linklists.sh; sourceTree = "<group>"; };
+               C9257ED0138E1B5000B3107C /* libFreeBSD.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFreeBSD.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9258105138E2D3100B3107C /* libNetBSD.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libNetBSD.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9265D1113B1CF970090BA1C /* clean_simulator.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = clean_simulator.sh; sourceTree = "<group>"; };
+               C932C2CF13AB1C73004EDA12 /* SpinlocksWFE.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SpinlocksWFE.c; sourceTree = "<group>"; };
+               C93D6150143D31E300EB9023 /* sanitise_headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = sanitise_headers.sh; sourceTree = "<group>"; };
+               C94212CC13900C8A004BA536 /* libc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libc.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C94212DD13900FC3004BA536 /* mig_headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = mig_headers.sh; sourceTree = "<group>"; };
+               C942135913904CBC004BA536 /* manpages.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = manpages.sh; sourceTree = "<group>"; };
+               C942135A13905D1C004BA536 /* manpages.lst */ = {isa = PBXFileReference; explicitFileType = text; path = manpages.lst; sourceTree = "<group>"; };
+               C95B7ED8138F3C11004311DA /* rune32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rune32.h; sourceTree = "<group>"; };
+               C95B8176138F3C55004311DA /* libvDarwinExtsn.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvDarwinExtsn.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C95B8421138F52B0004311DA /* libvDarwinExtsnCancelable.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvDarwinExtsnCancelable.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C95B86C7138F53DB004311DA /* libvPre1050.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvPre1050.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C965CBF1143BBEC7003912CE /* deps.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = deps.c; sourceTree = BUILT_PRODUCTS_DIR; };
+               C965CBF4143BC1BF003912CE /* force_libc_to_build.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = force_libc_to_build.sh; sourceTree = "<group>"; };
+               C9766150138EC9D400741512 /* patch_headers_variants.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = patch_headers_variants.pl; sourceTree = "<group>"; };
+               C9766153138ECF0000741512 /* variants.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = variants.xcconfig; sourceTree = "<group>"; };
+               C976616B138EF14100741512 /* generate_features.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = generate_features.pl; sourceTree = "<group>"; };
+               C97C344013AB0E1B00713550 /* Spinlocks.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Spinlocks.c; sourceTree = "<group>"; };
+               C980F8EB13AB168D0069AB06 /* SpinlocksUP.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SpinlocksUP.c; sourceTree = "<group>"; };
+               C9950E6A1390D2CA009863B6 /* headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = headers.sh; sourceTree = "<group>"; };
+               C995462713AAA25000A531B4 /* OSAtomicUP.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OSAtomicUP.c; sourceTree = "<group>"; };
+               C9B4E3D513BBBF060008A9BB /* OSAtomicLoadStoreEx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSAtomicLoadStoreEx.c; sourceTree = "<group>"; };
+               C9B4E3D713BBBF2D0008A9BB /* OSAtomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OSAtomic.c; sourceTree = "<group>"; };
+               C9B4E3D913BBC24E0008A9BB /* SpinlocksLoadStoreEx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SpinlocksLoadStoreEx.c; sourceTree = "<group>"; };
+               C9B535AE138D9E980028D27C /* APPLE_LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = APPLE_LICENSE; sourceTree = "<group>"; };
+               C9B535B1138D9E980028D27C /* cpu_number.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cpu_number.s; sourceTree = "<group>"; };
+               C9B535B2138D9E980028D27C /* icacheinval.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = icacheinval.s; sourceTree = "<group>"; };
+               C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init_cpu_capabilities.c; sourceTree = "<group>"; };
+               C9B535B8138D9E980028D27C /* pthread_getspecific.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_getspecific.s; sourceTree = "<group>"; };
+               C9B535B9138D9E980028D27C /* pthread_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_self.s; sourceTree = "<group>"; };
+               C9B535BA138D9E980028D27C /* pthread_set_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_set_self.s; sourceTree = "<group>"; };
+               C9B535BB138D9E980028D27C /* start_wqthread.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = start_wqthread.s; sourceTree = "<group>"; };
+               C9B535BC138D9E980028D27C /* thread_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = thread_start.s; sourceTree = "<group>"; };
+               C9B535C0138D9E980028D27C /* bcopy_CortexA8.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_CortexA8.s; sourceTree = "<group>"; };
+               C9B535C1138D9E980028D27C /* bcopy_CortexA9.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_CortexA9.s; sourceTree = "<group>"; };
+               C9B535C2138D9E980028D27C /* bcopy_Generic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_Generic.s; sourceTree = "<group>"; };
+               C9B535C3138D9E980028D27C /* bzero_CortexA8.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_CortexA8.s; sourceTree = "<group>"; };
+               C9B535C4138D9E980028D27C /* bzero_CortexA9.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_CortexA9.s; sourceTree = "<group>"; };
+               C9B535C5138D9E980028D27C /* bzero_Generic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_Generic.s; sourceTree = "<group>"; };
+               C9B535C6138D9E980028D27C /* dyld_resolvers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dyld_resolvers.c; sourceTree = "<group>"; };
+               C9B535C7138D9E980028D27C /* ffs.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ffs.s; sourceTree = "<group>"; };
+               C9B535C9138D9E980028D27C /* memcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memcmp.s; sourceTree = "<group>"; };
+               C9B535CA138D9E980028D27C /* memset_pattern.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset_pattern.s; sourceTree = "<group>"; };
+               C9B535CB138D9E980028D27C /* strchr.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strchr.s; sourceTree = "<group>"; };
+               C9B535CC138D9E980028D27C /* strcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcmp.s; sourceTree = "<group>"; };
+               C9B535CF138D9E980028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = "<group>"; };
+               C9B535D0138D9E980028D27C /* strncmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncmp.s; sourceTree = "<group>"; };
+               C9B535D2138D9E980028D27C /* strnlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strnlen.s; sourceTree = "<group>"; };
+               C9B535D3138D9E980028D27C /* strstr.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strstr.s; sourceTree = "<group>"; };
+               C9B535D5138D9E980028D27C /* _longjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _longjmp.s; sourceTree = "<group>"; };
+               C9B535D6138D9E980028D27C /* _setjmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _setjmp.h; sourceTree = "<group>"; };
+               C9B535D7138D9E980028D27C /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = "<group>"; };
+               C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = arm_commpage_gettimeofday.c; sourceTree = "<group>"; };
+               C9B535D9138D9E980028D27C /* gcc_atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gcc_atomic.c; sourceTree = "<group>"; };
+               C9B535DA138D9E980028D27C /* longjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longjmp.s; sourceTree = "<group>"; };
+               C9B535DB138D9E980028D27C /* mach_absolute_time.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mach_absolute_time.s; sourceTree = "<group>"; };
+               C9B535DD138D9E980028D27C /* OSAtomic-v4.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "OSAtomic-v4.c"; sourceTree = "<group>"; };
+               C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSAtomic_resolvers.c; sourceTree = "<group>"; };
+               C9B535E0138D9E980028D27C /* OSAtomic_resolvers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic_resolvers.h; sourceTree = "<group>"; };
+               C9B535E1138D9E980028D27C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = "<group>"; };
+               C9B535F7138D9E980028D27C /* creat.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = creat.2; sourceTree = "<group>"; };
+               C9B535F8138D9E980028D27C /* creat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = creat.c; sourceTree = "<group>"; };
+               C9B535FA138D9E980028D27C /* gethostid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gethostid.3; sourceTree = "<group>"; };
+               C9B535FC138D9E980028D27C /* gethostid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gethostid.c; sourceTree = "<group>"; };
+               C9B535FE138D9E980028D27C /* getwd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getwd.c; sourceTree = "<group>"; };
+               C9B535FF138D9E980028D27C /* killpg.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = killpg.2; sourceTree = "<group>"; };
+               C9B53601138D9E980028D27C /* killpg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = killpg.c; sourceTree = "<group>"; };
+               C9B53603138D9E980028D27C /* sethostid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sethostid.c; sourceTree = "<group>"; };
+               C9B53604138D9E980028D27C /* setpgrp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setpgrp.c; sourceTree = "<group>"; };
+               C9B53606138D9E980028D27C /* setrgid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setrgid.c; sourceTree = "<group>"; };
+               C9B53607138D9E980028D27C /* setruid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setruid.3; sourceTree = "<group>"; };
+               C9B53608138D9E980028D27C /* setruid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setruid.c; sourceTree = "<group>"; };
+               C9B5360A138D9E980028D27C /* setregid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setregid.c; sourceTree = "<group>"; };
+               C9B5360B138D9E980028D27C /* setreuid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setreuid.c; sourceTree = "<group>"; };
+               C9B5360C138D9E980028D27C /* sigaltstk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigaltstk.c; sourceTree = "<group>"; };
+               C9B5360D138D9E980028D27C /* sigblock.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigblock.2; sourceTree = "<group>"; };
+               C9B5360E138D9E980028D27C /* sigcompat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigcompat.c; sourceTree = "<group>"; };
+               C9B5360F138D9E980028D27C /* sigpause.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigpause.2; sourceTree = "<group>"; };
+               C9B53610138D9E980028D27C /* sigsetmask.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigsetmask.2; sourceTree = "<group>"; };
+               C9B53611138D9E980028D27C /* sigvec.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigvec.2; sourceTree = "<group>"; };
+               C9B53613138D9E980028D27C /* _dirhelper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _dirhelper.c; sourceTree = "<group>"; };
+               C9B53614138D9E980028D27C /* dirhelper.defs */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.mig; path = dirhelper.defs; sourceTree = "<group>"; };
+               C9B53615138D9E980028D27C /* dirhelper_priv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dirhelper_priv.h; sourceTree = "<group>"; };
+               C9B53616138D9E980028D27C /* kvm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = kvm.c; sourceTree = "<group>"; };
+               C9B53617138D9E980028D27C /* libproc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = libproc.c; sourceTree = "<group>"; };
+               C9B53618138D9E980028D27C /* libproc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libproc.h; sourceTree = "<group>"; };
+               C9B53619138D9E980028D27C /* libproc_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libproc_internal.h; sourceTree = "<group>"; };
+               C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = MKGetTimeBaseInfo.c; sourceTree = "<group>"; };
+               C9B5361C138D9E980028D27C /* proc_listpidspath.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = proc_listpidspath.c; sourceTree = "<group>"; };
+               C9B53620138D9E980028D27C /* bt_close.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_close.c; sourceTree = "<group>"; };
+               C9B53621138D9E980028D27C /* bt_conv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_conv.c; sourceTree = "<group>"; };
+               C9B53622138D9E980028D27C /* bt_debug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_debug.c; sourceTree = "<group>"; };
+               C9B53623138D9E980028D27C /* bt_delete.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_delete.c; sourceTree = "<group>"; };
+               C9B53624138D9E980028D27C /* bt_get.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_get.c; sourceTree = "<group>"; };
+               C9B53625138D9E980028D27C /* bt_open.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_open.c; sourceTree = "<group>"; };
+               C9B53626138D9E980028D27C /* bt_overflow.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_overflow.c; sourceTree = "<group>"; };
+               C9B53628138D9E980028D27C /* bt_page.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_page.c; sourceTree = "<group>"; };
+               C9B53629138D9E980028D27C /* bt_put.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_put.c; sourceTree = "<group>"; };
+               C9B5362A138D9E980028D27C /* bt_search.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_search.c; sourceTree = "<group>"; };
+               C9B5362B138D9E980028D27C /* bt_seq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_seq.c; sourceTree = "<group>"; };
+               C9B5362D138D9E980028D27C /* bt_split.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_split.c; sourceTree = "<group>"; };
+               C9B5362F138D9E980028D27C /* bt_utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_utils.c; sourceTree = "<group>"; };
+               C9B53630138D9E980028D27C /* btree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = btree.h; sourceTree = "<group>"; };
+               C9B53632138D9E980028D27C /* bt_extern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bt_extern.h; sourceTree = "<group>"; };
+               C9B53636138D9E980028D27C /* db.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = db.c; sourceTree = "<group>"; };
+               C9B5363A138D9E980028D27C /* hash_extern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hash_extern.h; sourceTree = "<group>"; };
+               C9B5363B138D9E980028D27C /* hash.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash.c; sourceTree = "<group>"; };
+               C9B5363D138D9E980028D27C /* hash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hash.h; sourceTree = "<group>"; };
+               C9B5363F138D9E980028D27C /* hash_bigkey.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_bigkey.c; sourceTree = "<group>"; };
+               C9B53641138D9E980028D27C /* hash_buf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_buf.c; sourceTree = "<group>"; };
+               C9B53643138D9E980028D27C /* hash_func.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_func.c; sourceTree = "<group>"; };
+               C9B53645138D9E980028D27C /* hash_log2.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_log2.c; sourceTree = "<group>"; };
+               C9B53647138D9E980028D27C /* hash_page.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_page.c; sourceTree = "<group>"; };
+               C9B53649138D9E980028D27C /* ndbm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ndbm.c; sourceTree = "<group>"; };
+               C9B5364B138D9E980028D27C /* page.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = page.h; sourceTree = "<group>"; };
+               C9B53650138D9E980028D27C /* btree.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = btree.3; sourceTree = "<group>"; };
+               C9B53651138D9E980028D27C /* dbm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dbm.3; sourceTree = "<group>"; };
+               C9B53653138D9E980028D27C /* dbopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dbopen.3; sourceTree = "<group>"; };
+               C9B53654138D9E980028D27C /* hash.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = hash.3; sourceTree = "<group>"; };
+               C9B53655138D9E980028D27C /* mpool.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mpool.3; sourceTree = "<group>"; };
+               C9B53656138D9E980028D27C /* recno.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = recno.3; sourceTree = "<group>"; };
+               C9B5365A138D9E980028D27C /* mpool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mpool.c; sourceTree = "<group>"; };
+               C9B5365F138D9E980028D27C /* rec_extern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rec_extern.h; sourceTree = "<group>"; };
+               C9B53661138D9E980028D27C /* rec_close.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_close.c; sourceTree = "<group>"; };
+               C9B53662138D9E980028D27C /* rec_delete.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_delete.c; sourceTree = "<group>"; };
+               C9B53663138D9E980028D27C /* rec_get.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_get.c; sourceTree = "<group>"; };
+               C9B53664138D9E980028D27C /* rec_open.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_open.c; sourceTree = "<group>"; };
+               C9B53665138D9E980028D27C /* rec_put.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_put.c; sourceTree = "<group>"; };
+               C9B53666138D9E980028D27C /* rec_search.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_search.c; sourceTree = "<group>"; };
+               C9B53667138D9E980028D27C /* rec_seq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_seq.c; sourceTree = "<group>"; };
+               C9B53668138D9E980028D27C /* rec_utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_utils.c; sourceTree = "<group>"; };
+               C9B53669138D9E980028D27C /* recno.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = recno.h; sourceTree = "<group>"; };
+               C9B5366D138D9E980028D27C /* brk.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = brk.2; sourceTree = "<group>"; };
+               C9B5366E138D9E980028D27C /* brk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = brk.c; sourceTree = "<group>"; };
+               C9B5366F138D9E980028D27C /* bsd_signal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bsd_signal.3; sourceTree = "<group>"; };
+               C9B53670138D9E980028D27C /* bsd_signal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bsd_signal.c; sourceTree = "<group>"; };
+               C9B53671138D9E980028D27C /* lchflags.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lchflags.3; sourceTree = "<group>"; };
+               C9B53672138D9E980028D27C /* lchflags.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lchflags.c; sourceTree = "<group>"; };
+               C9B53673138D9E980028D27C /* lchmod.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lchmod.3; sourceTree = "<group>"; };
+               C9B53674138D9E980028D27C /* lchmod.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lchmod.c; sourceTree = "<group>"; };
+               C9B53675138D9E980028D27C /* lutimes.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lutimes.3; sourceTree = "<group>"; };
+               C9B53676138D9E980028D27C /* lutimes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lutimes.c; sourceTree = "<group>"; };
+               C9B53678138D9E980028D27C /* statvfs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = statvfs.3; sourceTree = "<group>"; };
+               C9B53679138D9E980028D27C /* statvfs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = statvfs.c; sourceTree = "<group>"; };
+               C9B5367A138D9E980028D27C /* tcgetsid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcgetsid.3; sourceTree = "<group>"; };
+               C9B5367B138D9E980028D27C /* tcgetsid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tcgetsid.c; sourceTree = "<group>"; };
+               C9B5367D138D9E980028D27C /* _fbsd_compat_.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _fbsd_compat_.h; sourceTree = "<group>"; };
+               C9B5367E138D9E980028D27C /* _fpmath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _fpmath.h; sourceTree = "<group>"; };
+               C9B5367F138D9E980028D27C /* fpmath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fpmath.h; sourceTree = "<group>"; };
+               C9B53680138D9E980028D27C /* libc_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc_private.h; sourceTree = "<group>"; };
+               C9B53682138D9E980028D27C /* atomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atomic.h; sourceTree = "<group>"; };
+               C9B53683138D9E980028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = "<group>"; };
+               C9B53684138D9E980028D27C /* port_after.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = port_after.h; sourceTree = "<group>"; };
+               C9B53685138D9E980028D27C /* port_before.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = port_before.h; sourceTree = "<group>"; };
+               C9B53686138D9E980028D27C /* reentrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = reentrant.h; sourceTree = "<group>"; };
+               C9B53687138D9E980028D27C /* spinlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spinlock.h; sourceTree = "<group>"; };
+               C9B53689138D9E980028D27C /* cdefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cdefs.h; sourceTree = "<group>"; };
+               C9B5368A138D9E980028D27C /* endian.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = endian.h; sourceTree = "<group>"; };
+               C9B5368B138D9E980028D27C /* un-namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "un-namespace.h"; sourceTree = "<group>"; };
+               C9B5368E138D9E980028D27C /* _ldbl_util.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _ldbl_util.c; sourceTree = "<group>"; };
+               C9B5368F138D9E980028D27C /* arith.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = arith.h; sourceTree = "<group>"; };
+               C9B53691138D9E980028D27C /* _hdtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _hdtoa.c; sourceTree = "<group>"; };
+               C9B53693138D9E980028D27C /* _ldtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _ldtoa.c; sourceTree = "<group>"; };
+               C9B53695138D9E980028D27C /* gdtoa-dmisc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-dmisc.c"; sourceTree = "<group>"; };
+               C9B53696138D9E980028D27C /* gdtoa-dtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-dtoa.c"; sourceTree = "<group>"; };
+               C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-gdtoa.c"; sourceTree = "<group>"; };
+               C9B53698138D9E980028D27C /* gdtoa-gethex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-gethex.c"; sourceTree = "<group>"; };
+               C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-gmisc.c"; sourceTree = "<group>"; };
+               C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-hd_init.c"; sourceTree = "<group>"; };
+               C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-hexnan.c"; sourceTree = "<group>"; };
+               C9B5369E138D9E980028D27C /* gdtoa-misc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-misc.c"; sourceTree = "<group>"; };
+               C9B536A0138D9E980028D27C /* gdtoa-smisc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-smisc.c"; sourceTree = "<group>"; };
+               C9B536A1138D9E980028D27C /* gdtoa-strtod.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtod.c"; sourceTree = "<group>"; };
+               C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtodg.c"; sourceTree = "<group>"; };
+               C9B536A5138D9E980028D27C /* gdtoa-strtof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtof.c"; sourceTree = "<group>"; };
+               C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtoIg.c"; sourceTree = "<group>"; };
+               C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtopdd.c"; sourceTree = "<group>"; };
+               C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtopx.c"; sourceTree = "<group>"; };
+               C9B536AC138D9E980028D27C /* gdtoa-strtord.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtord.c"; sourceTree = "<group>"; };
+               C9B536AE138D9E980028D27C /* gdtoa-sum.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-sum.c"; sourceTree = "<group>"; };
+               C9B536AF138D9E980028D27C /* gdtoa-ulp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-ulp.c"; sourceTree = "<group>"; };
+               C9B536B0138D9E980028D27C /* gdtoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gdtoa.h; sourceTree = "<group>"; };
+               C9B536B2138D9E980028D27C /* gdtoa_fltrnds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gdtoa_fltrnds.h; sourceTree = "<group>"; };
+               C9B536B3138D9E980028D27C /* gdtoaimp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gdtoaimp.h; sourceTree = "<group>"; };
+               C9B536B5138D9E980028D27C /* glue.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = glue.c; sourceTree = "<group>"; };
+               C9B536B6138D9E980028D27C /* machdep_ldisd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisd.c; sourceTree = "<group>"; };
+               C9B536B8138D9E980028D27C /* machdep_ldisdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisdd.c; sourceTree = "<group>"; };
+               C9B536BA138D9E980028D27C /* machdep_ldisQ.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisQ.c; sourceTree = "<group>"; };
+               C9B536BB138D9E980028D27C /* machdep_ldisx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisx.c; sourceTree = "<group>"; };
+               C9B536BD138D9E980028D27C /* gd_qnan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gd_qnan.h; sourceTree = "<group>"; };
+               C9B536BE138D9E980028D27C /* gdtoa.tgz */ = {isa = PBXFileReference; lastKnownFileType = file; path = gdtoa.tgz; sourceTree = "<group>"; };
+               C9B536C1138D9E990028D27C /* __dirent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = __dirent.h; sourceTree = "<group>"; };
+               C9B536C2138D9E990028D27C /* _simple.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _simple.c; sourceTree = "<group>"; };
+               C9B536C3138D9E990028D27C /* _simple.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _simple.h; sourceTree = "<group>"; };
+               C9B536C4138D9E990028D27C /* asl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = asl.3; sourceTree = "<group>"; };
+               C9B536C5138D9E990028D27C /* asl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl.c; sourceTree = "<group>"; };
+               C9B536C6138D9E990028D27C /* asl_core.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_core.c; sourceTree = "<group>"; };
+               C9B536C7138D9E990028D27C /* asl_core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_core.h; sourceTree = "<group>"; };
+               C9B536C8138D9E990028D27C /* asl_file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_file.c; sourceTree = "<group>"; };
+               C9B536C9138D9E990028D27C /* asl_file.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_file.h; sourceTree = "<group>"; };
+               C9B536CA138D9E990028D27C /* asl_ipc.defs */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.mig; path = asl_ipc.defs; sourceTree = "<group>"; };
+               C9B536CB138D9E990028D27C /* asl_legacy1.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_legacy1.c; sourceTree = "<group>"; };
+               C9B536CC138D9E990028D27C /* asl_legacy1.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_legacy1.h; sourceTree = "<group>"; };
+               C9B536CD138D9E990028D27C /* asl_msg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_msg.c; sourceTree = "<group>"; };
+               C9B536CE138D9E990028D27C /* asl_msg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_msg.h; sourceTree = "<group>"; };
+               C9B536CF138D9E990028D27C /* asl_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_private.h; sourceTree = "<group>"; };
+               C9B536D0138D9E990028D27C /* asl_store.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_store.c; sourceTree = "<group>"; };
+               C9B536D1138D9E990028D27C /* asl_store.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_store.h; sourceTree = "<group>"; };
+               C9B536D2138D9E990028D27C /* asl_util.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_util.c; sourceTree = "<group>"; };
+               C9B536D3138D9E990028D27C /* assumes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = assumes.c; sourceTree = "<group>"; };
+               C9B536D4138D9E990028D27C /* assumes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = assumes.h; sourceTree = "<group>"; };
+               C9B536D5138D9E990028D27C /* authentication.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = authentication.c; sourceTree = "<group>"; };
+               C9B536D6138D9E990028D27C /* backtrace.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = backtrace.3; sourceTree = "<group>"; };
+               C9B536D7138D9E990028D27C /* backtrace.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = backtrace.c; sourceTree = "<group>"; };
+               C9B536D8138D9E990028D27C /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
+               C9B536D9138D9E990028D27C /* compat.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = compat.5; sourceTree = "<group>"; };
+               C9B536DA138D9E990028D27C /* confstr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = confstr.3; sourceTree = "<group>"; };
+               C9B536DB138D9E990028D27C /* confstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = confstr.c; sourceTree = "<group>"; };
+               C9B536DC138D9E990028D27C /* crypt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = crypt.3; sourceTree = "<group>"; };
+               C9B536DD138D9E990028D27C /* crypt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = crypt.c; sourceTree = "<group>"; };
+               C9B536DE138D9E990028D27C /* devname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = devname.3; sourceTree = "<group>"; };
+               C9B536DF138D9E990028D27C /* devname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = devname.c; sourceTree = "<group>"; };
+               C9B536E0138D9E990028D27C /* directory.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = directory.3; sourceTree = "<group>"; };
+               C9B536E1138D9E990028D27C /* disklabel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = disklabel.c; sourceTree = "<group>"; };
+               C9B536E2138D9E990028D27C /* errlst.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = errlst.c; sourceTree = "<group>"; };
+               C9B536E3138D9E990028D27C /* execinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = execinfo.h; sourceTree = "<group>"; };
+               C9B536E4138D9E990028D27C /* filesec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = filesec.c; sourceTree = "<group>"; };
+               C9B536E6138D9E990028D27C /* _rand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _rand48.c; sourceTree = "<group>"; };
+               C9B536E8138D9E990028D27C /* alarm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = alarm.3; sourceTree = "<group>"; };
+               C9B536EA138D9E990028D27C /* alarm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = alarm.c; sourceTree = "<group>"; };
+               C9B536EB138D9E990028D27C /* arc4random.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = arc4random.3; sourceTree = "<group>"; };
+               C9B536EC138D9E990028D27C /* arc4random.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = arc4random.c; sourceTree = "<group>"; };
+               C9B536EE138D9E990028D27C /* assert.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = assert.c; sourceTree = "<group>"; };
+               C9B536F0138D9E990028D27C /* basename.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = basename.3; sourceTree = "<group>"; };
+               C9B536F2138D9E990028D27C /* basename.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = basename.c; sourceTree = "<group>"; };
+               C9B536F4138D9E990028D27C /* clock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = clock.3; sourceTree = "<group>"; };
+               C9B536F5138D9E990028D27C /* clock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clock.c; sourceTree = "<group>"; };
+               C9B536F6138D9E990028D27C /* closedir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = closedir.c; sourceTree = "<group>"; };
+               C9B536F8138D9E990028D27C /* ctermid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctermid.3; sourceTree = "<group>"; };
+               C9B536FA138D9E990028D27C /* ctermid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ctermid.c; sourceTree = "<group>"; };
+               C9B536FB138D9E990028D27C /* daemon.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = daemon.3; sourceTree = "<group>"; };
+               C9B536FD138D9E990028D27C /* daemon.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = daemon.c; sourceTree = "<group>"; };
+               C9B536FF138D9E990028D27C /* dirname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dirname.3; sourceTree = "<group>"; };
+               C9B53701138D9E990028D27C /* dirname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dirname.c; sourceTree = "<group>"; };
+               C9B53703138D9E990028D27C /* drand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = drand48.c; sourceTree = "<group>"; };
+               C9B53705138D9E990028D27C /* erand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = erand48.c; sourceTree = "<group>"; };
+               C9B53707138D9E990028D27C /* err.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = err.3; sourceTree = "<group>"; };
+               C9B53709138D9E990028D27C /* err.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = err.c; sourceTree = "<group>"; };
+               C9B5370B138D9E990028D27C /* exec.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = exec.3; sourceTree = "<group>"; };
+               C9B5370D138D9E990028D27C /* exec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exec.c; sourceTree = "<group>"; };
+               C9B5370F138D9E990028D27C /* fmtcheck.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fmtcheck.3; sourceTree = "<group>"; };
+               C9B53710138D9E990028D27C /* fmtcheck.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fmtcheck.c; sourceTree = "<group>"; };
+               C9B53711138D9E990028D27C /* fmtmsg.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fmtmsg.3; sourceTree = "<group>"; };
+               C9B53712138D9E990028D27C /* fmtmsg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fmtmsg.c; sourceTree = "<group>"; };
+               C9B53714138D9E990028D27C /* fnmatch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fnmatch.3; sourceTree = "<group>"; };
+               C9B53716138D9E990028D27C /* fnmatch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fnmatch.c; sourceTree = "<group>"; };
+               C9B53718138D9E990028D27C /* ftok.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ftok.3; sourceTree = "<group>"; };
+               C9B5371A138D9E990028D27C /* ftok.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ftok.c; sourceTree = "<group>"; };
+               C9B5371B138D9E990028D27C /* getbsize.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getbsize.3; sourceTree = "<group>"; };
+               C9B5371C138D9E990028D27C /* getbsize.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getbsize.c; sourceTree = "<group>"; };
+               C9B5371D138D9E990028D27C /* getcap.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcap.3; sourceTree = "<group>"; };
+               C9B5371E138D9E990028D27C /* getcap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getcap.c; sourceTree = "<group>"; };
+               C9B53720138D9E990028D27C /* getcontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcontext.3; sourceTree = "<group>"; };
+               C9B53721138D9E990028D27C /* getcwd.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcwd.3; sourceTree = "<group>"; };
+               C9B53722138D9E990028D27C /* getcwd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getcwd.c; sourceTree = "<group>"; };
+               C9B53724138D9E990028D27C /* gethostname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gethostname.3; sourceTree = "<group>"; };
+               C9B53726138D9E990028D27C /* gethostname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gethostname.c; sourceTree = "<group>"; };
+               C9B53728138D9E990028D27C /* getlogin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getlogin.c; sourceTree = "<group>"; };
+               C9B5372A138D9E990028D27C /* getmntinfo.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getmntinfo.3; sourceTree = "<group>"; };
+               C9B5372C138D9E990028D27C /* getmntinfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmntinfo.c; sourceTree = "<group>"; };
+               C9B5372E138D9E990028D27C /* getpagesize.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getpagesize.3; sourceTree = "<group>"; };
+               C9B5372F138D9E990028D27C /* getpagesize.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getpagesize.c; sourceTree = "<group>"; };
+               C9B53730138D9E990028D27C /* getpass.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getpass.3; sourceTree = "<group>"; };
+               C9B53731138D9E990028D27C /* getpeereid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getpeereid.3; sourceTree = "<group>"; };
+               C9B53732138D9E990028D27C /* getpeereid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getpeereid.c; sourceTree = "<group>"; };
+               C9B53733138D9E990028D27C /* getprogname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getprogname.3; sourceTree = "<group>"; };
+               C9B53735138D9E990028D27C /* getprogname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getprogname.c; sourceTree = "<group>"; };
+               C9B53737138D9E990028D27C /* glob.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = glob.3; sourceTree = "<group>"; };
+               C9B53739138D9E990028D27C /* glob.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = glob.c; sourceTree = "<group>"; };
+               C9B5373B138D9E990028D27C /* isatty.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isatty.c; sourceTree = "<group>"; };
+               C9B5373D138D9E990028D27C /* jrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = jrand48.c; sourceTree = "<group>"; };
+               C9B5373F138D9E990028D27C /* lcong48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lcong48.c; sourceTree = "<group>"; };
+               C9B53741138D9E990028D27C /* lockf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lockf.3; sourceTree = "<group>"; };
+               C9B53743138D9E990028D27C /* lockf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lockf.c; sourceTree = "<group>"; };
+               C9B53745138D9E990028D27C /* lrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lrand48.c; sourceTree = "<group>"; };
+               C9B53747138D9E990028D27C /* makecontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = makecontext.3; sourceTree = "<group>"; };
+               C9B53749138D9E990028D27C /* mrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mrand48.c; sourceTree = "<group>"; };
+               C9B5374B138D9E990028D27C /* nice.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nice.3; sourceTree = "<group>"; };
+               C9B5374C138D9E990028D27C /* nice.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nice.c; sourceTree = "<group>"; };
+               C9B5374E138D9E990028D27C /* nrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nrand48.c; sourceTree = "<group>"; };
+               C9B53750138D9E990028D27C /* opendir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = opendir.c; sourceTree = "<group>"; };
+               C9B53752138D9E990028D27C /* pause.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pause.3; sourceTree = "<group>"; };
+               C9B53753138D9E990028D27C /* pause.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pause.c; sourceTree = "<group>"; };
+               C9B53755138D9E990028D27C /* popen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = popen.3; sourceTree = "<group>"; };
+               C9B53757138D9E990028D27C /* popen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = popen.c; sourceTree = "<group>"; };
+               C9B53759138D9E990028D27C /* pselect.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pselect.3; sourceTree = "<group>"; };
+               C9B5375B138D9E990028D27C /* pselect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pselect.c; sourceTree = "<group>"; };
+               C9B5375D138D9E990028D27C /* psignal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = psignal.3; sourceTree = "<group>"; };
+               C9B5375F138D9E990028D27C /* psignal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = psignal.c; sourceTree = "<group>"; };
+               C9B53760138D9E990028D27C /* raise.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = raise.3; sourceTree = "<group>"; };
+               C9B53761138D9E990028D27C /* raise.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = raise.c; sourceTree = "<group>"; };
+               C9B53762138D9E990028D27C /* rand48.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rand48.3; sourceTree = "<group>"; };
+               C9B53764138D9E990028D27C /* rand48.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rand48.h; sourceTree = "<group>"; };
+               C9B53766138D9E990028D27C /* readdir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = readdir.c; sourceTree = "<group>"; };
+               C9B53768138D9E990028D27C /* readpassphrase.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = readpassphrase.3; sourceTree = "<group>"; };
+               C9B53769138D9E990028D27C /* readpassphrase.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = readpassphrase.c; sourceTree = "<group>"; };
+               C9B5376B138D9E990028D27C /* rewinddir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rewinddir.c; sourceTree = "<group>"; };
+               C9B5376C138D9E990028D27C /* scandir.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = scandir.3; sourceTree = "<group>"; };
+               C9B5376E138D9E990028D27C /* scandir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scandir.c; sourceTree = "<group>"; };
+               C9B53771138D9E990028D27C /* seed48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = seed48.c; sourceTree = "<group>"; };
+               C9B53773138D9E990028D27C /* seekdir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = seekdir.c; sourceTree = "<group>"; };
+               C9B53774138D9E990028D27C /* sethostname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sethostname.c; sourceTree = "<group>"; };
+               C9B53775138D9E990028D27C /* setmode.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setmode.3; sourceTree = "<group>"; };
+               C9B53776138D9E990028D27C /* setmode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setmode.c; sourceTree = "<group>"; };
+               C9B53778138D9E990028D27C /* setprogname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setprogname.c; sourceTree = "<group>"; };
+               C9B5377A138D9E990028D27C /* siginterrupt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = siginterrupt.3; sourceTree = "<group>"; };
+               C9B5377C138D9E990028D27C /* siginterrupt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = siginterrupt.c; sourceTree = "<group>"; };
+               C9B5377D138D9E990028D27C /* siglist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = siglist.c; sourceTree = "<group>"; };
+               C9B5377F138D9E990028D27C /* signal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = signal.3; sourceTree = "<group>"; };
+               C9B53781138D9E990028D27C /* signal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = signal.c; sourceTree = "<group>"; };
+               C9B53783138D9E990028D27C /* signbit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = signbit.3; sourceTree = "<group>"; };
+               C9B53785138D9E990028D27C /* sleep.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sleep.3; sourceTree = "<group>"; };
+               C9B53787138D9E990028D27C /* sleep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sleep.c; sourceTree = "<group>"; };
+               C9B53789138D9E990028D27C /* srand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = srand48.c; sourceTree = "<group>"; };
+               C9B5378B138D9E990028D27C /* stringlist.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = stringlist.3; sourceTree = "<group>"; };
+               C9B5378C138D9E990028D27C /* stringlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stringlist.c; sourceTree = "<group>"; };
+               C9B5378D138D9E990028D27C /* sysconf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sysconf.3; sourceTree = "<group>"; };
+               C9B5378E138D9E990028D27C /* sysconf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysconf.c; sourceTree = "<group>"; };
+               C9B53790138D9E990028D27C /* sysctl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sysctl.3; sourceTree = "<group>"; };
+               C9B53792138D9E990028D27C /* sysctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysctl.c; sourceTree = "<group>"; };
+               C9B53794138D9E990028D27C /* sysctlbyname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysctlbyname.c; sourceTree = "<group>"; };
+               C9B53795138D9E990028D27C /* sysctlnametomib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysctlnametomib.c; sourceTree = "<group>"; };
+               C9B53796138D9E990028D27C /* telldir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = telldir.c; sourceTree = "<group>"; };
+               C9B53798138D9E990028D27C /* telldir.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = telldir.h; sourceTree = "<group>"; };
+               C9B5379A138D9E990028D27C /* termios.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = termios.c; sourceTree = "<group>"; };
+               C9B5379C138D9E990028D27C /* time.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = time.3; sourceTree = "<group>"; };
+               C9B5379E138D9E990028D27C /* time.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = time.c; sourceTree = "<group>"; };
+               C9B537A0138D9E990028D27C /* times.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = times.3; sourceTree = "<group>"; };
+               C9B537A2138D9E990028D27C /* times.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = times.c; sourceTree = "<group>"; };
+               C9B537A3138D9E990028D27C /* timezone.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = timezone.3; sourceTree = "<group>"; };
+               C9B537A4138D9E990028D27C /* timezone.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = timezone.c; sourceTree = "<group>"; };
+               C9B537A5138D9E990028D27C /* ttyname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ttyname.3; sourceTree = "<group>"; };
+               C9B537A7138D9E990028D27C /* ttyname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ttyname.c; sourceTree = "<group>"; };
+               C9B537A9138D9E990028D27C /* ttyslot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ttyslot.c; sourceTree = "<group>"; };
+               C9B537AA138D9E990028D27C /* ualarm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ualarm.3; sourceTree = "<group>"; };
+               C9B537AC138D9E990028D27C /* ualarm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ualarm.c; sourceTree = "<group>"; };
+               C9B537AD138D9E990028D27C /* ucontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ucontext.3; sourceTree = "<group>"; };
+               C9B537AE138D9E990028D27C /* ulimit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ulimit.3; sourceTree = "<group>"; };
+               C9B537B0138D9E990028D27C /* ulimit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ulimit.c; sourceTree = "<group>"; };
+               C9B537B1138D9E990028D27C /* unvis.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = unvis.3; sourceTree = "<group>"; };
+               C9B537B2138D9E990028D27C /* unvis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = unvis.c; sourceTree = "<group>"; };
+               C9B537B4138D9E990028D27C /* usleep.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = usleep.3; sourceTree = "<group>"; };
+               C9B537B6138D9E990028D27C /* usleep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = usleep.c; sourceTree = "<group>"; };
+               C9B537B8138D9E990028D27C /* utime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utime.3; sourceTree = "<group>"; };
+               C9B537BA138D9E990028D27C /* utime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utime.c; sourceTree = "<group>"; };
+               C9B537BB138D9E990028D27C /* vis.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = vis.3; sourceTree = "<group>"; };
+               C9B537BC138D9E990028D27C /* vis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vis.c; sourceTree = "<group>"; };
+               C9B537BE138D9E990028D27C /* wait.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wait.c; sourceTree = "<group>"; };
+               C9B537C0138D9E990028D27C /* wait3.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wait3.c; sourceTree = "<group>"; };
+               C9B537C1138D9E990028D27C /* waitpid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = waitpid.c; sourceTree = "<group>"; };
+               C9B537C3138D9E990028D27C /* fts.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fts.3; sourceTree = "<group>"; };
+               C9B537C4138D9E990028D27C /* fts.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fts.c; sourceTree = "<group>"; };
+               C9B537C5138D9E990028D27C /* ftw.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ftw.3; sourceTree = "<group>"; };
+               C9B537C6138D9E990028D27C /* get_compat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = get_compat.c; sourceTree = "<group>"; };
+               C9B537C7138D9E990028D27C /* get_compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = get_compat.h; sourceTree = "<group>"; };
+               C9B537C8138D9E990028D27C /* getdomainname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getdomainname.3; sourceTree = "<group>"; };
+               C9B537C9138D9E990028D27C /* getloadavg.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getloadavg.3; sourceTree = "<group>"; };
+               C9B537CA138D9E990028D27C /* getloadavg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getloadavg.c; sourceTree = "<group>"; };
+               C9B537CB138D9E990028D27C /* getttyent.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getttyent.3; sourceTree = "<group>"; };
+               C9B537CC138D9E990028D27C /* getttyent.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getttyent.c; sourceTree = "<group>"; };
+               C9B537CD138D9E990028D27C /* getusershell.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getusershell.3; sourceTree = "<group>"; };
+               C9B537CE138D9E990028D27C /* getusershell.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getusershell.c; sourceTree = "<group>"; };
+               C9B537CF138D9E990028D27C /* getvfsbyname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getvfsbyname.3; sourceTree = "<group>"; };
+               C9B537D0138D9E990028D27C /* getvfsbyname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getvfsbyname.c; sourceTree = "<group>"; };
+               C9B537D1138D9E990028D27C /* intro.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = intro.3; sourceTree = "<group>"; };
+               C9B537D2138D9E990028D27C /* isinf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isinf.c; sourceTree = "<group>"; };
+               C9B537D3138D9E990028D27C /* isnan.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isnan.c; sourceTree = "<group>"; };
+               C9B537D4138D9E990028D27C /* magazine_malloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = magazine_malloc.c; sourceTree = "<group>"; };
+               C9B537D5138D9E990028D27C /* magmallocProvider.d */ = {isa = PBXFileReference; explicitFileType = sourcecode.dtrace; path = magmallocProvider.d; sourceTree = "<group>"; };
+               C9B537D7138D9E990028D27C /* malloc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = malloc.3; sourceTree = "<group>"; };
+               C9B537D8138D9E990028D27C /* malloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = malloc.c; sourceTree = "<group>"; };
+               C9B537D9138D9E990028D27C /* malloc_printf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = malloc_printf.h; sourceTree = "<group>"; };
+               C9B537DA138D9E990028D27C /* malloc_size.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = malloc_size.3; sourceTree = "<group>"; };
+               C9B537DB138D9E990028D27C /* malloc_zone_malloc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = malloc_zone_malloc.3; sourceTree = "<group>"; };
+               C9B537DC138D9E990028D27C /* nanosleep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nanosleep.c; sourceTree = "<group>"; };
+               C9B537DE138D9E990028D27C /* endutxent.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = endutxent.3; sourceTree = "<group>"; };
+               C9B537E0138D9E990028D27C /* getlastlogx.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getlastlogx.3; sourceTree = "<group>"; };
+               C9B537E2138D9E990028D27C /* utmpx.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utmpx.5; sourceTree = "<group>"; };
+               C9B537E4138D9E990028D27C /* utmpx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utmpx.c; sourceTree = "<group>"; };
+               C9B537E6138D9E990028D27C /* nftw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nftw.c; sourceTree = "<group>"; };
+               C9B537E7138D9E990028D27C /* nlist.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nlist.3; sourceTree = "<group>"; };
+               C9B537E8138D9E990028D27C /* nlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nlist.c; sourceTree = "<group>"; };
+               C9B537E9138D9E990028D27C /* NSSystemDirectories.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NSSystemDirectories.c; sourceTree = "<group>"; };
+               C9B537EA138D9E990028D27C /* oldsyslog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = oldsyslog.c; sourceTree = "<group>"; };
+               C9B537EB138D9E990028D27C /* platfunc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = platfunc.c; sourceTree = "<group>"; };
+               C9B537EC138D9E990028D27C /* platfunc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = platfunc.h; sourceTree = "<group>"; };
+               C9B537ED138D9E990028D27C /* posix_memalign.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = posix_memalign.3; sourceTree = "<group>"; };
+               C9B537EE138D9E990028D27C /* pwcache.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pwcache.3; sourceTree = "<group>"; };
+               C9B537EF138D9E990028D27C /* scalable_malloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scalable_malloc.c; sourceTree = "<group>"; };
+               C9B537F0138D9E990028D27C /* scalable_malloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scalable_malloc.h; sourceTree = "<group>"; };
+               C9B537F1138D9E990028D27C /* setjmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setjmp.3; sourceTree = "<group>"; };
+               C9B537F2138D9E990028D27C /* setlogin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setlogin.c; sourceTree = "<group>"; };
+               C9B537F3138D9E990028D27C /* sigsetops.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigsetops.3; sourceTree = "<group>"; };
+               C9B537F4138D9E990028D27C /* sigsetops.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigsetops.c; sourceTree = "<group>"; };
+               C9B537F5138D9E990028D27C /* stack_logging.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack_logging.c; sourceTree = "<group>"; };
+               C9B537F6138D9E990028D27C /* stack_logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stack_logging.h; sourceTree = "<group>"; };
+               C9B537F7138D9E990028D27C /* stack_logging_disk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack_logging_disk.c; sourceTree = "<group>"; };
+               C9B537F8138D9E990028D27C /* strtofflags.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtofflags.3; sourceTree = "<group>"; };
+               C9B537F9138D9E990028D27C /* strtofflags.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtofflags.c; sourceTree = "<group>"; };
+               C9B537FA138D9E990028D27C /* syslog.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = syslog.3; sourceTree = "<group>"; };
+               C9B537FB138D9E990028D27C /* syslog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = syslog.c; sourceTree = "<group>"; };
+               C9B537FC138D9E990028D27C /* tcgetpgrp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcgetpgrp.3; sourceTree = "<group>"; };
+               C9B537FD138D9E990028D27C /* tcsendbreak.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcsendbreak.3; sourceTree = "<group>"; };
+               C9B537FE138D9E990028D27C /* tcsetattr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcsetattr.3; sourceTree = "<group>"; };
+               C9B537FF138D9E990028D27C /* tcsetpgrp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcsetpgrp.3; sourceTree = "<group>"; };
+               C9B53800138D9E990028D27C /* thread_stack_pcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = thread_stack_pcs.c; sourceTree = "<group>"; };
+               C9B53801138D9E990028D27C /* tzset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tzset.3; sourceTree = "<group>"; };
+               C9B53802138D9E990028D27C /* uname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = uname.3; sourceTree = "<group>"; };
+               C9B53803138D9E990028D27C /* uname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = uname.c; sourceTree = "<group>"; };
+               C9B53804138D9E990028D27C /* utmpx-darwin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "utmpx-darwin.c"; sourceTree = "<group>"; };
+               C9B53805138D9E990028D27C /* utmpx-darwin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "utmpx-darwin.h"; sourceTree = "<group>"; };
+               C9B53806138D9E990028D27C /* utmpx_thread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmpx_thread.h; sourceTree = "<group>"; };
+               C9B53807138D9E990028D27C /* wordexp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wordexp.3; sourceTree = "<group>"; };
+               C9B53808138D9E990028D27C /* wordexp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wordexp.c; sourceTree = "<group>"; };
+               C9B5380B138D9E990028D27C /* gmon.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gmon.c; sourceTree = "<group>"; };
+               C9B5380D138D9E990028D27C /* moncontrol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = moncontrol.3; sourceTree = "<group>"; };
+               C9B53811138D9E990028D27C /* _ctx_start.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _ctx_start.S; sourceTree = "<group>"; };
+               C9B53812138D9E990028D27C /* _setcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setcontext.S; sourceTree = "<group>"; };
+               C9B53813138D9E990028D27C /* cpu_number.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cpu_number.s; sourceTree = "<group>"; };
+               C9B53814138D9E990028D27C /* getcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = getcontext.S; sourceTree = "<group>"; };
+               C9B53815138D9E990028D27C /* getmcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmcontext.c; sourceTree = "<group>"; };
+               C9B53816138D9E990028D27C /* icacheinval.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = icacheinval.s; sourceTree = "<group>"; };
+               C9B53817138D9E990028D27C /* makecontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makecontext.c; sourceTree = "<group>"; };
+               C9B53819138D9E990028D27C /* mcount.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mcount.s; sourceTree = "<group>"; };
+               C9B5381A138D9E990028D27C /* setcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setcontext.c; sourceTree = "<group>"; };
+               C9B5381B138D9E990028D27C /* setjmperr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setjmperr.c; sourceTree = "<group>"; };
+               C9B5381C138D9E990028D27C /* swapcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swapcontext.c; sourceTree = "<group>"; };
+               C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init_cpu_capabilities.c; sourceTree = "<group>"; };
+               C9B53820138D9E990028D27C /* preempt.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = preempt.s; sourceTree = "<group>"; };
+               C9B53821138D9E990028D27C /* pthread_getspecific.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_getspecific.s; sourceTree = "<group>"; };
+               C9B53822138D9E990028D27C /* pthread_mutex_lock.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_mutex_lock.s; sourceTree = "<group>"; };
+               C9B53823138D9E990028D27C /* pthread_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_self.s; sourceTree = "<group>"; };
+               C9B53824138D9E990028D27C /* pthread_set_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_set_self.s; sourceTree = "<group>"; };
+               C9B53825138D9E990028D27C /* start_wqthread.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = start_wqthread.s; sourceTree = "<group>"; };
+               C9B53826138D9E990028D27C /* thread_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = thread_start.s; sourceTree = "<group>"; };
+               C9B5382A138D9E990028D27C /* __bzero.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = __bzero.s; sourceTree = "<group>"; };
+               C9B5382B138D9E990028D27C /* bcopy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = "<group>"; };
+               C9B5382C138D9E990028D27C /* bcopy_scalar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_scalar.s; sourceTree = "<group>"; };
+               C9B5382D138D9E990028D27C /* bcopy_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse2.s; sourceTree = "<group>"; };
+               C9B5382E138D9E990028D27C /* bcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse3x.s; sourceTree = "<group>"; };
+               C9B5382F138D9E990028D27C /* bcopy_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse42.s; sourceTree = "<group>"; };
+               C9B53830138D9E990028D27C /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = "<group>"; };
+               C9B53831138D9E990028D27C /* bzero_scalar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_scalar.s; sourceTree = "<group>"; };
+               C9B53832138D9E990028D27C /* bzero_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse2.s; sourceTree = "<group>"; };
+               C9B53833138D9E990028D27C /* bzero_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse42.s; sourceTree = "<group>"; };
+               C9B53834138D9E990028D27C /* ffs.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ffs.s; sourceTree = "<group>"; };
+               C9B53835138D9E990028D27C /* longcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longcopy_sse3x.s; sourceTree = "<group>"; };
+               C9B53837138D9E990028D27C /* memcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memcmp.s; sourceTree = "<group>"; };
+               C9B53838138D9E990028D27C /* memcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy.c; sourceTree = "<group>"; };
+               C9B53839138D9E990028D27C /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = "<group>"; };
+               C9B5383A138D9E990028D27C /* memset.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset.s; sourceTree = "<group>"; };
+               C9B5383B138D9E990028D27C /* memset_pattern_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset_pattern_sse2.s; sourceTree = "<group>"; };
+               C9B5383C138D9E990028D27C /* strcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcmp.s; sourceTree = "<group>"; };
+               C9B5383D138D9E990028D27C /* strcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcpy.s; sourceTree = "<group>"; };
+               C9B5383E138D9E990028D27C /* strlcat.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcat.s; sourceTree = "<group>"; };
+               C9B5383F138D9E990028D27C /* strlcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcpy.s; sourceTree = "<group>"; };
+               C9B53840138D9E990028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = "<group>"; };
+               C9B53841138D9E990028D27C /* strncmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncmp.s; sourceTree = "<group>"; };
+               C9B53842138D9E990028D27C /* strncpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncpy.s; sourceTree = "<group>"; };
+               C9B53844138D9E990028D27C /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = "<group>"; };
+               C9B53845138D9E990028D27C /* _sigtramp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _sigtramp.s; sourceTree = "<group>"; };
+               C9B53846138D9E990028D27C /* atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atomic.c; sourceTree = "<group>"; };
+               C9B53847138D9E990028D27C /* i386_gettimeofday_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = i386_gettimeofday_asm.s; sourceTree = "<group>"; };
+               C9B53848138D9E990028D27C /* mach_absolute_time.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mach_absolute_time.c; sourceTree = "<group>"; };
+               C9B53849138D9E990028D27C /* mach_absolute_time_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mach_absolute_time_asm.s; sourceTree = "<group>"; };
+               C9B5384B138D9E990028D27C /* OSAtomic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = OSAtomic.s; sourceTree = "<group>"; };
+               C9B5384C138D9E990028D27C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = "<group>"; };
+               C9B5384D138D9E990028D27C /* spinlocks.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spinlocks.c; sourceTree = "<group>"; };
+               C9B5384E138D9E990028D27C /* spinlocks_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spinlocks_asm.s; sourceTree = "<group>"; };
+               C9B53850138D9E990028D27C /* _locale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _locale.h; sourceTree = "<group>"; };
+               C9B53851138D9E990028D27C /* _structs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _structs.h; sourceTree = "<group>"; };
+               C9B53852138D9E990028D27C /* _types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _types.h; sourceTree = "<group>"; };
+               C9B53853138D9E990028D27C /* _wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype.h; sourceTree = "<group>"; };
+               C9B53854138D9E990028D27C /* _xlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _xlocale.h; sourceTree = "<group>"; };
+               C9B53855138D9E990028D27C /* aio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aio.h; sourceTree = "<group>"; };
+               C9B53856138D9E990028D27C /* alloca.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = alloca.h; sourceTree = "<group>"; };
+               C9B53857138D9E990028D27C /* ar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ar.h; sourceTree = "<group>"; };
+               C9B53859138D9E990028D27C /* ftp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ftp.h; sourceTree = "<group>"; };
+               C9B5385B138D9E990028D27C /* nameser_compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nameser_compat.h; sourceTree = "<group>"; };
+               C9B5385C138D9E990028D27C /* telnet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = telnet.h; sourceTree = "<group>"; };
+               C9B5385D138D9E990028D27C /* tftp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tftp.h; sourceTree = "<group>"; };
+               C9B5385E138D9E990028D27C /* asl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl.h; sourceTree = "<group>"; };
+               C9B5385F138D9E990028D27C /* asm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asm.h; sourceTree = "<group>"; };
+               C9B53860138D9E990028D27C /* assert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = assert.h; sourceTree = "<group>"; };
+               C9B53861138D9E990028D27C /* authentication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = authentication.h; sourceTree = "<group>"; };
+               C9B53862138D9E990028D27C /* bitstring.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bitstring.h; sourceTree = "<group>"; };
+               C9B53863138D9E990028D27C /* cpio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpio.h; sourceTree = "<group>"; };
+               C9B53864138D9E990028D27C /* CrashReporterClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrashReporterClient.h; sourceTree = "<group>"; };
+               C9B53865138D9E990028D27C /* crt_externs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = crt_externs.h; sourceTree = "<group>"; };
+               C9B53866138D9E990028D27C /* ctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ctype.h; sourceTree = "<group>"; };
+               C9B53867138D9E990028D27C /* db.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = db.h; sourceTree = "<group>"; };
+               C9B53868138D9E990028D27C /* dirent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dirent.h; sourceTree = "<group>"; };
+               C9B53869138D9E990028D27C /* disktab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disktab.h; sourceTree = "<group>"; };
+               C9B5386A138D9E990028D27C /* err.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = err.h; sourceTree = "<group>"; };
+               C9B5386B138D9E990028D27C /* errno.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = errno.h; sourceTree = "<group>"; };
+               C9B5386C138D9E990028D27C /* fcntl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fcntl.h; sourceTree = "<group>"; };
+               C9B5386D138D9E990028D27C /* fmtmsg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fmtmsg.h; sourceTree = "<group>"; };
+               C9B5386E138D9E990028D27C /* fnmatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fnmatch.h; sourceTree = "<group>"; };
+               C9B53870138D9E990028D27C /* nl_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nl_types.h; sourceTree = "<group>"; };
+               C9B53872138D9E990028D27C /* fsproperties.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fsproperties.h; sourceTree = "<group>"; };
+               C9B53873138D9E990028D27C /* fstab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fstab.h; sourceTree = "<group>"; };
+               C9B53874138D9E990028D27C /* fts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fts.h; sourceTree = "<group>"; };
+               C9B53875138D9E990028D27C /* ftw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ftw.h; sourceTree = "<group>"; };
+               C9B53876138D9E990028D27C /* getopt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = getopt.h; sourceTree = "<group>"; };
+               C9B53877138D9E990028D27C /* glob.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glob.h; sourceTree = "<group>"; };
+               C9B53879138D9E990028D27C /* inttypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = inttypes.h; sourceTree = "<group>"; };
+               C9B5387A138D9E990028D27C /* iso646.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iso646.h; sourceTree = "<group>"; };
+               C9B5387B138D9E990028D27C /* kvm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = kvm.h; sourceTree = "<group>"; };
+               C9B5387C138D9E990028D27C /* langinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = langinfo.h; sourceTree = "<group>"; };
+               C9B5387D138D9E990028D27C /* libc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc.h; sourceTree = "<group>"; };
+               C9B5387E138D9E990028D27C /* libgen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libgen.h; sourceTree = "<group>"; };
+               C9B53881138D9E990028D27C /* OSAtomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic.h; sourceTree = "<group>"; };
+               C9B53882138D9E990028D27C /* OSCacheControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSCacheControl.h; sourceTree = "<group>"; };
+               C9B53883138D9E990028D27C /* OSMemoryNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSMemoryNotification.h; sourceTree = "<group>"; };
+               C9B53884138D9E990028D27C /* OSThermalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSThermalNotification.h; sourceTree = "<group>"; };
+               C9B53885138D9E990028D27C /* limits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = limits.h; sourceTree = "<group>"; };
+               C9B53886138D9E990028D27C /* locale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = locale.h; sourceTree = "<group>"; };
+               C9B5388A138D9E990028D27C /* malloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = malloc.h; sourceTree = "<group>"; };
+               C9B5388B138D9E990028D27C /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
+               C9B5388C138D9E990028D27C /* monetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = monetary.h; sourceTree = "<group>"; };
+               C9B5388D138D9E990028D27C /* monitor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = monitor.h; sourceTree = "<group>"; };
+               C9B5388E138D9E990028D27C /* mpool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpool.h; sourceTree = "<group>"; };
+               C9B5388F138D9E990028D27C /* ndbm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ndbm.h; sourceTree = "<group>"; };
+               C9B53891138D9E990028D27C /* utmpx.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmpx.h; sourceTree = "<group>"; };
+               C9B53893138D9E990028D27C /* nlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nlist.h; sourceTree = "<group>"; };
+               C9B53894138D9E990028D27C /* NSSystemDirectories.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSSystemDirectories.h; sourceTree = "<group>"; };
+               C9B53899138D9E990028D27C /* paths.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = paths.h; sourceTree = "<group>"; };
+               C9B5389A138D9E990028D27C /* poll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poll.h; sourceTree = "<group>"; };
+               C9B5389D138D9E990028D27C /* routed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = routed.h; sourceTree = "<group>"; };
+               C9B5389E138D9E990028D27C /* rwhod.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rwhod.h; sourceTree = "<group>"; };
+               C9B5389F138D9E990028D27C /* talkd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = talkd.h; sourceTree = "<group>"; };
+               C9B538A0138D9E990028D27C /* timed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = timed.h; sourceTree = "<group>"; };
+               C9B538A2138D9E990028D27C /* ranlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ranlib.h; sourceTree = "<group>"; };
+               C9B538A3138D9E990028D27C /* readpassphrase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = readpassphrase.h; sourceTree = "<group>"; };
+               C9B538A4138D9E990028D27C /* regex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = regex.h; sourceTree = "<group>"; };
+               C9B538A5138D9E990028D27C /* rune.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rune.h; sourceTree = "<group>"; };
+               C9B538A6138D9E990028D27C /* runetype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = runetype.h; sourceTree = "<group>"; };
+               C9B538A7138D9E990028D27C /* search.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = search.h; sourceTree = "<group>"; };
+               C9B538A9138D9E990028D27C /* _common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _common.h; sourceTree = "<group>"; };
+               C9B538AA138D9E990028D27C /* _stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _stdio.h; sourceTree = "<group>"; };
+               C9B538AB138D9E990028D27C /* _string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _string.h; sourceTree = "<group>"; };
+               C9B538AD138D9E990028D27C /* semaphore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = semaphore.h; sourceTree = "<group>"; };
+               C9B538AE138D9E990028D27C /* setjmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = setjmp.h; sourceTree = "<group>"; };
+               C9B538AF138D9E990028D27C /* sgtty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sgtty.h; sourceTree = "<group>"; };
+               C9B538B0138D9E990028D27C /* signal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = signal.h; sourceTree = "<group>"; };
+               C9B538B1138D9E990028D27C /* spawn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spawn.h; sourceTree = "<group>"; };
+               C9B538B2138D9E990028D27C /* spawn_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spawn_private.h; sourceTree = "<group>"; };
+               C9B538B3138D9E990028D27C /* stab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stab.h; sourceTree = "<group>"; };
+               C9B538B4138D9E990028D27C /* standards.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = standards.h; sourceTree = "<group>"; };
+               C9B538B5138D9E990028D27C /* stdbool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdbool.h; sourceTree = "<group>"; };
+               C9B538B6138D9E990028D27C /* stddef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stddef.h; sourceTree = "<group>"; };
+               C9B538B7138D9E990028D27C /* stdint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdint.h; sourceTree = "<group>"; };
+               C9B538B8138D9E990028D27C /* stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdio.h; sourceTree = "<group>"; };
+               C9B538B9138D9E990028D27C /* stdlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdlib.h; sourceTree = "<group>"; };
+               C9B538BA138D9E990028D27C /* strhash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = strhash.h; sourceTree = "<group>"; };
+               C9B538BB138D9E990028D27C /* string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string.h; sourceTree = "<group>"; };
+               C9B538BC138D9E990028D27C /* stringlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stringlist.h; sourceTree = "<group>"; };
+               C9B538BD138D9E990028D27C /* strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = strings.h; sourceTree = "<group>"; };
+               C9B538BE138D9E990028D27C /* struct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = struct.h; sourceTree = "<group>"; };
+               C9B538C0138D9E990028D27C /* acl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acl.h; sourceTree = "<group>"; };
+               C9B538C1138D9E990028D27C /* cdefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cdefs.h; sourceTree = "<group>"; };
+               C9B538C3138D9E990028D27C /* statvfs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = statvfs.h; sourceTree = "<group>"; };
+               C9B538C4138D9E990028D27C /* sysexits.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sysexits.3; sourceTree = "<group>"; };
+               C9B538C5138D9E990028D27C /* sysexits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sysexits.h; sourceTree = "<group>"; };
+               C9B538C6138D9E990028D27C /* syslog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = syslog.h; sourceTree = "<group>"; };
+               C9B538C7138D9E990028D27C /* tar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tar.h; sourceTree = "<group>"; };
+               C9B538C8138D9E990028D27C /* termios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = termios.h; sourceTree = "<group>"; };
+               C9B538C9138D9E990028D27C /* time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = time.h; sourceTree = "<group>"; };
+               C9B538CA138D9E990028D27C /* timeconv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = timeconv.h; sourceTree = "<group>"; };
+               C9B538CB138D9E990028D27C /* ttyent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ttyent.h; sourceTree = "<group>"; };
+               C9B538CC138D9E990028D27C /* ucontext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ucontext.h; sourceTree = "<group>"; };
+               C9B538CD138D9E990028D27C /* ulimit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ulimit.h; sourceTree = "<group>"; };
+               C9B538CE138D9E990028D27C /* unistd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = "<group>"; };
+               C9B538CF138D9E990028D27C /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = "<group>"; };
+               C9B538D0138D9E990028D27C /* utime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utime.h; sourceTree = "<group>"; };
+               C9B538D1138D9E990028D27C /* utmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmp.h; sourceTree = "<group>"; };
+               C9B538D2138D9E990028D27C /* vis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vis.h; sourceTree = "<group>"; };
+               C9B538D3138D9E990028D27C /* wchar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wchar.h; sourceTree = "<group>"; };
+               C9B538D4138D9E990028D27C /* wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wctype.h; sourceTree = "<group>"; };
+               C9B538D5138D9E990028D27C /* wordexp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wordexp.h; sourceTree = "<group>"; };
+               C9B538D7138D9E990028D27C /* __wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = __wctype.h; sourceTree = "<group>"; };
+               C9B538D8138D9E990028D27C /* _ctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _ctype.h; sourceTree = "<group>"; };
+               C9B538D9138D9E990028D27C /* _inttypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _inttypes.h; sourceTree = "<group>"; };
+               C9B538DA138D9E990028D27C /* _langinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _langinfo.h; sourceTree = "<group>"; };
+               C9B538DB138D9E990028D27C /* _monetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _monetary.h; sourceTree = "<group>"; };
+               C9B538DC138D9E990028D27C /* _stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _stdio.h; sourceTree = "<group>"; };
+               C9B538DD138D9E990028D27C /* _stdlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _stdlib.h; sourceTree = "<group>"; };
+               C9B538DE138D9E990028D27C /* _string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _string.h; sourceTree = "<group>"; };
+               C9B538DF138D9E990028D27C /* _time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _time.h; sourceTree = "<group>"; };
+               C9B538E0138D9E990028D27C /* _wchar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wchar.h; sourceTree = "<group>"; };
+               C9B538E1138D9E990028D27C /* _wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype.h; sourceTree = "<group>"; };
+               C9B538E3138D9E990028D27C /* xlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xlocale.h; sourceTree = "<group>"; };
+               C9B538FF138D9E990028D27C /* ctype_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctype_l.3; sourceTree = "<group>"; };
+               C9B53900138D9E990028D27C /* duplocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = duplocale.3; sourceTree = "<group>"; };
+               C9B53902138D9E990028D27C /* ascii.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ascii.c; sourceTree = "<group>"; };
+               C9B53904138D9E990028D27C /* big5.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = big5.5; sourceTree = "<group>"; };
+               C9B53905138D9E990028D27C /* big5.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = big5.c; sourceTree = "<group>"; };
+               C9B53907138D9E990028D27C /* btowc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = btowc.3; sourceTree = "<group>"; };
+               C9B53909138D9E990028D27C /* btowc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = btowc.c; sourceTree = "<group>"; };
+               C9B5390B138D9E990028D27C /* collate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = collate.c; sourceTree = "<group>"; };
+               C9B5390D138D9E990028D27C /* collate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = collate.h; sourceTree = "<group>"; };
+               C9B5390F138D9E990028D27C /* collcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = collcmp.c; sourceTree = "<group>"; };
+               C9B53911138D9E990028D27C /* ctype.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctype.3; sourceTree = "<group>"; };
+               C9B53913138D9E990028D27C /* digittoint.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = digittoint.3; sourceTree = "<group>"; };
+               C9B53915138D9E990028D27C /* euc.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = euc.5; sourceTree = "<group>"; };
+               C9B53916138D9E990028D27C /* euc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = euc.c; sourceTree = "<group>"; };
+               C9B53918138D9E990028D27C /* fix_grouping.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fix_grouping.c; sourceTree = "<group>"; };
+               C9B5391A138D9E990028D27C /* gb18030.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gb18030.5; sourceTree = "<group>"; };
+               C9B5391B138D9E990028D27C /* gb18030.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gb18030.c; sourceTree = "<group>"; };
+               C9B5391D138D9E990028D27C /* gb2312.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gb2312.5; sourceTree = "<group>"; };
+               C9B5391E138D9E990028D27C /* gb2312.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gb2312.c; sourceTree = "<group>"; };
+               C9B53920138D9E990028D27C /* gbk.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gbk.5; sourceTree = "<group>"; };
+               C9B53921138D9E990028D27C /* gbk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gbk.c; sourceTree = "<group>"; };
+               C9B53923138D9E990028D27C /* isalnum.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isalnum.3; sourceTree = "<group>"; };
+               C9B53925138D9E990028D27C /* isalpha.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isalpha.3; sourceTree = "<group>"; };
+               C9B53927138D9E990028D27C /* isascii.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isascii.3; sourceTree = "<group>"; };
+               C9B53928138D9E990028D27C /* isblank.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isblank.3; sourceTree = "<group>"; };
+               C9B5392A138D9E990028D27C /* iscntrl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = iscntrl.3; sourceTree = "<group>"; };
+               C9B5392C138D9E990028D27C /* isdigit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isdigit.3; sourceTree = "<group>"; };
+               C9B5392E138D9E990028D27C /* isgraph.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isgraph.3; sourceTree = "<group>"; };
+               C9B53930138D9E990028D27C /* isideogram.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isideogram.3; sourceTree = "<group>"; };
+               C9B53932138D9E990028D27C /* islower.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = islower.3; sourceTree = "<group>"; };
+               C9B53934138D9E990028D27C /* isphonogram.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isphonogram.3; sourceTree = "<group>"; };
+               C9B53936138D9E990028D27C /* isprint.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isprint.3; sourceTree = "<group>"; };
+               C9B53938138D9E990028D27C /* ispunct.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ispunct.3; sourceTree = "<group>"; };
+               C9B5393A138D9E990028D27C /* isrune.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isrune.3; sourceTree = "<group>"; };
+               C9B5393C138D9E990028D27C /* isspace.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isspace.3; sourceTree = "<group>"; };
+               C9B5393E138D9E990028D27C /* isspecial.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isspecial.3; sourceTree = "<group>"; };
+               C9B53940138D9E990028D27C /* isupper.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isupper.3; sourceTree = "<group>"; };
+               C9B53942138D9E990028D27C /* iswalnum.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = iswalnum.3; sourceTree = "<group>"; };
+               C9B53944138D9E990028D27C /* isxdigit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isxdigit.3; sourceTree = "<group>"; };
+               C9B53946138D9E990028D27C /* ldpart.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ldpart.c; sourceTree = "<group>"; };
+               C9B53948138D9E990028D27C /* ldpart.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ldpart.h; sourceTree = "<group>"; };
+               C9B5394A138D9E990028D27C /* lmessages.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lmessages.c; sourceTree = "<group>"; };
+               C9B5394C138D9E990028D27C /* lmessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lmessages.h; sourceTree = "<group>"; };
+               C9B5394E138D9E990028D27C /* lmonetary.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lmonetary.c; sourceTree = "<group>"; };
+               C9B53950138D9E990028D27C /* lmonetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lmonetary.h; sourceTree = "<group>"; };
+               C9B53952138D9E990028D27C /* lnumeric.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lnumeric.c; sourceTree = "<group>"; };
+               C9B53954138D9E990028D27C /* lnumeric.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lnumeric.h; sourceTree = "<group>"; };
+               C9B53956138D9E990028D27C /* localeconv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = localeconv.3; sourceTree = "<group>"; };
+               C9B53958138D9E990028D27C /* localeconv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = localeconv.c; sourceTree = "<group>"; };
+               C9B5395A138D9E990028D27C /* mblen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mblen.3; sourceTree = "<group>"; };
+               C9B5395C138D9E990028D27C /* mblen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mblen.c; sourceTree = "<group>"; };
+               C9B5395E138D9E990028D27C /* mblocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mblocal.h; sourceTree = "<group>"; };
+               C9B53960138D9E990028D27C /* mbrlen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbrlen.3; sourceTree = "<group>"; };
+               C9B53962138D9E990028D27C /* mbrlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbrlen.c; sourceTree = "<group>"; };
+               C9B53964138D9E990028D27C /* mbrtowc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbrtowc.3; sourceTree = "<group>"; };
+               C9B53966138D9E990028D27C /* mbrtowc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbrtowc.c; sourceTree = "<group>"; };
+               C9B53968138D9E990028D27C /* mbsinit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbsinit.3; sourceTree = "<group>"; };
+               C9B5396A138D9E990028D27C /* mbsinit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbsinit.c; sourceTree = "<group>"; };
+               C9B5396C138D9E990028D27C /* mbsnrtowcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbsnrtowcs.c; sourceTree = "<group>"; };
+               C9B5396E138D9E990028D27C /* mbsrtowcs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbsrtowcs.3; sourceTree = "<group>"; };
+               C9B53970138D9E990028D27C /* mbsrtowcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbsrtowcs.c; sourceTree = "<group>"; };
+               C9B53972138D9E990028D27C /* mbstowcs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbstowcs.3; sourceTree = "<group>"; };
+               C9B53974138D9E990028D27C /* mbstowcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbstowcs.c; sourceTree = "<group>"; };
+               C9B53976138D9E990028D27C /* mbtowc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbtowc.3; sourceTree = "<group>"; };
+               C9B53978138D9E990028D27C /* mbtowc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbtowc.c; sourceTree = "<group>"; };
+               C9B5397A138D9E990028D27C /* mskanji.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mskanji.5; sourceTree = "<group>"; };
+               C9B5397B138D9E990028D27C /* mskanji.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mskanji.c; sourceTree = "<group>"; };
+               C9B5397D138D9E990028D27C /* multibyte.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = multibyte.3; sourceTree = "<group>"; };
+               C9B5397E138D9E990028D27C /* nextwctype.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nextwctype.3; sourceTree = "<group>"; };
+               C9B53980138D9E990028D27C /* nextwctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nextwctype.c; sourceTree = "<group>"; };
+               C9B53982138D9E990028D27C /* nl_langinfo.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nl_langinfo.3; sourceTree = "<group>"; };
+               C9B53984138D9E990028D27C /* nl_langinfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nl_langinfo.c; sourceTree = "<group>"; };
+               C9B53986138D9E990028D27C /* nomacros.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nomacros.c; sourceTree = "<group>"; };
+               C9B53987138D9E990028D27C /* none.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = none.c; sourceTree = "<group>"; };
+               C9B53989138D9E990028D27C /* rune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rune.c; sourceTree = "<group>"; };
+               C9B5398B138D9E990028D27C /* runetype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = runetype.c; sourceTree = "<group>"; };
+               C9B5398D138D9E990028D27C /* setlocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setlocale.3; sourceTree = "<group>"; };
+               C9B5398F138D9E990028D27C /* setlocale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setlocale.c; sourceTree = "<group>"; };
+               C9B53991138D9E990028D27C /* setlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = setlocale.h; sourceTree = "<group>"; };
+               C9B53993138D9E990028D27C /* setrunelocale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setrunelocale.c; sourceTree = "<group>"; };
+               C9B53995138D9E990028D27C /* table.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
+               C9B53997138D9E990028D27C /* toascii.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = toascii.3; sourceTree = "<group>"; };
+               C9B53998138D9E990028D27C /* tolower.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tolower.3; sourceTree = "<group>"; };
+               C9B5399A138D9E990028D27C /* tolower.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tolower.c; sourceTree = "<group>"; };
+               C9B5399C138D9E990028D27C /* toupper.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = toupper.3; sourceTree = "<group>"; };
+               C9B5399E138D9E990028D27C /* toupper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = toupper.c; sourceTree = "<group>"; };
+               C9B539A0138D9E990028D27C /* towlower.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = towlower.3; sourceTree = "<group>"; };
+               C9B539A2138D9E990028D27C /* towupper.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = towupper.3; sourceTree = "<group>"; };
+               C9B539A5138D9E990028D27C /* utf8.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utf8.5; sourceTree = "<group>"; };
+               C9B539A6138D9E990028D27C /* utf8.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utf8.c; sourceTree = "<group>"; };
+               C9B539A8138D9E990028D27C /* wcrtomb.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcrtomb.3; sourceTree = "<group>"; };
+               C9B539AA138D9E990028D27C /* wcrtomb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcrtomb.c; sourceTree = "<group>"; };
+               C9B539AC138D9E990028D27C /* wcsftime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcsftime.3; sourceTree = "<group>"; };
+               C9B539AE138D9E990028D27C /* wcsftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsftime.c; sourceTree = "<group>"; };
+               C9B539B0138D9E990028D27C /* wcsnrtombs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsnrtombs.c; sourceTree = "<group>"; };
+               C9B539B2138D9E990028D27C /* wcsrtombs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcsrtombs.3; sourceTree = "<group>"; };
+               C9B539B4138D9E990028D27C /* wcsrtombs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsrtombs.c; sourceTree = "<group>"; };
+               C9B539B6138D9E990028D27C /* wcstod.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstod.3; sourceTree = "<group>"; };
+               C9B539B8138D9E990028D27C /* wcstod.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstod.c; sourceTree = "<group>"; };
+               C9B539BA138D9E990028D27C /* wcstof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstof.c; sourceTree = "<group>"; };
+               C9B539BC138D9E990028D27C /* wcstoimax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoimax.c; sourceTree = "<group>"; };
+               C9B539BE138D9E990028D27C /* wcstol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstol.3; sourceTree = "<group>"; };
+               C9B539C0138D9E990028D27C /* wcstol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstol.c; sourceTree = "<group>"; };
+               C9B539C2138D9E990028D27C /* wcstold.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstold.c; sourceTree = "<group>"; };
+               C9B539C4138D9E990028D27C /* wcstoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoll.c; sourceTree = "<group>"; };
+               C9B539C6138D9E990028D27C /* wcstombs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstombs.3; sourceTree = "<group>"; };
+               C9B539C8138D9E990028D27C /* wcstombs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstombs.c; sourceTree = "<group>"; };
+               C9B539CA138D9E990028D27C /* wcstoul.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoul.c; sourceTree = "<group>"; };
+               C9B539CC138D9E990028D27C /* wcstoull.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoull.c; sourceTree = "<group>"; };
+               C9B539CE138D9E990028D27C /* wcstoumax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoumax.c; sourceTree = "<group>"; };
+               C9B539D0138D9E990028D27C /* wctob.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctob.c; sourceTree = "<group>"; };
+               C9B539D2138D9E990028D27C /* wctomb.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wctomb.3; sourceTree = "<group>"; };
+               C9B539D4138D9E990028D27C /* wctomb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctomb.c; sourceTree = "<group>"; };
+               C9B539D6138D9E990028D27C /* wctrans.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wctrans.3; sourceTree = "<group>"; };
+               C9B539D8138D9E990028D27C /* wctrans.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctrans.c; sourceTree = "<group>"; };
+               C9B539DA138D9E990028D27C /* wctype.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wctype.3; sourceTree = "<group>"; };
+               C9B539DC138D9E990028D27C /* wctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctype.c; sourceTree = "<group>"; };
+               C9B539DE138D9E990028D27C /* wcwidth.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcwidth.3; sourceTree = "<group>"; };
+               C9B539E0138D9E990028D27C /* wcwidth.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcwidth.c; sourceTree = "<group>"; };
+               C9B539E2138D9E990028D27C /* freelocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = freelocale.3; sourceTree = "<group>"; };
+               C9B539E3138D9E990028D27C /* frune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = frune.c; sourceTree = "<group>"; };
+               C9B539E4138D9E990028D27C /* isalnum_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isalnum_l.3; sourceTree = "<group>"; };
+               C9B539E5138D9E990028D27C /* isctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isctype.c; sourceTree = "<group>"; };
+               C9B539E6138D9E990028D27C /* iswalnum_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = iswalnum_l.3; sourceTree = "<group>"; };
+               C9B539E7138D9E990028D27C /* iswctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = iswctype.c; sourceTree = "<group>"; };
+               C9B539E8138D9E990028D27C /* lconv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lconv.c; sourceTree = "<group>"; };
+               C9B539EA138D9E990028D27C /* mbrune.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbrune.3; sourceTree = "<group>"; };
+               C9B539EB138D9E990028D27C /* mbrune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbrune.c; sourceTree = "<group>"; };
+               C9B539EC138D9E990028D27C /* newlocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = newlocale.3; sourceTree = "<group>"; };
+               C9B539ED138D9E990028D27C /* querylocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = querylocale.3; sourceTree = "<group>"; };
+               C9B539EE138D9E990028D27C /* rune.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rune.3; sourceTree = "<group>"; };
+               C9B539EF138D9E990028D27C /* runedepreciated.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = runedepreciated.c; sourceTree = "<group>"; };
+               C9B539F0138D9E990028D27C /* runedepreciated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = runedepreciated.h; sourceTree = "<group>"; };
+               C9B539F1138D9E990028D27C /* setinvalidrune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setinvalidrune.c; sourceTree = "<group>"; };
+               C9B539F2138D9E990028D27C /* uselocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = uselocale.3; sourceTree = "<group>"; };
+               C9B539F3138D9E990028D27C /* utf2.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utf2.5; sourceTree = "<group>"; };
+               C9B539F4138D9E990028D27C /* wcstod_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstod_l.3; sourceTree = "<group>"; };
+               C9B539F5138D9E990028D27C /* wcstol_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstol_l.3; sourceTree = "<group>"; };
+               C9B539F6138D9E990028D27C /* xlocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = xlocale.3; sourceTree = "<group>"; };
+               C9B539F7138D9E990028D27C /* xlocale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xlocale.c; sourceTree = "<group>"; };
+               C9B539F8138D9E990028D27C /* xlocale_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xlocale_private.h; sourceTree = "<group>"; };
+               C9B53A05138D9E990028D27C /* assert.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = assert.3; sourceTree = "<group>"; };
+               C9B53A06138D9E990028D27C /* bitstring.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bitstring.3; sourceTree = "<group>"; };
+               C9B53A07138D9E990028D27C /* environ.7 */ = {isa = PBXFileReference; lastKnownFileType = text; path = environ.7; sourceTree = "<group>"; };
+               C9B53A09138D9E990028D27C /* stdarg.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = stdarg.3; sourceTree = "<group>"; };
+               C9B53A0B138D9E990028D27C /* gethostuuid.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gethostuuid.2; sourceTree = "<group>"; };
+               C9B53A0D138D9E990028D27C /* utmp.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utmp.5; sourceTree = "<group>"; };
+               C9B53A0F138D9E990028D27C /* _nbsd_compat_.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _nbsd_compat_.h; sourceTree = "<group>"; };
+               C9B53A10138D9E990028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = "<group>"; };
+               C9B53A12138D9E990028D27C /* byteorder.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = byteorder.3; sourceTree = "<group>"; };
+               C9B53A13138D9E990028D27C /* ethers.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ethers.3; sourceTree = "<group>"; };
+               C9B53A15138D9E990028D27C /* addr2ascii.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = addr2ascii.3; sourceTree = "<group>"; };
+               C9B53A16138D9E990028D27C /* addr2ascii.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = addr2ascii.c; sourceTree = "<group>"; };
+               C9B53A17138D9E990028D27C /* ascii2addr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ascii2addr.c; sourceTree = "<group>"; };
+               C9B53A18138D9E990028D27C /* inet.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = inet.3; sourceTree = "<group>"; };
+               C9B53A1A138D9E990028D27C /* inet_addr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_addr.c; sourceTree = "<group>"; };
+               C9B53A1C138D9E990028D27C /* inet_lnaof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_lnaof.c; sourceTree = "<group>"; };
+               C9B53A1D138D9E990028D27C /* inet_makeaddr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_makeaddr.c; sourceTree = "<group>"; };
+               C9B53A1E138D9E990028D27C /* inet_net.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = inet_net.3; sourceTree = "<group>"; };
+               C9B53A20138D9E990028D27C /* inet_net_ntop.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_net_ntop.c; sourceTree = "<group>"; };
+               C9B53A21138D9E990028D27C /* inet_net_pton.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_net_pton.c; sourceTree = "<group>"; };
+               C9B53A23138D9E990028D27C /* inet_neta.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_neta.c; sourceTree = "<group>"; };
+               C9B53A24138D9E990028D27C /* inet_netof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_netof.c; sourceTree = "<group>"; };
+               C9B53A25138D9E990028D27C /* inet_network.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_network.c; sourceTree = "<group>"; };
+               C9B53A27138D9E990028D27C /* inet_ntoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_ntoa.c; sourceTree = "<group>"; };
+               C9B53A29138D9E990028D27C /* linkaddr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = linkaddr.3; sourceTree = "<group>"; };
+               C9B53A2A138D9E990028D27C /* linkaddr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = linkaddr.c; sourceTree = "<group>"; };
+               C9B53A2B138D9E990028D27C /* nsap_addr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nsap_addr.c; sourceTree = "<group>"; };
+               C9B53A2D138D9E990028D27C /* recv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = recv.c; sourceTree = "<group>"; };
+               C9B53A2F138D9E990028D27C /* send.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = send.c; sourceTree = "<group>"; };
+               C9B53A31138D9E990028D27C /* sockatmark.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sockatmark.3; sourceTree = "<group>"; };
+               C9B53A33138D9E990028D27C /* sockatmark.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sockatmark.c; sourceTree = "<group>"; };
+               C9B53A34138D9E990028D27C /* sourcefilter.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sourcefilter.3; sourceTree = "<group>"; };
+               C9B53A36138D9E990028D27C /* sourcefilter.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sourcefilter.c; sourceTree = "<group>"; };
+               C9B53A39138D9E990028D27C /* rcmdsh.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rcmdsh.3; sourceTree = "<group>"; };
+               C9B53A3C138D9E990028D27C /* catclose.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = catclose.3; sourceTree = "<group>"; };
+               C9B53A3D138D9E990028D27C /* catgets.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = catgets.3; sourceTree = "<group>"; };
+               C9B53A3E138D9E990028D27C /* catopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = catopen.3; sourceTree = "<group>"; };
+               C9B53A3F138D9E990028D27C /* msgcat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = msgcat.c; sourceTree = "<group>"; };
+               C9B53A41138D9E990028D27C /* msgcat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msgcat.h; sourceTree = "<group>"; };
+               C9B53A47138D9E990028D27C /* Makefile.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; path = Makefile.inc; sourceTree = "<group>"; };
+               C9B53A49138D9E990028D27C /* Makefile.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; path = Makefile.inc; sourceTree = "<group>"; };
+               C9B53A4B138D9E990028D27C /* acl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl.3; sourceTree = "<group>"; };
+               C9B53A4C138D9E990028D27C /* acl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl.c; sourceTree = "<group>"; };
+               C9B53A4D138D9E990028D27C /* acl_add_flag_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_add_flag_np.3; sourceTree = "<group>"; };
+               C9B53A4E138D9E990028D27C /* acl_add_perm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_add_perm.3; sourceTree = "<group>"; };
+               C9B53A4F138D9E990028D27C /* acl_clear_flags_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_clear_flags_np.3; sourceTree = "<group>"; };
+               C9B53A50138D9E990028D27C /* acl_clear_perms.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_clear_perms.3; sourceTree = "<group>"; };
+               C9B53A51138D9E990028D27C /* acl_copy_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_copy_entry.3; sourceTree = "<group>"; };
+               C9B53A52138D9E990028D27C /* acl_copy_ext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_copy_ext.3; sourceTree = "<group>"; };
+               C9B53A53138D9E990028D27C /* acl_create_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_create_entry.3; sourceTree = "<group>"; };
+               C9B53A54138D9E990028D27C /* acl_delete.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete.3; sourceTree = "<group>"; };
+               C9B53A55138D9E990028D27C /* acl_delete_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete_entry.3; sourceTree = "<group>"; };
+               C9B53A56138D9E990028D27C /* acl_delete_flag_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete_flag_np.3; sourceTree = "<group>"; };
+               C9B53A57138D9E990028D27C /* acl_delete_perm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete_perm.3; sourceTree = "<group>"; };
+               C9B53A58138D9E990028D27C /* acl_dup.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_dup.3; sourceTree = "<group>"; };
+               C9B53A59138D9E990028D27C /* acl_entry.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_entry.c; sourceTree = "<group>"; };
+               C9B53A5A138D9E990028D27C /* acl_file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_file.c; sourceTree = "<group>"; };
+               C9B53A5B138D9E990028D27C /* acl_flag.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_flag.c; sourceTree = "<group>"; };
+               C9B53A5C138D9E990028D27C /* acl_free.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_free.3; sourceTree = "<group>"; };
+               C9B53A5D138D9E990028D27C /* acl_from_text.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_from_text.3; sourceTree = "<group>"; };
+               C9B53A5E138D9E990028D27C /* acl_get.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get.3; sourceTree = "<group>"; };
+               C9B53A5F138D9E990028D27C /* acl_get_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_entry.3; sourceTree = "<group>"; };
+               C9B53A60138D9E990028D27C /* acl_get_fd.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_fd.3; sourceTree = "<group>"; };
+               C9B53A61138D9E990028D27C /* acl_get_flagset_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_flagset_np.3; sourceTree = "<group>"; };
+               C9B53A62138D9E990028D27C /* acl_get_perm_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_perm_np.3; sourceTree = "<group>"; };
+               C9B53A63138D9E990028D27C /* acl_get_permset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_permset.3; sourceTree = "<group>"; };
+               C9B53A64138D9E990028D27C /* acl_get_permset_mask_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_permset_mask_np.3; sourceTree = "<group>"; };
+               C9B53A65138D9E990028D27C /* acl_get_qualifier.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_qualifier.3; sourceTree = "<group>"; };
+               C9B53A66138D9E990028D27C /* acl_get_tag_type.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_tag_type.3; sourceTree = "<group>"; };
+               C9B53A67138D9E990028D27C /* acl_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_init.3; sourceTree = "<group>"; };
+               C9B53A68138D9E990028D27C /* acl_perm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_perm.c; sourceTree = "<group>"; };
+               C9B53A69138D9E990028D27C /* acl_set.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set.3; sourceTree = "<group>"; };
+               C9B53A6A138D9E990028D27C /* acl_set_flagset_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_flagset_np.3; sourceTree = "<group>"; };
+               C9B53A6B138D9E990028D27C /* acl_set_permset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_permset.3; sourceTree = "<group>"; };
+               C9B53A6C138D9E990028D27C /* acl_set_qualifier.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_qualifier.3; sourceTree = "<group>"; };
+               C9B53A6D138D9E990028D27C /* acl_set_tag_type.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_tag_type.3; sourceTree = "<group>"; };
+               C9B53A6E138D9E990028D27C /* acl_to_text.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_to_text.3; sourceTree = "<group>"; };
+               C9B53A6F138D9E990028D27C /* acl_translate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_translate.c; sourceTree = "<group>"; };
+               C9B53A70138D9E990028D27C /* acl_valid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_valid.3; sourceTree = "<group>"; };
+               C9B53A71138D9E990028D27C /* aclvar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aclvar.h; sourceTree = "<group>"; };
+               C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mk_pthread_impl.c; sourceTree = "<group>"; };
+               C9B53ABD138D9E990028D27C /* plockstat.d */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.dtrace; path = plockstat.d; sourceTree = "<group>"; };
+               C9B53ABE138D9E990028D27C /* posix_sched.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = posix_sched.h; sourceTree = "<group>"; };
+               C9B53ABF138D9E990028D27C /* pthread.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread.3; sourceTree = "<group>"; };
+               C9B53AC0138D9E990028D27C /* pthread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread.c; sourceTree = "<group>"; };
+               C9B53AC1138D9E990028D27C /* pthread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread.h; sourceTree = "<group>"; };
+               C9B53AC2138D9E990028D27C /* pthread_atfork.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_atfork.3; sourceTree = "<group>"; };
+               C9B53AC3138D9E990028D27C /* pthread_attr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr.3; sourceTree = "<group>"; };
+               C9B53AC4138D9E990028D27C /* pthread_attr_init_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_init_destroy.3; sourceTree = "<group>"; };
+               C9B53AC5138D9E990028D27C /* pthread_attr_set_getdetachstate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getdetachstate.3; sourceTree = "<group>"; };
+               C9B53AC6138D9E990028D27C /* pthread_attr_set_getinheritsched.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getinheritsched.3; sourceTree = "<group>"; };
+               C9B53AC7138D9E990028D27C /* pthread_attr_set_getschedparam.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getschedparam.3; sourceTree = "<group>"; };
+               C9B53AC8138D9E990028D27C /* pthread_attr_set_getschedpolicy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getschedpolicy.3; sourceTree = "<group>"; };
+               C9B53AC9138D9E990028D27C /* pthread_attr_set_getscope.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getscope.3; sourceTree = "<group>"; };
+               C9B53ACA138D9E990028D27C /* pthread_attr_set_getstackaddr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getstackaddr.3; sourceTree = "<group>"; };
+               C9B53ACB138D9E990028D27C /* pthread_attr_set_getstacksize.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getstacksize.3; sourceTree = "<group>"; };
+               C9B53ACC138D9E990028D27C /* pthread_cancel.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cancel.3; sourceTree = "<group>"; };
+               C9B53ACD138D9E990028D27C /* pthread_cancelable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_cancelable.c; sourceTree = "<group>"; };
+               C9B53ACE138D9E990028D27C /* pthread_cleanup_pop.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cleanup_pop.3; sourceTree = "<group>"; };
+               C9B53ACF138D9E990028D27C /* pthread_cleanup_push.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cleanup_push.3; sourceTree = "<group>"; };
+               C9B53AD0138D9E990028D27C /* pthread_cond.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_cond.c; sourceTree = "<group>"; };
+               C9B53AD1138D9E990028D27C /* pthread_cond_broadcast.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_broadcast.3; sourceTree = "<group>"; };
+               C9B53AD2138D9E990028D27C /* pthread_cond_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_destroy.3; sourceTree = "<group>"; };
+               C9B53AD3138D9E990028D27C /* pthread_cond_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_init.3; sourceTree = "<group>"; };
+               C9B53AD4138D9E990028D27C /* pthread_cond_signal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_signal.3; sourceTree = "<group>"; };
+               C9B53AD5138D9E990028D27C /* pthread_cond_timedwait.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_timedwait.3; sourceTree = "<group>"; };
+               C9B53AD6138D9E990028D27C /* pthread_cond_wait.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_wait.3; sourceTree = "<group>"; };
+               C9B53AD7138D9E990028D27C /* pthread_condattr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_condattr.3; sourceTree = "<group>"; };
+               C9B53AD8138D9E990028D27C /* pthread_create.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_create.3; sourceTree = "<group>"; };
+               C9B53AD9138D9E990028D27C /* pthread_detach.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_detach.3; sourceTree = "<group>"; };
+               C9B53ADA138D9E990028D27C /* pthread_equal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_equal.3; sourceTree = "<group>"; };
+               C9B53ADB138D9E990028D27C /* pthread_exit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_exit.3; sourceTree = "<group>"; };
+               C9B53ADC138D9E990028D27C /* pthread_getschedparam.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_getschedparam.3; sourceTree = "<group>"; };
+               C9B53ADD138D9E990028D27C /* pthread_getspecific.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_getspecific.3; sourceTree = "<group>"; };
+               C9B53ADE138D9E990028D27C /* pthread_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_impl.h; sourceTree = "<group>"; };
+               C9B53ADF138D9E990028D27C /* pthread_internals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_internals.h; sourceTree = "<group>"; };
+               C9B53AE0138D9E990028D27C /* pthread_join.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_join.3; sourceTree = "<group>"; };
+               C9B53AE1138D9E990028D27C /* pthread_key_create.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_key_create.3; sourceTree = "<group>"; };
+               C9B53AE2138D9E990028D27C /* pthread_key_delete.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_key_delete.3; sourceTree = "<group>"; };
+               C9B53AE3138D9E990028D27C /* pthread_machdep.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_machdep.h; sourceTree = "<group>"; };
+               C9B53AE4138D9E990028D27C /* pthread_mutex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_mutex.c; sourceTree = "<group>"; };
+               C9B53AE5138D9E990028D27C /* pthread_mutex_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_destroy.3; sourceTree = "<group>"; };
+               C9B53AE6138D9E990028D27C /* pthread_mutex_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_init.3; sourceTree = "<group>"; };
+               C9B53AE7138D9E990028D27C /* pthread_mutex_lock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_lock.3; sourceTree = "<group>"; };
+               C9B53AE8138D9E990028D27C /* pthread_mutex_trylock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_trylock.3; sourceTree = "<group>"; };
+               C9B53AE9138D9E990028D27C /* pthread_mutex_unlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_unlock.3; sourceTree = "<group>"; };
+               C9B53AEA138D9E990028D27C /* pthread_mutexattr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutexattr.3; sourceTree = "<group>"; };
+               C9B53AEB138D9E990028D27C /* pthread_once.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_once.3; sourceTree = "<group>"; };
+               C9B53AEC138D9E990028D27C /* pthread_rwlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_rwlock.c; sourceTree = "<group>"; };
+               C9B53AED138D9E990028D27C /* pthread_rwlock_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_destroy.3; sourceTree = "<group>"; };
+               C9B53AEE138D9E990028D27C /* pthread_rwlock_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_init.3; sourceTree = "<group>"; };
+               C9B53AEF138D9E990028D27C /* pthread_rwlock_rdlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_rdlock.3; sourceTree = "<group>"; };
+               C9B53AF0138D9E990028D27C /* pthread_rwlock_unlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_unlock.3; sourceTree = "<group>"; };
+               C9B53AF1138D9E990028D27C /* pthread_rwlock_wrlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_wrlock.3; sourceTree = "<group>"; };
+               C9B53AF2138D9E990028D27C /* pthread_rwlockattr_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_destroy.3; sourceTree = "<group>"; };
+               C9B53AF3138D9E990028D27C /* pthread_rwlockattr_getpshared.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_getpshared.3; sourceTree = "<group>"; };
+               C9B53AF4138D9E990028D27C /* pthread_rwlockattr_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_init.3; sourceTree = "<group>"; };
+               C9B53AF5138D9E990028D27C /* pthread_rwlockattr_setpshared.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_setpshared.3; sourceTree = "<group>"; };
+               C9B53AF6138D9E990028D27C /* pthread_self.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_self.3; sourceTree = "<group>"; };
+               C9B53AF7138D9E990028D27C /* pthread_setcancelstate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_setcancelstate.3; sourceTree = "<group>"; };
+               C9B53AF8138D9E990028D27C /* pthread_setspecific.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_setspecific.3; sourceTree = "<group>"; };
+               C9B53AF9138D9E990028D27C /* pthread_spinlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_spinlock.h; sourceTree = "<group>"; };
+               C9B53AFA138D9E990028D27C /* pthread_spis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_spis.h; sourceTree = "<group>"; };
+               C9B53AFB138D9E990028D27C /* pthread_tsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_tsd.c; sourceTree = "<group>"; };
+               C9B53AFC138D9E990028D27C /* pthread_workqueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_workqueue.h; sourceTree = "<group>"; };
+               C9B53AFD138D9E990028D27C /* sched.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sched.h; sourceTree = "<group>"; };
+               C9B53AFE138D9E990028D27C /* stack.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = stack.s; sourceTree = "<group>"; };
+               C9B53B00138D9E990028D27C /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
+               C9B53B01138D9E990028D27C /* pthread_atfork_test.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_atfork_test.c; sourceTree = "<group>"; };
+               C9B53B02138D9E990028D27C /* thread_setup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = thread_setup.c; sourceTree = "<group>"; };
+               C9B53B06138D9E990028D27C /* cname.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cname.h; sourceTree = "<group>"; };
+               C9B53B08138D9E990028D27C /* COPYRIGHT */ = {isa = PBXFileReference; lastKnownFileType = text; path = COPYRIGHT; sourceTree = "<group>"; };
+               C9B53B0B138D9E990028D27C /* re_format.7 */ = {isa = PBXFileReference; lastKnownFileType = text; path = re_format.7; sourceTree = "<group>"; };
+               C9B53B0E138D9E990028D27C /* regerror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = regerror.c; sourceTree = "<group>"; };
+               C9B53B10138D9E990028D27C /* regex.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = regex.3; sourceTree = "<group>"; };
+               C9B53B18138D9E990028D27C /* utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
+               C9B53B19138D9E990028D27C /* WHATSNEW */ = {isa = PBXFileReference; lastKnownFileType = text; path = WHATSNEW; sourceTree = "<group>"; };
+               C9B53B1E138D9E990028D27C /* chk_fail.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = chk_fail.c; sourceTree = "<group>"; };
+               C9B53B20138D9E990028D27C /* memcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy_chk.c; sourceTree = "<group>"; };
+               C9B53B21138D9E990028D27C /* memmove_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove_chk.c; sourceTree = "<group>"; };
+               C9B53B22138D9E990028D27C /* memset_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memset_chk.c; sourceTree = "<group>"; };
+               C9B53B23138D9E990028D27C /* snprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = snprintf_chk.c; sourceTree = "<group>"; };
+               C9B53B24138D9E990028D27C /* sprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sprintf_chk.c; sourceTree = "<group>"; };
+               C9B53B25138D9E990028D27C /* stpcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stpcpy_chk.c; sourceTree = "<group>"; };
+               C9B53B26138D9E990028D27C /* stpncpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stpncpy_chk.c; sourceTree = "<group>"; };
+               C9B53B27138D9E990028D27C /* strcat_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcat_chk.c; sourceTree = "<group>"; };
+               C9B53B28138D9E990028D27C /* strcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcpy_chk.c; sourceTree = "<group>"; };
+               C9B53B29138D9E990028D27C /* strncat_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncat_chk.c; sourceTree = "<group>"; };
+               C9B53B2A138D9E990028D27C /* strncpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncpy_chk.c; sourceTree = "<group>"; };
+               C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsnprintf_chk.c; sourceTree = "<group>"; };
+               C9B53B2C138D9E990028D27C /* vsprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsprintf_chk.c; sourceTree = "<group>"; };
+               C9B53B2F138D9E990028D27C /* _flock_stub.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _flock_stub.c; sourceTree = "<group>"; };
+               C9B53B30138D9E990028D27C /* asprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asprintf.c; sourceTree = "<group>"; };
+               C9B53B32138D9E990028D27C /* clrerr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clrerr.c; sourceTree = "<group>"; };
+               C9B53B33138D9E990028D27C /* dprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dprintf.c; sourceTree = "<group>"; };
+               C9B53B35138D9E990028D27C /* fclose.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fclose.3; sourceTree = "<group>"; };
+               C9B53B36138D9E990028D27C /* fclose.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fclose.c; sourceTree = "<group>"; };
+               C9B53B38138D9E990028D27C /* fdopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fdopen.c; sourceTree = "<group>"; };
+               C9B53B3A138D9E990028D27C /* feof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = feof.c; sourceTree = "<group>"; };
+               C9B53B3B138D9E990028D27C /* ferror.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ferror.3; sourceTree = "<group>"; };
+               C9B53B3C138D9E990028D27C /* ferror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ferror.c; sourceTree = "<group>"; };
+               C9B53B3D138D9E990028D27C /* fflush.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fflush.3; sourceTree = "<group>"; };
+               C9B53B3E138D9E990028D27C /* fflush.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fflush.c; sourceTree = "<group>"; };
+               C9B53B40138D9E990028D27C /* fgetc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetc.c; sourceTree = "<group>"; };
+               C9B53B41138D9E990028D27C /* fgetln.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgetln.3; sourceTree = "<group>"; };
+               C9B53B43138D9E990028D27C /* fgetln.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetln.c; sourceTree = "<group>"; };
+               C9B53B45138D9E990028D27C /* fgetpos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetpos.c; sourceTree = "<group>"; };
+               C9B53B46138D9E990028D27C /* fgets.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgets.3; sourceTree = "<group>"; };
+               C9B53B47138D9E990028D27C /* fgets.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgets.c; sourceTree = "<group>"; };
+               C9B53B48138D9E990028D27C /* fgetwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetwc.c; sourceTree = "<group>"; };
+               C9B53B4A138D9E990028D27C /* fgetwln.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgetwln.3; sourceTree = "<group>"; };
+               C9B53B4C138D9E990028D27C /* fgetwln.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetwln.c; sourceTree = "<group>"; };
+               C9B53B4E138D9E990028D27C /* fgetws.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgetws.3; sourceTree = "<group>"; };
+               C9B53B50138D9E990028D27C /* fgetws.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetws.c; sourceTree = "<group>"; };
+               C9B53B52138D9E990028D27C /* fileno.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fileno.c; sourceTree = "<group>"; };
+               C9B53B53138D9E990028D27C /* findfp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = findfp.c; sourceTree = "<group>"; };
+               C9B53B55138D9E990028D27C /* flags.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = flags.c; sourceTree = "<group>"; };
+               C9B53B57138D9E990028D27C /* floatio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = floatio.h; sourceTree = "<group>"; };
+               C9B53B58138D9E990028D27C /* flockfile.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = flockfile.3; sourceTree = "<group>"; };
+               C9B53B5A138D9E990028D27C /* fopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fopen.3; sourceTree = "<group>"; };
+               C9B53B5C138D9E990028D27C /* fopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fopen.c; sourceTree = "<group>"; };
+               C9B53B5E138D9E990028D27C /* fprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fprintf.c; sourceTree = "<group>"; };
+               C9B53B60138D9E990028D27C /* fpurge.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fpurge.c; sourceTree = "<group>"; };
+               C9B53B61138D9E990028D27C /* fputc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputc.c; sourceTree = "<group>"; };
+               C9B53B62138D9E990028D27C /* fputs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fputs.3; sourceTree = "<group>"; };
+               C9B53B64138D9E990028D27C /* fputs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputs.c; sourceTree = "<group>"; };
+               C9B53B66138D9E990028D27C /* fputwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputwc.c; sourceTree = "<group>"; };
+               C9B53B68138D9E990028D27C /* fputws.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fputws.3; sourceTree = "<group>"; };
+               C9B53B6A138D9E990028D27C /* fputws.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputws.c; sourceTree = "<group>"; };
+               C9B53B6C138D9E990028D27C /* fread.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fread.3; sourceTree = "<group>"; };
+               C9B53B6E138D9E990028D27C /* fread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fread.c; sourceTree = "<group>"; };
+               C9B53B70138D9E990028D27C /* freopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = freopen.c; sourceTree = "<group>"; };
+               C9B53B72138D9E990028D27C /* fscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fscanf.c; sourceTree = "<group>"; };
+               C9B53B74138D9E990028D27C /* fseek.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fseek.3; sourceTree = "<group>"; };
+               C9B53B76138D9E990028D27C /* fseek.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fseek.c; sourceTree = "<group>"; };
+               C9B53B77138D9E990028D27C /* fsetpos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fsetpos.c; sourceTree = "<group>"; };
+               C9B53B78138D9E990028D27C /* ftell.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ftell.c; sourceTree = "<group>"; };
+               C9B53B7A138D9E990028D27C /* funopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = funopen.3; sourceTree = "<group>"; };
+               C9B53B7B138D9E990028D27C /* funopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = funopen.c; sourceTree = "<group>"; };
+               C9B53B7D138D9E990028D27C /* fvwrite.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fvwrite.c; sourceTree = "<group>"; };
+               C9B53B7E138D9E990028D27C /* fvwrite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fvwrite.h; sourceTree = "<group>"; };
+               C9B53B7F138D9E990028D27C /* fwalk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwalk.c; sourceTree = "<group>"; };
+               C9B53B80138D9E990028D27C /* fwide.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fwide.3; sourceTree = "<group>"; };
+               C9B53B82138D9E990028D27C /* fwide.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwide.c; sourceTree = "<group>"; };
+               C9B53B83138D9E990028D27C /* fwprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwprintf.c; sourceTree = "<group>"; };
+               C9B53B85138D9E990028D27C /* fwrite.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwrite.c; sourceTree = "<group>"; };
+               C9B53B87138D9E990028D27C /* fwscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwscanf.c; sourceTree = "<group>"; };
+               C9B53B89138D9E990028D27C /* getc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getc.3; sourceTree = "<group>"; };
+               C9B53B8B138D9E990028D27C /* getc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getc.c; sourceTree = "<group>"; };
+               C9B53B8C138D9E990028D27C /* getchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getchar.c; sourceTree = "<group>"; };
+               C9B53B8D138D9E990028D27C /* getdelim.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getdelim.c; sourceTree = "<group>"; };
+               C9B53B8E138D9E990028D27C /* getline.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getline.3; sourceTree = "<group>"; };
+               C9B53B90138D9E990028D27C /* getline.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getline.c; sourceTree = "<group>"; };
+               C9B53B91138D9E990028D27C /* gets.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gets.c; sourceTree = "<group>"; };
+               C9B53B92138D9E990028D27C /* getw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getw.c; sourceTree = "<group>"; };
+               C9B53B93138D9E990028D27C /* getwc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getwc.3; sourceTree = "<group>"; };
+               C9B53B95138D9E990028D27C /* getwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getwc.c; sourceTree = "<group>"; };
+               C9B53B97138D9E990028D27C /* getwchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getwchar.c; sourceTree = "<group>"; };
+               C9B53B99138D9E990028D27C /* glue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glue.h; sourceTree = "<group>"; };
+               C9B53B9A138D9E990028D27C /* local.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = local.h; sourceTree = "<group>"; };
+               C9B53B9C138D9E990028D27C /* makebuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makebuf.c; sourceTree = "<group>"; };
+               C9B53B9E138D9E990028D27C /* mktemp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mktemp.3; sourceTree = "<group>"; };
+               C9B53BA0138D9E990028D27C /* mktemp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mktemp.c; sourceTree = "<group>"; };
+               C9B53BA2138D9E990028D27C /* perror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = perror.c; sourceTree = "<group>"; };
+               C9B53BA3138D9E990028D27C /* printf-pos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "printf-pos.c"; sourceTree = "<group>"; };
+               C9B53BA5138D9E990028D27C /* printf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = printf.3; sourceTree = "<group>"; };
+               C9B53BA7138D9E990028D27C /* printf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = "<group>"; };
+               C9B53BA9138D9E990028D27C /* printfcommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = printfcommon.h; sourceTree = "<group>"; };
+               C9B53BAB138D9E990028D27C /* printflocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = printflocal.h; sourceTree = "<group>"; };
+               C9B53BAD138D9E990028D27C /* putc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = putc.3; sourceTree = "<group>"; };
+               C9B53BAF138D9E990028D27C /* putc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putc.c; sourceTree = "<group>"; };
+               C9B53BB0138D9E990028D27C /* putchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putchar.c; sourceTree = "<group>"; };
+               C9B53BB1138D9E990028D27C /* puts.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = puts.c; sourceTree = "<group>"; };
+               C9B53BB3138D9E990028D27C /* putw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putw.c; sourceTree = "<group>"; };
+               C9B53BB4138D9E990028D27C /* putwc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = putwc.3; sourceTree = "<group>"; };
+               C9B53BB6138D9E990028D27C /* putwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putwc.c; sourceTree = "<group>"; };
+               C9B53BB8138D9E990028D27C /* putwchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putwchar.c; sourceTree = "<group>"; };
+               C9B53BBA138D9E990028D27C /* refill.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = refill.c; sourceTree = "<group>"; };
+               C9B53BBC138D9E990028D27C /* remove.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = remove.3; sourceTree = "<group>"; };
+               C9B53BBE138D9E990028D27C /* remove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = remove.c; sourceTree = "<group>"; };
+               C9B53BBF138D9E990028D27C /* rewind.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rewind.c; sourceTree = "<group>"; };
+               C9B53BC1138D9E990028D27C /* rget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rget.c; sourceTree = "<group>"; };
+               C9B53BC2138D9E990028D27C /* scanf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = scanf.3; sourceTree = "<group>"; };
+               C9B53BC4138D9E990028D27C /* scanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scanf.c; sourceTree = "<group>"; };
+               C9B53BC6138D9E990028D27C /* setbuf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setbuf.3; sourceTree = "<group>"; };
+               C9B53BC8138D9E990028D27C /* setbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setbuf.c; sourceTree = "<group>"; };
+               C9B53BC9138D9E990028D27C /* setbuffer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setbuffer.c; sourceTree = "<group>"; };
+               C9B53BCA138D9E990028D27C /* setvbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setvbuf.c; sourceTree = "<group>"; };
+               C9B53BCB138D9E990028D27C /* snprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = snprintf.c; sourceTree = "<group>"; };
+               C9B53BCD138D9E990028D27C /* sprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sprintf.c; sourceTree = "<group>"; };
+               C9B53BCF138D9E990028D27C /* sscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sscanf.c; sourceTree = "<group>"; };
+               C9B53BD1138D9E990028D27C /* stdio.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = stdio.3; sourceTree = "<group>"; };
+               C9B53BD3138D9E990028D27C /* stdio.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stdio.c; sourceTree = "<group>"; };
+               C9B53BD4138D9E990028D27C /* swprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swprintf.c; sourceTree = "<group>"; };
+               C9B53BD6138D9E990028D27C /* swscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swscanf.c; sourceTree = "<group>"; };
+               C9B53BD8138D9E990028D27C /* tempnam.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tempnam.c; sourceTree = "<group>"; };
+               C9B53BDA138D9E990028D27C /* tmpfile.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tmpfile.c; sourceTree = "<group>"; };
+               C9B53BDB138D9E990028D27C /* tmpnam.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tmpnam.3; sourceTree = "<group>"; };
+               C9B53BDD138D9E990028D27C /* tmpnam.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tmpnam.c; sourceTree = "<group>"; };
+               C9B53BDF138D9E990028D27C /* ungetc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ungetc.3; sourceTree = "<group>"; };
+               C9B53BE1138D9E990028D27C /* ungetc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ungetc.c; sourceTree = "<group>"; };
+               C9B53BE2138D9E990028D27C /* ungetwc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ungetwc.3; sourceTree = "<group>"; };
+               C9B53BE4138D9E990028D27C /* ungetwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ungetwc.c; sourceTree = "<group>"; };
+               C9B53BE6138D9E990028D27C /* vasprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vasprintf.c; sourceTree = "<group>"; };
+               C9B53BE8138D9E990028D27C /* vdprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vdprintf.c; sourceTree = "<group>"; };
+               C9B53BEA138D9E990028D27C /* vfprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfprintf.c; sourceTree = "<group>"; };
+               C9B53BEC138D9E990028D27C /* vfscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfscanf.c; sourceTree = "<group>"; };
+               C9B53BEE138D9E9A0028D27C /* vfwprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfwprintf.c; sourceTree = "<group>"; };
+               C9B53BF0138D9E9A0028D27C /* vfwscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfwscanf.c; sourceTree = "<group>"; };
+               C9B53BF2138D9E9A0028D27C /* vprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vprintf.c; sourceTree = "<group>"; };
+               C9B53BF4138D9E9A0028D27C /* vscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vscanf.c; sourceTree = "<group>"; };
+               C9B53BF6138D9E9A0028D27C /* vsnprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsnprintf.c; sourceTree = "<group>"; };
+               C9B53BF8138D9E9A0028D27C /* vsprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsprintf.c; sourceTree = "<group>"; };
+               C9B53BFA138D9E9A0028D27C /* vsscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsscanf.c; sourceTree = "<group>"; };
+               C9B53BFC138D9E9A0028D27C /* vswprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vswprintf.c; sourceTree = "<group>"; };
+               C9B53BFE138D9E9A0028D27C /* vswscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vswscanf.c; sourceTree = "<group>"; };
+               C9B53C00138D9E9A0028D27C /* vwprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vwprintf.c; sourceTree = "<group>"; };
+               C9B53C02138D9E9A0028D27C /* vwscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vwscanf.c; sourceTree = "<group>"; };
+               C9B53C04138D9E9A0028D27C /* wbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wbuf.c; sourceTree = "<group>"; };
+               C9B53C06138D9E9A0028D27C /* wprintf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wprintf.3; sourceTree = "<group>"; };
+               C9B53C08138D9E9A0028D27C /* wprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wprintf.c; sourceTree = "<group>"; };
+               C9B53C0A138D9E9A0028D27C /* wscanf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wscanf.3; sourceTree = "<group>"; };
+               C9B53C0C138D9E9A0028D27C /* wscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wscanf.c; sourceTree = "<group>"; };
+               C9B53C0E138D9E9A0028D27C /* wsetup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wsetup.c; sourceTree = "<group>"; };
+               C9B53C0F138D9E9A0028D27C /* getwc_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getwc_l.3; sourceTree = "<group>"; };
+               C9B53C11138D9E9A0028D27C /* printf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = printf_l.3; sourceTree = "<group>"; };
+               C9B53C12138D9E9A0028D27C /* putwc_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = putwc_l.3; sourceTree = "<group>"; };
+               C9B53C13138D9E9A0028D27C /* scanf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = scanf_l.3; sourceTree = "<group>"; };
+               C9B53C14138D9E9A0028D27C /* wprintf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wprintf_l.3; sourceTree = "<group>"; };
+               C9B53C15138D9E9A0028D27C /* wscanf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wscanf_l.3; sourceTree = "<group>"; };
+               C9B53C17138D9E9A0028D27C /* a64l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = a64l.3; sourceTree = "<group>"; };
+               C9B53C18138D9E9A0028D27C /* a64l.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = a64l.c; sourceTree = "<group>"; };
+               C9B53C1A138D9E9A0028D27C /* _Exit_.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _Exit_.c; sourceTree = "<group>"; };
+               C9B53C1B138D9E9A0028D27C /* abort.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = abort.3; sourceTree = "<group>"; };
+               C9B53C1D138D9E9A0028D27C /* abort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = abort.c; sourceTree = "<group>"; };
+               C9B53C1F138D9E9A0028D27C /* abs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = abs.3; sourceTree = "<group>"; };
+               C9B53C21138D9E9A0028D27C /* abs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = abs.c; sourceTree = "<group>"; };
+               C9B53C22138D9E9A0028D27C /* alloca.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = alloca.3; sourceTree = "<group>"; };
+               C9B53C24138D9E9A0028D27C /* atexit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atexit.3; sourceTree = "<group>"; };
+               C9B53C26138D9E9A0028D27C /* atexit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atexit.c; sourceTree = "<group>"; };
+               C9B53C28138D9E9A0028D27C /* atexit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atexit.h; sourceTree = "<group>"; };
+               C9B53C2A138D9E9A0028D27C /* atof.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atof.3; sourceTree = "<group>"; };
+               C9B53C2C138D9E9A0028D27C /* atof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atof.c; sourceTree = "<group>"; };
+               C9B53C2E138D9E9A0028D27C /* atoi.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atoi.3; sourceTree = "<group>"; };
+               C9B53C30138D9E9A0028D27C /* atoi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atoi.c; sourceTree = "<group>"; };
+               C9B53C32138D9E9A0028D27C /* atol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atol.3; sourceTree = "<group>"; };
+               C9B53C34138D9E9A0028D27C /* atol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atol.c; sourceTree = "<group>"; };
+               C9B53C36138D9E9A0028D27C /* atoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atoll.c; sourceTree = "<group>"; };
+               C9B53C38138D9E9A0028D27C /* bsearch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bsearch.3; sourceTree = "<group>"; };
+               C9B53C3A138D9E9A0028D27C /* bsearch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bsearch.c; sourceTree = "<group>"; };
+               C9B53C3C138D9E9A0028D27C /* div.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = div.3; sourceTree = "<group>"; };
+               C9B53C3E138D9E9A0028D27C /* div.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = div.c; sourceTree = "<group>"; };
+               C9B53C3F138D9E9A0028D27C /* exit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = exit.3; sourceTree = "<group>"; };
+               C9B53C40138D9E9A0028D27C /* exit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exit.c; sourceTree = "<group>"; };
+               C9B53C42138D9E9A0028D27C /* getenv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getenv.3; sourceTree = "<group>"; };
+               C9B53C44138D9E9A0028D27C /* getenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getenv.c; sourceTree = "<group>"; };
+               C9B53C46138D9E9A0028D27C /* getopt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getopt.3; sourceTree = "<group>"; };
+               C9B53C47138D9E9A0028D27C /* getopt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getopt.c; sourceTree = "<group>"; };
+               C9B53C49138D9E9A0028D27C /* getopt_long.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getopt_long.3; sourceTree = "<group>"; };
+               C9B53C4A138D9E9A0028D27C /* getopt_long.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getopt_long.c; sourceTree = "<group>"; };
+               C9B53C4B138D9E9A0028D27C /* getsubopt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getsubopt.3; sourceTree = "<group>"; };
+               C9B53C4D138D9E9A0028D27C /* getsubopt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getsubopt.c; sourceTree = "<group>"; };
+               C9B53C4E138D9E9A0028D27C /* hcreate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = hcreate.3; sourceTree = "<group>"; };
+               C9B53C4F138D9E9A0028D27C /* hcreate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hcreate.c; sourceTree = "<group>"; };
+               C9B53C50138D9E9A0028D27C /* heapsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = heapsort.c; sourceTree = "<group>"; };
+               C9B53C53138D9E9A0028D27C /* imaxabs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = imaxabs.3; sourceTree = "<group>"; };
+               C9B53C54138D9E9A0028D27C /* imaxabs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = imaxabs.c; sourceTree = "<group>"; };
+               C9B53C55138D9E9A0028D27C /* imaxdiv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = imaxdiv.3; sourceTree = "<group>"; };
+               C9B53C57138D9E9A0028D27C /* imaxdiv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = imaxdiv.c; sourceTree = "<group>"; };
+               C9B53C58138D9E9A0028D27C /* insque.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = insque.3; sourceTree = "<group>"; };
+               C9B53C5A138D9E9A0028D27C /* insque.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = insque.c; sourceTree = "<group>"; };
+               C9B53C5B138D9E9A0028D27C /* labs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = labs.3; sourceTree = "<group>"; };
+               C9B53C5D138D9E9A0028D27C /* labs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = labs.c; sourceTree = "<group>"; };
+               C9B53C5E138D9E9A0028D27C /* ldiv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ldiv.3; sourceTree = "<group>"; };
+               C9B53C60138D9E9A0028D27C /* ldiv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ldiv.c; sourceTree = "<group>"; };
+               C9B53C61138D9E9A0028D27C /* llabs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = llabs.3; sourceTree = "<group>"; };
+               C9B53C63138D9E9A0028D27C /* llabs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = llabs.c; sourceTree = "<group>"; };
+               C9B53C64138D9E9A0028D27C /* lldiv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lldiv.3; sourceTree = "<group>"; };
+               C9B53C66138D9E9A0028D27C /* lldiv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lldiv.c; sourceTree = "<group>"; };
+               C9B53C67138D9E9A0028D27C /* lsearch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lsearch.3; sourceTree = "<group>"; };
+               C9B53C69138D9E9A0028D27C /* lsearch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lsearch.c; sourceTree = "<group>"; };
+               C9B53C6A138D9E9A0028D27C /* memory.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memory.3; sourceTree = "<group>"; };
+               C9B53C6C138D9E9A0028D27C /* merge.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = merge.c; sourceTree = "<group>"; };
+               C9B53C6F138D9E9A0028D27C /* putenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putenv.c; sourceTree = "<group>"; };
+               C9B53C71138D9E9A0028D27C /* qsort.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = qsort.3; sourceTree = "<group>"; };
+               C9B53C73138D9E9A0028D27C /* qsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = "<group>"; };
+               C9B53C75138D9E9A0028D27C /* qsort_r.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = qsort_r.c; sourceTree = "<group>"; };
+               C9B53C77138D9E9A0028D27C /* radixsort.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = radixsort.3; sourceTree = "<group>"; };
+               C9B53C78138D9E9A0028D27C /* radixsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = radixsort.c; sourceTree = "<group>"; };
+               C9B53C7A138D9E9A0028D27C /* rand.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rand.3; sourceTree = "<group>"; };
+               C9B53C7C138D9E9A0028D27C /* rand.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rand.c; sourceTree = "<group>"; };
+               C9B53C7D138D9E9A0028D27C /* random.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = random.3; sourceTree = "<group>"; };
+               C9B53C7F138D9E9A0028D27C /* random.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = random.c; sourceTree = "<group>"; };
+               C9B53C81138D9E9A0028D27C /* reallocf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = reallocf.c; sourceTree = "<group>"; };
+               C9B53C82138D9E9A0028D27C /* realpath.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = realpath.3; sourceTree = "<group>"; };
+               C9B53C84138D9E9A0028D27C /* realpath.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = realpath.c; sourceTree = "<group>"; };
+               C9B53C86138D9E9A0028D27C /* remque.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = remque.c; sourceTree = "<group>"; };
+               C9B53C87138D9E9A0028D27C /* setenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setenv.c; sourceTree = "<group>"; };
+               C9B53C89138D9E9A0028D27C /* strhash.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strhash.c; sourceTree = "<group>"; };
+               C9B53C8B138D9E9A0028D27C /* strtod.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtod.3; sourceTree = "<group>"; };
+               C9B53C8D138D9E9A0028D27C /* strtoimax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoimax.c; sourceTree = "<group>"; };
+               C9B53C8F138D9E9A0028D27C /* strtol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtol.3; sourceTree = "<group>"; };
+               C9B53C91138D9E9A0028D27C /* strtol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = "<group>"; };
+               C9B53C93138D9E9A0028D27C /* strtoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoll.c; sourceTree = "<group>"; };
+               C9B53C95138D9E9A0028D27C /* strtoq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoq.c; sourceTree = "<group>"; };
+               C9B53C97138D9E9A0028D27C /* strtoul.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtoul.3; sourceTree = "<group>"; };
+               C9B53C99138D9E9A0028D27C /* strtoul.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoul.c; sourceTree = "<group>"; };
+               C9B53C9B138D9E9A0028D27C /* strtoull.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoull.c; sourceTree = "<group>"; };
+               C9B53C9D138D9E9A0028D27C /* strtoumax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoumax.c; sourceTree = "<group>"; };
+               C9B53C9F138D9E9A0028D27C /* strtouq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtouq.c; sourceTree = "<group>"; };
+               C9B53CA1138D9E9A0028D27C /* system.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = system.3; sourceTree = "<group>"; };
+               C9B53CA3138D9E9A0028D27C /* system.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = system.c; sourceTree = "<group>"; };
+               C9B53CA5138D9E9A0028D27C /* tdelete.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tdelete.c; sourceTree = "<group>"; };
+               C9B53CA6138D9E9A0028D27C /* tfind.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tfind.c; sourceTree = "<group>"; };
+               C9B53CA7138D9E9A0028D27C /* tsearch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tsearch.3; sourceTree = "<group>"; };
+               C9B53CA9138D9E9A0028D27C /* tsearch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tsearch.c; sourceTree = "<group>"; };
+               C9B53CAA138D9E9A0028D27C /* twalk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = twalk.c; sourceTree = "<group>"; };
+               C9B53CAB138D9E9A0028D27C /* grantpt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = grantpt.3; sourceTree = "<group>"; };
+               C9B53CAC138D9E9A0028D27C /* grantpt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = grantpt.c; sourceTree = "<group>"; };
+               C9B53CAD138D9E9A0028D27C /* l64a.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = l64a.c; sourceTree = "<group>"; };
+               C9B53CB0138D9E9A0028D27C /* strfmon.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strfmon.3; sourceTree = "<group>"; };
+               C9B53CB2138D9E9A0028D27C /* strfmon.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strfmon.c; sourceTree = "<group>"; };
+               C9B53CB5138D9E9A0028D27C /* ecvt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ecvt.3; sourceTree = "<group>"; };
+               C9B53CB7138D9E9A0028D27C /* ecvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ecvt.c; sourceTree = "<group>"; };
+               C9B53CB9138D9E9A0028D27C /* gcvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gcvt.c; sourceTree = "<group>"; };
+               C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "qsort_b-fbsd.c"; sourceTree = "<group>"; };
+               C9B53CBE138D9E9A0028D27C /* strtod_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtod_l.3; sourceTree = "<group>"; };
+               C9B53CBF138D9E9A0028D27C /* strtol_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtol_l.3; sourceTree = "<group>"; };
+               C9B53CC2138D9E9A0028D27C /* asctime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asctime.c; sourceTree = "<group>"; };
+               C9B53CC4138D9E9A0028D27C /* ctime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctime.3; sourceTree = "<group>"; };
+               C9B53CC6138D9E9A0028D27C /* difftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = difftime.c; sourceTree = "<group>"; };
+               C9B53CC7138D9E9A0028D27C /* ftime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ftime.3; sourceTree = "<group>"; };
+               C9B53CC9138D9E9A0028D27C /* ftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ftime.c; sourceTree = "<group>"; };
+               C9B53CCA138D9E9A0028D27C /* localtime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = localtime.c; sourceTree = "<group>"; };
+               C9B53CCC138D9E9A0028D27C /* private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = private.h; sourceTree = "<group>"; };
+               C9B53CCD138D9E9A0028D27C /* strftime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strftime.3; sourceTree = "<group>"; };
+               C9B53CCF138D9E9A0028D27C /* strftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strftime.c; sourceTree = "<group>"; };
+               C9B53CD1138D9E9A0028D27C /* strptime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strptime.3; sourceTree = "<group>"; };
+               C9B53CD3138D9E9A0028D27C /* strptime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strptime.c; sourceTree = "<group>"; };
+               C9B53CD5138D9E9A0028D27C /* time2posix.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = time2posix.3; sourceTree = "<group>"; };
+               C9B53CD6138D9E9A0028D27C /* time32.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = time32.c; sourceTree = "<group>"; };
+               C9B53CD7138D9E9A0028D27C /* timelocal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = timelocal.c; sourceTree = "<group>"; };
+               C9B53CD9138D9E9A0028D27C /* timelocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = timelocal.h; sourceTree = "<group>"; };
+               C9B53CDB138D9E9A0028D27C /* tzfile.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tzfile.5; sourceTree = "<group>"; };
+               C9B53CDD138D9E9A0028D27C /* tzfile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tzfile.h; sourceTree = "<group>"; };
+               C9B53CDF138D9E9A0028D27C /* getdate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getdate.3; sourceTree = "<group>"; };
+               C9B53CE0138D9E9A0028D27C /* getdate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getdate.c; sourceTree = "<group>"; };
+               C9B53CE2138D9E9A0028D27C /* timegm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = timegm.3; sourceTree = "<group>"; };
+               C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = timezone_unix03.c; sourceTree = "<group>"; };
+               C9B53CE6138D9E9A0028D27C /* bcmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bcmp.3; sourceTree = "<group>"; };
+               C9B53CE8138D9E9A0028D27C /* bcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcmp.c; sourceTree = "<group>"; };
+               C9B53CE9138D9E9A0028D27C /* bcopy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bcopy.3; sourceTree = "<group>"; };
+               C9B53CEB138D9E9A0028D27C /* bcopy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = "<group>"; };
+               C9B53CED138D9E9A0028D27C /* bstring.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bstring.3; sourceTree = "<group>"; };
+               C9B53CEF138D9E9A0028D27C /* bzero.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bzero.3; sourceTree = "<group>"; };
+               C9B53CF1138D9E9A0028D27C /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = "<group>"; };
+               C9B53CF3138D9E9A0028D27C /* ffs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ffs.3; sourceTree = "<group>"; };
+               C9B53CF5138D9E9A0028D27C /* index.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = index.3; sourceTree = "<group>"; };
+               C9B53CF7138D9E9A0028D27C /* index.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = index.c; sourceTree = "<group>"; };
+               C9B53CF8138D9E9A0028D27C /* memccpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memccpy.3; sourceTree = "<group>"; };
+               C9B53CFA138D9E9A0028D27C /* memccpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memccpy.c; sourceTree = "<group>"; };
+               C9B53CFB138D9E9A0028D27C /* memchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memchr.3; sourceTree = "<group>"; };
+               C9B53CFD138D9E9A0028D27C /* memchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memchr.c; sourceTree = "<group>"; };
+               C9B53CFE138D9E9A0028D27C /* memcmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memcmp.3; sourceTree = "<group>"; };
+               C9B53D00138D9E9A0028D27C /* memcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcmp.c; sourceTree = "<group>"; };
+               C9B53D01138D9E9A0028D27C /* memcpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memcpy.3; sourceTree = "<group>"; };
+               C9B53D03138D9E9A0028D27C /* memcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy.c; sourceTree = "<group>"; };
+               C9B53D05138D9E9A0028D27C /* memmem.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memmem.3; sourceTree = "<group>"; };
+               C9B53D06138D9E9A0028D27C /* memmem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmem.c; sourceTree = "<group>"; };
+               C9B53D07138D9E9A0028D27C /* memmove.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memmove.3; sourceTree = "<group>"; };
+               C9B53D09138D9E9A0028D27C /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = "<group>"; };
+               C9B53D0B138D9E9A0028D27C /* memset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memset.3; sourceTree = "<group>"; };
+               C9B53D0D138D9E9A0028D27C /* memset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memset.c; sourceTree = "<group>"; };
+               C9B53D0E138D9E9A0028D27C /* rindex.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rindex.3; sourceTree = "<group>"; };
+               C9B53D10138D9E9A0028D27C /* rindex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rindex.c; sourceTree = "<group>"; };
+               C9B53D13138D9E9A0028D27C /* strcasecmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcasecmp.3; sourceTree = "<group>"; };
+               C9B53D15138D9E9A0028D27C /* strcasecmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcasecmp.c; sourceTree = "<group>"; };
+               C9B53D17138D9E9A0028D27C /* strcasestr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcasestr.c; sourceTree = "<group>"; };
+               C9B53D19138D9E9A0028D27C /* strcat.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcat.3; sourceTree = "<group>"; };
+               C9B53D1C138D9E9A0028D27C /* strchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strchr.3; sourceTree = "<group>"; };
+               C9B53D1E138D9E9A0028D27C /* strchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strchr.c; sourceTree = "<group>"; };
+               C9B53D20138D9E9A0028D27C /* strcmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcmp.3; sourceTree = "<group>"; };
+               C9B53D22138D9E9A0028D27C /* strcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcmp.c; sourceTree = "<group>"; };
+               C9B53D24138D9E9A0028D27C /* strcoll.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcoll.3; sourceTree = "<group>"; };
+               C9B53D26138D9E9A0028D27C /* strcoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcoll.c; sourceTree = "<group>"; };
+               C9B53D28138D9E9A0028D27C /* strcpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcpy.3; sourceTree = "<group>"; };
+               C9B53D2B138D9E9A0028D27C /* strcspn.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcspn.3; sourceTree = "<group>"; };
+               C9B53D2D138D9E9A0028D27C /* strcspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcspn.c; sourceTree = "<group>"; };
+               C9B53D2E138D9E9A0028D27C /* strdup.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strdup.3; sourceTree = "<group>"; };
+               C9B53D30138D9E9A0028D27C /* strdup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strdup.c; sourceTree = "<group>"; };
+               C9B53D31138D9E9A0028D27C /* strerror.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strerror.3; sourceTree = "<group>"; };
+               C9B53D33138D9E9A0028D27C /* strerror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strerror.c; sourceTree = "<group>"; };
+               C9B53D35138D9E9A0028D27C /* string.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = string.3; sourceTree = "<group>"; };
+               C9B53D38138D9E9A0028D27C /* strlcpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strlcpy.3; sourceTree = "<group>"; };
+               C9B53D3B138D9E9A0028D27C /* strlen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strlen.3; sourceTree = "<group>"; };
+               C9B53D3C138D9E9A0028D27C /* strlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strlen.c; sourceTree = "<group>"; };
+               C9B53D3E138D9E9A0028D27C /* strmode.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strmode.3; sourceTree = "<group>"; };
+               C9B53D40138D9E9A0028D27C /* strmode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strmode.c; sourceTree = "<group>"; };
+               C9B53D42138D9E9A0028D27C /* strncmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncmp.c; sourceTree = "<group>"; };
+               C9B53D44138D9E9A0028D27C /* strndup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strndup.c; sourceTree = "<group>"; };
+               C9B53D45138D9E9A0028D27C /* strnlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strnlen.c; sourceTree = "<group>"; };
+               C9B53D46138D9E9A0028D27C /* strnstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strnstr.c; sourceTree = "<group>"; };
+               C9B53D47138D9E9A0028D27C /* strpbrk.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strpbrk.3; sourceTree = "<group>"; };
+               C9B53D49138D9E9A0028D27C /* strpbrk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strpbrk.c; sourceTree = "<group>"; };
+               C9B53D4A138D9E9A0028D27C /* strrchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strrchr.3; sourceTree = "<group>"; };
+               C9B53D4C138D9E9A0028D27C /* strrchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strrchr.c; sourceTree = "<group>"; };
+               C9B53D4E138D9E9A0028D27C /* strsep.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strsep.3; sourceTree = "<group>"; };
+               C9B53D4F138D9E9A0028D27C /* strsep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strsep.c; sourceTree = "<group>"; };
+               C9B53D50138D9E9A0028D27C /* strsignal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strsignal.c; sourceTree = "<group>"; };
+               C9B53D52138D9E9A0028D27C /* strspn.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strspn.3; sourceTree = "<group>"; };
+               C9B53D54138D9E9A0028D27C /* strspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strspn.c; sourceTree = "<group>"; };
+               C9B53D55138D9E9A0028D27C /* strstr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strstr.3; sourceTree = "<group>"; };
+               C9B53D57138D9E9A0028D27C /* strstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strstr.c; sourceTree = "<group>"; };
+               C9B53D58138D9E9A0028D27C /* strtok.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtok.3; sourceTree = "<group>"; };
+               C9B53D5A138D9E9A0028D27C /* strtok.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtok.c; sourceTree = "<group>"; };
+               C9B53D5B138D9E9A0028D27C /* strxfrm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strxfrm.3; sourceTree = "<group>"; };
+               C9B53D5D138D9E9A0028D27C /* strxfrm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strxfrm.c; sourceTree = "<group>"; };
+               C9B53D5F138D9E9A0028D27C /* swab.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = swab.3; sourceTree = "<group>"; };
+               C9B53D61138D9E9A0028D27C /* swab.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swab.c; sourceTree = "<group>"; };
+               C9B53D63138D9E9A0028D27C /* wcpcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcpcpy.c; sourceTree = "<group>"; };
+               C9B53D64138D9E9A0028D27C /* wcpncpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcpncpy.c; sourceTree = "<group>"; };
+               C9B53D65138D9E9A0028D27C /* wcscasecmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscasecmp.c; sourceTree = "<group>"; };
+               C9B53D67138D9E9A0028D27C /* wcscat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscat.c; sourceTree = "<group>"; };
+               C9B53D68138D9E9A0028D27C /* wcschr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcschr.c; sourceTree = "<group>"; };
+               C9B53D69138D9E9A0028D27C /* wcscmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscmp.c; sourceTree = "<group>"; };
+               C9B53D6A138D9E9A0028D27C /* wcscoll.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcscoll.3; sourceTree = "<group>"; };
+               C9B53D6C138D9E9A0028D27C /* wcscoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscoll.c; sourceTree = "<group>"; };
+               C9B53D6E138D9E9A0028D27C /* wcscpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscpy.c; sourceTree = "<group>"; };
+               C9B53D6F138D9E9A0028D27C /* wcscspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscspn.c; sourceTree = "<group>"; };
+               C9B53D70138D9E9A0028D27C /* wcsdup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsdup.c; sourceTree = "<group>"; };
+               C9B53D71138D9E9A0028D27C /* wcslcat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcslcat.c; sourceTree = "<group>"; };
+               C9B53D72138D9E9A0028D27C /* wcslcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcslcpy.c; sourceTree = "<group>"; };
+               C9B53D73138D9E9A0028D27C /* wcslen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcslen.c; sourceTree = "<group>"; };
+               C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncasecmp.c; sourceTree = "<group>"; };
+               C9B53D76138D9E9A0028D27C /* wcsncat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncat.c; sourceTree = "<group>"; };
+               C9B53D77138D9E9A0028D27C /* wcsncmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncmp.c; sourceTree = "<group>"; };
+               C9B53D78138D9E9A0028D27C /* wcsncpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncpy.c; sourceTree = "<group>"; };
+               C9B53D79138D9E9A0028D27C /* wcsnlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsnlen.c; sourceTree = "<group>"; };
+               C9B53D7A138D9E9A0028D27C /* wcspbrk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcspbrk.c; sourceTree = "<group>"; };
+               C9B53D7B138D9E9A0028D27C /* wcsrchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsrchr.c; sourceTree = "<group>"; };
+               C9B53D7C138D9E9A0028D27C /* wcsspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsspn.c; sourceTree = "<group>"; };
+               C9B53D7D138D9E9A0028D27C /* wcsstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsstr.c; sourceTree = "<group>"; };
+               C9B53D7E138D9E9A0028D27C /* wcstok.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstok.3; sourceTree = "<group>"; };
+               C9B53D80138D9E9A0028D27C /* wcstok.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstok.c; sourceTree = "<group>"; };
+               C9B53D81138D9E9A0028D27C /* wcswidth.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcswidth.3; sourceTree = "<group>"; };
+               C9B53D83138D9E9A0028D27C /* wcswidth.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcswidth.c; sourceTree = "<group>"; };
+               C9B53D85138D9E9A0028D27C /* wcsxfrm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcsxfrm.3; sourceTree = "<group>"; };
+               C9B53D87138D9E9A0028D27C /* wcsxfrm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsxfrm.c; sourceTree = "<group>"; };
+               C9B53D89138D9E9A0028D27C /* wmemchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wmemchr.3; sourceTree = "<group>"; };
+               C9B53D8B138D9E9A0028D27C /* wmemchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemchr.c; sourceTree = "<group>"; };
+               C9B53D8C138D9E9A0028D27C /* wmemcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemcmp.c; sourceTree = "<group>"; };
+               C9B53D8D138D9E9A0028D27C /* wmemcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemcpy.c; sourceTree = "<group>"; };
+               C9B53D8E138D9E9A0028D27C /* wmemmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemmove.c; sourceTree = "<group>"; };
+               C9B53D8F138D9E9A0028D27C /* wmemset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemset.c; sourceTree = "<group>"; };
+               C9B53D91138D9E9A0028D27C /* memset_pattern.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memset_pattern.3; sourceTree = "<group>"; };
+               C9B53D92138D9E9A0028D27C /* strip-header.ed */ = {isa = PBXFileReference; lastKnownFileType = text; path = "strip-header.ed"; sourceTree = "<group>"; };
+               C9B53D94138D9E9A0028D27C /* __libc_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = __libc_init.c; sourceTree = "<group>"; };
+               C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _libc_fork_child.c; sourceTree = "<group>"; };
+               C9B53D96138D9E9A0028D27C /* atomic.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atomic.3; sourceTree = "<group>"; };
+               C9B53D97138D9E9A0028D27C /* barrier.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = barrier.3; sourceTree = "<group>"; };
+               C9B53D98138D9E9A0028D27C /* cache.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = cache.3; sourceTree = "<group>"; };
+               C9B53D99138D9E9A0028D27C /* chmodx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = chmodx_np.c; sourceTree = "<group>"; };
+               C9B53D9A138D9E9A0028D27C /* CLIB-LIST */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CLIB-LIST"; sourceTree = "<group>"; };
+               C9B53D9B138D9E9A0028D27C /* context-stubs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "context-stubs.c"; sourceTree = "<group>"; };
+               C9B53D9C138D9E9A0028D27C /* crt_externs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = crt_externs.c; sourceTree = "<group>"; };
+               C9B53D9D138D9E9A0028D27C /* errno.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = errno.c; sourceTree = "<group>"; };
+               C9B53D9E138D9E9A0028D27C /* fork.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fork.c; sourceTree = "<group>"; };
+               C9B53D9F138D9E9A0028D27C /* getgroups.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getgroups.c; sourceTree = "<group>"; };
+               C9B53DA0138D9E9A0028D27C /* getiopolicy_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getiopolicy_np.3; sourceTree = "<group>"; };
+               C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getiopolicy_np.c; sourceTree = "<group>"; };
+               C9B53DA2138D9E9A0028D27C /* gettimeofday.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gettimeofday.c; sourceTree = "<group>"; };
+               C9B53DA4138D9E9A0028D27C /* MISSING-MANPAGE */ = {isa = PBXFileReference; lastKnownFileType = text; path = "MISSING-MANPAGE"; sourceTree = "<group>"; };
+               C9B53DA5138D9E9A0028D27C /* MISSING_SYSCALLS */ = {isa = PBXFileReference; lastKnownFileType = text; path = MISSING_SYSCALLS; sourceTree = "<group>"; };
+               C9B53DA6138D9E9A0028D27C /* msgctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = msgctl.c; sourceTree = "<group>"; };
+               C9B53DA7138D9E9A0028D27C /* nanosleep.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nanosleep.2; sourceTree = "<group>"; };
+               C9B53DA9138D9E9A0028D27C /* stack_protector.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack_protector.c; sourceTree = "<group>"; };
+               C9B53DAB138D9E9A0028D27C /* openx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = openx_np.c; sourceTree = "<group>"; };
+               C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSMemoryNotification.c; sourceTree = "<group>"; };
+               C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSThermalNotification.c; sourceTree = "<group>"; };
+               C9B53DAE138D9E9A0028D27C /* posix_spawn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = posix_spawn.c; sourceTree = "<group>"; };
+               C9B53DAF138D9E9A0028D27C /* pthread_kill.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_kill.2; sourceTree = "<group>"; };
+               C9B53DB0138D9E9A0028D27C /* pthread_sigmask.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_sigmask.2; sourceTree = "<group>"; };
+               C9B53DB1138D9E9A0028D27C /* REQUIRED-MACROS */ = {isa = PBXFileReference; lastKnownFileType = text; path = "REQUIRED-MACROS"; sourceTree = "<group>"; };
+               C9B53DB2138D9E9A0028D27C /* semctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = semctl.c; sourceTree = "<group>"; };
+               C9B53DB3138D9E9A0028D27C /* settimeofday.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = settimeofday.c; sourceTree = "<group>"; };
+               C9B53DB4138D9E9A0028D27C /* shmctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = shmctl.c; sourceTree = "<group>"; };
+               C9B53DB5138D9E9A0028D27C /* sigaction.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigaction.c; sourceTree = "<group>"; };
+               C9B53DB6138D9E9A0028D27C /* sigcatch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigcatch.c; sourceTree = "<group>"; };
+               C9B53DB7138D9E9A0028D27C /* sigcatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sigcatch.h; sourceTree = "<group>"; };
+               C9B53DB8138D9E9A0028D27C /* sigtramp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigtramp.c; sourceTree = "<group>"; };
+               C9B53DB9138D9E9A0028D27C /* sigwait.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigwait.2; sourceTree = "<group>"; };
+               C9B53DBA138D9E9A0028D27C /* slot_name.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = slot_name.c; sourceTree = "<group>"; };
+               C9B53DBB138D9E9A0028D27C /* spinlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = spinlock.3; sourceTree = "<group>"; };
+               C9B53DBC138D9E9A0028D27C /* statx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = statx_np.c; sourceTree = "<group>"; };
+               C9B53DBD138D9E9A0028D27C /* SYSCALL-LIST */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SYSCALL-LIST"; sourceTree = "<group>"; };
+               C9B53DBE138D9E9A0028D27C /* umaskx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = umaskx_np.c; sourceTree = "<group>"; };
+               C9B53DC0138D9E9A0028D27C /* cprocs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cprocs.c; sourceTree = "<group>"; };
+               C9B53DC1138D9E9A0028D27C /* cthread_internals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cthread_internals.h; sourceTree = "<group>"; };
+               C9B53DC2138D9E9A0028D27C /* cthreads.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cthreads.c; sourceTree = "<group>"; };
+               C9B53DC3138D9E9A0028D27C /* cthreads.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cthreads.h; sourceTree = "<group>"; };
+               C9B53DC5138D9E9A0028D27C /* mig_support.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mig_support.c; sourceTree = "<group>"; };
+               C9B53DC7138D9E9A0028D27C /* fparseln.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fparseln.3; sourceTree = "<group>"; };
+               C9B53DC8138D9E9A0028D27C /* fparseln.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fparseln.c; sourceTree = "<group>"; };
+               C9B53DC9138D9E9A0028D27C /* login.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = login.3; sourceTree = "<group>"; };
+               C9B53DCA138D9E9A0028D27C /* login.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = login.c; sourceTree = "<group>"; };
+               C9B53DCB138D9E9A0028D27C /* login_tty.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = login_tty.c; sourceTree = "<group>"; };
+               C9B53DCC138D9E9A0028D27C /* logout.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = logout.c; sourceTree = "<group>"; };
+               C9B53DCD138D9E9A0028D27C /* logwtmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = logwtmp.c; sourceTree = "<group>"; };
+               C9B53DCF138D9E9A0028D27C /* opendev.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = opendev.3; sourceTree = "<group>"; };
+               C9B53DD0138D9E9A0028D27C /* opendev.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = opendev.c; sourceTree = "<group>"; };
+               C9B53DD1138D9E9A0028D27C /* openpty.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = openpty.3; sourceTree = "<group>"; };
+               C9B53DD2138D9E9A0028D27C /* pty.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pty.c; sourceTree = "<group>"; };
+               C9B53DD5138D9E9A0028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = "<group>"; };
+               C9B53DD6138D9E9A0028D27C /* uuid-config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "uuid-config.h"; sourceTree = "<group>"; };
+               C9B53DD7138D9E9A0028D27C /* uuidman.sed */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuidman.sed; sourceTree = "<group>"; };
+               C9B53DD9138D9E9A0028D27C /* clear.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clear.c; sourceTree = "<group>"; };
+               C9B53DDA138D9E9A0028D27C /* compare.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = compare.c; sourceTree = "<group>"; };
+               C9B53DDB138D9E9A0028D27C /* copy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = copy.c; sourceTree = "<group>"; };
+               C9B53DDC138D9E9A0028D27C /* gen_uuid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gen_uuid.c; sourceTree = "<group>"; };
+               C9B53DDE138D9E9A0028D27C /* isnull.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isnull.c; sourceTree = "<group>"; };
+               C9B53DDF138D9E9A0028D27C /* libuuid.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = libuuid.3.in; sourceTree = "<group>"; };
+               C9B53DE0138D9E9A0028D27C /* pack.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pack.c; sourceTree = "<group>"; };
+               C9B53DE1138D9E9A0028D27C /* parse.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = parse.c; sourceTree = "<group>"; };
+               C9B53DE2138D9E9A0028D27C /* unpack.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = unpack.c; sourceTree = "<group>"; };
+               C9B53DE3138D9E9A0028D27C /* unparse.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = unparse.c; sourceTree = "<group>"; };
+               C9B53DE5138D9E9A0028D27C /* uuid_clear.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_clear.3.in; sourceTree = "<group>"; };
+               C9B53DE6138D9E9A0028D27C /* uuid_compare.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_compare.3.in; sourceTree = "<group>"; };
+               C9B53DE7138D9E9A0028D27C /* uuid_copy.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_copy.3.in; sourceTree = "<group>"; };
+               C9B53DE8138D9E9A0028D27C /* uuid_generate.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_generate.3.in; sourceTree = "<group>"; };
+               C9B53DE9138D9E9A0028D27C /* uuid_is_null.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_is_null.3.in; sourceTree = "<group>"; };
+               C9B53DEA138D9E9A0028D27C /* uuid_parse.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_parse.3.in; sourceTree = "<group>"; };
+               C9B53DEB138D9E9A0028D27C /* uuid_unparse.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_unparse.3.in; sourceTree = "<group>"; };
+               C9B53DED138D9E9A0028D27C /* uuidP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uuidP.h; sourceTree = "<group>"; };
+               C9B53DF1138D9E9A0028D27C /* _ctx_start.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _ctx_start.S; sourceTree = "<group>"; };
+               C9B53DF2138D9E9A0028D27C /* _setcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setcontext.S; sourceTree = "<group>"; };
+               C9B53DF3138D9E9A0028D27C /* cpu_number.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cpu_number.s; sourceTree = "<group>"; };
+               C9B53DF4138D9E9A0028D27C /* getcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = getcontext.S; sourceTree = "<group>"; };
+               C9B53DF5138D9E9A0028D27C /* getmcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmcontext.c; sourceTree = "<group>"; };
+               C9B53DF6138D9E9A0028D27C /* icacheinval.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = icacheinval.s; sourceTree = "<group>"; };
+               C9B53DF7138D9E9A0028D27C /* makecontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makecontext.c; sourceTree = "<group>"; };
+               C9B53DF9138D9E9A0028D27C /* mcount.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mcount.s; sourceTree = "<group>"; };
+               C9B53DFA138D9E9A0028D27C /* setcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setcontext.c; sourceTree = "<group>"; };
+               C9B53DFB138D9E9A0028D27C /* swapcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swapcontext.c; sourceTree = "<group>"; };
+               C9B53DFE138D9E9A0028D27C /* preempt.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = preempt.s; sourceTree = "<group>"; };
+               C9B53DFF138D9E9A0028D27C /* pthread_getspecific.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_getspecific.s; sourceTree = "<group>"; };
+               C9B53E00138D9E9A0028D27C /* pthread_mutex_lock.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_mutex_lock.s; sourceTree = "<group>"; };
+               C9B53E01138D9E9A0028D27C /* pthread_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_self.s; sourceTree = "<group>"; };
+               C9B53E02138D9E9A0028D27C /* pthread_set_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_set_self.s; sourceTree = "<group>"; };
+               C9B53E03138D9E9A0028D27C /* start_wqthread.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = start_wqthread.s; sourceTree = "<group>"; };
+               C9B53E04138D9E9A0028D27C /* thread_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = thread_start.s; sourceTree = "<group>"; };
+               C9B53E08138D9E9A0028D27C /* __bzero.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = __bzero.s; sourceTree = "<group>"; };
+               C9B53E09138D9E9A0028D27C /* bcopy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = "<group>"; };
+               C9B53E0A138D9E9A0028D27C /* bcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse3x.s; sourceTree = "<group>"; };
+               C9B53E0B138D9E9A0028D27C /* bcopy_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse42.s; sourceTree = "<group>"; };
+               C9B53E0C138D9E9A0028D27C /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = "<group>"; };
+               C9B53E0D138D9E9A0028D27C /* bzero_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse2.s; sourceTree = "<group>"; };
+               C9B53E0E138D9E9A0028D27C /* bzero_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse42.s; sourceTree = "<group>"; };
+               C9B53E0F138D9E9A0028D27C /* ffs.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ffs.s; sourceTree = "<group>"; };
+               C9B53E10138D9E9A0028D27C /* longcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longcopy_sse3x.s; sourceTree = "<group>"; };
+               C9B53E12138D9E9A0028D27C /* memcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memcmp.s; sourceTree = "<group>"; };
+               C9B53E13138D9E9A0028D27C /* memcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy.c; sourceTree = "<group>"; };
+               C9B53E14138D9E9A0028D27C /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = "<group>"; };
+               C9B53E15138D9E9A0028D27C /* memset.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset.s; sourceTree = "<group>"; };
+               C9B53E16138D9E9A0028D27C /* strcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcmp.s; sourceTree = "<group>"; };
+               C9B53E17138D9E9A0028D27C /* strcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcpy.s; sourceTree = "<group>"; };
+               C9B53E18138D9E9A0028D27C /* strlcat.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcat.s; sourceTree = "<group>"; };
+               C9B53E19138D9E9A0028D27C /* strlcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcpy.s; sourceTree = "<group>"; };
+               C9B53E1A138D9E9A0028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = "<group>"; };
+               C9B53E1B138D9E9A0028D27C /* strncmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncmp.s; sourceTree = "<group>"; };
+               C9B53E1C138D9E9A0028D27C /* strncpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncpy.s; sourceTree = "<group>"; };
+               C9B53E1E138D9E9A0028D27C /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = "<group>"; };
+               C9B53E1F138D9E9A0028D27C /* _sigtramp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _sigtramp.s; sourceTree = "<group>"; };
+               C9B53E20138D9E9A0028D27C /* atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atomic.c; sourceTree = "<group>"; };
+               C9B53E21138D9E9A0028D27C /* i386_gettimeofday_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = i386_gettimeofday_asm.s; sourceTree = "<group>"; };
+               C9B53E23138D9E9A0028D27C /* nanotime.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = nanotime.s; sourceTree = "<group>"; };
+               C9B53E24138D9E9A0028D27C /* OSAtomic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = OSAtomic.s; sourceTree = "<group>"; };
+               C9B53E25138D9E9A0028D27C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = "<group>"; };
+               C9B53E26138D9E9A0028D27C /* spinlocks.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spinlocks.c; sourceTree = "<group>"; };
+               C9B53E27138D9E9A0028D27C /* spinlocks_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spinlocks_asm.s; sourceTree = "<group>"; };
+               C9B53E2C138DA0610028D27C /* libPlatform.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPlatform.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9C2A948138DF7DD00287F00 /* libc.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = libc.xcconfig; sourceTree = "<group>"; };
+               C9C2A94D138DFFD900287F00 /* libBase.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libBase.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9C62BDF13AA7F6A001FD88D /* OSAtomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic.h; sourceTree = "<group>"; };
+               C9CF595913CD0B9600674871 /* memset_pattern.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memset_pattern.c; sourceTree = "<group>"; };
+               C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = forceLibcToBuild.c; sourceTree = "<group>"; };
+               C9D9432F138DB73300FB7ACC /* libsystem_c.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libsystem_c.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9D94357138EC0C600FB7ACC /* heapsort_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = heapsort_b.c; sourceTree = "<group>"; };
+               C9D94358138EC0C600FB7ACC /* heapsort_r.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = heapsort_r.c; sourceTree = "<group>"; };
+               C9D94360138EC3E300FB7ACC /* libvCancelable.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvCancelable.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9EB2FC0138F6BB00075BB52 /* merge_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = merge_b.c; sourceTree = "<group>"; };
+               C9EB2FC3138F6C5C0075BB52 /* psort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort.c; sourceTree = "<group>"; };
+               C9EB2FC5138F6CE10075BB52 /* psort_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort_b.c; sourceTree = "<group>"; };
+               C9EB2FC6138F6CE10075BB52 /* psort_r.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort_r.c; sourceTree = "<group>"; };
+               C9EB3266138F6D880075BB52 /* libvLegacy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvLegacy.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9EB350D138F75580075BB52 /* libvInode32.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvInode32.a; sourceTree = BUILT_PRODUCTS_DIR; };
+               C9EB350E138F769B0075BB52 /* scandir_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scandir_b.c; sourceTree = "<group>"; };
+               C9EB354F138F7EA50075BB52 /* getmntinfo64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getmntinfo64.c; sourceTree = "<group>"; };
+               C9EB3555138F7F6A0075BB52 /* setjmperr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = setjmperr.c; sourceTree = "<group>"; };
+               C9FA32F8138E4A5C0089A94B /* utf2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf2.c; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               B122F2A91432B8E600AF95D0 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               B1E96502157E722200FCCEE7 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9257ECD138E1B5000B3107C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9258100138E2D3100B3107C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C94212C713900C8A004BA536 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C95B8171138F3C55004311DA /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C95B841C138F52B0004311DA /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C95B86C2138F53DB004311DA /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9B53E29138DA0610028D27C /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9C2A94A138DFFD900287F00 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9D9432C138DB73300FB7ACC /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9D9435D138EC3E300FB7ACC /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9EB3261138F6D880075BB52 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9EB3508138F75580075BB52 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               B122F2AE1432B95B00AF95D0 /* TRE */ = {
+                       isa = PBXGroup;
+                       children = (
+                               B122F2AF1432B95B00AF95D0 /* config.h */,
+                               B122F2B01432B95B00AF95D0 /* lib */,
+                               B122F2C31432B95B00AF95D0 /* tre-0.8.0.tar.bz2 */,
+                               B122F2C41432B95B00AF95D0 /* tre-config.h */,
+                               B122F2C51432B95B00AF95D0 /* tre-last-matched.h */,
+                       );
+                       path = TRE;
+                       sourceTree = "<group>";
+               };
+               B122F2B01432B95B00AF95D0 /* lib */ = {
+                       isa = PBXGroup;
+                       children = (
+                               B122F2B11432B95B00AF95D0 /* regcomp.c */,
+                               B122F2B21432B95B00AF95D0 /* regexec.c */,
+                               B122F2B31432B95B00AF95D0 /* tre-ast.c */,
+                               B122F2B41432B95B00AF95D0 /* tre-ast.h */,
+                               B122F2B51432B95B00AF95D0 /* tre-compile.c */,
+                               B122F2B61432B95B00AF95D0 /* tre-compile.h */,
+                               B122F2B71432B95B00AF95D0 /* tre-internal.h */,
+                               B122F2B81432B95B00AF95D0 /* tre-match-backtrack.c */,
+                               B122F2B91432B95B00AF95D0 /* tre-match-parallel.c */,
+                               B122F2BA1432B95B00AF95D0 /* tre-match-utils.h */,
+                               B122F2BB1432B95B00AF95D0 /* tre-mem.c */,
+                               B122F2BC1432B95B00AF95D0 /* tre-mem.h */,
+                               B122F2BD1432B95B00AF95D0 /* tre-parse.c */,
+                               B122F2BE1432B95B00AF95D0 /* tre-parse.h */,
+                               B122F2BF1432B95B00AF95D0 /* tre-stack.c */,
+                               B122F2C01432B95B00AF95D0 /* tre-stack.h */,
+                               B122F2C11432B95B00AF95D0 /* tre.h */,
+                               B122F2C21432B95B00AF95D0 /* xmalloc.h */,
+                       );
+                       path = lib;
+                       sourceTree = "<group>";
+               };
+               C9B53595138D9A690028D27C = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535AE138D9E980028D27C /* APPLE_LICENSE */,
+                               C9B535AF138D9E980028D27C /* arm */,
+                               C9B535F5138D9E980028D27C /* compat-43 */,
+                               C9B53612138D9E980028D27C /* darwin */,
+                               C9B5361D138D9E980028D27C /* db */,
+                               C9B5366C138D9E980028D27C /* emulated */,
+                               C9B5367C138D9E980028D27C /* fbsdcompat */,
+                               C9B5368D138D9E980028D27C /* gdtoa */,
+                               C9B536C0138D9E980028D27C /* gen */,
+                               C9B5380A138D9E990028D27C /* gmon */,
+                               C9B5380F138D9E990028D27C /* i386 */,
+                               C9B5384F138D9E990028D27C /* include */,
+                               C9B538FE138D9E990028D27C /* locale */,
+                               C9B53A04138D9E990028D27C /* man */,
+                               C9B53A0E138D9E990028D27C /* nbsdcompat */,
+                               C9B53A11138D9E990028D27C /* net */,
+                               C9B53A3A138D9E990028D27C /* nls */,
+                               C9B53A45138D9E990028D27C /* Platforms */,
+                               C9B53A4A138D9E990028D27C /* posix1e */,
+                               C9B53ABA138D9E990028D27C /* pthreads */,
+                               C9B53B03138D9E990028D27C /* regex */,
+                               C9B53B1B138D9E990028D27C /* rpc */,
+                               C9B53B1D138D9E990028D27C /* secure */,
+                               C9B53B2D138D9E990028D27C /* stdio */,
+                               C9B53C16138D9E9A0028D27C /* stdlib */,
+                               C9B53CC0138D9E9A0028D27C /* stdtime */,
+                               C9B53CE4138D9E9A0028D27C /* string */,
+                               C9B53D93138D9E9A0028D27C /* sys */,
+                               C9B53DBF138D9E9A0028D27C /* threads */,
+                               C9B53DC6138D9E9A0028D27C /* util */,
+                               C9B53DD3138D9E9A0028D27C /* uuid */,
+                               C9B53DEF138D9E9A0028D27C /* x86_64 */,
+                               C9C2A946138DF66900287F00 /* xcodescripts */,
+                               C9B535A9138D9E890028D27C /* Products */,
+                               C965CBF1143BBEC7003912CE /* deps.c */,
+                       );
+                       indentWidth = 4;
+                       sourceTree = "<group>";
+                       tabWidth = 4;
+                       usesTabs = 1;
+               };
+               C9B535A9138D9E890028D27C /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53E2C138DA0610028D27C /* libPlatform.a */,
+                               C9D9432F138DB73300FB7ACC /* libsystem_c.dylib */,
+                               C9C2A94D138DFFD900287F00 /* libBase.a */,
+                               C9257ED0138E1B5000B3107C /* libFreeBSD.a */,
+                               C9258105138E2D3100B3107C /* libNetBSD.a */,
+                               C9D94360138EC3E300FB7ACC /* libvCancelable.a */,
+                               C95B8176138F3C55004311DA /* libvDarwinExtsn.a */,
+                               C95B8421138F52B0004311DA /* libvDarwinExtsnCancelable.a */,
+                               C95B86C7138F53DB004311DA /* libvPre1050.a */,
+                               C9EB3266138F6D880075BB52 /* libvLegacy.a */,
+                               C9EB350D138F75580075BB52 /* libvInode32.a */,
+                               C94212CC13900C8A004BA536 /* libc.a */,
+                               B122F2AD1432B8E600AF95D0 /* libTRE.a */,
+                               B1E96506157E722200FCCEE7 /* libFreeBSD_gcc.a */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+               C9B535AF138D9E980028D27C /* arm */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535B0138D9E980028D27C /* gen */,
+                               C9B535B5138D9E980028D27C /* pthreads */,
+                               C9B535BF138D9E980028D27C /* string */,
+                               C9B535D4138D9E980028D27C /* sys */,
+                       );
+                       path = arm;
+                       sourceTree = "<group>";
+               };
+               C9B535B0138D9E980028D27C /* gen */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535B1138D9E980028D27C /* cpu_number.s */,
+                               C9B535B2138D9E980028D27C /* icacheinval.s */,
+                       );
+                       path = gen;
+                       sourceTree = "<group>";
+               };
+               C9B535B5138D9E980028D27C /* pthreads */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */,
+                               C9B535B8138D9E980028D27C /* pthread_getspecific.s */,
+                               C9B535B9138D9E980028D27C /* pthread_self.s */,
+                               C9B535BA138D9E980028D27C /* pthread_set_self.s */,
+                               C9B535BB138D9E980028D27C /* start_wqthread.s */,
+                               C9B535BC138D9E980028D27C /* thread_start.s */,
+                       );
+                       path = pthreads;
+                       sourceTree = "<group>";
+               };
+               C9B535BF138D9E980028D27C /* string */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535C0138D9E980028D27C /* bcopy_CortexA8.s */,
+                               C9B535C1138D9E980028D27C /* bcopy_CortexA9.s */,
+                               6358199213B53ECB00CDF61C /* bcopy_Swift.s */,
+                               C9B535C2138D9E980028D27C /* bcopy_Generic.s */,
+                               C9B535C3138D9E980028D27C /* bzero_CortexA8.s */,
+                               C9B535C4138D9E980028D27C /* bzero_CortexA9.s */,
+                               6358199013B53DD800CDF61C /* bzero_Swift.s */,
+                               C9B535C5138D9E980028D27C /* bzero_Generic.s */,
+                               C9B535C6138D9E980028D27C /* dyld_resolvers.c */,
+                               C9B535C7138D9E980028D27C /* ffs.s */,
+                               C9B535C9138D9E980028D27C /* memcmp.s */,
+                               C9B535CA138D9E980028D27C /* memset_pattern.s */,
+                               634C4C3713BCEADC008CA66D /* memset_pattern_Swift.s */,
+                               C9B535CB138D9E980028D27C /* strchr.s */,
+                               C9B535CC138D9E980028D27C /* strcmp.s */,
+                               C9B535CF138D9E980028D27C /* strlen.s */,
+                               C9B535D0138D9E980028D27C /* strncmp.s */,
+                               C9B535D2138D9E980028D27C /* strnlen.s */,
+                               C9B535D3138D9E980028D27C /* strstr.s */,
+                       );
+                       path = string;
+                       sourceTree = "<group>";
+               };
+               C9B535D4138D9E980028D27C /* sys */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535D5138D9E980028D27C /* _longjmp.s */,
+                               C9B535D6138D9E980028D27C /* _setjmp.h */,
+                               C9B535D7138D9E980028D27C /* _setjmp.s */,
+                               C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */,
+                               C9B535D9138D9E980028D27C /* gcc_atomic.c */,
+                               C9B535DA138D9E980028D27C /* longjmp.s */,
+                               C9B535DB138D9E980028D27C /* mach_absolute_time.s */,
+                               C9B535DD138D9E980028D27C /* OSAtomic-v4.c */,
+                               C9C62BDF13AA7F6A001FD88D /* OSAtomic.h */,
+                               C9B4E3D713BBBF2D0008A9BB /* OSAtomic.c */,
+                               C995462713AAA25000A531B4 /* OSAtomicUP.c */,
+                               C97C344013AB0E1B00713550 /* Spinlocks.c */,
+                               C980F8EB13AB168D0069AB06 /* SpinlocksUP.c */,
+                               C932C2CF13AB1C73004EDA12 /* SpinlocksWFE.c */,
+                               C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */,
+                               C9B535E0138D9E980028D27C /* OSAtomic_resolvers.h */,
+                               C9B535E1138D9E980028D27C /* setjmp.s */,
+                       );
+                       path = sys;
+                       sourceTree = "<group>";
+               };
+               C9B535F5138D9E980028D27C /* compat-43 */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535F6138D9E980028D27C /* FreeBSD */,
+                               C9B5360A138D9E980028D27C /* setregid.c */,
+                               C9B5360B138D9E980028D27C /* setreuid.c */,
+                               C9B5360C138D9E980028D27C /* sigaltstk.c */,
+                               C9B5360D138D9E980028D27C /* sigblock.2 */,
+                               C9B5360E138D9E980028D27C /* sigcompat.c */,
+                               C9B5360F138D9E980028D27C /* sigpause.2 */,
+                               C9B53610138D9E980028D27C /* sigsetmask.2 */,
+                               C9B53611138D9E980028D27C /* sigvec.2 */,
+                       );
+                       path = "compat-43";
+                       sourceTree = "<group>";
+               };
+               C9B535F6138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B535F7138D9E980028D27C /* creat.2 */,
+                               C9B535FA138D9E980028D27C /* gethostid.3 */,
+                               C9B535FF138D9E980028D27C /* killpg.2 */,
+                               C9B53607138D9E980028D27C /* setruid.3 */,
+                               C9B535F8138D9E980028D27C /* creat.c */,
+                               C9B535FC138D9E980028D27C /* gethostid.c */,
+                               C9B535FE138D9E980028D27C /* getwd.c */,
+                               C9B53601138D9E980028D27C /* killpg.c */,
+                               C9B53603138D9E980028D27C /* sethostid.c */,
+                               C9B53604138D9E980028D27C /* setpgrp.c */,
+                               C9B53606138D9E980028D27C /* setrgid.c */,
+                               C9B53608138D9E980028D27C /* setruid.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53612138D9E980028D27C /* darwin */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53613138D9E980028D27C /* _dirhelper.c */,
+                               C9B53614138D9E980028D27C /* dirhelper.defs */,
+                               C9B53615138D9E980028D27C /* dirhelper_priv.h */,
+                               C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */,
+                               C9B53616138D9E980028D27C /* kvm.c */,
+                               C9B53617138D9E980028D27C /* libproc.c */,
+                               C9B53618138D9E980028D27C /* libproc.h */,
+                               C9B53619138D9E980028D27C /* libproc_internal.h */,
+                               C9B5361C138D9E980028D27C /* proc_listpidspath.c */,
+                               C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */,
+                               C9B4E3D513BBBF060008A9BB /* OSAtomicLoadStoreEx.c */,
+                               C9B4E3D913BBC24E0008A9BB /* SpinlocksLoadStoreEx.c */,
+                       );
+                       path = darwin;
+                       sourceTree = "<group>";
+               };
+               C9B5361D138D9E980028D27C /* db */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5361E138D9E980028D27C /* btree */,
+                               C9B53634138D9E980028D27C /* db */,
+                               C9B53638138D9E980028D27C /* hash */,
+                               C9B5364E138D9E980028D27C /* man */,
+                               C9B53658138D9E980028D27C /* mpool */,
+                               C9B5365D138D9E980028D27C /* recno */,
+                       );
+                       path = db;
+                       sourceTree = "<group>";
+               };
+               C9B5361E138D9E980028D27C /* btree */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5361F138D9E980028D27C /* FreeBSD */,
+                       );
+                       path = btree;
+                       sourceTree = "<group>";
+               };
+               C9B5361F138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53620138D9E980028D27C /* bt_close.c */,
+                               C9B53621138D9E980028D27C /* bt_conv.c */,
+                               C9B53622138D9E980028D27C /* bt_debug.c */,
+                               C9B53623138D9E980028D27C /* bt_delete.c */,
+                               C9B53624138D9E980028D27C /* bt_get.c */,
+                               C9B53625138D9E980028D27C /* bt_open.c */,
+                               C9B53626138D9E980028D27C /* bt_overflow.c */,
+                               C9B53628138D9E980028D27C /* bt_page.c */,
+                               C9B53629138D9E980028D27C /* bt_put.c */,
+                               C9B5362A138D9E980028D27C /* bt_search.c */,
+                               C9B5362B138D9E980028D27C /* bt_seq.c */,
+                               C9B5362D138D9E980028D27C /* bt_split.c */,
+                               C9B5362F138D9E980028D27C /* bt_utils.c */,
+                               C9B53630138D9E980028D27C /* btree.h */,
+                               C9B53632138D9E980028D27C /* bt_extern.h */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53634138D9E980028D27C /* db */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53635138D9E980028D27C /* FreeBSD */,
+                       );
+                       path = db;
+                       sourceTree = "<group>";
+               };
+               C9B53635138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53636138D9E980028D27C /* db.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53638138D9E980028D27C /* hash */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53639138D9E980028D27C /* FreeBSD */,
+                       );
+                       path = hash;
+                       sourceTree = "<group>";
+               };
+               C9B53639138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5363A138D9E980028D27C /* hash_extern.h */,
+                               C9B5363B138D9E980028D27C /* hash.c */,
+                               C9B5363D138D9E980028D27C /* hash.h */,
+                               C9B5363F138D9E980028D27C /* hash_bigkey.c */,
+                               C9B53641138D9E980028D27C /* hash_buf.c */,
+                               C9B53643138D9E980028D27C /* hash_func.c */,
+                               C9B53645138D9E980028D27C /* hash_log2.c */,
+                               C9B53647138D9E980028D27C /* hash_page.c */,
+                               C9B53649138D9E980028D27C /* ndbm.c */,
+                               C9B5364B138D9E980028D27C /* page.h */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B5364E138D9E980028D27C /* man */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5364F138D9E980028D27C /* FreeBSD */,
+                       );
+                       path = man;
+                       sourceTree = "<group>";
+               };
+               C9B5364F138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53650138D9E980028D27C /* btree.3 */,
+                               C9B53651138D9E980028D27C /* dbm.3 */,
+                               C9B53653138D9E980028D27C /* dbopen.3 */,
+                               C9B53654138D9E980028D27C /* hash.3 */,
+                               C9B53655138D9E980028D27C /* mpool.3 */,
+                               C9B53656138D9E980028D27C /* recno.3 */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53658138D9E980028D27C /* mpool */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53659138D9E980028D27C /* FreeBSD */,
+                       );
+                       path = mpool;
+                       sourceTree = "<group>";
+               };
+               C9B53659138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5365A138D9E980028D27C /* mpool.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B5365D138D9E980028D27C /* recno */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5365E138D9E980028D27C /* FreeBSD */,
+                       );
+                       path = recno;
+                       sourceTree = "<group>";
+               };
+               C9B5365E138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5365F138D9E980028D27C /* rec_extern.h */,
+                               C9B53661138D9E980028D27C /* rec_close.c */,
+                               C9B53662138D9E980028D27C /* rec_delete.c */,
+                               C9B53663138D9E980028D27C /* rec_get.c */,
+                               C9B53664138D9E980028D27C /* rec_open.c */,
+                               C9B53665138D9E980028D27C /* rec_put.c */,
+                               C9B53666138D9E980028D27C /* rec_search.c */,
+                               C9B53667138D9E980028D27C /* rec_seq.c */,
+                               C9B53668138D9E980028D27C /* rec_utils.c */,
+                               C9B53669138D9E980028D27C /* recno.h */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B5366C138D9E980028D27C /* emulated */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5366D138D9E980028D27C /* brk.2 */,
+                               C9B5366E138D9E980028D27C /* brk.c */,
+                               C9B5366F138D9E980028D27C /* bsd_signal.3 */,
+                               C9B53670138D9E980028D27C /* bsd_signal.c */,
+                               C9B53671138D9E980028D27C /* lchflags.3 */,
+                               C9B53672138D9E980028D27C /* lchflags.c */,
+                               C9B53673138D9E980028D27C /* lchmod.3 */,
+                               C9B53674138D9E980028D27C /* lchmod.c */,
+                               C9B53675138D9E980028D27C /* lutimes.3 */,
+                               C9B53676138D9E980028D27C /* lutimes.c */,
+                               C9B53678138D9E980028D27C /* statvfs.3 */,
+                               C9B53679138D9E980028D27C /* statvfs.c */,
+                               C9B5367A138D9E980028D27C /* tcgetsid.3 */,
+                               C9B5367B138D9E980028D27C /* tcgetsid.c */,
+                       );
+                       path = emulated;
+                       sourceTree = "<group>";
+               };
+               C9B5367C138D9E980028D27C /* fbsdcompat */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5367D138D9E980028D27C /* _fbsd_compat_.h */,
+                               C9B5367E138D9E980028D27C /* _fpmath.h */,
+                               C9B5367F138D9E980028D27C /* fpmath.h */,
+                               C9B53680138D9E980028D27C /* libc_private.h */,
+                               C9B53681138D9E980028D27C /* machine */,
+                               C9B53683138D9E980028D27C /* namespace.h */,
+                               C9B53684138D9E980028D27C /* port_after.h */,
+                               C9B53685138D9E980028D27C /* port_before.h */,
+                               C9B53686138D9E980028D27C /* reentrant.h */,
+                               C9B53687138D9E980028D27C /* spinlock.h */,
+                               C9B53688138D9E980028D27C /* sys */,
+                               C9B5368B138D9E980028D27C /* un-namespace.h */,
+                       );
+                       path = fbsdcompat;
+                       sourceTree = "<group>";
+               };
+               C9B53681138D9E980028D27C /* machine */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53682138D9E980028D27C /* atomic.h */,
+                       );
+                       path = machine;
+                       sourceTree = "<group>";
+               };
+               C9B53688138D9E980028D27C /* sys */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53689138D9E980028D27C /* cdefs.h */,
+                               C9B5368A138D9E980028D27C /* endian.h */,
+                       );
+                       path = sys;
+                       sourceTree = "<group>";
+               };
+               C9B5368D138D9E980028D27C /* gdtoa */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5368E138D9E980028D27C /* _ldbl_util.c */,
+                               C9B5368F138D9E980028D27C /* arith.h */,
+                               C9B53690138D9E980028D27C /* FreeBSD */,
+                               C9B536BD138D9E980028D27C /* gd_qnan.h */,
+                               C9B536BE138D9E980028D27C /* gdtoa.tgz */,
+                       );
+                       path = gdtoa;
+                       sourceTree = "<group>";
+               };
+               C9B53690138D9E980028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53691138D9E980028D27C /* _hdtoa.c */,
+                               C9B53693138D9E980028D27C /* _ldtoa.c */,
+                               C9B53695138D9E980028D27C /* gdtoa-dmisc.c */,
+                               C9B53696138D9E980028D27C /* gdtoa-dtoa.c */,
+                               C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */,
+                               C9B53698138D9E980028D27C /* gdtoa-gethex.c */,
+                               C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */,
+                               C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */,
+                               C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */,
+                               C9B5369E138D9E980028D27C /* gdtoa-misc.c */,
+                               C9B536A0138D9E980028D27C /* gdtoa-smisc.c */,
+                               C9B536A1138D9E980028D27C /* gdtoa-strtod.c */,
+                               C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */,
+                               C9B536A5138D9E980028D27C /* gdtoa-strtof.c */,
+                               C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */,
+                               C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */,
+                               C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */,
+                               C9B536AC138D9E980028D27C /* gdtoa-strtord.c */,
+                               C9B536AE138D9E980028D27C /* gdtoa-sum.c */,
+                               C9B536AF138D9E980028D27C /* gdtoa-ulp.c */,
+                               C9B536B0138D9E980028D27C /* gdtoa.h */,
+                               C9B536B2138D9E980028D27C /* gdtoa_fltrnds.h */,
+                               C9B536B3138D9E980028D27C /* gdtoaimp.h */,
+                               C9B536B5138D9E980028D27C /* glue.c */,
+                               C9B536B6138D9E980028D27C /* machdep_ldisd.c */,
+                               C9B536B8138D9E980028D27C /* machdep_ldisdd.c */,
+                               C9B536BA138D9E980028D27C /* machdep_ldisQ.c */,
+                               C9B536BB138D9E980028D27C /* machdep_ldisx.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B536C0138D9E980028D27C /* gen */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B536C1138D9E990028D27C /* __dirent.h */,
+                               C9B536C2138D9E990028D27C /* _simple.c */,
+                               C9B536C3138D9E990028D27C /* _simple.h */,
+                               C9B536C4138D9E990028D27C /* asl.3 */,
+                               C9B536C5138D9E990028D27C /* asl.c */,
+                               C9B536C6138D9E990028D27C /* asl_core.c */,
+                               C9B536C7138D9E990028D27C /* asl_core.h */,
+                               3F2208E714358B4A00386F5B /* asl_fd.c */,
+                               C9B536C8138D9E990028D27C /* asl_file.c */,
+                               C9B536C9138D9E990028D27C /* asl_file.h */,
+                               C9B536CA138D9E990028D27C /* asl_ipc.defs */,
+                               C9B536CB138D9E990028D27C /* asl_legacy1.c */,
+                               C9B536CC138D9E990028D27C /* asl_legacy1.h */,
+                               C9B536CD138D9E990028D27C /* asl_msg.c */,
+                               C9B536CE138D9E990028D27C /* asl_msg.h */,
+                               C9B536CF138D9E990028D27C /* asl_private.h */,
+                               C9B536D0138D9E990028D27C /* asl_store.c */,
+                               C9B536D1138D9E990028D27C /* asl_store.h */,
+                               C9B536D2138D9E990028D27C /* asl_util.c */,
+                               C9B536D3138D9E990028D27C /* assumes.c */,
+                               C9B536D4138D9E990028D27C /* assumes.h */,
+                               C9B536D5138D9E990028D27C /* authentication.c */,
+                               C9B536D6138D9E990028D27C /* backtrace.3 */,
+                               C9B536D7138D9E990028D27C /* backtrace.c */,
+                               C9B536D8138D9E990028D27C /* cache.c */,
+                               C9B536D9138D9E990028D27C /* compat.5 */,
+                               C9B536DA138D9E990028D27C /* confstr.3 */,
+                               C9B536DB138D9E990028D27C /* confstr.c */,
+                               C9B536DC138D9E990028D27C /* crypt.3 */,
+                               C9B536DD138D9E990028D27C /* crypt.c */,
+                               C9B536DE138D9E990028D27C /* devname.3 */,
+                               C9B536DF138D9E990028D27C /* devname.c */,
+                               C9B536E0138D9E990028D27C /* directory.3 */,
+                               3FB7E1B4146EF2E000843438 /* dirfd.c */,
+                               C9B536E1138D9E990028D27C /* disklabel.c */,
+                               C9B536E2138D9E990028D27C /* errlst.c */,
+                               C9B536E3138D9E990028D27C /* execinfo.h */,
+                               C9B536E4138D9E990028D27C /* filesec.c */,
+                               C9B536E5138D9E990028D27C /* FreeBSD */,
+                               C9B537C3138D9E990028D27C /* fts.3 */,
+                               C9B537C4138D9E990028D27C /* fts.c */,
+                               C9B537C5138D9E990028D27C /* ftw.3 */,
+                               C9B537C6138D9E990028D27C /* get_compat.c */,
+                               C9B537C7138D9E990028D27C /* get_compat.h */,
+                               C9B537C8138D9E990028D27C /* getdomainname.3 */,
+                               C9B537C9138D9E990028D27C /* getloadavg.3 */,
+                               C9B537CA138D9E990028D27C /* getloadavg.c */,
+                               C9B537CB138D9E990028D27C /* getttyent.3 */,
+                               C9B537CC138D9E990028D27C /* getttyent.c */,
+                               C9B537CD138D9E990028D27C /* getusershell.3 */,
+                               C9B537CE138D9E990028D27C /* getusershell.c */,
+                               C9B537CF138D9E990028D27C /* getvfsbyname.3 */,
+                               C9B537D0138D9E990028D27C /* getvfsbyname.c */,
+                               C9B537D1138D9E990028D27C /* intro.3 */,
+                               C9B537D2138D9E990028D27C /* isinf.c */,
+                               C9B537D3138D9E990028D27C /* isnan.c */,
+                               C9B537D4138D9E990028D27C /* magazine_malloc.c */,
+                               C9B537D5138D9E990028D27C /* magmallocProvider.d */,
+                               C9B537D7138D9E990028D27C /* malloc.3 */,
+                               C9B537D8138D9E990028D27C /* malloc.c */,
+                               C9B537D9138D9E990028D27C /* malloc_printf.h */,
+                               C9B537DA138D9E990028D27C /* malloc_size.3 */,
+                               C9B537DB138D9E990028D27C /* malloc_zone_malloc.3 */,
+                               C9B537DC138D9E990028D27C /* nanosleep.c */,
+                               C9B537DD138D9E990028D27C /* NetBSD */,
+                               C9B537E6138D9E990028D27C /* nftw.c */,
+                               C9B537E7138D9E990028D27C /* nlist.3 */,
+                               C9B537E8138D9E990028D27C /* nlist.c */,
+                               C9B537E9138D9E990028D27C /* NSSystemDirectories.c */,
+                               C9B537EA138D9E990028D27C /* oldsyslog.c */,
+                               C9B537EB138D9E990028D27C /* platfunc.c */,
+                               C9B537EC138D9E990028D27C /* platfunc.h */,
+                               C9B537ED138D9E990028D27C /* posix_memalign.3 */,
+                               C9B537EE138D9E990028D27C /* pwcache.3 */,
+                               C9B537EF138D9E990028D27C /* scalable_malloc.c */,
+                               C9B537F0138D9E990028D27C /* scalable_malloc.h */,
+                               C9B537F1138D9E990028D27C /* setjmp.3 */,
+                               C9B537F2138D9E990028D27C /* setlogin.c */,
+                               C9B537F3138D9E990028D27C /* sigsetops.3 */,
+                               C9B537F4138D9E990028D27C /* sigsetops.c */,
+                               C9B537F5138D9E990028D27C /* stack_logging.c */,
+                               C9B537F6138D9E990028D27C /* stack_logging.h */,
+                               C9B537F7138D9E990028D27C /* stack_logging_disk.c */,
+                               C9B537F8138D9E990028D27C /* strtofflags.3 */,
+                               C9B537F9138D9E990028D27C /* strtofflags.c */,
+                               B19C64591450F8B900032373 /* sync_volume_np.3 */,
+                               B19C645B1450F90200032373 /* sync_volume_np.c */,
+                               C9B537FA138D9E990028D27C /* syslog.3 */,
+                               C9B537FB138D9E990028D27C /* syslog.c */,
+                               C9B537FC138D9E990028D27C /* tcgetpgrp.3 */,
+                               C9B537FD138D9E990028D27C /* tcsendbreak.3 */,
+                               C9B537FE138D9E990028D27C /* tcsetattr.3 */,
+                               C9B537FF138D9E990028D27C /* tcsetpgrp.3 */,
+                               C9B53800138D9E990028D27C /* thread_stack_pcs.c */,
+                               C9B53801138D9E990028D27C /* tzset.3 */,
+                               C9B53802138D9E990028D27C /* uname.3 */,
+                               C9B53803138D9E990028D27C /* uname.c */,
+                               C9B53804138D9E990028D27C /* utmpx-darwin.c */,
+                               C9B53805138D9E990028D27C /* utmpx-darwin.h */,
+                               C9B53806138D9E990028D27C /* utmpx_thread.h */,
+                               C9B53807138D9E990028D27C /* wordexp.3 */,
+                               C9B53808138D9E990028D27C /* wordexp.c */,
+                       );
+                       path = gen;
+                       sourceTree = "<group>";
+               };
+               C9B536E5138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9EB354F138F7EA50075BB52 /* getmntinfo64.c */,
+                               C9EB350E138F769B0075BB52 /* scandir_b.c */,
+                               C9B536E8138D9E990028D27C /* alarm.3 */,
+                               C9B536EB138D9E990028D27C /* arc4random.3 */,
+                               C9B536F0138D9E990028D27C /* basename.3 */,
+                               C9B536F4138D9E990028D27C /* clock.3 */,
+                               C9B536F8138D9E990028D27C /* ctermid.3 */,
+                               C9B536FB138D9E990028D27C /* daemon.3 */,
+                               C9B536FF138D9E990028D27C /* dirname.3 */,
+                               C9B53707138D9E990028D27C /* err.3 */,
+                               C9B5370B138D9E990028D27C /* exec.3 */,
+                               C9B5370F138D9E990028D27C /* fmtcheck.3 */,
+                               C9B53711138D9E990028D27C /* fmtmsg.3 */,
+                               C9B53714138D9E990028D27C /* fnmatch.3 */,
+                               C9B53718138D9E990028D27C /* ftok.3 */,
+                               C9B5371B138D9E990028D27C /* getbsize.3 */,
+                               C9B5371D138D9E990028D27C /* getcap.3 */,
+                               C9B536E6138D9E990028D27C /* _rand48.c */,
+                               C9B536EA138D9E990028D27C /* alarm.c */,
+                               C9B536EC138D9E990028D27C /* arc4random.c */,
+                               C9B536EE138D9E990028D27C /* assert.c */,
+                               C9B536F2138D9E990028D27C /* basename.c */,
+                               C9B536F5138D9E990028D27C /* clock.c */,
+                               C9B536F6138D9E990028D27C /* closedir.c */,
+                               C9B536FA138D9E990028D27C /* ctermid.c */,
+                               C9B536FD138D9E990028D27C /* daemon.c */,
+                               C9B53701138D9E990028D27C /* dirname.c */,
+                               C9B53703138D9E990028D27C /* drand48.c */,
+                               C9B53705138D9E990028D27C /* erand48.c */,
+                               C9B53709138D9E990028D27C /* err.c */,
+                               C9B5370D138D9E990028D27C /* exec.c */,
+                               C9B53710138D9E990028D27C /* fmtcheck.c */,
+                               C9B53712138D9E990028D27C /* fmtmsg.c */,
+                               C9B53716138D9E990028D27C /* fnmatch.c */,
+                               C9B5371A138D9E990028D27C /* ftok.c */,
+                               C9B5371C138D9E990028D27C /* getbsize.c */,
+                               C9B5371E138D9E990028D27C /* getcap.c */,
+                               C9B53720138D9E990028D27C /* getcontext.3 */,
+                               C9B53721138D9E990028D27C /* getcwd.3 */,
+                               C9B53722138D9E990028D27C /* getcwd.c */,
+                               C9B53724138D9E990028D27C /* gethostname.3 */,
+                               C9B53726138D9E990028D27C /* gethostname.c */,
+                               C9B53728138D9E990028D27C /* getlogin.c */,
+                               C9B5372A138D9E990028D27C /* getmntinfo.3 */,
+                               C9B5372C138D9E990028D27C /* getmntinfo.c */,
+                               C9B5372E138D9E990028D27C /* getpagesize.3 */,
+                               C9B5372F138D9E990028D27C /* getpagesize.c */,
+                               C9B53730138D9E990028D27C /* getpass.3 */,
+                               C9B53731138D9E990028D27C /* getpeereid.3 */,
+                               C9B53732138D9E990028D27C /* getpeereid.c */,
+                               C9B53733138D9E990028D27C /* getprogname.3 */,
+                               C9B53735138D9E990028D27C /* getprogname.c */,
+                               C9B53737138D9E990028D27C /* glob.3 */,
+                               C9B53739138D9E990028D27C /* glob.c */,
+                               C9B5373B138D9E990028D27C /* isatty.c */,
+                               C9B5373D138D9E990028D27C /* jrand48.c */,
+                               C9B5373F138D9E990028D27C /* lcong48.c */,
+                               C9B53741138D9E990028D27C /* lockf.3 */,
+                               C9B53743138D9E990028D27C /* lockf.c */,
+                               C9B53745138D9E990028D27C /* lrand48.c */,
+                               C9B53747138D9E990028D27C /* makecontext.3 */,
+                               C9B53749138D9E990028D27C /* mrand48.c */,
+                               C9B5374B138D9E990028D27C /* nice.3 */,
+                               C9B5374C138D9E990028D27C /* nice.c */,
+                               C9B5374E138D9E990028D27C /* nrand48.c */,
+                               C9B53750138D9E990028D27C /* opendir.c */,
+                               C9B53752138D9E990028D27C /* pause.3 */,
+                               C9B53753138D9E990028D27C /* pause.c */,
+                               C9B53755138D9E990028D27C /* popen.3 */,
+                               C9B53757138D9E990028D27C /* popen.c */,
+                               C9B53759138D9E990028D27C /* pselect.3 */,
+                               C9B5375B138D9E990028D27C /* pselect.c */,
+                               C9B5375D138D9E990028D27C /* psignal.3 */,
+                               C9B5375F138D9E990028D27C /* psignal.c */,
+                               C9B53760138D9E990028D27C /* raise.3 */,
+                               C9B53761138D9E990028D27C /* raise.c */,
+                               C9B53762138D9E990028D27C /* rand48.3 */,
+                               C9B53764138D9E990028D27C /* rand48.h */,
+                               C9B53766138D9E990028D27C /* readdir.c */,
+                               C9B53768138D9E990028D27C /* readpassphrase.3 */,
+                               C9B53769138D9E990028D27C /* readpassphrase.c */,
+                               C9B5376B138D9E990028D27C /* rewinddir.c */,
+                               C9B5376C138D9E990028D27C /* scandir.3 */,
+                               C9B5376E138D9E990028D27C /* scandir.c */,
+                               C9B53771138D9E990028D27C /* seed48.c */,
+                               C9B53773138D9E990028D27C /* seekdir.c */,
+                               C9B53774138D9E990028D27C /* sethostname.c */,
+                               C9B53775138D9E990028D27C /* setmode.3 */,
+                               C9B53776138D9E990028D27C /* setmode.c */,
+                               C9B53778138D9E990028D27C /* setprogname.c */,
+                               C9B5377A138D9E990028D27C /* siginterrupt.3 */,
+                               C9B5377C138D9E990028D27C /* siginterrupt.c */,
+                               C9B5377D138D9E990028D27C /* siglist.c */,
+                               C9B5377F138D9E990028D27C /* signal.3 */,
+                               C9B53781138D9E990028D27C /* signal.c */,
+                               C9B53783138D9E990028D27C /* signbit.3 */,
+                               C9B53785138D9E990028D27C /* sleep.3 */,
+                               C9B53787138D9E990028D27C /* sleep.c */,
+                               C9B53789138D9E990028D27C /* srand48.c */,
+                               C9B5378B138D9E990028D27C /* stringlist.3 */,
+                               C9B5378C138D9E990028D27C /* stringlist.c */,
+                               C9B5378D138D9E990028D27C /* sysconf.3 */,
+                               C9B5378E138D9E990028D27C /* sysconf.c */,
+                               C9B53790138D9E990028D27C /* sysctl.3 */,
+                               C9B53792138D9E990028D27C /* sysctl.c */,
+                               C9B53794138D9E990028D27C /* sysctlbyname.c */,
+                               C9B53795138D9E990028D27C /* sysctlnametomib.c */,
+                               C9B53796138D9E990028D27C /* telldir.c */,
+                               C9B53798138D9E990028D27C /* telldir.h */,
+                               C9B5379A138D9E990028D27C /* termios.c */,
+                               C9B5379C138D9E990028D27C /* time.3 */,
+                               C9B5379E138D9E990028D27C /* time.c */,
+                               C9B537A0138D9E990028D27C /* times.3 */,
+                               C9B537A2138D9E990028D27C /* times.c */,
+                               C9B537A3138D9E990028D27C /* timezone.3 */,
+                               C9B537A4138D9E990028D27C /* timezone.c */,
+                               C9B537A5138D9E990028D27C /* ttyname.3 */,
+                               C9B537A7138D9E990028D27C /* ttyname.c */,
+                               C9B537A9138D9E990028D27C /* ttyslot.c */,
+                               C9B537AA138D9E990028D27C /* ualarm.3 */,
+                               C9B537AC138D9E990028D27C /* ualarm.c */,
+                               C9B537AD138D9E990028D27C /* ucontext.3 */,
+                               C9B537AE138D9E990028D27C /* ulimit.3 */,
+                               C9B537B0138D9E990028D27C /* ulimit.c */,
+                               C9B537B1138D9E990028D27C /* unvis.3 */,
+                               C9B537B2138D9E990028D27C /* unvis.c */,
+                               C9B537B4138D9E990028D27C /* usleep.3 */,
+                               C9B537B6138D9E990028D27C /* usleep.c */,
+                               C9B537B8138D9E990028D27C /* utime.3 */,
+                               C9B537BA138D9E990028D27C /* utime.c */,
+                               C9B537BB138D9E990028D27C /* vis.3 */,
+                               C9B537BC138D9E990028D27C /* vis.c */,
+                               C9B537BE138D9E990028D27C /* wait.c */,
+                               C9B537C0138D9E990028D27C /* wait3.c */,
+                               C9B537C1138D9E990028D27C /* waitpid.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B537DD138D9E990028D27C /* NetBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B537DE138D9E990028D27C /* endutxent.3 */,
+                               C9B537E0138D9E990028D27C /* getlastlogx.3 */,
+                               C9B537E2138D9E990028D27C /* utmpx.5 */,
+                               C9B537E4138D9E990028D27C /* utmpx.c */,
+                       );
+                       path = NetBSD;
+                       sourceTree = "<group>";
+               };
+               C9B5380A138D9E990028D27C /* gmon */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5380B138D9E990028D27C /* gmon.c */,
+                               C9B5380D138D9E990028D27C /* moncontrol.3 */,
+                       );
+                       path = gmon;
+                       sourceTree = "<group>";
+               };
+               C9B5380F138D9E990028D27C /* i386 */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53810138D9E990028D27C /* gen */,
+                               C9B5381D138D9E990028D27C /* pthreads */,
+                               C9B53829138D9E990028D27C /* string */,
+                               C9B53843138D9E990028D27C /* sys */,
+                       );
+                       path = i386;
+                       sourceTree = "<group>";
+               };
+               C9B53810138D9E990028D27C /* gen */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53811138D9E990028D27C /* _ctx_start.S */,
+                               C9B53812138D9E990028D27C /* _setcontext.S */,
+                               C9B53813138D9E990028D27C /* cpu_number.s */,
+                               C9B53814138D9E990028D27C /* getcontext.S */,
+                               C9B53815138D9E990028D27C /* getmcontext.c */,
+                               C9B53816138D9E990028D27C /* icacheinval.s */,
+                               C9B53817138D9E990028D27C /* makecontext.c */,
+                               C9B53819138D9E990028D27C /* mcount.s */,
+                               C9B5381A138D9E990028D27C /* setcontext.c */,
+                               C9B5381B138D9E990028D27C /* setjmperr.c */,
+                               C9B5381C138D9E990028D27C /* swapcontext.c */,
+                       );
+                       path = gen;
+                       sourceTree = "<group>";
+               };
+               C9B5381D138D9E990028D27C /* pthreads */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */,
+                               C9B53820138D9E990028D27C /* preempt.s */,
+                               C9B53821138D9E990028D27C /* pthread_getspecific.s */,
+                               C9B53822138D9E990028D27C /* pthread_mutex_lock.s */,
+                               C9B53823138D9E990028D27C /* pthread_self.s */,
+                               C9B53824138D9E990028D27C /* pthread_set_self.s */,
+                               C9B53825138D9E990028D27C /* start_wqthread.s */,
+                               C9B53826138D9E990028D27C /* thread_start.s */,
+                       );
+                       path = pthreads;
+                       sourceTree = "<group>";
+               };
+               C9B53829138D9E990028D27C /* string */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5382A138D9E990028D27C /* __bzero.s */,
+                               C9B5382B138D9E990028D27C /* bcopy.c */,
+                               C9B5382C138D9E990028D27C /* bcopy_scalar.s */,
+                               C9B5382D138D9E990028D27C /* bcopy_sse2.s */,
+                               C9B5382E138D9E990028D27C /* bcopy_sse3x.s */,
+                               C9B5382F138D9E990028D27C /* bcopy_sse42.s */,
+                               C9B53830138D9E990028D27C /* bzero.c */,
+                               C9B53831138D9E990028D27C /* bzero_scalar.s */,
+                               C9B53832138D9E990028D27C /* bzero_sse2.s */,
+                               C9B53833138D9E990028D27C /* bzero_sse42.s */,
+                               C9B53834138D9E990028D27C /* ffs.s */,
+                               C9B53835138D9E990028D27C /* longcopy_sse3x.s */,
+                               C9B53837138D9E990028D27C /* memcmp.s */,
+                               C9B53838138D9E990028D27C /* memcpy.c */,
+                               C9B53839138D9E990028D27C /* memmove.c */,
+                               C9B5383A138D9E990028D27C /* memset.s */,
+                               C9B5383B138D9E990028D27C /* memset_pattern_sse2.s */,
+                               C9B5383C138D9E990028D27C /* strcmp.s */,
+                               C9B5383D138D9E990028D27C /* strcpy.s */,
+                               C9B5383E138D9E990028D27C /* strlcat.s */,
+                               C9B5383F138D9E990028D27C /* strlcpy.s */,
+                               C9B53840138D9E990028D27C /* strlen.s */,
+                               C9B53841138D9E990028D27C /* strncmp.s */,
+                               C9B53842138D9E990028D27C /* strncpy.s */,
+                       );
+                       path = string;
+                       sourceTree = "<group>";
+               };
+               C9B53843138D9E990028D27C /* sys */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53844138D9E990028D27C /* _setjmp.s */,
+                               C9B53845138D9E990028D27C /* _sigtramp.s */,
+                               C9B53846138D9E990028D27C /* atomic.c */,
+                               C9B53847138D9E990028D27C /* i386_gettimeofday_asm.s */,
+                               C9B53848138D9E990028D27C /* mach_absolute_time.c */,
+                               C9B53849138D9E990028D27C /* mach_absolute_time_asm.s */,
+                               C9B5384B138D9E990028D27C /* OSAtomic.s */,
+                               C9B5384C138D9E990028D27C /* setjmp.s */,
+                               C9B5384D138D9E990028D27C /* spinlocks.c */,
+                               C9B5384E138D9E990028D27C /* spinlocks_asm.s */,
+                       );
+                       path = sys;
+                       sourceTree = "<group>";
+               };
+               C9B5384F138D9E990028D27C /* include */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53850138D9E990028D27C /* _locale.h */,
+                               C9B53851138D9E990028D27C /* _structs.h */,
+                               C9B53852138D9E990028D27C /* _types.h */,
+                               C9B53853138D9E990028D27C /* _wctype.h */,
+                               C9B53854138D9E990028D27C /* _xlocale.h */,
+                               C9B53855138D9E990028D27C /* aio.h */,
+                               C9B53856138D9E990028D27C /* alloca.h */,
+                               C9B53857138D9E990028D27C /* ar.h */,
+                               C9B53858138D9E990028D27C /* arpa */,
+                               C9B5385E138D9E990028D27C /* asl.h */,
+                               C9B5385F138D9E990028D27C /* asm.h */,
+                               C9B53860138D9E990028D27C /* assert.h */,
+                               C9B53861138D9E990028D27C /* authentication.h */,
+                               C9B53862138D9E990028D27C /* bitstring.h */,
+                               C9B53863138D9E990028D27C /* cpio.h */,
+                               C9B53864138D9E990028D27C /* CrashReporterClient.h */,
+                               C9B53865138D9E990028D27C /* crt_externs.h */,
+                               C9B53866138D9E990028D27C /* ctype.h */,
+                               C9B53867138D9E990028D27C /* db.h */,
+                               C9B53868138D9E990028D27C /* dirent.h */,
+                               C9B53869138D9E990028D27C /* disktab.h */,
+                               C9B5386A138D9E990028D27C /* err.h */,
+                               C9B5386B138D9E990028D27C /* errno.h */,
+                               C9B5386C138D9E990028D27C /* fcntl.h */,
+                               C9B5386D138D9E990028D27C /* fmtmsg.h */,
+                               C9B5386E138D9E990028D27C /* fnmatch.h */,
+                               C9B5386F138D9E990028D27C /* FreeBSD */,
+                               C9B53872138D9E990028D27C /* fsproperties.h */,
+                               C9B53873138D9E990028D27C /* fstab.h */,
+                               C9B53874138D9E990028D27C /* fts.h */,
+                               C9B53875138D9E990028D27C /* ftw.h */,
+                               C9B53876138D9E990028D27C /* getopt.h */,
+                               C9B53877138D9E990028D27C /* glob.h */,
+                               C9B53879138D9E990028D27C /* inttypes.h */,
+                               C9B5387A138D9E990028D27C /* iso646.h */,
+                               C9B5387B138D9E990028D27C /* kvm.h */,
+                               C9B5387C138D9E990028D27C /* langinfo.h */,
+                               C9B5387D138D9E990028D27C /* libc.h */,
+                               C9B5387E138D9E990028D27C /* libgen.h */,
+                               C9B5387F138D9E990028D27C /* libkern */,
+                               C9B53885138D9E990028D27C /* limits.h */,
+                               C9B53886138D9E990028D27C /* locale.h */,
+                               C9B53888138D9E990028D27C /* malloc */,
+                               C9B5388B138D9E990028D27C /* memory.h */,
+                               C9B5388C138D9E990028D27C /* monetary.h */,
+                               C9B5388D138D9E990028D27C /* monitor.h */,
+                               C9B5388E138D9E990028D27C /* mpool.h */,
+                               C9B5388F138D9E990028D27C /* ndbm.h */,
+                               C9B53890138D9E990028D27C /* NetBSD */,
+                               C9B53893138D9E990028D27C /* nlist.h */,
+                               C9B53894138D9E990028D27C /* NSSystemDirectories.h */,
+                               C9B53899138D9E990028D27C /* paths.h */,
+                               C9B5389A138D9E990028D27C /* poll.h */,
+                               C9B5389B138D9E990028D27C /* protocols */,
+                               C9B538A2138D9E990028D27C /* ranlib.h */,
+                               C9B538A3138D9E990028D27C /* readpassphrase.h */,
+                               C9B538A4138D9E990028D27C /* regex.h */,
+                               C9B538A5138D9E990028D27C /* rune.h */,
+                               C9B538A6138D9E990028D27C /* runetype.h */,
+                               C9B538A7138D9E990028D27C /* search.h */,
+                               C9B538A8138D9E990028D27C /* secure */,
+                               C9B538AD138D9E990028D27C /* semaphore.h */,
+                               C9B538AE138D9E990028D27C /* setjmp.h */,
+                               C9B538AF138D9E990028D27C /* sgtty.h */,
+                               C9B538B0138D9E990028D27C /* signal.h */,
+                               C9B538B1138D9E990028D27C /* spawn.h */,
+                               C9B538B2138D9E990028D27C /* spawn_private.h */,
+                               C9B538B3138D9E990028D27C /* stab.h */,
+                               C9B538B4138D9E990028D27C /* standards.h */,
+                               C9B538B5138D9E990028D27C /* stdbool.h */,
+                               C9B538B6138D9E990028D27C /* stddef.h */,
+                               C9B538B7138D9E990028D27C /* stdint.h */,
+                               C9B538B8138D9E990028D27C /* stdio.h */,
+                               C9B538B9138D9E990028D27C /* stdlib.h */,
+                               C9B538BA138D9E990028D27C /* strhash.h */,
+                               C9B538BB138D9E990028D27C /* string.h */,
+                               C9B538BC138D9E990028D27C /* stringlist.h */,
+                               C9B538BD138D9E990028D27C /* strings.h */,
+                               C9B538BE138D9E990028D27C /* struct.h */,
+                               C9B538BF138D9E990028D27C /* sys */,
+                               C9B538C4138D9E990028D27C /* sysexits.3 */,
+                               C9B538C5138D9E990028D27C /* sysexits.h */,
+                               C9B538C6138D9E990028D27C /* syslog.h */,
+                               C9B538C7138D9E990028D27C /* tar.h */,
+                               C9B538C8138D9E990028D27C /* termios.h */,
+                               C9B538C9138D9E990028D27C /* time.h */,
+                               C9B538CA138D9E990028D27C /* timeconv.h */,
+                               C9B538CB138D9E990028D27C /* ttyent.h */,
+                               C9B538CC138D9E990028D27C /* ucontext.h */,
+                               C9B538CD138D9E990028D27C /* ulimit.h */,
+                               C9B538CE138D9E990028D27C /* unistd.h */,
+                               C9B538CF138D9E990028D27C /* util.h */,
+                               C9B538D0138D9E990028D27C /* utime.h */,
+                               C9B538D1138D9E990028D27C /* utmp.h */,
+                               C9B538D2138D9E990028D27C /* vis.h */,
+                               C9B538D3138D9E990028D27C /* wchar.h */,
+                               C9B538D4138D9E990028D27C /* wctype.h */,
+                               C9B538D5138D9E990028D27C /* wordexp.h */,
+                               C9B538D6138D9E990028D27C /* xlocale */,
+                               C9B538E3138D9E990028D27C /* xlocale.h */,
+                       );
+                       path = include;
+                       sourceTree = "<group>";
+               };
+               C9B53858138D9E990028D27C /* arpa */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53859138D9E990028D27C /* ftp.h */,
+                               C9B5385B138D9E990028D27C /* nameser_compat.h */,
+                               C9B5385C138D9E990028D27C /* telnet.h */,
+                               C9B5385D138D9E990028D27C /* tftp.h */,
+                       );
+                       path = arpa;
+                       sourceTree = "<group>";
+               };
+               C9B5386F138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53870138D9E990028D27C /* nl_types.h */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B5387F138D9E990028D27C /* libkern */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53881138D9E990028D27C /* OSAtomic.h */,
+                               C9B53882138D9E990028D27C /* OSCacheControl.h */,
+                               C9B53883138D9E990028D27C /* OSMemoryNotification.h */,
+                               C9B53884138D9E990028D27C /* OSThermalNotification.h */,
+                       );
+                       path = libkern;
+                       sourceTree = "<group>";
+               };
+               C9B53888138D9E990028D27C /* malloc */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5388A138D9E990028D27C /* malloc.h */,
+                       );
+                       path = malloc;
+                       sourceTree = "<group>";
+               };
+               C9B53890138D9E990028D27C /* NetBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53891138D9E990028D27C /* utmpx.h */,
+                       );
+                       path = NetBSD;
+                       sourceTree = "<group>";
+               };
+               C9B5389B138D9E990028D27C /* protocols */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B5389D138D9E990028D27C /* routed.h */,
+                               C9B5389E138D9E990028D27C /* rwhod.h */,
+                               C9B5389F138D9E990028D27C /* talkd.h */,
+                               C9B538A0138D9E990028D27C /* timed.h */,
+                       );
+                       path = protocols;
+                       sourceTree = "<group>";
+               };
+               C9B538A8138D9E990028D27C /* secure */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B538A9138D9E990028D27C /* _common.h */,
+                               C9B538AA138D9E990028D27C /* _stdio.h */,
+                               C9B538AB138D9E990028D27C /* _string.h */,
+                       );
+                       path = secure;
+                       sourceTree = "<group>";
+               };
+               C9B538BF138D9E990028D27C /* sys */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B538C0138D9E990028D27C /* acl.h */,
+                               C9B538C1138D9E990028D27C /* cdefs.h */,
+                               C9B538C3138D9E990028D27C /* statvfs.h */,
+                       );
+                       path = sys;
+                       sourceTree = "<group>";
+               };
+               C9B538D6138D9E990028D27C /* xlocale */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B538D7138D9E990028D27C /* __wctype.h */,
+                               C9B538D8138D9E990028D27C /* _ctype.h */,
+                               C9B538D9138D9E990028D27C /* _inttypes.h */,
+                               C9B538DA138D9E990028D27C /* _langinfo.h */,
+                               C9B538DB138D9E990028D27C /* _monetary.h */,
+                               C9B538DC138D9E990028D27C /* _stdio.h */,
+                               C9B538DD138D9E990028D27C /* _stdlib.h */,
+                               C9B538DE138D9E990028D27C /* _string.h */,
+                               C9B538DF138D9E990028D27C /* _time.h */,
+                               C9B538E0138D9E990028D27C /* _wchar.h */,
+                               C9B538E1138D9E990028D27C /* _wctype.h */,
+                       );
+                       path = xlocale;
+                       sourceTree = "<group>";
+               };
+               C9B538FE138D9E990028D27C /* locale */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B538FF138D9E990028D27C /* ctype_l.3 */,
+                               C9B53900138D9E990028D27C /* duplocale.3 */,
+                               C9B53901138D9E990028D27C /* FreeBSD */,
+                               C9B539E2138D9E990028D27C /* freelocale.3 */,
+                               C9B539E3138D9E990028D27C /* frune.c */,
+                               C9B539E4138D9E990028D27C /* isalnum_l.3 */,
+                               C9B539E5138D9E990028D27C /* isctype.c */,
+                               C9B539E6138D9E990028D27C /* iswalnum_l.3 */,
+                               C9B539E7138D9E990028D27C /* iswctype.c */,
+                               C9B539E8138D9E990028D27C /* lconv.c */,
+                               C9B539EA138D9E990028D27C /* mbrune.3 */,
+                               C9B539EB138D9E990028D27C /* mbrune.c */,
+                               C9B539EC138D9E990028D27C /* newlocale.3 */,
+                               C9B539ED138D9E990028D27C /* querylocale.3 */,
+                               C9B539EE138D9E990028D27C /* rune.3 */,
+                               C9B539EF138D9E990028D27C /* runedepreciated.c */,
+                               C9B539F0138D9E990028D27C /* runedepreciated.h */,
+                               C9B539F1138D9E990028D27C /* setinvalidrune.c */,
+                               C9B539F2138D9E990028D27C /* uselocale.3 */,
+                               C9B539F3138D9E990028D27C /* utf2.5 */,
+                               C9B539F4138D9E990028D27C /* wcstod_l.3 */,
+                               C9B539F5138D9E990028D27C /* wcstol_l.3 */,
+                               C9B539F6138D9E990028D27C /* xlocale.3 */,
+                               C9B539F7138D9E990028D27C /* xlocale.c */,
+                               C9B539F8138D9E990028D27C /* xlocale_private.h */,
+                       );
+                       path = locale;
+                       sourceTree = "<group>";
+               };
+               C9B53901138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53902138D9E990028D27C /* ascii.c */,
+                               C9B53904138D9E990028D27C /* big5.5 */,
+                               C9B53905138D9E990028D27C /* big5.c */,
+                               C9B53907138D9E990028D27C /* btowc.3 */,
+                               C9B53909138D9E990028D27C /* btowc.c */,
+                               C9B5390B138D9E990028D27C /* collate.c */,
+                               C9B5390D138D9E990028D27C /* collate.h */,
+                               C9B5390F138D9E990028D27C /* collcmp.c */,
+                               C9B53911138D9E990028D27C /* ctype.3 */,
+                               C9B53913138D9E990028D27C /* digittoint.3 */,
+                               C9B53915138D9E990028D27C /* euc.5 */,
+                               C9B53916138D9E990028D27C /* euc.c */,
+                               C9B53918138D9E990028D27C /* fix_grouping.c */,
+                               C9B5391A138D9E990028D27C /* gb18030.5 */,
+                               C9B5391B138D9E990028D27C /* gb18030.c */,
+                               C9B5391D138D9E990028D27C /* gb2312.5 */,
+                               C9B5391E138D9E990028D27C /* gb2312.c */,
+                               C9B53920138D9E990028D27C /* gbk.5 */,
+                               C9B53921138D9E990028D27C /* gbk.c */,
+                               C9B53923138D9E990028D27C /* isalnum.3 */,
+                               C9B53925138D9E990028D27C /* isalpha.3 */,
+                               C9B53927138D9E990028D27C /* isascii.3 */,
+                               C9B53928138D9E990028D27C /* isblank.3 */,
+                               C9B5392A138D9E990028D27C /* iscntrl.3 */,
+                               C9B5392C138D9E990028D27C /* isdigit.3 */,
+                               C9B5392E138D9E990028D27C /* isgraph.3 */,
+                               C9B53930138D9E990028D27C /* isideogram.3 */,
+                               C9B53932138D9E990028D27C /* islower.3 */,
+                               C9B53934138D9E990028D27C /* isphonogram.3 */,
+                               C9B53936138D9E990028D27C /* isprint.3 */,
+                               C9B53938138D9E990028D27C /* ispunct.3 */,
+                               C9B5393A138D9E990028D27C /* isrune.3 */,
+                               C9B5393C138D9E990028D27C /* isspace.3 */,
+                               C9B5393E138D9E990028D27C /* isspecial.3 */,
+                               C9B53940138D9E990028D27C /* isupper.3 */,
+                               C9B53942138D9E990028D27C /* iswalnum.3 */,
+                               C9B53944138D9E990028D27C /* isxdigit.3 */,
+                               C9B53946138D9E990028D27C /* ldpart.c */,
+                               C9B53948138D9E990028D27C /* ldpart.h */,
+                               C9B5394A138D9E990028D27C /* lmessages.c */,
+                               C9B5394C138D9E990028D27C /* lmessages.h */,
+                               C9B5394E138D9E990028D27C /* lmonetary.c */,
+                               C9B53950138D9E990028D27C /* lmonetary.h */,
+                               C9B53952138D9E990028D27C /* lnumeric.c */,
+                               C9B53954138D9E990028D27C /* lnumeric.h */,
+                               C9B53956138D9E990028D27C /* localeconv.3 */,
+                               C9B53958138D9E990028D27C /* localeconv.c */,
+                               C9B5395A138D9E990028D27C /* mblen.3 */,
+                               C9B5395C138D9E990028D27C /* mblen.c */,
+                               C9B5395E138D9E990028D27C /* mblocal.h */,
+                               C9B53960138D9E990028D27C /* mbrlen.3 */,
+                               C9B53962138D9E990028D27C /* mbrlen.c */,
+                               C9B53964138D9E990028D27C /* mbrtowc.3 */,
+                               C9B53966138D9E990028D27C /* mbrtowc.c */,
+                               C9B53968138D9E990028D27C /* mbsinit.3 */,
+                               C9B5396A138D9E990028D27C /* mbsinit.c */,
+                               C9B5396C138D9E990028D27C /* mbsnrtowcs.c */,
+                               C9B5396E138D9E990028D27C /* mbsrtowcs.3 */,
+                               C9B53970138D9E990028D27C /* mbsrtowcs.c */,
+                               C9B53972138D9E990028D27C /* mbstowcs.3 */,
+                               C9B53974138D9E990028D27C /* mbstowcs.c */,
+                               C9B53976138D9E990028D27C /* mbtowc.3 */,
+                               C9B53978138D9E990028D27C /* mbtowc.c */,
+                               C9B5397A138D9E990028D27C /* mskanji.5 */,
+                               C9B5397B138D9E990028D27C /* mskanji.c */,
+                               C9B5397D138D9E990028D27C /* multibyte.3 */,
+                               C9B5397E138D9E990028D27C /* nextwctype.3 */,
+                               C9B53980138D9E990028D27C /* nextwctype.c */,
+                               C9B53982138D9E990028D27C /* nl_langinfo.3 */,
+                               C9B53984138D9E990028D27C /* nl_langinfo.c */,
+                               C9B53986138D9E990028D27C /* nomacros.c */,
+                               C9B53987138D9E990028D27C /* none.c */,
+                               C9B53989138D9E990028D27C /* rune.c */,
+                               C95B7ED8138F3C11004311DA /* rune32.h */,
+                               C9B5398B138D9E990028D27C /* runetype.c */,
+                               C9B5398D138D9E990028D27C /* setlocale.3 */,
+                               C9B5398F138D9E990028D27C /* setlocale.c */,
+                               C9B53991138D9E990028D27C /* setlocale.h */,
+                               C9B53993138D9E990028D27C /* setrunelocale.c */,
+                               C9B53995138D9E990028D27C /* table.c */,
+                               C9B53997138D9E990028D27C /* toascii.3 */,
+                               C9B53998138D9E990028D27C /* tolower.3 */,
+                               C9B5399A138D9E990028D27C /* tolower.c */,
+                               C9B5399C138D9E990028D27C /* toupper.3 */,
+                               C9B5399E138D9E990028D27C /* toupper.c */,
+                               C9B539A0138D9E990028D27C /* towlower.3 */,
+                               C9B539A2138D9E990028D27C /* towupper.3 */,
+                               C9B539A5138D9E990028D27C /* utf8.5 */,
+                               C9FA32F8138E4A5C0089A94B /* utf2.c */,
+                               C9B539A6138D9E990028D27C /* utf8.c */,
+                               C9B539A8138D9E990028D27C /* wcrtomb.3 */,
+                               C9B539AA138D9E990028D27C /* wcrtomb.c */,
+                               C9B539AC138D9E990028D27C /* wcsftime.3 */,
+                               C9B539AE138D9E990028D27C /* wcsftime.c */,
+                               C9B539B0138D9E990028D27C /* wcsnrtombs.c */,
+                               C9B539B2138D9E990028D27C /* wcsrtombs.3 */,
+                               C9B539B4138D9E990028D27C /* wcsrtombs.c */,
+                               C9B539B6138D9E990028D27C /* wcstod.3 */,
+                               C9B539B8138D9E990028D27C /* wcstod.c */,
+                               C9B539BA138D9E990028D27C /* wcstof.c */,
+                               C9B539BC138D9E990028D27C /* wcstoimax.c */,
+                               C9B539BE138D9E990028D27C /* wcstol.3 */,
+                               C9B539C0138D9E990028D27C /* wcstol.c */,
+                               C9B539C2138D9E990028D27C /* wcstold.c */,
+                               C9B539C4138D9E990028D27C /* wcstoll.c */,
+                               C9B539C6138D9E990028D27C /* wcstombs.3 */,
+                               C9B539C8138D9E990028D27C /* wcstombs.c */,
+                               C9B539CA138D9E990028D27C /* wcstoul.c */,
+                               C9B539CC138D9E990028D27C /* wcstoull.c */,
+                               C9B539CE138D9E990028D27C /* wcstoumax.c */,
+                               C9B539D0138D9E990028D27C /* wctob.c */,
+                               C9B539D2138D9E990028D27C /* wctomb.3 */,
+                               C9B539D4138D9E990028D27C /* wctomb.c */,
+                               C9B539D6138D9E990028D27C /* wctrans.3 */,
+                               C9B539D8138D9E990028D27C /* wctrans.c */,
+                               C9B539DA138D9E990028D27C /* wctype.3 */,
+                               C9B539DC138D9E990028D27C /* wctype.c */,
+                               C9B539DE138D9E990028D27C /* wcwidth.3 */,
+                               C9B539E0138D9E990028D27C /* wcwidth.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53A04138D9E990028D27C /* man */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A05138D9E990028D27C /* assert.3 */,
+                               C9B53A06138D9E990028D27C /* bitstring.3 */,
+                               C9B53A07138D9E990028D27C /* environ.7 */,
+                               C9B53A08138D9E990028D27C /* FreeBSD */,
+                               C9B53A0B138D9E990028D27C /* gethostuuid.2 */,
+                               C9B53A0D138D9E990028D27C /* utmp.5 */,
+                               C942135A13905D1C004BA536 /* manpages.lst */,
+                       );
+                       path = man;
+                       sourceTree = "<group>";
+               };
+               C9B53A08138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A09138D9E990028D27C /* stdarg.3 */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53A0E138D9E990028D27C /* nbsdcompat */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A0F138D9E990028D27C /* _nbsd_compat_.h */,
+                               C9B53A10138D9E990028D27C /* namespace.h */,
+                       );
+                       path = nbsdcompat;
+                       sourceTree = "<group>";
+               };
+               C9B53A11138D9E990028D27C /* net */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A12138D9E990028D27C /* byteorder.3 */,
+                               C9B53A13138D9E990028D27C /* ethers.3 */,
+                               C9B53A14138D9E990028D27C /* FreeBSD */,
+                               C9B53A39138D9E990028D27C /* rcmdsh.3 */,
+                       );
+                       path = net;
+                       sourceTree = "<group>";
+               };
+               C9B53A14138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A15138D9E990028D27C /* addr2ascii.3 */,
+                               C9B53A16138D9E990028D27C /* addr2ascii.c */,
+                               C9B53A17138D9E990028D27C /* ascii2addr.c */,
+                               C9B53A18138D9E990028D27C /* inet.3 */,
+                               C9B53A1A138D9E990028D27C /* inet_addr.c */,
+                               C9B53A1C138D9E990028D27C /* inet_lnaof.c */,
+                               C9B53A1D138D9E990028D27C /* inet_makeaddr.c */,
+                               C9B53A1E138D9E990028D27C /* inet_net.3 */,
+                               C9B53A20138D9E990028D27C /* inet_net_ntop.c */,
+                               C9B53A21138D9E990028D27C /* inet_net_pton.c */,
+                               C9B53A23138D9E990028D27C /* inet_neta.c */,
+                               C9B53A24138D9E990028D27C /* inet_netof.c */,
+                               C9B53A25138D9E990028D27C /* inet_network.c */,
+                               C9B53A27138D9E990028D27C /* inet_ntoa.c */,
+                               C9B53A29138D9E990028D27C /* linkaddr.3 */,
+                               C9B53A2A138D9E990028D27C /* linkaddr.c */,
+                               C9B53A2B138D9E990028D27C /* nsap_addr.c */,
+                               C9B53A2D138D9E990028D27C /* recv.c */,
+                               C9B53A2F138D9E990028D27C /* send.c */,
+                               C9B53A31138D9E990028D27C /* sockatmark.3 */,
+                               C9B53A33138D9E990028D27C /* sockatmark.c */,
+                               C9B53A34138D9E990028D27C /* sourcefilter.3 */,
+                               C9B53A36138D9E990028D27C /* sourcefilter.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53A3A138D9E990028D27C /* nls */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A3B138D9E990028D27C /* FreeBSD */,
+                       );
+                       path = nls;
+                       sourceTree = "<group>";
+               };
+               C9B53A3B138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A3C138D9E990028D27C /* catclose.3 */,
+                               C9B53A3D138D9E990028D27C /* catgets.3 */,
+                               C9B53A3E138D9E990028D27C /* catopen.3 */,
+                               C9B53A3F138D9E990028D27C /* msgcat.c */,
+                               C9B53A41138D9E990028D27C /* msgcat.h */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53A45138D9E990028D27C /* Platforms */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A46138D9E990028D27C /* iphoneos */,
+                               C9B53A48138D9E990028D27C /* macosx */,
+                       );
+                       path = Platforms;
+                       sourceTree = "<group>";
+               };
+               C9B53A46138D9E990028D27C /* iphoneos */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A47138D9E990028D27C /* Makefile.inc */,
+                       );
+                       path = iphoneos;
+                       sourceTree = "<group>";
+               };
+               C9B53A48138D9E990028D27C /* macosx */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A49138D9E990028D27C /* Makefile.inc */,
+                       );
+                       path = macosx;
+                       sourceTree = "<group>";
+               };
+               C9B53A4A138D9E990028D27C /* posix1e */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53A4B138D9E990028D27C /* acl.3 */,
+                               C9B53A4C138D9E990028D27C /* acl.c */,
+                               C9B53A4D138D9E990028D27C /* acl_add_flag_np.3 */,
+                               C9B53A4E138D9E990028D27C /* acl_add_perm.3 */,
+                               C9B53A4F138D9E990028D27C /* acl_clear_flags_np.3 */,
+                               C9B53A50138D9E990028D27C /* acl_clear_perms.3 */,
+                               C9B53A51138D9E990028D27C /* acl_copy_entry.3 */,
+                               C9B53A52138D9E990028D27C /* acl_copy_ext.3 */,
+                               C9B53A53138D9E990028D27C /* acl_create_entry.3 */,
+                               C9B53A54138D9E990028D27C /* acl_delete.3 */,
+                               C9B53A55138D9E990028D27C /* acl_delete_entry.3 */,
+                               C9B53A56138D9E990028D27C /* acl_delete_flag_np.3 */,
+                               C9B53A57138D9E990028D27C /* acl_delete_perm.3 */,
+                               C9B53A58138D9E990028D27C /* acl_dup.3 */,
+                               C9B53A59138D9E990028D27C /* acl_entry.c */,
+                               C9B53A5A138D9E990028D27C /* acl_file.c */,
+                               C9B53A5B138D9E990028D27C /* acl_flag.c */,
+                               C9B53A5C138D9E990028D27C /* acl_free.3 */,
+                               C9B53A5D138D9E990028D27C /* acl_from_text.3 */,
+                               C9B53A5E138D9E990028D27C /* acl_get.3 */,
+                               C9B53A5F138D9E990028D27C /* acl_get_entry.3 */,
+                               C9B53A60138D9E990028D27C /* acl_get_fd.3 */,
+                               C9B53A61138D9E990028D27C /* acl_get_flagset_np.3 */,
+                               C9B53A62138D9E990028D27C /* acl_get_perm_np.3 */,
+                               C9B53A63138D9E990028D27C /* acl_get_permset.3 */,
+                               C9B53A64138D9E990028D27C /* acl_get_permset_mask_np.3 */,
+                               C9B53A65138D9E990028D27C /* acl_get_qualifier.3 */,
+                               C9B53A66138D9E990028D27C /* acl_get_tag_type.3 */,
+                               C9B53A67138D9E990028D27C /* acl_init.3 */,
+                               C9B53A68138D9E990028D27C /* acl_perm.c */,
+                               C9B53A69138D9E990028D27C /* acl_set.3 */,
+                               C9B53A6A138D9E990028D27C /* acl_set_flagset_np.3 */,
+                               C9B53A6B138D9E990028D27C /* acl_set_permset.3 */,
+                               C9B53A6C138D9E990028D27C /* acl_set_qualifier.3 */,
+                               C9B53A6D138D9E990028D27C /* acl_set_tag_type.3 */,
+                               C9B53A6E138D9E990028D27C /* acl_to_text.3 */,
+                               C9B53A6F138D9E990028D27C /* acl_translate.c */,
+                               C9B53A70138D9E990028D27C /* acl_valid.3 */,
+                               C9B53A71138D9E990028D27C /* aclvar.h */,
+                       );
+                       path = posix1e;
+                       sourceTree = "<group>";
+               };
+               C9B53ABA138D9E990028D27C /* pthreads */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */,
+                               C9B53ABD138D9E990028D27C /* plockstat.d */,
+                               C9B53ABE138D9E990028D27C /* posix_sched.h */,
+                               C9B53ABF138D9E990028D27C /* pthread.3 */,
+                               C9B53AC0138D9E990028D27C /* pthread.c */,
+                               C9B53AC1138D9E990028D27C /* pthread.h */,
+                               C9B53AC2138D9E990028D27C /* pthread_atfork.3 */,
+                               C9B53AC3138D9E990028D27C /* pthread_attr.3 */,
+                               C9B53AC4138D9E990028D27C /* pthread_attr_init_destroy.3 */,
+                               C9B53AC5138D9E990028D27C /* pthread_attr_set_getdetachstate.3 */,
+                               C9B53AC6138D9E990028D27C /* pthread_attr_set_getinheritsched.3 */,
+                               C9B53AC7138D9E990028D27C /* pthread_attr_set_getschedparam.3 */,
+                               C9B53AC8138D9E990028D27C /* pthread_attr_set_getschedpolicy.3 */,
+                               C9B53AC9138D9E990028D27C /* pthread_attr_set_getscope.3 */,
+                               C9B53ACA138D9E990028D27C /* pthread_attr_set_getstackaddr.3 */,
+                               C9B53ACB138D9E990028D27C /* pthread_attr_set_getstacksize.3 */,
+                               C9B53ACC138D9E990028D27C /* pthread_cancel.3 */,
+                               C9B53ACD138D9E990028D27C /* pthread_cancelable.c */,
+                               C9B53ACE138D9E990028D27C /* pthread_cleanup_pop.3 */,
+                               C9B53ACF138D9E990028D27C /* pthread_cleanup_push.3 */,
+                               C9B53AD0138D9E990028D27C /* pthread_cond.c */,
+                               C9B53AD1138D9E990028D27C /* pthread_cond_broadcast.3 */,
+                               C9B53AD2138D9E990028D27C /* pthread_cond_destroy.3 */,
+                               C9B53AD3138D9E990028D27C /* pthread_cond_init.3 */,
+                               C9B53AD4138D9E990028D27C /* pthread_cond_signal.3 */,
+                               C9B53AD5138D9E990028D27C /* pthread_cond_timedwait.3 */,
+                               C9B53AD6138D9E990028D27C /* pthread_cond_wait.3 */,
+                               C9B53AD7138D9E990028D27C /* pthread_condattr.3 */,
+                               C9B53AD8138D9E990028D27C /* pthread_create.3 */,
+                               C9B53AD9138D9E990028D27C /* pthread_detach.3 */,
+                               C9B53ADA138D9E990028D27C /* pthread_equal.3 */,
+                               C9B53ADB138D9E990028D27C /* pthread_exit.3 */,
+                               C9B53ADC138D9E990028D27C /* pthread_getschedparam.3 */,
+                               C9B53ADD138D9E990028D27C /* pthread_getspecific.3 */,
+                               C9B53ADE138D9E990028D27C /* pthread_impl.h */,
+                               C9B53ADF138D9E990028D27C /* pthread_internals.h */,
+                               C9B53AE0138D9E990028D27C /* pthread_join.3 */,
+                               C9B53AE1138D9E990028D27C /* pthread_key_create.3 */,
+                               C9B53AE2138D9E990028D27C /* pthread_key_delete.3 */,
+                               C9B53AE3138D9E990028D27C /* pthread_machdep.h */,
+                               C9B53AE4138D9E990028D27C /* pthread_mutex.c */,
+                               C9B53AE5138D9E990028D27C /* pthread_mutex_destroy.3 */,
+                               C9B53AE6138D9E990028D27C /* pthread_mutex_init.3 */,
+                               C9B53AE7138D9E990028D27C /* pthread_mutex_lock.3 */,
+                               C9B53AE8138D9E990028D27C /* pthread_mutex_trylock.3 */,
+                               C9B53AE9138D9E990028D27C /* pthread_mutex_unlock.3 */,
+                               C9B53AEA138D9E990028D27C /* pthread_mutexattr.3 */,
+                               C9B53AEB138D9E990028D27C /* pthread_once.3 */,
+                               C9B53AEC138D9E990028D27C /* pthread_rwlock.c */,
+                               C9B53AED138D9E990028D27C /* pthread_rwlock_destroy.3 */,
+                               C9B53AEE138D9E990028D27C /* pthread_rwlock_init.3 */,
+                               C9B53AEF138D9E990028D27C /* pthread_rwlock_rdlock.3 */,
+                               C9B53AF0138D9E990028D27C /* pthread_rwlock_unlock.3 */,
+                               C9B53AF1138D9E990028D27C /* pthread_rwlock_wrlock.3 */,
+                               C9B53AF2138D9E990028D27C /* pthread_rwlockattr_destroy.3 */,
+                               C9B53AF3138D9E990028D27C /* pthread_rwlockattr_getpshared.3 */,
+                               C9B53AF4138D9E990028D27C /* pthread_rwlockattr_init.3 */,
+                               C9B53AF5138D9E990028D27C /* pthread_rwlockattr_setpshared.3 */,
+                               C9B53AF6138D9E990028D27C /* pthread_self.3 */,
+                               C9B53AF7138D9E990028D27C /* pthread_setcancelstate.3 */,
+                               C9B53AF8138D9E990028D27C /* pthread_setspecific.3 */,
+                               C9B53AF9138D9E990028D27C /* pthread_spinlock.h */,
+                               C9B53AFA138D9E990028D27C /* pthread_spis.h */,
+                               C9B53AFB138D9E990028D27C /* pthread_tsd.c */,
+                               C9B53AFC138D9E990028D27C /* pthread_workqueue.h */,
+                               C9B53AFD138D9E990028D27C /* sched.h */,
+                               C9B53AFE138D9E990028D27C /* stack.s */,
+                               C9B53AFF138D9E990028D27C /* tests */,
+                               C9B53B02138D9E990028D27C /* thread_setup.c */,
+                       );
+                       path = pthreads;
+                       sourceTree = "<group>";
+               };
+               C9B53AFF138D9E990028D27C /* tests */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53B00138D9E990028D27C /* Makefile */,
+                               C9B53B01138D9E990028D27C /* pthread_atfork_test.c */,
+                       );
+                       path = tests;
+                       sourceTree = "<group>";
+               };
+               C9B53B03138D9E990028D27C /* regex */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53B04138D9E990028D27C /* FreeBSD */,
+                               B122F2AE1432B95B00AF95D0 /* TRE */,
+                       );
+                       path = regex;
+                       sourceTree = "<group>";
+               };
+               C9B53B04138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53B06138D9E990028D27C /* cname.h */,
+                               C9B53B08138D9E990028D27C /* COPYRIGHT */,
+                               C9B53B0B138D9E990028D27C /* re_format.7 */,
+                               C9B53B0E138D9E990028D27C /* regerror.c */,
+                               C9B53B10138D9E990028D27C /* regex.3 */,
+                               C9B53B18138D9E990028D27C /* utils.h */,
+                               C9B53B19138D9E990028D27C /* WHATSNEW */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53B1B138D9E990028D27C /* rpc */ = {
+                       isa = PBXGroup;
+                       children = (
+                       );
+                       path = rpc;
+                       sourceTree = "<group>";
+               };
+               C9B53B1D138D9E990028D27C /* secure */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53B1E138D9E990028D27C /* chk_fail.c */,
+                               C9B53B20138D9E990028D27C /* memcpy_chk.c */,
+                               C9B53B21138D9E990028D27C /* memmove_chk.c */,
+                               C9B53B22138D9E990028D27C /* memset_chk.c */,
+                               C9B53B23138D9E990028D27C /* snprintf_chk.c */,
+                               C9B53B24138D9E990028D27C /* sprintf_chk.c */,
+                               C9B53B25138D9E990028D27C /* stpcpy_chk.c */,
+                               C9B53B26138D9E990028D27C /* stpncpy_chk.c */,
+                               C9B53B27138D9E990028D27C /* strcat_chk.c */,
+                               C9B53B28138D9E990028D27C /* strcpy_chk.c */,
+                               C9B53B29138D9E990028D27C /* strncat_chk.c */,
+                               C9B53B2A138D9E990028D27C /* strncpy_chk.c */,
+                               C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */,
+                               C9B53B2C138D9E990028D27C /* vsprintf_chk.c */,
+                       );
+                       path = secure;
+                       sourceTree = "<group>";
+               };
+               C9B53B2D138D9E990028D27C /* stdio */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53B2E138D9E990028D27C /* FreeBSD */,
+                               C9B53C0F138D9E9A0028D27C /* getwc_l.3 */,
+                               C9B53C11138D9E9A0028D27C /* printf_l.3 */,
+                               C9B53C12138D9E9A0028D27C /* putwc_l.3 */,
+                               C9B53C13138D9E9A0028D27C /* scanf_l.3 */,
+                               C9B53C14138D9E9A0028D27C /* wprintf_l.3 */,
+                               C9B53C15138D9E9A0028D27C /* wscanf_l.3 */,
+                       );
+                       path = stdio;
+                       sourceTree = "<group>";
+               };
+               C9B53B2E138D9E990028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53B2F138D9E990028D27C /* _flock_stub.c */,
+                               C9B53B30138D9E990028D27C /* asprintf.c */,
+                               C9B53B32138D9E990028D27C /* clrerr.c */,
+                               C9B53B33138D9E990028D27C /* dprintf.c */,
+                               C9B53B35138D9E990028D27C /* fclose.3 */,
+                               C9B53B36138D9E990028D27C /* fclose.c */,
+                               C9B53B38138D9E990028D27C /* fdopen.c */,
+                               C9B53B3A138D9E990028D27C /* feof.c */,
+                               C9B53B3B138D9E990028D27C /* ferror.3 */,
+                               C9B53B3C138D9E990028D27C /* ferror.c */,
+                               C9B53B3D138D9E990028D27C /* fflush.3 */,
+                               C9B53B3E138D9E990028D27C /* fflush.c */,
+                               C9B53B40138D9E990028D27C /* fgetc.c */,
+                               C9B53B41138D9E990028D27C /* fgetln.3 */,
+                               C9B53B43138D9E990028D27C /* fgetln.c */,
+                               C9B53B45138D9E990028D27C /* fgetpos.c */,
+                               C9B53B46138D9E990028D27C /* fgets.3 */,
+                               C9B53B47138D9E990028D27C /* fgets.c */,
+                               C9B53B48138D9E990028D27C /* fgetwc.c */,
+                               C9B53B4A138D9E990028D27C /* fgetwln.3 */,
+                               C9B53B4C138D9E990028D27C /* fgetwln.c */,
+                               C9B53B4E138D9E990028D27C /* fgetws.3 */,
+                               C9B53B50138D9E990028D27C /* fgetws.c */,
+                               C9B53B52138D9E990028D27C /* fileno.c */,
+                               C9B53B53138D9E990028D27C /* findfp.c */,
+                               C9B53B55138D9E990028D27C /* flags.c */,
+                               C9B53B57138D9E990028D27C /* floatio.h */,
+                               C9B53B58138D9E990028D27C /* flockfile.3 */,
+                               C9B53B5A138D9E990028D27C /* fopen.3 */,
+                               C9B53B5C138D9E990028D27C /* fopen.c */,
+                               C9B53B5E138D9E990028D27C /* fprintf.c */,
+                               C9B53B60138D9E990028D27C /* fpurge.c */,
+                               C9B53B61138D9E990028D27C /* fputc.c */,
+                               C9B53B62138D9E990028D27C /* fputs.3 */,
+                               C9B53B64138D9E990028D27C /* fputs.c */,
+                               C9B53B66138D9E990028D27C /* fputwc.c */,
+                               C9B53B68138D9E990028D27C /* fputws.3 */,
+                               C9B53B6A138D9E990028D27C /* fputws.c */,
+                               C9B53B6C138D9E990028D27C /* fread.3 */,
+                               C9B53B6E138D9E990028D27C /* fread.c */,
+                               C9B53B70138D9E990028D27C /* freopen.c */,
+                               C9B53B72138D9E990028D27C /* fscanf.c */,
+                               C9B53B74138D9E990028D27C /* fseek.3 */,
+                               C9B53B76138D9E990028D27C /* fseek.c */,
+                               C9B53B77138D9E990028D27C /* fsetpos.c */,
+                               C9B53B78138D9E990028D27C /* ftell.c */,
+                               C9B53B7A138D9E990028D27C /* funopen.3 */,
+                               C9B53B7B138D9E990028D27C /* funopen.c */,
+                               C9B53B7D138D9E990028D27C /* fvwrite.c */,
+                               C9B53B7E138D9E990028D27C /* fvwrite.h */,
+                               C9B53B7F138D9E990028D27C /* fwalk.c */,
+                               C9B53B80138D9E990028D27C /* fwide.3 */,
+                               C9B53B82138D9E990028D27C /* fwide.c */,
+                               C9B53B83138D9E990028D27C /* fwprintf.c */,
+                               C9B53B85138D9E990028D27C /* fwrite.c */,
+                               C9B53B87138D9E990028D27C /* fwscanf.c */,
+                               C9B53B89138D9E990028D27C /* getc.3 */,
+                               C9B53B8B138D9E990028D27C /* getc.c */,
+                               C9B53B8C138D9E990028D27C /* getchar.c */,
+                               C9B53B8D138D9E990028D27C /* getdelim.c */,
+                               C9B53B8E138D9E990028D27C /* getline.3 */,
+                               C9B53B90138D9E990028D27C /* getline.c */,
+                               C9B53B91138D9E990028D27C /* gets.c */,
+                               C9B53B92138D9E990028D27C /* getw.c */,
+                               C9B53B93138D9E990028D27C /* getwc.3 */,
+                               C9B53B95138D9E990028D27C /* getwc.c */,
+                               C9B53B97138D9E990028D27C /* getwchar.c */,
+                               C9B53B99138D9E990028D27C /* glue.h */,
+                               C9B53B9A138D9E990028D27C /* local.h */,
+                               C9B53B9C138D9E990028D27C /* makebuf.c */,
+                               C9B53B9E138D9E990028D27C /* mktemp.3 */,
+                               C9B53BA0138D9E990028D27C /* mktemp.c */,
+                               C9B53BA2138D9E990028D27C /* perror.c */,
+                               C9B53BA3138D9E990028D27C /* printf-pos.c */,
+                               C9B53BA5138D9E990028D27C /* printf.3 */,
+                               C9B53BA7138D9E990028D27C /* printf.c */,
+                               C9B53BA9138D9E990028D27C /* printfcommon.h */,
+                               C9B53BAB138D9E990028D27C /* printflocal.h */,
+                               C9B53BAD138D9E990028D27C /* putc.3 */,
+                               C9B53BAF138D9E990028D27C /* putc.c */,
+                               C9B53BB0138D9E990028D27C /* putchar.c */,
+                               C9B53BB1138D9E990028D27C /* puts.c */,
+                               C9B53BB3138D9E990028D27C /* putw.c */,
+                               C9B53BB4138D9E990028D27C /* putwc.3 */,
+                               C9B53BB6138D9E990028D27C /* putwc.c */,
+                               C9B53BB8138D9E990028D27C /* putwchar.c */,
+                               C9B53BBA138D9E990028D27C /* refill.c */,
+                               C9B53BBC138D9E990028D27C /* remove.3 */,
+                               C9B53BBE138D9E990028D27C /* remove.c */,
+                               C9B53BBF138D9E990028D27C /* rewind.c */,
+                               C9B53BC1138D9E990028D27C /* rget.c */,
+                               C9B53BC2138D9E990028D27C /* scanf.3 */,
+                               C9B53BC4138D9E990028D27C /* scanf.c */,
+                               C9B53BC6138D9E990028D27C /* setbuf.3 */,
+                               C9B53BC8138D9E990028D27C /* setbuf.c */,
+                               C9B53BC9138D9E990028D27C /* setbuffer.c */,
+                               C9B53BCA138D9E990028D27C /* setvbuf.c */,
+                               C9B53BCB138D9E990028D27C /* snprintf.c */,
+                               C9B53BCD138D9E990028D27C /* sprintf.c */,
+                               C9B53BCF138D9E990028D27C /* sscanf.c */,
+                               C9B53BD1138D9E990028D27C /* stdio.3 */,
+                               C9B53BD3138D9E990028D27C /* stdio.c */,
+                               C9B53BD4138D9E990028D27C /* swprintf.c */,
+                               C9B53BD6138D9E990028D27C /* swscanf.c */,
+                               C9B53BD8138D9E990028D27C /* tempnam.c */,
+                               C9B53BDA138D9E990028D27C /* tmpfile.c */,
+                               C9B53BDB138D9E990028D27C /* tmpnam.3 */,
+                               C9B53BDD138D9E990028D27C /* tmpnam.c */,
+                               C9B53BDF138D9E990028D27C /* ungetc.3 */,
+                               C9B53BE1138D9E990028D27C /* ungetc.c */,
+                               C9B53BE2138D9E990028D27C /* ungetwc.3 */,
+                               C9B53BE4138D9E990028D27C /* ungetwc.c */,
+                               C9B53BE6138D9E990028D27C /* vasprintf.c */,
+                               C9B53BE8138D9E990028D27C /* vdprintf.c */,
+                               C9B53BEA138D9E990028D27C /* vfprintf.c */,
+                               C9B53BEC138D9E990028D27C /* vfscanf.c */,
+                               C9B53BEE138D9E9A0028D27C /* vfwprintf.c */,
+                               C9B53BF0138D9E9A0028D27C /* vfwscanf.c */,
+                               C9B53BF2138D9E9A0028D27C /* vprintf.c */,
+                               C9B53BF4138D9E9A0028D27C /* vscanf.c */,
+                               C9B53BF6138D9E9A0028D27C /* vsnprintf.c */,
+                               C9B53BF8138D9E9A0028D27C /* vsprintf.c */,
+                               C9B53BFA138D9E9A0028D27C /* vsscanf.c */,
+                               C9B53BFC138D9E9A0028D27C /* vswprintf.c */,
+                               C9B53BFE138D9E9A0028D27C /* vswscanf.c */,
+                               C9B53C00138D9E9A0028D27C /* vwprintf.c */,
+                               C9B53C02138D9E9A0028D27C /* vwscanf.c */,
+                               C9B53C04138D9E9A0028D27C /* wbuf.c */,
+                               C9B53C06138D9E9A0028D27C /* wprintf.3 */,
+                               C9B53C08138D9E9A0028D27C /* wprintf.c */,
+                               C9B53C0A138D9E9A0028D27C /* wscanf.3 */,
+                               C9B53C0C138D9E9A0028D27C /* wscanf.c */,
+                               C9B53C0E138D9E9A0028D27C /* wsetup.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53C16138D9E9A0028D27C /* stdlib */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53C17138D9E9A0028D27C /* a64l.3 */,
+                               C9B53C18138D9E9A0028D27C /* a64l.c */,
+                               C9B53C19138D9E9A0028D27C /* FreeBSD */,
+                               C9B53CAB138D9E9A0028D27C /* grantpt.3 */,
+                               C9B53CAC138D9E9A0028D27C /* grantpt.c */,
+                               C9B53CAD138D9E9A0028D27C /* l64a.c */,
+                               C9B53CAF138D9E9A0028D27C /* NetBSD */,
+                               C9B53CB4138D9E9A0028D27C /* OpenBSD */,
+                               C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */,
+                               C9B53CBE138D9E9A0028D27C /* strtod_l.3 */,
+                               C9B53CBF138D9E9A0028D27C /* strtol_l.3 */,
+                       );
+                       path = stdlib;
+                       sourceTree = "<group>";
+               };
+               C9B53C19138D9E9A0028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9EB2FC3138F6C5C0075BB52 /* psort.c */,
+                               C9EB2FC5138F6CE10075BB52 /* psort_b.c */,
+                               C9EB2FC6138F6CE10075BB52 /* psort_r.c */,
+                               C9EB2FC0138F6BB00075BB52 /* merge_b.c */,
+                               C9B53C1A138D9E9A0028D27C /* _Exit_.c */,
+                               C9B53C1B138D9E9A0028D27C /* abort.3 */,
+                               C9B53C1D138D9E9A0028D27C /* abort.c */,
+                               C9B53C1F138D9E9A0028D27C /* abs.3 */,
+                               C9B53C21138D9E9A0028D27C /* abs.c */,
+                               C9B53C22138D9E9A0028D27C /* alloca.3 */,
+                               C9B53C24138D9E9A0028D27C /* atexit.3 */,
+                               C9B53C26138D9E9A0028D27C /* atexit.c */,
+                               C9B53C28138D9E9A0028D27C /* atexit.h */,
+                               C9B53C2A138D9E9A0028D27C /* atof.3 */,
+                               C9B53C2C138D9E9A0028D27C /* atof.c */,
+                               C9B53C2E138D9E9A0028D27C /* atoi.3 */,
+                               C9B53C30138D9E9A0028D27C /* atoi.c */,
+                               C9B53C32138D9E9A0028D27C /* atol.3 */,
+                               C9B53C34138D9E9A0028D27C /* atol.c */,
+                               C9B53C36138D9E9A0028D27C /* atoll.c */,
+                               C9B53C38138D9E9A0028D27C /* bsearch.3 */,
+                               C9B53C3A138D9E9A0028D27C /* bsearch.c */,
+                               C9B53C3C138D9E9A0028D27C /* div.3 */,
+                               C9B53C3E138D9E9A0028D27C /* div.c */,
+                               C9B53C3F138D9E9A0028D27C /* exit.3 */,
+                               C9B53C40138D9E9A0028D27C /* exit.c */,
+                               C9B53C42138D9E9A0028D27C /* getenv.3 */,
+                               C9B53C44138D9E9A0028D27C /* getenv.c */,
+                               C9B53C46138D9E9A0028D27C /* getopt.3 */,
+                               C9B53C47138D9E9A0028D27C /* getopt.c */,
+                               C9B53C49138D9E9A0028D27C /* getopt_long.3 */,
+                               C9B53C4A138D9E9A0028D27C /* getopt_long.c */,
+                               C9B53C4B138D9E9A0028D27C /* getsubopt.3 */,
+                               C9B53C4D138D9E9A0028D27C /* getsubopt.c */,
+                               C9B53C4E138D9E9A0028D27C /* hcreate.3 */,
+                               C9B53C4F138D9E9A0028D27C /* hcreate.c */,
+                               C9B53C50138D9E9A0028D27C /* heapsort.c */,
+                               C9D94357138EC0C600FB7ACC /* heapsort_b.c */,
+                               C9D94358138EC0C600FB7ACC /* heapsort_r.c */,
+                               C9B53C53138D9E9A0028D27C /* imaxabs.3 */,
+                               C9B53C54138D9E9A0028D27C /* imaxabs.c */,
+                               C9B53C55138D9E9A0028D27C /* imaxdiv.3 */,
+                               C9B53C57138D9E9A0028D27C /* imaxdiv.c */,
+                               C9B53C58138D9E9A0028D27C /* insque.3 */,
+                               C9B53C5A138D9E9A0028D27C /* insque.c */,
+                               C9B53C5B138D9E9A0028D27C /* labs.3 */,
+                               C9B53C5D138D9E9A0028D27C /* labs.c */,
+                               C9B53C5E138D9E9A0028D27C /* ldiv.3 */,
+                               C9B53C60138D9E9A0028D27C /* ldiv.c */,
+                               C9B53C61138D9E9A0028D27C /* llabs.3 */,
+                               C9B53C63138D9E9A0028D27C /* llabs.c */,
+                               C9B53C64138D9E9A0028D27C /* lldiv.3 */,
+                               C9B53C66138D9E9A0028D27C /* lldiv.c */,
+                               C9B53C67138D9E9A0028D27C /* lsearch.3 */,
+                               C9B53C69138D9E9A0028D27C /* lsearch.c */,
+                               C9B53C6A138D9E9A0028D27C /* memory.3 */,
+                               C9B53C6C138D9E9A0028D27C /* merge.c */,
+                               C9B53C6F138D9E9A0028D27C /* putenv.c */,
+                               C9B53C71138D9E9A0028D27C /* qsort.3 */,
+                               C9B53C73138D9E9A0028D27C /* qsort.c */,
+                               C9B53C75138D9E9A0028D27C /* qsort_r.c */,
+                               C9B53C77138D9E9A0028D27C /* radixsort.3 */,
+                               C9B53C78138D9E9A0028D27C /* radixsort.c */,
+                               C9B53C7A138D9E9A0028D27C /* rand.3 */,
+                               C9B53C7C138D9E9A0028D27C /* rand.c */,
+                               C9B53C7D138D9E9A0028D27C /* random.3 */,
+                               C9B53C7F138D9E9A0028D27C /* random.c */,
+                               C9B53C81138D9E9A0028D27C /* reallocf.c */,
+                               C9B53C82138D9E9A0028D27C /* realpath.3 */,
+                               C9B53C84138D9E9A0028D27C /* realpath.c */,
+                               C9B53C86138D9E9A0028D27C /* remque.c */,
+                               C9B53C87138D9E9A0028D27C /* setenv.c */,
+                               C9B53C89138D9E9A0028D27C /* strhash.c */,
+                               C9B53C8B138D9E9A0028D27C /* strtod.3 */,
+                               C9B53C8D138D9E9A0028D27C /* strtoimax.c */,
+                               C9B53C8F138D9E9A0028D27C /* strtol.3 */,
+                               C9B53C91138D9E9A0028D27C /* strtol.c */,
+                               C9B53C93138D9E9A0028D27C /* strtoll.c */,
+                               C9B53C95138D9E9A0028D27C /* strtoq.c */,
+                               C9B53C97138D9E9A0028D27C /* strtoul.3 */,
+                               C9B53C99138D9E9A0028D27C /* strtoul.c */,
+                               C9B53C9B138D9E9A0028D27C /* strtoull.c */,
+                               C9B53C9D138D9E9A0028D27C /* strtoumax.c */,
+                               C9B53C9F138D9E9A0028D27C /* strtouq.c */,
+                               C9B53CA1138D9E9A0028D27C /* system.3 */,
+                               C9B53CA3138D9E9A0028D27C /* system.c */,
+                               C9B53CA5138D9E9A0028D27C /* tdelete.c */,
+                               C9B53CA6138D9E9A0028D27C /* tfind.c */,
+                               C9B53CA7138D9E9A0028D27C /* tsearch.3 */,
+                               C9B53CA9138D9E9A0028D27C /* tsearch.c */,
+                               C9B53CAA138D9E9A0028D27C /* twalk.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53CAF138D9E9A0028D27C /* NetBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53CB0138D9E9A0028D27C /* strfmon.3 */,
+                               C9B53CB2138D9E9A0028D27C /* strfmon.c */,
+                       );
+                       path = NetBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53CB4138D9E9A0028D27C /* OpenBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53CB5138D9E9A0028D27C /* ecvt.3 */,
+                               C9B53CB7138D9E9A0028D27C /* ecvt.c */,
+                               C9B53CB9138D9E9A0028D27C /* gcvt.c */,
+                       );
+                       path = OpenBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53CC0138D9E9A0028D27C /* stdtime */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53CC1138D9E9A0028D27C /* FreeBSD */,
+                               C9B53CDF138D9E9A0028D27C /* getdate.3 */,
+                               C9B53CE0138D9E9A0028D27C /* getdate.c */,
+                               C9B53CE2138D9E9A0028D27C /* timegm.3 */,
+                               C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */,
+                       );
+                       path = stdtime;
+                       sourceTree = "<group>";
+               };
+               C9B53CC1138D9E9A0028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53CC2138D9E9A0028D27C /* asctime.c */,
+                               C9B53CC4138D9E9A0028D27C /* ctime.3 */,
+                               C9B53CC6138D9E9A0028D27C /* difftime.c */,
+                               C9B53CC7138D9E9A0028D27C /* ftime.3 */,
+                               C9B53CC9138D9E9A0028D27C /* ftime.c */,
+                               C9B53CCA138D9E9A0028D27C /* localtime.c */,
+                               C9B53CCC138D9E9A0028D27C /* private.h */,
+                               C9B53CCD138D9E9A0028D27C /* strftime.3 */,
+                               C9B53CCF138D9E9A0028D27C /* strftime.c */,
+                               C9B53CD1138D9E9A0028D27C /* strptime.3 */,
+                               C9B53CD3138D9E9A0028D27C /* strptime.c */,
+                               C9B53CD5138D9E9A0028D27C /* time2posix.3 */,
+                               C9B53CD6138D9E9A0028D27C /* time32.c */,
+                               C9B53CD7138D9E9A0028D27C /* timelocal.c */,
+                               C9B53CD9138D9E9A0028D27C /* timelocal.h */,
+                               C9B53CDB138D9E9A0028D27C /* tzfile.5 */,
+                               C9B53CDD138D9E9A0028D27C /* tzfile.h */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53CE4138D9E9A0028D27C /* string */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53CE5138D9E9A0028D27C /* FreeBSD */,
+                               C9B53D91138D9E9A0028D27C /* memset_pattern.3 */,
+                               C9CF595913CD0B9600674871 /* memset_pattern.c */,
+                               63D4060513DDEDF10094DD56 /* stpcpy.c */,
+                               63D4060913DDEEA10094DD56 /* stpncpy.c */,
+                               63D4060C13DDF26A0094DD56 /* strcat.c */,
+                               6310518613D4D966004F7BA8 /* strcpy.c */,
+                               63D4061213DDF6A20094DD56 /* strlcat.c */,
+                               6310518B13D4DABD004F7BA8 /* strlcpy.c */,
+                               63D4060F13DDF4340094DD56 /* strncat.c */,
+                               6310518E13D4DAEA004F7BA8 /* strncpy.c */,
+                       );
+                       path = string;
+                       sourceTree = "<group>";
+               };
+               C9B53CE5138D9E9A0028D27C /* FreeBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53CE6138D9E9A0028D27C /* bcmp.3 */,
+                               C9B53CE8138D9E9A0028D27C /* bcmp.c */,
+                               C9B53CE9138D9E9A0028D27C /* bcopy.3 */,
+                               C9B53CEB138D9E9A0028D27C /* bcopy.c */,
+                               C9B53CED138D9E9A0028D27C /* bstring.3 */,
+                               C9B53CEF138D9E9A0028D27C /* bzero.3 */,
+                               C9B53CF1138D9E9A0028D27C /* bzero.c */,
+                               C9B53CF3138D9E9A0028D27C /* ffs.3 */,
+                               C9B53CF5138D9E9A0028D27C /* index.3 */,
+                               C9B53CF7138D9E9A0028D27C /* index.c */,
+                               C9B53CF8138D9E9A0028D27C /* memccpy.3 */,
+                               C9B53CFA138D9E9A0028D27C /* memccpy.c */,
+                               C9B53CFB138D9E9A0028D27C /* memchr.3 */,
+                               C9B53CFD138D9E9A0028D27C /* memchr.c */,
+                               C9B53CFE138D9E9A0028D27C /* memcmp.3 */,
+                               C9B53D00138D9E9A0028D27C /* memcmp.c */,
+                               C9B53D01138D9E9A0028D27C /* memcpy.3 */,
+                               C9B53D03138D9E9A0028D27C /* memcpy.c */,
+                               C9B53D05138D9E9A0028D27C /* memmem.3 */,
+                               C9B53D06138D9E9A0028D27C /* memmem.c */,
+                               C9B53D07138D9E9A0028D27C /* memmove.3 */,
+                               C9B53D09138D9E9A0028D27C /* memmove.c */,
+                               C9B53D0B138D9E9A0028D27C /* memset.3 */,
+                               C9B53D0D138D9E9A0028D27C /* memset.c */,
+                               C9B53D0E138D9E9A0028D27C /* rindex.3 */,
+                               C9B53D10138D9E9A0028D27C /* rindex.c */,
+                               C9B53D13138D9E9A0028D27C /* strcasecmp.3 */,
+                               C9B53D15138D9E9A0028D27C /* strcasecmp.c */,
+                               C9B53D17138D9E9A0028D27C /* strcasestr.c */,
+                               C9B53D19138D9E9A0028D27C /* strcat.3 */,
+                               C9B53D1C138D9E9A0028D27C /* strchr.3 */,
+                               C9B53D1E138D9E9A0028D27C /* strchr.c */,
+                               C9B53D20138D9E9A0028D27C /* strcmp.3 */,
+                               C9B53D22138D9E9A0028D27C /* strcmp.c */,
+                               C9B53D24138D9E9A0028D27C /* strcoll.3 */,
+                               C9B53D26138D9E9A0028D27C /* strcoll.c */,
+                               C9B53D28138D9E9A0028D27C /* strcpy.3 */,
+                               C9B53D2B138D9E9A0028D27C /* strcspn.3 */,
+                               C9B53D2D138D9E9A0028D27C /* strcspn.c */,
+                               C9B53D2E138D9E9A0028D27C /* strdup.3 */,
+                               C9B53D30138D9E9A0028D27C /* strdup.c */,
+                               C9B53D31138D9E9A0028D27C /* strerror.3 */,
+                               C9B53D33138D9E9A0028D27C /* strerror.c */,
+                               C9B53D35138D9E9A0028D27C /* string.3 */,
+                               C9B53D38138D9E9A0028D27C /* strlcpy.3 */,
+                               C9B53D3B138D9E9A0028D27C /* strlen.3 */,
+                               C9B53D3C138D9E9A0028D27C /* strlen.c */,
+                               C9B53D3E138D9E9A0028D27C /* strmode.3 */,
+                               C9B53D40138D9E9A0028D27C /* strmode.c */,
+                               C9B53D42138D9E9A0028D27C /* strncmp.c */,
+                               C9B53D44138D9E9A0028D27C /* strndup.c */,
+                               C9B53D45138D9E9A0028D27C /* strnlen.c */,
+                               C9B53D46138D9E9A0028D27C /* strnstr.c */,
+                               C9B53D47138D9E9A0028D27C /* strpbrk.3 */,
+                               C9B53D49138D9E9A0028D27C /* strpbrk.c */,
+                               C9B53D4A138D9E9A0028D27C /* strrchr.3 */,
+                               C9B53D4C138D9E9A0028D27C /* strrchr.c */,
+                               C9B53D4E138D9E9A0028D27C /* strsep.3 */,
+                               C9B53D4F138D9E9A0028D27C /* strsep.c */,
+                               C9B53D50138D9E9A0028D27C /* strsignal.c */,
+                               C9B53D52138D9E9A0028D27C /* strspn.3 */,
+                               C9B53D54138D9E9A0028D27C /* strspn.c */,
+                               C9B53D55138D9E9A0028D27C /* strstr.3 */,
+                               C9B53D57138D9E9A0028D27C /* strstr.c */,
+                               C9B53D58138D9E9A0028D27C /* strtok.3 */,
+                               C9B53D5A138D9E9A0028D27C /* strtok.c */,
+                               C9B53D5B138D9E9A0028D27C /* strxfrm.3 */,
+                               C9B53D5D138D9E9A0028D27C /* strxfrm.c */,
+                               C9B53D5F138D9E9A0028D27C /* swab.3 */,
+                               C9B53D61138D9E9A0028D27C /* swab.c */,
+                               C9B53D63138D9E9A0028D27C /* wcpcpy.c */,
+                               C9B53D64138D9E9A0028D27C /* wcpncpy.c */,
+                               C9B53D65138D9E9A0028D27C /* wcscasecmp.c */,
+                               C9B53D67138D9E9A0028D27C /* wcscat.c */,
+                               C9B53D68138D9E9A0028D27C /* wcschr.c */,
+                               C9B53D69138D9E9A0028D27C /* wcscmp.c */,
+                               C9B53D6A138D9E9A0028D27C /* wcscoll.3 */,
+                               C9B53D6C138D9E9A0028D27C /* wcscoll.c */,
+                               C9B53D6E138D9E9A0028D27C /* wcscpy.c */,
+                               C9B53D6F138D9E9A0028D27C /* wcscspn.c */,
+                               C9B53D70138D9E9A0028D27C /* wcsdup.c */,
+                               C9B53D71138D9E9A0028D27C /* wcslcat.c */,
+                               C9B53D72138D9E9A0028D27C /* wcslcpy.c */,
+                               C9B53D73138D9E9A0028D27C /* wcslen.c */,
+                               C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */,
+                               C9B53D76138D9E9A0028D27C /* wcsncat.c */,
+                               C9B53D77138D9E9A0028D27C /* wcsncmp.c */,
+                               C9B53D78138D9E9A0028D27C /* wcsncpy.c */,
+                               C9B53D79138D9E9A0028D27C /* wcsnlen.c */,
+                               C9B53D7A138D9E9A0028D27C /* wcspbrk.c */,
+                               C9B53D7B138D9E9A0028D27C /* wcsrchr.c */,
+                               C9B53D7C138D9E9A0028D27C /* wcsspn.c */,
+                               C9B53D7D138D9E9A0028D27C /* wcsstr.c */,
+                               C9B53D7E138D9E9A0028D27C /* wcstok.3 */,
+                               C9B53D80138D9E9A0028D27C /* wcstok.c */,
+                               C9B53D81138D9E9A0028D27C /* wcswidth.3 */,
+                               C9B53D83138D9E9A0028D27C /* wcswidth.c */,
+                               C9B53D85138D9E9A0028D27C /* wcsxfrm.3 */,
+                               C9B53D87138D9E9A0028D27C /* wcsxfrm.c */,
+                               C9B53D89138D9E9A0028D27C /* wmemchr.3 */,
+                               C9B53D8B138D9E9A0028D27C /* wmemchr.c */,
+                               C9B53D8C138D9E9A0028D27C /* wmemcmp.c */,
+                               C9B53D8D138D9E9A0028D27C /* wmemcpy.c */,
+                               C9B53D8E138D9E9A0028D27C /* wmemmove.c */,
+                               C9B53D8F138D9E9A0028D27C /* wmemset.c */,
+                       );
+                       path = FreeBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53D93138D9E9A0028D27C /* sys */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53D94138D9E9A0028D27C /* __libc_init.c */,
+                               C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */,
+                               C9B53D96138D9E9A0028D27C /* atomic.3 */,
+                               C9B53D97138D9E9A0028D27C /* barrier.3 */,
+                               C9B53D98138D9E9A0028D27C /* cache.3 */,
+                               C9B53D99138D9E9A0028D27C /* chmodx_np.c */,
+                               C9B53D9A138D9E9A0028D27C /* CLIB-LIST */,
+                               C9B53D9B138D9E9A0028D27C /* context-stubs.c */,
+                               C9B53D9C138D9E9A0028D27C /* crt_externs.c */,
+                               C9B53D9D138D9E9A0028D27C /* errno.c */,
+                               C9B53D9E138D9E9A0028D27C /* fork.c */,
+                               C9B53D9F138D9E9A0028D27C /* getgroups.c */,
+                               C9B53DA0138D9E9A0028D27C /* getiopolicy_np.3 */,
+                               C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */,
+                               C9B53DA2138D9E9A0028D27C /* gettimeofday.c */,
+                               C9B53DA4138D9E9A0028D27C /* MISSING-MANPAGE */,
+                               C9B53DA5138D9E9A0028D27C /* MISSING_SYSCALLS */,
+                               C9B53DA6138D9E9A0028D27C /* msgctl.c */,
+                               C9B53DA7138D9E9A0028D27C /* nanosleep.2 */,
+                               C9B53DA8138D9E9A0028D27C /* OpenBSD */,
+                               C9B53DAB138D9E9A0028D27C /* openx_np.c */,
+                               C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */,
+                               C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */,
+                               C9B53DAE138D9E9A0028D27C /* posix_spawn.c */,
+                               C9B53DAF138D9E9A0028D27C /* pthread_kill.2 */,
+                               C9B53DB0138D9E9A0028D27C /* pthread_sigmask.2 */,
+                               C9B53DB1138D9E9A0028D27C /* REQUIRED-MACROS */,
+                               C9B53DB2138D9E9A0028D27C /* semctl.c */,
+                               C9B53DB3138D9E9A0028D27C /* settimeofday.c */,
+                               C9B53DB4138D9E9A0028D27C /* shmctl.c */,
+                               C9B53DB5138D9E9A0028D27C /* sigaction.c */,
+                               C9B53DB6138D9E9A0028D27C /* sigcatch.c */,
+                               C9B53DB7138D9E9A0028D27C /* sigcatch.h */,
+                               C9B53DB8138D9E9A0028D27C /* sigtramp.c */,
+                               C9B53DB9138D9E9A0028D27C /* sigwait.2 */,
+                               C9B53DBA138D9E9A0028D27C /* slot_name.c */,
+                               C9B53DBB138D9E9A0028D27C /* spinlock.3 */,
+                               C9B53DBC138D9E9A0028D27C /* statx_np.c */,
+                               C9B53DBD138D9E9A0028D27C /* SYSCALL-LIST */,
+                               C9B53DBE138D9E9A0028D27C /* umaskx_np.c */,
+                       );
+                       path = sys;
+                       sourceTree = "<group>";
+               };
+               C9B53DA8138D9E9A0028D27C /* OpenBSD */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DA9138D9E9A0028D27C /* stack_protector.c */,
+                       );
+                       path = OpenBSD;
+                       sourceTree = "<group>";
+               };
+               C9B53DBF138D9E9A0028D27C /* threads */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DC0138D9E9A0028D27C /* cprocs.c */,
+                               C9B53DC1138D9E9A0028D27C /* cthread_internals.h */,
+                               C9B53DC2138D9E9A0028D27C /* cthreads.c */,
+                               C9B53DC3138D9E9A0028D27C /* cthreads.h */,
+                               C9B53DC5138D9E9A0028D27C /* mig_support.c */,
+                       );
+                       path = threads;
+                       sourceTree = "<group>";
+               };
+               C9B53DC6138D9E9A0028D27C /* util */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DC7138D9E9A0028D27C /* fparseln.3 */,
+                               C9B53DC8138D9E9A0028D27C /* fparseln.c */,
+                               C9B53DC9138D9E9A0028D27C /* login.3 */,
+                               C9B53DCA138D9E9A0028D27C /* login.c */,
+                               C9B53DCB138D9E9A0028D27C /* login_tty.c */,
+                               C9B53DCC138D9E9A0028D27C /* logout.c */,
+                               C9B53DCD138D9E9A0028D27C /* logwtmp.c */,
+                               3F89F3DC13E9194C00F6856C /* mkpath_np.3 */,
+                               3F89F3DD13E9194C00F6856C /* mkpath_np.c */,
+                               C9B53DCF138D9E9A0028D27C /* opendev.3 */,
+                               C9B53DD0138D9E9A0028D27C /* opendev.c */,
+                               C9B53DD1138D9E9A0028D27C /* openpty.3 */,
+                               C9B53DD2138D9E9A0028D27C /* pty.c */,
+                       );
+                       path = util;
+                       sourceTree = "<group>";
+               };
+               C9B53DD3138D9E9A0028D27C /* uuid */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DD5138D9E9A0028D27C /* namespace.h */,
+                               C9B53DD6138D9E9A0028D27C /* uuid-config.h */,
+                               C9B53DD7138D9E9A0028D27C /* uuidman.sed */,
+                               C9B53DD8138D9E9A0028D27C /* uuidsrc */,
+                       );
+                       path = uuid;
+                       sourceTree = "<group>";
+               };
+               C9B53DD8138D9E9A0028D27C /* uuidsrc */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DD9138D9E9A0028D27C /* clear.c */,
+                               C9B53DDA138D9E9A0028D27C /* compare.c */,
+                               C9B53DDB138D9E9A0028D27C /* copy.c */,
+                               C9B53DDC138D9E9A0028D27C /* gen_uuid.c */,
+                               C9B53DDE138D9E9A0028D27C /* isnull.c */,
+                               C9B53DDF138D9E9A0028D27C /* libuuid.3.in */,
+                               C9B53DE0138D9E9A0028D27C /* pack.c */,
+                               C9B53DE1138D9E9A0028D27C /* parse.c */,
+                               C9B53DE2138D9E9A0028D27C /* unpack.c */,
+                               C9B53DE3138D9E9A0028D27C /* unparse.c */,
+                               C9B53DE5138D9E9A0028D27C /* uuid_clear.3.in */,
+                               C9B53DE6138D9E9A0028D27C /* uuid_compare.3.in */,
+                               C9B53DE7138D9E9A0028D27C /* uuid_copy.3.in */,
+                               C9B53DE8138D9E9A0028D27C /* uuid_generate.3.in */,
+                               C9B53DE9138D9E9A0028D27C /* uuid_is_null.3.in */,
+                               C9B53DEA138D9E9A0028D27C /* uuid_parse.3.in */,
+                               C9B53DEB138D9E9A0028D27C /* uuid_unparse.3.in */,
+                               C9B53DED138D9E9A0028D27C /* uuidP.h */,
+                       );
+                       path = uuidsrc;
+                       sourceTree = "<group>";
+               };
+               C9B53DEF138D9E9A0028D27C /* x86_64 */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DF0138D9E9A0028D27C /* gen */,
+                               C9B53DFC138D9E9A0028D27C /* pthreads */,
+                               C9B53E07138D9E9A0028D27C /* string */,
+                               C9B53E1D138D9E9A0028D27C /* sys */,
+                       );
+                       path = x86_64;
+                       sourceTree = "<group>";
+               };
+               C9B53DF0138D9E9A0028D27C /* gen */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DF1138D9E9A0028D27C /* _ctx_start.S */,
+                               C9B53DF2138D9E9A0028D27C /* _setcontext.S */,
+                               C9B53DF3138D9E9A0028D27C /* cpu_number.s */,
+                               C9B53DF4138D9E9A0028D27C /* getcontext.S */,
+                               C9B53DF5138D9E9A0028D27C /* getmcontext.c */,
+                               C9B53DF6138D9E9A0028D27C /* icacheinval.s */,
+                               C9B53DF7138D9E9A0028D27C /* makecontext.c */,
+                               C9B53DF9138D9E9A0028D27C /* mcount.s */,
+                               C9B53DFA138D9E9A0028D27C /* setcontext.c */,
+                               C9EB3555138F7F6A0075BB52 /* setjmperr.c */,
+                               C9B53DFB138D9E9A0028D27C /* swapcontext.c */,
+                       );
+                       path = gen;
+                       sourceTree = "<group>";
+               };
+               C9B53DFC138D9E9A0028D27C /* pthreads */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53DFE138D9E9A0028D27C /* preempt.s */,
+                               C9B53DFF138D9E9A0028D27C /* pthread_getspecific.s */,
+                               C9B53E00138D9E9A0028D27C /* pthread_mutex_lock.s */,
+                               C9B53E01138D9E9A0028D27C /* pthread_self.s */,
+                               C9B53E02138D9E9A0028D27C /* pthread_set_self.s */,
+                               C9B53E03138D9E9A0028D27C /* start_wqthread.s */,
+                               C9B53E04138D9E9A0028D27C /* thread_start.s */,
+                       );
+                       path = pthreads;
+                       sourceTree = "<group>";
+               };
+               C9B53E07138D9E9A0028D27C /* string */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53E08138D9E9A0028D27C /* __bzero.s */,
+                               C9B53E09138D9E9A0028D27C /* bcopy.c */,
+                               C9B53E0A138D9E9A0028D27C /* bcopy_sse3x.s */,
+                               C9B53E0B138D9E9A0028D27C /* bcopy_sse42.s */,
+                               C9B53E0C138D9E9A0028D27C /* bzero.c */,
+                               C9B53E0D138D9E9A0028D27C /* bzero_sse2.s */,
+                               C9B53E0E138D9E9A0028D27C /* bzero_sse42.s */,
+                               C9B53E0F138D9E9A0028D27C /* ffs.s */,
+                               C9B53E10138D9E9A0028D27C /* longcopy_sse3x.s */,
+                               C9B53E12138D9E9A0028D27C /* memcmp.s */,
+                               C9B53E13138D9E9A0028D27C /* memcpy.c */,
+                               C9B53E14138D9E9A0028D27C /* memmove.c */,
+                               C9B53E15138D9E9A0028D27C /* memset.s */,
+                               C9B53E16138D9E9A0028D27C /* strcmp.s */,
+                               C9B53E17138D9E9A0028D27C /* strcpy.s */,
+                               C9B53E18138D9E9A0028D27C /* strlcat.s */,
+                               C9B53E19138D9E9A0028D27C /* strlcpy.s */,
+                               C9B53E1A138D9E9A0028D27C /* strlen.s */,
+                               C9B53E1B138D9E9A0028D27C /* strncmp.s */,
+                               C9B53E1C138D9E9A0028D27C /* strncpy.s */,
+                       );
+                       path = string;
+                       sourceTree = "<group>";
+               };
+               C9B53E1D138D9E9A0028D27C /* sys */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9B53E1E138D9E9A0028D27C /* _setjmp.s */,
+                               C9B53E1F138D9E9A0028D27C /* _sigtramp.s */,
+                               C9B53E20138D9E9A0028D27C /* atomic.c */,
+                               C9B53E21138D9E9A0028D27C /* i386_gettimeofday_asm.s */,
+                               C9B53E23138D9E9A0028D27C /* nanotime.s */,
+                               C9B53E24138D9E9A0028D27C /* OSAtomic.s */,
+                               C9B53E25138D9E9A0028D27C /* setjmp.s */,
+                               C9B53E26138D9E9A0028D27C /* spinlocks.c */,
+                               C9B53E27138D9E9A0028D27C /* spinlocks_asm.s */,
+                       );
+                       path = sys;
+                       sourceTree = "<group>";
+               };
+               C9C2A946138DF66900287F00 /* xcodescripts */ = {
+                       isa = PBXGroup;
+                       children = (
+                               C9C2A948138DF7DD00287F00 /* libc.xcconfig */,
+                               C9766153138ECF0000741512 /* variants.xcconfig */,
+                               C9194B4C140E3BC700BE0C3A /* build_linklists.sh */,
+                               C9766150138EC9D400741512 /* patch_headers_variants.pl */,
+                               C976616B138EF14100741512 /* generate_features.pl */,
+                               C94212DD13900FC3004BA536 /* mig_headers.sh */,
+                               C942135913904CBC004BA536 /* manpages.sh */,
+                               C9950E6A1390D2CA009863B6 /* headers.sh */,
+                               C9B53D92138D9E9A0028D27C /* strip-header.ed */,
+                               C9265D1113B1CF970090BA1C /* clean_simulator.sh */,
+                               C965CBF4143BC1BF003912CE /* force_libc_to_build.sh */,
+                               C93D6150143D31E300EB9023 /* sanitise_headers.sh */,
+                       );
+                       path = xcodescripts;
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+               B122F0E71432B8E600AF95D0 /* TRE */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = B122F2AA1432B8E600AF95D0 /* Build configuration list for PBXNativeTarget "TRE" */;
+                       buildPhases = (
+                               B122F0E81432B8E600AF95D0 /* Generate libc-features.h */,
+                               B122F0E91432B8E600AF95D0 /* Sources */,
+                               B122F2A91432B8E600AF95D0 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = TRE;
+                       productName = FreeBSD;
+                       productReference = B122F2AD1432B8E600AF95D0 /* libTRE.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               B1E96340157E722200FCCEE7 /* FreeBSD_gcc */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = B1E96503157E722200FCCEE7 /* Build configuration list for PBXNativeTarget "FreeBSD_gcc" */;
+                       buildPhases = (
+                               B1E96341157E722200FCCEE7 /* Generate libc-features.h */,
+                               B1E96342157E722200FCCEE7 /* Sources */,
+                               B1E96502157E722200FCCEE7 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = FreeBSD_gcc;
+                       productName = FreeBSD;
+                       productReference = B1E96506157E722200FCCEE7 /* libFreeBSD_gcc.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9257ECF138E1B5000B3107C /* FreeBSD */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9257ED3138E1B5000B3107C /* Build configuration list for PBXNativeTarget "FreeBSD" */;
+                       buildPhases = (
+                               C9BD3C3D138F189E00B389FD /* Generate libc-features.h */,
+                               C9257ECC138E1B5000B3107C /* Sources */,
+                               C9257ECD138E1B5000B3107C /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = FreeBSD;
+                       productName = FreeBSD;
+                       productReference = C9257ED0138E1B5000B3107C /* libFreeBSD.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9258093138E2D3100B3107C /* NetBSD */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9258102138E2D3100B3107C /* Build configuration list for PBXNativeTarget "NetBSD" */;
+                       buildPhases = (
+                               C9BD3C3C138F189200B389FD /* Generate libc-features.h */,
+                               C9258094138E2D3100B3107C /* Sources */,
+                               C9258100138E2D3100B3107C /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = NetBSD;
+                       productName = Base;
+                       productReference = C9258105138E2D3100B3107C /* libNetBSD.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C942102D13900C8A004BA536 /* libc.a */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C94212C913900C8A004BA536 /* Build configuration list for PBXNativeTarget "libc.a" */;
+                       buildPhases = (
+                               C942102E13900C8A004BA536 /* Generate libc-features.h */,
+                               C94212DC13900FAA004BA536 /* Compile MIG Headers */,
+                               C942102F13900C8A004BA536 /* Generate dtrace headers */,
+                               C942103013900C8A004BA536 /* Patch Headers */,
+                               C942103113900C8A004BA536 /* Sources */,
+                               C94212C713900C8A004BA536 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = libc.a;
+                       productName = "Variant Cancelable";
+                       productReference = C94212CC13900C8A004BA536 /* libc.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C95B7ED9138F3C55004311DA /* Variant_DarwinExtsn */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C95B8173138F3C55004311DA /* Build configuration list for PBXNativeTarget "Variant_DarwinExtsn" */;
+                       buildPhases = (
+                               C95B7EDA138F3C55004311DA /* Generate libc-features.h */,
+                               C95B7EDB138F3C55004311DA /* Patch Headers */,
+                               C95B7EDC138F3C55004311DA /* Sources */,
+                               C95B8171138F3C55004311DA /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Variant_DarwinExtsn;
+                       productName = "Variant Cancelable";
+                       productReference = C95B8176138F3C55004311DA /* libvDarwinExtsn.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C95B8184138F52B0004311DA /* Variant_DarwinExtsn_Cancelable */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C95B841E138F52B0004311DA /* Build configuration list for PBXNativeTarget "Variant_DarwinExtsn_Cancelable" */;
+                       buildPhases = (
+                               C95B8185138F52B0004311DA /* Generate libc-features.h */,
+                               C95B8186138F52B0004311DA /* Patch Headers */,
+                               C95B8187138F52B0004311DA /* Sources */,
+                               C95B841C138F52B0004311DA /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Variant_DarwinExtsn_Cancelable;
+                       productName = "Variant Cancelable";
+                       productReference = C95B8421138F52B0004311DA /* libvDarwinExtsnCancelable.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C95B842A138F53DB004311DA /* Variant_Pre1050 */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C95B86C4138F53DB004311DA /* Build configuration list for PBXNativeTarget "Variant_Pre1050" */;
+                       buildPhases = (
+                               C95B842B138F53DB004311DA /* Generate libc-features.h */,
+                               C95B842C138F53DB004311DA /* Patch Headers */,
+                               C95B842D138F53DB004311DA /* Sources */,
+                               C95B86C2138F53DB004311DA /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Variant_Pre1050;
+                       productName = "Variant Cancelable";
+                       productReference = C95B86C7138F53DB004311DA /* libvPre1050.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9B53E2B138DA0610028D27C /* Platform */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9B53E2D138DA0610028D27C /* Build configuration list for PBXNativeTarget "Platform" */;
+                       buildPhases = (
+                               C9BD3C3F138F18D200B389FD /* Generate libc-features.h */,
+                               C9B53E28138DA0610028D27C /* Sources */,
+                               C9B53E29138DA0610028D27C /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Platform;
+                       productName = Platform;
+                       productReference = C9B53E2C138DA0610028D27C /* libPlatform.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9C2A94C138DFFD900287F00 /* Base */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9C2A94E138DFFDA00287F00 /* Build configuration list for PBXNativeTarget "Base" */;
+                       buildPhases = (
+                               C9BD3C3E138F18B200B389FD /* Generate libc-features.h */,
+                               C91875E313FC6433001F2604 /* Compile MIG Headers */,
+                               C9258127138E3EC800B3107C /* Generate dtrace headers */,
+                               C9C2A949138DFFD900287F00 /* Sources */,
+                               C9C2A94A138DFFD900287F00 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Base;
+                       productName = Base;
+                       productReference = C9C2A94D138DFFD900287F00 /* libBase.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9D9432E138DB73300FB7ACC /* libsystem_c.dylib */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9D94330138DB73300FB7ACC /* Build configuration list for PBXNativeTarget "libsystem_c.dylib" */;
+                       buildPhases = (
+                               C9950E6B1390D2DC009863B6 /* Install Headers */,
+                               C9194B4B140E3A7100BE0C3A /* Build Link Lists */,
+                               C9D9432B138DB73300FB7ACC /* Sources */,
+                               C9D9432C138DB73300FB7ACC /* Frameworks */,
+                               C942135B13905EB9004BA536 /* Install Manpages */,
+                               C9265D1313B1CFD10090BA1C /* Clean Simulator Binaries */,
+                               C965CBF3143BBFF7003912CE /* Remove deps.c */,
+                               C93D6152143D321000EB9023 /* Sanitise Headers (rdar://problem/10241868) */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                               C9FA32C8138E41800089A94B /* PBXTargetDependency */,
+                               C9FA32CA138E41800089A94B /* PBXTargetDependency */,
+                               B1E96509157E749200FCCEE7 /* PBXTargetDependency */,
+                               C9FA32CC138E41800089A94B /* PBXTargetDependency */,
+                               B122F2D91432BA8700AF95D0 /* PBXTargetDependency */,
+                               C9D94335138DB75F00FB7ACC /* PBXTargetDependency */,
+                               C9BD3C39138F16EE00B389FD /* PBXTargetDependency */,
+                               C95B817D138F3F72004311DA /* PBXTargetDependency */,
+                               C95B8428138F5388004311DA /* PBXTargetDependency */,
+                               C95B86CC138F546E004311DA /* PBXTargetDependency */,
+                               C9EB326D138F74D20075BB52 /* PBXTargetDependency */,
+                               C9EB3515138F771F0075BB52 /* PBXTargetDependency */,
+                               C942130913901709004BA536 /* PBXTargetDependency */,
+                       );
+                       name = libsystem_c.dylib;
+                       productName = Libc;
+                       productReference = C9D9432F138DB73300FB7ACC /* libsystem_c.dylib */;
+                       productType = "com.apple.product-type.library.dynamic";
+               };
+               C9D9435F138EC3E300FB7ACC /* Variant_Cancelable */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9D94361138EC3E300FB7ACC /* Build configuration list for PBXNativeTarget "Variant_Cancelable" */;
+                       buildPhases = (
+                               C976616D138EF15900741512 /* Generate libc-features.h */,
+                               C9766152138ECA3800741512 /* Patch Headers */,
+                               C9D9435C138EC3E300FB7ACC /* Sources */,
+                               C9D9435D138EC3E300FB7ACC /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Variant_Cancelable;
+                       productName = "Variant Cancelable";
+                       productReference = C9D94360138EC3E300FB7ACC /* libvCancelable.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9EB2FC9138F6D880075BB52 /* Variant_Legacy */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9EB3263138F6D880075BB52 /* Build configuration list for PBXNativeTarget "Variant_Legacy" */;
+                       buildPhases = (
+                               C9EB2FCA138F6D880075BB52 /* Generate libc-features.h */,
+                               C9EB326B138F74600075BB52 /* Generate dtrace headers */,
+                               C9EB2FCB138F6D880075BB52 /* Patch Headers */,
+                               C9EB2FCC138F6D880075BB52 /* Sources */,
+                               C9EB3261138F6D880075BB52 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Variant_Legacy;
+                       productName = "Variant Cancelable";
+                       productReference = C9EB3266138F6D880075BB52 /* libvLegacy.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+               C9EB326F138F75580075BB52 /* Variant_Inode32 */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = C9EB350A138F75580075BB52 /* Build configuration list for PBXNativeTarget "Variant_Inode32" */;
+                       buildPhases = (
+                               C9EB3270138F75580075BB52 /* Generate libc-features.h */,
+                               C9EB3271138F75580075BB52 /* Generate dtrace headers */,
+                               C9EB3272138F75580075BB52 /* Patch Headers */,
+                               C9EB3273138F75580075BB52 /* Sources */,
+                               C9EB3508138F75580075BB52 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = Variant_Inode32;
+                       productName = "Variant Cancelable";
+                       productReference = C9EB350D138F75580075BB52 /* libvInode32.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               C9B53597138D9A690028D27C /* Project object */ = {
+                       isa = PBXProject;
+                       attributes = {
+                               LastUpgradeCheck = 0430;
+                       };
+                       buildConfigurationList = C9B5359A138D9A690028D27C /* Build configuration list for PBXProject "Libc" */;
+                       compatibilityVersion = "Xcode 3.2";
+                       developmentRegion = English;
+                       hasScannedForEncodings = 0;
+                       knownRegions = (
+                               en,
+                       );
+                       mainGroup = C9B53595138D9A690028D27C;
+                       productRefGroup = C9B535A9138D9E890028D27C /* Products */;
+                       projectDirPath = "";
+                       projectRoot = "";
+                       targets = (
+                               C9D9432E138DB73300FB7ACC /* libsystem_c.dylib */,
+                               C942102D13900C8A004BA536 /* libc.a */,
+                               C9B53E2B138DA0610028D27C /* Platform */,
+                               C9C2A94C138DFFD900287F00 /* Base */,
+                               C9257ECF138E1B5000B3107C /* FreeBSD */,
+                               B1E96340157E722200FCCEE7 /* FreeBSD_gcc */,
+                               C9258093138E2D3100B3107C /* NetBSD */,
+                               B122F0E71432B8E600AF95D0 /* TRE */,
+                               C9D9435F138EC3E300FB7ACC /* Variant_Cancelable */,
+                               C95B7ED9138F3C55004311DA /* Variant_DarwinExtsn */,
+                               C95B8184138F52B0004311DA /* Variant_DarwinExtsn_Cancelable */,
+                               C95B842A138F53DB004311DA /* Variant_Pre1050 */,
+                               C9EB2FC9138F6D880075BB52 /* Variant_Legacy */,
+                               C9EB326F138F75580075BB52 /* Variant_Inode32 */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+               B122F0E81432B8E600AF95D0 /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               B1E96341157E722200FCCEE7 /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C91875E313FC6433001F2604 /* Compile MIG Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/gen/asl_ipc.defs",
+                               "$(SRCROOT)/xcodescripts/mig_headers.sh",
+                       );
+                       name = "Compile MIG Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = "/bin/bash -e";
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_1}\"";
+                       showEnvVarsInLog = 0;
+               };
+               C9194B4B140E3A7100BE0C3A /* Build Link Lists */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/xcodescripts/build_linklists.sh",
+                       );
+                       name = "Build Link Lists";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"";
+               };
+               C9258127138E3EC800B3107C /* Generate dtrace headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/gen/magmallocProvider.d",
+                               "$(SRCROOT)/pthreads/plockstat.d",
+                       );
+                       name = "Generate dtrace headers";
+                       outputPaths = (
+                               "$(DERIVED_FILE_DIR)/dtrace/magmallocProvider.h",
+                               "$(DERIVED_FILE_DIR)/dtrace/plockstat.h",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "dtrace -h -C -s ${SCRIPT_INPUT_FILE_0} -o ${SCRIPT_OUTPUT_FILE_0}\ndtrace -h -C -s ${SCRIPT_INPUT_FILE_1} -o ${SCRIPT_OUTPUT_FILE_1}";
+                       showEnvVarsInLog = 0;
+               };
+               C9265D1313B1CFD10090BA1C /* Clean Simulator Binaries */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/xcodescripts/clean_simulator.sh",
+                       );
+                       name = "Clean Simulator Binaries";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/sh;
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"\n";
+                       showEnvVarsInLog = 0;
+               };
+               C93D6152143D321000EB9023 /* Sanitise Headers (rdar://problem/10241868) */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/xcodescripts/sanitise_headers.sh",
+                       );
+                       name = "Sanitise Headers (rdar://problem/10241868)";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = /bin/bash;
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"";
+                       showEnvVarsInLog = 0;
+               };
+               C942102E13900C8A004BA536 /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C942102F13900C8A004BA536 /* Generate dtrace headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/pthreads/plockstat.d",
+                       );
+                       name = "Generate dtrace headers";
+                       outputPaths = (
+                               "$(DERIVED_FILE_DIR)/dtrace/plockstat.h",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "dtrace -h -C -s ${SCRIPT_INPUT_FILE_0} -o ${SCRIPT_OUTPUT_FILE_0}\n";
+                       showEnvVarsInLog = 0;
+               };
+               C942103013900C8A004BA536 /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+               C94212DC13900FAA004BA536 /* Compile MIG Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/gen/asl_ipc.defs",
+                               "$(SRCROOT)/xcodescripts/mig_headers.sh",
+                       );
+                       name = "Compile MIG Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = "/bin/bash -e";
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_1}\"";
+                       showEnvVarsInLog = 0;
+               };
+               C942135B13905EB9004BA536 /* Install Manpages */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 8;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/xcodescripts/manpages.sh",
+                       );
+                       name = "Install Manpages";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 1;
+                       shellPath = "/bin/bash -e";
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"";
+                       showEnvVarsInLog = 0;
+               };
+               C95B7EDA138F3C55004311DA /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C95B7EDB138F3C55004311DA /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+               C95B8185138F52B0004311DA /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C95B8186138F52B0004311DA /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+               C95B842B138F53DB004311DA /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C95B842C138F53DB004311DA /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+               C965CBF3143BBFF7003912CE /* Remove deps.c */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/xcodescripts/force_libc_to_build.sh",
+                       );
+                       name = "Remove deps.c";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"\n";
+               };
+               C9766152138ECA3800741512 /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+               C976616D138EF15900741512 /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9950E6B1390D2DC009863B6 /* Install Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/xcodescripts/headers.sh",
+                       );
+                       name = "Install Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = "/bin/bash -e";
+                       shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"";
+                       showEnvVarsInLog = 0;
+               };
+               C9BD3C3C138F189200B389FD /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9BD3C3D138F189E00B389FD /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9BD3C3E138F18B200B389FD /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9BD3C3F138F18D200B389FD /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9EB2FCA138F6D880075BB52 /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9EB2FCB138F6D880075BB52 /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+               C9EB326B138F74600075BB52 /* Generate dtrace headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/pthreads/plockstat.d",
+                       );
+                       name = "Generate dtrace headers";
+                       outputPaths = (
+                               "$(DERIVED_FILE_DIR)/dtrace/plockstat.h",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "dtrace -h -C -s ${SCRIPT_INPUT_FILE_0} -o ${SCRIPT_OUTPUT_FILE_0}\n";
+                       showEnvVarsInLog = 0;
+               };
+               C9EB3270138F75580075BB52 /* Generate libc-features.h */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Generate libc-features.h";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl";
+                       showEnvVarsInLog = 0;
+               };
+               C9EB3271138F75580075BB52 /* Generate dtrace headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                               "$(SRCROOT)/pthreads/plockstat.d",
+                       );
+                       name = "Generate dtrace headers";
+                       outputPaths = (
+                               "$(DERIVED_FILE_DIR)/dtrace/plockstat.h",
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "dtrace -h -C -s ${SCRIPT_INPUT_FILE_0} -o ${SCRIPT_OUTPUT_FILE_0}\n";
+                       showEnvVarsInLog = 0;
+               };
+               C9EB3272138F75580075BB52 /* Patch Headers */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Patch Headers";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/bash;
+                       shellScript = "perl ${SRCROOT}/xcodescripts/patch_headers_variants.pl \\\n    \"${SDKROOT}/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders\" \\\n    \"${DERIVED_FILES_DIR}/System.framework/Versions/B\"";
+                       showEnvVarsInLog = 0;
+               };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+               B122F0E91432B8E600AF95D0 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               B122F2C71432B95B00AF95D0 /* regcomp.c in Sources */,
+                               B122F2C91432B95B00AF95D0 /* regexec.c in Sources */,
+                               B122F2CB1432B95B00AF95D0 /* tre-ast.c in Sources */,
+                               B122F2CD1432B95B00AF95D0 /* tre-compile.c in Sources */,
+                               B122F2CF1432B95B00AF95D0 /* tre-match-backtrack.c in Sources */,
+                               B122F2D11432B95B00AF95D0 /* tre-match-parallel.c in Sources */,
+                               B122F2D31432B95B00AF95D0 /* tre-mem.c in Sources */,
+                               B122F2D51432B95B00AF95D0 /* tre-parse.c in Sources */,
+                               B122F2D71432B95B00AF95D0 /* tre-stack.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               B1E96342157E722200FCCEE7 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               B1E96442157E722200FCCEE7 /* printf-pos.c in Sources */,
+                               B1E9645F157E722200FCCEE7 /* vfprintf.c in Sources */,
+                               B1E96461157E722200FCCEE7 /* vfwprintf.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9257ECC138E1B5000B3107C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9257ED5138E1C2E00B3107C /* creat.c in Sources */,
+                               C9257ED6138E1C2E00B3107C /* gethostid.c in Sources */,
+                               C9257ED7138E1C2E00B3107C /* getwd.c in Sources */,
+                               C9257ED8138E1C2E00B3107C /* killpg.c in Sources */,
+                               C9257ED9138E1C2E00B3107C /* sethostid.c in Sources */,
+                               C9257EDA138E1C2E00B3107C /* setpgrp.c in Sources */,
+                               C9257EDB138E1C2E00B3107C /* setrgid.c in Sources */,
+                               C9257EDC138E1C2E00B3107C /* setruid.c in Sources */,
+                               C9257EDD138E1C5D00B3107C /* bt_close.c in Sources */,
+                               C9257EDE138E1C5D00B3107C /* bt_conv.c in Sources */,
+                               C9257EDF138E1C5D00B3107C /* bt_debug.c in Sources */,
+                               C9257EE0138E1C5D00B3107C /* bt_delete.c in Sources */,
+                               C9257EE1138E1C5D00B3107C /* bt_get.c in Sources */,
+                               C9257EE2138E1C5D00B3107C /* bt_open.c in Sources */,
+                               C9257EE3138E1C5D00B3107C /* bt_overflow.c in Sources */,
+                               C9257EE4138E1C5D00B3107C /* bt_page.c in Sources */,
+                               C9257EE5138E1C5D00B3107C /* bt_put.c in Sources */,
+                               C9257EE6138E1C5D00B3107C /* bt_search.c in Sources */,
+                               C9257EE7138E1C5D00B3107C /* bt_seq.c in Sources */,
+                               C9257EE8138E1C5D00B3107C /* bt_split.c in Sources */,
+                               C9257EE9138E1C5D00B3107C /* bt_utils.c in Sources */,
+                               C9257EEA138E1C5D00B3107C /* db.c in Sources */,
+                               C9257EEB138E1C5D00B3107C /* hash.c in Sources */,
+                               C9257EEC138E1C5D00B3107C /* hash_bigkey.c in Sources */,
+                               C9257EED138E1C5D00B3107C /* hash_buf.c in Sources */,
+                               C9257EEE138E1C5D00B3107C /* hash_func.c in Sources */,
+                               C9257EEF138E1C5D00B3107C /* hash_log2.c in Sources */,
+                               C9257EF0138E1C5D00B3107C /* hash_page.c in Sources */,
+                               C9257EF1138E1C5D00B3107C /* ndbm.c in Sources */,
+                               C9257EF2138E1C5D00B3107C /* mpool.c in Sources */,
+                               C9257EF3138E1C5D00B3107C /* rec_close.c in Sources */,
+                               C9257EF4138E1C5D00B3107C /* rec_delete.c in Sources */,
+                               C9257EF5138E1C5D00B3107C /* rec_get.c in Sources */,
+                               C9257EF6138E1C5D00B3107C /* rec_open.c in Sources */,
+                               C9257EF7138E1C5D00B3107C /* rec_put.c in Sources */,
+                               C9257EF8138E1C5D00B3107C /* rec_search.c in Sources */,
+                               C9257EF9138E1C5D00B3107C /* rec_seq.c in Sources */,
+                               C9257EFA138E1C5D00B3107C /* rec_utils.c in Sources */,
+                               C9257EFB138E1C6A00B3107C /* _hdtoa.c in Sources */,
+                               C9257EFC138E1C6A00B3107C /* gdtoa-dmisc.c in Sources */,
+                               C9257EFD138E1C6A00B3107C /* gdtoa-dtoa.c in Sources */,
+                               C9257EFE138E1C6A00B3107C /* gdtoa-gdtoa.c in Sources */,
+                               C9257EFF138E1C6A00B3107C /* gdtoa-gethex.c in Sources */,
+                               C9257F00138E1C6A00B3107C /* gdtoa-gmisc.c in Sources */,
+                               C9257F01138E1C6A00B3107C /* gdtoa-hd_init.c in Sources */,
+                               C9257F02138E1C6A00B3107C /* gdtoa-hexnan.c in Sources */,
+                               C9257F03138E1C6A00B3107C /* gdtoa-misc.c in Sources */,
+                               C9257F04138E1C6A00B3107C /* gdtoa-smisc.c in Sources */,
+                               C9257F05138E1C6A00B3107C /* gdtoa-strtod.c in Sources */,
+                               C9257F06138E1C6A00B3107C /* gdtoa-strtodg.c in Sources */,
+                               C9257F07138E1C6A00B3107C /* gdtoa-strtof.c in Sources */,
+                               C9257F09138E1C6A00B3107C /* gdtoa-strtopdd.c in Sources */,
+                               C9257F0A138E1C6A00B3107C /* gdtoa-strtopx.c in Sources */,
+                               C9257F0B138E1C6A00B3107C /* gdtoa-strtord.c in Sources */,
+                               C9257F0C138E1C6A00B3107C /* gdtoa-sum.c in Sources */,
+                               C9257F0D138E1C6A00B3107C /* gdtoa-ulp.c in Sources */,
+                               C9257F0E138E1C6A00B3107C /* glue.c in Sources */,
+                               C9257F0F138E1C8200B3107C /* _rand48.c in Sources */,
+                               C9257F10138E1C8200B3107C /* alarm.c in Sources */,
+                               C9257F11138E1C8200B3107C /* arc4random.c in Sources */,
+                               C9257F12138E1C8200B3107C /* assert.c in Sources */,
+                               C9257F13138E1C8200B3107C /* basename.c in Sources */,
+                               C9257F14138E1C8200B3107C /* clock.c in Sources */,
+                               C9257F15138E1C8200B3107C /* closedir.c in Sources */,
+                               C9257F16138E1C8200B3107C /* ctermid.c in Sources */,
+                               C9257F17138E1C8200B3107C /* daemon.c in Sources */,
+                               C9257F18138E1C8200B3107C /* dirname.c in Sources */,
+                               C9257F19138E1C8200B3107C /* drand48.c in Sources */,
+                               C9257F1A138E1C8200B3107C /* erand48.c in Sources */,
+                               C9257F1B138E1C8200B3107C /* err.c in Sources */,
+                               C9257F1C138E1C8200B3107C /* exec.c in Sources */,
+                               C9257F1D138E1C8200B3107C /* fmtcheck.c in Sources */,
+                               C9257F1E138E1C8200B3107C /* fmtmsg.c in Sources */,
+                               C9257F1F138E1C8200B3107C /* fnmatch.c in Sources */,
+                               C9257F20138E1C8200B3107C /* ftok.c in Sources */,
+                               C9257F21138E1C8200B3107C /* getbsize.c in Sources */,
+                               C9257F22138E1C8200B3107C /* getcap.c in Sources */,
+                               C9257F23138E1C8200B3107C /* getcwd.c in Sources */,
+                               C9257F24138E1C8200B3107C /* gethostname.c in Sources */,
+                               C9257F25138E1C8200B3107C /* getlogin.c in Sources */,
+                               C9257F26138E1C8200B3107C /* getmntinfo.c in Sources */,
+                               C9257F27138E1C8200B3107C /* getpagesize.c in Sources */,
+                               C9257F28138E1C8200B3107C /* getpeereid.c in Sources */,
+                               C9257F29138E1C8200B3107C /* getprogname.c in Sources */,
+                               C9257F2A138E1C8200B3107C /* glob.c in Sources */,
+                               C9257F2B138E1C8200B3107C /* isatty.c in Sources */,
+                               C9257F2C138E1C8200B3107C /* jrand48.c in Sources */,
+                               C9257F2D138E1C8200B3107C /* lcong48.c in Sources */,
+                               C9257F2E138E1C8200B3107C /* lockf.c in Sources */,
+                               C9257F2F138E1C8200B3107C /* lrand48.c in Sources */,
+                               C9257F30138E1C8200B3107C /* mrand48.c in Sources */,
+                               C9257F31138E1C8200B3107C /* nice.c in Sources */,
+                               C9257F32138E1C8200B3107C /* nrand48.c in Sources */,
+                               C9257F33138E1C8200B3107C /* opendir.c in Sources */,
+                               C9257F34138E1C8200B3107C /* pause.c in Sources */,
+                               C9257F35138E1C8200B3107C /* popen.c in Sources */,
+                               C9257F36138E1C8200B3107C /* pselect.c in Sources */,
+                               C9257F37138E1C8200B3107C /* psignal.c in Sources */,
+                               C9257F38138E1C8200B3107C /* raise.c in Sources */,
+                               C9257F39138E1C8200B3107C /* readdir.c in Sources */,
+                               C9257F3A138E1C8200B3107C /* readpassphrase.c in Sources */,
+                               C9257F3B138E1C8200B3107C /* rewinddir.c in Sources */,
+                               C9257F3C138E1C8200B3107C /* scandir.c in Sources */,
+                               C9257F3D138E1C8200B3107C /* seed48.c in Sources */,
+                               C9257F3E138E1C8200B3107C /* seekdir.c in Sources */,
+                               C9257F3F138E1C8200B3107C /* sethostname.c in Sources */,
+                               C9257F40138E1C8200B3107C /* setmode.c in Sources */,
+                               C9257F41138E1C8200B3107C /* setprogname.c in Sources */,
+                               C9257F42138E1C8200B3107C /* siginterrupt.c in Sources */,
+                               C9257F43138E1C8200B3107C /* siglist.c in Sources */,
+                               C9257F44138E1C8200B3107C /* signal.c in Sources */,
+                               C9257F45138E1C8200B3107C /* sleep.c in Sources */,
+                               C9257F46138E1C8200B3107C /* srand48.c in Sources */,
+                               C9257F47138E1C8200B3107C /* stringlist.c in Sources */,
+                               C9257F48138E1C8200B3107C /* sysconf.c in Sources */,
+                               C9257F49138E1C8200B3107C /* sysctl.c in Sources */,
+                               C9257F4A138E1C8200B3107C /* sysctlbyname.c in Sources */,
+                               C9257F4B138E1C8200B3107C /* sysctlnametomib.c in Sources */,
+                               C9257F4C138E1C8200B3107C /* telldir.c in Sources */,
+                               C9257F4D138E1C8200B3107C /* termios.c in Sources */,
+                               C9257F4E138E1C8200B3107C /* time.c in Sources */,
+                               C9257F4F138E1C8200B3107C /* times.c in Sources */,
+                               C9257F51138E1C8200B3107C /* ttyname.c in Sources */,
+                               C9257F52138E1C8200B3107C /* ttyslot.c in Sources */,
+                               C9257F53138E1C8200B3107C /* ualarm.c in Sources */,
+                               C9257F54138E1C8200B3107C /* ulimit.c in Sources */,
+                               C9257F55138E1C8200B3107C /* unvis.c in Sources */,
+                               C9257F56138E1C8200B3107C /* usleep.c in Sources */,
+                               C9257F57138E1C8200B3107C /* utime.c in Sources */,
+                               C9257F58138E1C8200B3107C /* vis.c in Sources */,
+                               C9257F59138E1C8200B3107C /* wait.c in Sources */,
+                               C9257F5A138E1C8200B3107C /* wait3.c in Sources */,
+                               C9257F5B138E1C8200B3107C /* waitpid.c in Sources */,
+                               C9257F5C138E1C9700B3107C /* ascii.c in Sources */,
+                               C9257F5D138E1C9700B3107C /* big5.c in Sources */,
+                               C9257F5E138E1C9700B3107C /* btowc.c in Sources */,
+                               C9257F5F138E1C9700B3107C /* collate.c in Sources */,
+                               C9257F60138E1C9700B3107C /* collcmp.c in Sources */,
+                               C9257F61138E1C9700B3107C /* euc.c in Sources */,
+                               C9257F62138E1C9700B3107C /* fix_grouping.c in Sources */,
+                               C9257F63138E1C9700B3107C /* gb18030.c in Sources */,
+                               C9257F64138E1C9700B3107C /* gb2312.c in Sources */,
+                               C9257F65138E1C9700B3107C /* gbk.c in Sources */,
+                               C9257F66138E1C9700B3107C /* ldpart.c in Sources */,
+                               C9257F67138E1C9700B3107C /* lmessages.c in Sources */,
+                               C9257F68138E1C9700B3107C /* lmonetary.c in Sources */,
+                               C9257F69138E1C9700B3107C /* lnumeric.c in Sources */,
+                               C9257F6A138E1C9700B3107C /* localeconv.c in Sources */,
+                               C9257F6B138E1C9700B3107C /* mblen.c in Sources */,
+                               C9257F6C138E1C9700B3107C /* mbrlen.c in Sources */,
+                               C9257F6D138E1C9700B3107C /* mbrtowc.c in Sources */,
+                               C9257F6E138E1C9700B3107C /* mbsinit.c in Sources */,
+                               C9257F6F138E1C9700B3107C /* mbsnrtowcs.c in Sources */,
+                               C9257F70138E1C9700B3107C /* mbsrtowcs.c in Sources */,
+                               C9257F71138E1C9700B3107C /* mbstowcs.c in Sources */,
+                               C9257F72138E1C9700B3107C /* mbtowc.c in Sources */,
+                               C9257F73138E1C9700B3107C /* mskanji.c in Sources */,
+                               C9257F74138E1C9700B3107C /* nextwctype.c in Sources */,
+                               C9257F75138E1C9700B3107C /* nl_langinfo.c in Sources */,
+                               C9257F76138E1C9700B3107C /* nomacros.c in Sources */,
+                               C9257F77138E1C9700B3107C /* none.c in Sources */,
+                               C9257F79138E1C9700B3107C /* runetype.c in Sources */,
+                               C9257F7A138E1C9700B3107C /* setlocale.c in Sources */,
+                               C9257F7B138E1C9700B3107C /* setrunelocale.c in Sources */,
+                               C9257F7C138E1C9700B3107C /* table.c in Sources */,
+                               C9257F7D138E1C9700B3107C /* tolower.c in Sources */,
+                               C9257F7E138E1C9700B3107C /* toupper.c in Sources */,
+                               C9257F7F138E1C9700B3107C /* utf8.c in Sources */,
+                               C9257F80138E1C9700B3107C /* wcrtomb.c in Sources */,
+                               C9257F81138E1C9700B3107C /* wcsftime.c in Sources */,
+                               C9257F82138E1C9700B3107C /* wcsnrtombs.c in Sources */,
+                               C9257F83138E1C9700B3107C /* wcsrtombs.c in Sources */,
+                               C9257F84138E1C9700B3107C /* wcstod.c in Sources */,
+                               C9257F85138E1C9700B3107C /* wcstof.c in Sources */,
+                               C9257F86138E1C9700B3107C /* wcstoimax.c in Sources */,
+                               C9257F87138E1C9700B3107C /* wcstol.c in Sources */,
+                               C9257F88138E1C9700B3107C /* wcstold.c in Sources */,
+                               C9257F89138E1C9700B3107C /* wcstoll.c in Sources */,
+                               C9257F8A138E1C9700B3107C /* wcstombs.c in Sources */,
+                               C9257F8B138E1C9700B3107C /* wcstoul.c in Sources */,
+                               C9257F8C138E1C9700B3107C /* wcstoull.c in Sources */,
+                               C9257F8D138E1C9700B3107C /* wcstoumax.c in Sources */,
+                               C9257F8E138E1C9700B3107C /* wctob.c in Sources */,
+                               C9257F8F138E1C9700B3107C /* wctomb.c in Sources */,
+                               C9257F90138E1C9700B3107C /* wctrans.c in Sources */,
+                               C9257F91138E1C9700B3107C /* wctype.c in Sources */,
+                               C9257F92138E1C9700B3107C /* wcwidth.c in Sources */,
+                               C9257F93138E1C9700B3107C /* addr2ascii.c in Sources */,
+                               C9257F94138E1C9700B3107C /* ascii2addr.c in Sources */,
+                               C9257F95138E1C9700B3107C /* inet_addr.c in Sources */,
+                               C9257F96138E1C9700B3107C /* inet_lnaof.c in Sources */,
+                               C9257F97138E1C9700B3107C /* inet_makeaddr.c in Sources */,
+                               C9257F98138E1C9700B3107C /* inet_net_ntop.c in Sources */,
+                               C9257F99138E1C9700B3107C /* inet_net_pton.c in Sources */,
+                               C9257F9A138E1C9700B3107C /* inet_neta.c in Sources */,
+                               C9257F9B138E1C9700B3107C /* inet_netof.c in Sources */,
+                               C9257F9C138E1C9700B3107C /* inet_network.c in Sources */,
+                               C9257F9D138E1C9700B3107C /* inet_ntoa.c in Sources */,
+                               C9257F9E138E1C9700B3107C /* linkaddr.c in Sources */,
+                               C9257F9F138E1C9700B3107C /* nsap_addr.c in Sources */,
+                               C9257FA0138E1C9700B3107C /* recv.c in Sources */,
+                               C9257FA1138E1C9700B3107C /* send.c in Sources */,
+                               C9257FA2138E1C9700B3107C /* sockatmark.c in Sources */,
+                               C9257FA3138E1C9700B3107C /* sourcefilter.c in Sources */,
+                               C9257FA4138E1C9700B3107C /* msgcat.c in Sources */,
+                               C9257FA5138E1CC000B3107C /* _flock_stub.c in Sources */,
+                               C9257FA6138E1CC000B3107C /* asprintf.c in Sources */,
+                               C9257FA7138E1CC000B3107C /* clrerr.c in Sources */,
+                               C9257FA8138E1CC000B3107C /* dprintf.c in Sources */,
+                               C9257FA9138E1CC000B3107C /* fclose.c in Sources */,
+                               C9257FAA138E1CC000B3107C /* fdopen.c in Sources */,
+                               C9257FAB138E1CC000B3107C /* feof.c in Sources */,
+                               C9257FAC138E1CC000B3107C /* ferror.c in Sources */,
+                               C9257FAD138E1CC000B3107C /* fflush.c in Sources */,
+                               C9257FAE138E1CC000B3107C /* fgetc.c in Sources */,
+                               C9257FAF138E1CC000B3107C /* fgetln.c in Sources */,
+                               C9257FB0138E1CC000B3107C /* fgetpos.c in Sources */,
+                               C9257FB1138E1CC000B3107C /* fgets.c in Sources */,
+                               C9257FB2138E1CC000B3107C /* fgetwc.c in Sources */,
+                               C9257FB3138E1CC000B3107C /* fgetwln.c in Sources */,
+                               C9257FB4138E1CC000B3107C /* fgetws.c in Sources */,
+                               C9257FB5138E1CC000B3107C /* fileno.c in Sources */,
+                               C9257FB6138E1CC000B3107C /* findfp.c in Sources */,
+                               C9257FB7138E1CC000B3107C /* flags.c in Sources */,
+                               C9257FB8138E1CC000B3107C /* fopen.c in Sources */,
+                               C9257FB9138E1CC000B3107C /* fprintf.c in Sources */,
+                               C9257FBA138E1CC000B3107C /* fpurge.c in Sources */,
+                               C9257FBB138E1CC000B3107C /* fputc.c in Sources */,
+                               C9257FBC138E1CC000B3107C /* fputs.c in Sources */,
+                               C9257FBD138E1CC000B3107C /* fputwc.c in Sources */,
+                               C9257FBE138E1CC000B3107C /* fputws.c in Sources */,
+                               C9257FBF138E1CC000B3107C /* fread.c in Sources */,
+                               C9257FC0138E1CC000B3107C /* freopen.c in Sources */,
+                               C9257FC1138E1CC000B3107C /* fscanf.c in Sources */,
+                               C9257FC2138E1CC000B3107C /* fseek.c in Sources */,
+                               C9257FC3138E1CC000B3107C /* fsetpos.c in Sources */,
+                               C9257FC4138E1CC000B3107C /* ftell.c in Sources */,
+                               C9257FC5138E1CC000B3107C /* funopen.c in Sources */,
+                               C9257FC6138E1CC000B3107C /* fvwrite.c in Sources */,
+                               C9257FC7138E1CC000B3107C /* fwalk.c in Sources */,
+                               C9257FC8138E1CC000B3107C /* fwide.c in Sources */,
+                               C9257FC9138E1CC000B3107C /* fwprintf.c in Sources */,
+                               C9257FCA138E1CC000B3107C /* fwrite.c in Sources */,
+                               C9257FCB138E1CC000B3107C /* fwscanf.c in Sources */,
+                               C9257FCC138E1CC000B3107C /* getc.c in Sources */,
+                               C9257FCD138E1CC000B3107C /* getchar.c in Sources */,
+                               C9257FCE138E1CC000B3107C /* getdelim.c in Sources */,
+                               C9257FCF138E1CC000B3107C /* getline.c in Sources */,
+                               C9257FD0138E1CC000B3107C /* gets.c in Sources */,
+                               C9257FD1138E1CC000B3107C /* getw.c in Sources */,
+                               C9257FD2138E1CC000B3107C /* getwc.c in Sources */,
+                               C9257FD3138E1CC000B3107C /* getwchar.c in Sources */,
+                               C9257FD4138E1CC000B3107C /* makebuf.c in Sources */,
+                               C9257FD5138E1CC000B3107C /* mktemp.c in Sources */,
+                               C9257FD6138E1CC000B3107C /* perror.c in Sources */,
+                               C9257FD8138E1CC000B3107C /* printf.c in Sources */,
+                               C9257FD9138E1CC000B3107C /* putc.c in Sources */,
+                               C9257FDA138E1CC000B3107C /* putchar.c in Sources */,
+                               C9257FDB138E1CC000B3107C /* puts.c in Sources */,
+                               C9257FDC138E1CC000B3107C /* putw.c in Sources */,
+                               C9257FDD138E1CC000B3107C /* putwc.c in Sources */,
+                               C9257FDE138E1CC000B3107C /* putwchar.c in Sources */,
+                               C9257FDF138E1CC000B3107C /* refill.c in Sources */,
+                               C9257FE0138E1CC000B3107C /* remove.c in Sources */,
+                               C9257FE1138E1CC000B3107C /* rewind.c in Sources */,
+                               C9257FE2138E1CC000B3107C /* rget.c in Sources */,
+                               C9257FE3138E1CC000B3107C /* scanf.c in Sources */,
+                               C9257FE4138E1CC000B3107C /* setbuf.c in Sources */,
+                               C9257FE5138E1CC000B3107C /* setbuffer.c in Sources */,
+                               C9257FE6138E1CC000B3107C /* setvbuf.c in Sources */,
+                               C9257FE7138E1CC000B3107C /* snprintf.c in Sources */,
+                               C9257FE8138E1CC000B3107C /* sprintf.c in Sources */,
+                               C9257FE9138E1CC000B3107C /* sscanf.c in Sources */,
+                               C9257FEA138E1CC000B3107C /* stdio.c in Sources */,
+                               C9257FEB138E1CC000B3107C /* swprintf.c in Sources */,
+                               C9257FEC138E1CC000B3107C /* swscanf.c in Sources */,
+                               C9257FED138E1CC000B3107C /* tempnam.c in Sources */,
+                               C9257FEE138E1CC000B3107C /* tmpfile.c in Sources */,
+                               C9257FEF138E1CC000B3107C /* tmpnam.c in Sources */,
+                               C9257FF0138E1CC000B3107C /* ungetc.c in Sources */,
+                               C9257FF1138E1CC000B3107C /* ungetwc.c in Sources */,
+                               C9257FF2138E1CC000B3107C /* vasprintf.c in Sources */,
+                               C9257FF3138E1CC000B3107C /* vdprintf.c in Sources */,
+                               C9257FF5138E1CC000B3107C /* vfscanf.c in Sources */,
+                               C9257FF7138E1CC000B3107C /* vfwscanf.c in Sources */,
+                               C9257FF8138E1CC000B3107C /* vprintf.c in Sources */,
+                               C9257FF9138E1CC000B3107C /* vscanf.c in Sources */,
+                               C9257FFA138E1CC000B3107C /* vsnprintf.c in Sources */,
+                               C9257FFB138E1CC000B3107C /* vsprintf.c in Sources */,
+                               C9257FFC138E1CC000B3107C /* vsscanf.c in Sources */,
+                               C9257FFD138E1CC000B3107C /* vswprintf.c in Sources */,
+                               C9257FFE138E1CC000B3107C /* vswscanf.c in Sources */,
+                               C9257FFF138E1CC000B3107C /* vwprintf.c in Sources */,
+                               C9258000138E1CC000B3107C /* vwscanf.c in Sources */,
+                               C9258001138E1CC000B3107C /* wbuf.c in Sources */,
+                               C9258002138E1CC000B3107C /* wprintf.c in Sources */,
+                               C9258003138E1CC000B3107C /* wscanf.c in Sources */,
+                               C9258004138E1CC000B3107C /* wsetup.c in Sources */,
+                               C9258005138E1CC000B3107C /* asctime.c in Sources */,
+                               C9258006138E1CC000B3107C /* difftime.c in Sources */,
+                               C9258007138E1CC000B3107C /* ftime.c in Sources */,
+                               C9258008138E1CC000B3107C /* localtime.c in Sources */,
+                               C9258009138E1CC000B3107C /* strftime.c in Sources */,
+                               C925800A138E1CC000B3107C /* strptime.c in Sources */,
+                               C925800B138E1CC000B3107C /* time32.c in Sources */,
+                               C925800C138E1CC000B3107C /* timelocal.c in Sources */,
+                               C925800D138E1CD200B3107C /* bcmp.c in Sources */,
+                               C925800E138E1CD200B3107C /* bcopy.c in Sources */,
+                               C925800F138E1CD200B3107C /* bzero.c in Sources */,
+                               C9258010138E1CD200B3107C /* index.c in Sources */,
+                               C9258011138E1CD200B3107C /* memccpy.c in Sources */,
+                               C9258012138E1CD200B3107C /* memchr.c in Sources */,
+                               C9258013138E1CD200B3107C /* memcmp.c in Sources */,
+                               C9258014138E1CD200B3107C /* memcpy.c in Sources */,
+                               C9258015138E1CD200B3107C /* memmem.c in Sources */,
+                               C9258016138E1CD200B3107C /* memmove.c in Sources */,
+                               C9258017138E1CD200B3107C /* memset.c in Sources */,
+                               C9258018138E1CD200B3107C /* rindex.c in Sources */,
+                               C925801B138E1CD200B3107C /* strcasecmp.c in Sources */,
+                               C925801C138E1CD200B3107C /* strcasestr.c in Sources */,
+                               C925801E138E1CD200B3107C /* strchr.c in Sources */,
+                               C925801F138E1CD200B3107C /* strcmp.c in Sources */,
+                               C9258020138E1CD200B3107C /* strcoll.c in Sources */,
+                               C9258022138E1CD200B3107C /* strcspn.c in Sources */,
+                               C9258023138E1CD200B3107C /* strdup.c in Sources */,
+                               C9258024138E1CD200B3107C /* strerror.c in Sources */,
+                               C9258027138E1CD200B3107C /* strlen.c in Sources */,
+                               C9258028138E1CD200B3107C /* strmode.c in Sources */,
+                               C925802A138E1CD200B3107C /* strncmp.c in Sources */,
+                               C925802C138E1CD200B3107C /* strndup.c in Sources */,
+                               C925802D138E1CD200B3107C /* strnlen.c in Sources */,
+                               C925802E138E1CD200B3107C /* strnstr.c in Sources */,
+                               C925802F138E1CD200B3107C /* strpbrk.c in Sources */,
+                               C9258030138E1CD200B3107C /* strrchr.c in Sources */,
+                               C9258031138E1CD200B3107C /* strsep.c in Sources */,
+                               C9258032138E1CD200B3107C /* strsignal.c in Sources */,
+                               C9258033138E1CD200B3107C /* strspn.c in Sources */,
+                               C9258034138E1CD200B3107C /* strstr.c in Sources */,
+                               C9258035138E1CD200B3107C /* strtok.c in Sources */,
+                               C9258036138E1CD200B3107C /* strxfrm.c in Sources */,
+                               C9258037138E1CD200B3107C /* swab.c in Sources */,
+                               C9258038138E1CD200B3107C /* wcpcpy.c in Sources */,
+                               C9258039138E1CD200B3107C /* wcpncpy.c in Sources */,
+                               C925803A138E1CD200B3107C /* wcscasecmp.c in Sources */,
+                               C925803B138E1CD200B3107C /* wcscat.c in Sources */,
+                               C925803C138E1CD200B3107C /* wcschr.c in Sources */,
+                               C925803D138E1CD200B3107C /* wcscmp.c in Sources */,
+                               C925803E138E1CD200B3107C /* wcscoll.c in Sources */,
+                               C925803F138E1CD200B3107C /* wcscpy.c in Sources */,
+                               C9258040138E1CD200B3107C /* wcscspn.c in Sources */,
+                               C9258041138E1CD200B3107C /* wcsdup.c in Sources */,
+                               C9258042138E1CD200B3107C /* wcslcat.c in Sources */,
+                               C9258043138E1CD200B3107C /* wcslcpy.c in Sources */,
+                               C9258044138E1CD200B3107C /* wcslen.c in Sources */,
+                               C9258045138E1CD200B3107C /* wcsncasecmp.c in Sources */,
+                               C9258046138E1CD200B3107C /* wcsncat.c in Sources */,
+                               C9258047138E1CD200B3107C /* wcsncmp.c in Sources */,
+                               C9258048138E1CD200B3107C /* wcsncpy.c in Sources */,
+                               C9258049138E1CD200B3107C /* wcsnlen.c in Sources */,
+                               C925804A138E1CD200B3107C /* wcspbrk.c in Sources */,
+                               C925804B138E1CD200B3107C /* wcsrchr.c in Sources */,
+                               C925804C138E1CD200B3107C /* wcsspn.c in Sources */,
+                               C925804D138E1CD200B3107C /* wcsstr.c in Sources */,
+                               C925804E138E1CD200B3107C /* wcstok.c in Sources */,
+                               C925804F138E1CD200B3107C /* wcswidth.c in Sources */,
+                               C9258050138E1CD200B3107C /* wcsxfrm.c in Sources */,
+                               C9258051138E1CD200B3107C /* wmemchr.c in Sources */,
+                               C9258052138E1CD200B3107C /* wmemcmp.c in Sources */,
+                               C9258053138E1CD200B3107C /* wmemcpy.c in Sources */,
+                               C9258054138E1CD200B3107C /* wmemmove.c in Sources */,
+                               C9258055138E1CD200B3107C /* wmemset.c in Sources */,
+                               C9258058138E1CDD00B3107C /* regerror.c in Sources */,
+                               C9FA32F4138E49550089A94B /* abort.c in Sources */,
+                               C9FA32F9138E4A5C0089A94B /* utf2.c in Sources */,
+                               C9FA3312138E4C490089A94B /* stack_protector.c in Sources */,
+                               C9FA3315138E4D040089A94B /* a64l.c in Sources */,
+                               C9FA3316138E4D040089A94B /* _Exit_.c in Sources */,
+                               C9FA3317138E4D040089A94B /* abs.c in Sources */,
+                               C9FA3318138E4D040089A94B /* atexit.c in Sources */,
+                               C9FA3319138E4D040089A94B /* atof.c in Sources */,
+                               C9FA331A138E4D040089A94B /* atoi.c in Sources */,
+                               C9FA331B138E4D040089A94B /* atol.c in Sources */,
+                               C9FA331C138E4D040089A94B /* atoll.c in Sources */,
+                               C9FA331D138E4D040089A94B /* bsearch.c in Sources */,
+                               C9FA331E138E4D040089A94B /* div.c in Sources */,
+                               C9FA331F138E4D040089A94B /* exit.c in Sources */,
+                               C9FA3320138E4D040089A94B /* getenv.c in Sources */,
+                               C9FA3321138E4D040089A94B /* getopt.c in Sources */,
+                               C9FA3322138E4D040089A94B /* getopt_long.c in Sources */,
+                               C9FA3323138E4D040089A94B /* getsubopt.c in Sources */,
+                               C9FA3324138E4D040089A94B /* hcreate.c in Sources */,
+                               C9FA3325138E4D040089A94B /* heapsort.c in Sources */,
+                               C9FA3326138E4D040089A94B /* imaxabs.c in Sources */,
+                               C9FA3327138E4D040089A94B /* imaxdiv.c in Sources */,
+                               C9FA3328138E4D040089A94B /* insque.c in Sources */,
+                               C9FA3329138E4D040089A94B /* labs.c in Sources */,
+                               C9FA332A138E4D040089A94B /* ldiv.c in Sources */,
+                               C9FA332B138E4D040089A94B /* llabs.c in Sources */,
+                               C9FA332C138E4D040089A94B /* lldiv.c in Sources */,
+                               C9FA332D138E4D040089A94B /* lsearch.c in Sources */,
+                               C9FA332E138E4D040089A94B /* merge.c in Sources */,
+                               C9FA332F138E4D040089A94B /* putenv.c in Sources */,
+                               C9FA3330138E4D040089A94B /* qsort.c in Sources */,
+                               C9FA3331138E4D040089A94B /* qsort_r.c in Sources */,
+                               C9FA3332138E4D040089A94B /* radixsort.c in Sources */,
+                               C9FA3333138E4D040089A94B /* rand.c in Sources */,
+                               C9FA3334138E4D040089A94B /* random.c in Sources */,
+                               C9FA3335138E4D040089A94B /* reallocf.c in Sources */,
+                               C9FA3336138E4D040089A94B /* realpath.c in Sources */,
+                               C9FA3337138E4D040089A94B /* remque.c in Sources */,
+                               C9FA3338138E4D040089A94B /* setenv.c in Sources */,
+                               C9FA3339138E4D040089A94B /* strhash.c in Sources */,
+                               C9FA333A138E4D040089A94B /* strtoimax.c in Sources */,
+                               C9FA333B138E4D040089A94B /* strtol.c in Sources */,
+                               C9FA333C138E4D040089A94B /* strtoll.c in Sources */,
+                               C9FA333D138E4D040089A94B /* strtoq.c in Sources */,
+                               C9FA333E138E4D040089A94B /* strtoul.c in Sources */,
+                               C9FA333F138E4D040089A94B /* strtoull.c in Sources */,
+                               C9FA3340138E4D040089A94B /* strtoumax.c in Sources */,
+                               C9FA3341138E4D040089A94B /* strtouq.c in Sources */,
+                               C9FA3342138E4D040089A94B /* system.c in Sources */,
+                               C9FA3343138E4D040089A94B /* tdelete.c in Sources */,
+                               C9FA3344138E4D040089A94B /* tfind.c in Sources */,
+                               C9FA3345138E4D040089A94B /* tsearch.c in Sources */,
+                               C9FA3346138E4D040089A94B /* twalk.c in Sources */,
+                               C9FA3347138E4D040089A94B /* grantpt.c in Sources */,
+                               C9FA3348138E4D040089A94B /* l64a.c in Sources */,
+                               C9FA334A138E4D040089A94B /* ecvt.c in Sources */,
+                               C9FA334B138E4D040089A94B /* gcvt.c in Sources */,
+                               C9FA334C138E4D040089A94B /* qsort_b-fbsd.c in Sources */,
+                               C9D94359138EC0C600FB7ACC /* heapsort_b.c in Sources */,
+                               C9D9435A138EC0C600FB7ACC /* heapsort_r.c in Sources */,
+                               C9421021138F2602004BA536 /* _ldtoa.c in Sources */,
+                               C9421022138F2661004BA536 /* machdep_ldisd.c in Sources */,
+                               C9421023138F2661004BA536 /* machdep_ldisdd.c in Sources */,
+                               C9421024138F2661004BA536 /* machdep_ldisQ.c in Sources */,
+                               C9421025138F2661004BA536 /* machdep_ldisx.c in Sources */,
+                               C95B7ED7138F3BEA004311DA /* rune.c in Sources */,
+                               C9EB2FC1138F6BB00075BB52 /* merge_b.c in Sources */,
+                               C9EB2FC4138F6C5C0075BB52 /* psort.c in Sources */,
+                               C9EB2FC7138F6CE10075BB52 /* psort_b.c in Sources */,
+                               C9EB2FC8138F6CE10075BB52 /* psort_r.c in Sources */,
+                               C9EB350F138F769B0075BB52 /* scandir_b.c in Sources */,
+                               C9EB3550138F7EA50075BB52 /* getmntinfo64.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9258094138E2D3100B3107C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C92580CC138E2D3100B3107C /* utmpx.c in Sources */,
+                               C9FA334D138E4D0C0089A94B /* strfmon.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C942103113900C8A004BA536 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C94213311390396E004BA536 /* _ctx_start.S in Sources */,
+                               C94213321390396E004BA536 /* _setcontext.S in Sources */,
+                               C94213331390396E004BA536 /* cpu_number.s in Sources */,
+                               C94213341390396E004BA536 /* getcontext.S in Sources */,
+                               C94213351390396E004BA536 /* icacheinval.s in Sources */,
+                               C94213361390396E004BA536 /* mcount.s in Sources */,
+                               C94213371390396E004BA536 /* preempt.s in Sources */,
+                               C94213381390396E004BA536 /* pthread_getspecific.s in Sources */,
+                               C94213391390396E004BA536 /* pthread_mutex_lock.s in Sources */,
+                               C942133A1390396E004BA536 /* pthread_self.s in Sources */,
+                               C942133B1390396E004BA536 /* pthread_set_self.s in Sources */,
+                               C942133C1390396E004BA536 /* start_wqthread.s in Sources */,
+                               C942133D1390396E004BA536 /* thread_start.s in Sources */,
+                               C942133E1390396E004BA536 /* __bzero.s in Sources */,
+                               C942133F1390396E004BA536 /* bcopy_scalar.s in Sources */,
+                               C94213401390396E004BA536 /* bcopy_sse2.s in Sources */,
+                               C94213411390396E004BA536 /* bcopy_sse3x.s in Sources */,
+                               C94213421390396E004BA536 /* bcopy_sse42.s in Sources */,
+                               C94213431390396E004BA536 /* bzero_scalar.s in Sources */,
+                               C94213441390396E004BA536 /* bzero_sse2.s in Sources */,
+                               C94213451390396E004BA536 /* bzero_sse42.s in Sources */,
+                               C94213461390396E004BA536 /* ffs.s in Sources */,
+                               C94213471390396E004BA536 /* longcopy_sse3x.s in Sources */,
+                               C94213481390396E004BA536 /* memcmp.s in Sources */,
+                               C94213491390396E004BA536 /* memset.s in Sources */,
+                               C942134A1390396E004BA536 /* memset_pattern_sse2.s in Sources */,
+                               C942134B1390396E004BA536 /* strcmp.s in Sources */,
+                               C942134C1390396E004BA536 /* strcpy.s in Sources */,
+                               C942134D1390396E004BA536 /* strlcat.s in Sources */,
+                               C942134E1390396E004BA536 /* strlcpy.s in Sources */,
+                               C942134F1390396E004BA536 /* strlen.s in Sources */,
+                               C94213501390396E004BA536 /* strncmp.s in Sources */,
+                               C94213511390396E004BA536 /* strncpy.s in Sources */,
+                               C94213521390396E004BA536 /* _setjmp.s in Sources */,
+                               C94213531390396E004BA536 /* _sigtramp.s in Sources */,
+                               C94213541390396E004BA536 /* i386_gettimeofday_asm.s in Sources */,
+                               C94213551390396E004BA536 /* mach_absolute_time_asm.s in Sources */,
+                               C94213561390396E004BA536 /* OSAtomic.s in Sources */,
+                               C94213571390396E004BA536 /* setjmp.s in Sources */,
+                               C94213581390396E004BA536 /* spinlocks_asm.s in Sources */,
+                               C942130A13903959004BA536 /* cpu_number.s in Sources */,
+                               C942130B13903959004BA536 /* icacheinval.s in Sources */,
+                               C942130C13903959004BA536 /* pthread_getspecific.s in Sources */,
+                               C942130D13903959004BA536 /* pthread_self.s in Sources */,
+                               C942130E13903959004BA536 /* pthread_set_self.s in Sources */,
+                               C942130F13903959004BA536 /* start_wqthread.s in Sources */,
+                               C942131013903959004BA536 /* thread_start.s in Sources */,
+                               C942131313903959004BA536 /* bcopy_Generic.s in Sources */,
+                               C942131613903959004BA536 /* bzero_Generic.s in Sources */,
+                               C942131713903959004BA536 /* ffs.s in Sources */,
+                               C942131813903959004BA536 /* memcmp.s in Sources */,
+                               C942131913903959004BA536 /* memset_pattern.s in Sources */,
+                               C942131A13903959004BA536 /* strchr.s in Sources */,
+                               C942131B13903959004BA536 /* strcmp.s in Sources */,
+                               C942131E13903959004BA536 /* strlen.s in Sources */,
+                               C942131F13903959004BA536 /* strncmp.s in Sources */,
+                               C942132113903959004BA536 /* strnlen.s in Sources */,
+                               C942132213903959004BA536 /* strstr.s in Sources */,
+                               C942132313903959004BA536 /* _longjmp.s in Sources */,
+                               C942132413903959004BA536 /* _setjmp.h in Sources */,
+                               C942132513903959004BA536 /* _setjmp.s in Sources */,
+                               C942132613903959004BA536 /* longjmp.s in Sources */,
+                               C942132713903959004BA536 /* mach_absolute_time.s in Sources */,
+                               C942132913903959004BA536 /* OSAtomic_resolvers.h in Sources */,
+                               C942132A13903959004BA536 /* setjmp.s in Sources */,
+                               C94212DE13901595004BA536 /* _ctx_start.S in Sources */,
+                               C94212DF13901595004BA536 /* _setcontext.S in Sources */,
+                               C94212E013901595004BA536 /* cpu_number.s in Sources */,
+                               C94212E113901595004BA536 /* getcontext.S in Sources */,
+                               C94212E213901595004BA536 /* icacheinval.s in Sources */,
+                               C94212E413901595004BA536 /* mcount.s in Sources */,
+                               C94212E513901595004BA536 /* setjmperr.c in Sources */,
+                               C94212E713901595004BA536 /* preempt.s in Sources */,
+                               C94212E813901595004BA536 /* pthread_getspecific.s in Sources */,
+                               C94212E913901595004BA536 /* pthread_mutex_lock.s in Sources */,
+                               C94212EA13901595004BA536 /* pthread_self.s in Sources */,
+                               C94212EB13901595004BA536 /* pthread_set_self.s in Sources */,
+                               C94212EC13901595004BA536 /* start_wqthread.s in Sources */,
+                               C94212ED13901595004BA536 /* thread_start.s in Sources */,
+                               C94212EF13901595004BA536 /* __bzero.s in Sources */,
+                               C94212F013901595004BA536 /* bcopy_sse3x.s in Sources */,
+                               C94212F113901595004BA536 /* bcopy_sse42.s in Sources */,
+                               C94212F213901595004BA536 /* bzero_sse2.s in Sources */,
+                               C94212F313901595004BA536 /* bzero_sse42.s in Sources */,
+                               C94212F413901595004BA536 /* ffs.s in Sources */,
+                               C94212F513901595004BA536 /* longcopy_sse3x.s in Sources */,
+                               C94212F713901595004BA536 /* memcmp.s in Sources */,
+                               C94212F813901595004BA536 /* memset.s in Sources */,
+                               C94212F913901595004BA536 /* strcmp.s in Sources */,
+                               C94212FA13901595004BA536 /* strcpy.s in Sources */,
+                               C94212FB13901595004BA536 /* strlcat.s in Sources */,
+                               C94212FC13901595004BA536 /* strlcpy.s in Sources */,
+                               C94212FD13901595004BA536 /* strlen.s in Sources */,
+                               C94212FE13901595004BA536 /* strncmp.s in Sources */,
+                               C94212FF13901595004BA536 /* strncpy.s in Sources */,
+                               C942130013901595004BA536 /* _setjmp.s in Sources */,
+                               C942130113901595004BA536 /* _sigtramp.s in Sources */,
+                               C942130213901595004BA536 /* i386_gettimeofday_asm.s in Sources */,
+                               C942130413901595004BA536 /* nanotime.s in Sources */,
+                               C942130513901595004BA536 /* OSAtomic.s in Sources */,
+                               C942130613901595004BA536 /* setjmp.s in Sources */,
+                               C942130713901595004BA536 /* spinlocks_asm.s in Sources */,
+                               C94212D113900ED1004BA536 /* dirhelper.defs in Sources */,
+                               C94212D213900ED1004BA536 /* asl_ipc.defs in Sources */,
+                               C942103213900C8A004BA536 /* init_cpu_capabilities.c in Sources */,
+                               C942103313900C8A004BA536 /* dyld_resolvers.c in Sources */,
+                               C942103413900C8A004BA536 /* arm_commpage_gettimeofday.c in Sources */,
+                               C942103513900C8A004BA536 /* gcc_atomic.c in Sources */,
+                               C942103613900C8A004BA536 /* OSAtomic-v4.c in Sources */,
+                               C942103713900C8A004BA536 /* OSAtomic_resolvers.c in Sources */,
+                               C942103913900C8A004BA536 /* creat.c in Sources */,
+                               C942103A13900C8A004BA536 /* gethostid.c in Sources */,
+                               C942103B13900C8A004BA536 /* getwd.c in Sources */,
+                               C942103C13900C8A004BA536 /* killpg.c in Sources */,
+                               C942103D13900C8A004BA536 /* sethostid.c in Sources */,
+                               C942103E13900C8A004BA536 /* setpgrp.c in Sources */,
+                               C942103F13900C8A004BA536 /* setrgid.c in Sources */,
+                               C942104013900C8A004BA536 /* setruid.c in Sources */,
+                               C942104113900C8A004BA536 /* setregid.c in Sources */,
+                               C942104213900C8A004BA536 /* setreuid.c in Sources */,
+                               C942104313900C8A004BA536 /* sigaltstk.c in Sources */,
+                               C942104413900C8A004BA536 /* sigcompat.c in Sources */,
+                               C942104513900C8A004BA536 /* _dirhelper.c in Sources */,
+                               C942104613900C8A004BA536 /* kvm.c in Sources */,
+                               C942104713900C8A004BA536 /* libproc.c in Sources */,
+                               C942104813900C8A004BA536 /* MKGetTimeBaseInfo.c in Sources */,
+                               C942104913900C8A004BA536 /* proc_listpidspath.c in Sources */,
+                               C942104A13900C8A004BA536 /* forceLibcToBuild.c in Sources */,
+                               C942104B13900C8A004BA536 /* bt_close.c in Sources */,
+                               C942104C13900C8A004BA536 /* bt_conv.c in Sources */,
+                               C942104D13900C8A004BA536 /* bt_debug.c in Sources */,
+                               C942104E13900C8A004BA536 /* bt_delete.c in Sources */,
+                               C942104F13900C8A004BA536 /* bt_get.c in Sources */,
+                               C942105013900C8A004BA536 /* bt_open.c in Sources */,
+                               C942105113900C8A004BA536 /* bt_overflow.c in Sources */,
+                               C942105213900C8A004BA536 /* bt_page.c in Sources */,
+                               C942105313900C8A004BA536 /* bt_put.c in Sources */,
+                               C942105413900C8A004BA536 /* bt_search.c in Sources */,
+                               C942105513900C8A004BA536 /* bt_seq.c in Sources */,
+                               C942105613900C8A004BA536 /* bt_split.c in Sources */,
+                               C942105713900C8A004BA536 /* bt_utils.c in Sources */,
+                               C942105813900C8A004BA536 /* db.c in Sources */,
+                               C942105913900C8A004BA536 /* hash.c in Sources */,
+                               C942105A13900C8A004BA536 /* hash_bigkey.c in Sources */,
+                               C942105B13900C8A004BA536 /* hash_buf.c in Sources */,
+                               C942105C13900C8A004BA536 /* hash_func.c in Sources */,
+                               C942105D13900C8A004BA536 /* hash_log2.c in Sources */,
+                               C942105E13900C8A004BA536 /* hash_page.c in Sources */,
+                               C942105F13900C8A004BA536 /* ndbm.c in Sources */,
+                               C942106013900C8A004BA536 /* mpool.c in Sources */,
+                               C942106113900C8A004BA536 /* rec_close.c in Sources */,
+                               C942106213900C8A004BA536 /* rec_delete.c in Sources */,
+                               C942106313900C8A004BA536 /* rec_get.c in Sources */,
+                               C942106413900C8A004BA536 /* rec_open.c in Sources */,
+                               C942106513900C8A004BA536 /* rec_put.c in Sources */,
+                               C942106613900C8A004BA536 /* rec_search.c in Sources */,
+                               C942106713900C8A004BA536 /* rec_seq.c in Sources */,
+                               C942106813900C8A004BA536 /* rec_utils.c in Sources */,
+                               C942106913900C8A004BA536 /* brk.c in Sources */,
+                               C942106A13900C8A004BA536 /* bsd_signal.c in Sources */,
+                               C942106B13900C8A004BA536 /* lchflags.c in Sources */,
+                               C942106C13900C8A004BA536 /* lchmod.c in Sources */,
+                               C942106D13900C8A004BA536 /* lutimes.c in Sources */,
+                               C942106E13900C8A004BA536 /* statvfs.c in Sources */,
+                               C942106F13900C8A004BA536 /* tcgetsid.c in Sources */,
+                               C942107013900C8A004BA536 /* _ldbl_util.c in Sources */,
+                               C942107113900C8A004BA536 /* _hdtoa.c in Sources */,
+                               C942107213900C8A004BA536 /* _ldtoa.c in Sources */,
+                               C942107313900C8A004BA536 /* gdtoa-dmisc.c in Sources */,
+                               C942107413900C8A004BA536 /* gdtoa-dtoa.c in Sources */,
+                               C942107513900C8A004BA536 /* gdtoa-gdtoa.c in Sources */,
+                               C942107613900C8A004BA536 /* gdtoa-gethex.c in Sources */,
+                               C942107713900C8A004BA536 /* gdtoa-gmisc.c in Sources */,
+                               C942107813900C8A004BA536 /* gdtoa-hd_init.c in Sources */,
+                               C942107913900C8A004BA536 /* gdtoa-hexnan.c in Sources */,
+                               C942107A13900C8A004BA536 /* gdtoa-misc.c in Sources */,
+                               C942107B13900C8A004BA536 /* gdtoa-smisc.c in Sources */,
+                               C942107C13900C8A004BA536 /* gdtoa-strtod.c in Sources */,
+                               C942107D13900C8A004BA536 /* gdtoa-strtodg.c in Sources */,
+                               C942107E13900C8A004BA536 /* gdtoa-strtof.c in Sources */,
+                               C942107F13900C8A004BA536 /* gdtoa-strtoIg.c in Sources */,
+                               C942108013900C8A004BA536 /* gdtoa-strtopdd.c in Sources */,
+                               C942108113900C8A004BA536 /* gdtoa-strtopx.c in Sources */,
+                               C942108213900C8A004BA536 /* gdtoa-strtord.c in Sources */,
+                               C942108313900C8A004BA536 /* gdtoa-sum.c in Sources */,
+                               C942108413900C8A004BA536 /* gdtoa-ulp.c in Sources */,
+                               C942108513900C8A004BA536 /* glue.c in Sources */,
+                               C942108613900C8A004BA536 /* machdep_ldisd.c in Sources */,
+                               C942108713900C8A004BA536 /* machdep_ldisdd.c in Sources */,
+                               C942108813900C8A004BA536 /* machdep_ldisQ.c in Sources */,
+                               C942108913900C8A004BA536 /* machdep_ldisx.c in Sources */,
+                               C942108A13900C8A004BA536 /* _simple.c in Sources */,
+                               C942108B13900C8A004BA536 /* asl.c in Sources */,
+                               C942108C13900C8A004BA536 /* asl_core.c in Sources */,
+                               C942108D13900C8A004BA536 /* asl_file.c in Sources */,
+                               C942108E13900C8A004BA536 /* asl_legacy1.c in Sources */,
+                               C942108F13900C8A004BA536 /* asl_msg.c in Sources */,
+                               C942109013900C8A004BA536 /* asl_store.c in Sources */,
+                               C942109113900C8A004BA536 /* asl_util.c in Sources */,
+                               C942109213900C8A004BA536 /* assumes.c in Sources */,
+                               C942109313900C8A004BA536 /* authentication.c in Sources */,
+                               C942109413900C8A004BA536 /* backtrace.c in Sources */,
+                               C942109513900C8A004BA536 /* cache.c in Sources */,
+                               C942109613900C8A004BA536 /* confstr.c in Sources */,
+                               C942109713900C8A004BA536 /* crypt.c in Sources */,
+                               C942109813900C8A004BA536 /* devname.c in Sources */,
+                               C942109913900C8A004BA536 /* disklabel.c in Sources */,
+                               C942109A13900C8A004BA536 /* errlst.c in Sources */,
+                               C942109B13900C8A004BA536 /* filesec.c in Sources */,
+                               C942109C13900C8A004BA536 /* _rand48.c in Sources */,
+                               C942109D13900C8A004BA536 /* alarm.c in Sources */,
+                               C942109E13900C8A004BA536 /* arc4random.c in Sources */,
+                               C942109F13900C8A004BA536 /* assert.c in Sources */,
+                               C94210A013900C8A004BA536 /* basename.c in Sources */,
+                               C94210A113900C8A004BA536 /* clock.c in Sources */,
+                               C94210A213900C8A004BA536 /* closedir.c in Sources */,
+                               C94210A313900C8A004BA536 /* ctermid.c in Sources */,
+                               C94210A413900C8A004BA536 /* daemon.c in Sources */,
+                               C94210A513900C8A004BA536 /* dirname.c in Sources */,
+                               C94210A613900C8A004BA536 /* drand48.c in Sources */,
+                               C94210A713900C8A004BA536 /* erand48.c in Sources */,
+                               C94210A813900C8A004BA536 /* err.c in Sources */,
+                               C94210A913900C8A004BA536 /* exec.c in Sources */,
+                               C94210AA13900C8A004BA536 /* fmtcheck.c in Sources */,
+                               C94210AB13900C8A004BA536 /* fmtmsg.c in Sources */,
+                               C94210AC13900C8A004BA536 /* fnmatch.c in Sources */,
+                               C94210AD13900C8A004BA536 /* ftok.c in Sources */,
+                               C94210AE13900C8A004BA536 /* getbsize.c in Sources */,
+                               C94210AF13900C8A004BA536 /* getcap.c in Sources */,
+                               C94210B013900C8A004BA536 /* getcwd.c in Sources */,
+                               C94210B113900C8A004BA536 /* gethostname.c in Sources */,
+                               C94210B213900C8A004BA536 /* getlogin.c in Sources */,
+                               C94210B313900C8A004BA536 /* getmntinfo.c in Sources */,
+                               C94210B413900C8A004BA536 /* getpagesize.c in Sources */,
+                               C94210B513900C8A004BA536 /* getpeereid.c in Sources */,
+                               C94210B613900C8A004BA536 /* getprogname.c in Sources */,
+                               C94210B713900C8A004BA536 /* glob.c in Sources */,
+                               C94210B813900C8A004BA536 /* isatty.c in Sources */,
+                               C94210B913900C8A004BA536 /* jrand48.c in Sources */,
+                               C94210BA13900C8A004BA536 /* lcong48.c in Sources */,
+                               C94210BB13900C8A004BA536 /* lockf.c in Sources */,
+                               C94210BC13900C8A004BA536 /* lrand48.c in Sources */,
+                               C94210BD13900C8A004BA536 /* mrand48.c in Sources */,
+                               C94210BE13900C8A004BA536 /* nice.c in Sources */,
+                               C94210BF13900C8A004BA536 /* nrand48.c in Sources */,
+                               C94210C013900C8A004BA536 /* opendir.c in Sources */,
+                               C94210C113900C8A004BA536 /* pause.c in Sources */,
+                               C94210C213900C8A004BA536 /* popen.c in Sources */,
+                               C94210C313900C8A004BA536 /* pselect.c in Sources */,
+                               C94210C413900C8A004BA536 /* psignal.c in Sources */,
+                               C94210C513900C8A004BA536 /* raise.c in Sources */,
+                               C94210C613900C8A004BA536 /* readdir.c in Sources */,
+                               C94210C713900C8A004BA536 /* readpassphrase.c in Sources */,
+                               C94210C813900C8A004BA536 /* rewinddir.c in Sources */,
+                               C94210C913900C8A004BA536 /* scandir.c in Sources */,
+                               C94210CA13900C8A004BA536 /* seed48.c in Sources */,
+                               C94210CB13900C8A004BA536 /* seekdir.c in Sources */,
+                               C94210CC13900C8A004BA536 /* sethostname.c in Sources */,
+                               C94210CD13900C8A004BA536 /* setmode.c in Sources */,
+                               C94210CE13900C8A004BA536 /* setprogname.c in Sources */,
+                               C94210CF13900C8A004BA536 /* siginterrupt.c in Sources */,
+                               C94210D013900C8A004BA536 /* siglist.c in Sources */,
+                               C94210D113900C8A004BA536 /* signal.c in Sources */,
+                               C94210D213900C8A004BA536 /* sleep.c in Sources */,
+                               C94210D313900C8A004BA536 /* srand48.c in Sources */,
+                               C94210D413900C8A004BA536 /* stringlist.c in Sources */,
+                               C94210D513900C8A004BA536 /* sysconf.c in Sources */,
+                               C94210D613900C8A004BA536 /* sysctl.c in Sources */,
+                               C94210D713900C8A004BA536 /* sysctlbyname.c in Sources */,
+                               C94210D813900C8A004BA536 /* sysctlnametomib.c in Sources */,
+                               C94210D913900C8A004BA536 /* telldir.c in Sources */,
+                               C94210DA13900C8A004BA536 /* termios.c in Sources */,
+                               C94210DB13900C8A004BA536 /* time.c in Sources */,
+                               C94210DC13900C8A004BA536 /* times.c in Sources */,
+                               C94210DD13900C8A004BA536 /* timezone.c in Sources */,
+                               C94210DE13900C8A004BA536 /* ttyname.c in Sources */,
+                               C94210DF13900C8A004BA536 /* ttyslot.c in Sources */,
+                               C94210E013900C8A004BA536 /* ualarm.c in Sources */,
+                               C94210E113900C8A004BA536 /* ulimit.c in Sources */,
+                               C94210E213900C8A004BA536 /* unvis.c in Sources */,
+                               C94210E313900C8A004BA536 /* usleep.c in Sources */,
+                               C94210E413900C8A004BA536 /* utime.c in Sources */,
+                               C94210E513900C8A004BA536 /* vis.c in Sources */,
+                               C94210E613900C8A004BA536 /* wait.c in Sources */,
+                               C94210E713900C8A004BA536 /* wait3.c in Sources */,
+                               C94210E813900C8A004BA536 /* waitpid.c in Sources */,
+                               C94210E913900C8A004BA536 /* fts.c in Sources */,
+                               C94210EA13900C8A004BA536 /* get_compat.c in Sources */,
+                               C94210EB13900C8A004BA536 /* getloadavg.c in Sources */,
+                               C94210EC13900C8A004BA536 /* getttyent.c in Sources */,
+                               C94210ED13900C8A004BA536 /* getusershell.c in Sources */,
+                               C94210EE13900C8A004BA536 /* getvfsbyname.c in Sources */,
+                               C94210EF13900C8A004BA536 /* isinf.c in Sources */,
+                               C94210F013900C8A004BA536 /* isnan.c in Sources */,
+                               C94210F113900C8A004BA536 /* magazine_malloc.c in Sources */,
+                               C94210F213900C8A004BA536 /* malloc.c in Sources */,
+                               C94210F313900C8A004BA536 /* nanosleep.c in Sources */,
+                               C94210F413900C8A004BA536 /* utmpx.c in Sources */,
+                               C94210F513900C8A004BA536 /* nftw.c in Sources */,
+                               C94210F613900C8A004BA536 /* nlist.c in Sources */,
+                               C94210F713900C8A004BA536 /* NSSystemDirectories.c in Sources */,
+                               C94210F813900C8A004BA536 /* oldsyslog.c in Sources */,
+                               C94210F913900C8A004BA536 /* platfunc.c in Sources */,
+                               C94210FA13900C8A004BA536 /* scalable_malloc.c in Sources */,
+                               C94210FB13900C8A004BA536 /* setlogin.c in Sources */,
+                               C94210FC13900C8A004BA536 /* sigsetops.c in Sources */,
+                               C94210FD13900C8A004BA536 /* stack_logging.c in Sources */,
+                               C94210FE13900C8A004BA536 /* stack_logging_disk.c in Sources */,
+                               C94210FF13900C8A004BA536 /* strtofflags.c in Sources */,
+                               C942110013900C8A004BA536 /* syslog.c in Sources */,
+                               C942110113900C8A004BA536 /* thread_stack_pcs.c in Sources */,
+                               C942110213900C8A004BA536 /* uname.c in Sources */,
+                               C942110313900C8A004BA536 /* utmpx-darwin.c in Sources */,
+                               C942110413900C8A004BA536 /* wordexp.c in Sources */,
+                               C942110613900C8A004BA536 /* gmon.c in Sources */,
+                               C942110713900C8A004BA536 /* getmcontext.c in Sources */,
+                               C942110813900C8A004BA536 /* makecontext.c in Sources */,
+                               C942110913900C8A004BA536 /* setcontext.c in Sources */,
+                               C942110A13900C8A004BA536 /* setjmperr.c in Sources */,
+                               C942110B13900C8A004BA536 /* swapcontext.c in Sources */,
+                               C942110C13900C8A004BA536 /* init_cpu_capabilities.c in Sources */,
+                               C942110D13900C8A004BA536 /* bcopy.c in Sources */,
+                               C942110E13900C8A004BA536 /* bzero.c in Sources */,
+                               C942110F13900C8A004BA536 /* memcpy.c in Sources */,
+                               C942111013900C8A004BA536 /* memmove.c in Sources */,
+                               C942111113900C8A004BA536 /* atomic.c in Sources */,
+                               C942111213900C8A004BA536 /* mach_absolute_time.c in Sources */,
+                               C942111313900C8A004BA536 /* spinlocks.c in Sources */,
+                               C942112613900C8A004BA536 /* ascii.c in Sources */,
+                               C942112713900C8A004BA536 /* big5.c in Sources */,
+                               C942112813900C8A004BA536 /* btowc.c in Sources */,
+                               C942112913900C8A004BA536 /* collate.c in Sources */,
+                               C942112A13900C8A004BA536 /* collcmp.c in Sources */,
+                               C942112B13900C8A004BA536 /* euc.c in Sources */,
+                               C942112C13900C8A004BA536 /* fix_grouping.c in Sources */,
+                               C942112D13900C8A004BA536 /* gb18030.c in Sources */,
+                               C942112E13900C8A004BA536 /* gb2312.c in Sources */,
+                               C942112F13900C8A004BA536 /* gbk.c in Sources */,
+                               C942113013900C8A004BA536 /* ldpart.c in Sources */,
+                               C942113113900C8A004BA536 /* lmessages.c in Sources */,
+                               C942113213900C8A004BA536 /* lmonetary.c in Sources */,
+                               C942113313900C8A004BA536 /* lnumeric.c in Sources */,
+                               C942113413900C8A004BA536 /* localeconv.c in Sources */,
+                               C942113513900C8A004BA536 /* mblen.c in Sources */,
+                               C942113613900C8A004BA536 /* mbrlen.c in Sources */,
+                               C942113713900C8A004BA536 /* mbrtowc.c in Sources */,
+                               C942113813900C8A004BA536 /* mbsinit.c in Sources */,
+                               C942113913900C8A004BA536 /* mbsnrtowcs.c in Sources */,
+                               C942113A13900C8A004BA536 /* mbsrtowcs.c in Sources */,
+                               C942113B13900C8A004BA536 /* mbstowcs.c in Sources */,
+                               C942113C13900C8A004BA536 /* mbtowc.c in Sources */,
+                               C942113D13900C8A004BA536 /* mskanji.c in Sources */,
+                               C942113E13900C8A004BA536 /* nextwctype.c in Sources */,
+                               C942113F13900C8A004BA536 /* nl_langinfo.c in Sources */,
+                               C942114013900C8A004BA536 /* nomacros.c in Sources */,
+                               C942114113900C8A004BA536 /* none.c in Sources */,
+                               C942114213900C8A004BA536 /* rune.c in Sources */,
+                               C942114313900C8A004BA536 /* runetype.c in Sources */,
+                               C942114413900C8A004BA536 /* setlocale.c in Sources */,
+                               C942114513900C8A004BA536 /* setrunelocale.c in Sources */,
+                               C942114613900C8A004BA536 /* table.c in Sources */,
+                               C942114713900C8A004BA536 /* tolower.c in Sources */,
+                               C942114813900C8A004BA536 /* toupper.c in Sources */,
+                               C942114913900C8A004BA536 /* utf2.c in Sources */,
+                               C942114A13900C8A004BA536 /* utf8.c in Sources */,
+                               C942114B13900C8A004BA536 /* wcrtomb.c in Sources */,
+                               C942114C13900C8A004BA536 /* wcsftime.c in Sources */,
+                               C942114D13900C8A004BA536 /* wcsnrtombs.c in Sources */,
+                               C942114E13900C8A004BA536 /* wcsrtombs.c in Sources */,
+                               C942114F13900C8A004BA536 /* wcstod.c in Sources */,
+                               C942115013900C8A004BA536 /* wcstof.c in Sources */,
+                               C942115113900C8A004BA536 /* wcstoimax.c in Sources */,
+                               C942115213900C8A004BA536 /* wcstol.c in Sources */,
+                               C942115313900C8A004BA536 /* wcstold.c in Sources */,
+                               C942115413900C8A004BA536 /* wcstoll.c in Sources */,
+                               C942115513900C8A004BA536 /* wcstombs.c in Sources */,
+                               C942115613900C8A004BA536 /* wcstoul.c in Sources */,
+                               C942115713900C8A004BA536 /* wcstoull.c in Sources */,
+                               C942115813900C8A004BA536 /* wcstoumax.c in Sources */,
+                               C942115913900C8A004BA536 /* wctob.c in Sources */,
+                               C942115A13900C8A004BA536 /* wctomb.c in Sources */,
+                               C942115B13900C8A004BA536 /* wctrans.c in Sources */,
+                               C942115C13900C8A004BA536 /* wctype.c in Sources */,
+                               C942115D13900C8A004BA536 /* wcwidth.c in Sources */,
+                               C942115E13900C8A004BA536 /* frune.c in Sources */,
+                               C942115F13900C8A004BA536 /* isctype.c in Sources */,
+                               C942116013900C8A004BA536 /* iswctype.c in Sources */,
+                               C942116113900C8A004BA536 /* lconv.c in Sources */,
+                               C942116213900C8A004BA536 /* mbrune.c in Sources */,
+                               C942116313900C8A004BA536 /* runedepreciated.c in Sources */,
+                               C942116413900C8A004BA536 /* setinvalidrune.c in Sources */,
+                               C942116513900C8A004BA536 /* xlocale.c in Sources */,
+                               C942116613900C8A004BA536 /* addr2ascii.c in Sources */,
+                               C942116713900C8A004BA536 /* ascii2addr.c in Sources */,
+                               C942116813900C8A004BA536 /* inet_addr.c in Sources */,
+                               C942116913900C8A004BA536 /* inet_lnaof.c in Sources */,
+                               C942116A13900C8A004BA536 /* inet_makeaddr.c in Sources */,
+                               C942116B13900C8A004BA536 /* inet_net_ntop.c in Sources */,
+                               C942116C13900C8A004BA536 /* inet_net_pton.c in Sources */,
+                               C942116D13900C8A004BA536 /* inet_neta.c in Sources */,
+                               C942116E13900C8A004BA536 /* inet_netof.c in Sources */,
+                               C942116F13900C8A004BA536 /* inet_network.c in Sources */,
+                               C942117013900C8A004BA536 /* inet_ntoa.c in Sources */,
+                               C942117113900C8A004BA536 /* linkaddr.c in Sources */,
+                               C942117213900C8A004BA536 /* nsap_addr.c in Sources */,
+                               C942117313900C8A004BA536 /* recv.c in Sources */,
+                               C942117413900C8A004BA536 /* send.c in Sources */,
+                               C942117513900C8A004BA536 /* sockatmark.c in Sources */,
+                               C942117613900C8A004BA536 /* sourcefilter.c in Sources */,
+                               C942117713900C8A004BA536 /* msgcat.c in Sources */,
+                               C942117813900C8A004BA536 /* acl.c in Sources */,
+                               C942117913900C8A004BA536 /* acl_entry.c in Sources */,
+                               C942117A13900C8A004BA536 /* acl_file.c in Sources */,
+                               C942117B13900C8A004BA536 /* acl_flag.c in Sources */,
+                               C942117C13900C8A004BA536 /* acl_perm.c in Sources */,
+                               C942117D13900C8A004BA536 /* acl_translate.c in Sources */,
+                               C942118613900C8A004BA536 /* mk_pthread_impl.c in Sources */,
+                               C942118713900C8A004BA536 /* pthread.c in Sources */,
+                               C942118813900C8A004BA536 /* pthread_cancelable.c in Sources */,
+                               C942118913900C8A004BA536 /* pthread_cond.c in Sources */,
+                               C942118A13900C8A004BA536 /* pthread_mutex.c in Sources */,
+                               C942118B13900C8A004BA536 /* pthread_rwlock.c in Sources */,
+                               C942118C13900C8A004BA536 /* pthread_tsd.c in Sources */,
+                               C942118D13900C8A004BA536 /* pthread_atfork_test.c in Sources */,
+                               C942118E13900C8A004BA536 /* thread_setup.c in Sources */,
+                               C942119113900C8A004BA536 /* regerror.c in Sources */,
+                               C942119413900C8A004BA536 /* chk_fail.c in Sources */,
+                               C942119513900C8A004BA536 /* memcpy_chk.c in Sources */,
+                               C942119613900C8A004BA536 /* memmove_chk.c in Sources */,
+                               C942119713900C8A004BA536 /* memset_chk.c in Sources */,
+                               C942119813900C8A004BA536 /* snprintf_chk.c in Sources */,
+                               C942119913900C8A004BA536 /* sprintf_chk.c in Sources */,
+                               C942119A13900C8A004BA536 /* stpcpy_chk.c in Sources */,
+                               C942119B13900C8A004BA536 /* stpncpy_chk.c in Sources */,
+                               C942119C13900C8A004BA536 /* strcat_chk.c in Sources */,
+                               C942119D13900C8A004BA536 /* strcpy_chk.c in Sources */,
+                               C942119E13900C8A004BA536 /* strncat_chk.c in Sources */,
+                               C942119F13900C8A004BA536 /* strncpy_chk.c in Sources */,
+                               C94211A013900C8A004BA536 /* vsnprintf_chk.c in Sources */,
+                               C94211A113900C8A004BA536 /* vsprintf_chk.c in Sources */,
+                               C94211A213900C8A004BA536 /* _flock_stub.c in Sources */,
+                               C94211A313900C8A004BA536 /* asprintf.c in Sources */,
+                               C94211A413900C8A004BA536 /* clrerr.c in Sources */,
+                               C94211A513900C8A004BA536 /* dprintf.c in Sources */,
+                               C94211A613900C8A004BA536 /* fclose.c in Sources */,
+                               C94211A713900C8A004BA536 /* fdopen.c in Sources */,
+                               C94211A813900C8A004BA536 /* feof.c in Sources */,
+                               C94211A913900C8A004BA536 /* ferror.c in Sources */,
+                               C94211AA13900C8A004BA536 /* fflush.c in Sources */,
+                               C94211AB13900C8A004BA536 /* fgetc.c in Sources */,
+                               C94211AC13900C8A004BA536 /* fgetln.c in Sources */,
+                               C94211AD13900C8A004BA536 /* fgetpos.c in Sources */,
+                               C94211AE13900C8A004BA536 /* fgets.c in Sources */,
+                               C94211AF13900C8A004BA536 /* fgetwc.c in Sources */,
+                               C94211B013900C8A004BA536 /* fgetwln.c in Sources */,
+                               C94211B113900C8A004BA536 /* fgetws.c in Sources */,
+                               C94211B213900C8A004BA536 /* fileno.c in Sources */,
+                               C94211B313900C8A004BA536 /* findfp.c in Sources */,
+                               C94211B413900C8A004BA536 /* flags.c in Sources */,
+                               C94211B513900C8A004BA536 /* fopen.c in Sources */,
+                               C94211B613900C8A004BA536 /* fprintf.c in Sources */,
+                               C94211B713900C8A004BA536 /* fpurge.c in Sources */,
+                               C94211B813900C8A004BA536 /* fputc.c in Sources */,
+                               C94211B913900C8A004BA536 /* fputs.c in Sources */,
+                               C94211BA13900C8A004BA536 /* fputwc.c in Sources */,
+                               C94211BB13900C8A004BA536 /* fputws.c in Sources */,
+                               C94211BC13900C8A004BA536 /* fread.c in Sources */,
+                               C94211BD13900C8A004BA536 /* freopen.c in Sources */,
+                               C94211BE13900C8A004BA536 /* fscanf.c in Sources */,
+                               C94211BF13900C8A004BA536 /* fseek.c in Sources */,
+                               C94211C013900C8A004BA536 /* fsetpos.c in Sources */,
+                               C94211C113900C8A004BA536 /* ftell.c in Sources */,
+                               C94211C213900C8A004BA536 /* funopen.c in Sources */,
+                               C94211C313900C8A004BA536 /* fvwrite.c in Sources */,
+                               C94211C413900C8A004BA536 /* fwalk.c in Sources */,
+                               C94211C513900C8A004BA536 /* fwide.c in Sources */,
+                               C94211C613900C8A004BA536 /* fwprintf.c in Sources */,
+                               C94211C713900C8A004BA536 /* fwrite.c in Sources */,
+                               C94211C813900C8A004BA536 /* fwscanf.c in Sources */,
+                               C94211C913900C8A004BA536 /* getc.c in Sources */,
+                               C94211CA13900C8A004BA536 /* getchar.c in Sources */,
+                               C94211CB13900C8A004BA536 /* getdelim.c in Sources */,
+                               C94211CC13900C8A004BA536 /* getline.c in Sources */,
+                               C94211CD13900C8A004BA536 /* gets.c in Sources */,
+                               C94211CE13900C8A004BA536 /* getw.c in Sources */,
+                               C94211CF13900C8A004BA536 /* getwc.c in Sources */,
+                               C94211D013900C8A004BA536 /* getwchar.c in Sources */,
+                               C94211D113900C8A004BA536 /* makebuf.c in Sources */,
+                               C94211D213900C8A004BA536 /* mktemp.c in Sources */,
+                               C94211D313900C8A004BA536 /* perror.c in Sources */,
+                               C94211D413900C8A004BA536 /* printf-pos.c in Sources */,
+                               C94211D513900C8A004BA536 /* printf.c in Sources */,
+                               C94211D613900C8A004BA536 /* putc.c in Sources */,
+                               C94211D713900C8A004BA536 /* putchar.c in Sources */,
+                               C94211D813900C8A004BA536 /* puts.c in Sources */,
+                               C94211D913900C8A004BA536 /* putw.c in Sources */,
+                               C94211DA13900C8A004BA536 /* putwc.c in Sources */,
+                               C94211DB13900C8A004BA536 /* putwchar.c in Sources */,
+                               C94211DC13900C8A004BA536 /* refill.c in Sources */,
+                               C94211DD13900C8A004BA536 /* remove.c in Sources */,
+                               C94211DE13900C8A004BA536 /* rewind.c in Sources */,
+                               C94211DF13900C8A004BA536 /* rget.c in Sources */,
+                               C94211E013900C8A004BA536 /* scanf.c in Sources */,
+                               C94211E113900C8A004BA536 /* setbuf.c in Sources */,
+                               C94211E213900C8A004BA536 /* setbuffer.c in Sources */,
+                               C94211E313900C8A004BA536 /* setvbuf.c in Sources */,
+                               C94211E413900C8A004BA536 /* snprintf.c in Sources */,
+                               C94211E513900C8A004BA536 /* sprintf.c in Sources */,
+                               C94211E613900C8A004BA536 /* sscanf.c in Sources */,
+                               C94211E713900C8A004BA536 /* stdio.c in Sources */,
+                               C94211E813900C8A004BA536 /* swprintf.c in Sources */,
+                               C94211E913900C8A004BA536 /* swscanf.c in Sources */,
+                               C94211EA13900C8A004BA536 /* tempnam.c in Sources */,
+                               C94211EB13900C8A004BA536 /* tmpfile.c in Sources */,
+                               C94211EC13900C8A004BA536 /* tmpnam.c in Sources */,
+                               C94211ED13900C8A004BA536 /* ungetc.c in Sources */,
+                               C94211EE13900C8A004BA536 /* ungetwc.c in Sources */,
+                               C94211EF13900C8A004BA536 /* vasprintf.c in Sources */,
+                               C94211F013900C8A004BA536 /* vdprintf.c in Sources */,
+                               C94211F113900C8A004BA536 /* vfprintf.c in Sources */,
+                               C94211F213900C8A004BA536 /* vfscanf.c in Sources */,
+                               C94211F313900C8A004BA536 /* vfwprintf.c in Sources */,
+                               C94211F413900C8A004BA536 /* vfwscanf.c in Sources */,
+                               C94211F513900C8A004BA536 /* vprintf.c in Sources */,
+                               C94211F613900C8A004BA536 /* vscanf.c in Sources */,
+                               C94211F713900C8A004BA536 /* vsnprintf.c in Sources */,
+                               C94211F813900C8A004BA536 /* vsprintf.c in Sources */,
+                               C94211F913900C8A004BA536 /* vsscanf.c in Sources */,
+                               C94211FA13900C8A004BA536 /* vswprintf.c in Sources */,
+                               C94211FB13900C8A004BA536 /* vswscanf.c in Sources */,
+                               C94211FC13900C8A004BA536 /* vwprintf.c in Sources */,
+                               C94211FD13900C8A004BA536 /* vwscanf.c in Sources */,
+                               C94211FE13900C8A004BA536 /* wbuf.c in Sources */,
+                               C94211FF13900C8A004BA536 /* wprintf.c in Sources */,
+                               C942120013900C8A004BA536 /* wscanf.c in Sources */,
+                               C942120113900C8A004BA536 /* wsetup.c in Sources */,
+                               C942120213900C8A004BA536 /* a64l.c in Sources */,
+                               C942120313900C8A004BA536 /* _Exit_.c in Sources */,
+                               C942120413900C8A004BA536 /* abort.c in Sources */,
+                               C942120513900C8A004BA536 /* abs.c in Sources */,
+                               C942120613900C8A004BA536 /* atexit.c in Sources */,
+                               C942120713900C8A004BA536 /* atof.c in Sources */,
+                               C942120813900C8A004BA536 /* atoi.c in Sources */,
+                               C942120913900C8A004BA536 /* atol.c in Sources */,
+                               C942120A13900C8A004BA536 /* atoll.c in Sources */,
+                               C942120B13900C8A004BA536 /* bsearch.c in Sources */,
+                               C942120C13900C8A004BA536 /* div.c in Sources */,
+                               C942120D13900C8A004BA536 /* exit.c in Sources */,
+                               C942120E13900C8A004BA536 /* getenv.c in Sources */,
+                               C942120F13900C8A004BA536 /* getopt.c in Sources */,
+                               C942121013900C8A004BA536 /* getopt_long.c in Sources */,
+                               C942121113900C8A004BA536 /* getsubopt.c in Sources */,
+                               C942121213900C8A004BA536 /* hcreate.c in Sources */,
+                               C942121313900C8A004BA536 /* heapsort.c in Sources */,
+                               C942121413900C8A004BA536 /* heapsort_b.c in Sources */,
+                               C942121513900C8A004BA536 /* heapsort_r.c in Sources */,
+                               C942121613900C8A004BA536 /* imaxabs.c in Sources */,
+                               C942121713900C8A004BA536 /* imaxdiv.c in Sources */,
+                               C942121813900C8A004BA536 /* insque.c in Sources */,
+                               C942121913900C8A004BA536 /* labs.c in Sources */,
+                               C942121A13900C8A004BA536 /* ldiv.c in Sources */,
+                               C942121B13900C8A004BA536 /* llabs.c in Sources */,
+                               C942121C13900C8A004BA536 /* lldiv.c in Sources */,
+                               C942121D13900C8A004BA536 /* lsearch.c in Sources */,
+                               C942121E13900C8A004BA536 /* merge.c in Sources */,
+                               C942121F13900C8A004BA536 /* putenv.c in Sources */,
+                               C942122013900C8A004BA536 /* qsort.c in Sources */,
+                               C942122113900C8A004BA536 /* qsort_r.c in Sources */,
+                               C942122213900C8A004BA536 /* radixsort.c in Sources */,
+                               C942122313900C8A004BA536 /* rand.c in Sources */,
+                               C942122413900C8A004BA536 /* random.c in Sources */,
+                               C942122513900C8A004BA536 /* reallocf.c in Sources */,
+                               C942122613900C8A004BA536 /* realpath.c in Sources */,
+                               C942122713900C8A004BA536 /* remque.c in Sources */,
+                               C942122813900C8A004BA536 /* setenv.c in Sources */,
+                               C942122913900C8A004BA536 /* strhash.c in Sources */,
+                               C942122A13900C8A004BA536 /* strtoimax.c in Sources */,
+                               C942122B13900C8A004BA536 /* strtol.c in Sources */,
+                               C942122C13900C8A004BA536 /* strtoll.c in Sources */,
+                               C942122D13900C8A004BA536 /* strtoq.c in Sources */,
+                               C942122E13900C8A004BA536 /* strtoul.c in Sources */,
+                               C942122F13900C8A004BA536 /* strtoull.c in Sources */,
+                               C942123013900C8A004BA536 /* strtoumax.c in Sources */,
+                               C942123113900C8A004BA536 /* strtouq.c in Sources */,
+                               C942123213900C8A004BA536 /* system.c in Sources */,
+                               C942123313900C8A004BA536 /* tdelete.c in Sources */,
+                               C942123413900C8A004BA536 /* tfind.c in Sources */,
+                               C942123513900C8A004BA536 /* tsearch.c in Sources */,
+                               C942123613900C8A004BA536 /* twalk.c in Sources */,
+                               C942123713900C8A004BA536 /* grantpt.c in Sources */,
+                               C942123813900C8A004BA536 /* l64a.c in Sources */,
+                               C942123913900C8A004BA536 /* strfmon.c in Sources */,
+                               C942123A13900C8A004BA536 /* ecvt.c in Sources */,
+                               C942123B13900C8A004BA536 /* gcvt.c in Sources */,
+                               C942123C13900C8A004BA536 /* qsort_b-fbsd.c in Sources */,
+                               C942123D13900C8A004BA536 /* asctime.c in Sources */,
+                               C942123E13900C8A004BA536 /* difftime.c in Sources */,
+                               C942123F13900C8A004BA536 /* ftime.c in Sources */,
+                               C942124013900C8A004BA536 /* localtime.c in Sources */,
+                               C942124113900C8A004BA536 /* strftime.c in Sources */,
+                               C942124213900C8A004BA536 /* strptime.c in Sources */,
+                               C942124313900C8A004BA536 /* time32.c in Sources */,
+                               C942124413900C8A004BA536 /* timelocal.c in Sources */,
+                               C942124513900C8A004BA536 /* getdate.c in Sources */,
+                               C942124613900C8A004BA536 /* timezone_unix03.c in Sources */,
+                               C942124713900C8A004BA536 /* bcmp.c in Sources */,
+                               C942124813900C8A004BA536 /* bcopy.c in Sources */,
+                               C942124913900C8A004BA536 /* bzero.c in Sources */,
+                               C942124A13900C8A004BA536 /* index.c in Sources */,
+                               C942124B13900C8A004BA536 /* memccpy.c in Sources */,
+                               C942124C13900C8A004BA536 /* memchr.c in Sources */,
+                               C942124D13900C8A004BA536 /* memcmp.c in Sources */,
+                               C942124E13900C8A004BA536 /* memcpy.c in Sources */,
+                               C942124F13900C8A004BA536 /* memmem.c in Sources */,
+                               C942125013900C8A004BA536 /* memmove.c in Sources */,
+                               C942125113900C8A004BA536 /* memset.c in Sources */,
+                               C942125213900C8A004BA536 /* rindex.c in Sources */,
+                               C942125513900C8A004BA536 /* strcasecmp.c in Sources */,
+                               C942125613900C8A004BA536 /* strcasestr.c in Sources */,
+                               C942125813900C8A004BA536 /* strchr.c in Sources */,
+                               C942125913900C8A004BA536 /* strcmp.c in Sources */,
+                               C942125A13900C8A004BA536 /* strcoll.c in Sources */,
+                               C942125C13900C8A004BA536 /* strcspn.c in Sources */,
+                               C942125D13900C8A004BA536 /* strdup.c in Sources */,
+                               C942125E13900C8A004BA536 /* strerror.c in Sources */,
+                               C942126113900C8A004BA536 /* strlen.c in Sources */,
+                               C942126213900C8A004BA536 /* strmode.c in Sources */,
+                               C942126413900C8A004BA536 /* strncmp.c in Sources */,
+                               C942126613900C8A004BA536 /* strndup.c in Sources */,
+                               C942126713900C8A004BA536 /* strnlen.c in Sources */,
+                               C942126813900C8A004BA536 /* strnstr.c in Sources */,
+                               C942126913900C8A004BA536 /* strpbrk.c in Sources */,
+                               C942126A13900C8A004BA536 /* strrchr.c in Sources */,
+                               C942126B13900C8A004BA536 /* strsep.c in Sources */,
+                               C942126C13900C8A004BA536 /* strsignal.c in Sources */,
+                               C942126D13900C8A004BA536 /* strspn.c in Sources */,
+                               C942126E13900C8A004BA536 /* strstr.c in Sources */,
+                               C942126F13900C8A004BA536 /* strtok.c in Sources */,
+                               C942127013900C8A004BA536 /* strxfrm.c in Sources */,
+                               C942127113900C8A004BA536 /* swab.c in Sources */,
+                               C942127213900C8A004BA536 /* wcpcpy.c in Sources */,
+                               C942127313900C8A004BA536 /* wcpncpy.c in Sources */,
+                               C942127413900C8A004BA536 /* wcscasecmp.c in Sources */,
+                               C942127513900C8A004BA536 /* wcscat.c in Sources */,
+                               C942127613900C8A004BA536 /* wcschr.c in Sources */,
+                               C942127713900C8A004BA536 /* wcscmp.c in Sources */,
+                               C942127813900C8A004BA536 /* wcscoll.c in Sources */,
+                               C942127913900C8A004BA536 /* wcscpy.c in Sources */,
+                               C942127A13900C8A004BA536 /* wcscspn.c in Sources */,
+                               C942127B13900C8A004BA536 /* wcsdup.c in Sources */,
+                               C942127C13900C8A004BA536 /* wcslcat.c in Sources */,
+                               C942127D13900C8A004BA536 /* wcslcpy.c in Sources */,
+                               C942127E13900C8A004BA536 /* wcslen.c in Sources */,
+                               C942127F13900C8A004BA536 /* wcsncasecmp.c in Sources */,
+                               C942128013900C8A004BA536 /* wcsncat.c in Sources */,
+                               C942128113900C8A004BA536 /* wcsncmp.c in Sources */,
+                               C942128213900C8A004BA536 /* wcsncpy.c in Sources */,
+                               C942128313900C8A004BA536 /* wcsnlen.c in Sources */,
+                               C942128413900C8A004BA536 /* wcspbrk.c in Sources */,
+                               C942128513900C8A004BA536 /* wcsrchr.c in Sources */,
+                               C942128613900C8A004BA536 /* wcsspn.c in Sources */,
+                               C942128713900C8A004BA536 /* wcsstr.c in Sources */,
+                               C942128813900C8A004BA536 /* wcstok.c in Sources */,
+                               C942128913900C8A004BA536 /* wcswidth.c in Sources */,
+                               C942128A13900C8A004BA536 /* wcsxfrm.c in Sources */,
+                               C942128B13900C8A004BA536 /* wmemchr.c in Sources */,
+                               C942128C13900C8A004BA536 /* wmemcmp.c in Sources */,
+                               C942128D13900C8A004BA536 /* wmemcpy.c in Sources */,
+                               C942128E13900C8A004BA536 /* wmemmove.c in Sources */,
+                               C942128F13900C8A004BA536 /* wmemset.c in Sources */,
+                               C942129013900C8A004BA536 /* __libc_init.c in Sources */,
+                               C942129113900C8A004BA536 /* _libc_fork_child.c in Sources */,
+                               C942129213900C8A004BA536 /* chmodx_np.c in Sources */,
+                               C942129313900C8A004BA536 /* context-stubs.c in Sources */,
+                               C942129413900C8A004BA536 /* crt_externs.c in Sources */,
+                               C942129513900C8A004BA536 /* errno.c in Sources */,
+                               C942129613900C8A004BA536 /* fork.c in Sources */,
+                               C942129713900C8A004BA536 /* getgroups.c in Sources */,
+                               C942129813900C8A004BA536 /* getiopolicy_np.c in Sources */,
+                               C942129913900C8A004BA536 /* gettimeofday.c in Sources */,
+                               C942129A13900C8A004BA536 /* msgctl.c in Sources */,
+                               C942129B13900C8A004BA536 /* stack_protector.c in Sources */,
+                               C942129C13900C8A004BA536 /* openx_np.c in Sources */,
+                               C942129D13900C8A004BA536 /* OSMemoryNotification.c in Sources */,
+                               C942129E13900C8A004BA536 /* OSThermalNotification.c in Sources */,
+                               C942129F13900C8A004BA536 /* posix_spawn.c in Sources */,
+                               C94212A013900C8A004BA536 /* semctl.c in Sources */,
+                               C94212A113900C8A004BA536 /* settimeofday.c in Sources */,
+                               C94212A213900C8A004BA536 /* shmctl.c in Sources */,
+                               C94212A313900C8A004BA536 /* sigaction.c in Sources */,
+                               C94212A413900C8A004BA536 /* sigcatch.c in Sources */,
+                               C94212A513900C8A004BA536 /* sigtramp.c in Sources */,
+                               C94212A613900C8A004BA536 /* slot_name.c in Sources */,
+                               C94212A713900C8A004BA536 /* statx_np.c in Sources */,
+                               C94212A813900C8A004BA536 /* umaskx_np.c in Sources */,
+                               C94212A913900C8A004BA536 /* cprocs.c in Sources */,
+                               C94212AA13900C8A004BA536 /* cthreads.c in Sources */,
+                               C94212AB13900C8A004BA536 /* mig_support.c in Sources */,
+                               C94212AC13900C8A004BA536 /* fparseln.c in Sources */,
+                               C94212AD13900C8A004BA536 /* login.c in Sources */,
+                               C94212AE13900C8A004BA536 /* login_tty.c in Sources */,
+                               C94212AF13900C8A004BA536 /* logout.c in Sources */,
+                               C94212B013900C8A004BA536 /* logwtmp.c in Sources */,
+                               3F76864913E91CE800C94D25 /* mkpath_np.c in Sources */,
+                               C94212B113900C8A004BA536 /* opendev.c in Sources */,
+                               C94212B213900C8A004BA536 /* pty.c in Sources */,
+                               C94212B313900C8A004BA536 /* clear.c in Sources */,
+                               C94212B413900C8A004BA536 /* compare.c in Sources */,
+                               C94212B513900C8A004BA536 /* copy.c in Sources */,
+                               C94212B613900C8A004BA536 /* gen_uuid.c in Sources */,
+                               C94212B713900C8A004BA536 /* isnull.c in Sources */,
+                               C94212B813900C8A004BA536 /* pack.c in Sources */,
+                               C94212B913900C8A004BA536 /* parse.c in Sources */,
+                               C94212BA13900C8A004BA536 /* unpack.c in Sources */,
+                               C94212BB13900C8A004BA536 /* unparse.c in Sources */,
+                               C94212BC13900C8A004BA536 /* getmcontext.c in Sources */,
+                               C94212BD13900C8A004BA536 /* makecontext.c in Sources */,
+                               C94212BE13900C8A004BA536 /* setcontext.c in Sources */,
+                               C94212BF13900C8A004BA536 /* swapcontext.c in Sources */,
+                               C94212C013900C8A004BA536 /* bcopy.c in Sources */,
+                               C94212C113900C8A004BA536 /* bzero.c in Sources */,
+                               C94212C213900C8A004BA536 /* memcpy.c in Sources */,
+                               C94212C313900C8A004BA536 /* memmove.c in Sources */,
+                               C94212C413900C8A004BA536 /* atomic.c in Sources */,
+                               C94212C513900C8A004BA536 /* spinlocks.c in Sources */,
+                               C94212C613900C8A004BA536 /* scandir_b.c in Sources */,
+                               C932C2D313AB20C8004EDA12 /* OSAtomicUP.c in Sources */,
+                               C932C2D413AB20C8004EDA12 /* Spinlocks.c in Sources */,
+                               C932C2D513AB20C8004EDA12 /* SpinlocksUP.c in Sources */,
+                               C932C2D613AB20C8004EDA12 /* SpinlocksWFE.c in Sources */,
+                               C9B4E3DE13BBCE5F0008A9BB /* OSAtomic.c in Sources */,
+                               6310518713D4D966004F7BA8 /* strcpy.c in Sources */,
+                               6310518C13D4DABD004F7BA8 /* strlcpy.c in Sources */,
+                               6310518F13D4DAEA004F7BA8 /* strncpy.c in Sources */,
+                               63D4060813DDEDFF0094DD56 /* stpcpy.c in Sources */,
+                               63D4060A13DDEEA20094DD56 /* stpncpy.c in Sources */,
+                               63D4060D13DDF26A0094DD56 /* strcat.c in Sources */,
+                               63D4061013DDF4340094DD56 /* strncat.c in Sources */,
+                               63D4061313DDF6A30094DD56 /* strlcat.c in Sources */,
+                               3F2208E814358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C645C1450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FD4D48E1472F4B200075CCE /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C95B7EDC138F3C55004311DA /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C95B7EDD138F3C55004311DA /* init_cpu_capabilities.c in Sources */,
+                               C95B7EDE138F3C55004311DA /* dyld_resolvers.c in Sources */,
+                               C95B7EDF138F3C55004311DA /* arm_commpage_gettimeofday.c in Sources */,
+                               C95B7EE0138F3C55004311DA /* gcc_atomic.c in Sources */,
+                               C95B7EE1138F3C55004311DA /* OSAtomic-v4.c in Sources */,
+                               C95B7EE2138F3C55004311DA /* OSAtomic_resolvers.c in Sources */,
+                               C95B7EE4138F3C55004311DA /* creat.c in Sources */,
+                               C95B7EE5138F3C55004311DA /* gethostid.c in Sources */,
+                               C95B7EE6138F3C55004311DA /* getwd.c in Sources */,
+                               C95B7EE7138F3C55004311DA /* killpg.c in Sources */,
+                               C95B7EE8138F3C55004311DA /* sethostid.c in Sources */,
+                               C95B7EE9138F3C55004311DA /* setpgrp.c in Sources */,
+                               C95B7EEA138F3C55004311DA /* setrgid.c in Sources */,
+                               C95B7EEB138F3C55004311DA /* setruid.c in Sources */,
+                               C95B7EEC138F3C55004311DA /* setregid.c in Sources */,
+                               C95B7EED138F3C55004311DA /* setreuid.c in Sources */,
+                               C95B7EEE138F3C55004311DA /* sigaltstk.c in Sources */,
+                               C95B7EEF138F3C55004311DA /* sigcompat.c in Sources */,
+                               C95B7EF0138F3C55004311DA /* _dirhelper.c in Sources */,
+                               C95B7EF1138F3C55004311DA /* kvm.c in Sources */,
+                               C95B7EF2138F3C55004311DA /* libproc.c in Sources */,
+                               C95B7EF3138F3C55004311DA /* MKGetTimeBaseInfo.c in Sources */,
+                               C95B7EF4138F3C55004311DA /* proc_listpidspath.c in Sources */,
+                               C95B7EF5138F3C55004311DA /* forceLibcToBuild.c in Sources */,
+                               C95B7EF6138F3C55004311DA /* bt_close.c in Sources */,
+                               C95B7EF7138F3C55004311DA /* bt_conv.c in Sources */,
+                               C95B7EF8138F3C55004311DA /* bt_debug.c in Sources */,
+                               C95B7EF9138F3C55004311DA /* bt_delete.c in Sources */,
+                               C95B7EFA138F3C55004311DA /* bt_get.c in Sources */,
+                               C95B7EFB138F3C55004311DA /* bt_open.c in Sources */,
+                               C95B7EFC138F3C55004311DA /* bt_overflow.c in Sources */,
+                               C95B7EFD138F3C55004311DA /* bt_page.c in Sources */,
+                               C95B7EFE138F3C55004311DA /* bt_put.c in Sources */,
+                               C95B7EFF138F3C55004311DA /* bt_search.c in Sources */,
+                               C95B7F00138F3C55004311DA /* bt_seq.c in Sources */,
+                               C95B7F01138F3C55004311DA /* bt_split.c in Sources */,
+                               C95B7F02138F3C55004311DA /* bt_utils.c in Sources */,
+                               C95B7F03138F3C55004311DA /* db.c in Sources */,
+                               C95B7F04138F3C55004311DA /* hash.c in Sources */,
+                               C95B7F05138F3C55004311DA /* hash_bigkey.c in Sources */,
+                               C95B7F06138F3C55004311DA /* hash_buf.c in Sources */,
+                               C95B7F07138F3C55004311DA /* hash_func.c in Sources */,
+                               C95B7F08138F3C55004311DA /* hash_log2.c in Sources */,
+                               C95B7F09138F3C55004311DA /* hash_page.c in Sources */,
+                               C95B7F0A138F3C55004311DA /* ndbm.c in Sources */,
+                               C95B7F0B138F3C55004311DA /* mpool.c in Sources */,
+                               C95B7F0C138F3C55004311DA /* rec_close.c in Sources */,
+                               C95B7F0D138F3C55004311DA /* rec_delete.c in Sources */,
+                               C95B7F0E138F3C55004311DA /* rec_get.c in Sources */,
+                               C95B7F0F138F3C55004311DA /* rec_open.c in Sources */,
+                               C95B7F10138F3C55004311DA /* rec_put.c in Sources */,
+                               C95B7F11138F3C55004311DA /* rec_search.c in Sources */,
+                               C95B7F12138F3C55004311DA /* rec_seq.c in Sources */,
+                               C95B7F13138F3C55004311DA /* rec_utils.c in Sources */,
+                               C95B7F14138F3C55004311DA /* brk.c in Sources */,
+                               C95B7F15138F3C55004311DA /* bsd_signal.c in Sources */,
+                               C95B7F16138F3C55004311DA /* lchflags.c in Sources */,
+                               C95B7F17138F3C55004311DA /* lchmod.c in Sources */,
+                               C95B7F18138F3C55004311DA /* lutimes.c in Sources */,
+                               C95B7F19138F3C55004311DA /* statvfs.c in Sources */,
+                               C95B7F1A138F3C55004311DA /* tcgetsid.c in Sources */,
+                               C95B7F1B138F3C55004311DA /* _ldbl_util.c in Sources */,
+                               C95B7F1C138F3C55004311DA /* _hdtoa.c in Sources */,
+                               C95B7F1D138F3C55004311DA /* _ldtoa.c in Sources */,
+                               C95B7F1E138F3C55004311DA /* gdtoa-dmisc.c in Sources */,
+                               C95B7F1F138F3C55004311DA /* gdtoa-dtoa.c in Sources */,
+                               C95B7F20138F3C55004311DA /* gdtoa-gdtoa.c in Sources */,
+                               C95B7F21138F3C55004311DA /* gdtoa-gethex.c in Sources */,
+                               C95B7F22138F3C55004311DA /* gdtoa-gmisc.c in Sources */,
+                               C95B7F23138F3C55004311DA /* gdtoa-hd_init.c in Sources */,
+                               C95B7F24138F3C55004311DA /* gdtoa-hexnan.c in Sources */,
+                               C95B7F25138F3C55004311DA /* gdtoa-misc.c in Sources */,
+                               C95B7F26138F3C55004311DA /* gdtoa-smisc.c in Sources */,
+                               C95B7F27138F3C55004311DA /* gdtoa-strtod.c in Sources */,
+                               C95B7F28138F3C55004311DA /* gdtoa-strtodg.c in Sources */,
+                               C95B7F29138F3C55004311DA /* gdtoa-strtof.c in Sources */,
+                               C95B7F2A138F3C55004311DA /* gdtoa-strtoIg.c in Sources */,
+                               C95B7F2B138F3C55004311DA /* gdtoa-strtopdd.c in Sources */,
+                               C95B7F2C138F3C55004311DA /* gdtoa-strtopx.c in Sources */,
+                               C95B7F2D138F3C55004311DA /* gdtoa-strtord.c in Sources */,
+                               C95B7F2E138F3C55004311DA /* gdtoa-sum.c in Sources */,
+                               C95B7F2F138F3C55004311DA /* gdtoa-ulp.c in Sources */,
+                               C95B7F30138F3C55004311DA /* glue.c in Sources */,
+                               C95B7F31138F3C55004311DA /* machdep_ldisd.c in Sources */,
+                               C95B7F32138F3C55004311DA /* machdep_ldisdd.c in Sources */,
+                               C95B7F33138F3C55004311DA /* machdep_ldisQ.c in Sources */,
+                               C95B7F34138F3C55004311DA /* machdep_ldisx.c in Sources */,
+                               C95B7F35138F3C55004311DA /* _simple.c in Sources */,
+                               C95B7F36138F3C55004311DA /* asl.c in Sources */,
+                               C95B7F37138F3C55004311DA /* asl_core.c in Sources */,
+                               C95B7F38138F3C55004311DA /* asl_file.c in Sources */,
+                               C95B7F39138F3C55004311DA /* asl_legacy1.c in Sources */,
+                               C95B7F3A138F3C55004311DA /* asl_msg.c in Sources */,
+                               C95B7F3B138F3C55004311DA /* asl_store.c in Sources */,
+                               C95B7F3C138F3C55004311DA /* asl_util.c in Sources */,
+                               C95B7F3D138F3C55004311DA /* assumes.c in Sources */,
+                               C95B7F3E138F3C55004311DA /* authentication.c in Sources */,
+                               C95B7F3F138F3C55004311DA /* backtrace.c in Sources */,
+                               C95B7F40138F3C55004311DA /* cache.c in Sources */,
+                               C95B7F41138F3C55004311DA /* confstr.c in Sources */,
+                               C95B7F42138F3C55004311DA /* crypt.c in Sources */,
+                               C95B7F43138F3C55004311DA /* devname.c in Sources */,
+                               C95B7F44138F3C55004311DA /* disklabel.c in Sources */,
+                               C95B7F45138F3C55004311DA /* errlst.c in Sources */,
+                               C95B7F46138F3C55004311DA /* filesec.c in Sources */,
+                               C95B7F47138F3C55004311DA /* _rand48.c in Sources */,
+                               C95B7F48138F3C55004311DA /* alarm.c in Sources */,
+                               C95B7F49138F3C55004311DA /* arc4random.c in Sources */,
+                               C95B7F4A138F3C55004311DA /* assert.c in Sources */,
+                               C95B7F4B138F3C55004311DA /* basename.c in Sources */,
+                               C95B7F4C138F3C55004311DA /* clock.c in Sources */,
+                               C95B7F4D138F3C55004311DA /* closedir.c in Sources */,
+                               C95B7F4E138F3C55004311DA /* ctermid.c in Sources */,
+                               C95B7F4F138F3C55004311DA /* daemon.c in Sources */,
+                               C95B7F50138F3C55004311DA /* dirname.c in Sources */,
+                               C95B7F51138F3C55004311DA /* drand48.c in Sources */,
+                               C95B7F52138F3C55004311DA /* erand48.c in Sources */,
+                               C95B7F53138F3C55004311DA /* err.c in Sources */,
+                               C95B7F54138F3C55004311DA /* exec.c in Sources */,
+                               C95B7F55138F3C55004311DA /* fmtcheck.c in Sources */,
+                               C95B7F56138F3C55004311DA /* fmtmsg.c in Sources */,
+                               C95B7F57138F3C55004311DA /* fnmatch.c in Sources */,
+                               C95B7F58138F3C55004311DA /* ftok.c in Sources */,
+                               C95B7F59138F3C55004311DA /* getbsize.c in Sources */,
+                               C95B7F5A138F3C55004311DA /* getcap.c in Sources */,
+                               C95B7F5B138F3C55004311DA /* getcwd.c in Sources */,
+                               C95B7F5C138F3C55004311DA /* gethostname.c in Sources */,
+                               C95B7F5D138F3C55004311DA /* getlogin.c in Sources */,
+                               C95B7F5E138F3C55004311DA /* getmntinfo.c in Sources */,
+                               C95B7F5F138F3C55004311DA /* getpagesize.c in Sources */,
+                               C95B7F60138F3C55004311DA /* getpeereid.c in Sources */,
+                               C95B7F61138F3C55004311DA /* getprogname.c in Sources */,
+                               C95B7F62138F3C55004311DA /* glob.c in Sources */,
+                               C95B7F63138F3C55004311DA /* isatty.c in Sources */,
+                               C95B7F64138F3C55004311DA /* jrand48.c in Sources */,
+                               C95B7F65138F3C55004311DA /* lcong48.c in Sources */,
+                               C95B7F66138F3C55004311DA /* lockf.c in Sources */,
+                               C95B7F67138F3C55004311DA /* lrand48.c in Sources */,
+                               C95B7F68138F3C55004311DA /* mrand48.c in Sources */,
+                               C95B7F69138F3C55004311DA /* nice.c in Sources */,
+                               C95B7F6A138F3C55004311DA /* nrand48.c in Sources */,
+                               C95B7F6B138F3C55004311DA /* opendir.c in Sources */,
+                               C95B7F6C138F3C55004311DA /* pause.c in Sources */,
+                               C95B7F6D138F3C55004311DA /* popen.c in Sources */,
+                               C95B7F6E138F3C55004311DA /* pselect.c in Sources */,
+                               C95B7F6F138F3C55004311DA /* psignal.c in Sources */,
+                               C95B7F70138F3C55004311DA /* raise.c in Sources */,
+                               C95B7F71138F3C55004311DA /* readdir.c in Sources */,
+                               C95B7F72138F3C55004311DA /* readpassphrase.c in Sources */,
+                               C95B7F73138F3C55004311DA /* rewinddir.c in Sources */,
+                               C95B7F74138F3C55004311DA /* scandir.c in Sources */,
+                               C95B7F75138F3C55004311DA /* seed48.c in Sources */,
+                               C95B7F76138F3C55004311DA /* seekdir.c in Sources */,
+                               C95B7F77138F3C55004311DA /* sethostname.c in Sources */,
+                               C95B7F78138F3C55004311DA /* setmode.c in Sources */,
+                               C95B7F79138F3C55004311DA /* setprogname.c in Sources */,
+                               C95B7F7A138F3C55004311DA /* siginterrupt.c in Sources */,
+                               C95B7F7B138F3C55004311DA /* siglist.c in Sources */,
+                               C95B7F7C138F3C55004311DA /* signal.c in Sources */,
+                               C95B7F7D138F3C55004311DA /* sleep.c in Sources */,
+                               C95B7F7E138F3C55004311DA /* srand48.c in Sources */,
+                               C95B7F7F138F3C55004311DA /* stringlist.c in Sources */,
+                               C95B7F80138F3C55004311DA /* sysconf.c in Sources */,
+                               C95B7F81138F3C55004311DA /* sysctl.c in Sources */,
+                               C95B7F82138F3C55004311DA /* sysctlbyname.c in Sources */,
+                               C95B7F83138F3C55004311DA /* sysctlnametomib.c in Sources */,
+                               C95B7F84138F3C55004311DA /* telldir.c in Sources */,
+                               C95B7F85138F3C55004311DA /* termios.c in Sources */,
+                               C95B7F86138F3C55004311DA /* time.c in Sources */,
+                               C95B7F87138F3C55004311DA /* times.c in Sources */,
+                               C95B7F88138F3C55004311DA /* timezone.c in Sources */,
+                               C95B7F89138F3C55004311DA /* ttyname.c in Sources */,
+                               C95B7F8A138F3C55004311DA /* ttyslot.c in Sources */,
+                               C95B7F8B138F3C55004311DA /* ualarm.c in Sources */,
+                               C95B7F8C138F3C55004311DA /* ulimit.c in Sources */,
+                               C95B7F8D138F3C55004311DA /* unvis.c in Sources */,
+                               C95B7F8E138F3C55004311DA /* usleep.c in Sources */,
+                               C95B7F8F138F3C55004311DA /* utime.c in Sources */,
+                               C95B7F90138F3C55004311DA /* vis.c in Sources */,
+                               C95B7F91138F3C55004311DA /* wait.c in Sources */,
+                               C95B7F92138F3C55004311DA /* wait3.c in Sources */,
+                               C95B7F93138F3C55004311DA /* waitpid.c in Sources */,
+                               C95B7F94138F3C55004311DA /* fts.c in Sources */,
+                               C95B7F95138F3C55004311DA /* get_compat.c in Sources */,
+                               C95B7F96138F3C55004311DA /* getloadavg.c in Sources */,
+                               C95B7F97138F3C55004311DA /* getttyent.c in Sources */,
+                               C95B7F98138F3C55004311DA /* getusershell.c in Sources */,
+                               C95B7F99138F3C55004311DA /* getvfsbyname.c in Sources */,
+                               C95B7F9A138F3C55004311DA /* isinf.c in Sources */,
+                               C95B7F9B138F3C55004311DA /* isnan.c in Sources */,
+                               C95B7F9C138F3C55004311DA /* magazine_malloc.c in Sources */,
+                               C95B7F9D138F3C55004311DA /* malloc.c in Sources */,
+                               C95B7F9E138F3C55004311DA /* nanosleep.c in Sources */,
+                               C95B7F9F138F3C55004311DA /* utmpx.c in Sources */,
+                               C95B7FA0138F3C55004311DA /* nftw.c in Sources */,
+                               C95B7FA1138F3C55004311DA /* nlist.c in Sources */,
+                               C95B7FA2138F3C55004311DA /* NSSystemDirectories.c in Sources */,
+                               C95B7FA3138F3C55004311DA /* oldsyslog.c in Sources */,
+                               C95B7FA4138F3C55004311DA /* platfunc.c in Sources */,
+                               C95B7FA5138F3C55004311DA /* scalable_malloc.c in Sources */,
+                               C95B7FA6138F3C55004311DA /* setlogin.c in Sources */,
+                               C95B7FA7138F3C55004311DA /* sigsetops.c in Sources */,
+                               C95B7FA8138F3C55004311DA /* stack_logging.c in Sources */,
+                               C95B7FA9138F3C55004311DA /* stack_logging_disk.c in Sources */,
+                               C95B7FAA138F3C55004311DA /* strtofflags.c in Sources */,
+                               C95B7FAB138F3C55004311DA /* syslog.c in Sources */,
+                               C95B7FAC138F3C55004311DA /* thread_stack_pcs.c in Sources */,
+                               C95B7FAD138F3C55004311DA /* uname.c in Sources */,
+                               C95B7FAE138F3C55004311DA /* utmpx-darwin.c in Sources */,
+                               C95B7FAF138F3C55004311DA /* wordexp.c in Sources */,
+                               C95B7FB1138F3C55004311DA /* gmon.c in Sources */,
+                               C95B7FB2138F3C55004311DA /* getmcontext.c in Sources */,
+                               C95B7FB3138F3C55004311DA /* makecontext.c in Sources */,
+                               C95B7FB4138F3C55004311DA /* setcontext.c in Sources */,
+                               C95B7FB5138F3C55004311DA /* setjmperr.c in Sources */,
+                               C95B7FB6138F3C55004311DA /* swapcontext.c in Sources */,
+                               C95B7FB7138F3C55004311DA /* init_cpu_capabilities.c in Sources */,
+                               C95B7FB8138F3C55004311DA /* bcopy.c in Sources */,
+                               C95B7FB9138F3C55004311DA /* bzero.c in Sources */,
+                               C95B7FBA138F3C55004311DA /* memcpy.c in Sources */,
+                               C95B7FBB138F3C55004311DA /* memmove.c in Sources */,
+                               C95B7FBC138F3C55004311DA /* atomic.c in Sources */,
+                               C95B7FBD138F3C55004311DA /* mach_absolute_time.c in Sources */,
+                               C95B7FBE138F3C55004311DA /* spinlocks.c in Sources */,
+                               C95B7FD1138F3C55004311DA /* ascii.c in Sources */,
+                               C95B7FD2138F3C55004311DA /* big5.c in Sources */,
+                               C95B7FD3138F3C55004311DA /* btowc.c in Sources */,
+                               C95B7FD4138F3C55004311DA /* collate.c in Sources */,
+                               C95B7FD5138F3C55004311DA /* collcmp.c in Sources */,
+                               C95B7FD6138F3C55004311DA /* euc.c in Sources */,
+                               C95B7FD7138F3C55004311DA /* fix_grouping.c in Sources */,
+                               C95B7FD8138F3C55004311DA /* gb18030.c in Sources */,
+                               C95B7FD9138F3C55004311DA /* gb2312.c in Sources */,
+                               C95B7FDA138F3C55004311DA /* gbk.c in Sources */,
+                               C95B7FDB138F3C55004311DA /* ldpart.c in Sources */,
+                               C95B7FDC138F3C55004311DA /* lmessages.c in Sources */,
+                               C95B7FDD138F3C55004311DA /* lmonetary.c in Sources */,
+                               C95B7FDE138F3C55004311DA /* lnumeric.c in Sources */,
+                               C95B7FDF138F3C55004311DA /* localeconv.c in Sources */,
+                               C95B7FE0138F3C55004311DA /* mblen.c in Sources */,
+                               C95B7FE1138F3C55004311DA /* mbrlen.c in Sources */,
+                               C95B7FE2138F3C55004311DA /* mbrtowc.c in Sources */,
+                               C95B7FE3138F3C55004311DA /* mbsinit.c in Sources */,
+                               C95B7FE4138F3C55004311DA /* mbsnrtowcs.c in Sources */,
+                               C95B7FE5138F3C55004311DA /* mbsrtowcs.c in Sources */,
+                               C95B7FE6138F3C55004311DA /* mbstowcs.c in Sources */,
+                               C95B7FE7138F3C55004311DA /* mbtowc.c in Sources */,
+                               C95B7FE8138F3C55004311DA /* mskanji.c in Sources */,
+                               C95B7FE9138F3C55004311DA /* nextwctype.c in Sources */,
+                               C95B7FEA138F3C55004311DA /* nl_langinfo.c in Sources */,
+                               C95B7FEB138F3C55004311DA /* nomacros.c in Sources */,
+                               C95B7FEC138F3C55004311DA /* none.c in Sources */,
+                               C95B7FED138F3C55004311DA /* rune.c in Sources */,
+                               C95B7FEE138F3C55004311DA /* runetype.c in Sources */,
+                               C95B7FEF138F3C55004311DA /* setlocale.c in Sources */,
+                               C95B7FF0138F3C55004311DA /* setrunelocale.c in Sources */,
+                               C95B7FF1138F3C55004311DA /* table.c in Sources */,
+                               C95B7FF2138F3C55004311DA /* tolower.c in Sources */,
+                               C95B7FF3138F3C55004311DA /* toupper.c in Sources */,
+                               C95B7FF4138F3C55004311DA /* utf2.c in Sources */,
+                               C95B7FF5138F3C55004311DA /* utf8.c in Sources */,
+                               C95B7FF6138F3C55004311DA /* wcrtomb.c in Sources */,
+                               C95B7FF7138F3C55004311DA /* wcsftime.c in Sources */,
+                               C95B7FF8138F3C55004311DA /* wcsnrtombs.c in Sources */,
+                               C95B7FF9138F3C55004311DA /* wcsrtombs.c in Sources */,
+                               C95B7FFA138F3C55004311DA /* wcstod.c in Sources */,
+                               C95B7FFB138F3C55004311DA /* wcstof.c in Sources */,
+                               C95B7FFC138F3C55004311DA /* wcstoimax.c in Sources */,
+                               C95B7FFD138F3C55004311DA /* wcstol.c in Sources */,
+                               C95B7FFE138F3C55004311DA /* wcstold.c in Sources */,
+                               C95B7FFF138F3C55004311DA /* wcstoll.c in Sources */,
+                               C95B8000138F3C55004311DA /* wcstombs.c in Sources */,
+                               C95B8001138F3C55004311DA /* wcstoul.c in Sources */,
+                               C95B8002138F3C55004311DA /* wcstoull.c in Sources */,
+                               C95B8003138F3C55004311DA /* wcstoumax.c in Sources */,
+                               C95B8004138F3C55004311DA /* wctob.c in Sources */,
+                               C95B8005138F3C55004311DA /* wctomb.c in Sources */,
+                               C95B8006138F3C55004311DA /* wctrans.c in Sources */,
+                               C95B8007138F3C55004311DA /* wctype.c in Sources */,
+                               C95B8008138F3C55004311DA /* wcwidth.c in Sources */,
+                               C95B8009138F3C55004311DA /* frune.c in Sources */,
+                               C95B800A138F3C55004311DA /* isctype.c in Sources */,
+                               C95B800B138F3C55004311DA /* iswctype.c in Sources */,
+                               C95B800C138F3C55004311DA /* lconv.c in Sources */,
+                               C95B800D138F3C55004311DA /* mbrune.c in Sources */,
+                               C95B800E138F3C55004311DA /* runedepreciated.c in Sources */,
+                               C95B800F138F3C55004311DA /* setinvalidrune.c in Sources */,
+                               C95B8010138F3C55004311DA /* xlocale.c in Sources */,
+                               C95B8011138F3C55004311DA /* addr2ascii.c in Sources */,
+                               C95B8012138F3C55004311DA /* ascii2addr.c in Sources */,
+                               C95B8013138F3C55004311DA /* inet_addr.c in Sources */,
+                               C95B8014138F3C55004311DA /* inet_lnaof.c in Sources */,
+                               C95B8015138F3C55004311DA /* inet_makeaddr.c in Sources */,
+                               C95B8016138F3C55004311DA /* inet_net_ntop.c in Sources */,
+                               C95B8017138F3C55004311DA /* inet_net_pton.c in Sources */,
+                               C95B8018138F3C55004311DA /* inet_neta.c in Sources */,
+                               C95B8019138F3C55004311DA /* inet_netof.c in Sources */,
+                               C95B801A138F3C55004311DA /* inet_network.c in Sources */,
+                               C95B801B138F3C55004311DA /* inet_ntoa.c in Sources */,
+                               C95B801C138F3C55004311DA /* linkaddr.c in Sources */,
+                               C95B801D138F3C55004311DA /* nsap_addr.c in Sources */,
+                               C95B801E138F3C55004311DA /* recv.c in Sources */,
+                               C95B801F138F3C55004311DA /* send.c in Sources */,
+                               C95B8020138F3C55004311DA /* sockatmark.c in Sources */,
+                               C95B8021138F3C55004311DA /* sourcefilter.c in Sources */,
+                               C95B8022138F3C55004311DA /* msgcat.c in Sources */,
+                               C95B8023138F3C55004311DA /* acl.c in Sources */,
+                               C95B8024138F3C55004311DA /* acl_entry.c in Sources */,
+                               C95B8025138F3C55004311DA /* acl_file.c in Sources */,
+                               C95B8026138F3C55004311DA /* acl_flag.c in Sources */,
+                               C95B8027138F3C55004311DA /* acl_perm.c in Sources */,
+                               C95B8028138F3C55004311DA /* acl_translate.c in Sources */,
+                               C95B8031138F3C55004311DA /* mk_pthread_impl.c in Sources */,
+                               C95B8032138F3C55004311DA /* pthread.c in Sources */,
+                               C95B8033138F3C55004311DA /* pthread_cancelable.c in Sources */,
+                               C95B8034138F3C55004311DA /* pthread_cond.c in Sources */,
+                               C95B8035138F3C55004311DA /* pthread_mutex.c in Sources */,
+                               C95B8036138F3C55004311DA /* pthread_rwlock.c in Sources */,
+                               C95B8037138F3C55004311DA /* pthread_tsd.c in Sources */,
+                               C95B8038138F3C55004311DA /* pthread_atfork_test.c in Sources */,
+                               C95B8039138F3C55004311DA /* thread_setup.c in Sources */,
+                               C95B803C138F3C55004311DA /* regerror.c in Sources */,
+                               C95B803F138F3C55004311DA /* chk_fail.c in Sources */,
+                               C95B8040138F3C55004311DA /* memcpy_chk.c in Sources */,
+                               C95B8041138F3C55004311DA /* memmove_chk.c in Sources */,
+                               C95B8042138F3C55004311DA /* memset_chk.c in Sources */,
+                               C95B8043138F3C55004311DA /* snprintf_chk.c in Sources */,
+                               C95B8044138F3C55004311DA /* sprintf_chk.c in Sources */,
+                               C95B8045138F3C55004311DA /* stpcpy_chk.c in Sources */,
+                               C95B8046138F3C55004311DA /* stpncpy_chk.c in Sources */,
+                               C95B8047138F3C55004311DA /* strcat_chk.c in Sources */,
+                               C95B8048138F3C55004311DA /* strcpy_chk.c in Sources */,
+                               C95B8049138F3C55004311DA /* strncat_chk.c in Sources */,
+                               C95B804A138F3C55004311DA /* strncpy_chk.c in Sources */,
+                               C95B804B138F3C55004311DA /* vsnprintf_chk.c in Sources */,
+                               C95B804C138F3C55004311DA /* vsprintf_chk.c in Sources */,
+                               C95B804D138F3C55004311DA /* _flock_stub.c in Sources */,
+                               C95B804E138F3C55004311DA /* asprintf.c in Sources */,
+                               C95B804F138F3C55004311DA /* clrerr.c in Sources */,
+                               C95B8050138F3C55004311DA /* dprintf.c in Sources */,
+                               C95B8051138F3C55004311DA /* fclose.c in Sources */,
+                               C95B8052138F3C55004311DA /* fdopen.c in Sources */,
+                               C95B8053138F3C55004311DA /* feof.c in Sources */,
+                               C95B8054138F3C55004311DA /* ferror.c in Sources */,
+                               C95B8055138F3C55004311DA /* fflush.c in Sources */,
+                               C95B8056138F3C55004311DA /* fgetc.c in Sources */,
+                               C95B8057138F3C55004311DA /* fgetln.c in Sources */,
+                               C95B8058138F3C55004311DA /* fgetpos.c in Sources */,
+                               C95B8059138F3C55004311DA /* fgets.c in Sources */,
+                               C95B805A138F3C55004311DA /* fgetwc.c in Sources */,
+                               C95B805B138F3C55004311DA /* fgetwln.c in Sources */,
+                               C95B805C138F3C55004311DA /* fgetws.c in Sources */,
+                               C95B805D138F3C55004311DA /* fileno.c in Sources */,
+                               C95B805E138F3C55004311DA /* findfp.c in Sources */,
+                               C95B805F138F3C55004311DA /* flags.c in Sources */,
+                               C95B8060138F3C55004311DA /* fopen.c in Sources */,
+                               C95B8061138F3C55004311DA /* fprintf.c in Sources */,
+                               C95B8062138F3C55004311DA /* fpurge.c in Sources */,
+                               C95B8063138F3C55004311DA /* fputc.c in Sources */,
+                               C95B8064138F3C55004311DA /* fputs.c in Sources */,
+                               C95B8065138F3C55004311DA /* fputwc.c in Sources */,
+                               C95B8066138F3C55004311DA /* fputws.c in Sources */,
+                               C95B8067138F3C55004311DA /* fread.c in Sources */,
+                               C95B8068138F3C55004311DA /* freopen.c in Sources */,
+                               C95B8069138F3C55004311DA /* fscanf.c in Sources */,
+                               C95B806A138F3C55004311DA /* fseek.c in Sources */,
+                               C95B806B138F3C55004311DA /* fsetpos.c in Sources */,
+                               C95B806C138F3C55004311DA /* ftell.c in Sources */,
+                               C95B806D138F3C55004311DA /* funopen.c in Sources */,
+                               C95B806E138F3C55004311DA /* fvwrite.c in Sources */,
+                               C95B806F138F3C55004311DA /* fwalk.c in Sources */,
+                               C95B8070138F3C55004311DA /* fwide.c in Sources */,
+                               C95B8071138F3C55004311DA /* fwprintf.c in Sources */,
+                               C95B8072138F3C55004311DA /* fwrite.c in Sources */,
+                               C95B8073138F3C55004311DA /* fwscanf.c in Sources */,
+                               C95B8074138F3C55004311DA /* getc.c in Sources */,
+                               C95B8075138F3C55004311DA /* getchar.c in Sources */,
+                               C95B8076138F3C55004311DA /* getdelim.c in Sources */,
+                               C95B8077138F3C55004311DA /* getline.c in Sources */,
+                               C95B8078138F3C55004311DA /* gets.c in Sources */,
+                               C95B8079138F3C55004311DA /* getw.c in Sources */,
+                               C95B807A138F3C55004311DA /* getwc.c in Sources */,
+                               C95B807B138F3C55004311DA /* getwchar.c in Sources */,
+                               C95B807C138F3C55004311DA /* makebuf.c in Sources */,
+                               C95B807D138F3C55004311DA /* mktemp.c in Sources */,
+                               C95B807E138F3C55004311DA /* perror.c in Sources */,
+                               C95B807F138F3C55004311DA /* printf-pos.c in Sources */,
+                               C95B8080138F3C55004311DA /* printf.c in Sources */,
+                               C95B8081138F3C55004311DA /* putc.c in Sources */,
+                               C95B8082138F3C55004311DA /* putchar.c in Sources */,
+                               C95B8083138F3C55004311DA /* puts.c in Sources */,
+                               C95B8084138F3C55004311DA /* putw.c in Sources */,
+                               C95B8085138F3C55004311DA /* putwc.c in Sources */,
+                               C95B8086138F3C55004311DA /* putwchar.c in Sources */,
+                               C95B8087138F3C55004311DA /* refill.c in Sources */,
+                               C95B8088138F3C55004311DA /* remove.c in Sources */,
+                               C95B8089138F3C55004311DA /* rewind.c in Sources */,
+                               C95B808A138F3C55004311DA /* rget.c in Sources */,
+                               C95B808B138F3C55004311DA /* scanf.c in Sources */,
+                               C95B808C138F3C55004311DA /* setbuf.c in Sources */,
+                               C95B808D138F3C55004311DA /* setbuffer.c in Sources */,
+                               C95B808E138F3C55004311DA /* setvbuf.c in Sources */,
+                               C95B808F138F3C55004311DA /* snprintf.c in Sources */,
+                               C95B8090138F3C55004311DA /* sprintf.c in Sources */,
+                               C95B8091138F3C55004311DA /* sscanf.c in Sources */,
+                               C95B8092138F3C55004311DA /* stdio.c in Sources */,
+                               C95B8093138F3C55004311DA /* swprintf.c in Sources */,
+                               C95B8094138F3C55004311DA /* swscanf.c in Sources */,
+                               C95B8095138F3C55004311DA /* tempnam.c in Sources */,
+                               C95B8096138F3C55004311DA /* tmpfile.c in Sources */,
+                               C95B8097138F3C55004311DA /* tmpnam.c in Sources */,
+                               C95B8098138F3C55004311DA /* ungetc.c in Sources */,
+                               C95B8099138F3C55004311DA /* ungetwc.c in Sources */,
+                               C95B809A138F3C55004311DA /* vasprintf.c in Sources */,
+                               C95B809B138F3C55004311DA /* vdprintf.c in Sources */,
+                               C95B809C138F3C55004311DA /* vfprintf.c in Sources */,
+                               C95B809D138F3C55004311DA /* vfscanf.c in Sources */,
+                               C95B809E138F3C55004311DA /* vfwprintf.c in Sources */,
+                               C95B809F138F3C55004311DA /* vfwscanf.c in Sources */,
+                               C95B80A0138F3C55004311DA /* vprintf.c in Sources */,
+                               C95B80A1138F3C55004311DA /* vscanf.c in Sources */,
+                               C95B80A2138F3C55004311DA /* vsnprintf.c in Sources */,
+                               C95B80A3138F3C55004311DA /* vsprintf.c in Sources */,
+                               C95B80A4138F3C55004311DA /* vsscanf.c in Sources */,
+                               C95B80A5138F3C55004311DA /* vswprintf.c in Sources */,
+                               C95B80A6138F3C55004311DA /* vswscanf.c in Sources */,
+                               C95B80A7138F3C55004311DA /* vwprintf.c in Sources */,
+                               C95B80A8138F3C55004311DA /* vwscanf.c in Sources */,
+                               C95B80A9138F3C55004311DA /* wbuf.c in Sources */,
+                               C95B80AA138F3C55004311DA /* wprintf.c in Sources */,
+                               C95B80AB138F3C55004311DA /* wscanf.c in Sources */,
+                               C95B80AC138F3C55004311DA /* wsetup.c in Sources */,
+                               C95B80AD138F3C55004311DA /* a64l.c in Sources */,
+                               C95B80AE138F3C55004311DA /* _Exit_.c in Sources */,
+                               C95B80AF138F3C55004311DA /* abort.c in Sources */,
+                               C95B80B0138F3C55004311DA /* abs.c in Sources */,
+                               C95B80B1138F3C55004311DA /* atexit.c in Sources */,
+                               C95B80B2138F3C55004311DA /* atof.c in Sources */,
+                               C95B80B3138F3C55004311DA /* atoi.c in Sources */,
+                               C95B80B4138F3C55004311DA /* atol.c in Sources */,
+                               C95B80B5138F3C55004311DA /* atoll.c in Sources */,
+                               C95B80B6138F3C55004311DA /* bsearch.c in Sources */,
+                               C95B80B7138F3C55004311DA /* div.c in Sources */,
+                               C95B80B8138F3C55004311DA /* exit.c in Sources */,
+                               C95B80B9138F3C55004311DA /* getenv.c in Sources */,
+                               C95B80BA138F3C55004311DA /* getopt.c in Sources */,
+                               C95B80BB138F3C55004311DA /* getopt_long.c in Sources */,
+                               C95B80BC138F3C55004311DA /* getsubopt.c in Sources */,
+                               C95B80BD138F3C55004311DA /* hcreate.c in Sources */,
+                               C95B80BE138F3C55004311DA /* heapsort.c in Sources */,
+                               C95B80BF138F3C55004311DA /* heapsort_b.c in Sources */,
+                               C95B80C0138F3C55004311DA /* heapsort_r.c in Sources */,
+                               C95B80C1138F3C55004311DA /* imaxabs.c in Sources */,
+                               C95B80C2138F3C55004311DA /* imaxdiv.c in Sources */,
+                               C95B80C3138F3C55004311DA /* insque.c in Sources */,
+                               C95B80C4138F3C55004311DA /* labs.c in Sources */,
+                               C95B80C5138F3C55004311DA /* ldiv.c in Sources */,
+                               C95B80C6138F3C55004311DA /* llabs.c in Sources */,
+                               C95B80C7138F3C55004311DA /* lldiv.c in Sources */,
+                               C95B80C8138F3C55004311DA /* lsearch.c in Sources */,
+                               C95B80C9138F3C55004311DA /* merge.c in Sources */,
+                               C95B80CA138F3C55004311DA /* putenv.c in Sources */,
+                               C95B80CB138F3C55004311DA /* qsort.c in Sources */,
+                               C95B80CC138F3C55004311DA /* qsort_r.c in Sources */,
+                               C95B80CD138F3C55004311DA /* radixsort.c in Sources */,
+                               C95B80CE138F3C55004311DA /* rand.c in Sources */,
+                               C95B80CF138F3C55004311DA /* random.c in Sources */,
+                               C95B80D0138F3C55004311DA /* reallocf.c in Sources */,
+                               C95B80D1138F3C55004311DA /* realpath.c in Sources */,
+                               C95B80D2138F3C55004311DA /* remque.c in Sources */,
+                               C95B80D3138F3C55004311DA /* setenv.c in Sources */,
+                               C95B80D4138F3C55004311DA /* strhash.c in Sources */,
+                               C95B80D5138F3C55004311DA /* strtoimax.c in Sources */,
+                               C95B80D6138F3C55004311DA /* strtol.c in Sources */,
+                               C95B80D7138F3C55004311DA /* strtoll.c in Sources */,
+                               C95B80D8138F3C55004311DA /* strtoq.c in Sources */,
+                               C95B80D9138F3C55004311DA /* strtoul.c in Sources */,
+                               C95B80DA138F3C55004311DA /* strtoull.c in Sources */,
+                               C95B80DB138F3C55004311DA /* strtoumax.c in Sources */,
+                               C95B80DC138F3C55004311DA /* strtouq.c in Sources */,
+                               C95B80DD138F3C55004311DA /* system.c in Sources */,
+                               C95B80DE138F3C55004311DA /* tdelete.c in Sources */,
+                               C95B80DF138F3C55004311DA /* tfind.c in Sources */,
+                               C95B80E0138F3C55004311DA /* tsearch.c in Sources */,
+                               C95B80E1138F3C55004311DA /* twalk.c in Sources */,
+                               C95B80E2138F3C55004311DA /* grantpt.c in Sources */,
+                               C95B80E3138F3C55004311DA /* l64a.c in Sources */,
+                               C95B80E4138F3C55004311DA /* strfmon.c in Sources */,
+                               C95B80E5138F3C55004311DA /* ecvt.c in Sources */,
+                               C95B80E6138F3C55004311DA /* gcvt.c in Sources */,
+                               C95B80E7138F3C55004311DA /* qsort_b-fbsd.c in Sources */,
+                               C95B80E8138F3C55004311DA /* asctime.c in Sources */,
+                               C95B80E9138F3C55004311DA /* difftime.c in Sources */,
+                               C95B80EA138F3C55004311DA /* ftime.c in Sources */,
+                               C95B80EB138F3C55004311DA /* localtime.c in Sources */,
+                               C95B80EC138F3C55004311DA /* strftime.c in Sources */,
+                               C95B80ED138F3C55004311DA /* strptime.c in Sources */,
+                               C95B80EE138F3C55004311DA /* time32.c in Sources */,
+                               C95B80EF138F3C55004311DA /* timelocal.c in Sources */,
+                               C95B80F0138F3C55004311DA /* getdate.c in Sources */,
+                               C95B80F1138F3C55004311DA /* timezone_unix03.c in Sources */,
+                               C95B80F2138F3C55004311DA /* bcmp.c in Sources */,
+                               C95B80F3138F3C55004311DA /* bcopy.c in Sources */,
+                               C95B80F4138F3C55004311DA /* bzero.c in Sources */,
+                               C95B80F5138F3C55004311DA /* index.c in Sources */,
+                               C95B80F6138F3C55004311DA /* memccpy.c in Sources */,
+                               C95B80F7138F3C55004311DA /* memchr.c in Sources */,
+                               C95B80F8138F3C55004311DA /* memcmp.c in Sources */,
+                               C95B80F9138F3C55004311DA /* memcpy.c in Sources */,
+                               C95B80FA138F3C55004311DA /* memmem.c in Sources */,
+                               C95B80FB138F3C55004311DA /* memmove.c in Sources */,
+                               C95B80FC138F3C55004311DA /* memset.c in Sources */,
+                               C95B80FD138F3C55004311DA /* rindex.c in Sources */,
+                               C95B8100138F3C55004311DA /* strcasecmp.c in Sources */,
+                               C95B8101138F3C55004311DA /* strcasestr.c in Sources */,
+                               C95B8103138F3C55004311DA /* strchr.c in Sources */,
+                               C95B8104138F3C55004311DA /* strcmp.c in Sources */,
+                               C95B8105138F3C55004311DA /* strcoll.c in Sources */,
+                               C95B8107138F3C55004311DA /* strcspn.c in Sources */,
+                               C95B8108138F3C55004311DA /* strdup.c in Sources */,
+                               C95B8109138F3C55004311DA /* strerror.c in Sources */,
+                               C95B810C138F3C55004311DA /* strlen.c in Sources */,
+                               C95B810D138F3C55004311DA /* strmode.c in Sources */,
+                               C95B810F138F3C55004311DA /* strncmp.c in Sources */,
+                               C95B8111138F3C55004311DA /* strndup.c in Sources */,
+                               C95B8112138F3C55004311DA /* strnlen.c in Sources */,
+                               C95B8113138F3C55004311DA /* strnstr.c in Sources */,
+                               C95B8114138F3C55004311DA /* strpbrk.c in Sources */,
+                               C95B8115138F3C55004311DA /* strrchr.c in Sources */,
+                               C95B8116138F3C55004311DA /* strsep.c in Sources */,
+                               C95B8117138F3C55004311DA /* strsignal.c in Sources */,
+                               C95B8118138F3C55004311DA /* strspn.c in Sources */,
+                               C95B8119138F3C55004311DA /* strstr.c in Sources */,
+                               C95B811A138F3C55004311DA /* strtok.c in Sources */,
+                               C95B811B138F3C55004311DA /* strxfrm.c in Sources */,
+                               C95B811C138F3C55004311DA /* swab.c in Sources */,
+                               C95B811D138F3C55004311DA /* wcpcpy.c in Sources */,
+                               C95B811E138F3C55004311DA /* wcpncpy.c in Sources */,
+                               C95B811F138F3C55004311DA /* wcscasecmp.c in Sources */,
+                               C95B8120138F3C55004311DA /* wcscat.c in Sources */,
+                               C95B8121138F3C55004311DA /* wcschr.c in Sources */,
+                               C95B8122138F3C55004311DA /* wcscmp.c in Sources */,
+                               C95B8123138F3C55004311DA /* wcscoll.c in Sources */,
+                               C95B8124138F3C55004311DA /* wcscpy.c in Sources */,
+                               C95B8125138F3C55004311DA /* wcscspn.c in Sources */,
+                               C95B8126138F3C55004311DA /* wcsdup.c in Sources */,
+                               C95B8127138F3C55004311DA /* wcslcat.c in Sources */,
+                               C95B8128138F3C55004311DA /* wcslcpy.c in Sources */,
+                               C95B8129138F3C55004311DA /* wcslen.c in Sources */,
+                               C95B812A138F3C55004311DA /* wcsncasecmp.c in Sources */,
+                               C95B812B138F3C55004311DA /* wcsncat.c in Sources */,
+                               C95B812C138F3C55004311DA /* wcsncmp.c in Sources */,
+                               C95B812D138F3C55004311DA /* wcsncpy.c in Sources */,
+                               C95B812E138F3C55004311DA /* wcsnlen.c in Sources */,
+                               C95B812F138F3C55004311DA /* wcspbrk.c in Sources */,
+                               C95B8130138F3C55004311DA /* wcsrchr.c in Sources */,
+                               C95B8131138F3C55004311DA /* wcsspn.c in Sources */,
+                               C95B8132138F3C55004311DA /* wcsstr.c in Sources */,
+                               C95B8133138F3C55004311DA /* wcstok.c in Sources */,
+                               C95B8134138F3C55004311DA /* wcswidth.c in Sources */,
+                               C95B8135138F3C55004311DA /* wcsxfrm.c in Sources */,
+                               C95B8136138F3C55004311DA /* wmemchr.c in Sources */,
+                               C95B8137138F3C55004311DA /* wmemcmp.c in Sources */,
+                               C95B8138138F3C55004311DA /* wmemcpy.c in Sources */,
+                               C95B8139138F3C55004311DA /* wmemmove.c in Sources */,
+                               C95B813A138F3C55004311DA /* wmemset.c in Sources */,
+                               C95B813B138F3C55004311DA /* __libc_init.c in Sources */,
+                               C95B813C138F3C55004311DA /* _libc_fork_child.c in Sources */,
+                               C95B813D138F3C55004311DA /* chmodx_np.c in Sources */,
+                               C95B813E138F3C55004311DA /* context-stubs.c in Sources */,
+                               C95B813F138F3C55004311DA /* crt_externs.c in Sources */,
+                               C95B8140138F3C55004311DA /* errno.c in Sources */,
+                               C95B8141138F3C55004311DA /* fork.c in Sources */,
+                               C95B8142138F3C55004311DA /* getgroups.c in Sources */,
+                               C95B8143138F3C55004311DA /* getiopolicy_np.c in Sources */,
+                               C95B8144138F3C55004311DA /* gettimeofday.c in Sources */,
+                               C95B8145138F3C55004311DA /* msgctl.c in Sources */,
+                               C95B8146138F3C55004311DA /* stack_protector.c in Sources */,
+                               C95B8147138F3C55004311DA /* openx_np.c in Sources */,
+                               C95B8148138F3C55004311DA /* OSMemoryNotification.c in Sources */,
+                               C95B8149138F3C55004311DA /* OSThermalNotification.c in Sources */,
+                               C95B814A138F3C55004311DA /* posix_spawn.c in Sources */,
+                               C95B814B138F3C55004311DA /* semctl.c in Sources */,
+                               C95B814C138F3C55004311DA /* settimeofday.c in Sources */,
+                               C95B814D138F3C55004311DA /* shmctl.c in Sources */,
+                               C95B814E138F3C55004311DA /* sigaction.c in Sources */,
+                               C95B814F138F3C55004311DA /* sigcatch.c in Sources */,
+                               C95B8150138F3C55004311DA /* sigtramp.c in Sources */,
+                               C95B8151138F3C55004311DA /* slot_name.c in Sources */,
+                               C95B8152138F3C55004311DA /* statx_np.c in Sources */,
+                               C95B8153138F3C55004311DA /* umaskx_np.c in Sources */,
+                               C95B8154138F3C55004311DA /* cprocs.c in Sources */,
+                               C95B8155138F3C55004311DA /* cthreads.c in Sources */,
+                               C95B8156138F3C55004311DA /* mig_support.c in Sources */,
+                               C95B8157138F3C55004311DA /* fparseln.c in Sources */,
+                               C95B8158138F3C55004311DA /* login.c in Sources */,
+                               C95B8159138F3C55004311DA /* login_tty.c in Sources */,
+                               C95B815A138F3C55004311DA /* logout.c in Sources */,
+                               C95B815B138F3C55004311DA /* logwtmp.c in Sources */,
+                               3F76864E13E91D5D00C94D25 /* mkpath_np.c in Sources */,
+                               C95B815C138F3C55004311DA /* opendev.c in Sources */,
+                               C95B815D138F3C55004311DA /* pty.c in Sources */,
+                               C95B815E138F3C55004311DA /* clear.c in Sources */,
+                               C95B815F138F3C55004311DA /* compare.c in Sources */,
+                               C95B8160138F3C55004311DA /* copy.c in Sources */,
+                               C95B8161138F3C55004311DA /* gen_uuid.c in Sources */,
+                               C95B8162138F3C55004311DA /* isnull.c in Sources */,
+                               C95B8163138F3C55004311DA /* pack.c in Sources */,
+                               C95B8164138F3C55004311DA /* parse.c in Sources */,
+                               C95B8165138F3C55004311DA /* unpack.c in Sources */,
+                               C95B8166138F3C55004311DA /* unparse.c in Sources */,
+                               C95B8167138F3C55004311DA /* getmcontext.c in Sources */,
+                               C95B8168138F3C55004311DA /* makecontext.c in Sources */,
+                               C95B8169138F3C55004311DA /* setcontext.c in Sources */,
+                               C95B816A138F3C55004311DA /* swapcontext.c in Sources */,
+                               C95B816B138F3C55004311DA /* bcopy.c in Sources */,
+                               C95B816C138F3C55004311DA /* bzero.c in Sources */,
+                               C95B816D138F3C55004311DA /* memcpy.c in Sources */,
+                               C95B816E138F3C55004311DA /* memmove.c in Sources */,
+                               C95B816F138F3C55004311DA /* atomic.c in Sources */,
+                               C95B8170138F3C55004311DA /* spinlocks.c in Sources */,
+                               3F2208EB14358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C645F1450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1B7146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C95B8187138F52B0004311DA /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C95B8188138F52B0004311DA /* init_cpu_capabilities.c in Sources */,
+                               C95B8189138F52B0004311DA /* dyld_resolvers.c in Sources */,
+                               C95B818A138F52B0004311DA /* arm_commpage_gettimeofday.c in Sources */,
+                               C95B818B138F52B0004311DA /* gcc_atomic.c in Sources */,
+                               C95B818C138F52B0004311DA /* OSAtomic-v4.c in Sources */,
+                               C95B818D138F52B0004311DA /* OSAtomic_resolvers.c in Sources */,
+                               C95B818F138F52B0004311DA /* creat.c in Sources */,
+                               C95B8190138F52B0004311DA /* gethostid.c in Sources */,
+                               C95B8191138F52B0004311DA /* getwd.c in Sources */,
+                               C95B8192138F52B0004311DA /* killpg.c in Sources */,
+                               C95B8193138F52B0004311DA /* sethostid.c in Sources */,
+                               C95B8194138F52B0004311DA /* setpgrp.c in Sources */,
+                               C95B8195138F52B0004311DA /* setrgid.c in Sources */,
+                               C95B8196138F52B0004311DA /* setruid.c in Sources */,
+                               C95B8197138F52B0004311DA /* setregid.c in Sources */,
+                               C95B8198138F52B0004311DA /* setreuid.c in Sources */,
+                               C95B8199138F52B0004311DA /* sigaltstk.c in Sources */,
+                               C95B819A138F52B0004311DA /* sigcompat.c in Sources */,
+                               C95B819B138F52B0004311DA /* _dirhelper.c in Sources */,
+                               C95B819C138F52B0004311DA /* kvm.c in Sources */,
+                               C95B819D138F52B0004311DA /* libproc.c in Sources */,
+                               C95B819E138F52B0004311DA /* MKGetTimeBaseInfo.c in Sources */,
+                               C95B819F138F52B0004311DA /* proc_listpidspath.c in Sources */,
+                               C95B81A0138F52B0004311DA /* forceLibcToBuild.c in Sources */,
+                               C95B81A1138F52B0004311DA /* bt_close.c in Sources */,
+                               C95B81A2138F52B0004311DA /* bt_conv.c in Sources */,
+                               C95B81A3138F52B0004311DA /* bt_debug.c in Sources */,
+                               C95B81A4138F52B0004311DA /* bt_delete.c in Sources */,
+                               C95B81A5138F52B0004311DA /* bt_get.c in Sources */,
+                               C95B81A6138F52B0004311DA /* bt_open.c in Sources */,
+                               C95B81A7138F52B0004311DA /* bt_overflow.c in Sources */,
+                               C95B81A8138F52B0004311DA /* bt_page.c in Sources */,
+                               C95B81A9138F52B0004311DA /* bt_put.c in Sources */,
+                               C95B81AA138F52B0004311DA /* bt_search.c in Sources */,
+                               C95B81AB138F52B0004311DA /* bt_seq.c in Sources */,
+                               C95B81AC138F52B0004311DA /* bt_split.c in Sources */,
+                               C95B81AD138F52B0004311DA /* bt_utils.c in Sources */,
+                               C95B81AE138F52B0004311DA /* db.c in Sources */,
+                               C95B81AF138F52B0004311DA /* hash.c in Sources */,
+                               C95B81B0138F52B0004311DA /* hash_bigkey.c in Sources */,
+                               C95B81B1138F52B0004311DA /* hash_buf.c in Sources */,
+                               C95B81B2138F52B0004311DA /* hash_func.c in Sources */,
+                               C95B81B3138F52B0004311DA /* hash_log2.c in Sources */,
+                               C95B81B4138F52B0004311DA /* hash_page.c in Sources */,
+                               C95B81B5138F52B0004311DA /* ndbm.c in Sources */,
+                               C95B81B6138F52B0004311DA /* mpool.c in Sources */,
+                               C95B81B7138F52B0004311DA /* rec_close.c in Sources */,
+                               C95B81B8138F52B0004311DA /* rec_delete.c in Sources */,
+                               C95B81B9138F52B0004311DA /* rec_get.c in Sources */,
+                               C95B81BA138F52B0004311DA /* rec_open.c in Sources */,
+                               C95B81BB138F52B0004311DA /* rec_put.c in Sources */,
+                               C95B81BC138F52B0004311DA /* rec_search.c in Sources */,
+                               C95B81BD138F52B0004311DA /* rec_seq.c in Sources */,
+                               C95B81BE138F52B0004311DA /* rec_utils.c in Sources */,
+                               C95B81BF138F52B0004311DA /* brk.c in Sources */,
+                               C95B81C0138F52B0004311DA /* bsd_signal.c in Sources */,
+                               C95B81C1138F52B0004311DA /* lchflags.c in Sources */,
+                               C95B81C2138F52B0004311DA /* lchmod.c in Sources */,
+                               C95B81C3138F52B0004311DA /* lutimes.c in Sources */,
+                               C95B81C4138F52B0004311DA /* statvfs.c in Sources */,
+                               C95B81C5138F52B0004311DA /* tcgetsid.c in Sources */,
+                               C95B81C6138F52B0004311DA /* _ldbl_util.c in Sources */,
+                               C95B81C7138F52B0004311DA /* _hdtoa.c in Sources */,
+                               C95B81C8138F52B0004311DA /* _ldtoa.c in Sources */,
+                               C95B81C9138F52B0004311DA /* gdtoa-dmisc.c in Sources */,
+                               C95B81CA138F52B0004311DA /* gdtoa-dtoa.c in Sources */,
+                               C95B81CB138F52B0004311DA /* gdtoa-gdtoa.c in Sources */,
+                               C95B81CC138F52B0004311DA /* gdtoa-gethex.c in Sources */,
+                               C95B81CD138F52B0004311DA /* gdtoa-gmisc.c in Sources */,
+                               C95B81CE138F52B0004311DA /* gdtoa-hd_init.c in Sources */,
+                               C95B81CF138F52B0004311DA /* gdtoa-hexnan.c in Sources */,
+                               C95B81D0138F52B0004311DA /* gdtoa-misc.c in Sources */,
+                               C95B81D1138F52B0004311DA /* gdtoa-smisc.c in Sources */,
+                               C95B81D2138F52B0004311DA /* gdtoa-strtod.c in Sources */,
+                               C95B81D3138F52B0004311DA /* gdtoa-strtodg.c in Sources */,
+                               C95B81D4138F52B0004311DA /* gdtoa-strtof.c in Sources */,
+                               C95B81D5138F52B0004311DA /* gdtoa-strtoIg.c in Sources */,
+                               C95B81D6138F52B0004311DA /* gdtoa-strtopdd.c in Sources */,
+                               C95B81D7138F52B0004311DA /* gdtoa-strtopx.c in Sources */,
+                               C95B81D8138F52B0004311DA /* gdtoa-strtord.c in Sources */,
+                               C95B81D9138F52B0004311DA /* gdtoa-sum.c in Sources */,
+                               C95B81DA138F52B0004311DA /* gdtoa-ulp.c in Sources */,
+                               C95B81DB138F52B0004311DA /* glue.c in Sources */,
+                               C95B81DC138F52B0004311DA /* machdep_ldisd.c in Sources */,
+                               C95B81DD138F52B0004311DA /* machdep_ldisdd.c in Sources */,
+                               C95B81DE138F52B0004311DA /* machdep_ldisQ.c in Sources */,
+                               C95B81DF138F52B0004311DA /* machdep_ldisx.c in Sources */,
+                               C95B81E0138F52B0004311DA /* _simple.c in Sources */,
+                               C95B81E1138F52B0004311DA /* asl.c in Sources */,
+                               C95B81E2138F52B0004311DA /* asl_core.c in Sources */,
+                               C95B81E3138F52B0004311DA /* asl_file.c in Sources */,
+                               C95B81E4138F52B0004311DA /* asl_legacy1.c in Sources */,
+                               C95B81E5138F52B0004311DA /* asl_msg.c in Sources */,
+                               C95B81E6138F52B0004311DA /* asl_store.c in Sources */,
+                               C95B81E7138F52B0004311DA /* asl_util.c in Sources */,
+                               C95B81E8138F52B0004311DA /* assumes.c in Sources */,
+                               C95B81E9138F52B0004311DA /* authentication.c in Sources */,
+                               C95B81EA138F52B0004311DA /* backtrace.c in Sources */,
+                               C95B81EB138F52B0004311DA /* cache.c in Sources */,
+                               C95B81EC138F52B0004311DA /* confstr.c in Sources */,
+                               C95B81ED138F52B0004311DA /* crypt.c in Sources */,
+                               C95B81EE138F52B0004311DA /* devname.c in Sources */,
+                               C95B81EF138F52B0004311DA /* disklabel.c in Sources */,
+                               C95B81F0138F52B0004311DA /* errlst.c in Sources */,
+                               C95B81F1138F52B0004311DA /* filesec.c in Sources */,
+                               C95B81F2138F52B0004311DA /* _rand48.c in Sources */,
+                               C95B81F3138F52B0004311DA /* alarm.c in Sources */,
+                               C95B81F4138F52B0004311DA /* arc4random.c in Sources */,
+                               C95B81F5138F52B0004311DA /* assert.c in Sources */,
+                               C95B81F6138F52B0004311DA /* basename.c in Sources */,
+                               C95B81F7138F52B0004311DA /* clock.c in Sources */,
+                               C95B81F8138F52B0004311DA /* closedir.c in Sources */,
+                               C95B81F9138F52B0004311DA /* ctermid.c in Sources */,
+                               C95B81FA138F52B0004311DA /* daemon.c in Sources */,
+                               C95B81FB138F52B0004311DA /* dirname.c in Sources */,
+                               C95B81FC138F52B0004311DA /* drand48.c in Sources */,
+                               C95B81FD138F52B0004311DA /* erand48.c in Sources */,
+                               C95B81FE138F52B0004311DA /* err.c in Sources */,
+                               C95B81FF138F52B0004311DA /* exec.c in Sources */,
+                               C95B8200138F52B0004311DA /* fmtcheck.c in Sources */,
+                               C95B8201138F52B0004311DA /* fmtmsg.c in Sources */,
+                               C95B8202138F52B0004311DA /* fnmatch.c in Sources */,
+                               C95B8203138F52B0004311DA /* ftok.c in Sources */,
+                               C95B8204138F52B0004311DA /* getbsize.c in Sources */,
+                               C95B8205138F52B0004311DA /* getcap.c in Sources */,
+                               C95B8206138F52B0004311DA /* getcwd.c in Sources */,
+                               C95B8207138F52B0004311DA /* gethostname.c in Sources */,
+                               C95B8208138F52B0004311DA /* getlogin.c in Sources */,
+                               C95B8209138F52B0004311DA /* getmntinfo.c in Sources */,
+                               C95B820A138F52B0004311DA /* getpagesize.c in Sources */,
+                               C95B820B138F52B0004311DA /* getpeereid.c in Sources */,
+                               C95B820C138F52B0004311DA /* getprogname.c in Sources */,
+                               C95B820D138F52B0004311DA /* glob.c in Sources */,
+                               C95B820E138F52B0004311DA /* isatty.c in Sources */,
+                               C95B820F138F52B0004311DA /* jrand48.c in Sources */,
+                               C95B8210138F52B0004311DA /* lcong48.c in Sources */,
+                               C95B8211138F52B0004311DA /* lockf.c in Sources */,
+                               C95B8212138F52B0004311DA /* lrand48.c in Sources */,
+                               C95B8213138F52B0004311DA /* mrand48.c in Sources */,
+                               C95B8214138F52B0004311DA /* nice.c in Sources */,
+                               C95B8215138F52B0004311DA /* nrand48.c in Sources */,
+                               C95B8216138F52B0004311DA /* opendir.c in Sources */,
+                               C95B8217138F52B0004311DA /* pause.c in Sources */,
+                               C95B8218138F52B0004311DA /* popen.c in Sources */,
+                               C95B8219138F52B0004311DA /* pselect.c in Sources */,
+                               C95B821A138F52B0004311DA /* psignal.c in Sources */,
+                               C95B821B138F52B0004311DA /* raise.c in Sources */,
+                               C95B821C138F52B0004311DA /* readdir.c in Sources */,
+                               C95B821D138F52B0004311DA /* readpassphrase.c in Sources */,
+                               C95B821E138F52B0004311DA /* rewinddir.c in Sources */,
+                               C95B821F138F52B0004311DA /* scandir.c in Sources */,
+                               C95B8220138F52B0004311DA /* seed48.c in Sources */,
+                               C95B8221138F52B0004311DA /* seekdir.c in Sources */,
+                               C95B8222138F52B0004311DA /* sethostname.c in Sources */,
+                               C95B8223138F52B0004311DA /* setmode.c in Sources */,
+                               C95B8224138F52B0004311DA /* setprogname.c in Sources */,
+                               C95B8225138F52B0004311DA /* siginterrupt.c in Sources */,
+                               C95B8226138F52B0004311DA /* siglist.c in Sources */,
+                               C95B8227138F52B0004311DA /* signal.c in Sources */,
+                               C95B8228138F52B0004311DA /* sleep.c in Sources */,
+                               C95B8229138F52B0004311DA /* srand48.c in Sources */,
+                               C95B822A138F52B0004311DA /* stringlist.c in Sources */,
+                               C95B822B138F52B0004311DA /* sysconf.c in Sources */,
+                               C95B822C138F52B0004311DA /* sysctl.c in Sources */,
+                               C95B822D138F52B0004311DA /* sysctlbyname.c in Sources */,
+                               C95B822E138F52B0004311DA /* sysctlnametomib.c in Sources */,
+                               C95B822F138F52B0004311DA /* telldir.c in Sources */,
+                               C95B8230138F52B0004311DA /* termios.c in Sources */,
+                               C95B8231138F52B0004311DA /* time.c in Sources */,
+                               C95B8232138F52B0004311DA /* times.c in Sources */,
+                               C95B8233138F52B0004311DA /* timezone.c in Sources */,
+                               C95B8234138F52B0004311DA /* ttyname.c in Sources */,
+                               C95B8235138F52B0004311DA /* ttyslot.c in Sources */,
+                               C95B8236138F52B0004311DA /* ualarm.c in Sources */,
+                               C95B8237138F52B0004311DA /* ulimit.c in Sources */,
+                               C95B8238138F52B0004311DA /* unvis.c in Sources */,
+                               C95B8239138F52B0004311DA /* usleep.c in Sources */,
+                               C95B823A138F52B0004311DA /* utime.c in Sources */,
+                               C95B823B138F52B0004311DA /* vis.c in Sources */,
+                               C95B823C138F52B0004311DA /* wait.c in Sources */,
+                               C95B823D138F52B0004311DA /* wait3.c in Sources */,
+                               C95B823E138F52B0004311DA /* waitpid.c in Sources */,
+                               C95B823F138F52B0004311DA /* fts.c in Sources */,
+                               C95B8240138F52B0004311DA /* get_compat.c in Sources */,
+                               C95B8241138F52B0004311DA /* getloadavg.c in Sources */,
+                               C95B8242138F52B0004311DA /* getttyent.c in Sources */,
+                               C95B8243138F52B0004311DA /* getusershell.c in Sources */,
+                               C95B8244138F52B0004311DA /* getvfsbyname.c in Sources */,
+                               C95B8245138F52B0004311DA /* isinf.c in Sources */,
+                               C95B8246138F52B0004311DA /* isnan.c in Sources */,
+                               C95B8247138F52B0004311DA /* magazine_malloc.c in Sources */,
+                               C95B8248138F52B0004311DA /* malloc.c in Sources */,
+                               C95B8249138F52B0004311DA /* nanosleep.c in Sources */,
+                               C95B824A138F52B0004311DA /* utmpx.c in Sources */,
+                               C95B824B138F52B0004311DA /* nftw.c in Sources */,
+                               C95B824C138F52B0004311DA /* nlist.c in Sources */,
+                               C95B824D138F52B0004311DA /* NSSystemDirectories.c in Sources */,
+                               C95B824E138F52B0004311DA /* oldsyslog.c in Sources */,
+                               C95B824F138F52B0004311DA /* platfunc.c in Sources */,
+                               C95B8250138F52B0004311DA /* scalable_malloc.c in Sources */,
+                               C95B8251138F52B0004311DA /* setlogin.c in Sources */,
+                               C95B8252138F52B0004311DA /* sigsetops.c in Sources */,
+                               C95B8253138F52B0004311DA /* stack_logging.c in Sources */,
+                               C95B8254138F52B0004311DA /* stack_logging_disk.c in Sources */,
+                               C95B8255138F52B0004311DA /* strtofflags.c in Sources */,
+                               C95B8256138F52B0004311DA /* syslog.c in Sources */,
+                               C95B8257138F52B0004311DA /* thread_stack_pcs.c in Sources */,
+                               C95B8258138F52B0004311DA /* uname.c in Sources */,
+                               C95B8259138F52B0004311DA /* utmpx-darwin.c in Sources */,
+                               C95B825A138F52B0004311DA /* wordexp.c in Sources */,
+                               C95B825C138F52B0004311DA /* gmon.c in Sources */,
+                               C95B825D138F52B0004311DA /* getmcontext.c in Sources */,
+                               C95B825E138F52B0004311DA /* makecontext.c in Sources */,
+                               C95B825F138F52B0004311DA /* setcontext.c in Sources */,
+                               C95B8260138F52B0004311DA /* setjmperr.c in Sources */,
+                               C95B8261138F52B0004311DA /* swapcontext.c in Sources */,
+                               C95B8262138F52B0004311DA /* init_cpu_capabilities.c in Sources */,
+                               C95B8263138F52B0004311DA /* bcopy.c in Sources */,
+                               C95B8264138F52B0004311DA /* bzero.c in Sources */,
+                               C95B8265138F52B0004311DA /* memcpy.c in Sources */,
+                               C95B8266138F52B0004311DA /* memmove.c in Sources */,
+                               C95B8267138F52B0004311DA /* atomic.c in Sources */,
+                               C95B8268138F52B0004311DA /* mach_absolute_time.c in Sources */,
+                               C95B8269138F52B0004311DA /* spinlocks.c in Sources */,
+                               C95B827C138F52B0004311DA /* ascii.c in Sources */,
+                               C95B827D138F52B0004311DA /* big5.c in Sources */,
+                               C95B827E138F52B0004311DA /* btowc.c in Sources */,
+                               C95B827F138F52B0004311DA /* collate.c in Sources */,
+                               C95B8280138F52B0004311DA /* collcmp.c in Sources */,
+                               C95B8281138F52B0004311DA /* euc.c in Sources */,
+                               C95B8282138F52B0004311DA /* fix_grouping.c in Sources */,
+                               C95B8283138F52B0004311DA /* gb18030.c in Sources */,
+                               C95B8284138F52B0004311DA /* gb2312.c in Sources */,
+                               C95B8285138F52B0004311DA /* gbk.c in Sources */,
+                               C95B8286138F52B0004311DA /* ldpart.c in Sources */,
+                               C95B8287138F52B0004311DA /* lmessages.c in Sources */,
+                               C95B8288138F52B0004311DA /* lmonetary.c in Sources */,
+                               C95B8289138F52B0004311DA /* lnumeric.c in Sources */,
+                               C95B828A138F52B0004311DA /* localeconv.c in Sources */,
+                               C95B828B138F52B0004311DA /* mblen.c in Sources */,
+                               C95B828C138F52B0004311DA /* mbrlen.c in Sources */,
+                               C95B828D138F52B0004311DA /* mbrtowc.c in Sources */,
+                               C95B828E138F52B0004311DA /* mbsinit.c in Sources */,
+                               C95B828F138F52B0004311DA /* mbsnrtowcs.c in Sources */,
+                               C95B8290138F52B0004311DA /* mbsrtowcs.c in Sources */,
+                               C95B8291138F52B0004311DA /* mbstowcs.c in Sources */,
+                               C95B8292138F52B0004311DA /* mbtowc.c in Sources */,
+                               C95B8293138F52B0004311DA /* mskanji.c in Sources */,
+                               C95B8294138F52B0004311DA /* nextwctype.c in Sources */,
+                               C95B8295138F52B0004311DA /* nl_langinfo.c in Sources */,
+                               C95B8296138F52B0004311DA /* nomacros.c in Sources */,
+                               C95B8297138F52B0004311DA /* none.c in Sources */,
+                               C95B8298138F52B0004311DA /* rune.c in Sources */,
+                               C95B8299138F52B0004311DA /* runetype.c in Sources */,
+                               C95B829A138F52B0004311DA /* setlocale.c in Sources */,
+                               C95B829B138F52B0004311DA /* setrunelocale.c in Sources */,
+                               C95B829C138F52B0004311DA /* table.c in Sources */,
+                               C95B829D138F52B0004311DA /* tolower.c in Sources */,
+                               C95B829E138F52B0004311DA /* toupper.c in Sources */,
+                               C95B829F138F52B0004311DA /* utf2.c in Sources */,
+                               C95B82A0138F52B0004311DA /* utf8.c in Sources */,
+                               C95B82A1138F52B0004311DA /* wcrtomb.c in Sources */,
+                               C95B82A2138F52B0004311DA /* wcsftime.c in Sources */,
+                               C95B82A3138F52B0004311DA /* wcsnrtombs.c in Sources */,
+                               C95B82A4138F52B0004311DA /* wcsrtombs.c in Sources */,
+                               C95B82A5138F52B0004311DA /* wcstod.c in Sources */,
+                               C95B82A6138F52B0004311DA /* wcstof.c in Sources */,
+                               C95B82A7138F52B0004311DA /* wcstoimax.c in Sources */,
+                               C95B82A8138F52B0004311DA /* wcstol.c in Sources */,
+                               C95B82A9138F52B0004311DA /* wcstold.c in Sources */,
+                               C95B82AA138F52B0004311DA /* wcstoll.c in Sources */,
+                               C95B82AB138F52B0004311DA /* wcstombs.c in Sources */,
+                               C95B82AC138F52B0004311DA /* wcstoul.c in Sources */,
+                               C95B82AD138F52B0004311DA /* wcstoull.c in Sources */,
+                               C95B82AE138F52B0004311DA /* wcstoumax.c in Sources */,
+                               C95B82AF138F52B0004311DA /* wctob.c in Sources */,
+                               C95B82B0138F52B0004311DA /* wctomb.c in Sources */,
+                               C95B82B1138F52B0004311DA /* wctrans.c in Sources */,
+                               C95B82B2138F52B0004311DA /* wctype.c in Sources */,
+                               C95B82B3138F52B0004311DA /* wcwidth.c in Sources */,
+                               C95B82B4138F52B0004311DA /* frune.c in Sources */,
+                               C95B82B5138F52B0004311DA /* isctype.c in Sources */,
+                               C95B82B6138F52B0004311DA /* iswctype.c in Sources */,
+                               C95B82B7138F52B0004311DA /* lconv.c in Sources */,
+                               C95B82B8138F52B0004311DA /* mbrune.c in Sources */,
+                               C95B82B9138F52B0004311DA /* runedepreciated.c in Sources */,
+                               C95B82BA138F52B0004311DA /* setinvalidrune.c in Sources */,
+                               C95B82BB138F52B0004311DA /* xlocale.c in Sources */,
+                               C95B82BC138F52B0004311DA /* addr2ascii.c in Sources */,
+                               C95B82BD138F52B0004311DA /* ascii2addr.c in Sources */,
+                               C95B82BE138F52B0004311DA /* inet_addr.c in Sources */,
+                               C95B82BF138F52B0004311DA /* inet_lnaof.c in Sources */,
+                               C95B82C0138F52B0004311DA /* inet_makeaddr.c in Sources */,
+                               C95B82C1138F52B0004311DA /* inet_net_ntop.c in Sources */,
+                               C95B82C2138F52B0004311DA /* inet_net_pton.c in Sources */,
+                               C95B82C3138F52B0004311DA /* inet_neta.c in Sources */,
+                               C95B82C4138F52B0004311DA /* inet_netof.c in Sources */,
+                               C95B82C5138F52B0004311DA /* inet_network.c in Sources */,
+                               C95B82C6138F52B0004311DA /* inet_ntoa.c in Sources */,
+                               C95B82C7138F52B0004311DA /* linkaddr.c in Sources */,
+                               C95B82C8138F52B0004311DA /* nsap_addr.c in Sources */,
+                               C95B82C9138F52B0004311DA /* recv.c in Sources */,
+                               C95B82CA138F52B0004311DA /* send.c in Sources */,
+                               C95B82CB138F52B0004311DA /* sockatmark.c in Sources */,
+                               C95B82CC138F52B0004311DA /* sourcefilter.c in Sources */,
+                               C95B82CD138F52B0004311DA /* msgcat.c in Sources */,
+                               C95B82CE138F52B0004311DA /* acl.c in Sources */,
+                               C95B82CF138F52B0004311DA /* acl_entry.c in Sources */,
+                               C95B82D0138F52B0004311DA /* acl_file.c in Sources */,
+                               C95B82D1138F52B0004311DA /* acl_flag.c in Sources */,
+                               C95B82D2138F52B0004311DA /* acl_perm.c in Sources */,
+                               C95B82D3138F52B0004311DA /* acl_translate.c in Sources */,
+                               C95B82DC138F52B0004311DA /* mk_pthread_impl.c in Sources */,
+                               C95B82DD138F52B0004311DA /* pthread.c in Sources */,
+                               C95B82DE138F52B0004311DA /* pthread_cancelable.c in Sources */,
+                               C95B82DF138F52B0004311DA /* pthread_cond.c in Sources */,
+                               C95B82E0138F52B0004311DA /* pthread_mutex.c in Sources */,
+                               C95B82E1138F52B0004311DA /* pthread_rwlock.c in Sources */,
+                               C95B82E2138F52B0004311DA /* pthread_tsd.c in Sources */,
+                               C95B82E3138F52B0004311DA /* pthread_atfork_test.c in Sources */,
+                               C95B82E4138F52B0004311DA /* thread_setup.c in Sources */,
+                               C95B82E7138F52B0004311DA /* regerror.c in Sources */,
+                               C95B82EA138F52B0004311DA /* chk_fail.c in Sources */,
+                               C95B82EB138F52B0004311DA /* memcpy_chk.c in Sources */,
+                               C95B82EC138F52B0004311DA /* memmove_chk.c in Sources */,
+                               C95B82ED138F52B0004311DA /* memset_chk.c in Sources */,
+                               C95B82EE138F52B0004311DA /* snprintf_chk.c in Sources */,
+                               C95B82EF138F52B0004311DA /* sprintf_chk.c in Sources */,
+                               C95B82F0138F52B0004311DA /* stpcpy_chk.c in Sources */,
+                               C95B82F1138F52B0004311DA /* stpncpy_chk.c in Sources */,
+                               C95B82F2138F52B0004311DA /* strcat_chk.c in Sources */,
+                               C95B82F3138F52B0004311DA /* strcpy_chk.c in Sources */,
+                               C95B82F4138F52B0004311DA /* strncat_chk.c in Sources */,
+                               C95B82F5138F52B0004311DA /* strncpy_chk.c in Sources */,
+                               C95B82F6138F52B0004311DA /* vsnprintf_chk.c in Sources */,
+                               C95B82F7138F52B0004311DA /* vsprintf_chk.c in Sources */,
+                               C95B82F8138F52B0004311DA /* _flock_stub.c in Sources */,
+                               C95B82F9138F52B0004311DA /* asprintf.c in Sources */,
+                               C95B82FA138F52B0004311DA /* clrerr.c in Sources */,
+                               C95B82FB138F52B0004311DA /* dprintf.c in Sources */,
+                               C95B82FC138F52B0004311DA /* fclose.c in Sources */,
+                               C95B82FD138F52B0004311DA /* fdopen.c in Sources */,
+                               C95B82FE138F52B0004311DA /* feof.c in Sources */,
+                               C95B82FF138F52B0004311DA /* ferror.c in Sources */,
+                               C95B8300138F52B0004311DA /* fflush.c in Sources */,
+                               C95B8301138F52B0004311DA /* fgetc.c in Sources */,
+                               C95B8302138F52B0004311DA /* fgetln.c in Sources */,
+                               C95B8303138F52B0004311DA /* fgetpos.c in Sources */,
+                               C95B8304138F52B0004311DA /* fgets.c in Sources */,
+                               C95B8305138F52B0004311DA /* fgetwc.c in Sources */,
+                               C95B8306138F52B0004311DA /* fgetwln.c in Sources */,
+                               C95B8307138F52B0004311DA /* fgetws.c in Sources */,
+                               C95B8308138F52B0004311DA /* fileno.c in Sources */,
+                               C95B8309138F52B0004311DA /* findfp.c in Sources */,
+                               C95B830A138F52B0004311DA /* flags.c in Sources */,
+                               C95B830B138F52B0004311DA /* fopen.c in Sources */,
+                               C95B830C138F52B0004311DA /* fprintf.c in Sources */,
+                               C95B830D138F52B0004311DA /* fpurge.c in Sources */,
+                               C95B830E138F52B0004311DA /* fputc.c in Sources */,
+                               C95B830F138F52B0004311DA /* fputs.c in Sources */,
+                               C95B8310138F52B0004311DA /* fputwc.c in Sources */,
+                               C95B8311138F52B0004311DA /* fputws.c in Sources */,
+                               C95B8312138F52B0004311DA /* fread.c in Sources */,
+                               C95B8313138F52B0004311DA /* freopen.c in Sources */,
+                               C95B8314138F52B0004311DA /* fscanf.c in Sources */,
+                               C95B8315138F52B0004311DA /* fseek.c in Sources */,
+                               C95B8316138F52B0004311DA /* fsetpos.c in Sources */,
+                               C95B8317138F52B0004311DA /* ftell.c in Sources */,
+                               C95B8318138F52B0004311DA /* funopen.c in Sources */,
+                               C95B8319138F52B0004311DA /* fvwrite.c in Sources */,
+                               C95B831A138F52B0004311DA /* fwalk.c in Sources */,
+                               C95B831B138F52B0004311DA /* fwide.c in Sources */,
+                               C95B831C138F52B0004311DA /* fwprintf.c in Sources */,
+                               C95B831D138F52B0004311DA /* fwrite.c in Sources */,
+                               C95B831E138F52B0004311DA /* fwscanf.c in Sources */,
+                               C95B831F138F52B0004311DA /* getc.c in Sources */,
+                               C95B8320138F52B0004311DA /* getchar.c in Sources */,
+                               C95B8321138F52B0004311DA /* getdelim.c in Sources */,
+                               C95B8322138F52B0004311DA /* getline.c in Sources */,
+                               C95B8323138F52B0004311DA /* gets.c in Sources */,
+                               C95B8324138F52B0004311DA /* getw.c in Sources */,
+                               C95B8325138F52B0004311DA /* getwc.c in Sources */,
+                               C95B8326138F52B0004311DA /* getwchar.c in Sources */,
+                               C95B8327138F52B0004311DA /* makebuf.c in Sources */,
+                               C95B8328138F52B0004311DA /* mktemp.c in Sources */,
+                               C95B8329138F52B0004311DA /* perror.c in Sources */,
+                               C95B832A138F52B0004311DA /* printf-pos.c in Sources */,
+                               C95B832B138F52B0004311DA /* printf.c in Sources */,
+                               C95B832C138F52B0004311DA /* putc.c in Sources */,
+                               C95B832D138F52B0004311DA /* putchar.c in Sources */,
+                               C95B832E138F52B0004311DA /* puts.c in Sources */,
+                               C95B832F138F52B0004311DA /* putw.c in Sources */,
+                               C95B8330138F52B0004311DA /* putwc.c in Sources */,
+                               C95B8331138F52B0004311DA /* putwchar.c in Sources */,
+                               C95B8332138F52B0004311DA /* refill.c in Sources */,
+                               C95B8333138F52B0004311DA /* remove.c in Sources */,
+                               C95B8334138F52B0004311DA /* rewind.c in Sources */,
+                               C95B8335138F52B0004311DA /* rget.c in Sources */,
+                               C95B8336138F52B0004311DA /* scanf.c in Sources */,
+                               C95B8337138F52B0004311DA /* setbuf.c in Sources */,
+                               C95B8338138F52B0004311DA /* setbuffer.c in Sources */,
+                               C95B8339138F52B0004311DA /* setvbuf.c in Sources */,
+                               C95B833A138F52B0004311DA /* snprintf.c in Sources */,
+                               C95B833B138F52B0004311DA /* sprintf.c in Sources */,
+                               C95B833C138F52B0004311DA /* sscanf.c in Sources */,
+                               C95B833D138F52B0004311DA /* stdio.c in Sources */,
+                               C95B833E138F52B0004311DA /* swprintf.c in Sources */,
+                               C95B833F138F52B0004311DA /* swscanf.c in Sources */,
+                               C95B8340138F52B0004311DA /* tempnam.c in Sources */,
+                               C95B8341138F52B0004311DA /* tmpfile.c in Sources */,
+                               C95B8342138F52B0004311DA /* tmpnam.c in Sources */,
+                               C95B8343138F52B0004311DA /* ungetc.c in Sources */,
+                               C95B8344138F52B0004311DA /* ungetwc.c in Sources */,
+                               C95B8345138F52B0004311DA /* vasprintf.c in Sources */,
+                               C95B8346138F52B0004311DA /* vdprintf.c in Sources */,
+                               C95B8347138F52B0004311DA /* vfprintf.c in Sources */,
+                               C95B8348138F52B0004311DA /* vfscanf.c in Sources */,
+                               C95B8349138F52B0004311DA /* vfwprintf.c in Sources */,
+                               C95B834A138F52B0004311DA /* vfwscanf.c in Sources */,
+                               C95B834B138F52B0004311DA /* vprintf.c in Sources */,
+                               C95B834C138F52B0004311DA /* vscanf.c in Sources */,
+                               C95B834D138F52B0004311DA /* vsnprintf.c in Sources */,
+                               C95B834E138F52B0004311DA /* vsprintf.c in Sources */,
+                               C95B834F138F52B0004311DA /* vsscanf.c in Sources */,
+                               C95B8350138F52B0004311DA /* vswprintf.c in Sources */,
+                               C95B8351138F52B0004311DA /* vswscanf.c in Sources */,
+                               C95B8352138F52B0004311DA /* vwprintf.c in Sources */,
+                               C95B8353138F52B0004311DA /* vwscanf.c in Sources */,
+                               C95B8354138F52B0004311DA /* wbuf.c in Sources */,
+                               C95B8355138F52B0004311DA /* wprintf.c in Sources */,
+                               C95B8356138F52B0004311DA /* wscanf.c in Sources */,
+                               C95B8357138F52B0004311DA /* wsetup.c in Sources */,
+                               C95B8358138F52B0004311DA /* a64l.c in Sources */,
+                               C95B8359138F52B0004311DA /* _Exit_.c in Sources */,
+                               C95B835A138F52B0004311DA /* abort.c in Sources */,
+                               C95B835B138F52B0004311DA /* abs.c in Sources */,
+                               C95B835C138F52B0004311DA /* atexit.c in Sources */,
+                               C95B835D138F52B0004311DA /* atof.c in Sources */,
+                               C95B835E138F52B0004311DA /* atoi.c in Sources */,
+                               C95B835F138F52B0004311DA /* atol.c in Sources */,
+                               C95B8360138F52B0004311DA /* atoll.c in Sources */,
+                               C95B8361138F52B0004311DA /* bsearch.c in Sources */,
+                               C95B8362138F52B0004311DA /* div.c in Sources */,
+                               C95B8363138F52B0004311DA /* exit.c in Sources */,
+                               C95B8364138F52B0004311DA /* getenv.c in Sources */,
+                               C95B8365138F52B0004311DA /* getopt.c in Sources */,
+                               C95B8366138F52B0004311DA /* getopt_long.c in Sources */,
+                               C95B8367138F52B0004311DA /* getsubopt.c in Sources */,
+                               C95B8368138F52B0004311DA /* hcreate.c in Sources */,
+                               C95B8369138F52B0004311DA /* heapsort.c in Sources */,
+                               C95B836A138F52B0004311DA /* heapsort_b.c in Sources */,
+                               C95B836B138F52B0004311DA /* heapsort_r.c in Sources */,
+                               C95B836C138F52B0004311DA /* imaxabs.c in Sources */,
+                               C95B836D138F52B0004311DA /* imaxdiv.c in Sources */,
+                               C95B836E138F52B0004311DA /* insque.c in Sources */,
+                               C95B836F138F52B0004311DA /* labs.c in Sources */,
+                               C95B8370138F52B0004311DA /* ldiv.c in Sources */,
+                               C95B8371138F52B0004311DA /* llabs.c in Sources */,
+                               C95B8372138F52B0004311DA /* lldiv.c in Sources */,
+                               C95B8373138F52B0004311DA /* lsearch.c in Sources */,
+                               C95B8374138F52B0004311DA /* merge.c in Sources */,
+                               C95B8375138F52B0004311DA /* putenv.c in Sources */,
+                               C95B8376138F52B0004311DA /* qsort.c in Sources */,
+                               C95B8377138F52B0004311DA /* qsort_r.c in Sources */,
+                               C95B8378138F52B0004311DA /* radixsort.c in Sources */,
+                               C95B8379138F52B0004311DA /* rand.c in Sources */,
+                               C95B837A138F52B0004311DA /* random.c in Sources */,
+                               C95B837B138F52B0004311DA /* reallocf.c in Sources */,
+                               C95B837C138F52B0004311DA /* realpath.c in Sources */,
+                               C95B837D138F52B0004311DA /* remque.c in Sources */,
+                               C95B837E138F52B0004311DA /* setenv.c in Sources */,
+                               C95B837F138F52B0004311DA /* strhash.c in Sources */,
+                               C95B8380138F52B0004311DA /* strtoimax.c in Sources */,
+                               C95B8381138F52B0004311DA /* strtol.c in Sources */,
+                               C95B8382138F52B0004311DA /* strtoll.c in Sources */,
+                               C95B8383138F52B0004311DA /* strtoq.c in Sources */,
+                               C95B8384138F52B0004311DA /* strtoul.c in Sources */,
+                               C95B8385138F52B0004311DA /* strtoull.c in Sources */,
+                               C95B8386138F52B0004311DA /* strtoumax.c in Sources */,
+                               C95B8387138F52B0004311DA /* strtouq.c in Sources */,
+                               C95B8388138F52B0004311DA /* system.c in Sources */,
+                               C95B8389138F52B0004311DA /* tdelete.c in Sources */,
+                               C95B838A138F52B0004311DA /* tfind.c in Sources */,
+                               C95B838B138F52B0004311DA /* tsearch.c in Sources */,
+                               C95B838C138F52B0004311DA /* twalk.c in Sources */,
+                               C95B838D138F52B0004311DA /* grantpt.c in Sources */,
+                               C95B838E138F52B0004311DA /* l64a.c in Sources */,
+                               C95B838F138F52B0004311DA /* strfmon.c in Sources */,
+                               C95B8390138F52B0004311DA /* ecvt.c in Sources */,
+                               C95B8391138F52B0004311DA /* gcvt.c in Sources */,
+                               C95B8392138F52B0004311DA /* qsort_b-fbsd.c in Sources */,
+                               C95B8393138F52B0004311DA /* asctime.c in Sources */,
+                               C95B8394138F52B0004311DA /* difftime.c in Sources */,
+                               C95B8395138F52B0004311DA /* ftime.c in Sources */,
+                               C95B8396138F52B0004311DA /* localtime.c in Sources */,
+                               C95B8397138F52B0004311DA /* strftime.c in Sources */,
+                               C95B8398138F52B0004311DA /* strptime.c in Sources */,
+                               C95B8399138F52B0004311DA /* time32.c in Sources */,
+                               C95B839A138F52B0004311DA /* timelocal.c in Sources */,
+                               C95B839B138F52B0004311DA /* getdate.c in Sources */,
+                               C95B839C138F52B0004311DA /* timezone_unix03.c in Sources */,
+                               C95B839D138F52B0004311DA /* bcmp.c in Sources */,
+                               C95B839E138F52B0004311DA /* bcopy.c in Sources */,
+                               C95B839F138F52B0004311DA /* bzero.c in Sources */,
+                               C95B83A0138F52B0004311DA /* index.c in Sources */,
+                               C95B83A1138F52B0004311DA /* memccpy.c in Sources */,
+                               C95B83A2138F52B0004311DA /* memchr.c in Sources */,
+                               C95B83A3138F52B0004311DA /* memcmp.c in Sources */,
+                               C95B83A4138F52B0004311DA /* memcpy.c in Sources */,
+                               C95B83A5138F52B0004311DA /* memmem.c in Sources */,
+                               C95B83A6138F52B0004311DA /* memmove.c in Sources */,
+                               C95B83A7138F52B0004311DA /* memset.c in Sources */,
+                               C95B83A8138F52B0004311DA /* rindex.c in Sources */,
+                               C95B83AB138F52B0004311DA /* strcasecmp.c in Sources */,
+                               C95B83AC138F52B0004311DA /* strcasestr.c in Sources */,
+                               C95B83AE138F52B0004311DA /* strchr.c in Sources */,
+                               C95B83AF138F52B0004311DA /* strcmp.c in Sources */,
+                               C95B83B0138F52B0004311DA /* strcoll.c in Sources */,
+                               C95B83B2138F52B0004311DA /* strcspn.c in Sources */,
+                               C95B83B3138F52B0004311DA /* strdup.c in Sources */,
+                               C95B83B4138F52B0004311DA /* strerror.c in Sources */,
+                               C95B83B7138F52B0004311DA /* strlen.c in Sources */,
+                               C95B83B8138F52B0004311DA /* strmode.c in Sources */,
+                               C95B83BA138F52B0004311DA /* strncmp.c in Sources */,
+                               C95B83BC138F52B0004311DA /* strndup.c in Sources */,
+                               C95B83BD138F52B0004311DA /* strnlen.c in Sources */,
+                               C95B83BE138F52B0004311DA /* strnstr.c in Sources */,
+                               C95B83BF138F52B0004311DA /* strpbrk.c in Sources */,
+                               C95B83C0138F52B0004311DA /* strrchr.c in Sources */,
+                               C95B83C1138F52B0004311DA /* strsep.c in Sources */,
+                               C95B83C2138F52B0004311DA /* strsignal.c in Sources */,
+                               C95B83C3138F52B0004311DA /* strspn.c in Sources */,
+                               C95B83C4138F52B0004311DA /* strstr.c in Sources */,
+                               C95B83C5138F52B0004311DA /* strtok.c in Sources */,
+                               C95B83C6138F52B0004311DA /* strxfrm.c in Sources */,
+                               C95B83C7138F52B0004311DA /* swab.c in Sources */,
+                               C95B83C8138F52B0004311DA /* wcpcpy.c in Sources */,
+                               C95B83C9138F52B0004311DA /* wcpncpy.c in Sources */,
+                               C95B83CA138F52B0004311DA /* wcscasecmp.c in Sources */,
+                               C95B83CB138F52B0004311DA /* wcscat.c in Sources */,
+                               C95B83CC138F52B0004311DA /* wcschr.c in Sources */,
+                               C95B83CD138F52B0004311DA /* wcscmp.c in Sources */,
+                               C95B83CE138F52B0004311DA /* wcscoll.c in Sources */,
+                               C95B83CF138F52B0004311DA /* wcscpy.c in Sources */,
+                               C95B83D0138F52B0004311DA /* wcscspn.c in Sources */,
+                               C95B83D1138F52B0004311DA /* wcsdup.c in Sources */,
+                               C95B83D2138F52B0004311DA /* wcslcat.c in Sources */,
+                               C95B83D3138F52B0004311DA /* wcslcpy.c in Sources */,
+                               C95B83D4138F52B0004311DA /* wcslen.c in Sources */,
+                               C95B83D5138F52B0004311DA /* wcsncasecmp.c in Sources */,
+                               C95B83D6138F52B0004311DA /* wcsncat.c in Sources */,
+                               C95B83D7138F52B0004311DA /* wcsncmp.c in Sources */,
+                               C95B83D8138F52B0004311DA /* wcsncpy.c in Sources */,
+                               C95B83D9138F52B0004311DA /* wcsnlen.c in Sources */,
+                               C95B83DA138F52B0004311DA /* wcspbrk.c in Sources */,
+                               C95B83DB138F52B0004311DA /* wcsrchr.c in Sources */,
+                               C95B83DC138F52B0004311DA /* wcsspn.c in Sources */,
+                               C95B83DD138F52B0004311DA /* wcsstr.c in Sources */,
+                               C95B83DE138F52B0004311DA /* wcstok.c in Sources */,
+                               C95B83DF138F52B0004311DA /* wcswidth.c in Sources */,
+                               C95B83E0138F52B0004311DA /* wcsxfrm.c in Sources */,
+                               C95B83E1138F52B0004311DA /* wmemchr.c in Sources */,
+                               C95B83E2138F52B0004311DA /* wmemcmp.c in Sources */,
+                               C95B83E3138F52B0004311DA /* wmemcpy.c in Sources */,
+                               C95B83E4138F52B0004311DA /* wmemmove.c in Sources */,
+                               C95B83E5138F52B0004311DA /* wmemset.c in Sources */,
+                               C95B83E6138F52B0004311DA /* __libc_init.c in Sources */,
+                               C95B83E7138F52B0004311DA /* _libc_fork_child.c in Sources */,
+                               C95B83E8138F52B0004311DA /* chmodx_np.c in Sources */,
+                               C95B83E9138F52B0004311DA /* context-stubs.c in Sources */,
+                               C95B83EA138F52B0004311DA /* crt_externs.c in Sources */,
+                               C95B83EB138F52B0004311DA /* errno.c in Sources */,
+                               C95B83EC138F52B0004311DA /* fork.c in Sources */,
+                               C95B83ED138F52B0004311DA /* getgroups.c in Sources */,
+                               C95B83EE138F52B0004311DA /* getiopolicy_np.c in Sources */,
+                               C95B83EF138F52B0004311DA /* gettimeofday.c in Sources */,
+                               C95B83F0138F52B0004311DA /* msgctl.c in Sources */,
+                               C95B83F1138F52B0004311DA /* stack_protector.c in Sources */,
+                               C95B83F2138F52B0004311DA /* openx_np.c in Sources */,
+                               C95B83F3138F52B0004311DA /* OSMemoryNotification.c in Sources */,
+                               C95B83F4138F52B0004311DA /* OSThermalNotification.c in Sources */,
+                               C95B83F5138F52B0004311DA /* posix_spawn.c in Sources */,
+                               C95B83F6138F52B0004311DA /* semctl.c in Sources */,
+                               C95B83F7138F52B0004311DA /* settimeofday.c in Sources */,
+                               C95B83F8138F52B0004311DA /* shmctl.c in Sources */,
+                               C95B83F9138F52B0004311DA /* sigaction.c in Sources */,
+                               C95B83FA138F52B0004311DA /* sigcatch.c in Sources */,
+                               C95B83FB138F52B0004311DA /* sigtramp.c in Sources */,
+                               C95B83FC138F52B0004311DA /* slot_name.c in Sources */,
+                               C95B83FD138F52B0004311DA /* statx_np.c in Sources */,
+                               C95B83FE138F52B0004311DA /* umaskx_np.c in Sources */,
+                               C95B83FF138F52B0004311DA /* cprocs.c in Sources */,
+                               C95B8400138F52B0004311DA /* cthreads.c in Sources */,
+                               C95B8401138F52B0004311DA /* mig_support.c in Sources */,
+                               C95B8402138F52B0004311DA /* fparseln.c in Sources */,
+                               C95B8403138F52B0004311DA /* login.c in Sources */,
+                               C95B8404138F52B0004311DA /* login_tty.c in Sources */,
+                               C95B8405138F52B0004311DA /* logout.c in Sources */,
+                               C95B8406138F52B0004311DA /* logwtmp.c in Sources */,
+                               3F76864D13E91D5500C94D25 /* mkpath_np.c in Sources */,
+                               C95B8407138F52B0004311DA /* opendev.c in Sources */,
+                               C95B8408138F52B0004311DA /* pty.c in Sources */,
+                               C95B8409138F52B0004311DA /* clear.c in Sources */,
+                               C95B840A138F52B0004311DA /* compare.c in Sources */,
+                               C95B840B138F52B0004311DA /* copy.c in Sources */,
+                               C95B840C138F52B0004311DA /* gen_uuid.c in Sources */,
+                               C95B840D138F52B0004311DA /* isnull.c in Sources */,
+                               C95B840E138F52B0004311DA /* pack.c in Sources */,
+                               C95B840F138F52B0004311DA /* parse.c in Sources */,
+                               C95B8410138F52B0004311DA /* unpack.c in Sources */,
+                               C95B8411138F52B0004311DA /* unparse.c in Sources */,
+                               C95B8412138F52B0004311DA /* getmcontext.c in Sources */,
+                               C95B8413138F52B0004311DA /* makecontext.c in Sources */,
+                               C95B8414138F52B0004311DA /* setcontext.c in Sources */,
+                               C95B8415138F52B0004311DA /* swapcontext.c in Sources */,
+                               C95B8416138F52B0004311DA /* bcopy.c in Sources */,
+                               C95B8417138F52B0004311DA /* bzero.c in Sources */,
+                               C95B8418138F52B0004311DA /* memcpy.c in Sources */,
+                               C95B8419138F52B0004311DA /* memmove.c in Sources */,
+                               C95B841A138F52B0004311DA /* atomic.c in Sources */,
+                               C95B841B138F52B0004311DA /* spinlocks.c in Sources */,
+                               3F2208EC14358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C64601450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1B8146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C95B842D138F53DB004311DA /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C95B842E138F53DB004311DA /* init_cpu_capabilities.c in Sources */,
+                               C95B842F138F53DB004311DA /* dyld_resolvers.c in Sources */,
+                               C95B8430138F53DB004311DA /* arm_commpage_gettimeofday.c in Sources */,
+                               C95B8431138F53DB004311DA /* gcc_atomic.c in Sources */,
+                               C95B8432138F53DB004311DA /* OSAtomic-v4.c in Sources */,
+                               C95B8433138F53DB004311DA /* OSAtomic_resolvers.c in Sources */,
+                               C95B8435138F53DB004311DA /* creat.c in Sources */,
+                               C95B8436138F53DB004311DA /* gethostid.c in Sources */,
+                               C95B8437138F53DB004311DA /* getwd.c in Sources */,
+                               C95B8438138F53DB004311DA /* killpg.c in Sources */,
+                               C95B8439138F53DB004311DA /* sethostid.c in Sources */,
+                               C95B843A138F53DB004311DA /* setpgrp.c in Sources */,
+                               C95B843B138F53DB004311DA /* setrgid.c in Sources */,
+                               C95B843C138F53DB004311DA /* setruid.c in Sources */,
+                               C95B843D138F53DB004311DA /* setregid.c in Sources */,
+                               C95B843E138F53DB004311DA /* setreuid.c in Sources */,
+                               C95B843F138F53DB004311DA /* sigaltstk.c in Sources */,
+                               C95B8440138F53DB004311DA /* sigcompat.c in Sources */,
+                               C95B8441138F53DB004311DA /* _dirhelper.c in Sources */,
+                               C95B8442138F53DB004311DA /* kvm.c in Sources */,
+                               C95B8443138F53DB004311DA /* libproc.c in Sources */,
+                               C95B8444138F53DB004311DA /* MKGetTimeBaseInfo.c in Sources */,
+                               C95B8445138F53DB004311DA /* proc_listpidspath.c in Sources */,
+                               C95B8446138F53DB004311DA /* forceLibcToBuild.c in Sources */,
+                               C95B8447138F53DB004311DA /* bt_close.c in Sources */,
+                               C95B8448138F53DB004311DA /* bt_conv.c in Sources */,
+                               C95B8449138F53DB004311DA /* bt_debug.c in Sources */,
+                               C95B844A138F53DB004311DA /* bt_delete.c in Sources */,
+                               C95B844B138F53DB004311DA /* bt_get.c in Sources */,
+                               C95B844C138F53DB004311DA /* bt_open.c in Sources */,
+                               C95B844D138F53DB004311DA /* bt_overflow.c in Sources */,
+                               C95B844E138F53DB004311DA /* bt_page.c in Sources */,
+                               C95B844F138F53DB004311DA /* bt_put.c in Sources */,
+                               C95B8450138F53DB004311DA /* bt_search.c in Sources */,
+                               C95B8451138F53DB004311DA /* bt_seq.c in Sources */,
+                               C95B8452138F53DB004311DA /* bt_split.c in Sources */,
+                               C95B8453138F53DB004311DA /* bt_utils.c in Sources */,
+                               C95B8454138F53DB004311DA /* db.c in Sources */,
+                               C95B8455138F53DB004311DA /* hash.c in Sources */,
+                               C95B8456138F53DB004311DA /* hash_bigkey.c in Sources */,
+                               C95B8457138F53DB004311DA /* hash_buf.c in Sources */,
+                               C95B8458138F53DB004311DA /* hash_func.c in Sources */,
+                               C95B8459138F53DB004311DA /* hash_log2.c in Sources */,
+                               C95B845A138F53DB004311DA /* hash_page.c in Sources */,
+                               C95B845B138F53DB004311DA /* ndbm.c in Sources */,
+                               C95B845C138F53DB004311DA /* mpool.c in Sources */,
+                               C95B845D138F53DB004311DA /* rec_close.c in Sources */,
+                               C95B845E138F53DB004311DA /* rec_delete.c in Sources */,
+                               C95B845F138F53DB004311DA /* rec_get.c in Sources */,
+                               C95B8460138F53DB004311DA /* rec_open.c in Sources */,
+                               C95B8461138F53DB004311DA /* rec_put.c in Sources */,
+                               C95B8462138F53DB004311DA /* rec_search.c in Sources */,
+                               C95B8463138F53DB004311DA /* rec_seq.c in Sources */,
+                               C95B8464138F53DB004311DA /* rec_utils.c in Sources */,
+                               C95B8465138F53DB004311DA /* brk.c in Sources */,
+                               C95B8466138F53DB004311DA /* bsd_signal.c in Sources */,
+                               C95B8467138F53DB004311DA /* lchflags.c in Sources */,
+                               C95B8468138F53DB004311DA /* lchmod.c in Sources */,
+                               C95B8469138F53DB004311DA /* lutimes.c in Sources */,
+                               C95B846A138F53DB004311DA /* statvfs.c in Sources */,
+                               C95B846B138F53DB004311DA /* tcgetsid.c in Sources */,
+                               C95B846C138F53DB004311DA /* _ldbl_util.c in Sources */,
+                               C95B846D138F53DB004311DA /* _hdtoa.c in Sources */,
+                               C95B846E138F53DB004311DA /* _ldtoa.c in Sources */,
+                               C95B846F138F53DB004311DA /* gdtoa-dmisc.c in Sources */,
+                               C95B8470138F53DB004311DA /* gdtoa-dtoa.c in Sources */,
+                               C95B8471138F53DB004311DA /* gdtoa-gdtoa.c in Sources */,
+                               C95B8472138F53DB004311DA /* gdtoa-gethex.c in Sources */,
+                               C95B8473138F53DB004311DA /* gdtoa-gmisc.c in Sources */,
+                               C95B8474138F53DB004311DA /* gdtoa-hd_init.c in Sources */,
+                               C95B8475138F53DB004311DA /* gdtoa-hexnan.c in Sources */,
+                               C95B8476138F53DB004311DA /* gdtoa-misc.c in Sources */,
+                               C95B8477138F53DB004311DA /* gdtoa-smisc.c in Sources */,
+                               C95B8478138F53DB004311DA /* gdtoa-strtod.c in Sources */,
+                               C95B8479138F53DB004311DA /* gdtoa-strtodg.c in Sources */,
+                               C95B847A138F53DB004311DA /* gdtoa-strtof.c in Sources */,
+                               C95B847B138F53DB004311DA /* gdtoa-strtoIg.c in Sources */,
+                               C95B847C138F53DB004311DA /* gdtoa-strtopdd.c in Sources */,
+                               C95B847D138F53DB004311DA /* gdtoa-strtopx.c in Sources */,
+                               C95B847E138F53DB004311DA /* gdtoa-strtord.c in Sources */,
+                               C95B847F138F53DB004311DA /* gdtoa-sum.c in Sources */,
+                               C95B8480138F53DB004311DA /* gdtoa-ulp.c in Sources */,
+                               C95B8481138F53DB004311DA /* glue.c in Sources */,
+                               C95B8482138F53DB004311DA /* machdep_ldisd.c in Sources */,
+                               C95B8483138F53DB004311DA /* machdep_ldisdd.c in Sources */,
+                               C95B8484138F53DB004311DA /* machdep_ldisQ.c in Sources */,
+                               C95B8485138F53DB004311DA /* machdep_ldisx.c in Sources */,
+                               C95B8486138F53DB004311DA /* _simple.c in Sources */,
+                               C95B8487138F53DB004311DA /* asl.c in Sources */,
+                               C95B8488138F53DB004311DA /* asl_core.c in Sources */,
+                               C95B8489138F53DB004311DA /* asl_file.c in Sources */,
+                               C95B848A138F53DB004311DA /* asl_legacy1.c in Sources */,
+                               C95B848B138F53DB004311DA /* asl_msg.c in Sources */,
+                               C95B848C138F53DB004311DA /* asl_store.c in Sources */,
+                               C95B848D138F53DB004311DA /* asl_util.c in Sources */,
+                               C95B848E138F53DB004311DA /* assumes.c in Sources */,
+                               C95B848F138F53DB004311DA /* authentication.c in Sources */,
+                               C95B8490138F53DB004311DA /* backtrace.c in Sources */,
+                               C95B8491138F53DB004311DA /* cache.c in Sources */,
+                               C95B8492138F53DB004311DA /* confstr.c in Sources */,
+                               C95B8493138F53DB004311DA /* crypt.c in Sources */,
+                               C95B8494138F53DB004311DA /* devname.c in Sources */,
+                               C95B8495138F53DB004311DA /* disklabel.c in Sources */,
+                               C95B8496138F53DB004311DA /* errlst.c in Sources */,
+                               C95B8497138F53DB004311DA /* filesec.c in Sources */,
+                               C95B8498138F53DB004311DA /* _rand48.c in Sources */,
+                               C95B8499138F53DB004311DA /* alarm.c in Sources */,
+                               C95B849A138F53DB004311DA /* arc4random.c in Sources */,
+                               C95B849B138F53DB004311DA /* assert.c in Sources */,
+                               C95B849C138F53DB004311DA /* basename.c in Sources */,
+                               C95B849D138F53DB004311DA /* clock.c in Sources */,
+                               C95B849E138F53DB004311DA /* closedir.c in Sources */,
+                               C95B849F138F53DB004311DA /* ctermid.c in Sources */,
+                               C95B84A0138F53DB004311DA /* daemon.c in Sources */,
+                               C95B84A1138F53DB004311DA /* dirname.c in Sources */,
+                               C95B84A2138F53DB004311DA /* drand48.c in Sources */,
+                               C95B84A3138F53DB004311DA /* erand48.c in Sources */,
+                               C95B84A4138F53DB004311DA /* err.c in Sources */,
+                               C95B84A5138F53DB004311DA /* exec.c in Sources */,
+                               C95B84A6138F53DB004311DA /* fmtcheck.c in Sources */,
+                               C95B84A7138F53DB004311DA /* fmtmsg.c in Sources */,
+                               C95B84A8138F53DB004311DA /* fnmatch.c in Sources */,
+                               C95B84A9138F53DB004311DA /* ftok.c in Sources */,
+                               C95B84AA138F53DB004311DA /* getbsize.c in Sources */,
+                               C95B84AB138F53DB004311DA /* getcap.c in Sources */,
+                               C95B84AC138F53DB004311DA /* getcwd.c in Sources */,
+                               C95B84AD138F53DB004311DA /* gethostname.c in Sources */,
+                               C95B84AE138F53DB004311DA /* getlogin.c in Sources */,
+                               C95B84AF138F53DB004311DA /* getmntinfo.c in Sources */,
+                               C95B84B0138F53DB004311DA /* getpagesize.c in Sources */,
+                               C95B84B1138F53DB004311DA /* getpeereid.c in Sources */,
+                               C95B84B2138F53DB004311DA /* getprogname.c in Sources */,
+                               C95B84B3138F53DB004311DA /* glob.c in Sources */,
+                               C95B84B4138F53DB004311DA /* isatty.c in Sources */,
+                               C95B84B5138F53DB004311DA /* jrand48.c in Sources */,
+                               C95B84B6138F53DB004311DA /* lcong48.c in Sources */,
+                               C95B84B7138F53DB004311DA /* lockf.c in Sources */,
+                               C95B84B8138F53DB004311DA /* lrand48.c in Sources */,
+                               C95B84B9138F53DB004311DA /* mrand48.c in Sources */,
+                               C95B84BA138F53DB004311DA /* nice.c in Sources */,
+                               C95B84BB138F53DB004311DA /* nrand48.c in Sources */,
+                               C95B84BC138F53DB004311DA /* opendir.c in Sources */,
+                               C95B84BD138F53DB004311DA /* pause.c in Sources */,
+                               C95B84BE138F53DB004311DA /* popen.c in Sources */,
+                               C95B84BF138F53DB004311DA /* pselect.c in Sources */,
+                               C95B84C0138F53DB004311DA /* psignal.c in Sources */,
+                               C95B84C1138F53DB004311DA /* raise.c in Sources */,
+                               C95B84C2138F53DB004311DA /* readdir.c in Sources */,
+                               C95B84C3138F53DB004311DA /* readpassphrase.c in Sources */,
+                               C95B84C4138F53DB004311DA /* rewinddir.c in Sources */,
+                               C95B84C5138F53DB004311DA /* scandir.c in Sources */,
+                               C95B84C6138F53DB004311DA /* seed48.c in Sources */,
+                               C95B84C7138F53DB004311DA /* seekdir.c in Sources */,
+                               C95B84C8138F53DB004311DA /* sethostname.c in Sources */,
+                               C95B84C9138F53DB004311DA /* setmode.c in Sources */,
+                               C95B84CA138F53DB004311DA /* setprogname.c in Sources */,
+                               C95B84CB138F53DB004311DA /* siginterrupt.c in Sources */,
+                               C95B84CC138F53DB004311DA /* siglist.c in Sources */,
+                               C95B84CD138F53DB004311DA /* signal.c in Sources */,
+                               C95B84CE138F53DB004311DA /* sleep.c in Sources */,
+                               C95B84CF138F53DB004311DA /* srand48.c in Sources */,
+                               C95B84D0138F53DB004311DA /* stringlist.c in Sources */,
+                               C95B84D1138F53DB004311DA /* sysconf.c in Sources */,
+                               C95B84D2138F53DB004311DA /* sysctl.c in Sources */,
+                               C95B84D3138F53DB004311DA /* sysctlbyname.c in Sources */,
+                               C95B84D4138F53DB004311DA /* sysctlnametomib.c in Sources */,
+                               C95B84D5138F53DB004311DA /* telldir.c in Sources */,
+                               C95B84D6138F53DB004311DA /* termios.c in Sources */,
+                               C95B84D7138F53DB004311DA /* time.c in Sources */,
+                               C95B84D8138F53DB004311DA /* times.c in Sources */,
+                               C95B84D9138F53DB004311DA /* timezone.c in Sources */,
+                               C95B84DA138F53DB004311DA /* ttyname.c in Sources */,
+                               C95B84DB138F53DB004311DA /* ttyslot.c in Sources */,
+                               C95B84DC138F53DB004311DA /* ualarm.c in Sources */,
+                               C95B84DD138F53DB004311DA /* ulimit.c in Sources */,
+                               C95B84DE138F53DB004311DA /* unvis.c in Sources */,
+                               C95B84DF138F53DB004311DA /* usleep.c in Sources */,
+                               C95B84E0138F53DB004311DA /* utime.c in Sources */,
+                               C95B84E1138F53DB004311DA /* vis.c in Sources */,
+                               C95B84E2138F53DB004311DA /* wait.c in Sources */,
+                               C95B84E3138F53DB004311DA /* wait3.c in Sources */,
+                               C95B84E4138F53DB004311DA /* waitpid.c in Sources */,
+                               C95B84E5138F53DB004311DA /* fts.c in Sources */,
+                               C95B84E6138F53DB004311DA /* get_compat.c in Sources */,
+                               C95B84E7138F53DB004311DA /* getloadavg.c in Sources */,
+                               C95B84E8138F53DB004311DA /* getttyent.c in Sources */,
+                               C95B84E9138F53DB004311DA /* getusershell.c in Sources */,
+                               C95B84EA138F53DB004311DA /* getvfsbyname.c in Sources */,
+                               C95B84EB138F53DB004311DA /* isinf.c in Sources */,
+                               C95B84EC138F53DB004311DA /* isnan.c in Sources */,
+                               C95B84ED138F53DB004311DA /* magazine_malloc.c in Sources */,
+                               C95B84EE138F53DB004311DA /* malloc.c in Sources */,
+                               C95B84EF138F53DB004311DA /* nanosleep.c in Sources */,
+                               C95B84F0138F53DB004311DA /* utmpx.c in Sources */,
+                               C95B84F1138F53DB004311DA /* nftw.c in Sources */,
+                               C95B84F2138F53DB004311DA /* nlist.c in Sources */,
+                               C95B84F3138F53DB004311DA /* NSSystemDirectories.c in Sources */,
+                               C95B84F4138F53DB004311DA /* oldsyslog.c in Sources */,
+                               C95B84F5138F53DB004311DA /* platfunc.c in Sources */,
+                               C95B84F6138F53DB004311DA /* scalable_malloc.c in Sources */,
+                               C95B84F7138F53DB004311DA /* setlogin.c in Sources */,
+                               C95B84F8138F53DB004311DA /* sigsetops.c in Sources */,
+                               C95B84F9138F53DB004311DA /* stack_logging.c in Sources */,
+                               C95B84FA138F53DB004311DA /* stack_logging_disk.c in Sources */,
+                               C95B84FB138F53DB004311DA /* strtofflags.c in Sources */,
+                               C95B84FC138F53DB004311DA /* syslog.c in Sources */,
+                               C95B84FD138F53DB004311DA /* thread_stack_pcs.c in Sources */,
+                               C95B84FE138F53DB004311DA /* uname.c in Sources */,
+                               C95B84FF138F53DB004311DA /* utmpx-darwin.c in Sources */,
+                               C95B8500138F53DB004311DA /* wordexp.c in Sources */,
+                               C95B8502138F53DB004311DA /* gmon.c in Sources */,
+                               C95B8503138F53DB004311DA /* getmcontext.c in Sources */,
+                               C95B8504138F53DB004311DA /* makecontext.c in Sources */,
+                               C95B8505138F53DB004311DA /* setcontext.c in Sources */,
+                               C95B8506138F53DB004311DA /* setjmperr.c in Sources */,
+                               C95B8507138F53DB004311DA /* swapcontext.c in Sources */,
+                               C95B8508138F53DB004311DA /* init_cpu_capabilities.c in Sources */,
+                               C95B8509138F53DB004311DA /* bcopy.c in Sources */,
+                               C95B850A138F53DB004311DA /* bzero.c in Sources */,
+                               C95B850B138F53DB004311DA /* memcpy.c in Sources */,
+                               C95B850C138F53DB004311DA /* memmove.c in Sources */,
+                               C95B850D138F53DB004311DA /* atomic.c in Sources */,
+                               C95B850E138F53DB004311DA /* mach_absolute_time.c in Sources */,
+                               C95B850F138F53DB004311DA /* spinlocks.c in Sources */,
+                               C95B8522138F53DB004311DA /* ascii.c in Sources */,
+                               C95B8523138F53DB004311DA /* big5.c in Sources */,
+                               C95B8524138F53DB004311DA /* btowc.c in Sources */,
+                               C95B8525138F53DB004311DA /* collate.c in Sources */,
+                               C95B8526138F53DB004311DA /* collcmp.c in Sources */,
+                               C95B8527138F53DB004311DA /* euc.c in Sources */,
+                               C95B8528138F53DB004311DA /* fix_grouping.c in Sources */,
+                               C95B8529138F53DB004311DA /* gb18030.c in Sources */,
+                               C95B852A138F53DB004311DA /* gb2312.c in Sources */,
+                               C95B852B138F53DB004311DA /* gbk.c in Sources */,
+                               C95B852C138F53DB004311DA /* ldpart.c in Sources */,
+                               C95B852D138F53DB004311DA /* lmessages.c in Sources */,
+                               C95B852E138F53DB004311DA /* lmonetary.c in Sources */,
+                               C95B852F138F53DB004311DA /* lnumeric.c in Sources */,
+                               C95B8530138F53DB004311DA /* localeconv.c in Sources */,
+                               C95B8531138F53DB004311DA /* mblen.c in Sources */,
+                               C95B8532138F53DB004311DA /* mbrlen.c in Sources */,
+                               C95B8533138F53DB004311DA /* mbrtowc.c in Sources */,
+                               C95B8534138F53DB004311DA /* mbsinit.c in Sources */,
+                               C95B8535138F53DB004311DA /* mbsnrtowcs.c in Sources */,
+                               C95B8536138F53DB004311DA /* mbsrtowcs.c in Sources */,
+                               C95B8537138F53DB004311DA /* mbstowcs.c in Sources */,
+                               C95B8538138F53DB004311DA /* mbtowc.c in Sources */,
+                               C95B8539138F53DB004311DA /* mskanji.c in Sources */,
+                               C95B853A138F53DB004311DA /* nextwctype.c in Sources */,
+                               C95B853B138F53DB004311DA /* nl_langinfo.c in Sources */,
+                               C95B853C138F53DB004311DA /* nomacros.c in Sources */,
+                               C95B853D138F53DB004311DA /* none.c in Sources */,
+                               C95B853E138F53DB004311DA /* rune.c in Sources */,
+                               C95B853F138F53DB004311DA /* runetype.c in Sources */,
+                               C95B8540138F53DB004311DA /* setlocale.c in Sources */,
+                               C95B8541138F53DB004311DA /* setrunelocale.c in Sources */,
+                               C95B8542138F53DB004311DA /* table.c in Sources */,
+                               C95B8543138F53DB004311DA /* tolower.c in Sources */,
+                               C95B8544138F53DB004311DA /* toupper.c in Sources */,
+                               C95B8545138F53DB004311DA /* utf2.c in Sources */,
+                               C95B8546138F53DB004311DA /* utf8.c in Sources */,
+                               C95B8547138F53DB004311DA /* wcrtomb.c in Sources */,
+                               C95B8548138F53DB004311DA /* wcsftime.c in Sources */,
+                               C95B8549138F53DB004311DA /* wcsnrtombs.c in Sources */,
+                               C95B854A138F53DB004311DA /* wcsrtombs.c in Sources */,
+                               C95B854B138F53DB004311DA /* wcstod.c in Sources */,
+                               C95B854C138F53DB004311DA /* wcstof.c in Sources */,
+                               C95B854D138F53DB004311DA /* wcstoimax.c in Sources */,
+                               C95B854E138F53DB004311DA /* wcstol.c in Sources */,
+                               C95B854F138F53DB004311DA /* wcstold.c in Sources */,
+                               C95B8550138F53DB004311DA /* wcstoll.c in Sources */,
+                               C95B8551138F53DB004311DA /* wcstombs.c in Sources */,
+                               C95B8552138F53DB004311DA /* wcstoul.c in Sources */,
+                               C95B8553138F53DB004311DA /* wcstoull.c in Sources */,
+                               C95B8554138F53DB004311DA /* wcstoumax.c in Sources */,
+                               C95B8555138F53DB004311DA /* wctob.c in Sources */,
+                               C95B8556138F53DB004311DA /* wctomb.c in Sources */,
+                               C95B8557138F53DB004311DA /* wctrans.c in Sources */,
+                               C95B8558138F53DB004311DA /* wctype.c in Sources */,
+                               C95B8559138F53DB004311DA /* wcwidth.c in Sources */,
+                               C95B855A138F53DB004311DA /* frune.c in Sources */,
+                               C95B855B138F53DB004311DA /* isctype.c in Sources */,
+                               C95B855C138F53DB004311DA /* iswctype.c in Sources */,
+                               C95B855D138F53DB004311DA /* lconv.c in Sources */,
+                               C95B855E138F53DB004311DA /* mbrune.c in Sources */,
+                               C95B855F138F53DB004311DA /* runedepreciated.c in Sources */,
+                               C95B8560138F53DB004311DA /* setinvalidrune.c in Sources */,
+                               C95B8561138F53DB004311DA /* xlocale.c in Sources */,
+                               C95B8562138F53DB004311DA /* addr2ascii.c in Sources */,
+                               C95B8563138F53DB004311DA /* ascii2addr.c in Sources */,
+                               C95B8564138F53DB004311DA /* inet_addr.c in Sources */,
+                               C95B8565138F53DB004311DA /* inet_lnaof.c in Sources */,
+                               C95B8566138F53DB004311DA /* inet_makeaddr.c in Sources */,
+                               C95B8567138F53DB004311DA /* inet_net_ntop.c in Sources */,
+                               C95B8568138F53DB004311DA /* inet_net_pton.c in Sources */,
+                               C95B8569138F53DB004311DA /* inet_neta.c in Sources */,
+                               C95B856A138F53DB004311DA /* inet_netof.c in Sources */,
+                               C95B856B138F53DB004311DA /* inet_network.c in Sources */,
+                               C95B856C138F53DB004311DA /* inet_ntoa.c in Sources */,
+                               C95B856D138F53DB004311DA /* linkaddr.c in Sources */,
+                               C95B856E138F53DB004311DA /* nsap_addr.c in Sources */,
+                               C95B856F138F53DB004311DA /* recv.c in Sources */,
+                               C95B8570138F53DB004311DA /* send.c in Sources */,
+                               C95B8571138F53DB004311DA /* sockatmark.c in Sources */,
+                               C95B8572138F53DB004311DA /* sourcefilter.c in Sources */,
+                               C95B8573138F53DB004311DA /* msgcat.c in Sources */,
+                               C95B8574138F53DB004311DA /* acl.c in Sources */,
+                               C95B8575138F53DB004311DA /* acl_entry.c in Sources */,
+                               C95B8576138F53DB004311DA /* acl_file.c in Sources */,
+                               C95B8577138F53DB004311DA /* acl_flag.c in Sources */,
+                               C95B8578138F53DB004311DA /* acl_perm.c in Sources */,
+                               C95B8579138F53DB004311DA /* acl_translate.c in Sources */,
+                               C95B8582138F53DB004311DA /* mk_pthread_impl.c in Sources */,
+                               C95B8583138F53DB004311DA /* pthread.c in Sources */,
+                               C95B8584138F53DB004311DA /* pthread_cancelable.c in Sources */,
+                               C95B8585138F53DB004311DA /* pthread_cond.c in Sources */,
+                               C95B8586138F53DB004311DA /* pthread_mutex.c in Sources */,
+                               C95B8587138F53DB004311DA /* pthread_rwlock.c in Sources */,
+                               C95B8588138F53DB004311DA /* pthread_tsd.c in Sources */,
+                               C95B8589138F53DB004311DA /* pthread_atfork_test.c in Sources */,
+                               C95B858A138F53DB004311DA /* thread_setup.c in Sources */,
+                               C95B858D138F53DB004311DA /* regerror.c in Sources */,
+                               C95B8590138F53DB004311DA /* chk_fail.c in Sources */,
+                               C95B8591138F53DB004311DA /* memcpy_chk.c in Sources */,
+                               C95B8592138F53DB004311DA /* memmove_chk.c in Sources */,
+                               C95B8593138F53DB004311DA /* memset_chk.c in Sources */,
+                               C95B8594138F53DB004311DA /* snprintf_chk.c in Sources */,
+                               C95B8595138F53DB004311DA /* sprintf_chk.c in Sources */,
+                               C95B8596138F53DB004311DA /* stpcpy_chk.c in Sources */,
+                               C95B8597138F53DB004311DA /* stpncpy_chk.c in Sources */,
+                               C95B8598138F53DB004311DA /* strcat_chk.c in Sources */,
+                               C95B8599138F53DB004311DA /* strcpy_chk.c in Sources */,
+                               C95B859A138F53DB004311DA /* strncat_chk.c in Sources */,
+                               C95B859B138F53DB004311DA /* strncpy_chk.c in Sources */,
+                               C95B859C138F53DB004311DA /* vsnprintf_chk.c in Sources */,
+                               C95B859D138F53DB004311DA /* vsprintf_chk.c in Sources */,
+                               C95B859E138F53DB004311DA /* _flock_stub.c in Sources */,
+                               C95B859F138F53DB004311DA /* asprintf.c in Sources */,
+                               C95B85A0138F53DB004311DA /* clrerr.c in Sources */,
+                               C95B85A1138F53DB004311DA /* dprintf.c in Sources */,
+                               C95B85A2138F53DB004311DA /* fclose.c in Sources */,
+                               C95B85A3138F53DB004311DA /* fdopen.c in Sources */,
+                               C95B85A4138F53DB004311DA /* feof.c in Sources */,
+                               C95B85A5138F53DB004311DA /* ferror.c in Sources */,
+                               C95B85A6138F53DB004311DA /* fflush.c in Sources */,
+                               C95B85A7138F53DB004311DA /* fgetc.c in Sources */,
+                               C95B85A8138F53DB004311DA /* fgetln.c in Sources */,
+                               C95B85A9138F53DB004311DA /* fgetpos.c in Sources */,
+                               C95B85AA138F53DB004311DA /* fgets.c in Sources */,
+                               C95B85AB138F53DB004311DA /* fgetwc.c in Sources */,
+                               C95B85AC138F53DB004311DA /* fgetwln.c in Sources */,
+                               C95B85AD138F53DB004311DA /* fgetws.c in Sources */,
+                               C95B85AE138F53DB004311DA /* fileno.c in Sources */,
+                               C95B85AF138F53DB004311DA /* findfp.c in Sources */,
+                               C95B85B0138F53DB004311DA /* flags.c in Sources */,
+                               C95B85B1138F53DB004311DA /* fopen.c in Sources */,
+                               C95B85B2138F53DB004311DA /* fprintf.c in Sources */,
+                               C95B85B3138F53DB004311DA /* fpurge.c in Sources */,
+                               C95B85B4138F53DB004311DA /* fputc.c in Sources */,
+                               C95B85B5138F53DB004311DA /* fputs.c in Sources */,
+                               C95B85B6138F53DB004311DA /* fputwc.c in Sources */,
+                               C95B85B7138F53DB004311DA /* fputws.c in Sources */,
+                               C95B85B8138F53DB004311DA /* fread.c in Sources */,
+                               C95B85B9138F53DB004311DA /* freopen.c in Sources */,
+                               C95B85BA138F53DB004311DA /* fscanf.c in Sources */,
+                               C95B85BB138F53DB004311DA /* fseek.c in Sources */,
+                               C95B85BC138F53DB004311DA /* fsetpos.c in Sources */,
+                               C95B85BD138F53DB004311DA /* ftell.c in Sources */,
+                               C95B85BE138F53DB004311DA /* funopen.c in Sources */,
+                               C95B85BF138F53DB004311DA /* fvwrite.c in Sources */,
+                               C95B85C0138F53DB004311DA /* fwalk.c in Sources */,
+                               C95B85C1138F53DB004311DA /* fwide.c in Sources */,
+                               C95B85C2138F53DB004311DA /* fwprintf.c in Sources */,
+                               C95B85C3138F53DB004311DA /* fwrite.c in Sources */,
+                               C95B85C4138F53DB004311DA /* fwscanf.c in Sources */,
+                               C95B85C5138F53DB004311DA /* getc.c in Sources */,
+                               C95B85C6138F53DB004311DA /* getchar.c in Sources */,
+                               C95B85C7138F53DB004311DA /* getdelim.c in Sources */,
+                               C95B85C8138F53DB004311DA /* getline.c in Sources */,
+                               C95B85C9138F53DB004311DA /* gets.c in Sources */,
+                               C95B85CA138F53DB004311DA /* getw.c in Sources */,
+                               C95B85CB138F53DB004311DA /* getwc.c in Sources */,
+                               C95B85CC138F53DB004311DA /* getwchar.c in Sources */,
+                               C95B85CD138F53DB004311DA /* makebuf.c in Sources */,
+                               C95B85CE138F53DB004311DA /* mktemp.c in Sources */,
+                               C95B85CF138F53DB004311DA /* perror.c in Sources */,
+                               C95B85D0138F53DB004311DA /* printf-pos.c in Sources */,
+                               C95B85D1138F53DB004311DA /* printf.c in Sources */,
+                               C95B85D2138F53DB004311DA /* putc.c in Sources */,
+                               C95B85D3138F53DB004311DA /* putchar.c in Sources */,
+                               C95B85D4138F53DB004311DA /* puts.c in Sources */,
+                               C95B85D5138F53DB004311DA /* putw.c in Sources */,
+                               C95B85D6138F53DB004311DA /* putwc.c in Sources */,
+                               C95B85D7138F53DB004311DA /* putwchar.c in Sources */,
+                               C95B85D8138F53DB004311DA /* refill.c in Sources */,
+                               C95B85D9138F53DB004311DA /* remove.c in Sources */,
+                               C95B85DA138F53DB004311DA /* rewind.c in Sources */,
+                               C95B85DB138F53DB004311DA /* rget.c in Sources */,
+                               C95B85DC138F53DB004311DA /* scanf.c in Sources */,
+                               C95B85DD138F53DB004311DA /* setbuf.c in Sources */,
+                               C95B85DE138F53DB004311DA /* setbuffer.c in Sources */,
+                               C95B85DF138F53DB004311DA /* setvbuf.c in Sources */,
+                               C95B85E0138F53DB004311DA /* snprintf.c in Sources */,
+                               C95B85E1138F53DB004311DA /* sprintf.c in Sources */,
+                               C95B85E2138F53DB004311DA /* sscanf.c in Sources */,
+                               C95B85E3138F53DB004311DA /* stdio.c in Sources */,
+                               C95B85E4138F53DB004311DA /* swprintf.c in Sources */,
+                               C95B85E5138F53DB004311DA /* swscanf.c in Sources */,
+                               C95B85E6138F53DB004311DA /* tempnam.c in Sources */,
+                               C95B85E7138F53DB004311DA /* tmpfile.c in Sources */,
+                               C95B85E8138F53DB004311DA /* tmpnam.c in Sources */,
+                               C95B85E9138F53DB004311DA /* ungetc.c in Sources */,
+                               C95B85EA138F53DB004311DA /* ungetwc.c in Sources */,
+                               C95B85EB138F53DB004311DA /* vasprintf.c in Sources */,
+                               C95B85EC138F53DB004311DA /* vdprintf.c in Sources */,
+                               C95B85ED138F53DB004311DA /* vfprintf.c in Sources */,
+                               C95B85EE138F53DB004311DA /* vfscanf.c in Sources */,
+                               C95B85EF138F53DB004311DA /* vfwprintf.c in Sources */,
+                               C95B85F0138F53DB004311DA /* vfwscanf.c in Sources */,
+                               C95B85F1138F53DB004311DA /* vprintf.c in Sources */,
+                               C95B85F2138F53DB004311DA /* vscanf.c in Sources */,
+                               C95B85F3138F53DB004311DA /* vsnprintf.c in Sources */,
+                               C95B85F4138F53DB004311DA /* vsprintf.c in Sources */,
+                               C95B85F5138F53DB004311DA /* vsscanf.c in Sources */,
+                               C95B85F6138F53DB004311DA /* vswprintf.c in Sources */,
+                               C95B85F7138F53DB004311DA /* vswscanf.c in Sources */,
+                               C95B85F8138F53DB004311DA /* vwprintf.c in Sources */,
+                               C95B85F9138F53DB004311DA /* vwscanf.c in Sources */,
+                               C95B85FA138F53DB004311DA /* wbuf.c in Sources */,
+                               C95B85FB138F53DB004311DA /* wprintf.c in Sources */,
+                               C95B85FC138F53DB004311DA /* wscanf.c in Sources */,
+                               C95B85FD138F53DB004311DA /* wsetup.c in Sources */,
+                               C95B85FE138F53DB004311DA /* a64l.c in Sources */,
+                               C95B85FF138F53DB004311DA /* _Exit_.c in Sources */,
+                               C95B8600138F53DB004311DA /* abort.c in Sources */,
+                               C95B8601138F53DB004311DA /* abs.c in Sources */,
+                               C95B8602138F53DB004311DA /* atexit.c in Sources */,
+                               C95B8603138F53DB004311DA /* atof.c in Sources */,
+                               C95B8604138F53DB004311DA /* atoi.c in Sources */,
+                               C95B8605138F53DB004311DA /* atol.c in Sources */,
+                               C95B8606138F53DB004311DA /* atoll.c in Sources */,
+                               C95B8607138F53DB004311DA /* bsearch.c in Sources */,
+                               C95B8608138F53DB004311DA /* div.c in Sources */,
+                               C95B8609138F53DB004311DA /* exit.c in Sources */,
+                               C95B860A138F53DB004311DA /* getenv.c in Sources */,
+                               C95B860B138F53DB004311DA /* getopt.c in Sources */,
+                               C95B860C138F53DB004311DA /* getopt_long.c in Sources */,
+                               C95B860D138F53DB004311DA /* getsubopt.c in Sources */,
+                               C95B860E138F53DB004311DA /* hcreate.c in Sources */,
+                               C95B860F138F53DB004311DA /* heapsort.c in Sources */,
+                               C95B8610138F53DB004311DA /* heapsort_b.c in Sources */,
+                               C95B8611138F53DB004311DA /* heapsort_r.c in Sources */,
+                               C95B8612138F53DB004311DA /* imaxabs.c in Sources */,
+                               C95B8613138F53DB004311DA /* imaxdiv.c in Sources */,
+                               C95B8614138F53DB004311DA /* insque.c in Sources */,
+                               C95B8615138F53DB004311DA /* labs.c in Sources */,
+                               C95B8616138F53DB004311DA /* ldiv.c in Sources */,
+                               C95B8617138F53DB004311DA /* llabs.c in Sources */,
+                               C95B8618138F53DB004311DA /* lldiv.c in Sources */,
+                               C95B8619138F53DB004311DA /* lsearch.c in Sources */,
+                               C95B861A138F53DB004311DA /* merge.c in Sources */,
+                               C95B861B138F53DB004311DA /* putenv.c in Sources */,
+                               C95B861C138F53DB004311DA /* qsort.c in Sources */,
+                               C95B861D138F53DB004311DA /* qsort_r.c in Sources */,
+                               C95B861E138F53DB004311DA /* radixsort.c in Sources */,
+                               C95B861F138F53DB004311DA /* rand.c in Sources */,
+                               C95B8620138F53DB004311DA /* random.c in Sources */,
+                               C95B8621138F53DB004311DA /* reallocf.c in Sources */,
+                               C95B8622138F53DB004311DA /* realpath.c in Sources */,
+                               C95B8623138F53DB004311DA /* remque.c in Sources */,
+                               C95B8624138F53DB004311DA /* setenv.c in Sources */,
+                               C95B8625138F53DB004311DA /* strhash.c in Sources */,
+                               C95B8626138F53DB004311DA /* strtoimax.c in Sources */,
+                               C95B8627138F53DB004311DA /* strtol.c in Sources */,
+                               C95B8628138F53DB004311DA /* strtoll.c in Sources */,
+                               C95B8629138F53DB004311DA /* strtoq.c in Sources */,
+                               C95B862A138F53DB004311DA /* strtoul.c in Sources */,
+                               C95B862B138F53DB004311DA /* strtoull.c in Sources */,
+                               C95B862C138F53DB004311DA /* strtoumax.c in Sources */,
+                               C95B862D138F53DB004311DA /* strtouq.c in Sources */,
+                               C95B862E138F53DB004311DA /* system.c in Sources */,
+                               C95B862F138F53DB004311DA /* tdelete.c in Sources */,
+                               C95B8630138F53DB004311DA /* tfind.c in Sources */,
+                               C95B8631138F53DB004311DA /* tsearch.c in Sources */,
+                               C95B8632138F53DB004311DA /* twalk.c in Sources */,
+                               C95B8633138F53DB004311DA /* grantpt.c in Sources */,
+                               C95B8634138F53DB004311DA /* l64a.c in Sources */,
+                               C95B8635138F53DB004311DA /* strfmon.c in Sources */,
+                               C95B8636138F53DB004311DA /* ecvt.c in Sources */,
+                               C95B8637138F53DB004311DA /* gcvt.c in Sources */,
+                               C95B8638138F53DB004311DA /* qsort_b-fbsd.c in Sources */,
+                               C95B8639138F53DB004311DA /* asctime.c in Sources */,
+                               C95B863A138F53DB004311DA /* difftime.c in Sources */,
+                               C95B863B138F53DB004311DA /* ftime.c in Sources */,
+                               C95B863C138F53DB004311DA /* localtime.c in Sources */,
+                               C95B863D138F53DB004311DA /* strftime.c in Sources */,
+                               C95B863E138F53DB004311DA /* strptime.c in Sources */,
+                               C95B863F138F53DB004311DA /* time32.c in Sources */,
+                               C95B8640138F53DB004311DA /* timelocal.c in Sources */,
+                               C95B8641138F53DB004311DA /* getdate.c in Sources */,
+                               C95B8642138F53DB004311DA /* timezone_unix03.c in Sources */,
+                               C95B8643138F53DB004311DA /* bcmp.c in Sources */,
+                               C95B8644138F53DB004311DA /* bcopy.c in Sources */,
+                               C95B8645138F53DB004311DA /* bzero.c in Sources */,
+                               C95B8646138F53DB004311DA /* index.c in Sources */,
+                               C95B8647138F53DB004311DA /* memccpy.c in Sources */,
+                               C95B8648138F53DB004311DA /* memchr.c in Sources */,
+                               C95B8649138F53DB004311DA /* memcmp.c in Sources */,
+                               C95B864A138F53DB004311DA /* memcpy.c in Sources */,
+                               C95B864B138F53DB004311DA /* memmem.c in Sources */,
+                               C95B864C138F53DB004311DA /* memmove.c in Sources */,
+                               C95B864D138F53DB004311DA /* memset.c in Sources */,
+                               C95B864E138F53DB004311DA /* rindex.c in Sources */,
+                               C95B8651138F53DB004311DA /* strcasecmp.c in Sources */,
+                               C95B8652138F53DB004311DA /* strcasestr.c in Sources */,
+                               C95B8654138F53DB004311DA /* strchr.c in Sources */,
+                               C95B8655138F53DB004311DA /* strcmp.c in Sources */,
+                               C95B8656138F53DB004311DA /* strcoll.c in Sources */,
+                               C95B8658138F53DB004311DA /* strcspn.c in Sources */,
+                               C95B8659138F53DB004311DA /* strdup.c in Sources */,
+                               C95B865A138F53DB004311DA /* strerror.c in Sources */,
+                               C95B865D138F53DB004311DA /* strlen.c in Sources */,
+                               C95B865E138F53DB004311DA /* strmode.c in Sources */,
+                               C95B8660138F53DB004311DA /* strncmp.c in Sources */,
+                               C95B8662138F53DB004311DA /* strndup.c in Sources */,
+                               C95B8663138F53DB004311DA /* strnlen.c in Sources */,
+                               C95B8664138F53DB004311DA /* strnstr.c in Sources */,
+                               C95B8665138F53DB004311DA /* strpbrk.c in Sources */,
+                               C95B8666138F53DB004311DA /* strrchr.c in Sources */,
+                               C95B8667138F53DB004311DA /* strsep.c in Sources */,
+                               C95B8668138F53DB004311DA /* strsignal.c in Sources */,
+                               C95B8669138F53DB004311DA /* strspn.c in Sources */,
+                               C95B866A138F53DB004311DA /* strstr.c in Sources */,
+                               C95B866B138F53DB004311DA /* strtok.c in Sources */,
+                               C95B866C138F53DB004311DA /* strxfrm.c in Sources */,
+                               C95B866D138F53DB004311DA /* swab.c in Sources */,
+                               C95B866E138F53DB004311DA /* wcpcpy.c in Sources */,
+                               C95B866F138F53DB004311DA /* wcpncpy.c in Sources */,
+                               C95B8670138F53DB004311DA /* wcscasecmp.c in Sources */,
+                               C95B8671138F53DB004311DA /* wcscat.c in Sources */,
+                               C95B8672138F53DB004311DA /* wcschr.c in Sources */,
+                               C95B8673138F53DB004311DA /* wcscmp.c in Sources */,
+                               C95B8674138F53DB004311DA /* wcscoll.c in Sources */,
+                               C95B8675138F53DB004311DA /* wcscpy.c in Sources */,
+                               C95B8676138F53DB004311DA /* wcscspn.c in Sources */,
+                               C95B8677138F53DB004311DA /* wcsdup.c in Sources */,
+                               C95B8678138F53DB004311DA /* wcslcat.c in Sources */,
+                               C95B8679138F53DB004311DA /* wcslcpy.c in Sources */,
+                               C95B867A138F53DB004311DA /* wcslen.c in Sources */,
+                               C95B867B138F53DB004311DA /* wcsncasecmp.c in Sources */,
+                               C95B867C138F53DB004311DA /* wcsncat.c in Sources */,
+                               C95B867D138F53DB004311DA /* wcsncmp.c in Sources */,
+                               C95B867E138F53DB004311DA /* wcsncpy.c in Sources */,
+                               C95B867F138F53DB004311DA /* wcsnlen.c in Sources */,
+                               C95B8680138F53DB004311DA /* wcspbrk.c in Sources */,
+                               C95B8681138F53DB004311DA /* wcsrchr.c in Sources */,
+                               C95B8682138F53DB004311DA /* wcsspn.c in Sources */,
+                               C95B8683138F53DB004311DA /* wcsstr.c in Sources */,
+                               C95B8684138F53DB004311DA /* wcstok.c in Sources */,
+                               C95B8685138F53DB004311DA /* wcswidth.c in Sources */,
+                               C95B8686138F53DB004311DA /* wcsxfrm.c in Sources */,
+                               C95B8687138F53DB004311DA /* wmemchr.c in Sources */,
+                               C95B8688138F53DB004311DA /* wmemcmp.c in Sources */,
+                               C95B8689138F53DB004311DA /* wmemcpy.c in Sources */,
+                               C95B868A138F53DB004311DA /* wmemmove.c in Sources */,
+                               C95B868B138F53DB004311DA /* wmemset.c in Sources */,
+                               C95B868C138F53DB004311DA /* __libc_init.c in Sources */,
+                               C95B868D138F53DB004311DA /* _libc_fork_child.c in Sources */,
+                               C95B868E138F53DB004311DA /* chmodx_np.c in Sources */,
+                               C95B868F138F53DB004311DA /* context-stubs.c in Sources */,
+                               C95B8690138F53DB004311DA /* crt_externs.c in Sources */,
+                               C95B8691138F53DB004311DA /* errno.c in Sources */,
+                               C95B8692138F53DB004311DA /* fork.c in Sources */,
+                               C95B8693138F53DB004311DA /* getgroups.c in Sources */,
+                               C95B8694138F53DB004311DA /* getiopolicy_np.c in Sources */,
+                               C95B8695138F53DB004311DA /* gettimeofday.c in Sources */,
+                               C95B8696138F53DB004311DA /* msgctl.c in Sources */,
+                               C95B8697138F53DB004311DA /* stack_protector.c in Sources */,
+                               C95B8698138F53DB004311DA /* openx_np.c in Sources */,
+                               C95B8699138F53DB004311DA /* OSMemoryNotification.c in Sources */,
+                               C95B869A138F53DB004311DA /* OSThermalNotification.c in Sources */,
+                               C95B869B138F53DB004311DA /* posix_spawn.c in Sources */,
+                               C95B869C138F53DB004311DA /* semctl.c in Sources */,
+                               C95B869D138F53DB004311DA /* settimeofday.c in Sources */,
+                               C95B869E138F53DB004311DA /* shmctl.c in Sources */,
+                               C95B869F138F53DB004311DA /* sigaction.c in Sources */,
+                               C95B86A0138F53DB004311DA /* sigcatch.c in Sources */,
+                               C95B86A1138F53DB004311DA /* sigtramp.c in Sources */,
+                               C95B86A2138F53DB004311DA /* slot_name.c in Sources */,
+                               C95B86A3138F53DB004311DA /* statx_np.c in Sources */,
+                               C95B86A4138F53DB004311DA /* umaskx_np.c in Sources */,
+                               C95B86A5138F53DB004311DA /* cprocs.c in Sources */,
+                               C95B86A6138F53DB004311DA /* cthreads.c in Sources */,
+                               C95B86A7138F53DB004311DA /* mig_support.c in Sources */,
+                               C95B86A8138F53DB004311DA /* fparseln.c in Sources */,
+                               C95B86A9138F53DB004311DA /* login.c in Sources */,
+                               C95B86AA138F53DB004311DA /* login_tty.c in Sources */,
+                               C95B86AB138F53DB004311DA /* logout.c in Sources */,
+                               C95B86AC138F53DB004311DA /* logwtmp.c in Sources */,
+                               3F76864A13E91D3700C94D25 /* mkpath_np.c in Sources */,
+                               C95B86AD138F53DB004311DA /* opendev.c in Sources */,
+                               C95B86AE138F53DB004311DA /* pty.c in Sources */,
+                               C95B86AF138F53DB004311DA /* clear.c in Sources */,
+                               C95B86B0138F53DB004311DA /* compare.c in Sources */,
+                               C95B86B1138F53DB004311DA /* copy.c in Sources */,
+                               C95B86B2138F53DB004311DA /* gen_uuid.c in Sources */,
+                               C95B86B3138F53DB004311DA /* isnull.c in Sources */,
+                               C95B86B4138F53DB004311DA /* pack.c in Sources */,
+                               C95B86B5138F53DB004311DA /* parse.c in Sources */,
+                               C95B86B6138F53DB004311DA /* unpack.c in Sources */,
+                               C95B86B7138F53DB004311DA /* unparse.c in Sources */,
+                               C95B86B8138F53DB004311DA /* getmcontext.c in Sources */,
+                               C95B86B9138F53DB004311DA /* makecontext.c in Sources */,
+                               C95B86BA138F53DB004311DA /* setcontext.c in Sources */,
+                               C95B86BB138F53DB004311DA /* swapcontext.c in Sources */,
+                               C95B86BC138F53DB004311DA /* bcopy.c in Sources */,
+                               C95B86BD138F53DB004311DA /* bzero.c in Sources */,
+                               C95B86BE138F53DB004311DA /* memcpy.c in Sources */,
+                               C95B86BF138F53DB004311DA /* memmove.c in Sources */,
+                               C95B86C0138F53DB004311DA /* atomic.c in Sources */,
+                               C95B86C1138F53DB004311DA /* spinlocks.c in Sources */,
+                               3F2208ED14358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C64611450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1B9146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9B53E28138DA0610028D27C /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9EB2F82138F68CB0075BB52 /* cpu_number.s in Sources */,
+                               C9EB2F83138F68CB0075BB52 /* icacheinval.s in Sources */,
+                               C9EB2F84138F68CB0075BB52 /* init_cpu_capabilities.c in Sources */,
+                               C9EB2F85138F68CB0075BB52 /* pthread_getspecific.s in Sources */,
+                               C9EB2F86138F68CB0075BB52 /* pthread_self.s in Sources */,
+                               C9EB2F87138F68CB0075BB52 /* pthread_set_self.s in Sources */,
+                               C9EB2F88138F68CB0075BB52 /* start_wqthread.s in Sources */,
+                               C9EB2F89138F68CB0075BB52 /* thread_start.s in Sources */,
+                               C9EB2F8B138F68CB0075BB52 /* bcopy_CortexA8.s in Sources */,
+                               C9EB2F8C138F68CB0075BB52 /* bcopy_CortexA9.s in Sources */,
+                               C9EB2F8D138F68CB0075BB52 /* bcopy_Generic.s in Sources */,
+                               C9EB2F8E138F68CB0075BB52 /* bzero_CortexA8.s in Sources */,
+                               C9EB2F8F138F68CB0075BB52 /* bzero_CortexA9.s in Sources */,
+                               C9EB2F90138F68CB0075BB52 /* bzero_Generic.s in Sources */,
+                               C9EB2F91138F68CB0075BB52 /* dyld_resolvers.c in Sources */,
+                               C9EB2F92138F68CB0075BB52 /* ffs.s in Sources */,
+                               C9EB2F93138F68CB0075BB52 /* memcmp.s in Sources */,
+                               C9EB2F94138F68CB0075BB52 /* memset_pattern.s in Sources */,
+                               C9EB2F95138F68CB0075BB52 /* strchr.s in Sources */,
+                               C9EB2F96138F68CB0075BB52 /* strcmp.s in Sources */,
+                               C9EB2F99138F68CB0075BB52 /* strlen.s in Sources */,
+                               C9EB2F9A138F68CB0075BB52 /* strncmp.s in Sources */,
+                               C9EB2F9C138F68CB0075BB52 /* strnlen.s in Sources */,
+                               C9EB2F9D138F68CB0075BB52 /* strstr.s in Sources */,
+                               C9EB2F9E138F68CB0075BB52 /* _longjmp.s in Sources */,
+                               C9EB2FA0138F68CB0075BB52 /* _setjmp.s in Sources */,
+                               C9EB2FA1138F68CB0075BB52 /* arm_commpage_gettimeofday.c in Sources */,
+                               C9EB2FA2138F68CB0075BB52 /* gcc_atomic.c in Sources */,
+                               C9EB2FA3138F68CB0075BB52 /* longjmp.s in Sources */,
+                               C9EB2FA4138F68CB0075BB52 /* mach_absolute_time.s in Sources */,
+                               C9EB2FA5138F68CB0075BB52 /* OSAtomic-v4.c in Sources */,
+                               C9EB2FA7138F68CB0075BB52 /* OSAtomic_resolvers.c in Sources */,
+                               C9EB2FA9138F68CB0075BB52 /* setjmp.s in Sources */,
+                               C9EB2F4C138F68A80075BB52 /* _ctx_start.S in Sources */,
+                               C9EB2F4D138F68A80075BB52 /* _setcontext.S in Sources */,
+                               C9EB2F4E138F68A80075BB52 /* cpu_number.s in Sources */,
+                               C9EB2F4F138F68A80075BB52 /* getcontext.S in Sources */,
+                               C9EB2F50138F68A80075BB52 /* getmcontext.c in Sources */,
+                               C9EB2F51138F68A80075BB52 /* icacheinval.s in Sources */,
+                               C9EB2F52138F68A80075BB52 /* makecontext.c in Sources */,
+                               C9EB2F53138F68A80075BB52 /* mcount.s in Sources */,
+                               C9EB2F54138F68A80075BB52 /* setcontext.c in Sources */,
+                               C9EB2F55138F68A80075BB52 /* setjmperr.c in Sources */,
+                               C9EB2F56138F68A80075BB52 /* swapcontext.c in Sources */,
+                               C9EB2F57138F68A80075BB52 /* init_cpu_capabilities.c in Sources */,
+                               C9EB2F58138F68A80075BB52 /* preempt.s in Sources */,
+                               C9EB2F59138F68A80075BB52 /* pthread_getspecific.s in Sources */,
+                               C9EB2F5A138F68A80075BB52 /* pthread_mutex_lock.s in Sources */,
+                               C9EB2F5B138F68A80075BB52 /* pthread_self.s in Sources */,
+                               C9EB2F5C138F68A80075BB52 /* pthread_set_self.s in Sources */,
+                               C9EB2F5D138F68A80075BB52 /* start_wqthread.s in Sources */,
+                               C9EB2F5E138F68A80075BB52 /* thread_start.s in Sources */,
+                               C9EB2F60138F68A80075BB52 /* __bzero.s in Sources */,
+                               C9EB2F61138F68A80075BB52 /* bcopy.c in Sources */,
+                               C9EB2F62138F68A80075BB52 /* bcopy_scalar.s in Sources */,
+                               C9EB2F63138F68A80075BB52 /* bcopy_sse2.s in Sources */,
+                               C9EB2F64138F68A80075BB52 /* bcopy_sse3x.s in Sources */,
+                               C9EB2F65138F68A80075BB52 /* bcopy_sse42.s in Sources */,
+                               C9EB2F66138F68A80075BB52 /* bzero.c in Sources */,
+                               C9EB2F67138F68A80075BB52 /* bzero_scalar.s in Sources */,
+                               C9EB2F68138F68A80075BB52 /* bzero_sse2.s in Sources */,
+                               C9EB2F69138F68A80075BB52 /* bzero_sse42.s in Sources */,
+                               C9EB2F6A138F68A80075BB52 /* ffs.s in Sources */,
+                               C9EB2F6B138F68A80075BB52 /* longcopy_sse3x.s in Sources */,
+                               C9EB2F6C138F68A80075BB52 /* memcmp.s in Sources */,
+                               C9EB2F6D138F68A80075BB52 /* memcpy.c in Sources */,
+                               C9EB2F6E138F68A80075BB52 /* memmove.c in Sources */,
+                               C9EB2F6F138F68A80075BB52 /* memset.s in Sources */,
+                               C9EB2F70138F68A80075BB52 /* memset_pattern_sse2.s in Sources */,
+                               C9EB2F71138F68A80075BB52 /* strcmp.s in Sources */,
+                               C9EB2F72138F68A80075BB52 /* strcpy.s in Sources */,
+                               C9EB2F73138F68A80075BB52 /* strlcat.s in Sources */,
+                               C9EB2F74138F68A80075BB52 /* strlcpy.s in Sources */,
+                               C9EB2F75138F68A80075BB52 /* strlen.s in Sources */,
+                               C9EB2F76138F68A80075BB52 /* strncmp.s in Sources */,
+                               C9EB2F77138F68A80075BB52 /* strncpy.s in Sources */,
+                               C9EB2F78138F68A80075BB52 /* _setjmp.s in Sources */,
+                               C9EB2F79138F68A80075BB52 /* _sigtramp.s in Sources */,
+                               C9EB2F7A138F68A80075BB52 /* atomic.c in Sources */,
+                               C9EB2F7B138F68A80075BB52 /* i386_gettimeofday_asm.s in Sources */,
+                               C9EB2F7C138F68A80075BB52 /* mach_absolute_time.c in Sources */,
+                               C9EB2F7D138F68A80075BB52 /* mach_absolute_time_asm.s in Sources */,
+                               C9EB2F7E138F68A80075BB52 /* OSAtomic.s in Sources */,
+                               C9EB2F7F138F68A80075BB52 /* setjmp.s in Sources */,
+                               C9EB2F80138F68A80075BB52 /* spinlocks.c in Sources */,
+                               C9EB2F81138F68A80075BB52 /* spinlocks_asm.s in Sources */,
+                               C9B53E57138DA5910028D27C /* _ctx_start.S in Sources */,
+                               C9B53E58138DA5910028D27C /* _setcontext.S in Sources */,
+                               C9B53E59138DA5910028D27C /* cpu_number.s in Sources */,
+                               C9B53E5A138DA5910028D27C /* getcontext.S in Sources */,
+                               C9B53E5B138DA5910028D27C /* getmcontext.c in Sources */,
+                               C9B53E5C138DA5910028D27C /* icacheinval.s in Sources */,
+                               C9B53E5D138DA5910028D27C /* makecontext.c in Sources */,
+                               C9B53E5E138DA5910028D27C /* mcount.s in Sources */,
+                               C9B53E5F138DA5910028D27C /* setcontext.c in Sources */,
+                               C9B53E60138DA5910028D27C /* swapcontext.c in Sources */,
+                               C9B53E62138DA5950028D27C /* preempt.s in Sources */,
+                               C9B53E63138DA5950028D27C /* pthread_getspecific.s in Sources */,
+                               C9B53E64138DA5950028D27C /* pthread_mutex_lock.s in Sources */,
+                               C9B53E65138DA5950028D27C /* pthread_self.s in Sources */,
+                               C9B53E66138DA5950028D27C /* pthread_set_self.s in Sources */,
+                               C9B53E67138DA5950028D27C /* start_wqthread.s in Sources */,
+                               C9B53E68138DA5950028D27C /* thread_start.s in Sources */,
+                               C9B53E69138DA59F0028D27C /* __bzero.s in Sources */,
+                               C9B53E6A138DA59F0028D27C /* bcopy.c in Sources */,
+                               C9B53E6B138DA59F0028D27C /* bcopy_sse3x.s in Sources */,
+                               C9B53E6C138DA59F0028D27C /* bcopy_sse42.s in Sources */,
+                               C9B53E6D138DA59F0028D27C /* bzero.c in Sources */,
+                               C9B53E6E138DA59F0028D27C /* bzero_sse2.s in Sources */,
+                               C9B53E6F138DA59F0028D27C /* bzero_sse42.s in Sources */,
+                               C9B53E70138DA59F0028D27C /* ffs.s in Sources */,
+                               C9B53E71138DA59F0028D27C /* longcopy_sse3x.s in Sources */,
+                               C9B53E72138DA59F0028D27C /* memcmp.s in Sources */,
+                               C9B53E73138DA59F0028D27C /* memcpy.c in Sources */,
+                               C9B53E74138DA59F0028D27C /* memmove.c in Sources */,
+                               C9B53E75138DA59F0028D27C /* memset.s in Sources */,
+                               C9B53E76138DA59F0028D27C /* strcmp.s in Sources */,
+                               C9B53E77138DA59F0028D27C /* strcpy.s in Sources */,
+                               C9B53E78138DA59F0028D27C /* strlcat.s in Sources */,
+                               C9B53E79138DA59F0028D27C /* strlcpy.s in Sources */,
+                               C9B53E7A138DA59F0028D27C /* strlen.s in Sources */,
+                               C9B53E7B138DA59F0028D27C /* strncmp.s in Sources */,
+                               C9B53E7C138DA59F0028D27C /* strncpy.s in Sources */,
+                               C9B53E7D138DA5A30028D27C /* _setjmp.s in Sources */,
+                               C9B53E7E138DA5A30028D27C /* _sigtramp.s in Sources */,
+                               C9B53E7F138DA5A30028D27C /* atomic.c in Sources */,
+                               C9B53E80138DA5A30028D27C /* i386_gettimeofday_asm.s in Sources */,
+                               C9B53E81138DA5A30028D27C /* nanotime.s in Sources */,
+                               C9B53E82138DA5A30028D27C /* OSAtomic.s in Sources */,
+                               C9B53E83138DA5A30028D27C /* setjmp.s in Sources */,
+                               C9B53E84138DA5A30028D27C /* spinlocks.c in Sources */,
+                               C9B53E85138DA5A30028D27C /* spinlocks_asm.s in Sources */,
+                               C9EB3556138F7F6A0075BB52 /* setjmperr.c in Sources */,
+                               6358199113B53DD800CDF61C /* bzero_Swift.s in Sources */,
+                               6358199313B53ECC00CDF61C /* bcopy_Swift.s in Sources */,
+                               634C4C3813BCEADC008CA66D /* memset_pattern_Swift.s in Sources */,
+                               C995462813AAA25000A531B4 /* OSAtomicUP.c in Sources */,
+                               C97C344113AB0E1B00713550 /* Spinlocks.c in Sources */,
+                               C980F8EC13AB168D0069AB06 /* SpinlocksUP.c in Sources */,
+                               C932C2D013AB1C73004EDA12 /* SpinlocksWFE.c in Sources */,
+                               C9B4E3D813BBBF2D0008A9BB /* OSAtomic.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9C2A949138DFFD900287F00 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9258122138E3CA100B3107C /* magmallocProvider.d in Sources */,
+                               C9C2A95C138E03C700287F00 /* dirhelper.defs in Sources */,
+                               C9C2A99C138E06D900287F00 /* asl_ipc.defs in Sources */,
+                               C9C2A959138E025700287F00 /* sigaltstk.c in Sources */,
+                               C9C2A95A138E025700287F00 /* sigcompat.c in Sources */,
+                               C9C2A95D138E03C700287F00 /* libproc.c in Sources */,
+                               C9C2A95E138E03C700287F00 /* proc_listpidspath.c in Sources */,
+                               C9C2A97D138E058200287F00 /* brk.c in Sources */,
+                               C9C2A97E138E058200287F00 /* bsd_signal.c in Sources */,
+                               C9C2A97F138E058200287F00 /* lchflags.c in Sources */,
+                               C9C2A980138E058200287F00 /* lchmod.c in Sources */,
+                               C9C2A981138E058200287F00 /* lutimes.c in Sources */,
+                               C9C2A982138E058200287F00 /* statvfs.c in Sources */,
+                               C9C2A9A1138E06D900287F00 /* assumes.c in Sources */,
+                               C9C2A9A2138E06D900287F00 /* backtrace.c in Sources */,
+                               C9C2A9A3138E06D900287F00 /* cache.c in Sources */,
+                               C9C2A9A4138E06D900287F00 /* confstr.c in Sources */,
+                               C9C2A9A5138E06D900287F00 /* crypt.c in Sources */,
+                               C9C2A9A6138E06D900287F00 /* devname.c in Sources */,
+                               C9C2A9A7138E06D900287F00 /* disklabel.c in Sources */,
+                               C9C2A9A8138E06D900287F00 /* errlst.c in Sources */,
+                               C9C2A9A9138E06D900287F00 /* filesec.c in Sources */,
+                               C9C2A9AA138E072500287F00 /* fts.c in Sources */,
+                               C9C2A9AB138E072500287F00 /* get_compat.c in Sources */,
+                               C9C2A9AC138E072500287F00 /* getloadavg.c in Sources */,
+                               C9C2A9AD138E072500287F00 /* getttyent.c in Sources */,
+                               C9C2A9AE138E072500287F00 /* getusershell.c in Sources */,
+                               C9C2A9AF138E072500287F00 /* getvfsbyname.c in Sources */,
+                               C9C2A9B0138E072500287F00 /* isinf.c in Sources */,
+                               C9C2A9B1138E072500287F00 /* isnan.c in Sources */,
+                               C9C2A9B5138E072500287F00 /* nanosleep.c in Sources */,
+                               C9C2A9B6138E072500287F00 /* nftw.c in Sources */,
+                               C9C2A9B7138E072500287F00 /* platfunc.c in Sources */,
+                               C9C2A9B8138E072500287F00 /* setlogin.c in Sources */,
+                               C9C2A9B9138E072600287F00 /* sigsetops.c in Sources */,
+                               C9C2A9BA138E072600287F00 /* stack_logging.c in Sources */,
+                               C9C2A9BB138E072600287F00 /* stack_logging_disk.c in Sources */,
+                               C9C2A9BC138E072600287F00 /* strtofflags.c in Sources */,
+                               C9C2A9BD138E072600287F00 /* syslog.c in Sources */,
+                               C9C2A9BE138E072600287F00 /* thread_stack_pcs.c in Sources */,
+                               C9C2A9BF138E072600287F00 /* uname.c in Sources */,
+                               C9C2A9C0138E072600287F00 /* utmpx-darwin.c in Sources */,
+                               C9C2A9C1138E072600287F00 /* wordexp.c in Sources */,
+                               C9A12853138E0BE00003880A /* gmon.c in Sources */,
+                               C9A12854138E0C1C0003880A /* isctype.c in Sources */,
+                               C9A12855138E0C1C0003880A /* iswctype.c in Sources */,
+                               C9A12856138E0C1C0003880A /* xlocale.c in Sources */,
+                               C9A128A0138E0CD10003880A /* acl.c in Sources */,
+                               C9A128A1138E0CD10003880A /* acl_entry.c in Sources */,
+                               C9A128A2138E0CD10003880A /* acl_file.c in Sources */,
+                               C9A128A3138E0CD10003880A /* acl_flag.c in Sources */,
+                               C9A128A4138E0CD10003880A /* acl_perm.c in Sources */,
+                               C9A128A5138E0CD10003880A /* acl_translate.c in Sources */,
+                               C9A128A6138E0D0B0003880A /* pthread.c in Sources */,
+                               C9A128A7138E0D0B0003880A /* pthread_cancelable.c in Sources */,
+                               C9A128A8138E0D0B0003880A /* pthread_cond.c in Sources */,
+                               C9A128A9138E0D0B0003880A /* pthread_mutex.c in Sources */,
+                               C9A128AA138E0D0B0003880A /* pthread_rwlock.c in Sources */,
+                               C9A128AB138E0D0B0003880A /* pthread_tsd.c in Sources */,
+                               C9A128AC138E0D0B0003880A /* stack.s in Sources */,
+                               C9A128AD138E0D0B0003880A /* thread_setup.c in Sources */,
+                               C9A128B3138E0D950003880A /* chk_fail.c in Sources */,
+                               C9A128B4138E0D950003880A /* memcpy_chk.c in Sources */,
+                               C9A128B5138E0D950003880A /* memmove_chk.c in Sources */,
+                               C9A128B6138E0D950003880A /* memset_chk.c in Sources */,
+                               C9A128B7138E0D950003880A /* snprintf_chk.c in Sources */,
+                               C9A128B8138E0D950003880A /* sprintf_chk.c in Sources */,
+                               C9A128B9138E0D950003880A /* stpcpy_chk.c in Sources */,
+                               C9A128BA138E0D950003880A /* stpncpy_chk.c in Sources */,
+                               C9A128BB138E0D950003880A /* strcat_chk.c in Sources */,
+                               C9A128BC138E0D950003880A /* strcpy_chk.c in Sources */,
+                               C9A128BD138E0D950003880A /* strncat_chk.c in Sources */,
+                               C9A128BE138E0D950003880A /* strncpy_chk.c in Sources */,
+                               C9A128BF138E0D950003880A /* vsnprintf_chk.c in Sources */,
+                               C9A128C0138E0D950003880A /* vsprintf_chk.c in Sources */,
+                               C9A12929138E0EF00003880A /* getdate.c in Sources */,
+                               C9A1292A138E0EF00003880A /* timezone_unix03.c in Sources */,
+                               C9A12974138E10AB0003880A /* cprocs.c in Sources */,
+                               C9A12975138E10AB0003880A /* cthreads.c in Sources */,
+                               C9A12976138E10AB0003880A /* mig_support.c in Sources */,
+                               C9A12977138E10C40003880A /* fparseln.c in Sources */,
+                               C9A12978138E10C40003880A /* login_tty.c in Sources */,
+                               C9A12979138E10C40003880A /* logwtmp.c in Sources */,
+                               3F76864713E91CBC00C94D25 /* mkpath_np.c in Sources */,
+                               C9A1297A138E10C40003880A /* opendev.c in Sources */,
+                               C9A1297B138E10C40003880A /* pty.c in Sources */,
+                               C9A1297C138E10FB0003880A /* clear.c in Sources */,
+                               C9A1297D138E10FB0003880A /* compare.c in Sources */,
+                               C9A1297E138E10FB0003880A /* copy.c in Sources */,
+                               C9A1297F138E10FB0003880A /* gen_uuid.c in Sources */,
+                               C9A12980138E10FB0003880A /* isnull.c in Sources */,
+                               C9A12981138E10FB0003880A /* pack.c in Sources */,
+                               C9A12982138E10FB0003880A /* parse.c in Sources */,
+                               C9A12983138E10FB0003880A /* unpack.c in Sources */,
+                               C9A12984138E10FB0003880A /* unparse.c in Sources */,
+                               C9C2A95B138E03C700287F00 /* _dirhelper.c in Sources */,
+                               C9C2A983138E058200287F00 /* tcgetsid.c in Sources */,
+                               C9C2A998138E06D900287F00 /* _simple.c in Sources */,
+                               C9C2A999138E06D900287F00 /* asl.c in Sources */,
+                               C9C2A99A138E06D900287F00 /* asl_core.c in Sources */,
+                               C9C2A99B138E06D900287F00 /* asl_file.c in Sources */,
+                               C9C2A99D138E06D900287F00 /* asl_legacy1.c in Sources */,
+                               C9C2A99E138E06D900287F00 /* asl_msg.c in Sources */,
+                               C9C2A99F138E06D900287F00 /* asl_store.c in Sources */,
+                               C9C2A9A0138E06D900287F00 /* asl_util.c in Sources */,
+                               C9C2A9B4138E072500287F00 /* malloc.c in Sources */,
+                               C9C2A9B2138E072500287F00 /* magazine_malloc.c in Sources */,
+                               C9FA32FB138E4BD00089A94B /* __libc_init.c in Sources */,
+                               C9FA32FC138E4BD00089A94B /* _libc_fork_child.c in Sources */,
+                               C9FA32FD138E4BD00089A94B /* chmodx_np.c in Sources */,
+                               C9FA32FE138E4BD00089A94B /* context-stubs.c in Sources */,
+                               C9FA32FF138E4BD00089A94B /* crt_externs.c in Sources */,
+                               C9FA3300138E4BD00089A94B /* errno.c in Sources */,
+                               C9FA3301138E4BD00089A94B /* fork.c in Sources */,
+                               C9FA3302138E4BD00089A94B /* getiopolicy_np.c in Sources */,
+                               C9FA3303138E4BD00089A94B /* gettimeofday.c in Sources */,
+                               C9FA3304138E4BD00089A94B /* openx_np.c in Sources */,
+                               C9FA3307138E4BD00089A94B /* posix_spawn.c in Sources */,
+                               C9FA3308138E4BD00089A94B /* settimeofday.c in Sources */,
+                               C9FA3309138E4BD00089A94B /* sigaction.c in Sources */,
+                               C9FA330A138E4BD00089A94B /* sigcatch.c in Sources */,
+                               C9FA330B138E4BD00089A94B /* sigtramp.c in Sources */,
+                               C9FA330C138E4BD00089A94B /* slot_name.c in Sources */,
+                               C9FA330D138E4BD00089A94B /* statx_np.c in Sources */,
+                               C9FA330E138E4BD00089A94B /* umaskx_np.c in Sources */,
+                               C9421014138F23CA004BA536 /* frune.c in Sources */,
+                               C9421015138F23CA004BA536 /* mbrune.c in Sources */,
+                               C9421016138F23CA004BA536 /* runedepreciated.c in Sources */,
+                               C9421017138F23CA004BA536 /* setinvalidrune.c in Sources */,
+                               C9EB2FBB138F6A920075BB52 /* NSSystemDirectories.c in Sources */,
+                               C9EB3542138F7D0A0075BB52 /* login.c in Sources */,
+                               C9EB3543138F7D0A0075BB52 /* logout.c in Sources */,
+                               C9EB3558138F7FF40075BB52 /* nlist.c in Sources */,
+                               C9EB355C138F81A40075BB52 /* kvm.c in Sources */,
+                               C9EB355E138F81AB0075BB52 /* MKGetTimeBaseInfo.c in Sources */,
+                               C98373971395989E00E5C052 /* OSMemoryNotification.c in Sources */,
+                               C98373981395989E00E5C052 /* OSThermalNotification.c in Sources */,
+                               C9CF595A13CD0B9600674871 /* memset_pattern.c in Sources */,
+                               6310518A13D4D9E9004F7BA8 /* strcpy.c in Sources */,
+                               6310518D13D4DABD004F7BA8 /* strlcpy.c in Sources */,
+                               6310519013D4DAEA004F7BA8 /* strncpy.c in Sources */,
+                               63D4060613DDEDF10094DD56 /* stpcpy.c in Sources */,
+                               63D4060B13DDEEA20094DD56 /* stpncpy.c in Sources */,
+                               63D4060E13DDF26A0094DD56 /* strcat.c in Sources */,
+                               63D4061113DDF4340094DD56 /* strncat.c in Sources */,
+                               63D4061413DDF6A30094DD56 /* strlcat.c in Sources */,
+                               3F2208E914358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C645D1450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1B5146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9D9432B138DB73300FB7ACC /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9D94333138DB75B00FB7ACC /* forceLibcToBuild.c in Sources */,
+                               C965CBF2143BBEC7003912CE /* deps.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9D9435C138EC3E300FB7ACC /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9765EB2138EC61900741512 /* init_cpu_capabilities.c in Sources */,
+                               C9765EB3138EC61900741512 /* dyld_resolvers.c in Sources */,
+                               C9765EB4138EC61900741512 /* arm_commpage_gettimeofday.c in Sources */,
+                               C9765EB5138EC61900741512 /* gcc_atomic.c in Sources */,
+                               C9765EB6138EC61900741512 /* OSAtomic-v4.c in Sources */,
+                               C9765EB7138EC61900741512 /* OSAtomic_resolvers.c in Sources */,
+                               C9765EB9138EC61900741512 /* creat.c in Sources */,
+                               C9765EBA138EC61900741512 /* gethostid.c in Sources */,
+                               C9765EBB138EC61900741512 /* getwd.c in Sources */,
+                               C9765EBC138EC61900741512 /* killpg.c in Sources */,
+                               C9765EBD138EC61900741512 /* sethostid.c in Sources */,
+                               C9765EBE138EC61900741512 /* setpgrp.c in Sources */,
+                               C9765EBF138EC61900741512 /* setrgid.c in Sources */,
+                               C9765EC0138EC61900741512 /* setruid.c in Sources */,
+                               C9765EC1138EC61900741512 /* setregid.c in Sources */,
+                               C9765EC2138EC61900741512 /* setreuid.c in Sources */,
+                               C9765EC3138EC61900741512 /* sigaltstk.c in Sources */,
+                               C9765EC4138EC61900741512 /* sigcompat.c in Sources */,
+                               C9765EC5138EC61900741512 /* _dirhelper.c in Sources */,
+                               C9765EC7138EC61900741512 /* libproc.c in Sources */,
+                               C9765EC6138EC61900741512 /* kvm.c in Sources */,
+                               C9765EC8138EC61900741512 /* MKGetTimeBaseInfo.c in Sources */,
+                               C9765EC9138EC61900741512 /* proc_listpidspath.c in Sources */,
+                               C9765ECA138EC61900741512 /* forceLibcToBuild.c in Sources */,
+                               C9765ECB138EC61900741512 /* bt_close.c in Sources */,
+                               C9765ECC138EC61900741512 /* bt_conv.c in Sources */,
+                               C9765ECD138EC61900741512 /* bt_debug.c in Sources */,
+                               C9765ECE138EC61900741512 /* bt_delete.c in Sources */,
+                               C9765ECF138EC61900741512 /* bt_get.c in Sources */,
+                               C9765ED0138EC61900741512 /* bt_open.c in Sources */,
+                               C9765ED1138EC61900741512 /* bt_overflow.c in Sources */,
+                               C9765ED2138EC61900741512 /* bt_page.c in Sources */,
+                               C9765ED3138EC61900741512 /* bt_put.c in Sources */,
+                               C9765ED4138EC61900741512 /* bt_search.c in Sources */,
+                               C9765ED5138EC61900741512 /* bt_seq.c in Sources */,
+                               C9765ED6138EC61900741512 /* bt_split.c in Sources */,
+                               C9765ED7138EC61900741512 /* bt_utils.c in Sources */,
+                               C9765ED8138EC61900741512 /* db.c in Sources */,
+                               C9765ED9138EC61900741512 /* hash.c in Sources */,
+                               C9765EDA138EC61900741512 /* hash_bigkey.c in Sources */,
+                               C9765EDB138EC61900741512 /* hash_buf.c in Sources */,
+                               C9765EDC138EC61900741512 /* hash_func.c in Sources */,
+                               C9765EDD138EC61900741512 /* hash_log2.c in Sources */,
+                               C9765EDE138EC61900741512 /* hash_page.c in Sources */,
+                               C9765EDF138EC61900741512 /* ndbm.c in Sources */,
+                               C9765EE0138EC61900741512 /* mpool.c in Sources */,
+                               C9765EE1138EC61900741512 /* rec_close.c in Sources */,
+                               C9765EE2138EC61900741512 /* rec_delete.c in Sources */,
+                               C9765EE3138EC61900741512 /* rec_get.c in Sources */,
+                               C9765EE4138EC61900741512 /* rec_open.c in Sources */,
+                               C9765EE5138EC61900741512 /* rec_put.c in Sources */,
+                               C9765EE6138EC61900741512 /* rec_search.c in Sources */,
+                               C9765EE7138EC61900741512 /* rec_seq.c in Sources */,
+                               C9765EE8138EC61900741512 /* rec_utils.c in Sources */,
+                               C9765EE9138EC61900741512 /* brk.c in Sources */,
+                               C9765EEA138EC61900741512 /* bsd_signal.c in Sources */,
+                               C9765EEB138EC61900741512 /* lchflags.c in Sources */,
+                               C9765EEC138EC61900741512 /* lchmod.c in Sources */,
+                               C9765EED138EC61900741512 /* lutimes.c in Sources */,
+                               C9765EEE138EC61900741512 /* statvfs.c in Sources */,
+                               C9765EEF138EC61900741512 /* tcgetsid.c in Sources */,
+                               C9765EF0138EC61900741512 /* _ldbl_util.c in Sources */,
+                               C9765EF1138EC61900741512 /* _hdtoa.c in Sources */,
+                               C9765EF2138EC61900741512 /* _ldtoa.c in Sources */,
+                               C9765EF3138EC61900741512 /* gdtoa-dmisc.c in Sources */,
+                               C9765EF4138EC61900741512 /* gdtoa-dtoa.c in Sources */,
+                               C9765EF5138EC61900741512 /* gdtoa-gdtoa.c in Sources */,
+                               C9765EF6138EC61900741512 /* gdtoa-gethex.c in Sources */,
+                               C9765EF7138EC61900741512 /* gdtoa-gmisc.c in Sources */,
+                               C9765EF8138EC61900741512 /* gdtoa-hd_init.c in Sources */,
+                               C9765EF9138EC61900741512 /* gdtoa-hexnan.c in Sources */,
+                               C9765EFA138EC61900741512 /* gdtoa-misc.c in Sources */,
+                               C9765EFB138EC61900741512 /* gdtoa-smisc.c in Sources */,
+                               C9765EFC138EC61900741512 /* gdtoa-strtod.c in Sources */,
+                               C9765EFD138EC61900741512 /* gdtoa-strtodg.c in Sources */,
+                               C9765EFE138EC61900741512 /* gdtoa-strtof.c in Sources */,
+                               C9765EFF138EC61900741512 /* gdtoa-strtoIg.c in Sources */,
+                               C9765F00138EC61900741512 /* gdtoa-strtopdd.c in Sources */,
+                               C9765F01138EC61900741512 /* gdtoa-strtopx.c in Sources */,
+                               C9765F02138EC61900741512 /* gdtoa-strtord.c in Sources */,
+                               C9765F03138EC61900741512 /* gdtoa-sum.c in Sources */,
+                               C9765F04138EC61900741512 /* gdtoa-ulp.c in Sources */,
+                               C9765F05138EC61900741512 /* glue.c in Sources */,
+                               C9765F06138EC61900741512 /* machdep_ldisd.c in Sources */,
+                               C9765F07138EC61900741512 /* machdep_ldisdd.c in Sources */,
+                               C9765F08138EC61900741512 /* machdep_ldisQ.c in Sources */,
+                               C9765F09138EC61900741512 /* machdep_ldisx.c in Sources */,
+                               C9765F0A138EC61900741512 /* _simple.c in Sources */,
+                               C9765F0B138EC61900741512 /* asl.c in Sources */,
+                               C9765F0C138EC61900741512 /* asl_core.c in Sources */,
+                               C9765F0D138EC61900741512 /* asl_file.c in Sources */,
+                               C9765F0E138EC61900741512 /* asl_legacy1.c in Sources */,
+                               C9765F0F138EC61900741512 /* asl_msg.c in Sources */,
+                               C9765F10138EC61900741512 /* asl_store.c in Sources */,
+                               C9765F11138EC61900741512 /* asl_util.c in Sources */,
+                               C9765F12138EC61900741512 /* assumes.c in Sources */,
+                               C9765F13138EC61900741512 /* authentication.c in Sources */,
+                               C9765F14138EC61900741512 /* backtrace.c in Sources */,
+                               C9765F15138EC61900741512 /* cache.c in Sources */,
+                               C9765F16138EC61900741512 /* confstr.c in Sources */,
+                               C9765F17138EC61900741512 /* crypt.c in Sources */,
+                               C9765F18138EC61900741512 /* devname.c in Sources */,
+                               C9765F19138EC61900741512 /* disklabel.c in Sources */,
+                               C9765F1A138EC61900741512 /* errlst.c in Sources */,
+                               C9765F1B138EC61900741512 /* filesec.c in Sources */,
+                               C9765F1C138EC61900741512 /* _rand48.c in Sources */,
+                               C9765F1D138EC61900741512 /* alarm.c in Sources */,
+                               C9765F1E138EC61900741512 /* arc4random.c in Sources */,
+                               C9765F1F138EC61900741512 /* assert.c in Sources */,
+                               C9765F20138EC61900741512 /* basename.c in Sources */,
+                               C9765F21138EC61900741512 /* clock.c in Sources */,
+                               C9765F22138EC61900741512 /* closedir.c in Sources */,
+                               C9765F23138EC61900741512 /* ctermid.c in Sources */,
+                               C9765F24138EC61900741512 /* daemon.c in Sources */,
+                               C9765F25138EC61900741512 /* dirname.c in Sources */,
+                               C9765F26138EC61900741512 /* drand48.c in Sources */,
+                               C9765F27138EC61900741512 /* erand48.c in Sources */,
+                               C9765F28138EC61900741512 /* err.c in Sources */,
+                               C9765F29138EC61900741512 /* exec.c in Sources */,
+                               C9765F2A138EC61900741512 /* fmtcheck.c in Sources */,
+                               C9765F2B138EC61900741512 /* fmtmsg.c in Sources */,
+                               C9765F2C138EC61900741512 /* fnmatch.c in Sources */,
+                               C9765F2D138EC61900741512 /* ftok.c in Sources */,
+                               C9765F2E138EC61900741512 /* getbsize.c in Sources */,
+                               C9765F2F138EC61900741512 /* getcap.c in Sources */,
+                               C9765F30138EC61900741512 /* getcwd.c in Sources */,
+                               C9765F31138EC61900741512 /* gethostname.c in Sources */,
+                               C9765F32138EC61900741512 /* getlogin.c in Sources */,
+                               C9765F33138EC61900741512 /* getmntinfo.c in Sources */,
+                               C9765F34138EC61900741512 /* getpagesize.c in Sources */,
+                               C9765F35138EC61900741512 /* getpeereid.c in Sources */,
+                               C9765F36138EC61900741512 /* getprogname.c in Sources */,
+                               C9765F37138EC61900741512 /* glob.c in Sources */,
+                               C9765F38138EC61900741512 /* isatty.c in Sources */,
+                               C9765F39138EC61900741512 /* jrand48.c in Sources */,
+                               C9765F3A138EC61900741512 /* lcong48.c in Sources */,
+                               C9765F3B138EC61900741512 /* lockf.c in Sources */,
+                               C9765F3C138EC61900741512 /* lrand48.c in Sources */,
+                               C9765F3D138EC61900741512 /* mrand48.c in Sources */,
+                               C9765F3E138EC61900741512 /* nice.c in Sources */,
+                               C9765F3F138EC61900741512 /* nrand48.c in Sources */,
+                               C9765F40138EC61900741512 /* opendir.c in Sources */,
+                               C9765F41138EC61900741512 /* pause.c in Sources */,
+                               C9765F42138EC61900741512 /* popen.c in Sources */,
+                               C9765F43138EC61900741512 /* pselect.c in Sources */,
+                               C9765F44138EC61900741512 /* psignal.c in Sources */,
+                               C9765F45138EC61900741512 /* raise.c in Sources */,
+                               C9765F46138EC61900741512 /* readdir.c in Sources */,
+                               C9765F47138EC61900741512 /* readpassphrase.c in Sources */,
+                               C9765F48138EC61900741512 /* rewinddir.c in Sources */,
+                               C9765F49138EC61900741512 /* scandir.c in Sources */,
+                               C9765F4A138EC61900741512 /* seed48.c in Sources */,
+                               C9765F4B138EC61900741512 /* seekdir.c in Sources */,
+                               C9765F4C138EC61900741512 /* sethostname.c in Sources */,
+                               C9765F4D138EC61900741512 /* setmode.c in Sources */,
+                               C9765F4E138EC61900741512 /* setprogname.c in Sources */,
+                               C9765F4F138EC61900741512 /* siginterrupt.c in Sources */,
+                               C9765F50138EC61900741512 /* siglist.c in Sources */,
+                               C9765F51138EC61900741512 /* signal.c in Sources */,
+                               C9765F52138EC61900741512 /* sleep.c in Sources */,
+                               C9765F53138EC61900741512 /* srand48.c in Sources */,
+                               C9765F54138EC61900741512 /* stringlist.c in Sources */,
+                               C9765F55138EC61900741512 /* sysconf.c in Sources */,
+                               C9765F56138EC61900741512 /* sysctl.c in Sources */,
+                               C9765F57138EC61900741512 /* sysctlbyname.c in Sources */,
+                               C9765F58138EC61900741512 /* sysctlnametomib.c in Sources */,
+                               C9765F59138EC61900741512 /* telldir.c in Sources */,
+                               C9765F5A138EC61900741512 /* termios.c in Sources */,
+                               C9765F5B138EC61900741512 /* time.c in Sources */,
+                               C9765F5C138EC61900741512 /* times.c in Sources */,
+                               C9765F5D138EC61900741512 /* timezone.c in Sources */,
+                               C9765F5E138EC61900741512 /* ttyname.c in Sources */,
+                               C9765F5F138EC61900741512 /* ttyslot.c in Sources */,
+                               C9765F60138EC61900741512 /* ualarm.c in Sources */,
+                               C9765F61138EC61900741512 /* ulimit.c in Sources */,
+                               C9765F62138EC61900741512 /* unvis.c in Sources */,
+                               C9765F63138EC61900741512 /* usleep.c in Sources */,
+                               C9765F64138EC61900741512 /* utime.c in Sources */,
+                               C9765F65138EC61900741512 /* vis.c in Sources */,
+                               C9765F66138EC61900741512 /* wait.c in Sources */,
+                               C9765F67138EC61900741512 /* wait3.c in Sources */,
+                               C9765F68138EC61900741512 /* waitpid.c in Sources */,
+                               C9765F69138EC61900741512 /* fts.c in Sources */,
+                               C9765F6A138EC61900741512 /* get_compat.c in Sources */,
+                               C9765F6B138EC61900741512 /* getloadavg.c in Sources */,
+                               C9765F6C138EC61900741512 /* getttyent.c in Sources */,
+                               C9765F6D138EC61900741512 /* getusershell.c in Sources */,
+                               C9765F6E138EC61900741512 /* getvfsbyname.c in Sources */,
+                               C9765F6F138EC61900741512 /* isinf.c in Sources */,
+                               C9765F70138EC61900741512 /* isnan.c in Sources */,
+                               C9765F71138EC61900741512 /* magazine_malloc.c in Sources */,
+                               C9765F72138EC61900741512 /* malloc.c in Sources */,
+                               C9765F73138EC61900741512 /* nanosleep.c in Sources */,
+                               C9765F74138EC61900741512 /* utmpx.c in Sources */,
+                               C9765F75138EC61900741512 /* nftw.c in Sources */,
+                               C9765F76138EC61900741512 /* nlist.c in Sources */,
+                               C9765F77138EC61900741512 /* NSSystemDirectories.c in Sources */,
+                               C9765F78138EC61900741512 /* oldsyslog.c in Sources */,
+                               C9765F79138EC61900741512 /* platfunc.c in Sources */,
+                               C9765F7A138EC61900741512 /* scalable_malloc.c in Sources */,
+                               C9765F7B138EC61900741512 /* setlogin.c in Sources */,
+                               C9765F7C138EC61900741512 /* sigsetops.c in Sources */,
+                               C9765F7D138EC61900741512 /* stack_logging.c in Sources */,
+                               C9765F7E138EC61900741512 /* stack_logging_disk.c in Sources */,
+                               C9765F7F138EC61900741512 /* strtofflags.c in Sources */,
+                               C9765F80138EC61900741512 /* syslog.c in Sources */,
+                               C9765F81138EC61900741512 /* thread_stack_pcs.c in Sources */,
+                               C9765F82138EC61900741512 /* uname.c in Sources */,
+                               C9765F83138EC61900741512 /* utmpx-darwin.c in Sources */,
+                               C9765F84138EC61900741512 /* wordexp.c in Sources */,
+                               C9765F86138EC61900741512 /* gmon.c in Sources */,
+                               C9765F87138EC61900741512 /* getmcontext.c in Sources */,
+                               C9765F88138EC61900741512 /* makecontext.c in Sources */,
+                               C9765F89138EC61900741512 /* setcontext.c in Sources */,
+                               C9765F8A138EC61900741512 /* setjmperr.c in Sources */,
+                               C9765F8B138EC61900741512 /* swapcontext.c in Sources */,
+                               C9765F8C138EC61900741512 /* init_cpu_capabilities.c in Sources */,
+                               C9765F8D138EC61900741512 /* bcopy.c in Sources */,
+                               C9765F8E138EC61900741512 /* bzero.c in Sources */,
+                               C9765F8F138EC61900741512 /* memcpy.c in Sources */,
+                               C9765F90138EC61900741512 /* memmove.c in Sources */,
+                               C9765F91138EC61900741512 /* atomic.c in Sources */,
+                               C9765F92138EC61900741512 /* mach_absolute_time.c in Sources */,
+                               C9765F93138EC61900741512 /* spinlocks.c in Sources */,
+                               C9765FA6138EC61900741512 /* ascii.c in Sources */,
+                               C9765FA7138EC61900741512 /* big5.c in Sources */,
+                               C9765FA8138EC61900741512 /* btowc.c in Sources */,
+                               C9765FA9138EC61900741512 /* collate.c in Sources */,
+                               C9765FAA138EC61900741512 /* collcmp.c in Sources */,
+                               C9765FAB138EC61900741512 /* euc.c in Sources */,
+                               C9765FAC138EC61900741512 /* fix_grouping.c in Sources */,
+                               C9765FAD138EC61900741512 /* gb18030.c in Sources */,
+                               C9765FAE138EC61900741512 /* gb2312.c in Sources */,
+                               C9765FAF138EC61900741512 /* gbk.c in Sources */,
+                               C9765FB0138EC61900741512 /* ldpart.c in Sources */,
+                               C9765FB1138EC61900741512 /* lmessages.c in Sources */,
+                               C9765FB2138EC61900741512 /* lmonetary.c in Sources */,
+                               C9765FB3138EC61900741512 /* lnumeric.c in Sources */,
+                               C9765FB4138EC61900741512 /* localeconv.c in Sources */,
+                               C9765FB5138EC61900741512 /* mblen.c in Sources */,
+                               C9765FB6138EC61900741512 /* mbrlen.c in Sources */,
+                               C9765FB7138EC61900741512 /* mbrtowc.c in Sources */,
+                               C9765FB8138EC61900741512 /* mbsinit.c in Sources */,
+                               C9765FB9138EC61900741512 /* mbsnrtowcs.c in Sources */,
+                               C9765FBA138EC61900741512 /* mbsrtowcs.c in Sources */,
+                               C9765FBB138EC61900741512 /* mbstowcs.c in Sources */,
+                               C9765FBC138EC61900741512 /* mbtowc.c in Sources */,
+                               C9765FBD138EC61900741512 /* mskanji.c in Sources */,
+                               C9765FBE138EC61900741512 /* nextwctype.c in Sources */,
+                               C9765FBF138EC61900741512 /* nl_langinfo.c in Sources */,
+                               C9765FC0138EC61900741512 /* nomacros.c in Sources */,
+                               C9765FC1138EC61900741512 /* none.c in Sources */,
+                               C9765FC2138EC61900741512 /* rune.c in Sources */,
+                               C9765FC3138EC61900741512 /* runetype.c in Sources */,
+                               C9765FC4138EC61900741512 /* setlocale.c in Sources */,
+                               C9765FC5138EC61900741512 /* setrunelocale.c in Sources */,
+                               C9765FC6138EC61900741512 /* table.c in Sources */,
+                               C9765FC7138EC61900741512 /* tolower.c in Sources */,
+                               C9765FC8138EC61900741512 /* toupper.c in Sources */,
+                               C9765FC9138EC61900741512 /* utf2.c in Sources */,
+                               C9765FCA138EC61900741512 /* utf8.c in Sources */,
+                               C9765FCB138EC61900741512 /* wcrtomb.c in Sources */,
+                               C9765FCC138EC61900741512 /* wcsftime.c in Sources */,
+                               C9765FCD138EC61900741512 /* wcsnrtombs.c in Sources */,
+                               C9765FCE138EC61900741512 /* wcsrtombs.c in Sources */,
+                               C9765FCF138EC61900741512 /* wcstod.c in Sources */,
+                               C9765FD0138EC61900741512 /* wcstof.c in Sources */,
+                               C9765FD1138EC61900741512 /* wcstoimax.c in Sources */,
+                               C9765FD2138EC61900741512 /* wcstol.c in Sources */,
+                               C9765FD3138EC61900741512 /* wcstold.c in Sources */,
+                               C9765FD4138EC61900741512 /* wcstoll.c in Sources */,
+                               C9765FD5138EC61900741512 /* wcstombs.c in Sources */,
+                               C9765FD6138EC61900741512 /* wcstoul.c in Sources */,
+                               C9765FD7138EC61900741512 /* wcstoull.c in Sources */,
+                               C9765FD8138EC61900741512 /* wcstoumax.c in Sources */,
+                               C9765FD9138EC61900741512 /* wctob.c in Sources */,
+                               C9765FDA138EC61900741512 /* wctomb.c in Sources */,
+                               C9765FDB138EC61900741512 /* wctrans.c in Sources */,
+                               C9765FDC138EC61900741512 /* wctype.c in Sources */,
+                               C9765FDD138EC61900741512 /* wcwidth.c in Sources */,
+                               C9765FDE138EC61900741512 /* frune.c in Sources */,
+                               C9765FDF138EC61900741512 /* isctype.c in Sources */,
+                               C9765FE0138EC61900741512 /* iswctype.c in Sources */,
+                               C9765FE1138EC61900741512 /* lconv.c in Sources */,
+                               C9765FE2138EC61900741512 /* mbrune.c in Sources */,
+                               C9765FE3138EC61900741512 /* runedepreciated.c in Sources */,
+                               C9765FE4138EC61900741512 /* setinvalidrune.c in Sources */,
+                               C9765FE5138EC61900741512 /* xlocale.c in Sources */,
+                               C9765FE6138EC61900741512 /* addr2ascii.c in Sources */,
+                               C9765FE7138EC61900741512 /* ascii2addr.c in Sources */,
+                               C9765FE8138EC61900741512 /* inet_addr.c in Sources */,
+                               C9765FE9138EC61900741512 /* inet_lnaof.c in Sources */,
+                               C9765FEA138EC61900741512 /* inet_makeaddr.c in Sources */,
+                               C9765FEB138EC61900741512 /* inet_net_ntop.c in Sources */,
+                               C9765FEC138EC61900741512 /* inet_net_pton.c in Sources */,
+                               C9765FED138EC61900741512 /* inet_neta.c in Sources */,
+                               C9765FEE138EC61900741512 /* inet_netof.c in Sources */,
+                               C9765FEF138EC61900741512 /* inet_network.c in Sources */,
+                               C9765FF0138EC61900741512 /* inet_ntoa.c in Sources */,
+                               C9765FF1138EC61900741512 /* linkaddr.c in Sources */,
+                               C9765FF2138EC61900741512 /* nsap_addr.c in Sources */,
+                               C9765FF3138EC61900741512 /* recv.c in Sources */,
+                               C9765FF4138EC61900741512 /* send.c in Sources */,
+                               C9765FF5138EC61900741512 /* sockatmark.c in Sources */,
+                               C9765FF6138EC61900741512 /* sourcefilter.c in Sources */,
+                               C9765FF7138EC61900741512 /* msgcat.c in Sources */,
+                               C9765FF8138EC61900741512 /* acl.c in Sources */,
+                               C9765FF9138EC61900741512 /* acl_entry.c in Sources */,
+                               C9765FFA138EC61900741512 /* acl_file.c in Sources */,
+                               C9765FFB138EC61900741512 /* acl_flag.c in Sources */,
+                               C9765FFC138EC61900741512 /* acl_perm.c in Sources */,
+                               C9765FFD138EC61900741512 /* acl_translate.c in Sources */,
+                               C9766006138EC61900741512 /* mk_pthread_impl.c in Sources */,
+                               C9766007138EC61900741512 /* pthread.c in Sources */,
+                               C9766008138EC61900741512 /* pthread_cancelable.c in Sources */,
+                               C9766009138EC61900741512 /* pthread_cond.c in Sources */,
+                               C976600A138EC61900741512 /* pthread_mutex.c in Sources */,
+                               C976600B138EC61900741512 /* pthread_rwlock.c in Sources */,
+                               C976600C138EC61900741512 /* pthread_tsd.c in Sources */,
+                               C976600D138EC61900741512 /* pthread_atfork_test.c in Sources */,
+                               C976600E138EC61900741512 /* thread_setup.c in Sources */,
+                               C9766011138EC61900741512 /* regerror.c in Sources */,
+                               C9766014138EC61900741512 /* chk_fail.c in Sources */,
+                               C9766015138EC61900741512 /* memcpy_chk.c in Sources */,
+                               C9766016138EC61900741512 /* memmove_chk.c in Sources */,
+                               C9766017138EC61900741512 /* memset_chk.c in Sources */,
+                               C9766018138EC61900741512 /* snprintf_chk.c in Sources */,
+                               C9766019138EC61900741512 /* sprintf_chk.c in Sources */,
+                               C976601A138EC61A00741512 /* stpcpy_chk.c in Sources */,
+                               C976601B138EC61A00741512 /* stpncpy_chk.c in Sources */,
+                               C976601C138EC61A00741512 /* strcat_chk.c in Sources */,
+                               C976601D138EC61A00741512 /* strcpy_chk.c in Sources */,
+                               C976601E138EC61A00741512 /* strncat_chk.c in Sources */,
+                               C976601F138EC61A00741512 /* strncpy_chk.c in Sources */,
+                               C9766020138EC61A00741512 /* vsnprintf_chk.c in Sources */,
+                               C9766021138EC61A00741512 /* vsprintf_chk.c in Sources */,
+                               C9766022138EC61A00741512 /* _flock_stub.c in Sources */,
+                               C9766023138EC61A00741512 /* asprintf.c in Sources */,
+                               C9766024138EC61A00741512 /* clrerr.c in Sources */,
+                               C9766025138EC61A00741512 /* dprintf.c in Sources */,
+                               C9766026138EC61A00741512 /* fclose.c in Sources */,
+                               C9766027138EC61A00741512 /* fdopen.c in Sources */,
+                               C9766028138EC61A00741512 /* feof.c in Sources */,
+                               C9766029138EC61A00741512 /* ferror.c in Sources */,
+                               C976602A138EC61A00741512 /* fflush.c in Sources */,
+                               C976602B138EC61A00741512 /* fgetc.c in Sources */,
+                               C976602C138EC61A00741512 /* fgetln.c in Sources */,
+                               C976602D138EC61A00741512 /* fgetpos.c in Sources */,
+                               C976602E138EC61A00741512 /* fgets.c in Sources */,
+                               C976602F138EC61A00741512 /* fgetwc.c in Sources */,
+                               C9766030138EC61A00741512 /* fgetwln.c in Sources */,
+                               C9766031138EC61A00741512 /* fgetws.c in Sources */,
+                               C9766032138EC61A00741512 /* fileno.c in Sources */,
+                               C9766033138EC61A00741512 /* findfp.c in Sources */,
+                               C9766034138EC61A00741512 /* flags.c in Sources */,
+                               C9766035138EC61A00741512 /* fopen.c in Sources */,
+                               C9766036138EC61A00741512 /* fprintf.c in Sources */,
+                               C9766037138EC61A00741512 /* fpurge.c in Sources */,
+                               C9766038138EC61A00741512 /* fputc.c in Sources */,
+                               C9766039138EC61A00741512 /* fputs.c in Sources */,
+                               C976603A138EC61A00741512 /* fputwc.c in Sources */,
+                               C976603B138EC61A00741512 /* fputws.c in Sources */,
+                               C976603C138EC61A00741512 /* fread.c in Sources */,
+                               C976603D138EC61A00741512 /* freopen.c in Sources */,
+                               C976603E138EC61A00741512 /* fscanf.c in Sources */,
+                               C976603F138EC61A00741512 /* fseek.c in Sources */,
+                               C9766040138EC61A00741512 /* fsetpos.c in Sources */,
+                               C9766041138EC61A00741512 /* ftell.c in Sources */,
+                               C9766042138EC61A00741512 /* funopen.c in Sources */,
+                               C9766043138EC61A00741512 /* fvwrite.c in Sources */,
+                               C9766044138EC61A00741512 /* fwalk.c in Sources */,
+                               C9766045138EC61A00741512 /* fwide.c in Sources */,
+                               C9766046138EC61A00741512 /* fwprintf.c in Sources */,
+                               C9766047138EC61A00741512 /* fwrite.c in Sources */,
+                               C9766048138EC61A00741512 /* fwscanf.c in Sources */,
+                               C9766049138EC61A00741512 /* getc.c in Sources */,
+                               C976604A138EC61A00741512 /* getchar.c in Sources */,
+                               C976604B138EC61A00741512 /* getdelim.c in Sources */,
+                               C976604C138EC61A00741512 /* getline.c in Sources */,
+                               C976604D138EC61A00741512 /* gets.c in Sources */,
+                               C976604E138EC61A00741512 /* getw.c in Sources */,
+                               C976604F138EC61A00741512 /* getwc.c in Sources */,
+                               C9766050138EC61A00741512 /* getwchar.c in Sources */,
+                               C9766051138EC61A00741512 /* makebuf.c in Sources */,
+                               C9766052138EC61A00741512 /* mktemp.c in Sources */,
+                               C9766053138EC61A00741512 /* perror.c in Sources */,
+                               C9766054138EC61A00741512 /* printf-pos.c in Sources */,
+                               C9766055138EC61A00741512 /* printf.c in Sources */,
+                               C9766056138EC61A00741512 /* putc.c in Sources */,
+                               C9766057138EC61A00741512 /* putchar.c in Sources */,
+                               C9766058138EC61A00741512 /* puts.c in Sources */,
+                               C9766059138EC61A00741512 /* putw.c in Sources */,
+                               C976605A138EC61A00741512 /* putwc.c in Sources */,
+                               C976605B138EC61A00741512 /* putwchar.c in Sources */,
+                               C976605C138EC61A00741512 /* refill.c in Sources */,
+                               C976605D138EC61A00741512 /* remove.c in Sources */,
+                               C976605E138EC61A00741512 /* rewind.c in Sources */,
+                               C976605F138EC61A00741512 /* rget.c in Sources */,
+                               C9766060138EC61A00741512 /* scanf.c in Sources */,
+                               C9766061138EC61A00741512 /* setbuf.c in Sources */,
+                               C9766062138EC61A00741512 /* setbuffer.c in Sources */,
+                               C9766063138EC61A00741512 /* setvbuf.c in Sources */,
+                               C9766064138EC61A00741512 /* snprintf.c in Sources */,
+                               C9766065138EC61A00741512 /* sprintf.c in Sources */,
+                               C9766066138EC61A00741512 /* sscanf.c in Sources */,
+                               C9766067138EC61A00741512 /* stdio.c in Sources */,
+                               C9766068138EC61A00741512 /* swprintf.c in Sources */,
+                               C9766069138EC61A00741512 /* swscanf.c in Sources */,
+                               C976606A138EC61A00741512 /* tempnam.c in Sources */,
+                               C976606B138EC61A00741512 /* tmpfile.c in Sources */,
+                               C976606C138EC61A00741512 /* tmpnam.c in Sources */,
+                               C976606D138EC61A00741512 /* ungetc.c in Sources */,
+                               C976606E138EC61A00741512 /* ungetwc.c in Sources */,
+                               C976606F138EC61A00741512 /* vasprintf.c in Sources */,
+                               C9766070138EC61A00741512 /* vdprintf.c in Sources */,
+                               C9766071138EC61A00741512 /* vfprintf.c in Sources */,
+                               C9766072138EC61A00741512 /* vfscanf.c in Sources */,
+                               C9766073138EC61A00741512 /* vfwprintf.c in Sources */,
+                               C9766074138EC61A00741512 /* vfwscanf.c in Sources */,
+                               C9766075138EC61A00741512 /* vprintf.c in Sources */,
+                               C9766076138EC61A00741512 /* vscanf.c in Sources */,
+                               C9766077138EC61A00741512 /* vsnprintf.c in Sources */,
+                               C9766078138EC61A00741512 /* vsprintf.c in Sources */,
+                               C9766079138EC61A00741512 /* vsscanf.c in Sources */,
+                               C976607A138EC61A00741512 /* vswprintf.c in Sources */,
+                               C976607B138EC61A00741512 /* vswscanf.c in Sources */,
+                               C976607C138EC61A00741512 /* vwprintf.c in Sources */,
+                               C976607D138EC61A00741512 /* vwscanf.c in Sources */,
+                               C976607E138EC61A00741512 /* wbuf.c in Sources */,
+                               C976607F138EC61A00741512 /* wprintf.c in Sources */,
+                               C9766080138EC61A00741512 /* wscanf.c in Sources */,
+                               C9766081138EC61A00741512 /* wsetup.c in Sources */,
+                               C9766082138EC61A00741512 /* a64l.c in Sources */,
+                               C9766083138EC61A00741512 /* _Exit_.c in Sources */,
+                               C9766084138EC61A00741512 /* abort.c in Sources */,
+                               C9766085138EC61A00741512 /* abs.c in Sources */,
+                               C9766086138EC61A00741512 /* atexit.c in Sources */,
+                               C9766087138EC61A00741512 /* atof.c in Sources */,
+                               C9766088138EC61A00741512 /* atoi.c in Sources */,
+                               C9766089138EC61A00741512 /* atol.c in Sources */,
+                               C976608A138EC61A00741512 /* atoll.c in Sources */,
+                               C976608B138EC61A00741512 /* bsearch.c in Sources */,
+                               C976608C138EC61A00741512 /* div.c in Sources */,
+                               C976608D138EC61A00741512 /* exit.c in Sources */,
+                               C976608E138EC61A00741512 /* getenv.c in Sources */,
+                               C976608F138EC61A00741512 /* getopt.c in Sources */,
+                               C9766090138EC61A00741512 /* getopt_long.c in Sources */,
+                               C9766091138EC61A00741512 /* getsubopt.c in Sources */,
+                               C9766092138EC61A00741512 /* hcreate.c in Sources */,
+                               C9766093138EC61A00741512 /* heapsort.c in Sources */,
+                               C9766094138EC61A00741512 /* heapsort_b.c in Sources */,
+                               C9766095138EC61A00741512 /* heapsort_r.c in Sources */,
+                               C9766096138EC61A00741512 /* imaxabs.c in Sources */,
+                               C9766097138EC61A00741512 /* imaxdiv.c in Sources */,
+                               C9766098138EC61A00741512 /* insque.c in Sources */,
+                               C9766099138EC61A00741512 /* labs.c in Sources */,
+                               C976609A138EC61A00741512 /* ldiv.c in Sources */,
+                               C976609B138EC61A00741512 /* llabs.c in Sources */,
+                               C976609C138EC61A00741512 /* lldiv.c in Sources */,
+                               C976609D138EC61A00741512 /* lsearch.c in Sources */,
+                               C976609E138EC61A00741512 /* merge.c in Sources */,
+                               C976609F138EC61A00741512 /* putenv.c in Sources */,
+                               C97660A0138EC61A00741512 /* qsort.c in Sources */,
+                               C97660A1138EC61A00741512 /* qsort_r.c in Sources */,
+                               C97660A2138EC61A00741512 /* radixsort.c in Sources */,
+                               C97660A3138EC61A00741512 /* rand.c in Sources */,
+                               C97660A4138EC61A00741512 /* random.c in Sources */,
+                               C97660A5138EC61A00741512 /* reallocf.c in Sources */,
+                               C97660A6138EC61A00741512 /* realpath.c in Sources */,
+                               C97660A7138EC61A00741512 /* remque.c in Sources */,
+                               C97660A8138EC61A00741512 /* setenv.c in Sources */,
+                               C97660A9138EC61A00741512 /* strhash.c in Sources */,
+                               C97660AA138EC61A00741512 /* strtoimax.c in Sources */,
+                               C97660AB138EC61A00741512 /* strtol.c in Sources */,
+                               C97660AC138EC61A00741512 /* strtoll.c in Sources */,
+                               C97660AD138EC61A00741512 /* strtoq.c in Sources */,
+                               C97660AE138EC61A00741512 /* strtoul.c in Sources */,
+                               C97660AF138EC61A00741512 /* strtoull.c in Sources */,
+                               C97660B0138EC61A00741512 /* strtoumax.c in Sources */,
+                               C97660B1138EC61A00741512 /* strtouq.c in Sources */,
+                               C97660B2138EC61A00741512 /* system.c in Sources */,
+                               C97660B3138EC61A00741512 /* tdelete.c in Sources */,
+                               C97660B4138EC61A00741512 /* tfind.c in Sources */,
+                               C97660B5138EC61A00741512 /* tsearch.c in Sources */,
+                               C97660B6138EC61A00741512 /* twalk.c in Sources */,
+                               C97660B7138EC61A00741512 /* grantpt.c in Sources */,
+                               C97660B8138EC61A00741512 /* l64a.c in Sources */,
+                               C97660B9138EC61A00741512 /* strfmon.c in Sources */,
+                               C97660BA138EC61A00741512 /* ecvt.c in Sources */,
+                               C97660BB138EC61A00741512 /* gcvt.c in Sources */,
+                               C97660BC138EC61A00741512 /* qsort_b-fbsd.c in Sources */,
+                               C97660BD138EC61A00741512 /* asctime.c in Sources */,
+                               C97660BE138EC61A00741512 /* difftime.c in Sources */,
+                               C97660BF138EC61A00741512 /* ftime.c in Sources */,
+                               C97660C0138EC61A00741512 /* localtime.c in Sources */,
+                               C97660C1138EC61A00741512 /* strftime.c in Sources */,
+                               C97660C2138EC61A00741512 /* strptime.c in Sources */,
+                               C97660C3138EC61A00741512 /* time32.c in Sources */,
+                               C97660C4138EC61A00741512 /* timelocal.c in Sources */,
+                               C97660C5138EC61A00741512 /* getdate.c in Sources */,
+                               C97660C6138EC61A00741512 /* timezone_unix03.c in Sources */,
+                               C97660C7138EC61A00741512 /* bcmp.c in Sources */,
+                               C97660C8138EC61A00741512 /* bcopy.c in Sources */,
+                               C97660C9138EC61A00741512 /* bzero.c in Sources */,
+                               C97660CA138EC61A00741512 /* index.c in Sources */,
+                               C97660CB138EC61A00741512 /* memccpy.c in Sources */,
+                               C97660CC138EC61A00741512 /* memchr.c in Sources */,
+                               C97660CD138EC61A00741512 /* memcmp.c in Sources */,
+                               C97660CE138EC61A00741512 /* memcpy.c in Sources */,
+                               C97660CF138EC61A00741512 /* memmem.c in Sources */,
+                               C97660D0138EC61A00741512 /* memmove.c in Sources */,
+                               C97660D1138EC61A00741512 /* memset.c in Sources */,
+                               C97660D2138EC61A00741512 /* rindex.c in Sources */,
+                               C97660D5138EC61A00741512 /* strcasecmp.c in Sources */,
+                               C97660D6138EC61A00741512 /* strcasestr.c in Sources */,
+                               C97660D8138EC61A00741512 /* strchr.c in Sources */,
+                               C97660D9138EC61A00741512 /* strcmp.c in Sources */,
+                               C97660DA138EC61A00741512 /* strcoll.c in Sources */,
+                               C97660DC138EC61A00741512 /* strcspn.c in Sources */,
+                               C97660DD138EC61A00741512 /* strdup.c in Sources */,
+                               C97660DE138EC61A00741512 /* strerror.c in Sources */,
+                               C97660E1138EC61A00741512 /* strlen.c in Sources */,
+                               C97660E2138EC61A00741512 /* strmode.c in Sources */,
+                               C97660E4138EC61A00741512 /* strncmp.c in Sources */,
+                               C97660E6138EC61A00741512 /* strndup.c in Sources */,
+                               C97660E7138EC61A00741512 /* strnlen.c in Sources */,
+                               C97660E8138EC61A00741512 /* strnstr.c in Sources */,
+                               C97660E9138EC61A00741512 /* strpbrk.c in Sources */,
+                               C97660EA138EC61A00741512 /* strrchr.c in Sources */,
+                               C97660EB138EC61A00741512 /* strsep.c in Sources */,
+                               C97660EC138EC61A00741512 /* strsignal.c in Sources */,
+                               C97660ED138EC61A00741512 /* strspn.c in Sources */,
+                               C97660EE138EC61A00741512 /* strstr.c in Sources */,
+                               C97660EF138EC61A00741512 /* strtok.c in Sources */,
+                               C97660F0138EC61A00741512 /* strxfrm.c in Sources */,
+                               C97660F1138EC61A00741512 /* swab.c in Sources */,
+                               C97660F2138EC61A00741512 /* wcpcpy.c in Sources */,
+                               C97660F3138EC61A00741512 /* wcpncpy.c in Sources */,
+                               C97660F4138EC61A00741512 /* wcscasecmp.c in Sources */,
+                               C97660F5138EC61A00741512 /* wcscat.c in Sources */,
+                               C97660F6138EC61A00741512 /* wcschr.c in Sources */,
+                               C97660F7138EC61A00741512 /* wcscmp.c in Sources */,
+                               C97660F8138EC61A00741512 /* wcscoll.c in Sources */,
+                               C97660F9138EC61A00741512 /* wcscpy.c in Sources */,
+                               C97660FA138EC61A00741512 /* wcscspn.c in Sources */,
+                               C97660FB138EC61A00741512 /* wcsdup.c in Sources */,
+                               C97660FC138EC61A00741512 /* wcslcat.c in Sources */,
+                               C97660FD138EC61A00741512 /* wcslcpy.c in Sources */,
+                               C97660FE138EC61A00741512 /* wcslen.c in Sources */,
+                               C97660FF138EC61A00741512 /* wcsncasecmp.c in Sources */,
+                               C9766100138EC61A00741512 /* wcsncat.c in Sources */,
+                               C9766101138EC61A00741512 /* wcsncmp.c in Sources */,
+                               C9766102138EC61A00741512 /* wcsncpy.c in Sources */,
+                               C9766103138EC61A00741512 /* wcsnlen.c in Sources */,
+                               C9766104138EC61A00741512 /* wcspbrk.c in Sources */,
+                               C9766105138EC61A00741512 /* wcsrchr.c in Sources */,
+                               C9766106138EC61A00741512 /* wcsspn.c in Sources */,
+                               C9766107138EC61A00741512 /* wcsstr.c in Sources */,
+                               C9766108138EC61A00741512 /* wcstok.c in Sources */,
+                               C9766109138EC61A00741512 /* wcswidth.c in Sources */,
+                               C976610A138EC61A00741512 /* wcsxfrm.c in Sources */,
+                               C976610B138EC61A00741512 /* wmemchr.c in Sources */,
+                               C976610C138EC61A00741512 /* wmemcmp.c in Sources */,
+                               C976610D138EC61A00741512 /* wmemcpy.c in Sources */,
+                               C976610E138EC61A00741512 /* wmemmove.c in Sources */,
+                               C976610F138EC61A00741512 /* wmemset.c in Sources */,
+                               C9766110138EC61A00741512 /* __libc_init.c in Sources */,
+                               C9766111138EC61A00741512 /* _libc_fork_child.c in Sources */,
+                               C9766112138EC61A00741512 /* chmodx_np.c in Sources */,
+                               C9766113138EC61A00741512 /* context-stubs.c in Sources */,
+                               C9766114138EC61A00741512 /* crt_externs.c in Sources */,
+                               C9766115138EC61A00741512 /* errno.c in Sources */,
+                               C9766116138EC61A00741512 /* fork.c in Sources */,
+                               C9766117138EC61A00741512 /* getgroups.c in Sources */,
+                               C9766118138EC61A00741512 /* getiopolicy_np.c in Sources */,
+                               C9766119138EC61A00741512 /* gettimeofday.c in Sources */,
+                               C976611A138EC61A00741512 /* msgctl.c in Sources */,
+                               C976611B138EC61A00741512 /* stack_protector.c in Sources */,
+                               C976611C138EC61A00741512 /* openx_np.c in Sources */,
+                               C976611D138EC61A00741512 /* OSMemoryNotification.c in Sources */,
+                               C976611E138EC61A00741512 /* OSThermalNotification.c in Sources */,
+                               C976611F138EC61A00741512 /* posix_spawn.c in Sources */,
+                               C9766120138EC61A00741512 /* semctl.c in Sources */,
+                               C9766121138EC61A00741512 /* settimeofday.c in Sources */,
+                               C9766122138EC61A00741512 /* shmctl.c in Sources */,
+                               C9766123138EC61A00741512 /* sigaction.c in Sources */,
+                               C9766124138EC61A00741512 /* sigcatch.c in Sources */,
+                               C9766125138EC61A00741512 /* sigtramp.c in Sources */,
+                               C9766126138EC61A00741512 /* slot_name.c in Sources */,
+                               C9766127138EC61A00741512 /* statx_np.c in Sources */,
+                               C9766128138EC61A00741512 /* umaskx_np.c in Sources */,
+                               C9766129138EC61A00741512 /* cprocs.c in Sources */,
+                               C976612A138EC61A00741512 /* cthreads.c in Sources */,
+                               C976612B138EC61A00741512 /* mig_support.c in Sources */,
+                               C976612C138EC61A00741512 /* fparseln.c in Sources */,
+                               C976612D138EC61A00741512 /* login.c in Sources */,
+                               C976612E138EC61A00741512 /* login_tty.c in Sources */,
+                               C976612F138EC61A00741512 /* logout.c in Sources */,
+                               C9766130138EC61A00741512 /* logwtmp.c in Sources */,
+                               3F76864F13E91D6700C94D25 /* mkpath_np.c in Sources */,
+                               C9766131138EC61A00741512 /* opendev.c in Sources */,
+                               C9766132138EC61A00741512 /* pty.c in Sources */,
+                               C9766133138EC61A00741512 /* clear.c in Sources */,
+                               C9766134138EC61A00741512 /* compare.c in Sources */,
+                               C9766135138EC61A00741512 /* copy.c in Sources */,
+                               C9766136138EC61A00741512 /* gen_uuid.c in Sources */,
+                               C9766137138EC61A00741512 /* isnull.c in Sources */,
+                               C9766138138EC61A00741512 /* pack.c in Sources */,
+                               C9766139138EC61A00741512 /* parse.c in Sources */,
+                               C976613A138EC61A00741512 /* unpack.c in Sources */,
+                               C976613B138EC61A00741512 /* unparse.c in Sources */,
+                               C976613C138EC61A00741512 /* getmcontext.c in Sources */,
+                               C976613D138EC61A00741512 /* makecontext.c in Sources */,
+                               C976613E138EC61A00741512 /* setcontext.c in Sources */,
+                               C976613F138EC61A00741512 /* swapcontext.c in Sources */,
+                               C9766140138EC61A00741512 /* bcopy.c in Sources */,
+                               C9766141138EC61A00741512 /* bzero.c in Sources */,
+                               C9766142138EC61A00741512 /* memcpy.c in Sources */,
+                               C9766143138EC61A00741512 /* memmove.c in Sources */,
+                               C9766144138EC61A00741512 /* atomic.c in Sources */,
+                               C9766145138EC61A00741512 /* spinlocks.c in Sources */,
+                               3F2208EA14358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C645E1450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1B6146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9EB2FCC138F6D880075BB52 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9EB2FCD138F6D880075BB52 /* init_cpu_capabilities.c in Sources */,
+                               C9EB2FCE138F6D880075BB52 /* dyld_resolvers.c in Sources */,
+                               C9EB2FCF138F6D880075BB52 /* arm_commpage_gettimeofday.c in Sources */,
+                               C9EB2FD0138F6D880075BB52 /* gcc_atomic.c in Sources */,
+                               C9EB2FD1138F6D880075BB52 /* OSAtomic-v4.c in Sources */,
+                               C9EB2FD2138F6D880075BB52 /* OSAtomic_resolvers.c in Sources */,
+                               C9EB2FD4138F6D880075BB52 /* creat.c in Sources */,
+                               C9EB2FD5138F6D880075BB52 /* gethostid.c in Sources */,
+                               C9EB2FD6138F6D880075BB52 /* getwd.c in Sources */,
+                               C9EB2FD7138F6D880075BB52 /* killpg.c in Sources */,
+                               C9EB2FD8138F6D880075BB52 /* sethostid.c in Sources */,
+                               C9EB2FD9138F6D880075BB52 /* setpgrp.c in Sources */,
+                               C9EB2FDA138F6D880075BB52 /* setrgid.c in Sources */,
+                               C9EB2FDB138F6D880075BB52 /* setruid.c in Sources */,
+                               C9EB2FDC138F6D880075BB52 /* setregid.c in Sources */,
+                               C9EB2FDD138F6D880075BB52 /* setreuid.c in Sources */,
+                               C9EB2FDE138F6D880075BB52 /* sigaltstk.c in Sources */,
+                               C9EB2FDF138F6D880075BB52 /* sigcompat.c in Sources */,
+                               C9EB2FE0138F6D880075BB52 /* _dirhelper.c in Sources */,
+                               C9EB2FE1138F6D880075BB52 /* kvm.c in Sources */,
+                               C9EB2FE2138F6D880075BB52 /* libproc.c in Sources */,
+                               C9EB2FE3138F6D880075BB52 /* MKGetTimeBaseInfo.c in Sources */,
+                               C9EB2FE4138F6D880075BB52 /* proc_listpidspath.c in Sources */,
+                               C9EB2FE5138F6D880075BB52 /* forceLibcToBuild.c in Sources */,
+                               C9EB2FE6138F6D880075BB52 /* bt_close.c in Sources */,
+                               C9EB2FE7138F6D880075BB52 /* bt_conv.c in Sources */,
+                               C9EB2FE8138F6D880075BB52 /* bt_debug.c in Sources */,
+                               C9EB2FE9138F6D880075BB52 /* bt_delete.c in Sources */,
+                               C9EB2FEA138F6D880075BB52 /* bt_get.c in Sources */,
+                               C9EB2FEB138F6D880075BB52 /* bt_open.c in Sources */,
+                               C9EB2FEC138F6D880075BB52 /* bt_overflow.c in Sources */,
+                               C9EB2FED138F6D880075BB52 /* bt_page.c in Sources */,
+                               C9EB2FEE138F6D880075BB52 /* bt_put.c in Sources */,
+                               C9EB2FEF138F6D880075BB52 /* bt_search.c in Sources */,
+                               C9EB2FF0138F6D880075BB52 /* bt_seq.c in Sources */,
+                               C9EB2FF1138F6D880075BB52 /* bt_split.c in Sources */,
+                               C9EB2FF2138F6D880075BB52 /* bt_utils.c in Sources */,
+                               C9EB2FF3138F6D880075BB52 /* db.c in Sources */,
+                               C9EB2FF4138F6D880075BB52 /* hash.c in Sources */,
+                               C9EB2FF5138F6D880075BB52 /* hash_bigkey.c in Sources */,
+                               C9EB2FF6138F6D880075BB52 /* hash_buf.c in Sources */,
+                               C9EB2FF7138F6D880075BB52 /* hash_func.c in Sources */,
+                               C9EB2FF8138F6D880075BB52 /* hash_log2.c in Sources */,
+                               C9EB2FF9138F6D880075BB52 /* hash_page.c in Sources */,
+                               C9EB2FFA138F6D880075BB52 /* ndbm.c in Sources */,
+                               C9EB2FFB138F6D880075BB52 /* mpool.c in Sources */,
+                               C9EB2FFC138F6D880075BB52 /* rec_close.c in Sources */,
+                               C9EB2FFD138F6D880075BB52 /* rec_delete.c in Sources */,
+                               C9EB2FFE138F6D880075BB52 /* rec_get.c in Sources */,
+                               C9EB2FFF138F6D880075BB52 /* rec_open.c in Sources */,
+                               C9EB3000138F6D880075BB52 /* rec_put.c in Sources */,
+                               C9EB3001138F6D880075BB52 /* rec_search.c in Sources */,
+                               C9EB3002138F6D880075BB52 /* rec_seq.c in Sources */,
+                               C9EB3003138F6D880075BB52 /* rec_utils.c in Sources */,
+                               C9EB3004138F6D880075BB52 /* brk.c in Sources */,
+                               C9EB3005138F6D880075BB52 /* bsd_signal.c in Sources */,
+                               C9EB3006138F6D880075BB52 /* lchflags.c in Sources */,
+                               C9EB3007138F6D880075BB52 /* lchmod.c in Sources */,
+                               C9EB3008138F6D880075BB52 /* lutimes.c in Sources */,
+                               C9EB3009138F6D880075BB52 /* statvfs.c in Sources */,
+                               C9EB300A138F6D880075BB52 /* tcgetsid.c in Sources */,
+                               C9EB300B138F6D880075BB52 /* _ldbl_util.c in Sources */,
+                               C9EB300C138F6D880075BB52 /* _hdtoa.c in Sources */,
+                               C9EB300D138F6D880075BB52 /* _ldtoa.c in Sources */,
+                               C9EB300E138F6D880075BB52 /* gdtoa-dmisc.c in Sources */,
+                               C9EB300F138F6D880075BB52 /* gdtoa-dtoa.c in Sources */,
+                               C9EB3010138F6D880075BB52 /* gdtoa-gdtoa.c in Sources */,
+                               C9EB3011138F6D880075BB52 /* gdtoa-gethex.c in Sources */,
+                               C9EB3012138F6D880075BB52 /* gdtoa-gmisc.c in Sources */,
+                               C9EB3013138F6D880075BB52 /* gdtoa-hd_init.c in Sources */,
+                               C9EB3014138F6D880075BB52 /* gdtoa-hexnan.c in Sources */,
+                               C9EB3015138F6D880075BB52 /* gdtoa-misc.c in Sources */,
+                               C9EB3016138F6D880075BB52 /* gdtoa-smisc.c in Sources */,
+                               C9EB3017138F6D880075BB52 /* gdtoa-strtod.c in Sources */,
+                               C9EB3018138F6D880075BB52 /* gdtoa-strtodg.c in Sources */,
+                               C9EB3019138F6D880075BB52 /* gdtoa-strtof.c in Sources */,
+                               C9EB301A138F6D880075BB52 /* gdtoa-strtoIg.c in Sources */,
+                               C9EB301B138F6D880075BB52 /* gdtoa-strtopdd.c in Sources */,
+                               C9EB301C138F6D880075BB52 /* gdtoa-strtopx.c in Sources */,
+                               C9EB301D138F6D880075BB52 /* gdtoa-strtord.c in Sources */,
+                               C9EB301E138F6D880075BB52 /* gdtoa-sum.c in Sources */,
+                               C9EB301F138F6D880075BB52 /* gdtoa-ulp.c in Sources */,
+                               C9EB3020138F6D880075BB52 /* glue.c in Sources */,
+                               C9EB3021138F6D880075BB52 /* machdep_ldisd.c in Sources */,
+                               C9EB3022138F6D880075BB52 /* machdep_ldisdd.c in Sources */,
+                               C9EB3023138F6D880075BB52 /* machdep_ldisQ.c in Sources */,
+                               C9EB3024138F6D880075BB52 /* machdep_ldisx.c in Sources */,
+                               C9EB3025138F6D880075BB52 /* _simple.c in Sources */,
+                               C9EB3026138F6D880075BB52 /* asl.c in Sources */,
+                               C9EB3027138F6D880075BB52 /* asl_core.c in Sources */,
+                               C9EB3028138F6D880075BB52 /* asl_file.c in Sources */,
+                               C9EB3029138F6D880075BB52 /* asl_legacy1.c in Sources */,
+                               C9EB302A138F6D880075BB52 /* asl_msg.c in Sources */,
+                               C9EB302B138F6D880075BB52 /* asl_store.c in Sources */,
+                               C9EB302C138F6D880075BB52 /* asl_util.c in Sources */,
+                               C9EB302D138F6D880075BB52 /* assumes.c in Sources */,
+                               C9EB302E138F6D880075BB52 /* authentication.c in Sources */,
+                               C9EB302F138F6D880075BB52 /* backtrace.c in Sources */,
+                               C9EB3030138F6D880075BB52 /* cache.c in Sources */,
+                               C9EB3031138F6D880075BB52 /* confstr.c in Sources */,
+                               C9EB3032138F6D880075BB52 /* crypt.c in Sources */,
+                               C9EB3033138F6D880075BB52 /* devname.c in Sources */,
+                               C9EB3034138F6D880075BB52 /* disklabel.c in Sources */,
+                               C9EB3035138F6D880075BB52 /* errlst.c in Sources */,
+                               C9EB3036138F6D880075BB52 /* filesec.c in Sources */,
+                               C9EB3037138F6D880075BB52 /* _rand48.c in Sources */,
+                               C9EB3038138F6D880075BB52 /* alarm.c in Sources */,
+                               C9EB3039138F6D880075BB52 /* arc4random.c in Sources */,
+                               C9EB303A138F6D880075BB52 /* assert.c in Sources */,
+                               C9EB303B138F6D880075BB52 /* basename.c in Sources */,
+                               C9EB303C138F6D880075BB52 /* clock.c in Sources */,
+                               C9EB303D138F6D880075BB52 /* closedir.c in Sources */,
+                               C9EB303E138F6D880075BB52 /* ctermid.c in Sources */,
+                               C9EB303F138F6D880075BB52 /* daemon.c in Sources */,
+                               C9EB3040138F6D880075BB52 /* dirname.c in Sources */,
+                               C9EB3041138F6D880075BB52 /* drand48.c in Sources */,
+                               C9EB3042138F6D880075BB52 /* erand48.c in Sources */,
+                               C9EB3043138F6D880075BB52 /* err.c in Sources */,
+                               C9EB3044138F6D880075BB52 /* exec.c in Sources */,
+                               C9EB3045138F6D880075BB52 /* fmtcheck.c in Sources */,
+                               C9EB3046138F6D880075BB52 /* fmtmsg.c in Sources */,
+                               C9EB3047138F6D880075BB52 /* fnmatch.c in Sources */,
+                               C9EB3048138F6D880075BB52 /* ftok.c in Sources */,
+                               C9EB3049138F6D880075BB52 /* getbsize.c in Sources */,
+                               C9EB304A138F6D880075BB52 /* getcap.c in Sources */,
+                               C9EB304B138F6D880075BB52 /* getcwd.c in Sources */,
+                               C9EB304C138F6D880075BB52 /* gethostname.c in Sources */,
+                               C9EB304D138F6D880075BB52 /* getlogin.c in Sources */,
+                               C9EB304E138F6D880075BB52 /* getmntinfo.c in Sources */,
+                               C9EB304F138F6D880075BB52 /* getpagesize.c in Sources */,
+                               C9EB3050138F6D880075BB52 /* getpeereid.c in Sources */,
+                               C9EB3051138F6D880075BB52 /* getprogname.c in Sources */,
+                               C9EB3052138F6D880075BB52 /* glob.c in Sources */,
+                               C9EB3053138F6D880075BB52 /* isatty.c in Sources */,
+                               C9EB3054138F6D880075BB52 /* jrand48.c in Sources */,
+                               C9EB3055138F6D880075BB52 /* lcong48.c in Sources */,
+                               C9EB3056138F6D880075BB52 /* lockf.c in Sources */,
+                               C9EB3057138F6D880075BB52 /* lrand48.c in Sources */,
+                               C9EB3058138F6D880075BB52 /* mrand48.c in Sources */,
+                               C9EB3059138F6D880075BB52 /* nice.c in Sources */,
+                               C9EB305A138F6D880075BB52 /* nrand48.c in Sources */,
+                               C9EB305B138F6D880075BB52 /* opendir.c in Sources */,
+                               C9EB305C138F6D880075BB52 /* pause.c in Sources */,
+                               C9EB305D138F6D880075BB52 /* popen.c in Sources */,
+                               C9EB305E138F6D880075BB52 /* pselect.c in Sources */,
+                               C9EB305F138F6D880075BB52 /* psignal.c in Sources */,
+                               C9EB3060138F6D880075BB52 /* raise.c in Sources */,
+                               C9EB3061138F6D880075BB52 /* readdir.c in Sources */,
+                               C9EB3062138F6D880075BB52 /* readpassphrase.c in Sources */,
+                               C9EB3063138F6D880075BB52 /* rewinddir.c in Sources */,
+                               C9EB3064138F6D880075BB52 /* scandir.c in Sources */,
+                               C9EB3065138F6D880075BB52 /* seed48.c in Sources */,
+                               C9EB3066138F6D880075BB52 /* seekdir.c in Sources */,
+                               C9EB3067138F6D880075BB52 /* sethostname.c in Sources */,
+                               C9EB3068138F6D880075BB52 /* setmode.c in Sources */,
+                               C9EB3069138F6D880075BB52 /* setprogname.c in Sources */,
+                               C9EB306A138F6D880075BB52 /* siginterrupt.c in Sources */,
+                               C9EB306B138F6D880075BB52 /* siglist.c in Sources */,
+                               C9EB306C138F6D880075BB52 /* signal.c in Sources */,
+                               C9EB306D138F6D880075BB52 /* sleep.c in Sources */,
+                               C9EB306E138F6D880075BB52 /* srand48.c in Sources */,
+                               C9EB306F138F6D880075BB52 /* stringlist.c in Sources */,
+                               C9EB3070138F6D880075BB52 /* sysconf.c in Sources */,
+                               C9EB3071138F6D880075BB52 /* sysctl.c in Sources */,
+                               C9EB3072138F6D880075BB52 /* sysctlbyname.c in Sources */,
+                               C9EB3073138F6D880075BB52 /* sysctlnametomib.c in Sources */,
+                               C9EB3074138F6D880075BB52 /* telldir.c in Sources */,
+                               C9EB3075138F6D880075BB52 /* termios.c in Sources */,
+                               C9EB3076138F6D880075BB52 /* time.c in Sources */,
+                               C9EB3077138F6D880075BB52 /* times.c in Sources */,
+                               C9EB3078138F6D880075BB52 /* timezone.c in Sources */,
+                               C9EB3079138F6D880075BB52 /* ttyname.c in Sources */,
+                               C9EB307A138F6D880075BB52 /* ttyslot.c in Sources */,
+                               C9EB307B138F6D880075BB52 /* ualarm.c in Sources */,
+                               C9EB307C138F6D880075BB52 /* ulimit.c in Sources */,
+                               C9EB307D138F6D880075BB52 /* unvis.c in Sources */,
+                               C9EB307E138F6D880075BB52 /* usleep.c in Sources */,
+                               C9EB307F138F6D880075BB52 /* utime.c in Sources */,
+                               C9EB3080138F6D880075BB52 /* vis.c in Sources */,
+                               C9EB3081138F6D880075BB52 /* wait.c in Sources */,
+                               C9EB3082138F6D880075BB52 /* wait3.c in Sources */,
+                               C9EB3083138F6D880075BB52 /* waitpid.c in Sources */,
+                               C9EB3084138F6D880075BB52 /* fts.c in Sources */,
+                               C9EB3085138F6D880075BB52 /* get_compat.c in Sources */,
+                               C9EB3086138F6D880075BB52 /* getloadavg.c in Sources */,
+                               C9EB3087138F6D880075BB52 /* getttyent.c in Sources */,
+                               C9EB3088138F6D880075BB52 /* getusershell.c in Sources */,
+                               C9EB3089138F6D880075BB52 /* getvfsbyname.c in Sources */,
+                               C9EB308A138F6D880075BB52 /* isinf.c in Sources */,
+                               C9EB308B138F6D880075BB52 /* isnan.c in Sources */,
+                               C9EB308C138F6D880075BB52 /* magazine_malloc.c in Sources */,
+                               C9EB308D138F6D880075BB52 /* malloc.c in Sources */,
+                               C9EB308E138F6D880075BB52 /* nanosleep.c in Sources */,
+                               C9EB308F138F6D880075BB52 /* utmpx.c in Sources */,
+                               C9EB3090138F6D880075BB52 /* nftw.c in Sources */,
+                               C9EB3091138F6D880075BB52 /* nlist.c in Sources */,
+                               C9EB3092138F6D880075BB52 /* NSSystemDirectories.c in Sources */,
+                               C9EB3093138F6D880075BB52 /* oldsyslog.c in Sources */,
+                               C9EB3094138F6D880075BB52 /* platfunc.c in Sources */,
+                               C9EB3095138F6D880075BB52 /* scalable_malloc.c in Sources */,
+                               C9EB3096138F6D880075BB52 /* setlogin.c in Sources */,
+                               C9EB3097138F6D880075BB52 /* sigsetops.c in Sources */,
+                               C9EB3098138F6D880075BB52 /* stack_logging.c in Sources */,
+                               C9EB3099138F6D880075BB52 /* stack_logging_disk.c in Sources */,
+                               C9EB309A138F6D880075BB52 /* strtofflags.c in Sources */,
+                               C9EB309B138F6D880075BB52 /* syslog.c in Sources */,
+                               C9EB309C138F6D880075BB52 /* thread_stack_pcs.c in Sources */,
+                               C9EB309D138F6D880075BB52 /* uname.c in Sources */,
+                               C9EB309E138F6D880075BB52 /* utmpx-darwin.c in Sources */,
+                               C9EB309F138F6D880075BB52 /* wordexp.c in Sources */,
+                               C9EB30A1138F6D880075BB52 /* gmon.c in Sources */,
+                               C9EB30A2138F6D880075BB52 /* getmcontext.c in Sources */,
+                               C9EB30A3138F6D880075BB52 /* makecontext.c in Sources */,
+                               C9EB30A4138F6D880075BB52 /* setcontext.c in Sources */,
+                               C9EB30A5138F6D880075BB52 /* setjmperr.c in Sources */,
+                               C9EB30A6138F6D880075BB52 /* swapcontext.c in Sources */,
+                               C9EB30A7138F6D880075BB52 /* init_cpu_capabilities.c in Sources */,
+                               C9EB30A8138F6D880075BB52 /* bcopy.c in Sources */,
+                               C9EB30A9138F6D880075BB52 /* bzero.c in Sources */,
+                               C9EB30AA138F6D880075BB52 /* memcpy.c in Sources */,
+                               C9EB30AB138F6D880075BB52 /* memmove.c in Sources */,
+                               C9EB30AC138F6D880075BB52 /* atomic.c in Sources */,
+                               C9EB30AD138F6D880075BB52 /* mach_absolute_time.c in Sources */,
+                               C9EB30AE138F6D880075BB52 /* spinlocks.c in Sources */,
+                               C9EB30C1138F6D880075BB52 /* ascii.c in Sources */,
+                               C9EB30C2138F6D880075BB52 /* big5.c in Sources */,
+                               C9EB30C3138F6D880075BB52 /* btowc.c in Sources */,
+                               C9EB30C4138F6D880075BB52 /* collate.c in Sources */,
+                               C9EB30C5138F6D880075BB52 /* collcmp.c in Sources */,
+                               C9EB30C6138F6D880075BB52 /* euc.c in Sources */,
+                               C9EB30C7138F6D880075BB52 /* fix_grouping.c in Sources */,
+                               C9EB30C8138F6D880075BB52 /* gb18030.c in Sources */,
+                               C9EB30C9138F6D880075BB52 /* gb2312.c in Sources */,
+                               C9EB30CA138F6D880075BB52 /* gbk.c in Sources */,
+                               C9EB30CB138F6D880075BB52 /* ldpart.c in Sources */,
+                               C9EB30CC138F6D880075BB52 /* lmessages.c in Sources */,
+                               C9EB30CD138F6D880075BB52 /* lmonetary.c in Sources */,
+                               C9EB30CE138F6D880075BB52 /* lnumeric.c in Sources */,
+                               C9EB30CF138F6D880075BB52 /* localeconv.c in Sources */,
+                               C9EB30D0138F6D880075BB52 /* mblen.c in Sources */,
+                               C9EB30D1138F6D880075BB52 /* mbrlen.c in Sources */,
+                               C9EB30D2138F6D880075BB52 /* mbrtowc.c in Sources */,
+                               C9EB30D3138F6D880075BB52 /* mbsinit.c in Sources */,
+                               C9EB30D4138F6D880075BB52 /* mbsnrtowcs.c in Sources */,
+                               C9EB30D5138F6D880075BB52 /* mbsrtowcs.c in Sources */,
+                               C9EB30D6138F6D880075BB52 /* mbstowcs.c in Sources */,
+                               C9EB30D7138F6D880075BB52 /* mbtowc.c in Sources */,
+                               C9EB30D8138F6D880075BB52 /* mskanji.c in Sources */,
+                               C9EB30D9138F6D880075BB52 /* nextwctype.c in Sources */,
+                               C9EB30DA138F6D880075BB52 /* nl_langinfo.c in Sources */,
+                               C9EB30DB138F6D880075BB52 /* nomacros.c in Sources */,
+                               C9EB30DC138F6D880075BB52 /* none.c in Sources */,
+                               C9EB30DD138F6D880075BB52 /* rune.c in Sources */,
+                               C9EB30DE138F6D880075BB52 /* runetype.c in Sources */,
+                               C9EB30DF138F6D880075BB52 /* setlocale.c in Sources */,
+                               C9EB30E0138F6D880075BB52 /* setrunelocale.c in Sources */,
+                               C9EB30E1138F6D880075BB52 /* table.c in Sources */,
+                               C9EB30E2138F6D880075BB52 /* tolower.c in Sources */,
+                               C9EB30E3138F6D880075BB52 /* toupper.c in Sources */,
+                               C9EB30E4138F6D880075BB52 /* utf2.c in Sources */,
+                               C9EB30E5138F6D880075BB52 /* utf8.c in Sources */,
+                               C9EB30E6138F6D880075BB52 /* wcrtomb.c in Sources */,
+                               C9EB30E7138F6D880075BB52 /* wcsftime.c in Sources */,
+                               C9EB30E8138F6D880075BB52 /* wcsnrtombs.c in Sources */,
+                               C9EB30E9138F6D880075BB52 /* wcsrtombs.c in Sources */,
+                               C9EB30EA138F6D880075BB52 /* wcstod.c in Sources */,
+                               C9EB30EB138F6D880075BB52 /* wcstof.c in Sources */,
+                               C9EB30EC138F6D880075BB52 /* wcstoimax.c in Sources */,
+                               C9EB30ED138F6D880075BB52 /* wcstol.c in Sources */,
+                               C9EB30EE138F6D880075BB52 /* wcstold.c in Sources */,
+                               C9EB30EF138F6D880075BB52 /* wcstoll.c in Sources */,
+                               C9EB30F0138F6D880075BB52 /* wcstombs.c in Sources */,
+                               C9EB30F1138F6D880075BB52 /* wcstoul.c in Sources */,
+                               C9EB30F2138F6D880075BB52 /* wcstoull.c in Sources */,
+                               C9EB30F3138F6D880075BB52 /* wcstoumax.c in Sources */,
+                               C9EB30F4138F6D880075BB52 /* wctob.c in Sources */,
+                               C9EB30F5138F6D880075BB52 /* wctomb.c in Sources */,
+                               C9EB30F6138F6D880075BB52 /* wctrans.c in Sources */,
+                               C9EB30F7138F6D880075BB52 /* wctype.c in Sources */,
+                               C9EB30F8138F6D880075BB52 /* wcwidth.c in Sources */,
+                               C9EB30F9138F6D880075BB52 /* frune.c in Sources */,
+                               C9EB30FA138F6D880075BB52 /* isctype.c in Sources */,
+                               C9EB30FB138F6D880075BB52 /* iswctype.c in Sources */,
+                               C9EB30FC138F6D880075BB52 /* lconv.c in Sources */,
+                               C9EB30FD138F6D880075BB52 /* mbrune.c in Sources */,
+                               C9EB30FE138F6D880075BB52 /* runedepreciated.c in Sources */,
+                               C9EB30FF138F6D880075BB52 /* setinvalidrune.c in Sources */,
+                               C9EB3100138F6D880075BB52 /* xlocale.c in Sources */,
+                               C9EB3101138F6D880075BB52 /* addr2ascii.c in Sources */,
+                               C9EB3102138F6D880075BB52 /* ascii2addr.c in Sources */,
+                               C9EB3103138F6D880075BB52 /* inet_addr.c in Sources */,
+                               C9EB3104138F6D880075BB52 /* inet_lnaof.c in Sources */,
+                               C9EB3105138F6D880075BB52 /* inet_makeaddr.c in Sources */,
+                               C9EB3106138F6D880075BB52 /* inet_net_ntop.c in Sources */,
+                               C9EB3107138F6D880075BB52 /* inet_net_pton.c in Sources */,
+                               C9EB3108138F6D880075BB52 /* inet_neta.c in Sources */,
+                               C9EB3109138F6D880075BB52 /* inet_netof.c in Sources */,
+                               C9EB310A138F6D880075BB52 /* inet_network.c in Sources */,
+                               C9EB310B138F6D880075BB52 /* inet_ntoa.c in Sources */,
+                               C9EB310C138F6D880075BB52 /* linkaddr.c in Sources */,
+                               C9EB310D138F6D880075BB52 /* nsap_addr.c in Sources */,
+                               C9EB310E138F6D880075BB52 /* recv.c in Sources */,
+                               C9EB310F138F6D880075BB52 /* send.c in Sources */,
+                               C9EB3110138F6D880075BB52 /* sockatmark.c in Sources */,
+                               C9EB3111138F6D880075BB52 /* sourcefilter.c in Sources */,
+                               C9EB3112138F6D880075BB52 /* msgcat.c in Sources */,
+                               C9EB3113138F6D880075BB52 /* acl.c in Sources */,
+                               C9EB3114138F6D880075BB52 /* acl_entry.c in Sources */,
+                               C9EB3115138F6D880075BB52 /* acl_file.c in Sources */,
+                               C9EB3116138F6D880075BB52 /* acl_flag.c in Sources */,
+                               C9EB3117138F6D880075BB52 /* acl_perm.c in Sources */,
+                               C9EB3118138F6D880075BB52 /* acl_translate.c in Sources */,
+                               C9EB3121138F6D880075BB52 /* mk_pthread_impl.c in Sources */,
+                               C9EB3122138F6D880075BB52 /* pthread.c in Sources */,
+                               C9EB3123138F6D880075BB52 /* pthread_cancelable.c in Sources */,
+                               C9EB3124138F6D880075BB52 /* pthread_cond.c in Sources */,
+                               C9EB3125138F6D880075BB52 /* pthread_mutex.c in Sources */,
+                               C9EB3126138F6D880075BB52 /* pthread_rwlock.c in Sources */,
+                               C9EB3127138F6D880075BB52 /* pthread_tsd.c in Sources */,
+                               C9EB3128138F6D880075BB52 /* pthread_atfork_test.c in Sources */,
+                               C9EB3129138F6D880075BB52 /* thread_setup.c in Sources */,
+                               C9EB312C138F6D880075BB52 /* regerror.c in Sources */,
+                               C9EB312F138F6D880075BB52 /* chk_fail.c in Sources */,
+                               C9EB3130138F6D880075BB52 /* memcpy_chk.c in Sources */,
+                               C9EB3131138F6D880075BB52 /* memmove_chk.c in Sources */,
+                               C9EB3132138F6D880075BB52 /* memset_chk.c in Sources */,
+                               C9EB3133138F6D880075BB52 /* snprintf_chk.c in Sources */,
+                               C9EB3134138F6D880075BB52 /* sprintf_chk.c in Sources */,
+                               C9EB3135138F6D880075BB52 /* stpcpy_chk.c in Sources */,
+                               C9EB3136138F6D880075BB52 /* stpncpy_chk.c in Sources */,
+                               C9EB3137138F6D880075BB52 /* strcat_chk.c in Sources */,
+                               C9EB3138138F6D880075BB52 /* strcpy_chk.c in Sources */,
+                               C9EB3139138F6D880075BB52 /* strncat_chk.c in Sources */,
+                               C9EB313A138F6D880075BB52 /* strncpy_chk.c in Sources */,
+                               C9EB313B138F6D880075BB52 /* vsnprintf_chk.c in Sources */,
+                               C9EB313C138F6D880075BB52 /* vsprintf_chk.c in Sources */,
+                               C9EB313D138F6D880075BB52 /* _flock_stub.c in Sources */,
+                               C9EB313E138F6D880075BB52 /* asprintf.c in Sources */,
+                               C9EB313F138F6D880075BB52 /* clrerr.c in Sources */,
+                               C9EB3140138F6D880075BB52 /* dprintf.c in Sources */,
+                               C9EB3141138F6D880075BB52 /* fclose.c in Sources */,
+                               C9EB3142138F6D880075BB52 /* fdopen.c in Sources */,
+                               C9EB3143138F6D880075BB52 /* feof.c in Sources */,
+                               C9EB3144138F6D880075BB52 /* ferror.c in Sources */,
+                               C9EB3145138F6D880075BB52 /* fflush.c in Sources */,
+                               C9EB3146138F6D880075BB52 /* fgetc.c in Sources */,
+                               C9EB3147138F6D880075BB52 /* fgetln.c in Sources */,
+                               C9EB3148138F6D880075BB52 /* fgetpos.c in Sources */,
+                               C9EB3149138F6D880075BB52 /* fgets.c in Sources */,
+                               C9EB314A138F6D880075BB52 /* fgetwc.c in Sources */,
+                               C9EB314B138F6D880075BB52 /* fgetwln.c in Sources */,
+                               C9EB314C138F6D880075BB52 /* fgetws.c in Sources */,
+                               C9EB314D138F6D880075BB52 /* fileno.c in Sources */,
+                               C9EB314E138F6D880075BB52 /* findfp.c in Sources */,
+                               C9EB314F138F6D880075BB52 /* flags.c in Sources */,
+                               C9EB3150138F6D880075BB52 /* fopen.c in Sources */,
+                               C9EB3151138F6D880075BB52 /* fprintf.c in Sources */,
+                               C9EB3152138F6D880075BB52 /* fpurge.c in Sources */,
+                               C9EB3153138F6D880075BB52 /* fputc.c in Sources */,
+                               C9EB3154138F6D880075BB52 /* fputs.c in Sources */,
+                               C9EB3155138F6D880075BB52 /* fputwc.c in Sources */,
+                               C9EB3156138F6D880075BB52 /* fputws.c in Sources */,
+                               C9EB3157138F6D880075BB52 /* fread.c in Sources */,
+                               C9EB3158138F6D880075BB52 /* freopen.c in Sources */,
+                               C9EB3159138F6D880075BB52 /* fscanf.c in Sources */,
+                               C9EB315A138F6D880075BB52 /* fseek.c in Sources */,
+                               C9EB315B138F6D880075BB52 /* fsetpos.c in Sources */,
+                               C9EB315C138F6D880075BB52 /* ftell.c in Sources */,
+                               C9EB315D138F6D880075BB52 /* funopen.c in Sources */,
+                               C9EB315E138F6D880075BB52 /* fvwrite.c in Sources */,
+                               C9EB315F138F6D880075BB52 /* fwalk.c in Sources */,
+                               C9EB3160138F6D880075BB52 /* fwide.c in Sources */,
+                               C9EB3161138F6D880075BB52 /* fwprintf.c in Sources */,
+                               C9EB3162138F6D880075BB52 /* fwrite.c in Sources */,
+                               C9EB3163138F6D880075BB52 /* fwscanf.c in Sources */,
+                               C9EB3164138F6D880075BB52 /* getc.c in Sources */,
+                               C9EB3165138F6D880075BB52 /* getchar.c in Sources */,
+                               C9EB3166138F6D880075BB52 /* getdelim.c in Sources */,
+                               C9EB3167138F6D880075BB52 /* getline.c in Sources */,
+                               C9EB3168138F6D880075BB52 /* gets.c in Sources */,
+                               C9EB3169138F6D880075BB52 /* getw.c in Sources */,
+                               C9EB316A138F6D880075BB52 /* getwc.c in Sources */,
+                               C9EB316B138F6D880075BB52 /* getwchar.c in Sources */,
+                               C9EB316C138F6D880075BB52 /* makebuf.c in Sources */,
+                               C9EB316D138F6D880075BB52 /* mktemp.c in Sources */,
+                               C9EB316E138F6D880075BB52 /* perror.c in Sources */,
+                               C9EB316F138F6D880075BB52 /* printf-pos.c in Sources */,
+                               C9EB3170138F6D880075BB52 /* printf.c in Sources */,
+                               C9EB3171138F6D880075BB52 /* putc.c in Sources */,
+                               C9EB3172138F6D880075BB52 /* putchar.c in Sources */,
+                               C9EB3173138F6D880075BB52 /* puts.c in Sources */,
+                               C9EB3174138F6D880075BB52 /* putw.c in Sources */,
+                               C9EB3175138F6D880075BB52 /* putwc.c in Sources */,
+                               C9EB3176138F6D880075BB52 /* putwchar.c in Sources */,
+                               C9EB3177138F6D880075BB52 /* refill.c in Sources */,
+                               C9EB3178138F6D880075BB52 /* remove.c in Sources */,
+                               C9EB3179138F6D880075BB52 /* rewind.c in Sources */,
+                               C9EB317A138F6D880075BB52 /* rget.c in Sources */,
+                               C9EB317B138F6D880075BB52 /* scanf.c in Sources */,
+                               C9EB317C138F6D880075BB52 /* setbuf.c in Sources */,
+                               C9EB317D138F6D880075BB52 /* setbuffer.c in Sources */,
+                               C9EB317E138F6D880075BB52 /* setvbuf.c in Sources */,
+                               C9EB317F138F6D880075BB52 /* snprintf.c in Sources */,
+                               C9EB3180138F6D880075BB52 /* sprintf.c in Sources */,
+                               C9EB3181138F6D880075BB52 /* sscanf.c in Sources */,
+                               C9EB3182138F6D880075BB52 /* stdio.c in Sources */,
+                               C9EB3183138F6D880075BB52 /* swprintf.c in Sources */,
+                               C9EB3184138F6D880075BB52 /* swscanf.c in Sources */,
+                               C9EB3185138F6D880075BB52 /* tempnam.c in Sources */,
+                               C9EB3186138F6D880075BB52 /* tmpfile.c in Sources */,
+                               C9EB3187138F6D880075BB52 /* tmpnam.c in Sources */,
+                               C9EB3188138F6D880075BB52 /* ungetc.c in Sources */,
+                               C9EB3189138F6D880075BB52 /* ungetwc.c in Sources */,
+                               C9EB318A138F6D880075BB52 /* vasprintf.c in Sources */,
+                               C9EB318B138F6D880075BB52 /* vdprintf.c in Sources */,
+                               C9EB318C138F6D880075BB52 /* vfprintf.c in Sources */,
+                               C9EB318D138F6D880075BB52 /* vfscanf.c in Sources */,
+                               C9EB318E138F6D880075BB52 /* vfwprintf.c in Sources */,
+                               C9EB318F138F6D880075BB52 /* vfwscanf.c in Sources */,
+                               C9EB3190138F6D880075BB52 /* vprintf.c in Sources */,
+                               C9EB3191138F6D880075BB52 /* vscanf.c in Sources */,
+                               C9EB3192138F6D880075BB52 /* vsnprintf.c in Sources */,
+                               C9EB3193138F6D880075BB52 /* vsprintf.c in Sources */,
+                               C9EB3194138F6D880075BB52 /* vsscanf.c in Sources */,
+                               C9EB3195138F6D880075BB52 /* vswprintf.c in Sources */,
+                               C9EB3196138F6D880075BB52 /* vswscanf.c in Sources */,
+                               C9EB3197138F6D880075BB52 /* vwprintf.c in Sources */,
+                               C9EB3198138F6D880075BB52 /* vwscanf.c in Sources */,
+                               C9EB3199138F6D880075BB52 /* wbuf.c in Sources */,
+                               C9EB319A138F6D880075BB52 /* wprintf.c in Sources */,
+                               C9EB319B138F6D880075BB52 /* wscanf.c in Sources */,
+                               C9EB319C138F6D880075BB52 /* wsetup.c in Sources */,
+                               C9EB319D138F6D880075BB52 /* a64l.c in Sources */,
+                               C9EB319E138F6D880075BB52 /* _Exit_.c in Sources */,
+                               C9EB319F138F6D880075BB52 /* abort.c in Sources */,
+                               C9EB31A0138F6D880075BB52 /* abs.c in Sources */,
+                               C9EB31A1138F6D880075BB52 /* atexit.c in Sources */,
+                               C9EB31A2138F6D880075BB52 /* atof.c in Sources */,
+                               C9EB31A3138F6D880075BB52 /* atoi.c in Sources */,
+                               C9EB31A4138F6D880075BB52 /* atol.c in Sources */,
+                               C9EB31A5138F6D880075BB52 /* atoll.c in Sources */,
+                               C9EB31A6138F6D880075BB52 /* bsearch.c in Sources */,
+                               C9EB31A7138F6D880075BB52 /* div.c in Sources */,
+                               C9EB31A8138F6D880075BB52 /* exit.c in Sources */,
+                               C9EB31A9138F6D880075BB52 /* getenv.c in Sources */,
+                               C9EB31AA138F6D880075BB52 /* getopt.c in Sources */,
+                               C9EB31AB138F6D880075BB52 /* getopt_long.c in Sources */,
+                               C9EB31AC138F6D880075BB52 /* getsubopt.c in Sources */,
+                               C9EB31AD138F6D880075BB52 /* hcreate.c in Sources */,
+                               C9EB31AE138F6D880075BB52 /* heapsort.c in Sources */,
+                               C9EB31AF138F6D880075BB52 /* heapsort_b.c in Sources */,
+                               C9EB31B0138F6D880075BB52 /* heapsort_r.c in Sources */,
+                               C9EB31B1138F6D880075BB52 /* imaxabs.c in Sources */,
+                               C9EB31B2138F6D880075BB52 /* imaxdiv.c in Sources */,
+                               C9EB31B3138F6D880075BB52 /* insque.c in Sources */,
+                               C9EB31B4138F6D880075BB52 /* labs.c in Sources */,
+                               C9EB31B5138F6D880075BB52 /* ldiv.c in Sources */,
+                               C9EB31B6138F6D880075BB52 /* llabs.c in Sources */,
+                               C9EB31B7138F6D880075BB52 /* lldiv.c in Sources */,
+                               C9EB31B8138F6D880075BB52 /* lsearch.c in Sources */,
+                               C9EB31B9138F6D880075BB52 /* merge.c in Sources */,
+                               C9EB31BA138F6D880075BB52 /* putenv.c in Sources */,
+                               C9EB31BB138F6D880075BB52 /* qsort.c in Sources */,
+                               C9EB31BC138F6D880075BB52 /* qsort_r.c in Sources */,
+                               C9EB31BD138F6D880075BB52 /* radixsort.c in Sources */,
+                               C9EB31BE138F6D880075BB52 /* rand.c in Sources */,
+                               C9EB31BF138F6D880075BB52 /* random.c in Sources */,
+                               C9EB31C0138F6D880075BB52 /* reallocf.c in Sources */,
+                               C9EB31C1138F6D880075BB52 /* realpath.c in Sources */,
+                               C9EB31C2138F6D880075BB52 /* remque.c in Sources */,
+                               C9EB31C3138F6D880075BB52 /* setenv.c in Sources */,
+                               C9EB31C4138F6D880075BB52 /* strhash.c in Sources */,
+                               C9EB31C5138F6D880075BB52 /* strtoimax.c in Sources */,
+                               C9EB31C6138F6D880075BB52 /* strtol.c in Sources */,
+                               C9EB31C7138F6D880075BB52 /* strtoll.c in Sources */,
+                               C9EB31C8138F6D880075BB52 /* strtoq.c in Sources */,
+                               C9EB31C9138F6D880075BB52 /* strtoul.c in Sources */,
+                               C9EB31CA138F6D880075BB52 /* strtoull.c in Sources */,
+                               C9EB31CB138F6D880075BB52 /* strtoumax.c in Sources */,
+                               C9EB31CC138F6D880075BB52 /* strtouq.c in Sources */,
+                               C9EB31CD138F6D880075BB52 /* system.c in Sources */,
+                               C9EB31CE138F6D880075BB52 /* tdelete.c in Sources */,
+                               C9EB31CF138F6D880075BB52 /* tfind.c in Sources */,
+                               C9EB31D0138F6D880075BB52 /* tsearch.c in Sources */,
+                               C9EB31D1138F6D880075BB52 /* twalk.c in Sources */,
+                               C9EB31D2138F6D880075BB52 /* grantpt.c in Sources */,
+                               C9EB31D3138F6D880075BB52 /* l64a.c in Sources */,
+                               C9EB31D4138F6D880075BB52 /* strfmon.c in Sources */,
+                               C9EB31D5138F6D880075BB52 /* ecvt.c in Sources */,
+                               C9EB31D6138F6D880075BB52 /* gcvt.c in Sources */,
+                               C9EB31D7138F6D880075BB52 /* qsort_b-fbsd.c in Sources */,
+                               C9EB31D8138F6D880075BB52 /* asctime.c in Sources */,
+                               C9EB31D9138F6D880075BB52 /* difftime.c in Sources */,
+                               C9EB31DA138F6D880075BB52 /* ftime.c in Sources */,
+                               C9EB31DB138F6D880075BB52 /* localtime.c in Sources */,
+                               C9EB31DC138F6D880075BB52 /* strftime.c in Sources */,
+                               C9EB31DD138F6D880075BB52 /* strptime.c in Sources */,
+                               C9EB31DE138F6D880075BB52 /* time32.c in Sources */,
+                               C9EB31DF138F6D880075BB52 /* timelocal.c in Sources */,
+                               C9EB31E0138F6D880075BB52 /* getdate.c in Sources */,
+                               C9EB31E1138F6D880075BB52 /* timezone_unix03.c in Sources */,
+                               C9EB31E2138F6D880075BB52 /* bcmp.c in Sources */,
+                               C9EB31E3138F6D880075BB52 /* bcopy.c in Sources */,
+                               C9EB31E4138F6D880075BB52 /* bzero.c in Sources */,
+                               C9EB31E5138F6D880075BB52 /* index.c in Sources */,
+                               C9EB31E6138F6D880075BB52 /* memccpy.c in Sources */,
+                               C9EB31E7138F6D880075BB52 /* memchr.c in Sources */,
+                               C9EB31E8138F6D880075BB52 /* memcmp.c in Sources */,
+                               C9EB31E9138F6D880075BB52 /* memcpy.c in Sources */,
+                               C9EB31EA138F6D880075BB52 /* memmem.c in Sources */,
+                               C9EB31EB138F6D880075BB52 /* memmove.c in Sources */,
+                               C9EB31EC138F6D880075BB52 /* memset.c in Sources */,
+                               C9EB31ED138F6D880075BB52 /* rindex.c in Sources */,
+                               C9EB31F0138F6D880075BB52 /* strcasecmp.c in Sources */,
+                               C9EB31F1138F6D880075BB52 /* strcasestr.c in Sources */,
+                               C9EB31F3138F6D880075BB52 /* strchr.c in Sources */,
+                               C9EB31F4138F6D880075BB52 /* strcmp.c in Sources */,
+                               C9EB31F5138F6D880075BB52 /* strcoll.c in Sources */,
+                               C9EB31F7138F6D880075BB52 /* strcspn.c in Sources */,
+                               C9EB31F8138F6D880075BB52 /* strdup.c in Sources */,
+                               C9EB31F9138F6D880075BB52 /* strerror.c in Sources */,
+                               C9EB31FC138F6D880075BB52 /* strlen.c in Sources */,
+                               C9EB31FD138F6D880075BB52 /* strmode.c in Sources */,
+                               C9EB31FF138F6D880075BB52 /* strncmp.c in Sources */,
+                               C9EB3201138F6D880075BB52 /* strndup.c in Sources */,
+                               C9EB3202138F6D880075BB52 /* strnlen.c in Sources */,
+                               C9EB3203138F6D880075BB52 /* strnstr.c in Sources */,
+                               C9EB3204138F6D880075BB52 /* strpbrk.c in Sources */,
+                               C9EB3205138F6D880075BB52 /* strrchr.c in Sources */,
+                               C9EB3206138F6D880075BB52 /* strsep.c in Sources */,
+                               C9EB3207138F6D880075BB52 /* strsignal.c in Sources */,
+                               C9EB3208138F6D880075BB52 /* strspn.c in Sources */,
+                               C9EB3209138F6D880075BB52 /* strstr.c in Sources */,
+                               C9EB320A138F6D880075BB52 /* strtok.c in Sources */,
+                               C9EB320B138F6D880075BB52 /* strxfrm.c in Sources */,
+                               C9EB320C138F6D880075BB52 /* swab.c in Sources */,
+                               C9EB320D138F6D880075BB52 /* wcpcpy.c in Sources */,
+                               C9EB320E138F6D880075BB52 /* wcpncpy.c in Sources */,
+                               C9EB320F138F6D880075BB52 /* wcscasecmp.c in Sources */,
+                               C9EB3210138F6D880075BB52 /* wcscat.c in Sources */,
+                               C9EB3211138F6D880075BB52 /* wcschr.c in Sources */,
+                               C9EB3212138F6D880075BB52 /* wcscmp.c in Sources */,
+                               C9EB3213138F6D880075BB52 /* wcscoll.c in Sources */,
+                               C9EB3214138F6D880075BB52 /* wcscpy.c in Sources */,
+                               C9EB3215138F6D880075BB52 /* wcscspn.c in Sources */,
+                               C9EB3216138F6D880075BB52 /* wcsdup.c in Sources */,
+                               C9EB3217138F6D880075BB52 /* wcslcat.c in Sources */,
+                               C9EB3218138F6D880075BB52 /* wcslcpy.c in Sources */,
+                               C9EB3219138F6D880075BB52 /* wcslen.c in Sources */,
+                               C9EB321A138F6D880075BB52 /* wcsncasecmp.c in Sources */,
+                               C9EB321B138F6D880075BB52 /* wcsncat.c in Sources */,
+                               C9EB321C138F6D880075BB52 /* wcsncmp.c in Sources */,
+                               C9EB321D138F6D880075BB52 /* wcsncpy.c in Sources */,
+                               C9EB321E138F6D880075BB52 /* wcsnlen.c in Sources */,
+                               C9EB321F138F6D880075BB52 /* wcspbrk.c in Sources */,
+                               C9EB3220138F6D880075BB52 /* wcsrchr.c in Sources */,
+                               C9EB3221138F6D880075BB52 /* wcsspn.c in Sources */,
+                               C9EB3222138F6D880075BB52 /* wcsstr.c in Sources */,
+                               C9EB3223138F6D880075BB52 /* wcstok.c in Sources */,
+                               C9EB3224138F6D880075BB52 /* wcswidth.c in Sources */,
+                               C9EB3225138F6D880075BB52 /* wcsxfrm.c in Sources */,
+                               C9EB3226138F6D880075BB52 /* wmemchr.c in Sources */,
+                               C9EB3227138F6D880075BB52 /* wmemcmp.c in Sources */,
+                               C9EB3228138F6D880075BB52 /* wmemcpy.c in Sources */,
+                               C9EB3229138F6D880075BB52 /* wmemmove.c in Sources */,
+                               C9EB322A138F6D880075BB52 /* wmemset.c in Sources */,
+                               C9EB322B138F6D880075BB52 /* __libc_init.c in Sources */,
+                               C9EB322C138F6D880075BB52 /* _libc_fork_child.c in Sources */,
+                               C9EB322D138F6D880075BB52 /* chmodx_np.c in Sources */,
+                               C9EB322E138F6D880075BB52 /* context-stubs.c in Sources */,
+                               C9EB322F138F6D880075BB52 /* crt_externs.c in Sources */,
+                               C9EB3230138F6D880075BB52 /* errno.c in Sources */,
+                               C9EB3231138F6D880075BB52 /* fork.c in Sources */,
+                               C9EB3232138F6D880075BB52 /* getgroups.c in Sources */,
+                               C9EB3233138F6D880075BB52 /* getiopolicy_np.c in Sources */,
+                               C9EB3234138F6D880075BB52 /* gettimeofday.c in Sources */,
+                               C9EB3235138F6D880075BB52 /* msgctl.c in Sources */,
+                               C9EB3236138F6D880075BB52 /* stack_protector.c in Sources */,
+                               C9EB3237138F6D880075BB52 /* openx_np.c in Sources */,
+                               C9EB3238138F6D880075BB52 /* OSMemoryNotification.c in Sources */,
+                               C9EB3239138F6D880075BB52 /* OSThermalNotification.c in Sources */,
+                               C9EB323A138F6D880075BB52 /* posix_spawn.c in Sources */,
+                               C9EB323B138F6D880075BB52 /* semctl.c in Sources */,
+                               C9EB323C138F6D880075BB52 /* settimeofday.c in Sources */,
+                               C9EB323D138F6D880075BB52 /* shmctl.c in Sources */,
+                               C9EB323E138F6D880075BB52 /* sigaction.c in Sources */,
+                               C9EB323F138F6D880075BB52 /* sigcatch.c in Sources */,
+                               C9EB3240138F6D880075BB52 /* sigtramp.c in Sources */,
+                               C9EB3241138F6D880075BB52 /* slot_name.c in Sources */,
+                               C9EB3242138F6D880075BB52 /* statx_np.c in Sources */,
+                               C9EB3243138F6D880075BB52 /* umaskx_np.c in Sources */,
+                               C9EB3244138F6D880075BB52 /* cprocs.c in Sources */,
+                               C9EB3245138F6D880075BB52 /* cthreads.c in Sources */,
+                               C9EB3246138F6D880075BB52 /* mig_support.c in Sources */,
+                               C9EB3247138F6D880075BB52 /* fparseln.c in Sources */,
+                               C9EB3248138F6D880075BB52 /* login.c in Sources */,
+                               C9EB3249138F6D880075BB52 /* login_tty.c in Sources */,
+                               C9EB324A138F6D880075BB52 /* logout.c in Sources */,
+                               C9EB324B138F6D880075BB52 /* logwtmp.c in Sources */,
+                               3F76864B13E91D3F00C94D25 /* mkpath_np.c in Sources */,
+                               C9EB324C138F6D880075BB52 /* opendev.c in Sources */,
+                               C9EB324D138F6D880075BB52 /* pty.c in Sources */,
+                               C9EB324E138F6D880075BB52 /* clear.c in Sources */,
+                               C9EB324F138F6D880075BB52 /* compare.c in Sources */,
+                               C9EB3250138F6D880075BB52 /* copy.c in Sources */,
+                               C9EB3251138F6D880075BB52 /* gen_uuid.c in Sources */,
+                               C9EB3252138F6D880075BB52 /* isnull.c in Sources */,
+                               C9EB3253138F6D880075BB52 /* pack.c in Sources */,
+                               C9EB3254138F6D880075BB52 /* parse.c in Sources */,
+                               C9EB3255138F6D880075BB52 /* unpack.c in Sources */,
+                               C9EB3256138F6D880075BB52 /* unparse.c in Sources */,
+                               C9EB3257138F6D880075BB52 /* getmcontext.c in Sources */,
+                               C9EB3258138F6D880075BB52 /* makecontext.c in Sources */,
+                               C9EB3259138F6D880075BB52 /* setcontext.c in Sources */,
+                               C9EB325A138F6D880075BB52 /* swapcontext.c in Sources */,
+                               C9EB325B138F6D880075BB52 /* bcopy.c in Sources */,
+                               C9EB325C138F6D880075BB52 /* bzero.c in Sources */,
+                               C9EB325D138F6D880075BB52 /* memcpy.c in Sources */,
+                               C9EB325E138F6D880075BB52 /* memmove.c in Sources */,
+                               C9EB325F138F6D880075BB52 /* atomic.c in Sources */,
+                               C9EB3260138F6D880075BB52 /* spinlocks.c in Sources */,
+                               B10BC41C14338AEB005E4366 /* regcomp.c in Sources */,
+                               3F2208EE14358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C64621450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1BA146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+               C9EB3273138F75580075BB52 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               C9EB3274138F75580075BB52 /* init_cpu_capabilities.c in Sources */,
+                               C9EB3275138F75580075BB52 /* dyld_resolvers.c in Sources */,
+                               C9EB3276138F75580075BB52 /* arm_commpage_gettimeofday.c in Sources */,
+                               C9EB3277138F75580075BB52 /* gcc_atomic.c in Sources */,
+                               C9EB3278138F75580075BB52 /* OSAtomic-v4.c in Sources */,
+                               C9EB3279138F75580075BB52 /* OSAtomic_resolvers.c in Sources */,
+                               C9EB327B138F75580075BB52 /* creat.c in Sources */,
+                               C9EB327C138F75580075BB52 /* gethostid.c in Sources */,
+                               C9EB327D138F75580075BB52 /* getwd.c in Sources */,
+                               C9EB327E138F75580075BB52 /* killpg.c in Sources */,
+                               C9EB327F138F75580075BB52 /* sethostid.c in Sources */,
+                               C9EB3280138F75580075BB52 /* setpgrp.c in Sources */,
+                               C9EB3281138F75580075BB52 /* setrgid.c in Sources */,
+                               C9EB3282138F75580075BB52 /* setruid.c in Sources */,
+                               C9EB3283138F75580075BB52 /* setregid.c in Sources */,
+                               C9EB3284138F75580075BB52 /* setreuid.c in Sources */,
+                               C9EB3285138F75580075BB52 /* sigaltstk.c in Sources */,
+                               C9EB3286138F75580075BB52 /* sigcompat.c in Sources */,
+                               C9EB3287138F75580075BB52 /* _dirhelper.c in Sources */,
+                               C9EB3288138F75580075BB52 /* kvm.c in Sources */,
+                               C9EB3289138F75580075BB52 /* libproc.c in Sources */,
+                               C9EB328A138F75580075BB52 /* MKGetTimeBaseInfo.c in Sources */,
+                               C9EB328B138F75580075BB52 /* proc_listpidspath.c in Sources */,
+                               C9EB328C138F75580075BB52 /* forceLibcToBuild.c in Sources */,
+                               C9EB328D138F75580075BB52 /* bt_close.c in Sources */,
+                               C9EB328E138F75580075BB52 /* bt_conv.c in Sources */,
+                               C9EB328F138F75580075BB52 /* bt_debug.c in Sources */,
+                               C9EB3290138F75580075BB52 /* bt_delete.c in Sources */,
+                               C9EB3291138F75580075BB52 /* bt_get.c in Sources */,
+                               C9EB3292138F75580075BB52 /* bt_open.c in Sources */,
+                               C9EB3293138F75580075BB52 /* bt_overflow.c in Sources */,
+                               C9EB3294138F75580075BB52 /* bt_page.c in Sources */,
+                               C9EB3295138F75580075BB52 /* bt_put.c in Sources */,
+                               C9EB3296138F75580075BB52 /* bt_search.c in Sources */,
+                               C9EB3297138F75580075BB52 /* bt_seq.c in Sources */,
+                               C9EB3298138F75580075BB52 /* bt_split.c in Sources */,
+                               C9EB3299138F75580075BB52 /* bt_utils.c in Sources */,
+                               C9EB329A138F75580075BB52 /* db.c in Sources */,
+                               C9EB329B138F75580075BB52 /* hash.c in Sources */,
+                               C9EB329C138F75580075BB52 /* hash_bigkey.c in Sources */,
+                               C9EB329D138F75580075BB52 /* hash_buf.c in Sources */,
+                               C9EB329E138F75580075BB52 /* hash_func.c in Sources */,
+                               C9EB329F138F75580075BB52 /* hash_log2.c in Sources */,
+                               C9EB32A0138F75580075BB52 /* hash_page.c in Sources */,
+                               C9EB32A1138F75580075BB52 /* ndbm.c in Sources */,
+                               C9EB32A2138F75580075BB52 /* mpool.c in Sources */,
+                               C9EB32A3138F75580075BB52 /* rec_close.c in Sources */,
+                               C9EB32A4138F75580075BB52 /* rec_delete.c in Sources */,
+                               C9EB32A5138F75580075BB52 /* rec_get.c in Sources */,
+                               C9EB32A6138F75580075BB52 /* rec_open.c in Sources */,
+                               C9EB32A7138F75580075BB52 /* rec_put.c in Sources */,
+                               C9EB32A8138F75580075BB52 /* rec_search.c in Sources */,
+                               C9EB32A9138F75580075BB52 /* rec_seq.c in Sources */,
+                               C9EB32AA138F75580075BB52 /* rec_utils.c in Sources */,
+                               C9EB32AB138F75580075BB52 /* brk.c in Sources */,
+                               C9EB32AC138F75580075BB52 /* bsd_signal.c in Sources */,
+                               C9EB32AD138F75580075BB52 /* lchflags.c in Sources */,
+                               C9EB32AE138F75580075BB52 /* lchmod.c in Sources */,
+                               C9EB32AF138F75580075BB52 /* lutimes.c in Sources */,
+                               C9EB32B0138F75580075BB52 /* statvfs.c in Sources */,
+                               C9EB32B1138F75580075BB52 /* tcgetsid.c in Sources */,
+                               C9EB32B2138F75580075BB52 /* _ldbl_util.c in Sources */,
+                               C9EB32B3138F75580075BB52 /* _hdtoa.c in Sources */,
+                               C9EB32B4138F75580075BB52 /* _ldtoa.c in Sources */,
+                               C9EB32B5138F75580075BB52 /* gdtoa-dmisc.c in Sources */,
+                               C9EB32B6138F75580075BB52 /* gdtoa-dtoa.c in Sources */,
+                               C9EB32B7138F75580075BB52 /* gdtoa-gdtoa.c in Sources */,
+                               C9EB32B8138F75580075BB52 /* gdtoa-gethex.c in Sources */,
+                               C9EB32B9138F75580075BB52 /* gdtoa-gmisc.c in Sources */,
+                               C9EB32BA138F75580075BB52 /* gdtoa-hd_init.c in Sources */,
+                               C9EB32BB138F75580075BB52 /* gdtoa-hexnan.c in Sources */,
+                               C9EB32BC138F75580075BB52 /* gdtoa-misc.c in Sources */,
+                               C9EB32BD138F75580075BB52 /* gdtoa-smisc.c in Sources */,
+                               C9EB32BE138F75580075BB52 /* gdtoa-strtod.c in Sources */,
+                               C9EB32BF138F75580075BB52 /* gdtoa-strtodg.c in Sources */,
+                               C9EB32C0138F75580075BB52 /* gdtoa-strtof.c in Sources */,
+                               C9EB32C1138F75580075BB52 /* gdtoa-strtoIg.c in Sources */,
+                               C9EB32C2138F75580075BB52 /* gdtoa-strtopdd.c in Sources */,
+                               C9EB32C3138F75580075BB52 /* gdtoa-strtopx.c in Sources */,
+                               C9EB32C4138F75580075BB52 /* gdtoa-strtord.c in Sources */,
+                               C9EB32C5138F75580075BB52 /* gdtoa-sum.c in Sources */,
+                               C9EB32C6138F75580075BB52 /* gdtoa-ulp.c in Sources */,
+                               C9EB32C7138F75580075BB52 /* glue.c in Sources */,
+                               C9EB32C8138F75580075BB52 /* machdep_ldisd.c in Sources */,
+                               C9EB32C9138F75580075BB52 /* machdep_ldisdd.c in Sources */,
+                               C9EB32CA138F75580075BB52 /* machdep_ldisQ.c in Sources */,
+                               C9EB32CB138F75580075BB52 /* machdep_ldisx.c in Sources */,
+                               C9EB32CC138F75580075BB52 /* _simple.c in Sources */,
+                               C9EB32CD138F75580075BB52 /* asl.c in Sources */,
+                               C9EB32CE138F75580075BB52 /* asl_core.c in Sources */,
+                               C9EB32CF138F75580075BB52 /* asl_file.c in Sources */,
+                               C9EB32D0138F75580075BB52 /* asl_legacy1.c in Sources */,
+                               C9EB32D1138F75580075BB52 /* asl_msg.c in Sources */,
+                               C9EB32D2138F75580075BB52 /* asl_store.c in Sources */,
+                               C9EB32D3138F75580075BB52 /* asl_util.c in Sources */,
+                               C9EB32D4138F75580075BB52 /* assumes.c in Sources */,
+                               C9EB32D5138F75580075BB52 /* authentication.c in Sources */,
+                               C9EB32D6138F75580075BB52 /* backtrace.c in Sources */,
+                               C9EB32D7138F75580075BB52 /* cache.c in Sources */,
+                               C9EB32D8138F75580075BB52 /* confstr.c in Sources */,
+                               C9EB32D9138F75580075BB52 /* crypt.c in Sources */,
+                               C9EB32DA138F75580075BB52 /* devname.c in Sources */,
+                               C9EB32DB138F75580075BB52 /* disklabel.c in Sources */,
+                               C9EB32DC138F75580075BB52 /* errlst.c in Sources */,
+                               C9EB32DD138F75580075BB52 /* filesec.c in Sources */,
+                               C9EB32DE138F75580075BB52 /* _rand48.c in Sources */,
+                               C9EB32DF138F75580075BB52 /* alarm.c in Sources */,
+                               C9EB32E0138F75580075BB52 /* arc4random.c in Sources */,
+                               C9EB32E1138F75580075BB52 /* assert.c in Sources */,
+                               C9EB32E2138F75580075BB52 /* basename.c in Sources */,
+                               C9EB32E3138F75580075BB52 /* clock.c in Sources */,
+                               C9EB32E4138F75580075BB52 /* closedir.c in Sources */,
+                               C9EB32E5138F75580075BB52 /* ctermid.c in Sources */,
+                               C9EB32E6138F75580075BB52 /* daemon.c in Sources */,
+                               C9EB32E7138F75580075BB52 /* dirname.c in Sources */,
+                               C9EB32E8138F75580075BB52 /* drand48.c in Sources */,
+                               C9EB32E9138F75580075BB52 /* erand48.c in Sources */,
+                               C9EB32EA138F75580075BB52 /* err.c in Sources */,
+                               C9EB32EB138F75580075BB52 /* exec.c in Sources */,
+                               C9EB32EC138F75580075BB52 /* fmtcheck.c in Sources */,
+                               C9EB32ED138F75580075BB52 /* fmtmsg.c in Sources */,
+                               C9EB32EE138F75580075BB52 /* fnmatch.c in Sources */,
+                               C9EB32EF138F75580075BB52 /* ftok.c in Sources */,
+                               C9EB32F0138F75580075BB52 /* getbsize.c in Sources */,
+                               C9EB32F1138F75580075BB52 /* getcap.c in Sources */,
+                               C9EB32F2138F75580075BB52 /* getcwd.c in Sources */,
+                               C9EB32F3138F75580075BB52 /* gethostname.c in Sources */,
+                               C9EB32F4138F75580075BB52 /* getlogin.c in Sources */,
+                               C9EB32F5138F75580075BB52 /* getmntinfo.c in Sources */,
+                               C9EB32F6138F75580075BB52 /* getpagesize.c in Sources */,
+                               C9EB32F7138F75580075BB52 /* getpeereid.c in Sources */,
+                               C9EB32F8138F75580075BB52 /* getprogname.c in Sources */,
+                               C9EB32F9138F75580075BB52 /* glob.c in Sources */,
+                               C9EB32FA138F75580075BB52 /* isatty.c in Sources */,
+                               C9EB32FB138F75580075BB52 /* jrand48.c in Sources */,
+                               C9EB32FC138F75580075BB52 /* lcong48.c in Sources */,
+                               C9EB32FD138F75580075BB52 /* lockf.c in Sources */,
+                               C9EB32FE138F75580075BB52 /* lrand48.c in Sources */,
+                               C9EB32FF138F75580075BB52 /* mrand48.c in Sources */,
+                               C9EB3300138F75580075BB52 /* nice.c in Sources */,
+                               C9EB3301138F75580075BB52 /* nrand48.c in Sources */,
+                               C9EB3302138F75580075BB52 /* opendir.c in Sources */,
+                               C9EB3303138F75580075BB52 /* pause.c in Sources */,
+                               C9EB3304138F75580075BB52 /* popen.c in Sources */,
+                               C9EB3305138F75580075BB52 /* pselect.c in Sources */,
+                               C9EB3306138F75580075BB52 /* psignal.c in Sources */,
+                               C9EB3307138F75580075BB52 /* raise.c in Sources */,
+                               C9EB3308138F75580075BB52 /* readdir.c in Sources */,
+                               C9EB3309138F75580075BB52 /* readpassphrase.c in Sources */,
+                               C9EB330A138F75580075BB52 /* rewinddir.c in Sources */,
+                               C9EB330B138F75580075BB52 /* scandir.c in Sources */,
+                               C9EB330C138F75580075BB52 /* seed48.c in Sources */,
+                               C9EB330D138F75580075BB52 /* seekdir.c in Sources */,
+                               C9EB330E138F75580075BB52 /* sethostname.c in Sources */,
+                               C9EB330F138F75580075BB52 /* setmode.c in Sources */,
+                               C9EB3310138F75580075BB52 /* setprogname.c in Sources */,
+                               C9EB3311138F75580075BB52 /* siginterrupt.c in Sources */,
+                               C9EB3312138F75580075BB52 /* siglist.c in Sources */,
+                               C9EB3313138F75580075BB52 /* signal.c in Sources */,
+                               C9EB3314138F75580075BB52 /* sleep.c in Sources */,
+                               C9EB3315138F75580075BB52 /* srand48.c in Sources */,
+                               C9EB3316138F75580075BB52 /* stringlist.c in Sources */,
+                               C9EB3317138F75580075BB52 /* sysconf.c in Sources */,
+                               C9EB3318138F75580075BB52 /* sysctl.c in Sources */,
+                               C9EB3319138F75580075BB52 /* sysctlbyname.c in Sources */,
+                               C9EB331A138F75580075BB52 /* sysctlnametomib.c in Sources */,
+                               C9EB331B138F75580075BB52 /* telldir.c in Sources */,
+                               C9EB331C138F75580075BB52 /* termios.c in Sources */,
+                               C9EB331D138F75580075BB52 /* time.c in Sources */,
+                               C9EB331E138F75580075BB52 /* times.c in Sources */,
+                               C9EB331F138F75580075BB52 /* timezone.c in Sources */,
+                               C9EB3320138F75580075BB52 /* ttyname.c in Sources */,
+                               C9EB3321138F75580075BB52 /* ttyslot.c in Sources */,
+                               C9EB3322138F75580075BB52 /* ualarm.c in Sources */,
+                               C9EB3323138F75580075BB52 /* ulimit.c in Sources */,
+                               C9EB3324138F75580075BB52 /* unvis.c in Sources */,
+                               C9EB3325138F75580075BB52 /* usleep.c in Sources */,
+                               C9EB3326138F75580075BB52 /* utime.c in Sources */,
+                               C9EB3327138F75580075BB52 /* vis.c in Sources */,
+                               C9EB3328138F75580075BB52 /* wait.c in Sources */,
+                               C9EB3329138F75580075BB52 /* wait3.c in Sources */,
+                               C9EB332A138F75580075BB52 /* waitpid.c in Sources */,
+                               C9EB332B138F75580075BB52 /* fts.c in Sources */,
+                               C9EB332C138F75580075BB52 /* get_compat.c in Sources */,
+                               C9EB332D138F75580075BB52 /* getloadavg.c in Sources */,
+                               C9EB332E138F75580075BB52 /* getttyent.c in Sources */,
+                               C9EB332F138F75580075BB52 /* getusershell.c in Sources */,
+                               C9EB3330138F75580075BB52 /* getvfsbyname.c in Sources */,
+                               C9EB3331138F75580075BB52 /* isinf.c in Sources */,
+                               C9EB3332138F75580075BB52 /* isnan.c in Sources */,
+                               C9EB3333138F75580075BB52 /* magazine_malloc.c in Sources */,
+                               C9EB3334138F75580075BB52 /* malloc.c in Sources */,
+                               C9EB3335138F75580075BB52 /* nanosleep.c in Sources */,
+                               C9EB3336138F75580075BB52 /* utmpx.c in Sources */,
+                               C9EB3337138F75580075BB52 /* nftw.c in Sources */,
+                               C9EB3338138F75580075BB52 /* nlist.c in Sources */,
+                               C9EB3339138F75580075BB52 /* NSSystemDirectories.c in Sources */,
+                               C9EB333A138F75580075BB52 /* oldsyslog.c in Sources */,
+                               C9EB333B138F75580075BB52 /* platfunc.c in Sources */,
+                               C9EB333C138F75580075BB52 /* scalable_malloc.c in Sources */,
+                               C9EB333D138F75580075BB52 /* setlogin.c in Sources */,
+                               C9EB333E138F75580075BB52 /* sigsetops.c in Sources */,
+                               C9EB333F138F75580075BB52 /* stack_logging.c in Sources */,
+                               C9EB3340138F75580075BB52 /* stack_logging_disk.c in Sources */,
+                               C9EB3341138F75580075BB52 /* strtofflags.c in Sources */,
+                               C9EB3342138F75580075BB52 /* syslog.c in Sources */,
+                               C9EB3343138F75580075BB52 /* thread_stack_pcs.c in Sources */,
+                               C9EB3344138F75580075BB52 /* uname.c in Sources */,
+                               C9EB3345138F75580075BB52 /* utmpx-darwin.c in Sources */,
+                               C9EB3346138F75580075BB52 /* wordexp.c in Sources */,
+                               C9EB3348138F75580075BB52 /* gmon.c in Sources */,
+                               C9EB3349138F75580075BB52 /* getmcontext.c in Sources */,
+                               C9EB334A138F75580075BB52 /* makecontext.c in Sources */,
+                               C9EB334B138F75580075BB52 /* setcontext.c in Sources */,
+                               C9EB334C138F75580075BB52 /* setjmperr.c in Sources */,
+                               C9EB334D138F75580075BB52 /* swapcontext.c in Sources */,
+                               C9EB334E138F75580075BB52 /* init_cpu_capabilities.c in Sources */,
+                               C9EB334F138F75580075BB52 /* bcopy.c in Sources */,
+                               C9EB3350138F75580075BB52 /* bzero.c in Sources */,
+                               C9EB3351138F75580075BB52 /* memcpy.c in Sources */,
+                               C9EB3352138F75580075BB52 /* memmove.c in Sources */,
+                               C9EB3353138F75580075BB52 /* atomic.c in Sources */,
+                               C9EB3354138F75580075BB52 /* mach_absolute_time.c in Sources */,
+                               C9EB3355138F75580075BB52 /* spinlocks.c in Sources */,
+                               C9EB3368138F75580075BB52 /* ascii.c in Sources */,
+                               C9EB3369138F75580075BB52 /* big5.c in Sources */,
+                               C9EB336A138F75580075BB52 /* btowc.c in Sources */,
+                               C9EB336B138F75580075BB52 /* collate.c in Sources */,
+                               C9EB336C138F75580075BB52 /* collcmp.c in Sources */,
+                               C9EB336D138F75580075BB52 /* euc.c in Sources */,
+                               C9EB336E138F75580075BB52 /* fix_grouping.c in Sources */,
+                               C9EB336F138F75580075BB52 /* gb18030.c in Sources */,
+                               C9EB3370138F75580075BB52 /* gb2312.c in Sources */,
+                               C9EB3371138F75580075BB52 /* gbk.c in Sources */,
+                               C9EB3372138F75580075BB52 /* ldpart.c in Sources */,
+                               C9EB3373138F75580075BB52 /* lmessages.c in Sources */,
+                               C9EB3374138F75580075BB52 /* lmonetary.c in Sources */,
+                               C9EB3375138F75580075BB52 /* lnumeric.c in Sources */,
+                               C9EB3376138F75580075BB52 /* localeconv.c in Sources */,
+                               C9EB3377138F75580075BB52 /* mblen.c in Sources */,
+                               C9EB3378138F75580075BB52 /* mbrlen.c in Sources */,
+                               C9EB3379138F75580075BB52 /* mbrtowc.c in Sources */,
+                               C9EB337A138F75580075BB52 /* mbsinit.c in Sources */,
+                               C9EB337B138F75580075BB52 /* mbsnrtowcs.c in Sources */,
+                               C9EB337C138F75580075BB52 /* mbsrtowcs.c in Sources */,
+                               C9EB337D138F75580075BB52 /* mbstowcs.c in Sources */,
+                               C9EB337E138F75580075BB52 /* mbtowc.c in Sources */,
+                               C9EB337F138F75580075BB52 /* mskanji.c in Sources */,
+                               C9EB3380138F75580075BB52 /* nextwctype.c in Sources */,
+                               C9EB3381138F75580075BB52 /* nl_langinfo.c in Sources */,
+                               C9EB3382138F75580075BB52 /* nomacros.c in Sources */,
+                               C9EB3383138F75580075BB52 /* none.c in Sources */,
+                               C9EB3384138F75580075BB52 /* rune.c in Sources */,
+                               C9EB3385138F75580075BB52 /* runetype.c in Sources */,
+                               C9EB3386138F75580075BB52 /* setlocale.c in Sources */,
+                               C9EB3387138F75580075BB52 /* setrunelocale.c in Sources */,
+                               C9EB3388138F75580075BB52 /* table.c in Sources */,
+                               C9EB3389138F75580075BB52 /* tolower.c in Sources */,
+                               C9EB338A138F75580075BB52 /* toupper.c in Sources */,
+                               C9EB338B138F75580075BB52 /* utf2.c in Sources */,
+                               C9EB338C138F75580075BB52 /* utf8.c in Sources */,
+                               C9EB338D138F75580075BB52 /* wcrtomb.c in Sources */,
+                               C9EB338E138F75580075BB52 /* wcsftime.c in Sources */,
+                               C9EB338F138F75580075BB52 /* wcsnrtombs.c in Sources */,
+                               C9EB3390138F75580075BB52 /* wcsrtombs.c in Sources */,
+                               C9EB3391138F75580075BB52 /* wcstod.c in Sources */,
+                               C9EB3392138F75580075BB52 /* wcstof.c in Sources */,
+                               C9EB3393138F75580075BB52 /* wcstoimax.c in Sources */,
+                               C9EB3394138F75580075BB52 /* wcstol.c in Sources */,
+                               C9EB3395138F75580075BB52 /* wcstold.c in Sources */,
+                               C9EB3396138F75580075BB52 /* wcstoll.c in Sources */,
+                               C9EB3397138F75580075BB52 /* wcstombs.c in Sources */,
+                               C9EB3398138F75580075BB52 /* wcstoul.c in Sources */,
+                               C9EB3399138F75580075BB52 /* wcstoull.c in Sources */,
+                               C9EB339A138F75580075BB52 /* wcstoumax.c in Sources */,
+                               C9EB339B138F75580075BB52 /* wctob.c in Sources */,
+                               C9EB339C138F75580075BB52 /* wctomb.c in Sources */,
+                               C9EB339D138F75580075BB52 /* wctrans.c in Sources */,
+                               C9EB339E138F75580075BB52 /* wctype.c in Sources */,
+                               C9EB339F138F75580075BB52 /* wcwidth.c in Sources */,
+                               C9EB33A0138F75580075BB52 /* frune.c in Sources */,
+                               C9EB33A1138F75580075BB52 /* isctype.c in Sources */,
+                               C9EB33A2138F75580075BB52 /* iswctype.c in Sources */,
+                               C9EB33A3138F75580075BB52 /* lconv.c in Sources */,
+                               C9EB33A4138F75580075BB52 /* mbrune.c in Sources */,
+                               C9EB33A5138F75580075BB52 /* runedepreciated.c in Sources */,
+                               C9EB33A6138F75580075BB52 /* setinvalidrune.c in Sources */,
+                               C9EB33A7138F75580075BB52 /* xlocale.c in Sources */,
+                               C9EB33A8138F75580075BB52 /* addr2ascii.c in Sources */,
+                               C9EB33A9138F75580075BB52 /* ascii2addr.c in Sources */,
+                               C9EB33AA138F75580075BB52 /* inet_addr.c in Sources */,
+                               C9EB33AB138F75580075BB52 /* inet_lnaof.c in Sources */,
+                               C9EB33AC138F75580075BB52 /* inet_makeaddr.c in Sources */,
+                               C9EB33AD138F75580075BB52 /* inet_net_ntop.c in Sources */,
+                               C9EB33AE138F75580075BB52 /* inet_net_pton.c in Sources */,
+                               C9EB33AF138F75580075BB52 /* inet_neta.c in Sources */,
+                               C9EB33B0138F75580075BB52 /* inet_netof.c in Sources */,
+                               C9EB33B1138F75580075BB52 /* inet_network.c in Sources */,
+                               C9EB33B2138F75580075BB52 /* inet_ntoa.c in Sources */,
+                               C9EB33B3138F75580075BB52 /* linkaddr.c in Sources */,
+                               C9EB33B4138F75580075BB52 /* nsap_addr.c in Sources */,
+                               C9EB33B5138F75580075BB52 /* recv.c in Sources */,
+                               C9EB33B6138F75580075BB52 /* send.c in Sources */,
+                               C9EB33B7138F75580075BB52 /* sockatmark.c in Sources */,
+                               C9EB33B8138F75580075BB52 /* sourcefilter.c in Sources */,
+                               C9EB33B9138F75580075BB52 /* msgcat.c in Sources */,
+                               C9EB33BA138F75580075BB52 /* acl.c in Sources */,
+                               C9EB33BB138F75580075BB52 /* acl_entry.c in Sources */,
+                               C9EB33BC138F75580075BB52 /* acl_file.c in Sources */,
+                               C9EB33BD138F75580075BB52 /* acl_flag.c in Sources */,
+                               C9EB33BE138F75580075BB52 /* acl_perm.c in Sources */,
+                               C9EB33BF138F75580075BB52 /* acl_translate.c in Sources */,
+                               C9EB33C8138F75580075BB52 /* mk_pthread_impl.c in Sources */,
+                               C9EB33C9138F75580075BB52 /* pthread.c in Sources */,
+                               C9EB33CA138F75580075BB52 /* pthread_cancelable.c in Sources */,
+                               C9EB33CB138F75580075BB52 /* pthread_cond.c in Sources */,
+                               C9EB33CC138F75580075BB52 /* pthread_mutex.c in Sources */,
+                               C9EB33CD138F75580075BB52 /* pthread_rwlock.c in Sources */,
+                               C9EB33CE138F75580075BB52 /* pthread_tsd.c in Sources */,
+                               C9EB33CF138F75580075BB52 /* pthread_atfork_test.c in Sources */,
+                               C9EB33D0138F75580075BB52 /* thread_setup.c in Sources */,
+                               C9EB33D3138F75580075BB52 /* regerror.c in Sources */,
+                               C9EB33D6138F75580075BB52 /* chk_fail.c in Sources */,
+                               C9EB33D7138F75580075BB52 /* memcpy_chk.c in Sources */,
+                               C9EB33D8138F75580075BB52 /* memmove_chk.c in Sources */,
+                               C9EB33D9138F75580075BB52 /* memset_chk.c in Sources */,
+                               C9EB33DA138F75580075BB52 /* snprintf_chk.c in Sources */,
+                               C9EB33DB138F75580075BB52 /* sprintf_chk.c in Sources */,
+                               C9EB33DC138F75580075BB52 /* stpcpy_chk.c in Sources */,
+                               C9EB33DD138F75580075BB52 /* stpncpy_chk.c in Sources */,
+                               C9EB33DE138F75580075BB52 /* strcat_chk.c in Sources */,
+                               C9EB33DF138F75580075BB52 /* strcpy_chk.c in Sources */,
+                               C9EB33E0138F75580075BB52 /* strncat_chk.c in Sources */,
+                               C9EB33E1138F75580075BB52 /* strncpy_chk.c in Sources */,
+                               C9EB33E2138F75580075BB52 /* vsnprintf_chk.c in Sources */,
+                               C9EB33E3138F75580075BB52 /* vsprintf_chk.c in Sources */,
+                               C9EB33E4138F75580075BB52 /* _flock_stub.c in Sources */,
+                               C9EB33E5138F75580075BB52 /* asprintf.c in Sources */,
+                               C9EB33E6138F75580075BB52 /* clrerr.c in Sources */,
+                               C9EB33E7138F75580075BB52 /* dprintf.c in Sources */,
+                               C9EB33E8138F75580075BB52 /* fclose.c in Sources */,
+                               C9EB33E9138F75580075BB52 /* fdopen.c in Sources */,
+                               C9EB33EA138F75580075BB52 /* feof.c in Sources */,
+                               C9EB33EB138F75580075BB52 /* ferror.c in Sources */,
+                               C9EB33EC138F75580075BB52 /* fflush.c in Sources */,
+                               C9EB33ED138F75580075BB52 /* fgetc.c in Sources */,
+                               C9EB33EE138F75580075BB52 /* fgetln.c in Sources */,
+                               C9EB33EF138F75580075BB52 /* fgetpos.c in Sources */,
+                               C9EB33F0138F75580075BB52 /* fgets.c in Sources */,
+                               C9EB33F1138F75580075BB52 /* fgetwc.c in Sources */,
+                               C9EB33F2138F75580075BB52 /* fgetwln.c in Sources */,
+                               C9EB33F3138F75580075BB52 /* fgetws.c in Sources */,
+                               C9EB33F4138F75580075BB52 /* fileno.c in Sources */,
+                               C9EB33F5138F75580075BB52 /* findfp.c in Sources */,
+                               C9EB33F6138F75580075BB52 /* flags.c in Sources */,
+                               C9EB33F7138F75580075BB52 /* fopen.c in Sources */,
+                               C9EB33F8138F75580075BB52 /* fprintf.c in Sources */,
+                               C9EB33F9138F75580075BB52 /* fpurge.c in Sources */,
+                               C9EB33FA138F75580075BB52 /* fputc.c in Sources */,
+                               C9EB33FB138F75580075BB52 /* fputs.c in Sources */,
+                               C9EB33FC138F75580075BB52 /* fputwc.c in Sources */,
+                               C9EB33FD138F75580075BB52 /* fputws.c in Sources */,
+                               C9EB33FE138F75580075BB52 /* fread.c in Sources */,
+                               C9EB33FF138F75580075BB52 /* freopen.c in Sources */,
+                               C9EB3400138F75580075BB52 /* fscanf.c in Sources */,
+                               C9EB3401138F75580075BB52 /* fseek.c in Sources */,
+                               C9EB3402138F75580075BB52 /* fsetpos.c in Sources */,
+                               C9EB3403138F75580075BB52 /* ftell.c in Sources */,
+                               C9EB3404138F75580075BB52 /* funopen.c in Sources */,
+                               C9EB3405138F75580075BB52 /* fvwrite.c in Sources */,
+                               C9EB3406138F75580075BB52 /* fwalk.c in Sources */,
+                               C9EB3407138F75580075BB52 /* fwide.c in Sources */,
+                               C9EB3408138F75580075BB52 /* fwprintf.c in Sources */,
+                               C9EB3409138F75580075BB52 /* fwrite.c in Sources */,
+                               C9EB340A138F75580075BB52 /* fwscanf.c in Sources */,
+                               C9EB340B138F75580075BB52 /* getc.c in Sources */,
+                               C9EB340C138F75580075BB52 /* getchar.c in Sources */,
+                               C9EB340D138F75580075BB52 /* getdelim.c in Sources */,
+                               C9EB340E138F75580075BB52 /* getline.c in Sources */,
+                               C9EB340F138F75580075BB52 /* gets.c in Sources */,
+                               C9EB3410138F75580075BB52 /* getw.c in Sources */,
+                               C9EB3411138F75580075BB52 /* getwc.c in Sources */,
+                               C9EB3412138F75580075BB52 /* getwchar.c in Sources */,
+                               C9EB3413138F75580075BB52 /* makebuf.c in Sources */,
+                               C9EB3414138F75580075BB52 /* mktemp.c in Sources */,
+                               C9EB3415138F75580075BB52 /* perror.c in Sources */,
+                               C9EB3416138F75580075BB52 /* printf-pos.c in Sources */,
+                               C9EB3417138F75580075BB52 /* printf.c in Sources */,
+                               C9EB3418138F75580075BB52 /* putc.c in Sources */,
+                               C9EB3419138F75580075BB52 /* putchar.c in Sources */,
+                               C9EB341A138F75580075BB52 /* puts.c in Sources */,
+                               C9EB341B138F75580075BB52 /* putw.c in Sources */,
+                               C9EB341C138F75580075BB52 /* putwc.c in Sources */,
+                               C9EB341D138F75580075BB52 /* putwchar.c in Sources */,
+                               C9EB341E138F75580075BB52 /* refill.c in Sources */,
+                               C9EB341F138F75580075BB52 /* remove.c in Sources */,
+                               C9EB3420138F75580075BB52 /* rewind.c in Sources */,
+                               C9EB3421138F75580075BB52 /* rget.c in Sources */,
+                               C9EB3422138F75580075BB52 /* scanf.c in Sources */,
+                               C9EB3423138F75580075BB52 /* setbuf.c in Sources */,
+                               C9EB3424138F75580075BB52 /* setbuffer.c in Sources */,
+                               C9EB3425138F75580075BB52 /* setvbuf.c in Sources */,
+                               C9EB3426138F75580075BB52 /* snprintf.c in Sources */,
+                               C9EB3427138F75580075BB52 /* sprintf.c in Sources */,
+                               C9EB3428138F75580075BB52 /* sscanf.c in Sources */,
+                               C9EB3429138F75580075BB52 /* stdio.c in Sources */,
+                               C9EB342A138F75580075BB52 /* swprintf.c in Sources */,
+                               C9EB342B138F75580075BB52 /* swscanf.c in Sources */,
+                               C9EB342C138F75580075BB52 /* tempnam.c in Sources */,
+                               C9EB342D138F75580075BB52 /* tmpfile.c in Sources */,
+                               C9EB342E138F75580075BB52 /* tmpnam.c in Sources */,
+                               C9EB342F138F75580075BB52 /* ungetc.c in Sources */,
+                               C9EB3430138F75580075BB52 /* ungetwc.c in Sources */,
+                               C9EB3431138F75580075BB52 /* vasprintf.c in Sources */,
+                               C9EB3432138F75580075BB52 /* vdprintf.c in Sources */,
+                               C9EB3433138F75580075BB52 /* vfprintf.c in Sources */,
+                               C9EB3434138F75580075BB52 /* vfscanf.c in Sources */,
+                               C9EB3435138F75580075BB52 /* vfwprintf.c in Sources */,
+                               C9EB3436138F75580075BB52 /* vfwscanf.c in Sources */,
+                               C9EB3437138F75580075BB52 /* vprintf.c in Sources */,
+                               C9EB3438138F75580075BB52 /* vscanf.c in Sources */,
+                               C9EB3439138F75580075BB52 /* vsnprintf.c in Sources */,
+                               C9EB343A138F75580075BB52 /* vsprintf.c in Sources */,
+                               C9EB343B138F75580075BB52 /* vsscanf.c in Sources */,
+                               C9EB343C138F75580075BB52 /* vswprintf.c in Sources */,
+                               C9EB343D138F75580075BB52 /* vswscanf.c in Sources */,
+                               C9EB343E138F75580075BB52 /* vwprintf.c in Sources */,
+                               C9EB343F138F75580075BB52 /* vwscanf.c in Sources */,
+                               C9EB3440138F75580075BB52 /* wbuf.c in Sources */,
+                               C9EB3441138F75580075BB52 /* wprintf.c in Sources */,
+                               C9EB3442138F75580075BB52 /* wscanf.c in Sources */,
+                               C9EB3443138F75580075BB52 /* wsetup.c in Sources */,
+                               C9EB3444138F75580075BB52 /* a64l.c in Sources */,
+                               C9EB3445138F75580075BB52 /* _Exit_.c in Sources */,
+                               C9EB3446138F75580075BB52 /* abort.c in Sources */,
+                               C9EB3447138F75580075BB52 /* abs.c in Sources */,
+                               C9EB3448138F75580075BB52 /* atexit.c in Sources */,
+                               C9EB3449138F75580075BB52 /* atof.c in Sources */,
+                               C9EB344A138F75580075BB52 /* atoi.c in Sources */,
+                               C9EB344B138F75580075BB52 /* atol.c in Sources */,
+                               C9EB344C138F75580075BB52 /* atoll.c in Sources */,
+                               C9EB344D138F75580075BB52 /* bsearch.c in Sources */,
+                               C9EB344E138F75580075BB52 /* div.c in Sources */,
+                               C9EB344F138F75580075BB52 /* exit.c in Sources */,
+                               C9EB3450138F75580075BB52 /* getenv.c in Sources */,
+                               C9EB3451138F75580075BB52 /* getopt.c in Sources */,
+                               C9EB3452138F75580075BB52 /* getopt_long.c in Sources */,
+                               C9EB3453138F75580075BB52 /* getsubopt.c in Sources */,
+                               C9EB3454138F75580075BB52 /* hcreate.c in Sources */,
+                               C9EB3455138F75580075BB52 /* heapsort.c in Sources */,
+                               C9EB3456138F75580075BB52 /* heapsort_b.c in Sources */,
+                               C9EB3457138F75580075BB52 /* heapsort_r.c in Sources */,
+                               C9EB3458138F75580075BB52 /* imaxabs.c in Sources */,
+                               C9EB3459138F75580075BB52 /* imaxdiv.c in Sources */,
+                               C9EB345A138F75580075BB52 /* insque.c in Sources */,
+                               C9EB345B138F75580075BB52 /* labs.c in Sources */,
+                               C9EB345C138F75580075BB52 /* ldiv.c in Sources */,
+                               C9EB345D138F75580075BB52 /* llabs.c in Sources */,
+                               C9EB345E138F75580075BB52 /* lldiv.c in Sources */,
+                               C9EB345F138F75580075BB52 /* lsearch.c in Sources */,
+                               C9EB3460138F75580075BB52 /* merge.c in Sources */,
+                               C9EB3461138F75580075BB52 /* putenv.c in Sources */,
+                               C9EB3462138F75580075BB52 /* qsort.c in Sources */,
+                               C9EB3463138F75580075BB52 /* qsort_r.c in Sources */,
+                               C9EB3464138F75580075BB52 /* radixsort.c in Sources */,
+                               C9EB3465138F75580075BB52 /* rand.c in Sources */,
+                               C9EB3466138F75580075BB52 /* random.c in Sources */,
+                               C9EB3467138F75580075BB52 /* reallocf.c in Sources */,
+                               C9EB3468138F75580075BB52 /* realpath.c in Sources */,
+                               C9EB3469138F75580075BB52 /* remque.c in Sources */,
+                               C9EB346A138F75580075BB52 /* setenv.c in Sources */,
+                               C9EB346B138F75580075BB52 /* strhash.c in Sources */,
+                               C9EB346C138F75580075BB52 /* strtoimax.c in Sources */,
+                               C9EB346D138F75580075BB52 /* strtol.c in Sources */,
+                               C9EB346E138F75580075BB52 /* strtoll.c in Sources */,
+                               C9EB346F138F75580075BB52 /* strtoq.c in Sources */,
+                               C9EB3470138F75580075BB52 /* strtoul.c in Sources */,
+                               C9EB3471138F75580075BB52 /* strtoull.c in Sources */,
+                               C9EB3472138F75580075BB52 /* strtoumax.c in Sources */,
+                               C9EB3473138F75580075BB52 /* strtouq.c in Sources */,
+                               C9EB3474138F75580075BB52 /* system.c in Sources */,
+                               C9EB3475138F75580075BB52 /* tdelete.c in Sources */,
+                               C9EB3476138F75580075BB52 /* tfind.c in Sources */,
+                               C9EB3477138F75580075BB52 /* tsearch.c in Sources */,
+                               C9EB3478138F75580075BB52 /* twalk.c in Sources */,
+                               C9EB3479138F75580075BB52 /* grantpt.c in Sources */,
+                               C9EB347A138F75580075BB52 /* l64a.c in Sources */,
+                               C9EB347B138F75580075BB52 /* strfmon.c in Sources */,
+                               C9EB347C138F75580075BB52 /* ecvt.c in Sources */,
+                               C9EB347D138F75580075BB52 /* gcvt.c in Sources */,
+                               C9EB347E138F75580075BB52 /* qsort_b-fbsd.c in Sources */,
+                               C9EB347F138F75580075BB52 /* asctime.c in Sources */,
+                               C9EB3480138F75580075BB52 /* difftime.c in Sources */,
+                               C9EB3481138F75580075BB52 /* ftime.c in Sources */,
+                               C9EB3482138F75580075BB52 /* localtime.c in Sources */,
+                               C9EB3483138F75580075BB52 /* strftime.c in Sources */,
+                               C9EB3484138F75580075BB52 /* strptime.c in Sources */,
+                               C9EB3485138F75580075BB52 /* time32.c in Sources */,
+                               C9EB3486138F75580075BB52 /* timelocal.c in Sources */,
+                               C9EB3487138F75580075BB52 /* getdate.c in Sources */,
+                               C9EB3488138F75580075BB52 /* timezone_unix03.c in Sources */,
+                               C9EB3489138F75580075BB52 /* bcmp.c in Sources */,
+                               C9EB348A138F75580075BB52 /* bcopy.c in Sources */,
+                               C9EB348B138F75580075BB52 /* bzero.c in Sources */,
+                               C9EB348C138F75580075BB52 /* index.c in Sources */,
+                               C9EB348D138F75580075BB52 /* memccpy.c in Sources */,
+                               C9EB348E138F75580075BB52 /* memchr.c in Sources */,
+                               C9EB348F138F75580075BB52 /* memcmp.c in Sources */,
+                               C9EB3490138F75580075BB52 /* memcpy.c in Sources */,
+                               C9EB3491138F75580075BB52 /* memmem.c in Sources */,
+                               C9EB3492138F75580075BB52 /* memmove.c in Sources */,
+                               C9EB3493138F75580075BB52 /* memset.c in Sources */,
+                               C9EB3494138F75580075BB52 /* rindex.c in Sources */,
+                               C9EB3497138F75580075BB52 /* strcasecmp.c in Sources */,
+                               C9EB3498138F75580075BB52 /* strcasestr.c in Sources */,
+                               C9EB349A138F75580075BB52 /* strchr.c in Sources */,
+                               C9EB349B138F75580075BB52 /* strcmp.c in Sources */,
+                               C9EB349C138F75580075BB52 /* strcoll.c in Sources */,
+                               C9EB349E138F75580075BB52 /* strcspn.c in Sources */,
+                               C9EB349F138F75580075BB52 /* strdup.c in Sources */,
+                               C9EB34A0138F75580075BB52 /* strerror.c in Sources */,
+                               C9EB34A3138F75580075BB52 /* strlen.c in Sources */,
+                               C9EB34A4138F75580075BB52 /* strmode.c in Sources */,
+                               C9EB34A6138F75580075BB52 /* strncmp.c in Sources */,
+                               C9EB34A8138F75580075BB52 /* strndup.c in Sources */,
+                               C9EB34A9138F75580075BB52 /* strnlen.c in Sources */,
+                               C9EB34AA138F75580075BB52 /* strnstr.c in Sources */,
+                               C9EB34AB138F75580075BB52 /* strpbrk.c in Sources */,
+                               C9EB34AC138F75580075BB52 /* strrchr.c in Sources */,
+                               C9EB34AD138F75580075BB52 /* strsep.c in Sources */,
+                               C9EB34AE138F75580075BB52 /* strsignal.c in Sources */,
+                               C9EB34AF138F75580075BB52 /* strspn.c in Sources */,
+                               C9EB34B0138F75580075BB52 /* strstr.c in Sources */,
+                               C9EB34B1138F75580075BB52 /* strtok.c in Sources */,
+                               C9EB34B2138F75580075BB52 /* strxfrm.c in Sources */,
+                               C9EB34B3138F75580075BB52 /* swab.c in Sources */,
+                               C9EB34B4138F75580075BB52 /* wcpcpy.c in Sources */,
+                               C9EB34B5138F75580075BB52 /* wcpncpy.c in Sources */,
+                               C9EB34B6138F75580075BB52 /* wcscasecmp.c in Sources */,
+                               C9EB34B7138F75580075BB52 /* wcscat.c in Sources */,
+                               C9EB34B8138F75580075BB52 /* wcschr.c in Sources */,
+                               C9EB34B9138F75580075BB52 /* wcscmp.c in Sources */,
+                               C9EB34BA138F75580075BB52 /* wcscoll.c in Sources */,
+                               C9EB34BB138F75580075BB52 /* wcscpy.c in Sources */,
+                               C9EB34BC138F75580075BB52 /* wcscspn.c in Sources */,
+                               C9EB34BD138F75580075BB52 /* wcsdup.c in Sources */,
+                               C9EB34BE138F75580075BB52 /* wcslcat.c in Sources */,
+                               C9EB34BF138F75580075BB52 /* wcslcpy.c in Sources */,
+                               C9EB34C0138F75580075BB52 /* wcslen.c in Sources */,
+                               C9EB34C1138F75580075BB52 /* wcsncasecmp.c in Sources */,
+                               C9EB34C2138F75580075BB52 /* wcsncat.c in Sources */,
+                               C9EB34C3138F75580075BB52 /* wcsncmp.c in Sources */,
+                               C9EB34C4138F75580075BB52 /* wcsncpy.c in Sources */,
+                               C9EB34C5138F75580075BB52 /* wcsnlen.c in Sources */,
+                               C9EB34C6138F75580075BB52 /* wcspbrk.c in Sources */,
+                               C9EB34C7138F75580075BB52 /* wcsrchr.c in Sources */,
+                               C9EB34C8138F75580075BB52 /* wcsspn.c in Sources */,
+                               C9EB34C9138F75580075BB52 /* wcsstr.c in Sources */,
+                               C9EB34CA138F75580075BB52 /* wcstok.c in Sources */,
+                               C9EB34CB138F75580075BB52 /* wcswidth.c in Sources */,
+                               C9EB34CC138F75580075BB52 /* wcsxfrm.c in Sources */,
+                               C9EB34CD138F75580075BB52 /* wmemchr.c in Sources */,
+                               C9EB34CE138F75580075BB52 /* wmemcmp.c in Sources */,
+                               C9EB34CF138F75580075BB52 /* wmemcpy.c in Sources */,
+                               C9EB34D0138F75580075BB52 /* wmemmove.c in Sources */,
+                               C9EB34D1138F75580075BB52 /* wmemset.c in Sources */,
+                               C9EB34D2138F75580075BB52 /* __libc_init.c in Sources */,
+                               C9EB34D3138F75580075BB52 /* _libc_fork_child.c in Sources */,
+                               C9EB34D4138F75580075BB52 /* chmodx_np.c in Sources */,
+                               C9EB34D5138F75580075BB52 /* context-stubs.c in Sources */,
+                               C9EB34D6138F75580075BB52 /* crt_externs.c in Sources */,
+                               C9EB34D7138F75580075BB52 /* errno.c in Sources */,
+                               C9EB34D8138F75580075BB52 /* fork.c in Sources */,
+                               C9EB34D9138F75580075BB52 /* getgroups.c in Sources */,
+                               C9EB34DA138F75580075BB52 /* getiopolicy_np.c in Sources */,
+                               C9EB34DB138F75580075BB52 /* gettimeofday.c in Sources */,
+                               C9EB34DC138F75580075BB52 /* msgctl.c in Sources */,
+                               C9EB34DD138F75580075BB52 /* stack_protector.c in Sources */,
+                               C9EB34DE138F75580075BB52 /* openx_np.c in Sources */,
+                               C9EB34DF138F75580075BB52 /* OSMemoryNotification.c in Sources */,
+                               C9EB34E0138F75580075BB52 /* OSThermalNotification.c in Sources */,
+                               C9EB34E1138F75580075BB52 /* posix_spawn.c in Sources */,
+                               C9EB34E2138F75580075BB52 /* semctl.c in Sources */,
+                               C9EB34E3138F75580075BB52 /* settimeofday.c in Sources */,
+                               C9EB34E4138F75580075BB52 /* shmctl.c in Sources */,
+                               C9EB34E5138F75580075BB52 /* sigaction.c in Sources */,
+                               C9EB34E6138F75580075BB52 /* sigcatch.c in Sources */,
+                               C9EB34E7138F75580075BB52 /* sigtramp.c in Sources */,
+                               C9EB34E8138F75580075BB52 /* slot_name.c in Sources */,
+                               C9EB34E9138F75580075BB52 /* statx_np.c in Sources */,
+                               C9EB34EA138F75580075BB52 /* umaskx_np.c in Sources */,
+                               C9EB34EB138F75580075BB52 /* cprocs.c in Sources */,
+                               C9EB34EC138F75580075BB52 /* cthreads.c in Sources */,
+                               C9EB34ED138F75580075BB52 /* mig_support.c in Sources */,
+                               C9EB34EE138F75580075BB52 /* fparseln.c in Sources */,
+                               C9EB34EF138F75580075BB52 /* login.c in Sources */,
+                               C9EB34F0138F75580075BB52 /* login_tty.c in Sources */,
+                               C9EB34F1138F75580075BB52 /* logout.c in Sources */,
+                               C9EB34F2138F75580075BB52 /* logwtmp.c in Sources */,
+                               3F76864C13E91D4B00C94D25 /* mkpath_np.c in Sources */,
+                               C9EB34F3138F75580075BB52 /* opendev.c in Sources */,
+                               C9EB34F4138F75580075BB52 /* pty.c in Sources */,
+                               C9EB34F5138F75580075BB52 /* clear.c in Sources */,
+                               C9EB34F6138F75580075BB52 /* compare.c in Sources */,
+                               C9EB34F7138F75580075BB52 /* copy.c in Sources */,
+                               C9EB34F8138F75580075BB52 /* gen_uuid.c in Sources */,
+                               C9EB34F9138F75580075BB52 /* isnull.c in Sources */,
+                               C9EB34FA138F75580075BB52 /* pack.c in Sources */,
+                               C9EB34FB138F75580075BB52 /* parse.c in Sources */,
+                               C9EB34FC138F75580075BB52 /* unpack.c in Sources */,
+                               C9EB34FD138F75580075BB52 /* unparse.c in Sources */,
+                               C9EB34FE138F75580075BB52 /* getmcontext.c in Sources */,
+                               C9EB34FF138F75580075BB52 /* makecontext.c in Sources */,
+                               C9EB3500138F75580075BB52 /* setcontext.c in Sources */,
+                               C9EB3501138F75580075BB52 /* swapcontext.c in Sources */,
+                               C9EB3502138F75580075BB52 /* bcopy.c in Sources */,
+                               C9EB3503138F75580075BB52 /* bzero.c in Sources */,
+                               C9EB3504138F75580075BB52 /* memcpy.c in Sources */,
+                               C9EB3505138F75580075BB52 /* memmove.c in Sources */,
+                               C9EB3506138F75580075BB52 /* atomic.c in Sources */,
+                               C9EB3507138F75580075BB52 /* spinlocks.c in Sources */,
+                               C9EB3510138F76A10075BB52 /* scandir_b.c in Sources */,
+                               3F2208EF14358B4A00386F5B /* asl_fd.c in Sources */,
+                               B19C64631450F90200032373 /* sync_volume_np.c in Sources */,
+                               3FB7E1BB146EF2E000843438 /* dirfd.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+               B122F2D91432BA8700AF95D0 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = B122F0E71432B8E600AF95D0 /* TRE */;
+                       targetProxy = B122F2D81432BA8700AF95D0 /* PBXContainerItemProxy */;
+               };
+               B1E96509157E749200FCCEE7 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = B1E96340157E722200FCCEE7 /* FreeBSD_gcc */;
+                       targetProxy = B1E96508157E749200FCCEE7 /* PBXContainerItemProxy */;
+               };
+               C942130913901709004BA536 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C942102D13900C8A004BA536 /* libc.a */;
+                       targetProxy = C942130813901709004BA536 /* PBXContainerItemProxy */;
+               };
+               C95B817D138F3F72004311DA /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C95B7ED9138F3C55004311DA /* Variant_DarwinExtsn */;
+                       targetProxy = C95B817C138F3F72004311DA /* PBXContainerItemProxy */;
+               };
+               C95B8428138F5388004311DA /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C95B8184138F52B0004311DA /* Variant_DarwinExtsn_Cancelable */;
+                       targetProxy = C95B8427138F5388004311DA /* PBXContainerItemProxy */;
+               };
+               C95B86CC138F546E004311DA /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C95B842A138F53DB004311DA /* Variant_Pre1050 */;
+                       targetProxy = C95B86CB138F546E004311DA /* PBXContainerItemProxy */;
+               };
+               C9BD3C39138F16EE00B389FD /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9D9435F138EC3E300FB7ACC /* Variant_Cancelable */;
+                       targetProxy = C9BD3C38138F16EE00B389FD /* PBXContainerItemProxy */;
+               };
+               C9D94335138DB75F00FB7ACC /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9B53E2B138DA0610028D27C /* Platform */;
+                       targetProxy = C9D94334138DB75F00FB7ACC /* PBXContainerItemProxy */;
+               };
+               C9EB326D138F74D20075BB52 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9EB2FC9138F6D880075BB52 /* Variant_Legacy */;
+                       targetProxy = C9EB326C138F74D20075BB52 /* PBXContainerItemProxy */;
+               };
+               C9EB3515138F771F0075BB52 /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9EB326F138F75580075BB52 /* Variant_Inode32 */;
+                       targetProxy = C9EB3514138F771F0075BB52 /* PBXContainerItemProxy */;
+               };
+               C9FA32C8138E41800089A94B /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9C2A94C138DFFD900287F00 /* Base */;
+                       targetProxy = C9FA32C7138E41800089A94B /* PBXContainerItemProxy */;
+               };
+               C9FA32CA138E41800089A94B /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9257ECF138E1B5000B3107C /* FreeBSD */;
+                       targetProxy = C9FA32C9138E41800089A94B /* PBXContainerItemProxy */;
+               };
+               C9FA32CC138E41800089A94B /* PBXTargetDependency */ = {
+                       isa = PBXTargetDependency;
+                       target = C9258093138E2D3100B3107C /* NetBSD */;
+                       targetProxy = C9FA32CB138E41800089A94B /* PBXContainerItemProxy */;
+               };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+               B122F2AB1432B8E600AF95D0 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(FreeBSD_EXCLUDED_SOURCE_GDTOA)",
+                                       "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = TRE;
+                       };
+                       name = Debug;
+               };
+               B122F2AC1432B8E600AF95D0 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(FreeBSD_EXCLUDED_SOURCE_GDTOA)",
+                                       "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = TRE;
+                       };
+                       name = Release;
+               };
+               B1E96504157E722200FCCEE7 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(FreeBSD_EXCLUDED_SOURCE_GDTOA)",
+                                       "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+                               GCC_VERSION = com.apple.compilers.llvmgcc42;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = FreeBSD_gcc;
+                       };
+                       name = Debug;
+               };
+               B1E96505157E722200FCCEE7 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(FreeBSD_EXCLUDED_SOURCE_GDTOA)",
+                                       "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_VERSION = com.apple.compilers.llvmgcc42;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = FreeBSD_gcc;
+                       };
+                       name = Release;
+               };
+               C9257ED1138E1B5000B3107C /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(FreeBSD_EXCLUDED_SOURCE_GDTOA)",
+                                       "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Debug;
+               };
+               C9257ED2138E1B5000B3107C /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(FreeBSD_EXCLUDED_SOURCE_GDTOA)",
+                                       "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Release;
+               };
+               C9258103138E2D3100B3107C /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+                               PRODUCT_NAME = NetBSD;
+                       };
+                       name = Debug;
+               };
+               C9258104138E2D3100B3107C /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                               GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+                               PRODUCT_NAME = NetBSD;
+                       };
+                       name = Release;
+               };
+               C94212CA13900C8A004BA536 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               INSTALL_PATH = /usr/local/lib/dyld;
+                               PRODUCT_NAME = c;
+                               SKIP_INSTALL = NO;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                               VARIANT = DYLD;
+                       };
+                       name = Debug;
+               };
+               C94212CB13900C8A004BA536 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               INSTALL_PATH = /usr/local/lib/dyld;
+                               PRODUCT_NAME = c;
+                               SKIP_INSTALL = NO;
+                               STRIP_INSTALLED_PRODUCT = NO;
+                               VARIANT = DYLD;
+                       };
+                       name = Release;
+               };
+               C95B8174138F3C55004311DA /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vDarwinExtsn;
+                               VARIANT = DARWINEXTSN;
+                       };
+                       name = Debug;
+               };
+               C95B8175138F3C55004311DA /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vDarwinExtsn;
+                               VARIANT = DARWINEXTSN;
+                       };
+                       name = Release;
+               };
+               C95B841F138F52B0004311DA /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vDarwinExtsnCancelable;
+                               VARIANT = DARWINEXTSN_CANCELABLE;
+                       };
+                       name = Debug;
+               };
+               C95B8420138F52B0004311DA /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vDarwinExtsnCancelable;
+                               VARIANT = DARWINEXTSN_CANCELABLE;
+                       };
+                       name = Release;
+               };
+               C95B86C5138F53DB004311DA /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vPre1050;
+                               VARIANT = PRE1050;
+                       };
+                       name = Debug;
+               };
+               C95B86C6138F53DB004311DA /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vPre1050;
+                               VARIANT = PRE1050;
+                       };
+                       name = Release;
+               };
+               C9B5359C138D9A690028D27C /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9C2A948138DF7DD00287F00 /* libc.xcconfig */;
+                       buildSettings = {
+                       };
+                       name = Debug;
+               };
+               C9B5359D138D9A690028D27C /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9C2A948138DF7DD00287F00 /* libc.xcconfig */;
+                       buildSettings = {
+                       };
+                       name = Release;
+               };
+               C9B53E2E138DA0610028D27C /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "*/*/*.c",
+                                       "*/*/*.s",
+                                       "*/*/*.S",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(ARCH_FAMILY)/*/*.c",
+                                       "$(ARCH_FAMILY)/*/*.s",
+                                       "$(ARCH_FAMILY)/*/*.S",
+                               );
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               SKIP_INSTALL = YES;
+                       };
+                       name = Debug;
+               };
+               C9B53E2F138DA0610028D27C /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = (
+                                       "*/*/*.c",
+                                       "*/*/*.s",
+                                       "*/*/*.S",
+                               );
+                               EXECUTABLE_PREFIX = lib;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INCLUDED_SOURCE_FILE_NAMES = (
+                                       "$(ARCH_FAMILY)/*/*.c",
+                                       "$(ARCH_FAMILY)/*/*.s",
+                                       "$(ARCH_FAMILY)/*/*.S",
+                               );
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               SKIP_INSTALL = YES;
+                       };
+                       name = Release;
+               };
+               C9C2A94F138DFFDA00287F00 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(BASE_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Debug;
+               };
+               C9C2A950138DFFDA00287F00 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(BASE_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(BASE_INCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))";
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                       };
+                       name = Release;
+               };
+               C9D94331138DB73300FB7ACC /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       /usr/lib/system,
+                               );
+                               OTHER_LDFLAGS = "$(LIBSYSTEM_C_LDFLAGS)";
+                               PRODUCT_NAME = c;
+                               SKIP_INSTALL = NO;
+                               STRIP_INSTALLED_PRODUCT = YES;
+                               VERSIONING_SYSTEM = "apple-generic";
+                       };
+                       name = Debug;
+               };
+               C9D94332138DB73300FB7ACC /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
+                               LIBRARY_SEARCH_PATHS = (
+                                       "$(inherited)",
+                                       /usr/lib/system,
+                               );
+                               OTHER_LDFLAGS = "$(LIBSYSTEM_C_LDFLAGS)";
+                               PRODUCT_NAME = c;
+                               SKIP_INSTALL = NO;
+                               STRIP_INSTALLED_PRODUCT = YES;
+                               VERSIONING_SYSTEM = "apple-generic";
+                       };
+                       name = Release;
+               };
+               C9D94362138EC3E300FB7ACC /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vCancelable;
+                               VARIANT = CANCELABLE;
+                       };
+                       name = Debug;
+               };
+               C9D94363138EC3E300FB7ACC /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vCancelable;
+                               VARIANT = CANCELABLE;
+                       };
+                       name = Release;
+               };
+               C9EB3264138F6D880075BB52 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vLegacy;
+                               VARIANT = LEGACY;
+                       };
+                       name = Debug;
+               };
+               C9EB3265138F6D880075BB52 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vLegacy;
+                               VARIANT = LEGACY;
+                       };
+                       name = Release;
+               };
+               C9EB350B138F75580075BB52 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vInode32;
+                               VARIANT = INODE32;
+                       };
+                       name = Debug;
+               };
+               C9EB350C138F75580075BB52 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9766153138ECF0000741512 /* variants.xcconfig */;
+                       buildSettings = {
+                               EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)";
+                               EXECUTABLE_PREFIX = lib;
+                               INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)";
+                               PRODUCT_NAME = vInode32;
+                               VARIANT = INODE32;
+                       };
+                       name = Release;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               B122F2AA1432B8E600AF95D0 /* Build configuration list for PBXNativeTarget "TRE" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               B122F2AB1432B8E600AF95D0 /* Debug */,
+                               B122F2AC1432B8E600AF95D0 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               B1E96503157E722200FCCEE7 /* Build configuration list for PBXNativeTarget "FreeBSD_gcc" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               B1E96504157E722200FCCEE7 /* Debug */,
+                               B1E96505157E722200FCCEE7 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9257ED3138E1B5000B3107C /* Build configuration list for PBXNativeTarget "FreeBSD" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9257ED1138E1B5000B3107C /* Debug */,
+                               C9257ED2138E1B5000B3107C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9258102138E2D3100B3107C /* Build configuration list for PBXNativeTarget "NetBSD" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9258103138E2D3100B3107C /* Debug */,
+                               C9258104138E2D3100B3107C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C94212C913900C8A004BA536 /* Build configuration list for PBXNativeTarget "libc.a" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C94212CA13900C8A004BA536 /* Debug */,
+                               C94212CB13900C8A004BA536 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C95B8173138F3C55004311DA /* Build configuration list for PBXNativeTarget "Variant_DarwinExtsn" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C95B8174138F3C55004311DA /* Debug */,
+                               C95B8175138F3C55004311DA /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C95B841E138F52B0004311DA /* Build configuration list for PBXNativeTarget "Variant_DarwinExtsn_Cancelable" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C95B841F138F52B0004311DA /* Debug */,
+                               C95B8420138F52B0004311DA /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C95B86C4138F53DB004311DA /* Build configuration list for PBXNativeTarget "Variant_Pre1050" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C95B86C5138F53DB004311DA /* Debug */,
+                               C95B86C6138F53DB004311DA /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9B5359A138D9A690028D27C /* Build configuration list for PBXProject "Libc" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9B5359C138D9A690028D27C /* Debug */,
+                               C9B5359D138D9A690028D27C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9B53E2D138DA0610028D27C /* Build configuration list for PBXNativeTarget "Platform" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9B53E2E138DA0610028D27C /* Debug */,
+                               C9B53E2F138DA0610028D27C /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9C2A94E138DFFDA00287F00 /* Build configuration list for PBXNativeTarget "Base" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9C2A94F138DFFDA00287F00 /* Debug */,
+                               C9C2A950138DFFDA00287F00 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9D94330138DB73300FB7ACC /* Build configuration list for PBXNativeTarget "libsystem_c.dylib" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9D94331138DB73300FB7ACC /* Debug */,
+                               C9D94332138DB73300FB7ACC /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9D94361138EC3E300FB7ACC /* Build configuration list for PBXNativeTarget "Variant_Cancelable" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9D94362138EC3E300FB7ACC /* Debug */,
+                               C9D94363138EC3E300FB7ACC /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9EB3263138F6D880075BB52 /* Build configuration list for PBXNativeTarget "Variant_Legacy" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9EB3264138F6D880075BB52 /* Debug */,
+                               C9EB3265138F6D880075BB52 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               C9EB350A138F75580075BB52 /* Build configuration list for PBXNativeTarget "Variant_Inode32" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               C9EB350B138F75580075BB52 /* Debug */,
+                               C9EB350C138F75580075BB52 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = C9B53597138D9A690028D27C /* Project object */;
+}
diff --git a/Libc.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Libc.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644 (file)
index 0000000..77138ed
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:Libc.xcodeproj">
+   </FileRef>
+</Workspace>
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index c86cdf5..0000000
--- a/Makefile
+++ /dev/null
@@ -1,101 +0,0 @@
-#      @(#)Makefile    8.2 (Berkeley) 2/3/94
-# $FreeBSD: src/lib/libc/Makefile,v 1.31 2001/08/13 21:48:43 peter Exp $
-#
-# Yes, we build everything with -g, and strip it out later...
-#
-# -faltivec now disables inlining, so we can't use it globally.  Fortunately,
-# only two files need altivec support, so we use file-specific CFLAGS to add
-# the option when needed.
-#
-LIB=c
-SHLIB_MAJOR= 1
-SHLIB_MINOR= 0
-
-.include <CoreOS/Standard/Commands.mk>
-.include <CoreOS/Standard/Variables.mk>
-
-.if !empty(MACHINE_ARCH:M*64)
-LP64 = 1
-.endif
-# RC_TARGET_CONFIG may not be set, so default to MacOSX (which is good enough
-# for installsrc to autopatch all files).
-.ifndef RC_TARGET_CONFIG
-RC_TARGET_CONFIG = MacOSX
-.endif
-
-.ifndef RC_ProjectName
-RC_ProjectName = Libc
-.endif
-
-# Use default compiler, so comment out OTHERCC
-#OTHERCC = gcc-4.0
-# HOSTCC is the compiler on the local host, so we need to unset any SDKROOT
-# to before calling PATH_OF_COMMAND
-.ifdef OTHERCC
-MYCC != ${PATH_OF_COMMAND} ${OTHERCC}
-HOSTCC != export -n SDKROOT && ${PATH_OF_COMMAND} ${OTHERCC}
-.else
-MYCC = ${CC}
-HOSTCC != export -n SDKROOT && ${PATH_OF_COMMAND} cc
-.endif
-GCC_VERSION != ${MYCC} -dumpversion | ${SED} -e 's/^\([^.]*\.[^.]*\).*/\1/'
-GCC_42 != ${PERL} -e "print ($(GCC_VERSION) >= 4.2 ? 'YES' : 'NO')"
-
-.ifdef ALTLIBCHEADERS
-INCLUDEDIR = ${ALTLIBCHEADERS}
-LIBCFLAGS += -I${INCLUDEDIR}
-.else # !ALTLIBCHEADERS
-INCLUDEDIR = ${SDKROOT}/usr/include
-.endif # ALTLIBCHEADERS
-FRAMEWORKS = ${OBJROOT}/Frameworks
-PRIVATEHEADERS = ${FRAMEWORKS}/System.framework/PrivateHeaders
-PRIVINC = -I${PRIVATEHEADERS}
-LIBCFLAGS += ${PRIVINC}
-
-SYMROOTINC = ${SYMROOT}/include
-CFLAGS = -g -arch ${CCARCH} ${RC_NONARCH_CFLAGS} -std=gnu99 -fno-common -fno-builtin -Wmost
-CFLAGS += -D__LIBC__ -D__DARWIN_UNIX03=1 -D__DARWIN_64_BIT_INO_T=1 -D__DARWIN_NON_CANCELABLE=1 -D__DARWIN_VERS_1050=1 -D_FORTIFY_SOURCE=0
-CFLAGS += -DNOID -DLIBC_MAJOR=${SHLIB_MAJOR}
-CFLAGS += -I${.OBJDIR} ${VARIANTINC} -I${SYMROOTINC} -I${.CURDIR}/include
-AINC = -g -arch ${CCARCH} ${RC_NONARCH_CFLAGS}
-AINC += -I${.CURDIR}/${MACHINE_ARCH} ${PRIVINC}
-.if $(MACHINE_ARCH) != arm
-CFLAGS += -force_cpusubtype_ALL
-AINC += -force_cpusubtype_ALL
-.endif
-.ifdef SDKROOT 
-CFLAGS += -isysroot '${SDKROOT}'
-AINC += -isysroot '${SDKROOT}'
-.endif # SDKROOT
-
-CLEANFILES+=tags
-INSTALL_PIC_ARCHIVE=   yes
-PRECIOUSLIB=   yes
-
-# workaround for 3649783
-AINC += -fdollars-in-identifiers
-
-# If these aren't set give it expected defaults
-DSTROOT ?= /
-OBJROOT ?= .
-SRCROOT ?= ${.CURDIR}
-.ifndef SYMROOT
-SYMROOT = ${.CURDIR}/SYMROOT
-_x_ != ${TEST} -d ${SYMROOT} || ${MKDIR} ${SYMROOT}
-.endif
-DESTDIR ?= ${DSTROOT}
-MAKEOBJDIR ?= ${OBJROOT}
-PLATROOT != xcodebuild -version -sdk $(SDKROOT) PlatformPath | tr -d '\n'
-
-# add version string
-SRCS += libc_version.c
-libc_version.c:
-       ${PLATROOT}/Developer/Makefiles/bin/version.pl Libc > $@
-
-.include "Makefile.features"
-.include "${.CURDIR}/Makefile.inc"
-.include "Makefile.xbs"
-
-MANFILTER = ${UNIFDEF} -t ${UNIFDEFARGS}
-.include <bsd.init.mk>
-.include <bsd.man.mk>
diff --git a/Makefile.fbsd_begin b/Makefile.fbsd_begin
deleted file mode 100644 (file)
index 2bc1c24..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# For the FreeBSD auto patching mechanism and compatibility environment
-# setup, original FreeBSD sources a put into a FreeBSD subdirectory.
-# If a file with the same name, but suffix ".patch" is in that directory,
-# that patch will be applied before use.
-#
-# The FBSD* variables are set, and bracketed by .include of Makefile.fbsd_begin
-# and Makefile.fbsd_end
-#
-# Define (empty) variables so that make doesn't give substitution
-# errors if the included makefiles don't change these:
-
-FBSDMAN1=
-FBSDMAN2=
-FBSDMAN3=
-FBSDMAN4=
-FBSDMAN5=
-FBSDMAN6=
-FBSDMAN7=
-FBSDMAN8=
-FBSDMAN9=
-FBSDMDSRCS=
-FBSDMISRCS=
-FBSDHDRS=
-FBSDPATCHSRCS=
-FBSDSRCS=
diff --git a/Makefile.fbsd_end b/Makefile.fbsd_end
deleted file mode 100644 (file)
index 6275b05..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# For the FreeBSD auto patching mechanism and compatibility environment
-# setup, original FreeBSD sources a put into a FreeBSD subdirectory.
-# If a file with the same name, but suffix ".patch" is in that directory,
-# that patch will be applied before use.
-#
-# The FBSDMDSRCS, FBSDMISRCS, FBSDORIGHDRS and FBSDSRCS variables must be set,
-# and bracketed by .include of Makefile.fbsd_begin and Makefile.fbsd_end
-#
-# Set up dependencies between the FreeBSD source (in a FreeBSD subdirectory)
-# and a file with a -fbsd.x suffix (where x is 'c' or 's').  The suffix
-# rules will then compile the file with the simulate FreeBSD environment.
-
-FBSDSECTIONS= 1 2 3 4 5 6 7 8 9
-
-# This .for statement forces evaluation of ${_cwd}
-.for _cwd in ${CWD}
-
-.for _src in ${FBSDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E}
-.else # !autopatch
-SRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.for _src in ${FBSDMDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E}
-.else # !autopatch
-MDSRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.for _src in ${FBSDMISRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E}
-.else # !autopatch
-MISRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-# FBSDPATCHSRCS are for source that need patching, but don't build
-# in base variant (only in other variants)
-.ifmake autopatch
-.for _src in ${FBSDPATCHSRCS}
-${_cwd}/${_src:R}-fbsd.${_src:E}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-fbsd.${_src:E}
-.endfor
-.endif # autopatch
-
-.ifmake autopatch
-.for _src in ${FBSDHDRS}
-${_cwd}/${_src}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/${_src}
-.endfor
-.endif # autopatch
-
-.for _sect in ${FBSDSECTIONS}
-.for _src in ${FBSDMAN${_sect}}
-.ifmake autopatch
-${_cwd}/${_src}: ${_cwd}/FreeBSD/${_src} _AUTOPATCH
-AUTOPATCHMAN+= ${_cwd}/${_src}
-.else # !autopatch
-MAN${_sect}+= ${_src}
-.endif # autopatch
-.endfor
-.endfor
-
-.endfor # _cwd
diff --git a/Makefile.features b/Makefile.features
deleted file mode 100644 (file)
index 56906a2..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-.include "Platforms/${RC_TARGET_CONFIG}/Makefile.inc"
-
-# Have to use || to avoid warning message if && is used
-.ifdef CCARCH
-_BLOCKS != ${MYCC} -arch ${CCARCH} -E -dD -x c /dev/null | fgrep -q __BLOCKS__ || echo NO
-.if ${_BLOCKS} != NO
-FEATURE_BLOCKS = YES
-.endif # _BLOCKS
-.endif # CCARCH
-_LIBCRASHREPORTERCLIENT_A = ${SDKROOT}/usr/local/lib/libCrashReporterClient.a
-_LIBCRASHREPORTERCLIENT != test -f ${_LIBCRASHREPORTERCLIENT_A} || echo NO
-.if ${_LIBCRASHREPORTERCLIENT} == NO
-FEATURE_NO_LIBCRASHREPORTERCLIENT = YES
-.endif # !_LIBCRASHREPORTERCLIENT
-
-${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h:
-       ${MKDIR} ${.TARGET:H}
-       ${ECHO} creating ${.TARGET}
-       @echo '#ifndef _LIBC_FEATURES_H_' > ${.TARGET}
-       @echo '#define _LIBC_FEATURES_H_' >> ${.TARGET}
-       @echo >> ${.TARGET}
-.ifdef FEATURE_LEGACY_RUNE_APIS
-       @echo '#define UNIFDEF_LEGACY_RUNE_APIS 1' >> ${.TARGET}
-.else
-       @echo '/* #undef UNIFDEF_LEGACY_RUNE_APIS */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_LEGACY_CRT1_ENVIRON
-       @echo '#define LEGACY_CRT1_ENVIRON 1' >> ${.TARGET}
-.else
-       @echo '/* #undef LEGACY_CRT1_ENVIRON */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_LEGACY_UTMP_APIS
-       @echo '#define UNIFDEF_LEGACY_UTMP_APIS 1' >> ${.TARGET}
-.else
-       @echo '/* #undef UNIFDEF_LEGACY_UTMP_APIS */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_MOVE_LOCALTIME
-       @echo '#define UNIFDEF_MOVE_LOCALTIME 1' >> ${.TARGET}
-.else
-       @echo '/* #undef UNIFDEF_MOVE_LOCALTIME */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_ONLY_LONG_DOUBLE_IS_DOUBLE
-       @echo '#if !__DARWIN_LONG_DOUBLE_IS_DOUBLE' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_LONG_DOUBLE_IS_DOUBLE == 0' >> ${.TARGET}
-       @echo '#endif /* !__DARWIN_LONG_DOUBLE_IS_DOUBLE */' >> ${.TARGET}
-       @echo '#define LDBL_COMPAT 1' >> ${.TARGET}
-.else
-       @echo '#if __DARWIN_LONG_DOUBLE_IS_DOUBLE' >> ${.TARGET}
-       @echo '#  if !defined(LDBL_COMPAT)' >> ${.TARGET}
-       @echo '#    error Feature mismatch: __DARWIN_LONG_DOUBLE_IS_DOUBLE == 1' >> ${.TARGET}
-       @echo '#  endif /* !LDBL_COMPAT */' >> ${.TARGET}
-       @echo '#elif defined(LDBL_COMPAT)' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_LONG_DOUBLE_IS_DOUBLE == 0' >> ${.TARGET}
-       @echo '#endif /* LDBL_COMPAT */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_ONLY_1050_VARIANTS
-       @echo '#if !__DARWIN_ONLY_VERS_1050' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_ONLY_VERS_1050 == 0' >> ${.TARGET}
-       @echo '#endif /* !__DARWIN_ONLY_VERS_1050 */' >> ${.TARGET}
-.else
-       @echo '#if __DARWIN_ONLY_VERS_1050' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_ONLY_VERS_1050 == 1' >> ${.TARGET}
-       @echo '#endif /* __DARWIN_ONLY_VERS_1050 */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_ONLY_UNIX_CONFORMANCE
-       @echo '#if !__DARWIN_ONLY_UNIX_CONFORMANCE' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_ONLY_UNIX_CONFORMANCE == 0' >> ${.TARGET}
-       @echo '#endif /* !__DARWIN_ONLY_UNIX_CONFORMANCE */' >> ${.TARGET}
-.else
-       @echo '#if __DARWIN_ONLY_UNIX_CONFORMANCE' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_ONLY_UNIX_CONFORMANCE == 1' >> ${.TARGET}
-       @echo '#endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_ONLY_64_BIT_INO_T
-       @echo '#if !__DARWIN_ONLY_64_BIT_INO_T' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_ONLY_64_BIT_INO_T == 0' >> ${.TARGET}
-       @echo '#endif /* !__DARWIN_ONLY_64_BIT_INO_T */' >> ${.TARGET}
-.else
-       @echo '#if __DARWIN_ONLY_64_BIT_INO_T' >> ${.TARGET}
-       @echo '#  error Feature mismatch: __DARWIN_ONLY_64_BIT_INO_T == 1' >> ${.TARGET}
-       @echo '#endif /* __DARWIN_ONLY_64_BIT_INO_T */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_PATCH_3417676
-       @echo '#define __APPLE_PR3417676_HACK__ 1' >> ${.TARGET}
-.else
-       @echo '/* #undef __APPLE_PR3417676_HACK__ */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_PATCH_5243343
-       @echo '#define PR_5243343 1' >> ${.TARGET}
-.else
-       @echo '/* #undef PR_5243343 */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_PLOCKSTAT
-       @echo '#define PLOCKSTAT 1' >> ${.TARGET}
-.else
-       @echo '/* #undef PLOCKSTAT */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_TIMEZONE_CHANGE_NOTIFICATION
-       @echo '#define NOTIFY_TZ 1' >> ${.TARGET}
-.else
-       @echo '/* #undef NOTIFY_TZ */' >> ${.TARGET}
-.endif
-.ifdef FEATURE_NO_LIBCRASHREPORTERCLIENT
-       @echo '#define LIBC_NO_LIBCRASHREPORTERCLIENT 1' >> ${.TARGET}
-.else
-       @echo '/* #undef LIBC_NO_LIBCRASHREPORTERCLIENT */' >> ${.TARGET}
-.endif
-       @echo >> ${.TARGET}
-       @echo '#endif /* _LIBC_FEATURES_H_ */' >> ${.TARGET}
-
-.ifdef FEATURE_BLOCKS
-UNIFDEFARGS += -DUNIFDEF_BLOCKS
-.else
-UNIFDEFARGS += -UUNIFDEF_BLOCKS
-.endif
-.ifdef FEATURE_LEGACY_64_APIS
-UNIFDEFARGS += -DUNIFDEF_LEGACY_64_APIS
-.else
-UNIFDEFARGS += -UUNIFDEF_LEGACY_64_APIS
-.endif
-.ifdef FEATURE_LEGACY_RUNE_APIS
-UNIFDEFARGS += -DUNIFDEF_LEGACY_RUNE_APIS
-.else
-UNIFDEFARGS += -UUNIFDEF_LEGACY_RUNE_APIS
-.endif
-.ifdef FEATURE_LEGACY_UTMP_APIS
-UNIFDEFARGS += -DUNIFDEF_LEGACY_UTMP_APIS
-.else
-UNIFDEFARGS += -UUNIFDEF_LEGACY_UTMP_APIS
-.endif
-.ifdef FEATURE_MOVE_LOCALTIME
-UNIFDEFARGS += -DUNIFDEF_MOVE_LOCALTIME
-.else
-UNIFDEFARGS += -UUNIFDEF_MOVE_LOCALTIME
-.endif
diff --git a/Makefile.inc b/Makefile.inc
deleted file mode 100644 (file)
index 6642b38..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# $FreeBSD: src/lMakefile.inc,v 1.7 2001/04/04 18:17:25 tmm Exp $
-#
-# This file contains make rules that are shared by libc and libc_r.
-#
-# Define (empty) variables so that make doesn't give substitution
-# errors if the included makefiles don't change these:
-MDSRCS=
-MISRCS=
-
-# SUPPRESSSRCS is used to prevent machine-independent files from being
-# built, when a machine-dependent file defines multiple symbols.
-# Use MDSRCS to block one file, and SUPPRESSSRCS to block the others.
-SUPPRESSSRCS=
-
-# Auto-patching variables
-AUTOPATCHHDRS=
-AUTOPATCHMAN=
-AUTOPATCHSRCS=
-
-# Auto-patch (or symlink)
-_AUTOPATCH: .USE
-       @if [ -f ${.ALLSRC}.patch ]; then \
-           ${ECHO} ${CP} ${.ALLSRC} ${.TARGET}; \
-           ${CP} ${.ALLSRC} ${.TARGET}; \
-           ${ECHO} ${PATCH} ${.TARGET} ${.ALLSRC}.patch; \
-           ${PATCH} ${.TARGET} ${.ALLSRC}.patch; \
-       else \
-           t=`${BASENAME} ${.ALLSRC}` && x=`${DIRNAME} ${.ALLSRC}` && d=`${BASENAME} $$x`; \
-           ${ECHO} ${LN} -fs $$d/$$t ${.TARGET}; \
-           ${LN} -fs $$d/$$t ${.TARGET}; \
-       fi
-# Standard compilation for the various forms
-_STANDARD_STATIC: .USE
-       ${MYCC} -static \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-_STANDARD_PROFILE: .USE
-       ${MYCC} -pg -DPROFILE \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-_STANDARD_DYNAMIC: .USE
-       ${MYCC} \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-_STANDARD_DEBUG: .USE
-       ${MYCC} -g -DDEBUG \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -c ${.IMPSRC} -o ${.TARGET}
-
-#
-# If there is a machine dependent makefile, use it:
-#
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc"
-
-.include "${.CURDIR}/darwin/Makefile.inc"
-.include "${.CURDIR}/db/Makefile.inc"
-.include "${.CURDIR}/compat-43/Makefile.inc"
-.include "${.CURDIR}/emulated/Makefile.inc"
-.include "${.CURDIR}/gdtoa/Makefile.inc"
-.include "${.CURDIR}/gen/Makefile.inc"
-.include "${.CURDIR}/gmon/Makefile.inc"
-.include "${.CURDIR}/include/Makefile.inc"
-.ifdef FEATURE_LEGACY_NX_INTERNAT_APIS
-.include "${.CURDIR}/internat/Makefile.inc"
-.endif
-.include "${.CURDIR}/locale/Makefile.inc"
-.include "${.CURDIR}/man/Makefile.inc"
-.include "${.CURDIR}/net/Makefile.inc"
-.include "${.CURDIR}/nls/Makefile.inc"
-.include "${.CURDIR}/posix1e/Makefile.inc"
-.include "${.CURDIR}/pthreads/Makefile.inc"
-.include "${.CURDIR}/regex/Makefile.inc"
-.include "${.CURDIR}/secure/Makefile.inc"
-.include "${.CURDIR}/stdio/Makefile.inc"
-.include "${.CURDIR}/stdlib/Makefile.inc"
-.include "${.CURDIR}/stdtime/Makefile.inc"
-.include "${.CURDIR}/string/Makefile.inc"
-.include "${.CURDIR}/sys/Makefile.inc"
-.include "${.CURDIR}/threads/Makefile.inc"
-.include "${.CURDIR}/util/Makefile.inc"
-.include "${.CURDIR}/uuid/Makefile.inc"
-
-# If there are no machine dependent sources, append all the
-# machine-independent sources:
-.if empty(MDSRCS)
-SRCS+= ${MISRCS}
-.else
-# Append machine-dependent sources, then append machine-independent sources
-# for which there is no machine-dependent variant, and not being suppressed.
-SRCS+= ${MDSRCS}
-_SUPPRESS= ${MDSRCS} ${SUPPRESSSRCS}
-.for _src in ${MISRCS}
-.if ${_SUPPRESS:R:M${_src:R}} == ""
-SRCS+= ${_src}
-.endif
-.endfor
-.endif
diff --git a/Makefile.nbsd_begin b/Makefile.nbsd_begin
deleted file mode 100644 (file)
index 1a7b778..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# For the NetBSD auto patching mechanism and compatibility environment
-# setup, original NetBSD sources a put into a NetBSD subdirectory.
-# If a file with the same name, but suffix ".patch" is in that directory,
-# that patch will be applied before use.
-#
-# The NBSD* variables are set, and bracketed by .include of Makefile.nbsd_begin
-# and Makefile.nbsd_end
-#
-# Define (empty) variables so that make doesn't give substitution
-# errors if the included makefiles don't change these:
-
-NBSDMAN1=
-NBSDMAN2=
-NBSDMAN3=
-NBSDMAN4=
-NBSDMAN5=
-NBSDMAN6=
-NBSDMAN7=
-NBSDMAN8=
-NBSDMAN9=
-NBSDMDSRCS=
-NBSDMISRCS=
-NBSDHDRS=
-NBSDSRCS=
diff --git a/Makefile.nbsd_end b/Makefile.nbsd_end
deleted file mode 100644 (file)
index 63a8a85..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# For the NetBSD auto patching mechanism and compatibility environment
-# setup, original NetBSD sources a put into a NetBSD subdirectory.
-# If a file with the same name, but suffix ".patch" is in that directory,
-# that patch will be applied before use.
-#
-# The NBSDMDSRCS, NBSDMISRCS, NBSDORIGHDRS and NBSDSRCS variables must be set,
-# and bracketed by .include of Makefile.nbsd_begin and Makefile.nbsd_end
-#
-# Set up dependencies between the NetBSD source (in a NetBSD subdirectory)
-# and a file with a -nbsd.x suffix (where x is 'c' or 's').  The suffix
-# rules will then compile the file with the simulate NetBSD environment.
-
-NBSDSECTIONS= 1 2 3 4 5 6 7 8 9
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-
-.for _src in ${NBSDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-nbsd.${_src:E}: ${_cwd}/NetBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-nbsd.${_src:E}
-.else # !autopatch
-SRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.for _src in ${NBSDMDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-nbsd.${_src:E}: ${_cwd}/NetBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-nbsd.${_src:E}
-.else # !autopatch
-MDSRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.for _src in ${NBSDMISRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-nbsd.${_src:E}: ${_cwd}/NetBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-nbsd.${_src:E}
-.else # !autopatch
-MISRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.ifmake autopatch
-.for _src in ${NBSDHDRS}
-${_cwd}/${_src}: ${_cwd}/NetBSD/${_src} _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/${_src}
-.endfor
-.endif # autopatch
-
-.for _sect in ${NBSDSECTIONS}
-.for _src in ${NBSDMAN${_sect}}
-.ifmake autopatch
-${_cwd}/${_src}: ${_cwd}/NetBSD/${_src} _AUTOPATCH
-AUTOPATCHMAN+= ${_cwd}/${_src}
-.else # !autopatch
-MAN${_sect}+= ${_src}
-.endif # autopatch
-.endfor
-.endfor
-
-.endfor # _cwd
diff --git a/Makefile.obsd_begin b/Makefile.obsd_begin
deleted file mode 100644 (file)
index fc75f15..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# For the OpenBSD auto patching mechanism and compatibility environment
-# setup, original OpenBSD sources a put into a OpenBSD subdirectory.
-# If a file with the same name, but suffix ".patch" is in that directory,
-# that patch will be applied before use.
-#
-# The OBSD* variables are set, and bracketed by .include of Makefile.obsd_begin
-# and Makefile.obsd_end
-#
-# Define (empty) variables so that make doesn't give substitution
-# errors if the included makefiles don't change these:
-
-OBSDMAN1=
-OBSDMAN2=
-OBSDMAN3=
-OBSDMAN4=
-OBSDMAN5=
-OBSDMAN6=
-OBSDMAN7=
-OBSDMAN8=
-OBSDMAN9=
-OBSDMDSRCS=
-OBSDMISRCS=
-OBSDHDRS=
-OBSDSRCS=
diff --git a/Makefile.obsd_end b/Makefile.obsd_end
deleted file mode 100644 (file)
index 9b3ef1a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# For the OpenBSD auto patching mechanism and compatibility environment
-# setup, original OpenBSD sources a put into a OpenBSD subdirectory.
-# If a file with the same name, but suffix ".patch" is in that directory,
-# that patch will be applied before use.
-#
-# The OBSDMDSRCS, OBSDMISRCS, OBSDORIGHDRS and OBSDSRCS variables must be set,
-# and bracketed by .include of Makefile.obsd_begin and Makefile.obsd_end
-#
-# Set up dependencies between the OpenBSD source (in a OpenBSD subdirectory)
-# and a file with a -obsd.x suffix (where x is 'c' or 's').  The suffix
-# rules will then compile the file with the simulate OpenBSD environment.
-
-OBSDSECTIONS= 1 2 3 4 5 6 7 8 9
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-
-.for _src in ${OBSDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-obsd.${_src:E}: ${_cwd}/OpenBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-obsd.${_src:E}
-.else # !autopatch
-SRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.for _src in ${OBSDMDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-obsd.${_src:E}: ${_cwd}/OpenBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-obsd.${_src:E}
-.else # !autopatch
-MDSRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.for _src in ${OBSDMISRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-obsd.${_src:E}: ${_cwd}/OpenBSD/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-obsd.${_src:E}
-.else # !autopatch
-MISRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.ifmake autopatch
-.for _src in ${OBSDHDRS}
-${_cwd}/${_src}: ${_cwd}/OpenBSD/${_src} _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/${_src}
-.endfor
-.endif # autopatch
-
-.for _sect in ${OBSDSECTIONS}
-.for _src in ${OBSDMAN${_sect}}
-.ifmake autopatch
-${_cwd}/${_src}: ${_cwd}/OpenBSD/${_src} _AUTOPATCH
-AUTOPATCHMAN+= ${_cwd}/${_src}
-.else # !autopatch
-MAN${_sect}+= ${_src}
-.endif # autopatch
-.endfor
-.endfor
-
-.endfor # _cwd
diff --git a/Makefile.xbs b/Makefile.xbs
deleted file mode 100644 (file)
index 6191453..0000000
+++ /dev/null
@@ -1,487 +0,0 @@
-# This is a replacement for bsd.lib.mk for the libc project to get it
-# doing the Right Thing in XBS, which is substantially different than
-# the BSD build system.
-#
-# The main problems arise when libc.a isn't meant to be static, but
-# libc_static.a is.  We also build a debug version of the library
-# in addition to shared, static, and profile.  Also, we build all 
-# versions of libc with debugging enabled, unstripped.  The BSD style
-# is to strip every object file after it is built but here, libc.a
-# will get merged into the larger libSystem.dylib, which will eventually
-# be stripped.  We also don't build a libc.dylib, since it will be
-# munged into libSystem.dylib.
-#
-# And another difference, B&I wishes to build the 4 incarnations of Libc
-# in parallel on different machines.  To do this, we must look at the
-# RC_ProjectName variable (which B&I sets) to determine which of the 4
-# versions of Libc we will be building.  Remember that the installhdrs
-# pass should only be invoked on one of the 4 versions, and man pages
-# should only be installed once as well.  Both of these get done when
-# we're invoked as "Libc".
-
-MYBSDMAKE = ${BSDMAKE} -f Makefile
-
-.PATH: .
-.MAIN: all
-all: libc.a libc_static.a libc_debug.a libc_profile.a
-install: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h installhdrs install_libc.a \
-        install_libc_profile.a install_libc_debug.a \
-        maninstall
-
-.SUFFIXES:
-.SUFFIXES: .o .po .So .do
-.SUFFIXES: .S .s .c .cc .cpp .cxx .m .C
-.SUFFIXES: -fbsd.c -nbsd.c -obsd.c -uuid.c
-.SUFFIXES: .f .y .l .defs .h
-.SUFFIXES: User.c User.o User.po User.So User.do
-.SUFFIXES: Server.c Server.o Server.po Server.So Server.do
-.SUFFIXES: .3-uuid.in .3
-
-OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
-DOBJS+= ${OBJS:.o=.do}
-POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
-SOBJS+= ${OBJS:.o=.So}
-
-#### Variant Rules ####################################################
-# The following magic is used for variants to avoid the exponental explosion
-# of suffix rules.  To add a variant, select a name (typically all-caps).
-# Add that name to the VARIANTS variable.  Create a CFLAGS_XXX variable
-# (XXX is the variant name) that contains the extra flags to pass to the
-# compiler (currently, no slashes are permitted in the flags).  Then, just
-# define a XXXSRCS variable with the names of the files to recompile with the
-# additional flags.  For auto-patched files, don't use the auto-patched file
-# name.  Just use the original file name.
-#
-# Note that this magic also deals with combinations of variants; e.g.,
-# for two variants XXX and YYY, there are three variant combinations,
-# XXX, XXX-YYY and YYY.  In this example, you can use XXX-YYYSRCS to
-# specify sources that will build with both the CFLAGS_XXX and CFLAGS_YYY
-# flags set.  The variants are always in alphabetic order.
-#
-# The DYLD variant is special; it builds a separate archive for use by dyld,
-# and contains customized binaries that are used to override the behavior of
-# the corresponding binaries in libc.a.  The DYLD variant by itself does not
-# cause BUILDING_VARIANT to be defined, and object files are in DYLDOBJS.
-#
-VARIANTS = CANCELABLE DARWINEXTSN DYLD
-
-.ifndef FEATURE_ONLY_64_BIT_INO_T
-VARIANTS += INODE32
-.endif
-.ifndef FEATURE_ONLY_1050_VARIANTS
-VARIANTS += PRE1050
-.endif
-.ifndef FEATURE_ONLY_UNIX_CONFORMANCE
-VARIANTS+= LEGACY
-.endif
-# Append the 64-bit long double sources (ppc only)
-.if (${MACHINE_ARCH} == ppc)
-VARIANTS += LDBL
-MDSRCS += ldbl64.s
-.endif
-
-CFLAGS_CANCELABLE= -DVARIANT_CANCELABLE
-CFLAGS_DARWINEXTSN= -DVARIANT_DARWINEXTSN
-CFLAGS_DYLD= -DVARIANT_DYLD -DVARIANT_CANCELABLE -DVARIANT_DARWINEXTSN -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0
-CFLAGS_INODE32= -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_INODE32
-CFLAGS_LDBL= -mlong-double-64 -DLDBL_COMPAT
-CFLAGS_LEGACY= -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0 -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_LEGACY
-CFLAGS_PRE1050= -U__DARWIN_VERS_1050 -D__DARWIN_VERS_1050=0 -DVARIANT_PRE1050
-
-# to insure a variable expansion of the left-hand side of a comparison
-DYLD = DYLD
-
-.for _v in ${VARIANTS}
-COMBOARGS+= ${_v}/${CFLAGS_${_v}}
-.endfor
-.ifdef COMBOARGS
-# makeCombos is a perl script that creates all the variant combinations
-# and all the combinations of flags
-VARIANTCOMBOCFLAGS != ${.CURDIR}/makeCombos ${COMBOARGS}
-.endif
-# For each of the variant combinations as target (and possibly suffixed with
-# _D, _P, and _S for the four kinds on compile styles, we create a subdirectory
-# to do the compiling in, and then call ${MYBSDMAKE} with the new directory, and
-# setting VARIANTCFLAGS, which are the extra flags to be added to CFLAGS.
-.for _v in ${VARIANTCOMBOCFLAGS}
-VARIANTCOMBOS+= ${_v:H:S,/,,}
-.if ${DYLD} != ${_v:H:S,/,,}
-${_v:H:S,/,,}_BUILDING_VARIANT = -DBUILDING_VARIANT
-.endif
-${_v:H:S,/,,}:
-.ifdef ${_v:H:S,/,,}SRCS
-       ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
-       MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}
-.endif
-${_v:H:S,/,,}_D:
-.ifdef ${_v:H:S,/,,}SRCS
-       ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
-       MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_D
-.endif
-${_v:H:S,/,,}_P:
-.ifdef ${_v:H:S,/,,}SRCS
-       ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
-       MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_P
-.endif
-${_v:H:S,/,,}_S:
-.ifdef ${_v:H:S,/,,}SRCS
-       ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
-       MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="${${_v:H:S,/,,}_BUILDING_VARIANT} ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_S
-.endif
-.endfor
-
-# The non-DYLD variants
-.for _v in ${VARIANTCOMBOS:N*DYLD*}
-# Variant suffix rules so the filenames are unique and Libsystem won't complain
-# because of ambiguities with -sectorder
-.SUFFIXES: -${_v}.o -${_v}.do -${_v}.po -${_v}.So
-.o-${_v}.o .do-${_v}.do .po-${_v}.po .So-${_v}.So:
-       ${MV} ${.IMPSRC} ${.TARGET}
-
-# These are the build targets of the above ${MYBSDMAKE} calls, which just builds
-# using the standard rules, but with the additional flags.
-VARIANTOBJS+=  ${${_v}SRCS:N*.h:R:S/$/-${_v}.o/g:S,^,${_v}/,g}
-build_${_v}:   ${${_v}SRCS:N*.h:R:S/$/-${_v}.o/g}
-build_${_v}_D: ${${_v}SRCS:N*.h:R:S/$/-${_v}.do/g}
-build_${_v}_P: ${${_v}SRCS:N*.h:R:S/$/-${_v}.po/g}
-build_${_v}_S: ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g}
-.endfor
-# These variables, plus VARIANTOBJS above, are the extra binaries that get
-# added to the .a files.  Note that these objects are in subdirectories
-# of the main build directory.
-VARIANTDOBJS+= ${VARIANTOBJS:.o=.do}
-VARIANTPOBJS+= ${VARIANTOBJS:.o=.po}
-VARIANTSOBJS+= ${VARIANTOBJS:.o=.So}
-
-# Now for the DYLD variants
-.for _v in ${VARIANTCOMBOS:M*DYLD*}
-# Variant suffix rules so the filenames are unique and Libsystem won't complain
-# because of ambiguities with -sectorder
-.SUFFIXES: -${_v}.o -${_v}.do -${_v}.po -${_v}.So
-.o-${_v}.o .do-${_v}.do .po-${_v}.po .So-${_v}.So:
-       ${MV} ${.IMPSRC} ${.TARGET}
-
-# These are the build targets of the above ${MYBSDMAKE} calls, which just builds
-# using the standard rules, but with the additional flags.
-DYLDOBJS+=  ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g:S,^,${_v}/,g}
-build_${_v}:
-build_${_v}_D:
-build_${_v}_P:
-build_${_v}_S: ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g}
-.endfor
-#### FreeBSD Rules ##################################################
-PREFBSDFLAGS= -I${.CURDIR}/fbsdcompat
-FBSDFLAGS= -include _fbsd_compat_.h
-
--fbsd.c.o:
-       ${MYCC} -static \
-           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--fbsd.c.po:
-       ${MYCC} -pg -DPROFILE \
-           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--fbsd.c.So: 
-       ${MYCC} \
-           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--fbsd.c.do:
-       ${MYCC} -DDEBUG \
-           ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
-           -c ${.IMPSRC} -o ${.TARGET}
-
-#### NetBSD Rules ##################################################
-PRENBSDFLAGS= -I${.CURDIR}/nbsdcompat
-NBSDFLAGS= -include _nbsd_compat_.h
-
--nbsd.c.o:
-       ${MYCC} -static \
-           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--nbsd.c.po:
-       ${MYCC} -pg -DPROFILE \
-           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--nbsd.c.So: 
-       ${MYCC} \
-           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--nbsd.c.do:
-       ${MYCC} -DDEBUG \
-           ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
-           -c ${.IMPSRC} -o ${.TARGET}
-
-#### OpenBSD Rules ##################################################
-PREOBSDFLAGS=
-OBSDFLAGS=
-
--obsd.c.o:
-       ${MYCC} -static \
-           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--obsd.c.po:
-       ${MYCC} -pg -DPROFILE \
-           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--obsd.c.So: 
-       ${MYCC} \
-           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--obsd.c.do:
-       ${MYCC} -DDEBUG \
-           ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
-           -c ${.IMPSRC} -o ${.TARGET}
-
-#### UUID Rules ######################################################
-PREUUIDFLAGS= -I${.CURDIR}/uuid
-UUIDFLAGS= -include uuid-config.h
-
--uuid.c.o:
-       ${MYCC} -static \
-           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--uuid.c.po:
-       ${MYCC} -pg -DPROFILE \
-           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--uuid.c.So: 
-       ${MYCC} \
-           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
--uuid.c.do:
-       ${MYCC} -DDEBUG \
-           ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
-           -c ${.IMPSRC} -o ${.TARGET}
-.3-uuid.in.3:
-       ${SED} -f ${SRCROOT}/uuid/uuidman.sed ${.IMPSRC} > ${.TARGET}
-
-#### Standard C Rules #################################################
-# If you change any of these standard rule, make corresponding changes
-# to the _STANDARD_* macros in Makefile.inc
-#######################################################################
-.c.o User.cUser.o Server.cServer.o:
-       ${MYCC} -static \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-.c.po User.cUser.po Server.cServer.po:
-       ${MYCC} -pg -DPROFILE \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-.c.So User.cUser.So Server.cServer.So: 
-       ${MYCC} \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
-.c.do User.cUser.do Server.cServer.do:
-       ${MYCC} -DDEBUG \
-           ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
-           ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
-           ${VARIANTCFLAGS} ${LIBCFLAGS} \
-           -c ${.IMPSRC} -o ${.TARGET}
-
-#### Standard Assembler Rules #########################################
-.s.o .S.o:
-       ${MYCC} -static -x assembler-with-cpp \
-           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
-           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
-           ${VARIANTCFLAGS:M-[BIDFU]*} -Os ${OPTIMIZE-${.IMPSRC:T}} \
-           -c ${.IMPSRC} -o ${.TARGET}
-.s.po .S.po:
-       ${MYCC} -pg -x assembler-with-cpp -DPROFILE \
-           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
-           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
-           ${VARIANTCFLAGS:M-[BIDFU]*} -Os ${OPTIMIZE-${.IMPSRC:T}} \
-           -c ${.IMPSRC} -o ${.TARGET}
-.s.So .S.So:
-       ${MYCC} -x assembler-with-cpp \
-           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
-           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
-           ${VARIANTCFLAGS:M-[BIDFU]*} -Os ${OPTIMIZE-${.IMPSRC:T}} \
-           -c ${.IMPSRC} -o ${.TARGET}
-.s.do .S.do:
-       ${MYCC} -x assembler-with-cpp -DDEBUG \
-           ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
-           ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
-           ${VARIANTCFLAGS:M-[BIDFU]*} -c ${.IMPSRC} -o ${.TARGET}
-
-#### mig Rules ########################################################
-.defs.h .defsUser.c .defsServer.c:
-       ${MIG} -arch ${CCARCH} -cc ${MYCC} -user ${.PREFIX}User.c -server ${.PREFIX}Server.c -header ${.PREFIX}.h ${.IMPSRC}
-
-gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS}
-gen_md_mig_defs: ${MD_MIGHDRS}
-
-#### CrashReporterClient Rules ########################################
-.ifdef FEATURE_NO_LIBCRASHREPORTERCLIENT
-CRASHREPORTERCLIENTOBJ =
-.else # !FEATURE_NO_LIBCRASHREPORTERCLIENT
-CRASHREPORTERCLIENT = CrashReporterClient
-CRASHREPORTERCLIENTOBJ = ${CRASHREPORTERCLIENT}.${OBJSUFFIX}
-LIBCRASHREPORTERCLIENT = lib${CRASHREPORTERCLIENT}.a
-${CRASHREPORTERCLIENTOBJ}: ${SDKROOT}/usr/local/lib/${LIBCRASHREPORTERCLIENT}
-       ditto -arch ${MACHINE_ARCH} $> ${LIBCRASHREPORTERCLIENT}
-       ar x ${LIBCRASHREPORTERCLIENT}
-       mv ${CRASHREPORTERCLIENT}.o $@
-.endif # !FEATURE_NO_LIBCRASHREPORTERCLIENT
-
-#### Library Rules ####################################################
-${VARIANTCOMBOS:N*DYLD*} ${OBJS} ${STATICOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
-lib${LIB}_static.a:: ${BUILDFIRST} ${VARIANTCOMBOS:N*DYLD*} ${OBJS} ${STATICOBJS} ${CRASHREPORTERCLIENTOBJ}
-       @${ECHO} building static ${LIB} library
-       @${RM} lib${LIB}_static.a
-       @${AR} cq lib${LIB}_static.a `${LORDER} ${OBJS} ${STATICOBJS} ${VARIANTOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
-       ${RANLIB} lib${LIB}_static.a
-
-${VARIANTCOMBOS:N*DYLD*:S/$/_P/g} ${POBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
-lib${LIB}_profile.a:: ${BUILDFIRST} ${VARIANTCOMBOS:N*DYLD*:S/$/_P/g} ${POBJS} ${CRASHREPORTERCLIENTOBJ}
-       @${ECHO} building profiled ${LIB} library
-       @${RM} lib${LIB}_profile.a
-       @${AR} cq lib${LIB}_profile.a `${LORDER} ${POBJS} ${VARIANTPOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
-       ${RANLIB} lib${LIB}_profile.a
-
-${VARIANTCOMBOS:N*DYLD*:S/$/_D/g} ${DOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
-lib${LIB}_debug.a:: ${BUILDFIRST} ${VARIANTCOMBOS:N*DYLD*:S/$/_D/g} ${DOBJS} ${CRASHREPORTERCLIENTOBJ}
-       @${ECHO} building debug ${LIB} library
-       @${RM} lib${LIB}_debug.a
-       @${AR} cq lib${LIB}_debug.a `${LORDER} ${DOBJS} ${VARIANTDOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
-       ${RANLIB} lib${LIB}_debug.a
-
-${VARIANTCOMBOS:S/$/_S/g} ${SOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
-lib${LIB}.a:: ${BUILDFIRST} ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS} ${CRASHREPORTERCLIENTOBJ}
-       @${ECHO} building standard ${LIB} library
-       @${RM} lib${LIB}.a
-       @${AR} cq lib${LIB}.a `${LORDER} ${SOBJS} ${VARIANTSOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
-       ${RANLIB} lib${LIB}.a
-       @${ECHO} building custom ${LIB} library for dyld
-       @${RM} lib${LIB}-dyld.a
-       @${AR} cq lib${LIB}-dyld.a `${LORDER} ${DYLDOBJS} | ${TSORT} -q`
-       ${RANLIB} lib${LIB}-dyld.a
-
-CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a
-
-INCDIR = ${DESTDIR}/usr/include
-LOCINCDIR = ${DESTDIR}/usr/local/include
-SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework
-PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders
-KERNELFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/Kernel.framework
-PRIVKERNELHDRS = ${KERNELFRAMEWORK}/Versions/A/PrivateHeaders
-INSTALLMODE != ${TEST} `id -u` -eq 0 && ${ECHO} 444 || ${ECHO} 644
-
-installhdrs-md: gen_md_mig_defs
-
-installhdrs: modifyhdrs
-
-copyhdrs: gen_mig_defs
-       ${MKDIR} ${INCDIR}/arpa
-       ${MKDIR} ${INCDIR}/libkern
-       ${MKDIR} ${INCDIR}/malloc
-.ifdef OBJC_INSTHDRS
-       ${MKDIR} ${INCDIR}/objc
-.endif
-       ${MKDIR} ${INCDIR}/protocols
-       ${MKDIR} ${INCDIR}/secure
-       ${MKDIR} ${INCDIR}/sys
-       ${MKDIR} ${INCDIR}/xlocale
-       ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS} ${INCDIR}
-       ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS} ${INCDIR}/arpa
-       ${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS} ${INCDIR}/libkern
-       ${INSTALL} -m ${INSTALLMODE} ${MALLOC_INSTHDRS} ${INCDIR}/malloc
-.ifdef OBJC_INSTHDRS
-       ${INSTALL} -m ${INSTALLMODE} ${OBJC_INSTHDRS} ${INCDIR}/objc
-.endif
-       ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS} ${INCDIR}/protocols
-       ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS} ${INCDIR}/secure
-       ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS} ${INCDIR}/sys
-       ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS} ${INCDIR}/xlocale
-       ${MKDIR} ${LOCINCDIR}
-       ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS} ${LOCINCDIR}
-       ${MKDIR} ${PRIVHDRS}/btree
-       ${MKDIR} ${PRIVHDRS}/machine
-       ${MKDIR} ${PRIVHDRS}/objc
-       ${MKDIR} ${PRIVHDRS}/uuid
-       ${MKDIR} ${PRIVHDRS}/sys
-       ${MKDIR} ${PRIVKERNELHDRS}/uuid
-       ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS} ${PRIVHDRS}
-       ${INSTALL} -m ${INSTALLMODE} ${INSTBTREEPRIVHDRS_AUTOPATCH} ${PRIVHDRS}/btree
-       ${INSTALL} -m ${INSTALLMODE} ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc
-       ${MV} ${DESTDIR}/usr/include/asm.h ${PRIVHDRS}/machine
-       ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS} ${PRIVHDRS}/sys
-       ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVHDRS}/uuid
-       ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVKERNELHDRS}/uuid
-
-modifyhdrs: copyhdrs
-       @for i in `${FIND} '${DESTDIR}' -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do \
-           ${CHMOD} u+w $$i && \
-           ${ECHO} ${ED} - $$i \< ${.CURDIR}/strip-header.ed && \
-           ${ED} - $$i < ${.CURDIR}/strip-header.ed && \
-           ${CHMOD} u-w $$i || exit 1; \
-       done
-       @for i in `${FIND} '${DESTDIR}' -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l UNIFDEF`; do \
-           ${CHMOD} u+w $$i && \
-           ${CP} $$i $$i.orig && \
-           ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $$i.orig \> $$i && \
-           { ${UNIFDEF} ${UNIFDEFARGS} $$i.orig > $$i || [ $$? -ne 2 ]; } && \
-           ${RM} $$i.orig && \
-           ${CHMOD} u-w $$i || exit 1; \
-       done
-
-install_lib${LIB}_static.a:
-       ${INSTALL} -m ${INSTALLMODE} lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/
-install_lib${LIB}_profile.a:
-       ${INSTALL} -m ${INSTALLMODE} lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system
-install_lib${LIB}_debug.a:
-       ${INSTALL} -m ${INSTALLMODE} lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/
-install_lib${LIB}.a:
-       ${INSTALL} -m ${INSTALLMODE} lib${LIB}.a ${DESTDIR}/usr/local/lib/system/
-
-autopatch: ${AUTOPATCHHDRS} ${AUTOPATCHSRCS} ${AUTOPATCHMAN}
-
-copyfiles:
-.if !empty(COPYFILES)
-       ${INSTALL} -m ${INSTALLMODE} ${COPYFILES} ${DESTDIR}/usr/local/lib/system
-.endif
-.if !empty(MDCOPYFILES)
-       ${INSTALL} -m ${INSTALLMODE} ${MDCOPYFILES} ${DESTDIR}/usr/local/lib/system
-.endif
-
-clean:
-       ${RM} ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES}
-       ${RM} lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \
-               lib${LIB}_debug.a 
diff --git a/Platforms/MacOSX/Makefile.inc b/Platforms/MacOSX/Makefile.inc
deleted file mode 100644 (file)
index 97d5f07..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Selectable features for MacOSX
-#
-
-# Legacy *64 APIs
-FEATURE_LEGACY_64_APIS = 1
-
-# Legacy crt1.o environ support
-FEATURE_LEGACY_CRT1_ENVIRON = 1
-
-# Legacy NX international APIs
-FEATURE_LEGACY_NX_INTERNAT_APIS = 1
-
-# Legacy NXZone APIs
-FEATURE_LEGACY_NXZONE_APIS = 1
-
-# Legacy rune APIs
-FEATURE_LEGACY_RUNE_APIS = 1
-
-# Legacy utmp APIs
-FEATURE_LEGACY_UTMP_APIS = 1
-
-# New OSMemoryNotification and OSThermalNotification APIs
-#FEATURE_MEM_THERM_NOTIFICATION_APIS = 1
-
-# Move localtime to /var/db/timezone
-#FEATURE_MOVE_LOCALTIME = 1
-
-# Long doubles are doubles (should match sys/cdefs.h)
-.if (${MACHINE_ARCH} == arm)
-FEATURE_ONLY_LONG_DOUBLE_IS_DOUBLE = 1
-.endif
-
-# No pre-1050 variants (should match sys/cdefs.h)
-#FEATURE_ONLY_1050_VARIANTS = 1
-
-# No legacy variants (should match sys/cdefs.h)
-.if defined(LP64)
-FEATURE_ONLY_UNIX_CONFORMANCE = 1
-.endif
-
-# Only 64-bit ino_t (should match sys/cdefs.h)
-#FEATURE_ONLY_64_BIT_INO_T = 1
-
-# Patch 3333969
-FEATURE_PATCH_3333969 = 1
-
-# Patch 3417676
-FEATURE_PATCH_3417676 = 1
-
-# Patch 5243343
-FEATURE_PATCH_5243343 = 1
-
-# plockstat dtrace support
-FEATURE_PLOCKSTAT = 1
-
-# Timezone change notification
-FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1
diff --git a/Platforms/iPhone/Makefile.inc b/Platforms/iPhone/Makefile.inc
deleted file mode 100644 (file)
index f9ac61c..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# Selectable features for iPhone
-#
-
-# Legacy *64 APIs
-#FEATURE_LEGACY_64_APIS = 1
-
-# Legacy crt1.o environ support
-#FEATURE_LEGACY_CRT1_ENVIRON = 1
-
-# Legacy NX international APIs
-FEATURE_LEGACY_NX_INTERNAT_APIS = 1
-
-# Legacy NXZone APIs
-FEATURE_LEGACY_NXZONE_APIS = 1
-
-# Legacy rune APIs
-#FEATURE_LEGACY_RUNE_APIS = 1
-
-# Legacy utmp APIs
-#FEATURE_LEGACY_UTMP_APIS = 1
-
-# New OSMemoryNotification and OSThermalNotification APIs
-FEATURE_MEM_THERM_NOTIFICATION_APIS = 1
-
-# Move localtime to /var/db/timezone
-.if $(RC_ProjectName) == $(RC_ProjectName:%_Sim=%)
-FEATURE_MOVE_LOCALTIME = 1
-.endif
-
-# Long doubles are doubles (should match sys/cdefs.h)
-.if (${MACHINE_ARCH} == arm)
-FEATURE_ONLY_LONG_DOUBLE_IS_DOUBLE = 1
-.endif
-
-# No pre-1050 variants (should match sys/cdefs.h)
-FEATURE_ONLY_1050_VARIANTS = 1
-
-# No legacy variants (should match sys/cdefs.h)
-FEATURE_ONLY_UNIX_CONFORMANCE = 1
-
-# Only 64-bit ino_t (should match sys/cdefs.h)
-FEATURE_ONLY_64_BIT_INO_T = 1
-
-# Patch 3333969
-#FEATURE_PATCH_3333969 = 1
-
-# Patch 3417676
-#FEATURE_PATCH_3417676 = 1
-
-# Patch 5243343
-FEATURE_PATCH_5243343 = 1
-
-# plockstat dtrace support
-#FEATURE_PLOCKSTAT = 1
-
-# Timezone change notification
-FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1
diff --git a/Platforms/iphoneos/Makefile.inc b/Platforms/iphoneos/Makefile.inc
new file mode 100644 (file)
index 0000000..4708e55
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Selectable features for iPhone
+#
+
+# Legacy *64 APIs
+#FEATURE_LEGACY_64_APIS = 1
+
+# Legacy crt1.o environ support
+#FEATURE_LEGACY_CRT1_ENVIRON = 1
+
+# Legacy rune APIs
+#FEATURE_LEGACY_RUNE_APIS = 1
+
+# Legacy utmp APIs
+#FEATURE_LEGACY_UTMP_APIS = 1
+
+# New OSMemoryNotification and OSThermalNotification APIs
+FEATURE_MEM_THERM_NOTIFICATION_APIS = 1
+
+# Move localtime to /var/db/timezone
+FEATURE_MOVE_LOCALTIME = 1
+
+.if RC_ProjectName _Sim$
+FEATURE_MOVE_LOCALTIME = 0
+.endif
+
+# No pre-1050 variants (should match sys/cdefs.h)
+FEATURE_ONLY_1050_VARIANTS = 1
+
+# No legacy variants (should match sys/cdefs.h)
+FEATURE_ONLY_UNIX_CONFORMANCE = 1
+
+# Only 64-bit ino_t (should match sys/cdefs.h)
+FEATURE_ONLY_64_BIT_INO_T = 1
+
+# Patch 3333969
+#FEATURE_PATCH_3333969 = 1
+
+# Patch 3417676
+#FEATURE_PATCH_3417676 = 1
+
+# Patch 5243343
+FEATURE_PATCH_5243343 = 1
+
+# plockstat dtrace support
+#FEATURE_PLOCKSTAT = 1
+
+# Timezone change notification
+FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1
+
+# Memorystatus support for posix_spawn()
+FEATURE_MEMORYSTATUS = 1
diff --git a/Platforms/macosx/Makefile.inc b/Platforms/macosx/Makefile.inc
new file mode 100644 (file)
index 0000000..ff3617f
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Selectable features for MacOSX
+#
+
+# Legacy *64 APIs
+FEATURE_LEGACY_64_APIS = 1
+
+# Legacy crt1.o environ support
+FEATURE_LEGACY_CRT1_ENVIRON = 1
+
+# Legacy rune APIs
+FEATURE_LEGACY_RUNE_APIS = 1
+
+# Legacy utmp APIs
+FEATURE_LEGACY_UTMP_APIS = 1
+
+# New OSMemoryNotification and OSThermalNotification APIs
+#FEATURE_MEM_THERM_NOTIFICATION_APIS = 1
+
+# Move localtime to /var/db/timezone
+#FEATURE_MOVE_LOCALTIME = 1
+
+# No pre-1050 variants (should match sys/cdefs.h)
+#FEATURE_ONLY_1050_VARIANTS = 1
+
+# No legacy variants (should match sys/cdefs.h)
+.if CURRENT_ARCH 64$
+FEATURE_ONLY_UNIX_CONFORMANCE = 1
+.endif
+
+# Only 64-bit ino_t (should match sys/cdefs.h)
+#FEATURE_ONLY_64_BIT_INO_T = 1
+
+# Patch 3333969
+FEATURE_PATCH_3333969 = 1
+
+# Patch 3417676
+FEATURE_PATCH_3417676 = 1
+
+# Patch 5243343
+FEATURE_PATCH_5243343 = 1
+
+# plockstat dtrace support
+FEATURE_PLOCKSTAT = 1
+
+# Timezone change notification
+FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1
+
+# Memorystatus support for posix_spawn()
+FEATURE_MEMORYSTATUS = 1
diff --git a/arm/Makefile.inc b/arm/Makefile.inc
deleted file mode 100644 (file)
index 2597b5b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.if defined(CCARCH) && ${CCARCH} == armv6
-CFLAGS += -mthumb
-.endif
-
-_arm_arch_6 != ${MYCC} -E -dD ${CFLAGS:M-[BIDFU]*} ${AINC} -include arm/arch.h -x c /dev/null | grep -q -w _ARM_ARCH_6 || echo NO
-.if ${_arm_arch_6} != NO
-FEATURE_ARM_ARCH_6 = 1
-.endif
diff --git a/arm/gen/Makefile.inc b/arm/gen/Makefile.inc
deleted file mode 100644 (file)
index 4796738..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-.PATH: ${.CURDIR}/arm/gen
-MDSRCS += \
-       cpu_number.s \
-       icacheinval.s
-
-DYLDSRCS += icacheinval.s
diff --git a/arm/pthreads/Makefile.inc b/arm/pthreads/Makefile.inc
deleted file mode 100644 (file)
index a37d6ea..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-.PATH: ${.CURDIR}/arm/pthreads
-MDSRCS += \
-       get_cpu_capabilities.s \
-       pthread_set_self.s \
-       pthread_self.s \
-       pthread_getspecific.s \
-       init_cpu_capabilities.c \
-       start_wqthread.s \
-       thread_start.s
-
-DYLDSRCS +=    \
-       pthread_getspecific.s \
-       pthread_self.s \
-       pthread_set_self.s
diff --git a/arm/pthreads/get_cpu_capabilities.s b/arm/pthreads/get_cpu_capabilities.s
deleted file mode 100644 (file)
index e4b5f20..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/* Get the cpu_capabilities bit vector out of the comm page */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-.text
-.align 2
-.private_extern __get_cpu_capabilities
-__get_cpu_capabilities:
-       mov     r0, #_COMM_PAGE_CPU_CAPABILITIES
-       ldr     r0, [r0]
-       bx      lr
index 3cf471e26ec260acc1fc1eff13bbd71d958710e9..79bb28e148a2c483924b339904c2f4e964ce658f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2009, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
         .align 2
         .globl _start_wqthread
 _start_wqthread:
-    stmfd sp!, {r4, r5}
+       stmfd sp!, {r4, r5}
        bl __pthread_wqthread
+
+// Stackshots will show the routine that happens to link immediately following
+// _start_wqthread.  So we add an extra instruction (nop) to make stackshots
+// more readable.
+        nop
index e7574d6cb1f6c34ade862ef0f453e362558f2bb6..5bf4bf61674abdddb54d4b5b4a8e194729ac6a86 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2009, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -38,3 +38,8 @@
 _thread_start:
     stmfd sp!, {r4, r5}
        bl __pthread_start
+
+// Stackshots will show the routine that happens to link immediately following
+// _thread_start.  So we add an extra instruction (nop) to make stackshots
+// more readable.
+       nop
diff --git a/arm/stdlib/gdtoa.mk b/arm/stdlib/gdtoa.mk
deleted file mode 100644 (file)
index c8477d4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-GDTOA_FBSDSRCS+= machdep_ldisd.c
diff --git a/arm/string/Makefile.inc b/arm/string/Makefile.inc
deleted file mode 100644 (file)
index 8125ca7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# $Version$
-#
-# ARM-optimised string functions.
-#
-.PATH: ${.CURDIR}/arm/string
-
-MDSRCS +=        \
-       bcopy_Generic.s  \
-       bcopy_CortexA8.s \
-       bcopy_CortexA9.s \
-       bzero_Generic.s  \
-       bzero_CortexA8.s \
-       bzero_CortexA9.s \
-       dyld_resolvers.c \
-       ffs.s     \
-       memcmp.s  \
-       strcmp.s  \
-       strncmp.s \
-       strlen.s  \
-       strchr.s  \
-       strstr.s  \
-       strcpy.s  \
-       strlcpy.s \
-       strncpy.s \
-       strnlen.s
-    
-DYLDSRCS +=     \
-       bcopy_Generic.s \
-       bzero_Generic.s \
-       ffs.s \
-       strcmp.s \
-       strlen.s
-
-.if defined(FEATURE_ARM_ARCH_6)
-MDSRCS += memset_pattern.s
-.endif
-
-SUPPRESSSRCS += \
-       bcmp.c    \
-       memcpy.c  \
-       memmove.c \
-       memset.c  \
-       strncmp.c \
-       strlen.c  \
-       strchr.c  \
-       strstr.c  \
-       strcpy.c  \
-       strlcpy.c \
-       strncpy.c \
-       strnlen.c
-
index d7fb7c4892a74d9d59751325d9e1d0ed91ffa408..89ae1a73ddd9d0728a47d970d6fb53ccbffbf337 100644 (file)
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+/*****************************************************************************
+ * Cortex-A8 implementation                                                  *
+ *****************************************************************************/
+// Cortex-A8 implementations of memcpy( ), memmove( ) and bcopy( ).
+//
+// Our tests have shown that NEON is always a performance win for memcpy( ).
+// However, for the specific case of copies from a warm source to a cold
+// destination when the buffer size is between 1k and 32k, it is not enough
+// of a performance win to offset the increased power footprint, resulting
+// in an energy usage regression.  Thus, we detect that particular case, and
+// pass those copies through the ARM core registers.  All other copies larger
+// than 8 bytes are handled on NEON.
+//
+// Stephen Canon, August 2009
+
+.text
+.code 16
+.syntax unified
+
+// void bcopy(const void * source,
+//            void * destination,
+//            size_t length);
+//
+// void *memmove(void * destination,
+//               const void * source,
+//               size_t n);
+//
+// void *memcpy(void * restrict destination,
+//              const void * restrict source,
+//              size_t n);
+//
+// all copy n successive bytes from source to destination. memmove and memcpy
+// returns destination, whereas bcopy has no return value. copying takes place
+// as if it were through a temporary buffer -- after return destination contains
+// exactly the bytes from source, even if the buffers overlap.
+
+.thumb_func _bcopy$VARIANT$CortexA8
+.thumb_func _memmove$VARIANT$CortexA8
+.thumb_func _memcpy$VARIANT$CortexA8
+.globl _bcopy$VARIANT$CortexA8
+.globl _memmove$VARIANT$CortexA8
+.globl _memcpy$VARIANT$CortexA8
+
+#define SAVE_REGISTERS {r4,r5,r6,r8,r10,r11}
+#define COPY_REGISTERS {r3,r4,r5,r6,r8,r9,r10,r11}
+               
+/*****************************************************************************
+ *  entry points                                                             *
+ *****************************************************************************/
+
+.align 2
+_bcopy$VARIANT$CortexA8:
+
+// bcopy has the first and second arguments in the opposite order as the C
+// library functions memmove and memcpy.  If bcopy is called, we swap these
+// two arguments and then fall into memmove.
+
+    mov         r3,     r0
+    mov         r0,     r1
+    mov         r1,     r3
+
+.align 2
+_memmove$VARIANT$CortexA8:
+_memcpy$VARIANT$CortexA8:
+
+// At entry to memmove/memcpy, registers contain the following values:
+//
+//  r0  pointer to the first byte of the destination buffer
+//  r1  pointer to the first byte of the source buffer
+//  r2  number of bytes to copy
+//
+// Our preference is to use a (faster and easier to understand) front-to-back
+// copy of the buffer.  However, memmove requires that copies take place as
+// though through a temporary buffer.  This means that if the buffers overlap,
+// it may be necessary to copy the buffer in reverse order.
+//
+// To properly detect such overlap, we begin by computing the offset between
+// the source and destination pointers.  If the offset happens to be zero,
+// then there is no work to be done, so we can early out.
+
+    subs    r3,     r0, r1
+    it      eq
+    bxeq    lr
+
+// r3 now contains the offset between the buffers, (destination - source).  If
+// 0 < offset < length, then the high-addressed bits of the source alias the
+// low addressed bytes of the destination.  Thus, if we were to perform the
+// copy in ascending address order, we would overwrite the high-addressed
+// source bytes before we had a chance to copy them, and the data would be lost.
+//
+// Thus, we can use the front-to-back copy only if offset is negative or
+// greater than the length.  This is the case precisely if offset compares
+// unsigned higher than length.
+
+    cmp     r3,     r2
+    bhs     L_copyFrontToBack
+                             
+/*****************************************************************************
+ *  back to front copy                                                       *
+ *****************************************************************************/
+
+// Here we have fallen through into the back-to-front copy.  We preserve the
+// original destination pointer in r0 because it is the return value for the
+// routine, and update the other registers as follows:
+//
+//  r1  one byte beyond the end of the destination buffer
+//  r2  number of bytes to copy
+//  ip  one byte beyond the end of the destination buffer
+
+    mov      ip,    r0
+    add      r1,    r2
+    add      ip,    r2
+    
+// Subtract 8 from the buffer length; if this is negative, then we will use
+// only single-byte copies, and we jump directly to a scalar copy loop.
+
+    subs     r2,        $8
+    blt      L_scalarReverseCopy
+    
+// If the destination pointer is 8-byte aligned we can use 8-byte NEON copies
+// to move the data.
+    
+    tst      ip,        $7
+    beq      L_vectorReverseCopy
+    
+// Otherwise, we copy a single byte at a time, in order of descending memory
+// address, until the destination is 8 byte aligned.  Within this loop,
+// registers are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to be copied) - 8
+//  r3  temporary to hold the byte that is being copied
+//  ip  pointer one byte past the destination of the next byte to be copied
+//
+//  byte that will be copied in this iteration
+//                            |  byte that was copied in the previous iteration                           
+//  Source buffer:            v   v                                
+//  ------------------------+---+---+-------------------------
+//  bytes still to copy ... |   |   | ... bytes already copied
+//  ------------------------+---+---+-------------------------
+//                                ^
+//                               r1 holds the address of this byte
+
+0:  ldrb     r3,   [r1, $-1]!
+    sub      r2,        $1
+    strb     r3,   [ip, $-1]!
+    tst      ip,        $7
+    bne      0b
+    
+// At this point, the destination pointer is 8 byte aligned.  Check again that
+// there are at least 8 bytes remaining to copy by comparing the remaining
+// length minus 8 to zero.  If fewer than 8 bytes remain, jump to the cleanup
+// path.
+    
+    cmp      r2,    $0
+    blt      L_scalarReverseCopy
+                                    
+/*****************************************************************************
+ *  destination is 8 byte aligned                                            *
+ *****************************************************************************/
+
+L_vectorReverseCopy:
+
+// At this point, registers contain the following values:
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to copy) - 8
+//  ip  pointer one byte past the destination of the next byte to be copied
+//
+// Furthermore, it is known that ip is 8 byte aligned, and that r2 is positive.
+// NEON has really excellent alignment handling in hardware, so we would like
+// to use that to handle cases where the source is not similarly aligned to the
+// destination (it supports even single-byte misalignment at speed).  However,
+// on some SoC designs, not all of the DMA busses support such access.  Thus,
+// we must unfortunately use a software workaround in those cases.
+//
+// Fortunately, 4-byte aligned loads are supported even on the DMA busses, so
+// we only need to handle the different possible source alignments modulo 4.
+// Here we have a dispatch table to jump to the correct copy implementation
+// for the given source alignment.
+//
+// The tbh instruction loads the address offset of the correct implementation
+// from the data table that immediately follows it and adds it to the pc to 
+// jump to the correct branch.
+
+    ands     r3,    r1, $3
+    tbh     [pc, r3, lsl $1]
+0:  
+.short (L_reverseAligned0-0b)/2
+.short (L_reverseAligned1-0b)/2
+.short (L_reverseAligned2-0b)/2
+.short (L_reverseAligned3-0b)/2
+
+/*****************************************************************************
+ *  source is also at least word aligned                                     *
+ *****************************************************************************/
+    
+L_reverseAligned0:
+
+// Subtract 56 from r2, so that it contains the number of bytes remaining to
+// copy minus 64.  If this result is negative, then we jump into a loop that
+// copies 8 bytes at a time.
+
+    subs     r2,        $0x38
+    blt      L_reverseVectorCleanup
+    
+// Check if the destination pointer is 64-byte aligned.  If so, jump to a loop
+// that copies whole cachelines.
+
+    tst      ip,        $0x38
+    beq      L_reverseCachelineAligned
+    
+// Otherwise, we copy a 8 bytes at a time, in order of descending memory
+// address, until the destination is 64 byte aligned.  Within this loop,
+// registers are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to be copied) - 64
+//  ip  pointer one byte past the destination of the next byte to be copied
+//  d0  temporary storage for copy
+//
+//  bytes that will be copied after this iteration
+//        |         8 byte block that will be copied in this iteration                            
+//        v         v
+//  --------------+-------------------------------+---------------------
+//                | 0   1   2   3   4   5   6   7 | bytes already copied
+//  --------------+-------------------------------+---------------------
+//                                                  ^
+//                                                  r1 points here
+    
+0:  sub      r1,        $8
+    vld1.32 {d0},  [r1]
+    sub      ip,        $8
+    sub      r2,        $8
+    tst      ip,        $0x38
+    vst1.64 {d0},  [ip,:64]
+    bne      0b
+    
+// At this point, the destination pointer is 64 byte aligned.  Check again that
+// there are at least 64 bytes remaining to copy by comparing the remaining
+// length minus 64 to zero.  If fewer than 64 bytes remain, skip over the main
+// copy loop.
+
+    cmp      r2,        $0
+    blt      L_reverseVectorCleanup
+    
+/*****************************************************************************
+ *  destination is cacheline aligned                                         *
+ *****************************************************************************/
+
+L_reverseCachelineAligned:
+
+// In the special case that we are copying a buffer of between 1k and 32k bytes
+// we do not use a NEON copy for the main loop.  This is because if we happen
+// to be doing a copy from a source in cache to a destination that is not in
+// cache, this will result in an increase in energy usage.  In all other cases,
+// NEON gives superior energy conservation.
+
+    sub      r3,    r2, $0x3c0
+    cmp      r3,        $0x7c00
+    blo      L_useSTMDB
+    
+// Pre-decrement the source (r1) and destination (ip) pointers so that they
+// point to the first byte of the trailing 32-byte window of each buffer.
+// Additionally, load the address increment of -32 into r3.
+
+    sub      r1,        $32
+    sub      ip,        $32
+    mov      r3,        $-32
+    
+// The destination pointer is known to be 64-byte aligned, so we can use the
+// maximal alignment hint (:256) for our vector stores.  Detect if the source
+// is also at least 32-byte aligned and jump to a loop that uses maximal
+// alignment hints for the loads as well if possible.
+    
+    tst      r1,        $0x1f
+    beq      L_reverseSourceAligned
+    
+// This loop copies 64 bytes per iteration, from a 4-byte aligned source to a
+// 64-byte aligned destination, in order of descending memory address.  Within
+// this loop, registers are used as follows:
+//
+//  r0      original destination pointer (unmodified)
+//  r1      pointer to the next 32-byte block to load
+//  r2      (number of bytes remaining to copy) - 64
+//  r3      address increment of -32.
+//  ip      pointer to which the next 32-byte block is to be stored
+//  q0-q3   temporary registers used for copies
+//
+// Note that the loop is arrange in such a way that a single cleanup store is
+// necessary after the final loop iteration.  This occurs at label (1), and is
+// shared between the unaligned and aligned loops.
+    
+    vld1.32 {q2,q3}, [r1],      r3
+    vld1.32 {q0,q1}, [r1],      r3
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256], r3
+    blt      1f
+.align 3
+0:  vld1.32 {q2,q3}, [r1],      r3
+    vst1.64 {q0,q1}, [ip,:256], r3
+    vld1.32 {q0,q1}, [r1],      r3
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256], r3 
+    bge      0b
+    b        1f
+    
+L_reverseSourceAligned:
+
+// This loop is identical to the immediately preceeding loop, except that it
+// uses the additional alignment hint that the source pointer (r1) is 32-byte
+// aligned.  The two loops share cleanup code for the final iteration.
+
+    vld1.64 {q2,q3}, [r1,:256], r3
+    vld1.64 {q0,q1}, [r1,:256], r3
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256], r3
+    blt      1f
+.align 3
+0:  vld1.64 {q2,q3}, [r1,:256], r3
+    vst1.64 {q0,q1}, [ip,:256], r3
+    vld1.64 {q0,q1}, [r1,:256], r3
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256], r3
+    bge      0b
+    
+// Final vector store for both of the above loops.
+
+1:  vst1.64 {q0,q1}, [ip,:256], r3
+
+// Adjust the source and destination pointers so that they once again point to
+// the last byte that we used (which is one byte higher than the address that
+// we will use next for any required cleanup).
+
+    add      r1,         $32
+    add      ip,         $32
+    
+L_reverseVectorCleanup:
+
+// Add 56 to r2, so that it contains the number of bytes remaing to copy minus
+// 8.  A comparison of this value with zero tells us if any more whole 8-byte
+// blocks need to be copied.
+
+    adds     r2,    r2, $0x38
+    blt      L_scalarReverseCopy
+
+// This loop copies 8 bytes at a time in order of descending memory address,
+// until fewer than 8 bytes remain to be copied.  Within this loop, registers
+// are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to be copied) - 64
+//  ip  pointer one byte past the destination of the next byte to be copied
+//  d0  temporary storage for copy
+
+0:  sub      r1,        $8
+    vld1.32 {d0},  [r1]
+    sub      ip,        $8
+    subs     r2,        $8
+    vst1.64 {d0},  [ip,:64]
+    bge      0b
+
+/*****************************************************************************
+ *  sub-doubleword cleanup copies                                            *
+ *****************************************************************************/
+
+L_scalarReverseCopy:
+
+// Add 8 to r2, so that it contains the number of bytes remaining to copy, and
+// return to the calling routine if zero bytes remain.
+
+    adds     r2,        $8
+    it       eq
+    bxeq     lr
+
+// Copy one byte at a time in descending address order until we reach the front
+// of the buffer.  Within this loop, registers are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to be copied) - 8
+//  r3  temporary to hold the byte that is being copied
+//  ip  pointer one byte past the destination of the next byte to be copied
+         
+0:  ldrb     r3,   [r1, $-1]!
+    subs     r2,        $1
+    strb     r3,   [ip, $-1]!
+    bne      0b
+    bx       lr
+         
+/*****************************************************************************
+ *  STMDB loop for 1k-32k buffers                                            *
+ *****************************************************************************/
+
+// This loop copies 64 bytes each iteration in order of descending memory
+// address, using the GPRs instead of NEON.
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to be copied) - 64
+//  r3-6,r8-11 (COPY_REGISTERS) temporary registers used for moving data
+//  ip  pointer to one byte past the next location to store to
+
+L_useSTMDB:
+    push    SAVE_REGISTERS
+.align 3
+0:  ldmdb   r1!,    COPY_REGISTERS
+    subs    r2,     r2,  $64
+    stmdb   ip!,    COPY_REGISTERS
+    ldmdb   r1!,    COPY_REGISTERS
+    pld     [r1, $-64]
+    stmdb   ip!,    COPY_REGISTERS
+    bge     0b
+    pop     SAVE_REGISTERS
+    b       L_reverseVectorCleanup
+    
+/*****************************************************************************
+ *  Misaligned reverse vld1 loop                                             *
+ *****************************************************************************/
+
+// Software alignment fixup to handle source and dest that are relatively
+// misaligned mod 4 bytes.  
+//
+// The basic idea is to use 4-byte aligned loads to load 8 bytes per iteration,
+// which we combine with the 8 bytes loaded in the previous iteration to get a
+// 16 byte field; the next 8 bytes to be stored to the destination buffer are
+// somewhere in that field, and we get them using the VEXT instruction:
+//      
+//     |  8 bytes from this iteration  |  8 bytes from last iteration  |
+//     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+//     | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f |
+//     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+//         ^8 bytes to store this iteration^           |
+//                                                   could be a page boundary 
+//
+// We need to be a little bit careful, however.  Because the loads only have 4
+// byte alignment, the very first load could slop over into a page that is not
+// mapped readable.  In order to prevent this scenario, we copy eight bytes
+// using byte-by-byte before beginning the main loop.
+//
+// At the beginning of each iteration through this loop, registers are used
+// as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to the next block of 8 bytes to load
+//  r2  (bytes remaining to copy) - 8
+//  ip  pointer to the next block of 8 bytes to store
+//  d0  next 8 bytes to store
+//  d2  8 bytes loaded in the previous iteration
+//  d3  8 bytes loaded two iterations ago
+
+#define RCOPY_UNALIGNED(offset)      \
+0:  ldrb      r3,     [r1,$-1]!     ;\
+    strb      r3,     [ip,$-1]!     ;\
+    subs      r2,         $1        ;\
+    blt       L_scalarReverseCopy   ;\
+    tst       ip,         $7        ;\
+    bne       0b                    ;\
+    bic       r1,         $3        ;\
+    sub       r1,         $8        ;\
+    sub       ip,         $8        ;\
+    mov       r3,         $-8       ;\
+    vld1.32  {d2,d3}, [r1], r3      ;\
+    subs      r2,         $8        ;\
+    blt       1f                    ;\
+0:  vext.8    d0,  d2, d3, $(offset);\
+    vmov      d3,      d2           ;\
+    vld1.32  {d2},    [r1], r3      ;\
+    subs      r2,          $8       ;\
+    vst1.64  {d0},    [ip, :64], r3 ;\
+    bge       0b                    ;\
+1:  vext.8    d0,  d2, d3, $(offset);\
+    add       r1,          $8       ;\
+    vst1.64  {d0},    [ip, :64]     ;\
+2:  add       r1,          $(offset);\
+    b         L_scalarReverseCopy
+
+L_reverseAligned1:
+    RCOPY_UNALIGNED(1)
+L_reverseAligned2:
+    RCOPY_UNALIGNED(2)
+L_reverseAligned3:
+    RCOPY_UNALIGNED(3)
+
+/*****************************************************************************
+ *  front to back copy                                                       *
+ *****************************************************************************/
+
+L_copyFrontToBack:
+
+// Here the pointers are laid out such that we can use our preferred
+// front-to-back copy.  We preserve original destination pointer in r0 because
+// it is the return value for the routine, and copy it to ip to use in this
+// routine.
+
+    mov      ip,    r0
+    
+// Subtract 8 from the buffer length; if this is negative, then we will use
+// only single-byte copies, and we jump directly to a scalar copy loop.
+    
+    subs     r2,        $8
+    blt      L_scalarCopy
+    
+// If the destination pointer is 8-byte aligned we can use 8-byte NEON copies
+// to move the data.
+
+    tst      ip,        $7
+    beq      L_vectorCopy
+    
+// Otherwise, we copy a single byte at a time, in order of ascending memory
+// address, until the destination is 8 byte aligned.  Within this loop,
+// registers are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to the next byte to copy
+//  r2  (bytes remaining to be copied) - 8
+//  r3  temporary to hold the byte that is being copied
+//  ip  pointer to the next byte to store to
+
+0:  ldrb     r3,  [r1], $1
+    sub      r2,        $1
+    strb     r3,  [ip], $1
+    tst      ip,        $7
+    bne      0b
+    
+// At this point, the destination pointer is 8 byte aligned.  Check again that
+// there are at least 8 bytes remaining to copy by comparing the remaining
+// length minus 8 to zero.  If fewer than 8 bytes remain, jump to the cleanup
+// path.
+
+    cmp      r2,        $0
+    blt      L_scalarCopy
+    
+/*****************************************************************************
+ *  destination is doubleword aligned                                        *
+ *****************************************************************************/
+
+L_vectorCopy:
+
+// At this point, registers contain the following values:
+//
+//  r0  original destination pointer
+//  r1  pointer to the next element to be copied
+//  r2  (bytes remaining to copy) - 8
+//  ip  pointer to the destination of the next byte to be copied
+//
+// Furthermore, it is known that ip is 8 byte aligned, and that r2 is positive.
+// NEON has really excellent alignment handling in hardware, so we would like
+// to use that to handle cases where the source is not similarly aligned to the
+// destination (it supports even single-byte misalignment at speed).  However,
+// on some SoC designs, not all of the DMA busses support such access.  Thus,
+// we must unfortunately use a software workaround in those cases.
+//
+// Fortunately, 4-byte aligned loads are supported even on the DMA busses, so
+// we only need to handle the different possible source alignments modulo 4.
+// Here we have a dispatch table to jump to the correct copy implementation
+// for the given source alignment.
+//
+// The tbh instruction loads the address offset of the correct implementation
+// from the data table that immediately follows it and adds it to the pc to 
+// jump to the correct branch.
+
+    ands     r3,    r1, $3
+    bic      r1,        $3
+    tbh     [pc, r3, lsl $1]
+0:  
+.short (L_sourceAligned0-0b)/2
+.short (L_sourceAligned1-0b)/2
+.short (L_sourceAligned2-0b)/2
+.short (L_sourceAligned3-0b)/2
+
+/*****************************************************************************
+ *  source is also at least word aligned                                     *
+ *****************************************************************************/
+    
+L_sourceAligned0:
+
+// Subtract 56 from r2, so that it contains the number of bytes remaining to
+// copy minus 64.  If this result is negative, then we jump into a loop that
+// copies 8 bytes at a time.
+
+    subs     r2,        $0x38
+    blt      L_vectorCleanup
+    
+// Check if the destination pointer is 64-byte aligned.  If so, jump to a loop
+// that copies whole cachelines.
+
+    tst      ip,        $0x38
+    beq      L_cachelineAligned
+        
+// Otherwise, we copy a 8 bytes at a time, in order of ascending memory
+// address, until the destination is 64 byte aligned.  Within this loop,
+// registers are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to the next element to be copied
+//  r2  (bytes remaining to be copied) - 64
+//  ip  pointer to the destination of the next byte to be copied
+//  d0  temporary storage for copy
+
+0:  vld1.32 {d0},  [r1]!
+    sub      r2,        $8
+    vst1.64 {d0},  [ip,:64]!
+    tst      ip,        $0x38
+    bne      0b
+    
+// At this point, the destination pointer is 64 byte aligned.  Check again that
+// there are at least 64 bytes remaining to copy by comparing the remaining
+// length minus 64 to zero.  If fewer than 64 bytes remain, skip over the main
+// copy loop.
+
+    cmp      r2,        $0
+    blt      L_vectorCleanup
+    
+/*****************************************************************************
+ *  destination is cacheline aligned                                         *
+ *****************************************************************************/
+
+// In the special case that we are copying a buffer of between 1k and 32k bytes
+// we do not use a NEON copy for the main loop.  This is because if we happen
+// to be doing a copy from a source in cache to a destination that is not in
+// cache, this will result in an increase in energy usage.  In all other cases,
+// NEON gives superior energy conservation.
+
+L_cachelineAligned:
+    sub      r3,    r2, $0x3c0
+    cmp      r3,        $0x7c00
+    blo      L_useSTMIA
+    
+// The destination pointer is known to be 64-byte aligned, so we can use the
+// maximal alignment hint (:256) for our vector stores.  Detect if the source
+// is also at least 32-byte aligned and jump to a loop that uses maximal
+// alignment hints for the loads as well if possible.
+
+    tst      r1,        $0x1f
+    beq      L_sourceAligned32
+    
+// This loop copies 64 bytes per iteration, from a 4-byte aligned source to a
+// 64-byte aligned destination, in order of ascending memory address.  Within
+// this loop, registers are used as follows:
+//
+//  r0      original destination pointer (unmodified)
+//  r1      pointer to the next 32-byte block to load
+//  r2      (number of bytes remaining to copy) - 64
+//  ip      pointer to which the next 32-byte block is to be stored
+//  q0-q3   temporary registers used for copies
+//
+// Note that the loop is arrange in such a way that a single cleanup store is
+// necessary after the final loop iteration.  This occurs at label (1), and is
+// shared between the unaligned and aligned loops.
+
+    vld1.32 {q2,q3}, [r1]!
+    vld1.32 {q0,q1}, [r1]!
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256]!
+    blt      1f
+.align 3
+0:  vld1.32 {q2,q3}, [r1]!
+    vst1.64 {q0,q1}, [ip,:256]!
+    vld1.32 {q0,q1}, [r1]!
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256]!
+    bge      0b
+    b        1f
+    
+L_sourceAligned32:
+
+// This loop is identical to the immediately preceeding loop, except that it
+// uses the additional alignment hint that the source pointer (r1) is 32-byte
+// aligned.  The two loops share cleanup code for the final iteration.
+
+    vld1.64 {q2,q3}, [r1,:256]!
+    vld1.64 {q0,q1}, [r1,:256]!
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256]!
+    blt      1f
+.align 3
+0:  vld1.64 {q2,q3}, [r1,:256]!
+    vst1.64 {q0,q1}, [ip,:256]!
+    vld1.64 {q0,q1}, [r1,:256]!
+    subs     r2,         $64
+    vst1.64 {q2,q3}, [ip,:256]!
+    bge      0b
+    
+// Final vector store for both of the above loops.
+
+1:  vst1.64 {q0,q1}, [ip,:256]!
+
+L_vectorCleanup:
+
+// Add 56 to r2, so that it contains the number of bytes remaing to copy minus
+// 8.  A comparison of this value with zero tells us if any more whole 8-byte
+// blocks need to be copied.
+
+    adds     r2,        $0x38
+    blt      L_scalarCopy
+
+// This loop copies 8 bytes at a time in order of descending memory address,
+// until fewer than 8 bytes remain to be copied.  Within this loop, registers
+// are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to the next element to be copied
+//  r2  (bytes remaining to be copied) - 64
+//  ip  pointer to the destination of the next byte to be copied
+//  d0  temporary storage for copy
+    
+0:  vld1.32 {d0},   [r1]!
+    subs     r2,        $8
+    vst1.64 {d0},   [ip,:64]!
+    bge      0b
+
+/*****************************************************************************
+ *  sub-doubleword cleanup copies                                            *
+ *****************************************************************************/
+
+L_scalarCopy:
+
+// Add 8 to r2, so that it contains the number of bytes remaining to copy, and
+// return to the calling routine if zero bytes remain.
+
+    adds     r2,        $8
+    it       eq
+    bxeq     lr
+         
+// Copy one byte at a time in descending address order until we reach the front
+// of the buffer.  Within this loop, registers are used as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to one byte past the next element to be copied
+//  r2  (bytes remaining to be copied) - 8
+//  r3  temporary to hold the byte that is being copied
+//  ip  pointer one byte past the destination of the next byte to be copied
+
+0:  ldrb     r3,    [r1], $1
+    strb     r3,    [ip], $1
+    subs     r2,          $1
+    bne      0b
+    bx       lr
+    
+/*****************************************************************************
+ *  STMIA loop for 1k-32k buffers                                            *
+ *****************************************************************************/
+    
+// This loop copies 64 bytes each iteration in order of ascending memory
+// address, using the GPRs instead of NEON.
+//
+//  r0  original destination pointer
+//  r1  pointer to the next element to be copied
+//  r2  (bytes remaining to be copied) - 64
+//  r3-6,r8-11 (COPY_REGISTERS) temporary registers used for moving data
+//  ip  pointer to the next location to store to
+
+L_useSTMIA:
+    push     SAVE_REGISTERS
+.align 3
+0:  ldmia   r1!,    COPY_REGISTERS
+    subs    r2,     r2,  $64
+    stmia   ip!,    COPY_REGISTERS
+    ldmia   r1!,    COPY_REGISTERS
+    pld     [r1, $64]
+    stmia   ip!,    COPY_REGISTERS
+    bge     0b
+    pop     SAVE_REGISTERS
+    b       L_vectorCleanup
+    
+/*****************************************************************************
+ *  Misaligned forward vld1 loop                                             *
+ *****************************************************************************/
+
+// Software alignment fixup to handle source and dest that are relatively
+// misaligned mod 4 bytes.  
+//
+// The basic idea is to use 4-byte aligned loads to load 8 bytes per iteration,
+// which we combine with the 8 bytes loaded in the previous iteration to get a
+// 16 byte field; the next 8 bytes to be stored to the destination buffer are
+// somewhere in that field, and we get them using the VEXT instruction:
+//      
+//     |  8 bytes from last iteration  |  8 bytes from this iteration  |
+//     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+//     | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f |
+//     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+//         ^8 bytes to store this iteration^           |
+//                                                   could be a page boundary 
+//
+// We need to be a little bit careful, however.  Because the loads only have 4
+// byte alignment, if we used this approach all the way to the end of the
+// buffer, the very last 8 byte load might slop over onto a new page by 4
+// bytes, and that new page might not be mapped into our process.  Thus, we
+// terminate this copy loop when fewer than 12 bytes remain to be copied,
+// instead of the more natural-seeming termination condition of "8 bytes
+// remaining" (the illustration above shows the worst case and demonstrates
+// why 12 is a sufficiently safe condition).
+//
+// At the beginning of each iteration through this loop, registers are used
+// as follows:
+//
+//  r0  original destination pointer
+//  r1  pointer to the next block of 8 bytes to load
+//  r2  (bytes remaining to copy) - 12
+//  ip  pointer to the next block of 8 bytes to store
+//  d0  next 8 bytes to store
+//  d2  8 bytes loaded in the previous iteration
+//  d3  8 bytes loaded two iterations ago
+
+#define COPY_UNALIGNED(offset)       \
+    subs      r2,          $4       ;\
+    blt       2f                    ;\
+    vld1.32  {d2,d3}, [r1]!         ;\
+    subs      r2,          $8       ;\
+    blt       1f                    ;\
+0:  vext.8    d0,  d2, d3, $(offset);\
+    vmov      d2,      d3           ;\
+    vld1.32  {d3},    [r1]!         ;\
+    subs      r2,          $8       ;\
+    vst1.64  {d0},    [ip, :64]!    ;\
+    bge       0b                    ;\
+1:  vext.8    d0,  d2, d3, $(offset);\
+    sub       r1,          $8       ;\
+    vst1.64  {d0},    [ip, :64]!    ;\
+2:  add       r1,          $(offset);\
+    add       r2,          $4       ;\
+    b         L_scalarCopy
+
+L_sourceAligned1:
+    COPY_UNALIGNED(1)
+L_sourceAligned2:
+    COPY_UNALIGNED(2)
+L_sourceAligned3:
+    COPY_UNALIGNED(3)
+
+#endif // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
index 9b2664f9f08c2efd952295785aa9c89a56734cf7..45f0e2b6420bb0ac4f9903f43545da326c986552 100644 (file)
  * this function on OS X and iOS).
  */
 
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+/*****************************************************************************
+ * Macros                                                                    *
+ *****************************************************************************/
+
+#define A9_ENTRY(name) \
+       .align 2;\
+       .globl _ ## name ## $VARIANT$CortexA9;\
+       _ ## name ## $VARIANT$CortexA9:
+
+#define ESTABLISH_FRAME \
+       push   {r0,r4,r7,lr};\
+       add     r7,     sp, #8
+    
+#define CLEAR_FRAME_AND_RETURN \
+       pop    {r0,r4,r7,pc}
+    
+#define ADDITIONAL_CALLEE_SAVE_REGISTERS {r5,r6,r8,r10}
+
+#define COPY_REGISTERS {r3,r4,r5,r6,r8,r9,r10,r12}
+
+/*****************************************************************************
+ *  entry points                                                             *
+ *****************************************************************************/
+
+.text
+.syntax unified
+.code 32
+
+A9_ENTRY(bcopy)
+//  Translate bcopy calls into memcpy calls by swapping the first and second
+//  arguments.
+       mov     r3,     r0
+       mov     r0,     r1
+       mov     r1,     r3
+
+A9_ENTRY(memcpy)
+A9_ENTRY(memmove)
+//  Our preference is to copy the data in ascending address order, but if the
+//  buffers overlap such that the beginning of the destination buffer aliases
+//  the end of the source buffer, we need to copy in descending address order
+//  instead to preserve the memmove semantics.  We detect this case with the
+//  test:
+//
+//      destination - source < length    (unsigned compare)
+//
+//  If the address of the source buffer is higher than the address of the
+//  destination buffer, this arithmetic can overflow, but the overflowed value
+//  can only be smaller than length if the buffers do not overlap, so we don't
+//  need to worry about false positives due to the overflow (they happen, but
+//  only in cases where copying in either order is correct).
+       subs    r3,     r0, r1
+       bxeq    lr
+       ESTABLISH_FRAME
+       cmp     r3,     r2
+       blo     L_descendingCopy
+
+/*****************************************************************************
+ *  ascending copy                                                           *
+ *****************************************************************************/
+
+//  The layout of the two buffers is such that we can use our preferred
+//  (ascending address order) copy implementation.  Throughout this copy,
+//  registers are used as follows:
+//
+//      r0  lowest unwritten address in the destination buffer.
+//      r1  lowest unread address in the source buffer.
+//      r2  number of bytes remaining to copy less an offset that varies
+//          with the size of the copies that are being made.
+//      r3, r4, r5, r6, r8, r9, r10, r12
+//          temporary registers used to hold the data during copies.
+//      r12 also used as a scratch register for alignment / length calculations
+
+L_ascendingCopy:
+//  We begin by checking if less than four bytes are to be copied; if so, we
+//  branch directly to a small-buffer copy and return.  Otherwise, we copy up
+//  to three bytes if needed to make the destination pointer have word (four
+//  byte) alignment.
+       subs    r2,         #4
+       blo     L_ascendingLengthLessThanFour
+       ands    ip,     r0, #0x3
+       beq     L_ascendingDestinationWordAligned
+       ldrb    r3,    [r1],#1
+       cmp     ip,         #2
+       ldrbls  r4,    [r1],#1
+       strb    r3,    [r0],#1
+       ldrblo  r3,    [r1],#1
+       add     r2,         ip
+       strbls  r4,    [r0],#1
+       strblo  r3,    [r0],#1
+       subs    r2,         #4
+       bhs     L_ascendingDestinationWordAligned
+    
+L_ascendingLengthLessThanFour:
+//  Conditionally copies up to three bytes, assuming no alignment.  This is
+//  only used if the original length of the buffer is smaller than four.
+       lsls    ip,     r2, #31
+       ldrbcs  r3,    [r1],#1
+       ldrbcs  ip,    [r1],#1
+       ldrbmi  r4,    [r1]
+       strbcs  r3,    [r0],#1
+       strbcs  ip,    [r0],#1
+       strbmi  r4,    [r0]
+       CLEAR_FRAME_AND_RETURN
+    
+L_ascendingDestinationWordAligned:
+//  We know that the destination has word alignment.  If the source is not
+//  similarly aligned, jump to an unaligned copy loop.
+       tst     r1,         #0x3
+       bne             L_ascendingUnalignedCopy
+
+/*****************************************************************************
+ *  ascending copy, both buffers have word alignment                         *
+ *****************************************************************************/
+    
+//  If less than sixty-four bytes remain to be copied, jump directly to the
+//  word-aligned cleanup path.  Otherwise, we copy up to 28 bytes as needed
+//  to make the destination pointer have cacheline alignment.
+       subs    r2,     r2, #0x3c
+       blo     L_ascendingLengthLessThanSixtyFour
+0:  tst     r0,         #0x1c
+       beq     L_ascendingDestinationCachelineAligned
+       ldr     r3,    [r1],#4
+       subs    r2,         #4
+       str     r3,    [r0],#4
+       bhs     0b
+       b       L_ascendingLengthLessThanSixtyFour
+
+L_ascendingDestinationCachelineAligned:
+//  Unrolled main copy loop; copies two cachelines (64 bytes) per iteration.
+//  Empirical testing suggests that 0x60 is the optimal lookahead for preload,
+//  though anything between 0x40 and 0x100 seems to be "acceptable".
+       push    ADDITIONAL_CALLEE_SAVE_REGISTERS
+0:     ldm     r1!,    COPY_REGISTERS
+       subs    r2,     r2, #0x40
+       stm     r0!,    COPY_REGISTERS
+       pld    [r1, #0x60]
+       ldm     r1!,    COPY_REGISTERS
+       pld    [r1, #0x60]
+       stm     r0!,    COPY_REGISTERS
+       bhs     0b
+       pop     ADDITIONAL_CALLEE_SAVE_REGISTERS
+
+L_ascendingLengthLessThanSixtyFour:
+//  Cleanup copy of up to 63 bytes.  We can assume that both the source and
+//  destination addresses have word alignment here.
+    tst     r2,         #0x30
+    beq     1f
+0:  ldm     r1!,   {r3,r4,r9,ip}
+    sub     r2,     r2, #0x10
+    stm     r0!,   {r3,r4,r9,ip}
+    tst     r2,         #0x30
+    bne     0b
+1:  tst     r2,         #0xf
+    beq     2f
+    lsls    ip,     r2, #29
+    ldmcs   r1!,   {r3,ip}
+    stmcs   r0!,   {r3,ip}
+    ldrmi   r3,    [r1],#4
+    strmi   r3,    [r0],#4
+       lsls    ip,     r2, #31
+       ldrhcs  r3,    [r1],#2
+       strhcs  r3,    [r0],#2
+       ldrbmi  ip,    [r1]
+       strbmi  ip,    [r0]
+2:  CLEAR_FRAME_AND_RETURN
+
+/*****************************************************************************
+ *  ascending copy, source buffer is not word aligned                        *
+ *****************************************************************************/
+
+L_ascendingUnalignedCopy:
+//  Destination buffer is word aligned, but source buffer is not.  Copy
+//  byte-by-byte until the destination buffer has eightbyte alignment.
+    subs    r2,         #4
+    blo     L_ascendingUnalignedByteCleanup
+0:  tst     r0,         #0x7
+    beq     L_ascendingUnalignedVectorCopy
+    ldrb    r3,    [r1],#1
+    subs    r2,         #1
+    strb    r3,    [r0],#1
+    bhs     0b
+L_ascendingUnalignedByteCleanup:
+    adds    r2,         #8
+    beq     1f
+0:  ldrb    r3,    [r1],#1
+    subs    r2,         #1
+    strb    r3,    [r0],#1
+    bne     0b
+1:  CLEAR_FRAME_AND_RETURN
+    
+L_ascendingUnalignedVectorCopy:
+//  Destination buffer is eightbyte aligned.  Source buffer has unknown
+//  alignment.  Use NEON to handle the misaligned copies.  We begin by copying
+//  up to 24 bytes to get cacheline alignment of the destination buffer.
+    subs    r2,         #0x18
+    blo     L_ascendingUnalignedVectorCleanup
+0:  tst     r0,         #0x18
+    beq     L_ascendingUnalignedCachelineCopy
+    vld1.8 {d0},   [r1]!
+    subs    r2,         #8
+    vst1.8 {d0},   [r0,:64]!
+    bhs     0b
+L_ascendingUnalignedVectorCleanup:
+    adds    r2,         #0x18
+    blo     L_ascendingUnalignedByteCleanup
+0:  vld1.8 {d0},   [r1]!
+    subs    r2,         #8
+    vst1.8 {d0},   [r0,:64]!
+    bhs     0b
+    b       L_ascendingUnalignedByteCleanup
+    
+L_ascendingUnalignedCachelineCopy:
+//  Main copy loop; moves 32 bytes per iteration.  Requires only byte alignment
+//  of the source address.
+    vld1.8 {q0,q1},[r1]!
+    pld    [r1, #0x60]
+    vst1.8 {q0,q1},[r0,:256]!
+    subs    r2,         #0x20
+    bhs     L_ascendingUnalignedCachelineCopy
+    b       L_ascendingUnalignedVectorCleanup
+
+/*****************************************************************************
+ *  descending copy                                                          *
+ *****************************************************************************/
+
+//  The layout of the two buffers is such that we must copy in descending-
+//  address order.  Throughout this copy, registers are used as follows:
+//
+//      r0  lowest address in the destination buffer that has been written to.
+//      r1  lowest address in the source buffer that has been read from.
+//      r2  number of bytes remaining to copy less an offset that varies
+//          with the size of the copies that are being made.
+//      r3, r4, r5, r6, r8, r9, r10, r12
+//          temporary registers used to hold the data during copies.
+//      r12 also used as a scratch register for alignment / length calculations
+
+L_descendingCopy:
+//  We begin by checking if less than four bytes are to be copied; if so, we
+//  branch directly to a small-buffer copy and return.  Otherwise, we copy up
+//  to three bytes if needed to make the destination pointer have word (four
+//  byte) alignment.
+    add     r1,     r2
+    add     r0,     r2
+    subs    r2,         #4
+       blo     L_descendingLengthLessThanFour
+       ands    ip,     r0, #0x3
+       beq     L_descendingDestinationWordAligned
+       ldrb    r3,    [r1, #-1]!
+       cmp     ip,         #2
+       ldrbhs  r4,    [r1, #-1]!
+       strb    r3,    [r0, #-1]!
+       ldrbhi  r3,    [r1, #-1]!
+       strbhs  r4,    [r0, #-1]!
+       strbhi  r3,    [r0, #-1]!
+       subs    r2,         ip
+       bhs     L_descendingDestinationWordAligned
+        
+L_descendingLengthLessThanFour:
+//  Conditionally copies up to three bytes, assuming no alignment.  This is
+//  only used if the original length of the buffer is smaller than four.
+       lsls    ip,     r2, #31
+       ldrbcs  r3,    [r1, #-1]!
+       ldrbcs  ip,    [r1, #-1]!
+       ldrbmi  r4,    [r1, #-1]
+       strbcs  r3,    [r0, #-1]!
+       strbcs  ip,    [r0, #-1]!
+       strbmi  r4,    [r0, #-1]
+       CLEAR_FRAME_AND_RETURN
+    
+L_descendingDestinationWordAligned:
+//  We know that the destination has word alignment.  If the source is not
+//  similarly aligned, jump to an unaligned copy loop.
+       tst     r1,         #0x3
+       bne             L_descendingUnalignedCopy
+
+/*****************************************************************************
+ *  descending copy, both buffers have word alignment                        *
+ *****************************************************************************/
+    
+//  If less than sixty-four bytes remain to be copied, jump directly to the
+//  word-aligned cleanup path.  Otherwise, we copy up to 28 bytes as needed
+//  to make the destination pointer have cacheline alignment.
+       subs    r2,     r2, #0x3c
+       blo     L_descendingLengthLessThanSixtyFour
+0:  tst     r0,         #0x1c
+       beq     L_descendingDestinationCachelineAligned
+       ldr     r3,    [r1, #-4]!
+       subs    r2,         #4
+       str     r3,    [r0, #-4]!
+       bhs     0b
+       b       L_descendingLengthLessThanSixtyFour
+
+L_descendingDestinationCachelineAligned:
+//  Unrolled main copy loop; copies two cachelines (64 bytes) per iteration.
+//  Empirical testing suggests that -0x80 is the optimal lookahead for preload,
+//  though anything between -0x40 and -0x100 seems to be "acceptable".
+       push    ADDITIONAL_CALLEE_SAVE_REGISTERS
+0:     ldmdb   r1!,    COPY_REGISTERS
+       subs    r2,     r2, #0x40
+       stmdb   r0!,    COPY_REGISTERS
+       pld    [r1, #-0x80]
+       ldmdb   r1!,    COPY_REGISTERS
+       pld    [r1, #-0x80]
+       stmdb   r0!,    COPY_REGISTERS
+       bhs     0b
+       pop     ADDITIONAL_CALLEE_SAVE_REGISTERS
+
+L_descendingLengthLessThanSixtyFour:
+//  Cleanup copy of up to 63 bytes.  We can assume that both the source and
+//  destination addresses have word alignment here.
+    tst     r2,         #0x30
+    beq     1f
+0:  ldmdb   r1!,   {r3,r4,r9,ip}
+    sub     r2,     r2, #0x10
+    stmdb   r0!,   {r3,r4,r9,ip}
+    tst     r2,         #0x30
+    bne     0b
+1:  tst     r2,         #0xf
+    beq     2f
+    lsls    ip,     r2, #29
+    ldmdbcs r1!,   {r3,ip}
+    stmdbcs r0!,   {r3,ip}
+    ldrmi   r3,    [r1, #-4]!
+    strmi   r3,    [r0, #-4]!
+       lsls    ip,     r2, #31
+       ldrhcs  r3,    [r1, #-2]!
+       strhcs  r3,    [r0, #-2]!
+       ldrbmi  ip,    [r1, #-1]
+       strbmi  ip,    [r0, #-1]
+2:  CLEAR_FRAME_AND_RETURN
+
+/*****************************************************************************
+ *  descending copy, source buffer is not word aligned                       *
+ *****************************************************************************/
+
+L_descendingUnalignedCopy:
+//  Destination buffer is word aligned, but source buffer is not.  Copy
+//  byte-by-byte until the destination buffer has eightbyte alignment.
+    subs    r2,         #4
+    blo     L_descendingUnalignedByteCleanup
+0:  tst     r0,         #0x7
+    beq     L_descendingUnalignedVectorCopy
+    ldrb    r3,    [r1, #-1]!
+    subs    r2,         #1
+    strb    r3,    [r0, #-1]!
+    bhs     0b
+L_descendingUnalignedByteCleanup:
+    adds    r2,         #8
+    beq     1f
+0:  ldrb    r3,    [r1, #-1]!
+    subs    r2,         #1
+    strb    r3,    [r0, #-1]!
+    bne     0b
+1:  CLEAR_FRAME_AND_RETURN
+    
+L_descendingUnalignedVectorCopy:
+//  Destination buffer is eightbyte aligned.  Source buffer has unknown
+//  alignment.  Use NEON to handle the misaligned copies.  We begin by copying
+//  up to 24 bytes to get cacheline alignment of the destination buffer.
+    subs    r2,         #0x18
+    blo     L_descendingUnalignedVectorCleanup
+0:  tst     r0,         #0x18
+    beq     L_descendingUnalignedCachelineCopy
+    sub     r1,         #8
+    vld1.8 {d0},   [r1]
+    sub     r0,         #8
+    vst1.8 {d0},   [r0,:64]
+    subs    r2,         #8
+    bhs     0b
+L_descendingUnalignedVectorCleanup:
+    adds    r2,         #0x18
+    blo     L_descendingUnalignedByteCleanup
+0:  sub     r1,         #8
+    vld1.8 {d0},   [r1]
+    sub     r0,         #8
+    vst1.8 {d0},   [r0,:64]
+    subs    r2,         #8
+    bhs     0b
+    b       L_descendingUnalignedByteCleanup
+    
+L_descendingUnalignedCachelineCopy:
+//  Main copy loop; moves 32 bytes per iteration.  Requires only byte alignment
+//  of the source address.
+    sub     r1,         #32
+    sub     r0,         #32
+    mov     r4,         #-32
+0:  vld1.8 {q0,q1},[r1], r4
+    pld    [r1, #-0x60]
+    vst1.8 {q0,q1},[r0,:256], r4
+    subs    r2,         #0x20
+    bhs     0b
+    add     r1,         #32
+    add     r0,         #32
+    b       L_descendingUnalignedVectorCleanup
+
+#endif // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
index 711b91d207515925dad936759b70f43aa95c24ad..4d5fc22ea735ba54aaddd5a0eb1e39e01bc069bf 100644 (file)
  * @APPLE_LICENSE_HEADER_END@
  */
 
+/*****************************************************************************
+ * ARMv5 and ARMv6 implementation, also used in dyld on later archs          *
+ *****************************************************************************/
+#include <arm/arch.h>
+#if !defined _ARM_ARCH_7 || defined VARIANT_DYLD
+
+.text
+.align 2
+       
+       .globl _memcpy
+       .globl _bcopy
+       .globl _memmove
+
+_bcopy:                /* void bcopy(const void *src, void *dest, size_t len); */
+       mov             r3, r0
+       mov             r0, r1
+       mov             r1, r3
+
+_memcpy:               /* void *memcpy(void *dest, const void *src, size_t len); */
+_memmove:      /* void *memmove(void *dest, const void *src, size_t len); */
+       /* check for zero len or if the pointers are the same */
+       cmp             r2, #0
+       cmpne   r0, r1
+       bxeq    lr
+
+       /* save r0 (return value), r4 (scratch), and r5 (scratch) */
+       stmfd   sp!, { r0, r4, r5, r7, lr }
+       add     r7, sp, #12
+       
+       /* check for overlap. r3 <- distance between src & dest */
+       subhs   r3, r0, r1
+       sublo   r3, r1, r0
+       cmp             r3, r2                  /* if distance(src, dest) < len, we have overlap */
+       blo             Loverlap
+
+Lnormalforwardcopy:
+       /* are src and dest dissimilarly word aligned? */
+       mov             r12, r0, lsl #30
+       cmp             r12, r1, lsl #30
+       bne             Lnonwordaligned_forward
+
+       /* if len < 64, do a quick forward copy */
+       cmp             r2, #64
+       blt             Lsmallforwardcopy
+
+       /* check for 16 byte src/dest unalignment */
+       tst             r0, #0xf
+       bne             Lsimilarlyunaligned
+
+       /* check for 32 byte dest unalignment */
+       tst             r0, #(1<<4)
+       bne             Lunaligned_32
+
+Lmorethan64_aligned:
+       /* save some more registers to use in the copy */
+       stmfd   sp!, { r6, r8, r10, r11 }
+
+       /* pre-subtract 64 from the len counter to avoid an extra compare in the loop */
+       sub             r2, r2, #64
+
+L64loop:
+       /* copy 64 bytes at a time */
+       ldmia   r1!, { r3, r4, r5, r6, r8, r10, r11, r12 }
+#ifdef _ARM_ARCH_6
+       pld             [r1, #32]
+#endif
+       stmia   r0!, { r3, r4, r5, r6, r8, r10, r11, r12 }
+       ldmia   r1!, { r3, r4, r5, r6, r8, r10, r11, r12 }
+       subs    r2, r2, #64
+#ifdef _ARM_ARCH_6
+       pld             [r1, #32]
+#endif
+       stmia   r0!, { r3, r4, r5, r6, r8, r10, r11, r12 }
+       bge             L64loop
+
+       /* restore the scratch registers we just saved */
+       ldmfd   sp!, { r6, r8, r10, r11 }
+
+       /* fix up the len counter (previously subtracted an extra 64 from it) and test for completion */
+       adds    r2, r2, #64
+       beq             Lexit
+
+Llessthan64_aligned:
+       /* copy 16 bytes at a time until we have < 16 bytes */
+       cmp             r2, #16
+       ldmgeia r1!, { r3, r4, r5, r12 }
+       stmgeia r0!, { r3, r4, r5, r12 }
+       subges  r2, r2, #16
+       bgt             Llessthan64_aligned
+       beq             Lexit
+       
+Llessthan16_aligned:
+       mov             r2, r2, lsl #28
+       msr             cpsr_f, r2
+
+       ldmmiia r1!, { r2, r3 }
+       ldreq   r4, [r1], #4
+       ldrcsh  r5, [r1], #2
+       ldrvsb  r12, [r1], #1
+
+       stmmiia r0!, { r2, r3 }
+       streq   r4, [r0], #4
+       strcsh  r5, [r0], #2
+       strvsb  r12, [r0], #1
+       b               Lexit
+
+Lsimilarlyunaligned:
+       /* both src and dest are unaligned in similar ways, align to dest on 32 byte boundary */
+       mov             r12, r0, lsl #28
+       rsb             r12, r12, #0
+       msr             cpsr_f, r12
+
+       ldrvsb  r3, [r1], #1
+       ldrcsh  r4, [r1], #2
+       ldreq   r5, [r1], #4
+
+       strvsb  r3, [r0], #1
+       strcsh  r4, [r0], #2
+       streq   r5, [r0], #4
+
+       ldmmiia r1!, { r3, r4 }
+       stmmiia r0!, { r3, r4 }
+
+       subs    r2, r2, r12, lsr #28
+       beq             Lexit
+
+Lunaligned_32:
+       /* bring up to dest 32 byte alignment */
+       tst             r0, #(1 << 4)
+       ldmneia r1!, { r3, r4, r5, r12 }
+       stmneia r0!, { r3, r4, r5, r12 }
+       subne   r2, r2, #16
+
+       /* we should now be aligned, see what copy method we should use */
+       cmp             r2, #64
+       bge             Lmorethan64_aligned
+       b               Llessthan64_aligned
+       
+Lbytewise2:
+       /* copy 2 bytes at a time */
+       subs    r2, r2, #2
+
+       ldrb    r3, [r1], #1
+       ldrplb  r4, [r1], #1
+
+       strb    r3, [r0], #1
+       strplb  r4, [r0], #1
+
+       bhi             Lbytewise2
+       b               Lexit
+
+Lbytewise:
+       /* simple bytewise forward copy */
+       ldrb    r3, [r1], #1
+       subs    r2, r2, #1
+       strb    r3, [r0], #1
+       bne             Lbytewise
+       b               Lexit
+
+Lsmallforwardcopy:
+       /* src and dest are word aligned similarly, less than 64 bytes to copy */
+       cmp             r2, #4
+       blt             Lbytewise2
+
+       /* bytewise copy until word aligned */
+       tst             r1, #3
+Lwordalignloop:
+       ldrneb  r3, [r1], #1
+       strneb  r3, [r0], #1
+       subne   r2, r2, #1
+       tstne   r1, #3
+       bne             Lwordalignloop
+
+       cmp             r2, #16
+       bge             Llessthan64_aligned
+       blt             Llessthan16_aligned
+
+Loverlap:
+       /* src and dest overlap in some way, len > 0 */
+       cmp             r0, r1                          /* if dest > src */
+       bhi             Loverlap_srclower
+
+Loverlap_destlower:
+       /* dest < src, see if we can still do a fast forward copy or fallback to slow forward copy */
+       cmp             r3, #64
+       bge             Lnormalforwardcopy      /* overlap is greater than one stride of the copy, use normal copy */
+
+       cmp             r3, #2
+       bge             Lbytewise2
+       b               Lbytewise
+
+       /* the following routines deal with having to copy in the reverse direction */
+Loverlap_srclower:
+       /* src < dest, with overlap */
+
+       /* src += len; dest += len; */
+       add             r0, r0, r2
+       add             r1, r1, r2
+
+       /* we have to copy in reverse no matter what, test if we can we use a large block reverse copy */
+       cmp             r2, #64                         /* less than 64 bytes to copy? */
+       cmpgt   r3, #64                         /* less than 64 bytes of nonoverlap? */
+       blt             Lbytewise_reverse
+
+       /* test of src and dest are nonword aligned differently */
+       mov             r3, r0, lsl #30
+       cmp             r3, r1, lsl #30
+       bne             Lbytewise_reverse
+
+       /* test if src and dest are non word aligned or dest is non 16 byte aligned */
+       tst             r0, #0xf
+       bne             Lunaligned_reverse_similarly
+
+       /* test for dest 32 byte alignment */
+       tst             r0, #(1<<4)
+       bne             Lunaligned_32_reverse_similarly
+
+       /* 64 byte reverse block copy, src and dest aligned */
+Lmorethan64_aligned_reverse:
+       /* save some more registers to use in the copy */
+       stmfd   sp!, { r6, r8, r10, r11 }
+
+       /* pre-subtract 64 from the len counter to avoid an extra compare in the loop */
+       sub             r2, r2, #64
+
+L64loop_reverse:
+       /* copy 64 bytes at a time */
+       ldmdb   r1!, { r3, r4, r5, r6, r8, r10, r11, r12 }
+#ifdef _ARM_ARCH_6
+       pld             [r1, #-32]
+#endif
+       stmdb   r0!, { r3, r4, r5, r6, r8, r10, r11, r12 }      
+       ldmdb   r1!, { r3, r4, r5, r6, r8, r10, r11, r12 }      
+       subs    r2, r2, #64
+#ifdef _ARM_ARCH_6
+       pld             [r1, #-32]
+#endif
+       stmdb   r0!, { r3, r4, r5, r6, r8, r10, r11, r12 }      
+       bge             L64loop_reverse
+
+       /* restore the scratch registers we just saved */
+       ldmfd   sp!, { r6, r8, r10, r11 }
+
+       /* fix up the len counter (previously subtracted an extra 64 from it) and test for completion */
+       adds    r2, r2, #64
+       beq             Lexit
+
+Lbytewise_reverse:
+       ldrb    r3, [r1, #-1]!
+       strb    r3, [r0, #-1]!
+       subs    r2, r2, #1
+       bne             Lbytewise_reverse
+       b               Lexit
+
+Lunaligned_reverse_similarly:
+       /* both src and dest are unaligned in similar ways, align to dest on 32 byte boundary */
+       mov             r12, r0, lsl #28
+       msr             cpsr_f, r12
+
+       ldrvsb  r3, [r1, #-1]!
+       ldrcsh  r4, [r1, #-2]!
+       ldreq   r5, [r1, #-4]!
+
+       strvsb  r3, [r0, #-1]!
+       strcsh  r4, [r0, #-2]!
+       streq   r5, [r0, #-4]!
+
+       ldmmidb r1!, { r3, r4 }
+       stmmidb r0!, { r3, r4 }
+
+       subs    r2, r2, r12, lsr #28
+       beq             Lexit
+
+Lunaligned_32_reverse_similarly:
+       /* bring up to dest 32 byte alignment */
+       tst             r0, #(1 << 4)
+       ldmnedb r1!, { r3, r4, r5, r12 }
+       stmnedb r0!, { r3, r4, r5, r12 }
+       subne   r2, r2, #16
+
+       /* we should now be aligned, see what copy method we should use */
+       cmp             r2, #64
+       bge             Lmorethan64_aligned_reverse
+       b               Lbytewise_reverse
+
+       /* the following routines deal with non word aligned copies */
+Lnonwordaligned_forward:
+       cmp             r2, #8
+       blt             Lbytewise2                      /* not worth the effort with less than 24 bytes total */
+
+       /* bytewise copy until src word aligned */
+       tst             r1, #3
+Lwordalignloop2:
+       ldrneb  r3, [r1], #1
+       strneb  r3, [r0], #1
+       subne   r2, r2, #1
+       tstne   r1, #3
+       bne             Lwordalignloop2
+
+       /* figure out how the src and dest are unaligned */
+       and             r3, r0, #3
+       cmp             r3, #2
+       blt             Lalign1_forward
+       beq             Lalign2_forward
+       bgt             Lalign3_forward
+
+Lalign1_forward:
+       /* the dest pointer is 1 byte off from src */
+       mov             r12, r2, lsr #2         /* number of words we should copy */
+       sub             r0, r0, #1
+
+       /* prime the copy */
+       ldrb    r4, [r0]                        /* load D[7:0] */
+
+Lalign1_forward_loop:
+       ldr             r3, [r1], #4            /* load S */
+       orr             r4, r4, r3, lsl #8      /* D[31:8] = S[24:0] */
+       str             r4, [r0], #4            /* save D */
+       mov             r4, r3, lsr #24         /* D[7:0] = S[31:25] */
+       subs    r12, r12, #1
+       bne             Lalign1_forward_loop
+
+       /* finish the copy off */
+       strb    r4, [r0], #1            /* save D[7:0] */
+
+       ands    r2, r2, #3
+       beq             Lexit
+       b               Lbytewise2
+
+Lalign2_forward:
+       /* the dest pointer is 2 bytes off from src */
+       mov             r12, r2, lsr #2         /* number of words we should copy */
+       sub             r0, r0, #2
+
+       /* prime the copy */
+       ldrh    r4, [r0]                        /* load D[15:0] */
+
+Lalign2_forward_loop:
+       ldr             r3, [r1], #4            /* load S */
+       orr             r4, r4, r3, lsl #16     /* D[31:16] = S[15:0] */
+       str             r4, [r0], #4            /* save D */
+       mov             r4, r3, lsr #16         /* D[15:0] = S[31:15] */
+       subs    r12, r12, #1
+       bne             Lalign2_forward_loop
+
+       /* finish the copy off */
+       strh    r4, [r0], #2            /* save D[15:0] */
+
+       ands    r2, r2, #3
+       beq             Lexit
+       b               Lbytewise2
+
+Lalign3_forward:
+       /* the dest pointer is 3 bytes off from src */
+       mov             r12, r2, lsr #2         /* number of words we should copy */
+       sub             r0, r0, #3
+
+       /* prime the copy */
+       ldr             r4, [r0]
+       and             r4, r4, #0x00ffffff     /* load D[24:0] */
+
+Lalign3_forward_loop:
+       ldr             r3, [r1], #4            /* load S */
+       orr             r4, r4, r3, lsl #24     /* D[31:25] = S[7:0] */
+       str             r4, [r0], #4            /* save D */
+       mov             r4, r3, lsr #8          /* D[24:0] = S[31:8] */
+       subs    r12, r12, #1
+       bne             Lalign3_forward_loop
+
+       /* finish the copy off */
+       strh    r4, [r0], #2            /* save D[15:0] */
+       mov             r4, r4, lsr #16
+       strb    r4, [r0], #1            /* save D[23:16] */
+
+       ands    r2, r2, #3
+       beq             Lexit
+       b               Lbytewise2
+
+Lexit:
+       ldmfd   sp!, {r0, r4, r5, r7, pc}
+
+#endif // !defined _ARM_ARCH_7 || defined VARIANT_DYLD
+
diff --git a/arm/string/bcopy_Swift.s b/arm/string/bcopy_Swift.s
new file mode 100644 (file)
index 0000000..e5188b1
--- /dev/null
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ *
+ *  This file implements the following functions for the Swift micro-arch:
+ *
+ *  void bcopy(const void * source,
+ *             void * destination,
+ *             size_t length);
+ *
+ *  void *memmove(void * destination,
+ *                const void * source,
+ *                size_t n);
+ *
+ *  void *memcpy(void * restrict destination,
+ *               const void * restrict source,
+ *               size_t n);
+ *
+ * All copy n successive bytes from source to destination.  Memmove and memcpy
+ * return destination, whereas bcopy has no return value.  Copying takes place
+ * as if it were through a temporary buffer -- after return destination
+ * contains exactly the bytes from source, even if the buffers overlap (this is
+ * not required of memcpy by the C standard; its behavior is undefined if the
+ * buffers overlap, but we are holding ourselves to the historical behavior of
+ * this function on OS X and iOS).
+ */
+
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+.syntax unified
+.code 16
+.globl _bcopy$VARIANT$Swift
+.thumb_func _bcopy$VARIANT$Swift
+.globl _memmove$VARIANT$Swift
+.thumb_func _memmove$VARIANT$Swift
+.globl _memcpy$VARIANT$Swift
+.thumb_func _memcpy$VARIANT$Swift
+
+.text
+.align 4
+_bcopy$VARIANT$Swift:
+//  Translate bcopy calls into memcpy calls by swapping the first and second
+//  arguments.
+    mov     r3,     r0
+    mov     r0,     r1
+    mov     r1,     r3
+
+_memmove$VARIANT$Swift:
+_memcpy$VARIANT$Swift:
+//  Our preference is to copy the data in ascending address order, but if the
+//  buffers overlap such that the beginning of the destination buffer aliases
+//  the end of the source buffer, we need to copy in descending address order
+//  instead to preserve the memmove semantics.  We detect this case with the
+//  test:
+//
+//      destination - source < length    (unsigned compare)
+//
+//  If the address of the source buffer is higher than the address of the
+//  destination buffer, this arithmetic can overflow, but the overflowed value
+//  can only be smaller than length if the buffers do not overlap, so we don't
+//  need to worry about false positives due to the overflow (they happen, but
+//  only in cases where copying in either order is correct).
+    push    {r7,lr}
+    mov     r7,         sp
+    subs    r3,     r0, r1
+    beq     L_exit
+    mov     ip,         r0
+    cmp     r3,         r2
+    blo     L_descendingCopy
+
+/*****************************************************************************
+ *  Ascending copy                                                           *
+ *****************************************************************************/
+
+    subs    r3,     r2, #32     //  If length < 32, jump to a dedicated code
+    blo     L_ascendingShort    //  path for short buffers.
+
+    orr     lr,     r0, r1      //  If the length is not a multiple of 16, or
+    orr     lr,         r2      //  either buffer is not 16-byte aligned, then
+    ands    lr,         #0xf    //  some edging is needed; jump to a separate
+    bne     L_ascendingEdging   //  branch to handle it.
+
+/*****************************************************************************
+ *  Ascending vector aligned copy                                            *
+ *****************************************************************************/
+
+0:  subs    r3,         #32     //  Copy 32 bytes at a time from src to dst,
+    vld1.8  {q0,q1}, [r1,:128]! //  both of which have 16-byte alignment.
+    vst1.8  {q0,q1}, [ip,:128]! //  Terminate this loop when 32 or fewer bytes
+    bhi     0b                  //  remain to be copied.
+
+    add     r1,         r3      //  Backtrack both pointers by 32 - remaining
+    vld1.8  {q0,q1}, [r1,:128]  //  and copy 32 bytes from src to dst.  This
+    add     ip,         r3      //  copy may overlap the previous copy, and
+    vst1.8  {q0,q1}, [ip,:128]  //  takes us precisely to the end of the
+    pop     {r7,pc}             //  buffer.
+
+/*****************************************************************************
+ *  Ascending vector misaligned copy                                         *
+ *****************************************************************************/
+
+L_ascendingEdging:
+    tst     ip,         #0xf    //  Copy one byte at a time until the 
+    itttt   ne                  //  destination pointer has 16 byte alignment.
+    ldrbne  r3,    [r1],#1
+    strbne  r3,    [ip],#1
+    subne   r2,         #1
+    bne     L_ascendingEdging
+
+    and     lr,     r1, #0xf    //  Back the source pointer up to a 16-byte
+    bic     r1,         #0xf    //  aligned location, and check if length > 32.
+    subs    r3,     r2, #32
+    blo     L_ascendingEdgingExit
+    tbh    [pc, lr, lsl #1]     //  Otherwise, we have a jump table based on
+0:                              //  the relative alignment of the buffers.
+.short (L_ascendingExtract0x0-0b)/2
+.short (L_ascendingExtract0x1-0b)/2
+.short (L_ascendingExtract0x2-0b)/2
+.short (L_ascendingExtract0x3-0b)/2
+.short (L_ascendingExtract0x4-0b)/2
+.short (L_ascendingExtract0x5-0b)/2
+.short (L_ascendingExtract0x6-0b)/2
+.short (L_ascendingExtract0x7-0b)/2
+.short (L_ascendingExtract0x8-0b)/2
+.short (L_ascendingExtract0x9-0b)/2
+.short (L_ascendingExtract0xa-0b)/2
+.short (L_ascendingExtract0xb-0b)/2
+.short (L_ascendingExtract0xc-0b)/2
+.short (L_ascendingExtract0xd-0b)/2
+.short (L_ascendingExtract0xe-0b)/2
+.short (L_ascendingExtract0xf-0b)/2
+
+L_ascendingExtract0x0:          //  If the two buffers are similarly aligned,
+    subs    r3,         #32     //  we use a slightly simpler loop that just
+    vld1.8  {q0,q1}, [r1,:128]! //  copies 32 bytes at a time.
+    vst1.8  {q0,q1}, [ip,:128]!
+    bhs     L_ascendingExtract0x0
+    b       L_ascendingEdgingExit
+
+#define ASCENDING_EXTRACT(shift)\
+L_ascendingExtract ## shift:\
+    vld1.8  {q8},    [r1,:128]!;\
+0:  vld1.8  {q9,q10},[r1,:128]!;\
+    vext.8  q0, q8, q9, $(shift);\
+    vext.8  q1, q9, q10,$(shift);\
+    vmov    q8,         q10;\
+    vst1.8  {q0,q1}, [ip,:128]!;\
+    subs    r3,         $32;\
+    bhs     0b;\
+    sub     r1,         $16;\
+    b       L_ascendingEdgingExit
+
+ASCENDING_EXTRACT(0x1)          //  Otherwise, we use the loop implemented in
+ASCENDING_EXTRACT(0x2)          //  the above macro.  It loads 32 bytes per
+ASCENDING_EXTRACT(0x3)          //  iteration combines it with the residual
+ASCENDING_EXTRACT(0x4)          //  bytes from the previous iteration, and
+ASCENDING_EXTRACT(0x5)          //  uses the VEXT instruction to extract 32
+ASCENDING_EXTRACT(0x6)          //  bytes that can be stored to a 16-byte
+ASCENDING_EXTRACT(0x7)          //  aligned location in the destination buffer.
+ASCENDING_EXTRACT(0x8)          //  This continues until 32 or fewer bytes
+ASCENDING_EXTRACT(0x9)          //  remain to be copied.  This is significantly
+ASCENDING_EXTRACT(0xa)          //  faster than using misaligned loads and
+ASCENDING_EXTRACT(0xb)          //  stores, which are very inefficient on
+ASCENDING_EXTRACT(0xc)          //  Swift.
+ASCENDING_EXTRACT(0xd)
+ASCENDING_EXTRACT(0xe)
+ASCENDING_EXTRACT(0xf)
+
+L_ascendingEdgingExit:
+    add     r1,         lr      //  Restore the source pointer
+    add     r2,     r3, #32     //  Restore the length
+L_ascendingShort:
+    subs    r2,         #1      //  Copy one byte at a time until the buffer
+    itt     hs                  //  is exhausted, then return.
+    ldrbhs  r3,    [r1],#1
+    strbhs  r3,    [ip],#1
+    bhi     L_ascendingShort
+L_exit:
+    pop     {r7,pc}
+
+/*****************************************************************************
+ *  Descending copy                                                          *
+ *****************************************************************************/
+
+L_descendingCopy:
+    add     r1,         r2      //  Advance source and destination pointers to
+    add     ip,         r2      //  the end of the buffer.
+
+    subs    r3,     r2, #32     //  If length < 32, jump to a dedicated code
+    blo     L_descendingShort   //  path for short buffers.
+
+    orr     lr,     r0, r1      //  If the length is not a multiple of 16, or
+    orr     lr,         r2      //  either buffer is not 16-byte aligned, then
+    ands    lr,         #0xf    //  some edging is needed; jump to a separate
+    bne     L_descendingEdging  //  branch to handle it.
+
+/*****************************************************************************
+ *  Descending vector aligned copy                                            *
+ *****************************************************************************/
+
+0:  sub     r1,         #32     //  Copies 32 bytes (16-byte aligned) from
+    vld1.8  {q0,q1}, [r1,:128]  //  source to destination on each pass through
+    sub     ip,         #32     //  the loop.  The loop ends when 32 or fewer
+    vst1.8  {q0,q1}, [ip,:128]  //  bytes remain to be copied.
+    subs    r3,         #32
+    bhi     0b
+    add     r3,         #32     //  Copy the remaining up-to-32 bytes.
+    sub     r1,         r3      //  This copy may overlap the copy performed
+    vld1.8  {q0,q1}, [r1,:128]  //  in the final iteration through the
+    sub     ip,         r3      //  previous loop, but this is more efficient
+    vst1.8  {q0,q1}, [ip,:128]  //  than figuring out exactly which bytes
+    pop     {r7,pc}             //  need to be copied.
+
+/*****************************************************************************
+ *  Descending vector misaligned copy                                        *
+ *****************************************************************************/
+
+L_descendingEdging:
+    tst     ip,         #0xf    //  Identical to how we handle misalignment for
+    itttt   ne                  //  ascending copies.  First we move one byte
+    ldrbne  r3,    [r1,#-1]!    //  at a time until the destination has 16
+    strbne  r3,    [ip,#-1]!    //  byte alignment.
+    subne   r2,         #1
+    bne     L_descendingEdging
+
+    and     lr,     r1, #0xf    //  Then we extract the alignment of the source
+    bic     r1,         #0xf    //  buffer and use a jump table to dispatch
+    subs    r3,     r2, #32     //  into code that does the appropriate
+    blo     L_descendingEdgingExit  //  software alignment fixup.
+    tbh    [pc, lr, lsl #1]
+0:
+.short (L_descendingExtract0x0-0b)/2
+.short (L_descendingExtract0x1-0b)/2
+.short (L_descendingExtract0x2-0b)/2
+.short (L_descendingExtract0x3-0b)/2
+.short (L_descendingExtract0x4-0b)/2
+.short (L_descendingExtract0x5-0b)/2
+.short (L_descendingExtract0x6-0b)/2
+.short (L_descendingExtract0x7-0b)/2
+.short (L_descendingExtract0x8-0b)/2
+.short (L_descendingExtract0x9-0b)/2
+.short (L_descendingExtract0xa-0b)/2
+.short (L_descendingExtract0xb-0b)/2
+.short (L_descendingExtract0xc-0b)/2
+.short (L_descendingExtract0xd-0b)/2
+.short (L_descendingExtract0xe-0b)/2
+.short (L_descendingExtract0xf-0b)/2
+
+L_descendingExtract0x0:         //  For relative alignment, we have a fast
+    sub     r1,         #32     //  path identical to the aligned copy loop.
+    vld1.8  {q0,q1}, [r1,:128]
+    sub     ip,         #32
+    vst1.8  {q0,q1}, [ip,:128]
+    subs    r3,         #32
+    bhs     L_descendingExtract0x0
+    b       L_descendingEdgingExit
+
+#define DESCENDING_EXTRACT(shift)\
+L_descendingExtract ## shift:\
+    vld1.8  {q10},    [r1,:128];\
+0:  sub     r1,         #32;\
+    vld1.8  {q8,q9},  [r1,:128];\
+    vext.8  q1, q9, q10,$(shift);\
+    vext.8  q0, q8, q9, $(shift);\
+    vmov    q10,        q8;\
+    sub     ip,         #32;\
+    vst1.8  {q0,q1}, [ip,:128];\
+    subs    r3,         $32;\
+    bhs     0b;\
+    b       L_descendingEdgingExit
+
+DESCENDING_EXTRACT(0x1)         //  Otherwise, we use the loop above (almost
+DESCENDING_EXTRACT(0x2)         //  identical to the one we use in the
+DESCENDING_EXTRACT(0x3)         //  ascending copy case).
+DESCENDING_EXTRACT(0x4)
+DESCENDING_EXTRACT(0x5)
+DESCENDING_EXTRACT(0x6)
+DESCENDING_EXTRACT(0x7)
+DESCENDING_EXTRACT(0x8)
+DESCENDING_EXTRACT(0x9)
+DESCENDING_EXTRACT(0xa)
+DESCENDING_EXTRACT(0xb)
+DESCENDING_EXTRACT(0xc)
+DESCENDING_EXTRACT(0xd)
+DESCENDING_EXTRACT(0xe)
+DESCENDING_EXTRACT(0xf)
+
+L_descendingEdgingExit:
+    add     r1,         lr      //  Restore source pointer
+    add     r2,     r3, #32     //  Restore length
+L_descendingShort:
+    subs    r2,         #1      //  Byte-by-byte copy loop for short overlapping
+    itt     hs                  //  buffers.
+    ldrbhs  r3,    [r1,#-1]!
+    strbhs  r3,    [ip,#-1]!
+    bhi     L_descendingShort
+    pop     {r7,pc}
+
+#endif // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
\ No newline at end of file
index eb6e59cb44b57c5598bd7d4122f189f3725eecd1..bcbfea042633e7ad7773a0b592dba94e290ff411 100644 (file)
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
+
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+/**********************************************************************
+ * Cortex-A8 implementation                                           *
+ **********************************************************************/
+
+// Cortex-A8 implementations of memset( ) and bzero( ).  Main loop is 64-byte
+// NEON stores, unless the buffer length is > 1k.  Beyond that point, there is
+// little to no speed advantage with NEON (and a slight regression in some
+// measured cases), so we switch to the GPRs.
+//
+// The crossover point should be reevaluated for future architectures.
+//
+// -- Stephen Canon, August 2009
+
+.text
+.syntax unified
+.code 16
+
+// void bzero(void * destination,
+//            size_t length);
+//
+// zeros out a buffer length bytes long, beginning at the address destination.
+.thumb_func ___bzero$VARIANT$CortexA8
+.globl ___bzero$VARIANT$CortexA8
+.thumb_func _bzero$VARIANT$CortexA8
+.globl _bzero$VARIANT$CortexA8
+.align 2
+___bzero$VARIANT$CortexA8:
+_bzero$VARIANT$CortexA8:
+    mov     r2,     r1              // match the API to memset(dest, 0, length)
+    eor     r1,     r1              // and fall through into memset
+
+// void *memset(void * destination,
+//              int value, size_t n);
+//
+// writes value converted to an unsigned char to n successive bytes, beginning
+// at destination.
+
+// Notes on register usage:
+// 
+// Throughout this function, registers have nearly constant usage; the pattern
+// is:
+//
+//     r0 holds the original destination pointer, unmodified.  This value
+//        must be returned by the routine, so it is easiest to just leave it
+//        in place.
+//     r1 holds the value that is being copied into the buffer, in some stage
+//        of splattedness.  The low byte is guaranteed to always have the value
+//        but the higher bytes may or may not contain copies of it.
+//     r2 holds the length minus some offset, where the offset is always the
+//        number of bytes that the current loop stores per iteration.
+//     r3-r6,r8,r10,r11 are used with stmia, and will only ever contain splatted
+//        copies of the value to be stored.
+//     ip holds a pointer to the lowest byte in the array that has not yet been
+//        set to hold value.
+//     q0 and q1 hold splatted copies of the value in the vector path, and are
+//        otherwise unused.
+
+.thumb_func _memset$VARIANT$CortexA8
+.globl _memset$VARIANT$CortexA8
+.align 2
+_memset$VARIANT$CortexA8:
+    mov       ip,      r0           // copy destination pointer.
+    subs      r2,           #0x8    // if length - 8 is negative (i.e. length
+    and       r1,           #0xff   // is less than 8), jump to cleanup path.
+    blt       L_scalarCleanup       // 
+    
+    tst       ip,           #0x7    // if the destination is doubleword
+    beq       L_vectorCopy          // aligned, jump to fast path.
+    
+0:  strb      r1,     [ip], #1      // store one byte at a time until
+    sub       r2,           #1      // destination pointer is 8 byte aligned.
+    tst       ip,           #7      //
+    bne       0b                    //
+    
+    cmp       r2,           #0x0    // if length - 8 is negative,
+    blt       L_scalarCleanup       // jump to the cleanup code
+
+L_vectorCopy:
+    vdup.8    q0,      r1           // splat the byte to be stored across
+    subs      r2,           #0x38   // q0 and q1, and check if length - 64
+    vmov      q1,      q0           // is negative; if so, jump to the
+    blt       L_vectorCleanup       // cleanup code.
+    
+    tst       ip,           #0x38   // if the destination is cacheline
+    beq       L_cachelineAligned    // aligned, jump to the fast path.
+
+0:  vst1.64  {d0},    [ip, :64]!    // store one double word at a time until
+    sub       r2,           #8      // the destination is 64-byte aligned
+    tst       ip,           #0x38   // 
+    bne       0b
+    
+    cmp       r2,           #0x0    // if length - 64 is negative,
+    blt       L_vectorCleanup       // jump to the cleanup code
+
+L_cachelineAligned:
+    cmp       r2,           #0x3c0  // if length > 1024
+    bge       L_useSTMIA            // we use stmia instead
+
+.align 4                            // main loop
+0:  vst1.64  {q0,q1}, [ip, :256]!   // store 32 bytes
+    subs      r2,           #0x40   // decrement length by 64
+    vst1.64  {q0,q1}, [ip, :256]!   // store 32 bytes
+    bge       0b                    // if length - 64 >= 0, continue
+    
+L_vectorCleanup:
+    adds      r2,           #0x38   // if (length - 8) < 0, goto scalar cleanup
+    blt       L_scalarCleanup       //
+    
+0:  subs      r2,           #8      // store one double word at a time until
+    vst1.64  {d0},    [ip, :64]!    // (length - 8) < 0.
+    bge       0b
+    
+L_scalarCleanup:
+    adds      r2,           #8      // restore length
+    beq       1f                    // early out if zero.
+    
+0:  strb      r1,     [ip], #1      // store one byte at a time until length
+    subs      r2,           #1      // is zero.
+    bne       0b                    //
+1:  bx        lr                    // return.
+
+//  STMIA loop for large buffers
+//
+//  For stores larger than 1024 bytes, we use STMIA because we can't get enough
+//  of a speedup from NEON to offset the higher power draw of the NEON unit.
+//
+//  This crossover should be reevaluated on future architectures.
+//
+//  We avoid using r7 and r9 even though it's not strictly necessary.
+
+L_useSTMIA:
+    push     {r4,r5,r6,r8,r10,r11}
+    orr       r1,      r1,  r1, lsl #8
+    orr       r1,      r1,  r1, lsl #16
+    mov       r3,      r1
+    mov       r4,      r1
+    mov       r5,      r1
+    mov       r6,      r1
+    mov       r8,      r1
+    mov       r10,     r1
+    mov       r11,     r1
+.align 4
+0:  stmia     ip!,  {r1,r3,r4,r5,r6,r8,r10,r11}
+    subs      r2,           #0x40
+    stmia     ip!,  {r1,r3,r4,r5,r6,r8,r10,r11}
+    bge       0b
+    pop      {r4,r5,r6,r8,r10,r11}
+    b         L_vectorCleanup
+
+#endif // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
index fc3198c90aaa46986f91aa4b344b30c784a36aa4..9ab178b7505d7185072197bb87b5fb06f0e613ec 100644 (file)
  * writes value converted to an unsigned char to n successive bytes, beginning
  * at destination.
  */
+
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7
+
+/*****************************************************************************
+ * Macros                                                                    *
+ *****************************************************************************/
+
+#define A9_ENTRY(name) \
+       .align 2;\
+       .globl _ ## name ## $VARIANT$CortexA9;\
+       _ ## name ## $VARIANT$CortexA9:
+
+#define ESTABLISH_FRAME \
+       push   {r0,r4,r7,lr};\
+       add     r7,     sp, #8
+    
+#define CLEAR_FRAME_AND_RETURN \
+       pop    {r0,r4,r7,pc}
+    
+#define ADDITIONAL_CALLEE_SAVE_REGISTERS {r5,r6,r8}
+
+#define STORE_REGISTERS {r1,r3,r4,r5,r6,r8,r9,ip}
+
+/*****************************************************************************
+ *  entry points                                                             *
+ *****************************************************************************/
+
+.text
+.syntax unified
+.code 32
+
+A9_ENTRY(__bzero)
+A9_ENTRY(bzero)
+    mov     r2,     r1
+    eor     r1,     r1
+
+A9_ENTRY(memset)
+//  Early out if fewer than four bytes are to be set.  Otherwise, store up to
+//  three bytes to align the destination pointer to a word boundary.
+    ESTABLISH_FRAME
+    and     r1,         #0xff
+    subs    r2,         #4
+    orr     r1,     r1, r1, lsl #8
+    blo     L_lengthLessThanFour
+    orr     r1,     r1, r1, lsl #16
+0:  tst     r0,         #0x3
+    beq     L_wordAligned
+    strb    r1,    [r0],#1
+    subs    r2,         #1
+    bhs     0b
+L_lengthLessThanFour:
+    adds    r2,         #4
+    beq     1f
+0:  strb    r1,    [r0],#1
+    subs    r2,         #1
+    bne     0b
+1:  CLEAR_FRAME_AND_RETURN
+
+L_wordAligned:
+//  Destination pointer has word alignment.  Early out if fewer than 64 bytes
+//  are to be set.  Otherwise, store up to 28 bytes to align the destination
+//  pointer to a cacheline boundary.
+    mov     r3,     r1
+    mov     r4,     r1
+    subs    r2,         #0x3c
+    mov     r9,     r1
+    blo     L_lengthLessThanSixtyFour
+0:  tst     r0,         #0x1c
+    beq     L_cachelineAligned
+    str     r1,    [r0],#4
+    subs    r2,         #4
+    bhs     0b
+L_lengthLessThanSixtyFour:
+    tst     r2,         #0x30
+    beq     1f
+0:  stm     r0!,   {r1,r3,r4,r9}
+    sub     r2,         #0x10
+    tst     r2,         #0x30
+    bne     0b
+1:  tst     r2,         #0xf
+    beq     2f
+    lsls    ip,     r2, #29
+    stmcs   r0!,   {r1,r3}
+    strmi   r1,    [r0],#4
+    lsls    ip,     r2, #31
+    strhcs  r1,    [r0],#2
+    strbmi  r1,    [r0]
+2:  CLEAR_FRAME_AND_RETURN
+
+L_cachelineAligned:
+//  Main unrolled loop; stores two complete cachelines per iteration.
+    push    ADDITIONAL_CALLEE_SAVE_REGISTERS
+    mov     r5,     r1
+    mov     r6,     r1
+    mov     r8,     r1
+    mov     ip,     r1
+.align 4
+0:  stm     r0!,    STORE_REGISTERS
+    subs    r2,         #0x40
+    stm     r0!,    STORE_REGISTERS
+    bhs     0b
+    pop     ADDITIONAL_CALLEE_SAVE_REGISTERS
+    b       L_lengthLessThanSixtyFour
+
+#endif // defined _ARM_ARCH_7
index 1c9efb5fbe3b753c729a6185aa2d92dc0819bde6..c3c24582f440c4cfbb4a1ccaa1706072cd269114 100644 (file)
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
+
+#include <arm/arch.h>
+#if !defined _ARM_ARCH_7 || defined VARIANT_DYLD
+
+#include <mach/machine/asm.h>
+#include <architecture/arm/asm_help.h>
+       
+/* 
+ * A reasonably well-optimized bzero/memset. Should work equally well on arm11 and arm9 based
+ * cores. 
+ *
+ * The algorithm is to align the destination pointer on a 32 byte boundary and then
+ * blast data 64 bytes at a time, in two stores of 32 bytes per loop.
+ */
+       .text
+       .align 2
+
+       .globl _memset
+/* void *memset(void *ptr, int c, size_t len); */
+_memset:
+       /* move len into r1, unpack c into r2 */
+       mov             r3, r2
+       and             r1, r1, #0xff
+       orr             r1, r1, r1, lsl #8
+       orr             r2, r1, r1, lsl #16
+       mov             r1, r3
+       b               Lbzeroengine
+
+       .globl _bzero
+/* void bzero(void *ptr, size_t len); */
+_bzero:
+       /* zero out r2 so we can be just like memset(0) */
+       mov             r2, #0
+
+Lbzeroengine:
+       /* move the base pointer into r12 and leave r0 alone so that we return the original pointer */
+       mov             r12, r0
+
+       /* copy r2 into r3 for 64-bit stores */
+       mov             r3, r2
+
+       /* check for zero len */
+       cmp             r1, #0
+       bxeq    lr
+
+       /* fall back to a bytewise store for less than 32 bytes */
+       cmp             r1, #32
+       blt             L_bytewise
+
+       /* check for 32 byte unaligned ptr */
+       tst             r12, #0x1f
+       bne             L_unaligned
+
+       /* make sure we have more than 64 bytes to zero */
+       cmp             r1, #64
+       blt             L_lessthan64aligned
+
+       /* >= 64 bytes of len, 32 byte aligned */
+L_64ormorealigned:
+
+       /* we need some registers, avoid r7 (frame pointer) and r9 (thread register) */
+       stmfd   sp!, { r4-r6, r8, r10-r11 }
+       mov             r4, r2
+       mov             r5, r2
+       mov             r6, r2
+       mov             r8, r2
+       mov             r10, r2
+       mov             r11, r2
+
+       /* pre-subtract 64 from the len to avoid an extra compare in the loop */
+       sub             r1, r1, #64
+
+L_64loop:
+       stmia   r12!, { r2-r6, r8, r10-r11 }
+       subs    r1, r1, #64
+       stmia   r12!, { r2-r6, r8, r10-r11 }
+       bge             L_64loop
+
+       /* restore the saved regs */
+       ldmfd   sp!, { r4-r6, r8, r10-r11 }
+
+       /* check for completion (had previously subtracted an extra 64 from len) */
+       adds    r1, r1, #64
+       bxeq    lr
+
+L_lessthan64aligned:
+       /* do we have 16 or more bytes left */
+       cmp             r1, #16
+       stmgeia r12!, { r2-r3 }
+       stmgeia r12!, { r2-r3 }
+       subges  r1, r1, #16
+       bgt             L_lessthan64aligned
+       bxeq    lr
+
+L_lessthan16aligned:
+       /* store 0 to 15 bytes */
+       mov             r1, r1, lsl #28         /* move the remaining len bits [3:0] to the flags area of cpsr */
+       msr             cpsr_f, r1
+
+       stmmiia r12!, { r2-r3 }         /* n is set, store 8 bytes */
+       streq   r2, [r12], #4           /* z is set, store 4 bytes */
+       strcsh  r2, [r12], #2           /* c is set, store 2 bytes */
+       strvsb  r2, [r12], #1           /* v is set, store 1 byte */
+       bx              lr
+
+L_bytewise:
+       /* bytewise copy, 2 bytes at a time, alignment not guaranteed */        
+       subs    r1, r1, #2
+       strb    r2, [r12], #1
+       strplb  r2, [r12], #1
+       bhi             L_bytewise
+       bx              lr
+
+L_unaligned:
+       /* unaligned on 32 byte boundary, store 1-15 bytes until we're 16 byte aligned */
+       mov             r3, r12, lsl #28
+       rsb     r3, r3, #0x00000000
+       msr             cpsr_f, r3
+
+       strvsb  r2, [r12], #1           /* v is set, unaligned in the 1s column */
+       strcsh  r2, [r12], #2           /* c is set, unaligned in the 2s column */
+       streq   r2, [r12], #4           /* z is set, unaligned in the 4s column */
+       strmi   r2, [r12], #4           /* n is set, unaligned in the 8s column */
+       strmi   r2, [r12], #4
+
+       subs    r1, r1, r3, lsr #28
+       bxeq    lr
+
+       /* we had previously trashed r3, restore it */
+       mov             r3, r2
+
+       /* now make sure we're 32 byte aligned */
+       tst             r12, #(1 << 4)
+       stmneia r12!, { r2-r3 }
+       stmneia r12!, { r2-r3 }
+       subnes  r1, r1, #16
+
+       /* we're now aligned, check for >= 64 bytes left */
+       cmp             r1, #64
+       bge             L_64ormorealigned
+       b               L_lessthan64aligned
+
+X_LEAF(___bzero, _bzero)
+
+#endif // !defined _ARM_ARCH_7 || defined VARIANT_DYLD
diff --git a/arm/string/bzero_Swift.s b/arm/string/bzero_Swift.s
new file mode 100644 (file)
index 0000000..9c0d1af
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ *
+ *  This file implements the following functions for the Swift micro-arch:
+ *
+ *  void bzero(void * destination,
+ *             size_t length);
+ *
+ *  void __bzero(void * destination,
+ *               size_t length);
+ *
+ * zeros out a buffer length bytes long, beginning at the address destination.
+ *
+ *  void *memset(void * destination,
+ *               int value,
+ *               size_t n);
+ *
+ * writes value converted to an unsigned char to n successive bytes, beginning
+ * at destination.
+ */
+
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7
+
+.syntax unified
+.code 32
+.globl ___bzero$VARIANT$Swift
+.globl _bzero$VARIANT$Swift
+.globl _memset$VARIANT$Swift
+
+.text
+.align 4
+___bzero$VARIANT$Swift:
+_bzero$VARIANT$Swift:
+    mov     r2,         r1      //  Set value to zero and move length to the
+    eor     r1,         r1      //  correct register to match the memset API.
+_memset$VARIANT$Swift:
+    push    {r7,lr}             //  Establish a frame, and make a copy of the
+    mov     r7,         sp      //  pointer to increment so that we can
+    mov     ip,         r0      //  return the original pointer unmodified.
+
+    vdup.8  q0,         r1      //  Splat the low byte of value across q0.
+    subs    r3,     r2, #64     //  If length < 64, jump to a dedicated
+    blo     L_lengthLessThan64  //  code path to handle small buffers.
+
+    vmov    q1,         q0      //  Copy the splatted value to q1.
+    orr     lr,     r2, r0      //  If the length is not a multiple of 16 or
+    ands    lr,         #0xf    //  the buffer is not 16-byte aligned, then
+    bne     L_edgingNeeded      //  some edging is needed; branch.
+
+0:  subs    r3,         #64     //  Write 64 bytes at a time to the 16-byte
+    vst1.8  {q0,q1}, [ip,:128]! //  aligned buffer.  Terminate this loop when
+    vst1.8  {q0,q1}, [ip,:128]! //  64 or fewer bytes remain to be written.
+    bhi     0b
+
+    add     ip,         r3      //  Backtrack the destination pointer by
+    vst1.8  {q0,q1}, [ip,:128]! //  64 - remaining bytes, and write 64 bytes
+    vst1.8  {q0,q1}, [ip,:128]  //  to that address.  This takes us precisely
+    pop     {r7,pc}             //  to the end of the buffer.
+
+L_edgingNeeded:
+    vst1.8  {q0},      [ip]     //  Write 16 bytes to the [possibly unaligned]
+    and     lr,     ip, #0xf    //  buffer, then advance the pointer to the
+    bic     ip,         #0xf    //  next aligned location, and adjust the
+    add     r3,         lr      //  length accordingly.  Note that this means
+    add     ip,         #16     //  that the first write in the loop may
+    subs    r3,         #16     //  overlap with the write we just performed;
+    blo     1f                  //  this is the fastest way to get alignment
+    nop                         //  on Swift.
+
+0:  subs    r3,         #64     //  Write 64 bytes at a time to the 16-byte
+    vst1.8  {q0,q1}, [ip,:128]! //  aligned buffer.  Terminate this loop when
+    vst1.8  {q0,q1}, [ip,:128]! //  64 or fewer bytes remain to be written.
+    bhi     0b
+
+1:  add     ip,         r3      //  Backtrack the destination pointer by
+    vst1.8  {q0,q1},   [ip]!    //  64 - remaining bytes, and write 64 bytes
+    vst1.8  {q0,q1},   [ip]     //  to that address.  This takes us precisely
+    pop     {r7,pc}             //  to the end of the buffer.  
+
+L_lengthLessThan64:
+    subs    r3,     r2, #8      //  If the length is smaller than eight, jump
+    blo     1f                  //  into a dedicated byte store loop.
+
+0:  subs    r3,         #8      //  Write 8 bytes at a time to the destination
+    vst1.8  {d0},      [ip]!    //  buffer, terminating when eight or fewer
+    bhi     0b                  //  bytes remain to be written.
+
+    add     ip,         r3      //  Backtrack the destination pointer by
+    vst1.8  {d0},      [ip]     //  8 - remaining bytes, and write 8 bytes
+    pop     {r7,pc}             //  to that address, then return.
+
+1:  subs    r2,         #1      //  Store one byte at a time to the destination
+    strbhs  r1,        [ip], #1 //  buffer, until we exhaust the length.
+    bhi     1b
+    pop     {r7,pc}    
+
+#endif // defined _ARM_ARCH_7
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1c53fff38b56b0afbd62c1adb547d6cee75f42f7 100644 (file)
@@ -0,0 +1,98 @@
+// This file implements resolvers to assist dyld in choosing the correct
+// implementation of <string.h> routines on ARMv7 processors.  The
+// micro-architectural differences between Cortex-A8 and Cortex-A9 are such
+// that optimal write loops are quite different on the two processors.
+
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+#include <stdlib.h>
+#include <machine/cpu_capabilities.h>
+#include <mach/machine.h>
+
+// The MakeResolver(name) macro creates a function that dyld calls to
+// pick an implementation of the name function.  It does a check to determine
+// if it is running on a8 or a9 hardware, and returns a pointer to either
+//
+//    name$VARIANT$CortexA8
+// or
+//    name$VARIANT$CortexA9
+// or
+//    name$VARIANT$Swift
+//
+// This resolution only occurs once per process; once a symbol is bound to an
+// implementation in dyld, no further calls to the resolver occur.
+//
+// On unknown implementations of the ARMv7 architecture, the Swift variant
+// is returned by these resolvers.
+#define MakeResolver(name)                                           \
+    void * name ## Resolver(void) __asm__("_" #name);                \
+    void * name ## Resolver(void) {                                  \
+        __asm__(".symbol_resolver _" #name);                         \
+        switch (*(int *)_COMM_PAGE_CPUFAMILY) {                      \
+            case CPUFAMILY_ARM_13: return name ## $VARIANT$CortexA8; \
+            case CPUFAMILY_ARM_14: return name ## $VARIANT$CortexA9; \
+            default:               return name ## $VARIANT$Swift;    \
+        }                                                            \
+    }
+
+void bzero$VARIANT$CortexA8(void *, size_t);
+void bzero$VARIANT$CortexA9(void *, size_t);
+void bzero$VARIANT$Swift(void *, size_t);
+MakeResolver(bzero)
+
+void __bzero$VARIANT$CortexA8(void *, size_t);
+void __bzero$VARIANT$CortexA9(void *, size_t);
+void __bzero$VARIANT$Swift(void *, size_t);
+MakeResolver(__bzero)
+
+void *memset$VARIANT$CortexA8(void *, int, size_t);
+void *memset$VARIANT$CortexA9(void *, int, size_t);
+void *memset$VARIANT$Swift(void *, int, size_t);
+MakeResolver(memset)
+
+void bcopy$VARIANT$CortexA8(const void *, void *, size_t);
+void bcopy$VARIANT$CortexA9(const void *, void *, size_t);
+void bcopy$VARIANT$Swift(const void *, void *, size_t);
+MakeResolver(bcopy)
+
+void *memmove$VARIANT$CortexA8(void *, const void *, size_t);
+void *memmove$VARIANT$CortexA9(void *, const void *, size_t);
+void *memmove$VARIANT$Swift(void *, const void *, size_t);
+MakeResolver(memmove)
+
+void *memcpy$VARIANT$CortexA8(void *, const void *, size_t);
+void *memcpy$VARIANT$CortexA9(void *, const void *, size_t);
+void *memcpy$VARIANT$Swift(void *, const void *, size_t);
+MakeResolver(memcpy)
+
+//  The memset_patternx resolvers are a little different, because we only have
+//  a generic implementation and a Swift implementation.
+#define MakeResolver_Swift(name)                                     \
+    void * name ## Resolver(void) __asm__("_" #name);                \
+    void * name ## Resolver(void) {                                  \
+        __asm__(".symbol_resolver _" #name);                         \
+        switch (*(int *)_COMM_PAGE_CPUFAMILY) {                      \
+            case CPUFAMILY_ARM_13: return name ## $VARIANT$Generic;  \
+            case CPUFAMILY_ARM_14: return name ## $VARIANT$Generic;  \
+            default:               return name ## $VARIANT$Swift;    \
+        }                                                            \
+    }
+
+void memset_pattern4$VARIANT$Generic(void *b, const void *c4, size_t len);
+void memset_pattern4$VARIANT$Swift(void *b, const void *c4, size_t len);
+MakeResolver_Swift(memset_pattern4);
+
+void memset_pattern8$VARIANT$Generic(void *b, const void *c8, size_t len);
+void memset_pattern8$VARIANT$Swift(void *b, const void *c8, size_t len);
+MakeResolver_Swift(memset_pattern8);
+
+void memset_pattern16$VARIANT$Generic(void *b, const void *c16, size_t len);
+void memset_pattern16$VARIANT$Swift(void *b, const void *c16, size_t len);
+MakeResolver_Swift(memset_pattern16);
+
+#else // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+typedef int emptyFilesArentCFiles;
+
+#endif // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
index a462a6bdb29bd5273a7cc2b339f45753aeb3bb1c..62e492a0b70542fdb31a362da7dbd2bb38f909be 100644 (file)
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <arm/arch.h>
+
+#ifdef _ARM_ARCH_5
+       .text
+
+       .align  2
+       .globl  _ffs
+_ffs:
+       .globl  _ffsl
+_ffsl:
+       rsb             r3, r0, #0
+       and             r0, r0, r3
+       clz             r0, r0
+       rsb             r0, r0, #32
+       bx              lr
+
+       .align  2
+       .globl _fls
+_fls:
+       .globl  _flsl
+_flsl:
+       clz             r0, r0
+       rsb             r0, r0, #32
+       bx              lr
+#else
+#error need to define ffs for this architecture
+#endif
index d7fb7c4892a74d9d59751325d9e1d0ed91ffa408..2cdd5a32a8d7139678f69a1769834a7903bb2ab6 100644 (file)
  * @APPLE_LICENSE_HEADER_END@
  */
 
+// ARM Assembly implementation of memcmp( ) from <string.h>
+// Uses Thumb2 if it is available, otherwise generates ARM code.
+//
+// -- Stephen Canon, August 2009
+//
+// The basic idea is to use word compares instead of byte compares as long as
+// at least four bytes remain to be compared.  However, because memcmp( )
+// compares the buffers as though they were big-endian unsigned integers, we
+// need to byte-reverse each word before comparing them.
+//
+// If the buffers are not word aligned, or they are shorter than four bytes,
+// we just use a simple byte comparison loop instead.
+//
+// int   bcmp(void *src1, void *src2, size_t length);
+// int memcmp(void *src1, void *src2, size_t length);
+
+.text
+.syntax unified
+#if defined __thumb2__
+       .code 16
+       .thumb_func _bcmp
+       .thumb_func _memcmp
+#else
+       .code 32
+#endif
+
+#define ESTABLISH_FRAME \
+       push   {r7,lr};\
+       mov     r7,     sp
+#define CLEAR_FRAME_AND_RETURN \
+       pop    {r7,pc}
+
+#include <arm/arch.h>
+
+#if defined _ARM_ARCH_6
+       #define BYTE_REVERSE(reg,tmp) \
+    rev     reg, reg
+#else // defined _ARM_ARCH_6
+// Prior to ARMv6, the REV instruction is not available.  We use a very cute
+// software workaround instead, which needs only a single scratch register.
+       #define BYTE_REVERSE(reg,tmp) \
+       eor     tmp, reg, reg, ror #16;\
+       bic     tmp, tmp, #0xff0000   ;\
+       mov     tmp,      tmp, lsr #8 ;\
+       eor     reg, tmp, reg, ror #8
+#endif // defined _ARM_ARCH_6
+
+.globl _bcmp
+.globl _memcmp
+.align 2
+_bcmp:
+_memcmp:
+    // If both buffers are not word aligned, jump to a byte-comparison loop.
+       ESTABLISH_FRAME
+       orr     ip,     r0, r1
+       tst     ip,         #3
+       bne     L_useByteComparisons
+
+    // As long as at least four bytes of length remain, load one word from each
+    // buffer and check if they are equal.
+0:  subs    r2,         #4
+       blo     L_lessThanFourBytesRemain
+       ldr     r3,    [r0],#4
+       ldr     ip,    [r1],#4
+       cmp     r3,     ip
+       beq     0b
+       
+    // If words from the two buffers compared unequal, we end up here.  We need
+    // to byte-swap both words, then subtract to determine the result (+/-1).
+       BYTE_REVERSE(r3,r1)
+       BYTE_REVERSE(ip,r2)
+    mov     r0,         #1
+       subs    r3,     ip
+       it      lo
+       movlo   r0,         #-1
+       CLEAR_FRAME_AND_RETURN
+       
+L_lessThanFourBytesRemain:
+    adds    r2,         #4
+L_useByteComparisons:
+       mov     r3,     r0
+    // If no bytes remain to compare, the buffers are equal and we return zero.
+    // Otherwise, load one byte from each buffer and check if they are equal.
+0:  subs    r2,         #1
+       blo     L_buffersAreEqual
+       ldrb    r0,    [r3],#1
+       ldrb    ip,    [r1],#1
+       subs    r0,         ip
+       beq     0b
+       CLEAR_FRAME_AND_RETURN
+    
+L_buffersAreEqual:
+    mov     r0,         #0
+       CLEAR_FRAME_AND_RETURN
index ffdc454c97862a366f42bb0ae2352428c119b95f..b569484ce31b3d0648220e09427a0608faea22c2 100755 (executable)
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <arm/arch.h>
+
+//  Only built for armv6 and higher.
+#if defined _ARM_ARCH_6
+
+//  If we're building for armv7, and not for DYLD, then we have a symbol
+//  resolver so we need to rename these implementations.
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+#define _memset_pattern4  _memset_pattern4$VARIANT$Generic
+#define _memset_pattern8  _memset_pattern8$VARIANT$Generic
+#define _memset_pattern16 _memset_pattern16$VARIANT$Generic
+#endif
+
+#include <mach/machine/asm.h>
+
+/* 
+ * This file contains the following functions: 
+ * 
+ *     void memset_pattern4(void *b, const void *c4, size_t len)
+ *     void memset_pattern8(void *b, const void *c8, size_t len)
+ *     void memset_pattern16(void *b, const void *c16, size_t len)
+ * 
+ * The memset() is implemented in the bzero.s file. 
+ * 
+ * This is a reasonably well optimized version of memset_pattern* routines
+ * implemented for the ARM9 and ARM11 processors using the ARMv6 instruction
+ * set. These routines use the ARM's core registers.  
+ *
+ * The algorithm is to align the destination pointer on a 16 byte boundary 
+ * and then blast data 64 bytes at a time, in two stores of 32 bytes per loop.
+ * 
+ */
+       .text
+       .align 2
+       .syntax unified
+
+/*----------------------------------------------------------------------------*/
+/* void     memset_pattern4(void *ptr, const void *pattern4, size_t len);     */
+/*                                                                            */
+/*      r0    << destination pointer                                          */
+/*     r1    << pointer to 4-byte pattern                                    */
+/*     r2    << 'len' (length of destination buffer in bytes)                */
+/*----------------------------------------------------------------------------*/
+       .globl _memset_pattern4
+_memset_pattern4:
+       cmp     r2, #0  /* check if len is zero */
+       bxeq    lr      /* return if length is zero */
+
+       /* We need some registers, so save volatiles on stack */
+       /* Avoid r7 (frame pointer) and r9 (thread register)  */
+       stmfd   sp!, {r4-r7, lr} 
+       add     r7, sp, #12        /* establish frame */
+       stmfd   sp!, {r8, r10-r11}
+
+       /* copy destination base pointer r0 to r12 and leave r0 alone */
+       /* so that we return original pointer back to the caller */
+       mov     r12, r0
+
+       /* Check if 'len' is long enough to bother alignment of destination */
+       /* pointer */
+       cmp     r2, #32     /* long enough to bother aligning? */
+       movlt   r3, #4      /* move pattern length into r3 */
+       movlt   r10, #4     /* pattern index */
+       movlt   r11, r1     /* move pattern pointer into r11 */
+       blt     L_Short     /* no */
+
+       /* move 'len' into r1, get 4-byte pattern in r2 */
+       mov     r6, r2  /* temporarily move 'len' in to r6 */
+       ldr     r2, [r1]/* load 4-byte pattern into r2 */
+       mov     r1, r6  /* move 'len' from r6 to r1 */
+
+       mov     r3, r2  /* copy 4-byte pattern into r3, r4 and r5 registers */
+       mov     r4, r2
+       mov     r5, r2
+
+L_NotShort: 
+
+       /* Check for 16 or 32 byte aligned destination pointer */ 
+       tst     r12, #0x1F  /* check for 32 byte aligned */
+       beq     L_Aligned
+       tst     r12, #0xF   /* check for 16 byte aligned */
+       beq     L_16ByteAligned
+       b       L_Unaligned /* yes */
+
+L_Bytewise: 
+       ldrb    r4, [r11], #1
+       strb    r4, [r12], #1
+       subs    r10, #1
+       moveq   r10, r3
+       moveq   r11, r1
+       sub     r2, #1
+
+L_Short: 
+       cmp     r2, #0 /* more bytes left? */
+       bne     L_Bytewise
+       ldm     sp!, {r8, r10-r11} /* restores registers from stack */
+       ldm     sp!, {r4-r7, pc}   /* restore & return from subroutine */
+
+/* 'len' is long enough to justify aligning the destination pointer           */
+/*                                                                            */
+/* By the time we reach here, data is stored in registers as follows:         */
+/*     r1    << 'len' (length of destination buffer in bytes)                */
+/*     r2-r5 << pattern; either 4x4byte OR 2x8byte OR 1x16-byte              */
+/*      r12   << destination pointer copy (scratch register)                  */
+/*      r0    << destination pointer original                                 */
+/*                                                                            */
+/* Use r11 as scratch register to store the #bytes offset to 16-byte align    */
+/*                                                                            */
+/* Unaligned on 32-byte boundary, store 1-15 bytes until 16-byte aligned      */
+/* As we store these bytes, we rotate the pattern stored in r2-r5 to reflect  */
+/* the alignment.                                                             */
+
+L_Unaligned: 
+       mov     r11, r12, lsl #28
+       rsb     r11, r11, #0
+       msr     cpsr_f, r11 /* Bits[31:28] of cpsr now contain #bytes to align*/
+
+L_Store15BytesAndRotatePattern: 
+        strbvs  r2, [r12], #1   /* v is set, unaligned in the 1s column */
+       andvs   r6, r2, #0xFF   /* Rotate pattern right in r2-r5 by 1-byte */
+       andvs   r8, r3, #0xFF   /* Consider register r2-r5 and a contiguous */
+       andvs   r10, r4, #0xFF  /* 16-byte register with r2 containing LSB */
+       andvs   r11, r5, #0xFF  /* and r5 containing MSB */
+       lsrvs   r2, r2, #8
+       lsrvs   r3, r3, #8
+       lsrvs   r4, r4, #8
+       lsrvs   r5, r5, #8
+       orrvs   r2, r2, r8, lsl #24
+       orrvs   r3, r3, r10, lsl #24
+       orrvs   r4, r4, r11, lsl #24
+       orrvs   r5, r5, r6, lsl #24
+       
+        strhcs  r2, [r12], #2 /* c is set, unaligned in the 2s column */
+       movcs   r6, r2, lsl #16   /* Rotate pattern right in r2-r5 by 2-bytes */
+       movcs   r8, r3, lsl #16
+       movcs   r10, r4, lsl #16
+       movcs   r11, r5, lsl #16
+       lsrcs   r2, r2, #16
+       lsrcs   r3, r3, #16
+       lsrcs   r4, r4, #16
+       lsrcs   r5, r5, #16
+       orrcs   r2, r2, r8
+       orrcs   r3, r3, r10
+       orrcs   r4, r4, r11
+       orrcs   r5, r5, r6
+
+        streq   r2, [r12], #4 /* z is set, unaligned in the 4s column */
+       moveq   r6, r2 /* Rotate pattern right in r2-r5 by 4-bytes */
+       moveq   r2, r3
+       moveq   r3, r4
+       moveq   r4, r5
+       moveq   r5, r6
+
+       stmmi   r12!, {r2-r3} /* n is set, unaligned in the 8s column */
+       movmi   r6, r2 /* Rotate pattern right in r2-r5 by 4-bytes */
+       movmi   r8, r3
+       movmi   r2, r4
+       movmi   r3, r5
+       movmi   r4, r6
+       movmi   r5, r8
+
+       mrs     r11, cpsr   /*copy cpsr in to r11 */
+       subs    r1, r1, r11, lsr #28
+       ldmeq   sp!, {r8, r10-r11} /* restores registers from stack */
+       ldmeq   sp!, {r4-r7, pc}   /* restore & return from subroutine */
+
+/* By the time we reach here, we are 16-byte aligned and r2-r5 contains       */
+/* rotated pattern. Now lets make sure we are 32-byte aligned.                */
+L_16ByteAligned: 
+       tst     r12, #(1 << 4)
+       stmne   r12!, {r2-r5}
+       subsne  r1, r1, #16
+
+/* By the time we reach here, data is stored in registers as follows:         */
+/*     r1    << 'len' (remaining length of destination buffer in bytes)      */
+/*     r2-r5 << rotated pattern; either 4x4byte OR 2x8byte OR 1x16-byte      */
+/*      r12   << aligned destination pointer copy (scratch register)          */
+L_Aligned: 
+       cmp     r1, #64
+       blt     L_AlignedLessThan64
+
+/* Copy pattern in four more registers so that we can do 64 byte transfers */
+        mov    r6, r2
+        mov    r8, r3
+        mov    r10, r4
+        mov    r11, r5
+
+/* At this point, we are 16-byte aligned and 'len' is greater than 64 bytes   */
+/* Lets transfer 64 bytes at a time until len becomes less than 64 bytes      */
+       sub     r1, r1, #64  /* pre-subtract to avoid extra compare in loop   */
+L_Loop64:
+       stm     r12!, {r2-r6, r8, r10-r11}
+       subs    r1, r1, #64
+       stm     r12!, {r2-r6, r8, r10-r11}
+       bge     L_Loop64
+
+       /* return if 'len' is zero */
+       adds    r1, r1, #64 /* readjust length; previously subtracted extra 64*/
+       ldmeq   sp!, {r8, r10-r11} /* restores registers from stack */
+       ldmeq   sp!, {r4-r7, pc}   /* restore & return from subroutine */
+
+L_AlignedLessThan64:
+        /* do we have 16 or more bytes left */
+        cmp    r1, #16
+        stmge  r12!, {r2-r5}
+        subsge         r1, r1, #16
+        bgt    L_AlignedLessThan64
+       ldmeq   sp!, {r8, r10-r11} /* restores registers from stack */
+       ldmeq   sp!, {r4-r7, pc}   /* restore & return from subroutine */
+
+L_AlignedLessThan16:
+        /* store last up-to 15 bytes */
+       /* move the remaining len bits [3:0] to the flags area of cpsr */
+        mov    r1, r1, lsl #28 
+        msr    cpsr_f, r1
+
+        stmmi  r12!, {r2-r3} /* n is set, store 8 bytes */
+       movmi   r2, r4        /* shift vector down 8 bytes */
+       movmi   r3, r5
+
+        streq   r2, [r12], #4 /* z is set, store 4 bytes */
+       moveq   r2, r3        /* shift vector down 4 bytes */
+
+        strhcs  r2, [r12], #2 /* c is set, store 2 bytes */
+       lsrcs   r2, #16       /* shift register right 2 bytes */
+
+        strbvs  r2, [r12], #1 /* v is set, store 1 byte */
+       ldm     sp!, {r8, r10-r11} /* restores registers from stack */
+       ldm     sp!, {r4-r7, pc}   /* restore & return from subroutine */
+
+/*----------------------------------------------------------------------------*/
+/* void     memset_pattern8(void *ptr, const void *pattern8, size_t len);     */
+/*                                                                            */
+/*      r0    << destination pointer                                          */
+/*     r1    << pointer to 8-byte pattern                                    */
+/*     r2    << 'len' (length of destination buffer in bytes)                */
+/*----------------------------------------------------------------------------*/
+       .globl _memset_pattern8
+_memset_pattern8:
+        cmp     r2, #0  /* check if len is zero */
+        bxeq    lr      /* return if length is zero */
+
+        /* We need some registers, so save volatiles on stack */
+        /* Avoid r7 (frame pointer) and r9 (thread register)  */
+        stmfd   sp!, {r4-r7, lr}
+        add     r7, sp, #12        /* establish frame */
+        stmfd   sp!, {r8, r10-r11}
+
+        /* copy destination base pointer r0 to r12 and leave r0 alone */
+        /* so that we return original pointer back to the caller */
+        mov     r12, r0
+
+        /* Check if 'len' is long enough to bother alignment of destination */
+        /* pointer */
+        cmp     r2, #32     /* long enough to bother aligning? */
+        movlt   r3, #8      /* move pattern length into r3 */
+        movlt   r10, #8     /* pattern index */
+        movlt   r11, r1     /* move pattern pointer into r11 */
+        blt     L_Short     /* no */
+
+        /* move 'len' into r1, get 8-byte pattern in r2-r3 */
+        mov     r6, r2       /* temporarily move 'len' in to r6 */
+        ldr     r2, [r1], #4 /* load 8-byte pattern into r2-r3 */
+        ldr     r3, [r1], #4 
+        mov     r1, r6  /* move 'len' from r6 to r1 */
+
+        mov     r4, r2  /* copy 8-byte pattern into r4-r5 registers */
+        mov     r5, r3                                                        
+       b       L_NotShort  /* yes */
+
+
+/*----------------------------------------------------------------------------*/
+/* void     memset_pattern16(void *ptr, const void *pattern16, size_t len);   */
+/*                                                                            */
+/*      r0    << destination pointer                                          */
+/*     r1    << pointer to 16-byte pattern                                   */
+/*     r2    << 'len' (length of destination buffer in bytes)                */
+/*----------------------------------------------------------------------------*/
+       .globl _memset_pattern16
+_memset_pattern16:
+        cmp     r2, #0  /* check if len is zero */
+        bxeq    lr      /* return if length is zero */
+
+        /* We need some registers, so save volatiles on stack */
+        /* Avoid r7 (frame pointer) and r9 (thread register)  */
+        stmfd   sp!, {r4-r7, lr}                                              
+        add     r7, sp, #12        /* establish frame */                      
+        stmfd   sp!, {r8, r10-r11}
+
+        /* copy destination base pointer r0 to r12 and leave r0 alone */
+        /* so that we return original pointer back to the caller */
+        mov     r12, r0
+        
+        /* Check if 'len' is long enough to bother alignment of destination */
+        /* pointer */
+        cmp     r2, #32     /* long enough to bother aligning? */
+        movlt   r3, #16      /* move pattern length into r3 */ 
+        movlt   r10, #16     /* pattern index */
+        movlt   r11, r1     /* move pattern pointer into r11 */
+        blt     L_Short     /* no */
+
+        /* move 'len' into r1, get 16-byte pattern in r2-r5 */
+        mov     r6, r2       /* temporarily move 'len' in to r6 */
+        ldr     r2, [r1], #4 /* load 16-byte pattern into r2-r5 */
+        ldr     r3, [r1], #4 
+        ldr     r4, [r1], #4 
+        ldr     r5, [r1], #4 
+        mov     r1, r6  /* move 'len' from r6 to r1 */
+
+        b       L_NotShort  /* yes */
+
+
+#endif /* _ARM_ARCH_6 */
diff --git a/arm/string/memset_pattern_Swift.s b/arm/string/memset_pattern_Swift.s
new file mode 100644 (file)
index 0000000..2f843a0
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ *
+ *  This file implements the following functions for the Swift micro-arch:
+ *
+ *  void memset_pattern4(void *b, const void *pattern4, size_t len);
+ *  void memset_pattern8(void *b, const void *pattern8, size_t len);
+ *  void memset_pattern16(void *b, const void *pattern16, size_t len);
+ *
+ *  The implementation of all three functions is fundamentally the same.
+ *  memset_pattern4 is extensively commented to explain, reference that
+ *  if you have any questions about the other two.
+ */
+
+#include <arm/arch.h>
+#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+
+.syntax unified
+.code 32
+.text
+.globl _memset_pattern4$VARIANT$Swift
+.globl _memset_pattern8$VARIANT$Swift
+.globl _memset_pattern16$VARIANT$Swift
+
+/******************************************************************************/
+
+.align 4
+_memset_pattern4$VARIANT$Swift:
+    push    {r7,lr}
+    mov     r7,         sp
+
+//  Load the pattern and splat it to q0, then check if the buffer is at least
+//  64 bytes long.  If not, branch to a short-buffer implementation.
+    ldr     r1,        [r1]
+    vdup.32 q0,         r1
+    subs    r3,     r2, #64
+    blo     L_short4
+
+//  We want to use aligned vector stores to fill the bulk of the buffer.  In
+//  order to make that work, we need to rotate the pattern as necessary to
+//  match up with aligned locations, and we also need to extract the alignment
+//  of the destination pointer mod 16.
+    lsl     ip,     r0, #3
+    and     lr,     r0, #0xf    //  alignment of destination pointer mod 16
+    rsb     ip,     ip, #32     //  low five bits contain 32 - 8*(address%4).
+
+//  Before we start the aligned stores, we do a single unaligned store of
+//  16 bytes of the pattern to the start of the buffer.  Since the buffer is
+//  at least 64 bytes long, this store is known to lie entirely inside the
+//  buffer:
+//                              first aligned address in buffer
+//                                                            v
+//   ---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
+//  ... | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | 0 | 1 | 2 | ...
+//   ---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---
+//        ^
+//        unaligned store starts here:
+//      [ 0   1   2   3   0   1   2   3   0   1   2   3   0   1   2   3 ]
+    vst1.8  {q0},      [r0]!
+
+//  Subsequent stores will be aligned, and will start at the first aligned
+//  address in the buffer.  We apply the rotation that we calculated before
+//  the vector store (in the low five bits of ip) to get the pattern that
+//  is to be stored starting at the aligned location.  For example, in the
+//  picture above, the buffer had alignment of 3 mod 4, so the rotation to
+//  be applied is 32 - 8*3 = 8.  Rotating the pattern right by 8 bits gives
+//  us [ 1 2 3 0 ] (remember, we're little-endian), which we see is what
+//  needs to be stored starting at the first aligned location.
+//
+//  Besides rotating the pattern, we also need to adjust the length (by
+//  subtracting 16 - alignment mod 16), and to advance the pointer to the
+//  first aligned location.
+    ror     r1,         ip      //  Pattern to use for aligned memory
+    add     r3,         lr
+    bic     r0,         #0xf    //  destination for first aligned store
+    subs    r3,         #16     //  updated length
+    blo     1f
+
+//  Splat the rotated value across q1 and q2
+    vdup.32 q1,         r1
+    vmov    q2,         q1
+
+//  Main store loop.  We write the splatted aligned pattern across 64 bytes
+//  per iteration, terminating the loop when the remaining length of the
+//  buffer is 64 bytes or less.
+0:  subs    r3,         #64
+    vst1.32 {q1,q2}, [r0,:128]!
+    vst1.32 {q1,q2}, [r0,:128]!
+    bhi     0b
+
+//  The remaining length of the buffer is 64 bytes or less (but the total
+//  length of the buffer is at least 64 bytes; otherwise we would have
+//  branched to the "short" path).  Thus, we can handle the entirety of the
+//  remaining buffer with two 32-byte unaligned stores.
+//
+//  Again, we need to rotate the pattern to match the alignment, this time
+//  by 8*(length%4), and we also need to back up the destination pointer
+//  so that it points to precisely 64 bytes before the end of the buffer.
+//  We accomplish this by adding r3, which contains the remaining length of
+//  the buffer minus 64.
+1:  lsl     ip,     r3, #3
+    ror     r1,         ip
+    vdup.32 q8,         r1
+    vmov    q9,         q8
+    add     r0,         r3
+    vst1.32 {q8,q9},   [r0]!
+    vst1.32 {q8,q9},   [r0]
+    pop     {r7,pc}
+
+L_short4:
+//  If we branch here, the buffer is less than 64 bytes long.  At this point,
+//  register contents are as follows:
+//
+//      r0      pointer to the buffer
+//      r1      pattern
+//      r2      buffer length
+//      q0      splatted pattern
+//
+//  To begin, we store eight bytes at a time until the remaining length is
+//  less than eight bytes.
+    subs    r3,     r2, #8
+    blo     1f
+0:  subs    r3,         #8
+    vst1.32 {d0},      [r0]!
+    bhs     0b
+
+//  Then we store one byte at a time, rotating the pattern to get the next
+//  byte, until we reach the end of the buffer.
+    add     r2,     r3, #8
+1:  subs    r2,         #1
+    strbhs  r1,    [r0],#1
+    ror     r1,         #8
+    bhi     1b
+    pop     {r7,pc}
+
+/******************************************************************************/
+
+.align 4
+_memset_pattern8$VARIANT$Swift:
+//  The implementation of this function is substantially identical to that of
+//  memset_pattern4.  The only differences are in how we rotate the pattern for
+//  the purposes of extracting the bytes to store.  For clarity, only those
+//  differences are commented here; consult memset_pattern4 (above) for
+//  a detailed description of the algorithm used.
+    push    {r7,lr}
+    mov     r7,         sp
+    vld1.8  {d0},      [r1]
+    vmov    d1,         d0
+    subs    r3,     r2, #64
+    blo     L_short8
+
+    bic     sp,         #0xf    //  Align stack to 16 bytes and write 32 bytes
+    sub     sp,         #16     //  of pattern to the stack.  We will use 
+    vst1.8  {q0},    [sp,:128]  //  unaligned loads from this scratch buffer
+    sub     sp,         #16     //  to get rotated forms of the pattern.
+    vst1.8  {q0},    [sp,:128]
+    and     ip,     r0, #0x7    //  Now generate an unaligned pointer to the
+    rsb     ip,     ip, #8      //  rotated pattern that we need to use for
+    add     ip,         sp      //  aligned stores in the main loop.
+    and     lr,     r0, #0xf
+    vst1.8  {q0},      [r0]!
+    add     r3,         lr
+    bic     r0,         #0xf
+    subs    r3,         #16
+    blo     1f
+    vld1.8  {q1},      [ip]
+    vmov    q2,         q1
+0:  subs    r3,         #64
+    vst1.32 {q1,q2}, [r0,:128]!
+    vst1.32 {q1,q2}, [r0,:128]!
+    bhi     0b
+1:  and     lr,     r3, #0x7    //  Generate an unaligned pointer to the
+    add     ip,         lr      //  rotated pattern to use for cleanup.
+    vld1.8  {q8},      [ip]
+    vmov    q9,         q8
+    add     r0,         r3
+    vst1.32 {q8,q9},   [r0]!
+    vst1.32 {q8,q9},   [r0]
+    mov     sp,         r7      //  Restore stack pointer
+    pop     {r7,pc}
+
+L_short8:
+    subs    r2,         #8
+    blo     1f
+0:  subs    r2,         #8
+    vst1.32 {d0},      [r0]!
+    bhs     0b
+1:  adds    r2,         #8
+    beq     3f
+2:  vst1.8  {d0[0]},   [r0]!    //  Store one byte from NEON
+    vext.8  d0,     d0, d0, #1  //  Use VEXT to rotate pattern
+    subs    r2,         #1
+    bhi     2b
+3:  pop     {r7,pc}
+
+/******************************************************************************/
+
+.align 4
+_memset_pattern16$VARIANT$Swift:
+//  The implementation of this function is substantially identical to that of
+//  memset_pattern4.  The only differences are in how we rotate the pattern for
+//  the purposes of extracting the bytes to store.  For clarity, only those
+//  differences are commented here; consult memset_pattern4 (above) for
+//  a detailed description of the algorithm used.
+    push    {r7,lr}
+    mov     r7,         sp
+    vld1.8  {q0},      [r1]
+    subs    r3,     r2, #64
+    blo     L_short16
+
+    bic     sp,         #0xf    //  Align stack to 16 bytes and write 48 bytes
+    sub     sp,         #16     //  of pattern to the stack.  We will use 
+    vst1.8  {q0},    [sp,:128]  //  unaligned loads from this scratch buffer
+    sub     sp,         #16     //  to get rotated forms of the pattern.
+    vst1.8  {q0},    [sp,:128]
+    sub     sp,         #16   
+    vst1.8  {q0},    [sp,:128]
+    and     lr,     r0, #0xf    //  Now generate an unaligned pointer to the
+    rsb     ip,     lr, #16     //  rotated pattern that we need to use for
+    add     ip,         sp      //  aligned stores in the main loop.
+    vst1.8  {q0},      [r0]!
+    add     r3,         lr
+    bic     r0,         #0xf
+    subs    r3,         #16
+    blo     1f
+    vld1.8  {q1},      [ip]
+    vmov    q2,         q1
+0:  subs    r3,         #64
+    vst1.32 {q1,q2}, [r0,:128]!
+    vst1.32 {q1,q2}, [r0,:128]!
+    bhi     0b
+1:  and     lr,     r3, #0xf    //  Generate an unaligned pointer to the
+    add     ip,         lr      //  rotated pattern to use for cleanup.
+    vld1.8  {q8},      [ip]
+    vmov    q9,         q8
+    add     r0,         r3
+    vst1.32 {q8,q9},   [r0]!
+    vst1.32 {q8,q9},   [r0]
+    mov     sp,         r7      //  Restore stack pointer
+    pop     {r7,pc}
+
+L_short16:
+    subs    r2,         #16
+    blo     1f
+0:  subs    r2,         #16
+    vst1.32 {q0},      [r0]!
+    bhs     0b
+1:  adds    r2,         #16
+    beq     3f
+2:  vst1.8  {d0[0]},   [r0]!    //  Store one byte from NEON
+    vext.8  q0,     q0, q0, #1  //  Use VEXT to rotate pattern
+    subs    r2,         #1
+    bhi     2b
+3:  pop     {r7,pc}
+
+#endif // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
index 58981cb07aff11d2f3dedee7bbd50214c8ff37c6..229db7bad0884cdc68a4d562148e64509964b35f 100644 (file)
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
+//  char * strchr(const char *s, int c);
+//
+//  The strchr( ) function locates the first occurence of c (converted to a
+//  char) in the string s.  If c is '\0', the function locates the terminating
+//  '\0' byte.
 
+.text
+.syntax unified
+.code 32
+.globl _strchr
+
+.align 3
+_strchr:
+//  Setup a frame and convert c to a char.
+    push   {r7,lr}
+    mov     r7,         sp
+    and     r1,     r1, #0xff
+
+//  Basic character-by-character search for c; on each pass through the loop
+//  we load a byte from s and increment s.  We then check if this byte is equal
+//  to either c or to '\0'; if not, we continue the loop.
+0:  ldrb    r2,    [r0],#1
+    cmp     r2,     r1
+    tstne   r2,     r2
+    bne     0b
+
+//  Either we have found a match, or we have reached the end of the string (or
+//  both, if c == '\0').  Because we incremented s after loading the last
+//  character, we need to decrement the pointer by one to get a pointer to
+//  either the matching or terminating character. 
+    sub     r0,     r0, #1
+    
+//  Now compare the last character we loaded to the character that we're
+//  searching for.  If they don't match, the character was not found in the
+//  string, so return NULL.
+    cmp     r2,     r1
+    movne   r0,     #0
+    pop    {r7,pc}
index 08becae98f191d9c65c195552c6efb1d67421412..e214c3f66171d26946629f88d287f7c61a4ab15c 100644 (file)
-/*     $NetBSD: strcmp.S,v 1.3 2003/04/05 23:08:52 bjh21 Exp $ */
-/*     $FreeBSD: src/lib/libc/arm/string/strcmp.S,v 1.2 2004/11/09 16:49:14 cognet Exp $ */ 
-
 /*
- * Copyright (c) 2002 ARM Ltd
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the company may not be used to endorse or promote
- *    products derived from this software without specific prior written
- *    permission.
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
  *
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
  */
 
+.text
+.syntax unified
+.code 32
+.globl _strcmp
+// int strcmp(const char *s1, const char *s2);
+//
+// Returns zero if the two NUL-terminated strings s1 and s2 are equal.
+// Otherwise, returns the difference between the first two
+// characters that do not match, interpreted as unsigned integers.
+
+#define ESTABLISH_FRAME        \
+    push   {r4-r7,lr}         ;\
+    add     r7,     sp, #12   ;\
+    push   {r8}
+#define CLEAR_FRAME            \
+    pop    {r8}               ;\
+    pop    {r4-r7,lr}
+
+.align 3
+.long 0, 0x01010101
+_strcmp:
+//  Load a character from each string and advance the pointers.  If the loaded
+//  characters are unequal or NUL, return their difference.
+0:     ldrb    r2,    [r0],#1
+    ldrb    ip,    [r1],#1
+    cmp     r2,         #1
+    cmphs   r2,         ip
+    bne     L_earlyReturn
+//  If the address of the next character from s1 does not have word alignment,
+//  continue with the character-by-character comparison.  Otherwise, fall
+//  through into the word-by-word comparison path.
+    tst     r0,         #3
+    bne     0b
+
+//  We have not encountered a NUL or a mismatch, and s1 has word alignment.
+//  Establish a frame, since we're going to need additional registers anyway.
+    ESTABLISH_FRAME
+    ldr     lr,    (_strcmp-4)
+
+//  Word align s2, and place the remainder in r8.  Compute the right- and
+//  left-shifts to extract each word that we will compare to the other source
+//  from the aligned words that we load:
+//
+//      aligned s2        to be loaded on next iteration
+//      |   "true" s2     |
+//      v   v             v
+//      +---+---+---+---+ +---+---+---+---+
+//      | 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 |
+//      +---+---+---+---+ +---+---+---+---+
+//          ^-----------------^
+//          to be compared on next iteration
+    and     r8,     r1, #3
+    bic     r1,     r1, #3
+    mov     r8,         r8, lsl #3
+    rsb     r5,     r8, #32
+
+//  Load the first aligned word of s2.  OR 0x01 into any bytes that preceed the
+//  "true s2", to prevent our check for NUL from generating a false positive.
+//  Then check for NUL, and jump to the byte-by-byte comparison loop after
+//  unwinding the pointers if we enounter one.
+    ldr     r6,    [r1],#4
+    orr     r6,     r6, lr, lsr r5
+    sub     r2,     r6, lr
+    bic     r2,     r2, r6
+    tst     r2,         lr, lsl #7
+    mov     r4,         r6, lsr r8
+    bne     L_unwindLoopPreload
+
+.align 3
+L_wordCompareLoop:
+    //  Load the next aligned word of s2 and check if it contains any NUL bytes.
+    //  Load the next aligned word of s1, and extract the corresponding bytes from
+    //  the two words of s2 loaded in this and the previous iteration of the loop.
+    //  Compare these two words.
+    //  If no NUL or mismatched words have been encountered, continue the loop.
+    ldr     r6,    [r1],#4
+#if defined _ARM_ARCH_6
+    uqsub8  r2,     lr, r6
+    tst     r2,         r2
+    ldr     ip,    [r0],#4
+#else
+    sub     r2,     r6, lr
+    bic     r2,     r2, r6
+    ldr     ip,    [r0],#4
+    tst     r2,         lr, lsl #7
+#endif
+    orr     r3,     r4, r6, lsl r5
+    cmpeq   ip,         r3
+    mov     r4,         r6, lsr r8
+    beq     L_wordCompareLoop
+
+//  Either we have encountered a NUL, or we have found a mismatch between s1
+//  and s2.  Unwind the pointers and use a byte-by-byte comparison loop.
+    sub     r0,     r0, #4
+    sub     r1,     r1, #4
+L_unwindLoopPreload:
+    sub     r1,     r1, r5, lsr #3
+    CLEAR_FRAME
+
+L_byteCompareLoop:
+//  Load a character from each string and advance the pointers.  If the loaded
+//  characters are unequal or NUL, return their difference.
+    ldrb    r2,    [r0],#1
+    ldrb    ip,    [r1],#1
+    cmp     r2,         #1
+    cmpcs   r2,         ip
+    beq     L_byteCompareLoop
+
+L_earlyReturn:
+//  Return the difference between the last two characters loaded.
+    sub     r0,     r2, ip
+    bx      lr
diff --git a/arm/string/strcpy.s b/arm/string/strcpy.s
deleted file mode 100644 (file)
index 58981cb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2010 Apple, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
diff --git a/arm/string/strlcpy.s b/arm/string/strlcpy.s
deleted file mode 100644 (file)
index e69de29..0000000
index ffdc454c97862a366f42bb0ae2352428c119b95f..d7b261d38c38c3c542d6acadc6b95e27935c137c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <arm/arch.h>
+.syntax unified
+.code 32
+.globl _strlen
+
+#define addr r0
+#define word r1
+#define temp r2
+#define mask r3
+#define save ip
+#define indx r0
+
+.macro IfWordDoesntContainNUL_SetZ
+#if defined _ARM_ARCH_6
+//  In each word of the string, we check for NUL bytes via a saturating
+//  unsigned subtraction of each byte from 0x1.  The result of this is
+//  non-zero if and only if the corresponding byte in the string is NUL.
+//  Simply using a TST instruction checks all four bytes for NULs in one
+//  go.
+    uqsub8  temp,   mask,   word
+    tst     temp,           temp
+#else
+//  If we're on armv5, we do not have the uqsub8 instruction, so we need
+//  to use a different test for NUL.  Instead, we compute:
+//
+//      byte - 0x1 & ~byte
+//
+//  and test the high-order bit.  If it is set, then byte is NUL.  Just
+//  as with the other test, this can be applied simultaneously to all
+//  bytes in a word.
+    sub     temp,   word,   mask
+    bic     temp,   temp,   word
+    tst     temp,           mask, lsl #7
+#endif
+.endm
+
+.text
+.align 4
+.long 0x0           // padding
+.long 0x01010101    // mask for use in finding NULs
+_strlen:
+//  Establish stack frame, load mask that we will use to find NUL bytes,
+//  and set aside a copy of the pointer to the string.
+    push    {r7,lr}
+    mov     r7,     sp
+    ldr     mask,   (_strlen-4)
+    add                save,   addr,   #4
+
+//  Load the aligned word that contains the start of the string, then OR
+//  0x01 into any bytes that preceed the start of the string to prevent
+//  false positives when we check for NUL bytes.
+    and     temp,   addr,   #3
+    bic     addr,   addr,   #3
+    lsl     temp,   temp,   #3
+    ldr     word,  [addr],  #4
+    rsb     temp,   temp,   #32
+    orr     word,   word,   mask, lsr temp
+
+//  Check if the string ends in the first word.  If so, don't load any
+//  more of the string; instead jump directly to the cleanup code.
+    IfWordDoesntContainNUL_SetZ
+    bne     1f
+
+.align 4
+//  Load one word of the string on each iteration, and check it for NUL
+//  bytes.  If a NUL is found, fall through into the cleanup code.
+0:  ldr     word,  [addr],  #4
+    IfWordDoesntContainNUL_SetZ
+    beq                0b
+
+//  The last word that we loaded contained a NUL.  Subtracting the saved
+//  pointer from the current pointer gives us the number of bytes from
+//  the start of the string to the word containing the NUL.
+1:  sub     indx,   addr,   save
+#if defined _ARM_ARCH_6
+//  To that we add the index of the first NUL byte in the word, computed
+//  using REV and CLZ followed by a shift.
+    rev     temp,           temp
+    clz     temp,           temp
+    add     indx,   indx,   temp, lsr #3
+#else
+//  armv5 does not have the REV instruction, so instead we find the
+//  index of the NUL byte in word with a linear search.
+    tst     word,           #0x000000ff
+    addne   indx,           #1
+    tstne   word,           #0x0000ff00
+    addne   indx,           #1
+    tstne   word,           #0x00ff0000
+    addne   indx,           #1
+#endif
+    pop     {r7,pc}
+
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..450aa44fc63b541432c463d9a3748698807faa01 100644 (file)
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2010, 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+.text
+.syntax unified
+.code 32
+.globl _strncmp
+// int strncmp(const char *s1, const char *s2, size_t n);
+//
+// Returns zero if the two NUL-terminated strings s1 and s2 are equal up to
+// n characters.  Otherwise, returns the difference between the first two
+// characters that do not match, interpreted as unsigned integers.
+
+#define ESTABLISH_FRAME        \
+       push   {r4-r7,lr}         ;\
+       add     r7,     sp, #12   ;\
+       push   {r8,r10}
+#define CLEAR_FRAME            \
+       pop    {r8,r10}            ;\
+       pop    {r4-r7,lr}
+
+.align 3
+.long 0, 0x01010101
+_strncmp:
+//  If n < 16, jump straight to the byte-by-byte comparison loop.
+       cmp     r2,         #16
+       blo     L_byteCompareLoop
+//  Load a character from each string and advance the pointers.  If the loaded
+//  characters are unequal or NUL, return their difference.
+0:     ldrb    r3,    [r0],#1
+       ldrb    ip,    [r1],#1
+       sub     r2,         #1
+       cmp     r3,         #1
+       cmphs   r3,         ip
+       bne     L_earlyReturn
+//  If the address of the next character from s1 does not have word alignment,
+//  continue with the character-by-character comparison.  Otherwise, fall
+//  through into the word-by-word comparison path.
+       tst     r0,         #3
+       bne     0b
+       
+//  We have not encountered a NUL or a mismatch, and s1 has word alignment.
+//  Establish a frame, since we're going to need additional registers anyway.
+       ESTABLISH_FRAME
+       ldr     lr,    (_strncmp-4)
+
+//  Word align s2, and place the remainder in r10.  Compute the right- and
+//  left-shifts to extract each word that we will compare to the other source
+//  from the aligned words that we load:
+//
+//      aligned s2        to be loaded on next iteration
+//      |   "true" s2     |
+//      v   v             v
+//      +---+---+---+---+ +---+---+---+---+
+//      | 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 |
+//      +---+---+---+---+ +---+---+---+---+
+//          ^-----------------^
+//          to be compared on next iteration
+       and     r10,    r1, #3
+       bic     r1,     r1, #3
+       mov     r10,        r10, lsl #3
+       rsb     r6,     r10,#32
+       
+//  Subtract the number of bytes of the initial word load from s2 that will 
+//  actually be used from n.
+       sub     r2,     r2, r6, lsr #3
+       
+//  Load the first aligned word of s2.  OR 0x01 into any bytes that preceed the
+//  "true s2", to prevent our check for NUL from generating a false positive.
+//  Then check for NUL, and jump to the byte-by-byte comparison loop after
+//  unwinding the pointers if we enounter one.
+       ldr     r8,    [r1],#4
+       orr     r8,     r8, lr, lsr r6
+       sub     r3,     r8, lr
+       bic     r3,     r3, r8
+       tst     r3,         lr, lsl #7
+       mov     r5,         r8, lsr r10
+       bne     L_unwindLoopPreload
+       
+.align 3
+L_wordCompareLoop:
+//  If n < 4, abort the word compare loop before we load any more data.
+       subs    r2,     r2, #4
+       blo     L_nIsLessThanFour
+//  Load the next aligned word of s2 and check if it contains any NUL bytes.
+//  Load the next aligned word of s1, and extract the corresponding bytes from
+//  the two words of s2 loaded in this and the previous iteration of the loop.
+//  Compare these two words.
+//  If no NUL or mismatched words have been encountered, continue the loop.
+       ldr     r8,    [r1],#4
+#if defined _ARM_ARCH_6
+    uqsub8  r3,     lr, r8
+    tst     r3,         r3
+    ldr     ip,    [r0],#4
+#else
+       sub     r3,     r8, lr
+       bic     r3,     r3, r8
+       ldr     ip,    [r0],#4
+       tst     r3,         lr, lsl #7
+#endif
+       orr     r4,     r5, r8, lsl r6
+       cmpeq   ip,         r4
+       mov     r5,         r8, lsr r10
+       beq     L_wordCompareLoop
+
+//  Either we have encountered a NUL, or we have found a mismatch between s1
+//  and s2.  Unwind the pointers and use a byte-by-byte comparison loop.
+       sub     r0,     r0, #4
+       sub     r1,     r1, #4
+L_nIsLessThanFour:
+       add     r2,     r2, #4
+L_unwindLoopPreload:
+       sub     r1,     r1, r6, lsr #3
+       add     r2,     r2, r6, lsr #3
+       CLEAR_FRAME
+       
+L_byteCompareLoop:
+//  If n-- == 0, we have exhausted the allowed number of comparisons, and need
+//  to return zero without additional loads.
+       subs    r2,     r2, #1
+       movlo   r0,         #0
+       bxlo    lr
+//  Load a character from each string and advance the pointers.  If the loaded
+//  characters are unequal or NUL, return their difference.
+       ldrb    r3,    [r0],#1
+       ldrb    ip,    [r1],#1
+       cmp     r3,         #1
+       cmpcs   r3,         ip
+       beq     L_byteCompareLoop
+       
+L_earlyReturn:
+//  Return the difference between the last two characters loaded.
+       sub     r0,     r3, ip
+       bx      lr
diff --git a/arm/string/strncpy.s b/arm/string/strncpy.s
deleted file mode 100644 (file)
index e69de29..0000000
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..33535fd1f978f3280d979aed3fa60186c47cb163 100644 (file)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <arm/arch.h>
+.syntax unified
+.code 32
+.globl _strnlen
+
+#define addr r0
+#define maxl r1
+#define temp r2
+#define mask r3
+#define save ip
+#define word lr
+#define byte lr
+#define indx r0
+
+.macro IfHS_and_WordDoesntContainNUL_SetZ
+#if defined _ARM_ARCH_6
+//  In each word of the string, we check for NUL bytes via a saturating
+//  unsigned subtraction of each byte from 0x1.  The result of this is
+//  non-zero if and only if the corresponding byte in the string is NUL.
+//  Simply using a TST instruction checks all four bytes for NULs in one
+//  go.
+    uqsub8  temp,   mask,   word
+    tsths   temp,           temp
+#else
+//  If we're on armv5, we do not have the uqsub8 instruction, so we need
+//  to use a different test for NUL.  Instead, we compute:
+//
+//      byte - 0x1 & ~byte
+//
+//  and test the high-order bit.  If it is set, then byte is NUL.  Just
+//  as with the other test, this can be applied simultaneously to all
+//  bytes in a word.
+    sub     temp,   word,   mask
+    bic     temp,   temp,   word
+    tsths   temp,           mask, lsl #7
+#endif
+.endm
+
+.text
+.align 3
+.long 0x0           // padding
+.long 0x01010101    // mask for use in finding NULs
+_strnlen:
+//  Establish stack frame, load mask that we will use to find NUL bytes,
+//  and set aside a copy of the pointer to the string.  Subtract 4 from
+//  the maxlen, and jump into a byte-by-byte search if this requires a
+//  borrow, as we cannot use a word-by-word search in that case.
+    push    {r7,lr}
+    mov     r7,     sp
+    ldr     mask,   (_strnlen-4)
+    add                save,   addr,   #4
+    subs    maxl,   maxl,   #4
+    blo     L_bytewiseSearch
+
+//  Load the aligned word that contains the start of the string, then OR
+//  0x01 into any bytes that preceed the start to prevent false positives
+//  when we check for NUL bytes.  Additionally, add the number of unused
+//  bytes to maxlen.
+    and     temp,   addr,   #3
+    bic     addr,   addr,   #3
+    add     maxl,   maxl,   temp
+    lsl     temp,   temp,   #3
+    ldr     word,  [addr],  #4
+    rsb     temp,   temp,   #32
+    orr     word,   word,   mask, lsr temp
+
+    subs    maxl,   maxl,   #4
+    IfHS_and_WordDoesntContainNUL_SetZ
+    bne     1f
+
+.align 4
+0:  ldr     word,  [addr],  #4
+    subs    maxl,   maxl,   #4
+    IfHS_and_WordDoesntContainNUL_SetZ
+    beq     0b
+
+.align 4
+//  Either the last word that we loaded contained a NUL, or we will
+//  exceed maxlen before we finish the next word in the string.  Determine
+//  which case we are in by repeating the check for NUL, and branch if
+//  there was not a NUL byte.  Padding ensures that we don't have two
+//  branches in a single 16-byte fetch group, as this interferes with
+//  branch prediction on Swift.
+1:  tst     temp,           temp
+    beq     L_bytewiseSearch
+
+//  The last word that we loaded contained a NUL.  Subtracting the saved
+//  pointer from the current pointer gives us the number of bytes from
+//  the start of the string to the word containing the NUL.
+    sub     indx,   addr,   save
+#if defined _ARM_ARCH_6
+//  To that we add the index of the first NUL byte in the word, computed
+//  using REV and CLZ followed by a shift.
+    rev     temp,           temp
+    clz     temp,           temp
+    add     indx,   indx,   temp, lsr #3
+#else
+//  armv5 does not have the REV instruction, so instead we find the
+//  index of the NUL byte in word with a linear search.
+    tst     word,           #0x000000ff
+    addne   indx,           #1
+    tstne   word,           #0x0000ff00
+    addne   indx,           #1
+    tstne   word,           #0x00ff0000
+    addne   indx,           #1
+#endif
+    pop     {r7,pc}
+
+.align 4
+L_bytewiseSearch:
+//  Restore maxlen (the last thing that happened before we branched here
+//  was that we subtracted 4 from maxlen), and adjust the saved string
+//  pointer.  Then we do a simple byte-by-byte search until we either
+//  reach the end of the string or maxlen reaches zero, at which point
+//  the length to return is simply the difference between the current
+//  and saved pointers.
+    adds    maxl,   maxl,   #4
+    sub     save,   save,   #4
+    beq     1f
+0:  ldrb    byte,          [addr]
+    cmp     byte,           #0
+    addhi   addr,           #1
+    subshi  maxl,           #1
+    bhi     0b
+1:  sub     indx,   addr,   save
+    pop     {r7,pc}
index fc9f350678fe8cd3df5bcdb8d4373fd706cec06a..a44087e835b52212ae2c853ab33d163739b49da9 100644 (file)
  * @APPLE_LICENSE_HEADER_END@
  */
 
+//  char * strstr(const char *s1, const char *s2);
+//
+//  If s2 is empty, s1 is returned.
+//  If s2 does not occur in s1, NULL is returned.
+//  Otherwise, a pointer to the first character of the first occurrence of s2
+//  in s1 is returned.
+//
+//  We use a hand-tuned version of the naive quadratic time algorithm; we have
+//  experimented with more sophisticated algorithms, however they have been
+//  found wanting.  The increased startup cost combines with the frequency of
+//  calls to strstr with small strings to swamp the gains from improved
+//  asymptotic complexity.
+
+#define CLEAR_FRAME_AND_RETURN \
+    pop    {r4,r5,r6,r7,pc}
+
+.text
+.syntax unified
+.code 32
+.globl _strstr
+.align 2
+_strstr:
+    push   {r4,r5,r6,r7,lr}
+    add     r7,     sp, #12
+    
+//  Throughout this function, I will refer to the string in which we are
+//  searching as "string" and the string for which we are searching as "word".
+//  Using s1 and s2 is too confusing.  Thus, we want to return a pointer to
+//  the first occurrence of "word" in "string".
+    mov     r5,     r1
+    mov     r4,     r0
+
+//  We begin by calling strlen to find the length of "word".  We also handle
+//  two special cases here: we early-out if word is an empty string (length
+//  zero), and we call strchr if word is only a single character.
+    mov     r0,     r5
+    bl      _strlen
+    subs    r0,     r0, #1
+    ble     L_tinyWord
+    
+//  Load the first character of word
+    ldrb    ip,    [r5]
+
+L_lookForFirstCharacter:
+//  Load the first character from string.  If it is equal to the first
+//  character of word, or is a zero byte, then we do more processing;
+//  otherwise, proceed to the next character.
+    ldrb    r1,    [r4],#1
+    cmp     r1,     ip
+    tstne   r1,     r1
+    bne     L_lookForFirstCharacter
+    
+//  The byte that we loaded from string either matched the first character
+//  of word, or was a zero byte.  If it was a zero byte, then we have reached
+//  the end of string without finding a match of word.  Otherwise, we fall
+//  into a loop that checks additional characters to see if we have a match.
+    tst     r1,     r1
+    beq     L_noMatch
+    
+//  We have found a match for the first character of word; we want to read
+//  characters from this point on to see if we have a match for the entirety
+//  of word.  We want to be sure to preserve the state of the outside loop,
+//  however:
+//
+//      r0: length(word) - 1
+//      r4: pointer to the next character in string
+//      r5: pointer to the first character in word
+//      ip: first character in word
+//
+//  The registers r1-r3, r6, and lr are available as scratch.  We set them up
+//  for the inner loop as follows:
+//
+//      r1: remaining length to be matched
+//      r2: pointer to next character of string to match
+//      r3: pointer to next character of word to match
+//      r6: current character from string
+//      lr: current character from word    
+    mov     r2,     r4
+    add     r3,     r5, #1
+    mov     r1,     r0
+    
+L_checkMatch:
+//  Load the next byte from both the candidate match and from word.  If they
+//  are not equal, jump back to the outer loop.  If they are equal, decrement
+//  the length, and continue the inner loop if we have not yet found a
+//  complete match.
+//
+//  We don't need to worry about looking for null bytes in this loop; we know
+//  that we won't load a null byte from word, because we computed it's length
+//  earlier, and are using that as a termination condition.  If we hit a null
+//  byte in string, the comparison will fail (because the corresponding byte
+//  in word is non-null), and we will return to the outer loop, where the
+//  null byte will be detected and handled properly.
+    ldrb    r6,    [r2],#1
+    ldrb    lr,    [r3],#1
+    cmp     r6,     lr
+    bne     L_lookForFirstCharacter
+    subs    r1,     r1, #1
+    bne     L_checkMatch
+
+//  We have exhausted the length of word without finding a mismatched character
+//  so we have found a match.  Return a pointer to the beginning of the match
+//  string.  (This pointer is r4 - 1 because r4 was auto-incremented when we
+//  loaded the first character).
+    sub     r0,     r4, #1
+    CLEAR_FRAME_AND_RETURN
+
+L_noMatch:
+//  No match was found; return NULL.
+    mov     r0,     #0
+    CLEAR_FRAME_AND_RETURN
+
+L_tinyWord:
+//  "word" is either empty or a single character.  If it is a single character,
+//  translate strstr into a call to the (more efficient) strchr.
+    blt     L_emptyWord
+    ldrb    r1,    [r5]
+    mov     r0,     r4
+    bl      _strchr
+    CLEAR_FRAME_AND_RETURN
+    
+L_emptyWord:
+//  "word" is empty; return "string".
+    movlt   r0,     r4
+    CLEAR_FRAME_AND_RETURN
+    
\ No newline at end of file
diff --git a/arm/sys/Makefile.inc b/arm/sys/Makefile.inc
deleted file mode 100644 (file)
index 7991b41..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-.PATH: ${.CURDIR}/arm/sys
-
-MDSRCS+= \
-       OSAtomic.s      \
-       OSAtomic_resolvers.c    \
-       gcc_atomic.c    \
-       _longjmp.s      \
-       _setjmp.s       \
-       arm_commpage_gettimeofday.c     \
-       longjmp.s       \
-       setjmp.s \
-       mach_absolute_time.s
-
-DYLDSRCS += OSAtomic.s arm_commpage_gettimeofday.c mach_absolute_time.s
-
-.if !defined(FEATURE_ARM_ARCH_6)
-MDSRCS+= OSAtomic-v4.c
-DYLDSRCS+= OSAtomic-v4.c
-.endif
diff --git a/arm/sys/OSAtomic.c b/arm/sys/OSAtomic.c
new file mode 100644 (file)
index 0000000..41c328b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include "OSAtomic.h"
+#include "../../darwin/OSAtomicLoadStoreEx.c"
diff --git a/arm/sys/OSAtomic.h b/arm/sys/OSAtomic.h
new file mode 100644 (file)
index 0000000..7745403
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef __ARM_OSATOMIC_SHIMS__
+#define __ARM_OSATOMIC_SHIMS__
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#define fastpath(x)    ((typeof(x))__builtin_expect((long)(x), ~0l))
+#define slowpath(x)    ((typeof(x))__builtin_expect((long)(x), 0l))
+
+#if defined(__arm__)
+#include <arm/arch.h>
+
+#define _osatomic_load_exclusive(p, r) \
+       __asm__ __volatile__( \
+       "ldrex  %[_r], %[_p]" \
+       : [_r] "=&r" (r) \
+       : [_p] "m" (*(p)) : "memory")
+
+#define _osatomic_load_exclusive64(p, r) \
+       do { \
+               register uint32_t rl asm("r4"), rh asm("r5"); \
+               __asm__ __volatile__( \
+                       "ldrexd %[_rl], %[_rh], %[_p]" \
+                       : [_rl] "=r" (rl), [_rh] "=r" (rh) \
+                       : [_p] "m" (*(p)) : "memory"); \
+               r = (typeof(r))(((uint64_t)rh << 32) | (uint64_t)rl); \
+       } while (0);
+
+#define _osatomic_store_exclusive(p, r, t) \
+       __asm__ __volatile__( \
+       "strex  %[_t], %[_r], %[_p]" \
+       : [_t] "=&r" (t) \
+       : [_p] "m" (*(p)), [_r] "r" (r) : "memory")
+
+#define _osatomic_store_exclusive64(p, r, t) \
+       do { \
+               register uint32_t rl asm("r4"), rh asm("r5"); \
+               rh = (uint32_t)(r >> 32); \
+               rl = (uint32_t)(r); \
+               __asm__ __volatile__( \
+                       "strexd %[_t], %[_rl], %[_rh], %[_p]" \
+                       : [_t] "=&r" (t) \
+                       : [_p] "m" (*(p)), [_rl] "r" (rl), [_rh] "r" (rh) : "memory"); \
+       } while (0);
+
+#if defined(_ARM_ARCH_7)
+
+#ifdef _OSATOMIC_WFE
+#      define MP_SPIN_TRIES            10
+#      define _osatomic_pause()        __asm__ __volatile__("wfe")
+#else
+#      define MP_SPIN_TRIES            1000
+#      define _osatomic_pause()        __asm__ __volatile__("yield")
+#endif // _OSATOMIC_WFE
+
+#define _osatomic_barrier() \
+       __asm__ __volatile__( \
+       "dmb    ish" \
+       : : : "memory")
+
+#define _osatomic_store_barrier() \
+       __asm__ __volatile__( \
+       "dmb    ishst" \
+       : : : "memory")
+
+#elif defined(_ARM_ARCH_6) && !defined(__thumb__) // _ARM_ARCH_7
+
+#define _osatomic_barrier() \
+       __asm__ __volatile__( \
+       "mcr    p15, 0, %0, c7, c10, 5" \
+       : : "r" (0) : "memory")
+
+#define _osatomic_store_barrier() _osatomic_barrier()
+#define _osatomic_pause()
+
+#elif defined(_ARM_ARCH_6) && defined(__thumb__)
+#error Atomic operations not available on ARMv6 Thumb
+#endif // _ARM_ARCH_7
+
+#if !defined(_ARM_ARCH_7)
+#      ifndef _OSATOMIC_NO_BARRIERS
+#              define __OSATOMIC_SUFFIX        ""
+#              define __OSATOMIC_BARRIER       "Barrier"
+#              define _OSATOMIC_ALIAS_NB(x)
+#      else
+#              define _OSATOMIC_EXTRAS                 1
+#              define __OSATOMIC_SUFFIX        ""
+#              define __OSATOMIC_BARRIER       ""
+#              define _OSATOMIC_ALIAS_NB(x)
+#      endif // _OSATOMIC_NO_BARRIERS
+#else
+#      define _OSATOMIC_EXTRAS                 1
+#      ifndef _OSATOMIC_NO_BARRIERS
+#              ifdef _OSATOMIC_WFE
+#                      define __OSATOMIC_SUFFIX "$VARIANT$wfe"
+#              else
+#                      define __OSATOMIC_SUFFIX "$VARIANT$mp"
+#              endif // _OSATOMIC_ONLY_WFE
+#              define __OSATOMIC_BARRIER "Barrier" __OSATOMIC_SUFFIX
+#              define _OSATOMIC_ALIAS_NB(x)
+#      else
+#              define __OSATOMIC_SUFFIX "$VARIANT$up"
+#              define __OSATOMIC_BARRIER "Barrier" __OSATOMIC_SUFFIX
+// Undefine the barrier operations
+#              undef _osatomic_barrier
+#              define _osatomic_barrier()
+#              undef _osatomic_store_barrier
+#              define _osatomic_store_barrier()
+// Aliases to alias non-barrier operations to UP variant names
+#              if defined(__thumb__)
+#                      define _OSATOMIC_ALIAS_NB(sym)  __asm __volatile__(".globl _" __STRING(sym) "; .thumb_func _" __STRING(sym) " ; .set _" __STRING(sym) ", _" __STRING(sym) __OSATOMIC_BARRIER)
+#              else
+#                      define _OSATOMIC_ALIAS_NB(sym)  __asm __volatile__(".globl _" __STRING(sym) "; .set _" __STRING(sym) ", _" __STRING(sym) __OSATOMIC_BARRIER)
+#              endif // __thumb__
+#      endif // _OSATOMIC_NO_BARRIERS
+#endif // !_ARM_ARCH_7
+
+// Allow us to mark up functions as being uni/multiprocessor.
+#define _OSATOMIC_VARIANT(sym) __asm("_" __STRING(sym) __OSATOMIC_SUFFIX)
+#define _OSATOMIC_VARIANT_B(sym)       __asm("_" __STRING(sym) __OSATOMIC_BARRIER)
+
+#if defined(__thumb__)
+       // For aliasing CompareAndSwap operations of the same size
+       #define _OSATOMIC_ALIAS_B(newsym, sym)  \
+               __asm __volatile__( \
+                       ".globl _" __STRING(newsym) __OSATOMIC_BARRIER ";" \
+                       ".thumb_func _" __STRING(newsym) __OSATOMIC_BARRIER ";" \
+                       ".set _" __STRING(newsym) __OSATOMIC_BARRIER ", _" __STRING(sym) __OSATOMIC_BARRIER \
+               )
+
+       #define _OSATOMIC_ALIAS(newsym, sym)    \
+               __asm __volatile__( \
+                       ".globl _" __STRING(newsym) __OSATOMIC_SUFFIX ";" \
+                       ".thumb_func _" __STRING(newsym) __OSATOMIC_SUFFIX ";" \
+                       ".set _" __STRING(newsym) __OSATOMIC_SUFFIX ", _" __STRING(sym) __OSATOMIC_SUFFIX \
+               )
+#else
+       // For aliasing CompareAndSwap operations of the same size
+       #define _OSATOMIC_ALIAS_B(newsym, sym)  \
+               __asm __volatile__( \
+                       ".globl _" __STRING(newsym) __OSATOMIC_BARRIER ";" \
+                       ".set _" __STRING(newsym) __OSATOMIC_BARRIER ", _" __STRING(sym) __OSATOMIC_BARRIER \
+               )
+
+       #define _OSATOMIC_ALIAS(newsym, sym)    \
+               __asm __volatile__( \
+                       ".globl _" __STRING(newsym) __OSATOMIC_SUFFIX ";" \
+                       ".set _" __STRING(newsym) __OSATOMIC_SUFFIX ", _" __STRING(sym) __OSATOMIC_SUFFIX \
+               )
+#endif // __thumb__
+
+#endif // __arm__
+
+#endif // __ARM_OSATOMIC_SHIMS__
diff --git a/arm/sys/OSAtomic.s b/arm/sys/OSAtomic.s
deleted file mode 100644 (file)
index 6bcf8d1..0000000
+++ /dev/null
@@ -1,634 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <machine/cpu_capabilities.h>
-#include <architecture/arm/asm_help.h>
-#include <arm/arch.h>
-
-.text
-
-/* Number of times we spin in a spinlock before going to kernel */
-#define        MP_SPIN_TRIES           1000
-#define        MP_SPIN_TRIES_WFE       10
-
-#if defined(VARIANT_DYLD)
-  #if defined(_ARM_ARCH_7)
-    /* This makes sure we pick up MP variants for dyld on armv7 */
-    #define ENTRY_POINT_RESOLVER(symbol, variant) \
-        ENTRY_POINT(symbol##$VARIANT$##variant) ;\
-        .private_extern symbol##$VARIANT$##variant
-
-    #define ENTRY_POINT_DEFAULT(symbol, variant) \
-        ENTRY_POINT(symbol##$VARIANT$##variant) ;\
-        .private_extern symbol##$VARIANT$##variant
-
-    #define makeResolver_up_mp(name) \
-      ENTRY_POINT(_##name) \
-        ldr ip, L##name##$commpage ; \
-        ldr ip, [ip] ; \
-        tst ip, $(kUP) ; \
-        beq _##name##$VARIANT$mp ; \
-        b   _##name##$VARIANT$up ; \
-        L##name##$commpage: .long _COMM_PAGE_CPU_CAPABILITIES ;
-
-    #define makeResolver_up_mp_wfe(name) \
-        makeResolver_up_mp(name)
-  #else
-    #define ENTRY_POINT_RESOLVER(symbol, variant) \
-        ENTRY_POINT(symbol##$VARIANT$##variant) ;\
-        .private_extern symbol##$VARIANT$##variant
-
-    #define ENTRY_POINT_DEFAULT(symbol, variant)       ENTRY_POINT(symbol)
-  #endif
-#else
-  #if defined(_ARM_ARCH_7)
-    #define ENTRY_POINT_RESOLVER(symbol, variant) \
-        ENTRY_POINT(symbol##$VARIANT$##variant) ;\
-        .private_extern symbol##$VARIANT$##variant
-    #define ENTRY_POINT_DEFAULT(symbol, variant) \
-        ENTRY_POINT(symbol##$VARIANT$##variant) ;\
-        .private_extern symbol##$VARIANT$##variant
-  #else // !_ARM_ARCH_7
-    /* _RESOLVER shouldn't be used on armv5/6, so intentionally plants bad text. */
-    #define ENTRY_POINT_RESOLVER(symbol, variant)      .error
-    #define ENTRY_POINT_DEFAULT(symbol, variant)       ENTRY_POINT(symbol)
-  #endif
-#endif // VARIANT_DYLD
-
-#if defined(VARIANT_DYLD) && defined(_ARM_ARCH_7)
-/*
- * In dyld's build only, we include the list of resolvers needed and
- * this generates entry points for dyld which are run on every execution
- * in order to pick the correct variant.
- */
-#include "OSAtomic_resolvers.h"
-#endif
-
-#if defined(_ARM_ARCH_6)
-
-/* Implement a generic atomic arithmetic operation:
- * operand is in R0, pointer is in R1.  Return new
- * value into R0 (or old valule in _ORIG cases).
- *
- * Return instructions are separate to the
- * _ATOMIC_ARITHMETIC macro.
- */
-#define _ATOMIC_ARITHMETIC(op) \
-       ldrex   r2, [r1]        /* load existing value and tag memory */            ;\
-       op      r3, r2, r0      /* compute new value */                             ;\
-       strex   ip, r3, [r1]    /* store new value if memory is still tagged */     ;\
-       cmp     ip, #0          /* check if the store succeeded */                  ;\
-       bne     1b              /* if not, try again */
-
-#if defined(_ARM_ARCH_7)
-/*
- * ARMv7 barrier operations:
- *  - Full Barrier (FB); store barrier before store exclusive, full barrier after op.
- */
-
-#define ATOMIC_ARITHMETIC_FB(op) \
-       dmb     ishst           /* store barrier before store exclusive */          ;\
-1:     _ATOMIC_ARITHMETIC(op)                                                      ;\
-       dmb     ish             /* issue data memory barrier */                     ;\
-       mov     r0, r3          /* return new value */
-
-#define ATOMIC_ARITHMETIC_ORIG_FB(op) \
-       dmb     ishst           /* store barrier before store exclusive */          ;\
-1:     _ATOMIC_ARITHMETIC(op)                                                      ;\
-       dmb     ish             /* issue data memory barrier */                     ;\
-       mov     r0, r2          /* return orig value */
-
-#endif
-
-/* 
- * For the non-MP ARMv7 cases, and ARMv5/6, these provide atomic arithmetic
- * without any barriers at all.
- */
-#define ATOMIC_ARITHMETIC(op) \
-1:     _ATOMIC_ARITHMETIC(op) ;\
-       mov     r0, r3          /* return new value */
-
-#define ATOMIC_ARITHMETIC_ORIG(op) \
-       1:      _ATOMIC_ARITHMETIC(op) ;\
-       mov     r0, r2          /* return orig value */
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicAdd32Barrier, mp)
-       ATOMIC_ARITHMETIC_FB(add)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicAdd32Barrier, up)
-ENTRY_POINT(_OSAtomicAdd32)
-       ATOMIC_ARITHMETIC(add)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicOr32Barrier, mp)
-       ATOMIC_ARITHMETIC_FB(orr)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicOr32Barrier, up)
-ENTRY_POINT(_OSAtomicOr32)
-       ATOMIC_ARITHMETIC(orr)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicOr32OrigBarrier, mp)
-       ATOMIC_ARITHMETIC_ORIG_FB(orr)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicOr32OrigBarrier, up)
-ENTRY_POINT(_OSAtomicOr32Orig)
-       ATOMIC_ARITHMETIC_ORIG(orr)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicAnd32Barrier, mp)
-       ATOMIC_ARITHMETIC_FB(and)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicAnd32Barrier, up)
-ENTRY_POINT(_OSAtomicAnd32)
-       ATOMIC_ARITHMETIC(and)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicAnd32OrigBarrier, mp)
-       ATOMIC_ARITHMETIC_ORIG_FB(and)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicAnd32OrigBarrier, up)
-ENTRY_POINT(_OSAtomicAnd32Orig)
-       ATOMIC_ARITHMETIC_ORIG(and)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicXor32Barrier, mp)
-       ATOMIC_ARITHMETIC_FB(eor)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicXor32Barrier, up)
-ENTRY_POINT(_OSAtomicXor32)
-       ATOMIC_ARITHMETIC(eor)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicXor32OrigBarrier, mp)
-       ATOMIC_ARITHMETIC_ORIG_FB(eor)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicXor32OrigBarrier, up)
-ENTRY_POINT(_OSAtomicXor32Orig)
-       ATOMIC_ARITHMETIC_ORIG(eor)
-       bx      lr
-
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicCompareAndSwap32Barrier, mp)
-ENTRY_POINT_RESOLVER(_OSAtomicCompareAndSwapIntBarrier, mp)
-ENTRY_POINT_RESOLVER(_OSAtomicCompareAndSwapLongBarrier, mp)
-ENTRY_POINT_RESOLVER(_OSAtomicCompareAndSwapPtrBarrier, mp)
-       ldrex   r3, [r2]        // load existing value and tag memory
-       teq     r3, r0          // is it the same as oldValue?
-       movne   r0, #0          // if not, return 0 immediately
-       bxne    lr          
-       dmb     ishst           // store barrier before store exclusive
-       strex   r3, r1, [r2]    // otherwise, try to store new value
-       cmp     r3, #0          // check if the store succeeded
-       bne     2f              // if not, try again
-1:     dmb     ish             // memory barrier
-       mov     r0, #1          // return true
-       bx      lr
-2:     ldrex   r3, [r2]        // load existing value and tag memory
-       teq     r3, r0          // is it the same as oldValue?
-       movne   r0, #0          // if not, return 0 immediately
-       bxne    lr          
-       strex   r3, r1, [r2]    // otherwise, try to store new value
-       cmp     r3, #0          // check if the store succeeded
-       bne     2b              // if not, try again
-       b       1b              // return
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicCompareAndSwap32Barrier, up)
-ENTRY_POINT_DEFAULT(_OSAtomicCompareAndSwapIntBarrier, up)
-ENTRY_POINT_DEFAULT(_OSAtomicCompareAndSwapLongBarrier, up)
-ENTRY_POINT_DEFAULT(_OSAtomicCompareAndSwapPtrBarrier, up)
-ENTRY_POINT(_OSAtomicCompareAndSwap32)
-ENTRY_POINT(_OSAtomicCompareAndSwapInt)
-ENTRY_POINT(_OSAtomicCompareAndSwapLong)
-ENTRY_POINT(_OSAtomicCompareAndSwapPtr)
-1:     ldrex   r3, [r2]        // load existing value and tag memory
-       teq     r3, r0          // is it the same as oldValue?
-       movne   r0, #0          // if not, return 0 immediately
-       bxne    lr          
-       strex   r3, r1, [r2]    // otherwise, try to store new value
-       cmp     r3, #0          // check if the store succeeded
-       bne     1b              // if not, try again
-       mov     r0, #1          // return true
-       bx      lr
-
-
-/* Implement a generic test-and-bit-op operation:
- * bit to set is in R0, base address is in R1.  Return
- * previous value (0 or 1) of the bit in R0.
- */
-#define _BITOP(op)     \
-       /* Adjust pointer to point at the correct word                              ;\
-        * R1 = R1 + 4 * (R0 / 32)                                                  ;\
-        */                                                                         ;\
-       mov     r3, r0, lsr #5                                                      ;\
-       add     r1, r1, r3, asl #2                                                  ;\
-       /* Generate a bit mask for the bit we want to test                          ;\
-        * R0 = (0x80 >> (R0 & 7)) << (R0 & ~7 & 31)                                ;\
-        */                                                                         ;\
-       and     r2, r0, #7                                                          ;\
-       mov     r3, #0x80                                                           ;\
-       mov     r3, r3, asr r2                                                      ;\
-       and     r0, r0, #0x18                                                       ;\
-       mov     r0, r3, asl r0                                                      ;\
-
-#define ATOMIC_BITOP(op)    \
-       _BITOP(op)                                                                  ;\
-1:                                                                                 ;\
-       ldrex   r2, [r1]        /* load existing value and tag memory */            ;\
-       op      r3, r2, r0      /* compute new value */                             ;\
-       strex   ip, r3, [r1]    /* attempt to store new value */                    ;\
-       cmp     ip, #0          /* check if the store succeeded */                  ;\
-       bne     1b              /* if not, try again */                             ;\
-       ands    r0, r2, r0      /* mask off the bit from the old value */           ;\
-       movne   r0, #1          /* if non-zero, return exactly 1 */
-       
-#if defined(_ARM_ARCH_7)
-#define ATOMIC_BITOP_FB(op)    \
-       _BITOP(op)                                                                  ;\
-       dmb     ishst           /* store barrier before store exclusive */          ;\
-1:     ldrex   r2, [r1]        /* load existing value and tag memory */            ;\
-       op      r3, r2, r0      /* compute new value */                             ;\
-       strex   ip, r3, [r1]    /* attempt to store new value */                    ;\
-       cmp     ip, #0          /* check if the store succeeded */                  ;\
-       bne     1b              /* if not, try again */                             ;\
-       dmb     ish             /* memory barrier */                                ;\
-       ands    r0, r2, r0      /* mask off the bit from the old value */           ;\
-       movne   r0, #1          /* if non-zero, return exactly 1 */
-#endif
-
-#if defined(_ARM_ARCH_7)       
-ENTRY_POINT_RESOLVER(_OSAtomicTestAndSetBarrier, mp)
-       ATOMIC_BITOP_FB(orr)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicTestAndSetBarrier, up)
-ENTRY_POINT(_OSAtomicTestAndSet)
-       ATOMIC_BITOP(orr)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicTestAndClearBarrier, mp)
-       ATOMIC_BITOP_FB(bic)
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicTestAndClearBarrier, up)
-ENTRY_POINT(_OSAtomicTestAndClear)
-       ATOMIC_BITOP(bic)
-       bx      lr
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSMemoryBarrier, mp)
-       dmb     ish
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSMemoryBarrier, up)
-       bx      lr
-
-/* void  OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset); */
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicEnqueue, mp)
-        dmb     ishst
-1:      ldrex   r3, [r0]        // get link to 1st on list
-        str     r3, [r1, r2]    // hang list off new node
-        strex   r3, r1, [r0]    // make new 1st on list
-        cmp     r3, #0
-        bne     1b
-        dmb     ish
-        bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicEnqueue, up)
-1:      ldrex   r3, [r0]        // get link to 1st on list
-        str     r3, [r1, r2]    // hang list off new node
-        strex   r3, r1, [r0]    // make new 1st on list
-        cmp     r3, #0
-        bne     1b
-        bx      lr
-        
-/* void* OSAtomicDequeue( OSQueueHead *list, size_t offset); */
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicDequeue, mp)
-        mov     r2, r0
-        dmb     ishst
-1:      ldrex   r0, [r2]        // get 1st in list
-        cmp     r0, #0          // null?
-        bxeq    lr              // yes, list empty
-        ldr     r3, [r0, r1]    // get 2nd
-        strex   ip, r3, [r2]    // make 2nd first
-        cmp     ip, #0
-        bne     1b
-        dmb     ish
-        bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicDequeue, up)
-        mov     r2, r0
-1:      ldrex   r0, [r2]        // get 1st in list
-        cmp     r0, #0          // null?
-        bxeq    lr              // yes, list empty
-        ldr     r3, [r0, r1]    // get 2nd
-        strex   ip, r3, [r2]    // make 2nd first
-        cmp     ip, #0
-        bne     1b
-        bx      lr
-
-#if defined(_ARM_ARCH_6K)
-/* If we can use LDREXD/STREXD, then we can implement 64-bit atomic operations */
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicAdd64Barrier, mp)
-       // R0,R1 contain the amount to add
-       // R2 contains the pointer
-       stmfd   sp!, {r4, r5, r8, r9, lr}
-       dmb     ishst           // store memory barrier before store exclusive
-1:     ldrexd  r4, r5, [r2]    // load existing value to R4/R5 and tag memory
-       adds    r8, r4, r0      // add lower half of new value into R8 and set carry bit
-       adc     r9, r5, r1      // add upper half of new value into R9 with carry
-       strexd  r3, r8, r9, [r2]        // store new value if memory is still tagged
-       cmp     r3, #0          // check if store succeeded
-       bne     1b              // if not, try again
-       dmb     ish             // memory barrier
-       mov     r0, r8          // return new value
-       mov     r1, r9
-       ldmfd   sp!, {r4, r5, r8, r9, pc}
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicAdd64Barrier, up)
-ENTRY_POINT(_OSAtomicAdd64)
-       // R0,R1 contain the amount to add
-       // R2 contains the pointer
-       stmfd   sp!, {r4, r5, r8, r9, lr}
-1:     ldrexd  r4, r5, [r2]    // load existing value to R4/R5 and tag memory
-       adds    r8, r4, r0      // add lower half of new value into R8 and set carry bit
-       adc     r9, r5, r1      // add upper half of new value into R9 with carry
-       strexd  r3, r8, r9, [r2]        // store new value if memory is still tagged
-       cmp     r3, #0          // check if store succeeded
-       bne     1b              // if not, try again
-       mov     r0, r8          // return new value
-       mov     r1, r9
-       ldmfd   sp!, {r4, r5, r8, r9, pc}
-       
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_OSAtomicCompareAndSwap64Barrier, mp)
-       // R0,R1 contains the old value
-       // R2,R3 contains the new value
-       // the pointer is pushed onto the stack
-       ldr     ip, [sp, #0]    // load pointer into IP
-       stmfd   sp!, {r4, r5, lr}
-       ldrexd  r4, [ip]        // load existing value into R4/R5 and tag memory
-       teq     r0, r4          // check low word
-       teqeq   r1, r5          // if low words match, check high word
-       movne   r0, #0          // if either match fails, return 0
-       bne     2f
-       dmb     ishst           // store barrier before store exclusive
-       strexd  r4, r2, [ip]    // otherwise, try to store new values
-       cmp     r4, #0          // check if store succeeded
-       bne     3f              // if not, try again
-1:     dmb     ish             // memory barrier
-       mov     r0, #1          // return true
-2:     ldmfd   sp!, {r4, r5, pc}
-3:     ldrexd  r4, [ip]        // load existing value into R4/R5 and tag memory
-       teq     r0, r4          // check low word
-       teqeq   r1, r5          // if low words match, check high word
-       movne   r0, #0          // if either match fails, return 0
-       bne     2b
-       strexd  r4, r2, [ip]    // otherwise, try to store new values
-       cmp     r4, #0          // check if store succeeded
-       bne     3f              // if not, try again
-       b       1b              // return
-#endif
-
-ENTRY_POINT_DEFAULT(_OSAtomicCompareAndSwap64Barrier, up)
-ENTRY_POINT(_OSAtomicCompareAndSwap64)
-       // R0,R1 contains the old value
-       // R2,R3 contains the new value
-       // the pointer is pushed onto the stack
-       ldr     ip, [sp, #0]    // load pointer into IP
-       stmfd   sp!, {r4, r5, lr}
-1:     ldrexd  r4, [ip]        // load existing value into R4/R5 and tag memory
-       teq     r0, r4          // check low word
-       teqeq   r1, r5          // if low words match, check high word
-       movne   r0, #0          // if either match fails, return 0
-       bne     2f
-       strexd  r4, r2, [ip]    // otherwise, try to store new values
-       cmp     r4, #0          // check if store succeeded
-       bne     1b              // if not, try again
-       mov     r0, #1          // return true
-2:     ldmfd   sp!, {r4, r5, pc}
-                       
-#endif /* defined(_ARM_ARCH_6K) */
-
-#endif /* defined(_ARM_ARCH_6) */
-
-/*    
- * void
- * _spin_lock(p)
- *      int *p;
- *
- * Lock the lock pointed to by p.  Spin (possibly forever) until the next
- * lock is available.
- */
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_spin_lock, mp)
-ENTRY_POINT_RESOLVER(__spin_lock, mp)
-ENTRY_POINT_RESOLVER(_OSSpinLockLock, mp)
-       mov     r1, #1
-1:     ldrex   r2, [r0]        // load the value of [r0] into r2
-       cmp     r2, #0          // compare the lock value to zero
-       bne     2f              // jump to the spin if we don't own the lock
-       strex   r3, r1, [r0]    // try to store the one
-       cmp     r3, #0          // test to see if we stored our value
-       bne     2f              // if not, jump to the spin too
-       dmb     ish             // memory barrier if we acquired the lock
-       bx      lr              // and return
-2:     mov     r3, $(MP_SPIN_TRIES)    // load up r3 with spin counter
-3:     ldr     r2, [r0]        // load the lock
-       cmp     r2, #0          // if unlocked
-       beq     1b              // then go back to the top
-       subs    r3, r3, #1      // counter--
-       bne     3b              // if nonzero, back to 3:
-       
-       mov     r3, r0          // r0 is clobbered by the syscall return value
-       mov     r0, #0          // THREAD_NULL
-                               // SWITCH_OPTION_DEPRESS (r1==1 already)
-       mov     r2, #1          // timeout (ms)
-       mov     r12, #-61       // SYSCALL_THREAD_SWITCH
-       swi     0x80
-       mov     r0, r3          // restore state of r0
-       b       1b
-
-#if !defined(VARIANT_DYLD)
-/*
- This sucks from a code sharing PoV. The only difference in this version is
- the presence of a WFE instruction in the spin loop. This is only used on
- CPU's which get woken up regularly out of WFE waits.
-
- Additionally, completely compiled out of the dyld variant so we can easily
- use macros to pick the normal MP version for dyld on armv7 platforms.
- */
-ENTRY_POINT_RESOLVER(_spin_lock, wfe)
-ENTRY_POINT_RESOLVER(__spin_lock, wfe)
-ENTRY_POINT_RESOLVER(_OSSpinLockLock, wfe)
-       mov     r1, #1
-1:     ldrex   r2, [r0]        // load the value of [r0] into r2
-       cmp     r2, #0          // compare the lock value to zero
-       bne     2f              // jump to the spin if we don't own the lock
-       strex   r3, r1, [r0]    // try to store the one
-       cmp     r3, #0          // test to see if we stored our value
-       bne     2f              // if not, jump to the spin too
-       dmb     ish             // memory barrier if we acquired the lock
-       bx      lr              // and return
-2:     mov     r3, $(MP_SPIN_TRIES_WFE)        // load up r3 with spin counter
-3:     wfe                     // sleepy time
-       ldr     r2, [r0]        // load the lock
-       cmp     r2, #0          // if unlocked
-       beq     1b              // then go back to the top
-       subs    r3, r3, #1      // counter--
-       bne     3b              // if nonzero, back to 3:
-
-       mov     r3, r0          // r0 is clobbered by the syscall return value
-       mov     r0, #0          // THREAD_NULL
-                               // SWITCH_OPTION_DEPRESS (r1==1 already)
-       mov     r2, #1          // timeout (ms)
-       mov     r12, #-61       // SYSCALL_THREAD_SWITCH
-       swi     0x80
-       mov     r0, r3          // restore state of r0
-       b       1b
-#endif // VARIANT_DYLD
-#endif // _ARM_ARCH_7
-
-ENTRY_POINT_DEFAULT(_spin_lock, up)
-ENTRY_POINT_DEFAULT(__spin_lock, up)
-ENTRY_POINT_DEFAULT(_OSSpinLockLock, up)
-       mov     r1, #1
-1:
-#if !defined(_ARM_ARCH_7)
-       swp     r2, r1, [r0]
-       cmp     r2, #0
-#else
-       ldrex   r2, [r0]        // load the value of [r0] into r2
-       cmp     r2, #0          // compare the lock value to zero
-       bne     2f              // jump to the spin if we don't own the lock
-       strex   r3, r1, [r0]    // try to store the one
-       cmp     r3, #0          // test to see if we stored our value
-#endif // !_ARM_ARCH_6
-       bxeq    lr              // if so, return
-2:     mov     r3, r0          // r0 is clobbered by the syscall return value
-       mov     r0, #0          // THREAD_NULL
-                               // SWITCH_OPTION_DEPRESS (r1==1 already)
-       mov     r2, #1          // timeout (ms)
-       mov     r12, #-61       // SYSCALL_THREAD_SWITCH
-       swi     0x80
-       mov     r0, r3          // restore state of r0
-       b       1b
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_spin_lock_try, mp)
-ENTRY_POINT_RESOLVER(__spin_lock_try, mp)
-ENTRY_POINT_RESOLVER(_OSSpinLockTry, mp)
-       mov     r1, #1
-1:     ldrex   r2, [r0]
-       strex   r3, r1, [r0]
-       cmp     r3, #0
-       bne     1b
-       dmb     ish
-       bic     r0, r1, r2
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_spin_lock_try, up)
-ENTRY_POINT_DEFAULT(__spin_lock_try, up)
-ENTRY_POINT_DEFAULT(_OSSpinLockTry, up)
-       mov     r1, #1
-#if !defined(_ARM_ARCH_7)
-       swp     r2, r1, [r0]
-#else
-1:     ldrex   r2, [r0]
-       strex   r3, r1, [r0]
-       cmp     r3, #0
-       bne     1b
-#endif // !_ARM_ARCH_6
-       bic     r0, r1, r2
-       bx      lr
-
-/*
- * void
- * _spin_unlock(p)
- *      int *p;
- *
- * Unlock the lock pointed to by p.
- */
-
-#if defined(_ARM_ARCH_7)
-ENTRY_POINT_RESOLVER(_spin_unlock, mp)
-ENTRY_POINT_RESOLVER(__spin_unlock, mp)
-ENTRY_POINT_RESOLVER(_OSSpinLockUnlock, mp)
-       mov     r1, #0
-       dmb     ish             // barrier so that previous accesses are observed before unlock
-1:     ldrex   r2, [r0]        // load the lock to get exclusive access
-       strex   r3, r1, [r0]    // strex is instantly visible to (at least) {st,ld}rex
-       cmp     r3, #0          // did the unlock succeed?
-       bne     1b              // if not, try try again.
-       bx      lr
-#endif
-
-ENTRY_POINT_DEFAULT(_spin_unlock, up)
-ENTRY_POINT_DEFAULT(__spin_unlock, up)
-ENTRY_POINT_DEFAULT(_OSSpinLockUnlock, up)
-       mov     r1, #0
-#if !defined(_ARM_ARCH_7)
-       str     r1, [r0]
-#else
-1:     ldrex   r2, [r0]        // load the lock to get exclusive access
-       strex   r3, r1, [r0]    // store zero to the lock
-       cmp     r3, #0          // did the unlock succeed?
-       bne     1b              // if not, try try again.
-#endif // !_ARM_ARCH_6
-       bx      lr
diff --git a/arm/sys/OSAtomicUP.c b/arm/sys/OSAtomicUP.c
new file mode 100644 (file)
index 0000000..d9a24a1
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#define _OSATOMIC_NO_BARRIERS
+#include "OSAtomic.c"
index 6b26d3084d9094a978024f25f611e96e986579ab..28ad04fae96a6eb6776b3ff5138aefb230cfc43c 100644 (file)
@@ -2,14 +2,14 @@
  * Copyright (c) 2010 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
+ *
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
  * compliance with the License. Please obtain a copy of the License at
  * http://www.opensource.apple.com/apsl/ and read it before using this
  * file.
- * 
+ *
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
@@ -17,7 +17,7 @@
  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  * Please see the License for the specific language governing rights and
  * limitations under the License.
- * 
+ *
  * @APPLE_LICENSE_HEADER_END@
  */
 
  */
 
 #include <arm/arch.h>
-#if defined(_ARM_ARCH_7) && !defined(VARIANT_DYLD)
+#if defined(_ARM_ARCH_7)
 
 #include <stdlib.h>
 #include <machine/cpu_capabilities.h>
 #include <mach/machine.h>
 
+#if defined(VARIANT_DYLD)
+
+#define _STRDEF(x) __STRING(x)
+
+#define makeResolver_up_mp(name) \
+       void* name ## $VARIANT$up(void); \
+       void* name ## $VARIANT$mp(void); \
+       void* name ## Resolver(void) __asm__( "_" #name ); \
+       void* name ## Resolver(void) { \
+               __asm__ __volatile__ ( \
+                       "ldr ip, L" #name "$commpage ;" \
+                       "ldr ip, [ip] ;" \
+                       "tst ip, $(" _STRDEF(kUP) ") ;" \
+                       "bne 1f ; " \
+                       "b   _" __STRING(name) "$VARIANT$mp ;" \
+                       "1: b   _" __STRING(name) "$VARIANT$up ;" \
+                       "L" #name "$commpage: .long " _STRDEF(_COMM_PAGE_CPU_CAPABILITIES) " ;" \
+                       : : : ); \
+       }
+
+#define makeResolver_up_mp_wfe(name) makeResolver_up_mp(name)
+
+#else
+
 #define makeResolver_up_mp(name) \
        void name ## $VARIANT$up(void); \
        void name ## $VARIANT$mp(void); \
@@ -40,7 +64,7 @@
        void* name ## Resolver(void) { \
                __asm__(".symbol_resolver _" #name); \
                /* return MP variant functions on kNumCPUs > 1 */ \
-               if ((_get_cpu_capabilities() & kUP) == 0) { \
+               if ((*(uint32_t*)(uintptr_t)_COMM_PAGE_CPU_CAPABILITIES & kUP) == 0) { \
                        return name ## $VARIANT$mp; \
                } \
                return name ## $VARIANT$up; \
@@ -53,7 +77,7 @@
        void* name ## Resolver(void) __asm__( "_" #name ) ; \
        void* name ## Resolver(void) { \
                __asm__(".symbol_resolver _" #name); \
-               int caps = _get_cpu_capabilities(); \
+               uint32_t caps = *(uint32_t*)(uintptr_t)_COMM_PAGE_CPU_CAPABILITIES; \
                /* return WFE variant if we will get woken up */ \
                if ((caps & (kHasEvent | kUP)) == kHasEvent) { \
                        return name ## $VARIANT$wfe; \
                } \
                return name ## $VARIANT$up; \
        }
-       
+
+#endif // defined VARIANT_DYLD
+
 #include "OSAtomic_resolvers.h"
 
-#else // defined _ARM_ARCH_7 && !defined VARIANT_DYLD
+#else // defined _ARM_ARCH_7
 
 typedef int emptyFilesArentCFiles;
 
diff --git a/arm/sys/Spinlocks.c b/arm/sys/Spinlocks.c
new file mode 100644 (file)
index 0000000..c428e13
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include "OSAtomic.h"
+#include "../../darwin/SpinlocksLoadStoreEx.c"
diff --git a/arm/sys/SpinlocksUP.c b/arm/sys/SpinlocksUP.c
new file mode 100644 (file)
index 0000000..aa09ea5
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <arm/arch.h>
+
+// On ARMv6, the default implementation already has no barriers, no need to do it again
+#if defined(_ARM_ARCH_7)
+
+#define _OSATOMIC_NO_BARRIERS
+#include "Spinlocks.c"
+
+#endif
diff --git a/arm/sys/SpinlocksWFE.c b/arm/sys/SpinlocksWFE.c
new file mode 100644 (file)
index 0000000..2107670
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <arm/arch.h>
+
+#if defined(_ARM_ARCH_7)
+
+#define _OSATOMIC_WFE
+#include "Spinlocks.c"
+
+#endif
index d371d95431d15320cde9a6def6cc6ac4df33c4d6..0bd11ab113d24f33e2464f87a9614a7483611557 100644 (file)
@@ -36,9 +36,7 @@
             
 ENTRY_POINT(__longjmp)
        ldmia   r0!, { r4-r8, r10-r11, sp, lr }
-#ifdef _ARM_ARCH_6
-       fldmiax r0, { d8-d15 }
-#endif
+       vldmia  r0, { d8-d15 }
        movs    r0, r1
        moveq   r0, #1
        bx              lr
index b0b2dad43bb8ec3e2d623bf71b6f9bc3ae375d7d..433f8c92f0266c3ae9d342ca93b6bb810136a700 100644 (file)
@@ -34,8 +34,6 @@
 
 ENTRY_POINT(__setjmp)
        stmia   r0!, { r4-r8, r10-r11, sp, lr }
-#ifdef _ARM_ARCH_6
-       fstmiax r0, { d8-d15 }
-#endif
+       vstmia  r0, { d8-d15 }
        mov     r0, #0
        bx      lr
index 4fc25d2c7ac546da2b8b8af56590ec1349c5890a..c96820a74287ccc5b8dbf262b0b969be59e44c0c 100644 (file)
  * since the ARM GCC target does not currently support them
  */
 
-int32_t __sync_fetch_and_add_4 (int32_t *ptr, int32_t value)
+int32_t __sync_fetch_and_add_4 (int32_t *ptr, int32_t value, ...)
 {
     return OSAtomicAdd32Barrier(value, ptr) - value;
 }
 
-int32_t __sync_fetch_and_sub_4 (int32_t *ptr, int32_t value)
+int32_t __sync_fetch_and_sub_4 (int32_t *ptr, int32_t value, ...)
 {
     return OSAtomicAdd32Barrier(-value, ptr) + value;
 }
 
-uint32_t __sync_fetch_and_or_4(uint32_t *ptr, uint32_t value)
+uint32_t __sync_fetch_and_or_4(uint32_t *ptr, uint32_t value, ...)
 {
     return OSAtomicOr32OrigBarrier(value, ptr);
 }
 
-uint32_t __sync_fetch_and_and_4(uint32_t *ptr, uint32_t value)
+uint32_t __sync_fetch_and_and_4(uint32_t *ptr, uint32_t value, ...)
 {
     return OSAtomicAnd32OrigBarrier(value, ptr);
 }
 
-uint32_t __sync_fetch_and_xor_4(uint32_t *ptr, uint32_t value)
+uint32_t __sync_fetch_and_xor_4(uint32_t *ptr, uint32_t value, ...)
 {
     return OSAtomicXor32OrigBarrier(value, ptr);
 }
 
-int32_t __sync_add_and_fetch_4 (int32_t *ptr, int32_t value)
+int32_t __sync_add_and_fetch_4 (int32_t *ptr, int32_t value, ...)
 {
     return OSAtomicAdd32Barrier(value, ptr);
 }
 
-int32_t __sync_sub_and_fetch_4 (int32_t *ptr, int32_t value)
+int32_t __sync_sub_and_fetch_4 (int32_t *ptr, int32_t value, ...)
 {
     return OSAtomicAdd32Barrier(-value, ptr);
 }
 
-uint32_t __sync_or_and_fetch_4 (uint32_t *ptr, int32_t value)
+uint32_t __sync_or_and_fetch_4 (uint32_t *ptr, int32_t value, ...)
 {
     return OSAtomicOr32Barrier(value, ptr);
 }
 
-uint32_t __sync_and_and_fetch_4 (uint32_t *ptr, int32_t value)
+uint32_t __sync_and_and_fetch_4 (uint32_t *ptr, int32_t value, ...)
 {
     return OSAtomicAnd32Barrier(value, ptr);
 }
 
-uint32_t __sync_xor_and_fetch_4 (uint32_t *ptr, int32_t value)
+uint32_t __sync_xor_and_fetch_4 (uint32_t *ptr, int32_t value, ...)
 {
     return OSAtomicXor32Barrier(value, ptr);
 }
 
-bool __sync_bool_compare_and_swap_4(int32_t *ptr, int32_t oldval, int32_t newval)
+bool __sync_bool_compare_and_swap_4(int32_t *ptr, int32_t oldval, int32_t newval, ...)
 {
     return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr);
 }
 
-int32_t __sync_val_compare_and_swap_4(int32_t *ptr, int32_t oldval, int32_t newval)
+int32_t __sync_val_compare_and_swap_4(int32_t *ptr, int32_t oldval, int32_t newval, ...)
 {
     int32_t old = *ptr;
     OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr);
     return old;
 }
 
-int32_t __sync_lock_test_and_set_4(int32_t *ptr, int32_t value)
+int32_t __sync_lock_test_and_set_4(int32_t *ptr, int32_t value, ...)
 {
     int32_t old;
 
@@ -106,9 +106,15 @@ int32_t __sync_lock_test_and_set_4(int32_t *ptr, int32_t value)
     return old;
 }
 
-void __sync_lock_release_4(int32_t *ptr)
+void __sync_lock_release_4(int32_t *ptr, ...)
 {
     *ptr = 0;
 }
 
+__private_extern__
+void __sync_synchronize(void)
+{
+       OSMemoryBarrier();
+}
+
 #endif
index 2ee5dd4ce9924992764002ad8f2d0e51b41df2a2..f913d4a45f299d1562f41bc83f851be952a93b42 100644 (file)
@@ -33,14 +33,26 @@ static char sccsid[] = "@(#)creat.c 8.1 (Berkeley) 6/2/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/compat-43/creat.c,v 1.8 2007/01/09 00:27:49 imp Exp $");
 
+
 #include "namespace.h"
 #include <fcntl.h>
 #include "un-namespace.h"
 
+#ifdef VARIANT_CANCELABLE
+int __open(const char *path, int flags, mode_t mode);
+#else /* !VARIANT_CANCELABLE */
+int __open_nocancel(const char *path, int flags, mode_t mode);
+#endif /* VARIANT_CANCELABLE */
+
+
 int
 __creat(const char *path, mode_t mode)
 {
-       return(_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
+#ifdef VARIANT_CANCELABLE
+       return(__open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
+#else /* !VARIANT_CANCELABLE */
+       return(__open_nocancel(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
+#endif /* VARIANT_CANCELABLE */
 }
 __weak_reference(__creat, creat);
 __weak_reference(__creat, _creat);
diff --git a/compat-43/FreeBSD/creat.c.patch b/compat-43/FreeBSD/creat.c.patch
deleted file mode 100644 (file)
index c3bad77..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- creat.c.orig       2009-11-06 10:36:38.000000000 -0800
-+++ creat.c    2009-11-06 10:39:44.000000000 -0800
-@@ -33,14 +33,26 @@ static char sccsid[] = "@(#)creat.c        8.1 
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/compat-43/creat.c,v 1.8 2007/01/09 00:27:49 imp Exp $");
-+
- #include "namespace.h"
- #include <fcntl.h>
- #include "un-namespace.h"
-+#ifdef VARIANT_CANCELABLE
-+int __open(const char *path, int flags, mode_t mode);
-+#else /* !VARIANT_CANCELABLE */
-+int __open_nocancel(const char *path, int flags, mode_t mode);
-+#endif /* VARIANT_CANCELABLE */
-+
-+
- int
- __creat(const char *path, mode_t mode)
- {
--      return(_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
-+#ifdef VARIANT_CANCELABLE
-+      return(__open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
-+#else /* !VARIANT_CANCELABLE */
-+      return(__open_nocancel(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
-+#endif /* VARIANT_CANCELABLE */
- }
- __weak_reference(__creat, creat);
- __weak_reference(__creat, _creat);
index 472dca641d9dfbf98d4597244684b51b67ced0a1..e93832032e3c87f8a9d67d2bf4a13887256410d7 100644 (file)
 The
 .Fn sethostid
 function
-establishes a 32-bit identifier for the
-current processor that is intended to be unique among all
-UNIX systems in existence.
-This is normally a DARPA Internet
-address for the local machine.
+establishes a 32-bit identifier for the current processor.
+The id, intended to be unique among all UNIX systems in existence,
+is normally a DARPA Internet address for the local machine.
 This call is allowed only to the
 super-user and is normally performed at boot time.
 .Pp
diff --git a/compat-43/FreeBSD/gethostid.3.patch b/compat-43/FreeBSD/gethostid.3.patch
deleted file mode 100644 (file)
index 184729b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
---- gethostid.3.orig   2009-11-06 10:36:38.000000000 -0800
-+++ gethostid.3        2009-11-06 10:41:15.000000000 -0800
-@@ -47,11 +47,9 @@
- The
- .Fn sethostid
- function
--establishes a 32-bit identifier for the
--current processor that is intended to be unique among all
--UNIX systems in existence.
--This is normally a DARPA Internet
--address for the local machine.
-+establishes a 32-bit identifier for the current processor.
-+The id, intended to be unique among all UNIX systems in existence,
-+is normally a DARPA Internet address for the local machine.
- This call is allowed only to the
- super-user and is normally performed at boot time.
- .Pp
index 3a7da2224f5c768b1a24d6c309779a72ff781076..5f77a9b20fc50ac8be6d04a8ad3b230e8af363bf 100644 (file)
@@ -43,7 +43,7 @@ gethostid(void)
 {
        int mib[2];
        size_t size;
-       long value;
+       int value;
 
        mib[0] = CTL_KERN;
        mib[1] = KERN_HOSTID;
diff --git a/compat-43/FreeBSD/gethostid.c.patch b/compat-43/FreeBSD/gethostid.c.patch
deleted file mode 100644 (file)
index 29aa613..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- gethostid.c.orig   2011-02-15 16:30:07.000000000 -0800
-+++ gethostid.c        2011-02-18 12:19:33.000000000 -0800
-@@ -43,7 +43,7 @@ gethostid(void)
- {
-       int mib[2];
-       size_t size;
--      long value;
-+      int value;
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_HOSTID;
index 97bc9b11994524191b4519e203d8746c809b01e2..2518ab904b088ee42afe4aed7a7579e90f413774 100644 (file)
@@ -37,7 +37,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
 .In signal.h
 .Ft int
 .Fn killpg "pid_t pgrp" "int sig"
@@ -76,21 +75,29 @@ The
 .Fa sig
 argument
 is not a valid signal number.
+.It Bq Er EPERM
+The sending process is not the super-user and one or more
+of the target processes has an effective user ID different from that
+of the sending process.
 .It Bq Er ESRCH
 No process can be found in the process group specified by
 .Fa pgrp .
 .It Bq Er ESRCH
 The process group was given as 0
 but the sending process does not have a process group.
-.It Bq Er EPERM
-The sending process is not the super-user and one or more
-of the target processes has an effective user ID different from that
-of the sending process.
 .El
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <signal.h>
+.Pp
+The include file
+.In sys/types.h
+is necessary.
 .Sh SEE ALSO
 .Xr getpgrp 2 ,
 .Xr kill 2 ,
-.Xr sigaction 2
+.Xr sigaction 2 ,
+.Xr compat 5
 .Sh HISTORY
 The
 .Fn killpg
diff --git a/compat-43/FreeBSD/killpg.2.patch b/compat-43/FreeBSD/killpg.2.patch
deleted file mode 100644 (file)
index 8a00461..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
---- killpg.2.orig      2009-11-06 10:36:38.000000000 -0800
-+++ killpg.2   2009-11-06 10:41:32.000000000 -0800
-@@ -37,7 +37,6 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In sys/types.h
- .In signal.h
- .Ft int
- .Fn killpg "pid_t pgrp" "int sig"
-@@ -76,21 +75,29 @@ The
- .Fa sig
- argument
- is not a valid signal number.
-+.It Bq Er EPERM
-+The sending process is not the super-user and one or more
-+of the target processes has an effective user ID different from that
-+of the sending process.
- .It Bq Er ESRCH
- No process can be found in the process group specified by
- .Fa pgrp .
- .It Bq Er ESRCH
- The process group was given as 0
- but the sending process does not have a process group.
--.It Bq Er EPERM
--The sending process is not the super-user and one or more
--of the target processes has an effective user ID different from that
--of the sending process.
- .El
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/types.h>
-+.Fd #include <signal.h>
-+.Pp
-+The include file
-+.In sys/types.h
-+is necessary.
- .Sh SEE ALSO
- .Xr getpgrp 2 ,
- .Xr kill 2 ,
--.Xr sigaction 2
-+.Xr sigaction 2 ,
-+.Xr compat 5
- .Sh HISTORY
- The
- .Fn killpg
index ca8097e3aa747c9ca0ece8f2c95a71d4172c0175..d66425bf57d508e92033e1031e52d261b604c1d7 100644 (file)
@@ -37,6 +37,16 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-43/killpg.c,v 1.5 2007/01/09 00:27:49 im
 #include <signal.h>
 #include <errno.h>
 
+int __kill(pid_t pid, int sig, int posix);
+
+#if __DARWIN_UNIX03
+#define        _PID1ERR        EPERM
+#define        _POSIXKILL      1
+#else  /* !__DARWIN_UNIX03 */
+#define        _PID1ERR        ESRCH
+#define        _POSIXKILL      0
+#endif /* !__DARWIN_UNIX03 */
+
 /*
  * Backwards-compatible killpg().
  */
@@ -44,8 +54,8 @@ int
 killpg(pid_t pgid, int sig)
 {
        if (pgid == 1) {
-               errno = ESRCH;
+               errno = _PID1ERR;
                return (-1);
        }
-       return (kill(-pgid, sig));
+       return (__kill(-pgid, sig, _POSIXKILL));
 }
diff --git a/compat-43/FreeBSD/killpg.c.patch b/compat-43/FreeBSD/killpg.c.patch
deleted file mode 100644 (file)
index 6c18982..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- killpg.c.orig      2009-11-06 10:36:38.000000000 -0800
-+++ killpg.c   2009-11-06 10:41:47.000000000 -0800
-@@ -37,6 +37,16 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-
- #include <signal.h>
- #include <errno.h>
-+int __kill(pid_t pid, int sig, int posix);
-+
-+#if __DARWIN_UNIX03
-+#define       _PID1ERR        EPERM
-+#define       _POSIXKILL      1
-+#else /* !__DARWIN_UNIX03 */
-+#define       _PID1ERR        ESRCH
-+#define       _POSIXKILL      0
-+#endif        /* !__DARWIN_UNIX03 */
-+
- /*
-  * Backwards-compatible killpg().
-  */
-@@ -44,8 +54,8 @@ int
- killpg(pid_t pgid, int sig)
- {
-       if (pgid == 1) {
--              errno = ESRCH;
-+              errno = _PID1ERR;
-               return (-1);
-       }
--      return (kill(-pgid, sig));
-+      return (__kill(-pgid, sig, _POSIXKILL));
- }
index 011f7bc580f4c1a2dadfcc9e8d197f2e4491cd62..ebed79a40b842b1eb0dd70a854c4d2283e508ddf 100644 (file)
@@ -36,8 +36,13 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-43/setpgrp.c,v 1.5 2007/01/09 00:27:49 i
 #include <sys/types.h>
 #include <unistd.h>
 
-int
-setpgrp(pid_t pid, pid_t pgid)
+/* UNIX03 only */
+pid_t
+setpgrp(void)
 {
-       return(setpgid(pid, pgid));
+       pid_t pgid = getpgrp();
+       pid_t pid = getpid();
+       if (pgid != pid)
+           setpgid(pid, pid);
+       return pid;
 }
diff --git a/compat-43/FreeBSD/setpgrp.c.patch b/compat-43/FreeBSD/setpgrp.c.patch
deleted file mode 100644 (file)
index 3b8c176..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- setpgrp.c.orig     2009-11-06 10:36:38.000000000 -0800
-+++ setpgrp.c  2009-11-06 10:42:14.000000000 -0800
-@@ -36,8 +36,13 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-
- #include <sys/types.h>
- #include <unistd.h>
--int
--setpgrp(pid_t pid, pid_t pgid)
-+/* UNIX03 only */
-+pid_t
-+setpgrp(void)
- {
--      return(setpgid(pid, pgid));
-+      pid_t pgid = getpgrp();
-+      pid_t pid = getpid();
-+      if (pgid != pid)
-+          setpgid(pid, pid);
-+      return pid;
- }
diff --git a/compat-43/Makefile.inc b/compat-43/Makefile.inc
deleted file mode 100644 (file)
index f1bf890..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#      @(#)Makefile.inc        8.1 (Berkeley) 6/2/93
-# $FreeBSD: src/lib/libc/compat-43/Makefile.inc,v 1.11 2001/03/27 17:26:46 ru Exp $
-
-# compat-43 sources
-.PATH: ${.CURDIR}/${MACHINE_ARCH}/compat-43 ${.CURDIR}/compat-43
-CWD := ${.CURDIR}/compat-43
-
-MISRCS+= sigaltstk.c sigcompat.c
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= creat.c gethostid.c getwd.c killpg.c sethostid.c setpgrp.c \
-       setrgid.c setruid.c
-.include "Makefile.fbsd_end"
-
-LEGACYSRCS += creat.c setregid.c setreuid.c sigcompat.c killpg.c
-CANCELABLESRCS += creat.c sigcompat.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-creat-fbsd.c += -DLIBC_ALIAS_CREAT
-CFLAGS-setregid.c += -DLIBC_ALIAS_SETREGID
-CFLAGS-setreuid.c += -DLIBC_ALIAS_SETREUID
-CFLAGS-setpgrp-fbsd.c += -DLIBC_ALIAS_SETPGRP
-CFLAGS-sigcompat.c += -DLIBC_ALIAS_SIGPAUSE
-CFLAGS-killpg-fbsd.c += -DLIBC_ALIAS_KILLPG
-CFLAGS-sigaltstk.c += -DLIBC_ALIAS_SIGALTSTACK
-
-.if ${LIB} == "c"
-MAN2+= sigblock.2 sigpause.2 sigsetmask.2 sigvec.2
-
-.include "Makefile.fbsd_begin"
-FBSDMAN2= creat.2 killpg.2
-FBSDMAN3= gethostid.3 setruid.3
-.include "Makefile.fbsd_end"
-
-MLINKS+= gethostid.3 sethostid.3
-
-MLINKS+= setruid.3 setrgid.3
-
-MLINKS+= sigsetmask.2 sigmask.2
-
-.endif
diff --git a/compat-43/creat-fbsd.c b/compat-43/creat-fbsd.c
deleted file mode 100644 (file)
index f913d4a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)creat.c    8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/compat-43/creat.c,v 1.8 2007/01/09 00:27:49 imp Exp $");
-
-
-#include "namespace.h"
-#include <fcntl.h>
-#include "un-namespace.h"
-
-#ifdef VARIANT_CANCELABLE
-int __open(const char *path, int flags, mode_t mode);
-#else /* !VARIANT_CANCELABLE */
-int __open_nocancel(const char *path, int flags, mode_t mode);
-#endif /* VARIANT_CANCELABLE */
-
-
-int
-__creat(const char *path, mode_t mode)
-{
-#ifdef VARIANT_CANCELABLE
-       return(__open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
-#else /* !VARIANT_CANCELABLE */
-       return(__open_nocancel(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
-#endif /* VARIANT_CANCELABLE */
-}
-__weak_reference(__creat, creat);
-__weak_reference(__creat, _creat);
diff --git a/compat-43/creat.2 b/compat-43/creat.2
deleted file mode 120000 (symlink)
index 3904d0d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./creat.2
\ No newline at end of file
diff --git a/compat-43/gethostid-fbsd.c b/compat-43/gethostid-fbsd.c
deleted file mode 100644 (file)
index 5f77a9b..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostid.c        8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/compat-43/gethostid.c,v 1.5 2007/01/09 00:27:49 imp Exp $");
-
-#include <sys/param.h>
-#include <sys/sysctl.h>
-
-#include <unistd.h>
-
-long
-gethostid(void)
-{
-       int mib[2];
-       size_t size;
-       int value;
-
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_HOSTID;
-       size = sizeof value;
-       if (sysctl(mib, 2, &value, &size, NULL, 0) == -1)
-               return (-1);
-       return (value);
-}
diff --git a/compat-43/gethostid.3 b/compat-43/gethostid.3
deleted file mode 100644 (file)
index e938320..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)gethostid.3        8.1 (Berkeley) 6/2/93
-.\" $FreeBSD: src/lib/libc/compat-43/gethostid.3,v 1.14 2007/01/09 00:27:49 imp Exp $
-.\"
-.Dd June 2, 1993
-.Dt GETHOSTID 3
-.Os
-.Sh NAME
-.Nm gethostid ,
-.Nm sethostid
-.Nd get/set unique identifier of current host
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft long
-.Fn gethostid void
-.Ft void
-.Fn sethostid "long hostid"
-.Sh DESCRIPTION
-The
-.Fn sethostid
-function
-establishes a 32-bit identifier for the current processor.
-The id, intended to be unique among all UNIX systems in existence,
-is normally a DARPA Internet address for the local machine.
-This call is allowed only to the
-super-user and is normally performed at boot time.
-.Pp
-The
-.Fn gethostid
-function
-returns the 32-bit identifier for the current processor.
-.Pp
-This function has been deprecated.
-The hostid should be set or retrieved by use of
-.Xr sysctl 3 .
-.Sh SEE ALSO
-.Xr gethostname 3 ,
-.Xr sysctl 3 ,
-.Xr sysctl 8
-.Sh HISTORY
-The
-.Fn gethostid
-and
-.Fn sethostid
-syscalls appeared in
-.Bx 4.2
-and were dropped in
-.Bx 4.4 .
-.Sh BUGS
-32 bits for the identifier is too small.
diff --git a/compat-43/getwd-fbsd.c b/compat-43/getwd-fbsd.c
deleted file mode 120000 (symlink)
index cee67a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getwd.c
\ No newline at end of file
diff --git a/compat-43/killpg-fbsd.c b/compat-43/killpg-fbsd.c
deleted file mode 100644 (file)
index d66425b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)killpg.c   8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/compat-43/killpg.c,v 1.5 2007/01/09 00:27:49 imp Exp $");
-
-#include <sys/types.h>
-#include <signal.h>
-#include <errno.h>
-
-int __kill(pid_t pid, int sig, int posix);
-
-#if __DARWIN_UNIX03
-#define        _PID1ERR        EPERM
-#define        _POSIXKILL      1
-#else  /* !__DARWIN_UNIX03 */
-#define        _PID1ERR        ESRCH
-#define        _POSIXKILL      0
-#endif /* !__DARWIN_UNIX03 */
-
-/*
- * Backwards-compatible killpg().
- */
-int
-killpg(pid_t pgid, int sig)
-{
-       if (pgid == 1) {
-               errno = _PID1ERR;
-               return (-1);
-       }
-       return (__kill(-pgid, sig, _POSIXKILL));
-}
diff --git a/compat-43/killpg.2 b/compat-43/killpg.2
deleted file mode 100644 (file)
index 2518ab9..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)killpg.2   8.1 (Berkeley) 6/2/93
-.\" $FreeBSD: src/lib/libc/compat-43/killpg.2,v 1.14 2007/01/09 00:27:49 imp Exp $
-.\"
-.Dd October 10, 2006
-.Dt KILLPG 2
-.Os
-.Sh NAME
-.Nm killpg
-.Nd send signal to a process group
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn killpg "pid_t pgrp" "int sig"
-.Sh DESCRIPTION
-The
-.Fn killpg
-function
-sends the signal
-.Fa sig
-to the process group
-.Fa pgrp .
-See
-.Xr sigaction 2
-for a list of signals.
-If
-.Fa pgrp
-is 0,
-.Fn killpg
-sends the signal to the sending process's process group.
-.Pp
-The sending process and members of the process group must
-have the same effective user ID, or
-the sender must be the super-user.
-As a single special case the continue signal SIGCONT may be sent
-to any process with the same session ID as the caller.
-.Sh RETURN VALUES
-.Rv -std killpg
-.Sh ERRORS
-The
-.Fn killpg
-function
-will fail and no signal will be sent if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa sig
-argument
-is not a valid signal number.
-.It Bq Er EPERM
-The sending process is not the super-user and one or more
-of the target processes has an effective user ID different from that
-of the sending process.
-.It Bq Er ESRCH
-No process can be found in the process group specified by
-.Fa pgrp .
-.It Bq Er ESRCH
-The process group was given as 0
-but the sending process does not have a process group.
-.El
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <signal.h>
-.Pp
-The include file
-.In sys/types.h
-is necessary.
-.Sh SEE ALSO
-.Xr getpgrp 2 ,
-.Xr kill 2 ,
-.Xr sigaction 2 ,
-.Xr compat 5
-.Sh HISTORY
-The
-.Fn killpg
-function appeared in
-.Bx 4.0 .
diff --git a/compat-43/sethostid-fbsd.c b/compat-43/sethostid-fbsd.c
deleted file mode 120000 (symlink)
index 4754530..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./sethostid.c
\ No newline at end of file
diff --git a/compat-43/setpgrp-fbsd.c b/compat-43/setpgrp-fbsd.c
deleted file mode 100644 (file)
index ebed79a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setpgrp.c  8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/compat-43/setpgrp.c,v 1.5 2007/01/09 00:27:49 imp Exp $");
-
-#include <sys/types.h>
-#include <unistd.h>
-
-/* UNIX03 only */
-pid_t
-setpgrp(void)
-{
-       pid_t pgid = getpgrp();
-       pid_t pid = getpid();
-       if (pgid != pid)
-           setpgid(pid, pid);
-       return pid;
-}
diff --git a/compat-43/setrgid-fbsd.c b/compat-43/setrgid-fbsd.c
deleted file mode 120000 (symlink)
index 5734593..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setrgid.c
\ No newline at end of file
diff --git a/compat-43/setruid-fbsd.c b/compat-43/setruid-fbsd.c
deleted file mode 120000 (symlink)
index b76fe9c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setruid.c
\ No newline at end of file
diff --git a/compat-43/setruid.3 b/compat-43/setruid.3
deleted file mode 120000 (symlink)
index dde144b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setruid.3
\ No newline at end of file
diff --git a/darwin/Makefile.inc b/darwin/Makefile.inc
deleted file mode 100644 (file)
index b83c1fe..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-.PATH: ${.CURDIR}/darwin
-
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/darwin/Makefile.inc"
-
-DARWINMIGDEFS += dirhelper.defs
-DARWINMIGHDRS += ${DARWINMIGDEFS:.defs=.h}
-DARWINMIGSRCS += ${DARWINMIGDEFS:.defs=User.c}
-
-INSTHDRS += ${.CURDIR}/darwin/libproc.h
-
-LOCALHDRS += ${.CURDIR}/darwin/dirhelper.defs \
-       ${.CURDIR}/darwin/dirhelper_priv.h \
-       ${.CURDIR}/darwin/libproc.h \
-       ${.CURDIR}/darwin/libproc_internal.h 
-MISRCS += ${DARWINMIGSRCS} _dirhelper.c libproc.c proc_listpidspath.c
-
-.ifndef LP64
-MISRCS += kvm.c MKGetTimeBaseInfo.c
-.endif
-
-# force building of the mig stuff before _dirhelper.c
-_dirhelper.${OBJSUFFIX}: dirhelperUser.c
-
-CFLAGS-proc_listpidspath.c += -I${.CURDIR}/darwin
diff --git a/darwin/OSAtomicLoadStoreEx.c b/darwin/OSAtomicLoadStoreEx.c
new file mode 100644 (file)
index 0000000..75d008b
--- /dev/null
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+// OSAtomic.h is included by files that include this C file.
+/* #include "OSAtomic.h" */
+
+int32_t OSAtomicAdd32(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicAdd32);
+int32_t OSAtomicAdd32(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicAdd32);
+       int32_t r;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               r += v;
+               _osatomic_store_exclusive(p, r, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int64_t OSAtomicAdd64(int64_t v, volatile int64_t *p) _OSATOMIC_VARIANT_B(OSAtomicAdd64);
+int64_t OSAtomicAdd64(int64_t v, volatile int64_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicAdd64);
+
+       int64_t r;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive64(p, r);
+               r += v;
+               _osatomic_store_exclusive64(p, r, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int32_t OSAtomicOr32(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicOr32);
+int32_t OSAtomicOr32(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicOr32);
+       int32_t r;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               r |= v;
+               _osatomic_store_exclusive(p, r, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int32_t OSAtomicOr32Orig(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicOr32Orig);
+int32_t OSAtomicOr32Orig(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicOr32Orig);
+       int32_t r, n;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               n = r | v;
+               _osatomic_store_exclusive(p, n, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int32_t OSAtomicAnd32(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicAnd32);
+int32_t OSAtomicAnd32(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicAnd32);
+       int32_t r;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               r &= v;
+               _osatomic_store_exclusive(p, r, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int32_t OSAtomicAnd32Orig(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicAnd32Orig);
+int32_t OSAtomicAnd32Orig(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicAnd32Orig);
+       int32_t r, n;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               n = r & v;
+               _osatomic_store_exclusive(p, n, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int32_t OSAtomicXor32(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicXor32);
+int32_t OSAtomicXor32(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicXor32);
+       int32_t r;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               r ^= v;
+               _osatomic_store_exclusive(p, r, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+int32_t OSAtomicXor32Orig(int32_t v, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicXor32Orig);
+int32_t OSAtomicXor32Orig(int32_t v, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicXor32Orig);
+       int32_t r, n;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(p, r);
+               n = r ^ v;
+               _osatomic_store_exclusive(p, n, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+bool OSAtomicCompareAndSwap32(int32_t o, int32_t n, volatile int32_t *p) _OSATOMIC_VARIANT_B(OSAtomicCompareAndSwap32);
+bool OSAtomicCompareAndSwap32(int32_t o, int32_t n, volatile int32_t *p)
+{
+       _OSATOMIC_ALIAS_B(OSAtomicCompareAndSwapInt, OSAtomicCompareAndSwap32);
+
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwap32);
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwapInt);
+#ifndef __LP64__
+       _OSATOMIC_ALIAS_B(OSAtomicCompareAndSwapLong, OSAtomicCompareAndSwap32);
+       _OSATOMIC_ALIAS_B(OSAtomicCompareAndSwapPtr, OSAtomicCompareAndSwap32);
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwapLong);
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwapPtr);
+#endif
+
+       int32_t r;
+       uint32_t t;
+
+       do {
+               _osatomic_load_exclusive(p, r);
+               if (r != o) return false;
+               _osatomic_store_barrier();
+               _osatomic_store_exclusive(p, n, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return true;
+}
+
+bool OSAtomicCompareAndSwap64(int64_t o, int64_t n, volatile int64_t *p) _OSATOMIC_VARIANT_B(OSAtomicCompareAndSwap64);
+bool OSAtomicCompareAndSwap64(int64_t o, int64_t n, volatile int64_t *p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwap64);
+#ifdef __LP64__
+       _OSATOMIC_ALIAS_B(OSAtomicCompareAndSwapLong, OSAtomicCompareAndSwap64);
+       _OSATOMIC_ALIAS_B(OSAtomicCompareAndSwapPtr, OSAtomicCompareAndSwap64);
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwapLong);
+       _OSATOMIC_ALIAS_NB(OSAtomicCompareAndSwapPtr);
+#endif
+
+       int64_t r;
+       uint32_t t;
+
+       do {
+               _osatomic_load_exclusive64(p, r);
+               if (r != o) return false;
+               _osatomic_store_barrier();
+               _osatomic_store_exclusive64(p, n, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return true;
+}
+
+#if defined(_OSATOMIC_EXTRAS)
+
+void OSMemoryBarrier(void) _OSATOMIC_VARIANT(OSMemoryBarrier);
+void OSMemoryBarrier(void)
+{
+       _osatomic_barrier();
+}
+
+typedef volatile struct {
+       void    *item;
+       long     unused;
+} OSQueueHead;
+
+void OSAtomicEnqueue(OSQueueHead *l, void *n, size_t o) _OSATOMIC_VARIANT(OSAtomicEnqueue);
+void OSAtomicEnqueue(OSQueueHead *l, void *n, size_t o)
+{
+       void ** r = (void **)((char *)n + o);
+       void * volatile * i = (void **)&(l->item);
+       void * q;
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(i, q);
+               *r = q;
+               _osatomic_store_exclusive(i, n, t);
+       } while (slowpath(t));
+       _osatomic_barrier();
+}
+
+void* OSAtomicDequeue(OSQueueHead *l, size_t o) _OSATOMIC_VARIANT(OSAtomicDequeue);
+void* OSAtomicDequeue(OSQueueHead *l, size_t o)
+{
+       void * h;
+       void ** r;
+       void * volatile * i = (void **)&(l->item);
+       uint32_t t;
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(i, r);
+               if (!r) return NULL;
+               h = *(void **)((char *)r + o);
+               _osatomic_store_exclusive(i, h, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return r;
+}
+
+#endif
+
+bool OSAtomicTestAndSet(uint32_t n, volatile void * p) _OSATOMIC_VARIANT_B(OSAtomicTestAndSet);
+bool OSAtomicTestAndSet(uint32_t n, volatile void * p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicTestAndSet);
+       uint32_t * ptr = (uint32_t *)((char *)p + (4 * (n / 32)));
+       uint32_t i, r, t;
+
+       n = (0x80 >> (n & 7)) << (n & ~7 & 31);
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(ptr, r);
+               i = r | n;
+               if (i == r) break;
+               _osatomic_store_exclusive(ptr, i, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return ((r & n) != 0);
+}
+
+bool OSAtomicTestAndClear(uint32_t n, volatile void * p) _OSATOMIC_VARIANT_B(OSAtomicTestAndClear);
+bool OSAtomicTestAndClear(uint32_t n, volatile void * p)
+{
+       _OSATOMIC_ALIAS_NB(OSAtomicTestAndClear);
+       uint32_t * ptr = (uint32_t *)((char *)p + (4 * (n / 32)));
+       uint32_t i, r, t;
+
+       n = (0x80 >> (n & 7)) << (n & ~7 & 31);
+
+       _osatomic_store_barrier();
+       do {
+               _osatomic_load_exclusive(ptr, r);
+               i = r & ~n;
+               if (i == r) break;
+               _osatomic_store_exclusive(ptr, i, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return ((r & n) != 0);
+}
+
diff --git a/darwin/SpinlocksLoadStoreEx.c b/darwin/SpinlocksLoadStoreEx.c
new file mode 100644 (file)
index 0000000..a991ba0
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+// OSAtomic.h is included by files that include this C file.
+/* #include "OSAtomic.h" */
+
+typedef int32_t OSSpinLock;
+
+/*
+ * Bear with me, there's method to this madness. clang actually produces more optimal
+ * fastpath code if the lock code is split in half like this.
+ *
+ * Once we're spinning in userspace/kernel like this then we can be more lenient about
+ * how much effort is spent doing the spin. Where the lock is uncontended, this split
+ * arrangement produces a very good fastpath at the cost of some code duplication.
+ *
+ * Similarly, the gotos produce less wasteful code during spins then the equivalent code
+ * defined with loops.
+ */
+
+#import <mach/mach_traps.h>
+
+static inline void _OSSpinLockSlow(volatile OSSpinLock * lock) _OSATOMIC_VARIANT(_OSSpinLockSlow);
+static inline void _OSSpinLockSlow(volatile OSSpinLock * lock)
+{
+       int32_t r;
+       uint32_t t;
+
+_spin: ;
+#if (defined(_ARM_ARCH_7) && !defined(_OSATOMIC_NO_BARRIERS))
+       uint32_t tries = MP_SPIN_TRIES;
+       do {
+               if (*lock == 0) goto _try_store;
+               _osatomic_pause();
+       } while (--tries);
+#endif
+
+       __asm__ ("mov   r0, %[_a] ;"
+                        "mov   r1, %[_b] ;"
+                        "mov   r2, %[_c] ;"
+                        "bl    _syscall_thread_switch ;"
+                        : : [_a] "i" (0), [_b] "i" (1), [_c] "i" (1)
+                        : "r0", "r1", "r2", "r9", "r12", "lr" );
+
+_try_store:
+       do {
+               _osatomic_load_exclusive(lock, r);
+               if (slowpath(r)) goto _spin;
+               _osatomic_store_exclusive(lock, 1, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+}
+
+void OSSpinLockLock(volatile OSSpinLock * lock) _OSATOMIC_VARIANT(OSSpinLockLock);
+void OSSpinLockLock(volatile OSSpinLock * lock)
+{
+       _OSATOMIC_ALIAS(spin_lock, OSSpinLockLock);
+       _OSATOMIC_ALIAS(_spin_lock, OSSpinLockLock);
+
+       int32_t r;
+       uint32_t t;
+
+       do {
+               _osatomic_load_exclusive(lock, r);
+               if (slowpath(r)) return _OSSpinLockSlow(lock);
+               _osatomic_store_exclusive(lock, 1, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+}
+
+#ifndef _OSATOMIC_WFE
+
+bool OSSpinLockTry(OSSpinLock * lock) _OSATOMIC_VARIANT(OSSpinLockTry);
+bool OSSpinLockTry(OSSpinLock * lock)
+{
+       _OSATOMIC_ALIAS(spin_lock_try, OSSpinLockTry);
+       _OSATOMIC_ALIAS(_spin_lock_try, OSSpinLockTry);
+
+       int32_t r;
+       uint32_t t;
+
+       do {
+               _osatomic_load_exclusive(lock, r);
+               if (slowpath(r)) return false;
+               _osatomic_store_exclusive(lock, 1, t);
+       } while (slowpath(t));
+
+       _osatomic_barrier();
+       return (r == 0);
+}
+
+void OSSpinLockUnlock(OSSpinLock * lock) _OSATOMIC_VARIANT(OSSpinLockUnlock);
+void OSSpinLockUnlock(OSSpinLock * lock)
+{
+       _OSATOMIC_ALIAS(spin_unlock, OSSpinLockUnlock);
+       _OSATOMIC_ALIAS(_spin_unlock, OSSpinLockUnlock);
+
+       _osatomic_barrier();
+       *lock = 0;
+}
+
+#endif // _OSATOMIC_WFE
index bfd9959211c4e2918a6c6a68c5a94e265a855705..04749f660a0311e468e9d4fa8eec936932d6e43c 100644 (file)
@@ -130,7 +130,7 @@ encode_uuid_uid(const uuid_t uuid, uid_t uid, char *str)
 char *
 __user_local_dirname(uid_t uid, dirhelper_which_t which, char *path, size_t pathlen)
 {
-#if TARGET_OS_EMBEDDED
+#if TARGET_OS_IPHONE
     char *tmpdir;
 #else
     uuid_t uuid;
@@ -143,7 +143,7 @@ __user_local_dirname(uid_t uid, dirhelper_which_t which, char *path, size_t path
        return NULL;
     }
 
-#if TARGET_OS_EMBEDDED
+#if TARGET_OS_IPHONE
     /* We only support DIRHELPER_USER_LOCAL_TEMP on embedded.
      * This interface really doesn't map from OSX to embedded,
      * and clients of this interface will need to adapt when
@@ -304,20 +304,22 @@ _dirhelper(dirhelper_which_t which, char *path, size_t pathlen)
     strcat(path, subdirs[which]);
 
     /*
-     * now for subdirectories, create it with the appropriate permissions
-     * if it doesn't already exist. On OS X, if we're under App Sandbox, we
-     * rely on xpchelper having created the subdir for us.
+     * create the subdir with the appropriate permissions if it doesn't already
+     * exist. On OS X, if we're under App Sandbox, we rely on the subdir having
+     * been already created for us.
      */
-#if !TARGET_OS_EMBEDDED
+#if !TARGET_OS_IPHONE
     if (!_xpc_runtime_is_app_sandboxed())
 #endif
     if(mkdir(path, modes[which]) != 0 && errno != EEXIST)
         return NULL;
 
-#if !TARGET_OS_EMBEDDED
+#if !TARGET_OS_IPHONE
+    char *userdir_suffix = NULL;
+
     if (_xpc_runtime_is_app_sandboxed()) {
         /*
-         * if xpchelper didn't make the subdir for us, bail since we don't have
+         * if the subdir wasn't made for us, bail since we probably don't have
          * permission to create it ourselves.
          */
         if(stat(path, &sb) < 0) {
@@ -329,29 +331,41 @@ _dirhelper(dirhelper_which_t which, char *path, size_t pathlen)
          * sandboxed applications get per-application directories named
          * after the container
          */
-        char *container_id = getenv(XPC_ENV_SANDBOX_CONTAINER_ID);
-        if(!container_id) {
+        userdir_suffix = getenv(XPC_ENV_SANDBOX_CONTAINER_ID);
+        if (!userdir_suffix) {
             errno = EINVAL;
             return NULL;
         }
+    } else
+        userdir_suffix = getenv(DIRHELPER_ENV_USER_DIR_SUFFIX);
 
+    if (userdir_suffix) {
         /*
-         * container ID doesn't end in a slash, so +2 is for slash and \0
+         * suffix (usually container ID) doesn't end in a slash, so +2 is for slash and \0
          */
-        if (pathlen < strlen(path) + strlen(container_id) + 2) {
+        if (pathlen < strlen(path) + strlen(userdir_suffix) + 2) {
             errno = EINVAL;
             return NULL; /* buffer too small */
         }
 
-        strcat(path, container_id);
+        strcat(path, userdir_suffix);
         strcat(path, "/");
 
         /*
-         * create per-app subdirectory with the appropriate permissions
+         * create suffix subdirectory with the appropriate permissions
          * if it doesn't already exist.
          */
-        if(mkdir(path, modes[which]) != 0 && errno != EEXIST)
+        if (mkdir(path, modes[which]) != 0 && errno != EEXIST)
             return NULL;
+
+        /*
+         * update TMPDIR if necessary
+         */
+        if (which == DIRHELPER_USER_LOCAL_TEMP) {
+            char *tmpdir = getenv("TMPDIR");
+            if (!tmpdir || strncmp(tmpdir, path, strlen(path)))
+                setenv("TMPDIR", path, 1);
+        }
     }
 #endif
 
index cf2ae3c1201874621a2eb5795b3da370a3918d0f..bbb7aec26f0f24bccf34f5a5154b74e208bdd631 100644 (file)
@@ -33,6 +33,7 @@
 #define DIRHELPER_CACHE_STR            "C/"
 #define DIRHELPER_TEMP_STR             "T/"
 #define DIRHELPER_TOP_STR              "0/"
+#define DIRHELPER_ENV_USER_DIR_SUFFIX  "DIRHELPER_USER_DIR_SUFFIX"
 
 typedef enum {
     DIRHELPER_USER_LOCAL = 0,
diff --git a/darwin/forceLibcToBuild.c b/darwin/forceLibcToBuild.c
new file mode 100644 (file)
index 0000000..9b0b97c
--- /dev/null
@@ -0,0 +1,6 @@
+//  XCode will not build a library unless it contains at least one module.
+//  Absent this requirement, libm.dylib would be composed entirely by linking
+//  the component static libraries together, but to satisfy it, we must have
+//  a C file.
+
+typedef int theCStandardDoesNotAllowAnEmptyModule;
index 0b6eb47ee852d590653305bfca629b748c4fe5ab..9879aaafe9a77c87ddd887fa4b7fd656fa4ff701 100644 (file)
@@ -248,6 +248,64 @@ proc_setthreadname(void * buffer, int buffersize)
                return(0);
 }
 
+int
+proc_track_dirty(pid_t pid, uint32_t flags)
+{
+       if (__proc_info(8, pid, PROC_DIRTYCONTROL_TRACK, flags, NULL, 0) == -1) {
+               return errno;
+       }
+               
+       return 0;
+}
+
+int
+proc_set_dirty(pid_t pid, bool dirty)
+{
+       if (__proc_info(8, pid, PROC_DIRTYCONTROL_SET, dirty, NULL, 0) == -1) {
+               return errno;           
+       }
+
+       return 0;
+}
+
+int
+proc_get_dirty(pid_t pid, uint32_t *flags)
+{
+       int retval;
+       
+       if (!flags) {
+               return EINVAL;
+       }
+       
+       retval = __proc_info(8, pid, PROC_DIRTYCONTROL_GET, 0, NULL, 0);
+       if (retval == -1) {
+               return errno;           
+       }
+       
+       *flags = retval;
+
+       return 0;
+}
+
+int
+proc_terminate(pid_t pid, int *sig)
+{
+       int retval;
+       
+       if (!sig) {
+               return EINVAL;
+       }
+       
+       retval = __proc_info(7, pid, 0, 0, NULL, 0);
+       if (retval == -1) {
+               return errno;           
+       }
+       
+       *sig = retval;
+       
+       return 0;
+}
+
 #if TARGET_OS_EMBEDDED
 
 int 
@@ -406,6 +464,30 @@ proc_set_owner_vmpressure(void)
        return(0);
 }
 
+/* mark yourself to delay idle sleep on disk IO */
+int 
+proc_set_delayidlesleep(void)
+{
+       int retval;
+
+       if ((retval = __proc_info(5, getpid(), PROC_SELFSET_DELAYIDLESLEEP, (uint64_t)1, NULL, 0)) == -1)
+               return(errno);
+
+       return(0);
+}
+
+/* Reset yourself to delay idle sleep on disk IO, if already set */
+int 
+proc_clear_delayidlesleep(void)
+{
+       int retval;
+
+       if ((retval = __proc_info(5, getpid(), PROC_SELFSET_DELAYIDLESLEEP, (uint64_t)0, NULL, 0)) == -1)
+               return(errno);
+
+       return(0);
+}
+
 /* disable the launch time backgroudn policy and restore the process to default group */
 int 
 proc_disable_apptype(pid_t pid, int apptype)
index 7692f85bfd32a87abf424b79f112904c430cdbf0..cbc72d228be6b59b42f33c1cec49f5ad5dc9ddb5 100644 (file)
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <sys/mount.h>
 #include <stdint.h>
+#include <stdbool.h>
 
 #include <sys/proc_info.h>
 
@@ -109,6 +110,12 @@ int proc_libversion(int *major, int * minor) __OSX_AVAILABLE_STARTING(__MAC_10_5
 int proc_setpcontrol(const int control) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
 int proc_setpcontrol(const int control);
 
+int proc_track_dirty(pid_t pid, uint32_t flags);
+int proc_set_dirty(pid_t pid, bool dirty);
+int proc_get_dirty(pid_t pid, uint32_t *flags);
+
+int proc_terminate(pid_t pid, int *sig);
+
 __END_DECLS
 
 #endif /*_LIBPROC_H_ */
index 20feee7ef024f5e6fffe114d8d1894482a9812a7..6bf4accc4ab0606d6491f6125c90c62f1197c643 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <sys/cdefs.h>
 #include <libproc.h>
-#include <sys/process_policy.h>
 
 __BEGIN_DECLS
 
@@ -70,6 +69,18 @@ int proc_clear_vmpressure(pid_t pid);
 /* set self as the one who is going to resume suspended processes due to low VM. Need to be root */
 int proc_set_owner_vmpressure(void);
 
+/* mark yourself to delay idle sleep on disk IO */
+int proc_set_delayidlesleep(void);
+/* Reset yourself to delay idle sleep on disk IO, if already set */
+int proc_clear_delayidlesleep(void);
+
+
+/* sub policies for PROC_POLICY_APPTYPE */
+#define PROC_POLICY_OSX_APPTYPE_NONE            0
+#define PROC_POLICY_OSX_APPTYPE_TAL             1       /* TAL based launched */
+#define PROC_POLICY_OSX_APPTYPE_WIDGET          2       /* for dashboard client */
+#define PROC_POLICY_OSX_APPTYPE_DASHCLIENT      2       /* rename to move away from widget */
+
 /* 
  * Resumes the backgrounded TAL or dashboard client. Only priv users can disable TAL apps.
  * Valid apptype are PROC_POLICY_OSX_APPTYPE_DASHCLIENT and PROC_POLICY_OSX_APPTYPE_TAL.
diff --git a/db/Makefile.inc b/db/Makefile.inc
deleted file mode 100644 (file)
index 39357c7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#      from @(#)Makefile.inc   8.2 (Berkeley) 2/21/94
-# $FreeBSD: src/lib/libc/db/Makefile.inc,v 1.4 2002/11/18 09:50:54 ru Exp $
-#
-
-.include "${.CURDIR}/db/btree/Makefile.inc"
-.include "${.CURDIR}/db/db/Makefile.inc"
-.include "${.CURDIR}/db/hash/Makefile.inc"
-.include "${.CURDIR}/db/man/Makefile.inc"
-.include "${.CURDIR}/db/mpool/Makefile.inc"
-.include "${.CURDIR}/db/recno/Makefile.inc"
diff --git a/db/btree/FreeBSD/bt_extern.h b/db/btree/FreeBSD/bt_extern.h
new file mode 100644 (file)
index 0000000..2edf1c1
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)extern.h    8.10 (Berkeley) 7/20/94
+ * $FreeBSD: src/lib/libc/db/btree/extern.h,v 1.4 2007/01/09 00:27:50 imp Exp $
+ */
+
+int     __bt_close(DB *);
+int     __bt_cmp(BTREE *, const DBT *, EPG *);
+int     __bt_crsrdel(BTREE *, EPGNO *);
+int     __bt_defcmp(const DBT *, const DBT *);
+size_t  __bt_defpfx(const DBT *, const DBT *);
+int     __bt_delete(const DB *, const DBT *, u_int);
+int     __bt_dleaf(BTREE *, const DBT *, PAGE *, u_int);
+int     __bt_fd(const DB *);
+int     __bt_free(BTREE *, PAGE *);
+int     __bt_get(const DB *, const DBT *, DBT *, u_int);
+PAGE   *__bt_new(BTREE *, pgno_t *);
+void    __bt_pgin(void *, pgno_t, void *);
+void    __bt_pgout(void *, pgno_t, void *);
+int     __bt_push(BTREE *, pgno_t, int);
+int     __bt_put(const DB *dbp, DBT *, const DBT *, u_int);
+int     __bt_ret(BTREE *, EPG *, DBT *, DBT *, DBT *, DBT *, int);
+EPG    *__bt_search(BTREE *, const DBT *, int *);
+int     __bt_seq(const DB *, DBT *, DBT *, u_int);
+void    __bt_setcur(BTREE *, pgno_t, u_int);
+int     __bt_split(BTREE *, PAGE *,
+           const DBT *, const DBT *, int, size_t, u_int32_t);
+int     __bt_sync(const DB *, u_int);
+
+int     __ovfl_delete(BTREE *, void *);
+int     __ovfl_get(BTREE *, void *, size_t *, void **, size_t *);
+int     __ovfl_put(BTREE *, const DBT *, pgno_t *);
+
+#ifdef DEBUG
+void    __bt_dnpage(DB *, pgno_t);
+void    __bt_dpage(PAGE *);
+void    __bt_dump(DB *);
+#endif
+#ifdef STATISTICS
+void    __bt_stat(DB *);
+#endif
index 344b7c14a799e88a16e81d55836a6568810ff4a2..25e3000159cd04f32f77b6726a1ffbca7163d5de 100644 (file)
@@ -88,7 +88,7 @@ __ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz)
 
 #ifdef DEBUG
        if (pg == P_INVALID || sz == 0)
-               abort();
+               LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
 #endif
        /* Make the buffer bigger as necessary. */
        if (*bufsz < sz) {
@@ -192,7 +192,7 @@ __ovfl_delete(BTREE *t, void *p)
 
 #ifdef DEBUG
        if (pg == P_INVALID || sz == 0)
-               abort();
+               LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
 #endif
        if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
                return (RET_ERROR);
diff --git a/db/btree/FreeBSD/bt_overflow.c.patch b/db/btree/FreeBSD/bt_overflow.c.patch
deleted file mode 100644 (file)
index d2bf3b5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- bt_overflow.c.orig 2009-11-06 12:39:34.000000000 -0800
-+++ bt_overflow.c      2009-11-06 12:40:06.000000000 -0800
-@@ -88,7 +88,7 @@ __ovfl_get(BTREE *t, void *p, size_t *ss
- #ifdef DEBUG
-       if (pg == P_INVALID || sz == 0)
--              abort();
-+              LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
- #endif
-       /* Make the buffer bigger as necessary. */
-       if (*bufsz < sz) {
-@@ -192,7 +192,7 @@ __ovfl_delete(BTREE *t, void *p)
- #ifdef DEBUG
-       if (pg == P_INVALID || sz == 0)
--              abort();
-+              LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
- #endif
-       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-               return (RET_ERROR);
index 2ffe71faa349fb2ab5c96a9f88fdae1749b81484..b0b8b04ede2f973a9e7e725404f2819f6d66af0c 100644 (file)
@@ -369,18 +369,19 @@ __bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp)
                         * occurs.
                         */
                        if (ep->index == 0) {
+                               PAGE *hprev;
                                if (h->prevpg == P_INVALID)
                                        break;
                                if (h->pgno != save.page->pgno)
                                        mpool_put(t->bt_mp, h, 0);
-                               if ((h = mpool_get(t->bt_mp,
+                               if ((hprev = mpool_get(t->bt_mp,
                                    h->prevpg, 0)) == NULL) {
                                        if (h->pgno == save.page->pgno)
                                                mpool_put(t->bt_mp,
                                                    save.page, 0);
                                        return (RET_ERROR);
                                }
-                               ep->page = h;
+                               ep->page = h = hprev;
                                ep->index = NEXTINDEX(h);
                        }
                        --ep->index;
diff --git a/db/btree/FreeBSD/bt_seq.c.patch b/db/btree/FreeBSD/bt_seq.c.patch
deleted file mode 100644 (file)
index afdfbea..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
---- bt_seq.c.orig      2009-11-06 12:39:34.000000000 -0800
-+++ bt_seq.c   2009-11-06 12:40:06.000000000 -0800
-@@ -369,18 +369,19 @@ __bt_first(BTREE *t, const DBT *key, EPG
-                        * occurs.
-                        */
-                       if (ep->index == 0) {
-+                              PAGE *hprev;
-                               if (h->prevpg == P_INVALID)
-                                       break;
-                               if (h->pgno != save.page->pgno)
-                                       mpool_put(t->bt_mp, h, 0);
--                              if ((h = mpool_get(t->bt_mp,
-+                              if ((hprev = mpool_get(t->bt_mp,
-                                   h->prevpg, 0)) == NULL) {
-                                       if (h->pgno == save.page->pgno)
-                                               mpool_put(t->bt_mp,
-                                                   save.page, 0);
-                                       return (RET_ERROR);
-                               }
--                              ep->page = h;
-+                              ep->page = h = hprev;
-                               ep->index = NEXTINDEX(h);
-                       }
-                       --ep->index;
index 2f34975018cbca9fd517588934c51f3dc9f2a4f6..3e93e208fac69ff9f8c120a641af5376f1daa989 100644 (file)
@@ -201,7 +201,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags,
                        nbytes = NRINTERNAL;
                        break;
                default:
-                       abort();
+                       LIBC_ABORT("illegal rchild->flags & P_TYPE (0x%x)", rchild->flags & P_TYPE);
                }
 
                /* Split the parent page if necessary or shift the indices. */
@@ -276,7 +276,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags,
                        ((RINTERNAL *)dest)->pgno = rchild->pgno;
                        break;
                default:
-                       abort();
+                       LIBC_ABORT("illegal rchild->flags & P_TYPE (0x%x)", rchild->flags & P_TYPE);
                }
 
                /* Unpin the held pages. */
@@ -556,7 +556,7 @@ bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
                ((BINTERNAL *)dest)->pgno = r->pgno;
                break;
        default:
-               abort();
+               LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
        }
 
        /* There are two keys on the page. */
@@ -635,7 +635,7 @@ bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen)
                                isbigkey = 0;
                                break;
                        default:
-                               abort();
+                               LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
                        }
 
                /*
@@ -728,7 +728,7 @@ bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen)
                        nbytes = NRLEAF(rl);
                        break;
                default:
-                       abort();
+                       LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
                }
                ++nxt;
                r->linp[off] = r->upper -= nbytes;
diff --git a/db/btree/FreeBSD/bt_split.c.patch b/db/btree/FreeBSD/bt_split.c.patch
deleted file mode 100644 (file)
index a180794..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- bt_split.c.orig    2009-11-06 12:39:34.000000000 -0800
-+++ bt_split.c 2009-11-06 12:40:06.000000000 -0800
-@@ -201,7 +201,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT
-                       nbytes = NRINTERNAL;
-                       break;
-               default:
--                      abort();
-+                      LIBC_ABORT("illegal rchild->flags & P_TYPE (0x%x)", rchild->flags & P_TYPE);
-               }
-               /* Split the parent page if necessary or shift the indices. */
-@@ -276,7 +276,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT
-                       ((RINTERNAL *)dest)->pgno = rchild->pgno;
-                       break;
-               default:
--                      abort();
-+                      LIBC_ABORT("illegal rchild->flags & P_TYPE (0x%x)", rchild->flags & P_TYPE);
-               }
-               /* Unpin the held pages. */
-@@ -556,7 +556,7 @@ bt_broot(BTREE *t, PAGE *h, PAGE *l, PAG
-               ((BINTERNAL *)dest)->pgno = r->pgno;
-               break;
-       default:
--              abort();
-+              LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
-       }
-       /* There are two keys on the page. */
-@@ -635,7 +635,7 @@ bt_psplit(BTREE *t, PAGE *h, PAGE *l, PA
-                               isbigkey = 0;
-                               break;
-                       default:
--                              abort();
-+                              LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
-                       }
-               /*
-@@ -728,7 +728,7 @@ bt_psplit(BTREE *t, PAGE *h, PAGE *l, PA
-                       nbytes = NRLEAF(rl);
-                       break;
-               default:
--                      abort();
-+                      LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
-               }
-               ++nxt;
-               r->linp[off] = r->upper -= nbytes;
index 02001b3b9a5f4bd4e09a1facd881f8578798c36e..c7c1f0f9dcbb5d04892c7b33382cbd96d9c89747 100644 (file)
@@ -377,4 +377,4 @@ typedef struct _btree {
        u_int32_t flags;
 } BTREE;
 
-#include "extern.h"
+#include "bt_extern.h"
diff --git a/db/btree/FreeBSD/btree.h.patch b/db/btree/FreeBSD/btree.h.patch
deleted file mode 100644 (file)
index ee96ee7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- btree.h.orig       2009-11-06 12:39:34.000000000 -0800
-+++ btree.h    2009-11-06 12:40:06.000000000 -0800
-@@ -377,4 +377,4 @@ typedef struct _btree {
-       u_int32_t flags;
- } BTREE;
--#include "extern.h"
-+#include "bt_extern.h"
diff --git a/db/btree/FreeBSD/extern.h b/db/btree/FreeBSD/extern.h
deleted file mode 100644 (file)
index 2edf1c1..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)extern.h    8.10 (Berkeley) 7/20/94
- * $FreeBSD: src/lib/libc/db/btree/extern.h,v 1.4 2007/01/09 00:27:50 imp Exp $
- */
-
-int     __bt_close(DB *);
-int     __bt_cmp(BTREE *, const DBT *, EPG *);
-int     __bt_crsrdel(BTREE *, EPGNO *);
-int     __bt_defcmp(const DBT *, const DBT *);
-size_t  __bt_defpfx(const DBT *, const DBT *);
-int     __bt_delete(const DB *, const DBT *, u_int);
-int     __bt_dleaf(BTREE *, const DBT *, PAGE *, u_int);
-int     __bt_fd(const DB *);
-int     __bt_free(BTREE *, PAGE *);
-int     __bt_get(const DB *, const DBT *, DBT *, u_int);
-PAGE   *__bt_new(BTREE *, pgno_t *);
-void    __bt_pgin(void *, pgno_t, void *);
-void    __bt_pgout(void *, pgno_t, void *);
-int     __bt_push(BTREE *, pgno_t, int);
-int     __bt_put(const DB *dbp, DBT *, const DBT *, u_int);
-int     __bt_ret(BTREE *, EPG *, DBT *, DBT *, DBT *, DBT *, int);
-EPG    *__bt_search(BTREE *, const DBT *, int *);
-int     __bt_seq(const DB *, DBT *, DBT *, u_int);
-void    __bt_setcur(BTREE *, pgno_t, u_int);
-int     __bt_split(BTREE *, PAGE *,
-           const DBT *, const DBT *, int, size_t, u_int32_t);
-int     __bt_sync(const DB *, u_int);
-
-int     __ovfl_delete(BTREE *, void *);
-int     __ovfl_get(BTREE *, void *, size_t *, void **, size_t *);
-int     __ovfl_put(BTREE *, const DBT *, pgno_t *);
-
-#ifdef DEBUG
-void    __bt_dnpage(DB *, pgno_t);
-void    __bt_dpage(PAGE *);
-void    __bt_dump(DB *);
-#endif
-#ifdef STATISTICS
-void    __bt_stat(DB *);
-#endif
diff --git a/db/btree/Makefile.inc b/db/btree/Makefile.inc
deleted file mode 100644 (file)
index adcfc03..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#      from @(#)Makefile.inc   8.2 (Berkeley) 7/14/94
-# $FreeBSD: src/lib/libc/db/btree/Makefile.inc,v 1.4 2002/11/18 09:50:54 ru Exp $
-
-.PATH: ${.CURDIR}/db/btree
-CWD := ${.CURDIR}/db/btree
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= bt_close.c bt_conv.c bt_delete.c bt_get.c bt_open.c \
-       bt_overflow.c bt_page.c bt_put.c bt_search.c bt_seq.c bt_split.c \
-       bt_utils.c 
-.for _src in ${FBSDMISRCS}
-CFLAGS-${_src:R}-fbsd.${_src:E} += -D__DBINTERFACE_PRIVATE
-.endfor
-.for _src in bt_open.c bt_overflow.c
-CFLAGS-${_src:R}-fbsd.${_src:E} += -UDEBUG
-.endfor
-FBSDHDRS= btree.h
-.include "Makefile.fbsd_end"
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-
-# need to rename extern.h to make it unique
-.ifmake autopatch
-${_cwd}/bt_extern.h: ${_cwd}/FreeBSD/extern.h _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/bt_extern.h
-.endif # autopatch
-
-INSTBTREEPRIVHDRS_AUTOPATCH+= ${_cwd}/bt_extern.h ${_cwd}/btree.h
-
-.endfor # _cwd
diff --git a/db/btree/bt_close-fbsd.c b/db/btree/bt_close-fbsd.c
deleted file mode 120000 (symlink)
index 445d433..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_close.c
\ No newline at end of file
diff --git a/db/btree/bt_conv-fbsd.c b/db/btree/bt_conv-fbsd.c
deleted file mode 120000 (symlink)
index 4ecb6ae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_conv.c
\ No newline at end of file
diff --git a/db/btree/bt_delete-fbsd.c b/db/btree/bt_delete-fbsd.c
deleted file mode 120000 (symlink)
index e240289..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_delete.c
\ No newline at end of file
diff --git a/db/btree/bt_extern.h b/db/btree/bt_extern.h
deleted file mode 120000 (symlink)
index 70017bf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./extern.h
\ No newline at end of file
diff --git a/db/btree/bt_get-fbsd.c b/db/btree/bt_get-fbsd.c
deleted file mode 120000 (symlink)
index fb8f834..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_get.c
\ No newline at end of file
diff --git a/db/btree/bt_open-fbsd.c b/db/btree/bt_open-fbsd.c
deleted file mode 120000 (symlink)
index 628e50e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_open.c
\ No newline at end of file
diff --git a/db/btree/bt_overflow-fbsd.c b/db/btree/bt_overflow-fbsd.c
deleted file mode 100644 (file)
index 25e3000..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_overflow.c      8.5 (Berkeley) 7/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_overflow.c,v 1.6 2009/03/05 00:57:01 delphij Exp $");
-
-#include <sys/param.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-/*
- * Big key/data code.
- *
- * Big key and data entries are stored on linked lists of pages.  The initial
- * reference is byte string stored with the key or data and is the page number
- * and size.  The actual record is stored in a chain of pages linked by the
- * nextpg field of the PAGE header.
- *
- * The first page of the chain has a special property.  If the record is used
- * by an internal page, it cannot be deleted and the P_PRESERVE bit will be set
- * in the header.
- *
- * XXX
- * A single DBT is written to each chain, so a lot of space on the last page
- * is wasted.  This is a fairly major bug for some data sets.
- */
-
-/*
- * __OVFL_GET -- Get an overflow key/data item.
- *
- * Parameters:
- *     t:      tree
- *     p:      pointer to { pgno_t, u_int32_t }
- *     buf:    storage address
- *     bufsz:  storage size
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz)
-{
-       PAGE *h;
-       pgno_t pg;
-       size_t nb, plen;
-       u_int32_t sz;
-
-       memmove(&pg, p, sizeof(pgno_t));
-       memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t));
-       *ssz = sz;
-
-#ifdef DEBUG
-       if (pg == P_INVALID || sz == 0)
-               LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
-#endif
-       /* Make the buffer bigger as necessary. */
-       if (*bufsz < sz) {
-               *buf = reallocf(*buf, sz);
-               if (*buf == NULL)
-                       return (RET_ERROR);
-               *bufsz = sz;
-       }
-
-       /*
-        * Step through the linked list of pages, copying the data on each one
-        * into the buffer.  Never copy more than the data's length.
-        */
-       plen = t->bt_psize - BTDATAOFF;
-       for (p = *buf;; p = (char *)p + nb, pg = h->nextpg) {
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (RET_ERROR);
-
-               nb = MIN(sz, plen);
-               memmove(p, (char *)h + BTDATAOFF, nb);
-               mpool_put(t->bt_mp, h, 0);
-
-               if ((sz -= nb) == 0)
-                       break;
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __OVFL_PUT -- Store an overflow key/data item.
- *
- * Parameters:
- *     t:      tree
- *     data:   DBT to store
- *     pgno:   storage page number
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__ovfl_put(BTREE *t, const DBT *dbt, pgno_t *pg)
-{
-       PAGE *h, *last;
-       void *p;
-       pgno_t npg;
-       size_t nb, plen;
-       u_int32_t sz;
-
-       /*
-        * Allocate pages and copy the key/data record into them.  Store the
-        * number of the first page in the chain.
-        */
-       plen = t->bt_psize - BTDATAOFF;
-       for (last = NULL, p = dbt->data, sz = dbt->size;;
-           p = (char *)p + plen, last = h) {
-               if ((h = __bt_new(t, &npg)) == NULL)
-                       return (RET_ERROR);
-
-               h->pgno = npg;
-               h->nextpg = h->prevpg = P_INVALID;
-               h->flags = P_OVERFLOW;
-               h->lower = h->upper = 0;
-
-               nb = MIN(sz, plen);
-               memmove((char *)h + BTDATAOFF, p, nb);
-
-               if (last) {
-                       last->nextpg = h->pgno;
-                       mpool_put(t->bt_mp, last, MPOOL_DIRTY);
-               } else
-                       *pg = h->pgno;
-
-               if ((sz -= nb) == 0) {
-                       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       break;
-               }
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __OVFL_DELETE -- Delete an overflow chain.
- *
- * Parameters:
- *     t:      tree
- *     p:      pointer to { pgno_t, u_int32_t }
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__ovfl_delete(BTREE *t, void *p)
-{
-       PAGE *h;
-       pgno_t pg;
-       size_t plen;
-       u_int32_t sz;
-
-       memmove(&pg, p, sizeof(pgno_t));
-       memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(u_int32_t));
-
-#ifdef DEBUG
-       if (pg == P_INVALID || sz == 0)
-               LIBC_ABORT("%s", pg == P_INVALID ? "pg == P_INVALID" : "sz == 0");
-#endif
-       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-               return (RET_ERROR);
-
-       /* Don't delete chains used by internal pages. */
-       if (h->flags & P_PRESERVE) {
-               mpool_put(t->bt_mp, h, 0);
-               return (RET_SUCCESS);
-       }
-
-       /* Step through the chain, calling the free routine for each page. */
-       for (plen = t->bt_psize - BTDATAOFF;; sz -= plen) {
-               pg = h->nextpg;
-               __bt_free(t, h);
-               if (sz <= plen)
-                       break;
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (RET_ERROR);
-       }
-       return (RET_SUCCESS);
-}
diff --git a/db/btree/bt_page-fbsd.c b/db/btree/bt_page-fbsd.c
deleted file mode 120000 (symlink)
index f41e3f7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_page.c
\ No newline at end of file
diff --git a/db/btree/bt_put-fbsd.c b/db/btree/bt_put-fbsd.c
deleted file mode 120000 (symlink)
index 0ac099f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_put.c
\ No newline at end of file
diff --git a/db/btree/bt_search-fbsd.c b/db/btree/bt_search-fbsd.c
deleted file mode 120000 (symlink)
index 06a108b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_search.c
\ No newline at end of file
diff --git a/db/btree/bt_seq-fbsd.c b/db/btree/bt_seq-fbsd.c
deleted file mode 100644 (file)
index b0b8b04..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_seq.c   8.7 (Berkeley) 7/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_seq.c,v 1.7 2009/03/04 00:58:04 delphij Exp $");
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int __bt_first(BTREE *, const DBT *, EPG *, int *);
-static int __bt_seqadv(BTREE *, EPG *, int);
-static int __bt_seqset(BTREE *, EPG *, DBT *, int);
-
-/*
- * Sequential scan support.
- *
- * The tree can be scanned sequentially, starting from either end of the
- * tree or from any specific key.  A scan request before any scanning is
- * done is initialized as starting from the least node.
- */
-
-/*
- * __bt_seq --
- *     Btree sequential scan interface.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key for positioning and return value
- *     data:   data return value
- *     flags:  R_CURSOR, R_FIRST, R_LAST, R_NEXT, R_PREV.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-int
-__bt_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
-{
-       BTREE *t;
-       EPG e;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /*
-        * If scan unitialized as yet, or starting at a specific record, set
-        * the scan to a specific key.  Both __bt_seqset and __bt_seqadv pin
-        * the page the cursor references if they're successful.
-        */
-       switch (flags) {
-       case R_NEXT:
-       case R_PREV:
-               if (F_ISSET(&t->bt_cursor, CURS_INIT)) {
-                       status = __bt_seqadv(t, &e, flags);
-                       break;
-               }
-               /* FALLTHROUGH */
-       case R_FIRST:
-       case R_LAST:
-       case R_CURSOR:
-               status = __bt_seqset(t, &e, key, flags);
-               break;
-       default:
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       if (status == RET_SUCCESS) {
-               __bt_setcur(t, e.page->pgno, e.index);
-
-               status =
-                   __bt_ret(t, &e, key, &t->bt_rkey, data, &t->bt_rdata, 0);
-
-               /*
-                * If the user is doing concurrent access, we copied the
-                * key/data, toss the page.
-                */
-               if (F_ISSET(t, B_DB_LOCK))
-                       mpool_put(t->bt_mp, e.page, 0);
-               else
-                       t->bt_pinned = e.page;
-       }
-       return (status);
-}
-
-/*
- * __bt_seqset --
- *     Set the sequential scan to a specific key.
- *
- * Parameters:
- *     t:      tree
- *     ep:     storage for returned key
- *     key:    key for initial scan position
- *     flags:  R_CURSOR, R_FIRST, R_LAST, R_NEXT, R_PREV
- *
- * Side effects:
- *     Pins the page the cursor references.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-static int
-__bt_seqset(BTREE *t, EPG *ep, DBT *key, int flags)
-{
-       PAGE *h;
-       pgno_t pg;
-       int exact;
-
-       /*
-        * Find the first, last or specific key in the tree and point the
-        * cursor at it.  The cursor may not be moved until a new key has
-        * been found.
-        */
-       switch (flags) {
-       case R_CURSOR:                          /* Keyed scan. */
-               /*
-                * Find the first instance of the key or the smallest key
-                * which is greater than or equal to the specified key.
-                */
-               if (key->data == NULL || key->size == 0) {
-                       errno = EINVAL;
-                       return (RET_ERROR);
-               }
-               return (__bt_first(t, key, ep, &exact));
-       case R_FIRST:                           /* First record. */
-       case R_NEXT:
-               /* Walk down the left-hand side of the tree. */
-               for (pg = P_ROOT;;) {
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-
-                       /* Check for an empty tree. */
-                       if (NEXTINDEX(h) == 0) {
-                               mpool_put(t->bt_mp, h, 0);
-                               return (RET_SPECIAL);
-                       }
-
-                       if (h->flags & (P_BLEAF | P_RLEAF))
-                               break;
-                       pg = GETBINTERNAL(h, 0)->pgno;
-                       mpool_put(t->bt_mp, h, 0);
-               }
-               ep->page = h;
-               ep->index = 0;
-               break;
-       case R_LAST:                            /* Last record. */
-       case R_PREV:
-               /* Walk down the right-hand side of the tree. */
-               for (pg = P_ROOT;;) {
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-
-                       /* Check for an empty tree. */
-                       if (NEXTINDEX(h) == 0) {
-                               mpool_put(t->bt_mp, h, 0);
-                               return (RET_SPECIAL);
-                       }
-
-                       if (h->flags & (P_BLEAF | P_RLEAF))
-                               break;
-                       pg = GETBINTERNAL(h, NEXTINDEX(h) - 1)->pgno;
-                       mpool_put(t->bt_mp, h, 0);
-               }
-
-               ep->page = h;
-               ep->index = NEXTINDEX(h) - 1;
-               break;
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_seqadvance --
- *     Advance the sequential scan.
- *
- * Parameters:
- *     t:      tree
- *     flags:  R_NEXT, R_PREV
- *
- * Side effects:
- *     Pins the page the new key/data record is on.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-static int
-__bt_seqadv(BTREE *t, EPG *ep, int flags)
-{
-       CURSOR *c;
-       PAGE *h;
-       indx_t idx;
-       pgno_t pg;
-       int exact;
-
-       /*
-        * There are a couple of states that we can be in.  The cursor has
-        * been initialized by the time we get here, but that's all we know.
-        */
-       c = &t->bt_cursor;
-
-       /*
-        * The cursor was deleted where there weren't any duplicate records,
-        * so the key was saved.  Find out where that key would go in the
-        * current tree.  It doesn't matter if the returned key is an exact
-        * match or not -- if it's an exact match, the record was added after
-        * the delete so we can just return it.  If not, as long as there's
-        * a record there, return it.
-        */
-       if (F_ISSET(c, CURS_ACQUIRE))
-               return (__bt_first(t, &c->key, ep, &exact));
-
-       /* Get the page referenced by the cursor. */
-       if ((h = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL)
-               return (RET_ERROR);
-
-       /*
-        * Find the next/previous record in the tree and point the cursor at
-        * it.  The cursor may not be moved until a new key has been found.
-        */
-       switch (flags) {
-       case R_NEXT:                    /* Next record. */
-               /*
-                * The cursor was deleted in duplicate records, and moved
-                * forward to a record that has yet to be returned.  Clear
-                * that flag, and return the record.
-                */
-               if (F_ISSET(c, CURS_AFTER))
-                       goto usecurrent;
-               idx = c->pg.index;
-               if (++idx == NEXTINDEX(h)) {
-                       pg = h->nextpg;
-                       mpool_put(t->bt_mp, h, 0);
-                       if (pg == P_INVALID)
-                               return (RET_SPECIAL);
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-                       idx = 0;
-               }
-               break;
-       case R_PREV:                    /* Previous record. */
-               /*
-                * The cursor was deleted in duplicate records, and moved
-                * backward to a record that has yet to be returned.  Clear
-                * that flag, and return the record.
-                */
-               if (F_ISSET(c, CURS_BEFORE)) {
-usecurrent:            F_CLR(c, CURS_AFTER | CURS_BEFORE);
-                       ep->page = h;
-                       ep->index = c->pg.index;
-                       return (RET_SUCCESS);
-               }
-               idx = c->pg.index;
-               if (idx == 0) {
-                       pg = h->prevpg;
-                       mpool_put(t->bt_mp, h, 0);
-                       if (pg == P_INVALID)
-                               return (RET_SPECIAL);
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-                       idx = NEXTINDEX(h) - 1;
-               } else
-                       --idx;
-               break;
-       }
-
-       ep->page = h;
-       ep->index = idx;
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_first --
- *     Find the first entry.
- *
- * Parameters:
- *     t:      the tree
- *    key:     the key
- *  erval:     return EPG
- * exactp:     pointer to exact match flag
- *
- * Returns:
- *     The first entry in the tree greater than or equal to key,
- *     or RET_SPECIAL if no such key exists.
- */
-static int
-__bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp)
-{
-       PAGE *h;
-       EPG *ep, save;
-       pgno_t pg;
-
-       /*
-        * Find any matching record; __bt_search pins the page.
-        *
-        * If it's an exact match and duplicates are possible, walk backwards
-        * in the tree until we find the first one.  Otherwise, make sure it's
-        * a valid key (__bt_search may return an index just past the end of a
-        * page) and return it.
-        */
-       if ((ep = __bt_search(t, key, exactp)) == NULL)
-               return (0);
-       if (*exactp) {
-               if (F_ISSET(t, B_NODUPS)) {
-                       *erval = *ep;
-                       return (RET_SUCCESS);
-               }
-
-               /*
-                * Walk backwards, as long as the entry matches and there are
-                * keys left in the tree.  Save a copy of each match in case
-                * we go too far.
-                */
-               save = *ep;
-               h = ep->page;
-               do {
-                       if (save.page->pgno != ep->page->pgno) {
-                               mpool_put(t->bt_mp, save.page, 0);
-                               save = *ep;
-                       } else
-                               save.index = ep->index;
-
-                       /*
-                        * Don't unpin the page the last (or original) match
-                        * was on, but make sure it's unpinned if an error
-                        * occurs.
-                        */
-                       if (ep->index == 0) {
-                               PAGE *hprev;
-                               if (h->prevpg == P_INVALID)
-                                       break;
-                               if (h->pgno != save.page->pgno)
-                                       mpool_put(t->bt_mp, h, 0);
-                               if ((hprev = mpool_get(t->bt_mp,
-                                   h->prevpg, 0)) == NULL) {
-                                       if (h->pgno == save.page->pgno)
-                                               mpool_put(t->bt_mp,
-                                                   save.page, 0);
-                                       return (RET_ERROR);
-                               }
-                               ep->page = h = hprev;
-                               ep->index = NEXTINDEX(h);
-                       }
-                       --ep->index;
-               } while (__bt_cmp(t, key, ep) == 0);
-
-               /*
-                * Reach here with the last page that was looked at pinned,
-                * which may or may not be the same as the last (or original)
-                * match page.  If it's not useful, release it.
-                */
-               if (h->pgno != save.page->pgno)
-                       mpool_put(t->bt_mp, h, 0);
-
-               *erval = save;
-               return (RET_SUCCESS);
-       }
-
-       /* If at the end of a page, find the next entry. */
-       if (ep->index == NEXTINDEX(ep->page)) {
-               h = ep->page;
-               pg = h->nextpg;
-               mpool_put(t->bt_mp, h, 0);
-               if (pg == P_INVALID)
-                       return (RET_SPECIAL);
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (RET_ERROR);
-               ep->index = 0;
-               ep->page = h;
-       }
-       *erval = *ep;
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_setcur --
- *     Set the cursor to an entry in the tree.
- *
- * Parameters:
- *     t:      the tree
- *   pgno:     page number
- *    idx:     page index
- */
-void
-__bt_setcur(BTREE *t, pgno_t pgno, u_int idx)
-{
-       /* Lose any already deleted key. */
-       if (t->bt_cursor.key.data != NULL) {
-               free(t->bt_cursor.key.data);
-               t->bt_cursor.key.size = 0;
-               t->bt_cursor.key.data = NULL;
-       }
-       F_CLR(&t->bt_cursor, CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE);
-
-       /* Update the cursor. */
-       t->bt_cursor.pg.pgno = pgno;
-       t->bt_cursor.pg.index = idx;
-       F_SET(&t->bt_cursor, CURS_INIT);
-}
diff --git a/db/btree/bt_split-fbsd.c b/db/btree/bt_split-fbsd.c
deleted file mode 100644 (file)
index 3e93e20..0000000
+++ /dev/null
@@ -1,796 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_split.c 8.9 (Berkeley) 7/26/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_split.c,v 1.12 2009/03/28 05:45:29 delphij Exp $");
-
-#include <sys/types.h>
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int      bt_broot(BTREE *, PAGE *, PAGE *, PAGE *);
-static PAGE    *bt_page(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
-static int      bt_preserve(BTREE *, pgno_t);
-static PAGE    *bt_psplit(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t);
-static PAGE    *bt_root(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
-static int      bt_rroot(BTREE *, PAGE *, PAGE *, PAGE *);
-static recno_t  rec_total(PAGE *);
-
-#ifdef STATISTICS
-u_long bt_rootsplit, bt_split, bt_sortsplit, bt_pfxsaved;
-#endif
-
-/*
- * __BT_SPLIT -- Split the tree.
- *
- * Parameters:
- *     t:      tree
- *     sp:     page to split
- *     key:    key to insert
- *     data:   data to insert
- *     flags:  BIGKEY/BIGDATA flags
- *     ilen:   insert length
- *     skip:   index to leave open
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags,
-    size_t ilen, u_int32_t argskip)
-{
-       BINTERNAL *bi;
-       BLEAF *bl, *tbl;
-       DBT a, b;
-       EPGNO *parent;
-       PAGE *h, *l, *r, *lchild, *rchild;
-       indx_t nxtindex;
-       u_int16_t skip;
-       u_int32_t n, nbytes, nksize;
-       int parentsplit;
-       char *dest;
-
-       /*
-        * Split the page into two pages, l and r.  The split routines return
-        * a pointer to the page into which the key should be inserted and with
-        * skip set to the offset which should be used.  Additionally, l and r
-        * are pinned.
-        */
-       skip = argskip;
-       h = sp->pgno == P_ROOT ?
-           bt_root(t, sp, &l, &r, &skip, ilen) :
-           bt_page(t, sp, &l, &r, &skip, ilen);
-       if (h == NULL)
-               return (RET_ERROR);
-
-       /*
-        * Insert the new key/data pair into the leaf page.  (Key inserts
-        * always cause a leaf page to split first.)
-        */
-       h->linp[skip] = h->upper -= ilen;
-       dest = (char *)h + h->upper;
-       if (F_ISSET(t, R_RECNO))
-               WR_RLEAF(dest, data, flags)
-       else
-               WR_BLEAF(dest, key, data, flags)
-
-       /* If the root page was split, make it look right. */
-       if (sp->pgno == P_ROOT &&
-           (F_ISSET(t, R_RECNO) ?
-           bt_rroot(t, sp, l, r) : bt_broot(t, sp, l, r)) == RET_ERROR)
-               goto err2;
-
-       /*
-        * Now we walk the parent page stack -- a LIFO stack of the pages that
-        * were traversed when we searched for the page that split.  Each stack
-        * entry is a page number and a page index offset.  The offset is for
-        * the page traversed on the search.  We've just split a page, so we
-        * have to insert a new key into the parent page.
-        *
-        * If the insert into the parent page causes it to split, may have to
-        * continue splitting all the way up the tree.  We stop if the root
-        * splits or the page inserted into didn't have to split to hold the
-        * new key.  Some algorithms replace the key for the old page as well
-        * as the new page.  We don't, as there's no reason to believe that the
-        * first key on the old page is any better than the key we have, and,
-        * in the case of a key being placed at index 0 causing the split, the
-        * key is unavailable.
-        *
-        * There are a maximum of 5 pages pinned at any time.  We keep the left
-        * and right pages pinned while working on the parent.   The 5 are the
-        * two children, left parent and right parent (when the parent splits)
-        * and the root page or the overflow key page when calling bt_preserve.
-        * This code must make sure that all pins are released other than the
-        * root page or overflow page which is unlocked elsewhere.
-        */
-       while ((parent = BT_POP(t)) != NULL) {
-               lchild = l;
-               rchild = r;
-
-               /* Get the parent page. */
-               if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
-                       goto err2;
-
-               /*
-                * The new key goes ONE AFTER the index, because the split
-                * was to the right.
-                */
-               skip = parent->index + 1;
-
-               /*
-                * Calculate the space needed on the parent page.
-                *
-                * Prefix trees: space hack when inserting into BINTERNAL
-                * pages.  Retain only what's needed to distinguish between
-                * the new entry and the LAST entry on the page to its left.
-                * If the keys compare equal, retain the entire key.  Note,
-                * we don't touch overflow keys, and the entire key must be
-                * retained for the next-to-left most key on the leftmost
-                * page of each level, or the search will fail.  Applicable
-                * ONLY to internal pages that have leaf pages as children.
-                * Further reduction of the key between pairs of internal
-                * pages loses too much information.
-                */
-               switch (rchild->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       bi = GETBINTERNAL(rchild, 0);
-                       nbytes = NBINTERNAL(bi->ksize);
-                       break;
-               case P_BLEAF:
-                       bl = GETBLEAF(rchild, 0);
-                       nbytes = NBINTERNAL(bl->ksize);
-                       if (t->bt_pfx && !(bl->flags & P_BIGKEY) &&
-                           (h->prevpg != P_INVALID || skip > 1)) {
-                               tbl = GETBLEAF(lchild, NEXTINDEX(lchild) - 1);
-                               a.size = tbl->ksize;
-                               a.data = tbl->bytes;
-                               b.size = bl->ksize;
-                               b.data = bl->bytes;
-                               nksize = t->bt_pfx(&a, &b);
-                               n = NBINTERNAL(nksize);
-                               if (n < nbytes) {
-#ifdef STATISTICS
-                                       bt_pfxsaved += nbytes - n;
-#endif
-                                       nbytes = n;
-                               } else
-                                       nksize = 0;
-                       } else
-                               nksize = 0;
-                       break;
-               case P_RINTERNAL:
-               case P_RLEAF:
-                       nbytes = NRINTERNAL;
-                       break;
-               default:
-                       LIBC_ABORT("illegal rchild->flags & P_TYPE (0x%x)", rchild->flags & P_TYPE);
-               }
-
-               /* Split the parent page if necessary or shift the indices. */
-               if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) {
-                       sp = h;
-                       h = h->pgno == P_ROOT ?
-                           bt_root(t, h, &l, &r, &skip, nbytes) :
-                           bt_page(t, h, &l, &r, &skip, nbytes);
-                       if (h == NULL)
-                               goto err1;
-                       parentsplit = 1;
-               } else {
-                       if (skip < (nxtindex = NEXTINDEX(h)))
-                               memmove(h->linp + skip + 1, h->linp + skip,
-                                   (nxtindex - skip) * sizeof(indx_t));
-                       h->lower += sizeof(indx_t);
-                       parentsplit = 0;
-               }
-
-               /* Insert the key into the parent page. */
-               switch (rchild->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)h + h->linp[skip];
-                       memmove(dest, bi, nbytes);
-                       ((BINTERNAL *)dest)->pgno = rchild->pgno;
-                       break;
-               case P_BLEAF:
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)h + h->linp[skip];
-                       WR_BINTERNAL(dest, nksize ? nksize : bl->ksize,
-                           rchild->pgno, bl->flags & P_BIGKEY);
-                       memmove(dest, bl->bytes, nksize ? nksize : bl->ksize);
-                       if (bl->flags & P_BIGKEY &&
-                           bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR)
-                               goto err1;
-                       break;
-               case P_RINTERNAL:
-                       /*
-                        * Update the left page count.  If split
-                        * added at index 0, fix the correct page.
-                        */
-                       if (skip > 0)
-                               dest = (char *)h + h->linp[skip - 1];
-                       else
-                               dest = (char *)l + l->linp[NEXTINDEX(l) - 1];
-                       ((RINTERNAL *)dest)->nrecs = rec_total(lchild);
-                       ((RINTERNAL *)dest)->pgno = lchild->pgno;
-
-                       /* Update the right page count. */
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)h + h->linp[skip];
-                       ((RINTERNAL *)dest)->nrecs = rec_total(rchild);
-                       ((RINTERNAL *)dest)->pgno = rchild->pgno;
-                       break;
-               case P_RLEAF:
-                       /*
-                        * Update the left page count.  If split
-                        * added at index 0, fix the correct page.
-                        */
-                       if (skip > 0)
-                               dest = (char *)h + h->linp[skip - 1];
-                       else
-                               dest = (char *)l + l->linp[NEXTINDEX(l) - 1];
-                       ((RINTERNAL *)dest)->nrecs = NEXTINDEX(lchild);
-                       ((RINTERNAL *)dest)->pgno = lchild->pgno;
-
-                       /* Update the right page count. */
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)h + h->linp[skip];
-                       ((RINTERNAL *)dest)->nrecs = NEXTINDEX(rchild);
-                       ((RINTERNAL *)dest)->pgno = rchild->pgno;
-                       break;
-               default:
-                       LIBC_ABORT("illegal rchild->flags & P_TYPE (0x%x)", rchild->flags & P_TYPE);
-               }
-
-               /* Unpin the held pages. */
-               if (!parentsplit) {
-                       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       break;
-               }
-
-               /* If the root page was split, make it look right. */
-               if (sp->pgno == P_ROOT &&
-                   (F_ISSET(t, R_RECNO) ?
-                   bt_rroot(t, sp, l, r) : bt_broot(t, sp, l, r)) == RET_ERROR)
-                       goto err1;
-
-               mpool_put(t->bt_mp, lchild, MPOOL_DIRTY);
-               mpool_put(t->bt_mp, rchild, MPOOL_DIRTY);
-       }
-
-       /* Unpin the held pages. */
-       mpool_put(t->bt_mp, l, MPOOL_DIRTY);
-       mpool_put(t->bt_mp, r, MPOOL_DIRTY);
-
-       /* Clear any pages left on the stack. */
-       return (RET_SUCCESS);
-
-       /*
-        * If something fails in the above loop we were already walking back
-        * up the tree and the tree is now inconsistent.  Nothing much we can
-        * do about it but release any memory we're holding.
-        */
-err1:  mpool_put(t->bt_mp, lchild, MPOOL_DIRTY);
-       mpool_put(t->bt_mp, rchild, MPOOL_DIRTY);
-
-err2:  mpool_put(t->bt_mp, l, 0);
-       mpool_put(t->bt_mp, r, 0);
-       __dbpanic(t->bt_dbp);
-       return (RET_ERROR);
-}
-
-/*
- * BT_PAGE -- Split a non-root page of a btree.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     lp:     pointer to left page pointer
- *     rp:     pointer to right page pointer
- *     skip:   pointer to index to leave open
- *     ilen:   insert length
- *
- * Returns:
- *     Pointer to page in which to insert or NULL on error.
- */
-static PAGE *
-bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
-{
-       PAGE *l, *r, *tp;
-       pgno_t npg;
-
-#ifdef STATISTICS
-       ++bt_split;
-#endif
-       /* Put the new right page for the split into place. */
-       if ((r = __bt_new(t, &npg)) == NULL)
-               return (NULL);
-       r->pgno = npg;
-       r->lower = BTDATAOFF;
-       r->upper = t->bt_psize;
-       r->nextpg = h->nextpg;
-       r->prevpg = h->pgno;
-       r->flags = h->flags & P_TYPE;
-
-       /*
-        * If we're splitting the last page on a level because we're appending
-        * a key to it (skip is NEXTINDEX()), it's likely that the data is
-        * sorted.  Adding an empty page on the side of the level is less work
-        * and can push the fill factor much higher than normal.  If we're
-        * wrong it's no big deal, we'll just do the split the right way next
-        * time.  It may look like it's equally easy to do a similar hack for
-        * reverse sorted data, that is, split the tree left, but it's not.
-        * Don't even try.
-        */
-       if (h->nextpg == P_INVALID && *skip == NEXTINDEX(h)) {
-#ifdef STATISTICS
-               ++bt_sortsplit;
-#endif
-               h->nextpg = r->pgno;
-               r->lower = BTDATAOFF + sizeof(indx_t);
-               *skip = 0;
-               *lp = h;
-               *rp = r;
-               return (r);
-       }
-
-       /* Put the new left page for the split into place. */
-       if ((l = (PAGE *)calloc(1, t->bt_psize)) == NULL) {
-               mpool_put(t->bt_mp, r, 0);
-               return (NULL);
-       }
-       l->pgno = h->pgno;
-       l->nextpg = r->pgno;
-       l->prevpg = h->prevpg;
-       l->lower = BTDATAOFF;
-       l->upper = t->bt_psize;
-       l->flags = h->flags & P_TYPE;
-
-       /* Fix up the previous pointer of the page after the split page. */
-       if (h->nextpg != P_INVALID) {
-               if ((tp = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) {
-                       free(l);
-                       /* XXX mpool_free(t->bt_mp, r->pgno); */
-                       return (NULL);
-               }
-               tp->prevpg = r->pgno;
-               mpool_put(t->bt_mp, tp, MPOOL_DIRTY);
-       }
-
-       /*
-        * Split right.  The key/data pairs aren't sorted in the btree page so
-        * it's simpler to copy the data from the split page onto two new pages
-        * instead of copying half the data to the right page and compacting
-        * the left page in place.  Since the left page can't change, we have
-        * to swap the original and the allocated left page after the split.
-        */
-       tp = bt_psplit(t, h, l, r, skip, ilen);
-
-       /* Move the new left page onto the old left page. */
-       memmove(h, l, t->bt_psize);
-       if (tp == l)
-               tp = h;
-       free(l);
-
-       *lp = h;
-       *rp = r;
-       return (tp);
-}
-
-/*
- * BT_ROOT -- Split the root page of a btree.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     lp:     pointer to left page pointer
- *     rp:     pointer to right page pointer
- *     skip:   pointer to index to leave open
- *     ilen:   insert length
- *
- * Returns:
- *     Pointer to page in which to insert or NULL on error.
- */
-static PAGE *
-bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
-{
-       PAGE *l, *r, *tp;
-       pgno_t lnpg, rnpg;
-
-#ifdef STATISTICS
-       ++bt_split;
-       ++bt_rootsplit;
-#endif
-       /* Put the new left and right pages for the split into place. */
-       if ((l = __bt_new(t, &lnpg)) == NULL ||
-           (r = __bt_new(t, &rnpg)) == NULL)
-               return (NULL);
-       l->pgno = lnpg;
-       r->pgno = rnpg;
-       l->nextpg = r->pgno;
-       r->prevpg = l->pgno;
-       l->prevpg = r->nextpg = P_INVALID;
-       l->lower = r->lower = BTDATAOFF;
-       l->upper = r->upper = t->bt_psize;
-       l->flags = r->flags = h->flags & P_TYPE;
-
-       /* Split the root page. */
-       tp = bt_psplit(t, h, l, r, skip, ilen);
-
-       *lp = l;
-       *rp = r;
-       return (tp);
-}
-
-/*
- * BT_RROOT -- Fix up the recno root page after it has been split.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     l:      left page
- *     r:      right page
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-static int
-bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
-{
-       char *dest;
-
-       /* Insert the left and right keys, set the header information. */
-       h->linp[0] = h->upper = t->bt_psize - NRINTERNAL;
-       dest = (char *)h + h->upper;
-       WR_RINTERNAL(dest,
-           l->flags & P_RLEAF ? NEXTINDEX(l) : rec_total(l), l->pgno);
-
-       h->linp[1] = h->upper -= NRINTERNAL;
-       dest = (char *)h + h->upper;
-       WR_RINTERNAL(dest,
-           r->flags & P_RLEAF ? NEXTINDEX(r) : rec_total(r), r->pgno);
-
-       h->lower = BTDATAOFF + 2 * sizeof(indx_t);
-
-       /* Unpin the root page, set to recno internal page. */
-       h->flags &= ~P_TYPE;
-       h->flags |= P_RINTERNAL;
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-       return (RET_SUCCESS);
-}
-
-/*
- * BT_BROOT -- Fix up the btree root page after it has been split.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     l:      left page
- *     r:      right page
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-static int
-bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
-{
-       BINTERNAL *bi;
-       BLEAF *bl;
-       u_int32_t nbytes;
-       char *dest;
-
-       /*
-        * If the root page was a leaf page, change it into an internal page.
-        * We copy the key we split on (but not the key's data, in the case of
-        * a leaf page) to the new root page.
-        *
-        * The btree comparison code guarantees that the left-most key on any
-        * level of the tree is never used, so it doesn't need to be filled in.
-        */
-       nbytes = NBINTERNAL(0);
-       h->linp[0] = h->upper = t->bt_psize - nbytes;
-       dest = (char *)h + h->upper;
-       WR_BINTERNAL(dest, 0, l->pgno, 0);
-
-       switch (h->flags & P_TYPE) {
-       case P_BLEAF:
-               bl = GETBLEAF(r, 0);
-               nbytes = NBINTERNAL(bl->ksize);
-               h->linp[1] = h->upper -= nbytes;
-               dest = (char *)h + h->upper;
-               WR_BINTERNAL(dest, bl->ksize, r->pgno, 0);
-               memmove(dest, bl->bytes, bl->ksize);
-
-               /*
-                * If the key is on an overflow page, mark the overflow chain
-                * so it isn't deleted when the leaf copy of the key is deleted.
-                */
-               if (bl->flags & P_BIGKEY &&
-                   bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR)
-                       return (RET_ERROR);
-               break;
-       case P_BINTERNAL:
-               bi = GETBINTERNAL(r, 0);
-               nbytes = NBINTERNAL(bi->ksize);
-               h->linp[1] = h->upper -= nbytes;
-               dest = (char *)h + h->upper;
-               memmove(dest, bi, nbytes);
-               ((BINTERNAL *)dest)->pgno = r->pgno;
-               break;
-       default:
-               LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
-       }
-
-       /* There are two keys on the page. */
-       h->lower = BTDATAOFF + 2 * sizeof(indx_t);
-
-       /* Unpin the root page, set to btree internal page. */
-       h->flags &= ~P_TYPE;
-       h->flags |= P_BINTERNAL;
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-       return (RET_SUCCESS);
-}
-
-/*
- * BT_PSPLIT -- Do the real work of splitting the page.
- *
- * Parameters:
- *     t:      tree
- *     h:      page to be split
- *     l:      page to put lower half of data
- *     r:      page to put upper half of data
- *     pskip:  pointer to index to leave open
- *     ilen:   insert length
- *
- * Returns:
- *     Pointer to page in which to insert.
- */
-static PAGE *
-bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen)
-{
-       BINTERNAL *bi;
-       BLEAF *bl;
-       CURSOR *c;
-       RLEAF *rl;
-       PAGE *rval;
-       void *src;
-       indx_t full, half, nxt, off, skip, top, used;
-       u_int32_t nbytes;
-       int bigkeycnt, isbigkey;
-
-       /*
-        * Split the data to the left and right pages.  Leave the skip index
-        * open.  Additionally, make some effort not to split on an overflow
-        * key.  This makes internal page processing faster and can save
-        * space as overflow keys used by internal pages are never deleted.
-        */
-       bigkeycnt = 0;
-       skip = *pskip;
-       full = t->bt_psize - BTDATAOFF;
-       half = full / 2;
-       used = 0;
-       for (nxt = off = 0, top = NEXTINDEX(h); nxt < top; ++off) {
-               if (skip == off) {
-                       nbytes = ilen;
-                       isbigkey = 0;           /* XXX: not really known. */
-               } else
-                       switch (h->flags & P_TYPE) {
-                       case P_BINTERNAL:
-                               src = bi = GETBINTERNAL(h, nxt);
-                               nbytes = NBINTERNAL(bi->ksize);
-                               isbigkey = bi->flags & P_BIGKEY;
-                               break;
-                       case P_BLEAF:
-                               src = bl = GETBLEAF(h, nxt);
-                               nbytes = NBLEAF(bl);
-                               isbigkey = bl->flags & P_BIGKEY;
-                               break;
-                       case P_RINTERNAL:
-                               src = GETRINTERNAL(h, nxt);
-                               nbytes = NRINTERNAL;
-                               isbigkey = 0;
-                               break;
-                       case P_RLEAF:
-                               src = rl = GETRLEAF(h, nxt);
-                               nbytes = NRLEAF(rl);
-                               isbigkey = 0;
-                               break;
-                       default:
-                               LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
-                       }
-
-               /*
-                * If the key/data pairs are substantial fractions of the max
-                * possible size for the page, it's possible to get situations
-                * where we decide to try and copy too much onto the left page.
-                * Make sure that doesn't happen.
-                */
-               if ((skip <= off && used + nbytes + sizeof(indx_t) >= full)
-                   || nxt == top - 1) {
-                       --off;
-                       break;
-               }
-
-               /* Copy the key/data pair, if not the skipped index. */
-               if (skip != off) {
-                       ++nxt;
-
-                       l->linp[off] = l->upper -= nbytes;
-                       memmove((char *)l + l->upper, src, nbytes);
-               }
-
-               used += nbytes + sizeof(indx_t);
-               if (used >= half) {
-                       if (!isbigkey || bigkeycnt == 3)
-                               break;
-                       else
-                               ++bigkeycnt;
-               }
-       }
-
-       /*
-        * Off is the last offset that's valid for the left page.
-        * Nxt is the first offset to be placed on the right page.
-        */
-       l->lower += (off + 1) * sizeof(indx_t);
-
-       /*
-        * If splitting the page that the cursor was on, the cursor has to be
-        * adjusted to point to the same record as before the split.  If the
-        * cursor is at or past the skipped slot, the cursor is incremented by
-        * one.  If the cursor is on the right page, it is decremented by the
-        * number of records split to the left page.
-        */
-       c = &t->bt_cursor;
-       if (F_ISSET(c, CURS_INIT) && c->pg.pgno == h->pgno) {
-               if (c->pg.index >= skip)
-                       ++c->pg.index;
-               if (c->pg.index < nxt)                  /* Left page. */
-                       c->pg.pgno = l->pgno;
-               else {                                  /* Right page. */
-                       c->pg.pgno = r->pgno;
-                       c->pg.index -= nxt;
-               }
-       }
-
-       /*
-        * If the skipped index was on the left page, just return that page.
-        * Otherwise, adjust the skip index to reflect the new position on
-        * the right page.
-        */
-       if (skip <= off) {
-               skip = MAX_PAGE_OFFSET;
-               rval = l;
-       } else {
-               rval = r;
-               *pskip -= nxt;
-       }
-
-       for (off = 0; nxt < top; ++off) {
-               if (skip == nxt) {
-                       ++off;
-                       skip = MAX_PAGE_OFFSET;
-               }
-               switch (h->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       src = bi = GETBINTERNAL(h, nxt);
-                       nbytes = NBINTERNAL(bi->ksize);
-                       break;
-               case P_BLEAF:
-                       src = bl = GETBLEAF(h, nxt);
-                       nbytes = NBLEAF(bl);
-                       break;
-               case P_RINTERNAL:
-                       src = GETRINTERNAL(h, nxt);
-                       nbytes = NRINTERNAL;
-                       break;
-               case P_RLEAF:
-                       src = rl = GETRLEAF(h, nxt);
-                       nbytes = NRLEAF(rl);
-                       break;
-               default:
-                       LIBC_ABORT("illegal h->flags & P_TYPE (0x%x)", h->flags & P_TYPE);
-               }
-               ++nxt;
-               r->linp[off] = r->upper -= nbytes;
-               memmove((char *)r + r->upper, src, nbytes);
-       }
-       r->lower += off * sizeof(indx_t);
-
-       /* If the key is being appended to the page, adjust the index. */
-       if (skip == top)
-               r->lower += sizeof(indx_t);
-
-       return (rval);
-}
-
-/*
- * BT_PRESERVE -- Mark a chain of pages as used by an internal node.
- *
- * Chains of indirect blocks pointed to by leaf nodes get reclaimed when the
- * record that references them gets deleted.  Chains pointed to by internal
- * pages never get deleted.  This routine marks a chain as pointed to by an
- * internal page.
- *
- * Parameters:
- *     t:      tree
- *     pg:     page number of first page in the chain.
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-static int
-bt_preserve(BTREE *t, pgno_t pg)
-{
-       PAGE *h;
-
-       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-               return (RET_ERROR);
-       h->flags |= P_PRESERVE;
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-       return (RET_SUCCESS);
-}
-
-/*
- * REC_TOTAL -- Return the number of recno entries below a page.
- *
- * Parameters:
- *     h:      page
- *
- * Returns:
- *     The number of recno entries below a page.
- *
- * XXX
- * These values could be set by the bt_psplit routine.  The problem is that the
- * entry has to be popped off of the stack etc. or the values have to be passed
- * all the way back to bt_split/bt_rroot and it's not very clean.
- */
-static recno_t
-rec_total(PAGE *h)
-{
-       recno_t recs;
-       indx_t nxt, top;
-
-       for (recs = 0, nxt = 0, top = NEXTINDEX(h); nxt < top; ++nxt)
-               recs += GETRINTERNAL(h, nxt)->nrecs;
-       return (recs);
-}
diff --git a/db/btree/bt_utils-fbsd.c b/db/btree/bt_utils-fbsd.c
deleted file mode 120000 (symlink)
index aa281da..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bt_utils.c
\ No newline at end of file
diff --git a/db/btree/btree.h b/db/btree/btree.h
deleted file mode 100644 (file)
index c7c1f0f..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)btree.h     8.11 (Berkeley) 8/17/94
- * $FreeBSD: src/lib/libc/db/btree/btree.h,v 1.5 2009/03/04 00:58:04 delphij Exp $
- */
-
-/* Macros to set/clear/test flags. */
-#define        F_SET(p, f)     (p)->flags |= (f)
-#define        F_CLR(p, f)     (p)->flags &= ~(f)
-#define        F_ISSET(p, f)   ((p)->flags & (f))
-
-#include <mpool.h>
-
-#define        DEFMINKEYPAGE   (2)             /* Minimum keys per page */
-#define        MINCACHE        (5)             /* Minimum cached pages */
-#define        MINPSIZE        (512)           /* Minimum page size */
-
-/*
- * Page 0 of a btree file contains a copy of the meta-data.  This page is also
- * used as an out-of-band page, i.e. page pointers that point to nowhere point
- * to page 0.  Page 1 is the root of the btree.
- */
-#define        P_INVALID        0              /* Invalid tree page number. */
-#define        P_META           0              /* Tree metadata page number. */
-#define        P_ROOT           1              /* Tree root page number. */
-
-/*
- * There are five page layouts in the btree: btree internal pages (BINTERNAL),
- * btree leaf pages (BLEAF), recno internal pages (RINTERNAL), recno leaf pages
- * (RLEAF) and overflow pages.  All five page types have a page header (PAGE).
- * This implementation requires that values within structures NOT be padded.
- * (ANSI C permits random padding.)  If your compiler pads randomly you'll have
- * to do some work to get this package to run.
- */
-typedef struct _page {
-       pgno_t  pgno;                   /* this page's page number */
-       pgno_t  prevpg;                 /* left sibling */
-       pgno_t  nextpg;                 /* right sibling */
-
-#define        P_BINTERNAL     0x01            /* btree internal page */
-#define        P_BLEAF         0x02            /* leaf page */
-#define        P_OVERFLOW      0x04            /* overflow page */
-#define        P_RINTERNAL     0x08            /* recno internal page */
-#define        P_RLEAF         0x10            /* leaf page */
-#define P_TYPE         0x1f            /* type mask */
-#define        P_PRESERVE      0x20            /* never delete this chain of pages */
-       u_int32_t flags;
-
-       indx_t  lower;                  /* lower bound of free space on page */
-       indx_t  upper;                  /* upper bound of free space on page */
-       indx_t  linp[1];                /* indx_t-aligned VAR. LENGTH DATA */
-} PAGE;
-
-/* First and next index. */
-#define        BTDATAOFF                                                       \
-       (sizeof(pgno_t) + sizeof(pgno_t) + sizeof(pgno_t) +             \
-           sizeof(u_int32_t) + sizeof(indx_t) + sizeof(indx_t))
-#define        NEXTINDEX(p)    (((p)->lower - BTDATAOFF) / sizeof(indx_t))
-
-/*
- * For pages other than overflow pages, there is an array of offsets into the
- * rest of the page immediately following the page header.  Each offset is to
- * an item which is unique to the type of page.  The h_lower offset is just
- * past the last filled-in index.  The h_upper offset is the first item on the
- * page.  Offsets are from the beginning of the page.
- *
- * If an item is too big to store on a single page, a flag is set and the item
- * is a { page, size } pair such that the page is the first page of an overflow
- * chain with size bytes of item.  Overflow pages are simply bytes without any
- * external structure.
- *
- * The page number and size fields in the items are pgno_t-aligned so they can
- * be manipulated without copying.  (This presumes that 32 bit items can be
- * manipulated on this system.)
- */
-#define        LALIGN(n)       (((n) + sizeof(pgno_t) - 1) & ~(sizeof(pgno_t) - 1))
-#define        NOVFLSIZE       (sizeof(pgno_t) + sizeof(u_int32_t))
-
-/*
- * For the btree internal pages, the item is a key.  BINTERNALs are {key, pgno}
- * pairs, such that the key compares less than or equal to all of the records
- * on that page.  For a tree without duplicate keys, an internal page with two
- * consecutive keys, a and b, will have all records greater than or equal to a
- * and less than b stored on the page associated with a.  Duplicate keys are
- * somewhat special and can cause duplicate internal and leaf page records and
- * some minor modifications of the above rule.
- */
-typedef struct _binternal {
-       u_int32_t ksize;                /* key size */
-       pgno_t  pgno;                   /* page number stored on */
-#define        P_BIGDATA       0x01            /* overflow data */
-#define        P_BIGKEY        0x02            /* overflow key */
-       u_char  flags;
-       char    bytes[1];               /* data */
-} BINTERNAL;
-
-/* Get the page's BINTERNAL structure at index indx. */
-#define        GETBINTERNAL(pg, indx)                                          \
-       ((BINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
-
-/* Get the number of bytes in the entry. */
-#define NBINTERNAL(len)                                                        \
-       LALIGN(sizeof(u_int32_t) + sizeof(pgno_t) + sizeof(u_char) + (len))
-
-/* Copy a BINTERNAL entry to the page. */
-#define        WR_BINTERNAL(p, size, pgno, flags) {                            \
-       *(u_int32_t *)p = size;                                         \
-       p += sizeof(u_int32_t);                                         \
-       *(pgno_t *)p = pgno;                                            \
-       p += sizeof(pgno_t);                                            \
-       *(u_char *)p = flags;                                           \
-       p += sizeof(u_char);                                            \
-}
-
-/*
- * For the recno internal pages, the item is a page number with the number of
- * keys found on that page and below.
- */
-typedef struct _rinternal {
-       recno_t nrecs;                  /* number of records */
-       pgno_t  pgno;                   /* page number stored below */
-} RINTERNAL;
-
-/* Get the page's RINTERNAL structure at index indx. */
-#define        GETRINTERNAL(pg, indx)                                          \
-       ((RINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
-
-/* Get the number of bytes in the entry. */
-#define NRINTERNAL                                                     \
-       LALIGN(sizeof(recno_t) + sizeof(pgno_t))
-
-/* Copy a RINTERAL entry to the page. */
-#define        WR_RINTERNAL(p, nrecs, pgno) {                                  \
-       *(recno_t *)p = nrecs;                                          \
-       p += sizeof(recno_t);                                           \
-       *(pgno_t *)p = pgno;                                            \
-}
-
-/* For the btree leaf pages, the item is a key and data pair. */
-typedef struct _bleaf {
-       u_int32_t       ksize;          /* size of key */
-       u_int32_t       dsize;          /* size of data */
-       u_char  flags;                  /* P_BIGDATA, P_BIGKEY */
-       char    bytes[1];               /* data */
-} BLEAF;
-
-/* Get the page's BLEAF structure at index indx. */
-#define        GETBLEAF(pg, indx)                                              \
-       ((BLEAF *)((char *)(pg) + (pg)->linp[indx]))
-
-/* Get the number of bytes in the entry. */
-#define NBLEAF(p)      NBLEAFDBT((p)->ksize, (p)->dsize)
-
-/* Get the number of bytes in the user's key/data pair. */
-#define NBLEAFDBT(ksize, dsize)                                                \
-       LALIGN(sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(u_char) + \
-           (ksize) + (dsize))
-
-/* Copy a BLEAF entry to the page. */
-#define        WR_BLEAF(p, key, data, flags) {                                 \
-       *(u_int32_t *)p = key->size;                                    \
-       p += sizeof(u_int32_t);                                         \
-       *(u_int32_t *)p = data->size;                                   \
-       p += sizeof(u_int32_t);                                         \
-       *(u_char *)p = flags;                                           \
-       p += sizeof(u_char);                                            \
-       memmove(p, key->data, key->size);                               \
-       p += key->size;                                                 \
-       memmove(p, data->data, data->size);                             \
-}
-
-/* For the recno leaf pages, the item is a data entry. */
-typedef struct _rleaf {
-       u_int32_t       dsize;          /* size of data */
-       u_char  flags;                  /* P_BIGDATA */
-       char    bytes[1];
-} RLEAF;
-
-/* Get the page's RLEAF structure at index indx. */
-#define        GETRLEAF(pg, indx)                                              \
-       ((RLEAF *)((char *)(pg) + (pg)->linp[indx]))
-
-/* Get the number of bytes in the entry. */
-#define NRLEAF(p)      NRLEAFDBT((p)->dsize)
-
-/* Get the number of bytes from the user's data. */
-#define        NRLEAFDBT(dsize)                                                \
-       LALIGN(sizeof(u_int32_t) + sizeof(u_char) + (dsize))
-
-/* Copy a RLEAF entry to the page. */
-#define        WR_RLEAF(p, data, flags) {                                      \
-       *(u_int32_t *)p = data->size;                                   \
-       p += sizeof(u_int32_t);                                         \
-       *(u_char *)p = flags;                                           \
-       p += sizeof(u_char);                                            \
-       memmove(p, data->data, data->size);                             \
-}
-
-/*
- * A record in the tree is either a pointer to a page and an index in the page
- * or a page number and an index.  These structures are used as a cursor, stack
- * entry and search returns as well as to pass records to other routines.
- *
- * One comment about searches.  Internal page searches must find the largest
- * record less than key in the tree so that descents work.  Leaf page searches
- * must find the smallest record greater than key so that the returned index
- * is the record's correct position for insertion.
- */
-typedef struct _epgno {
-       pgno_t  pgno;                   /* the page number */
-       indx_t  index;                  /* the index on the page */
-} EPGNO;
-
-typedef struct _epg {
-       PAGE    *page;                  /* the (pinned) page */
-       indx_t   index;                 /* the index on the page */
-} EPG;
-
-/*
- * About cursors.  The cursor (and the page that contained the key/data pair
- * that it referenced) can be deleted, which makes things a bit tricky.  If
- * there are no duplicates of the cursor key in the tree (i.e. B_NODUPS is set
- * or there simply aren't any duplicates of the key) we copy the key that it
- * referenced when it's deleted, and reacquire a new cursor key if the cursor
- * is used again.  If there are duplicates keys, we move to the next/previous
- * key, and set a flag so that we know what happened.  NOTE: if duplicate (to
- * the cursor) keys are added to the tree during this process, it is undefined
- * if they will be returned or not in a cursor scan.
- *
- * The flags determine the possible states of the cursor:
- *
- * CURS_INIT   The cursor references *something*.
- * CURS_ACQUIRE        The cursor was deleted, and a key has been saved so that
- *             we can reacquire the right position in the tree.
- * CURS_AFTER, CURS_BEFORE
- *             The cursor was deleted, and now references a key/data pair
- *             that has not yet been returned, either before or after the
- *             deleted key/data pair.
- * XXX
- * This structure is broken out so that we can eventually offer multiple
- * cursors as part of the DB interface.
- */
-typedef struct _cursor {
-       EPGNO    pg;                    /* B: Saved tree reference. */
-       DBT      key;                   /* B: Saved key, or key.data == NULL. */
-       recno_t  rcursor;               /* R: recno cursor (1-based) */
-
-#define        CURS_ACQUIRE    0x01            /*  B: Cursor needs to be reacquired. */
-#define        CURS_AFTER      0x02            /*  B: Unreturned cursor after key. */
-#define        CURS_BEFORE     0x04            /*  B: Unreturned cursor before key. */
-#define        CURS_INIT       0x08            /* RB: Cursor initialized. */
-       u_int8_t flags;
-} CURSOR;
-
-/*
- * The metadata of the tree.  The nrecs field is used only by the RECNO code.
- * This is because the btree doesn't really need it and it requires that every
- * put or delete call modify the metadata.
- */
-typedef struct _btmeta {
-       u_int32_t       magic;          /* magic number */
-       u_int32_t       version;        /* version */
-       u_int32_t       psize;          /* page size */
-       u_int32_t       free;           /* page number of first free page */
-       u_int32_t       nrecs;          /* R: number of records */
-
-#define        SAVEMETA        (B_NODUPS | R_RECNO)
-       u_int32_t       flags;          /* bt_flags & SAVEMETA */
-} BTMETA;
-
-/* The in-memory btree/recno data structure. */
-typedef struct _btree {
-       MPOOL    *bt_mp;                /* memory pool cookie */
-
-       DB       *bt_dbp;               /* pointer to enclosing DB */
-
-       EPG       bt_cur;               /* current (pinned) page */
-       PAGE     *bt_pinned;            /* page pinned across calls */
-
-       CURSOR    bt_cursor;            /* cursor */
-
-#define        BT_PUSH(t, p, i) {                                              \
-       t->bt_sp->pgno = p;                                             \
-       t->bt_sp->index = i;                                            \
-       ++t->bt_sp;                                                     \
-}
-#define        BT_POP(t)       (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp)
-#define        BT_CLR(t)       (t->bt_sp = t->bt_stack)
-       EPGNO     bt_stack[50];         /* stack of parent pages */
-       EPGNO    *bt_sp;                /* current stack pointer */
-
-       DBT       bt_rkey;              /* returned key */
-       DBT       bt_rdata;             /* returned data */
-
-       int       bt_fd;                /* tree file descriptor */
-
-       pgno_t    bt_free;              /* next free page */
-       u_int32_t bt_psize;             /* page size */
-       indx_t    bt_ovflsize;          /* cut-off for key/data overflow */
-       int       bt_lorder;            /* byte order */
-                                       /* sorted order */
-       enum { NOT, BACK, FORWARD } bt_order;
-       EPGNO     bt_last;              /* last insert */
-
-                                       /* B: key comparison function */
-       int     (*bt_cmp)(const DBT *, const DBT *);
-                                       /* B: prefix comparison function */
-       size_t  (*bt_pfx)(const DBT *, const DBT *);
-                                       /* R: recno input function */
-       int     (*bt_irec)(struct _btree *, recno_t);
-
-       FILE     *bt_rfp;               /* R: record FILE pointer */
-       int       bt_rfd;               /* R: record file descriptor */
-
-       caddr_t   bt_cmap;              /* R: current point in mapped space */
-       caddr_t   bt_smap;              /* R: start of mapped space */
-       caddr_t   bt_emap;              /* R: end of mapped space */
-       size_t    bt_msize;             /* R: size of mapped region. */
-
-       recno_t   bt_nrecs;             /* R: number of records */
-       size_t    bt_reclen;            /* R: fixed record length */
-       u_char    bt_bval;              /* R: delimiting byte/pad character */
-
-/*
- * NB:
- * B_NODUPS and R_RECNO are stored on disk, and may not be changed.
- */
-#define        B_INMEM         0x00001         /* in-memory tree */
-#define        B_METADIRTY     0x00002         /* need to write metadata */
-#define        B_MODIFIED      0x00004         /* tree modified */
-#define        B_NEEDSWAP      0x00008         /* if byte order requires swapping */
-#define        B_RDONLY        0x00010         /* read-only tree */
-
-#define        B_NODUPS        0x00020         /* no duplicate keys permitted */
-#define        R_RECNO         0x00080         /* record oriented tree */
-
-#define        R_CLOSEFP       0x00040         /* opened a file pointer */
-#define        R_EOF           0x00100         /* end of input file reached. */
-#define        R_FIXLEN        0x00200         /* fixed length records */
-#define        R_MEMMAPPED     0x00400         /* memory mapped file. */
-#define        R_INMEM         0x00800         /* in-memory file */
-#define        R_MODIFIED      0x01000         /* modified file */
-#define        R_RDONLY        0x02000         /* read-only file */
-
-#define        B_DB_LOCK       0x04000         /* DB_LOCK specified. */
-#define        B_DB_SHMEM      0x08000         /* DB_SHMEM specified. */
-#define        B_DB_TXN        0x10000         /* DB_TXN specified. */
-       u_int32_t flags;
-} BTREE;
-
-#include "bt_extern.h"
diff --git a/db/db/Makefile.inc b/db/db/Makefile.inc
deleted file mode 100644 (file)
index c5739d4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#       from @(#)Makefile.inc  8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/db/db/Makefile.inc,v 1.4 2002/11/18 09:50:54 ru Exp $
-
-.PATH: ${.CURDIR}/db/db
-CWD := ${.CURDIR}/db/db
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= db.c
-.for _src in ${FBSDMISRCS}
-CFLAGS-${_src:R}-fbsd.${_src:E} += -D__DBINTERFACE_PRIVATE
-.endfor
-.include "Makefile.fbsd_end"
diff --git a/db/db/db-fbsd.c b/db/db/db-fbsd.c
deleted file mode 120000 (symlink)
index 0f977fb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./db.c
\ No newline at end of file
diff --git a/db/hash/FreeBSD/extern.h b/db/hash/FreeBSD/extern.h
deleted file mode 100644 (file)
index 9c0afaf..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)extern.h    8.4 (Berkeley) 6/16/94
- * $FreeBSD: src/lib/libc/db/hash/extern.h,v 1.4 2007/01/09 00:27:50 imp Exp $
- */
-
-BUFHEAD        *__add_ovflpage(HTAB *, BUFHEAD *);
-int     __addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
-int     __big_delete(HTAB *, BUFHEAD *);
-int     __big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
-int     __big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
-int     __big_return(HTAB *, BUFHEAD *, int, DBT *, int);
-int     __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
-               int, u_int32_t, SPLIT_RETURN *);
-int     __buf_free(HTAB *, int, int);
-void    __buf_init(HTAB *, int);
-u_int32_t       __call_hash(HTAB *, char *, int);
-int     __delpair(HTAB *, BUFHEAD *, int);
-int     __expand_table(HTAB *);
-int     __find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
-u_int16_t       __find_last_page(HTAB *, BUFHEAD **);
-void    __free_ovflpage(HTAB *, BUFHEAD *);
-BUFHEAD        *__get_buf(HTAB *, u_int32_t, BUFHEAD *, int);
-int     __get_page(HTAB *, char *, u_int32_t, int, int, int);
-int     __ibitmap(HTAB *, int, int, int);
-u_int32_t       __log2(u_int32_t);
-int     __put_page(HTAB *, char *, u_int32_t, int, int);
-void    __reclaim_buf(HTAB *, BUFHEAD *);
-int     __split_page(HTAB *, u_int32_t, u_int32_t);
-
-/* Default hash routine. */
-extern u_int32_t (*__default_hash)(const void *, size_t);
-
-#ifdef HASH_STATISTICS
-extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
-#endif
index 8e41d8f2d1ce5ede5500650d18fddb4b5995ff15..8c9a0c493c8598a761081cef5ac4f56da187b0e6 100644 (file)
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delph
 #include <db.h>
 #include "hash.h"
 #include "page.h"
-#include "extern.h"
+#include "hash_extern.h"
 
 static int   alloc_segs(HTAB *, int);
 static int   flush_meta(HTAB *);
@@ -104,8 +104,7 @@ __hash_open(const char *file, int flags, int mode,
        int bpages, hdrsize, new_table, nsegs, save_errno;
 
        if ((flags & O_ACCMODE) == O_WRONLY) {
-               errno = EINVAL;
-               return (NULL);
+               flags += O_RDWR - O_WRONLY; /* POSIX */
        }
 
        if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB))))
@@ -685,7 +684,7 @@ found:
                        return (ERROR);
                break;
        default:
-               abort();
+               LIBC_ABORT("illegal action (%d)", action);
        }
        save_bufp->flags &= ~BUF_PIN;
        return (SUCCESS);
diff --git a/db/hash/FreeBSD/hash.c.patch b/db/hash/FreeBSD/hash.c.patch
deleted file mode 100644 (file)
index 9533941..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- hash.c.orig        2009-11-06 12:41:16.000000000 -0800
-+++ hash.c     2009-11-06 12:41:27.000000000 -0800
-@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- #include <db.h>
- #include "hash.h"
- #include "page.h"
--#include "extern.h"
-+#include "hash_extern.h"
- static int   alloc_segs(HTAB *, int);
- static int   flush_meta(HTAB *);
-@@ -104,8 +104,7 @@ __hash_open(const char *file, int flags,
-       int bpages, hdrsize, new_table, nsegs, save_errno;
-       if ((flags & O_ACCMODE) == O_WRONLY) {
--              errno = EINVAL;
--              return (NULL);
-+              flags += O_RDWR - O_WRONLY; /* POSIX */
-       }
-       if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB))))
-@@ -684,7 +683,7 @@ found:
-                       return (ERROR);
-               break;
-       default:
--              abort();
-+              LIBC_ABORT("illegal action (%d)", action);
-       }
-       save_bufp->flags &= ~BUF_PIN;
-       return (SUCCESS);
index f8ea5caef0a13a43582871d27fbf36012df8acdb..e4f77c2bf618e485565ebe156c55f34f1c52f363 100644 (file)
@@ -113,6 +113,8 @@ typedef struct htab  {              /* Memory resident data structure */
                                         * allocate */
        BUFHEAD         bufhead;        /* Header of buffer lru list */
        SEGMENT         *dir;           /* Hash Bucket directory */
+                                       /* other flags */
+       int             nextkey_eof :1; /* dbm_nextkey() reached EOF */
 } HTAB;
 
 /*
diff --git a/db/hash/FreeBSD/hash.h.patch b/db/hash/FreeBSD/hash.h.patch
deleted file mode 100644 (file)
index efe6e7d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- hash.h.orig        2009-11-06 12:41:16.000000000 -0800
-+++ hash.h     2009-11-06 12:41:27.000000000 -0800
-@@ -113,6 +113,8 @@ typedef struct htab         {              /* Memory reside
-                                        * allocate */
-       BUFHEAD         bufhead;        /* Header of buffer lru list */
-       SEGMENT         *dir;           /* Hash Bucket directory */
-+                                      /* other flags */
-+      int             nextkey_eof :1; /* dbm_nextkey() reached EOF */
- } HTAB;
- /*
index de8180e6b008d117042703ad821ca81c0baef795..d325105edcb900aaf3ee8de41ccfb08e0f60ab68 100644 (file)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_bigkey.c,v 1.10 2009/03/28 06:47:0
 #include <db.h>
 #include "hash.h"
 #include "page.h"
-#include "extern.h"
+#include "hash_extern.h"
 
 static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int);
 static int collect_data(HTAB *, BUFHEAD *, int, int);
diff --git a/db/hash/FreeBSD/hash_bigkey.c.patch b/db/hash/FreeBSD/hash_bigkey.c.patch
deleted file mode 100644 (file)
index 54a30d8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- hash_bigkey.c.orig 2009-11-06 12:41:16.000000000 -0800
-+++ hash_bigkey.c      2009-11-06 12:41:27.000000000 -0800
-@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- #include <db.h>
- #include "hash.h"
- #include "page.h"
--#include "extern.h"
-+#include "hash_extern.h"
- static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int);
- static int collect_data(HTAB *, BUFHEAD *, int, int);
index 62117c94346b295c79b6891b8c36ade376ceea97..e19beda025231483881916f875f51aea64e873c1 100644 (file)
@@ -66,7 +66,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_buf.c,v 1.12 2009/03/28 06:40:48 d
 #include <db.h>
 #include "hash.h"
 #include "page.h"
-#include "extern.h"
+#include "hash_extern.h"
 
 static BUFHEAD *newbuf(HTAB *, u_int32_t, BUFHEAD *);
 
@@ -293,7 +293,7 @@ newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
        return (bp);
 }
 
-void
+__private_extern__ void
 __buf_init(HTAB *hashp, int nbytes)
 {
        BUFHEAD *bfp;
diff --git a/db/hash/FreeBSD/hash_buf.c.patch b/db/hash/FreeBSD/hash_buf.c.patch
deleted file mode 100644 (file)
index 11e5799..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- hash_buf.c (revision 61187)
-+++ hash_buf.c (working copy)
-@@ -66,7 +66,7 @@
- #include <db.h>
- #include "hash.h"
- #include "page.h"
--#include "extern.h"
-+#include "hash_extern.h"
- static BUFHEAD *newbuf(HTAB *, u_int32_t, BUFHEAD *);
-@@ -293,7 +293,7 @@
-       return (bp);
- }
--void
-+__private_extern__ void
- __buf_init(HTAB *hashp, int nbytes)
- {
-       BUFHEAD *bfp;
diff --git a/db/hash/FreeBSD/hash_extern.h b/db/hash/FreeBSD/hash_extern.h
new file mode 100644 (file)
index 0000000..9c0afaf
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)extern.h    8.4 (Berkeley) 6/16/94
+ * $FreeBSD: src/lib/libc/db/hash/extern.h,v 1.4 2007/01/09 00:27:50 imp Exp $
+ */
+
+BUFHEAD        *__add_ovflpage(HTAB *, BUFHEAD *);
+int     __addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
+int     __big_delete(HTAB *, BUFHEAD *);
+int     __big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
+int     __big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
+int     __big_return(HTAB *, BUFHEAD *, int, DBT *, int);
+int     __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
+               int, u_int32_t, SPLIT_RETURN *);
+int     __buf_free(HTAB *, int, int);
+void    __buf_init(HTAB *, int);
+u_int32_t       __call_hash(HTAB *, char *, int);
+int     __delpair(HTAB *, BUFHEAD *, int);
+int     __expand_table(HTAB *);
+int     __find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
+u_int16_t       __find_last_page(HTAB *, BUFHEAD **);
+void    __free_ovflpage(HTAB *, BUFHEAD *);
+BUFHEAD        *__get_buf(HTAB *, u_int32_t, BUFHEAD *, int);
+int     __get_page(HTAB *, char *, u_int32_t, int, int, int);
+int     __ibitmap(HTAB *, int, int, int);
+u_int32_t       __log2(u_int32_t);
+int     __put_page(HTAB *, char *, u_int32_t, int, int);
+void    __reclaim_buf(HTAB *, BUFHEAD *);
+int     __split_page(HTAB *, u_int32_t, u_int32_t);
+
+/* Default hash routine. */
+extern u_int32_t (*__default_hash)(const void *, size_t);
+
+#ifdef HASH_STATISTICS
+extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
+#endif
index 88d21f7a4413f55bfb3a5d3686f358b5c0682f85..a402e49beaa0a5a645c7d94968ffb1e5d23e7d40 100644 (file)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_func.c,v 1.6 2007/01/09 00:27:50 i
 #include <db.h>
 #include "hash.h"
 #include "page.h"
-#include "extern.h"
+#include "hash_extern.h"
 
 static u_int32_t hash1(const void *, size_t) __unused;
 static u_int32_t hash2(const void *, size_t) __unused;
diff --git a/db/hash/FreeBSD/hash_func.c.patch b/db/hash/FreeBSD/hash_func.c.patch
deleted file mode 100644 (file)
index db68d77..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- hash_func.c.orig   2009-11-06 12:41:16.000000000 -0800
-+++ hash_func.c        2009-11-06 12:41:27.000000000 -0800
-@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- #include <db.h>
- #include "hash.h"
- #include "page.h"
--#include "extern.h"
-+#include "hash_extern.h"
- static u_int32_t hash1(const void *, size_t) __unused;
- static u_int32_t hash2(const void *, size_t) __unused;
index 6f8b5226da18b886cbd252ec92fe376300541441..56714a1b097820fec53740a153f3e727eb48e238 100644 (file)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_log2.c,v 1.5 2009/03/28 05:45:29 d
 #include <db.h>
 #include "hash.h"
 #include "page.h"
-#include "extern.h"
+#include "hash_extern.h"
 
 u_int32_t
 __log2(u_int32_t num)
diff --git a/db/hash/FreeBSD/hash_log2.c.patch b/db/hash/FreeBSD/hash_log2.c.patch
deleted file mode 100644 (file)
index 056340a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- hash_log2.c.orig   2009-11-06 14:27:02.000000000 -0800
-+++ hash_log2.c        2009-11-06 14:27:42.000000000 -0800
-@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- #include <db.h>
- #include "hash.h"
- #include "page.h"
--#include "extern.h"
-+#include "hash_extern.h"
- u_int32_t
- __log2(u_int32_t num)
index 1f44bdeab664c8794c01e594e182b9f3fd5e136f..809a3b9e1203501903dabad2b366087ebdf4bf85 100644 (file)
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_page.c,v 1.16 2009/03/28 06:30:43
 #include <db.h>
 #include "hash.h"
 #include "page.h"
-#include "extern.h"
+#include "hash_extern.h"
 
 static u_int32_t *fetch_bitmap(HTAB *, int);
 static u_int32_t  first_free(u_int32_t);
@@ -571,7 +571,7 @@ __get_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_disk,
 int
 __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
 {
-       int fd, page, size, wsize;
+       int fd, page, size, wsize, max;
 
        size = hashp->BSIZE;
        if ((hashp->fp == -1) && open_temp(hashp))
@@ -579,7 +579,7 @@ __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
        fd = hashp->fp;
 
        if (hashp->LORDER != BYTE_ORDER) {
-               int i, max;
+               int i;
 
                if (is_bitmap) {
                        max = hashp->BSIZE >> 2;        /* divide by 4 */
@@ -602,6 +602,18 @@ __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
                errno = EFTYPE;
                return (-1);
        }
+       /* 4485533 - reswap the in-memory copy */
+       if (hashp->LORDER != BYTE_ORDER) {
+               int i;
+
+               if (is_bitmap) {
+                       for (i = 0; i < max; i++)
+                               M_32_SWAP(((int *)p)[i]);
+               } else {
+                       for (i = 0; i <= max; i++)
+                               M_16_SWAP(((u_int16_t *)p)[i]);
+               }
+       }
        return (0);
 }
 
diff --git a/db/hash/FreeBSD/hash_page.c.patch b/db/hash/FreeBSD/hash_page.c.patch
deleted file mode 100644 (file)
index 904c9a0..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- hash_page.c.orig   2009-11-06 12:41:16.000000000 -0800
-+++ hash_page.c        2009-11-06 12:43:23.000000000 -0800
-@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- #include <db.h>
- #include "hash.h"
- #include "page.h"
--#include "extern.h"
-+#include "hash_extern.h"
- static u_int32_t *fetch_bitmap(HTAB *, int);
- static u_int32_t  first_free(u_int32_t);
-@@ -571,7 +571,7 @@ __get_page(HTAB *hashp, char *p, u_int32
- int
- __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
- {
--      int fd, page, size, wsize;
-+      int fd, page, size, wsize, max;
-       size = hashp->BSIZE;
-       if ((hashp->fp == -1) && open_temp(hashp))
-@@ -579,7 +579,7 @@ __put_page(HTAB *hashp, char *p, u_int32
-       fd = hashp->fp;
-       if (hashp->LORDER != BYTE_ORDER) {
--              int i, max;
-+              int i;
-               if (is_bitmap) {
-                       max = hashp->BSIZE >> 2;        /* divide by 4 */
-@@ -602,6 +602,18 @@ __put_page(HTAB *hashp, char *p, u_int32
-               errno = EFTYPE;
-               return (-1);
-       }
-+      /* 4485533 - reswap the in-memory copy */
-+      if (hashp->LORDER != BYTE_ORDER) {
-+              int i;
-+
-+              if (is_bitmap) {
-+                      for (i = 0; i < max; i++)
-+                              M_32_SWAP(((int *)p)[i]);
-+              } else {
-+                      for (i = 0; i <= max; i++)
-+                              M_16_SWAP(((u_int16_t *)p)[i]);
-+              }
-+      }
-       return (0);
- }
index 8c23b795c63474a657d8c432e17a5f09ec98b17e..c589af8110d2bb5e2a94f12dd1af8b14f948c242 100644 (file)
@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/ndbm.c,v 1.7 2007/01/09 00:27:51 imp Ex
 #include <string.h>
 #include <errno.h>
 
+#include <db.h>
+#define _DBM
+typedef DB DBM;
 #include <ndbm.h>
 #include "hash.h"
 
@@ -58,7 +61,8 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/ndbm.c,v 1.7 2007/01/09 00:27:51 imp Ex
 extern DBM *
 dbm_open(file, flags, mode)
        const char *file;
-       int flags, mode;
+       int flags;
+       mode_t mode;
 {
        HASHINFO info;
        char path[MAXPATHLEN];
@@ -124,10 +128,14 @@ dbm_firstkey(db)
        int status;
        datum retkey;
        DBT dbtretkey, dbtretdata;
+       HTAB *htab = (HTAB *)(db->internal);
 
        status = (db->seq)(db, &dbtretkey, &dbtretdata, R_FIRST);
-       if (status)
+       if (status) {
                dbtretkey.data = NULL;
+               htab->nextkey_eof = 1;
+       } else
+               htab->nextkey_eof = 0;
        retkey.dptr = dbtretkey.data;
        retkey.dsize = dbtretkey.size;
        return (retkey);
@@ -142,13 +150,20 @@ extern datum
 dbm_nextkey(db)
        DBM *db;
 {
-       int status;
+       int status = 1;
        datum retkey;
        DBT dbtretkey, dbtretdata;
+       HTAB *htab = (HTAB *)(db->internal);
 
-       status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
-       if (status)
+       if (htab->nextkey_eof)
                dbtretkey.data = NULL;
+       else {
+               status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
+               if (status) {
+                       dbtretkey.data = NULL;
+                       htab->nextkey_eof = 1;
+               }
+       }
        retkey.dptr = dbtretkey.data;
        retkey.dsize = dbtretkey.size;
        return (retkey);
diff --git a/db/hash/FreeBSD/ndbm.c.patch b/db/hash/FreeBSD/ndbm.c.patch
deleted file mode 100644 (file)
index 6292cd6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
---- ndbm.c.orig        2009-11-06 12:41:16.000000000 -0800
-+++ ndbm.c     2009-11-06 12:41:27.000000000 -0800
-@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- #include <string.h>
- #include <errno.h>
-+#include <db.h>
-+#define _DBM
-+typedef DB DBM;
- #include <ndbm.h>
- #include "hash.h"
-@@ -58,7 +61,8 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
- extern DBM *
- dbm_open(file, flags, mode)
-       const char *file;
--      int flags, mode;
-+      int flags;
-+      mode_t mode;
- {
-       HASHINFO info;
-       char path[MAXPATHLEN];
-@@ -124,10 +128,14 @@ dbm_firstkey(db)
-       int status;
-       datum retkey;
-       DBT dbtretkey, dbtretdata;
-+      HTAB *htab = (HTAB *)(db->internal);
-       status = (db->seq)(db, &dbtretkey, &dbtretdata, R_FIRST);
--      if (status)
-+      if (status) {
-               dbtretkey.data = NULL;
-+              htab->nextkey_eof = 1;
-+      } else
-+              htab->nextkey_eof = 0;
-       retkey.dptr = dbtretkey.data;
-       retkey.dsize = dbtretkey.size;
-       return (retkey);
-@@ -142,13 +150,20 @@ extern datum
- dbm_nextkey(db)
-       DBM *db;
- {
--      int status;
-+      int status = 1;
-       datum retkey;
-       DBT dbtretkey, dbtretdata;
-+      HTAB *htab = (HTAB *)(db->internal);
--      status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
--      if (status)
-+      if (htab->nextkey_eof)
-               dbtretkey.data = NULL;
-+      else {
-+              status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
-+              if (status) {
-+                      dbtretkey.data = NULL;
-+                      htab->nextkey_eof = 1;
-+              }
-+      }
-       retkey.dptr = dbtretkey.data;
-       retkey.dsize = dbtretkey.size;
-       return (retkey);
diff --git a/db/hash/Makefile.inc b/db/hash/Makefile.inc
deleted file mode 100644 (file)
index 7efd016..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#       from @(#)Makefile.inc  8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/db/hash/Makefile.inc,v 1.5 2002/11/18 09:50:54 ru Exp $
-
-.PATH: ${.CURDIR}/db/hash
-CWD := ${.CURDIR}/db/hash
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= hash.c hash_bigkey.c hash_buf.c hash_func.c hash_log2.c \
-       hash_page.c ndbm.c
-.for _src in ${FBSDMISRCS}
-CFLAGS-${_src:R}-fbsd.${_src:E} += -D__DBINTERFACE_PRIVATE
-.endfor
-.for _src in hash.c hash_bigkey.c hash_buf.c hash_page.c
-CFLAGS-${_src:R}-fbsd.${_src:E} += -UDEBUG
-.endfor
-FBSDHDRS= hash.h page.h
-.include "Makefile.fbsd_end"
-
-# need to rename extern.h to make it unique
-.ifmake autopatch
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-${_cwd}/hash_extern.h: ${_cwd}/FreeBSD/extern.h _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/hash_extern.h
-.endfor # _cwd
-
-.endif # autopatch
diff --git a/db/hash/hash-fbsd.c b/db/hash/hash-fbsd.c
deleted file mode 100644 (file)
index 8c9a0c4..0000000
+++ /dev/null
@@ -1,963 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c     8.9 (Berkeley) 6/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delphij Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef DEBUG
-#include <assert.h>
-#endif
-#include "un-namespace.h"
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "hash_extern.h"
-
-static int   alloc_segs(HTAB *, int);
-static int   flush_meta(HTAB *);
-static int   hash_access(HTAB *, ACTION, DBT *, DBT *);
-static int   hash_close(DB *);
-static int   hash_delete(const DB *, const DBT *, u_int32_t);
-static int   hash_fd(const DB *);
-static int   hash_get(const DB *, const DBT *, DBT *, u_int32_t);
-static int   hash_put(const DB *, DBT *, const DBT *, u_int32_t);
-static void *hash_realloc(SEGMENT **, int, int);
-static int   hash_seq(const DB *, DBT *, DBT *, u_int32_t);
-static int   hash_sync(const DB *, u_int32_t);
-static int   hdestroy(HTAB *);
-static HTAB *init_hash(HTAB *, const char *, const HASHINFO *);
-static int   init_htab(HTAB *, int);
-#if BYTE_ORDER == LITTLE_ENDIAN
-static void  swap_header(HTAB *);
-static void  swap_header_copy(HASHHDR *, HASHHDR *);
-#endif
-
-/* Fast arithmetic, relying on powers of 2, */
-#define MOD(x, y)              ((x) & ((y) - 1))
-
-#define RETURN_ERROR(ERR, LOC) { save_errno = ERR; goto LOC; }
-
-/* Return values */
-#define        SUCCESS  (0)
-#define        ERROR   (-1)
-#define        ABNORMAL (1)
-
-#ifdef HASH_STATISTICS
-int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
-#endif
-
-/************************** INTERFACE ROUTINES ***************************/
-/* OPEN/CLOSE */
-
-/* ARGSUSED */
-DB *
-__hash_open(const char *file, int flags, int mode,
-    const HASHINFO *info,      /* Special directives for create */
-    int dflags)
-{
-       HTAB *hashp;
-       struct stat statbuf;
-       DB *dbp;
-       int bpages, hdrsize, new_table, nsegs, save_errno;
-
-       if ((flags & O_ACCMODE) == O_WRONLY) {
-               flags += O_RDWR - O_WRONLY; /* POSIX */
-       }
-
-       if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB))))
-               return (NULL);
-       hashp->fp = -1;
-
-       /*
-        * Even if user wants write only, we need to be able to read
-        * the actual file, so we need to open it read/write. But, the
-        * field in the hashp structure needs to be accurate so that
-        * we can check accesses.
-        */
-       hashp->flags = flags;
-
-       if (file) {
-               if ((hashp->fp = _open(file, flags, mode)) == -1)
-                       RETURN_ERROR(errno, error0);
-               (void)_fcntl(hashp->fp, F_SETFD, 1);
-               new_table = _fstat(hashp->fp, &statbuf) == 0 &&
-                   statbuf.st_size == 0 &&
-                   ((flags & O_ACCMODE) != O_RDONLY || (flags & O_CREAT) != 0);
-       } else
-               new_table = 1;
-
-       if (new_table) {
-               if (!(hashp = init_hash(hashp, file, info)))
-                       RETURN_ERROR(errno, error1);
-       } else {
-               /* Table already exists */
-               if (info && info->hash)
-                       hashp->hash = info->hash;
-               else
-                       hashp->hash = __default_hash;
-
-               hdrsize = _read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
-#if BYTE_ORDER == LITTLE_ENDIAN
-               swap_header(hashp);
-#endif
-               if (hdrsize == -1)
-                       RETURN_ERROR(errno, error1);
-               if (hdrsize != sizeof(HASHHDR))
-                       RETURN_ERROR(EFTYPE, error1);
-               /* Verify file type, versions and hash function */
-               if (hashp->MAGIC != HASHMAGIC)
-                       RETURN_ERROR(EFTYPE, error1);
-#define        OLDHASHVERSION  1
-               if (hashp->VERSION != HASHVERSION &&
-                   hashp->VERSION != OLDHASHVERSION)
-                       RETURN_ERROR(EFTYPE, error1);
-               if ((int32_t)hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
-                       RETURN_ERROR(EFTYPE, error1);
-               /*
-                * Figure out how many segments we need.  Max_Bucket is the
-                * maximum bucket number, so the number of buckets is
-                * max_bucket + 1.
-                */
-               nsegs = (hashp->MAX_BUCKET + 1 + hashp->SGSIZE - 1) /
-                        hashp->SGSIZE;
-               if (alloc_segs(hashp, nsegs))
-                       /*
-                        * If alloc_segs fails, table will have been destroyed
-                        * and errno will have been set.
-                        */
-                       return (NULL);
-               /* Read in bitmaps */
-               bpages = (hashp->SPARES[hashp->OVFL_POINT] +
-                   (hashp->BSIZE << BYTE_SHIFT) - 1) >>
-                   (hashp->BSHIFT + BYTE_SHIFT);
-
-               hashp->nmaps = bpages;
-               (void)memset(&hashp->mapp[0], 0, bpages * sizeof(u_int32_t *));
-       }
-
-       /* Initialize Buffer Manager */
-       if (info && info->cachesize)
-               __buf_init(hashp, info->cachesize);
-       else
-               __buf_init(hashp, DEF_BUFSIZE);
-
-       hashp->new_file = new_table;
-       hashp->save_file = file && (hashp->flags & O_RDWR);
-       hashp->cbucket = -1;
-       if (!(dbp = (DB *)malloc(sizeof(DB)))) {
-               save_errno = errno;
-               hdestroy(hashp);
-               errno = save_errno;
-               return (NULL);
-       }
-       dbp->internal = hashp;
-       dbp->close = hash_close;
-       dbp->del = hash_delete;
-       dbp->fd = hash_fd;
-       dbp->get = hash_get;
-       dbp->put = hash_put;
-       dbp->seq = hash_seq;
-       dbp->sync = hash_sync;
-       dbp->type = DB_HASH;
-
-#ifdef DEBUG
-       (void)fprintf(stderr,
-"%s\n%s%p\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%x\n%s%x\n%s%d\n%s%d\n",
-           "init_htab:",
-           "TABLE POINTER   ", hashp,
-           "BUCKET SIZE     ", hashp->BSIZE,
-           "BUCKET SHIFT    ", hashp->BSHIFT,
-           "DIRECTORY SIZE  ", hashp->DSIZE,
-           "SEGMENT SIZE    ", hashp->SGSIZE,
-           "SEGMENT SHIFT   ", hashp->SSHIFT,
-           "FILL FACTOR     ", hashp->FFACTOR,
-           "MAX BUCKET      ", hashp->MAX_BUCKET,
-           "OVFL POINT      ", hashp->OVFL_POINT,
-           "LAST FREED      ", hashp->LAST_FREED,
-           "HIGH MASK       ", hashp->HIGH_MASK,
-           "LOW  MASK       ", hashp->LOW_MASK,
-           "NSEGS           ", hashp->nsegs,
-           "NKEYS           ", hashp->NKEYS);
-#endif
-#ifdef HASH_STATISTICS
-       hash_overflows = hash_accesses = hash_collisions = hash_expansions = 0;
-#endif
-       return (dbp);
-
-error1:
-       if (hashp != NULL)
-               (void)_close(hashp->fp);
-
-error0:
-       free(hashp);
-       errno = save_errno;
-       return (NULL);
-}
-
-static int
-hash_close(DB *dbp)
-{
-       HTAB *hashp;
-       int retval;
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = (HTAB *)dbp->internal;
-       retval = hdestroy(hashp);
-       free(dbp);
-       return (retval);
-}
-
-static int
-hash_fd(const DB *dbp)
-{
-       HTAB *hashp;
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = (HTAB *)dbp->internal;
-       if (hashp->fp == -1) {
-               errno = ENOENT;
-               return (-1);
-       }
-       return (hashp->fp);
-}
-
-/************************** LOCAL CREATION ROUTINES **********************/
-static HTAB *
-init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
-{
-       struct stat statbuf;
-       int nelem;
-
-       nelem = 1;
-       hashp->NKEYS = 0;
-       hashp->LORDER = BYTE_ORDER;
-       hashp->BSIZE = DEF_BUCKET_SIZE;
-       hashp->BSHIFT = DEF_BUCKET_SHIFT;
-       hashp->SGSIZE = DEF_SEGSIZE;
-       hashp->SSHIFT = DEF_SEGSIZE_SHIFT;
-       hashp->DSIZE = DEF_DIRSIZE;
-       hashp->FFACTOR = DEF_FFACTOR;
-       hashp->hash = __default_hash;
-       memset(hashp->SPARES, 0, sizeof(hashp->SPARES));
-       memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS));
-
-       /* Fix bucket size to be optimal for file system */
-       if (file != NULL) {
-               if (stat(file, &statbuf))
-                       return (NULL);
-               hashp->BSIZE = statbuf.st_blksize;
-               hashp->BSHIFT = __log2(hashp->BSIZE);
-       }
-
-       if (info) {
-               if (info->bsize) {
-                       /* Round pagesize up to power of 2 */
-                       hashp->BSHIFT = __log2(info->bsize);
-                       hashp->BSIZE = 1 << hashp->BSHIFT;
-                       if (hashp->BSIZE > MAX_BSIZE) {
-                               errno = EINVAL;
-                               return (NULL);
-                       }
-               }
-               if (info->ffactor)
-                       hashp->FFACTOR = info->ffactor;
-               if (info->hash)
-                       hashp->hash = info->hash;
-               if (info->nelem)
-                       nelem = info->nelem;
-               if (info->lorder) {
-                       if (info->lorder != BIG_ENDIAN &&
-                           info->lorder != LITTLE_ENDIAN) {
-                               errno = EINVAL;
-                               return (NULL);
-                       }
-                       hashp->LORDER = info->lorder;
-               }
-       }
-       /* init_htab should destroy the table and set errno if it fails */
-       if (init_htab(hashp, nelem))
-               return (NULL);
-       else
-               return (hashp);
-}
-/*
- * This calls alloc_segs which may run out of memory.  Alloc_segs will destroy
- * the table and set errno, so we just pass the error information along.
- *
- * Returns 0 on No Error
- */
-static int
-init_htab(HTAB *hashp, int nelem)
-{
-       int nbuckets, nsegs, l2;
-
-       /*
-        * Divide number of elements by the fill factor and determine a
-        * desired number of buckets.  Allocate space for the next greater
-        * power of two number of buckets.
-        */
-       nelem = (nelem - 1) / hashp->FFACTOR + 1;
-
-       l2 = __log2(MAX(nelem, 2));
-       nbuckets = 1 << l2;
-
-       hashp->SPARES[l2] = l2 + 1;
-       hashp->SPARES[l2 + 1] = l2 + 1;
-       hashp->OVFL_POINT = l2;
-       hashp->LAST_FREED = 2;
-
-       /* First bitmap page is at: splitpoint l2 page offset 1 */
-       if (__ibitmap(hashp, OADDR_OF(l2, 1), l2 + 1, 0))
-               return (-1);
-
-       hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1;
-       hashp->HIGH_MASK = (nbuckets << 1) - 1;
-       hashp->HDRPAGES = ((MAX(sizeof(HASHHDR), MINHDRSIZE) - 1) >>
-           hashp->BSHIFT) + 1;
-
-       nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
-       nsegs = 1 << __log2(nsegs);
-
-       if (nsegs > hashp->DSIZE)
-               hashp->DSIZE = nsegs;
-       return (alloc_segs(hashp, nsegs));
-}
-
-/********************** DESTROY/CLOSE ROUTINES ************************/
-
-/*
- * Flushes any changes to the file if necessary and destroys the hashp
- * structure, freeing all allocated space.
- */
-static int
-hdestroy(HTAB *hashp)
-{
-       int i, save_errno;
-
-       save_errno = 0;
-
-#ifdef HASH_STATISTICS
-       (void)fprintf(stderr, "hdestroy: accesses %ld collisions %ld\n",
-           hash_accesses, hash_collisions);
-       (void)fprintf(stderr, "hdestroy: expansions %ld\n",
-           hash_expansions);
-       (void)fprintf(stderr, "hdestroy: overflows %ld\n",
-           hash_overflows);
-       (void)fprintf(stderr, "keys %ld maxp %d segmentcount %d\n",
-           hashp->NKEYS, hashp->MAX_BUCKET, hashp->nsegs);
-
-       for (i = 0; i < NCACHED; i++)
-               (void)fprintf(stderr,
-                   "spares[%d] = %d\n", i, hashp->SPARES[i]);
-#endif
-       /*
-        * Call on buffer manager to free buffers, and if required,
-        * write them to disk.
-        */
-       if (__buf_free(hashp, 1, hashp->save_file))
-               save_errno = errno;
-       if (hashp->dir) {
-               free(*hashp->dir);      /* Free initial segments */
-               /* Free extra segments */
-               while (hashp->exsegs--)
-                       free(hashp->dir[--hashp->nsegs]);
-               free(hashp->dir);
-       }
-       if (flush_meta(hashp) && !save_errno)
-               save_errno = errno;
-       /* Free Bigmaps */
-       for (i = 0; i < hashp->nmaps; i++)
-               if (hashp->mapp[i])
-                       free(hashp->mapp[i]);
-       if (hashp->tmp_key)
-               free(hashp->tmp_key);
-       if (hashp->tmp_buf)
-               free(hashp->tmp_buf);
-
-       if (hashp->fp != -1)
-               (void)_close(hashp->fp);
-
-       free(hashp);
-
-       if (save_errno) {
-               errno = save_errno;
-               return (ERROR);
-       }
-       return (SUCCESS);
-}
-/*
- * Write modified pages to disk
- *
- * Returns:
- *      0 == OK
- *     -1 ERROR
- */
-static int
-hash_sync(const DB *dbp, u_int32_t flags)
-{
-       HTAB *hashp;
-
-       if (flags != 0) {
-               errno = EINVAL;
-               return (ERROR);
-       }
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = (HTAB *)dbp->internal;
-       if (!hashp->save_file)
-               return (0);
-       if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
-               return (ERROR);
-       hashp->new_file = 0;
-       return (0);
-}
-
-/*
- * Returns:
- *      0 == OK
- *     -1 indicates that errno should be set
- */
-static int
-flush_meta(HTAB *hashp)
-{
-       HASHHDR *whdrp;
-#if BYTE_ORDER == LITTLE_ENDIAN
-       HASHHDR whdr;
-#endif
-       int fp, i, wsize;
-
-       if (!hashp->save_file)
-               return (0);
-       hashp->MAGIC = HASHMAGIC;
-       hashp->VERSION = HASHVERSION;
-       hashp->H_CHARKEY = hashp->hash(CHARKEY, sizeof(CHARKEY));
-
-       fp = hashp->fp;
-       whdrp = &hashp->hdr;
-#if BYTE_ORDER == LITTLE_ENDIAN
-       whdrp = &whdr;
-       swap_header_copy(&hashp->hdr, whdrp);
-#endif
-       if ((wsize = pwrite(fp, whdrp, sizeof(HASHHDR), (off_t)0)) == -1)
-               return (-1);
-       else
-               if (wsize != sizeof(HASHHDR)) {
-                       errno = EFTYPE;
-                       hashp->error = errno;
-                       return (-1);
-               }
-       for (i = 0; i < NCACHED; i++)
-               if (hashp->mapp[i])
-                       if (__put_page(hashp, (char *)hashp->mapp[i],
-                               hashp->BITMAPS[i], 0, 1))
-                               return (-1);
-       return (0);
-}
-
-/*******************************SEARCH ROUTINES *****************************/
-/*
- * All the access routines return
- *
- * Returns:
- *      0 on SUCCESS
- *      1 to indicate an external ERROR (i.e. key not found, etc)
- *     -1 to indicate an internal ERROR (i.e. out of memory, etc)
- */
-static int
-hash_get(const DB *dbp, const DBT *key, DBT *data, u_int32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-       return (hash_access(hashp, HASH_GET, (DBT *)key, data));
-}
-
-static int
-hash_put(const DB *dbp, DBT *key, const DBT *data, u_int32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag && flag != R_NOOVERWRITE) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-       if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-               hashp->error = errno = EPERM;
-               return (ERROR);
-       }
-       return (hash_access(hashp, flag == R_NOOVERWRITE ?
-           HASH_PUTNEW : HASH_PUT, (DBT *)key, (DBT *)data));
-}
-
-static int
-hash_delete(const DB *dbp, const DBT *key,
-    u_int32_t flag)            /* Ignored */
-{
-       HTAB *hashp;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag && flag != R_CURSOR) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-       if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-               hashp->error = errno = EPERM;
-               return (ERROR);
-       }
-       return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
-}
-
-/*
- * Assume that hashp has been set in wrapper routine.
- */
-static int
-hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val)
-{
-       BUFHEAD *rbufp;
-       BUFHEAD *bufp, *save_bufp;
-       u_int16_t *bp;
-       int n, ndx, off, size;
-       char *kp;
-       u_int16_t pageno;
-
-#ifdef HASH_STATISTICS
-       hash_accesses++;
-#endif
-
-       off = hashp->BSIZE;
-       size = key->size;
-       kp = (char *)key->data;
-       rbufp = __get_buf(hashp, __call_hash(hashp, kp, size), NULL, 0);
-       if (!rbufp)
-               return (ERROR);
-       save_bufp = rbufp;
-
-       /* Pin the bucket chain */
-       rbufp->flags |= BUF_PIN;
-       for (bp = (u_int16_t *)rbufp->page, n = *bp++, ndx = 1; ndx < n;)
-               if (bp[1] >= REAL_KEY) {
-                       /* Real key/data pair */
-                       if (size == off - *bp &&
-                           memcmp(kp, rbufp->page + *bp, size) == 0)
-                               goto found;
-                       off = bp[1];
-#ifdef HASH_STATISTICS
-                       hash_collisions++;
-#endif
-                       bp += 2;
-                       ndx += 2;
-               } else if (bp[1] == OVFLPAGE) {
-                       rbufp = __get_buf(hashp, *bp, rbufp, 0);
-                       if (!rbufp) {
-                               save_bufp->flags &= ~BUF_PIN;
-                               return (ERROR);
-                       }
-                       /* FOR LOOP INIT */
-                       bp = (u_int16_t *)rbufp->page;
-                       n = *bp++;
-                       ndx = 1;
-                       off = hashp->BSIZE;
-               } else if (bp[1] < REAL_KEY) {
-                       if ((ndx =
-                           __find_bigpair(hashp, rbufp, ndx, kp, size)) > 0)
-                               goto found;
-                       if (ndx == -2) {
-                               bufp = rbufp;
-                               if (!(pageno =
-                                   __find_last_page(hashp, &bufp))) {
-                                       ndx = 0;
-                                       rbufp = bufp;
-                                       break;  /* FOR */
-                               }
-                               rbufp = __get_buf(hashp, pageno, bufp, 0);
-                               if (!rbufp) {
-                                       save_bufp->flags &= ~BUF_PIN;
-                                       return (ERROR);
-                               }
-                               /* FOR LOOP INIT */
-                               bp = (u_int16_t *)rbufp->page;
-                               n = *bp++;
-                               ndx = 1;
-                               off = hashp->BSIZE;
-                       } else {
-                               save_bufp->flags &= ~BUF_PIN;
-                               return (ERROR);
-                       }
-               }
-
-       /* Not found */
-       switch (action) {
-       case HASH_PUT:
-       case HASH_PUTNEW:
-               if (__addel(hashp, rbufp, key, val)) {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (ERROR);
-               } else {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (SUCCESS);
-               }
-       case HASH_GET:
-       case HASH_DELETE:
-       default:
-               save_bufp->flags &= ~BUF_PIN;
-               return (ABNORMAL);
-       }
-
-found:
-       switch (action) {
-       case HASH_PUTNEW:
-               save_bufp->flags &= ~BUF_PIN;
-               return (ABNORMAL);
-       case HASH_GET:
-               bp = (u_int16_t *)rbufp->page;
-               if (bp[ndx + 1] < REAL_KEY) {
-                       if (__big_return(hashp, rbufp, ndx, val, 0))
-                               return (ERROR);
-               } else {
-                       val->data = (u_char *)rbufp->page + (int)bp[ndx + 1];
-                       val->size = bp[ndx] - bp[ndx + 1];
-               }
-               break;
-       case HASH_PUT:
-               if ((__delpair(hashp, rbufp, ndx)) ||
-                   (__addel(hashp, rbufp, key, val))) {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (ERROR);
-               }
-               break;
-       case HASH_DELETE:
-               if (__delpair(hashp, rbufp, ndx))
-                       return (ERROR);
-               break;
-       default:
-               LIBC_ABORT("illegal action (%d)", action);
-       }
-       save_bufp->flags &= ~BUF_PIN;
-       return (SUCCESS);
-}
-
-static int
-hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag)
-{
-       u_int32_t bucket;
-       BUFHEAD *bufp;
-       HTAB *hashp;
-       u_int16_t *bp, ndx;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag && flag != R_FIRST && flag != R_NEXT) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-#ifdef HASH_STATISTICS
-       hash_accesses++;
-#endif
-       if ((hashp->cbucket < 0) || (flag == R_FIRST)) {
-               hashp->cbucket = 0;
-               hashp->cndx = 1;
-               hashp->cpage = NULL;
-       }
- next_bucket:
-       for (bp = NULL; !bp || !bp[0]; ) {
-               if (!(bufp = hashp->cpage)) {
-                       for (bucket = hashp->cbucket;
-                           bucket <= hashp->MAX_BUCKET;
-                           bucket++, hashp->cndx = 1) {
-                               bufp = __get_buf(hashp, bucket, NULL, 0);
-                               if (!bufp)
-                                       return (ERROR);
-                               hashp->cpage = bufp;
-                               bp = (u_int16_t *)bufp->page;
-                               if (bp[0])
-                                       break;
-                       }
-                       hashp->cbucket = bucket;
-                       if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) {
-                               hashp->cbucket = -1;
-                               return (ABNORMAL);
-                       }
-               } else {
-                       bp = (u_int16_t *)hashp->cpage->page;
-                       if (flag == R_NEXT) {
-                               hashp->cndx += 2;
-                               if (hashp->cndx > bp[0]) {
-                                       hashp->cpage = NULL;
-                                       hashp->cbucket++;
-                                       hashp->cndx = 1;
-                                       goto next_bucket;
-                               }
-                       }
-               }
-
-#ifdef DEBUG
-               assert(bp);
-               assert(bufp);
-#endif
-               while (bp[hashp->cndx + 1] == OVFLPAGE) {
-                       bufp = hashp->cpage =
-                           __get_buf(hashp, bp[hashp->cndx], bufp, 0);
-                       if (!bufp)
-                               return (ERROR);
-                       bp = (u_int16_t *)(bufp->page);
-                       hashp->cndx = 1;
-               }
-               if (!bp[0]) {
-                       hashp->cpage = NULL;
-                       ++hashp->cbucket;
-               }
-       }
-       ndx = hashp->cndx;
-       if (bp[ndx + 1] < REAL_KEY) {
-               if (__big_keydata(hashp, bufp, key, data, 1))
-                       return (ERROR);
-       } else {
-               if (hashp->cpage == 0)
-                       return (ERROR);
-               key->data = (u_char *)hashp->cpage->page + bp[ndx];
-               key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
-               data->data = (u_char *)hashp->cpage->page + bp[ndx + 1];
-               data->size = bp[ndx] - bp[ndx + 1];
-       }
-       return (SUCCESS);
-}
-
-/********************************* UTILITIES ************************/
-
-/*
- * Returns:
- *      0 ==> OK
- *     -1 ==> Error
- */
-int
-__expand_table(HTAB *hashp)
-{
-       u_int32_t old_bucket, new_bucket;
-       int dirsize, new_segnum, spare_ndx;
-
-#ifdef HASH_STATISTICS
-       hash_expansions++;
-#endif
-       new_bucket = ++hashp->MAX_BUCKET;
-       old_bucket = (hashp->MAX_BUCKET & hashp->LOW_MASK);
-
-       new_segnum = new_bucket >> hashp->SSHIFT;
-
-       /* Check if we need a new segment */
-       if (new_segnum >= hashp->nsegs) {
-               /* Check if we need to expand directory */
-               if (new_segnum >= hashp->DSIZE) {
-                       /* Reallocate directory */
-                       dirsize = hashp->DSIZE * sizeof(SEGMENT *);
-                       if (!hash_realloc(&hashp->dir, dirsize, dirsize << 1))
-                               return (-1);
-                       hashp->DSIZE = dirsize << 1;
-               }
-               if ((hashp->dir[new_segnum] =
-                   (SEGMENT)calloc(hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
-                       return (-1);
-               hashp->exsegs++;
-               hashp->nsegs++;
-       }
-       /*
-        * If the split point is increasing (MAX_BUCKET's log base 2
-        * * increases), we need to copy the current contents of the spare
-        * split bucket to the next bucket.
-        */
-       spare_ndx = __log2(hashp->MAX_BUCKET + 1);
-       if (spare_ndx > hashp->OVFL_POINT) {
-               hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
-               hashp->OVFL_POINT = spare_ndx;
-       }
-
-       if (new_bucket > hashp->HIGH_MASK) {
-               /* Starting a new doubling */
-               hashp->LOW_MASK = hashp->HIGH_MASK;
-               hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
-       }
-       /* Relocate records to the new bucket */
-       return (__split_page(hashp, old_bucket, new_bucket));
-}
-
-/*
- * If realloc guarantees that the pointer is not destroyed if the realloc
- * fails, then this routine can go away.
- */
-static void *
-hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize)
-{
-       void *p;
-
-       if ( (p = malloc(newsize)) ) {
-               memmove(p, *p_ptr, oldsize);
-               memset((char *)p + oldsize, 0, newsize - oldsize);
-               free(*p_ptr);
-               *p_ptr = p;
-       }
-       return (p);
-}
-
-u_int32_t
-__call_hash(HTAB *hashp, char *k, int len)
-{
-       unsigned int n, bucket;
-
-       n = hashp->hash(k, len);
-       bucket = n & hashp->HIGH_MASK;
-       if (bucket > hashp->MAX_BUCKET)
-               bucket = bucket & hashp->LOW_MASK;
-       return (bucket);
-}
-
-/*
- * Allocate segment table.  On error, destroy the table and set errno.
- *
- * Returns 0 on success
- */
-static int
-alloc_segs(HTAB *hashp, int nsegs)
-{
-       int i;
-       SEGMENT store;
-
-       int save_errno;
-
-       if ((hashp->dir =
-           (SEGMENT *)calloc(hashp->DSIZE, sizeof(SEGMENT *))) == NULL) {
-               save_errno = errno;
-               (void)hdestroy(hashp);
-               errno = save_errno;
-               return (-1);
-       }
-       hashp->nsegs = nsegs;
-       if (nsegs == 0)
-               return (0);
-       /* Allocate segments */
-       if ((store = (SEGMENT)calloc(nsegs << hashp->SSHIFT,
-           sizeof(SEGMENT))) == NULL) {
-               save_errno = errno;
-               (void)hdestroy(hashp);
-               errno = save_errno;
-               return (-1);
-       }
-       for (i = 0; i < nsegs; i++)
-               hashp->dir[i] = &store[i << hashp->SSHIFT];
-       return (0);
-}
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-/*
- * Hashp->hdr needs to be byteswapped.
- */
-static void
-swap_header_copy(HASHHDR *srcp, HASHHDR *destp)
-{
-       int i;
-
-       P_32_COPY(srcp->magic, destp->magic);
-       P_32_COPY(srcp->version, destp->version);
-       P_32_COPY(srcp->lorder, destp->lorder);
-       P_32_COPY(srcp->bsize, destp->bsize);
-       P_32_COPY(srcp->bshift, destp->bshift);
-       P_32_COPY(srcp->dsize, destp->dsize);
-       P_32_COPY(srcp->ssize, destp->ssize);
-       P_32_COPY(srcp->sshift, destp->sshift);
-       P_32_COPY(srcp->ovfl_point, destp->ovfl_point);
-       P_32_COPY(srcp->last_freed, destp->last_freed);
-       P_32_COPY(srcp->max_bucket, destp->max_bucket);
-       P_32_COPY(srcp->high_mask, destp->high_mask);
-       P_32_COPY(srcp->low_mask, destp->low_mask);
-       P_32_COPY(srcp->ffactor, destp->ffactor);
-       P_32_COPY(srcp->nkeys, destp->nkeys);
-       P_32_COPY(srcp->hdrpages, destp->hdrpages);
-       P_32_COPY(srcp->h_charkey, destp->h_charkey);
-       for (i = 0; i < NCACHED; i++) {
-               P_32_COPY(srcp->spares[i], destp->spares[i]);
-               P_16_COPY(srcp->bitmaps[i], destp->bitmaps[i]);
-       }
-}
-
-static void
-swap_header(HTAB *hashp)
-{
-       HASHHDR *hdrp;
-       int i;
-
-       hdrp = &hashp->hdr;
-
-       M_32_SWAP(hdrp->magic);
-       M_32_SWAP(hdrp->version);
-       M_32_SWAP(hdrp->lorder);
-       M_32_SWAP(hdrp->bsize);
-       M_32_SWAP(hdrp->bshift);
-       M_32_SWAP(hdrp->dsize);
-       M_32_SWAP(hdrp->ssize);
-       M_32_SWAP(hdrp->sshift);
-       M_32_SWAP(hdrp->ovfl_point);
-       M_32_SWAP(hdrp->last_freed);
-       M_32_SWAP(hdrp->max_bucket);
-       M_32_SWAP(hdrp->high_mask);
-       M_32_SWAP(hdrp->low_mask);
-       M_32_SWAP(hdrp->ffactor);
-       M_32_SWAP(hdrp->nkeys);
-       M_32_SWAP(hdrp->hdrpages);
-       M_32_SWAP(hdrp->h_charkey);
-       for (i = 0; i < NCACHED; i++) {
-               M_32_SWAP(hdrp->spares[i]);
-               M_16_SWAP(hdrp->bitmaps[i]);
-       }
-}
-#endif
diff --git a/db/hash/hash-fbsd.c.orig b/db/hash/hash-fbsd.c.orig
deleted file mode 100644 (file)
index 8e41d8f..0000000
+++ /dev/null
@@ -1,964 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c     8.9 (Berkeley) 6/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delphij Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef DEBUG
-#include <assert.h>
-#endif
-#include "un-namespace.h"
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-static int   alloc_segs(HTAB *, int);
-static int   flush_meta(HTAB *);
-static int   hash_access(HTAB *, ACTION, DBT *, DBT *);
-static int   hash_close(DB *);
-static int   hash_delete(const DB *, const DBT *, u_int32_t);
-static int   hash_fd(const DB *);
-static int   hash_get(const DB *, const DBT *, DBT *, u_int32_t);
-static int   hash_put(const DB *, DBT *, const DBT *, u_int32_t);
-static void *hash_realloc(SEGMENT **, int, int);
-static int   hash_seq(const DB *, DBT *, DBT *, u_int32_t);
-static int   hash_sync(const DB *, u_int32_t);
-static int   hdestroy(HTAB *);
-static HTAB *init_hash(HTAB *, const char *, const HASHINFO *);
-static int   init_htab(HTAB *, int);
-#if BYTE_ORDER == LITTLE_ENDIAN
-static void  swap_header(HTAB *);
-static void  swap_header_copy(HASHHDR *, HASHHDR *);
-#endif
-
-/* Fast arithmetic, relying on powers of 2, */
-#define MOD(x, y)              ((x) & ((y) - 1))
-
-#define RETURN_ERROR(ERR, LOC) { save_errno = ERR; goto LOC; }
-
-/* Return values */
-#define        SUCCESS  (0)
-#define        ERROR   (-1)
-#define        ABNORMAL (1)
-
-#ifdef HASH_STATISTICS
-int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
-#endif
-
-/************************** INTERFACE ROUTINES ***************************/
-/* OPEN/CLOSE */
-
-/* ARGSUSED */
-DB *
-__hash_open(const char *file, int flags, int mode,
-    const HASHINFO *info,      /* Special directives for create */
-    int dflags)
-{
-       HTAB *hashp;
-       struct stat statbuf;
-       DB *dbp;
-       int bpages, hdrsize, new_table, nsegs, save_errno;
-
-       if ((flags & O_ACCMODE) == O_WRONLY) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB))))
-               return (NULL);
-       hashp->fp = -1;
-
-       /*
-        * Even if user wants write only, we need to be able to read
-        * the actual file, so we need to open it read/write. But, the
-        * field in the hashp structure needs to be accurate so that
-        * we can check accesses.
-        */
-       hashp->flags = flags;
-
-       if (file) {
-               if ((hashp->fp = _open(file, flags, mode)) == -1)
-                       RETURN_ERROR(errno, error0);
-               (void)_fcntl(hashp->fp, F_SETFD, 1);
-               new_table = _fstat(hashp->fp, &statbuf) == 0 &&
-                   statbuf.st_size == 0 &&
-                   ((flags & O_ACCMODE) != O_RDONLY || (flags & O_CREAT) != 0);
-       } else
-               new_table = 1;
-
-       if (new_table) {
-               if (!(hashp = init_hash(hashp, file, info)))
-                       RETURN_ERROR(errno, error1);
-       } else {
-               /* Table already exists */
-               if (info && info->hash)
-                       hashp->hash = info->hash;
-               else
-                       hashp->hash = __default_hash;
-
-               hdrsize = _read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
-#if BYTE_ORDER == LITTLE_ENDIAN
-               swap_header(hashp);
-#endif
-               if (hdrsize == -1)
-                       RETURN_ERROR(errno, error1);
-               if (hdrsize != sizeof(HASHHDR))
-                       RETURN_ERROR(EFTYPE, error1);
-               /* Verify file type, versions and hash function */
-               if (hashp->MAGIC != HASHMAGIC)
-                       RETURN_ERROR(EFTYPE, error1);
-#define        OLDHASHVERSION  1
-               if (hashp->VERSION != HASHVERSION &&
-                   hashp->VERSION != OLDHASHVERSION)
-                       RETURN_ERROR(EFTYPE, error1);
-               if ((int32_t)hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
-                       RETURN_ERROR(EFTYPE, error1);
-               /*
-                * Figure out how many segments we need.  Max_Bucket is the
-                * maximum bucket number, so the number of buckets is
-                * max_bucket + 1.
-                */
-               nsegs = (hashp->MAX_BUCKET + 1 + hashp->SGSIZE - 1) /
-                        hashp->SGSIZE;
-               if (alloc_segs(hashp, nsegs))
-                       /*
-                        * If alloc_segs fails, table will have been destroyed
-                        * and errno will have been set.
-                        */
-                       return (NULL);
-               /* Read in bitmaps */
-               bpages = (hashp->SPARES[hashp->OVFL_POINT] +
-                   (hashp->BSIZE << BYTE_SHIFT) - 1) >>
-                   (hashp->BSHIFT + BYTE_SHIFT);
-
-               hashp->nmaps = bpages;
-               (void)memset(&hashp->mapp[0], 0, bpages * sizeof(u_int32_t *));
-       }
-
-       /* Initialize Buffer Manager */
-       if (info && info->cachesize)
-               __buf_init(hashp, info->cachesize);
-       else
-               __buf_init(hashp, DEF_BUFSIZE);
-
-       hashp->new_file = new_table;
-       hashp->save_file = file && (hashp->flags & O_RDWR);
-       hashp->cbucket = -1;
-       if (!(dbp = (DB *)malloc(sizeof(DB)))) {
-               save_errno = errno;
-               hdestroy(hashp);
-               errno = save_errno;
-               return (NULL);
-       }
-       dbp->internal = hashp;
-       dbp->close = hash_close;
-       dbp->del = hash_delete;
-       dbp->fd = hash_fd;
-       dbp->get = hash_get;
-       dbp->put = hash_put;
-       dbp->seq = hash_seq;
-       dbp->sync = hash_sync;
-       dbp->type = DB_HASH;
-
-#ifdef DEBUG
-       (void)fprintf(stderr,
-"%s\n%s%p\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%x\n%s%x\n%s%d\n%s%d\n",
-           "init_htab:",
-           "TABLE POINTER   ", hashp,
-           "BUCKET SIZE     ", hashp->BSIZE,
-           "BUCKET SHIFT    ", hashp->BSHIFT,
-           "DIRECTORY SIZE  ", hashp->DSIZE,
-           "SEGMENT SIZE    ", hashp->SGSIZE,
-           "SEGMENT SHIFT   ", hashp->SSHIFT,
-           "FILL FACTOR     ", hashp->FFACTOR,
-           "MAX BUCKET      ", hashp->MAX_BUCKET,
-           "OVFL POINT      ", hashp->OVFL_POINT,
-           "LAST FREED      ", hashp->LAST_FREED,
-           "HIGH MASK       ", hashp->HIGH_MASK,
-           "LOW  MASK       ", hashp->LOW_MASK,
-           "NSEGS           ", hashp->nsegs,
-           "NKEYS           ", hashp->NKEYS);
-#endif
-#ifdef HASH_STATISTICS
-       hash_overflows = hash_accesses = hash_collisions = hash_expansions = 0;
-#endif
-       return (dbp);
-
-error1:
-       if (hashp != NULL)
-               (void)_close(hashp->fp);
-
-error0:
-       free(hashp);
-       errno = save_errno;
-       return (NULL);
-}
-
-static int
-hash_close(DB *dbp)
-{
-       HTAB *hashp;
-       int retval;
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = (HTAB *)dbp->internal;
-       retval = hdestroy(hashp);
-       free(dbp);
-       return (retval);
-}
-
-static int
-hash_fd(const DB *dbp)
-{
-       HTAB *hashp;
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = (HTAB *)dbp->internal;
-       if (hashp->fp == -1) {
-               errno = ENOENT;
-               return (-1);
-       }
-       return (hashp->fp);
-}
-
-/************************** LOCAL CREATION ROUTINES **********************/
-static HTAB *
-init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
-{
-       struct stat statbuf;
-       int nelem;
-
-       nelem = 1;
-       hashp->NKEYS = 0;
-       hashp->LORDER = BYTE_ORDER;
-       hashp->BSIZE = DEF_BUCKET_SIZE;
-       hashp->BSHIFT = DEF_BUCKET_SHIFT;
-       hashp->SGSIZE = DEF_SEGSIZE;
-       hashp->SSHIFT = DEF_SEGSIZE_SHIFT;
-       hashp->DSIZE = DEF_DIRSIZE;
-       hashp->FFACTOR = DEF_FFACTOR;
-       hashp->hash = __default_hash;
-       memset(hashp->SPARES, 0, sizeof(hashp->SPARES));
-       memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS));
-
-       /* Fix bucket size to be optimal for file system */
-       if (file != NULL) {
-               if (stat(file, &statbuf))
-                       return (NULL);
-               hashp->BSIZE = statbuf.st_blksize;
-               hashp->BSHIFT = __log2(hashp->BSIZE);
-       }
-
-       if (info) {
-               if (info->bsize) {
-                       /* Round pagesize up to power of 2 */
-                       hashp->BSHIFT = __log2(info->bsize);
-                       hashp->BSIZE = 1 << hashp->BSHIFT;
-                       if (hashp->BSIZE > MAX_BSIZE) {
-                               errno = EINVAL;
-                               return (NULL);
-                       }
-               }
-               if (info->ffactor)
-                       hashp->FFACTOR = info->ffactor;
-               if (info->hash)
-                       hashp->hash = info->hash;
-               if (info->nelem)
-                       nelem = info->nelem;
-               if (info->lorder) {
-                       if (info->lorder != BIG_ENDIAN &&
-                           info->lorder != LITTLE_ENDIAN) {
-                               errno = EINVAL;
-                               return (NULL);
-                       }
-                       hashp->LORDER = info->lorder;
-               }
-       }
-       /* init_htab should destroy the table and set errno if it fails */
-       if (init_htab(hashp, nelem))
-               return (NULL);
-       else
-               return (hashp);
-}
-/*
- * This calls alloc_segs which may run out of memory.  Alloc_segs will destroy
- * the table and set errno, so we just pass the error information along.
- *
- * Returns 0 on No Error
- */
-static int
-init_htab(HTAB *hashp, int nelem)
-{
-       int nbuckets, nsegs, l2;
-
-       /*
-        * Divide number of elements by the fill factor and determine a
-        * desired number of buckets.  Allocate space for the next greater
-        * power of two number of buckets.
-        */
-       nelem = (nelem - 1) / hashp->FFACTOR + 1;
-
-       l2 = __log2(MAX(nelem, 2));
-       nbuckets = 1 << l2;
-
-       hashp->SPARES[l2] = l2 + 1;
-       hashp->SPARES[l2 + 1] = l2 + 1;
-       hashp->OVFL_POINT = l2;
-       hashp->LAST_FREED = 2;
-
-       /* First bitmap page is at: splitpoint l2 page offset 1 */
-       if (__ibitmap(hashp, OADDR_OF(l2, 1), l2 + 1, 0))
-               return (-1);
-
-       hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1;
-       hashp->HIGH_MASK = (nbuckets << 1) - 1;
-       hashp->HDRPAGES = ((MAX(sizeof(HASHHDR), MINHDRSIZE) - 1) >>
-           hashp->BSHIFT) + 1;
-
-       nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
-       nsegs = 1 << __log2(nsegs);
-
-       if (nsegs > hashp->DSIZE)
-               hashp->DSIZE = nsegs;
-       return (alloc_segs(hashp, nsegs));
-}
-
-/********************** DESTROY/CLOSE ROUTINES ************************/
-
-/*
- * Flushes any changes to the file if necessary and destroys the hashp
- * structure, freeing all allocated space.
- */
-static int
-hdestroy(HTAB *hashp)
-{
-       int i, save_errno;
-
-       save_errno = 0;
-
-#ifdef HASH_STATISTICS
-       (void)fprintf(stderr, "hdestroy: accesses %ld collisions %ld\n",
-           hash_accesses, hash_collisions);
-       (void)fprintf(stderr, "hdestroy: expansions %ld\n",
-           hash_expansions);
-       (void)fprintf(stderr, "hdestroy: overflows %ld\n",
-           hash_overflows);
-       (void)fprintf(stderr, "keys %ld maxp %d segmentcount %d\n",
-           hashp->NKEYS, hashp->MAX_BUCKET, hashp->nsegs);
-
-       for (i = 0; i < NCACHED; i++)
-               (void)fprintf(stderr,
-                   "spares[%d] = %d\n", i, hashp->SPARES[i]);
-#endif
-       /*
-        * Call on buffer manager to free buffers, and if required,
-        * write them to disk.
-        */
-       if (__buf_free(hashp, 1, hashp->save_file))
-               save_errno = errno;
-       if (hashp->dir) {
-               free(*hashp->dir);      /* Free initial segments */
-               /* Free extra segments */
-               while (hashp->exsegs--)
-                       free(hashp->dir[--hashp->nsegs]);
-               free(hashp->dir);
-       }
-       if (flush_meta(hashp) && !save_errno)
-               save_errno = errno;
-       /* Free Bigmaps */
-       for (i = 0; i < hashp->nmaps; i++)
-               if (hashp->mapp[i])
-                       free(hashp->mapp[i]);
-       if (hashp->tmp_key)
-               free(hashp->tmp_key);
-       if (hashp->tmp_buf)
-               free(hashp->tmp_buf);
-
-       if (hashp->fp != -1)
-               (void)_close(hashp->fp);
-
-       free(hashp);
-
-       if (save_errno) {
-               errno = save_errno;
-               return (ERROR);
-       }
-       return (SUCCESS);
-}
-/*
- * Write modified pages to disk
- *
- * Returns:
- *      0 == OK
- *     -1 ERROR
- */
-static int
-hash_sync(const DB *dbp, u_int32_t flags)
-{
-       HTAB *hashp;
-
-       if (flags != 0) {
-               errno = EINVAL;
-               return (ERROR);
-       }
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = (HTAB *)dbp->internal;
-       if (!hashp->save_file)
-               return (0);
-       if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
-               return (ERROR);
-       hashp->new_file = 0;
-       return (0);
-}
-
-/*
- * Returns:
- *      0 == OK
- *     -1 indicates that errno should be set
- */
-static int
-flush_meta(HTAB *hashp)
-{
-       HASHHDR *whdrp;
-#if BYTE_ORDER == LITTLE_ENDIAN
-       HASHHDR whdr;
-#endif
-       int fp, i, wsize;
-
-       if (!hashp->save_file)
-               return (0);
-       hashp->MAGIC = HASHMAGIC;
-       hashp->VERSION = HASHVERSION;
-       hashp->H_CHARKEY = hashp->hash(CHARKEY, sizeof(CHARKEY));
-
-       fp = hashp->fp;
-       whdrp = &hashp->hdr;
-#if BYTE_ORDER == LITTLE_ENDIAN
-       whdrp = &whdr;
-       swap_header_copy(&hashp->hdr, whdrp);
-#endif
-       if ((wsize = pwrite(fp, whdrp, sizeof(HASHHDR), (off_t)0)) == -1)
-               return (-1);
-       else
-               if (wsize != sizeof(HASHHDR)) {
-                       errno = EFTYPE;
-                       hashp->error = errno;
-                       return (-1);
-               }
-       for (i = 0; i < NCACHED; i++)
-               if (hashp->mapp[i])
-                       if (__put_page(hashp, (char *)hashp->mapp[i],
-                               hashp->BITMAPS[i], 0, 1))
-                               return (-1);
-       return (0);
-}
-
-/*******************************SEARCH ROUTINES *****************************/
-/*
- * All the access routines return
- *
- * Returns:
- *      0 on SUCCESS
- *      1 to indicate an external ERROR (i.e. key not found, etc)
- *     -1 to indicate an internal ERROR (i.e. out of memory, etc)
- */
-static int
-hash_get(const DB *dbp, const DBT *key, DBT *data, u_int32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-       return (hash_access(hashp, HASH_GET, (DBT *)key, data));
-}
-
-static int
-hash_put(const DB *dbp, DBT *key, const DBT *data, u_int32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag && flag != R_NOOVERWRITE) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-       if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-               hashp->error = errno = EPERM;
-               return (ERROR);
-       }
-       return (hash_access(hashp, flag == R_NOOVERWRITE ?
-           HASH_PUTNEW : HASH_PUT, (DBT *)key, (DBT *)data));
-}
-
-static int
-hash_delete(const DB *dbp, const DBT *key,
-    u_int32_t flag)            /* Ignored */
-{
-       HTAB *hashp;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag && flag != R_CURSOR) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-       if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-               hashp->error = errno = EPERM;
-               return (ERROR);
-       }
-       return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
-}
-
-/*
- * Assume that hashp has been set in wrapper routine.
- */
-static int
-hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val)
-{
-       BUFHEAD *rbufp;
-       BUFHEAD *bufp, *save_bufp;
-       u_int16_t *bp;
-       int n, ndx, off, size;
-       char *kp;
-       u_int16_t pageno;
-
-#ifdef HASH_STATISTICS
-       hash_accesses++;
-#endif
-
-       off = hashp->BSIZE;
-       size = key->size;
-       kp = (char *)key->data;
-       rbufp = __get_buf(hashp, __call_hash(hashp, kp, size), NULL, 0);
-       if (!rbufp)
-               return (ERROR);
-       save_bufp = rbufp;
-
-       /* Pin the bucket chain */
-       rbufp->flags |= BUF_PIN;
-       for (bp = (u_int16_t *)rbufp->page, n = *bp++, ndx = 1; ndx < n;)
-               if (bp[1] >= REAL_KEY) {
-                       /* Real key/data pair */
-                       if (size == off - *bp &&
-                           memcmp(kp, rbufp->page + *bp, size) == 0)
-                               goto found;
-                       off = bp[1];
-#ifdef HASH_STATISTICS
-                       hash_collisions++;
-#endif
-                       bp += 2;
-                       ndx += 2;
-               } else if (bp[1] == OVFLPAGE) {
-                       rbufp = __get_buf(hashp, *bp, rbufp, 0);
-                       if (!rbufp) {
-                               save_bufp->flags &= ~BUF_PIN;
-                               return (ERROR);
-                       }
-                       /* FOR LOOP INIT */
-                       bp = (u_int16_t *)rbufp->page;
-                       n = *bp++;
-                       ndx = 1;
-                       off = hashp->BSIZE;
-               } else if (bp[1] < REAL_KEY) {
-                       if ((ndx =
-                           __find_bigpair(hashp, rbufp, ndx, kp, size)) > 0)
-                               goto found;
-                       if (ndx == -2) {
-                               bufp = rbufp;
-                               if (!(pageno =
-                                   __find_last_page(hashp, &bufp))) {
-                                       ndx = 0;
-                                       rbufp = bufp;
-                                       break;  /* FOR */
-                               }
-                               rbufp = __get_buf(hashp, pageno, bufp, 0);
-                               if (!rbufp) {
-                                       save_bufp->flags &= ~BUF_PIN;
-                                       return (ERROR);
-                               }
-                               /* FOR LOOP INIT */
-                               bp = (u_int16_t *)rbufp->page;
-                               n = *bp++;
-                               ndx = 1;
-                               off = hashp->BSIZE;
-                       } else {
-                               save_bufp->flags &= ~BUF_PIN;
-                               return (ERROR);
-                       }
-               }
-
-       /* Not found */
-       switch (action) {
-       case HASH_PUT:
-       case HASH_PUTNEW:
-               if (__addel(hashp, rbufp, key, val)) {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (ERROR);
-               } else {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (SUCCESS);
-               }
-       case HASH_GET:
-       case HASH_DELETE:
-       default:
-               save_bufp->flags &= ~BUF_PIN;
-               return (ABNORMAL);
-       }
-
-found:
-       switch (action) {
-       case HASH_PUTNEW:
-               save_bufp->flags &= ~BUF_PIN;
-               return (ABNORMAL);
-       case HASH_GET:
-               bp = (u_int16_t *)rbufp->page;
-               if (bp[ndx + 1] < REAL_KEY) {
-                       if (__big_return(hashp, rbufp, ndx, val, 0))
-                               return (ERROR);
-               } else {
-                       val->data = (u_char *)rbufp->page + (int)bp[ndx + 1];
-                       val->size = bp[ndx] - bp[ndx + 1];
-               }
-               break;
-       case HASH_PUT:
-               if ((__delpair(hashp, rbufp, ndx)) ||
-                   (__addel(hashp, rbufp, key, val))) {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (ERROR);
-               }
-               break;
-       case HASH_DELETE:
-               if (__delpair(hashp, rbufp, ndx))
-                       return (ERROR);
-               break;
-       default:
-               abort();
-       }
-       save_bufp->flags &= ~BUF_PIN;
-       return (SUCCESS);
-}
-
-static int
-hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag)
-{
-       u_int32_t bucket;
-       BUFHEAD *bufp;
-       HTAB *hashp;
-       u_int16_t *bp, ndx;
-
-       hashp = (HTAB *)dbp->internal;
-       if (flag && flag != R_FIRST && flag != R_NEXT) {
-               hashp->error = errno = EINVAL;
-               return (ERROR);
-       }
-#ifdef HASH_STATISTICS
-       hash_accesses++;
-#endif
-       if ((hashp->cbucket < 0) || (flag == R_FIRST)) {
-               hashp->cbucket = 0;
-               hashp->cndx = 1;
-               hashp->cpage = NULL;
-       }
- next_bucket:
-       for (bp = NULL; !bp || !bp[0]; ) {
-               if (!(bufp = hashp->cpage)) {
-                       for (bucket = hashp->cbucket;
-                           bucket <= hashp->MAX_BUCKET;
-                           bucket++, hashp->cndx = 1) {
-                               bufp = __get_buf(hashp, bucket, NULL, 0);
-                               if (!bufp)
-                                       return (ERROR);
-                               hashp->cpage = bufp;
-                               bp = (u_int16_t *)bufp->page;
-                               if (bp[0])
-                                       break;
-                       }
-                       hashp->cbucket = bucket;
-                       if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) {
-                               hashp->cbucket = -1;
-                               return (ABNORMAL);
-                       }
-               } else {
-                       bp = (u_int16_t *)hashp->cpage->page;
-                       if (flag == R_NEXT) {
-                               hashp->cndx += 2;
-                               if (hashp->cndx > bp[0]) {
-                                       hashp->cpage = NULL;
-                                       hashp->cbucket++;
-                                       hashp->cndx = 1;
-                                       goto next_bucket;
-                               }
-                       }
-               }
-
-#ifdef DEBUG
-               assert(bp);
-               assert(bufp);
-#endif
-               while (bp[hashp->cndx + 1] == OVFLPAGE) {
-                       bufp = hashp->cpage =
-                           __get_buf(hashp, bp[hashp->cndx], bufp, 0);
-                       if (!bufp)
-                               return (ERROR);
-                       bp = (u_int16_t *)(bufp->page);
-                       hashp->cndx = 1;
-               }
-               if (!bp[0]) {
-                       hashp->cpage = NULL;
-                       ++hashp->cbucket;
-               }
-       }
-       ndx = hashp->cndx;
-       if (bp[ndx + 1] < REAL_KEY) {
-               if (__big_keydata(hashp, bufp, key, data, 1))
-                       return (ERROR);
-       } else {
-               if (hashp->cpage == 0)
-                       return (ERROR);
-               key->data = (u_char *)hashp->cpage->page + bp[ndx];
-               key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
-               data->data = (u_char *)hashp->cpage->page + bp[ndx + 1];
-               data->size = bp[ndx] - bp[ndx + 1];
-       }
-       return (SUCCESS);
-}
-
-/********************************* UTILITIES ************************/
-
-/*
- * Returns:
- *      0 ==> OK
- *     -1 ==> Error
- */
-int
-__expand_table(HTAB *hashp)
-{
-       u_int32_t old_bucket, new_bucket;
-       int dirsize, new_segnum, spare_ndx;
-
-#ifdef HASH_STATISTICS
-       hash_expansions++;
-#endif
-       new_bucket = ++hashp->MAX_BUCKET;
-       old_bucket = (hashp->MAX_BUCKET & hashp->LOW_MASK);
-
-       new_segnum = new_bucket >> hashp->SSHIFT;
-
-       /* Check if we need a new segment */
-       if (new_segnum >= hashp->nsegs) {
-               /* Check if we need to expand directory */
-               if (new_segnum >= hashp->DSIZE) {
-                       /* Reallocate directory */
-                       dirsize = hashp->DSIZE * sizeof(SEGMENT *);
-                       if (!hash_realloc(&hashp->dir, dirsize, dirsize << 1))
-                               return (-1);
-                       hashp->DSIZE = dirsize << 1;
-               }
-               if ((hashp->dir[new_segnum] =
-                   (SEGMENT)calloc(hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
-                       return (-1);
-               hashp->exsegs++;
-               hashp->nsegs++;
-       }
-       /*
-        * If the split point is increasing (MAX_BUCKET's log base 2
-        * * increases), we need to copy the current contents of the spare
-        * split bucket to the next bucket.
-        */
-       spare_ndx = __log2(hashp->MAX_BUCKET + 1);
-       if (spare_ndx > hashp->OVFL_POINT) {
-               hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
-               hashp->OVFL_POINT = spare_ndx;
-       }
-
-       if (new_bucket > hashp->HIGH_MASK) {
-               /* Starting a new doubling */
-               hashp->LOW_MASK = hashp->HIGH_MASK;
-               hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
-       }
-       /* Relocate records to the new bucket */
-       return (__split_page(hashp, old_bucket, new_bucket));
-}
-
-/*
- * If realloc guarantees that the pointer is not destroyed if the realloc
- * fails, then this routine can go away.
- */
-static void *
-hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize)
-{
-       void *p;
-
-       if ( (p = malloc(newsize)) ) {
-               memmove(p, *p_ptr, oldsize);
-               memset((char *)p + oldsize, 0, newsize - oldsize);
-               free(*p_ptr);
-               *p_ptr = p;
-       }
-       return (p);
-}
-
-u_int32_t
-__call_hash(HTAB *hashp, char *k, int len)
-{
-       unsigned int n, bucket;
-
-       n = hashp->hash(k, len);
-       bucket = n & hashp->HIGH_MASK;
-       if (bucket > hashp->MAX_BUCKET)
-               bucket = bucket & hashp->LOW_MASK;
-       return (bucket);
-}
-
-/*
- * Allocate segment table.  On error, destroy the table and set errno.
- *
- * Returns 0 on success
- */
-static int
-alloc_segs(HTAB *hashp, int nsegs)
-{
-       int i;
-       SEGMENT store;
-
-       int save_errno;
-
-       if ((hashp->dir =
-           (SEGMENT *)calloc(hashp->DSIZE, sizeof(SEGMENT *))) == NULL) {
-               save_errno = errno;
-               (void)hdestroy(hashp);
-               errno = save_errno;
-               return (-1);
-       }
-       hashp->nsegs = nsegs;
-       if (nsegs == 0)
-               return (0);
-       /* Allocate segments */
-       if ((store = (SEGMENT)calloc(nsegs << hashp->SSHIFT,
-           sizeof(SEGMENT))) == NULL) {
-               save_errno = errno;
-               (void)hdestroy(hashp);
-               errno = save_errno;
-               return (-1);
-       }
-       for (i = 0; i < nsegs; i++)
-               hashp->dir[i] = &store[i << hashp->SSHIFT];
-       return (0);
-}
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-/*
- * Hashp->hdr needs to be byteswapped.
- */
-static void
-swap_header_copy(HASHHDR *srcp, HASHHDR *destp)
-{
-       int i;
-
-       P_32_COPY(srcp->magic, destp->magic);
-       P_32_COPY(srcp->version, destp->version);
-       P_32_COPY(srcp->lorder, destp->lorder);
-       P_32_COPY(srcp->bsize, destp->bsize);
-       P_32_COPY(srcp->bshift, destp->bshift);
-       P_32_COPY(srcp->dsize, destp->dsize);
-       P_32_COPY(srcp->ssize, destp->ssize);
-       P_32_COPY(srcp->sshift, destp->sshift);
-       P_32_COPY(srcp->ovfl_point, destp->ovfl_point);
-       P_32_COPY(srcp->last_freed, destp->last_freed);
-       P_32_COPY(srcp->max_bucket, destp->max_bucket);
-       P_32_COPY(srcp->high_mask, destp->high_mask);
-       P_32_COPY(srcp->low_mask, destp->low_mask);
-       P_32_COPY(srcp->ffactor, destp->ffactor);
-       P_32_COPY(srcp->nkeys, destp->nkeys);
-       P_32_COPY(srcp->hdrpages, destp->hdrpages);
-       P_32_COPY(srcp->h_charkey, destp->h_charkey);
-       for (i = 0; i < NCACHED; i++) {
-               P_32_COPY(srcp->spares[i], destp->spares[i]);
-               P_16_COPY(srcp->bitmaps[i], destp->bitmaps[i]);
-       }
-}
-
-static void
-swap_header(HTAB *hashp)
-{
-       HASHHDR *hdrp;
-       int i;
-
-       hdrp = &hashp->hdr;
-
-       M_32_SWAP(hdrp->magic);
-       M_32_SWAP(hdrp->version);
-       M_32_SWAP(hdrp->lorder);
-       M_32_SWAP(hdrp->bsize);
-       M_32_SWAP(hdrp->bshift);
-       M_32_SWAP(hdrp->dsize);
-       M_32_SWAP(hdrp->ssize);
-       M_32_SWAP(hdrp->sshift);
-       M_32_SWAP(hdrp->ovfl_point);
-       M_32_SWAP(hdrp->last_freed);
-       M_32_SWAP(hdrp->max_bucket);
-       M_32_SWAP(hdrp->high_mask);
-       M_32_SWAP(hdrp->low_mask);
-       M_32_SWAP(hdrp->ffactor);
-       M_32_SWAP(hdrp->nkeys);
-       M_32_SWAP(hdrp->hdrpages);
-       M_32_SWAP(hdrp->h_charkey);
-       for (i = 0; i < NCACHED; i++) {
-               M_32_SWAP(hdrp->spares[i]);
-               M_16_SWAP(hdrp->bitmaps[i]);
-       }
-}
-#endif
diff --git a/db/hash/hash.h b/db/hash/hash.h
deleted file mode 100644 (file)
index e4f77c2..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)hash.h      8.3 (Berkeley) 5/31/94
- * $FreeBSD: src/lib/libc/db/hash/hash.h,v 1.9 2009/03/28 05:45:29 delphij Exp $
- */
-
-/* Operations */
-typedef enum {
-       HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT
-} ACTION;
-
-/* Buffer Management structures */
-typedef struct _bufhead BUFHEAD;
-
-struct _bufhead {
-       BUFHEAD         *prev;          /* LRU links */
-       BUFHEAD         *next;          /* LRU links */
-       BUFHEAD         *ovfl;          /* Overflow page buffer header */
-       u_int32_t        addr;          /* Address of this page */
-       char            *page;          /* Actual page data */
-       char            flags;
-#define        BUF_MOD         0x0001
-#define BUF_DISK       0x0002
-#define        BUF_BUCKET      0x0004
-#define        BUF_PIN         0x0008
-};
-
-#define IS_BUCKET(X)   ((X) & BUF_BUCKET)
-
-typedef BUFHEAD **SEGMENT;
-
-/* Hash Table Information */
-typedef struct hashhdr {               /* Disk resident portion */
-       int32_t         magic;          /* Magic NO for hash tables */
-       int32_t         version;        /* Version ID */
-       u_int32_t       lorder;         /* Byte Order */
-       int32_t         bsize;          /* Bucket/Page Size */
-       int32_t         bshift;         /* Bucket shift */
-       int32_t         dsize;          /* Directory Size */
-       int32_t         ssize;          /* Segment Size */
-       int32_t         sshift;         /* Segment shift */
-       int32_t         ovfl_point;     /* Where overflow pages are being 
-                                        * allocated */
-       int32_t         last_freed;     /* Last overflow page freed */
-       u_int32_t       max_bucket;     /* ID of Maximum bucket in use */
-       u_int32_t       high_mask;      /* Mask to modulo into entire table */
-       u_int32_t       low_mask;       /* Mask to modulo into lower half of 
-                                        * table */
-       u_int32_t       ffactor;        /* Fill factor */
-       int32_t         nkeys;          /* Number of keys in hash table */
-       int32_t         hdrpages;       /* Size of table header */
-       int32_t         h_charkey;      /* value of hash(CHARKEY) */
-#define NCACHED        32                      /* number of bit maps and spare 
-                                        * points */
-       int32_t         spares[NCACHED];/* spare pages for overflow */
-       u_int16_t       bitmaps[NCACHED];       /* address of overflow page 
-                                                * bitmaps */
-} HASHHDR;
-
-typedef struct htab     {              /* Memory resident data structure */
-       HASHHDR         hdr;            /* Header */
-       int             nsegs;          /* Number of allocated segments */
-       int             exsegs;         /* Number of extra allocated 
-                                        * segments */
-       u_int32_t                       /* Hash function */
-           (*hash)(const void *, size_t);
-       int             flags;          /* Flag values */
-       int             fp;             /* File pointer */
-       char            *tmp_buf;       /* Temporary Buffer for BIG data */
-       char            *tmp_key;       /* Temporary Buffer for BIG keys */
-       BUFHEAD         *cpage;         /* Current page */
-       int             cbucket;        /* Current bucket */
-       int             cndx;           /* Index of next item on cpage */
-       int             error;          /* Error Number -- for DBM 
-                                        * compatibility */
-       int             new_file;       /* Indicates if fd is backing store 
-                                        * or no */
-       int             save_file;      /* Indicates whether we need to flush 
-                                        * file at
-                                        * exit */
-       u_int32_t       *mapp[NCACHED]; /* Pointers to page maps */
-       int             nmaps;          /* Initial number of bitmaps */
-       int             nbufs;          /* Number of buffers left to 
-                                        * allocate */
-       BUFHEAD         bufhead;        /* Header of buffer lru list */
-       SEGMENT         *dir;           /* Hash Bucket directory */
-                                       /* other flags */
-       int             nextkey_eof :1; /* dbm_nextkey() reached EOF */
-} HTAB;
-
-/*
- * Constants
- */
-#define        MAX_BSIZE               65536           /* 2^16 */
-#define MIN_BUFFERS            6
-#define MINHDRSIZE             512
-#define DEF_BUFSIZE            65536           /* 64 K */
-#define DEF_BUCKET_SIZE                4096
-#define DEF_BUCKET_SHIFT       12              /* log2(BUCKET) */
-#define DEF_SEGSIZE            256
-#define DEF_SEGSIZE_SHIFT      8               /* log2(SEGSIZE)         */
-#define DEF_DIRSIZE            256
-#define DEF_FFACTOR            65536
-#define MIN_FFACTOR            4
-#define SPLTMAX                        8
-#define CHARKEY                        "%$sniglet^&"
-#define NUMKEY                 1038583
-#define BYTE_SHIFT             3
-#define INT_TO_BYTE            2
-#define INT_BYTE_SHIFT         5
-#define ALL_SET                        ((u_int32_t)0xFFFFFFFF)
-#define ALL_CLEAR              0
-
-#define PTROF(X)       ((BUFHEAD *)((ptrdiff_t)(X)&~0x3))
-#define ISMOD(X)       ((u_int32_t)(ptrdiff_t)(X)&0x1)
-#define DOMOD(X)       ((X) = (char *)((ptrdiff_t)(X)|0x1))
-#define ISDISK(X)      ((u_int32_t)(ptrdiff_t)(X)&0x2)
-#define DODISK(X)      ((X) = (char *)((ptrdiff_t)(X)|0x2))
-
-#define BITS_PER_MAP   32
-
-/* Given the address of the beginning of a big map, clear/set the nth bit */
-#define CLRBIT(A, N)   ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP)))
-#define SETBIT(A, N)   ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP)))
-#define ISSET(A, N)    ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP)))
-
-/* Overflow management */
-/*
- * Overflow page numbers are allocated per split point.  At each doubling of
- * the table, we can allocate extra pages.  So, an overflow page number has
- * the top 5 bits indicate which split point and the lower 11 bits indicate
- * which page at that split point is indicated (pages within split points are
- * numberered starting with 1).
- */
-
-#define SPLITSHIFT     11
-#define SPLITMASK      0x7FF
-#define SPLITNUM(N)    (((u_int32_t)(N)) >> SPLITSHIFT)
-#define OPAGENUM(N)    ((N) & SPLITMASK)
-#define        OADDR_OF(S,O)   ((u_int32_t)((u_int32_t)(S) << SPLITSHIFT) + (O))
-
-#define BUCKET_TO_PAGE(B) \
-       (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((B)+1)-1] : 0)
-#define OADDR_TO_PAGE(B)       \
-       BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));
-
-/*
- * page.h contains a detailed description of the page format.
- *
- * Normally, keys and data are accessed from offset tables in the top of
- * each page which point to the beginning of the key and data.  There are
- * four flag values which may be stored in these offset tables which indicate
- * the following:
- *
- *
- * OVFLPAGE    Rather than a key data pair, this pair contains
- *             the address of an overflow page.  The format of
- *             the pair is:
- *                 OVERFLOW_PAGE_NUMBER OVFLPAGE
- *
- * PARTIAL_KEY This must be the first key/data pair on a page
- *             and implies that page contains only a partial key.
- *             That is, the key is too big to fit on a single page
- *             so it starts on this page and continues on the next.
- *             The format of the page is:
- *                 KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE
- *
- *                 KEY_OFF -- offset of the beginning of the key
- *                 PARTIAL_KEY -- 1
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- * FULL_KEY    This must be the first key/data pair on the page.  It
- *             is used in two cases.
- *
- *             Case 1:
- *                 There is a complete key on the page but no data
- *                 (because it wouldn't fit).  The next page contains
- *                 the data.
- *
- *                 Page format it:
- *                 KEY_OFF FULL_KEY OVFL_PAGENO OVFL_PAGE
- *
- *                 KEY_OFF -- offset of the beginning of the key
- *                 FULL_KEY -- 2
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- *             Case 2:
- *                 This page contains no key, but part of a large
- *                 data field, which is continued on the next page.
- *
- *                 Page format it:
- *                 DATA_OFF FULL_KEY OVFL_PAGENO OVFL_PAGE
- *
- *                 KEY_OFF -- offset of the beginning of the data on
- *                             this page
- *                 FULL_KEY -- 2
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- * FULL_KEY_DATA
- *             This must be the first key/data pair on the page.
- *             There are two cases:
- *
- *             Case 1:
- *                 This page contains a key and the beginning of the
- *                 data field, but the data field is continued on the
- *                 next page.
- *
- *                 Page format is:
- *                 KEY_OFF FULL_KEY_DATA OVFL_PAGENO DATA_OFF
- *
- *                 KEY_OFF -- offset of the beginning of the key
- *                 FULL_KEY_DATA -- 3
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 DATA_OFF -- offset of the beginning of the data
- *
- *             Case 2:
- *                 This page contains the last page of a big data pair.
- *                 There is no key, only the  tail end of the data
- *                 on this page.
- *
- *                 Page format is:
- *                 DATA_OFF FULL_KEY_DATA <OVFL_PAGENO> <OVFLPAGE>
- *
- *                 DATA_OFF -- offset of the beginning of the data on
- *                             this page
- *                 FULL_KEY_DATA -- 3
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- *                 OVFL_PAGENO and OVFLPAGE are optional (they are
- *                 not present if there is no next page).
- */
-
-#define OVFLPAGE       0
-#define PARTIAL_KEY    1
-#define FULL_KEY       2
-#define FULL_KEY_DATA  3
-#define        REAL_KEY        4
-
-/* Short hands for accessing structure */
-#define BSIZE          hdr.bsize
-#define BSHIFT         hdr.bshift
-#define DSIZE          hdr.dsize
-#define SGSIZE         hdr.ssize
-#define SSHIFT         hdr.sshift
-#define LORDER         hdr.lorder
-#define OVFL_POINT     hdr.ovfl_point
-#define        LAST_FREED      hdr.last_freed
-#define MAX_BUCKET     hdr.max_bucket
-#define FFACTOR                hdr.ffactor
-#define HIGH_MASK      hdr.high_mask
-#define LOW_MASK       hdr.low_mask
-#define NKEYS          hdr.nkeys
-#define HDRPAGES       hdr.hdrpages
-#define SPARES         hdr.spares
-#define BITMAPS                hdr.bitmaps
-#define VERSION                hdr.version
-#define MAGIC          hdr.magic
-#define NEXT_FREE      hdr.next_free
-#define H_CHARKEY      hdr.h_charkey
diff --git a/db/hash/hash_bigkey-fbsd.c b/db/hash/hash_bigkey-fbsd.c
deleted file mode 100644 (file)
index d325105..0000000
+++ /dev/null
@@ -1,646 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_bigkey.c      8.3 (Berkeley) 5/31/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_bigkey.c,v 1.10 2009/03/28 06:47:05 delphij Exp $");
-
-/*
- * PACKAGE: hash
- * DESCRIPTION:
- *     Big key/data handling for the hashing package.
- *
- * ROUTINES:
- * External
- *     __big_keydata
- *     __big_split
- *     __big_insert
- *     __big_return
- *     __big_delete
- *     __find_last_page
- * Internal
- *     collect_key
- *     collect_data
- */
-
-#include <sys/param.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef DEBUG
-#include <assert.h>
-#endif
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "hash_extern.h"
-
-static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int);
-static int collect_data(HTAB *, BUFHEAD *, int, int);
-
-/*
- * Big_insert
- *
- * You need to do an insert and the key/data pair is too big
- *
- * Returns:
- * 0 ==> OK
- *-1 ==> ERROR
- */
-int
-__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
-{
-       u_int16_t *p;
-       int key_size, n;
-       unsigned int val_size;
-       u_int16_t space, move_bytes, off;
-       char *cp, *key_data, *val_data;
-
-       cp = bufp->page;                /* Character pointer of p. */
-       p = (u_int16_t *)cp;
-
-       key_data = (char *)key->data;
-       key_size = key->size;
-       val_data = (char *)val->data;
-       val_size = val->size;
-
-       /* First move the Key */
-       for (space = FREESPACE(p) - BIGOVERHEAD; key_size;
-           space = FREESPACE(p) - BIGOVERHEAD) {
-               move_bytes = MIN(space, key_size);
-               off = OFFSET(p) - move_bytes;
-               memmove(cp + off, key_data, move_bytes);
-               key_size -= move_bytes;
-               key_data += move_bytes;
-               n = p[0];
-               p[++n] = off;
-               p[0] = ++n;
-               FREESPACE(p) = off - PAGE_META(n);
-               OFFSET(p) = off;
-               p[n] = PARTIAL_KEY;
-               bufp = __add_ovflpage(hashp, bufp);
-               if (!bufp)
-                       return (-1);
-               n = p[0];
-               if (!key_size) {
-                       space = FREESPACE(p);
-                       if (space) {
-                               move_bytes = MIN(space, val_size);
-                               /*
-                                * If the data would fit exactly in the
-                                * remaining space, we must overflow it to the
-                                * next page; otherwise the invariant that the
-                                * data must end on a page with FREESPACE
-                                * non-zero would fail.
-                                */
-                               if (space == val_size && val_size == val->size)
-                                       goto toolarge;
-                               off = OFFSET(p) - move_bytes;
-                               memmove(cp + off, val_data, move_bytes);
-                               val_data += move_bytes;
-                               val_size -= move_bytes;
-                               p[n] = off;
-                               p[n - 2] = FULL_KEY_DATA;
-                               FREESPACE(p) = FREESPACE(p) - move_bytes;
-                               OFFSET(p) = off;
-                       } else {
-                       toolarge:
-                               p[n - 2] = FULL_KEY;
-                       }
-               }
-               p = (u_int16_t *)bufp->page;
-               cp = bufp->page;
-               bufp->flags |= BUF_MOD;
-       }
-
-       /* Now move the data */
-       for (space = FREESPACE(p) - BIGOVERHEAD; val_size;
-           space = FREESPACE(p) - BIGOVERHEAD) {
-               move_bytes = MIN(space, val_size);
-               /*
-                * Here's the hack to make sure that if the data ends on the
-                * same page as the key ends, FREESPACE is at least one.
-                */
-               if (space == val_size && val_size == val->size)
-                       move_bytes--;
-               off = OFFSET(p) - move_bytes;
-               memmove(cp + off, val_data, move_bytes);
-               val_size -= move_bytes;
-               val_data += move_bytes;
-               n = p[0];
-               p[++n] = off;
-               p[0] = ++n;
-               FREESPACE(p) = off - PAGE_META(n);
-               OFFSET(p) = off;
-               if (val_size) {
-                       p[n] = FULL_KEY;
-                       bufp = __add_ovflpage(hashp, bufp);
-                       if (!bufp)
-                               return (-1);
-                       cp = bufp->page;
-                       p = (u_int16_t *)cp;
-               } else
-                       p[n] = FULL_KEY_DATA;
-               bufp->flags |= BUF_MOD;
-       }
-       return (0);
-}
-
-/*
- * Called when bufp's page  contains a partial key (index should be 1)
- *
- * All pages in the big key/data pair except bufp are freed.  We cannot
- * free bufp because the page pointing to it is lost and we can't get rid
- * of its pointer.
- *
- * Returns:
- * 0 => OK
- *-1 => ERROR
- */
-int
-__big_delete(HTAB *hashp, BUFHEAD *bufp)
-{
-       BUFHEAD *last_bfp, *rbufp;
-       u_int16_t *bp, pageno;
-       int key_done, n;
-
-       rbufp = bufp;
-       last_bfp = NULL;
-       bp = (u_int16_t *)bufp->page;
-       pageno = 0;
-       key_done = 0;
-
-       while (!key_done || (bp[2] != FULL_KEY_DATA)) {
-               if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA)
-                       key_done = 1;
-
-               /*
-                * If there is freespace left on a FULL_KEY_DATA page, then
-                * the data is short and fits entirely on this page, and this
-                * is the last page.
-                */
-               if (bp[2] == FULL_KEY_DATA && FREESPACE(bp))
-                       break;
-               pageno = bp[bp[0] - 1];
-               rbufp->flags |= BUF_MOD;
-               rbufp = __get_buf(hashp, pageno, rbufp, 0);
-               if (last_bfp)
-                       __free_ovflpage(hashp, last_bfp);
-               last_bfp = rbufp;
-               if (!rbufp)
-                       return (-1);            /* Error. */
-               bp = (u_int16_t *)rbufp->page;
-       }
-
-       /*
-        * If we get here then rbufp points to the last page of the big
-        * key/data pair.  Bufp points to the first one -- it should now be
-        * empty pointing to the next page after this pair.  Can't free it
-        * because we don't have the page pointing to it.
-        */
-
-       /* This is information from the last page of the pair. */
-       n = bp[0];
-       pageno = bp[n - 1];
-
-       /* Now, bp is the first page of the pair. */
-       bp = (u_int16_t *)bufp->page;
-       if (n > 2) {
-               /* There is an overflow page. */
-               bp[1] = pageno;
-               bp[2] = OVFLPAGE;
-               bufp->ovfl = rbufp->ovfl;
-       } else
-               /* This is the last page. */
-               bufp->ovfl = NULL;
-       n -= 2;
-       bp[0] = n;
-       FREESPACE(bp) = hashp->BSIZE - PAGE_META(n);
-       OFFSET(bp) = hashp->BSIZE;
-
-       bufp->flags |= BUF_MOD;
-       if (rbufp)
-               __free_ovflpage(hashp, rbufp);
-       if (last_bfp && last_bfp != rbufp)
-               __free_ovflpage(hashp, last_bfp);
-
-       hashp->NKEYS--;
-       return (0);
-}
-/*
- * Returns:
- *  0 = key not found
- * -1 = get next overflow page
- * -2 means key not found and this is big key/data
- * -3 error
- */
-int
-__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
-{
-       u_int16_t *bp;
-       char *p;
-       int ksize;
-       u_int16_t bytes;
-       char *kkey;
-
-       bp = (u_int16_t *)bufp->page;
-       p = bufp->page;
-       ksize = size;
-       kkey = key;
-
-       for (bytes = hashp->BSIZE - bp[ndx];
-           bytes <= size && bp[ndx + 1] == PARTIAL_KEY;
-           bytes = hashp->BSIZE - bp[ndx]) {
-               if (memcmp(p + bp[ndx], kkey, bytes))
-                       return (-2);
-               kkey += bytes;
-               ksize -= bytes;
-               bufp = __get_buf(hashp, bp[ndx + 2], bufp, 0);
-               if (!bufp)
-                       return (-3);
-               p = bufp->page;
-               bp = (u_int16_t *)p;
-               ndx = 1;
-       }
-
-       if (bytes != ksize || memcmp(p + bp[ndx], kkey, bytes)) {
-#ifdef HASH_STATISTICS
-               ++hash_collisions;
-#endif
-               return (-2);
-       } else
-               return (ndx);
-}
-
-/*
- * Given the buffer pointer of the first overflow page of a big pair,
- * find the end of the big pair
- *
- * This will set bpp to the buffer header of the last page of the big pair.
- * It will return the pageno of the overflow page following the last page
- * of the pair; 0 if there isn't any (i.e. big pair is the last key in the
- * bucket)
- */
-u_int16_t
-__find_last_page(HTAB *hashp, BUFHEAD **bpp)
-{
-       BUFHEAD *bufp;
-       u_int16_t *bp, pageno;
-       int n;
-
-       bufp = *bpp;
-       bp = (u_int16_t *)bufp->page;
-       for (;;) {
-               n = bp[0];
-
-               /*
-                * This is the last page if: the tag is FULL_KEY_DATA and
-                * either only 2 entries OVFLPAGE marker is explicit there
-                * is freespace on the page.
-                */
-               if (bp[2] == FULL_KEY_DATA &&
-                   ((n == 2) || (bp[n] == OVFLPAGE) || (FREESPACE(bp))))
-                       break;
-
-               pageno = bp[n - 1];
-               bufp = __get_buf(hashp, pageno, bufp, 0);
-               if (!bufp)
-                       return (0);     /* Need to indicate an error! */
-               bp = (u_int16_t *)bufp->page;
-       }
-
-       *bpp = bufp;
-       if (bp[0] > 2)
-               return (bp[3]);
-       else
-               return (0);
-}
-
-/*
- * Return the data for the key/data pair that begins on this page at this
- * index (index should always be 1).
- */
-int
-__big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current)
-{
-       BUFHEAD *save_p;
-       u_int16_t *bp, len, off, save_addr;
-       char *tp;
-
-       bp = (u_int16_t *)bufp->page;
-       while (bp[ndx + 1] == PARTIAL_KEY) {
-               bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-               if (!bufp)
-                       return (-1);
-               bp = (u_int16_t *)bufp->page;
-               ndx = 1;
-       }
-
-       if (bp[ndx + 1] == FULL_KEY) {
-               bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-               if (!bufp)
-                       return (-1);
-               bp = (u_int16_t *)bufp->page;
-               save_p = bufp;
-               save_addr = save_p->addr;
-               off = bp[1];
-               len = 0;
-       } else
-               if (!FREESPACE(bp)) {
-                       /*
-                        * This is a hack.  We can't distinguish between
-                        * FULL_KEY_DATA that contains complete data or
-                        * incomplete data, so we require that if the data
-                        * is complete, there is at least 1 byte of free
-                        * space left.
-                        */
-                       off = bp[bp[0]];
-                       len = bp[1] - off;
-                       save_p = bufp;
-                       save_addr = bufp->addr;
-                       bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-                       if (!bufp)
-                               return (-1);
-                       bp = (u_int16_t *)bufp->page;
-               } else {
-                       /* The data is all on one page. */
-                       tp = (char *)bp;
-                       off = bp[bp[0]];
-                       val->data = (u_char *)tp + off;
-                       val->size = bp[1] - off;
-                       if (set_current) {
-                               if (bp[0] == 2) {       /* No more buckets in
-                                                        * chain */
-                                       hashp->cpage = NULL;
-                                       hashp->cbucket++;
-                                       hashp->cndx = 1;
-                               } else {
-                                       hashp->cpage = __get_buf(hashp,
-                                           bp[bp[0] - 1], bufp, 0);
-                                       if (!hashp->cpage)
-                                               return (-1);
-                                       hashp->cndx = 1;
-                                       if (!((u_int16_t *)
-                                           hashp->cpage->page)[0]) {
-                                               hashp->cbucket++;
-                                               hashp->cpage = NULL;
-                                       }
-                               }
-                       }
-                       return (0);
-               }
-
-       val->size = (size_t)collect_data(hashp, bufp, (int)len, set_current);
-       if (val->size == (size_t)-1)
-               return (-1);
-       if (save_p->addr != save_addr) {
-               /* We are pretty short on buffers. */
-               errno = EINVAL;                 /* OUT OF BUFFERS */
-               return (-1);
-       }
-       memmove(hashp->tmp_buf, (save_p->page) + off, len);
-       val->data = (u_char *)hashp->tmp_buf;
-       return (0);
-}
-/*
- * Count how big the total datasize is by recursing through the pages.  Then
- * allocate a buffer and copy the data as you recurse up.
- */
-static int
-collect_data(HTAB *hashp, BUFHEAD *bufp, int len, int set)
-{
-       u_int16_t *bp;
-       char *p;
-       BUFHEAD *xbp;
-       u_int16_t save_addr;
-       int mylen, totlen;
-
-       p = bufp->page;
-       bp = (u_int16_t *)p;
-       mylen = hashp->BSIZE - bp[1];
-       save_addr = bufp->addr;
-
-       if (bp[2] == FULL_KEY_DATA) {           /* End of Data */
-               totlen = len + mylen;
-               if (hashp->tmp_buf)
-                       free(hashp->tmp_buf);
-               if ((hashp->tmp_buf = (char *)malloc(totlen)) == NULL)
-                       return (-1);
-               if (set) {
-                       hashp->cndx = 1;
-                       if (bp[0] == 2) {       /* No more buckets in chain */
-                               hashp->cpage = NULL;
-                               hashp->cbucket++;
-                       } else {
-                               hashp->cpage =
-                                   __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-                               if (!hashp->cpage)
-                                       return (-1);
-                               else if (!((u_int16_t *)hashp->cpage->page)[0]) {
-                                       hashp->cbucket++;
-                                       hashp->cpage = NULL;
-                               }
-                       }
-               }
-       } else {
-               xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-               if (!xbp || ((totlen =
-                   collect_data(hashp, xbp, len + mylen, set)) < 1))
-                       return (-1);
-       }
-       if (bufp->addr != save_addr) {
-               errno = EINVAL;                 /* Out of buffers. */
-               return (-1);
-       }
-       memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], mylen);
-       return (totlen);
-}
-
-/*
- * Fill in the key and data for this big pair.
- */
-int
-__big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set)
-{
-       key->size = (size_t)collect_key(hashp, bufp, 0, val, set);
-       if (key->size == (size_t)-1)
-               return (-1);
-       key->data = (u_char *)hashp->tmp_key;
-       return (0);
-}
-
-/*
- * Count how big the total key size is by recursing through the pages.  Then
- * collect the data, allocate a buffer and copy the key as you recurse up.
- */
-static int
-collect_key(HTAB *hashp, BUFHEAD *bufp, int len, DBT *val, int set)
-{
-       BUFHEAD *xbp;
-       char *p;
-       int mylen, totlen;
-       u_int16_t *bp, save_addr;
-
-       p = bufp->page;
-       bp = (u_int16_t *)p;
-       mylen = hashp->BSIZE - bp[1];
-
-       save_addr = bufp->addr;
-       totlen = len + mylen;
-       if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) {    /* End of Key. */
-               if (hashp->tmp_key != NULL)
-                       free(hashp->tmp_key);
-               if ((hashp->tmp_key = (char *)malloc(totlen)) == NULL)
-                       return (-1);
-               if (__big_return(hashp, bufp, 1, val, set))
-                       return (-1);
-       } else {
-               xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-               if (!xbp || ((totlen =
-                   collect_key(hashp, xbp, totlen, val, set)) < 1))
-                       return (-1);
-       }
-       if (bufp->addr != save_addr) {
-               errno = EINVAL;         /* MIS -- OUT OF BUFFERS */
-               return (-1);
-       }
-       memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], mylen);
-       return (totlen);
-}
-
-/*
- * Returns:
- *  0 => OK
- * -1 => error
- */
-int
-__big_split(HTAB *hashp,
-    BUFHEAD *op,       /* Pointer to where to put keys that go in old bucket */
-    BUFHEAD *np,       /* Pointer to new bucket page */
-    BUFHEAD *big_keyp, /* Pointer to first page containing the big key/data */
-    int addr,          /* Address of big_keyp */
-    u_int32_t obucket, /* Old Bucket */
-    SPLIT_RETURN *ret)
-{
-       BUFHEAD *bp, *tmpp;
-       DBT key, val;
-       u_int32_t change;
-       u_int16_t free_space, n, off, *tp;
-
-       bp = big_keyp;
-
-       /* Now figure out where the big key/data goes */
-       if (__big_keydata(hashp, big_keyp, &key, &val, 0))
-               return (-1);
-       change = (__call_hash(hashp, key.data, key.size) != obucket);
-
-       if ( (ret->next_addr = __find_last_page(hashp, &big_keyp)) ) {
-               if (!(ret->nextp =
-                   __get_buf(hashp, ret->next_addr, big_keyp, 0)))
-                       return (-1);
-       } else
-               ret->nextp = NULL;
-
-       /* Now make one of np/op point to the big key/data pair */
-#ifdef DEBUG
-       assert(np->ovfl == NULL);
-#endif
-       if (change)
-               tmpp = np;
-       else
-               tmpp = op;
-
-       tmpp->flags |= BUF_MOD;
-#ifdef DEBUG1
-       (void)fprintf(stderr,
-           "BIG_SPLIT: %d->ovfl was %d is now %d\n", tmpp->addr,
-           (tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0));
-#endif
-       tmpp->ovfl = bp;        /* one of op/np point to big_keyp */
-       tp = (u_int16_t *)tmpp->page;
-#ifdef DEBUG
-       assert(FREESPACE(tp) >= OVFLSIZE);
-#endif
-       n = tp[0];
-       off = OFFSET(tp);
-       free_space = FREESPACE(tp);
-       tp[++n] = (u_int16_t)addr;
-       tp[++n] = OVFLPAGE;
-       tp[0] = n;
-       OFFSET(tp) = off;
-       FREESPACE(tp) = free_space - OVFLSIZE;
-
-       /*
-        * Finally, set the new and old return values. BIG_KEYP contains a
-        * pointer to the last page of the big key_data pair. Make sure that
-        * big_keyp has no following page (2 elements) or create an empty
-        * following page.
-        */
-
-       ret->newp = np;
-       ret->oldp = op;
-
-       tp = (u_int16_t *)big_keyp->page;
-       big_keyp->flags |= BUF_MOD;
-       if (tp[0] > 2) {
-               /*
-                * There may be either one or two offsets on this page.  If
-                * there is one, then the overflow page is linked on normally
-                * and tp[4] is OVFLPAGE.  If there are two, tp[4] contains
-                * the second offset and needs to get stuffed in after the
-                * next overflow page is added.
-                */
-               n = tp[4];
-               free_space = FREESPACE(tp);
-               off = OFFSET(tp);
-               tp[0] -= 2;
-               FREESPACE(tp) = free_space + OVFLSIZE;
-               OFFSET(tp) = off;
-               tmpp = __add_ovflpage(hashp, big_keyp);
-               if (!tmpp)
-                       return (-1);
-               tp[4] = n;
-       } else
-               tmpp = big_keyp;
-
-       if (change)
-               ret->newp = tmpp;
-       else
-               ret->oldp = tmpp;
-       return (0);
-}
diff --git a/db/hash/hash_buf-fbsd.c b/db/hash/hash_buf-fbsd.c
deleted file mode 100644 (file)
index e19beda..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_buf.c 8.5 (Berkeley) 7/15/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_buf.c,v 1.12 2009/03/28 06:40:48 delphij Exp $");
-
-/*
- * PACKAGE: hash
- *
- * DESCRIPTION:
- *     Contains buffer management
- *
- * ROUTINES:
- * External
- *     __buf_init
- *     __get_buf
- *     __buf_free
- *     __reclaim_buf
- * Internal
- *     newbuf
- */
-
-#include <sys/param.h>
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef DEBUG
-#include <assert.h>
-#endif
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "hash_extern.h"
-
-static BUFHEAD *newbuf(HTAB *, u_int32_t, BUFHEAD *);
-
-/* Unlink B from its place in the lru */
-#define BUF_REMOVE(B) { \
-       (B)->prev->next = (B)->next; \
-       (B)->next->prev = (B)->prev; \
-}
-
-/* Insert B after P */
-#define BUF_INSERT(B, P) { \
-       (B)->next = (P)->next; \
-       (B)->prev = (P); \
-       (P)->next = (B); \
-       (B)->next->prev = (B); \
-}
-
-#define        MRU     hashp->bufhead.next
-#define        LRU     hashp->bufhead.prev
-
-#define MRU_INSERT(B)  BUF_INSERT((B), &hashp->bufhead)
-#define LRU_INSERT(B)  BUF_INSERT((B), LRU)
-
-/*
- * We are looking for a buffer with address "addr".  If prev_bp is NULL, then
- * address is a bucket index.  If prev_bp is not NULL, then it points to the
- * page previous to an overflow page that we are trying to find.
- *
- * CAVEAT:  The buffer header accessed via prev_bp's ovfl field may no longer
- * be valid.  Therefore, you must always verify that its address matches the
- * address you are seeking.
- */
-BUFHEAD *
-__get_buf(HTAB *hashp, u_int32_t addr,
-    BUFHEAD *prev_bp,  /* If prev_bp set, indicates a new overflow page. */
-    int newpage)
-{
-       BUFHEAD *bp;
-       u_int32_t is_disk_mask;
-       int is_disk, segment_ndx;
-       SEGMENT segp;
-
-       is_disk = 0;
-       is_disk_mask = 0;
-       if (prev_bp) {
-               bp = prev_bp->ovfl;
-               if (!bp || (bp->addr != addr))
-                       bp = NULL;
-               if (!newpage)
-                       is_disk = BUF_DISK;
-       } else {
-               /* Grab buffer out of directory */
-               segment_ndx = addr & (hashp->SGSIZE - 1);
-
-               /* valid segment ensured by __call_hash() */
-               segp = hashp->dir[addr >> hashp->SSHIFT];
-#ifdef DEBUG
-               assert(segp != NULL);
-#endif
-               bp = PTROF(segp[segment_ndx]);
-               is_disk_mask = ISDISK(segp[segment_ndx]);
-               is_disk = is_disk_mask || !hashp->new_file;
-       }
-
-       if (!bp) {
-               bp = newbuf(hashp, addr, prev_bp);
-               if (!bp ||
-                   __get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0))
-                       return (NULL);
-               if (!prev_bp)
-                       segp[segment_ndx] =
-                           (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask);
-       } else {
-               BUF_REMOVE(bp);
-               MRU_INSERT(bp);
-       }
-       return (bp);
-}
-
-/*
- * We need a buffer for this page. Either allocate one, or evict a resident
- * one (if we have as many buffers as we're allowed) and put this one in.
- *
- * If newbuf finds an error (returning NULL), it also sets errno.
- */
-static BUFHEAD *
-newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
-{
-       BUFHEAD *bp;            /* The buffer we're going to use */
-       BUFHEAD *xbp;           /* Temp pointer */
-       BUFHEAD *next_xbp;
-       SEGMENT segp;
-       int segment_ndx;
-       u_int16_t oaddr, *shortp;
-
-       oaddr = 0;
-       bp = LRU;
-
-        /* It is bad to overwrite the page under the cursor. */
-        if (bp == hashp->cpage) {
-                BUF_REMOVE(bp);
-                MRU_INSERT(bp);
-                bp = LRU;
-        }
-
-       /* If prev_bp is part of bp overflow, create a new buffer. */
-       if (hashp->nbufs == 0 && prev_bp && bp->ovfl) {
-               BUFHEAD *ovfl;
-
-               for (ovfl = bp->ovfl; ovfl ; ovfl = ovfl->ovfl) {
-                       if (ovfl == prev_bp) {
-                               hashp->nbufs++;
-                               break;
-                       }
-               }
-       }
-
-       /*
-        * If LRU buffer is pinned, the buffer pool is too small. We need to
-        * allocate more buffers.
-        */
-       if (hashp->nbufs || (bp->flags & BUF_PIN) || bp == hashp->cpage) {
-               /* Allocate a new one */
-               if ((bp = (BUFHEAD *)calloc(1, sizeof(BUFHEAD))) == NULL)
-                       return (NULL);
-               if ((bp->page = (char *)calloc(1, hashp->BSIZE)) == NULL) {
-                       free(bp);
-                       return (NULL);
-               }
-               if (hashp->nbufs)
-                       hashp->nbufs--;
-       } else {
-               /* Kick someone out */
-               BUF_REMOVE(bp);
-               /*
-                * If this is an overflow page with addr 0, it's already been
-                * flushed back in an overflow chain and initialized.
-                */
-               if ((bp->addr != 0) || (bp->flags & BUF_BUCKET)) {
-                       /*
-                        * Set oaddr before __put_page so that you get it
-                        * before bytes are swapped.
-                        */
-                       shortp = (u_int16_t *)bp->page;
-                       if (shortp[0])
-                               oaddr = shortp[shortp[0] - 1];
-                       if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page,
-                           bp->addr, (int)IS_BUCKET(bp->flags), 0))
-                               return (NULL);
-                       /*
-                        * Update the pointer to this page (i.e. invalidate it).
-                        *
-                        * If this is a new file (i.e. we created it at open
-                        * time), make sure that we mark pages which have been
-                        * written to disk so we retrieve them from disk later,
-                        * rather than allocating new pages.
-                        */
-                       if (IS_BUCKET(bp->flags)) {
-                               segment_ndx = bp->addr & (hashp->SGSIZE - 1);
-                               segp = hashp->dir[bp->addr >> hashp->SSHIFT];
-#ifdef DEBUG
-                               assert(segp != NULL);
-#endif
-
-                               if (hashp->new_file &&
-                                   ((bp->flags & BUF_MOD) ||
-                                   ISDISK(segp[segment_ndx])))
-                                       segp[segment_ndx] = (BUFHEAD *)BUF_DISK;
-                               else
-                                       segp[segment_ndx] = NULL;
-                       }
-                       /*
-                        * Since overflow pages can only be access by means of
-                        * their bucket, free overflow pages associated with
-                        * this bucket.
-                        */
-                       for (xbp = bp; xbp->ovfl;) {
-                               next_xbp = xbp->ovfl;
-                               xbp->ovfl = 0;
-                               xbp = next_xbp;
-
-                               /* Check that ovfl pointer is up date. */
-                               if (IS_BUCKET(xbp->flags) ||
-                                   (oaddr != xbp->addr))
-                                       break;
-
-                               shortp = (u_int16_t *)xbp->page;
-                               if (shortp[0])
-                                       /* set before __put_page */
-                                       oaddr = shortp[shortp[0] - 1];
-                               if ((xbp->flags & BUF_MOD) && __put_page(hashp,
-                                   xbp->page, xbp->addr, 0, 0))
-                                       return (NULL);
-                               xbp->addr = 0;
-                               xbp->flags = 0;
-                               BUF_REMOVE(xbp);
-                               LRU_INSERT(xbp);
-                       }
-               }
-       }
-
-       /* Now assign this buffer */
-       bp->addr = addr;
-#ifdef DEBUG1
-       (void)fprintf(stderr, "NEWBUF1: %d->ovfl was %d is now %d\n",
-           bp->addr, (bp->ovfl ? bp->ovfl->addr : 0), 0);
-#endif
-       bp->ovfl = NULL;
-       if (prev_bp) {
-               /*
-                * If prev_bp is set, this is an overflow page, hook it in to
-                * the buffer overflow links.
-                */
-#ifdef DEBUG1
-               (void)fprintf(stderr, "NEWBUF2: %d->ovfl was %d is now %d\n",
-                   prev_bp->addr, (prev_bp->ovfl ? prev_bp->ovfl->addr : 0),
-                   (bp ? bp->addr : 0));
-#endif
-               prev_bp->ovfl = bp;
-               bp->flags = 0;
-       } else
-               bp->flags = BUF_BUCKET;
-       MRU_INSERT(bp);
-       return (bp);
-}
-
-__private_extern__ void
-__buf_init(HTAB *hashp, int nbytes)
-{
-       BUFHEAD *bfp;
-       int npages;
-
-       bfp = &(hashp->bufhead);
-       npages = (nbytes + hashp->BSIZE - 1) >> hashp->BSHIFT;
-       npages = MAX(npages, MIN_BUFFERS);
-
-       hashp->nbufs = npages;
-       bfp->next = bfp;
-       bfp->prev = bfp;
-       /*
-        * This space is calloc'd so these are already null.
-        *
-        * bfp->ovfl = NULL;
-        * bfp->flags = 0;
-        * bfp->page = NULL;
-        * bfp->addr = 0;
-        */
-}
-
-int
-__buf_free(HTAB *hashp, int do_free, int to_disk)
-{
-       BUFHEAD *bp;
-
-       /* Need to make sure that buffer manager has been initialized */
-       if (!LRU)
-               return (0);
-       for (bp = LRU; bp != &hashp->bufhead;) {
-               /* Check that the buffer is valid */
-               if (bp->addr || IS_BUCKET(bp->flags)) {
-                       if (to_disk && (bp->flags & BUF_MOD) &&
-                           __put_page(hashp, bp->page,
-                           bp->addr, IS_BUCKET(bp->flags), 0))
-                               return (-1);
-               }
-               /* Check if we are freeing stuff */
-               if (do_free) {
-                       if (bp->page) {
-                               (void)memset(bp->page, 0, hashp->BSIZE);
-                               free(bp->page);
-                       }
-                       BUF_REMOVE(bp);
-                       free(bp);
-                       bp = LRU;
-               } else
-                       bp = bp->prev;
-       }
-       return (0);
-}
-
-void
-__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
-{
-       bp->ovfl = 0;
-       bp->addr = 0;
-       bp->flags = 0;
-       BUF_REMOVE(bp);
-       LRU_INSERT(bp);
-}
diff --git a/db/hash/hash_extern.h b/db/hash/hash_extern.h
deleted file mode 120000 (symlink)
index 70017bf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./extern.h
\ No newline at end of file
diff --git a/db/hash/hash_func-fbsd.c b/db/hash/hash_func-fbsd.c
deleted file mode 100644 (file)
index a402e49..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_func.c        8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_func.c,v 1.6 2007/01/09 00:27:50 imp Exp $");
-
-#include <sys/types.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "hash_extern.h"
-
-static u_int32_t hash1(const void *, size_t) __unused;
-static u_int32_t hash2(const void *, size_t) __unused;
-static u_int32_t hash3(const void *, size_t) __unused;
-static u_int32_t hash4(const void *, size_t);
-
-/* Global default hash function */
-u_int32_t (*__default_hash)(const void *, size_t) = hash4;
-
-/*
- * HASH FUNCTIONS
- *
- * Assume that we've already split the bucket to which this key hashes,
- * calculate that bucket, and check that in fact we did already split it.
- *
- * This came from ejb's hsearch.
- */
-
-#define PRIME1         37
-#define PRIME2         1048583
-
-static u_int32_t
-hash1(keyarg, len)
-       const void *keyarg;
-       size_t len;
-{
-       const u_char *key;
-       u_int32_t h;
-
-       /* Convert string to integer */
-       for (key = keyarg, h = 0; len--;)
-               h = h * PRIME1 ^ (*key++ - ' ');
-       h %= PRIME2;
-       return (h);
-}
-
-/*
- * Phong's linear congruential hash
- */
-#define dcharhash(h, c)        ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c))
-
-static u_int32_t
-hash2(keyarg, len)
-       const void *keyarg;
-       size_t len;
-{
-       const u_char *e, *key;
-       u_int32_t h;
-       u_char c;
-
-       key = keyarg;
-       e = key + len;
-       for (h = 0; key != e;) {
-               c = *key++;
-               if (!c && key > e)
-                       break;
-               dcharhash(h, c);
-       }
-       return (h);
-}
-
-/*
- * This is INCREDIBLY ugly, but fast.  We break the string up into 8 byte
- * units.  On the first time through the loop we get the "leftover bytes"
- * (strlen % 8).  On every other iteration, we perform 8 HASHC's so we handle
- * all 8 bytes.  Essentially, this saves us 7 cmp & branch instructions.  If
- * this routine is heavily used enough, it's worth the ugly coding.
- *
- * OZ's original sdbm hash
- */
-static u_int32_t
-hash3(keyarg, len)
-       const void *keyarg;
-       size_t len;
-{
-       const u_char *key;
-       size_t loop;
-       u_int32_t h;
-
-#define HASHC   h = *key++ + 65599 * h
-
-       h = 0;
-       key = keyarg;
-       if (len > 0) {
-               loop = (len + 8 - 1) >> 3;
-
-               switch (len & (8 - 1)) {
-               case 0:
-                       do {
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 7:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 6:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 5:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 4:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 3:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 2:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 1:
-                               HASHC;
-                       } while (--loop);
-               }
-       }
-       return (h);
-}
-
-/* Hash function from Chris Torek. */
-static u_int32_t
-hash4(keyarg, len)
-       const void *keyarg;
-       size_t len;
-{
-       const u_char *key;
-       size_t loop;
-       u_int32_t h;
-
-#define HASH4a   h = (h << 5) - h + *key++;
-#define HASH4b   h = (h << 5) + h + *key++;
-#define HASH4 HASH4b
-
-       h = 0;
-       key = keyarg;
-       if (len > 0) {
-               loop = (len + 8 - 1) >> 3;
-
-               switch (len & (8 - 1)) {
-               case 0:
-                       do {
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 7:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 6:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 5:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 4:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 3:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 2:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 1:
-                               HASH4;
-                       } while (--loop);
-               }
-       }
-       return (h);
-}
diff --git a/db/hash/hash_log2-fbsd.c b/db/hash/hash_log2-fbsd.c
deleted file mode 100644 (file)
index 56714a1..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_log2.c        8.2 (Berkeley) 5/31/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_log2.c,v 1.5 2009/03/28 05:45:29 delphij Exp $");
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "hash_extern.h"
-
-u_int32_t
-__log2(u_int32_t num)
-{
-       u_int32_t i, limit;
-
-       limit = 1;
-       for (i = 0; limit < num; limit = limit << 1, i++);
-       return (i);
-}
diff --git a/db/hash/hash_page-fbsd.c b/db/hash/hash_page-fbsd.c
deleted file mode 100644 (file)
index 809a3b9..0000000
+++ /dev/null
@@ -1,948 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_page.c        8.7 (Berkeley) 8/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_page.c,v 1.16 2009/03/28 06:30:43 delphij Exp $");
-
-/*
- * PACKAGE:  hashing
- *
- * DESCRIPTION:
- *     Page manipulation for hashing package.
- *
- * ROUTINES:
- *
- * External
- *     __get_page
- *     __add_ovflpage
- * Internal
- *     overflow_page
- *     open_temp
- */
-
-#include "namespace.h"
-#include <sys/param.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef DEBUG
-#include <assert.h>
-#endif
-#include "un-namespace.h"
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "hash_extern.h"
-
-static u_int32_t *fetch_bitmap(HTAB *, int);
-static u_int32_t  first_free(u_int32_t);
-static int       open_temp(HTAB *);
-static u_int16_t  overflow_page(HTAB *);
-static void      putpair(char *, const DBT *, const DBT *);
-static void      squeeze_key(u_int16_t *, const DBT *, const DBT *);
-static int       ugly_split(HTAB *, u_int32_t, BUFHEAD *, BUFHEAD *, int, int);
-
-#define        PAGE_INIT(P) { \
-       ((u_int16_t *)(P))[0] = 0; \
-       ((u_int16_t *)(P))[1] = hashp->BSIZE - 3 * sizeof(u_int16_t); \
-       ((u_int16_t *)(P))[2] = hashp->BSIZE; \
-}
-
-/*
- * This is called AFTER we have verified that there is room on the page for
- * the pair (PAIRFITS has returned true) so we go right ahead and start moving
- * stuff on.
- */
-static void
-putpair(char *p, const DBT *key, const DBT *val)
-{
-       u_int16_t *bp, n, off;
-
-       bp = (u_int16_t *)p;
-
-       /* Enter the key first. */
-       n = bp[0];
-
-       off = OFFSET(bp) - key->size;
-       memmove(p + off, key->data, key->size);
-       bp[++n] = off;
-
-       /* Now the data. */
-       off -= val->size;
-       memmove(p + off, val->data, val->size);
-       bp[++n] = off;
-
-       /* Adjust page info. */
-       bp[0] = n;
-       bp[n + 1] = off - ((n + 3) * sizeof(u_int16_t));
-       bp[n + 2] = off;
-}
-
-/*
- * Returns:
- *      0 OK
- *     -1 error
- */
-int
-__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
-{
-       u_int16_t *bp, newoff, pairlen;
-       int n;
-
-       bp = (u_int16_t *)bufp->page;
-       n = bp[0];
-
-       if (bp[ndx + 1] < REAL_KEY)
-               return (__big_delete(hashp, bufp));
-       if (ndx != 1)
-               newoff = bp[ndx - 1];
-       else
-               newoff = hashp->BSIZE;
-       pairlen = newoff - bp[ndx + 1];
-
-       if (ndx != (n - 1)) {
-               /* Hard Case -- need to shuffle keys */
-               int i;
-               char *src = bufp->page + (int)OFFSET(bp);
-               char *dst = src + (int)pairlen;
-               memmove(dst, src, bp[ndx + 1] - OFFSET(bp));
-
-               /* Now adjust the pointers */
-               for (i = ndx + 2; i <= n; i += 2) {
-                       if (bp[i + 1] == OVFLPAGE) {
-                               bp[i - 2] = bp[i];
-                               bp[i - 1] = bp[i + 1];
-                       } else {
-                               bp[i - 2] = bp[i] + pairlen;
-                               bp[i - 1] = bp[i + 1] + pairlen;
-                       }
-               }
-               if (ndx == hashp->cndx) {
-                       /*
-                        * We just removed pair we were "pointing" to.
-                        * By moving back the cndx we ensure subsequent
-                        * hash_seq() calls won't skip over any entries.
-                        */
-                       hashp->cndx -= 2;
-               }
-       }
-       /* Finally adjust the page data */
-       bp[n] = OFFSET(bp) + pairlen;
-       bp[n - 1] = bp[n + 1] + pairlen + 2 * sizeof(u_int16_t);
-       bp[0] = n - 2;
-       hashp->NKEYS--;
-
-       bufp->flags |= BUF_MOD;
-       return (0);
-}
-/*
- * Returns:
- *      0 ==> OK
- *     -1 ==> Error
- */
-int
-__split_page(HTAB *hashp, u_int32_t obucket, u_int32_t nbucket)
-{
-       BUFHEAD *new_bufp, *old_bufp;
-       u_int16_t *ino;
-       char *np;
-       DBT key, val;
-       int n, ndx, retval;
-       u_int16_t copyto, diff, off, moved;
-       char *op;
-
-       copyto = (u_int16_t)hashp->BSIZE;
-       off = (u_int16_t)hashp->BSIZE;
-       old_bufp = __get_buf(hashp, obucket, NULL, 0);
-       if (old_bufp == NULL)
-               return (-1);
-       new_bufp = __get_buf(hashp, nbucket, NULL, 0);
-       if (new_bufp == NULL)
-               return (-1);
-
-       old_bufp->flags |= (BUF_MOD | BUF_PIN);
-       new_bufp->flags |= (BUF_MOD | BUF_PIN);
-
-       ino = (u_int16_t *)(op = old_bufp->page);
-       np = new_bufp->page;
-
-       moved = 0;
-
-       for (n = 1, ndx = 1; n < ino[0]; n += 2) {
-               if (ino[n + 1] < REAL_KEY) {
-                       retval = ugly_split(hashp, obucket, old_bufp, new_bufp,
-                           (int)copyto, (int)moved);
-                       old_bufp->flags &= ~BUF_PIN;
-                       new_bufp->flags &= ~BUF_PIN;
-                       return (retval);
-
-               }
-               key.data = (u_char *)op + ino[n];
-               key.size = off - ino[n];
-
-               if (__call_hash(hashp, key.data, key.size) == obucket) {
-                       /* Don't switch page */
-                       diff = copyto - off;
-                       if (diff) {
-                               copyto = ino[n + 1] + diff;
-                               memmove(op + copyto, op + ino[n + 1],
-                                   off - ino[n + 1]);
-                               ino[ndx] = copyto + ino[n] - ino[n + 1];
-                               ino[ndx + 1] = copyto;
-                       } else
-                               copyto = ino[n + 1];
-                       ndx += 2;
-               } else {
-                       /* Switch page */
-                       val.data = (u_char *)op + ino[n + 1];
-                       val.size = ino[n] - ino[n + 1];
-                       putpair(np, &key, &val);
-                       moved += 2;
-               }
-
-               off = ino[n + 1];
-       }
-
-       /* Now clean up the page */
-       ino[0] -= moved;
-       FREESPACE(ino) = copyto - sizeof(u_int16_t) * (ino[0] + 3);
-       OFFSET(ino) = copyto;
-
-#ifdef DEBUG3
-       (void)fprintf(stderr, "split %d/%d\n",
-           ((u_int16_t *)np)[0] / 2,
-           ((u_int16_t *)op)[0] / 2);
-#endif
-       /* unpin both pages */
-       old_bufp->flags &= ~BUF_PIN;
-       new_bufp->flags &= ~BUF_PIN;
-       return (0);
-}
-
-/*
- * Called when we encounter an overflow or big key/data page during split
- * handling.  This is special cased since we have to begin checking whether
- * the key/data pairs fit on their respective pages and because we may need
- * overflow pages for both the old and new pages.
- *
- * The first page might be a page with regular key/data pairs in which case
- * we have a regular overflow condition and just need to go on to the next
- * page or it might be a big key/data pair in which case we need to fix the
- * big key/data pair.
- *
- * Returns:
- *      0 ==> success
- *     -1 ==> failure
- */
-static int
-ugly_split(HTAB *hashp,
-    u_int32_t obucket, /* Same as __split_page. */
-    BUFHEAD *old_bufp,
-    BUFHEAD *new_bufp,
-    int copyto,                /* First byte on page which contains key/data values. */
-    int moved)         /* Number of pairs moved to new page. */
-{
-       BUFHEAD *bufp;  /* Buffer header for ino */
-       u_int16_t *ino; /* Page keys come off of */
-       u_int16_t *np;  /* New page */
-       u_int16_t *op;  /* Page keys go on to if they aren't moving */
-
-       BUFHEAD *last_bfp;      /* Last buf header OVFL needing to be freed */
-       DBT key, val;
-       SPLIT_RETURN ret;
-       u_int16_t n, off, ov_addr, scopyto;
-       char *cino;             /* Character value of ino */
-
-       bufp = old_bufp;
-       ino = (u_int16_t *)old_bufp->page;
-       np = (u_int16_t *)new_bufp->page;
-       op = (u_int16_t *)old_bufp->page;
-       last_bfp = NULL;
-       scopyto = (u_int16_t)copyto;    /* ANSI */
-
-       n = ino[0] - 1;
-       while (n < ino[0]) {
-               if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) {
-                       if (__big_split(hashp, old_bufp,
-                           new_bufp, bufp, bufp->addr, obucket, &ret))
-                               return (-1);
-                       old_bufp = ret.oldp;
-                       if (!old_bufp)
-                               return (-1);
-                       op = (u_int16_t *)old_bufp->page;
-                       new_bufp = ret.newp;
-                       if (!new_bufp)
-                               return (-1);
-                       np = (u_int16_t *)new_bufp->page;
-                       bufp = ret.nextp;
-                       if (!bufp)
-                               return (0);
-                       cino = (char *)bufp->page;
-                       ino = (u_int16_t *)cino;
-                       last_bfp = ret.nextp;
-               } else if (ino[n + 1] == OVFLPAGE) {
-                       ov_addr = ino[n];
-                       /*
-                        * Fix up the old page -- the extra 2 are the fields
-                        * which contained the overflow information.
-                        */
-                       ino[0] -= (moved + 2);
-                       FREESPACE(ino) =
-                           scopyto - sizeof(u_int16_t) * (ino[0] + 3);
-                       OFFSET(ino) = scopyto;
-
-                       bufp = __get_buf(hashp, ov_addr, bufp, 0);
-                       if (!bufp)
-                               return (-1);
-
-                       ino = (u_int16_t *)bufp->page;
-                       n = 1;
-                       scopyto = hashp->BSIZE;
-                       moved = 0;
-
-                       if (last_bfp)
-                               __free_ovflpage(hashp, last_bfp);
-                       last_bfp = bufp;
-               }
-               /* Move regular sized pairs of there are any */
-               off = hashp->BSIZE;
-               for (n = 1; (n < ino[0]) && (ino[n + 1] >= REAL_KEY); n += 2) {
-                       cino = (char *)ino;
-                       key.data = (u_char *)cino + ino[n];
-                       key.size = off - ino[n];
-                       val.data = (u_char *)cino + ino[n + 1];
-                       val.size = ino[n] - ino[n + 1];
-                       off = ino[n + 1];
-
-                       if (__call_hash(hashp, key.data, key.size) == obucket) {
-                               /* Keep on old page */
-                               if (PAIRFITS(op, (&key), (&val)))
-                                       putpair((char *)op, &key, &val);
-                               else {
-                                       old_bufp =
-                                           __add_ovflpage(hashp, old_bufp);
-                                       if (!old_bufp)
-                                               return (-1);
-                                       op = (u_int16_t *)old_bufp->page;
-                                       putpair((char *)op, &key, &val);
-                               }
-                               old_bufp->flags |= BUF_MOD;
-                       } else {
-                               /* Move to new page */
-                               if (PAIRFITS(np, (&key), (&val)))
-                                       putpair((char *)np, &key, &val);
-                               else {
-                                       new_bufp =
-                                           __add_ovflpage(hashp, new_bufp);
-                                       if (!new_bufp)
-                                               return (-1);
-                                       np = (u_int16_t *)new_bufp->page;
-                                       putpair((char *)np, &key, &val);
-                               }
-                               new_bufp->flags |= BUF_MOD;
-                       }
-               }
-       }
-       if (last_bfp)
-               __free_ovflpage(hashp, last_bfp);
-       return (0);
-}
-
-/*
- * Add the given pair to the page
- *
- * Returns:
- *     0 ==> OK
- *     1 ==> failure
- */
-int
-__addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
-{
-       u_int16_t *bp, *sop;
-       int do_expand;
-
-       bp = (u_int16_t *)bufp->page;
-       do_expand = 0;
-       while (bp[0] && (bp[2] < REAL_KEY || bp[bp[0]] < REAL_KEY))
-               /* Exception case */
-               if (bp[2] == FULL_KEY_DATA && bp[0] == 2)
-                       /* This is the last page of a big key/data pair
-                          and we need to add another page */
-                       break;
-               else if (bp[2] < REAL_KEY && bp[bp[0]] != OVFLPAGE) {
-                       bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-                       if (!bufp)
-                               return (-1);
-                       bp = (u_int16_t *)bufp->page;
-               } else if (bp[bp[0]] != OVFLPAGE) {
-                       /* Short key/data pairs, no more pages */
-                       break;
-               } else {
-                       /* Try to squeeze key on this page */
-                       if (bp[2] >= REAL_KEY &&
-                           FREESPACE(bp) >= PAIRSIZE(key, val)) {
-                               squeeze_key(bp, key, val);
-                               goto stats;
-                       } else {
-                               bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0);
-                               if (!bufp)
-                                       return (-1);
-                               bp = (u_int16_t *)bufp->page;
-                       }
-               }
-
-       if (PAIRFITS(bp, key, val))
-               putpair(bufp->page, key, val);
-       else {
-               do_expand = 1;
-               bufp = __add_ovflpage(hashp, bufp);
-               if (!bufp)
-                       return (-1);
-               sop = (u_int16_t *)bufp->page;
-
-               if (PAIRFITS(sop, key, val))
-                       putpair((char *)sop, key, val);
-               else
-                       if (__big_insert(hashp, bufp, key, val))
-                               return (-1);
-       }
-stats:
-       bufp->flags |= BUF_MOD;
-       /*
-        * If the average number of keys per bucket exceeds the fill factor,
-        * expand the table.
-        */
-       hashp->NKEYS++;
-       if (do_expand ||
-           (hashp->NKEYS / (hashp->MAX_BUCKET + 1) > hashp->FFACTOR))
-               return (__expand_table(hashp));
-       return (0);
-}
-
-/*
- *
- * Returns:
- *     pointer on success
- *     NULL on error
- */
-BUFHEAD *
-__add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
-{
-       u_int16_t *sp, ndx, ovfl_num;
-#ifdef DEBUG1
-       int tmp1, tmp2;
-#endif
-       sp = (u_int16_t *)bufp->page;
-
-       /* Check if we are dynamically determining the fill factor */
-       if (hashp->FFACTOR == DEF_FFACTOR) {
-               hashp->FFACTOR = sp[0] >> 1;
-               if (hashp->FFACTOR < MIN_FFACTOR)
-                       hashp->FFACTOR = MIN_FFACTOR;
-       }
-       bufp->flags |= BUF_MOD;
-       ovfl_num = overflow_page(hashp);
-#ifdef DEBUG1
-       tmp1 = bufp->addr;
-       tmp2 = bufp->ovfl ? bufp->ovfl->addr : 0;
-#endif
-       if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, ovfl_num, bufp, 1)))
-               return (NULL);
-       bufp->ovfl->flags |= BUF_MOD;
-#ifdef DEBUG1
-       (void)fprintf(stderr, "ADDOVFLPAGE: %d->ovfl was %d is now %d\n",
-           tmp1, tmp2, bufp->ovfl->addr);
-#endif
-       ndx = sp[0];
-       /*
-        * Since a pair is allocated on a page only if there's room to add
-        * an overflow page, we know that the OVFL information will fit on
-        * the page.
-        */
-       sp[ndx + 4] = OFFSET(sp);
-       sp[ndx + 3] = FREESPACE(sp) - OVFLSIZE;
-       sp[ndx + 1] = ovfl_num;
-       sp[ndx + 2] = OVFLPAGE;
-       sp[0] = ndx + 2;
-#ifdef HASH_STATISTICS
-       hash_overflows++;
-#endif
-       return (bufp->ovfl);
-}
-
-/*
- * Returns:
- *      0 indicates SUCCESS
- *     -1 indicates FAILURE
- */
-int
-__get_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_disk,
-    int is_bitmap)
-{
-       int fd, page, size, rsize;
-       u_int16_t *bp;
-
-       fd = hashp->fp;
-       size = hashp->BSIZE;
-
-       if ((fd == -1) || !is_disk) {
-               PAGE_INIT(p);
-               return (0);
-       }
-       if (is_bucket)
-               page = BUCKET_TO_PAGE(bucket);
-       else
-               page = OADDR_TO_PAGE(bucket);
-       if ((rsize = pread(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
-               return (-1);
-       bp = (u_int16_t *)p;
-       if (!rsize)
-               bp[0] = 0;      /* We hit the EOF, so initialize a new page */
-       else
-               if (rsize != size) {
-                       errno = EFTYPE;
-                       return (-1);
-               }
-       if (!is_bitmap && !bp[0]) {
-               PAGE_INIT(p);
-       } else
-               if (hashp->LORDER != BYTE_ORDER) {
-                       int i, max;
-
-                       if (is_bitmap) {
-                               max = hashp->BSIZE >> 2; /* divide by 4 */
-                               for (i = 0; i < max; i++)
-                                       M_32_SWAP(((int *)p)[i]);
-                       } else {
-                               M_16_SWAP(bp[0]);
-                               max = bp[0] + 2;
-                               for (i = 1; i <= max; i++)
-                                       M_16_SWAP(bp[i]);
-                       }
-               }
-       return (0);
-}
-
-/*
- * Write page p to disk
- *
- * Returns:
- *      0 ==> OK
- *     -1 ==>failure
- */
-int
-__put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
-{
-       int fd, page, size, wsize, max;
-
-       size = hashp->BSIZE;
-       if ((hashp->fp == -1) && open_temp(hashp))
-               return (-1);
-       fd = hashp->fp;
-
-       if (hashp->LORDER != BYTE_ORDER) {
-               int i;
-
-               if (is_bitmap) {
-                       max = hashp->BSIZE >> 2;        /* divide by 4 */
-                       for (i = 0; i < max; i++)
-                               M_32_SWAP(((int *)p)[i]);
-               } else {
-                       max = ((u_int16_t *)p)[0] + 2;
-                       for (i = 0; i <= max; i++)
-                               M_16_SWAP(((u_int16_t *)p)[i]);
-               }
-       }
-       if (is_bucket)
-               page = BUCKET_TO_PAGE(bucket);
-       else
-               page = OADDR_TO_PAGE(bucket);
-       if ((wsize = pwrite(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
-               /* Errno is set */
-               return (-1);
-       if (wsize != size) {
-               errno = EFTYPE;
-               return (-1);
-       }
-       /* 4485533 - reswap the in-memory copy */
-       if (hashp->LORDER != BYTE_ORDER) {
-               int i;
-
-               if (is_bitmap) {
-                       for (i = 0; i < max; i++)
-                               M_32_SWAP(((int *)p)[i]);
-               } else {
-                       for (i = 0; i <= max; i++)
-                               M_16_SWAP(((u_int16_t *)p)[i]);
-               }
-       }
-       return (0);
-}
-
-#define BYTE_MASK      ((1 << INT_BYTE_SHIFT) -1)
-/*
- * Initialize a new bitmap page.  Bitmap pages are left in memory
- * once they are read in.
- */
-int
-__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
-{
-       u_int32_t *ip;
-       int clearbytes, clearints;
-
-       if ((ip = (u_int32_t *)malloc(hashp->BSIZE)) == NULL)
-               return (1);
-       hashp->nmaps++;
-       clearints = ((nbits - 1) >> INT_BYTE_SHIFT) + 1;
-       clearbytes = clearints << INT_TO_BYTE;
-       (void)memset((char *)ip, 0, clearbytes);
-       (void)memset(((char *)ip) + clearbytes, 0xFF,
-           hashp->BSIZE - clearbytes);
-       ip[clearints - 1] = ALL_SET << (nbits & BYTE_MASK);
-       SETBIT(ip, 0);
-       hashp->BITMAPS[ndx] = (u_int16_t)pnum;
-       hashp->mapp[ndx] = ip;
-       return (0);
-}
-
-static u_int32_t
-first_free(u_int32_t map)
-{
-       u_int32_t i, mask;
-
-       mask = 0x1;
-       for (i = 0; i < BITS_PER_MAP; i++) {
-               if (!(mask & map))
-                       return (i);
-               mask = mask << 1;
-       }
-       return (i);
-}
-
-static u_int16_t
-overflow_page(HTAB *hashp)
-{
-       u_int32_t *freep;
-       int max_free, offset, splitnum;
-       u_int16_t addr;
-       int bit, first_page, free_bit, free_page, i, in_use_bits, j;
-#ifdef DEBUG2
-       int tmp1, tmp2;
-#endif
-       splitnum = hashp->OVFL_POINT;
-       max_free = hashp->SPARES[splitnum];
-
-       free_page = (max_free - 1) >> (hashp->BSHIFT + BYTE_SHIFT);
-       free_bit = (max_free - 1) & ((hashp->BSIZE << BYTE_SHIFT) - 1);
-
-       /* Look through all the free maps to find the first free block */
-       first_page = hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT);
-       for ( i = first_page; i <= free_page; i++ ) {
-               if (!(freep = (u_int32_t *)hashp->mapp[i]) &&
-                   !(freep = fetch_bitmap(hashp, i)))
-                       return (0);
-               if (i == free_page)
-                       in_use_bits = free_bit;
-               else
-                       in_use_bits = (hashp->BSIZE << BYTE_SHIFT) - 1;
-
-               if (i == first_page) {
-                       bit = hashp->LAST_FREED &
-                           ((hashp->BSIZE << BYTE_SHIFT) - 1);
-                       j = bit / BITS_PER_MAP;
-                       bit = bit & ~(BITS_PER_MAP - 1);
-               } else {
-                       bit = 0;
-                       j = 0;
-               }
-               for (; bit <= in_use_bits; j++, bit += BITS_PER_MAP)
-                       if (freep[j] != ALL_SET)
-                               goto found;
-       }
-
-       /* No Free Page Found */
-       hashp->LAST_FREED = hashp->SPARES[splitnum];
-       hashp->SPARES[splitnum]++;
-       offset = hashp->SPARES[splitnum] -
-           (splitnum ? hashp->SPARES[splitnum - 1] : 0);
-
-#define        OVMSG   "HASH: Out of overflow pages.  Increase page size\n"
-       if (offset > SPLITMASK) {
-               if (++splitnum >= NCACHED) {
-                       (void)_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
-                       errno = EFBIG;
-                       return (0);
-               }
-               hashp->OVFL_POINT = splitnum;
-               hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1];
-               hashp->SPARES[splitnum-1]--;
-               offset = 1;
-       }
-
-       /* Check if we need to allocate a new bitmap page */
-       if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) {
-               free_page++;
-               if (free_page >= NCACHED) {
-                       (void)_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
-                       errno = EFBIG;
-                       return (0);
-               }
-               /*
-                * This is tricky.  The 1 indicates that you want the new page
-                * allocated with 1 clear bit.  Actually, you are going to
-                * allocate 2 pages from this map.  The first is going to be
-                * the map page, the second is the overflow page we were
-                * looking for.  The init_bitmap routine automatically, sets
-                * the first bit of itself to indicate that the bitmap itself
-                * is in use.  We would explicitly set the second bit, but
-                * don't have to if we tell init_bitmap not to leave it clear
-                * in the first place.
-                */
-               if (__ibitmap(hashp,
-                   (int)OADDR_OF(splitnum, offset), 1, free_page))
-                       return (0);
-               hashp->SPARES[splitnum]++;
-#ifdef DEBUG2
-               free_bit = 2;
-#endif
-               offset++;
-               if (offset > SPLITMASK) {
-                       if (++splitnum >= NCACHED) {
-                               (void)_write(STDERR_FILENO, OVMSG,
-                                   sizeof(OVMSG) - 1);
-                               errno = EFBIG;
-                               return (0);
-                       }
-                       hashp->OVFL_POINT = splitnum;
-                       hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1];
-                       hashp->SPARES[splitnum-1]--;
-                       offset = 0;
-               }
-       } else {
-               /*
-                * Free_bit addresses the last used bit.  Bump it to address
-                * the first available bit.
-                */
-               free_bit++;
-               SETBIT(freep, free_bit);
-       }
-
-       /* Calculate address of the new overflow page */
-       addr = OADDR_OF(splitnum, offset);
-#ifdef DEBUG2
-       (void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
-           addr, free_bit, free_page);
-#endif
-       return (addr);
-
-found:
-       bit = bit + first_free(freep[j]);
-       SETBIT(freep, bit);
-#ifdef DEBUG2
-       tmp1 = bit;
-       tmp2 = i;
-#endif
-       /*
-        * Bits are addressed starting with 0, but overflow pages are addressed
-        * beginning at 1. Bit is a bit addressnumber, so we need to increment
-        * it to convert it to a page number.
-        */
-       bit = 1 + bit + (i * (hashp->BSIZE << BYTE_SHIFT));
-       if (bit >= hashp->LAST_FREED)
-               hashp->LAST_FREED = bit - 1;
-
-       /* Calculate the split number for this page */
-       for (i = 0; (i < splitnum) && (bit > hashp->SPARES[i]); i++);
-       offset = (i ? bit - hashp->SPARES[i - 1] : bit);
-       if (offset >= SPLITMASK) {
-               (void)_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
-               errno = EFBIG;
-               return (0);     /* Out of overflow pages */
-       }
-       addr = OADDR_OF(i, offset);
-#ifdef DEBUG2
-       (void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
-           addr, tmp1, tmp2);
-#endif
-
-       /* Allocate and return the overflow page */
-       return (addr);
-}
-
-/*
- * Mark this overflow page as free.
- */
-void
-__free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
-{
-       u_int16_t addr;
-       u_int32_t *freep;
-       int bit_address, free_page, free_bit;
-       u_int16_t ndx;
-
-       addr = obufp->addr;
-#ifdef DEBUG1
-       (void)fprintf(stderr, "Freeing %d\n", addr);
-#endif
-       ndx = (((u_int16_t)addr) >> SPLITSHIFT);
-       bit_address =
-           (ndx ? hashp->SPARES[ndx - 1] : 0) + (addr & SPLITMASK) - 1;
-        if (bit_address < hashp->LAST_FREED)
-               hashp->LAST_FREED = bit_address;
-       free_page = (bit_address >> (hashp->BSHIFT + BYTE_SHIFT));
-       free_bit = bit_address & ((hashp->BSIZE << BYTE_SHIFT) - 1);
-
-       if (!(freep = hashp->mapp[free_page]))
-               freep = fetch_bitmap(hashp, free_page);
-#ifdef DEBUG
-       /*
-        * This had better never happen.  It means we tried to read a bitmap
-        * that has already had overflow pages allocated off it, and we
-        * failed to read it from the file.
-        */
-       if (!freep)
-               assert(0);
-#endif
-       CLRBIT(freep, free_bit);
-#ifdef DEBUG2
-       (void)fprintf(stderr, "FREE_OVFLPAGE: ADDR: %d BIT: %d PAGE %d\n",
-           obufp->addr, free_bit, free_page);
-#endif
-       __reclaim_buf(hashp, obufp);
-}
-
-/*
- * Returns:
- *      0 success
- *     -1 failure
- */
-static int
-open_temp(HTAB *hashp)
-{
-       sigset_t set, oset;
-       int len;
-       char *envtmp = NULL;
-       char path[MAXPATHLEN];
-
-       if (issetugid() == 0)
-               envtmp = getenv("TMPDIR");
-       len = snprintf(path,
-           sizeof(path), "%s/_hash.XXXXXX", envtmp ? envtmp : "/tmp");
-       if (len < 0 || len >= sizeof(path)) {
-               errno = ENAMETOOLONG;
-               return (-1);
-       }
-
-       /* Block signals; make sure file goes away at process exit. */
-       (void)sigfillset(&set);
-       (void)_sigprocmask(SIG_BLOCK, &set, &oset);
-       if ((hashp->fp = mkstemp(path)) != -1) {
-               (void)unlink(path);
-               (void)_fcntl(hashp->fp, F_SETFD, 1);
-       }
-       (void)_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
-       return (hashp->fp != -1 ? 0 : -1);
-}
-
-/*
- * We have to know that the key will fit, but the last entry on the page is
- * an overflow pair, so we need to shift things.
- */
-static void
-squeeze_key(u_int16_t *sp, const DBT *key, const DBT *val)
-{
-       char *p;
-       u_int16_t free_space, n, off, pageno;
-
-       p = (char *)sp;
-       n = sp[0];
-       free_space = FREESPACE(sp);
-       off = OFFSET(sp);
-
-       pageno = sp[n - 1];
-       off -= key->size;
-       sp[n - 1] = off;
-       memmove(p + off, key->data, key->size);
-       off -= val->size;
-       sp[n] = off;
-       memmove(p + off, val->data, val->size);
-       sp[0] = n + 2;
-       sp[n + 1] = pageno;
-       sp[n + 2] = OVFLPAGE;
-       FREESPACE(sp) = free_space - PAIRSIZE(key, val);
-       OFFSET(sp) = off;
-}
-
-static u_int32_t *
-fetch_bitmap(HTAB *hashp, int ndx)
-{
-       if (ndx >= hashp->nmaps)
-               return (NULL);
-       if ((hashp->mapp[ndx] = (u_int32_t *)malloc(hashp->BSIZE)) == NULL)
-               return (NULL);
-       if (__get_page(hashp,
-           (char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) {
-               free(hashp->mapp[ndx]);
-               return (NULL);
-       }
-       return (hashp->mapp[ndx]);
-}
-
-#ifdef DEBUG4
-int
-print_chain(int addr)
-{
-       BUFHEAD *bufp;
-       short *bp, oaddr;
-
-       (void)fprintf(stderr, "%d ", addr);
-       bufp = __get_buf(hashp, addr, NULL, 0);
-       bp = (short *)bufp->page;
-       while (bp[0] && ((bp[bp[0]] == OVFLPAGE) ||
-               ((bp[0] > 2) && bp[2] < REAL_KEY))) {
-               oaddr = bp[bp[0] - 1];
-               (void)fprintf(stderr, "%d ", (int)oaddr);
-               bufp = __get_buf(hashp, (int)oaddr, bufp, 0);
-               bp = (short *)bufp->page;
-       }
-       (void)fprintf(stderr, "\n");
-}
-#endif
diff --git a/db/hash/ndbm-fbsd.c b/db/hash/ndbm-fbsd.c
deleted file mode 100644 (file)
index c589af8..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ndbm.c     8.4 (Berkeley) 7/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/ndbm.c,v 1.7 2007/01/09 00:27:51 imp Exp $");
-
-/*
- * This package provides a dbm compatible interface to the new hashing
- * package described in db(3).
- */
-
-#include <sys/param.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <db.h>
-#define _DBM
-typedef DB DBM;
-#include <ndbm.h>
-#include "hash.h"
-
-/*
- * Returns:
- *     *DBM on success
- *      NULL on failure
- */
-extern DBM *
-dbm_open(file, flags, mode)
-       const char *file;
-       int flags;
-       mode_t mode;
-{
-       HASHINFO info;
-       char path[MAXPATHLEN];
-
-       info.bsize = 4096;
-       info.ffactor = 40;
-       info.nelem = 1;
-       info.cachesize = 0;
-       info.hash = NULL;
-       info.lorder = 0;
-
-       if( strlen(file) >= sizeof(path) - strlen(DBM_SUFFIX)) {
-               errno = ENAMETOOLONG;
-               return(NULL);
-       }
-       (void)strcpy(path, file);
-       (void)strcat(path, DBM_SUFFIX);
-       return ((DBM *)__hash_open(path, flags, mode, &info, 0));
-}
-
-extern void
-dbm_close(db)
-       DBM *db;
-{
-       (void)(db->close)(db);
-}
-
-/*
- * Returns:
- *     DATUM on success
- *     NULL on failure
- */
-extern datum
-dbm_fetch(db, key)
-       DBM *db;
-       datum key;
-{
-       datum retdata;
-       int status;
-       DBT dbtkey, dbtretdata;
-
-       dbtkey.data = key.dptr;
-       dbtkey.size = key.dsize;
-       status = (db->get)(db, &dbtkey, &dbtretdata, 0);
-       if (status) {
-               dbtretdata.data = NULL;
-               dbtretdata.size = 0;
-       }
-       retdata.dptr = dbtretdata.data;
-       retdata.dsize = dbtretdata.size;
-       return (retdata);
-}
-
-/*
- * Returns:
- *     DATUM on success
- *     NULL on failure
- */
-extern datum
-dbm_firstkey(db)
-       DBM *db;
-{
-       int status;
-       datum retkey;
-       DBT dbtretkey, dbtretdata;
-       HTAB *htab = (HTAB *)(db->internal);
-
-       status = (db->seq)(db, &dbtretkey, &dbtretdata, R_FIRST);
-       if (status) {
-               dbtretkey.data = NULL;
-               htab->nextkey_eof = 1;
-       } else
-               htab->nextkey_eof = 0;
-       retkey.dptr = dbtretkey.data;
-       retkey.dsize = dbtretkey.size;
-       return (retkey);
-}
-
-/*
- * Returns:
- *     DATUM on success
- *     NULL on failure
- */
-extern datum
-dbm_nextkey(db)
-       DBM *db;
-{
-       int status = 1;
-       datum retkey;
-       DBT dbtretkey, dbtretdata;
-       HTAB *htab = (HTAB *)(db->internal);
-
-       if (htab->nextkey_eof)
-               dbtretkey.data = NULL;
-       else {
-               status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
-               if (status) {
-                       dbtretkey.data = NULL;
-                       htab->nextkey_eof = 1;
-               }
-       }
-       retkey.dptr = dbtretkey.data;
-       retkey.dsize = dbtretkey.size;
-       return (retkey);
-}
-
-/*
- * Returns:
- *      0 on success
- *     <0 failure
- */
-extern int
-dbm_delete(db, key)
-       DBM *db;
-       datum key;
-{
-       int status;
-       DBT dbtkey;
-
-       dbtkey.data = key.dptr;
-       dbtkey.size = key.dsize;
-       status = (db->del)(db, &dbtkey, 0);
-       if (status)
-               return (-1);
-       else
-               return (0);
-}
-
-/*
- * Returns:
- *      0 on success
- *     <0 failure
- *      1 if DBM_INSERT and entry exists
- */
-extern int
-dbm_store(db, key, data, flags)
-       DBM *db;
-       datum key, data;
-       int flags;
-{
-       DBT dbtkey, dbtdata;
-
-       dbtkey.data = key.dptr;
-       dbtkey.size = key.dsize;
-       dbtdata.data = data.dptr;
-       dbtdata.size = data.dsize;
-       return ((db->put)(db, &dbtkey, &dbtdata,
-           (flags == DBM_INSERT) ? R_NOOVERWRITE : 0));
-}
-
-extern int
-dbm_error(db)
-       DBM *db;
-{
-       HTAB *hp;
-
-       hp = (HTAB *)db->internal;
-       return (hp->error);
-}
-
-extern int
-dbm_clearerr(db)
-       DBM *db;
-{
-       HTAB *hp;
-
-       hp = (HTAB *)db->internal;
-       hp->error = 0;
-       return (0);
-}
-
-extern int
-dbm_dirfno(db)
-       DBM *db;
-{
-       return(((HTAB *)db->internal)->fp);
-}
diff --git a/db/hash/page.h b/db/hash/page.h
deleted file mode 120000 (symlink)
index 0fb054f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./page.h
\ No newline at end of file
index e04bc20701602e8f0a7143ff990e028f24ccaa48..6258f1caeab4e677d6556528db0c95d89e46d8bf 100644 (file)
 .Nm dbm_store
 .Nd database access functions
 .Sh SYNOPSIS
-.In fcntl.h
 .In ndbm.h
-.Ft DBM *
-.Fn dbm_open "const char *base" "int flags" "int mode"
+.Ft int
+.Fo dbm_clearerr
+.Fa "DBM *db"
+.Fc
 .Ft void
-.Fn dbm_close "DBM *db"
+.Fo dbm_close
+.Fa "DBM *db"
+.Fc
 .Ft int
-.Fn dbm_store "DBM *db" "datum key" "datum data" "int flags"
-.Ft datum
-.Fn dbm_fetch "DBM *db" "datum key"
+.Fo dbm_delete
+.Fa "DBM *db"
+.Fa "datum key"
+.Fc
+.Ft int
+.Fo dbm_dirfno
+.Fa "DBM *db"
+.Fc
 .Ft int
-.Fn dbm_delete "DBM *db" "datum key"
+.Fo dbm_error
+.Fa "DBM *db"
+.Fc
 .Ft datum
-.Fn dbm_firstkey "DBM *db"
+.Fo dbm_fetch
+.Fa "DBM *db"
+.Fa "datum key"
+.Fc
 .Ft datum
-.Fn dbm_nextkey "DBM *db"
-.Ft int
-.Fn dbm_error "DBM *db"
-.Ft int
-.Fn dbm_clearerr "DBM *db"
+.Fo dbm_firstkey
+.Fa "DBM *db"
+.Fc
+.Ft datum
+.Fo dbm_nextkey
+.Fa "DBM *db"
+.Fc
+.Ft DBM *
+.Fo dbm_open
+.Fa "const char *file"
+.Fa "int open_flags"
+.Fa "mode_t file_mode"
+.Fc
 .Ft int
-.Fn dbm_dirfno "DBM *db"
+.Fo dbm_store
+.Fa "DBM *db"
+.Fa "datum key"
+.Fa "datum content"
+.Fa "int store_mode"
+.Fc
 .Sh DESCRIPTION
 Database access functions.
 These functions are implemented using
@@ -72,38 +98,38 @@ typedef struct {
 .Ed
 .Pp
 The
-.Fn dbm_open base flags mode
+.Fn dbm_open file open_flags file_mode
 function
-opens or creates a database.
+opens or creates a database file.
 The
-.Fa base
+.Fa file
 argument
 is the basename of the file containing
 the database; the actual database has a
 .Pa .db
 suffix.
 I.e., if
-.Fa base
+.Fa file
 is
 .Qq Li /home/me/mystuff
 then the actual database is in the file
 .Pa /home/me/mystuff.db .
 The
-.Fa flags
+.Fa open_flags
 and
-.Fa mode
+.Fa file_mode
 arguments
 are passed to
 .Xr open 2 .
 .Pq Dv O_RDWR | O_CREAT
 is a typical value for
-.Fa flags ;
+.Fa open_flags ;
 .Li 0660
 is a typical value for
-.Fa mode .
+.Fa file_mode .
 .Dv O_WRONLY
 is not allowed in
-.Fa flags .
+.Fa open_flags .
 The pointer returned by
 .Fn dbm_open
 identifies the database and is the
@@ -124,18 +150,18 @@ function
 closes the database.
 .Pp
 The
-.Fn dbm_store db key data flags
+.Fn dbm_store db key content store_mode
 function
 inserts or replaces an entry in the database.
 The
-.Fa flags
+.Fa store_mode
 argument
 is either
 .Dv DBM_INSERT
 or
 .Dv DBM_REPLACE .
 If
-.Fa flags
+.Fa store_mode
 is
 .Dv DBM_INSERT
 and the database already contains an entry for
@@ -147,7 +173,7 @@ The
 function
 normally returns zero but returns 1 if the entry could not be
 inserted (because
-.Fa flags
+.Fa store_mode
 is
 .Dv DBM_INSERT ,
 and an entry with
@@ -162,7 +188,7 @@ function
 returns
 .Dv NULL
 or the
-.Fa data
+.Fa content
 corresponding to
 .Fa key .
 .Pp
@@ -217,10 +243,30 @@ The
 .Fn dbm_dirfno db
 function
 returns the file descriptor to the database.
+.Sh LEGACY SYNOPSIS
+.Fd #include <fcntl.h>
+.Fd #include <ndbm.h>
+.Pp
+The include file
+.In ndbm.h
+is necessary for all functions.
+.Pp
+.Ft DBM *
+.br
+.Fo dbm_open
+.Fa "const char *file"
+.Fa "int open_flags"
+.Fa "int file_mode"
+.Fc ;
+.Pp
+.Fa file_mode
+has type
+.Vt int .
 .Sh SEE ALSO
 .Xr open 2 ,
 .Xr dbopen 3 ,
-.Xr hash 3
+.Xr hash 3 ,
+.Xr compat 5
 .Sh STANDARDS
 These functions (except
 .Fn dbm_dirfno )
diff --git a/db/man/FreeBSD/dbm.3.patch b/db/man/FreeBSD/dbm.3.patch
deleted file mode 100644 (file)
index c0f8688..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
---- dbm.3.orig 2009-11-06 12:44:50.000000000 -0800
-+++ dbm.3      2009-11-06 12:49:59.000000000 -0800
-@@ -31,28 +31,54 @@
- .Nm dbm_store
- .Nd database access functions
- .Sh SYNOPSIS
--.In fcntl.h
- .In ndbm.h
--.Ft DBM *
--.Fn dbm_open "const char *base" "int flags" "int mode"
-+.Ft int
-+.Fo dbm_clearerr
-+.Fa "DBM *db"
-+.Fc
- .Ft void
--.Fn dbm_close "DBM *db"
-+.Fo dbm_close
-+.Fa "DBM *db"
-+.Fc
- .Ft int
--.Fn dbm_store "DBM *db" "datum key" "datum data" "int flags"
--.Ft datum
--.Fn dbm_fetch "DBM *db" "datum key"
-+.Fo dbm_delete
-+.Fa "DBM *db"
-+.Fa "datum key"
-+.Fc
-+.Ft int
-+.Fo dbm_dirfno
-+.Fa "DBM *db"
-+.Fc
- .Ft int
--.Fn dbm_delete "DBM *db" "datum key"
-+.Fo dbm_error
-+.Fa "DBM *db"
-+.Fc
- .Ft datum
--.Fn dbm_firstkey "DBM *db"
-+.Fo dbm_fetch
-+.Fa "DBM *db"
-+.Fa "datum key"
-+.Fc
- .Ft datum
--.Fn dbm_nextkey "DBM *db"
--.Ft int
--.Fn dbm_error "DBM *db"
--.Ft int
--.Fn dbm_clearerr "DBM *db"
-+.Fo dbm_firstkey
-+.Fa "DBM *db"
-+.Fc
-+.Ft datum
-+.Fo dbm_nextkey
-+.Fa "DBM *db"
-+.Fc
-+.Ft DBM *
-+.Fo dbm_open
-+.Fa "const char *file"
-+.Fa "int open_flags"
-+.Fa "mode_t file_mode"
-+.Fc
- .Ft int
--.Fn dbm_dirfno "DBM *db"
-+.Fo dbm_store
-+.Fa "DBM *db"
-+.Fa "datum key"
-+.Fa "datum content"
-+.Fa "int store_mode"
-+.Fc
- .Sh DESCRIPTION
- Database access functions.
- These functions are implemented using
-@@ -72,38 +98,38 @@ typedef struct {
- .Ed
- .Pp
- The
--.Fn dbm_open base flags mode
-+.Fn dbm_open file open_flags file_mode
- function
--opens or creates a database.
-+opens or creates a database file.
- The
--.Fa base
-+.Fa file
- argument
- is the basename of the file containing
- the database; the actual database has a
- .Pa .db
- suffix.
- I.e., if
--.Fa base
-+.Fa file
- is
- .Qq Li /home/me/mystuff
- then the actual database is in the file
- .Pa /home/me/mystuff.db .
- The
--.Fa flags
-+.Fa open_flags
- and
--.Fa mode
-+.Fa file_mode
- arguments
- are passed to
- .Xr open 2 .
- .Pq Dv O_RDWR | O_CREAT
- is a typical value for
--.Fa flags ;
-+.Fa open_flags ;
- .Li 0660
- is a typical value for
--.Fa mode .
-+.Fa file_mode .
- .Dv O_WRONLY
- is not allowed in
--.Fa flags .
-+.Fa open_flags .
- The pointer returned by
- .Fn dbm_open
- identifies the database and is the
-@@ -124,18 +150,18 @@ function
- closes the database.
- .Pp
- The
--.Fn dbm_store db key data flags
-+.Fn dbm_store db key content store_mode
- function
- inserts or replaces an entry in the database.
- The
--.Fa flags
-+.Fa store_mode
- argument
- is either
- .Dv DBM_INSERT
- or
- .Dv DBM_REPLACE .
- If
--.Fa flags
-+.Fa store_mode
- is
- .Dv DBM_INSERT
- and the database already contains an entry for
-@@ -147,7 +173,7 @@ The
- function
- normally returns zero but returns 1 if the entry could not be
- inserted (because
--.Fa flags
-+.Fa store_mode
- is
- .Dv DBM_INSERT ,
- and an entry with
-@@ -162,7 +188,7 @@ function
- returns
- .Dv NULL
- or the
--.Fa data
-+.Fa content
- corresponding to
- .Fa key .
- .Pp
-@@ -217,10 +243,30 @@ The
- .Fn dbm_dirfno db
- function
- returns the file descriptor to the database.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <fcntl.h>
-+.Fd #include <ndbm.h>
-+.Pp
-+The include file
-+.In ndbm.h
-+is necessary for all functions.
-+.Pp
-+.Ft DBM *
-+.br
-+.Fo dbm_open
-+.Fa "const char *file"
-+.Fa "int open_flags"
-+.Fa "int file_mode"
-+.Fc ;
-+.Pp
-+.Fa file_mode
-+has type
-+.Vt int .
- .Sh SEE ALSO
- .Xr open 2 ,
- .Xr dbopen 3 ,
--.Xr hash 3
-+.Xr hash 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- These functions (except
- .Fn dbm_dirfno )
diff --git a/db/man/Makefile.inc b/db/man/Makefile.inc
deleted file mode 100644 (file)
index 86b03ff..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#       from @(#)Makefile.inc  8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/db/man/Makefile.inc,v 1.11 2002/11/18 09:50:54 ru Exp $
-
-.PATH: ${.CURDIR}/db/man
-CWD := ${.CURDIR}/db/man
-
-.if ${LIB} == "c"
-.include "Makefile.fbsd_begin"
-FBSDMAN3= btree.3 dbm.3 dbopen.3 hash.3 mpool.3 recno.3
-.include "Makefile.fbsd_end"
-
-MLINKS+= dbm.3 dbm_clearerr.3          \
-         dbm.3 dbm_close.3             \
-         dbm.3 dbm_delete.3            \
-         dbm.3 dbm_dirfno.3            \
-         dbm.3 dbm_error.3             \
-         dbm.3 dbm_fetch.3             \
-         dbm.3 dbm_firstkey.3          \
-         dbm.3 dbm_nextkey.3           \
-         dbm.3 dbm_open.3              \
-         dbm.3 dbm_store.3
-
-MLINKS+= dbopen.3 db.3
-
-MLINKS+= mpool.3 mpool_close.3         \
-         mpool.3 mpool_filter.3                \
-         mpool.3 mpool_get.3           \
-         mpool.3 mpool_new.3           \
-         mpool.3 mpool_open.3          \
-         mpool.3 mpool_put.3           \
-         mpool.3 mpool_sync.3
-
-.endif
diff --git a/db/man/btree.3 b/db/man/btree.3
deleted file mode 120000 (symlink)
index caa7263..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./btree.3
\ No newline at end of file
diff --git a/db/man/dbm.3 b/db/man/dbm.3
deleted file mode 100644 (file)
index 6258f1c..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-.\" Copyright (c) 1999 Tim Singletary
-.\" No copyright is claimed.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/db/man/dbm.3,v 1.10 2009/01/30 15:28:35 gabor Exp $
-.\"
-.Dd April 16, 2006
-.Dt DBM 3
-.Os
-.Sh NAME
-.Nm dbm_clearerr ,
-.Nm dbm_close ,
-.Nm dbm_delete ,
-.Nm dbm_dirfno ,
-.Nm dbm_error ,
-.Nm dbm_fetch ,
-.Nm dbm_firstkey ,
-.Nm dbm_nextkey ,
-.Nm dbm_open ,
-.Nm dbm_store
-.Nd database access functions
-.Sh SYNOPSIS
-.In ndbm.h
-.Ft int
-.Fo dbm_clearerr
-.Fa "DBM *db"
-.Fc
-.Ft void
-.Fo dbm_close
-.Fa "DBM *db"
-.Fc
-.Ft int
-.Fo dbm_delete
-.Fa "DBM *db"
-.Fa "datum key"
-.Fc
-.Ft int
-.Fo dbm_dirfno
-.Fa "DBM *db"
-.Fc
-.Ft int
-.Fo dbm_error
-.Fa "DBM *db"
-.Fc
-.Ft datum
-.Fo dbm_fetch
-.Fa "DBM *db"
-.Fa "datum key"
-.Fc
-.Ft datum
-.Fo dbm_firstkey
-.Fa "DBM *db"
-.Fc
-.Ft datum
-.Fo dbm_nextkey
-.Fa "DBM *db"
-.Fc
-.Ft DBM *
-.Fo dbm_open
-.Fa "const char *file"
-.Fa "int open_flags"
-.Fa "mode_t file_mode"
-.Fc
-.Ft int
-.Fo dbm_store
-.Fa "DBM *db"
-.Fa "datum key"
-.Fa "datum content"
-.Fa "int store_mode"
-.Fc
-.Sh DESCRIPTION
-Database access functions.
-These functions are implemented using
-.Xr dbopen 3
-with a
-.Xr hash 3
-database.
-.Pp
-.Vt datum
-is declared in
-.In ndbm.h :
-.Bd -literal
-typedef struct {
-       char *dptr;
-       int dsize;
-} datum;
-.Ed
-.Pp
-The
-.Fn dbm_open file open_flags file_mode
-function
-opens or creates a database file.
-The
-.Fa file
-argument
-is the basename of the file containing
-the database; the actual database has a
-.Pa .db
-suffix.
-I.e., if
-.Fa file
-is
-.Qq Li /home/me/mystuff
-then the actual database is in the file
-.Pa /home/me/mystuff.db .
-The
-.Fa open_flags
-and
-.Fa file_mode
-arguments
-are passed to
-.Xr open 2 .
-.Pq Dv O_RDWR | O_CREAT
-is a typical value for
-.Fa open_flags ;
-.Li 0660
-is a typical value for
-.Fa file_mode .
-.Dv O_WRONLY
-is not allowed in
-.Fa open_flags .
-The pointer returned by
-.Fn dbm_open
-identifies the database and is the
-.Fa db
-argument to the other functions.
-The
-.Fn dbm_open
-function
-returns
-.Dv NULL
-and sets
-.Va errno
-if there were any errors.
-.Pp
-The
-.Fn dbm_close db
-function
-closes the database.
-.Pp
-The
-.Fn dbm_store db key content store_mode
-function
-inserts or replaces an entry in the database.
-The
-.Fa store_mode
-argument
-is either
-.Dv DBM_INSERT
-or
-.Dv DBM_REPLACE .
-If
-.Fa store_mode
-is
-.Dv DBM_INSERT
-and the database already contains an entry for
-.Fa key ,
-that entry is not replaced.
-Otherwise the entry is replaced or inserted.
-The
-.Fn dbm_store
-function
-normally returns zero but returns 1 if the entry could not be
-inserted (because
-.Fa store_mode
-is
-.Dv DBM_INSERT ,
-and an entry with
-.Fa key
-already exists) or returns -1 and sets
-.Va errno
-if there were any errors.
-.Pp
-The
-.Fn dbm_fetch db key
-function
-returns
-.Dv NULL
-or the
-.Fa content
-corresponding to
-.Fa key .
-.Pp
-The
-.Fn dbm_delete db key
-function
-deletes the entry for
-.Fa key .
-The
-.Fn dbm_delete
-function
-normally returns zero but returns 1 if there was no entry with
-.Fa key
-in the database or returns -1 and sets
-.Va errno
-if there were any errors.
-.Pp
-The
-.Fn dbm_firstkey db
-function
-returns the first key in the database.
-The
-.Fn dbm_nextkey db
-function
-returns subsequent keys.
-The
-.Fn db_firstkey
-function
-must be called before
-.Fn dbm_nextkey .
-The order in which keys are returned is unspecified and may appear
-random.
-The
-.Fn dbm_nextkey
-function
-returns
-.Dv NULL
-after all keys have been returned.
-.Pp
-The
-.Fn dbm_error db
-function
-returns the
-.Va errno
-value of the most recent error.
-The
-.Fn dbm_clearerr db
-function
-resets this value to 0 and returns 0.
-.Pp
-The
-.Fn dbm_dirfno db
-function
-returns the file descriptor to the database.
-.Sh LEGACY SYNOPSIS
-.Fd #include <fcntl.h>
-.Fd #include <ndbm.h>
-.Pp
-The include file
-.In ndbm.h
-is necessary for all functions.
-.Pp
-.Ft DBM *
-.br
-.Fo dbm_open
-.Fa "const char *file"
-.Fa "int open_flags"
-.Fa "int file_mode"
-.Fc ;
-.Pp
-.Fa file_mode
-has type
-.Vt int .
-.Sh SEE ALSO
-.Xr open 2 ,
-.Xr dbopen 3 ,
-.Xr hash 3 ,
-.Xr compat 5
-.Sh STANDARDS
-These functions (except
-.Fn dbm_dirfno )
-are included in the
-.St -susv2 .
diff --git a/db/man/dbopen.3 b/db/man/dbopen.3
deleted file mode 120000 (symlink)
index 25b88f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./dbopen.3
\ No newline at end of file
diff --git a/db/man/hash.3 b/db/man/hash.3
deleted file mode 120000 (symlink)
index 4158259..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./hash.3
\ No newline at end of file
diff --git a/db/man/mpool.3 b/db/man/mpool.3
deleted file mode 120000 (symlink)
index b15f332..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpool.3
\ No newline at end of file
diff --git a/db/man/recno.3 b/db/man/recno.3
deleted file mode 120000 (symlink)
index 346f3e2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./recno.3
\ No newline at end of file
index 6938194e44ec366ea97d770447d2938c543047f9..36fb30bb56bda9c3f165f327677faf82691b787a 100644 (file)
@@ -119,7 +119,7 @@ mpool_new(mp, pgnoaddr)
 
        if (mp->npages == MAX_PAGE_NUMBER) {
                (void)fprintf(stderr, "mpool_new: page allocation overflow.\n");
-               abort();
+               LIBC_ABORT("page allocation overflow");
        }
 #ifdef STATISTICS
        ++mp->pagenew;
@@ -170,7 +170,7 @@ mpool_get(MPOOL *mp, pgno_t pgno,
                if (bp->flags & MPOOL_PINNED) {
                        (void)fprintf(stderr,
                            "mpool_get: page %d already pinned\n", bp->pgno);
-                       abort();
+                       LIBC_ABORT("page %d already pinned", bp->pgno);
                }
 #endif
                /*
@@ -241,7 +241,7 @@ mpool_put(MPOOL *mp, void *page, u_int flags)
        if (!(bp->flags & MPOOL_PINNED)) {
                (void)fprintf(stderr,
                    "mpool_put: page %d not pinned\n", bp->pgno);
-               abort();
+               LIBC_ABORT("page %d not pinned", bp->pgno);
        }
 #endif
        bp->flags &= ~MPOOL_PINNED;
@@ -280,10 +280,16 @@ mpool_sync(MPOOL *mp)
        BKT *bp;
 
        /* Walk the lru chain, flushing any dirty pages to disk. */
-       TAILQ_FOREACH(bp, &mp->lqh, q)
-               if (bp->flags & MPOOL_DIRTY &&
-                   mpool_write(mp, bp) == RET_ERROR)
-                       return (RET_ERROR);
+       TAILQ_FOREACH(bp, &mp->lqh, q) {
+               if (bp->flags & MPOOL_DIRTY)
+                       if (mpool_write(mp, bp) == RET_ERROR) {
+                               return (RET_ERROR);
+                       } else {
+                               /* 4874757: Re-run through the user's pgin filter. */
+                               if (mp->pgin != NULL)
+                                       (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
+                       }
+       }
 
        /* Sync the file descriptor. */
        return (_fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
diff --git a/db/mpool/FreeBSD/mpool.c.patch b/db/mpool/FreeBSD/mpool.c.patch
deleted file mode 100644 (file)
index 2193284..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
---- mpool.c.orig       2009-11-06 12:36:03.000000000 -0800
-+++ mpool.c    2009-11-06 12:36:15.000000000 -0800
-@@ -119,7 +119,7 @@ mpool_new(mp, pgnoaddr)
-       if (mp->npages == MAX_PAGE_NUMBER) {
-               (void)fprintf(stderr, "mpool_new: page allocation overflow.\n");
--              abort();
-+              LIBC_ABORT("page allocation overflow");
-       }
- #ifdef STATISTICS
-       ++mp->pagenew;
-@@ -170,7 +170,7 @@ mpool_get(MPOOL *mp, pgno_t pgno,
-               if (bp->flags & MPOOL_PINNED) {
-                       (void)fprintf(stderr,
-                           "mpool_get: page %d already pinned\n", bp->pgno);
--                      abort();
-+                      LIBC_ABORT("page %d already pinned", bp->pgno);
-               }
- #endif
-               /*
-@@ -241,7 +241,7 @@ mpool_put(MPOOL *mp, void *page, u_int f
-       if (!(bp->flags & MPOOL_PINNED)) {
-               (void)fprintf(stderr,
-                   "mpool_put: page %d not pinned\n", bp->pgno);
--              abort();
-+              LIBC_ABORT("page %d not pinned", bp->pgno);
-       }
- #endif
-       bp->flags &= ~MPOOL_PINNED;
-@@ -280,10 +280,16 @@ mpool_sync(MPOOL *mp)
-       BKT *bp;
-       /* Walk the lru chain, flushing any dirty pages to disk. */
--      TAILQ_FOREACH(bp, &mp->lqh, q)
--              if (bp->flags & MPOOL_DIRTY &&
--                  mpool_write(mp, bp) == RET_ERROR)
--                      return (RET_ERROR);
-+      TAILQ_FOREACH(bp, &mp->lqh, q) {
-+              if (bp->flags & MPOOL_DIRTY)
-+                      if (mpool_write(mp, bp) == RET_ERROR) {
-+                              return (RET_ERROR);
-+                      } else {
-+                              /* 4874757: Re-run through the user's pgin filter. */
-+                              if (mp->pgin != NULL)
-+                                      (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
-+                      }
-+      }
-       /* Sync the file descriptor. */
-       return (_fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
diff --git a/db/mpool/Makefile.inc b/db/mpool/Makefile.inc
deleted file mode 100644 (file)
index 9b5775e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#      from @(#)Makefile.inc   8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/db/mpool/Makefile.inc,v 1.4 2002/11/18 09:50:55 ru Exp $
-
-.PATH: ${.CURDIR}/db/mpool
-CWD := ${.CURDIR}/db/mpool
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= mpool.c
-.for _src in ${FBSDMISRCS}
-CFLAGS-${_src:R}-fbsd.${_src:E} += -D__DBINTERFACE_PRIVATE
-.endfor
-.for _src in mpool.c
-CFLAGS-${_src:R}-fbsd.${_src:E} += -UDEBUG
-.endfor
-.include "Makefile.fbsd_end"
diff --git a/db/mpool/mpool-fbsd.c b/db/mpool/mpool-fbsd.c
deleted file mode 100644 (file)
index 36fb30b..0000000
+++ /dev/null
@@ -1,445 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mpool.c    8.5 (Berkeley) 7/26/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/mpool/mpool.c,v 1.16 2009/03/28 04:00:46 delphij Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include <db.h>
-
-#define        __MPOOLINTERFACE_PRIVATE
-#include <mpool.h>
-
-static BKT *mpool_bkt(MPOOL *);
-static BKT *mpool_look(MPOOL *, pgno_t);
-static int  mpool_write(MPOOL *, BKT *);
-
-/*
- * mpool_open --
- *     Initialize a memory pool.
- */
-/* ARGSUSED */
-MPOOL *
-mpool_open(void *key, int fd, pgno_t pagesize, pgno_t maxcache)
-{
-       struct stat sb;
-       MPOOL *mp;
-       int entry;
-
-       /*
-        * Get information about the file.
-        *
-        * XXX
-        * We don't currently handle pipes, although we should.
-        */
-       if (_fstat(fd, &sb))
-               return (NULL);
-       if (!S_ISREG(sb.st_mode)) {
-               errno = ESPIPE;
-               return (NULL);
-       }
-
-       /* Allocate and initialize the MPOOL cookie. */
-       if ((mp = (MPOOL *)calloc(1, sizeof(MPOOL))) == NULL)
-               return (NULL);
-       TAILQ_INIT(&mp->lqh);
-       for (entry = 0; entry < HASHSIZE; ++entry)
-               TAILQ_INIT(&mp->hqh[entry]);
-       mp->maxcache = maxcache;
-       mp->npages = sb.st_size / pagesize;
-       mp->pagesize = pagesize;
-       mp->fd = fd;
-       return (mp);
-}
-
-/*
- * mpool_filter --
- *     Initialize input/output filters.
- */
-void
-mpool_filter(MPOOL *mp, void (*pgin) (void *, pgno_t, void *),
-    void (*pgout) (void *, pgno_t, void *), void *pgcookie)
-{
-       mp->pgin = pgin;
-       mp->pgout = pgout;
-       mp->pgcookie = pgcookie;
-}
-       
-/*
- * mpool_new --
- *     Get a new page of memory.
- */
-void *
-mpool_new(mp, pgnoaddr)
-       MPOOL *mp;
-       pgno_t *pgnoaddr;
-{
-       struct _hqh *head;
-       BKT *bp;
-
-       if (mp->npages == MAX_PAGE_NUMBER) {
-               (void)fprintf(stderr, "mpool_new: page allocation overflow.\n");
-               LIBC_ABORT("page allocation overflow");
-       }
-#ifdef STATISTICS
-       ++mp->pagenew;
-#endif
-       /*
-        * Get a BKT from the cache.  Assign a new page number, attach
-        * it to the head of the hash chain, the tail of the lru chain,
-        * and return.
-        */
-       if ((bp = mpool_bkt(mp)) == NULL)
-               return (NULL);
-       *pgnoaddr = bp->pgno = mp->npages++;
-       bp->flags = MPOOL_PINNED;
-
-       head = &mp->hqh[HASHKEY(bp->pgno)];
-       TAILQ_INSERT_HEAD(head, bp, hq);
-       TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
-       return (bp->page);
-}
-
-/*
- * mpool_get
- *     Get a page.
- */
-/* ARGSUSED */
-void *
-mpool_get(MPOOL *mp, pgno_t pgno,
-    u_int flags)               /* XXX not used? */
-{
-       struct _hqh *head;
-       BKT *bp;
-       off_t off;
-       int nr;
-
-       /* Check for attempt to retrieve a non-existent page. */
-       if (pgno >= mp->npages) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-#ifdef STATISTICS
-       ++mp->pageget;
-#endif
-
-       /* Check for a page that is cached. */
-       if ((bp = mpool_look(mp, pgno)) != NULL) {
-#ifdef DEBUG
-               if (bp->flags & MPOOL_PINNED) {
-                       (void)fprintf(stderr,
-                           "mpool_get: page %d already pinned\n", bp->pgno);
-                       LIBC_ABORT("page %d already pinned", bp->pgno);
-               }
-#endif
-               /*
-                * Move the page to the head of the hash chain and the tail
-                * of the lru chain.
-                */
-               head = &mp->hqh[HASHKEY(bp->pgno)];
-               TAILQ_REMOVE(head, bp, hq);
-               TAILQ_INSERT_HEAD(head, bp, hq);
-               TAILQ_REMOVE(&mp->lqh, bp, q);
-               TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
-
-               /* Return a pinned page. */
-               bp->flags |= MPOOL_PINNED;
-               return (bp->page);
-       }
-
-       /* Get a page from the cache. */
-       if ((bp = mpool_bkt(mp)) == NULL)
-               return (NULL);
-
-       /* Read in the contents. */
-#ifdef STATISTICS
-       ++mp->pageread;
-#endif
-       off = mp->pagesize * pgno;
-       nr = pread(mp->fd, bp->page, mp->pagesize, off);
-       if (nr != mp->pagesize) {
-               if (nr >= 0)
-                       errno = EFTYPE;
-               return (NULL);
-       }
-
-       /* Set the page number, pin the page. */
-       bp->pgno = pgno;
-       bp->flags = MPOOL_PINNED;
-
-       /*
-        * Add the page to the head of the hash chain and the tail
-        * of the lru chain.
-        */
-       head = &mp->hqh[HASHKEY(bp->pgno)];
-       TAILQ_INSERT_HEAD(head, bp, hq);
-       TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
-
-       /* Run through the user's filter. */
-       if (mp->pgin != NULL)
-               (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
-
-       return (bp->page);
-}
-
-/*
- * mpool_put
- *     Return a page.
- */
-/* ARGSUSED */
-int
-mpool_put(MPOOL *mp, void *page, u_int flags)
-{
-       BKT *bp;
-
-#ifdef STATISTICS
-       ++mp->pageput;
-#endif
-       bp = (BKT *)((char *)page - sizeof(BKT));
-#ifdef DEBUG
-       if (!(bp->flags & MPOOL_PINNED)) {
-               (void)fprintf(stderr,
-                   "mpool_put: page %d not pinned\n", bp->pgno);
-               LIBC_ABORT("page %d not pinned", bp->pgno);
-       }
-#endif
-       bp->flags &= ~MPOOL_PINNED;
-       bp->flags |= flags & MPOOL_DIRTY;
-       return (RET_SUCCESS);
-}
-
-/*
- * mpool_close
- *     Close the buffer pool.
- */
-int
-mpool_close(MPOOL *mp)
-{
-       BKT *bp;
-
-       /* Free up any space allocated to the lru pages. */
-       while (!TAILQ_EMPTY(&mp->lqh)) {
-               bp = TAILQ_FIRST(&mp->lqh);
-               TAILQ_REMOVE(&mp->lqh, bp, q);
-               free(bp);
-       }
-
-       /* Free the MPOOL cookie. */
-       free(mp);
-       return (RET_SUCCESS);
-}
-
-/*
- * mpool_sync
- *     Sync the pool to disk.
- */
-int
-mpool_sync(MPOOL *mp)
-{
-       BKT *bp;
-
-       /* Walk the lru chain, flushing any dirty pages to disk. */
-       TAILQ_FOREACH(bp, &mp->lqh, q) {
-               if (bp->flags & MPOOL_DIRTY)
-                       if (mpool_write(mp, bp) == RET_ERROR) {
-                               return (RET_ERROR);
-                       } else {
-                               /* 4874757: Re-run through the user's pgin filter. */
-                               if (mp->pgin != NULL)
-                                       (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
-                       }
-       }
-
-       /* Sync the file descriptor. */
-       return (_fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
-}
-
-/*
- * mpool_bkt
- *     Get a page from the cache (or create one).
- */
-static BKT *
-mpool_bkt(MPOOL *mp)
-{
-       struct _hqh *head;
-       BKT *bp;
-
-       /* If under the max cached, always create a new page. */
-       if (mp->curcache < mp->maxcache)
-               goto new;
-
-       /*
-        * If the cache is max'd out, walk the lru list for a buffer we
-        * can flush.  If we find one, write it (if necessary) and take it
-        * off any lists.  If we don't find anything we grow the cache anyway.
-        * The cache never shrinks.
-        */
-       TAILQ_FOREACH(bp, &mp->lqh, q)
-               if (!(bp->flags & MPOOL_PINNED)) {
-                       /* Flush if dirty. */
-                       if (bp->flags & MPOOL_DIRTY &&
-                           mpool_write(mp, bp) == RET_ERROR)
-                               return (NULL);
-#ifdef STATISTICS
-                       ++mp->pageflush;
-#endif
-                       /* Remove from the hash and lru queues. */
-                       head = &mp->hqh[HASHKEY(bp->pgno)];
-                       TAILQ_REMOVE(head, bp, hq);
-                       TAILQ_REMOVE(&mp->lqh, bp, q);
-#ifdef DEBUG
-                       { void *spage;
-                               spage = bp->page;
-                               memset(bp, 0xff, sizeof(BKT) + mp->pagesize);
-                               bp->page = spage;
-                       }
-#endif
-                       return (bp);
-               }
-
-new:   if ((bp = (BKT *)calloc(1, sizeof(BKT) + mp->pagesize)) == NULL)
-               return (NULL);
-#ifdef STATISTICS
-       ++mp->pagealloc;
-#endif
-       bp->page = (char *)bp + sizeof(BKT);
-       ++mp->curcache;
-       return (bp);
-}
-
-/*
- * mpool_write
- *     Write a page to disk.
- */
-static int
-mpool_write(MPOOL *mp, BKT *bp)
-{
-       off_t off;
-
-#ifdef STATISTICS
-       ++mp->pagewrite;
-#endif
-
-       /* Run through the user's filter. */
-       if (mp->pgout)
-               (mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
-
-       off = mp->pagesize * bp->pgno;
-       if (pwrite(mp->fd, bp->page, mp->pagesize, off) != mp->pagesize)
-               return (RET_ERROR);
-
-       bp->flags &= ~MPOOL_DIRTY;
-       return (RET_SUCCESS);
-}
-
-/*
- * mpool_look
- *     Lookup a page in the cache.
- */
-static BKT *
-mpool_look(MPOOL *mp, pgno_t pgno)
-{
-       struct _hqh *head;
-       BKT *bp;
-
-       head = &mp->hqh[HASHKEY(pgno)];
-       TAILQ_FOREACH(bp, head, hq)
-               if (bp->pgno == pgno) {
-#ifdef STATISTICS
-                       ++mp->cachehit;
-#endif
-                       return (bp);
-               }
-#ifdef STATISTICS
-       ++mp->cachemiss;
-#endif
-       return (NULL);
-}
-
-#ifdef STATISTICS
-/*
- * mpool_stat
- *     Print out cache statistics.
- */
-void
-mpool_stat(MPOOL *mp)
-{
-       BKT *bp;
-       int cnt;
-       char *sep;
-
-       (void)fprintf(stderr, "%lu pages in the file\n", mp->npages);
-       (void)fprintf(stderr,
-           "page size %lu, cacheing %lu pages of %lu page max cache\n",
-           mp->pagesize, mp->curcache, mp->maxcache);
-       (void)fprintf(stderr, "%lu page puts, %lu page gets, %lu page new\n",
-           mp->pageput, mp->pageget, mp->pagenew);
-       (void)fprintf(stderr, "%lu page allocs, %lu page flushes\n",
-           mp->pagealloc, mp->pageflush);
-       if (mp->cachehit + mp->cachemiss)
-               (void)fprintf(stderr,
-                   "%.0f%% cache hit rate (%lu hits, %lu misses)\n", 
-                   ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
-                   * 100, mp->cachehit, mp->cachemiss);
-       (void)fprintf(stderr, "%lu page reads, %lu page writes\n",
-           mp->pageread, mp->pagewrite);
-
-       sep = "";
-       cnt = 0;
-       TAILQ_FOREACH(bp, &mp->lqh, q) {
-               (void)fprintf(stderr, "%s%d", sep, bp->pgno);
-               if (bp->flags & MPOOL_DIRTY)
-                       (void)fprintf(stderr, "d");
-               if (bp->flags & MPOOL_PINNED)
-                       (void)fprintf(stderr, "P");
-               if (++cnt == 10) {
-                       sep = "\n";
-                       cnt = 0;
-               } else
-                       sep = ", ";
-                       
-       }
-       (void)fprintf(stderr, "\n");
-}
-#endif
diff --git a/db/recno/FreeBSD/extern.h b/db/recno/FreeBSD/extern.h
deleted file mode 100644 (file)
index ad00805..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)extern.h    8.3 (Berkeley) 6/4/94
- * $FreeBSD: src/lib/libc/db/recno/extern.h,v 1.3 2007/01/09 00:27:51 imp Exp $
- */
-
-#include "../btree/extern.h"
-
-int     __rec_close(DB *);
-int     __rec_delete(const DB *, const DBT *, u_int);
-int     __rec_dleaf(BTREE *, PAGE *, u_int32_t);
-int     __rec_fd(const DB *);
-int     __rec_fmap(BTREE *, recno_t);
-int     __rec_fout(BTREE *);
-int     __rec_fpipe(BTREE *, recno_t);
-int     __rec_get(const DB *, const DBT *, DBT *, u_int);
-int     __rec_iput(BTREE *, recno_t, const DBT *, u_int);
-int     __rec_put(const DB *dbp, DBT *, const DBT *, u_int);
-int     __rec_ret(BTREE *, EPG *, recno_t, DBT *, DBT *);
-EPG    *__rec_search(BTREE *, recno_t, enum SRCHOP);
-int     __rec_seq(const DB *, DBT *, DBT *, u_int);
-int     __rec_sync(const DB *, u_int);
-int     __rec_vmap(BTREE *, recno_t);
-int     __rec_vout(BTREE *);
-int     __rec_vpipe(BTREE *, recno_t);
diff --git a/db/recno/FreeBSD/extern.h.patch b/db/recno/FreeBSD/extern.h.patch
deleted file mode 100644 (file)
index e5ff9e2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- extern.h.orig      2009-11-06 12:44:16.000000000 -0800
-+++ extern.h   2009-11-06 12:44:28.000000000 -0800
-@@ -30,7 +30,7 @@
-  * $FreeBSD: src/lib/libc/db/recno/extern.h,v 1.3 2007/01/09 00:27:51 imp Exp $
-  */
--#include "../btree/extern.h"
-+#include "../btree/bt_extern.h"
- int    __rec_close(DB *);
- int    __rec_delete(const DB *, const DBT *, u_int);
diff --git a/db/recno/FreeBSD/rec_extern.h b/db/recno/FreeBSD/rec_extern.h
new file mode 100644 (file)
index 0000000..514170c
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)extern.h    8.3 (Berkeley) 6/4/94
+ * $FreeBSD: src/lib/libc/db/recno/extern.h,v 1.3 2007/01/09 00:27:51 imp Exp $
+ */
+
+#include "../../btree/FreeBSD/bt_extern.h"
+
+int     __rec_close(DB *);
+int     __rec_delete(const DB *, const DBT *, u_int);
+int     __rec_dleaf(BTREE *, PAGE *, u_int32_t);
+int     __rec_fd(const DB *);
+int     __rec_fmap(BTREE *, recno_t);
+int     __rec_fout(BTREE *);
+int     __rec_fpipe(BTREE *, recno_t);
+int     __rec_get(const DB *, const DBT *, DBT *, u_int);
+int     __rec_iput(BTREE *, recno_t, const DBT *, u_int);
+int     __rec_put(const DB *dbp, DBT *, const DBT *, u_int);
+int     __rec_ret(BTREE *, EPG *, recno_t, DBT *, DBT *);
+EPG    *__rec_search(BTREE *, recno_t, enum SRCHOP);
+int     __rec_seq(const DB *, DBT *, DBT *, u_int);
+int     __rec_sync(const DB *, u_int);
+int     __rec_vmap(BTREE *, recno_t);
+int     __rec_vout(BTREE *);
+int     __rec_vpipe(BTREE *, recno_t);
index d5e10f0e5858e433c6c3ea0f8d229be9dc4be229..438a56c1cd4a102bfeb2096151c785d51b68b30e 100644 (file)
@@ -32,5 +32,5 @@
 
 enum SRCHOP { SDELETE, SINSERT, SEARCH};       /* Rec_search operation. */
 
-#include "../btree/btree.h"
-#include "extern.h"
+#include "../../btree/FreeBSD/btree.h"
+#include "rec_extern.h"
diff --git a/db/recno/FreeBSD/recno.h.patch b/db/recno/FreeBSD/recno.h.patch
deleted file mode 100644 (file)
index 4b968d4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- recno.h.orig       2009-11-06 12:44:16.000000000 -0800
-+++ recno.h    2009-11-06 12:44:28.000000000 -0800
-@@ -33,4 +33,4 @@
- enum SRCHOP { SDELETE, SINSERT, SEARCH};      /* Rec_search operation. */
- #include "../btree/btree.h"
--#include "extern.h"
-+#include "rec_extern.h"
diff --git a/db/recno/Makefile.inc b/db/recno/Makefile.inc
deleted file mode 100644 (file)
index 04c3681..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#       from @(#)Makefile.inc  8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/db/recno/Makefile.inc,v 1.4 2002/11/18 09:50:55 ru Exp $
-
-.PATH: ${.CURDIR}/db/recno
-CWD := ${.CURDIR}/db/recno
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= rec_close.c rec_delete.c rec_get.c rec_open.c rec_put.c rec_search.c \
-       rec_seq.c rec_utils.c
-.for _src in ${FBSDMISRCS}
-CFLAGS-${_src:R}-fbsd.${_src:E} += -D__DBINTERFACE_PRIVATE
-.endfor
-CFLAGS-rec_open-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-FBSDHDRS= recno.h
-.include "Makefile.fbsd_end"
-
-# need to rename extern.h to make it unique
-.ifmake autopatch
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-${_cwd}/rec_extern.h: ${_cwd}/FreeBSD/extern.h _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/rec_extern.h
-.endfor # _cwd
-
-.endif # autopatch
diff --git a/db/recno/rec_close-fbsd.c b/db/recno/rec_close-fbsd.c
deleted file mode 120000 (symlink)
index 31b4ea9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_close.c
\ No newline at end of file
diff --git a/db/recno/rec_delete-fbsd.c b/db/recno/rec_delete-fbsd.c
deleted file mode 120000 (symlink)
index 99b089d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_delete.c
\ No newline at end of file
diff --git a/db/recno/rec_extern.h b/db/recno/rec_extern.h
deleted file mode 100644 (file)
index 179a612..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)extern.h    8.3 (Berkeley) 6/4/94
- * $FreeBSD: src/lib/libc/db/recno/extern.h,v 1.3 2007/01/09 00:27:51 imp Exp $
- */
-
-#include "../btree/bt_extern.h"
-
-int     __rec_close(DB *);
-int     __rec_delete(const DB *, const DBT *, u_int);
-int     __rec_dleaf(BTREE *, PAGE *, u_int32_t);
-int     __rec_fd(const DB *);
-int     __rec_fmap(BTREE *, recno_t);
-int     __rec_fout(BTREE *);
-int     __rec_fpipe(BTREE *, recno_t);
-int     __rec_get(const DB *, const DBT *, DBT *, u_int);
-int     __rec_iput(BTREE *, recno_t, const DBT *, u_int);
-int     __rec_put(const DB *dbp, DBT *, const DBT *, u_int);
-int     __rec_ret(BTREE *, EPG *, recno_t, DBT *, DBT *);
-EPG    *__rec_search(BTREE *, recno_t, enum SRCHOP);
-int     __rec_seq(const DB *, DBT *, DBT *, u_int);
-int     __rec_sync(const DB *, u_int);
-int     __rec_vmap(BTREE *, recno_t);
-int     __rec_vout(BTREE *);
-int     __rec_vpipe(BTREE *, recno_t);
diff --git a/db/recno/rec_get-fbsd.c b/db/recno/rec_get-fbsd.c
deleted file mode 120000 (symlink)
index 5d7c157..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_get.c
\ No newline at end of file
diff --git a/db/recno/rec_open-fbsd.c b/db/recno/rec_open-fbsd.c
deleted file mode 120000 (symlink)
index 84a4acb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_open.c
\ No newline at end of file
diff --git a/db/recno/rec_put-fbsd.c b/db/recno/rec_put-fbsd.c
deleted file mode 120000 (symlink)
index 73a5bdc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_put.c
\ No newline at end of file
diff --git a/db/recno/rec_search-fbsd.c b/db/recno/rec_search-fbsd.c
deleted file mode 120000 (symlink)
index b4a722a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_search.c
\ No newline at end of file
diff --git a/db/recno/rec_seq-fbsd.c b/db/recno/rec_seq-fbsd.c
deleted file mode 120000 (symlink)
index 3274e31..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_seq.c
\ No newline at end of file
diff --git a/db/recno/rec_utils-fbsd.c b/db/recno/rec_utils-fbsd.c
deleted file mode 120000 (symlink)
index eb044fb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rec_utils.c
\ No newline at end of file
diff --git a/db/recno/recno.h b/db/recno/recno.h
deleted file mode 100644 (file)
index 26eb9f3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)recno.h     8.1 (Berkeley) 6/4/93
- * $FreeBSD: src/lib/libc/db/recno/recno.h,v 1.3 2007/01/09 00:27:52 imp Exp $
- */
-
-enum SRCHOP { SDELETE, SINSERT, SEARCH};       /* Rec_search operation. */
-
-#include "../btree/btree.h"
-#include "rec_extern.h"
diff --git a/emulated/Makefile.inc b/emulated/Makefile.inc
deleted file mode 100644 (file)
index 1d8399b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.PATH: ${.CURDIR}/emulated
-
-MISRCS+=bsd_signal.c \
-       brk.c \
-       lchflags.c \
-       lchmod.c \
-       lutimes.c \
-       statvfs.c \
-       tcgetsid.c
-
-.if ${LIB} == "c"
-MAN2+= brk.2
-
-MLINKS+=brk.2 sbrk.2
-
-MAN3+= bsd_signal.3 lchflags.3 lchmod.3 lutimes.3 statvfs.3 tcgetsid.3
-
-MLINKS+=statvfs.3 fstatvfs.3
-
-.endif
index cf40a68d5933110200cfe478b1ced03a8af7d5ce..fcd5aa3c8d4c48e4aa3e80e922a3a177a746511e 100644 (file)
  * $FreeBSD: src/lib/libc/i386/_fpmath.h,v 1.3 2004/01/18 07:57:01 das Exp $
  */
 
-#if defined(__ppc__) || defined(__ppc64__)
-
-union IEEEl2bits {
-       long double     e;
-       double          d[2];
-       struct {
-               unsigned long long      sign    :1;
-               unsigned long long      exp     :11;
-               unsigned long long      manh    :52;
-               unsigned long long      sign2   :1;
-               unsigned long long      exp2    :11;
-               unsigned long long      manl    :52;
-       } bits;
-};
-
-#define        mask_nbit_l(u)  ((void)0)
-#define LDBL_IMPLICIT_NBIT
-
-#define        LDBL_MANH_SIZE  52
-#define        LDBL_MANL_SIZE  53      // includes hidden bit
-
-#define LDBL_HEAD_TAIL_PAIR
-
-__private_extern__ int _ldbl2array32dd(union IEEEl2bits, uint32_t *);
-
-#define        LDBL_TO_ARRAY32(u, a) _ldbl2array32dd(u, a)
-
-#elif defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__x86_64__)
 
 union IEEEl2bits {
        long double     e;
@@ -97,7 +70,7 @@ union IEEEl2bits {
        (a)[0] = (uint32_t)(u).bits.manl;               \
        (a)[1] = (uint32_t)(u).bits.manh;               \
 } while(0)
-#elif defined(__arm__)
+#elif defined(__arm__) 
 
 union IEEEl2bits {
     long double     e;
index b80b990f4d3dad375b6949bd1097fd5e8d2965ea..a56be2c537faebb2ac591c7ccd2b35bc6d1d8990 100644 (file)
 #define        __aligned(x)
 #define        __section(x)
 #else
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
 #define        __packed        __attribute__((__packed__))
 #define        __aligned(x)    __attribute__((__aligned__(x)))
 #define        __section(x)    __attribute__((__section__(x)))
 #endif
-#endif
-
-/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
-#if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3)
-#define        __func__        NULL
-#endif
 
-#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
+#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
 #define        __LONG_LONG_SUPPORTED
 #endif
 
  */
 #define        __offsetof(type, field) ((size_t)(&((type *)0)->field))
 
-/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
-#if __FreeBSD_cc_version >= 300001 && __FreeBSD_cc_version < 500003
-#define        __printf0like(fmtarg, firstvararg) \
-           __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
-#else
-#define        __printf0like(fmtarg, firstvararg)
-#endif
-
-#ifdef __GNUC__
 #define        __strong_reference(sym,aliassym)        \
        extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
-#ifdef __APPLE__
 #define        __weak_reference(sym,alias)
 #define        __warn_references(sym,msg)
-#else // ! __APPLE__
-#ifdef __STDC__
-#define        __weak_reference(sym,alias)     \
-       __asm__(".weak " #alias);       \
-       __asm__(".equ "  #alias ", " #sym)
-#define        __warn_references(sym,msg)      \
-       __asm__(".section .gnu.warning." #sym); \
-       __asm__(".asciz \"" msg "\"");  \
-       __asm__(".previous")
-#else
-#define        __weak_reference(sym,alias)     \
-       __asm__(".weak alias");         \
-       __asm__(".equ alias, sym")
-#define        __warn_references(sym,msg)      \
-       __asm__(".section .gnu.warning.sym"); \
-       __asm__(".asciz \"msg\"");      \
-       __asm__(".previous")
-#endif /* __STDC__ */
-#endif // __APPLE__
-#endif /* __GNUC__ */
-
-/*
- * Embed the rcs id of a source file in the resulting library.  Note that in
- * more recent ELF binutils, we use .ident allowing the ID to be stripped.
- * Usage:
- *     __FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $");
- */
-#ifndef        __FBSDID
-#if !defined(lint) && !defined(STRIP_FBSDID)
-#define        __FBSDID(s)     __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
-#else
-#define        __FBSDID(s)     struct __hack
-#endif
-#endif
-
-#ifndef        __RCSID
-#ifndef        NO__RCSID
-#define        __RCSID(s)      __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
-#else
-#define        __RCSID(s)
-#endif
-#endif
 
 #ifndef        __RCSID_SOURCE
 #ifndef        NO__RCSID_SOURCE
 #endif
 #endif
 
-#ifndef        __SCCSID
-#ifndef        NO__SCCSID
-#define        __SCCSID(s)     __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
-#else
-#define        __SCCSID(s)
-#endif
-#endif
-
-#ifndef        __COPYRIGHT
-#ifndef        NO__COPYRIGHT
-#define        __COPYRIGHT(s)  __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
-#else
-#define        __COPYRIGHT(s)
-#endif
-#endif
-
 #ifndef        __DECONST
 #define        __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
 #endif
diff --git a/fixdups.ed b/fixdups.ed
deleted file mode 100644 (file)
index 009f6d9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/<mach\/mig\.h>/;.+1,$g/<mach\/mig\.h>/d
-w
index 77e99ac3e2331d74870f1aba8e5e188e00cbbe97..10d4ab5d54b47d96b0591b9686bcf8fd166aeef4 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.3 2005/01/18 18:44:07 das Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.5 2007/05/08 02:59:37 das Exp $");
 
 #include <float.h>
 #include <limits.h>
@@ -55,7 +55,7 @@ roundup(char *s0, int ndigits)
                        *s = 1;
                        return (1);
                }
-               ++*s;
+               *s = 0;
        }
        ++*s;
        return (0);
@@ -78,7 +78,7 @@ dorounding(char *s0, int ndigits, int sign, int *decpt)
                break;
        case 1:         /* to nearest, halfway rounds to even */
                if ((s0[ndigits] > 8) ||
-                   (s0[ndigits] == 8 && s0[ndigits - 1] & 1))
+                   (s0[ndigits] == 8 && s0[ndigits + 1] & 1))
                        adjust = roundup(s0, ndigits);
                break;
        case 2:         /* toward +inf */
@@ -126,19 +126,25 @@ __hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
        static const int sigfigs = (DBL_MANT_DIG + 3) / 4;
        union IEEEd2bits u;
        char *s, *s0;
-       int bufsize;
+       int bufsize, f;
 
        u.d = d;
        *sign = u.bits.sign;
 
-       switch (fpclassify(d)) {
+       switch (f = fpclassify(d)) {
        case FP_NORMAL:
                *decpt = u.bits.exp - DBL_ADJ;
                break;
        case FP_ZERO:
+return_zero:
                *decpt = 1;
                return (nrv_alloc("0", rve, 1));
        case FP_SUBNORMAL:
+               /*
+                * For processors that treat subnormals as zero, comparison
+                * with zero will be equal, so we jump to the FP_ZERO case.
+                */
+               if(u.d == 0.0) goto return_zero;
                u.d *= 0x1p514;
                *decpt = u.bits.exp - (514 + DBL_ADJ);
                break;
@@ -149,7 +155,7 @@ __hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
                *decpt = INT_MAX;
                return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
        default:
-               abort();
+               LIBC_ABORT("fpclassify returned %d", f);
        }
 
        /* FP_NORMAL or FP_SUBNORMAL */
@@ -222,13 +228,14 @@ __hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
        static const int sigfigs = (LDBL_MANT_DIG + 3) / 4;
        union IEEEl2bits u;
        char *s, *s0;
-       int bufsize;
+       int bufsize, f;
 
        u.e = e;
        *sign = u.bits.sign;
 
-       switch (fpclassify(e)) {
+       switch (f = fpclassify(e)) {
        case FP_NORMAL:
+       case FP_SUPERNORMAL:
                *decpt = u.bits.exp - LDBL_ADJ;
                break;
        case FP_ZERO:
@@ -245,7 +252,7 @@ __hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
                *decpt = INT_MAX;
                return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
        default:
-               abort();
+               LIBC_ABORT("fpclassify returned %d", f);
        }
 
        /* FP_NORMAL or FP_SUBNORMAL */
diff --git a/gdtoa/FreeBSD/_hdtoa.c.patch b/gdtoa/FreeBSD/_hdtoa.c.patch
deleted file mode 100644 (file)
index 69173cd..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
---- _hdtoa.c.orig      2008-09-07 11:38:10.000000000 -0700
-+++ _hdtoa.c   2008-09-07 12:49:47.000000000 -0700
-@@ -55,7 +55,7 @@ roundup(char *s0, int ndigits)
-                       *s = 1;
-                       return (1);
-               }
--              ++*s;
-+              *s = 0;
-       }
-       ++*s;
-       return (0);
-@@ -126,12 +126,12 @@ __hdtoa(double d, const char *xdigs, int
-       static const int sigfigs = (DBL_MANT_DIG + 3) / 4;
-       union IEEEd2bits u;
-       char *s, *s0;
--      int bufsize;
-+      int bufsize, f;
-       u.d = d;
-       *sign = u.bits.sign;
--      switch (fpclassify(d)) {
-+      switch (f = fpclassify(d)) {
-       case FP_NORMAL:
-               *decpt = u.bits.exp - DBL_ADJ;
-               break;
-@@ -149,7 +149,7 @@ __hdtoa(double d, const char *xdigs, int
-               *decpt = INT_MAX;
-               return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
-       default:
--              abort();
-+              LIBC_ABORT("fpclassify returned %d", f);
-       }
-       /* FP_NORMAL or FP_SUBNORMAL */
-@@ -210,6 +210,7 @@ __hdtoa(double d, const char *xdigs, int
-       return (s0);
- }
-+#ifndef LDBL_COMPAT
- #if (LDBL_MANT_DIG > DBL_MANT_DIG)
- /*
-@@ -222,13 +223,18 @@ __hldtoa(long double e, const char *xdig
-       static const int sigfigs = (LDBL_MANT_DIG + 3) / 4;
-       union IEEEl2bits u;
-       char *s, *s0;
--      int bufsize;
-+      int bufsize, f;
-+#ifdef LDBL_HEAD_TAIL_PAIR
-+      uint32_t bits[4];
-+      int i, pos;
-+#endif /* LDBL_HEAD_TAIL_PAIR */
-       u.e = e;
-       *sign = u.bits.sign;
--      switch (fpclassify(e)) {
-+      switch (f = fpclassify(e)) {
-       case FP_NORMAL:
-+      case FP_SUPERNORMAL:
-               *decpt = u.bits.exp - LDBL_ADJ;
-               break;
-       case FP_ZERO:
-@@ -245,7 +251,7 @@ __hldtoa(long double e, const char *xdig
-               *decpt = INT_MAX;
-               return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
-       default:
--              abort();
-+              LIBC_ABORT("fpclassify returned %d", f);
-       }
-       /* FP_NORMAL or FP_SUBNORMAL */
-@@ -270,6 +276,19 @@ __hldtoa(long double e, const char *xdig
-        */
-       for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
-               *s = 0;
-+#ifdef LDBL_HEAD_TAIL_PAIR
-+      *decpt -= _ldbl2array32dd(u, bits);
-+      i = 0;
-+      pos = 8;
-+      for (; s > s0; s--) {
-+              *s = bits[i] & 0xf;
-+              bits[i] >>= 4;
-+              if (--pos <= 0) {
-+                      i++;
-+                      pos = 8;
-+              }
-+      }
-+#else /* LDBL_HEAD_TAIL_PAIR */
-       for (; s > s0 + sigfigs - (LDBL_MANL_SIZE / 4) - 1 && s > s0; s--) {
-               *s = u.bits.manl & 0xf;
-               u.bits.manl >>= 4;
-@@ -278,6 +297,7 @@ __hldtoa(long double e, const char *xdig
-               *s = u.bits.manh & 0xf;
-               u.bits.manh >>= 4;
-       }
-+#endif /* LDBL_HEAD_TAIL_PAIR */
-       /*
-        * At this point, we have snarfed all the bits in the
-@@ -285,7 +305,11 @@ __hldtoa(long double e, const char *xdig
-        * (partial) nibble, which is dealt with by the next
-        * statement.  We also tack on the implicit normalization bit.
-        */
-+#ifdef LDBL_HEAD_TAIL_PAIR
-+      *s = bits[i];
-+#else /* LDBL_HEAD_TAIL_PAIR */
-       *s = u.bits.manh | (1U << ((LDBL_MANT_DIG - 1) % 4));
-+#endif /* LDBL_HEAD_TAIL_PAIR */
-       /* If ndigits < 0, we are expected to auto-size the precision. */
-       if (ndigits < 0) {
-@@ -317,3 +341,4 @@ __hldtoa(long double e, const char *xdig
- }
- #endif        /* (LDBL_MANT_DIG == DBL_MANT_DIG) */
-+#endif  /* !LDBL_COMPAT */
index ededc68d217c2e8920a433d0a5bbbf7ef269fbac..903ce10ff7d76c470168596719c8c1d6230f6142 100644 (file)
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_ldtoa.c,v 1.2 2004/01/18 07:53:49 das Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_ldtoa.c,v 1.5 2007/12/09 19:48:57 das Exp $");
 
 #include <float.h>
 #include <inttypes.h>
@@ -46,11 +46,18 @@ char *
 __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
     char **rve)
 {
-       static FPI fpi = {
+#if defined(__arm__) 
+       /* On arm, double == long double, so short circuit this */
+       char * ret = __dtoa((double)*ld, mode, ndigits, decpt, sign, rve);
+       if (*decpt == 9999)
+               *decpt = INT_MAX;
+       return ret;
+#else
+       FPI fpi = {
                LDBL_MANT_DIG,                  /* nbits */
                LDBL_MIN_EXP - LDBL_MANT_DIG,   /* emin */
                LDBL_MAX_EXP - LDBL_MANT_DIG,   /* emax */
-               FPI_Round_near,                 /* rounding */
+               FLT_ROUNDS,                     /* rounding */
 #ifdef Sudden_Underflow        /* unused, but correct anyway */
                1
 #else
@@ -61,14 +68,26 @@ __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
        char *ret;
        union IEEEl2bits u;
        uint32_t bits[(LDBL_MANT_DIG + 31) / 32];
+       void *vbits = bits;
+       int type;
 
        u.e = *ld;
+       type = fpclassify(u.e);
+
+       /*
+        * gdtoa doesn't know anything about the sign of the number, so
+        * if the number is negative, we need to swap rounding modes of
+        * 2 (upwards) and 3 (downwards).
+        */
        *sign = u.bits.sign;
+       fpi.rounding ^= (fpi.rounding >> 1) & u.bits.sign;
+
        be = u.bits.exp - (LDBL_MAX_EXP - 1) - (LDBL_MANT_DIG - 1);
        LDBL_TO_ARRAY32(u, bits);
 
-       switch (fpclassify(u.e)) {
+       switch (type) {
        case FP_NORMAL:
+       case FP_SUPERNORMAL:
                kind = STRTOG_Normal;
 #ifdef LDBL_IMPLICIT_NBIT
                bits[LDBL_MANT_DIG / 32] |= 1 << ((LDBL_MANT_DIG - 1) % 32);
@@ -79,9 +98,7 @@ __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
                break;
        case FP_SUBNORMAL:
                kind = STRTOG_Denormal;
-#ifdef LDBL_IMPLICIT_NBIT
                be++;
-#endif
                break;
        case FP_INFINITE:
                kind = STRTOG_Infinite;
@@ -90,11 +107,12 @@ __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
                kind = STRTOG_NaN;
                break;
        default:
-               abort();
+               LIBC_ABORT("fpclassify returned %d", type);
        }
 
-       ret = gdtoa(&fpi, be, (ULong *)bits, &kind, mode, ndigits, decpt, rve);
+       ret = gdtoa(&fpi, be, vbits, &kind, mode, ndigits, decpt, rve);
        if (*decpt == -32768)
                *decpt = INT_MAX;
        return ret;
+#endif
 }
diff --git a/gdtoa/FreeBSD/_ldtoa.c.patch b/gdtoa/FreeBSD/_ldtoa.c.patch
deleted file mode 100644 (file)
index 3e57e86..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
---- _ldtoa.c.orig      2008-09-07 11:38:10.000000000 -0700
-+++ _ldtoa.c   2008-09-07 12:55:35.000000000 -0700
-@@ -46,7 +46,7 @@ char *
- __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
-     char **rve)
- {
--      static FPI fpi = {
-+      static FPI fpi0 = {
-               LDBL_MANT_DIG,                  /* nbits */
-               LDBL_MIN_EXP - LDBL_MANT_DIG,   /* emin */
-               LDBL_MAX_EXP - LDBL_MANT_DIG,   /* emax */
-@@ -61,28 +61,57 @@ __ldtoa(long double *ld, int mode, int n
-       char *ret;
-       union IEEEl2bits u;
-       uint32_t bits[(LDBL_MANT_DIG + 31) / 32];
-+      FPI *fpi = &fpi0, fpi1;
-+#ifdef Honor_FLT_ROUNDS
-+      int rounding = Flt_Rounds;
-+#endif
-+      int type;
-       u.e = *ld;
-+#if defined(__ppc__) || defined(__ppc64__)
-+      /*
-+       * Subnormal head-tail doubles don't seem to be converted correctly
-+       * by gdtoa.  So we multiply by 10^32 to make them normal then
-+       * subtract 32 from the exponent later.
-+       */
-+      if ((type = __fpclassify(u.e)) == FP_NORMAL && __fpclassifyd(u.d[1]) == FP_SUBNORMAL)
-+              type = FP_SUBNORMAL;
-+      if (type == FP_SUBNORMAL)
-+              u.e *= 1.0e32L;
-+#else /* !defined(__ppc__) && !defined(__ppc64__) */
-+      type = fpclassify(u.e);
-+#endif /* defined(__ppc__) || defined(__ppc64__) */
-       *sign = u.bits.sign;
-       be = u.bits.exp - (LDBL_MAX_EXP - 1) - (LDBL_MANT_DIG - 1);
-+#if defined(__ppc__) || defined(__ppc64__)
-+      be -= LDBL_TO_ARRAY32(u, bits);
-+#else /* !defined(__ppc__) && !defined(__ppc64__) */
-       LDBL_TO_ARRAY32(u, bits);
-+#endif /* defined(__ppc__) || defined(__ppc64__) */
--      switch (fpclassify(u.e)) {
-+      switch (type) {
-+#if defined(__ppc__) || defined(__ppc64__)
-+      case FP_SUBNORMAL:
-+#endif /* defined(__ppc__) || defined(__ppc64__) */
-       case FP_NORMAL:
-+      case FP_SUPERNORMAL:
-               kind = STRTOG_Normal;
-+/* For ppc/ppc64 and head-tail long double, the implicit bit is already there */
-+#if !defined(__ppc__) && !defined(__ppc64__)
- #ifdef        LDBL_IMPLICIT_NBIT
-               bits[LDBL_MANT_DIG / 32] |= 1 << ((LDBL_MANT_DIG - 1) % 32);
- #endif /* LDBL_IMPLICIT_NBIT */
-+#endif /* !defined(__ppc__) && !defined(__ppc64__) */
-               break;
-       case FP_ZERO:
-               kind = STRTOG_Zero;
-               break;
-+#if !defined(__ppc__) && !defined(__ppc64__)
-       case FP_SUBNORMAL:
-               kind = STRTOG_Denormal;
--#ifdef        LDBL_IMPLICIT_NBIT
-               be++;
--#endif
-               break;
-+#endif /* !defined(__ppc__) && !defined(__ppc64__) */
-       case FP_INFINITE:
-               kind = STRTOG_Infinite;
-               break;
-@@ -90,11 +119,22 @@ __ldtoa(long double *ld, int mode, int n
-               kind = STRTOG_NaN;
-               break;
-       default:
--              abort();
-+              LIBC_ABORT("fpclassify returned %d", type);
-       }
--      ret = gdtoa(&fpi, be, (ULong *)bits, &kind, mode, ndigits, decpt, rve);
-+#ifdef Honor_FLT_ROUNDS
-+      if (rounding != fpi0.rounding) {
-+              fpi1 = fpi0; /* for thread safety */
-+              fpi1.rounding = rounding;
-+              fpi = &fpi1;
-+              }
-+#endif /* Honor_FLT_ROUNDS */
-+      ret = gdtoa(fpi, be, (ULong *)bits, &kind, mode, ndigits, decpt, rve);
-       if (*decpt == -32768)
-               *decpt = INT_MAX;
-+#if defined(__ppc__) || defined(__ppc64__)
-+      else if (type == FP_SUBNORMAL)
-+              *decpt -= 32;
-+#endif /* defined(__ppc__) || defined(__ppc64__) */
-       return ret;
- }
index a9982c9d33a76095a8281498749ba20072f5fab2..855726a531c17afa34a8b87ff5951a15658a5fcb 100644 (file)
@@ -29,34 +29,40 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
+#include <sys/types.h>
+
 #ifdef USE_LOCALE
 #include "locale.h"
 #endif
 
  int
 #ifdef KR_headers
-gethex(sp, fpi, exp, bp, sign)
-       CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign;
+gethex(sp, fpi, exp, bp, sign, loc)
+       CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign; locale_t loc;
 #else
-gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
+gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign, locale_t loc)
 #endif
 {
        Bigint *b;
        CONST unsigned char *decpt, *s0, *s, *s1;
+       unsigned char *strunc;
        int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret;
        ULong L, lostbits, *x;
        Long e, e1;
 #ifdef USE_LOCALE
        int i;
+       NORMALIZE_LOCALE(loc);
 #ifdef NO_LOCALE_CACHE
-       const unsigned char *decimalpoint = (unsigned char*)localeconv()->decimal_point;
+       const unsigned char *decimalpoint = (unsigned char*)localeconv_l(loc)->decimal_point;
 #else
        const unsigned char *decimalpoint;
        static unsigned char *decimalpoint_cache;
        if (!(s0 = decimalpoint_cache)) {
-               s0 = (unsigned char*)localeconv()->decimal_point;
+               s0 = (unsigned char*)localeconv_l(loc)->decimal_point;
                if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
                        strcpy(decimalpoint_cache, s0);
                        s0 = decimalpoint_cache;
@@ -198,6 +204,57 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
                *exp = fpi->emin;
                return STRTOG_Normal | STRTOG_Inexlo;
                }
+       /*
+        * Truncate the hex string if it is longer than the precision needed,
+        * to avoid denial-of-service issues with very large strings.  Use
+        * additional digits to insure precision.  Scan to-be-truncated digits
+        * and replace with either '1' or '0' to ensure proper rounding.
+        */
+       {
+               int maxdigits = ((fpi->nbits + 3) >> 2) + 2;
+               size_t nd = s1 - s0;
+#ifdef USE_LOCALE
+               int dplen = strlen((const char *)decimalpoint);
+#else
+               int dplen = 1;
+#endif
+
+               if (decpt && s0 < decpt)
+                       nd -= dplen;
+               if (nd > maxdigits && (strunc = alloca(maxdigits + dplen + 2)) != NULL) {
+                       ssize_t nd0 = decpt ? decpt - s0 - dplen : nd;
+                       unsigned char *tp = strunc + maxdigits;
+                       int found = 0;
+                       if ((nd0 -= maxdigits) >= 0 || s0 >= decpt)
+                               memcpy(strunc, s0, maxdigits);
+                       else {
+                               memcpy(strunc, s0, maxdigits + dplen);
+                               tp += dplen;
+                               }
+                       s0 += maxdigits;
+                       e += (nd - (maxdigits + 1)) << 2;
+                       if (nd0 > 0) {
+                               while(nd0-- > 0)
+                                       if (*s0++ != '0') {
+                                               found++;
+                                               break;
+                                               }
+                               s0 += dplen;
+                               }
+                       if (!found && decpt) {
+                               while(s0 < s1)
+                                       if(*s0++ != '0') {
+                                               found++;
+                                               break;
+                                               }
+                               }
+                       *tp++ = found ? '1' : '0';
+                       *tp = 0;
+                       s0 = strunc;
+                       s1 = tp;
+                       }
+               }
+
        n = s1 - s0 - 1;
        for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1)
                k++;
diff --git a/gdtoa/FreeBSD/gdtoa-gethex.c.patch b/gdtoa/FreeBSD/gdtoa-gethex.c.patch
deleted file mode 100644 (file)
index 655851b..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
---- gdtoa-gethex.c.orig        2010-02-24 20:50:10.000000000 -0800
-+++ gdtoa-gethex.c     2010-02-24 21:26:32.000000000 -0800
-@@ -29,34 +29,40 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
-+#include <sys/types.h>
-+
- #ifdef USE_LOCALE
- #include "locale.h"
- #endif
-  int
- #ifdef KR_headers
--gethex(sp, fpi, exp, bp, sign)
--      CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign;
-+gethex(sp, fpi, exp, bp, sign, loc)
-+      CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign; locale_t loc;
- #else
--gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
-+gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign, locale_t loc)
- #endif
- {
-       Bigint *b;
-       CONST unsigned char *decpt, *s0, *s, *s1;
-+      unsigned char *strunc;
-       int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret;
-       ULong L, lostbits, *x;
-       Long e, e1;
- #ifdef USE_LOCALE
-       int i;
-+      NORMALIZE_LOCALE(loc);
- #ifdef NO_LOCALE_CACHE
--      const unsigned char *decimalpoint = (unsigned char*)localeconv()->decimal_point;
-+      const unsigned char *decimalpoint = (unsigned char*)localeconv_l(loc)->decimal_point;
- #else
-       const unsigned char *decimalpoint;
-       static unsigned char *decimalpoint_cache;
-       if (!(s0 = decimalpoint_cache)) {
--              s0 = (unsigned char*)localeconv()->decimal_point;
-+              s0 = (unsigned char*)localeconv_l(loc)->decimal_point;
-               if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-                       strcpy(decimalpoint_cache, s0);
-                       s0 = decimalpoint_cache;
-@@ -198,6 +204,57 @@ gethex( CONST char **sp, FPI *fpi, Long 
-               *exp = fpi->emin;
-               return STRTOG_Normal | STRTOG_Inexlo;
-               }
-+      /*
-+       * Truncate the hex string if it is longer than the precision needed,
-+       * to avoid denial-of-service issues with very large strings.  Use
-+       * additional digits to insure precision.  Scan to-be-truncated digits
-+       * and replace with either '1' or '0' to ensure proper rounding.
-+       */
-+      {
-+              int maxdigits = ((fpi->nbits + 3) >> 2) + 2;
-+              size_t nd = s1 - s0;
-+#ifdef USE_LOCALE
-+              int dplen = strlen((const char *)decimalpoint);
-+#else
-+              int dplen = 1;
-+#endif
-+
-+              if (decpt && s0 < decpt)
-+                      nd -= dplen;
-+              if (nd > maxdigits && (strunc = alloca(maxdigits + dplen + 2)) != NULL) {
-+                      ssize_t nd0 = decpt ? decpt - s0 - dplen : nd;
-+                      unsigned char *tp = strunc + maxdigits;
-+                      int found = 0;
-+                      if ((nd0 -= maxdigits) >= 0 || s0 >= decpt)
-+                              memcpy(strunc, s0, maxdigits);
-+                      else {
-+                              memcpy(strunc, s0, maxdigits + dplen);
-+                              tp += dplen;
-+                              }
-+                      s0 += maxdigits;
-+                      e += (nd - (maxdigits + 1)) << 2;
-+                      if (nd0 > 0) {
-+                              while(nd0-- > 0)
-+                                      if (*s0++ != '0') {
-+                                              found++;
-+                                              break;
-+                                              }
-+                              s0 += dplen;
-+                              }
-+                      if (!found && decpt) {
-+                              while(s0 < s1)
-+                                      if(*s0++ != '0') {
-+                                              found++;
-+                                              break;
-+                                              }
-+                              }
-+                      *tp++ = found ? '1' : '0';
-+                      *tp = 0;
-+                      s0 = strunc;
-+                      s1 = tp;
-+                      }
-+              }
-+
-       n = s1 - s0 - 1;
-       for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1)
-               k++;
index a443721f52dd17319893bb83af20d654a3ee2d76..bc1b4bd9cf70845769878712c7087537d229db3b 100644 (file)
@@ -30,7 +30,9 @@ THIS SOFTWARE.
  * with " at " changed at "@" and " dot " changed to ".").     */
 
 #include "gdtoaimp.h"
+#include <fpmath.h>
 
+#ifndef __APPLE__
  static void
 #ifdef KR_headers
 L_shift(x, x1, i) ULong *x; ULong *x1; int i;
@@ -48,6 +50,7 @@ L_shift(ULong *x, ULong *x1, int i)
                x[1] >>= i;
                } while(++x < x1);
        }
+#endif /* !__APPLE__ */
 
  int
 #ifdef KR_headers
@@ -57,10 +60,21 @@ hexnan(sp, fpi, x0)
 hexnan( CONST char **sp, FPI *fpi, ULong *x0)
 #endif
 {
+#ifdef __APPLE__
+       int nbits, len;
+       char *cp;
+#else /* !__APPLE__ */
        ULong c, h, *x, *x1, *xe;
+#endif /* __APPLE__ */
        CONST char *s;
+#ifndef __APPLE__
        int havedig, hd0, i, nbits;
+#endif /* !__APPLE__ */
 
+#ifdef __APPLE__
+       if (sp == NULL || *sp == NULL || **sp != '(')
+               return STRTOG_NaN;
+#else /* !__APPLE__ */
        if (!hexdig['0'])
                hexdig_init_D2A();
        nbits = fpi->nbits;
@@ -70,7 +84,17 @@ hexnan( CONST char **sp, FPI *fpi, ULong *x0)
        *--x = 0;
        x1 = xe = x;
        havedig = hd0 = i = 0;
+#endif /* __APPLE__ */
        s = *sp;
+#ifdef __APPLE__
+       if ((cp = strchr(s + 1, ')')) == NULL) {
+               return STRTOG_NaN;
+               }
+       else {
+               len = cp - (s + 1);
+               cp = alloca(len + 1);
+               if (!cp)
+#else /* !__APPLE__ */
        /* allow optional initial 0x or 0X */
        while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
                ++s;
@@ -111,7 +135,12 @@ hexnan( CONST char **sp, FPI *fpi, ULong *x0)
                                        }
                                } while((c = *++s));
 #endif
+#endif /* __APPLE__ */
                        return STRTOG_NaN;
+#ifdef __APPLE__
+               strlcpy(cp, s + 1, len + 1);
+               *sp += len + 2;
+#else /* !__APPLE__ */
                        }
                havedig++;
                if (++i > 8) {
@@ -121,7 +150,17 @@ hexnan( CONST char **sp, FPI *fpi, ULong *x0)
                        *--x = 0;
                        }
                *x = (*x << 4) | (h & 0xf);
+#endif /* __APPLE__ */
                }
+#ifdef __APPLE__
+       nbits = fpi->nbits;
+       /* a hack */
+       if (nbits == 52) {      /* double */
+               union IEEEd2bits u;
+               u.d = nan(cp);
+               x0[1] = u.bits.manh;
+               x0[0] = u.bits.manl;
+#else /* !__APPLE__ */
        if (!havedig)
                return STRTOG_NaN;
        if (x < x1 && i < 8)
@@ -132,12 +171,31 @@ hexnan( CONST char **sp, FPI *fpi, ULong *x0)
                        while(x <= xe);
                do *x1++ = 0;
                        while(x1 <= xe);
+#endif /* __APPLE__ */
                }
+#ifdef __APPLE__
+       else if (nbits < 52) {  /* float */
+               union IEEEf2bits u;
+               u.f = nanf(cp);
+               x0[0] = u.bits.man;
+#else /* !__APPLE__ */
        else {
                /* truncate high-order word if necessary */
                if ( (i = nbits & (ULbits-1)) !=0)
                        *xe &= ((ULong)0xffffffff) >> (ULbits - i);
+#endif /* __APPLE__ */
                }
+#ifdef __APPLE__
+       else {                  /* long double */
+               union IEEEl2bits u;
+               u.e = nanl(cp);
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
+               x0[1] = (ULong)u.bits.manh;
+               x0[0] = (ULong)u.bits.manl;
+#else
+#error unsupported architecture
+#endif
+#else /* !__APPLE__ */
        for(x1 = xe;; --x1) {
                if (*x1 != 0)
                        break;
@@ -145,6 +203,7 @@ hexnan( CONST char **sp, FPI *fpi, ULong *x0)
                        *x1 = 1;
                        break;
                        }
+#endif /* __APPLE__ */
                }
        return STRTOG_NaNbits;
        }
diff --git a/gdtoa/FreeBSD/gdtoa-hexnan.c.patch b/gdtoa/FreeBSD/gdtoa-hexnan.c.patch
deleted file mode 100644 (file)
index ac98f17..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
---- gdtoa-hexnan.c.orig        2010-01-29 16:36:11.000000000 -0800
-+++ gdtoa-hexnan.c     2010-01-29 16:40:59.000000000 -0800
-@@ -30,7 +30,9 @@ THIS SOFTWARE.
-  * with " at " changed at "@" and " dot " changed to ".").    */
- #include "gdtoaimp.h"
-+#include <fpmath.h>
-+#ifndef __APPLE__
-  static void
- #ifdef KR_headers
- L_shift(x, x1, i) ULong *x; ULong *x1; int i;
-@@ -48,6 +50,7 @@ L_shift(ULong *x, ULong *x1, int i)
-               x[1] >>= i;
-               } while(++x < x1);
-       }
-+#endif /* !__APPLE__ */
-  int
- #ifdef KR_headers
-@@ -57,10 +60,21 @@ hexnan(sp, fpi, x0)
- hexnan( CONST char **sp, FPI *fpi, ULong *x0)
- #endif
- {
-+#ifdef __APPLE__
-+      int nbits, len;
-+      char *cp;
-+#else /* !__APPLE__ */
-       ULong c, h, *x, *x1, *xe;
-+#endif /* __APPLE__ */
-       CONST char *s;
-+#ifndef __APPLE__
-       int havedig, hd0, i, nbits;
-+#endif /* !__APPLE__ */
-+#ifdef __APPLE__
-+      if (sp == NULL || *sp == NULL || **sp != '(')
-+              return STRTOG_NaN;
-+#else /* !__APPLE__ */
-       if (!hexdig['0'])
-               hexdig_init_D2A();
-       nbits = fpi->nbits;
-@@ -70,7 +84,17 @@ hexnan( CONST char **sp, FPI *fpi, ULong
-       *--x = 0;
-       x1 = xe = x;
-       havedig = hd0 = i = 0;
-+#endif /* __APPLE__ */
-       s = *sp;
-+#ifdef __APPLE__
-+      if ((cp = strchr(s + 1, ')')) == NULL) {
-+              return STRTOG_NaN;
-+              }
-+      else {
-+              len = cp - (s + 1);
-+              cp = alloca(len + 1);
-+              if (!cp)
-+#else /* !__APPLE__ */
-       /* allow optional initial 0x or 0X */
-       while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
-               ++s;
-@@ -111,7 +135,12 @@ hexnan( CONST char **sp, FPI *fpi, ULong
-                                       }
-                               } while((c = *++s));
- #endif
-+#endif /* __APPLE__ */
-                       return STRTOG_NaN;
-+#ifdef __APPLE__
-+              strlcpy(cp, s + 1, len + 1);
-+              *sp += len + 2;
-+#else /* !__APPLE__ */
-                       }
-               havedig++;
-               if (++i > 8) {
-@@ -121,7 +150,17 @@ hexnan( CONST char **sp, FPI *fpi, ULong
-                       *--x = 0;
-                       }
-               *x = (*x << 4) | (h & 0xf);
-+#endif /* __APPLE__ */
-               }
-+#ifdef __APPLE__
-+      nbits = fpi->nbits;
-+      /* a hack */
-+      if (nbits == 52) {      /* double */
-+              union IEEEd2bits u;
-+              u.d = nan(cp);
-+              x0[1] = u.bits.manh;
-+              x0[0] = u.bits.manl;
-+#else /* !__APPLE__ */
-       if (!havedig)
-               return STRTOG_NaN;
-       if (x < x1 && i < 8)
-@@ -132,12 +171,36 @@ hexnan( CONST char **sp, FPI *fpi, ULong
-                       while(x <= xe);
-               do *x1++ = 0;
-                       while(x1 <= xe);
-+#endif /* __APPLE__ */
-               }
-+#ifdef __APPLE__
-+      else if (nbits < 52) {  /* float */
-+              union IEEEf2bits u;
-+              u.f = nanf(cp);
-+              x0[0] = u.bits.man;
-+#else /* !__APPLE__ */
-       else {
-               /* truncate high-order word if necessary */
-               if ( (i = nbits & (ULbits-1)) !=0)
-                       *xe &= ((ULong)0xffffffff) >> (ULbits - i);
-+#endif /* __APPLE__ */
-               }
-+#ifdef __APPLE__
-+      else {                  /* long double */
-+              union IEEEl2bits u;
-+              u.e = nanl(cp);
-+#if defined(__ppc__) || defined(__ppc64__)
-+              x0[3] = (ULong)(u.bits.manh >> 44);
-+              x0[2] = (ULong)(u.bits.manh >> 12);
-+              x0[1] = ((ULong)u.bits.manh & 0xfff) << 20 | (ULong)(u.bits.manl >> 32);
-+              x0[0] = (ULong)u.bits.manl;
-+#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__)
-+              x0[1] = (ULong)u.bits.manh;
-+              x0[0] = (ULong)u.bits.manl;
-+#else
-+#error unsupported architecture
-+#endif
-+#else /* !__APPLE__ */
-       for(x1 = xe;; --x1) {
-               if (*x1 != 0)
-                       break;
-@@ -145,6 +208,7 @@ hexnan( CONST char **sp, FPI *fpi, ULong
-                       *x1 = 1;
-                       break;
-                       }
-+#endif /* __APPLE__ */
-               }
-       return STRTOG_NaNbits;
-       }
index e5f7b046b2e87bdffae3adbf6c19a9b33125f4ce..84fe199193200befd2f1ac3c664c634b4c9d9fe6 100644 (file)
@@ -29,9 +29,20 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#define GDTOA_TSD
+#define Omit_Private_Memory
+
+#ifdef GDTOA_TSD
+#include <pthread.h>
+#endif /* GDTOA_TSD */
 #include "gdtoaimp.h"
 
+#ifdef GDTOA_TSD
+static pthread_key_t   gdtoa_tsd_key = (pthread_key_t)-1;
+static pthread_mutex_t gdtoa_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
+#else /* !GDTOA_TSD */
  static Bigint *freelist[Kmax+1];
+#endif /* GDTOA_TSD */
 #ifndef Omit_Private_Memory
 #ifndef PRIVATE_MEM
 #define PRIVATE_MEM 2304
@@ -40,6 +51,26 @@ THIS SOFTWARE.
 static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
 #endif
 
+#ifdef GDTOA_TSD
+static void
+gdtoa_freelist_free(void *x)
+{
+       int i;
+       Bigint *cur, *next;
+       Bigint **fl = (Bigint **)x;
+
+       if (!fl) return;
+       for(i = 0; i < Kmax+1; fl++, i++) {
+               if (!*fl) continue;
+               for(cur = *fl; cur; cur = next) {
+                       next = cur->next;
+                       free(cur);
+                       }
+               }
+       free(x);
+       }
+#endif /* GDTOA_TSD */
+
  Bigint *
 Balloc
 #ifdef KR_headers
@@ -53,8 +84,25 @@ Balloc
 #ifndef Omit_Private_Memory
        unsigned int len;
 #endif
+#ifdef GDTOA_TSD
+       Bigint **freelist;
 
+       if (gdtoa_tsd_key == (pthread_key_t)-1) {
+               pthread_mutex_lock(&gdtoa_tsd_lock);
+               if (gdtoa_tsd_key == (pthread_key_t)-1) {
+                       gdtoa_tsd_key = __LIBC_PTHREAD_KEY_GDTOA_BIGINT;
+                       pthread_key_init_np(gdtoa_tsd_key, gdtoa_freelist_free);
+                       }
+               pthread_mutex_unlock(&gdtoa_tsd_lock);
+               }
+       if ((freelist = (Bigint **)pthread_getspecific(gdtoa_tsd_key)) == NULL) {
+               freelist = (Bigint **)MALLOC((Kmax+1) * sizeof(Bigint *));
+               bzero(freelist, (Kmax+1) * sizeof(Bigint *));
+               pthread_setspecific(gdtoa_tsd_key, freelist);
+               }
+#else /* !GDTOA_TSD */
        ACQUIRE_DTOA_LOCK(0);
+#endif /* GDTOA_TSD */
        /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
        /* but this case seems very unlikely. */
        if (k <= Kmax && (rv = freelist[k]) !=0) {
@@ -77,7 +125,9 @@ Balloc
                rv->k = k;
                rv->maxwds = x;
                }
+#ifndef GDTOA_TSD
        FREE_DTOA_LOCK(0);
+#endif /* GDTOA_TSD */
        rv->sign = rv->wds = 0;
        return rv;
        }
@@ -98,10 +148,16 @@ Bfree
                        free((void*)v);
 #endif
                else {
+#ifdef GDTOA_TSD
+                       Bigint **freelist = (Bigint **)pthread_getspecific(gdtoa_tsd_key);
+#else /* !GDTOA_TSD */
                        ACQUIRE_DTOA_LOCK(0);
+#endif /* !GDTOA_TSD */
                        v->next = freelist[v->k];
                        freelist[v->k] = v;
+#ifndef GDTOA_TSD
                        FREE_DTOA_LOCK(0);
+#endif /* !GDTOA_TSD */
                        }
                }
        }
diff --git a/gdtoa/FreeBSD/gdtoa-misc.c.patch b/gdtoa/FreeBSD/gdtoa-misc.c.patch
deleted file mode 100644 (file)
index ec8c295..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
---- gdtoa-misc.c.orig  2010-01-12 10:59:42.000000000 -0800
-+++ gdtoa-misc.c       2010-01-12 12:08:17.000000000 -0800
-@@ -29,9 +29,20 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#define GDTOA_TSD
-+#define Omit_Private_Memory
-+
-+#ifdef GDTOA_TSD
-+#include <pthread.h>
-+#endif /* GDTOA_TSD */
- #include "gdtoaimp.h"
-+#ifdef GDTOA_TSD
-+static pthread_key_t  gdtoa_tsd_key = (pthread_key_t)-1;
-+static pthread_mutex_t        gdtoa_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
-+#else /* !GDTOA_TSD */
-  static Bigint *freelist[Kmax+1];
-+#endif /* GDTOA_TSD */
- #ifndef Omit_Private_Memory
- #ifndef PRIVATE_MEM
- #define PRIVATE_MEM 2304
-@@ -40,6 +51,26 @@ THIS SOFTWARE.
- static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
- #endif
-+#ifdef GDTOA_TSD
-+static void
-+gdtoa_freelist_free(void *x)
-+{
-+      int i;
-+      Bigint *cur, *next;
-+      Bigint **fl = (Bigint **)x;
-+
-+      if (!fl) return;
-+      for(i = 0; i < Kmax+1; fl++, i++) {
-+              if (!*fl) continue;
-+              for(cur = *fl; cur; cur = next) {
-+                      next = cur->next;
-+                      free(cur);
-+                      }
-+              }
-+      free(x);
-+      }
-+#endif /* GDTOA_TSD */
-+
-  Bigint *
- Balloc
- #ifdef KR_headers
-@@ -53,8 +84,25 @@ Balloc
- #ifndef Omit_Private_Memory
-       unsigned int len;
- #endif
-+#ifdef GDTOA_TSD
-+      Bigint **freelist;
-+      if (gdtoa_tsd_key == (pthread_key_t)-1) {
-+              pthread_mutex_lock(&gdtoa_tsd_lock);
-+              if (gdtoa_tsd_key == (pthread_key_t)-1) {
-+                      gdtoa_tsd_key = __LIBC_PTHREAD_KEY_GDTOA_BIGINT;
-+                      pthread_key_init_np(gdtoa_tsd_key, gdtoa_freelist_free);
-+                      }
-+              pthread_mutex_unlock(&gdtoa_tsd_lock);
-+              }
-+      if ((freelist = (Bigint **)pthread_getspecific(gdtoa_tsd_key)) == NULL) {
-+              freelist = (Bigint **)MALLOC((Kmax+1) * sizeof(Bigint *));
-+              bzero(freelist, (Kmax+1) * sizeof(Bigint *));
-+              pthread_setspecific(gdtoa_tsd_key, freelist);
-+              }
-+#else /* !GDTOA_TSD */
-       ACQUIRE_DTOA_LOCK(0);
-+#endif /* GDTOA_TSD */
-       /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
-       /* but this case seems very unlikely. */
-       if (k <= Kmax && (rv = freelist[k]) !=0) {
-@@ -77,7 +125,9 @@ Balloc
-               rv->k = k;
-               rv->maxwds = x;
-               }
-+#ifndef GDTOA_TSD
-       FREE_DTOA_LOCK(0);
-+#endif /* GDTOA_TSD */
-       rv->sign = rv->wds = 0;
-       return rv;
-       }
-@@ -98,10 +148,16 @@ Bfree
-                       free((void*)v);
- #endif
-               else {
-+#ifdef GDTOA_TSD
-+                      Bigint **freelist = (Bigint **)pthread_getspecific(gdtoa_tsd_key);
-+#else /* !GDTOA_TSD */
-                       ACQUIRE_DTOA_LOCK(0);
-+#endif /* !GDTOA_TSD */
-                       v->next = freelist[v->k];
-                       freelist[v->k] = v;
-+#ifndef GDTOA_TSD
-                       FREE_DTOA_LOCK(0);
-+#endif /* !GDTOA_TSD */
-                       }
-               }
-       }
index fdc933a1ef98d73c304bf5b16c194d7720272d6c..3186f2541eb0e9c0e4476b7a67c4c0c880bdefd5 100644 (file)
@@ -29,6 +29,8 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 #ifndef NO_FENV_H
 #include <fenv.h>
@@ -58,11 +60,11 @@ static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128,
 #endif
 
  double
-strtod
+strtod_l
 #ifdef KR_headers
-       (s00, se) CONST char *s00; char **se;
+       (s00, se, loc) CONST char *s00; char **se; locale_t loc;
 #else
-       (CONST char *s00, char **se)
+       (CONST char *s00, char **se, locale_t loc)
 #endif
 {
 #ifdef Avoid_Underflow
@@ -71,6 +73,7 @@ strtod
        int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign,
                 e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
        CONST char *s, *s0, *s1;
+       char *strunc = NULL;
        double aadj;
        Long L;
        U adj, aadj1, rv, rv0;
@@ -80,15 +83,16 @@ strtod
        int inexact, oldinexact;
 #endif
 #ifdef USE_LOCALE /*{{*/
+       NORMALIZE_LOCALE(loc);
 #ifdef NO_LOCALE_CACHE
-       char *decimalpoint = localeconv()->decimal_point;
+       char *decimalpoint = localeconv_l(loc)->decimal_point;
        int dplen = strlen(decimalpoint);
 #else
        char *decimalpoint;
        static char *decimalpoint_cache;
        static int dplen;
        if (!(s0 = decimalpoint_cache)) {
-               s0 = localeconv()->decimal_point;
+               s0 = localeconv_l(loc)->decimal_point;
                if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
                        strcpy(decimalpoint_cache, s0);
                        s0 = decimalpoint_cache;
@@ -154,7 +158,7 @@ strtod
 #else
 #define fpi1 fpi
 #endif
-                       switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
+                       switch((i = gethex(&s, &fpi1, &exp, &bb, sign, loc)) & STRTOG_Retmask) {
                          case STRTOG_NoNumber:
                                s = s00;
                                sign = 0;
@@ -310,6 +314,9 @@ strtod
                        }
                goto ret;
                }
+#define FPIEMIN (1-1023-53+1)  // fpi.emin
+#define FPINBITS 52            // fpi.nbits
+       TRUNCATE_DIGITS(s0, strunc, nd, nd0, nf, FPINBITS, FPIEMIN, dplen);
        e1 = e -= nf;
 
        /* Now we have nd0 digits, starting at s0, followed by a
@@ -346,7 +353,7 @@ strtod
 #ifdef Honor_FLT_ROUNDS
                                /* round correctly FLT_ROUNDS = 2 or 3 */
                                if (sign) {
-                                       rv = -rv;
+                                       dval(&rv) = -dval(&rv);
                                        sign = 0;
                                        }
 #endif
@@ -362,7 +369,7 @@ strtod
 #ifdef Honor_FLT_ROUNDS
                                /* round correctly FLT_ROUNDS = 2 or 3 */
                                if (sign) {
-                                       rv = -rv;
+                                       dval(&rv) = -dval(&rv);
                                        sign = 0;
                                        }
 #endif
@@ -390,7 +397,7 @@ strtod
 #ifdef Honor_FLT_ROUNDS
                        /* round correctly FLT_ROUNDS = 2 or 3 */
                        if (sign) {
-                               rv = -rv;
+                               dval(&rv) = -dval(&rv);
                                sign = 0;
                                }
 #endif
@@ -672,17 +679,17 @@ strtod
                                        else
 #endif /*Sudden_Underflow*/
 #endif /*Avoid_Underflow*/
-                                       dval(&rv) += adj*ulp(&rv);
+                                       dval(&rv) += dval(&adj)*ulp(&rv);
                                        }
                                break;
                                }
                        dval(&adj) = ratio(delta, bs);
-                       if (adj < 1.)
+                       if (dval(&adj) < 1.)
                                dval(&adj) = 1.;
-                       if (adj <= 0x7ffffffe) {
+                       if (dval(&adj) <= 0x7ffffffe) {
                                /* dval(&adj) = Rounding ? ceil(&adj) : floor(&adj); */
-                               y = adj;
-                               if (y != adj) {
+                               y = dval(&adj);
+                               if (y != dval(&adj)) {
                                        if (!((Rounding>>1) ^ dsign))
                                                y++;
                                        dval(&adj) = y;
@@ -709,10 +716,10 @@ strtod
                        if (dsign) {
                                if (word0(&rv) == Big0 && word1(&rv) == Big1)
                                        goto ovfl;
-                               dval(&rv) += adj;
+                               dval(&rv) += dval(&adj);
                                }
                        else
-                               dval(&rv) -= adj;
+                               dval(&rv) -= dval(&adj);
                        goto cont;
                        }
 #endif /*Honor_FLT_ROUNDS*/
@@ -991,7 +998,7 @@ strtod
                dval(&rv) *= dval(&rv0);
 #ifndef NO_ERRNO
                /* try to avoid the bug of testing an 8087 register value */
-#ifdef IEEE_Arith
+#if defined(IEEE_Arith) && __DARWIN_UNIX03
                if (!(word0(&rv) & Exp_mask))
 #else
                if (word0(&rv) == 0 && word1(&rv) == 0)
@@ -1016,6 +1023,22 @@ strtod
  ret:
        if (se)
                *se = (char *)s;
+       if (strunc)
+#ifdef FREE
+               FREE(strunc);
+#else
+               free(strunc);
+#endif
        return sign ? -dval(&rv) : dval(&rv);
        }
 
+ double
+strtod
+#ifdef KR_headers
+       (s00, se) CONST char *s00; char **se;
+#else
+       (CONST char *s00, char **se)
+#endif
+{
+       return strtod_l(s00, se, __current_locale());
+}
diff --git a/gdtoa/FreeBSD/gdtoa-strtod.c.patch b/gdtoa/FreeBSD/gdtoa-strtod.c.patch
deleted file mode 100644 (file)
index 9134046..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
---- gdtoa-strtod.c.orig        2010-01-29 16:43:20.000000000 -0800
-+++ gdtoa-strtod.c     2010-01-29 18:05:44.000000000 -0800
-@@ -29,6 +29,8 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
- #ifndef NO_FENV_H
- #include <fenv.h>
-@@ -58,11 +60,11 @@ static CONST double tinytens[] = { 1e-16
- #endif
-  double
--strtod
-+strtod_l
- #ifdef KR_headers
--      (s00, se) CONST char *s00; char **se;
-+      (s00, se, loc) CONST char *s00; char **se; locale_t loc;
- #else
--      (CONST char *s00, char **se)
-+      (CONST char *s00, char **se, locale_t loc)
- #endif
- {
- #ifdef Avoid_Underflow
-@@ -71,6 +73,7 @@ strtod
-       int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign,
-                e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
-       CONST char *s, *s0, *s1;
-+      char *strunc = NULL;
-       double aadj;
-       Long L;
-       U adj, aadj1, rv, rv0;
-@@ -80,15 +83,16 @@ strtod
-       int inexact, oldinexact;
- #endif
- #ifdef USE_LOCALE /*{{*/
-+      NORMALIZE_LOCALE(loc);
- #ifdef NO_LOCALE_CACHE
--      char *decimalpoint = localeconv()->decimal_point;
-+      char *decimalpoint = localeconv_l(loc)->decimal_point;
-       int dplen = strlen(decimalpoint);
- #else
-       char *decimalpoint;
-       static char *decimalpoint_cache;
-       static int dplen;
-       if (!(s0 = decimalpoint_cache)) {
--              s0 = localeconv()->decimal_point;
-+              s0 = localeconv_l(loc)->decimal_point;
-               if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-                       strcpy(decimalpoint_cache, s0);
-                       s0 = decimalpoint_cache;
-@@ -154,7 +158,7 @@ strtod
- #else
- #define fpi1 fpi
- #endif
--                      switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
-+                      switch((i = gethex(&s, &fpi1, &exp, &bb, sign, loc)) & STRTOG_Retmask) {
-                         case STRTOG_NoNumber:
-                               s = s00;
-                               sign = 0;
-@@ -310,6 +314,9 @@ strtod
-                       }
-               goto ret;
-               }
-+#define FPIEMIN (1-1023-53+1) // fpi.emin
-+#define FPINBITS 52           // fpi.nbits
-+      TRUNCATE_DIGITS(s0, strunc, nd, nd0, nf, FPINBITS, FPIEMIN, dplen);
-       e1 = e -= nf;
-       /* Now we have nd0 digits, starting at s0, followed by a
-@@ -346,7 +353,7 @@ strtod
- #ifdef Honor_FLT_ROUNDS
-                               /* round correctly FLT_ROUNDS = 2 or 3 */
-                               if (sign) {
--                                      rv = -rv;
-+                                      dval(&rv) = -dval(&rv);
-                                       sign = 0;
-                                       }
- #endif
-@@ -362,7 +369,7 @@ strtod
- #ifdef Honor_FLT_ROUNDS
-                               /* round correctly FLT_ROUNDS = 2 or 3 */
-                               if (sign) {
--                                      rv = -rv;
-+                                      dval(&rv) = -dval(&rv);
-                                       sign = 0;
-                                       }
- #endif
-@@ -390,7 +397,7 @@ strtod
- #ifdef Honor_FLT_ROUNDS
-                       /* round correctly FLT_ROUNDS = 2 or 3 */
-                       if (sign) {
--                              rv = -rv;
-+                              dval(&rv) = -dval(&rv);
-                               sign = 0;
-                               }
- #endif
-@@ -672,17 +679,17 @@ strtod
-                                       else
- #endif /*Sudden_Underflow*/
- #endif /*Avoid_Underflow*/
--                                      dval(&rv) += adj*ulp(&rv);
-+                                      dval(&rv) += dval(&adj)*ulp(&rv);
-                                       }
-                               break;
-                               }
-                       dval(&adj) = ratio(delta, bs);
--                      if (adj < 1.)
-+                      if (dval(&adj) < 1.)
-                               dval(&adj) = 1.;
--                      if (adj <= 0x7ffffffe) {
-+                      if (dval(&adj) <= 0x7ffffffe) {
-                               /* dval(&adj) = Rounding ? ceil(&adj) : floor(&adj); */
--                              y = adj;
--                              if (y != adj) {
-+                              y = dval(&adj);
-+                              if (y != dval(&adj)) {
-                                       if (!((Rounding>>1) ^ dsign))
-                                               y++;
-                                       dval(&adj) = y;
-@@ -709,10 +716,10 @@ strtod
-                       if (dsign) {
-                               if (word0(&rv) == Big0 && word1(&rv) == Big1)
-                                       goto ovfl;
--                              dval(&rv) += adj;
-+                              dval(&rv) += dval(&adj);
-                               }
-                       else
--                              dval(&rv) -= adj;
-+                              dval(&rv) -= dval(&adj);
-                       goto cont;
-                       }
- #endif /*Honor_FLT_ROUNDS*/
-@@ -991,7 +998,7 @@ strtod
-               dval(&rv) *= dval(&rv0);
- #ifndef NO_ERRNO
-               /* try to avoid the bug of testing an 8087 register value */
--#ifdef IEEE_Arith
-+#if defined(IEEE_Arith) && __DARWIN_UNIX03
-               if (!(word0(&rv) & Exp_mask))
- #else
-               if (word0(&rv) == 0 && word1(&rv) == 0)
-@@ -1016,6 +1023,22 @@ strtod
-  ret:
-       if (se)
-               *se = (char *)s;
-+      if (strunc)
-+#ifdef FREE
-+              FREE(strunc);
-+#else
-+              free(strunc);
-+#endif
-       return sign ? -dval(&rv) : dval(&rv);
-       }
-+ double
-+strtod
-+#ifdef KR_headers
-+      (s00, se) CONST char *s00; char **se;
-+#else
-+      (CONST char *s00, char **se)
-+#endif
-+{
-+      return strtod_l(s00, se, __current_locale());
-+}
index 5059869ecf5f74a83908330f2e2a329f5607946c..e1acc54bcd73f4089ad875bad13dfcb72f9bd238 100644 (file)
@@ -29,13 +29,29 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
 #ifdef USE_LOCALE
 #include "locale.h"
 #endif
 
- static CONST int
+#define fivesbits __fivesbits_D2A
+#define all_on __all_on_D2A
+#define set_ones __set_ones_D2A
+#define rvOK __rvOK_D2A
+#define mantbits __mantbits_D2A
+
+#ifdef BUILDING_VARIANT
+extern CONST int fivesbits[];
+int all_on(Bigint *b, int n);
+Bigint *set_ones(Bigint *b, int n);
+int rvOK(U *d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv);
+int mantbits(U *d);
+#else /* !BUILDING_VARIANT */
+
+ __private_extern__ CONST int
 fivesbits[] = {         0,  3,  5,  7, 10, 12, 14, 17, 19, 21,
                24, 26, 28, 31, 33, 35, 38, 40, 42, 45,
                47, 49, 52
@@ -121,7 +137,7 @@ decrement(Bigint *b)
 #endif
        }
 
static int
__private_extern__ int
 #ifdef KR_headers
 all_on(b, n) Bigint *b; int n;
 #else
@@ -168,7 +184,7 @@ set_ones(Bigint *b, int n)
        return b;
        }
 
static int
__private_extern__ int
 rvOK
 #ifdef KR_headers
  (d, fpi, exp, bits, exact, rd, irv)
@@ -289,7 +305,7 @@ rvOK
        return rv;
        }
 
static int
__private_extern__ int
 #ifdef KR_headers
 mantbits(d) U *d;
 #else
@@ -312,13 +328,15 @@ mantbits(U *d)
        return P - 32 - lo0bits(&L);
        }
 
+#endif /* BUILDING_VARIANT */
+
  int
 strtodg
 #ifdef KR_headers
-       (s00, se, fpi, exp, bits)
-       CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits;
+       (s00, se, fpi, exp, bits, loc)
+       CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
 #else
-       (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
+       (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
 #endif
 {
        int abe, abits, asub;
@@ -327,21 +345,23 @@ strtodg
        int j, k, nbits, nd, nd0, nf, nz, nz0, rd, rvbits, rve, rve1, sign;
        int sudden_underflow;
        CONST char *s, *s0, *s1;
+       char *strunc = NULL;
        double adj0, tol;
        Long L;
        U adj, rv;
        ULong *b, *be, y, z;
        Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
 #ifdef USE_LOCALE /*{{*/
+       NORMALIZE_LOCALE(loc);
 #ifdef NO_LOCALE_CACHE
-       char *decimalpoint = localeconv()->decimal_point;
+       char *decimalpoint = localeconv_l(loc)->decimal_point;
        int dplen = strlen(decimalpoint);
 #else
        char *decimalpoint;
        static char *decimalpoint_cache;
        static int dplen;
        if (!(s0 = decimalpoint_cache)) {
-               s0 = localeconv()->decimal_point;
+               s0 = localeconv_l(loc)->decimal_point;
                if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
                        strcpy(decimalpoint_cache, s0);
                        s0 = decimalpoint_cache;
@@ -388,7 +408,7 @@ strtodg
                switch(s[1]) {
                  case 'x':
                  case 'X':
-                       irv = gethex(&s, fpi, exp, &rvb, sign);
+                       irv = gethex(&s, fpi, exp, &rvb, sign, loc);
                        if (irv == STRTOG_NoNumber) {
                                s = s00;
                                sign = 0;
@@ -525,6 +545,7 @@ strtodg
                        }
                goto ret;
                }
+       TRUNCATE_DIGITS(s0, strunc, nd, nd0, nf, fpi->nbits, fpi->emin, dplen);
 
        irv = STRTOG_Normal;
        e1 = e -= nf;
@@ -693,6 +714,10 @@ strtodg
                                        rvb->x[0] = 0;
                                        *exp = emin;
                                        irv = STRTOG_Underflow | STRTOG_Inexlo;
+/* When __DARWIN_UNIX03 is set, we don't need this (errno is set later) */
+#if !defined(NO_ERRNO) && !__DARWIN_UNIX03
+                                       errno = ERANGE;
+#endif
                                        goto ret;
                                        }
                                rvb->x[0] = rvb->wds = rvbits = 1;
@@ -1038,7 +1063,7 @@ strtodg
                if (sudden_underflow) {
                        rvb->wds = 0;
                        irv = STRTOG_Underflow | STRTOG_Inexlo;
-#ifndef NO_ERRNO
+#if !defined(NO_ERRNO) && __DARWIN_UNIX03
                        errno = ERANGE;
 #endif
                        }
@@ -1047,7 +1072,7 @@ strtodg
                                (rvb->wds > 0 ? STRTOG_Denormal : STRTOG_Zero);
                        if (irv & STRTOG_Inexact) {
                                irv |= STRTOG_Underflow;
-#ifndef NO_ERRNO
+#if !defined(NO_ERRNO) && __DARWIN_UNIX03
                                errno = ERANGE;
 #endif
                                }
@@ -1061,5 +1086,11 @@ strtodg
                copybits(bits, nbits, rvb);
                Bfree(rvb);
                }
+       if (strunc)
+#ifdef FREE
+               FREE(strunc);
+#else
+               free(strunc);
+#endif
        return irv;
        }
diff --git a/gdtoa/FreeBSD/gdtoa-strtodg.c.patch b/gdtoa/FreeBSD/gdtoa-strtodg.c.patch
deleted file mode 100644 (file)
index 4c233cd..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
---- gdtoa-strtodg.c.orig       2010-01-29 16:43:20.000000000 -0800
-+++ gdtoa-strtodg.c    2010-01-29 18:13:37.000000000 -0800
-@@ -29,13 +29,29 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
- #ifdef USE_LOCALE
- #include "locale.h"
- #endif
-- static CONST int
-+#define fivesbits __fivesbits_D2A
-+#define all_on __all_on_D2A
-+#define set_ones __set_ones_D2A
-+#define rvOK __rvOK_D2A
-+#define mantbits __mantbits_D2A
-+
-+#ifdef BUILDING_VARIANT
-+extern CONST int fivesbits[];
-+int all_on(Bigint *b, int n);
-+Bigint *set_ones(Bigint *b, int n);
-+int rvOK(U *d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv);
-+int mantbits(U *d);
-+#else /* !BUILDING_VARIANT */
-+
-+ __private_extern__ CONST int
- fivesbits[] = {        0,  3,  5,  7, 10, 12, 14, 17, 19, 21,
-               24, 26, 28, 31, 33, 35, 38, 40, 42, 45,
-               47, 49, 52
-@@ -121,7 +137,7 @@ decrement(Bigint *b)
- #endif
-       }
-- static int
-+ __private_extern__ int
- #ifdef KR_headers
- all_on(b, n) Bigint *b; int n;
- #else
-@@ -168,7 +184,7 @@ set_ones(Bigint *b, int n)
-       return b;
-       }
-- static int
-+ __private_extern__ int
- rvOK
- #ifdef KR_headers
-  (d, fpi, exp, bits, exact, rd, irv)
-@@ -289,7 +305,7 @@ rvOK
-       return rv;
-       }
-- static int
-+ __private_extern__ int
- #ifdef KR_headers
- mantbits(d) U *d;
- #else
-@@ -312,13 +328,15 @@ mantbits(U *d)
-       return P - 32 - lo0bits(&L);
-       }
-+#endif /* BUILDING_VARIANT */
-+
-  int
- strtodg
- #ifdef KR_headers
--      (s00, se, fpi, exp, bits)
--      CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits;
-+      (s00, se, fpi, exp, bits, loc)
-+      CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
- #else
--      (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
-+      (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
- #endif
- {
-       int abe, abits, asub;
-@@ -327,21 +345,23 @@ strtodg
-       int j, k, nbits, nd, nd0, nf, nz, nz0, rd, rvbits, rve, rve1, sign;
-       int sudden_underflow;
-       CONST char *s, *s0, *s1;
-+      char *strunc = NULL;
-       double adj0, tol;
-       Long L;
-       U adj, rv;
-       ULong *b, *be, y, z;
-       Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
- #ifdef USE_LOCALE /*{{*/
-+      NORMALIZE_LOCALE(loc);
- #ifdef NO_LOCALE_CACHE
--      char *decimalpoint = localeconv()->decimal_point;
-+      char *decimalpoint = localeconv_l(loc)->decimal_point;
-       int dplen = strlen(decimalpoint);
- #else
-       char *decimalpoint;
-       static char *decimalpoint_cache;
-       static int dplen;
-       if (!(s0 = decimalpoint_cache)) {
--              s0 = localeconv()->decimal_point;
-+              s0 = localeconv_l(loc)->decimal_point;
-               if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-                       strcpy(decimalpoint_cache, s0);
-                       s0 = decimalpoint_cache;
-@@ -388,7 +408,7 @@ strtodg
-               switch(s[1]) {
-                 case 'x':
-                 case 'X':
--                      irv = gethex(&s, fpi, exp, &rvb, sign);
-+                      irv = gethex(&s, fpi, exp, &rvb, sign, loc);
-                       if (irv == STRTOG_NoNumber) {
-                               s = s00;
-                               sign = 0;
-@@ -525,6 +545,7 @@ strtodg
-                       }
-               goto ret;
-               }
-+      TRUNCATE_DIGITS(s0, strunc, nd, nd0, nf, fpi->nbits, fpi->emin, dplen);
-       irv = STRTOG_Normal;
-       e1 = e -= nf;
-@@ -693,6 +714,10 @@ strtodg
-                                       rvb->x[0] = 0;
-                                       *exp = emin;
-                                       irv = STRTOG_Underflow | STRTOG_Inexlo;
-+/* When __DARWIN_UNIX03 is set, we don't need this (errno is set later) */
-+#if !defined(NO_ERRNO) && !__DARWIN_UNIX03
-+                                      errno = ERANGE;
-+#endif
-                                       goto ret;
-                                       }
-                               rvb->x[0] = rvb->wds = rvbits = 1;
-@@ -1038,7 +1063,7 @@ strtodg
-               if (sudden_underflow) {
-                       rvb->wds = 0;
-                       irv = STRTOG_Underflow | STRTOG_Inexlo;
--#ifndef NO_ERRNO
-+#if !defined(NO_ERRNO) && __DARWIN_UNIX03
-                       errno = ERANGE;
- #endif
-                       }
-@@ -1047,7 +1072,7 @@ strtodg
-                               (rvb->wds > 0 ? STRTOG_Denormal : STRTOG_Zero);
-                       if (irv & STRTOG_Inexact) {
-                               irv |= STRTOG_Underflow;
--#ifndef NO_ERRNO
-+#if !defined(NO_ERRNO) && __DARWIN_UNIX03
-                               errno = ERANGE;
- #endif
-                               }
-@@ -1061,5 +1086,11 @@ strtodg
-               copybits(bits, nbits, rvb);
-               Bfree(rvb);
-               }
-+      if (strunc)
-+#ifdef FREE
-+              FREE(strunc);
-+#else
-+              free(strunc);
-+#endif
-       return irv;
-       }
index a8beb3520a018728f5565f39c06479e3088c787d..fc29f597be0bc3b906f2cee8f80dd02161d3631a 100644 (file)
@@ -29,13 +29,15 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
  float
 #ifdef KR_headers
-strtof(s, sp) CONST char *s; char **sp;
+strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
 #else
-strtof(CONST char *s, char **sp)
+strtof_l(CONST char *s, char **sp, locale_t loc)
 #endif
 {
        static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
@@ -49,9 +51,13 @@ strtof(CONST char *s, char **sp)
 #define fpi &fpi0
 #endif
 
-       k = strtodg(s, sp, fpi, &exp, bits);
+       NORMALIZE_LOCALE(loc);
+       k = strtodg(s, sp, fpi, &exp, bits, loc);
        switch(k & STRTOG_Retmask) {
          case STRTOG_NoNumber:
+               u.L[0] = 0;
+               return u.f; // avoid setting sign
+
          case STRTOG_Zero:
                u.L[0] = 0;
                break;
@@ -76,3 +82,13 @@ strtof(CONST char *s, char **sp)
                u.L[0] |= 0x80000000L;
        return u.f;
        }
+
+ float
+#ifdef KR_headers
+strtof(s, sp) CONST char *s; char **sp;
+#else
+strtof(CONST char *s, char **sp)
+#endif
+{
+       return strtof_l(s, sp, __current_locale());
+}
diff --git a/gdtoa/FreeBSD/gdtoa-strtof.c.patch b/gdtoa/FreeBSD/gdtoa-strtof.c.patch
deleted file mode 100644 (file)
index 6e31620..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
---- gdtoa-strtof.c.orig        2008-10-28 12:35:19.000000000 -0700
-+++ gdtoa-strtof.c     2008-10-28 13:19:34.000000000 -0700
-@@ -29,13 +29,15 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
-  float
- #ifdef KR_headers
--strtof(s, sp) CONST char *s; char **sp;
-+strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
- #else
--strtof(CONST char *s, char **sp)
-+strtof_l(CONST char *s, char **sp, locale_t loc)
- #endif
- {
-       static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
-@@ -49,9 +51,13 @@ strtof(CONST char *s, char **sp)
- #define fpi &fpi0
- #endif
--      k = strtodg(s, sp, fpi, &exp, bits);
-+      NORMALIZE_LOCALE(loc);
-+      k = strtodg(s, sp, fpi, &exp, bits, loc);
-       switch(k & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-+              u.L[0] = 0;
-+              return u.f; // avoid setting sign
-+
-         case STRTOG_Zero:
-               u.L[0] = 0;
-               break;
-@@ -76,3 +82,13 @@ strtof(CONST char *s, char **sp)
-               u.L[0] |= 0x80000000L;
-       return u.f;
-       }
-+
-+ float
-+#ifdef KR_headers
-+strtof(s, sp) CONST char *s; char **sp;
-+#else
-+strtof(CONST char *s, char **sp)
-+#endif
-+{
-+      return strtof_l(s, sp, __current_locale());
-+}
index 738372d8829f91db3022adb0c40bb90aaf7d7933..2695746465e9375dfd145dd37d66a9a69afdf843 100644 (file)
@@ -29,13 +29,25 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
+#ifdef __APPLE__
+/*
+ * IEEE specifies that the most significant (head) double is required to
+ * be equal to the long double rounded to the nearest double, so that means
+ * the tail double might be the opposite sign as the head.  We can do this
+ * adding (long double)0 to the number, which will fix it up.
+ */
+#define        fixLDBL(x)      ((x) += 0.L)
+#endif /* __APPLE__ */
+
  int
 #ifdef KR_headers
-strtopdd(s, sp, dd) CONST char *s; char **sp; double *dd;
+strtopdd(s, sp, dd, loc) CONST char *s; char **sp; double *dd; locale_t loc;
 #else
-strtopdd(CONST char *s, char **sp, double *dd)
+strtopdd(CONST char *s, char **sp, double *dd, locale_t loc)
 #endif
 {
 #ifdef Sudden_Underflow
@@ -49,6 +61,9 @@ strtopdd(CONST char *s, char **sp, double *dd)
        typedef union {
                double d[2];
                ULong L[4];
+#ifdef __APPLE__
+               long double ld;
+#endif /* __APPLE__ */
                } U;
        U *u;
 #ifdef Honor_FLT_ROUNDS
@@ -57,10 +72,13 @@ strtopdd(CONST char *s, char **sp, double *dd)
 #define fpi &fpi0
 #endif
 
-       rv = strtodg(s, sp, fpi, &exp, bits);
+       rv = strtodg(s, sp, fpi, &exp, bits, loc);
        u = (U*)dd;
        switch(rv & STRTOG_Retmask) {
          case STRTOG_NoNumber:
+               u->d[0] = u->d[1] = 0.;
+               return rv; // avoid setting sign
+
          case STRTOG_Zero:
                u->d[0] = u->d[1] = 0.;
                break;
@@ -106,6 +124,9 @@ strtopdd(CONST char *s, char **sp, double *dd)
                        }
                u->L[2+_1] = bits[0];
                u->L[2+_0] = (bits[1] & 0xfffff) | (exp << 20);
+#ifdef __APPLE__
+               fixLDBL(u->ld);
+#endif /* __APPLE__ */
                break;
 
          case STRTOG_Denormal:
@@ -129,6 +150,9 @@ strtopdd(CONST char *s, char **sp, double *dd)
                u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL;
                u->L[2+_0] = bits[1] & ((1L << j) - 1);
                u->L[2+_1] = bits[0];
+#ifdef __APPLE__
+               fixLDBL(u->ld);
+#endif /* __APPLE__ */
                break;
 
          partly_normal:
@@ -140,6 +164,9 @@ strtopdd(CONST char *s, char **sp, double *dd)
                        u->L[_1] = ((bits[2] << i) | (bits[1] >> j)) & 0xffffffffL;
                        u->L[2+_0] = bits[1] & ((1L << j) - 1);
                        u->L[2+_1] = bits[0];
+#ifdef __APPLE__
+                       fixLDBL(u->ld);
+#endif /* __APPLE__ */
                        break;
                        }
                if (i == 0) {
@@ -147,6 +174,9 @@ strtopdd(CONST char *s, char **sp, double *dd)
                        u->L[_1] = bits[1];
                        u->L[2+_0] = 0;
                        u->L[2+_1] = bits[0];
+#ifdef __APPLE__
+                       fixLDBL(u->ld);
+#endif /* __APPLE__ */
                        break;
                        }
                j = 32 - i;
@@ -155,6 +185,9 @@ strtopdd(CONST char *s, char **sp, double *dd)
                u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
                u->L[2+_0] = 0;
                u->L[2+_1] = bits[0] & ((1L << j) - 1);
+#ifdef __APPLE__
+               fixLDBL(u->ld);
+#endif /* __APPLE__ */
                break;
 
          hardly_normal:
@@ -164,20 +197,45 @@ strtopdd(CONST char *s, char **sp, double *dd)
                u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
                u->L[2+_0] = 0;
                u->L[2+_1] = bits[0] & ((1L << j) - 1);
+#ifdef __APPLE__
+               fixLDBL(u->ld);
+#endif /* __APPLE__ */
                break;
 
          case STRTOG_Infinite:
+#ifdef __APPLE__
+               u->L[_0] = 0x7ff00000;
+               u->L[_1] = u->L[2+_0] = u->L[2+_1] = 0;
+#else /* __APPLE__ */
                u->L[_0] = u->L[2+_0] = 0x7ff00000;
                u->L[_1] = u->L[2+_1] = 0;
+#endif /* __APPLE__ */
                break;
 
          case STRTOG_NaN:
+#ifdef __APPLE__
+               u->L[0] = d_QNAN0;
+               u->L[1] = d_QNAN1;
+               u->L[2] = u->L[3] = 0;
+#else /* __APPLE__ */
                u->L[0] = u->L[2] = d_QNAN0;
                u->L[1] = u->L[3] = d_QNAN1;
+#endif /* __APPLE__ */
+               break;
+#ifdef __APPLE__
+        case STRTOG_NaNbits:
+               u->L[0] = d_QNAN0 | ((bits[2] >> 20 | bits[3] << 12) & 0xfffff);
+               u->L[1] = d_QNAN1 | bits[1] >> 20 | bits[2] << 12;
+               u->L[2] = u->L[3] = 0;
+#endif /* __APPLE__ */
          }
        if (rv & STRTOG_Neg) {
                u->L[  _0] |= 0x80000000L;
+#ifdef __APPLE__
+               u->L[2+_0] ^= 0x80000000L;
+#else /* __APPLE__ */
                u->L[2+_0] |= 0x80000000L;
+#endif /* __APPLE__ */
                }
        return rv;
        }
diff --git a/gdtoa/FreeBSD/gdtoa-strtopdd.c.patch b/gdtoa/FreeBSD/gdtoa-strtopdd.c.patch
deleted file mode 100644 (file)
index 63a7ee2..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
---- gdtoa-strtopdd.c.orig      2010-01-12 10:59:42.000000000 -0800
-+++ gdtoa-strtopdd.c   2010-01-12 11:09:40.000000000 -0800
-@@ -29,13 +29,25 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
-+#ifdef __APPLE__
-+/*
-+ * IEEE specifies that the most significant (head) double is required to
-+ * be equal to the long double rounded to the nearest double, so that means
-+ * the tail double might be the opposite sign as the head.  We can do this
-+ * adding (long double)0 to the number, which will fix it up.
-+ */
-+#define       fixLDBL(x)      ((x) += 0.L)
-+#endif /* __APPLE__ */
-+
-  int
- #ifdef KR_headers
--strtopdd(s, sp, dd) CONST char *s; char **sp; double *dd;
-+strtopdd(s, sp, dd, loc) CONST char *s; char **sp; double *dd; locale_t loc;
- #else
--strtopdd(CONST char *s, char **sp, double *dd)
-+strtopdd(CONST char *s, char **sp, double *dd, locale_t loc)
- #endif
- {
- #ifdef Sudden_Underflow
-@@ -49,6 +61,9 @@ strtopdd(CONST char *s, char **sp, doubl
-       typedef union {
-               double d[2];
-               ULong L[4];
-+#ifdef __APPLE__
-+              long double ld;
-+#endif /* __APPLE__ */
-               } U;
-       U *u;
- #ifdef Honor_FLT_ROUNDS
-@@ -57,10 +72,13 @@ strtopdd(CONST char *s, char **sp, doubl
- #define fpi &fpi0
- #endif
--      rv = strtodg(s, sp, fpi, &exp, bits);
-+      rv = strtodg(s, sp, fpi, &exp, bits, loc);
-       u = (U*)dd;
-       switch(rv & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-+              u->d[0] = u->d[1] = 0.;
-+              return rv; // avoid setting sign
-+
-         case STRTOG_Zero:
-               u->d[0] = u->d[1] = 0.;
-               break;
-@@ -106,6 +124,9 @@ strtopdd(CONST char *s, char **sp, doubl
-                       }
-               u->L[2+_1] = bits[0];
-               u->L[2+_0] = (bits[1] & 0xfffff) | (exp << 20);
-+#ifdef __APPLE__
-+              fixLDBL(u->ld);
-+#endif /* __APPLE__ */
-               break;
-         case STRTOG_Denormal:
-@@ -129,6 +150,9 @@ strtopdd(CONST char *s, char **sp, doubl
-               u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL;
-               u->L[2+_0] = bits[1] & ((1L << j) - 1);
-               u->L[2+_1] = bits[0];
-+#ifdef __APPLE__
-+              fixLDBL(u->ld);
-+#endif /* __APPLE__ */
-               break;
-         partly_normal:
-@@ -140,6 +164,9 @@ strtopdd(CONST char *s, char **sp, doubl
-                       u->L[_1] = ((bits[2] << i) | (bits[1] >> j)) & 0xffffffffL;
-                       u->L[2+_0] = bits[1] & ((1L << j) - 1);
-                       u->L[2+_1] = bits[0];
-+#ifdef __APPLE__
-+                      fixLDBL(u->ld);
-+#endif /* __APPLE__ */
-                       break;
-                       }
-               if (i == 0) {
-@@ -147,6 +174,9 @@ strtopdd(CONST char *s, char **sp, doubl
-                       u->L[_1] = bits[1];
-                       u->L[2+_0] = 0;
-                       u->L[2+_1] = bits[0];
-+#ifdef __APPLE__
-+                      fixLDBL(u->ld);
-+#endif /* __APPLE__ */
-                       break;
-                       }
-               j = 32 - i;
-@@ -155,6 +185,9 @@ strtopdd(CONST char *s, char **sp, doubl
-               u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
-               u->L[2+_0] = 0;
-               u->L[2+_1] = bits[0] & ((1L << j) - 1);
-+#ifdef __APPLE__
-+              fixLDBL(u->ld);
-+#endif /* __APPLE__ */
-               break;
-         hardly_normal:
-@@ -164,20 +197,45 @@ strtopdd(CONST char *s, char **sp, doubl
-               u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
-               u->L[2+_0] = 0;
-               u->L[2+_1] = bits[0] & ((1L << j) - 1);
-+#ifdef __APPLE__
-+              fixLDBL(u->ld);
-+#endif /* __APPLE__ */
-               break;
-         case STRTOG_Infinite:
-+#ifdef __APPLE__
-+              u->L[_0] = 0x7ff00000;
-+              u->L[_1] = u->L[2+_0] = u->L[2+_1] = 0;
-+#else /* __APPLE__ */
-               u->L[_0] = u->L[2+_0] = 0x7ff00000;
-               u->L[_1] = u->L[2+_1] = 0;
-+#endif /* __APPLE__ */
-               break;
-         case STRTOG_NaN:
-+#ifdef __APPLE__
-+              u->L[0] = d_QNAN0;
-+              u->L[1] = d_QNAN1;
-+              u->L[2] = u->L[3] = 0;
-+#else /* __APPLE__ */
-               u->L[0] = u->L[2] = d_QNAN0;
-               u->L[1] = u->L[3] = d_QNAN1;
-+#endif /* __APPLE__ */
-+              break;
-+#ifdef __APPLE__
-+       case STRTOG_NaNbits:
-+              u->L[0] = d_QNAN0 | ((bits[2] >> 20 | bits[3] << 12) & 0xfffff);
-+              u->L[1] = d_QNAN1 | bits[1] >> 20 | bits[2] << 12;
-+              u->L[2] = u->L[3] = 0;
-+#endif /* __APPLE__ */
-         }
-       if (rv & STRTOG_Neg) {
-               u->L[  _0] |= 0x80000000L;
-+#ifdef __APPLE__
-+              u->L[2+_0] ^= 0x80000000L;
-+#else /* __APPLE__ */
-               u->L[2+_0] |= 0x80000000L;
-+#endif /* __APPLE__ */
-               }
-       return rv;
-       }
index f7a25ff1ac9d8948fa01e5de3dcb26e713640668..b8e8a34ec7aae45f83a5748a68d48f7e12223560 100644 (file)
@@ -29,6 +29,8 @@ THIS SOFTWARE.
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").     */
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
 #undef _0
@@ -53,9 +55,9 @@ THIS SOFTWARE.
 
  int
 #ifdef KR_headers
-strtopx(s, sp, V) CONST char *s; char **sp; void *V;
+strtopx(s, sp, V, loc) CONST char *s; char **sp; void *V; locale_t loc;
 #else
-strtopx(CONST char *s, char **sp, void *V)
+strtopx(CONST char *s, char **sp, void *V, locale_t loc)
 #endif
 {
        static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
@@ -69,9 +71,12 @@ strtopx(CONST char *s, char **sp, void *V)
 #define fpi &fpi0
 #endif
 
-       k = strtodg(s, sp, fpi, &exp, bits);
+       k = strtodg(s, sp, fpi, &exp, bits, loc);
        switch(k & STRTOG_Retmask) {
          case STRTOG_NoNumber:
+               L[0] = L[1] = L[2] = L[3] = L[4] = 0;
+               return k; // avoid setting sign
+
          case STRTOG_Zero:
                L[0] = L[1] = L[2] = L[3] = L[4] = 0;
                break;
diff --git a/gdtoa/FreeBSD/gdtoa-strtopx.c.patch b/gdtoa/FreeBSD/gdtoa-strtopx.c.patch
deleted file mode 100644 (file)
index d251fb4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---- gdtoa-strtopx.c.orig       2010-01-12 10:59:42.000000000 -0800
-+++ gdtoa-strtopx.c    2010-01-12 12:11:48.000000000 -0800
-@@ -29,6 +29,8 @@ THIS SOFTWARE.
- /* Please send bug reports to David M. Gay (dmg at acm dot org,
-  * with " at " changed at "@" and " dot " changed to ".").    */
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
- #undef _0
-@@ -53,9 +55,9 @@ THIS SOFTWARE.
-  int
- #ifdef KR_headers
--strtopx(s, sp, V) CONST char *s; char **sp; void *V;
-+strtopx(s, sp, V, loc) CONST char *s; char **sp; void *V; locale_t loc;
- #else
--strtopx(CONST char *s, char **sp, void *V)
-+strtopx(CONST char *s, char **sp, void *V, locale_t loc)
- #endif
- {
-       static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
-@@ -69,9 +71,12 @@ strtopx(CONST char *s, char **sp, void *
- #define fpi &fpi0
- #endif
--      k = strtodg(s, sp, fpi, &exp, bits);
-+      k = strtodg(s, sp, fpi, &exp, bits, loc);
-       switch(k & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-+              L[0] = L[1] = L[2] = L[3] = L[4] = 0;
-+              return k; // avoid setting sign
-+
-         case STRTOG_Zero:
-               L[0] = L[1] = L[2] = L[3] = L[4] = 0;
-               break;
index 709af4c713f5b61eb8922c707297ec79a403d5a1..2500488958a0da190c7410eca8ef4bf3f6605547 100644 (file)
@@ -67,27 +67,3 @@ ULtod(ULong *L, ULong *bits, Long exp, int k)
        if (k & STRTOG_Neg)
                L[_0] |= 0x80000000L;
        }
-
- int
-#ifdef KR_headers
-strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
-#else
-strtord(CONST char *s, char **sp, int rounding, double *d)
-#endif
-{
-       static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
-       FPI *fpi, fpi1;
-       ULong bits[2];
-       Long exp;
-       int k;
-
-       fpi = &fpi0;
-       if (rounding != FPI_Round_near) {
-               fpi1 = fpi0;
-               fpi1.rounding = rounding;
-               fpi = &fpi1;
-               }
-       k = strtodg(s, sp, fpi, &exp, bits);
-       ULtod((ULong*)d, bits, exp, k);
-       return k;
-       }
diff --git a/gdtoa/FreeBSD/gdtoa-strtord.c.patch b/gdtoa/FreeBSD/gdtoa-strtord.c.patch
deleted file mode 100644 (file)
index 6ac0191..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- gdtoa-strtord.c.orig       2005-01-20 20:12:37.000000000 -0800
-+++ gdtoa-strtord.c    2005-02-17 13:06:38.000000000 -0800
-@@ -67,27 +67,3 @@
-       if (k & STRTOG_Neg)
-               L[_0] |= 0x80000000L;
-       }
--
-- int
--#ifdef KR_headers
--strtord(s, sp, rounding, d) CONST char *s; char **sp; int rounding; double *d;
--#else
--strtord(CONST char *s, char **sp, int rounding, double *d)
--#endif
--{
--      static FPI fpi0 = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
--      FPI *fpi, fpi1;
--      ULong bits[2];
--      Long exp;
--      int k;
--
--      fpi = &fpi0;
--      if (rounding != FPI_Round_near) {
--              fpi1 = fpi0;
--              fpi1.rounding = rounding;
--              fpi = &fpi1;
--              }
--      k = strtodg(s, sp, fpi, &exp, bits);
--      ULtod((ULong*)d, bits, exp, k);
--      return k;
--      }
index e59ebf65d08672e50c60fac0c6fe7b118d973816..8bdcd4d472eba8dcf539053d1807ba2ed1bd2211 100644 (file)
@@ -110,7 +110,7 @@ extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
 extern void freedtoa ANSI((char*));
 extern float  strtof ANSI((CONST char *, char **));
 extern double strtod ANSI((CONST char *, char **));
-extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t)) __DARWIN_ALIAS(strtodg);
 
 extern char*   g_ddfmt  ANSI((char*, double*, int, size_t));
 extern char*   g_dfmt   ANSI((char*, double*, int, size_t));
@@ -134,10 +134,10 @@ extern int        strtorxL ANSI((CONST char*, char**, int, void*));
 #if 1
 extern int     strtodI  ANSI((CONST char*, char**, double*));
 extern int     strtopd  ANSI((CONST char*, char**, double*));
-extern int     strtopdd ANSI((CONST char*, char**, double*));
+extern int     strtopdd ANSI((CONST char*, char**, double*, locale_t));
 extern int     strtopf  ANSI((CONST char*, char**, float*));
 extern int     strtopQ  ANSI((CONST char*, char**, void*));
-extern int     strtopx  ANSI((CONST char*, char**, void*));
+extern int     strtopx  ANSI((CONST char*, char**, void*, locale_t));
 extern int     strtopxL ANSI((CONST char*, char**, void*));
 #else
 #define strtopd(s,se,x) strtord(s,se,1,x)
diff --git a/gdtoa/FreeBSD/gdtoa.h.patch b/gdtoa/FreeBSD/gdtoa.h.patch
deleted file mode 100644 (file)
index 5db0731..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
---- gdtoa.h.orig       2008-10-28 11:36:35.000000000 -0700
-+++ gdtoa.h    2008-10-28 12:00:08.000000000 -0700
-@@ -110,7 +110,7 @@
- extern void freedtoa ANSI((char*));
- extern float  strtof ANSI((CONST char *, char **));
- extern double strtod ANSI((CONST char *, char **));
--extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
-+extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t)) __DARWIN_ALIAS(strtodg);
- extern char*  g_ddfmt  ANSI((char*, double*, int, size_t));
- extern char*  g_dfmt   ANSI((char*, double*, int, size_t));
-@@ -134,10 +134,10 @@
- #if 1
- extern int    strtodI  ANSI((CONST char*, char**, double*));
- extern int    strtopd  ANSI((CONST char*, char**, double*));
--extern int    strtopdd ANSI((CONST char*, char**, double*));
-+extern int    strtopdd ANSI((CONST char*, char**, double*, locale_t));
- extern int    strtopf  ANSI((CONST char*, char**, float*));
- extern int    strtopQ  ANSI((CONST char*, char**, void*));
--extern int    strtopx  ANSI((CONST char*, char**, void*));
-+extern int    strtopx  ANSI((CONST char*, char**, void*, locale_t));
- extern int    strtopxL ANSI((CONST char*, char**, void*));
- #else
- #define strtopd(s,se,x) strtord(s,se,1,x)
index 2c188d66a0a4cc36ad07fa949da2fca686d8ed29..39012aa191df7d7503ae3eded5dd44f6c7c446b6 100644 (file)
@@ -172,6 +172,91 @@ THIS SOFTWARE.
 
 #ifndef GDTOAIMP_H_INCLUDED
 #define GDTOAIMP_H_INCLUDED
+/*
+ * Paranoia: Protect exported symbols, including ones in files we don't
+ * compile right now.  The standard strtof and strtod survive.
+ */
+#define        dtoa            __dtoa
+#define        gdtoa           __gdtoa
+#define        freedtoa        __freedtoa
+#define        strtodg         __strtodg
+#define        g_ddfmt         __g_ddfmt
+#define        g_dfmt          __g_dfmt
+#define        g_ffmt          __g_ffmt
+#define        g_Qfmt          __g_Qfmt
+#define        g_xfmt          __g_xfmt
+#define        g_xLfmt         __g_xLfmt
+#define        strtoId         __strtoId
+#define        strtoIdd        __strtoIdd
+#define        strtoIf         __strtoIf
+#define        strtoIQ         __strtoIQ
+#define        strtoIx         __strtoIx
+#define        strtoIxL        __strtoIxL
+#define        strtord         __strtord
+#define        strtordd        __strtordd
+#define        strtorf         __strtorf
+#define        strtorQ         __strtorQ
+#define        strtorx         __strtorx
+#define        strtorxL        __strtorxL
+#define        strtodI         __strtodI
+#define        strtopd         __strtopd
+#define        strtopdd        __strtopdd
+#define        strtopf         __strtopf
+#define        strtopQ         __strtopQ
+#define        strtopx         __strtopx
+#define        strtopxL        __strtopxL
+
+/* Protect gdtoa-internal symbols */
+#define        Balloc          __Balloc_D2A
+#define        Bfree           __Bfree_D2A
+#define        ULtoQ           __ULtoQ_D2A
+#define        ULtof           __ULtof_D2A
+#define        ULtod           __ULtod_D2A
+#define        ULtodd          __ULtodd_D2A
+#define        ULtox           __ULtox_D2A
+#define        ULtoxL          __ULtoxL_D2A
+#define        any_on          __any_on_D2A
+#define        b2d             __b2d_D2A
+#define        bigtens         __bigtens_D2A
+#define        cmp             __cmp_D2A
+#define        copybits        __copybits_D2A
+#define        d2b             __d2b_D2A
+#define        decrement       __decrement_D2A
+#define        diff            __diff_D2A
+#define        dtoa_result     __dtoa_result_D2A
+#define        g__fmt          __g__fmt_D2A
+#define        gethex          __gethex_D2A
+#define        hexdig          __hexdig_D2A
+#define        hexdig_init_D2A __hexdig_init_D2A
+#define        hexnan          __hexnan_D2A
+#define        hi0bits         __hi0bits_D2A
+#define        hi0bits_D2A     __hi0bits_D2A
+#define        i2b             __i2b_D2A
+#define        increment       __increment_D2A
+#define        lo0bits         __lo0bits_D2A
+#define        lshift          __lshift_D2A
+#define        match           __match_D2A
+#define        mult            __mult_D2A
+#define        multadd         __multadd_D2A
+#define        nrv_alloc       __nrv_alloc_D2A
+#define        pow5mult        __pow5mult_D2A
+#define        quorem          __quorem_D2A
+#define        ratio           __ratio_D2A
+#define        rshift          __rshift_D2A
+#define        rv_alloc        __rv_alloc_D2A
+#define        s2b             __s2b_D2A
+#define        set_ones        __set_ones_D2A
+#define        strcp           __strcp_D2A
+#define        strcp_D2A       __strcp_D2A
+#define        strtoIg         __strtoIg_D2A
+#define        sum             __sum_D2A
+#define        tens            __tens_D2A
+#define        tinytens        __tinytens_D2A
+#define        tinytens        __tinytens_D2A
+#define        trailz          __trailz_D2A
+#define        ulp             __ulp_D2A
+
+#include <xlocale.h>
 #include "gdtoa.h"
 #include "gd_qnan.h"
 #ifdef Honor_FLT_ROUNDS
@@ -183,8 +268,11 @@ THIS SOFTWARE.
 #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
 #endif
 
+#include "limits.h"
 #include "stdlib.h"
 #include "string.h"
+#include "libc_private.h"
+#include "spinlock.h"
 
 #ifdef KR_headers
 #define Char char
@@ -198,6 +286,10 @@ extern Char *MALLOC ANSI((size_t));
 #define MALLOC malloc
 #endif
 
+#define INFNAN_CHECK
+#define USE_LOCALE
+#define NO_LOCALE_CACHE
+
 #undef IEEE_Arith
 #undef Avoid_Underflow
 #ifdef IEEE_MC68k
@@ -446,10 +538,14 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
 #define ALL_ON 0xffff
 #endif
 
-#ifndef MULTIPLE_THREADS
-#define ACQUIRE_DTOA_LOCK(n)   /*nothing*/
-#define FREE_DTOA_LOCK(n)      /*nothing*/
-#endif
+#define MULTIPLE_THREADS
+extern spinlock_t __gdtoa_locks[2];
+#define ACQUIRE_DTOA_LOCK(n)   do {                            \
+       if (__isthreaded) _SPINLOCK(&__gdtoa_locks[n]);         \
+} while(0)
+#define FREE_DTOA_LOCK(n)      do {                            \
+       if (__isthreaded) _SPINUNLOCK(&__gdtoa_locks[n]);       \
+} while(0)
 
 #define Kmax 9
 
@@ -472,52 +568,6 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
 #define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
 #endif /* NO_STRING_H */
 
-#define Balloc Balloc_D2A
-#define Bfree Bfree_D2A
-#define ULtoQ ULtoQ_D2A
-#define ULtof ULtof_D2A
-#define ULtod ULtod_D2A
-#define ULtodd ULtodd_D2A
-#define ULtox ULtox_D2A
-#define ULtoxL ULtoxL_D2A
-#define any_on any_on_D2A
-#define b2d b2d_D2A
-#define bigtens bigtens_D2A
-#define cmp cmp_D2A
-#define copybits copybits_D2A
-#define d2b d2b_D2A
-#define decrement decrement_D2A
-#define diff diff_D2A
-#define dtoa_result dtoa_result_D2A
-#define g__fmt g__fmt_D2A
-#define gethex gethex_D2A
-#define hexdig hexdig_D2A
-#define hexnan hexnan_D2A
-#define hi0bits(x) hi0bits_D2A((ULong)(x))
-#define i2b i2b_D2A
-#define increment increment_D2A
-#define lo0bits lo0bits_D2A
-#define lshift lshift_D2A
-#define match match_D2A
-#define mult mult_D2A
-#define multadd multadd_D2A
-#define nrv_alloc nrv_alloc_D2A
-#define pow5mult pow5mult_D2A
-#define quorem quorem_D2A
-#define ratio ratio_D2A
-#define rshift rshift_D2A
-#define rv_alloc rv_alloc_D2A
-#define s2b s2b_D2A
-#define set_ones set_ones_D2A
-#define strcp strcp_D2A
-#define strtoIg strtoIg_D2A
-#define sum sum_D2A
-#define tens tens_D2A
-#define tinytens tinytens_D2A
-#define tinytens tinytens_D2A
-#define trailz trailz_D2A
-#define ulp ulp_D2A
-
  extern char *dtoa_result;
  extern CONST double bigtens[], tens[], tinytens[];
  extern unsigned char hexdig[];
@@ -540,7 +590,7 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
  extern char *dtoa ANSI((double d, int mode, int ndigits,
                        int *decpt, int *sign, char **rve));
  extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
- extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
+ extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int, locale_t));
  extern void hexdig_init_D2A(Void);
  extern int hexnan ANSI((CONST char**, FPI*, ULong*));
  extern int hi0bits_D2A ANSI((ULong));
@@ -562,6 +612,7 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
  extern char *strcp ANSI((char*, const char*));
  extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
  extern double strtod ANSI((const char *s00, char **se));
+ extern double strtod_l ANSI((const char *s00, char **se, locale_t));
  extern Bigint *sum ANSI((Bigint*, Bigint*));
  extern int trailz ANSI((Bigint*));
  extern double ulp ANSI((U*));
@@ -613,4 +664,78 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
 #define SI 0
 #endif
 
+/*
+ * For very large strings, strtod and family might exhaust memory in tight
+ * memory conditions (especially in 32-bits).  Such large strings could also
+ * tie up a CPU for minutes at a time.  Either can be considered a denial-of-
+ * service vunerability.
+ *
+ * To fix, we limit the string size to the maximum we need to calculate the
+ * rounding point correctly.  The longest string corresponding to the exact
+ * value of a floating point number occuring at 1.f...f p^-n, where n is
+ * the (absolute value of the) smallest exponent for a normalize number.
+ *
+ * To calculate this number of decimal digits, we use the formula:
+ *
+ * (n + m) - int(n * log10(2)) + 3
+ *
+ * where m is the number of bits in the f...f fraction.  This is the number
+ * of decimal digits for the least significant bit minus the number of leading
+ * zeros for the most significant bit (the '1'), plus a few to compensate for
+ * an extra digits due to the full 1.f...f value, an extra digit for the
+ * mid-way point for rounding and an extra guard digit.
+ *
+ * Using the approximation log10(2) ~ 1233 / (2^12), converting to the fpi.emin
+ * and fpi.nbits values, we get:
+ *
+ * -fpi.emin -((1233 * (-fpi.nbits - fpi.emin)) >> 12) + 3
+ *
+ * Finally, we add an extra digit, either '1' or '0', to represent whether
+ * to-be-truncated digits contain a non-zero digit, or are all zeros,
+ * respectively.
+ *
+ * The truncated string is allocated on the heap, so code using
+ * TRUNCATE_DIGITS() will need to free that space when no longer needed.
+ * Pass a char * as the second argument, initialized to NULL; if its value
+ * becomes non-NULL, memory was allocated.
+ */
+#define LOG2NUM 1233
+#define LOG2DENOMSHIFT 12
+#define TRUNCATEDIGITS(_nbits, _emin)  (-(_emin) - ((LOG2NUM * (-(_nbits) - (_emin))) >> LOG2DENOMSHIFT) + 3)
+
+#define TRUNCATE_DIGITS(_s0, _temp, _nd, _nd0, _nf, _nbits, _emin, _dplen) \
+{ \
+       int _maxdigits = TRUNCATEDIGITS((_nbits), (_emin)); \
+       if ((_nd) > _maxdigits && \
+         ((_temp) = MALLOC(_maxdigits + (_dplen) + 2)) != NULL) { \
+               char *_tp = (_temp) + _maxdigits; \
+               if ((_nd0) >= _maxdigits) { \
+                       memcpy((_temp), (_s0), _maxdigits); \
+                       if ((_nd) > (_nd0)) *_tp++ = '1'; \
+                       else { \
+                           const char *_q = (_s0) + _maxdigits; \
+                           int _n = (_nd0) - _maxdigits; \
+                           for(; _n > 0 && *_q == '0'; _n--, _q++) {} \
+                           *_tp++ = _n > 0 ? '1' : '0'; \
+                           } \
+                       (_nf) = -((_nd0) - (_maxdigits + 1)); \
+                       (_nd0) = _maxdigits + 1; \
+                       } \
+               else if ((_nd0) == 0) { \
+                       memcpy((_temp), (_s0), _maxdigits); \
+                       *_tp++ = '1'; \
+                       (_nf) -= ((_nd) - (_maxdigits + 1)); \
+                       } \
+               else { \
+                       memcpy((_temp), (_s0), _maxdigits + (_dplen)); \
+                       _tp += (_dplen); \
+                       *_tp++ = '1'; \
+                       (_nf) = (_maxdigits + 1) - (_nd0); \
+                       } \
+               *_tp = 0; \
+               (_nd) = _maxdigits + 1; \
+               (_s0) = (_temp); \
+               } \
+       }
+
 #endif /* GDTOAIMP_H_INCLUDED */
diff --git a/gdtoa/FreeBSD/gdtoaimp.h.patch b/gdtoa/FreeBSD/gdtoaimp.h.patch
deleted file mode 100644 (file)
index 3d10bf4..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
---- gdtoaimp.h.orig    2010-01-29 16:43:20.000000000 -0800
-+++ gdtoaimp.h 2010-02-01 10:58:41.000000000 -0800
-@@ -172,6 +172,91 @@
- #ifndef GDTOAIMP_H_INCLUDED
- #define GDTOAIMP_H_INCLUDED
-+/*
-+ * Paranoia: Protect exported symbols, including ones in files we don't
-+ * compile right now.  The standard strtof and strtod survive.
-+ */
-+#define       dtoa            __dtoa
-+#define       gdtoa           __gdtoa
-+#define       freedtoa        __freedtoa
-+#define       strtodg         __strtodg
-+#define       g_ddfmt         __g_ddfmt
-+#define       g_dfmt          __g_dfmt
-+#define       g_ffmt          __g_ffmt
-+#define       g_Qfmt          __g_Qfmt
-+#define       g_xfmt          __g_xfmt
-+#define       g_xLfmt         __g_xLfmt
-+#define       strtoId         __strtoId
-+#define       strtoIdd        __strtoIdd
-+#define       strtoIf         __strtoIf
-+#define       strtoIQ         __strtoIQ
-+#define       strtoIx         __strtoIx
-+#define       strtoIxL        __strtoIxL
-+#define       strtord         __strtord
-+#define       strtordd        __strtordd
-+#define       strtorf         __strtorf
-+#define       strtorQ         __strtorQ
-+#define       strtorx         __strtorx
-+#define       strtorxL        __strtorxL
-+#define       strtodI         __strtodI
-+#define       strtopd         __strtopd
-+#define       strtopdd        __strtopdd
-+#define       strtopf         __strtopf
-+#define       strtopQ         __strtopQ
-+#define       strtopx         __strtopx
-+#define       strtopxL        __strtopxL
-+
-+/* Protect gdtoa-internal symbols */
-+#define       Balloc          __Balloc_D2A
-+#define       Bfree           __Bfree_D2A
-+#define       ULtoQ           __ULtoQ_D2A
-+#define       ULtof           __ULtof_D2A
-+#define       ULtod           __ULtod_D2A
-+#define       ULtodd          __ULtodd_D2A
-+#define       ULtox           __ULtox_D2A
-+#define       ULtoxL          __ULtoxL_D2A
-+#define       any_on          __any_on_D2A
-+#define       b2d             __b2d_D2A
-+#define       bigtens         __bigtens_D2A
-+#define       cmp             __cmp_D2A
-+#define       copybits        __copybits_D2A
-+#define       d2b             __d2b_D2A
-+#define       decrement       __decrement_D2A
-+#define       diff            __diff_D2A
-+#define       dtoa_result     __dtoa_result_D2A
-+#define       g__fmt          __g__fmt_D2A
-+#define       gethex          __gethex_D2A
-+#define       hexdig          __hexdig_D2A
-+#define       hexdig_init_D2A __hexdig_init_D2A
-+#define       hexnan          __hexnan_D2A
-+#define       hi0bits         __hi0bits_D2A
-+#define       hi0bits_D2A     __hi0bits_D2A
-+#define       i2b             __i2b_D2A
-+#define       increment       __increment_D2A
-+#define       lo0bits         __lo0bits_D2A
-+#define       lshift          __lshift_D2A
-+#define       match           __match_D2A
-+#define       mult            __mult_D2A
-+#define       multadd         __multadd_D2A
-+#define       nrv_alloc       __nrv_alloc_D2A
-+#define       pow5mult        __pow5mult_D2A
-+#define       quorem          __quorem_D2A
-+#define       ratio           __ratio_D2A
-+#define       rshift          __rshift_D2A
-+#define       rv_alloc        __rv_alloc_D2A
-+#define       s2b             __s2b_D2A
-+#define       set_ones        __set_ones_D2A
-+#define       strcp           __strcp_D2A
-+#define       strcp_D2A       __strcp_D2A
-+#define       strtoIg         __strtoIg_D2A
-+#define       sum             __sum_D2A
-+#define       tens            __tens_D2A
-+#define       tinytens        __tinytens_D2A
-+#define       tinytens        __tinytens_D2A
-+#define       trailz          __trailz_D2A
-+#define       ulp             __ulp_D2A
-+
-+#include <xlocale.h>
- #include "gdtoa.h"
- #include "gd_qnan.h"
- #ifdef Honor_FLT_ROUNDS
-@@ -183,8 +268,11 @@
- #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
- #endif
-+#include "limits.h"
- #include "stdlib.h"
- #include "string.h"
-+#include "libc_private.h"
-+#include "spinlock.h"
- #ifdef KR_headers
- #define Char char
-@@ -198,6 +286,10 @@
- #define MALLOC malloc
- #endif
-+#define INFNAN_CHECK
-+#define USE_LOCALE
-+#define NO_LOCALE_CACHE
-+
- #undef IEEE_Arith
- #undef Avoid_Underflow
- #ifdef IEEE_MC68k
-@@ -446,10 +538,14 @@
- #define ALL_ON 0xffff
- #endif
--#ifndef MULTIPLE_THREADS
--#define ACQUIRE_DTOA_LOCK(n)  /*nothing*/
--#define FREE_DTOA_LOCK(n)     /*nothing*/
--#endif
-+#define MULTIPLE_THREADS
-+extern spinlock_t __gdtoa_locks[2];
-+#define ACQUIRE_DTOA_LOCK(n)  do {                            \
-+      if (__isthreaded) _SPINLOCK(&__gdtoa_locks[n]);         \
-+} while(0)
-+#define FREE_DTOA_LOCK(n)     do {                            \
-+      if (__isthreaded) _SPINUNLOCK(&__gdtoa_locks[n]);       \
-+} while(0)
- #define Kmax 9
-@@ -472,52 +568,6 @@
- #define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
- #endif /* NO_STRING_H */
--#define Balloc Balloc_D2A
--#define Bfree Bfree_D2A
--#define ULtoQ ULtoQ_D2A
--#define ULtof ULtof_D2A
--#define ULtod ULtod_D2A
--#define ULtodd ULtodd_D2A
--#define ULtox ULtox_D2A
--#define ULtoxL ULtoxL_D2A
--#define any_on any_on_D2A
--#define b2d b2d_D2A
--#define bigtens bigtens_D2A
--#define cmp cmp_D2A
--#define copybits copybits_D2A
--#define d2b d2b_D2A
--#define decrement decrement_D2A
--#define diff diff_D2A
--#define dtoa_result dtoa_result_D2A
--#define g__fmt g__fmt_D2A
--#define gethex gethex_D2A
--#define hexdig hexdig_D2A
--#define hexnan hexnan_D2A
--#define hi0bits(x) hi0bits_D2A((ULong)(x))
--#define i2b i2b_D2A
--#define increment increment_D2A
--#define lo0bits lo0bits_D2A
--#define lshift lshift_D2A
--#define match match_D2A
--#define mult mult_D2A
--#define multadd multadd_D2A
--#define nrv_alloc nrv_alloc_D2A
--#define pow5mult pow5mult_D2A
--#define quorem quorem_D2A
--#define ratio ratio_D2A
--#define rshift rshift_D2A
--#define rv_alloc rv_alloc_D2A
--#define s2b s2b_D2A
--#define set_ones set_ones_D2A
--#define strcp strcp_D2A
--#define strtoIg strtoIg_D2A
--#define sum sum_D2A
--#define tens tens_D2A
--#define tinytens tinytens_D2A
--#define tinytens tinytens_D2A
--#define trailz trailz_D2A
--#define ulp ulp_D2A
--
-  extern char *dtoa_result;
-  extern CONST double bigtens[], tens[], tinytens[];
-  extern unsigned char hexdig[];
-@@ -540,7 +590,7 @@
-  extern char *dtoa ANSI((double d, int mode, int ndigits,
-                       int *decpt, int *sign, char **rve));
-  extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
-- extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
-+ extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int, locale_t));
-  extern void hexdig_init_D2A(Void);
-  extern int hexnan ANSI((CONST char**, FPI*, ULong*));
-  extern int hi0bits_D2A ANSI((ULong));
-@@ -562,6 +612,7 @@
-  extern char *strcp ANSI((char*, const char*));
-  extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
-  extern double strtod ANSI((const char *s00, char **se));
-+ extern double strtod_l ANSI((const char *s00, char **se, locale_t));
-  extern Bigint *sum ANSI((Bigint*, Bigint*));
-  extern int trailz ANSI((Bigint*));
-  extern double ulp ANSI((U*));
-@@ -613,4 +664,78 @@
- #define SI 0
- #endif
-+/*
-+ * For very large strings, strtod and family might exhaust memory in tight
-+ * memory conditions (especially in 32-bits).  Such large strings could also
-+ * tie up a CPU for minutes at a time.  Either can be considered a denial-of-
-+ * service vunerability.
-+ *
-+ * To fix, we limit the string size to the maximum we need to calculate the
-+ * rounding point correctly.  The longest string corresponding to the exact
-+ * value of a floating point number occuring at 1.f...f p^-n, where n is
-+ * the (absolute value of the) smallest exponent for a normalize number.
-+ *
-+ * To calculate this number of decimal digits, we use the formula:
-+ *
-+ * (n + m) - int(n * log10(2)) + 3
-+ *
-+ * where m is the number of bits in the f...f fraction.  This is the number
-+ * of decimal digits for the least significant bit minus the number of leading
-+ * zeros for the most significant bit (the '1'), plus a few to compensate for
-+ * an extra digits due to the full 1.f...f value, an extra digit for the
-+ * mid-way point for rounding and an extra guard digit.
-+ *
-+ * Using the approximation log10(2) ~ 1233 / (2^12), converting to the fpi.emin
-+ * and fpi.nbits values, we get:
-+ *
-+ * -fpi.emin -((1233 * (-fpi.nbits - fpi.emin)) >> 12) + 3
-+ *
-+ * Finally, we add an extra digit, either '1' or '0', to represent whether
-+ * to-be-truncated digits contain a non-zero digit, or are all zeros,
-+ * respectively.
-+ *
-+ * The truncated string is allocated on the heap, so code using
-+ * TRUNCATE_DIGITS() will need to free that space when no longer needed.
-+ * Pass a char * as the second argument, initialized to NULL; if its value
-+ * becomes non-NULL, memory was allocated.
-+ */
-+#define LOG2NUM 1233
-+#define LOG2DENOMSHIFT 12
-+#define TRUNCATEDIGITS(_nbits, _emin) (-(_emin) - ((LOG2NUM * (-(_nbits) - (_emin))) >> LOG2DENOMSHIFT) + 3)
-+
-+#define TRUNCATE_DIGITS(_s0, _temp, _nd, _nd0, _nf, _nbits, _emin, _dplen) \
-+{ \
-+      int _maxdigits = TRUNCATEDIGITS((_nbits), (_emin)); \
-+      if ((_nd) > _maxdigits && \
-+        ((_temp) = MALLOC(_maxdigits + (_dplen) + 2)) != NULL) { \
-+              char *_tp = (_temp) + _maxdigits; \
-+              if ((_nd0) >= _maxdigits) { \
-+                      memcpy((_temp), (_s0), _maxdigits); \
-+                      if ((_nd) > (_nd0)) *_tp++ = '1'; \
-+                      else { \
-+                          const char *_q = (_s0) + _maxdigits; \
-+                          int _n = (_nd0) - _maxdigits; \
-+                          for(; _n > 0 && *_q == '0'; _n--, _q++) {} \
-+                          *_tp++ = _n > 0 ? '1' : '0'; \
-+                          } \
-+                      (_nf) = -((_nd0) - (_maxdigits + 1)); \
-+                      (_nd0) = _maxdigits + 1; \
-+                      } \
-+              else if ((_nd0) == 0) { \
-+                      memcpy((_temp), (_s0), _maxdigits); \
-+                      *_tp++ = '1'; \
-+                      (_nf) -= ((_nd) - (_maxdigits + 1)); \
-+                      } \
-+              else { \
-+                      memcpy((_temp), (_s0), _maxdigits + (_dplen)); \
-+                      _tp += (_dplen); \
-+                      *_tp++ = '1'; \
-+                      (_nf) = (_maxdigits + 1) - (_nd0); \
-+                      } \
-+              *_tp = 0; \
-+              (_nd) = _maxdigits + 1; \
-+              (_s0) = (_temp); \
-+              } \
-+      }
-+
- #endif /* GDTOAIMP_H_INCLUDED */
index 2e20e1754c640e614788ce527dff63364531f658..f674ebcb60bbc2d6e9ff8dc46d7ea52493d8ae24 100644 (file)
@@ -41,3 +41,11 @@ strtold(const char * __restrict s, char ** __restrict sp)
 
        return strtod(s, sp);
 }
+
+long double
+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
+{
+
+       return strtod_l(s, sp, loc);
+}
+
diff --git a/gdtoa/FreeBSD/machdep_ldisd.c.patch b/gdtoa/FreeBSD/machdep_ldisd.c.patch
deleted file mode 100644 (file)
index e6605cd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- machdep_ldisd.c.orig       2005-07-06 16:00:22.000000000 -0700
-+++ machdep_ldisd.c    2005-07-06 16:02:24.000000000 -0700
-@@ -41,3 +41,11 @@
-       return strtod(s, sp);
- }
-+
-+long double
-+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
-+{
-+
-+      return strtod_l(s, sp, loc);
-+}
-+
index 8da0144d0eb6a8b58a5c0202c89f664b04848d8e..a07a21ba2ca8eb5eb5beac75fcbc3d07da648acd 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <sys/cdefs.h>
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
 long double
@@ -39,6 +41,16 @@ strtold(const char * __restrict s, char ** __restrict sp)
 {
        long double result;
 
-       strtopdd(s, sp, &result);
+       strtopdd(s, sp, (double *)&result, __current_locale());
+       return result;
+}
+
+long double
+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
+{
+       long double result;
+
+       NORMALIZE_LOCALE(loc);
+       strtopdd(s, sp, (double *)&result, loc);
        return result;
 }
diff --git a/gdtoa/FreeBSD/machdep_ldisdd.c.patch b/gdtoa/FreeBSD/machdep_ldisdd.c.patch
deleted file mode 100644 (file)
index ead0850..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
---- machdep_ldisdd.c.orig      2004-09-20 17:32:38.000000000 -0700
-+++ machdep_ldisdd.c   2005-02-19 03:07:38.000000000 -0800
-@@ -32,13 +32,34 @@
- #include <sys/cdefs.h>
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
- long double
- strtold(const char * __restrict s, char ** __restrict sp)
- {
-+#ifdef LDBL_COMPAT
-+      return (long double)strtod_l(s, sp, __current_locale());
-+#else /* LDBL_COMPAT */
-+      long double result;
-+
-+      strtopdd(s, sp, (double *)&result, __current_locale());
-+      return result;
-+#endif /* LDBL_COMPAT */
-+}
-+
-+long double
-+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
-+{
-+#ifdef LDBL_COMPAT
-+      NORMALIZE_LOCALE(loc);
-+      return (long double)strtod_l(s, sp, loc);
-+#else /* LDBL_COMPAT */
-       long double result;
--      strtopdd(s, sp, &result);
-+      NORMALIZE_LOCALE(loc);
-+      strtopdd(s, sp, (double *)&result, loc);
-       return result;
-+#endif /* LDBL_COMPAT */
- }
index 0ceea1b29de9551470c152815bbe03b162f9b0b7..64b14d456ba8021ef3f2f2089b059986449c3b89 100644 (file)
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisx.c,v 1.2 2003/04/09 05:58:43 das Exp $");
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
 long double
@@ -40,6 +42,16 @@ strtold(const char * __restrict s, char ** __restrict sp)
 {
        long double result;
 
-       strtopx(s, sp, &result);
+       strtopx(s, sp, &result, __current_locale());
+       return result;
+}
+
+long double
+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
+{
+       long double result;
+
+       NORMALIZE_LOCALE(loc);
+       strtopx(s, sp, &result, loc);
        return result;
 }
diff --git a/gdtoa/FreeBSD/machdep_ldisx.c.patch b/gdtoa/FreeBSD/machdep_ldisx.c.patch
deleted file mode 100644 (file)
index d2d5eb2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
---- machdep_ldisx.c.orig       2003-05-20 15:20:48.000000000 -0700
-+++ machdep_ldisx.c    2005-02-17 02:00:41.000000000 -0800
-@@ -33,6 +33,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisx.c,v 1.2 2003/04/09 05:58:43 das Exp $");
-+#include "xlocale_private.h"
-+
- #include "gdtoaimp.h"
- long double
-@@ -40,6 +42,16 @@
- {
-       long double result;
--      strtopx(s, sp, &result);
-+      strtopx(s, sp, &result, __current_locale());
-+      return result;
-+}
-+
-+long double
-+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
-+{
-+      long double result;
-+
-+      NORMALIZE_LOCALE(loc);
-+      strtopx(s, sp, &result, loc);
-       return result;
- }
diff --git a/gdtoa/Makefile.inc b/gdtoa/Makefile.inc
deleted file mode 100644 (file)
index 9941267..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-.PATH: ${.CURDIR}/gdtoa
-CWD := ${.CURDIR}/gdtoa
-
-CFLAGS += -I${.CURDIR}/gdtoa
-
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/stdlib/gdtoa.mk"
-
-GDTOA_UNIQUE_SRCS != ${PERL} -e '@z = split(" ", "$(GDTOA_FBSDSRCS)"); $$, = "\n"; print @z' | sort -u
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= $(GDTOA_UNIQUE_SRCS) _hdtoa.c glue.c \
-    gdtoa-dmisc.c gdtoa-dtoa.c gdtoa-gdtoa.c gdtoa-gethex.c gdtoa-gmisc.c \
-    gdtoa-hd_init.c gdtoa-hexnan.c gdtoa-misc.c gdtoa-smisc.c \
-    gdtoa-strtod.c gdtoa-strtodg.c gdtoa-strtof.c gdtoa-strtord.c \
-    gdtoa-sum.c gdtoa-ulp.c
-
-.ifndef FEATURE_ONLY_LONG_DOUBLE_IS_DOUBLE
-FBSDMISRCS+= _ldtoa.c
-.endif
-
-FBSDHDRS= gdtoa.h gdtoaimp.h gdtoa_fltrnds.h
-
-.include "Makefile.fbsd_end"
-
-LEGACYSRCS += gdtoa-strtof.c gdtoa-strtod.c gdtoa-strtodg.c
diff --git a/gdtoa/_hdtoa-fbsd.c b/gdtoa/_hdtoa-fbsd.c
deleted file mode 100644 (file)
index 04a2888..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-/*-
- * Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.ORG>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.3 2005/01/18 18:44:07 das Exp $");
-
-#include <float.h>
-#include <limits.h>
-#include <math.h>
-#include "fpmath.h"
-#include "gdtoaimp.h"
-
-/* Strings values used by dtoa() */
-#define        INFSTR  "Infinity"
-#define        NANSTR  "NaN"
-
-#define        DBL_ADJ         (DBL_MAX_EXP - 2 + ((DBL_MANT_DIG - 1) % 4))
-#define        LDBL_ADJ        (LDBL_MAX_EXP - 2 + ((LDBL_MANT_DIG - 1) % 4))
-
-/*
- * Round up the given digit string.  If the digit string is fff...f,
- * this procedure sets it to 100...0 and returns 1 to indicate that
- * the exponent needs to be bumped.  Otherwise, 0 is returned.
- */
-static int
-roundup(char *s0, int ndigits)
-{
-       char *s;
-
-       for (s = s0 + ndigits - 1; *s == 0xf; s--) {
-               if (s == s0) {
-                       *s = 1;
-                       return (1);
-               }
-               *s = 0;
-       }
-       ++*s;
-       return (0);
-}
-
-/*
- * Round the given digit string to ndigits digits according to the
- * current rounding mode.  Note that this could produce a string whose
- * value is not representable in the corresponding floating-point
- * type.  The exponent pointed to by decpt is adjusted if necessary.
- */
-static void
-dorounding(char *s0, int ndigits, int sign, int *decpt)
-{
-       int adjust = 0; /* do we need to adjust the exponent? */
-
-       switch (FLT_ROUNDS) {
-       case 0:         /* toward zero */
-       default:        /* implementation-defined */
-               break;
-       case 1:         /* to nearest, halfway rounds to even */
-               if ((s0[ndigits] > 8) ||
-                   (s0[ndigits] == 8 && s0[ndigits - 1] & 1))
-                       adjust = roundup(s0, ndigits);
-               break;
-       case 2:         /* toward +inf */
-               if (sign == 0)
-                       adjust = roundup(s0, ndigits);
-               break;
-       case 3:         /* toward -inf */
-               if (sign != 0)
-                       adjust = roundup(s0, ndigits);
-               break;
-       }
-
-       if (adjust)
-               *decpt += 4;
-}
-
-/*
- * This procedure converts a double-precision number in IEEE format
- * into a string of hexadecimal digits and an exponent of 2.  Its
- * behavior is bug-for-bug compatible with dtoa() in mode 2, with the
- * following exceptions:
- *
- * - An ndigits < 0 causes it to use as many digits as necessary to
- *   represent the number exactly.
- * - The additional xdigs argument should point to either the string
- *   "0123456789ABCDEF" or the string "0123456789abcdef", depending on
- *   which case is desired.
- * - This routine does not repeat dtoa's mistake of setting decpt
- *   to 9999 in the case of an infinity or NaN.  INT_MAX is used
- *   for this purpose instead.
- *
- * Note that the C99 standard does not specify what the leading digit
- * should be for non-zero numbers.  For instance, 0x1.3p3 is the same
- * as 0x2.6p2 is the same as 0x4.cp3.  This implementation chooses the
- * first digit so that subsequent digits are aligned on nibble
- * boundaries (before rounding).
- *
- * Inputs:     d, xdigs, ndigits
- * Outputs:    decpt, sign, rve
- */
-char *
-__hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
-    char **rve)
-{
-       static const int sigfigs = (DBL_MANT_DIG + 3) / 4;
-       union IEEEd2bits u;
-       char *s, *s0;
-       int bufsize, f;
-
-       u.d = d;
-       *sign = u.bits.sign;
-
-       switch (f = fpclassify(d)) {
-       case FP_NORMAL:
-               *decpt = u.bits.exp - DBL_ADJ;
-               break;
-       case FP_ZERO:
-               *decpt = 1;
-               return (nrv_alloc("0", rve, 1));
-       case FP_SUBNORMAL:
-               u.d *= 0x1p514;
-               *decpt = u.bits.exp - (514 + DBL_ADJ);
-               break;
-       case FP_INFINITE:
-               *decpt = INT_MAX;
-               return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1));
-       case FP_NAN:
-               *decpt = INT_MAX;
-               return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
-       default:
-               LIBC_ABORT("fpclassify returned %d", f);
-       }
-
-       /* FP_NORMAL or FP_SUBNORMAL */
-
-       if (ndigits == 0)               /* dtoa() compatibility */
-               ndigits = 1;
-
-       /*
-        * For simplicity, we generate all the digits even if the
-        * caller has requested fewer.
-        */
-       bufsize = (sigfigs > ndigits) ? sigfigs : ndigits;
-       s0 = rv_alloc(bufsize);
-
-       /*
-        * We work from right to left, first adding any requested zero
-        * padding, then the least significant portion of the
-        * mantissa, followed by the most significant.  The buffer is
-        * filled with the byte values 0x0 through 0xf, which are
-        * converted to xdigs[0x0] through xdigs[0xf] after the
-        * rounding phase.
-        */
-       for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
-               *s = 0;
-       for (; s > s0 + sigfigs - (DBL_MANL_SIZE / 4) - 1 && s > s0; s--) {
-               *s = u.bits.manl & 0xf;
-               u.bits.manl >>= 4;
-       }
-       for (; s > s0; s--) {
-               *s = u.bits.manh & 0xf;
-               u.bits.manh >>= 4;
-       }
-
-       /*
-        * At this point, we have snarfed all the bits in the
-        * mantissa, with the possible exception of the highest-order
-        * (partial) nibble, which is dealt with by the next
-        * statement.  We also tack on the implicit normalization bit.
-        */
-       *s = u.bits.manh | (1U << ((DBL_MANT_DIG - 1) % 4));
-
-       /* If ndigits < 0, we are expected to auto-size the precision. */
-       if (ndigits < 0) {
-               for (ndigits = sigfigs; s0[ndigits - 1] == 0; ndigits--)
-                       ;
-       }
-
-       if (sigfigs > ndigits && s0[ndigits] != 0)
-               dorounding(s0, ndigits, u.bits.sign, decpt);
-
-       s = s0 + ndigits;
-       if (rve != NULL)
-               *rve = s;
-       *s-- = '\0';
-       for (; s >= s0; s--)
-               *s = xdigs[(unsigned int)*s];
-
-       return (s0);
-}
-
-#ifndef LDBL_COMPAT
-#if (LDBL_MANT_DIG > DBL_MANT_DIG)
-
-/*
- * This is the long double version of __hdtoa().
- */
-char *
-__hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
-    char **rve)
-{
-       static const int sigfigs = (LDBL_MANT_DIG + 3) / 4;
-       union IEEEl2bits u;
-       char *s, *s0;
-       int bufsize, f;
-#ifdef LDBL_HEAD_TAIL_PAIR
-       uint32_t bits[4];
-       int i, pos;
-#endif /* LDBL_HEAD_TAIL_PAIR */
-
-       u.e = e;
-       *sign = u.bits.sign;
-
-       switch (f = fpclassify(e)) {
-       case FP_NORMAL:
-       case FP_SUPERNORMAL:
-               *decpt = u.bits.exp - LDBL_ADJ;
-               break;
-       case FP_ZERO:
-               *decpt = 1;
-               return (nrv_alloc("0", rve, 1));
-       case FP_SUBNORMAL:
-               u.e *= 0x1p514L;
-               *decpt = u.bits.exp - (514 + LDBL_ADJ);
-               break;
-       case FP_INFINITE:
-               *decpt = INT_MAX;
-               return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1));
-       case FP_NAN:
-               *decpt = INT_MAX;
-               return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
-       default:
-               LIBC_ABORT("fpclassify returned %d", f);
-       }
-
-       /* FP_NORMAL or FP_SUBNORMAL */
-
-       if (ndigits == 0)               /* dtoa() compatibility */
-               ndigits = 1;
-
-       /*
-        * For simplicity, we generate all the digits even if the
-        * caller has requested fewer.
-        */
-       bufsize = (sigfigs > ndigits) ? sigfigs : ndigits;
-       s0 = rv_alloc(bufsize);
-
-       /*
-        * We work from right to left, first adding any requested zero
-        * padding, then the least significant portion of the
-        * mantissa, followed by the most significant.  The buffer is
-        * filled with the byte values 0x0 through 0xf, which are
-        * converted to xdigs[0x0] through xdigs[0xf] after the
-        * rounding phase.
-        */
-       for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
-               *s = 0;
-#ifdef LDBL_HEAD_TAIL_PAIR
-       *decpt -= _ldbl2array32dd(u, bits);
-       i = 0;
-       pos = 8;
-       for (; s > s0; s--) {
-               *s = bits[i] & 0xf;
-               bits[i] >>= 4;
-               if (--pos <= 0) {
-                       i++;
-                       pos = 8;
-               }
-       }
-#else /* LDBL_HEAD_TAIL_PAIR */
-       for (; s > s0 + sigfigs - (LDBL_MANL_SIZE / 4) - 1 && s > s0; s--) {
-               *s = u.bits.manl & 0xf;
-               u.bits.manl >>= 4;
-       }
-       for (; s > s0; s--) {
-               *s = u.bits.manh & 0xf;
-               u.bits.manh >>= 4;
-       }
-#endif /* LDBL_HEAD_TAIL_PAIR */
-
-       /*
-        * At this point, we have snarfed all the bits in the
-        * mantissa, with the possible exception of the highest-order
-        * (partial) nibble, which is dealt with by the next
-        * statement.  We also tack on the implicit normalization bit.
-        */
-#ifdef LDBL_HEAD_TAIL_PAIR
-       *s = bits[i];
-#else /* LDBL_HEAD_TAIL_PAIR */
-       *s = u.bits.manh | (1U << ((LDBL_MANT_DIG - 1) % 4));
-#endif /* LDBL_HEAD_TAIL_PAIR */
-
-       /* If ndigits < 0, we are expected to auto-size the precision. */
-       if (ndigits < 0) {
-               for (ndigits = sigfigs; s0[ndigits - 1] == 0; ndigits--)
-                       ;
-       }
-
-       if (sigfigs > ndigits && s0[ndigits] != 0)
-               dorounding(s0, ndigits, u.bits.sign, decpt);
-
-       s = s0 + ndigits;
-       if (rve != NULL)
-               *rve = s;
-       *s-- = '\0';
-       for (; s >= s0; s--)
-               *s = xdigs[(unsigned int)*s];
-
-       return (s0);
-}
-
-#else  /* (LDBL_MANT_DIG == DBL_MANT_DIG) */
-
-char *
-__hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
-    char **rve)
-{
-
-       return (__hdtoa((double)e, xdigs, ndigits, decpt, sign, rve));
-}
-
-#endif /* (LDBL_MANT_DIG == DBL_MANT_DIG) */
-#endif  /* !LDBL_COMPAT */
diff --git a/gdtoa/_ldtoa-fbsd.c b/gdtoa/_ldtoa-fbsd.c
deleted file mode 100644 (file)
index 72f2b7f..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_ldtoa.c,v 1.2 2004/01/18 07:53:49 das Exp $");
-
-#include <float.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <math.h>
-#include <stdlib.h>
-#include "fpmath.h"
-#include "gdtoaimp.h"
-
-/*
- * ldtoa() is a wrapper for gdtoa() that makes it smell like dtoa(),
- * except that the floating point argument is passed by reference.
- * When dtoa() is passed a NaN or infinity, it sets expt to 9999.
- * However, a long double could have a valid exponent of 9999, so we
- * use INT_MAX in ldtoa() instead.
- */
-char *
-__ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
-    char **rve)
-{
-       static FPI fpi0 = {
-               LDBL_MANT_DIG,                  /* nbits */
-               LDBL_MIN_EXP - LDBL_MANT_DIG,   /* emin */
-               LDBL_MAX_EXP - LDBL_MANT_DIG,   /* emax */
-               FPI_Round_near,                 /* rounding */
-#ifdef Sudden_Underflow        /* unused, but correct anyway */
-               1
-#else
-               0
-#endif
-       };
-       int be, kind;
-       char *ret;
-       union IEEEl2bits u;
-       uint32_t bits[(LDBL_MANT_DIG + 31) / 32];
-       FPI *fpi = &fpi0, fpi1;
-#ifdef Honor_FLT_ROUNDS
-       int rounding = Flt_Rounds;
-#endif
-       int type;
-
-       u.e = *ld;
-#if defined(__ppc__) || defined(__ppc64__)
-       /*
-        * Subnormal head-tail doubles don't seem to be converted correctly
-        * by gdtoa.  So we multiply by 10^32 to make them normal then
-        * subtract 32 from the exponent later.
-        */
-       if ((type = __fpclassify(u.e)) == FP_NORMAL && __fpclassifyd(u.d[1]) == FP_SUBNORMAL)
-               type = FP_SUBNORMAL;
-       if (type == FP_SUBNORMAL)
-               u.e *= 1.0e32L;
-#else /* !defined(__ppc__) && !defined(__ppc64__) */
-       type = fpclassify(u.e);
-#endif /* defined(__ppc__) || defined(__ppc64__) */
-       *sign = u.bits.sign;
-       be = u.bits.exp - (LDBL_MAX_EXP - 1) - (LDBL_MANT_DIG - 1);
-#if defined(__ppc__) || defined(__ppc64__)
-       be -= LDBL_TO_ARRAY32(u, bits);
-#else /* !defined(__ppc__) && !defined(__ppc64__) */
-       LDBL_TO_ARRAY32(u, bits);
-#endif /* defined(__ppc__) || defined(__ppc64__) */
-
-       switch (type) {
-#if defined(__ppc__) || defined(__ppc64__)
-       case FP_SUBNORMAL:
-#endif /* defined(__ppc__) || defined(__ppc64__) */
-       case FP_NORMAL:
-       case FP_SUPERNORMAL:
-               kind = STRTOG_Normal;
-/* For ppc/ppc64 and head-tail long double, the implicit bit is already there */
-#if !defined(__ppc__) && !defined(__ppc64__)
-#ifdef LDBL_IMPLICIT_NBIT
-               bits[LDBL_MANT_DIG / 32] |= 1 << ((LDBL_MANT_DIG - 1) % 32);
-#endif /* LDBL_IMPLICIT_NBIT */
-#endif /* !defined(__ppc__) && !defined(__ppc64__) */
-               break;
-       case FP_ZERO:
-               kind = STRTOG_Zero;
-               break;
-#if !defined(__ppc__) && !defined(__ppc64__)
-       case FP_SUBNORMAL:
-               kind = STRTOG_Denormal;
-               be++;
-               break;
-#endif /* !defined(__ppc__) && !defined(__ppc64__) */
-       case FP_INFINITE:
-               kind = STRTOG_Infinite;
-               break;
-       case FP_NAN:
-               kind = STRTOG_NaN;
-               break;
-       default:
-               LIBC_ABORT("fpclassify returned %d", type);
-       }
-
-#ifdef Honor_FLT_ROUNDS
-       if (rounding != fpi0.rounding) {
-               fpi1 = fpi0; /* for thread safety */
-               fpi1.rounding = rounding;
-               fpi = &fpi1;
-               }
-#endif /* Honor_FLT_ROUNDS */
-       ret = gdtoa(fpi, be, (ULong *)bits, &kind, mode, ndigits, decpt, rve);
-       if (*decpt == -32768)
-               *decpt = INT_MAX;
-#if defined(__ppc__) || defined(__ppc64__)
-       else if (type == FP_SUBNORMAL)
-               *decpt -= 32;
-#endif /* defined(__ppc__) || defined(__ppc64__) */
-       return ret;
-}
index 688a121fdf3247b3b32f499f80f321d4362570f3..f60614a17df9060c6ecc86550aeaa9b23bf7fbad 100644 (file)
  * and spliced together for the different architectures.
  */
 
-#if defined(__ppc__)
-#define IEEE_MC68k
-#define Arith_Kind_ASL 2
-#define Double_Align
-#elif defined(__ppc64__)
-#define IEEE_MC68k
-#define Arith_Kind_ASL 2
-#define Double_Align
-#define Long int
-#elif defined(__i386__)
+#if defined(__i386__)
 #define IEEE_8087
 #define Arith_Kind_ASL 1
 #elif defined(__x86_64__)
 #define IEEE_8087
 #define Arith_Kind_ASL 1
 #define Long int
+#define Intcast (int)(long)
+#define Double_Align
+#define X64_bit_pointers
 #elif defined(__arm__)
 #if __VFP_FP__
 #define IEEE_8087
 #else
 #define IEEE_MC68k
 #endif
+#define Arith_Kind_ASL 1
 #else
 #error Unsupported architecture
 #endif
index dd5d7876ed5becd02da0402c0869b9a7dcefcb1e..601fff63aa116837fde5646fd65fcd92d4050268 100644 (file)
@@ -13,7 +13,7 @@
 #define ldus_QNAN3 0x0
 #define ldus_QNAN4 0x0
 
-#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
 
 #define f_QNAN 0x7fc00000
 #define d_QNAN0 0x0
diff --git a/gdtoa/gdtoa-dmisc-fbsd.c b/gdtoa/gdtoa-dmisc-fbsd.c
deleted file mode 120000 (symlink)
index 5d57ae1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-dmisc.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-dtoa-fbsd.c b/gdtoa/gdtoa-dtoa-fbsd.c
deleted file mode 120000 (symlink)
index 82ff421..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-dtoa.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-gdtoa-fbsd.c b/gdtoa/gdtoa-gdtoa-fbsd.c
deleted file mode 120000 (symlink)
index ac880d6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-gdtoa.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-gethex-fbsd.c b/gdtoa/gdtoa-gethex-fbsd.c
deleted file mode 100644 (file)
index 855726a..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
-#include <sys/types.h>
-
-#ifdef USE_LOCALE
-#include "locale.h"
-#endif
-
- int
-#ifdef KR_headers
-gethex(sp, fpi, exp, bp, sign, loc)
-       CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign; locale_t loc;
-#else
-gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign, locale_t loc)
-#endif
-{
-       Bigint *b;
-       CONST unsigned char *decpt, *s0, *s, *s1;
-       unsigned char *strunc;
-       int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret;
-       ULong L, lostbits, *x;
-       Long e, e1;
-#ifdef USE_LOCALE
-       int i;
-       NORMALIZE_LOCALE(loc);
-#ifdef NO_LOCALE_CACHE
-       const unsigned char *decimalpoint = (unsigned char*)localeconv_l(loc)->decimal_point;
-#else
-       const unsigned char *decimalpoint;
-       static unsigned char *decimalpoint_cache;
-       if (!(s0 = decimalpoint_cache)) {
-               s0 = (unsigned char*)localeconv_l(loc)->decimal_point;
-               if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-                       strcpy(decimalpoint_cache, s0);
-                       s0 = decimalpoint_cache;
-                       }
-               }
-       decimalpoint = s0;
-#endif
-#endif
-
-       if (!hexdig['0'])
-               hexdig_init_D2A();
-       *bp = 0;
-       havedig = 0;
-       s0 = *(CONST unsigned char **)sp + 2;
-       while(s0[havedig] == '0')
-               havedig++;
-       s0 += havedig;
-       s = s0;
-       decpt = 0;
-       zret = 0;
-       e = 0;
-       if (hexdig[*s])
-               havedig++;
-       else {
-               zret = 1;
-#ifdef USE_LOCALE
-               for(i = 0; decimalpoint[i]; ++i) {
-                       if (s[i] != decimalpoint[i])
-                               goto pcheck;
-                       }
-               decpt = s += i;
-#else
-               if (*s != '.')
-                       goto pcheck;
-               decpt = ++s;
-#endif
-               if (!hexdig[*s])
-                       goto pcheck;
-               while(*s == '0')
-                       s++;
-               if (hexdig[*s])
-                       zret = 0;
-               havedig = 1;
-               s0 = s;
-               }
-       while(hexdig[*s])
-               s++;
-#ifdef USE_LOCALE
-       if (*s == *decimalpoint && !decpt) {
-               for(i = 1; decimalpoint[i]; ++i) {
-                       if (s[i] != decimalpoint[i])
-                               goto pcheck;
-                       }
-               decpt = s += i;
-#else
-       if (*s == '.' && !decpt) {
-               decpt = ++s;
-#endif
-               while(hexdig[*s])
-                       s++;
-               }/*}*/
-       if (decpt)
-               e = -(((Long)(s-decpt)) << 2);
- pcheck:
-       s1 = s;
-       big = esign = 0;
-       switch(*s) {
-         case 'p':
-         case 'P':
-               switch(*++s) {
-                 case '-':
-                       esign = 1;
-                       /* no break */
-                 case '+':
-                       s++;
-                 }
-               if ((n = hexdig[*s]) == 0 || n > 0x19) {
-                       s = s1;
-                       break;
-                       }
-               e1 = n - 0x10;
-               while((n = hexdig[*++s]) !=0 && n <= 0x19) {
-                       if (e1 & 0xf8000000)
-                               big = 1;
-                       e1 = 10*e1 + n - 0x10;
-                       }
-               if (esign)
-                       e1 = -e1;
-               e += e1;
-         }
-       *sp = (char*)s;
-       if (!havedig)
-               *sp = (char*)s0 - 1;
-       if (zret)
-               return STRTOG_Zero;
-       if (big) {
-               if (esign) {
-                       switch(fpi->rounding) {
-                         case FPI_Round_up:
-                               if (sign)
-                                       break;
-                               goto ret_tiny;
-                         case FPI_Round_down:
-                               if (!sign)
-                                       break;
-                               goto ret_tiny;
-                         }
-                       goto retz;
- ret_tiny:
-                       b = Balloc(0);
-                       b->wds = 1;
-                       b->x[0] = 1;
-                       goto dret;
-                       }
-               switch(fpi->rounding) {
-                 case FPI_Round_near:
-                       goto ovfl1;
-                 case FPI_Round_up:
-                       if (!sign)
-                               goto ovfl1;
-                       goto ret_big;
-                 case FPI_Round_down:
-                       if (sign)
-                               goto ovfl1;
-                       goto ret_big;
-                 }
- ret_big:
-               nbits = fpi->nbits;
-               n0 = n = nbits >> kshift;
-               if (nbits & kmask)
-                       ++n;
-               for(j = n, k = 0; j >>= 1; ++k);
-               *bp = b = Balloc(k);
-               b->wds = n;
-               for(j = 0; j < n0; ++j)
-                       b->x[j] = ALL_ON;
-               if (n > n0)
-                       b->x[j] = ULbits >> (ULbits - (nbits & kmask));
-               *exp = fpi->emin;
-               return STRTOG_Normal | STRTOG_Inexlo;
-               }
-       /*
-        * Truncate the hex string if it is longer than the precision needed,
-        * to avoid denial-of-service issues with very large strings.  Use
-        * additional digits to insure precision.  Scan to-be-truncated digits
-        * and replace with either '1' or '0' to ensure proper rounding.
-        */
-       {
-               int maxdigits = ((fpi->nbits + 3) >> 2) + 2;
-               size_t nd = s1 - s0;
-#ifdef USE_LOCALE
-               int dplen = strlen((const char *)decimalpoint);
-#else
-               int dplen = 1;
-#endif
-
-               if (decpt && s0 < decpt)
-                       nd -= dplen;
-               if (nd > maxdigits && (strunc = alloca(maxdigits + dplen + 2)) != NULL) {
-                       ssize_t nd0 = decpt ? decpt - s0 - dplen : nd;
-                       unsigned char *tp = strunc + maxdigits;
-                       int found = 0;
-                       if ((nd0 -= maxdigits) >= 0 || s0 >= decpt)
-                               memcpy(strunc, s0, maxdigits);
-                       else {
-                               memcpy(strunc, s0, maxdigits + dplen);
-                               tp += dplen;
-                               }
-                       s0 += maxdigits;
-                       e += (nd - (maxdigits + 1)) << 2;
-                       if (nd0 > 0) {
-                               while(nd0-- > 0)
-                                       if (*s0++ != '0') {
-                                               found++;
-                                               break;
-                                               }
-                               s0 += dplen;
-                               }
-                       if (!found && decpt) {
-                               while(s0 < s1)
-                                       if(*s0++ != '0') {
-                                               found++;
-                                               break;
-                                               }
-                               }
-                       *tp++ = found ? '1' : '0';
-                       *tp = 0;
-                       s0 = strunc;
-                       s1 = tp;
-                       }
-               }
-
-       n = s1 - s0 - 1;
-       for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1)
-               k++;
-       b = Balloc(k);
-       x = b->x;
-       n = 0;
-       L = 0;
-#ifdef USE_LOCALE
-       for(i = 0; decimalpoint[i+1]; ++i);
-#endif
-       while(s1 > s0) {
-#ifdef USE_LOCALE
-               if (*--s1 == decimalpoint[i]) {
-                       s1 -= i;
-                       continue;
-                       }
-#else
-               if (*--s1 == '.')
-                       continue;
-#endif
-               if (n == ULbits) {
-                       *x++ = L;
-                       L = 0;
-                       n = 0;
-                       }
-               L |= (hexdig[*s1] & 0x0f) << n;
-               n += 4;
-               }
-       *x++ = L;
-       b->wds = n = x - b->x;
-       n = ULbits*n - hi0bits(L);
-       nbits = fpi->nbits;
-       lostbits = 0;
-       x = b->x;
-       if (n > nbits) {
-               n -= nbits;
-               if (any_on(b,n)) {
-                       lostbits = 1;
-                       k = n - 1;
-                       if (x[k>>kshift] & 1 << (k & kmask)) {
-                               lostbits = 2;
-                               if (k > 0 && any_on(b,k))
-                                       lostbits = 3;
-                               }
-                       }
-               rshift(b, n);
-               e += n;
-               }
-       else if (n < nbits) {
-               n = nbits - n;
-               b = lshift(b, n);
-               e -= n;
-               x = b->x;
-               }
-       if (e > fpi->emax) {
- ovfl:
-               Bfree(b);
- ovfl1:
-#ifndef NO_ERRNO
-               errno = ERANGE;
-#endif
-               return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
-               }
-       irv = STRTOG_Normal;
-       if (e < fpi->emin) {
-               irv = STRTOG_Denormal;
-               n = fpi->emin - e;
-               if (n >= nbits) {
-                       switch (fpi->rounding) {
-                         case FPI_Round_near:
-                               if (n == nbits && (n < 2 || any_on(b,n-1)))
-                                       goto one_bit;
-                               break;
-                         case FPI_Round_up:
-                               if (!sign)
-                                       goto one_bit;
-                               break;
-                         case FPI_Round_down:
-                               if (sign) {
- one_bit:
-                                       x[0] = b->wds = 1;
- dret:
-                                       *bp = b;
-                                       *exp = fpi->emin;
-#ifndef NO_ERRNO
-                                       errno = ERANGE;
-#endif
-                                       return STRTOG_Denormal | STRTOG_Inexhi
-                                               | STRTOG_Underflow;
-                                       }
-                         }
-                       Bfree(b);
- retz:
-#ifndef NO_ERRNO
-                       errno = ERANGE;
-#endif
-                       return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow;
-                       }
-               k = n - 1;
-               if (lostbits)
-                       lostbits = 1;
-               else if (k > 0)
-                       lostbits = any_on(b,k);
-               if (x[k>>kshift] & 1 << (k & kmask))
-                       lostbits |= 2;
-               nbits -= n;
-               rshift(b,n);
-               e = fpi->emin;
-               }
-       if (lostbits) {
-               up = 0;
-               switch(fpi->rounding) {
-                 case FPI_Round_zero:
-                       break;
-                 case FPI_Round_near:
-                       if (lostbits & 2
-                        && (lostbits | x[0]) & 1)
-                               up = 1;
-                       break;
-                 case FPI_Round_up:
-                       up = 1 - sign;
-                       break;
-                 case FPI_Round_down:
-                       up = sign;
-                 }
-               if (up) {
-                       k = b->wds;
-                       b = increment(b);
-                       x = b->x;
-                       if (irv == STRTOG_Denormal) {
-                               if (nbits == fpi->nbits - 1
-                                && x[nbits >> kshift] & 1 << (nbits & kmask))
-                                       irv =  STRTOG_Normal;
-                               }
-                       else if (b->wds > k
-                        || ((n = nbits & kmask) !=0
-                             && hi0bits(x[k-1]) < 32-n)) {
-                               rshift(b,1);
-                               if (++e > fpi->emax)
-                                       goto ovfl;
-                               }
-                       irv |= STRTOG_Inexhi;
-                       }
-               else
-                       irv |= STRTOG_Inexlo;
-               }
-       *bp = b;
-       *exp = e;
-       return irv;
-       }
diff --git a/gdtoa/gdtoa-gmisc-fbsd.c b/gdtoa/gdtoa-gmisc-fbsd.c
deleted file mode 120000 (symlink)
index d7a4165..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-gmisc.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-hd_init-fbsd.c b/gdtoa/gdtoa-hd_init-fbsd.c
deleted file mode 120000 (symlink)
index 795e2b0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-hd_init.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-hexnan-fbsd.c b/gdtoa/gdtoa-hexnan-fbsd.c
deleted file mode 100644 (file)
index 2e0089e..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 2000 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "gdtoaimp.h"
-#include <fpmath.h>
-
-#ifndef __APPLE__
- static void
-#ifdef KR_headers
-L_shift(x, x1, i) ULong *x; ULong *x1; int i;
-#else
-L_shift(ULong *x, ULong *x1, int i)
-#endif
-{
-       int j;
-
-       i = 8 - i;
-       i <<= 2;
-       j = ULbits - i;
-       do {
-               *x |= x[1] << j;
-               x[1] >>= i;
-               } while(++x < x1);
-       }
-#endif /* !__APPLE__ */
-
- int
-#ifdef KR_headers
-hexnan(sp, fpi, x0)
-       CONST char **sp; FPI *fpi; ULong *x0;
-#else
-hexnan( CONST char **sp, FPI *fpi, ULong *x0)
-#endif
-{
-#ifdef __APPLE__
-       int nbits, len;
-       char *cp;
-#else /* !__APPLE__ */
-       ULong c, h, *x, *x1, *xe;
-#endif /* __APPLE__ */
-       CONST char *s;
-#ifndef __APPLE__
-       int havedig, hd0, i, nbits;
-#endif /* !__APPLE__ */
-
-#ifdef __APPLE__
-       if (sp == NULL || *sp == NULL || **sp != '(')
-               return STRTOG_NaN;
-#else /* !__APPLE__ */
-       if (!hexdig['0'])
-               hexdig_init_D2A();
-       nbits = fpi->nbits;
-       x = x0 + (nbits >> kshift);
-       if (nbits & kmask)
-               x++;
-       *--x = 0;
-       x1 = xe = x;
-       havedig = hd0 = i = 0;
-#endif /* __APPLE__ */
-       s = *sp;
-#ifdef __APPLE__
-       if ((cp = strchr(s + 1, ')')) == NULL) {
-               return STRTOG_NaN;
-               }
-       else {
-               len = cp - (s + 1);
-               cp = alloca(len + 1);
-               if (!cp)
-#else /* !__APPLE__ */
-       /* allow optional initial 0x or 0X */
-       while((c = *(CONST unsigned char*)(s+1)) && c <= ' ')
-               ++s;
-       if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')
-        && *(CONST unsigned char*)(s+3) > ' ')
-               s += 2;
-       while((c = *(CONST unsigned char*)++s)) {
-               if (!(h = hexdig[c])) {
-                       if (c <= ' ') {
-                               if (hd0 < havedig) {
-                                       if (x < x1 && i < 8)
-                                               L_shift(x, x1, i);
-                                       if (x <= x0) {
-                                               i = 8;
-                                               continue;
-                                               }
-                                       hd0 = havedig;
-                                       *--x = 0;
-                                       x1 = x;
-                                       i = 0;
-                                       }
-                               while(*(CONST unsigned char*)(s+1) <= ' ')
-                                       ++s;
-                               if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')
-                                && *(CONST unsigned char*)(s+3) > ' ')
-                                       s += 2;
-                               continue;
-                               }
-                       if (/*(*/ c == ')' && havedig) {
-                               *sp = s + 1;
-                               break;
-                               }
-#ifndef GDTOA_NON_PEDANTIC_NANCHECK
-                       do {
-                               if (/*(*/ c == ')') {
-                                       *sp = s + 1;
-                                       break;
-                                       }
-                               } while((c = *++s));
-#endif
-#endif /* __APPLE__ */
-                       return STRTOG_NaN;
-#ifdef __APPLE__
-               strlcpy(cp, s + 1, len + 1);
-               *sp += len + 2;
-#else /* !__APPLE__ */
-                       }
-               havedig++;
-               if (++i > 8) {
-                       if (x <= x0)
-                               continue;
-                       i = 1;
-                       *--x = 0;
-                       }
-               *x = (*x << 4) | (h & 0xf);
-#endif /* __APPLE__ */
-               }
-#ifdef __APPLE__
-       nbits = fpi->nbits;
-       /* a hack */
-       if (nbits == 52) {      /* double */
-               union IEEEd2bits u;
-               u.d = nan(cp);
-               x0[1] = u.bits.manh;
-               x0[0] = u.bits.manl;
-#else /* !__APPLE__ */
-       if (!havedig)
-               return STRTOG_NaN;
-       if (x < x1 && i < 8)
-               L_shift(x, x1, i);
-       if (x > x0) {
-               x1 = x0;
-               do *x1++ = *x++;
-                       while(x <= xe);
-               do *x1++ = 0;
-                       while(x1 <= xe);
-#endif /* __APPLE__ */
-               }
-#ifdef __APPLE__
-       else if (nbits < 52) {  /* float */
-               union IEEEf2bits u;
-               u.f = nanf(cp);
-               x0[0] = u.bits.man;
-#else /* !__APPLE__ */
-       else {
-               /* truncate high-order word if necessary */
-               if ( (i = nbits & (ULbits-1)) !=0)
-                       *xe &= ((ULong)0xffffffff) >> (ULbits - i);
-#endif /* __APPLE__ */
-               }
-#ifdef __APPLE__
-       else {                  /* long double */
-               union IEEEl2bits u;
-               u.e = nanl(cp);
-#if defined(__ppc__) || defined(__ppc64__)
-               x0[3] = (ULong)(u.bits.manh >> 44);
-               x0[2] = (ULong)(u.bits.manh >> 12);
-               x0[1] = ((ULong)u.bits.manh & 0xfff) << 20 | (ULong)(u.bits.manl >> 32);
-               x0[0] = (ULong)u.bits.manl;
-#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__)
-               x0[1] = (ULong)u.bits.manh;
-               x0[0] = (ULong)u.bits.manl;
-#else
-#error unsupported architecture
-#endif
-#else /* !__APPLE__ */
-       for(x1 = xe;; --x1) {
-               if (*x1 != 0)
-                       break;
-               if (x1 == x0) {
-                       *x1 = 1;
-                       break;
-                       }
-#endif /* __APPLE__ */
-               }
-       return STRTOG_NaNbits;
-       }
diff --git a/gdtoa/gdtoa-misc-fbsd.c b/gdtoa/gdtoa-misc-fbsd.c
deleted file mode 100644 (file)
index 84fe199..0000000
+++ /dev/null
@@ -1,931 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998, 1999 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#define GDTOA_TSD
-#define Omit_Private_Memory
-
-#ifdef GDTOA_TSD
-#include <pthread.h>
-#endif /* GDTOA_TSD */
-#include "gdtoaimp.h"
-
-#ifdef GDTOA_TSD
-static pthread_key_t   gdtoa_tsd_key = (pthread_key_t)-1;
-static pthread_mutex_t gdtoa_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
-#else /* !GDTOA_TSD */
- static Bigint *freelist[Kmax+1];
-#endif /* GDTOA_TSD */
-#ifndef Omit_Private_Memory
-#ifndef PRIVATE_MEM
-#define PRIVATE_MEM 2304
-#endif
-#define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
-static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
-#endif
-
-#ifdef GDTOA_TSD
-static void
-gdtoa_freelist_free(void *x)
-{
-       int i;
-       Bigint *cur, *next;
-       Bigint **fl = (Bigint **)x;
-
-       if (!fl) return;
-       for(i = 0; i < Kmax+1; fl++, i++) {
-               if (!*fl) continue;
-               for(cur = *fl; cur; cur = next) {
-                       next = cur->next;
-                       free(cur);
-                       }
-               }
-       free(x);
-       }
-#endif /* GDTOA_TSD */
-
- Bigint *
-Balloc
-#ifdef KR_headers
-       (k) int k;
-#else
-       (int k)
-#endif
-{
-       int x;
-       Bigint *rv;
-#ifndef Omit_Private_Memory
-       unsigned int len;
-#endif
-#ifdef GDTOA_TSD
-       Bigint **freelist;
-
-       if (gdtoa_tsd_key == (pthread_key_t)-1) {
-               pthread_mutex_lock(&gdtoa_tsd_lock);
-               if (gdtoa_tsd_key == (pthread_key_t)-1) {
-                       gdtoa_tsd_key = __LIBC_PTHREAD_KEY_GDTOA_BIGINT;
-                       pthread_key_init_np(gdtoa_tsd_key, gdtoa_freelist_free);
-                       }
-               pthread_mutex_unlock(&gdtoa_tsd_lock);
-               }
-       if ((freelist = (Bigint **)pthread_getspecific(gdtoa_tsd_key)) == NULL) {
-               freelist = (Bigint **)MALLOC((Kmax+1) * sizeof(Bigint *));
-               bzero(freelist, (Kmax+1) * sizeof(Bigint *));
-               pthread_setspecific(gdtoa_tsd_key, freelist);
-               }
-#else /* !GDTOA_TSD */
-       ACQUIRE_DTOA_LOCK(0);
-#endif /* GDTOA_TSD */
-       /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
-       /* but this case seems very unlikely. */
-       if (k <= Kmax && (rv = freelist[k]) !=0) {
-               freelist[k] = rv->next;
-               }
-       else {
-               x = 1 << k;
-#ifdef Omit_Private_Memory
-               rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
-#else
-               len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
-                       /sizeof(double);
-               if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
-                       rv = (Bigint*)pmem_next;
-                       pmem_next += len;
-                       }
-               else
-                       rv = (Bigint*)MALLOC(len*sizeof(double));
-#endif
-               rv->k = k;
-               rv->maxwds = x;
-               }
-#ifndef GDTOA_TSD
-       FREE_DTOA_LOCK(0);
-#endif /* GDTOA_TSD */
-       rv->sign = rv->wds = 0;
-       return rv;
-       }
-
- void
-Bfree
-#ifdef KR_headers
-       (v) Bigint *v;
-#else
-       (Bigint *v)
-#endif
-{
-       if (v) {
-               if (v->k > Kmax)
-#ifdef FREE
-                       FREE((void*)v);
-#else
-                       free((void*)v);
-#endif
-               else {
-#ifdef GDTOA_TSD
-                       Bigint **freelist = (Bigint **)pthread_getspecific(gdtoa_tsd_key);
-#else /* !GDTOA_TSD */
-                       ACQUIRE_DTOA_LOCK(0);
-#endif /* !GDTOA_TSD */
-                       v->next = freelist[v->k];
-                       freelist[v->k] = v;
-#ifndef GDTOA_TSD
-                       FREE_DTOA_LOCK(0);
-#endif /* !GDTOA_TSD */
-                       }
-               }
-       }
-
- int
-lo0bits
-#ifdef KR_headers
-       (y) ULong *y;
-#else
-       (ULong *y)
-#endif
-{
-       int k;
-       ULong x = *y;
-
-       if (x & 7) {
-               if (x & 1)
-                       return 0;
-               if (x & 2) {
-                       *y = x >> 1;
-                       return 1;
-                       }
-               *y = x >> 2;
-               return 2;
-               }
-       k = 0;
-       if (!(x & 0xffff)) {
-               k = 16;
-               x >>= 16;
-               }
-       if (!(x & 0xff)) {
-               k += 8;
-               x >>= 8;
-               }
-       if (!(x & 0xf)) {
-               k += 4;
-               x >>= 4;
-               }
-       if (!(x & 0x3)) {
-               k += 2;
-               x >>= 2;
-               }
-       if (!(x & 1)) {
-               k++;
-               x >>= 1;
-               if (!x)
-                       return 32;
-               }
-       *y = x;
-       return k;
-       }
-
- Bigint *
-multadd
-#ifdef KR_headers
-       (b, m, a) Bigint *b; int m, a;
-#else
-       (Bigint *b, int m, int a)       /* multiply by m and add a */
-#endif
-{
-       int i, wds;
-#ifdef ULLong
-       ULong *x;
-       ULLong carry, y;
-#else
-       ULong carry, *x, y;
-#ifdef Pack_32
-       ULong xi, z;
-#endif
-#endif
-       Bigint *b1;
-
-       wds = b->wds;
-       x = b->x;
-       i = 0;
-       carry = a;
-       do {
-#ifdef ULLong
-               y = *x * (ULLong)m + carry;
-               carry = y >> 32;
-               *x++ = y & 0xffffffffUL;
-#else
-#ifdef Pack_32
-               xi = *x;
-               y = (xi & 0xffff) * m + carry;
-               z = (xi >> 16) * m + (y >> 16);
-               carry = z >> 16;
-               *x++ = (z << 16) + (y & 0xffff);
-#else
-               y = *x * m + carry;
-               carry = y >> 16;
-               *x++ = y & 0xffff;
-#endif
-#endif
-               }
-               while(++i < wds);
-       if (carry) {
-               if (wds >= b->maxwds) {
-                       b1 = Balloc(b->k+1);
-                       Bcopy(b1, b);
-                       Bfree(b);
-                       b = b1;
-                       }
-               b->x[wds++] = carry;
-               b->wds = wds;
-               }
-       return b;
-       }
-
- int
-hi0bits_D2A
-#ifdef KR_headers
-       (x) ULong x;
-#else
-       (ULong x)
-#endif
-{
-       int k = 0;
-
-       if (!(x & 0xffff0000)) {
-               k = 16;
-               x <<= 16;
-               }
-       if (!(x & 0xff000000)) {
-               k += 8;
-               x <<= 8;
-               }
-       if (!(x & 0xf0000000)) {
-               k += 4;
-               x <<= 4;
-               }
-       if (!(x & 0xc0000000)) {
-               k += 2;
-               x <<= 2;
-               }
-       if (!(x & 0x80000000)) {
-               k++;
-               if (!(x & 0x40000000))
-                       return 32;
-               }
-       return k;
-       }
-
- Bigint *
-i2b
-#ifdef KR_headers
-       (i) int i;
-#else
-       (int i)
-#endif
-{
-       Bigint *b;
-
-       b = Balloc(1);
-       b->x[0] = i;
-       b->wds = 1;
-       return b;
-       }
-
- Bigint *
-mult
-#ifdef KR_headers
-       (a, b) Bigint *a, *b;
-#else
-       (Bigint *a, Bigint *b)
-#endif
-{
-       Bigint *c;
-       int k, wa, wb, wc;
-       ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
-       ULong y;
-#ifdef ULLong
-       ULLong carry, z;
-#else
-       ULong carry, z;
-#ifdef Pack_32
-       ULong z2;
-#endif
-#endif
-
-       if (a->wds < b->wds) {
-               c = a;
-               a = b;
-               b = c;
-               }
-       k = a->k;
-       wa = a->wds;
-       wb = b->wds;
-       wc = wa + wb;
-       if (wc > a->maxwds)
-               k++;
-       c = Balloc(k);
-       for(x = c->x, xa = x + wc; x < xa; x++)
-               *x = 0;
-       xa = a->x;
-       xae = xa + wa;
-       xb = b->x;
-       xbe = xb + wb;
-       xc0 = c->x;
-#ifdef ULLong
-       for(; xb < xbe; xc0++) {
-               if ( (y = *xb++) !=0) {
-                       x = xa;
-                       xc = xc0;
-                       carry = 0;
-                       do {
-                               z = *x++ * (ULLong)y + *xc + carry;
-                               carry = z >> 32;
-                               *xc++ = z & 0xffffffffUL;
-                               }
-                               while(x < xae);
-                       *xc = carry;
-                       }
-               }
-#else
-#ifdef Pack_32
-       for(; xb < xbe; xb++, xc0++) {
-               if ( (y = *xb & 0xffff) !=0) {
-                       x = xa;
-                       xc = xc0;
-                       carry = 0;
-                       do {
-                               z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
-                               carry = z >> 16;
-                               z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
-                               carry = z2 >> 16;
-                               Storeinc(xc, z2, z);
-                               }
-                               while(x < xae);
-                       *xc = carry;
-                       }
-               if ( (y = *xb >> 16) !=0) {
-                       x = xa;
-                       xc = xc0;
-                       carry = 0;
-                       z2 = *xc;
-                       do {
-                               z = (*x & 0xffff) * y + (*xc >> 16) + carry;
-                               carry = z >> 16;
-                               Storeinc(xc, z, z2);
-                               z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
-                               carry = z2 >> 16;
-                               }
-                               while(x < xae);
-                       *xc = z2;
-                       }
-               }
-#else
-       for(; xb < xbe; xc0++) {
-               if ( (y = *xb++) !=0) {
-                       x = xa;
-                       xc = xc0;
-                       carry = 0;
-                       do {
-                               z = *x++ * y + *xc + carry;
-                               carry = z >> 16;
-                               *xc++ = z & 0xffff;
-                               }
-                               while(x < xae);
-                       *xc = carry;
-                       }
-               }
-#endif
-#endif
-       for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ;
-       c->wds = wc;
-       return c;
-       }
-
- static Bigint *p5s;
-
- Bigint *
-pow5mult
-#ifdef KR_headers
-       (b, k) Bigint *b; int k;
-#else
-       (Bigint *b, int k)
-#endif
-{
-       Bigint *b1, *p5, *p51;
-       int i;
-       static int p05[3] = { 5, 25, 125 };
-
-       if ( (i = k & 3) !=0)
-               b = multadd(b, p05[i-1], 0);
-
-       if (!(k >>= 2))
-               return b;
-       if ((p5 = p5s) == 0) {
-               /* first time */
-#ifdef MULTIPLE_THREADS
-               ACQUIRE_DTOA_LOCK(1);
-               if (!(p5 = p5s)) {
-                       p5 = p5s = i2b(625);
-                       p5->next = 0;
-                       }
-               FREE_DTOA_LOCK(1);
-#else
-               p5 = p5s = i2b(625);
-               p5->next = 0;
-#endif
-               }
-       for(;;) {
-               if (k & 1) {
-                       b1 = mult(b, p5);
-                       Bfree(b);
-                       b = b1;
-                       }
-               if (!(k >>= 1))
-                       break;
-               if ((p51 = p5->next) == 0) {
-#ifdef MULTIPLE_THREADS
-                       ACQUIRE_DTOA_LOCK(1);
-                       if (!(p51 = p5->next)) {
-                               p51 = p5->next = mult(p5,p5);
-                               p51->next = 0;
-                               }
-                       FREE_DTOA_LOCK(1);
-#else
-                       p51 = p5->next = mult(p5,p5);
-                       p51->next = 0;
-#endif
-                       }
-               p5 = p51;
-               }
-       return b;
-       }
-
- Bigint *
-lshift
-#ifdef KR_headers
-       (b, k) Bigint *b; int k;
-#else
-       (Bigint *b, int k)
-#endif
-{
-       int i, k1, n, n1;
-       Bigint *b1;
-       ULong *x, *x1, *xe, z;
-
-       n = k >> kshift;
-       k1 = b->k;
-       n1 = n + b->wds + 1;
-       for(i = b->maxwds; n1 > i; i <<= 1)
-               k1++;
-       b1 = Balloc(k1);
-       x1 = b1->x;
-       for(i = 0; i < n; i++)
-               *x1++ = 0;
-       x = b->x;
-       xe = x + b->wds;
-       if (k &= kmask) {
-#ifdef Pack_32
-               k1 = 32 - k;
-               z = 0;
-               do {
-                       *x1++ = *x << k | z;
-                       z = *x++ >> k1;
-                       }
-                       while(x < xe);
-               if ((*x1 = z) !=0)
-                       ++n1;
-#else
-               k1 = 16 - k;
-               z = 0;
-               do {
-                       *x1++ = *x << k  & 0xffff | z;
-                       z = *x++ >> k1;
-                       }
-                       while(x < xe);
-               if (*x1 = z)
-                       ++n1;
-#endif
-               }
-       else do
-               *x1++ = *x++;
-               while(x < xe);
-       b1->wds = n1 - 1;
-       Bfree(b);
-       return b1;
-       }
-
- int
-cmp
-#ifdef KR_headers
-       (a, b) Bigint *a, *b;
-#else
-       (Bigint *a, Bigint *b)
-#endif
-{
-       ULong *xa, *xa0, *xb, *xb0;
-       int i, j;
-
-       i = a->wds;
-       j = b->wds;
-#ifdef DEBUG
-       if (i > 1 && !a->x[i-1])
-               Bug("cmp called with a->x[a->wds-1] == 0");
-       if (j > 1 && !b->x[j-1])
-               Bug("cmp called with b->x[b->wds-1] == 0");
-#endif
-       if (i -= j)
-               return i;
-       xa0 = a->x;
-       xa = xa0 + j;
-       xb0 = b->x;
-       xb = xb0 + j;
-       for(;;) {
-               if (*--xa != *--xb)
-                       return *xa < *xb ? -1 : 1;
-               if (xa <= xa0)
-                       break;
-               }
-       return 0;
-       }
-
- Bigint *
-diff
-#ifdef KR_headers
-       (a, b) Bigint *a, *b;
-#else
-       (Bigint *a, Bigint *b)
-#endif
-{
-       Bigint *c;
-       int i, wa, wb;
-       ULong *xa, *xae, *xb, *xbe, *xc;
-#ifdef ULLong
-       ULLong borrow, y;
-#else
-       ULong borrow, y;
-#ifdef Pack_32
-       ULong z;
-#endif
-#endif
-
-       i = cmp(a,b);
-       if (!i) {
-               c = Balloc(0);
-               c->wds = 1;
-               c->x[0] = 0;
-               return c;
-               }
-       if (i < 0) {
-               c = a;
-               a = b;
-               b = c;
-               i = 1;
-               }
-       else
-               i = 0;
-       c = Balloc(a->k);
-       c->sign = i;
-       wa = a->wds;
-       xa = a->x;
-       xae = xa + wa;
-       wb = b->wds;
-       xb = b->x;
-       xbe = xb + wb;
-       xc = c->x;
-       borrow = 0;
-#ifdef ULLong
-       do {
-               y = (ULLong)*xa++ - *xb++ - borrow;
-               borrow = y >> 32 & 1UL;
-               *xc++ = y & 0xffffffffUL;
-               }
-               while(xb < xbe);
-       while(xa < xae) {
-               y = *xa++ - borrow;
-               borrow = y >> 32 & 1UL;
-               *xc++ = y & 0xffffffffUL;
-               }
-#else
-#ifdef Pack_32
-       do {
-               y = (*xa & 0xffff) - (*xb & 0xffff) - borrow;
-               borrow = (y & 0x10000) >> 16;
-               z = (*xa++ >> 16) - (*xb++ >> 16) - borrow;
-               borrow = (z & 0x10000) >> 16;
-               Storeinc(xc, z, y);
-               }
-               while(xb < xbe);
-       while(xa < xae) {
-               y = (*xa & 0xffff) - borrow;
-               borrow = (y & 0x10000) >> 16;
-               z = (*xa++ >> 16) - borrow;
-               borrow = (z & 0x10000) >> 16;
-               Storeinc(xc, z, y);
-               }
-#else
-       do {
-               y = *xa++ - *xb++ - borrow;
-               borrow = (y & 0x10000) >> 16;
-               *xc++ = y & 0xffff;
-               }
-               while(xb < xbe);
-       while(xa < xae) {
-               y = *xa++ - borrow;
-               borrow = (y & 0x10000) >> 16;
-               *xc++ = y & 0xffff;
-               }
-#endif
-#endif
-       while(!*--xc)
-               wa--;
-       c->wds = wa;
-       return c;
-       }
-
- double
-b2d
-#ifdef KR_headers
-       (a, e) Bigint *a; int *e;
-#else
-       (Bigint *a, int *e)
-#endif
-{
-       ULong *xa, *xa0, w, y, z;
-       int k;
-       U d;
-#ifdef VAX
-       ULong d0, d1;
-#else
-#define d0 word0(&d)
-#define d1 word1(&d)
-#endif
-
-       xa0 = a->x;
-       xa = xa0 + a->wds;
-       y = *--xa;
-#ifdef DEBUG
-       if (!y) Bug("zero y in b2d");
-#endif
-       k = hi0bits(y);
-       *e = 32 - k;
-#ifdef Pack_32
-       if (k < Ebits) {
-               d0 = Exp_1 | y >> (Ebits - k);
-               w = xa > xa0 ? *--xa : 0;
-               d1 = y << ((32-Ebits) + k) | w >> (Ebits - k);
-               goto ret_d;
-               }
-       z = xa > xa0 ? *--xa : 0;
-       if (k -= Ebits) {
-               d0 = Exp_1 | y << k | z >> (32 - k);
-               y = xa > xa0 ? *--xa : 0;
-               d1 = z << k | y >> (32 - k);
-               }
-       else {
-               d0 = Exp_1 | y;
-               d1 = z;
-               }
-#else
-       if (k < Ebits + 16) {
-               z = xa > xa0 ? *--xa : 0;
-               d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k;
-               w = xa > xa0 ? *--xa : 0;
-               y = xa > xa0 ? *--xa : 0;
-               d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k;
-               goto ret_d;
-               }
-       z = xa > xa0 ? *--xa : 0;
-       w = xa > xa0 ? *--xa : 0;
-       k -= Ebits + 16;
-       d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k;
-       y = xa > xa0 ? *--xa : 0;
-       d1 = w << k + 16 | y << k;
-#endif
- ret_d:
-#ifdef VAX
-       word0(&d) = d0 >> 16 | d0 << 16;
-       word1(&d) = d1 >> 16 | d1 << 16;
-#endif
-       return dval(&d);
-       }
-#undef d0
-#undef d1
-
- Bigint *
-d2b
-#ifdef KR_headers
-       (dd, e, bits) double dd; int *e, *bits;
-#else
-       (double dd, int *e, int *bits)
-#endif
-{
-       Bigint *b;
-       U d;
-#ifndef Sudden_Underflow
-       int i;
-#endif
-       int de, k;
-       ULong *x, y, z;
-#ifdef VAX
-       ULong d0, d1;
-#else
-#define d0 word0(&d)
-#define d1 word1(&d)
-#endif
-       d.d = dd;
-#ifdef VAX
-       d0 = word0(&d) >> 16 | word0(&d) << 16;
-       d1 = word1(&d) >> 16 | word1(&d) << 16;
-#endif
-
-#ifdef Pack_32
-       b = Balloc(1);
-#else
-       b = Balloc(2);
-#endif
-       x = b->x;
-
-       z = d0 & Frac_mask;
-       d0 &= 0x7fffffff;       /* clear sign bit, which we ignore */
-#ifdef Sudden_Underflow
-       de = (int)(d0 >> Exp_shift);
-#ifndef IBM
-       z |= Exp_msk11;
-#endif
-#else
-       if ( (de = (int)(d0 >> Exp_shift)) !=0)
-               z |= Exp_msk1;
-#endif
-#ifdef Pack_32
-       if ( (y = d1) !=0) {
-               if ( (k = lo0bits(&y)) !=0) {
-                       x[0] = y | z << (32 - k);
-                       z >>= k;
-                       }
-               else
-                       x[0] = y;
-#ifndef Sudden_Underflow
-               i =
-#endif
-                    b->wds = (x[1] = z) !=0 ? 2 : 1;
-               }
-       else {
-               k = lo0bits(&z);
-               x[0] = z;
-#ifndef Sudden_Underflow
-               i =
-#endif
-                   b->wds = 1;
-               k += 32;
-               }
-#else
-       if ( (y = d1) !=0) {
-               if ( (k = lo0bits(&y)) !=0)
-                       if (k >= 16) {
-                               x[0] = y | z << 32 - k & 0xffff;
-                               x[1] = z >> k - 16 & 0xffff;
-                               x[2] = z >> k;
-                               i = 2;
-                               }
-                       else {
-                               x[0] = y & 0xffff;
-                               x[1] = y >> 16 | z << 16 - k & 0xffff;
-                               x[2] = z >> k & 0xffff;
-                               x[3] = z >> k+16;
-                               i = 3;
-                               }
-               else {
-                       x[0] = y & 0xffff;
-                       x[1] = y >> 16;
-                       x[2] = z & 0xffff;
-                       x[3] = z >> 16;
-                       i = 3;
-                       }
-               }
-       else {
-#ifdef DEBUG
-               if (!z)
-                       Bug("Zero passed to d2b");
-#endif
-               k = lo0bits(&z);
-               if (k >= 16) {
-                       x[0] = z;
-                       i = 0;
-                       }
-               else {
-                       x[0] = z & 0xffff;
-                       x[1] = z >> 16;
-                       i = 1;
-                       }
-               k += 32;
-               }
-       while(!x[i])
-               --i;
-       b->wds = i + 1;
-#endif
-#ifndef Sudden_Underflow
-       if (de) {
-#endif
-#ifdef IBM
-               *e = (de - Bias - (P-1) << 2) + k;
-               *bits = 4*P + 8 - k - hi0bits(word0(&d) & Frac_mask);
-#else
-               *e = de - Bias - (P-1) + k;
-               *bits = P - k;
-#endif
-#ifndef Sudden_Underflow
-               }
-       else {
-               *e = de - Bias - (P-1) + 1 + k;
-#ifdef Pack_32
-               *bits = 32*i - hi0bits(x[i-1]);
-#else
-               *bits = (i+2)*16 - hi0bits(x[i]);
-#endif
-               }
-#endif
-       return b;
-       }
-#undef d0
-#undef d1
-
- CONST double
-#ifdef IEEE_Arith
-bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
-CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256
-               };
-#else
-#ifdef IBM
-bigtens[] = { 1e16, 1e32, 1e64 };
-CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 };
-#else
-bigtens[] = { 1e16, 1e32 };
-CONST double tinytens[] = { 1e-16, 1e-32 };
-#endif
-#endif
-
- CONST double
-tens[] = {
-               1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
-               1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
-               1e20, 1e21, 1e22
-#ifdef VAX
-               , 1e23, 1e24
-#endif
-               };
-
- char *
-#ifdef KR_headers
-strcp_D2A(a, b) char *a; char *b;
-#else
-strcp_D2A(char *a, CONST char *b)
-#endif
-{
-       while((*a = *b++))
-               a++;
-       return a;
-       }
-
-#ifdef NO_STRING_H
-
- Char *
-#ifdef KR_headers
-memcpy_D2A(a, b, len) Char *a; Char *b; size_t len;
-#else
-memcpy_D2A(void *a1, void *b1, size_t len)
-#endif
-{
-       char *a = (char*)a1, *ae = a + len;
-       char *b = (char*)b1, *a0 = a;
-       while(a < ae)
-               *a++ = *b++;
-       return a0;
-       }
-
-#endif /* NO_STRING_H */
diff --git a/gdtoa/gdtoa-smisc-fbsd.c b/gdtoa/gdtoa-smisc-fbsd.c
deleted file mode 120000 (symlink)
index e467f82..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-smisc.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-strtod-fbsd.c b/gdtoa/gdtoa-strtod-fbsd.c
deleted file mode 100644 (file)
index 3186f25..0000000
+++ /dev/null
@@ -1,1044 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998-2001 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-#ifndef NO_FENV_H
-#include <fenv.h>
-#endif
-
-#ifdef USE_LOCALE
-#include "locale.h"
-#endif
-
-#ifdef IEEE_Arith
-#ifndef NO_IEEE_Scale
-#define Avoid_Underflow
-#undef tinytens
-/* The factor of 2^106 in tinytens[4] helps us avoid setting the underflow */
-/* flag unnecessarily.  It leads to a song and dance at the end of strtod. */
-static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128,
-               9007199254740992.*9007199254740992.e-256
-               };
-#endif
-#endif
-
-#ifdef Honor_FLT_ROUNDS
-#undef Check_FLT_ROUNDS
-#define Check_FLT_ROUNDS
-#else
-#define Rounding Flt_Rounds
-#endif
-
- double
-strtod_l
-#ifdef KR_headers
-       (s00, se, loc) CONST char *s00; char **se; locale_t loc;
-#else
-       (CONST char *s00, char **se, locale_t loc)
-#endif
-{
-#ifdef Avoid_Underflow
-       int scale;
-#endif
-       int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign,
-                e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
-       CONST char *s, *s0, *s1;
-       char *strunc = NULL;
-       double aadj;
-       Long L;
-       U adj, aadj1, rv, rv0;
-       ULong y, z;
-       Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
-#ifdef SET_INEXACT
-       int inexact, oldinexact;
-#endif
-#ifdef USE_LOCALE /*{{*/
-       NORMALIZE_LOCALE(loc);
-#ifdef NO_LOCALE_CACHE
-       char *decimalpoint = localeconv_l(loc)->decimal_point;
-       int dplen = strlen(decimalpoint);
-#else
-       char *decimalpoint;
-       static char *decimalpoint_cache;
-       static int dplen;
-       if (!(s0 = decimalpoint_cache)) {
-               s0 = localeconv_l(loc)->decimal_point;
-               if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-                       strcpy(decimalpoint_cache, s0);
-                       s0 = decimalpoint_cache;
-                       }
-               dplen = strlen(s0);
-               }
-       decimalpoint = (char*)s0;
-#endif /*NO_LOCALE_CACHE*/
-#else  /*USE_LOCALE}{*/
-#define dplen 1
-#endif /*USE_LOCALE}}*/
-
-#ifdef Honor_FLT_ROUNDS /*{*/
-       int Rounding;
-#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
-       Rounding = Flt_Rounds;
-#else /*}{*/
-       Rounding = 1;
-       switch(fegetround()) {
-         case FE_TOWARDZERO:   Rounding = 0; break;
-         case FE_UPWARD:       Rounding = 2; break;
-         case FE_DOWNWARD:     Rounding = 3;
-         }
-#endif /*}}*/
-#endif /*}*/
-
-       sign = nz0 = nz = decpt = 0;
-       dval(&rv) = 0.;
-       for(s = s00;;s++) switch(*s) {
-               case '-':
-                       sign = 1;
-                       /* no break */
-               case '+':
-                       if (*++s)
-                               goto break2;
-                       /* no break */
-               case 0:
-                       goto ret0;
-               case '\t':
-               case '\n':
-               case '\v':
-               case '\f':
-               case '\r':
-               case ' ':
-                       continue;
-               default:
-                       goto break2;
-               }
- break2:
-       if (*s == '0') {
-#ifndef NO_HEX_FP /*{*/
-               {
-               static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
-               Long exp;
-               ULong bits[2];
-               switch(s[1]) {
-                 case 'x':
-                 case 'X':
-                       {
-#ifdef Honor_FLT_ROUNDS
-                       FPI fpi1 = fpi;
-                       fpi1.rounding = Rounding;
-#else
-#define fpi1 fpi
-#endif
-                       switch((i = gethex(&s, &fpi1, &exp, &bb, sign, loc)) & STRTOG_Retmask) {
-                         case STRTOG_NoNumber:
-                               s = s00;
-                               sign = 0;
-                         case STRTOG_Zero:
-                               break;
-                         default:
-                               if (bb) {
-                                       copybits(bits, fpi.nbits, bb);
-                                       Bfree(bb);
-                                       }
-                               ULtod(((U*)&rv)->L, bits, exp, i);
-                         }}
-                       goto ret;
-                 }
-               }
-#endif /*}*/
-               nz0 = 1;
-               while(*++s == '0') ;
-               if (!*s)
-                       goto ret;
-               }
-       s0 = s;
-       y = z = 0;
-       for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
-               if (nd < 9)
-                       y = 10*y + c - '0';
-               else if (nd < 16)
-                       z = 10*z + c - '0';
-       nd0 = nd;
-#ifdef USE_LOCALE
-       if (c == *decimalpoint) {
-               for(i = 1; decimalpoint[i]; ++i)
-                       if (s[i] != decimalpoint[i])
-                               goto dig_done;
-               s += i;
-               c = *s;
-#else
-       if (c == '.') {
-               c = *++s;
-#endif
-               decpt = 1;
-               if (!nd) {
-                       for(; c == '0'; c = *++s)
-                               nz++;
-                       if (c > '0' && c <= '9') {
-                               s0 = s;
-                               nf += nz;
-                               nz = 0;
-                               goto have_dig;
-                               }
-                       goto dig_done;
-                       }
-               for(; c >= '0' && c <= '9'; c = *++s) {
- have_dig:
-                       nz++;
-                       if (c -= '0') {
-                               nf += nz;
-                               for(i = 1; i < nz; i++)
-                                       if (nd++ < 9)
-                                               y *= 10;
-                                       else if (nd <= DBL_DIG + 1)
-                                               z *= 10;
-                               if (nd++ < 9)
-                                       y = 10*y + c;
-                               else if (nd <= DBL_DIG + 1)
-                                       z = 10*z + c;
-                               nz = 0;
-                               }
-                       }
-               }/*}*/
- dig_done:
-       e = 0;
-       if (c == 'e' || c == 'E') {
-               if (!nd && !nz && !nz0) {
-                       goto ret0;
-                       }
-               s00 = s;
-               esign = 0;
-               switch(c = *++s) {
-                       case '-':
-                               esign = 1;
-                       case '+':
-                               c = *++s;
-                       }
-               if (c >= '0' && c <= '9') {
-                       while(c == '0')
-                               c = *++s;
-                       if (c > '0' && c <= '9') {
-                               L = c - '0';
-                               s1 = s;
-                               while((c = *++s) >= '0' && c <= '9')
-                                       L = 10*L + c - '0';
-                               if (s - s1 > 8 || L > 19999)
-                                       /* Avoid confusion from exponents
-                                        * so large that e might overflow.
-                                        */
-                                       e = 19999; /* safe for 16 bit ints */
-                               else
-                                       e = (int)L;
-                               if (esign)
-                                       e = -e;
-                               }
-                       else
-                               e = 0;
-                       }
-               else
-                       s = s00;
-               }
-       if (!nd) {
-               if (!nz && !nz0) {
-#ifdef INFNAN_CHECK
-                       /* Check for Nan and Infinity */
-                       ULong bits[2];
-                       static FPI fpinan =     /* only 52 explicit bits */
-                               { 52, 1-1023-53+1, 2046-1023-53+1, 1, SI };
-                       if (!decpt)
-                        switch(c) {
-                         case 'i':
-                         case 'I':
-                               if (match(&s,"nf")) {
-                                       --s;
-                                       if (!match(&s,"inity"))
-                                               ++s;
-                                       word0(&rv) = 0x7ff00000;
-                                       word1(&rv) = 0;
-                                       goto ret;
-                                       }
-                               break;
-                         case 'n':
-                         case 'N':
-                               if (match(&s, "an")) {
-#ifndef No_Hex_NaN
-                                       if (*s == '(' /*)*/
-                                        && hexnan(&s, &fpinan, bits)
-                                                       == STRTOG_NaNbits) {
-                                               word0(&rv) = 0x7ff00000 | bits[1];
-                                               word1(&rv) = bits[0];
-                                               }
-                                       else {
-#endif
-                                               word0(&rv) = NAN_WORD0;
-                                               word1(&rv) = NAN_WORD1;
-#ifndef No_Hex_NaN
-                                               }
-#endif
-                                       goto ret;
-                                       }
-                         }
-#endif /* INFNAN_CHECK */
- ret0:
-                       s = s00;
-                       sign = 0;
-                       }
-               goto ret;
-               }
-#define FPIEMIN (1-1023-53+1)  // fpi.emin
-#define FPINBITS 52            // fpi.nbits
-       TRUNCATE_DIGITS(s0, strunc, nd, nd0, nf, FPINBITS, FPIEMIN, dplen);
-       e1 = e -= nf;
-
-       /* Now we have nd0 digits, starting at s0, followed by a
-        * decimal point, followed by nd-nd0 digits.  The number we're
-        * after is the integer represented by those digits times
-        * 10**e */
-
-       if (!nd0)
-               nd0 = nd;
-       k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1;
-       dval(&rv) = y;
-       if (k > 9) {
-#ifdef SET_INEXACT
-               if (k > DBL_DIG)
-                       oldinexact = get_inexact();
-#endif
-               dval(&rv) = tens[k - 9] * dval(&rv) + z;
-               }
-       bd0 = 0;
-       if (nd <= DBL_DIG
-#ifndef RND_PRODQUOT
-#ifndef Honor_FLT_ROUNDS
-               && Flt_Rounds == 1
-#endif
-#endif
-                       ) {
-               if (!e)
-                       goto ret;
-               if (e > 0) {
-                       if (e <= Ten_pmax) {
-#ifdef VAX
-                               goto vax_ovfl_check;
-#else
-#ifdef Honor_FLT_ROUNDS
-                               /* round correctly FLT_ROUNDS = 2 or 3 */
-                               if (sign) {
-                                       dval(&rv) = -dval(&rv);
-                                       sign = 0;
-                                       }
-#endif
-                               /* rv = */ rounded_product(dval(&rv), tens[e]);
-                               goto ret;
-#endif
-                               }
-                       i = DBL_DIG - nd;
-                       if (e <= Ten_pmax + i) {
-                               /* A fancier test would sometimes let us do
-                                * this for larger i values.
-                                */
-#ifdef Honor_FLT_ROUNDS
-                               /* round correctly FLT_ROUNDS = 2 or 3 */
-                               if (sign) {
-                                       dval(&rv) = -dval(&rv);
-                                       sign = 0;
-                                       }
-#endif
-                               e -= i;
-                               dval(&rv) *= tens[i];
-#ifdef VAX
-                               /* VAX exponent range is so narrow we must
-                                * worry about overflow here...
-                                */
- vax_ovfl_check:
-                               word0(&rv) -= P*Exp_msk1;
-                               /* rv = */ rounded_product(dval(&rv), tens[e]);
-                               if ((word0(&rv) & Exp_mask)
-                                > Exp_msk1*(DBL_MAX_EXP+Bias-1-P))
-                                       goto ovfl;
-                               word0(&rv) += P*Exp_msk1;
-#else
-                               /* rv = */ rounded_product(dval(&rv), tens[e]);
-#endif
-                               goto ret;
-                               }
-                       }
-#ifndef Inaccurate_Divide
-               else if (e >= -Ten_pmax) {
-#ifdef Honor_FLT_ROUNDS
-                       /* round correctly FLT_ROUNDS = 2 or 3 */
-                       if (sign) {
-                               dval(&rv) = -dval(&rv);
-                               sign = 0;
-                               }
-#endif
-                       /* rv = */ rounded_quotient(dval(&rv), tens[-e]);
-                       goto ret;
-                       }
-#endif
-               }
-       e1 += nd - k;
-
-#ifdef IEEE_Arith
-#ifdef SET_INEXACT
-       inexact = 1;
-       if (k <= DBL_DIG)
-               oldinexact = get_inexact();
-#endif
-#ifdef Avoid_Underflow
-       scale = 0;
-#endif
-#ifdef Honor_FLT_ROUNDS
-       if (Rounding >= 2) {
-               if (sign)
-                       Rounding = Rounding == 2 ? 0 : 2;
-               else
-                       if (Rounding != 2)
-                               Rounding = 0;
-               }
-#endif
-#endif /*IEEE_Arith*/
-
-       /* Get starting approximation = rv * 10**e1 */
-
-       if (e1 > 0) {
-               if ( (i = e1 & 15) !=0)
-                       dval(&rv) *= tens[i];
-               if (e1 &= ~15) {
-                       if (e1 > DBL_MAX_10_EXP) {
- ovfl:
-#ifndef NO_ERRNO
-                               errno = ERANGE;
-#endif
-                               /* Can't trust HUGE_VAL */
-#ifdef IEEE_Arith
-#ifdef Honor_FLT_ROUNDS
-                               switch(Rounding) {
-                                 case 0: /* toward 0 */
-                                 case 3: /* toward -infinity */
-                                       word0(&rv) = Big0;
-                                       word1(&rv) = Big1;
-                                       break;
-                                 default:
-                                       word0(&rv) = Exp_mask;
-                                       word1(&rv) = 0;
-                                 }
-#else /*Honor_FLT_ROUNDS*/
-                               word0(&rv) = Exp_mask;
-                               word1(&rv) = 0;
-#endif /*Honor_FLT_ROUNDS*/
-#ifdef SET_INEXACT
-                               /* set overflow bit */
-                               dval(&rv0) = 1e300;
-                               dval(&rv0) *= dval(&rv0);
-#endif
-#else /*IEEE_Arith*/
-                               word0(&rv) = Big0;
-                               word1(&rv) = Big1;
-#endif /*IEEE_Arith*/
-                               if (bd0)
-                                       goto retfree;
-                               goto ret;
-                               }
-                       e1 >>= 4;
-                       for(j = 0; e1 > 1; j++, e1 >>= 1)
-                               if (e1 & 1)
-                                       dval(&rv) *= bigtens[j];
-               /* The last multiplication could overflow. */
-                       word0(&rv) -= P*Exp_msk1;
-                       dval(&rv) *= bigtens[j];
-                       if ((z = word0(&rv) & Exp_mask)
-                        > Exp_msk1*(DBL_MAX_EXP+Bias-P))
-                               goto ovfl;
-                       if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) {
-                               /* set to largest number */
-                               /* (Can't trust DBL_MAX) */
-                               word0(&rv) = Big0;
-                               word1(&rv) = Big1;
-                               }
-                       else
-                               word0(&rv) += P*Exp_msk1;
-                       }
-               }
-       else if (e1 < 0) {
-               e1 = -e1;
-               if ( (i = e1 & 15) !=0)
-                       dval(&rv) /= tens[i];
-               if (e1 >>= 4) {
-                       if (e1 >= 1 << n_bigtens)
-                               goto undfl;
-#ifdef Avoid_Underflow
-                       if (e1 & Scale_Bit)
-                               scale = 2*P;
-                       for(j = 0; e1 > 0; j++, e1 >>= 1)
-                               if (e1 & 1)
-                                       dval(&rv) *= tinytens[j];
-                       if (scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask)
-                                               >> Exp_shift)) > 0) {
-                               /* scaled rv is denormal; zap j low bits */
-                               if (j >= 32) {
-                                       word1(&rv) = 0;
-                                       if (j >= 53)
-                                        word0(&rv) = (P+2)*Exp_msk1;
-                                       else
-                                        word0(&rv) &= 0xffffffff << (j-32);
-                                       }
-                               else
-                                       word1(&rv) &= 0xffffffff << j;
-                               }
-#else
-                       for(j = 0; e1 > 1; j++, e1 >>= 1)
-                               if (e1 & 1)
-                                       dval(&rv) *= tinytens[j];
-                       /* The last multiplication could underflow. */
-                       dval(&rv0) = dval(&rv);
-                       dval(&rv) *= tinytens[j];
-                       if (!dval(&rv)) {
-                               dval(&rv) = 2.*dval(&rv0);
-                               dval(&rv) *= tinytens[j];
-#endif
-                               if (!dval(&rv)) {
- undfl:
-                                       dval(&rv) = 0.;
-#ifndef NO_ERRNO
-                                       errno = ERANGE;
-#endif
-                                       if (bd0)
-                                               goto retfree;
-                                       goto ret;
-                                       }
-#ifndef Avoid_Underflow
-                               word0(&rv) = Tiny0;
-                               word1(&rv) = Tiny1;
-                               /* The refinement below will clean
-                                * this approximation up.
-                                */
-                               }
-#endif
-                       }
-               }
-
-       /* Now the hard part -- adjusting rv to the correct value.*/
-
-       /* Put digits into bd: true value = bd * 10^e */
-
-       bd0 = s2b(s0, nd0, nd, y, dplen);
-
-       for(;;) {
-               bd = Balloc(bd0->k);
-               Bcopy(bd, bd0);
-               bb = d2b(dval(&rv), &bbe, &bbbits);     /* rv = bb * 2^bbe */
-               bs = i2b(1);
-
-               if (e >= 0) {
-                       bb2 = bb5 = 0;
-                       bd2 = bd5 = e;
-                       }
-               else {
-                       bb2 = bb5 = -e;
-                       bd2 = bd5 = 0;
-                       }
-               if (bbe >= 0)
-                       bb2 += bbe;
-               else
-                       bd2 -= bbe;
-               bs2 = bb2;
-#ifdef Honor_FLT_ROUNDS
-               if (Rounding != 1)
-                       bs2++;
-#endif
-#ifdef Avoid_Underflow
-               j = bbe - scale;
-               i = j + bbbits - 1;     /* logb(&rv) */
-               if (i < Emin)   /* denormal */
-                       j += P - Emin;
-               else
-                       j = P + 1 - bbbits;
-#else /*Avoid_Underflow*/
-#ifdef Sudden_Underflow
-#ifdef IBM
-               j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3);
-#else
-               j = P + 1 - bbbits;
-#endif
-#else /*Sudden_Underflow*/
-               j = bbe;
-               i = j + bbbits - 1;     /* logb(&rv) */
-               if (i < Emin)   /* denormal */
-                       j += P - Emin;
-               else
-                       j = P + 1 - bbbits;
-#endif /*Sudden_Underflow*/
-#endif /*Avoid_Underflow*/
-               bb2 += j;
-               bd2 += j;
-#ifdef Avoid_Underflow
-               bd2 += scale;
-#endif
-               i = bb2 < bd2 ? bb2 : bd2;
-               if (i > bs2)
-                       i = bs2;
-               if (i > 0) {
-                       bb2 -= i;
-                       bd2 -= i;
-                       bs2 -= i;
-                       }
-               if (bb5 > 0) {
-                       bs = pow5mult(bs, bb5);
-                       bb1 = mult(bs, bb);
-                       Bfree(bb);
-                       bb = bb1;
-                       }
-               if (bb2 > 0)
-                       bb = lshift(bb, bb2);
-               if (bd5 > 0)
-                       bd = pow5mult(bd, bd5);
-               if (bd2 > 0)
-                       bd = lshift(bd, bd2);
-               if (bs2 > 0)
-                       bs = lshift(bs, bs2);
-               delta = diff(bb, bd);
-               dsign = delta->sign;
-               delta->sign = 0;
-               i = cmp(delta, bs);
-#ifdef Honor_FLT_ROUNDS
-               if (Rounding != 1) {
-                       if (i < 0) {
-                               /* Error is less than an ulp */
-                               if (!delta->x[0] && delta->wds <= 1) {
-                                       /* exact */
-#ifdef SET_INEXACT
-                                       inexact = 0;
-#endif
-                                       break;
-                                       }
-                               if (Rounding) {
-                                       if (dsign) {
-                                               dval(&adj) = 1.;
-                                               goto apply_adj;
-                                               }
-                                       }
-                               else if (!dsign) {
-                                       dval(&adj) = -1.;
-                                       if (!word1(&rv)
-                                        && !(word0(&rv) & Frac_mask)) {
-                                               y = word0(&rv) & Exp_mask;
-#ifdef Avoid_Underflow
-                                               if (!scale || y > 2*P*Exp_msk1)
-#else
-                                               if (y)
-#endif
-                                                 {
-                                                 delta = lshift(delta,Log2P);
-                                                 if (cmp(delta, bs) <= 0)
-                                                       dval(&adj) = -0.5;
-                                                 }
-                                               }
- apply_adj:
-#ifdef Avoid_Underflow
-                                       if (scale && (y = word0(&rv) & Exp_mask)
-                                               <= 2*P*Exp_msk1)
-                                         word0(&adj) += (2*P+1)*Exp_msk1 - y;
-#else
-#ifdef Sudden_Underflow
-                                       if ((word0(&rv) & Exp_mask) <=
-                                                       P*Exp_msk1) {
-                                               word0(&rv) += P*Exp_msk1;
-                                               dval(&rv) += adj*ulp(&rv);
-                                               word0(&rv) -= P*Exp_msk1;
-                                               }
-                                       else
-#endif /*Sudden_Underflow*/
-#endif /*Avoid_Underflow*/
-                                       dval(&rv) += dval(&adj)*ulp(&rv);
-                                       }
-                               break;
-                               }
-                       dval(&adj) = ratio(delta, bs);
-                       if (dval(&adj) < 1.)
-                               dval(&adj) = 1.;
-                       if (dval(&adj) <= 0x7ffffffe) {
-                               /* dval(&adj) = Rounding ? ceil(&adj) : floor(&adj); */
-                               y = dval(&adj);
-                               if (y != dval(&adj)) {
-                                       if (!((Rounding>>1) ^ dsign))
-                                               y++;
-                                       dval(&adj) = y;
-                                       }
-                               }
-#ifdef Avoid_Underflow
-                       if (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
-                               word0(&adj) += (2*P+1)*Exp_msk1 - y;
-#else
-#ifdef Sudden_Underflow
-                       if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) {
-                               word0(&rv) += P*Exp_msk1;
-                               dval(&adj) *= ulp(&rv);
-                               if (dsign)
-                                       dval(&rv) += adj;
-                               else
-                                       dval(&rv) -= adj;
-                               word0(&rv) -= P*Exp_msk1;
-                               goto cont;
-                               }
-#endif /*Sudden_Underflow*/
-#endif /*Avoid_Underflow*/
-                       dval(&adj) *= ulp(&rv);
-                       if (dsign) {
-                               if (word0(&rv) == Big0 && word1(&rv) == Big1)
-                                       goto ovfl;
-                               dval(&rv) += dval(&adj);
-                               }
-                       else
-                               dval(&rv) -= dval(&adj);
-                       goto cont;
-                       }
-#endif /*Honor_FLT_ROUNDS*/
-
-               if (i < 0) {
-                       /* Error is less than half an ulp -- check for
-                        * special case of mantissa a power of two.
-                        */
-                       if (dsign || word1(&rv) || word0(&rv) & Bndry_mask
-#ifdef IEEE_Arith
-#ifdef Avoid_Underflow
-                        || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1
-#else
-                        || (word0(&rv) & Exp_mask) <= Exp_msk1
-#endif
-#endif
-                               ) {
-#ifdef SET_INEXACT
-                               if (!delta->x[0] && delta->wds <= 1)
-                                       inexact = 0;
-#endif
-                               break;
-                               }
-                       if (!delta->x[0] && delta->wds <= 1) {
-                               /* exact result */
-#ifdef SET_INEXACT
-                               inexact = 0;
-#endif
-                               break;
-                               }
-                       delta = lshift(delta,Log2P);
-                       if (cmp(delta, bs) > 0)
-                               goto drop_down;
-                       break;
-                       }
-               if (i == 0) {
-                       /* exactly half-way between */
-                       if (dsign) {
-                               if ((word0(&rv) & Bndry_mask1) == Bndry_mask1
-                                &&  word1(&rv) == (
-#ifdef Avoid_Underflow
-                       (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
-               ? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) :
-#endif
-                                                  0xffffffff)) {
-                                       /*boundary case -- increment exponent*/
-                                       word0(&rv) = (word0(&rv) & Exp_mask)
-                                               + Exp_msk1
-#ifdef IBM
-                                               | Exp_msk1 >> 4
-#endif
-                                               ;
-                                       word1(&rv) = 0;
-#ifdef Avoid_Underflow
-                                       dsign = 0;
-#endif
-                                       break;
-                                       }
-                               }
-                       else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) {
- drop_down:
-                               /* boundary case -- decrement exponent */
-#ifdef Sudden_Underflow /*{{*/
-                               L = word0(&rv) & Exp_mask;
-#ifdef IBM
-                               if (L <  Exp_msk1)
-#else
-#ifdef Avoid_Underflow
-                               if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1))
-#else
-                               if (L <= Exp_msk1)
-#endif /*Avoid_Underflow*/
-#endif /*IBM*/
-                                       goto undfl;
-                               L -= Exp_msk1;
-#else /*Sudden_Underflow}{*/
-#ifdef Avoid_Underflow
-                               if (scale) {
-                                       L = word0(&rv) & Exp_mask;
-                                       if (L <= (2*P+1)*Exp_msk1) {
-                                               if (L > (P+2)*Exp_msk1)
-                                                       /* round even ==> */
-                                                       /* accept rv */
-                                                       break;
-                                               /* rv = smallest denormal */
-                                               goto undfl;
-                                               }
-                                       }
-#endif /*Avoid_Underflow*/
-                               L = (word0(&rv) & Exp_mask) - Exp_msk1;
-#endif /*Sudden_Underflow}}*/
-                               word0(&rv) = L | Bndry_mask1;
-                               word1(&rv) = 0xffffffff;
-#ifdef IBM
-                               goto cont;
-#else
-                               break;
-#endif
-                               }
-#ifndef ROUND_BIASED
-                       if (!(word1(&rv) & LSB))
-                               break;
-#endif
-                       if (dsign)
-                               dval(&rv) += ulp(&rv);
-#ifndef ROUND_BIASED
-                       else {
-                               dval(&rv) -= ulp(&rv);
-#ifndef Sudden_Underflow
-                               if (!dval(&rv))
-                                       goto undfl;
-#endif
-                               }
-#ifdef Avoid_Underflow
-                       dsign = 1 - dsign;
-#endif
-#endif
-                       break;
-                       }
-               if ((aadj = ratio(delta, bs)) <= 2.) {
-                       if (dsign)
-                               aadj = dval(&aadj1) = 1.;
-                       else if (word1(&rv) || word0(&rv) & Bndry_mask) {
-#ifndef Sudden_Underflow
-                               if (word1(&rv) == Tiny1 && !word0(&rv))
-                                       goto undfl;
-#endif
-                               aadj = 1.;
-                               dval(&aadj1) = -1.;
-                               }
-                       else {
-                               /* special case -- power of FLT_RADIX to be */
-                               /* rounded down... */
-
-                               if (aadj < 2./FLT_RADIX)
-                                       aadj = 1./FLT_RADIX;
-                               else
-                                       aadj *= 0.5;
-                               dval(&aadj1) = -aadj;
-                               }
-                       }
-               else {
-                       aadj *= 0.5;
-                       dval(&aadj1) = dsign ? aadj : -aadj;
-#ifdef Check_FLT_ROUNDS
-                       switch(Rounding) {
-                               case 2: /* towards +infinity */
-                                       dval(&aadj1) -= 0.5;
-                                       break;
-                               case 0: /* towards 0 */
-                               case 3: /* towards -infinity */
-                                       dval(&aadj1) += 0.5;
-                               }
-#else
-                       if (Flt_Rounds == 0)
-                               dval(&aadj1) += 0.5;
-#endif /*Check_FLT_ROUNDS*/
-                       }
-               y = word0(&rv) & Exp_mask;
-
-               /* Check for overflow */
-
-               if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) {
-                       dval(&rv0) = dval(&rv);
-                       word0(&rv) -= P*Exp_msk1;
-                       dval(&adj) = dval(&aadj1) * ulp(&rv);
-                       dval(&rv) += dval(&adj);
-                       if ((word0(&rv) & Exp_mask) >=
-                                       Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
-                               if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
-                                       goto ovfl;
-                               word0(&rv) = Big0;
-                               word1(&rv) = Big1;
-                               goto cont;
-                               }
-                       else
-                               word0(&rv) += P*Exp_msk1;
-                       }
-               else {
-#ifdef Avoid_Underflow
-                       if (scale && y <= 2*P*Exp_msk1) {
-                               if (aadj <= 0x7fffffff) {
-                                       if ((z = aadj) <= 0)
-                                               z = 1;
-                                       aadj = z;
-                                       dval(&aadj1) = dsign ? aadj : -aadj;
-                                       }
-                               word0(&aadj1) += (2*P+1)*Exp_msk1 - y;
-                               }
-                       dval(&adj) = dval(&aadj1) * ulp(&rv);
-                       dval(&rv) += dval(&adj);
-#else
-#ifdef Sudden_Underflow
-                       if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) {
-                               dval(&rv0) = dval(&rv);
-                               word0(&rv) += P*Exp_msk1;
-                               dval(&adj) = dval(&aadj1) * ulp(&rv);
-                               dval(&rv) += adj;
-#ifdef IBM
-                               if ((word0(&rv) & Exp_mask) <  P*Exp_msk1)
-#else
-                               if ((word0(&rv) & Exp_mask) <= P*Exp_msk1)
-#endif
-                                       {
-                                       if (word0(&rv0) == Tiny0
-                                        && word1(&rv0) == Tiny1)
-                                               goto undfl;
-                                       word0(&rv) = Tiny0;
-                                       word1(&rv) = Tiny1;
-                                       goto cont;
-                                       }
-                               else
-                                       word0(&rv) -= P*Exp_msk1;
-                               }
-                       else {
-                               dval(&adj) = dval(&aadj1) * ulp(&rv);
-                               dval(&rv) += adj;
-                               }
-#else /*Sudden_Underflow*/
-                       /* Compute dval(&adj) so that the IEEE rounding rules will
-                        * correctly round rv + dval(&adj) in some half-way cases.
-                        * If rv * ulp(&rv) is denormalized (i.e.,
-                        * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid
-                        * trouble from bits lost to denormalization;
-                        * example: 1.2e-307 .
-                        */
-                       if (y <= (P-1)*Exp_msk1 && aadj > 1.) {
-                               dval(&aadj1) = (double)(int)(aadj + 0.5);
-                               if (!dsign)
-                                       dval(&aadj1) = -dval(&aadj1);
-                               }
-                       dval(&adj) = dval(&aadj1) * ulp(&rv);
-                       dval(&rv) += adj;
-#endif /*Sudden_Underflow*/
-#endif /*Avoid_Underflow*/
-                       }
-               z = word0(&rv) & Exp_mask;
-#ifndef SET_INEXACT
-#ifdef Avoid_Underflow
-               if (!scale)
-#endif
-               if (y == z) {
-                       /* Can we stop now? */
-                       L = (Long)aadj;
-                       aadj -= L;
-                       /* The tolerances below are conservative. */
-                       if (dsign || word1(&rv) || word0(&rv) & Bndry_mask) {
-                               if (aadj < .4999999 || aadj > .5000001)
-                                       break;
-                               }
-                       else if (aadj < .4999999/FLT_RADIX)
-                               break;
-                       }
-#endif
- cont:
-               Bfree(bb);
-               Bfree(bd);
-               Bfree(bs);
-               Bfree(delta);
-               }
-#ifdef SET_INEXACT
-       if (inexact) {
-               if (!oldinexact) {
-                       word0(&rv0) = Exp_1 + (70 << Exp_shift);
-                       word1(&rv0) = 0;
-                       dval(&rv0) += 1.;
-                       }
-               }
-       else if (!oldinexact)
-               clear_inexact();
-#endif
-#ifdef Avoid_Underflow
-       if (scale) {
-               word0(&rv0) = Exp_1 - 2*P*Exp_msk1;
-               word1(&rv0) = 0;
-               dval(&rv) *= dval(&rv0);
-#ifndef NO_ERRNO
-               /* try to avoid the bug of testing an 8087 register value */
-#if defined(IEEE_Arith) && __DARWIN_UNIX03
-               if (!(word0(&rv) & Exp_mask))
-#else
-               if (word0(&rv) == 0 && word1(&rv) == 0)
-#endif
-                       errno = ERANGE;
-#endif
-               }
-#endif /* Avoid_Underflow */
-#ifdef SET_INEXACT
-       if (inexact && !(word0(&rv) & Exp_mask)) {
-               /* set underflow bit */
-               dval(&rv0) = 1e-300;
-               dval(&rv0) *= dval(&rv0);
-               }
-#endif
- retfree:
-       Bfree(bb);
-       Bfree(bd);
-       Bfree(bs);
-       Bfree(bd0);
-       Bfree(delta);
- ret:
-       if (se)
-               *se = (char *)s;
-       if (strunc)
-#ifdef FREE
-               FREE(strunc);
-#else
-               free(strunc);
-#endif
-       return sign ? -dval(&rv) : dval(&rv);
-       }
-
- double
-strtod
-#ifdef KR_headers
-       (s00, se) CONST char *s00; char **se;
-#else
-       (CONST char *s00, char **se)
-#endif
-{
-       return strtod_l(s00, se, __current_locale());
-}
diff --git a/gdtoa/gdtoa-strtodg-fbsd.c b/gdtoa/gdtoa-strtodg-fbsd.c
deleted file mode 100644 (file)
index e1acc54..0000000
+++ /dev/null
@@ -1,1096 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998-2001 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
-#ifdef USE_LOCALE
-#include "locale.h"
-#endif
-
-#define fivesbits __fivesbits_D2A
-#define all_on __all_on_D2A
-#define set_ones __set_ones_D2A
-#define rvOK __rvOK_D2A
-#define mantbits __mantbits_D2A
-
-#ifdef BUILDING_VARIANT
-extern CONST int fivesbits[];
-int all_on(Bigint *b, int n);
-Bigint *set_ones(Bigint *b, int n);
-int rvOK(U *d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv);
-int mantbits(U *d);
-#else /* !BUILDING_VARIANT */
-
- __private_extern__ CONST int
-fivesbits[] = {         0,  3,  5,  7, 10, 12, 14, 17, 19, 21,
-               24, 26, 28, 31, 33, 35, 38, 40, 42, 45,
-               47, 49, 52
-#ifdef VAX
-               , 54, 56
-#endif
-               };
-
- Bigint *
-#ifdef KR_headers
-increment(b) Bigint *b;
-#else
-increment(Bigint *b)
-#endif
-{
-       ULong *x, *xe;
-       Bigint *b1;
-#ifdef Pack_16
-       ULong carry = 1, y;
-#endif
-
-       x = b->x;
-       xe = x + b->wds;
-#ifdef Pack_32
-       do {
-               if (*x < (ULong)0xffffffffL) {
-                       ++*x;
-                       return b;
-                       }
-               *x++ = 0;
-               } while(x < xe);
-#else
-       do {
-               y = *x + carry;
-               carry = y >> 16;
-               *x++ = y & 0xffff;
-               if (!carry)
-                       return b;
-               } while(x < xe);
-       if (carry)
-#endif
-       {
-               if (b->wds >= b->maxwds) {
-                       b1 = Balloc(b->k+1);
-                       Bcopy(b1,b);
-                       Bfree(b);
-                       b = b1;
-                       }
-               b->x[b->wds++] = 1;
-               }
-       return b;
-       }
-
- void
-#ifdef KR_headers
-decrement(b) Bigint *b;
-#else
-decrement(Bigint *b)
-#endif
-{
-       ULong *x, *xe;
-#ifdef Pack_16
-       ULong borrow = 1, y;
-#endif
-
-       x = b->x;
-       xe = x + b->wds;
-#ifdef Pack_32
-       do {
-               if (*x) {
-                       --*x;
-                       break;
-                       }
-               *x++ = 0xffffffffL;
-               }
-               while(x < xe);
-#else
-       do {
-               y = *x - borrow;
-               borrow = (y & 0x10000) >> 16;
-               *x++ = y & 0xffff;
-               } while(borrow && x < xe);
-#endif
-       }
-
- __private_extern__ int
-#ifdef KR_headers
-all_on(b, n) Bigint *b; int n;
-#else
-all_on(Bigint *b, int n)
-#endif
-{
-       ULong *x, *xe;
-
-       x = b->x;
-       xe = x + (n >> kshift);
-       while(x < xe)
-               if ((*x++ & ALL_ON) != ALL_ON)
-                       return 0;
-       if (n &= kmask)
-               return ((*x | (ALL_ON << n)) & ALL_ON) == ALL_ON;
-       return 1;
-       }
-
- Bigint *
-#ifdef KR_headers
-set_ones(b, n) Bigint *b; int n;
-#else
-set_ones(Bigint *b, int n)
-#endif
-{
-       int k;
-       ULong *x, *xe;
-
-       k = (n + ((1 << kshift) - 1)) >> kshift;
-       if (b->k < k) {
-               Bfree(b);
-               b = Balloc(k);
-               }
-       k = n >> kshift;
-       if (n &= kmask)
-               k++;
-       b->wds = k;
-       x = b->x;
-       xe = x + k;
-       while(x < xe)
-               *x++ = ALL_ON;
-       if (n)
-               x[-1] >>= ULbits - n;
-       return b;
-       }
-
- __private_extern__ int
-rvOK
-#ifdef KR_headers
- (d, fpi, exp, bits, exact, rd, irv)
- U *d; FPI *fpi; Long *exp; ULong *bits; int exact, rd, *irv;
-#else
- (U *d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv)
-#endif
-{
-       Bigint *b;
-       ULong carry, inex, lostbits;
-       int bdif, e, j, k, k1, nb, rv;
-
-       carry = rv = 0;
-       b = d2b(dval(d), &e, &bdif);
-       bdif -= nb = fpi->nbits;
-       e += bdif;
-       if (bdif <= 0) {
-               if (exact)
-                       goto trunc;
-               goto ret;
-               }
-       if (P == nb) {
-               if (
-#ifndef IMPRECISE_INEXACT
-                       exact &&
-#endif
-                       fpi->rounding ==
-#ifdef RND_PRODQUOT
-                                       FPI_Round_near
-#else
-                                       Flt_Rounds
-#endif
-                       ) goto trunc;
-               goto ret;
-               }
-       switch(rd) {
-         case 1: /* round down (toward -Infinity) */
-               goto trunc;
-         case 2: /* round up (toward +Infinity) */
-               break;
-         default: /* round near */
-               k = bdif - 1;
-               if (k < 0)
-                       goto trunc;
-               if (!k) {
-                       if (!exact)
-                               goto ret;
-                       if (b->x[0] & 2)
-                               break;
-                       goto trunc;
-                       }
-               if (b->x[k>>kshift] & ((ULong)1 << (k & kmask)))
-                       break;
-               goto trunc;
-         }
-       /* "break" cases: round up 1 bit, then truncate; bdif > 0 */
-       carry = 1;
- trunc:
-       inex = lostbits = 0;
-       if (bdif > 0) {
-               if ( (lostbits = any_on(b, bdif)) !=0)
-                       inex = STRTOG_Inexlo;
-               rshift(b, bdif);
-               if (carry) {
-                       inex = STRTOG_Inexhi;
-                       b = increment(b);
-                       if ( (j = nb & kmask) !=0)
-                               j = ULbits - j;
-                       if (hi0bits(b->x[b->wds - 1]) != j) {
-                               if (!lostbits)
-                                       lostbits = b->x[0] & 1;
-                               rshift(b, 1);
-                               e++;
-                               }
-                       }
-               }
-       else if (bdif < 0)
-               b = lshift(b, -bdif);
-       if (e < fpi->emin) {
-               k = fpi->emin - e;
-               e = fpi->emin;
-               if (k > nb || fpi->sudden_underflow) {
-                       b->wds = inex = 0;
-                       *irv = STRTOG_Underflow | STRTOG_Inexlo;
-                       }
-               else {
-                       k1 = k - 1;
-                       if (k1 > 0 && !lostbits)
-                               lostbits = any_on(b, k1);
-                       if (!lostbits && !exact)
-                               goto ret;
-                       lostbits |=
-                         carry = b->x[k1>>kshift] & (1 << (k1 & kmask));
-                       rshift(b, k);
-                       *irv = STRTOG_Denormal;
-                       if (carry) {
-                               b = increment(b);
-                               inex = STRTOG_Inexhi | STRTOG_Underflow;
-                               }
-                       else if (lostbits)
-                               inex = STRTOG_Inexlo | STRTOG_Underflow;
-                       }
-               }
-       else if (e > fpi->emax) {
-               e = fpi->emax + 1;
-               *irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
-#ifndef NO_ERRNO
-               errno = ERANGE;
-#endif
-               b->wds = inex = 0;
-               }
-       *exp = e;
-       copybits(bits, nb, b);
-       *irv |= inex;
-       rv = 1;
- ret:
-       Bfree(b);
-       return rv;
-       }
-
- __private_extern__ int
-#ifdef KR_headers
-mantbits(d) U *d;
-#else
-mantbits(U *d)
-#endif
-{
-       ULong L;
-#ifdef VAX
-       L = word1(d) << 16 | word1(d) >> 16;
-       if (L)
-#else
-       if ( (L = word1(d)) !=0)
-#endif
-               return P - lo0bits(&L);
-#ifdef VAX
-       L = word0(d) << 16 | word0(d) >> 16 | Exp_msk11;
-#else
-       L = word0(d) | Exp_msk1;
-#endif
-       return P - 32 - lo0bits(&L);
-       }
-
-#endif /* BUILDING_VARIANT */
-
- int
-strtodg
-#ifdef KR_headers
-       (s00, se, fpi, exp, bits, loc)
-       CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; locale_t loc;
-#else
-       (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits, locale_t loc)
-#endif
-{
-       int abe, abits, asub;
-       int bb0, bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, denorm;
-       int dsign, e, e1, e2, emin, esign, finished, i, inex, irv;
-       int j, k, nbits, nd, nd0, nf, nz, nz0, rd, rvbits, rve, rve1, sign;
-       int sudden_underflow;
-       CONST char *s, *s0, *s1;
-       char *strunc = NULL;
-       double adj0, tol;
-       Long L;
-       U adj, rv;
-       ULong *b, *be, y, z;
-       Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
-#ifdef USE_LOCALE /*{{*/
-       NORMALIZE_LOCALE(loc);
-#ifdef NO_LOCALE_CACHE
-       char *decimalpoint = localeconv_l(loc)->decimal_point;
-       int dplen = strlen(decimalpoint);
-#else
-       char *decimalpoint;
-       static char *decimalpoint_cache;
-       static int dplen;
-       if (!(s0 = decimalpoint_cache)) {
-               s0 = localeconv_l(loc)->decimal_point;
-               if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-                       strcpy(decimalpoint_cache, s0);
-                       s0 = decimalpoint_cache;
-                       }
-               dplen = strlen(s0);
-               }
-       decimalpoint = (char*)s0;
-#endif /*NO_LOCALE_CACHE*/
-#else  /*USE_LOCALE}{*/
-#define dplen 1
-#endif /*USE_LOCALE}}*/
-
-       irv = STRTOG_Zero;
-       denorm = sign = nz0 = nz = 0;
-       dval(&rv) = 0.;
-       rvb = 0;
-       nbits = fpi->nbits;
-       for(s = s00;;s++) switch(*s) {
-               case '-':
-                       sign = 1;
-                       /* no break */
-               case '+':
-                       if (*++s)
-                               goto break2;
-                       /* no break */
-               case 0:
-                       sign = 0;
-                       irv = STRTOG_NoNumber;
-                       s = s00;
-                       goto ret;
-               case '\t':
-               case '\n':
-               case '\v':
-               case '\f':
-               case '\r':
-               case ' ':
-                       continue;
-               default:
-                       goto break2;
-               }
- break2:
-       if (*s == '0') {
-#ifndef NO_HEX_FP
-               switch(s[1]) {
-                 case 'x':
-                 case 'X':
-                       irv = gethex(&s, fpi, exp, &rvb, sign, loc);
-                       if (irv == STRTOG_NoNumber) {
-                               s = s00;
-                               sign = 0;
-                               }
-                       goto ret;
-                 }
-#endif
-               nz0 = 1;
-               while(*++s == '0') ;
-               if (!*s)
-                       goto ret;
-               }
-       sudden_underflow = fpi->sudden_underflow;
-       s0 = s;
-       y = z = 0;
-       for(decpt = nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
-               if (nd < 9)
-                       y = 10*y + c - '0';
-               else if (nd < 16)
-                       z = 10*z + c - '0';
-       nd0 = nd;
-#ifdef USE_LOCALE
-       if (c == *decimalpoint) {
-               for(i = 1; decimalpoint[i]; ++i)
-                       if (s[i] != decimalpoint[i])
-                               goto dig_done;
-               s += i;
-               c = *s;
-#else
-       if (c == '.') {
-               c = *++s;
-#endif
-               decpt = 1;
-               if (!nd) {
-                       for(; c == '0'; c = *++s)
-                               nz++;
-                       if (c > '0' && c <= '9') {
-                               s0 = s;
-                               nf += nz;
-                               nz = 0;
-                               goto have_dig;
-                               }
-                       goto dig_done;
-                       }
-               for(; c >= '0' && c <= '9'; c = *++s) {
- have_dig:
-                       nz++;
-                       if (c -= '0') {
-                               nf += nz;
-                               for(i = 1; i < nz; i++)
-                                       if (nd++ < 9)
-                                               y *= 10;
-                                       else if (nd <= DBL_DIG + 1)
-                                               z *= 10;
-                               if (nd++ < 9)
-                                       y = 10*y + c;
-                               else if (nd <= DBL_DIG + 1)
-                                       z = 10*z + c;
-                               nz = 0;
-                               }
-                       }
-               }/*}*/
- dig_done:
-       e = 0;
-       if (c == 'e' || c == 'E') {
-               if (!nd && !nz && !nz0) {
-                       irv = STRTOG_NoNumber;
-                       s = s00;
-                       goto ret;
-                       }
-               s00 = s;
-               esign = 0;
-               switch(c = *++s) {
-                       case '-':
-                               esign = 1;
-                       case '+':
-                               c = *++s;
-                       }
-               if (c >= '0' && c <= '9') {
-                       while(c == '0')
-                               c = *++s;
-                       if (c > '0' && c <= '9') {
-                               L = c - '0';
-                               s1 = s;
-                               while((c = *++s) >= '0' && c <= '9')
-                                       L = 10*L + c - '0';
-                               if (s - s1 > 8 || L > 19999)
-                                       /* Avoid confusion from exponents
-                                        * so large that e might overflow.
-                                        */
-                                       e = 19999; /* safe for 16 bit ints */
-                               else
-                                       e = (int)L;
-                               if (esign)
-                                       e = -e;
-                               }
-                       else
-                               e = 0;
-                       }
-               else
-                       s = s00;
-               }
-       if (!nd) {
-               if (!nz && !nz0) {
-#ifdef INFNAN_CHECK
-                       /* Check for Nan and Infinity */
-                       if (!decpt)
-                        switch(c) {
-                         case 'i':
-                         case 'I':
-                               if (match(&s,"nf")) {
-                                       --s;
-                                       if (!match(&s,"inity"))
-                                               ++s;
-                                       irv = STRTOG_Infinite;
-                                       goto infnanexp;
-                                       }
-                               break;
-                         case 'n':
-                         case 'N':
-                               if (match(&s, "an")) {
-                                       irv = STRTOG_NaN;
-                                       *exp = fpi->emax + 1;
-#ifndef No_Hex_NaN
-                                       if (*s == '(') /*)*/
-                                               irv = hexnan(&s, fpi, bits);
-#endif
-                                       goto infnanexp;
-                                       }
-                         }
-#endif /* INFNAN_CHECK */
-                       irv = STRTOG_NoNumber;
-                       s = s00;
-                       }
-               goto ret;
-               }
-       TRUNCATE_DIGITS(s0, strunc, nd, nd0, nf, fpi->nbits, fpi->emin, dplen);
-
-       irv = STRTOG_Normal;
-       e1 = e -= nf;
-       rd = 0;
-       switch(fpi->rounding & 3) {
-         case FPI_Round_up:
-               rd = 2 - sign;
-               break;
-         case FPI_Round_zero:
-               rd = 1;
-               break;
-         case FPI_Round_down:
-               rd = 1 + sign;
-         }
-
-       /* Now we have nd0 digits, starting at s0, followed by a
-        * decimal point, followed by nd-nd0 digits.  The number we're
-        * after is the integer represented by those digits times
-        * 10**e */
-
-       if (!nd0)
-               nd0 = nd;
-       k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1;
-       dval(&rv) = y;
-       if (k > 9)
-               dval(&rv) = tens[k - 9] * dval(&rv) + z;
-       bd0 = 0;
-       if (nbits <= P && nd <= DBL_DIG) {
-               if (!e) {
-                       if (rvOK(&rv, fpi, exp, bits, 1, rd, &irv))
-                               goto ret;
-                       }
-               else if (e > 0) {
-                       if (e <= Ten_pmax) {
-#ifdef VAX
-                               goto vax_ovfl_check;
-#else
-                               i = fivesbits[e] + mantbits(&rv) <= P;
-                               /* rv = */ rounded_product(dval(&rv), tens[e]);
-                               if (rvOK(&rv, fpi, exp, bits, i, rd, &irv))
-                                       goto ret;
-                               e1 -= e;
-                               goto rv_notOK;
-#endif
-                               }
-                       i = DBL_DIG - nd;
-                       if (e <= Ten_pmax + i) {
-                               /* A fancier test would sometimes let us do
-                                * this for larger i values.
-                                */
-                               e2 = e - i;
-                               e1 -= i;
-                               dval(&rv) *= tens[i];
-#ifdef VAX
-                               /* VAX exponent range is so narrow we must
-                                * worry about overflow here...
-                                */
- vax_ovfl_check:
-                               dval(&adj) = dval(&rv);
-                               word0(&adj) -= P*Exp_msk1;
-                               /* adj = */ rounded_product(dval(&adj), tens[e2]);
-                               if ((word0(&adj) & Exp_mask)
-                                > Exp_msk1*(DBL_MAX_EXP+Bias-1-P))
-                                       goto rv_notOK;
-                               word0(&adj) += P*Exp_msk1;
-                               dval(&rv) = dval(&adj);
-#else
-                               /* rv = */ rounded_product(dval(&rv), tens[e2]);
-#endif
-                               if (rvOK(&rv, fpi, exp, bits, 0, rd, &irv))
-                                       goto ret;
-                               e1 -= e2;
-                               }
-                       }
-#ifndef Inaccurate_Divide
-               else if (e >= -Ten_pmax) {
-                       /* rv = */ rounded_quotient(dval(&rv), tens[-e]);
-                       if (rvOK(&rv, fpi, exp, bits, 0, rd, &irv))
-                               goto ret;
-                       e1 -= e;
-                       }
-#endif
-               }
- rv_notOK:
-       e1 += nd - k;
-
-       /* Get starting approximation = rv * 10**e1 */
-
-       e2 = 0;
-       if (e1 > 0) {
-               if ( (i = e1 & 15) !=0)
-                       dval(&rv) *= tens[i];
-               if (e1 &= ~15) {
-                       e1 >>= 4;
-                       while(e1 >= (1 << (n_bigtens-1))) {
-                               e2 += ((word0(&rv) & Exp_mask)
-                                       >> Exp_shift1) - Bias;
-                               word0(&rv) &= ~Exp_mask;
-                               word0(&rv) |= Bias << Exp_shift1;
-                               dval(&rv) *= bigtens[n_bigtens-1];
-                               e1 -= 1 << (n_bigtens-1);
-                               }
-                       e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias;
-                       word0(&rv) &= ~Exp_mask;
-                       word0(&rv) |= Bias << Exp_shift1;
-                       for(j = 0; e1 > 0; j++, e1 >>= 1)
-                               if (e1 & 1)
-                                       dval(&rv) *= bigtens[j];
-                       }
-               }
-       else if (e1 < 0) {
-               e1 = -e1;
-               if ( (i = e1 & 15) !=0)
-                       dval(&rv) /= tens[i];
-               if (e1 &= ~15) {
-                       e1 >>= 4;
-                       while(e1 >= (1 << (n_bigtens-1))) {
-                               e2 += ((word0(&rv) & Exp_mask)
-                                       >> Exp_shift1) - Bias;
-                               word0(&rv) &= ~Exp_mask;
-                               word0(&rv) |= Bias << Exp_shift1;
-                               dval(&rv) *= tinytens[n_bigtens-1];
-                               e1 -= 1 << (n_bigtens-1);
-                               }
-                       e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias;
-                       word0(&rv) &= ~Exp_mask;
-                       word0(&rv) |= Bias << Exp_shift1;
-                       for(j = 0; e1 > 0; j++, e1 >>= 1)
-                               if (e1 & 1)
-                                       dval(&rv) *= tinytens[j];
-                       }
-               }
-#ifdef IBM
-       /* e2 is a correction to the (base 2) exponent of the return
-        * value, reflecting adjustments above to avoid overflow in the
-        * native arithmetic.  For native IBM (base 16) arithmetic, we
-        * must multiply e2 by 4 to change from base 16 to 2.
-        */
-       e2 <<= 2;
-#endif
-       rvb = d2b(dval(&rv), &rve, &rvbits);    /* rv = rvb * 2^rve */
-       rve += e2;
-       if ((j = rvbits - nbits) > 0) {
-               rshift(rvb, j);
-               rvbits = nbits;
-               rve += j;
-               }
-       bb0 = 0;        /* trailing zero bits in rvb */
-       e2 = rve + rvbits - nbits;
-       if (e2 > fpi->emax + 1)
-               goto huge;
-       rve1 = rve + rvbits - nbits;
-       if (e2 < (emin = fpi->emin)) {
-               denorm = 1;
-               j = rve - emin;
-               if (j > 0) {
-                       rvb = lshift(rvb, j);
-                       rvbits += j;
-                       }
-               else if (j < 0) {
-                       rvbits += j;
-                       if (rvbits <= 0) {
-                               if (rvbits < -1) {
- ufl:
-                                       rvb->wds = 0;
-                                       rvb->x[0] = 0;
-                                       *exp = emin;
-                                       irv = STRTOG_Underflow | STRTOG_Inexlo;
-/* When __DARWIN_UNIX03 is set, we don't need this (errno is set later) */
-#if !defined(NO_ERRNO) && !__DARWIN_UNIX03
-                                       errno = ERANGE;
-#endif
-                                       goto ret;
-                                       }
-                               rvb->x[0] = rvb->wds = rvbits = 1;
-                               }
-                       else
-                               rshift(rvb, -j);
-                       }
-               rve = rve1 = emin;
-               if (sudden_underflow && e2 + 1 < emin)
-                       goto ufl;
-               }
-
-       /* Now the hard part -- adjusting rv to the correct value.*/
-
-       /* Put digits into bd: true value = bd * 10^e */
-
-       bd0 = s2b(s0, nd0, nd, y, dplen);
-
-       for(;;) {
-               bd = Balloc(bd0->k);
-               Bcopy(bd, bd0);
-               bb = Balloc(rvb->k);
-               Bcopy(bb, rvb);
-               bbbits = rvbits - bb0;
-               bbe = rve + bb0;
-               bs = i2b(1);
-
-               if (e >= 0) {
-                       bb2 = bb5 = 0;
-                       bd2 = bd5 = e;
-                       }
-               else {
-                       bb2 = bb5 = -e;
-                       bd2 = bd5 = 0;
-                       }
-               if (bbe >= 0)
-                       bb2 += bbe;
-               else
-                       bd2 -= bbe;
-               bs2 = bb2;
-               j = nbits + 1 - bbbits;
-               i = bbe + bbbits - nbits;
-               if (i < emin)   /* denormal */
-                       j += i - emin;
-               bb2 += j;
-               bd2 += j;
-               i = bb2 < bd2 ? bb2 : bd2;
-               if (i > bs2)
-                       i = bs2;
-               if (i > 0) {
-                       bb2 -= i;
-                       bd2 -= i;
-                       bs2 -= i;
-                       }
-               if (bb5 > 0) {
-                       bs = pow5mult(bs, bb5);
-                       bb1 = mult(bs, bb);
-                       Bfree(bb);
-                       bb = bb1;
-                       }
-               bb2 -= bb0;
-               if (bb2 > 0)
-                       bb = lshift(bb, bb2);
-               else if (bb2 < 0)
-                       rshift(bb, -bb2);
-               if (bd5 > 0)
-                       bd = pow5mult(bd, bd5);
-               if (bd2 > 0)
-                       bd = lshift(bd, bd2);
-               if (bs2 > 0)
-                       bs = lshift(bs, bs2);
-               asub = 1;
-               inex = STRTOG_Inexhi;
-               delta = diff(bb, bd);
-               if (delta->wds <= 1 && !delta->x[0])
-                       break;
-               dsign = delta->sign;
-               delta->sign = finished = 0;
-               L = 0;
-               i = cmp(delta, bs);
-               if (rd && i <= 0) {
-                       irv = STRTOG_Normal;
-                       if ( (finished = dsign ^ (rd&1)) !=0) {
-                               if (dsign != 0) {
-                                       irv |= STRTOG_Inexhi;
-                                       goto adj1;
-                                       }
-                               irv |= STRTOG_Inexlo;
-                               if (rve1 == emin)
-                                       goto adj1;
-                               for(i = 0, j = nbits; j >= ULbits;
-                                               i++, j -= ULbits) {
-                                       if (rvb->x[i] & ALL_ON)
-                                               goto adj1;
-                                       }
-                               if (j > 1 && lo0bits(rvb->x + i) < j - 1)
-                                       goto adj1;
-                               rve = rve1 - 1;
-                               rvb = set_ones(rvb, rvbits = nbits);
-                               break;
-                               }
-                       irv |= dsign ? STRTOG_Inexlo : STRTOG_Inexhi;
-                       break;
-                       }
-               if (i < 0) {
-                       /* Error is less than half an ulp -- check for
-                        * special case of mantissa a power of two.
-                        */
-                       irv = dsign
-                               ? STRTOG_Normal | STRTOG_Inexlo
-                               : STRTOG_Normal | STRTOG_Inexhi;
-                       if (dsign || bbbits > 1 || denorm || rve1 == emin)
-                               break;
-                       delta = lshift(delta,1);
-                       if (cmp(delta, bs) > 0) {
-                               irv = STRTOG_Normal | STRTOG_Inexlo;
-                               goto drop_down;
-                               }
-                       break;
-                       }
-               if (i == 0) {
-                       /* exactly half-way between */
-                       if (dsign) {
-                               if (denorm && all_on(rvb, rvbits)) {
-                                       /*boundary case -- increment exponent*/
-                                       rvb->wds = 1;
-                                       rvb->x[0] = 1;
-                                       rve = emin + nbits - (rvbits = 1);
-                                       irv = STRTOG_Normal | STRTOG_Inexhi;
-                                       denorm = 0;
-                                       break;
-                                       }
-                               irv = STRTOG_Normal | STRTOG_Inexlo;
-                               }
-                       else if (bbbits == 1) {
-                               irv = STRTOG_Normal;
- drop_down:
-                               /* boundary case -- decrement exponent */
-                               if (rve1 == emin) {
-                                       irv = STRTOG_Normal | STRTOG_Inexhi;
-                                       if (rvb->wds == 1 && rvb->x[0] == 1)
-                                               sudden_underflow = 1;
-                                       break;
-                                       }
-                               rve -= nbits;
-                               rvb = set_ones(rvb, rvbits = nbits);
-                               break;
-                               }
-                       else
-                               irv = STRTOG_Normal | STRTOG_Inexhi;
-                       if ((bbbits < nbits && !denorm) || !(rvb->x[0] & 1))
-                               break;
-                       if (dsign) {
-                               rvb = increment(rvb);
-                               j = kmask & (ULbits - (rvbits & kmask));
-                               if (hi0bits(rvb->x[rvb->wds - 1]) != j)
-                                       rvbits++;
-                               irv = STRTOG_Normal | STRTOG_Inexhi;
-                               }
-                       else {
-                               if (bbbits == 1)
-                                       goto undfl;
-                               decrement(rvb);
-                               irv = STRTOG_Normal | STRTOG_Inexlo;
-                               }
-                       break;
-                       }
-               if ((dval(&adj) = ratio(delta, bs)) <= 2.) {
- adj1:
-                       inex = STRTOG_Inexlo;
-                       if (dsign) {
-                               asub = 0;
-                               inex = STRTOG_Inexhi;
-                               }
-                       else if (denorm && bbbits <= 1) {
- undfl:
-                               rvb->wds = 0;
-                               rve = emin;
-                               irv = STRTOG_Underflow | STRTOG_Inexlo;
-                               break;
-                               }
-                       adj0 = dval(&adj) = 1.;
-                       }
-               else {
-                       adj0 = dval(&adj) *= 0.5;
-                       if (dsign) {
-                               asub = 0;
-                               inex = STRTOG_Inexlo;
-                               }
-                       if (dval(&adj) < 2147483647.) {
-                               L = adj0;
-                               adj0 -= L;
-                               switch(rd) {
-                                 case 0:
-                                       if (adj0 >= .5)
-                                               goto inc_L;
-                                       break;
-                                 case 1:
-                                       if (asub && adj0 > 0.)
-                                               goto inc_L;
-                                       break;
-                                 case 2:
-                                       if (!asub && adj0 > 0.) {
- inc_L:
-                                               L++;
-                                               inex = STRTOG_Inexact - inex;
-                                               }
-                                 }
-                               dval(&adj) = L;
-                               }
-                       }
-               y = rve + rvbits;
-
-               /* adj *= ulp(dval(&rv)); */
-               /* if (asub) rv -= adj; else rv += adj; */
-
-               if (!denorm && rvbits < nbits) {
-                       rvb = lshift(rvb, j = nbits - rvbits);
-                       rve -= j;
-                       rvbits = nbits;
-                       }
-               ab = d2b(dval(&adj), &abe, &abits);
-               if (abe < 0)
-                       rshift(ab, -abe);
-               else if (abe > 0)
-                       ab = lshift(ab, abe);
-               rvb0 = rvb;
-               if (asub) {
-                       /* rv -= adj; */
-                       j = hi0bits(rvb->x[rvb->wds-1]);
-                       rvb = diff(rvb, ab);
-                       k = rvb0->wds - 1;
-                       if (denorm)
-                               /* do nothing */;
-                       else if (rvb->wds <= k
-                               || hi0bits( rvb->x[k]) >
-                                  hi0bits(rvb0->x[k])) {
-                               /* unlikely; can only have lost 1 high bit */
-                               if (rve1 == emin) {
-                                       --rvbits;
-                                       denorm = 1;
-                                       }
-                               else {
-                                       rvb = lshift(rvb, 1);
-                                       --rve;
-                                       --rve1;
-                                       L = finished = 0;
-                                       }
-                               }
-                       }
-               else {
-                       rvb = sum(rvb, ab);
-                       k = rvb->wds - 1;
-                       if (k >= rvb0->wds
-                        || hi0bits(rvb->x[k]) < hi0bits(rvb0->x[k])) {
-                               if (denorm) {
-                                       if (++rvbits == nbits)
-                                               denorm = 0;
-                                       }
-                               else {
-                                       rshift(rvb, 1);
-                                       rve++;
-                                       rve1++;
-                                       L = 0;
-                                       }
-                               }
-                       }
-               Bfree(ab);
-               Bfree(rvb0);
-               if (finished)
-                       break;
-
-               z = rve + rvbits;
-               if (y == z && L) {
-                       /* Can we stop now? */
-                       tol = dval(&adj) * 5e-16; /* > max rel error */
-                       dval(&adj) = adj0 - .5;
-                       if (dval(&adj) < -tol) {
-                               if (adj0 > tol) {
-                                       irv |= inex;
-                                       break;
-                                       }
-                               }
-                       else if (dval(&adj) > tol && adj0 < 1. - tol) {
-                               irv |= inex;
-                               break;
-                               }
-                       }
-               bb0 = denorm ? 0 : trailz(rvb);
-               Bfree(bb);
-               Bfree(bd);
-               Bfree(bs);
-               Bfree(delta);
-               }
-       if (!denorm && (j = nbits - rvbits)) {
-               if (j > 0)
-                       rvb = lshift(rvb, j);
-               else
-                       rshift(rvb, -j);
-               rve -= j;
-               }
-       *exp = rve;
-       Bfree(bb);
-       Bfree(bd);
-       Bfree(bs);
-       Bfree(bd0);
-       Bfree(delta);
-       if (rve > fpi->emax) {
-               switch(fpi->rounding & 3) {
-                 case FPI_Round_near:
-                       goto huge;
-                 case FPI_Round_up:
-                       if (!sign)
-                               goto huge;
-                       break;
-                 case FPI_Round_down:
-                       if (sign)
-                               goto huge;
-                 }
-               /* Round to largest representable magnitude */
-               Bfree(rvb);
-               rvb = 0;
-               irv = STRTOG_Normal | STRTOG_Inexlo;
-               *exp = fpi->emax;
-               b = bits;
-               be = b + ((fpi->nbits + 31) >> 5);
-               while(b < be)
-                       *b++ = -1;
-               if ((j = fpi->nbits & 0x1f))
-                       *--be >>= (32 - j);
-               goto ret;
- huge:
-               rvb->wds = 0;
-               irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
-#ifndef NO_ERRNO
-               errno = ERANGE;
-#endif
- infnanexp:
-               *exp = fpi->emax + 1;
-               }
- ret:
-       if (denorm) {
-               if (sudden_underflow) {
-                       rvb->wds = 0;
-                       irv = STRTOG_Underflow | STRTOG_Inexlo;
-#if !defined(NO_ERRNO) && __DARWIN_UNIX03
-                       errno = ERANGE;
-#endif
-                       }
-               else  {
-                       irv = (irv & ~STRTOG_Retmask) |
-                               (rvb->wds > 0 ? STRTOG_Denormal : STRTOG_Zero);
-                       if (irv & STRTOG_Inexact) {
-                               irv |= STRTOG_Underflow;
-#if !defined(NO_ERRNO) && __DARWIN_UNIX03
-                               errno = ERANGE;
-#endif
-                               }
-                       }
-               }
-       if (se)
-               *se = (char *)s;
-       if (sign)
-               irv |= STRTOG_Neg;
-       if (rvb) {
-               copybits(bits, nbits, rvb);
-               Bfree(rvb);
-               }
-       if (strunc)
-#ifdef FREE
-               FREE(strunc);
-#else
-               free(strunc);
-#endif
-       return irv;
-       }
diff --git a/gdtoa/gdtoa-strtof-fbsd.c b/gdtoa/gdtoa-strtof-fbsd.c
deleted file mode 100644 (file)
index fc29f59..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998, 2000 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
- float
-#ifdef KR_headers
-strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
-#else
-strtof_l(CONST char *s, char **sp, locale_t loc)
-#endif
-{
-       static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
-       ULong bits[1];
-       Long exp;
-       int k;
-       union { ULong L[1]; float f; } u;
-#ifdef Honor_FLT_ROUNDS
-#include "gdtoa_fltrnds.h"
-#else
-#define fpi &fpi0
-#endif
-
-       NORMALIZE_LOCALE(loc);
-       k = strtodg(s, sp, fpi, &exp, bits, loc);
-       switch(k & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-               u.L[0] = 0;
-               return u.f; // avoid setting sign
-
-         case STRTOG_Zero:
-               u.L[0] = 0;
-               break;
-
-         case STRTOG_Normal:
-         case STRTOG_NaNbits:
-               u.L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23);
-               break;
-
-         case STRTOG_Denormal:
-               u.L[0] = bits[0];
-               break;
-
-         case STRTOG_Infinite:
-               u.L[0] = 0x7f800000;
-               break;
-
-         case STRTOG_NaN:
-               u.L[0] = f_QNAN;
-         }
-       if (k & STRTOG_Neg)
-               u.L[0] |= 0x80000000L;
-       return u.f;
-       }
-
- float
-#ifdef KR_headers
-strtof(s, sp) CONST char *s; char **sp;
-#else
-strtof(CONST char *s, char **sp)
-#endif
-{
-       return strtof_l(s, sp, __current_locale());
-}
diff --git a/gdtoa/gdtoa-strtopdd-fbsd.c b/gdtoa/gdtoa-strtopdd-fbsd.c
deleted file mode 100644 (file)
index 2695746..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998, 2000 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
-#ifdef __APPLE__
-/*
- * IEEE specifies that the most significant (head) double is required to
- * be equal to the long double rounded to the nearest double, so that means
- * the tail double might be the opposite sign as the head.  We can do this
- * adding (long double)0 to the number, which will fix it up.
- */
-#define        fixLDBL(x)      ((x) += 0.L)
-#endif /* __APPLE__ */
-
- int
-#ifdef KR_headers
-strtopdd(s, sp, dd, loc) CONST char *s; char **sp; double *dd; locale_t loc;
-#else
-strtopdd(CONST char *s, char **sp, double *dd, locale_t loc)
-#endif
-{
-#ifdef Sudden_Underflow
-       static FPI fpi0 = { 106, 1-1023, 2046-1023-106+1, 1, 1 };
-#else
-       static FPI fpi0 = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 };
-#endif
-       ULong bits[4];
-       Long exp;
-       int i, j, rv;
-       typedef union {
-               double d[2];
-               ULong L[4];
-#ifdef __APPLE__
-               long double ld;
-#endif /* __APPLE__ */
-               } U;
-       U *u;
-#ifdef Honor_FLT_ROUNDS
-#include "gdtoa_fltrnds.h"
-#else
-#define fpi &fpi0
-#endif
-
-       rv = strtodg(s, sp, fpi, &exp, bits, loc);
-       u = (U*)dd;
-       switch(rv & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-               u->d[0] = u->d[1] = 0.;
-               return rv; // avoid setting sign
-
-         case STRTOG_Zero:
-               u->d[0] = u->d[1] = 0.;
-               break;
-
-         case STRTOG_Normal:
-               u->L[_1] = (bits[1] >> 21 | bits[2] << 11) & 0xffffffffL;
-               u->L[_0] = (bits[2] >> 21) | ((bits[3] << 11) & 0xfffff)
-                         | ((exp + 0x3ff + 105) << 20);
-               exp += 0x3ff + 52;
-               if (bits[1] &= 0x1fffff) {
-                       i = hi0bits(bits[1]) - 11;
-                       if (i >= exp) {
-                               i = exp - 1;
-                               exp = 0;
-                               }
-                       else
-                               exp -= i;
-                       if (i > 0) {
-                               bits[1] = bits[1] << i | bits[0] >> (32-i);
-                               bits[0] = bits[0] << i & 0xffffffffL;
-                               }
-                       }
-               else if (bits[0]) {
-                       i = hi0bits(bits[0]) + 21;
-                       if (i >= exp) {
-                               i = exp - 1;
-                               exp = 0;
-                               }
-                       else
-                               exp -= i;
-                       if (i < 32) {
-                               bits[1] = bits[0] >> (32 - i);
-                               bits[0] = bits[0] << i & 0xffffffffL;
-                               }
-                       else {
-                               bits[1] = bits[0] << (i - 32);
-                               bits[0] = 0;
-                               }
-                       }
-               else {
-                       u->L[2] = u->L[3] = 0;
-                       break;
-                       }
-               u->L[2+_1] = bits[0];
-               u->L[2+_0] = (bits[1] & 0xfffff) | (exp << 20);
-#ifdef __APPLE__
-               fixLDBL(u->ld);
-#endif /* __APPLE__ */
-               break;
-
-         case STRTOG_Denormal:
-               if (bits[3])
-                       goto nearly_normal;
-               if (bits[2])
-                       goto partly_normal;
-               if (bits[1] & 0xffe00000)
-                       goto hardly_normal;
-               /* completely denormal */
-               u->L[2] = u->L[3] = 0;
-               u->L[_1] = bits[0];
-               u->L[_0] = bits[1];
-               break;
-
-         nearly_normal:
-               i = hi0bits(bits[3]) - 11;      /* i >= 12 */
-               j = 32 - i;
-               u->L[_0] = ((bits[3] << i | bits[2] >> j) & 0xfffff)
-                       | ((65 - i) << 20);
-               u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL;
-               u->L[2+_0] = bits[1] & ((1L << j) - 1);
-               u->L[2+_1] = bits[0];
-#ifdef __APPLE__
-               fixLDBL(u->ld);
-#endif /* __APPLE__ */
-               break;
-
-         partly_normal:
-               i = hi0bits(bits[2]) - 11;
-               if (i < 0) {
-                       j = -i;
-                       i += 32;
-                       u->L[_0] = (bits[2] >> j & 0xfffff) | (33 + j) << 20;
-                       u->L[_1] = ((bits[2] << i) | (bits[1] >> j)) & 0xffffffffL;
-                       u->L[2+_0] = bits[1] & ((1L << j) - 1);
-                       u->L[2+_1] = bits[0];
-#ifdef __APPLE__
-                       fixLDBL(u->ld);
-#endif /* __APPLE__ */
-                       break;
-                       }
-               if (i == 0) {
-                       u->L[_0] = (bits[2] & 0xfffff) | (33 << 20);
-                       u->L[_1] = bits[1];
-                       u->L[2+_0] = 0;
-                       u->L[2+_1] = bits[0];
-#ifdef __APPLE__
-                       fixLDBL(u->ld);
-#endif /* __APPLE__ */
-                       break;
-                       }
-               j = 32 - i;
-               u->L[_0] = (((bits[2] << i) | (bits[1] >> j)) & 0xfffff)
-                               | ((j + 1) << 20);
-               u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
-               u->L[2+_0] = 0;
-               u->L[2+_1] = bits[0] & ((1L << j) - 1);
-#ifdef __APPLE__
-               fixLDBL(u->ld);
-#endif /* __APPLE__ */
-               break;
-
-         hardly_normal:
-               j = 11 - hi0bits(bits[1]);
-               i = 32 - j;
-               u->L[_0] = (bits[1] >> j & 0xfffff) | ((j + 1) << 20);
-               u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
-               u->L[2+_0] = 0;
-               u->L[2+_1] = bits[0] & ((1L << j) - 1);
-#ifdef __APPLE__
-               fixLDBL(u->ld);
-#endif /* __APPLE__ */
-               break;
-
-         case STRTOG_Infinite:
-#ifdef __APPLE__
-               u->L[_0] = 0x7ff00000;
-               u->L[_1] = u->L[2+_0] = u->L[2+_1] = 0;
-#else /* __APPLE__ */
-               u->L[_0] = u->L[2+_0] = 0x7ff00000;
-               u->L[_1] = u->L[2+_1] = 0;
-#endif /* __APPLE__ */
-               break;
-
-         case STRTOG_NaN:
-#ifdef __APPLE__
-               u->L[0] = d_QNAN0;
-               u->L[1] = d_QNAN1;
-               u->L[2] = u->L[3] = 0;
-#else /* __APPLE__ */
-               u->L[0] = u->L[2] = d_QNAN0;
-               u->L[1] = u->L[3] = d_QNAN1;
-#endif /* __APPLE__ */
-               break;
-#ifdef __APPLE__
-        case STRTOG_NaNbits:
-               u->L[0] = d_QNAN0 | ((bits[2] >> 20 | bits[3] << 12) & 0xfffff);
-               u->L[1] = d_QNAN1 | bits[1] >> 20 | bits[2] << 12;
-               u->L[2] = u->L[3] = 0;
-#endif /* __APPLE__ */
-         }
-       if (rv & STRTOG_Neg) {
-               u->L[  _0] |= 0x80000000L;
-#ifdef __APPLE__
-               u->L[2+_0] ^= 0x80000000L;
-#else /* __APPLE__ */
-               u->L[2+_0] |= 0x80000000L;
-#endif /* __APPLE__ */
-               }
-       return rv;
-       }
diff --git a/gdtoa/gdtoa-strtopx-fbsd.c b/gdtoa/gdtoa-strtopx-fbsd.c
deleted file mode 100644 (file)
index b8e8a34..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998, 2000 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
-#undef _0
-#undef _1
-
-/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */
-
-#ifdef IEEE_MC68k
-#define _0 0
-#define _1 1
-#define _2 2
-#define _3 3
-#define _4 4
-#endif
-#ifdef IEEE_8087
-#define _0 4
-#define _1 3
-#define _2 2
-#define _3 1
-#define _4 0
-#endif
-
- int
-#ifdef KR_headers
-strtopx(s, sp, V, loc) CONST char *s; char **sp; void *V; locale_t loc;
-#else
-strtopx(CONST char *s, char **sp, void *V, locale_t loc)
-#endif
-{
-       static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
-       ULong bits[2];
-       Long exp;
-       int k;
-       UShort *L = (UShort*)V;
-#ifdef Honor_FLT_ROUNDS
-#include "gdtoa_fltrnds.h"
-#else
-#define fpi &fpi0
-#endif
-
-       k = strtodg(s, sp, fpi, &exp, bits, loc);
-       switch(k & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-               L[0] = L[1] = L[2] = L[3] = L[4] = 0;
-               return k; // avoid setting sign
-
-         case STRTOG_Zero:
-               L[0] = L[1] = L[2] = L[3] = L[4] = 0;
-               break;
-
-         case STRTOG_Denormal:
-               L[_0] = 0;
-               goto normal_bits;
-
-         case STRTOG_Normal:
-         case STRTOG_NaNbits:
-               L[_0] = exp + 0x3fff + 63;
- normal_bits:
-               L[_4] = (UShort)bits[0];
-               L[_3] = (UShort)(bits[0] >> 16);
-               L[_2] = (UShort)bits[1];
-               L[_1] = (UShort)(bits[1] >> 16);
-               break;
-
-         case STRTOG_Infinite:
-               L[_0] = 0x7fff;
-               L[_1] = 0x8000;
-               L[_2] = L[_3] = L[_4] = 0;
-               break;
-
-         case STRTOG_NaN:
-               L[0] = ldus_QNAN0;
-               L[1] = ldus_QNAN1;
-               L[2] = ldus_QNAN2;
-               L[3] = ldus_QNAN3;
-               L[4] = ldus_QNAN4;
-         }
-       if (k & STRTOG_Neg)
-               L[_0] |= 0x8000;
-       return k;
-       }
diff --git a/gdtoa/gdtoa-strtord-fbsd.c b/gdtoa/gdtoa-strtord-fbsd.c
deleted file mode 100644 (file)
index 2500488..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998, 2000 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#include "gdtoaimp.h"
-
- void
-#ifdef KR_headers
-ULtod(L, bits, exp, k) ULong *L; ULong *bits; Long exp; int k;
-#else
-ULtod(ULong *L, ULong *bits, Long exp, int k)
-#endif
-{
-       switch(k & STRTOG_Retmask) {
-         case STRTOG_NoNumber:
-         case STRTOG_Zero:
-               L[0] = L[1] = 0;
-               break;
-
-         case STRTOG_Denormal:
-               L[_1] = bits[0];
-               L[_0] = bits[1];
-               break;
-
-         case STRTOG_Normal:
-         case STRTOG_NaNbits:
-               L[_1] = bits[0];
-               L[_0] = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20);
-               break;
-
-         case STRTOG_Infinite:
-               L[_0] = 0x7ff00000;
-               L[_1] = 0;
-               break;
-
-         case STRTOG_NaN:
-               L[0] = d_QNAN0;
-               L[1] = d_QNAN1;
-         }
-       if (k & STRTOG_Neg)
-               L[_0] |= 0x80000000L;
-       }
diff --git a/gdtoa/gdtoa-sum-fbsd.c b/gdtoa/gdtoa-sum-fbsd.c
deleted file mode 120000 (symlink)
index d7692e4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-sum.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa-ulp-fbsd.c b/gdtoa/gdtoa-ulp-fbsd.c
deleted file mode 120000 (symlink)
index 5e1ddd4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa-ulp.c
\ No newline at end of file
diff --git a/gdtoa/gdtoa.h b/gdtoa/gdtoa.h
deleted file mode 100644 (file)
index 8bdcd4d..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* Please send bug reports to David M. Gay (dmg at acm dot org,
- * with " at " changed at "@" and " dot " changed to ".").     */
-
-#ifndef GDTOA_H_INCLUDED
-#define GDTOA_H_INCLUDED
-
-#include "arith.h"
-#include <stddef.h> /* for size_t */
-
-#ifndef Long
-#define Long long
-#endif
-#ifndef ULong
-typedef unsigned Long ULong;
-#endif
-#ifndef UShort
-typedef unsigned short UShort;
-#endif
-
-#ifndef ANSI
-#ifdef KR_headers
-#define ANSI(x) ()
-#define Void /*nothing*/
-#else
-#define ANSI(x) x
-#define Void void
-#endif
-#endif /* ANSI */
-
-#ifndef CONST
-#ifdef KR_headers
-#define CONST /* blank */
-#else
-#define CONST const
-#endif
-#endif /* CONST */
-
- enum {        /* return values from strtodg */
-       STRTOG_Zero     = 0,
-       STRTOG_Normal   = 1,
-       STRTOG_Denormal = 2,
-       STRTOG_Infinite = 3,
-       STRTOG_NaN      = 4,
-       STRTOG_NaNbits  = 5,
-       STRTOG_NoNumber = 6,
-       STRTOG_Retmask  = 7,
-
-       /* The following may be or-ed into one of the above values. */
-
-       STRTOG_Neg      = 0x08, /* does not affect STRTOG_Inexlo or STRTOG_Inexhi */
-       STRTOG_Inexlo   = 0x10, /* returned result rounded toward zero */
-       STRTOG_Inexhi   = 0x20, /* returned result rounded away from zero */
-       STRTOG_Inexact  = 0x30,
-       STRTOG_Underflow= 0x40,
-       STRTOG_Overflow = 0x80
-       };
-
- typedef struct
-FPI {
-       int nbits;
-       int emin;
-       int emax;
-       int rounding;
-       int sudden_underflow;
-       } FPI;
-
-enum { /* FPI.rounding values: same as FLT_ROUNDS */
-       FPI_Round_zero = 0,
-       FPI_Round_near = 1,
-       FPI_Round_up = 2,
-       FPI_Round_down = 3
-       };
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char* dtoa  ANSI((double d, int mode, int ndigits, int *decpt,
-                       int *sign, char **rve));
-extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
-                       int mode, int ndigits, int *decpt, char **rve));
-extern void freedtoa ANSI((char*));
-extern float  strtof ANSI((CONST char *, char **));
-extern double strtod ANSI((CONST char *, char **));
-extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t)) __DARWIN_ALIAS(strtodg);
-
-extern char*   g_ddfmt  ANSI((char*, double*, int, size_t));
-extern char*   g_dfmt   ANSI((char*, double*, int, size_t));
-extern char*   g_ffmt   ANSI((char*, float*,  int, size_t));
-extern char*   g_Qfmt   ANSI((char*, void*,   int, size_t));
-extern char*   g_xfmt   ANSI((char*, void*,   int, size_t));
-extern char*   g_xLfmt  ANSI((char*, void*,   int, size_t));
-
-extern int     strtoId  ANSI((CONST char*, char**, double*, double*));
-extern int     strtoIdd ANSI((CONST char*, char**, double*, double*));
-extern int     strtoIf  ANSI((CONST char*, char**, float*, float*));
-extern int     strtoIQ  ANSI((CONST char*, char**, void*, void*));
-extern int     strtoIx  ANSI((CONST char*, char**, void*, void*));
-extern int     strtoIxL ANSI((CONST char*, char**, void*, void*));
-extern int     strtord  ANSI((CONST char*, char**, int, double*));
-extern int     strtordd ANSI((CONST char*, char**, int, double*));
-extern int     strtorf  ANSI((CONST char*, char**, int, float*));
-extern int     strtorQ  ANSI((CONST char*, char**, int, void*));
-extern int     strtorx  ANSI((CONST char*, char**, int, void*));
-extern int     strtorxL ANSI((CONST char*, char**, int, void*));
-#if 1
-extern int     strtodI  ANSI((CONST char*, char**, double*));
-extern int     strtopd  ANSI((CONST char*, char**, double*));
-extern int     strtopdd ANSI((CONST char*, char**, double*, locale_t));
-extern int     strtopf  ANSI((CONST char*, char**, float*));
-extern int     strtopQ  ANSI((CONST char*, char**, void*));
-extern int     strtopx  ANSI((CONST char*, char**, void*, locale_t));
-extern int     strtopxL ANSI((CONST char*, char**, void*));
-#else
-#define strtopd(s,se,x) strtord(s,se,1,x)
-#define strtopdd(s,se,x) strtordd(s,se,1,x)
-#define strtopf(s,se,x) strtorf(s,se,1,x)
-#define strtopQ(s,se,x) strtorQ(s,se,1,x)
-#define strtopx(s,se,x) strtorx(s,se,1,x)
-#define strtopxL(s,se,x) strtorxL(s,se,1,x)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* GDTOA_H_INCLUDED */
diff --git a/gdtoa/gdtoa_fltrnds.h b/gdtoa/gdtoa_fltrnds.h
deleted file mode 120000 (symlink)
index de739da..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gdtoa_fltrnds.h
\ No newline at end of file
diff --git a/gdtoa/gdtoaimp.h b/gdtoa/gdtoaimp.h
deleted file mode 100644 (file)
index 39012aa..0000000
+++ /dev/null
@@ -1,741 +0,0 @@
-/****************************************************************
-
-The author of this software is David M. Gay.
-
-Copyright (C) 1998-2000 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-
-****************************************************************/
-
-/* This is a variation on dtoa.c that converts arbitary binary
-   floating-point formats to and from decimal notation.  It uses
-   double-precision arithmetic internally, so there are still
-   various #ifdefs that adapt the calculations to the native
-   double-precision arithmetic (any of IEEE, VAX D_floating,
-   or IBM mainframe arithmetic).
-
-   Please send bug reports to David M. Gay (dmg at acm dot org,
-   with " at " changed at "@" and " dot " changed to ".").
- */
-
-/* On a machine with IEEE extended-precision registers, it is
- * necessary to specify double-precision (53-bit) rounding precision
- * before invoking strtod or dtoa.  If the machine uses (the equivalent
- * of) Intel 80x87 arithmetic, the call
- *     _control87(PC_53, MCW_PC);
- * does this with many compilers.  Whether this or another call is
- * appropriate depends on the compiler; for this to work, it may be
- * necessary to #include "float.h" or another system-dependent header
- * file.
- */
-
-/* strtod for IEEE-, VAX-, and IBM-arithmetic machines.
- *
- * This strtod returns a nearest machine number to the input decimal
- * string (or sets errno to ERANGE).  With IEEE arithmetic, ties are
- * broken by the IEEE round-even rule.  Otherwise ties are broken by
- * biased rounding (add half and chop).
- *
- * Inspired loosely by William D. Clinger's paper "How to Read Floating
- * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 112-126].
- *
- * Modifications:
- *
- *     1. We only require IEEE, IBM, or VAX double-precision
- *             arithmetic (not IEEE double-extended).
- *     2. We get by with floating-point arithmetic in a case that
- *             Clinger missed -- when we're computing d * 10^n
- *             for a small integer d and the integer n is not too
- *             much larger than 22 (the maximum integer k for which
- *             we can represent 10^k exactly), we may be able to
- *             compute (d*10^k) * 10^(e-k) with just one roundoff.
- *     3. Rather than a bit-at-a-time adjustment of the binary
- *             result in the hard case, we use floating-point
- *             arithmetic to determine the adjustment to within
- *             one bit; only in really hard cases do we need to
- *             compute a second residual.
- *     4. Because of 3., we don't need a large table of powers of 10
- *             for ten-to-e (just some small tables, e.g. of 10^k
- *             for 0 <= k <= 22).
- */
-
-/*
- * #define IEEE_8087 for IEEE-arithmetic machines where the least
- *     significant byte has the lowest address.
- * #define IEEE_MC68k for IEEE-arithmetic machines where the most
- *     significant byte has the lowest address.
- * #define Long int on machines with 32-bit ints and 64-bit longs.
- * #define Sudden_Underflow for IEEE-format machines without gradual
- *     underflow (i.e., that flush to zero on underflow).
- * #define IBM for IBM mainframe-style floating-point arithmetic.
- * #define VAX for VAX-style floating-point arithmetic (D_floating).
- * #define No_leftright to omit left-right logic in fast floating-point
- *     computation of dtoa.
- * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3.
- * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
- *     that use extended-precision instructions to compute rounded
- *     products and quotients) with IBM.
- * #define ROUND_BIASED for IEEE-format with biased rounding.
- * #define Inaccurate_Divide for IEEE-format with correctly rounded
- *     products but inaccurate quotients, e.g., for Intel i860.
- * #define NO_LONG_LONG on machines that do not have a "long long"
- *     integer type (of >= 64 bits).  On such machines, you can
- *     #define Just_16 to store 16 bits per 32-bit Long when doing
- *     high-precision integer arithmetic.  Whether this speeds things
- *     up or slows things down depends on the machine and the number
- *     being converted.  If long long is available and the name is
- *     something other than "long long", #define Llong to be the name,
- *     and if "unsigned Llong" does not work as an unsigned version of
- *     Llong, #define #ULLong to be the corresponding unsigned type.
- * #define KR_headers for old-style C function headers.
- * #define Bad_float_h if your system lacks a float.h or if it does not
- *     define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
- *     FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
- * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n)
- *     if memory is available and otherwise does something you deem
- *     appropriate.  If MALLOC is undefined, malloc will be invoked
- *     directly -- and assumed always to succeed.  Similarly, if you
- *     want something other than the system's free() to be called to
- *     recycle memory acquired from MALLOC, #define FREE to be the
- *     name of the alternate routine.  (FREE or free is only called in
- *     pathological cases, e.g., in a gdtoa call after a gdtoa return in
- *     mode 3 with thousands of digits requested.)
- * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making
- *     memory allocations from a private pool of memory when possible.
- *     When used, the private pool is PRIVATE_MEM bytes long:  2304 bytes,
- *     unless #defined to be a different length.  This default length
- *     suffices to get rid of MALLOC calls except for unusual cases,
- *     such as decimal-to-binary conversion of a very long string of
- *     digits.  When converting IEEE double precision values, the
- *     longest string gdtoa can return is about 751 bytes long.  For
- *     conversions by strtod of strings of 800 digits and all gdtoa
- *     conversions of IEEE doubles in single-threaded executions with
- *     8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with
- *     4-byte pointers, PRIVATE_MEM >= 7112 appears adequate.
- * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK
- *     #defined automatically on IEEE systems.  On such systems,
- *     when INFNAN_CHECK is #defined, strtod checks
- *     for Infinity and NaN (case insensitively).
- *     When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
- *     strtodg also accepts (case insensitively) strings of the form
- *     NaN(x), where x is a string of hexadecimal digits (optionally
- *     preceded by 0x or 0X) and spaces; if there is only one string
- *     of hexadecimal digits, it is taken for the fraction bits of the
- *     resulting NaN; if there are two or more strings of hexadecimal
- *     digits, each string is assigned to the next available sequence
- *     of 32-bit words of fractions bits (starting with the most
- *     significant), right-aligned in each sequence.
- *     Unless GDTOA_NON_PEDANTIC_NANCHECK is #defined, input "NaN(...)"
- *     is consumed even when ... has the wrong form (in which case the
- *     "(...)" is consumed but ignored).
- * #define MULTIPLE_THREADS if the system offers preemptively scheduled
- *     multiple threads.  In this case, you must provide (or suitably
- *     #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
- *     by FREE_DTOA_LOCK(n) for n = 0 or 1.  (The second lock, accessed
- *     in pow5mult, ensures lazy evaluation of only one copy of high
- *     powers of 5; omitting this lock would introduce a small
- *     probability of wasting memory, but would otherwise be harmless.)
- *     You must also invoke freedtoa(s) to free the value s returned by
- *     dtoa.  You may do so whether or not MULTIPLE_THREADS is #defined.
- * #define IMPRECISE_INEXACT if you do not care about the setting of
- *     the STRTOG_Inexact bits in the special case of doing IEEE double
- *     precision conversions (which could also be done by the strtod in
- *     dtoa.c).
- * #define NO_HEX_FP to disable recognition of C9x's hexadecimal
- *     floating-point constants.
- * #define -DNO_ERRNO to suppress setting errno (in strtod.c and
- *     strtodg.c).
- * #define NO_STRING_H to use private versions of memcpy.
- *     On some K&R systems, it may also be necessary to
- *     #define DECLARE_SIZE_T in this case.
- * #define USE_LOCALE to use the current locale's decimal_point value.
- */
-
-#ifndef GDTOAIMP_H_INCLUDED
-#define GDTOAIMP_H_INCLUDED
-/*
- * Paranoia: Protect exported symbols, including ones in files we don't
- * compile right now.  The standard strtof and strtod survive.
- */
-#define        dtoa            __dtoa
-#define        gdtoa           __gdtoa
-#define        freedtoa        __freedtoa
-#define        strtodg         __strtodg
-#define        g_ddfmt         __g_ddfmt
-#define        g_dfmt          __g_dfmt
-#define        g_ffmt          __g_ffmt
-#define        g_Qfmt          __g_Qfmt
-#define        g_xfmt          __g_xfmt
-#define        g_xLfmt         __g_xLfmt
-#define        strtoId         __strtoId
-#define        strtoIdd        __strtoIdd
-#define        strtoIf         __strtoIf
-#define        strtoIQ         __strtoIQ
-#define        strtoIx         __strtoIx
-#define        strtoIxL        __strtoIxL
-#define        strtord         __strtord
-#define        strtordd        __strtordd
-#define        strtorf         __strtorf
-#define        strtorQ         __strtorQ
-#define        strtorx         __strtorx
-#define        strtorxL        __strtorxL
-#define        strtodI         __strtodI
-#define        strtopd         __strtopd
-#define        strtopdd        __strtopdd
-#define        strtopf         __strtopf
-#define        strtopQ         __strtopQ
-#define        strtopx         __strtopx
-#define        strtopxL        __strtopxL
-
-/* Protect gdtoa-internal symbols */
-#define        Balloc          __Balloc_D2A
-#define        Bfree           __Bfree_D2A
-#define        ULtoQ           __ULtoQ_D2A
-#define        ULtof           __ULtof_D2A
-#define        ULtod           __ULtod_D2A
-#define        ULtodd          __ULtodd_D2A
-#define        ULtox           __ULtox_D2A
-#define        ULtoxL          __ULtoxL_D2A
-#define        any_on          __any_on_D2A
-#define        b2d             __b2d_D2A
-#define        bigtens         __bigtens_D2A
-#define        cmp             __cmp_D2A
-#define        copybits        __copybits_D2A
-#define        d2b             __d2b_D2A
-#define        decrement       __decrement_D2A
-#define        diff            __diff_D2A
-#define        dtoa_result     __dtoa_result_D2A
-#define        g__fmt          __g__fmt_D2A
-#define        gethex          __gethex_D2A
-#define        hexdig          __hexdig_D2A
-#define        hexdig_init_D2A __hexdig_init_D2A
-#define        hexnan          __hexnan_D2A
-#define        hi0bits         __hi0bits_D2A
-#define        hi0bits_D2A     __hi0bits_D2A
-#define        i2b             __i2b_D2A
-#define        increment       __increment_D2A
-#define        lo0bits         __lo0bits_D2A
-#define        lshift          __lshift_D2A
-#define        match           __match_D2A
-#define        mult            __mult_D2A
-#define        multadd         __multadd_D2A
-#define        nrv_alloc       __nrv_alloc_D2A
-#define        pow5mult        __pow5mult_D2A
-#define        quorem          __quorem_D2A
-#define        ratio           __ratio_D2A
-#define        rshift          __rshift_D2A
-#define        rv_alloc        __rv_alloc_D2A
-#define        s2b             __s2b_D2A
-#define        set_ones        __set_ones_D2A
-#define        strcp           __strcp_D2A
-#define        strcp_D2A       __strcp_D2A
-#define        strtoIg         __strtoIg_D2A
-#define        sum             __sum_D2A
-#define        tens            __tens_D2A
-#define        tinytens        __tinytens_D2A
-#define        tinytens        __tinytens_D2A
-#define        trailz          __trailz_D2A
-#define        ulp             __ulp_D2A
-
-#include <xlocale.h>
-#include "gdtoa.h"
-#include "gd_qnan.h"
-#ifdef Honor_FLT_ROUNDS
-#include <fenv.h>
-#endif
-
-#ifdef DEBUG
-#include "stdio.h"
-#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
-#endif
-
-#include "limits.h"
-#include "stdlib.h"
-#include "string.h"
-#include "libc_private.h"
-#include "spinlock.h"
-
-#ifdef KR_headers
-#define Char char
-#else
-#define Char void
-#endif
-
-#ifdef MALLOC
-extern Char *MALLOC ANSI((size_t));
-#else
-#define MALLOC malloc
-#endif
-
-#define INFNAN_CHECK
-#define USE_LOCALE
-#define NO_LOCALE_CACHE
-
-#undef IEEE_Arith
-#undef Avoid_Underflow
-#ifdef IEEE_MC68k
-#define IEEE_Arith
-#endif
-#ifdef IEEE_8087
-#define IEEE_Arith
-#endif
-
-#include "errno.h"
-#ifdef Bad_float_h
-
-#ifdef IEEE_Arith
-#define DBL_DIG 15
-#define DBL_MAX_10_EXP 308
-#define DBL_MAX_EXP 1024
-#define FLT_RADIX 2
-#define DBL_MAX 1.7976931348623157e+308
-#endif
-
-#ifdef IBM
-#define DBL_DIG 16
-#define DBL_MAX_10_EXP 75
-#define DBL_MAX_EXP 63
-#define FLT_RADIX 16
-#define DBL_MAX 7.2370055773322621e+75
-#endif
-
-#ifdef VAX
-#define DBL_DIG 16
-#define DBL_MAX_10_EXP 38
-#define DBL_MAX_EXP 127
-#define FLT_RADIX 2
-#define DBL_MAX 1.7014118346046923e+38
-#define n_bigtens 2
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647
-#endif
-
-#else /* ifndef Bad_float_h */
-#include "float.h"
-#endif /* Bad_float_h */
-
-#ifdef IEEE_Arith
-#define Scale_Bit 0x10
-#define n_bigtens 5
-#endif
-
-#ifdef IBM
-#define n_bigtens 3
-#endif
-
-#ifdef VAX
-#define n_bigtens 2
-#endif
-
-#ifndef __MATH_H__
-#include "math.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
-Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
-#endif
-
-typedef union { double d; ULong L[2]; } U;
-
-#ifdef IEEE_8087
-#define word0(x) (x)->L[1]
-#define word1(x) (x)->L[0]
-#else
-#define word0(x) (x)->L[0]
-#define word1(x) (x)->L[1]
-#endif
-#define dval(x) (x)->d
-
-/* The following definition of Storeinc is appropriate for MIPS processors.
- * An alternative that might be better on some machines is
- * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
- */
-#if defined(IEEE_8087) + defined(VAX)
-#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
-((unsigned short *)a)[0] = (unsigned short)c, a++)
-#else
-#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
-((unsigned short *)a)[1] = (unsigned short)c, a++)
-#endif
-
-/* #define P DBL_MANT_DIG */
-/* Ten_pmax = floor(P*log(2)/log(5)) */
-/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */
-/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */
-/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */
-
-#ifdef IEEE_Arith
-#define Exp_shift  20
-#define Exp_shift1 20
-#define Exp_msk1    0x100000
-#define Exp_msk11   0x100000
-#define Exp_mask  0x7ff00000
-#define P 53
-#define Bias 1023
-#define Emin (-1022)
-#define Exp_1  0x3ff00000
-#define Exp_11 0x3ff00000
-#define Ebits 11
-#define Frac_mask  0xfffff
-#define Frac_mask1 0xfffff
-#define Ten_pmax 22
-#define Bletch 0x10
-#define Bndry_mask  0xfffff
-#define Bndry_mask1 0xfffff
-#define LSB 1
-#define Sign_bit 0x80000000
-#define Log2P 1
-#define Tiny0 0
-#define Tiny1 1
-#define Quick_max 14
-#define Int_max 14
-
-#ifndef Flt_Rounds
-#ifdef FLT_ROUNDS
-#define Flt_Rounds FLT_ROUNDS
-#else
-#define Flt_Rounds 1
-#endif
-#endif /*Flt_Rounds*/
-
-#else /* ifndef IEEE_Arith */
-#undef  Sudden_Underflow
-#define Sudden_Underflow
-#ifdef IBM
-#undef Flt_Rounds
-#define Flt_Rounds 0
-#define Exp_shift  24
-#define Exp_shift1 24
-#define Exp_msk1   0x1000000
-#define Exp_msk11  0x1000000
-#define Exp_mask  0x7f000000
-#define P 14
-#define Bias 65
-#define Exp_1  0x41000000
-#define Exp_11 0x41000000
-#define Ebits 8        /* exponent has 7 bits, but 8 is the right value in b2d */
-#define Frac_mask  0xffffff
-#define Frac_mask1 0xffffff
-#define Bletch 4
-#define Ten_pmax 22
-#define Bndry_mask  0xefffff
-#define Bndry_mask1 0xffffff
-#define LSB 1
-#define Sign_bit 0x80000000
-#define Log2P 4
-#define Tiny0 0x100000
-#define Tiny1 0
-#define Quick_max 14
-#define Int_max 15
-#else /* VAX */
-#undef Flt_Rounds
-#define Flt_Rounds 1
-#define Exp_shift  23
-#define Exp_shift1 7
-#define Exp_msk1    0x80
-#define Exp_msk11   0x800000
-#define Exp_mask  0x7f80
-#define P 56
-#define Bias 129
-#define Exp_1  0x40800000
-#define Exp_11 0x4080
-#define Ebits 8
-#define Frac_mask  0x7fffff
-#define Frac_mask1 0xffff007f
-#define Ten_pmax 24
-#define Bletch 2
-#define Bndry_mask  0xffff007f
-#define Bndry_mask1 0xffff007f
-#define LSB 0x10000
-#define Sign_bit 0x8000
-#define Log2P 1
-#define Tiny0 0x80
-#define Tiny1 0
-#define Quick_max 15
-#define Int_max 15
-#endif /* IBM, VAX */
-#endif /* IEEE_Arith */
-
-#ifndef IEEE_Arith
-#define ROUND_BIASED
-#endif
-
-#ifdef RND_PRODQUOT
-#define rounded_product(a,b) a = rnd_prod(a, b)
-#define rounded_quotient(a,b) a = rnd_quot(a, b)
-#ifdef KR_headers
-extern double rnd_prod(), rnd_quot();
-#else
-extern double rnd_prod(double, double), rnd_quot(double, double);
-#endif
-#else
-#define rounded_product(a,b) a *= b
-#define rounded_quotient(a,b) a /= b
-#endif
-
-#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
-#define Big1 0xffffffff
-
-#undef  Pack_16
-#ifndef Pack_32
-#define Pack_32
-#endif
-
-#ifdef NO_LONG_LONG
-#undef ULLong
-#ifdef Just_16
-#undef Pack_32
-#define Pack_16
-/* When Pack_32 is not defined, we store 16 bits per 32-bit Long.
- * This makes some inner loops simpler and sometimes saves work
- * during multiplications, but it often seems to make things slightly
- * slower.  Hence the default is now to store 32 bits per Long.
- */
-#endif
-#else  /* long long available */
-#ifndef Llong
-#define Llong long long
-#endif
-#ifndef ULLong
-#define ULLong unsigned Llong
-#endif
-#endif /* NO_LONG_LONG */
-
-#ifdef Pack_32
-#define ULbits 32
-#define kshift 5
-#define kmask 31
-#define ALL_ON 0xffffffff
-#else
-#define ULbits 16
-#define kshift 4
-#define kmask 15
-#define ALL_ON 0xffff
-#endif
-
-#define MULTIPLE_THREADS
-extern spinlock_t __gdtoa_locks[2];
-#define ACQUIRE_DTOA_LOCK(n)   do {                            \
-       if (__isthreaded) _SPINLOCK(&__gdtoa_locks[n]);         \
-} while(0)
-#define FREE_DTOA_LOCK(n)      do {                            \
-       if (__isthreaded) _SPINUNLOCK(&__gdtoa_locks[n]);       \
-} while(0)
-
-#define Kmax 9
-
- struct
-Bigint {
-       struct Bigint *next;
-       int k, maxwds, sign, wds;
-       ULong x[1];
-       };
-
- typedef struct Bigint Bigint;
-
-#ifdef NO_STRING_H
-#ifdef DECLARE_SIZE_T
-typedef unsigned int size_t;
-#endif
-extern void memcpy_D2A ANSI((void*, const void*, size_t));
-#define Bcopy(x,y) memcpy_D2A(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
-#else /* !NO_STRING_H */
-#define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
-#endif /* NO_STRING_H */
-
- extern char *dtoa_result;
- extern CONST double bigtens[], tens[], tinytens[];
- extern unsigned char hexdig[];
-
- extern Bigint *Balloc ANSI((int));
- extern void Bfree ANSI((Bigint*));
- extern void ULtof ANSI((ULong*, ULong*, Long, int));
- extern void ULtod ANSI((ULong*, ULong*, Long, int));
- extern void ULtodd ANSI((ULong*, ULong*, Long, int));
- extern void ULtoQ ANSI((ULong*, ULong*, Long, int));
- extern void ULtox ANSI((UShort*, ULong*, Long, int));
- extern void ULtoxL ANSI((ULong*, ULong*, Long, int));
- extern ULong any_on ANSI((Bigint*, int));
- extern double b2d ANSI((Bigint*, int*));
- extern int cmp ANSI((Bigint*, Bigint*));
- extern void copybits ANSI((ULong*, int, Bigint*));
- extern Bigint *d2b ANSI((double, int*, int*));
- extern void decrement ANSI((Bigint*));
- extern Bigint *diff ANSI((Bigint*, Bigint*));
- extern char *dtoa ANSI((double d, int mode, int ndigits,
-                       int *decpt, int *sign, char **rve));
- extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
- extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int, locale_t));
- extern void hexdig_init_D2A(Void);
- extern int hexnan ANSI((CONST char**, FPI*, ULong*));
- extern int hi0bits_D2A ANSI((ULong));
- extern Bigint *i2b ANSI((int));
- extern Bigint *increment ANSI((Bigint*));
- extern int lo0bits ANSI((ULong*));
- extern Bigint *lshift ANSI((Bigint*, int));
- extern int match ANSI((CONST char**, char*));
- extern Bigint *mult ANSI((Bigint*, Bigint*));
- extern Bigint *multadd ANSI((Bigint*, int, int));
- extern char *nrv_alloc ANSI((char*, char **, int));
- extern Bigint *pow5mult ANSI((Bigint*, int));
- extern int quorem ANSI((Bigint*, Bigint*));
- extern double ratio ANSI((Bigint*, Bigint*));
- extern void rshift ANSI((Bigint*, int));
- extern char *rv_alloc ANSI((int));
- extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
- extern Bigint *set_ones ANSI((Bigint*, int));
- extern char *strcp ANSI((char*, const char*));
- extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
- extern double strtod ANSI((const char *s00, char **se));
- extern double strtod_l ANSI((const char *s00, char **se, locale_t));
- extern Bigint *sum ANSI((Bigint*, Bigint*));
- extern int trailz ANSI((Bigint*));
- extern double ulp ANSI((U*));
-
-#ifdef __cplusplus
-}
-#endif
-/*
- * NAN_WORD0 and NAN_WORD1 are only referenced in strtod.c.  Prior to
- * 20050115, they used to be hard-wired here (to 0x7ff80000 and 0,
- * respectively), but now are determined by compiling and running
- * qnan.c to generate gd_qnan.h, which specifies d_QNAN0 and d_QNAN1.
- * Formerly gdtoaimp.h recommended supplying suitable -DNAN_WORD0=...
- * and -DNAN_WORD1=...  values if necessary.  This should still work.
- * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
- */
-#ifdef IEEE_Arith
-#ifndef NO_INFNAN_CHECK
-#undef INFNAN_CHECK
-#define INFNAN_CHECK
-#endif
-#ifdef IEEE_MC68k
-#define _0 0
-#define _1 1
-#ifndef NAN_WORD0
-#define NAN_WORD0 d_QNAN0
-#endif
-#ifndef NAN_WORD1
-#define NAN_WORD1 d_QNAN1
-#endif
-#else
-#define _0 1
-#define _1 0
-#ifndef NAN_WORD0
-#define NAN_WORD0 d_QNAN1
-#endif
-#ifndef NAN_WORD1
-#define NAN_WORD1 d_QNAN0
-#endif
-#endif
-#else
-#undef INFNAN_CHECK
-#endif
-
-#undef SI
-#ifdef Sudden_Underflow
-#define SI 1
-#else
-#define SI 0
-#endif
-
-/*
- * For very large strings, strtod and family might exhaust memory in tight
- * memory conditions (especially in 32-bits).  Such large strings could also
- * tie up a CPU for minutes at a time.  Either can be considered a denial-of-
- * service vunerability.
- *
- * To fix, we limit the string size to the maximum we need to calculate the
- * rounding point correctly.  The longest string corresponding to the exact
- * value of a floating point number occuring at 1.f...f p^-n, where n is
- * the (absolute value of the) smallest exponent for a normalize number.
- *
- * To calculate this number of decimal digits, we use the formula:
- *
- * (n + m) - int(n * log10(2)) + 3
- *
- * where m is the number of bits in the f...f fraction.  This is the number
- * of decimal digits for the least significant bit minus the number of leading
- * zeros for the most significant bit (the '1'), plus a few to compensate for
- * an extra digits due to the full 1.f...f value, an extra digit for the
- * mid-way point for rounding and an extra guard digit.
- *
- * Using the approximation log10(2) ~ 1233 / (2^12), converting to the fpi.emin
- * and fpi.nbits values, we get:
- *
- * -fpi.emin -((1233 * (-fpi.nbits - fpi.emin)) >> 12) + 3
- *
- * Finally, we add an extra digit, either '1' or '0', to represent whether
- * to-be-truncated digits contain a non-zero digit, or are all zeros,
- * respectively.
- *
- * The truncated string is allocated on the heap, so code using
- * TRUNCATE_DIGITS() will need to free that space when no longer needed.
- * Pass a char * as the second argument, initialized to NULL; if its value
- * becomes non-NULL, memory was allocated.
- */
-#define LOG2NUM 1233
-#define LOG2DENOMSHIFT 12
-#define TRUNCATEDIGITS(_nbits, _emin)  (-(_emin) - ((LOG2NUM * (-(_nbits) - (_emin))) >> LOG2DENOMSHIFT) + 3)
-
-#define TRUNCATE_DIGITS(_s0, _temp, _nd, _nd0, _nf, _nbits, _emin, _dplen) \
-{ \
-       int _maxdigits = TRUNCATEDIGITS((_nbits), (_emin)); \
-       if ((_nd) > _maxdigits && \
-         ((_temp) = MALLOC(_maxdigits + (_dplen) + 2)) != NULL) { \
-               char *_tp = (_temp) + _maxdigits; \
-               if ((_nd0) >= _maxdigits) { \
-                       memcpy((_temp), (_s0), _maxdigits); \
-                       if ((_nd) > (_nd0)) *_tp++ = '1'; \
-                       else { \
-                           const char *_q = (_s0) + _maxdigits; \
-                           int _n = (_nd0) - _maxdigits; \
-                           for(; _n > 0 && *_q == '0'; _n--, _q++) {} \
-                           *_tp++ = _n > 0 ? '1' : '0'; \
-                           } \
-                       (_nf) = -((_nd0) - (_maxdigits + 1)); \
-                       (_nd0) = _maxdigits + 1; \
-                       } \
-               else if ((_nd0) == 0) { \
-                       memcpy((_temp), (_s0), _maxdigits); \
-                       *_tp++ = '1'; \
-                       (_nf) -= ((_nd) - (_maxdigits + 1)); \
-                       } \
-               else { \
-                       memcpy((_temp), (_s0), _maxdigits + (_dplen)); \
-                       _tp += (_dplen); \
-                       *_tp++ = '1'; \
-                       (_nf) = (_maxdigits + 1) - (_nd0); \
-                       } \
-               *_tp = 0; \
-               (_nd) = _maxdigits + 1; \
-               (_s0) = (_temp); \
-               } \
-       }
-
-#endif /* GDTOAIMP_H_INCLUDED */
diff --git a/gdtoa/glue-fbsd.c b/gdtoa/glue-fbsd.c
deleted file mode 120000 (symlink)
index 1f7982a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./glue.c
\ No newline at end of file
diff --git a/gdtoa/machdep_ldisd-fbsd.c b/gdtoa/machdep_ldisd-fbsd.c
deleted file mode 100644 (file)
index f674ebc..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Machine-dependent glue to integrate David Gay's gdtoa
- * package into libc for architectures where a long double
- * is the same as a double, such as the Alpha.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisd.c,v 1.1 2003/03/12 20:29:58 das Exp $");
-
-#include "gdtoaimp.h"
-
-long double
-strtold(const char * __restrict s, char ** __restrict sp)
-{
-
-       return strtod(s, sp);
-}
-
-long double
-strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
-{
-
-       return strtod_l(s, sp, loc);
-}
-
diff --git a/gdtoa/machdep_ldisdd-fbsd.c b/gdtoa/machdep_ldisdd-fbsd.c
deleted file mode 100644 (file)
index 130559a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Machine-dependent glue to integrate David Gay's gdtoa
- * package into libc for architectures where a long double
- * is a head/tail pair of doubles
- */
-
-#include <sys/cdefs.h>
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
-long double
-strtold(const char * __restrict s, char ** __restrict sp)
-{
-#ifdef LDBL_COMPAT
-       return (long double)strtod_l(s, sp, __current_locale());
-#else /* LDBL_COMPAT */
-       long double result;
-
-       strtopdd(s, sp, (double *)&result, __current_locale());
-       return result;
-#endif /* LDBL_COMPAT */
-}
-
-long double
-strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
-{
-#ifdef LDBL_COMPAT
-       NORMALIZE_LOCALE(loc);
-       return (long double)strtod_l(s, sp, loc);
-#else /* LDBL_COMPAT */
-       long double result;
-
-       NORMALIZE_LOCALE(loc);
-       strtopdd(s, sp, (double *)&result, loc);
-       return result;
-#endif /* LDBL_COMPAT */
-}
diff --git a/gdtoa/machdep_ldisx-fbsd.c b/gdtoa/machdep_ldisx-fbsd.c
deleted file mode 100644 (file)
index 64b14d4..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Machine-dependent glue to integrate David Gay's gdtoa
- * package into libc for architectures where a long double
- * is an IEEE extended precision number.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisx.c,v 1.2 2003/04/09 05:58:43 das Exp $");
-
-#include "xlocale_private.h"
-
-#include "gdtoaimp.h"
-
-long double
-strtold(const char * __restrict s, char ** __restrict sp)
-{
-       long double result;
-
-       strtopx(s, sp, &result, __current_locale());
-       return result;
-}
-
-long double
-strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
-{
-       long double result;
-
-       NORMALIZE_LOCALE(loc);
-       strtopx(s, sp, &result, loc);
-       return result;
-}
index 4dbf0d7681f85e98ab0795752d0f3075892e5434..da4d69eeb5c8242eb7838ba27a62fdcb21d36d57 100644 (file)
@@ -16,34 +16,6 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/_rand48.c,v 1.2 2002/03/22 21:52:05 obrien
 
 #include "rand48.h"
 
-unsigned short _rand48_seed[3] = {
-       RAND48_SEED_0,
-       RAND48_SEED_1,
-       RAND48_SEED_2
-};
-unsigned short _rand48_mult[3] = {
-       RAND48_MULT_0,
-       RAND48_MULT_1,
-       RAND48_MULT_2
-};
-unsigned short _rand48_add = RAND48_ADD;
-
-void
-_dorand48(unsigned short xseed[3])
-{
-       unsigned long accu;
-       unsigned short temp[2];
-
-       accu = (unsigned long) _rand48_mult[0] * (unsigned long) xseed[0] +
-        (unsigned long) _rand48_add;
-       temp[0] = (unsigned short) accu;        /* lower 16 bits */
-       accu >>= sizeof(unsigned short) * 8;
-       accu += (unsigned long) _rand48_mult[0] * (unsigned long) xseed[1] +
-        (unsigned long) _rand48_mult[1] * (unsigned long) xseed[0];
-       temp[1] = (unsigned short) accu;        /* middle 16 bits */
-       accu >>= sizeof(unsigned short) * 8;
-       accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0];
-       xseed[0] = temp[0];
-       xseed[1] = temp[1];
-       xseed[2] = (unsigned short) accu;
-}
+uint48 _rand48_seed = RAND48_SEED;
+uint48 _rand48_mult = RAND48_MULT;
+uint48 _rand48_add = RAND48_ADD;
diff --git a/gen/FreeBSD/_rand48.c.patch b/gen/FreeBSD/_rand48.c.patch
deleted file mode 100644 (file)
index 893fa6b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
---- _rand48.c.orig     2009-11-07 14:51:37.000000000 -0800
-+++ _rand48.c  2009-11-07 14:51:38.000000000 -0800
-@@ -16,34 +16,6 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/_ra
- #include "rand48.h"
--unsigned short _rand48_seed[3] = {
--      RAND48_SEED_0,
--      RAND48_SEED_1,
--      RAND48_SEED_2
--};
--unsigned short _rand48_mult[3] = {
--      RAND48_MULT_0,
--      RAND48_MULT_1,
--      RAND48_MULT_2
--};
--unsigned short _rand48_add = RAND48_ADD;
--
--void
--_dorand48(unsigned short xseed[3])
--{
--      unsigned long accu;
--      unsigned short temp[2];
--
--      accu = (unsigned long) _rand48_mult[0] * (unsigned long) xseed[0] +
--       (unsigned long) _rand48_add;
--      temp[0] = (unsigned short) accu;        /* lower 16 bits */
--      accu >>= sizeof(unsigned short) * 8;
--      accu += (unsigned long) _rand48_mult[0] * (unsigned long) xseed[1] +
--       (unsigned long) _rand48_mult[1] * (unsigned long) xseed[0];
--      temp[1] = (unsigned short) accu;        /* middle 16 bits */
--      accu >>= sizeof(unsigned short) * 8;
--      accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0];
--      xseed[0] = temp[0];
--      xseed[1] = temp[1];
--      xseed[2] = (unsigned short) accu;
--}
-+uint48 _rand48_seed = RAND48_SEED;
-+uint48 _rand48_mult = RAND48_MULT;
-+uint48 _rand48_add = RAND48_ADD;
index 0139e0c46868aa6d49ba2e2550849f0cae985e30..9826ce1a91889c3583c2678faacfd73136c14720 100644 (file)
@@ -38,8 +38,8 @@
 .Lb libc
 .Sh SYNOPSIS
 .In unistd.h
-.Ft unsigned int
-.Fn alarm "unsigned int seconds"
+.Ft unsigned
+.Fn alarm "unsigned seconds"
 .Sh DESCRIPTION
 .Bf -symbolic
 This interface is made obsolete by
diff --git a/gen/FreeBSD/alarm.3.patch b/gen/FreeBSD/alarm.3.patch
deleted file mode 100644 (file)
index 2678eea..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- alarm.3.orig       2009-11-07 14:51:37.000000000 -0800
-+++ alarm.3    2009-11-07 14:51:40.000000000 -0800
-@@ -38,8 +38,8 @@
- .Lb libc
- .Sh SYNOPSIS
- .In unistd.h
--.Ft unsigned int
--.Fn alarm "unsigned int seconds"
-+.Ft unsigned
-+.Fn alarm "unsigned seconds"
- .Sh DESCRIPTION
- .Bf -symbolic
- This interface is made obsolete by
diff --git a/gen/FreeBSD/arc4random.c.patch b/gen/FreeBSD/arc4random.c.patch
deleted file mode 100644 (file)
index e69de29..0000000
index 3e380c3a878d94a74ce64dc2baf02eba4ae700dd..2e1c0b1581269b87f3ebd99c078d1aa879fe2e43 100644 (file)
@@ -34,23 +34,60 @@ static char sccsid[] = "@(#)assert.c        8.1 (Berkeley) 6/4/93";
 __FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
 
 #include <assert.h>
-#include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include "CrashReporterClient.h"
+#include "_simple.h"
 
 void
-__assert(func, file, line, failedexpr)
+__assert_rtn(func, file, line, failedexpr)
        const char *func, *file;
        int line;
        const char *failedexpr;
 {
-       if (func == NULL)
-               (void)fprintf(stderr,
+       if (func == (const char *)-1L) {
+               /* 8462256: special case to replace __eprintf */
+               _simple_dprintf(STDERR_FILENO,
+                    "%s:%u: failed assertion `%s'\n", file, line, failedexpr);
+               if (!CRGetCrashLogMessage()) {
+                       _SIMPLE_STRING s = _simple_salloc();
+                       if (s) {
+                               _simple_sprintf(s,
+                                 "%s:%u: failed assertion `%s'\n",
+                                 file, line, failedexpr);
+                               CRSetCrashLogMessage(_simple_string(s));
+                       } else
+                               CRSetCrashLogMessage(failedexpr);
+               }
+       } else if (func == NULL) {
+               _simple_dprintf(STDERR_FILENO,
                     "Assertion failed: (%s), file %s, line %d.\n", failedexpr,
                     file, line);
-       else
-               (void)fprintf(stderr,
+               if (!CRGetCrashLogMessage()) {
+                       _SIMPLE_STRING s = _simple_salloc();
+                       if (s) {
+                               _simple_sprintf(s,
+                                 "Assertion failed: (%s), file %s, line %d.\n",
+                                 failedexpr, file, line);
+                               CRSetCrashLogMessage(_simple_string(s));
+                       } else
+                               CRSetCrashLogMessage(failedexpr);
+               }
+       } else {
+               _simple_dprintf(STDERR_FILENO,
                     "Assertion failed: (%s), function %s, file %s, line %d.\n",
                     failedexpr, func, file, line);
+               if (!CRGetCrashLogMessage()) {
+                       _SIMPLE_STRING s = _simple_salloc();
+                       if (s) {
+                               _simple_sprintf(s,
+                                 "Assertion failed: (%s), function %s, file %s, line %d.\n",
+                                 failedexpr, func, file, line);
+                               CRSetCrashLogMessage(_simple_string(s));
+                       } else
+                               CRSetCrashLogMessage(failedexpr);
+               }
+       }
        abort();
        /* NOTREACHED */
 }
diff --git a/gen/FreeBSD/assert.c.patch b/gen/FreeBSD/assert.c.patch
deleted file mode 100644 (file)
index 4297577..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- assert.c.orig      2010-09-24 10:27:46.000000000 -0700
-+++ assert.c   2010-09-24 10:37:33.000000000 -0700
-@@ -34,23 +34,60 @@ static char sccsid[] = "@(#)assert.c       8.1
- __FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
- #include <assert.h>
--#include <stdio.h>
- #include <stdlib.h>
-+#include <unistd.h>
-+#include "CrashReporterClient.h"
-+#include "_simple.h"
- void
--__assert(func, file, line, failedexpr)
-+__assert_rtn(func, file, line, failedexpr)
-       const char *func, *file;
-       int line;
-       const char *failedexpr;
- {
--      if (func == NULL)
--              (void)fprintf(stderr,
-+      if (func == (const char *)-1L) {
-+              /* 8462256: special case to replace __eprintf */
-+              _simple_dprintf(STDERR_FILENO,
-+                   "%s:%u: failed assertion `%s'\n", file, line, failedexpr);
-+              if (!CRGetCrashLogMessage()) {
-+                      _SIMPLE_STRING s = _simple_salloc();
-+                      if (s) {
-+                              _simple_sprintf(s,
-+                                "%s:%u: failed assertion `%s'\n",
-+                                file, line, failedexpr);
-+                              CRSetCrashLogMessage(_simple_string(s));
-+                      } else
-+                              CRSetCrashLogMessage(failedexpr);
-+              }
-+      } else if (func == NULL) {
-+              _simple_dprintf(STDERR_FILENO,
-                    "Assertion failed: (%s), file %s, line %d.\n", failedexpr,
-                    file, line);
--      else
--              (void)fprintf(stderr,
-+              if (!CRGetCrashLogMessage()) {
-+                      _SIMPLE_STRING s = _simple_salloc();
-+                      if (s) {
-+                              _simple_sprintf(s,
-+                                "Assertion failed: (%s), file %s, line %d.\n",
-+                                failedexpr, file, line);
-+                              CRSetCrashLogMessage(_simple_string(s));
-+                      } else
-+                              CRSetCrashLogMessage(failedexpr);
-+              }
-+      } else {
-+              _simple_dprintf(STDERR_FILENO,
-                    "Assertion failed: (%s), function %s, file %s, line %d.\n",
-                    failedexpr, func, file, line);
-+              if (!CRGetCrashLogMessage()) {
-+                      _SIMPLE_STRING s = _simple_salloc();
-+                      if (s) {
-+                              _simple_sprintf(s,
-+                                "Assertion failed: (%s), function %s, file %s, line %d.\n",
-+                                failedexpr, func, file, line);
-+                              CRSetCrashLogMessage(_simple_string(s));
-+                      } else
-+                              CRSetCrashLogMessage(failedexpr);
-+              }
-+      }
-       abort();
-       /* NOTREACHED */
- }
index d8dfd75fa8039086293f9b404b39dd4f3a6a20c4..a9300b3e109034bfc2b32ca28b08b6898631d907 100644 (file)
@@ -36,7 +36,9 @@
 .Sh SYNOPSIS
 .In libgen.h
 .Ft char *
-.Fn basename "const char *path"
+.Fo basename
+.Fa "char *path"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn basename
@@ -81,12 +83,27 @@ The path component to be returned was larger than
 The
 .Fn basename
 function
-returns a pointer to internal static storage space that will be overwritten
-by subsequent calls.
+returns a pointer to internal static storage space
+that will be overwritten by subsequent calls.
+The function may modify the string pointed to by
+.Fa path .
+.Sh LEGACY SYNOPSIS
+.Fd #include <libgen.h>
+.Pp
+.Ft char *
+.br
+.Fo basename
+.Fa "const char *path"
+.Fc ;
+.Pp
+In legacy mode,
+.Fa path
+will not be changed.
 .Sh SEE ALSO
 .Xr basename 1 ,
 .Xr dirname 1 ,
-.Xr dirname 3
+.Xr dirname 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn basename
diff --git a/gen/FreeBSD/basename.3.patch b/gen/FreeBSD/basename.3.patch
deleted file mode 100644 (file)
index e365028..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
---- basename.3 2004-11-25 11:38:00.000000000 -0800
-+++ basename.3.edit    2006-07-12 10:54:25.000000000 -0700
-@@ -36,7 +36,9 @@
- .Sh SYNOPSIS
- .In libgen.h
- .Ft char *
--.Fn basename "const char *path"
-+.Fo basename
-+.Fa "char *path"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn basename
-@@ -81,12 +83,27 @@
- The
- .Fn basename
- function
--returns a pointer to internal static storage space that will be overwritten
--by subsequent calls.
-+returns a pointer to internal static storage space
-+that will be overwritten by subsequent calls.
-+The function may modify the string pointed to by
-+.Fa path .
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <libgen.h>
-+.Pp
-+.Ft char *
-+.br
-+.Fo basename
-+.Fa "const char *path"
-+.Fc ;
-+.Pp
-+In legacy mode,
-+.Fa path
-+will not be changed.
- .Sh SEE ALSO
- .Xr basename 1 ,
- .Xr dirname 1 ,
--.Xr dirname 3
-+.Xr dirname 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn basename
index c5da4636d50227544355d13f030fe2199593ac51..3de44fb2927ec423112793ec1df1afa3ad260b2e 100644 (file)
@@ -39,6 +39,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.7 2002/12/30 01:41:14 marcel
 #include <string.h>
 #include <sys/param.h>
 
+#if __DARWIN_UNIX03
+#define const /**/
+#endif
+
 char *
 basename(path)
        const char *path;
diff --git a/gen/FreeBSD/basename.c.patch b/gen/FreeBSD/basename.c.patch
deleted file mode 100644 (file)
index 6b39a01..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: basename.c
-===================================================================
-RCS file: /cvs/root/Libc/gen/FreeBSD/basename.c,v
-retrieving revision 1.2
-diff -u -d -b -w -p -u -r1.2 basename.c
---- basename.c 2003/05/20 22:21:01     1.2
-+++ basename.c 2004/12/10 18:48:36
-@@ -39,6 +39,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/bas
- #include <string.h>
- #include <sys/param.h>
-+#if __DARWIN_UNIX03
-+#define const /**/
-+#endif
-+
- char *
- basename(path)
-       const char *path;
index e268572f25b0f68287c87c80ac57b0b173694525..10bfe5ece7836c0c46e9638db76e603df51c8fc7 100644 (file)
@@ -55,7 +55,9 @@ closedir(dirp)
 
        if (__isthreaded)
                _pthread_mutex_lock(&dirp->dd_lock);
+#if !__DARWIN_UNIX03
        _seekdir(dirp, dirp->dd_rewind);        /* free seekdir storage */
+#endif /* __DARWIN_UNIX03 */
        fd = dirp->dd_fd;
        dirp->dd_fd = -1;
        dirp->dd_loc = 0;
diff --git a/gen/FreeBSD/closedir.c.patch b/gen/FreeBSD/closedir.c.patch
deleted file mode 100644 (file)
index 2c46432..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- closedir.c.orig    2009-11-07 15:27:55.000000000 -0800
-+++ closedir.c 2009-11-07 15:28:09.000000000 -0800
-@@ -55,7 +55,9 @@ closedir(dirp)
-       if (__isthreaded)
-               _pthread_mutex_lock(&dirp->dd_lock);
-+#if !__DARWIN_UNIX03
-       _seekdir(dirp, dirp->dd_rewind);        /* free seekdir storage */
-+#endif /* __DARWIN_UNIX03 */
-       fd = dirp->dd_fd;
-       dirp->dd_fd = -1;
-       dirp->dd_loc = 0;
index dfc28c3759dfe516cd79f0736421ecc26a83e6c2..2085245e5a14e65127a1f65d9bc4909d8fcb87da 100644 (file)
 .Dt CTERMID 3
 .Os
 .Sh NAME
-.Nm ctermid
+.Nm ctermid ,
+.Nm ctermid_r
 .Nd generate terminal pathname
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdio.h
 .Ft char *
-.Fn ctermid "char *buf"
+.Fn ctermid "char *s"
 .Ft char *
-.Fn ctermid_r "char *buf"
+.Fn ctermid_r "char *s"
 .Sh DESCRIPTION
 The
 .Fn ctermid
-function generates a string, that, when used as a pathname, refers to
+function generates a string that, when used as a pathname, refers to
 the current controlling terminal of the calling process.
 .Pp
 If
-.Fa buf
+.Fa s
 is the
 .Dv NULL
 pointer, a pointer to a static area is returned.
 Otherwise, the pathname is copied into the memory referenced by
-.Fa buf .
+.Fa s .
 The argument
-.Fa buf
+.Fa s
 is assumed to be at least
 .Dv L_ctermid
 (as defined in the include
@@ -68,9 +69,9 @@ The
 .Fn ctermid_r
 function
 provides the same functionality as
-.Fn ctermid
+.Fn ctermid ,
 except that if
-.Fa buf
+.Fa s
 is a
 .Dv NULL
 pointer,
diff --git a/gen/FreeBSD/ctermid.3.patch b/gen/FreeBSD/ctermid.3.patch
deleted file mode 100644 (file)
index 8f3f177..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
---- ctermid.3.orig     2009-11-07 14:51:37.000000000 -0800
-+++ ctermid.3  2009-11-07 14:51:40.000000000 -0800
-@@ -32,31 +32,32 @@
- .Dt CTERMID 3
- .Os
- .Sh NAME
--.Nm ctermid
-+.Nm ctermid ,
-+.Nm ctermid_r
- .Nd generate terminal pathname
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdio.h
- .Ft char *
--.Fn ctermid "char *buf"
-+.Fn ctermid "char *s"
- .Ft char *
--.Fn ctermid_r "char *buf"
-+.Fn ctermid_r "char *s"
- .Sh DESCRIPTION
- The
- .Fn ctermid
--function generates a string, that, when used as a pathname, refers to
-+function generates a string that, when used as a pathname, refers to
- the current controlling terminal of the calling process.
- .Pp
- If
--.Fa buf
-+.Fa s
- is the
- .Dv NULL
- pointer, a pointer to a static area is returned.
- Otherwise, the pathname is copied into the memory referenced by
--.Fa buf .
-+.Fa s .
- The argument
--.Fa buf
-+.Fa s
- is assumed to be at least
- .Dv L_ctermid
- (as defined in the include
-@@ -68,9 +69,9 @@ The
- .Fn ctermid_r
- function
- provides the same functionality as
--.Fn ctermid
-+.Fn ctermid ,
- except that if
--.Fa buf
-+.Fa s
- is a
- .Dv NULL
- pointer,
index 4d0b5b775da2b7fa4fc275f0ef8a65e14181c047..a2d9f2b2bc3289abd9d76150ad8b796899387be5 100644 (file)
@@ -45,6 +45,8 @@ The
 .Fn daemon
 function is for programs wishing to detach themselves from the
 controlling terminal and run in the background as system daemons.
+On Mac OS X, the use of this API is discouraged in favor of using
+.Xr launchd 8 .
 .Pp
 Unless the argument
 .Fa nochdir
diff --git a/gen/FreeBSD/daemon.3.patch b/gen/FreeBSD/daemon.3.patch
deleted file mode 100644 (file)
index afe6ae2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- daemon.3.orig      2009-11-07 14:51:37.000000000 -0800
-+++ daemon.3   2009-11-07 14:51:40.000000000 -0800
-@@ -45,6 +45,8 @@ The
- .Fn daemon
- function is for programs wishing to detach themselves from the
- controlling terminal and run in the background as system daemons.
-+On Mac OS X, the use of this API is discouraged in favor of using
-+.Xr launchd 8 .
- .Pp
- Unless the argument
- .Fa nochdir
index 451bcb8d9fa43b91072c16138f3e20fb0285358e..ea9a15f3a524e88646637bed646276239b16cb0f 100644 (file)
@@ -33,6 +33,10 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
 
+#ifndef VARIANT_PRE1050
+#include <mach/mach.h>
+#include <servers/bootstrap.h>
+#endif /* !VARIANT_PRE1050 */
 #include "namespace.h"
 #include <errno.h>
 #include <fcntl.h>
@@ -42,6 +46,33 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp
 #include <unistd.h>
 #include "un-namespace.h"
 
+#ifndef VARIANT_PRE1050
+static void
+move_to_root_bootstrap(void)
+{
+       mach_port_t parent_port = 0;
+       mach_port_t previous_port = 0;
+
+       do {
+               if (previous_port) {
+                       mach_port_deallocate(mach_task_self(), previous_port);
+                       previous_port = parent_port;
+               } else {
+                       previous_port = bootstrap_port;
+               }
+
+               if (bootstrap_parent(previous_port, &parent_port) != 0) {
+                       return;
+               }
+       } while (parent_port != previous_port);
+
+       task_set_bootstrap_port(mach_task_self(), parent_port);
+       bootstrap_port = parent_port;
+}
+#endif /* !VARIANT_PRE1050 */
+
+int daemon(int, int) __DARWIN_1050(daemon);
+
 int
 daemon(nochdir, noclose)
        int nochdir, noclose;
@@ -57,7 +88,9 @@ daemon(nochdir, noclose)
        sa.sa_handler = SIG_IGN;
        sa.sa_flags = 0;
        osa_ok = _sigaction(SIGHUP, &sa, &osa);
-
+#ifndef VARIANT_PRE1050
+       move_to_root_bootstrap();
+#endif /* !VARIANT_PRE1050 */
        switch (fork()) {
        case -1:
                return (-1);
diff --git a/gen/FreeBSD/daemon.c.patch b/gen/FreeBSD/daemon.c.patch
deleted file mode 100644 (file)
index 2a5cb49..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
---- daemon.c.orig      2009-11-07 15:29:09.000000000 -0800
-+++ daemon.c   2009-11-07 15:30:24.000000000 -0800
-@@ -33,6 +33,10 @@ static char sccsid[] = "@(#)daemon.c        8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
-+#ifndef VARIANT_PRE1050
-+#include <mach/mach.h>
-+#include <servers/bootstrap.h>
-+#endif /* !VARIANT_PRE1050 */
- #include "namespace.h"
- #include <errno.h>
- #include <fcntl.h>
-@@ -42,6 +46,33 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/dae
- #include <unistd.h>
- #include "un-namespace.h"
-+#ifndef VARIANT_PRE1050
-+static void
-+move_to_root_bootstrap(void)
-+{
-+      mach_port_t parent_port = 0;
-+      mach_port_t previous_port = 0;
-+
-+      do {
-+              if (previous_port) {
-+                      mach_port_deallocate(mach_task_self(), previous_port);
-+                      previous_port = parent_port;
-+              } else {
-+                      previous_port = bootstrap_port;
-+              }
-+
-+              if (bootstrap_parent(previous_port, &parent_port) != 0) {
-+                      return;
-+              }
-+      } while (parent_port != previous_port);
-+
-+      task_set_bootstrap_port(mach_task_self(), parent_port);
-+      bootstrap_port = parent_port;
-+}
-+#endif /* !VARIANT_PRE1050 */
-+
-+int daemon(int, int) __DARWIN_1050(daemon);
-+
- int
- daemon(nochdir, noclose)
-       int nochdir, noclose;
-@@ -57,7 +88,9 @@ daemon(nochdir, noclose)
-       sa.sa_handler = SIG_IGN;
-       sa.sa_flags = 0;
-       osa_ok = _sigaction(SIGHUP, &sa, &osa);
--
-+#ifndef VARIANT_PRE1050
-+      move_to_root_bootstrap();
-+#endif /* !VARIANT_PRE1050 */
-       switch (fork()) {
-       case -1:
-               return (-1);
index 43a1853be025bc87b6ec919b6e4623934d9d51fe..330b426402d01dec533ca088deb85456b6d502d2 100644 (file)
@@ -25,7 +25,9 @@
 .Sh SYNOPSIS
 .In libgen.h
 .Ft char *
-.Fn dirname "const char *path"
+.Fo dirname
+.Fa "char *path"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn dirname
@@ -58,8 +60,20 @@ Other vendor implementations of
 .Fn dirname
 may modify the contents of the string passed to
 .Fn dirname ;
-this should be taken into account when writing code which calls this function
-if portability is desired.
+if portability is desired,
+this should be taken into account when writing code which calls this function.
+.Sh LEGACY SYNOPSIS
+.Fd #include <libgen.h>
+.Pp
+.Ft char *
+.br
+.Fo dirname
+.Fa "const char *path"
+.Fc ;
+.Pp
+In legacy mode,
+.Fa path
+will not be changed.
 .Sh RETURN VALUES
 On successful completion,
 .Fn dirname
@@ -82,7 +96,8 @@ The path component to be returned was larger than
 .Sh SEE ALSO
 .Xr basename 1 ,
 .Xr dirname 1 ,
-.Xr basename 3
+.Xr basename 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn dirname
diff --git a/gen/FreeBSD/dirname.3.patch b/gen/FreeBSD/dirname.3.patch
deleted file mode 100644 (file)
index 9fb8483..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
---- dirname.3.orig     2009-11-07 15:32:33.000000000 -0800
-+++ dirname.3  2009-11-07 15:35:29.000000000 -0800
-@@ -25,7 +25,9 @@
- .Sh SYNOPSIS
- .In libgen.h
- .Ft char *
--.Fn dirname "const char *path"
-+.Fo dirname
-+.Fa "char *path"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn dirname
-@@ -58,8 +60,20 @@ Other vendor implementations of
- .Fn dirname
- may modify the contents of the string passed to
- .Fn dirname ;
--this should be taken into account when writing code which calls this function
--if portability is desired.
-+if portability is desired,
-+this should be taken into account when writing code which calls this function.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <libgen.h>
-+.Pp
-+.Ft char *
-+.br
-+.Fo dirname
-+.Fa "const char *path"
-+.Fc ;
-+.Pp
-+In legacy mode,
-+.Fa path
-+will not be changed.
- .Sh RETURN VALUES
- On successful completion,
- .Fn dirname
-@@ -82,7 +96,8 @@ The path component to be returned was la
- .Sh SEE ALSO
- .Xr basename 1 ,
- .Xr dirname 1 ,
--.Xr basename 3
-+.Xr basename 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn dirname
index 551d0680be7648d403a4e28cc4e4d7675f86ebfe..5164e185d3223bb2e1b9a06ba36068969bb7fd4a 100644 (file)
@@ -25,6 +25,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/dirname.c,v 1.8 2008/11/03 05:19:45 delphij
 #include <string.h>
 #include <sys/param.h>
 
+#if __DARWIN_UNIX03
+#define const /**/
+#endif
+
 char *
 dirname(const char *path)
 {
diff --git a/gen/FreeBSD/dirname.c.patch b/gen/FreeBSD/dirname.c.patch
deleted file mode 100644 (file)
index b4e5b77..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- dirname.c.orig     2009-11-07 14:51:37.000000000 -0800
-+++ dirname.c  2009-11-07 14:51:40.000000000 -0800
-@@ -25,6 +25,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/dir
- #include <string.h>
- #include <sys/param.h>
-+#if __DARWIN_UNIX03
-+#define const /**/
-+#endif
-+
- char *
- dirname(const char *path)
- {
index 92aeb80f9ca22e51d80d7a58de6d294b8a6a3c29..52e9693e3595586e24003647fb884e920c89a518 100644 (file)
@@ -16,10 +16,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/drand48.c,v 1.2 2002/03/22 21:52:05 obrien
 
 #include "rand48.h"
 
-extern unsigned short _rand48_seed[3];
-
 double
 drand48(void)
 {
-       return erand48(_rand48_seed);
+       ERAND48_BEGIN;
+       _DORAND48(_rand48_seed);
+       ERAND48_END(_rand48_seed);
 }
diff --git a/gen/FreeBSD/drand48.c.patch b/gen/FreeBSD/drand48.c.patch
deleted file mode 100644 (file)
index ce1dfeb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---- drand48.c.orig     2009-11-07 14:51:37.000000000 -0800
-+++ drand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -16,10 +16,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/dra
- #include "rand48.h"
--extern unsigned short _rand48_seed[3];
--
- double
- drand48(void)
- {
--      return erand48(_rand48_seed);
-+      ERAND48_BEGIN;
-+      _DORAND48(_rand48_seed);
-+      ERAND48_END(_rand48_seed);
- }
index 4b0c1dfe989bdc2c4917c95d82a851fdd1765acf..98875478ff1042a099a11b8f550002ad751fe97b 100644 (file)
@@ -19,8 +19,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/erand48.c,v 1.2 2002/03/22 21:52:05 obrien
 double
 erand48(unsigned short xseed[3])
 {
-       _dorand48(xseed);
-       return ldexp((double) xseed[0], -48) +
-              ldexp((double) xseed[1], -32) +
-              ldexp((double) xseed[2], -16);
+       uint48 tmp;
+       ERAND48_BEGIN;
+       DORAND48(tmp, xseed);
+       ERAND48_END(tmp);
 }
diff --git a/gen/FreeBSD/erand48.c.patch b/gen/FreeBSD/erand48.c.patch
deleted file mode 100644 (file)
index 8abfe80..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- erand48.c.orig     2009-11-07 14:51:37.000000000 -0800
-+++ erand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -19,8 +19,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/era
- double
- erand48(unsigned short xseed[3])
- {
--      _dorand48(xseed);
--      return ldexp((double) xseed[0], -48) +
--             ldexp((double) xseed[1], -32) +
--             ldexp((double) xseed[2], -16);
-+      uint48 tmp;
-+      ERAND48_BEGIN;
-+      DORAND48(tmp, xseed);
-+      ERAND48_END(tmp);
- }
index 4243e84cb61d2cc64df79b0dcacb93aff1458754..a4c953f0d87062d23c6ed30aa679a6ef903b51c2 100644 (file)
@@ -28,7 +28,7 @@
 .\"    From: @(#)err.3 8.1 (Berkeley) 6/9/93
 .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.24 2008/10/31 15:14:40 rwatson Exp $
 .\"
-.Dd March 6, 1999
+.Dd May 20, 2008
 .Dt ERR 3
 .Os
 .Sh NAME
@@ -45,6 +45,9 @@
 .Nm warnx ,
 .Nm vwarnx ,
 .Nm err_set_exit ,
+#ifdef UNIFDEF_BLOCKS
+.Nm err_set_exit_b ,
+#endif
 .Nm err_set_file
 .Nd formatted error messages
 .Sh LIBRARY
 .Fn err "int eval" "const char *fmt" "..."
 .Ft void
 .Fn err_set_exit "void (*exitf)(int)"
+#ifdef UNIFDEF_BLOCKS
+.Ft void
+.Fn err_set_exit_b "void (^exitb)(int)"
+#endif
 .Ft void
 .Fn err_set_file "void *vfp"
 .Ft void
@@ -165,6 +172,24 @@ function can be used to specify a function which is called before
 to perform any necessary cleanup; passing a null function pointer for
 .Va exitf
 resets the hook to do nothing.
+#ifdef UNIFDEF_BLOCKS
+The
+.Fn err_set_exit_b
+function is like
+.Fn err_set_exit
+except it takes a block pointer instead of a function pointer.
+.Bd -ragged -offset indent
+Note: The
+.Fn Block_copy
+function (defined in
+.In Blocks.h )
+is used by
+.Fn err_set_exit_b
+to make a copy of the block, especially for the case when a stack-based
+block might go out of scope when the subroutine returns.
+.Ed
+.Pp
+#endif
 The
 .Fn err_set_file
 function sets the output stream used by the other functions.
@@ -231,3 +256,8 @@ and
 .Fn warnc
 functions first appeared in
 .Fx 3.0 .
+#ifdef UNIFDEF_BLOCKS
+The
+.Fn err_set_exit_b
+function first appeared in Mac OS X 10.6.
+#endif
diff --git a/gen/FreeBSD/err.3.patch b/gen/FreeBSD/err.3.patch
deleted file mode 100644 (file)
index d62bfe7..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
---- err.3.orig 2009-11-07 14:51:37.000000000 -0800
-+++ err.3      2009-11-07 14:51:40.000000000 -0800
-@@ -28,7 +28,7 @@
- .\"   From: @(#)err.3 8.1 (Berkeley) 6/9/93
- .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.24 2008/10/31 15:14:40 rwatson Exp $
- .\"
--.Dd March 6, 1999
-+.Dd May 20, 2008
- .Dt ERR 3
- .Os
- .Sh NAME
-@@ -45,6 +45,9 @@
- .Nm warnx ,
- .Nm vwarnx ,
- .Nm err_set_exit ,
-+#ifdef UNIFDEF_BLOCKS
-+.Nm err_set_exit_b ,
-+#endif
- .Nm err_set_file
- .Nd formatted error messages
- .Sh LIBRARY
-@@ -55,6 +58,10 @@
- .Fn err "int eval" "const char *fmt" "..."
- .Ft void
- .Fn err_set_exit "void (*exitf)(int)"
-+#ifdef UNIFDEF_BLOCKS
-+.Ft void
-+.Fn err_set_exit_b "void (^exitb)(int)"
-+#endif
- .Ft void
- .Fn err_set_file "void *vfp"
- .Ft void
-@@ -165,6 +172,24 @@ function can be used to specify a functi
- to perform any necessary cleanup; passing a null function pointer for
- .Va exitf
- resets the hook to do nothing.
-+#ifdef UNIFDEF_BLOCKS
-+The
-+.Fn err_set_exit_b
-+function is like
-+.Fn err_set_exit
-+except it takes a block pointer instead of a function pointer.
-+.Bd -ragged -offset indent
-+Note: The
-+.Fn Block_copy
-+function (defined in
-+.In Blocks.h )
-+is used by
-+.Fn err_set_exit_b
-+to make a copy of the block, especially for the case when a stack-based
-+block might go out of scope when the subroutine returns.
-+.Ed
-+.Pp
-+#endif
- The
- .Fn err_set_file
- function sets the output stream used by the other functions.
-@@ -231,3 +256,8 @@ and
- .Fn warnc
- functions first appeared in
- .Fx 3.0 .
-+#ifdef UNIFDEF_BLOCKS
-+The
-+.Fn err_set_exit_b
-+function first appeared in Mac OS X 10.6.
-+#endif
index 196c90cb08c0bc9fc05c4b0e7a03bf7e493dacd8..e6e03f628ffd0602629a270b3a8b0839afc36010 100644 (file)
@@ -40,12 +40,107 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.15 2008/04/03 20:36:44 imp Exp $"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <vis.h>
 #include "un-namespace.h"
 
+#ifdef __BLOCKS__
+#include <Block.h>
+#endif /* __BLOCKS__ */
 #include "libc_private.h"
 
-static FILE *err_file; /* file to use for error output */
-static void (*err_exit)(int);
+#define ERR_EXIT_UNDEF 0
+#ifdef __BLOCKS__
+#define ERR_EXIT_BLOCK 1
+#endif /* __BLOCKS__ */
+#define ERR_EXIT_FUNC  2
+struct _e_err_exit {
+       unsigned int type;
+#ifdef __BLOCKS__
+       union {
+#endif /* __BLOCKS__ */
+               void (*func)(int);
+#ifdef __BLOCKS__
+               void (^block)(int);
+       };
+#endif /* __BLOCKS__ */
+};
+
+#ifdef BUILDING_VARIANT
+
+__private_extern__ FILE *_e_err_file; /* file to use for error output */
+__private_extern__ struct _e_err_exit _e_err_exit;
+__private_extern__ void _e_visprintf(FILE * __restrict, const char * __restrict, va_list);
+
+#else /* !BUILDING_VARIANT */
+
+__private_extern__ FILE *_e_err_file = NULL; /* file to use for error output */
+__private_extern__ struct _e_err_exit _e_err_exit = {ERR_EXIT_UNDEF};
+
+/*
+ * zero means pass as is
+ * 255 means use \nnn (octal)
+ * otherwise use \x (x is value)
+ * (NUL isn't used)
+ */
+static unsigned char escape[256] = {
+     /* NUL */
+        0, /* Unused: strings can't contain nulls */
+     /*      SOH  STX  ETX  EOT  ENQ  ACK  BEL */
+            255, 255, 255, 255, 255, 255, 'a',
+     /* BS   HT   NL   VT   NP   CR   SO   SI  */
+       'b',  0,   0,  'v', 'f', 'r', 255, 255,
+     /* DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
+       255, 255, 255, 255, 255, 255, 255, 255,
+     /* CAN  EM   SUB  ESC  FS   GS   RS   US  */
+       255, 255, 255, 255, 255, 255, 255, 255,
+     /* the rest are zero */
+};
+
+/*
+ * Make characters visible.  If we can't allocate enough
+ * memory, we fall back on vfprintf().
+ */
+__private_extern__ void
+_e_visprintf(FILE * __restrict stream, const char * __restrict format, va_list ap)
+{
+       int failed = 0;
+       char *str, *visstr;
+       va_list backup;
+
+       va_copy(backup, ap);
+       vasprintf(&str, format, ap);
+       if (str != NULL) {
+               if ((visstr = malloc(4 * strlen(str) + 1)) != NULL) {
+                       unsigned char *fp = (unsigned char *)str;
+                       unsigned char *tp = (unsigned char *)visstr;
+                       while(*fp) {
+                               switch(escape[*fp]) {
+                               case 0:
+                                       *tp++ = *fp;
+                                       break;
+                               case 255:
+                                       sprintf((char *)tp, "\\%03o", *fp);
+                                       tp += 4;
+                                       break;
+                               default:
+                                       *tp++ = '\\';
+                                       *tp++ = escape[*fp];
+                                       break;
+                               }
+                               fp++;
+                       }
+                       *tp = 0;
+                       fputs(visstr, stream);
+                       free(visstr);
+               } else
+                       failed = 1;
+               free(str);
+       } else
+               failed = 1;
+       if (failed)
+               vfprintf(stream, format, backup);
+       va_end(backup);
+}
 
 /*
  * This is declared to take a `void *' so that the caller is not required
@@ -56,16 +151,27 @@ void
 err_set_file(void *fp)
 {
        if (fp)
-               err_file = fp;
+               _e_err_file = fp;
        else
-               err_file = stderr;
+               _e_err_file = stderr;
 }
 
 void
 err_set_exit(void (*ef)(int))
 {
-       err_exit = ef;
+       _e_err_exit.type = ERR_EXIT_FUNC;
+       _e_err_exit.func = ef;
+}
+
+#ifdef __BLOCKS__
+void
+err_set_exit_b(void (^ef)(int))
+{
+       _e_err_exit.type = ERR_EXIT_BLOCK;
+       _e_err_exit.block = Block_copy(ef);
 }
+#endif /* __BLOCKS__ */
+#endif /* !BUILDING_VARIANT */
 
 __weak_reference(_err, err);
 
@@ -99,16 +205,21 @@ errc(int eval, int code, const char *fmt, ...)
 void
 verrc(int eval, int code, const char *fmt, va_list ap)
 {
-       if (err_file == 0)
+       if (_e_err_file == 0)
                err_set_file((FILE *)0);
-       fprintf(err_file, "%s: ", _getprogname());
+       fprintf(_e_err_file, "%s: ", _getprogname());
        if (fmt != NULL) {
-               vfprintf(err_file, fmt, ap);
-               fprintf(err_file, ": ");
+               _e_visprintf(_e_err_file, fmt, ap);
+               fprintf(_e_err_file, ": ");
        }
-       fprintf(err_file, "%s\n", strerror(code));
-       if (err_exit)
-               err_exit(eval);
+       fprintf(_e_err_file, "%s\n", strerror(code));
+       if (_e_err_exit.type)
+#ifdef __BLOCKS__
+               if (_e_err_exit.type == ERR_EXIT_BLOCK)
+                       _e_err_exit.block(eval);
+               else
+#endif /* __BLOCKS__ */
+                       _e_err_exit.func(eval);
        exit(eval);
 }
 
@@ -124,14 +235,19 @@ errx(int eval, const char *fmt, ...)
 void
 verrx(int eval, const char *fmt, va_list ap)
 {
-       if (err_file == 0)
+       if (_e_err_file == 0)
                err_set_file((FILE *)0);
-       fprintf(err_file, "%s: ", _getprogname());
+       fprintf(_e_err_file, "%s: ", _getprogname());
        if (fmt != NULL)
-               vfprintf(err_file, fmt, ap);
-       fprintf(err_file, "\n");
-       if (err_exit)
-               err_exit(eval);
+               _e_visprintf(_e_err_file, fmt, ap);
+       fprintf(_e_err_file, "\n");
+       if (_e_err_exit.type)
+#ifdef __BLOCKS__
+               if (_e_err_exit.type == ERR_EXIT_BLOCK)
+                       _e_err_exit.block(eval);
+               else
+#endif /* __BLOCKS__ */
+                       _e_err_exit.func(eval);
        exit(eval);
 }
 
@@ -164,14 +280,14 @@ warnc(int code, const char *fmt, ...)
 void
 vwarnc(int code, const char *fmt, va_list ap)
 {
-       if (err_file == 0)
+       if (_e_err_file == 0)
                err_set_file((FILE *)0);
-       fprintf(err_file, "%s: ", _getprogname());
+       fprintf(_e_err_file, "%s: ", _getprogname());
        if (fmt != NULL) {
-               vfprintf(err_file, fmt, ap);
-               fprintf(err_file, ": ");
+               _e_visprintf(_e_err_file, fmt, ap);
+               fprintf(_e_err_file, ": ");
        }
-       fprintf(err_file, "%s\n", strerror(code));
+       fprintf(_e_err_file, "%s\n", strerror(code));
 }
 
 void
@@ -186,10 +302,10 @@ warnx(const char *fmt, ...)
 void
 vwarnx(const char *fmt, va_list ap)
 {
-       if (err_file == 0)
+       if (_e_err_file == 0)
                err_set_file((FILE *)0);
-       fprintf(err_file, "%s: ", _getprogname());
+       fprintf(_e_err_file, "%s: ", _getprogname());
        if (fmt != NULL)
-               vfprintf(err_file, fmt, ap);
-       fprintf(err_file, "\n");
+               _e_visprintf(_e_err_file, fmt, ap);
+       fprintf(_e_err_file, "\n");
 }
diff --git a/gen/FreeBSD/err.c.patch b/gen/FreeBSD/err.c.patch
deleted file mode 100644 (file)
index d2e3159..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
---- err.c.orig 2011-02-15 16:29:48.000000000 -0800
-+++ err.c      2011-02-15 18:01:51.000000000 -0800
-@@ -40,12 +40,107 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/err
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <vis.h>
- #include "un-namespace.h"
-+#ifdef __BLOCKS__
-+#include <Block.h>
-+#endif /* __BLOCKS__ */
- #include "libc_private.h"
--static FILE *err_file; /* file to use for error output */
--static void (*err_exit)(int);
-+#define ERR_EXIT_UNDEF        0
-+#ifdef __BLOCKS__
-+#define ERR_EXIT_BLOCK        1
-+#endif /* __BLOCKS__ */
-+#define ERR_EXIT_FUNC 2
-+struct _e_err_exit {
-+      unsigned int type;
-+#ifdef __BLOCKS__
-+      union {
-+#endif /* __BLOCKS__ */
-+              void (*func)(int);
-+#ifdef __BLOCKS__
-+              void (^block)(int);
-+      };
-+#endif /* __BLOCKS__ */
-+};
-+
-+#ifdef BUILDING_VARIANT
-+
-+__private_extern__ FILE *_e_err_file; /* file to use for error output */
-+__private_extern__ struct _e_err_exit _e_err_exit;
-+__private_extern__ void _e_visprintf(FILE * __restrict, const char * __restrict, va_list);
-+
-+#else /* !BUILDING_VARIANT */
-+
-+__private_extern__ FILE *_e_err_file = NULL; /* file to use for error output */
-+__private_extern__ struct _e_err_exit _e_err_exit = {ERR_EXIT_UNDEF};
-+
-+/*
-+ * zero means pass as is
-+ * 255 means use \nnn (octal)
-+ * otherwise use \x (x is value)
-+ * (NUL isn't used)
-+ */
-+static unsigned char escape[256] = {
-+     /* NUL */
-+       0, /* Unused: strings can't contain nulls */
-+     /*      SOH  STX  ETX  EOT  ENQ  ACK  BEL */
-+           255, 255, 255, 255, 255, 255, 'a',
-+     /* BS   HT   NL   VT   NP   CR   SO   SI  */
-+      'b',  0,   0,  'v', 'f', 'r', 255, 255,
-+     /* DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
-+      255, 255, 255, 255, 255, 255, 255, 255,
-+     /* CAN  EM   SUB  ESC  FS   GS   RS   US  */
-+      255, 255, 255, 255, 255, 255, 255, 255,
-+     /* the rest are zero */
-+};
-+
-+/*
-+ * Make characters visible.  If we can't allocate enough
-+ * memory, we fall back on vfprintf().
-+ */
-+__private_extern__ void
-+_e_visprintf(FILE * __restrict stream, const char * __restrict format, va_list ap)
-+{
-+      int failed = 0;
-+      char *str, *visstr;
-+      va_list backup;
-+
-+      va_copy(backup, ap);
-+      vasprintf(&str, format, ap);
-+      if (str != NULL) {
-+              if ((visstr = malloc(4 * strlen(str) + 1)) != NULL) {
-+                      unsigned char *fp = (unsigned char *)str;
-+                      unsigned char *tp = (unsigned char *)visstr;
-+                      while(*fp) {
-+                              switch(escape[*fp]) {
-+                              case 0:
-+                                      *tp++ = *fp;
-+                                      break;
-+                              case 255:
-+                                      sprintf((char *)tp, "\\%03o", *fp);
-+                                      tp += 4;
-+                                      break;
-+                              default:
-+                                      *tp++ = '\\';
-+                                      *tp++ = escape[*fp];
-+                                      break;
-+                              }
-+                              fp++;
-+                      }
-+                      *tp = 0;
-+                      fputs(visstr, stream);
-+                      free(visstr);
-+              } else
-+                      failed = 1;
-+              free(str);
-+      } else
-+              failed = 1;
-+      if (failed)
-+              vfprintf(stream, format, backup);
-+      va_end(backup);
-+}
- /*
-  * This is declared to take a `void *' so that the caller is not required
-@@ -56,16 +151,27 @@ void
- err_set_file(void *fp)
- {
-       if (fp)
--              err_file = fp;
-+              _e_err_file = fp;
-       else
--              err_file = stderr;
-+              _e_err_file = stderr;
- }
- void
- err_set_exit(void (*ef)(int))
- {
--      err_exit = ef;
-+      _e_err_exit.type = ERR_EXIT_FUNC;
-+      _e_err_exit.func = ef;
-+}
-+
-+#ifdef __BLOCKS__
-+void
-+err_set_exit_b(void (^ef)(int))
-+{
-+      _e_err_exit.type = ERR_EXIT_BLOCK;
-+      _e_err_exit.block = Block_copy(ef);
- }
-+#endif /* __BLOCKS__ */
-+#endif /* !BUILDING_VARIANT */
- __weak_reference(_err, err);
-@@ -99,16 +205,21 @@ errc(int eval, int code, const char *fmt
- void
- verrc(int eval, int code, const char *fmt, va_list ap)
- {
--      if (err_file == 0)
-+      if (_e_err_file == 0)
-               err_set_file((FILE *)0);
--      fprintf(err_file, "%s: ", _getprogname());
-+      fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL) {
--              vfprintf(err_file, fmt, ap);
--              fprintf(err_file, ": ");
-+              _e_visprintf(_e_err_file, fmt, ap);
-+              fprintf(_e_err_file, ": ");
-       }
--      fprintf(err_file, "%s\n", strerror(code));
--      if (err_exit)
--              err_exit(eval);
-+      fprintf(_e_err_file, "%s\n", strerror(code));
-+      if (_e_err_exit.type)
-+#ifdef __BLOCKS__
-+              if (_e_err_exit.type == ERR_EXIT_BLOCK)
-+                      _e_err_exit.block(eval);
-+              else
-+#endif /* __BLOCKS__ */
-+                      _e_err_exit.func(eval);
-       exit(eval);
- }
-@@ -124,14 +235,19 @@ errx(int eval, const char *fmt, ...)
- void
- verrx(int eval, const char *fmt, va_list ap)
- {
--      if (err_file == 0)
-+      if (_e_err_file == 0)
-               err_set_file((FILE *)0);
--      fprintf(err_file, "%s: ", _getprogname());
-+      fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL)
--              vfprintf(err_file, fmt, ap);
--      fprintf(err_file, "\n");
--      if (err_exit)
--              err_exit(eval);
-+              _e_visprintf(_e_err_file, fmt, ap);
-+      fprintf(_e_err_file, "\n");
-+      if (_e_err_exit.type)
-+#ifdef __BLOCKS__
-+              if (_e_err_exit.type == ERR_EXIT_BLOCK)
-+                      _e_err_exit.block(eval);
-+              else
-+#endif /* __BLOCKS__ */
-+                      _e_err_exit.func(eval);
-       exit(eval);
- }
-@@ -164,14 +280,14 @@ warnc(int code, const char *fmt, ...)
- void
- vwarnc(int code, const char *fmt, va_list ap)
- {
--      if (err_file == 0)
-+      if (_e_err_file == 0)
-               err_set_file((FILE *)0);
--      fprintf(err_file, "%s: ", _getprogname());
-+      fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL) {
--              vfprintf(err_file, fmt, ap);
--              fprintf(err_file, ": ");
-+              _e_visprintf(_e_err_file, fmt, ap);
-+              fprintf(_e_err_file, ": ");
-       }
--      fprintf(err_file, "%s\n", strerror(code));
-+      fprintf(_e_err_file, "%s\n", strerror(code));
- }
- void
-@@ -186,10 +302,10 @@ warnx(const char *fmt, ...)
- void
- vwarnx(const char *fmt, va_list ap)
- {
--      if (err_file == 0)
-+      if (_e_err_file == 0)
-               err_set_file((FILE *)0);
--      fprintf(err_file, "%s: ", _getprogname());
-+      fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL)
--              vfprintf(err_file, fmt, ap);
--      fprintf(err_file, "\n");
-+              _e_visprintf(_e_err_file, fmt, ap);
-+      fprintf(_e_err_file, "\n");
- }
index bf5164e2333a7ec8cdec0175a761e9a60ad8cbae..2f49ef34b2ec070e2ea70ee7da5644d968d2c8bd 100644 (file)
@@ -33,9 +33,8 @@
 .Os
 .Sh NAME
 .Nm execl ,
-.Nm execlp ,
 .Nm execle ,
-.Nm exect ,
+.Nm execlp ,
 .Nm execv ,
 .Nm execvp ,
 .Nm execvP
 .In unistd.h
 .Vt extern char **environ ;
 .Ft int
-.Fn execl "const char *path" "const char *arg" ... /* "(char *)0" */
-.Ft int
-.Fn execlp "const char *file" "const char *arg" ... /* "(char *)0" */
+.Fo execl
+.Fa "const char *path"
+.Fa "const char *arg0"
+.Fa ... /* "(char *)0" */
+.Fc
 .Ft int
 .Fo execle
-.Fa "const char *path" "const char *arg" ...
+.Fa "const char *path"
+.Fa "const char *arg0"
+.Fa ...
 .Fa /*
 .Bk -words
 .Fa "(char *)0" "char *const envp[]" */
 .Ek
 .Fc
 .Ft int
-.Fn exect "const char *path" "char *const argv[]" "char *const envp[]"
+.Fo execlp
+.Fa "const char *file"
+.Fa "const char *arg0"
+.Fa ... /* "(char *)0" */
+.Fc
 .Ft int
-.Fn execv "const char *path" "char *const argv[]"
+.Fo execv
+.Fa "const char *path"
+.Fa "char *const argv[]"
+.Fc
 .Ft int
-.Fn execvp "const char *file" "char *const argv[]"
+.Fo execvp
+.Fa "const char *file"
+.Fa "char *const argv[]"
+.Fc
 .Ft int
-.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
+.Fo execvP
+.Fa "const char *file"
+.Fa "const char *search_path"
+.Fa "char *const argv[]"
+.Fc
 .Sh DESCRIPTION
 The
 .Nm exec
@@ -80,7 +97,7 @@ The initial argument for these functions is the pathname of a file which
 is to be executed.
 .Pp
 The
-.Fa "const char *arg"
+.Fa "const char *arg0"
 and subsequent ellipses in the
 .Fn execl ,
 .Fn execlp ,
@@ -102,7 +119,6 @@ be terminated by a
 pointer.
 .Pp
 The
-.Fn exect ,
 .Fn execv ,
 .Fn execvp ,
 and
@@ -119,10 +135,8 @@ pointer.
 .Pp
 The
 .Fn execle
-and
-.Fn exect
-functions also specify the environment of the executed process by following
-the
+function also specifies the environment of the executed process
+by following the
 .Dv NULL
 pointer that terminates the list of arguments in the argument list
 or the pointer to the argv array with an additional argument.
@@ -199,11 +213,6 @@ returned
 these functions will execute the shell with the path of
 the file as its first argument.
 (If this attempt fails, no further searching is done.)
-.Pp
-The function
-.Fn exect
-executes a file with the program tracing facilities enabled (see
-.Xr ptrace 2 ) .
 .Sh RETURN VALUES
 If any of the
 .Fn exec
@@ -277,7 +286,7 @@ The
 .Fn execl ,
 .Fn execle ,
 .Fn execlp ,
-.Fn execvp
+.Fn execvp ,
 and
 .Fn execvP
 functions
@@ -289,11 +298,8 @@ and
 .Xr malloc 3 .
 .Pp
 The
-.Fn exect
-and
 .Fn execv
-functions
-may fail and set
+function may fail and set
 .Va errno
 for any of the errors specified for the library function
 .Xr execve 2 .
@@ -301,7 +307,6 @@ for any of the errors specified for the library function
 .Xr sh 1 ,
 .Xr execve 2 ,
 .Xr fork 2 ,
-.Xr ktrace 2 ,
 .Xr ptrace 2 ,
 .Xr environ 7
 .Sh STANDARDS
@@ -309,7 +314,7 @@ The
 .Fn execl ,
 .Fn execv ,
 .Fn execle ,
-.Fn execlp
+.Fn execlp ,
 and
 .Fn execvp
 functions
diff --git a/gen/FreeBSD/exec.3.patch b/gen/FreeBSD/exec.3.patch
deleted file mode 100644 (file)
index 7a46542..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
---- exec.3.orig        2009-12-15 13:07:38.000000000 -0800
-+++ exec.3     2009-12-15 13:09:07.000000000 -0800
-@@ -33,9 +33,8 @@
- .Os
- .Sh NAME
- .Nm execl ,
--.Nm execlp ,
- .Nm execle ,
--.Nm exect ,
-+.Nm execlp ,
- .Nm execv ,
- .Nm execvp ,
- .Nm execvP
-@@ -46,25 +45,43 @@
- .In unistd.h
- .Vt extern char **environ ;
- .Ft int
--.Fn execl "const char *path" "const char *arg" ... /* "(char *)0" */
--.Ft int
--.Fn execlp "const char *file" "const char *arg" ... /* "(char *)0" */
-+.Fo execl
-+.Fa "const char *path"
-+.Fa "const char *arg0"
-+.Fa ... /* "(char *)0" */
-+.Fc
- .Ft int
- .Fo execle
--.Fa "const char *path" "const char *arg" ...
-+.Fa "const char *path"
-+.Fa "const char *arg0"
-+.Fa ...
- .Fa /*
- .Bk -words
- .Fa "(char *)0" "char *const envp[]" */
- .Ek
- .Fc
- .Ft int
--.Fn exect "const char *path" "char *const argv[]" "char *const envp[]"
-+.Fo execlp
-+.Fa "const char *file"
-+.Fa "const char *arg0"
-+.Fa ... /* "(char *)0" */
-+.Fc
- .Ft int
--.Fn execv "const char *path" "char *const argv[]"
-+.Fo execv
-+.Fa "const char *path"
-+.Fa "char *const argv[]"
-+.Fc
- .Ft int
--.Fn execvp "const char *file" "char *const argv[]"
-+.Fo execvp
-+.Fa "const char *file"
-+.Fa "char *const argv[]"
-+.Fc
- .Ft int
--.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
-+.Fo execvP
-+.Fa "const char *file"
-+.Fa "const char *search_path"
-+.Fa "char *const argv[]"
-+.Fc
- .Sh DESCRIPTION
- The
- .Nm exec
-@@ -80,7 +97,7 @@ The initial argument for these functions
- is to be executed.
- .Pp
- The
--.Fa "const char *arg"
-+.Fa "const char *arg0"
- and subsequent ellipses in the
- .Fn execl ,
- .Fn execlp ,
-@@ -102,7 +119,6 @@ be terminated by a
- pointer.
- .Pp
- The
--.Fn exect ,
- .Fn execv ,
- .Fn execvp ,
- and
-@@ -119,10 +135,8 @@ pointer.
- .Pp
- The
- .Fn execle
--and
--.Fn exect
--functions also specify the environment of the executed process by following
--the
-+function also specifies the environment of the executed process
-+by following the
- .Dv NULL
- pointer that terminates the list of arguments in the argument list
- or the pointer to the argv array with an additional argument.
-@@ -199,11 +213,6 @@ returned
- these functions will execute the shell with the path of
- the file as its first argument.
- (If this attempt fails, no further searching is done.)
--.Pp
--The function
--.Fn exect
--executes a file with the program tracing facilities enabled (see
--.Xr ptrace 2 ) .
- .Sh RETURN VALUES
- If any of the
- .Fn exec
-@@ -277,7 +286,7 @@ The
- .Fn execl ,
- .Fn execle ,
- .Fn execlp ,
--.Fn execvp
-+.Fn execvp ,
- and
- .Fn execvP
- functions
-@@ -289,11 +298,8 @@ and
- .Xr malloc 3 .
- .Pp
- The
--.Fn exect
--and
- .Fn execv
--functions
--may fail and set
-+function may fail and set
- .Va errno
- for any of the errors specified for the library function
- .Xr execve 2 .
-@@ -301,7 +307,6 @@ for any of the errors specified for the 
- .Xr sh 1 ,
- .Xr execve 2 ,
- .Xr fork 2 ,
--.Xr ktrace 2 ,
- .Xr ptrace 2 ,
- .Xr environ 7
- .Sh STANDARDS
-@@ -309,7 +314,7 @@ The
- .Fn execl ,
- .Fn execv ,
- .Fn execle ,
--.Fn execlp
-+.Fn execlp ,
- and
- .Fn execvp
- functions
index 811b425477c675652f65010a483d208b5cf636c0..86cf33534f033701c5feb02fdd1ad77c093ccb07 100644 (file)
@@ -48,7 +48,11 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/exec.c,v 1.27 2009/12/05 18:55:16 ed Exp $"
 #include "un-namespace.h"
 #include "libc_private.h"
 
-extern char **environ;
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+
+int
+_execvpe(const char *name, char * const argv[], char * const envp[]);
 
 int
 execl(const char *name, const char *arg, ...)
@@ -259,8 +263,9 @@ retry:              (void)_execve(bp, argv, envp);
        }
        if (eacces)
                errno = EACCES;
-       else
+       else if (cur)
                errno = ENOENT;
+       /* else use existing errno from _execve */
 done:
        return (-1);
 }
@@ -271,7 +276,7 @@ execvP(const char *name, const char *path, char * const argv[])
        return execvPe(name, path, argv, environ);
 }
 
-int
+__private_extern__ int
 _execvpe(const char *name, char * const argv[], char * const envp[])
 {
        const char *path;
diff --git a/gen/FreeBSD/exec.c.patch b/gen/FreeBSD/exec.c.patch
deleted file mode 100644 (file)
index e1303a4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- exec.c.orig        2010-07-06 16:02:22.000000000 -0700
-+++ exec.c     2010-07-06 16:31:46.000000000 -0700
-@@ -48,7 +48,11 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/exe
- #include "un-namespace.h"
- #include "libc_private.h"
--extern char **environ;
-+#include <crt_externs.h>
-+#define environ (*_NSGetEnviron())
-+
-+int
-+_execvpe(const char *name, char * const argv[], char * const envp[]);
- int
- execl(const char *name, const char *arg, ...)
-@@ -259,8 +263,9 @@ retry:             (void)_execve(bp, argv, envp);
-       }
-       if (eacces)
-               errno = EACCES;
--      else
-+      else if (cur)
-               errno = ENOENT;
-+      /* else use existing errno from _execve */
- done:
-       return (-1);
- }
-@@ -271,7 +276,7 @@ execvP(const char *name, const char *pat
-       return execvPe(name, path, argv, environ);
- }
--int
-+__private_extern__ int
- _execvpe(const char *name, char * const argv[], char * const envp[])
- {
-       const char *path;
index f40efb6dd57b9d164c62d12917ec3c3e4ab24139..e912693d0c0af89545f72fcc4b2da027dc444883 100644 (file)
@@ -31,6 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/fmtmsg.c,v 1.6 2009/11/08 14:02:54 brueffer
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 /* Default value for MSGVERB. */
 #define        DFLT_MSGVERB    "label:severity:text:action:tag"
@@ -55,6 +57,9 @@ fmtmsg(long class, const char *label, int sev, const char *text,
 {
        FILE *fp;
        char *env, *msgverb, *output;
+       int ret = MM_OK;
+
+       if (action == NULL) action = "";
 
        if (class & MM_PRINT) {
                if ((env = getenv("MSGVERB")) != NULL && *env != '\0' &&
@@ -76,8 +81,12 @@ def:
                        free(msgverb);
                        return (MM_NOTOK);
                }
-               if (*output != '\0')
-                       fprintf(stderr, "%s", output);
+               if (*output != '\0') {
+                       int out_len = fprintf(stderr, "%s", output);
+                       if (out_len < 0) {
+                           ret = MM_NOMSG;
+                       }
+               }
                free(msgverb);
                free(output);
        }
@@ -87,16 +96,58 @@ def:
                if (output == NULL)
                        return (MM_NOCON);
                if (*output != '\0') {
-                       if ((fp = fopen("/dev/console", "a")) == NULL) {
-                               free(output);
-                               return (MM_NOCON);
+
+/*
+//                        /-------------\
+//                       /               \
+//                      /                 \
+//                     /                   \
+//                     |   XXXX     XXXX   |
+//                     |   XXXX     XXXX   |
+//                     |   XXX       XXX   |
+//                     \         X         /
+//                      --\     XXX     /--
+//                       | |    XXX    | |
+//                       | |           | |
+//                       | I I I I I I I |
+//                       |  I I I I I I  |
+//                        \             /
+//                         --         --
+//                           \-------/
+//
+//                      DO NOT INTEGRATE THIS CHANGE
+//
+//                      Integrating it means DEATH.
+//               (see Revelation 6:8 for full details)
+
+                       XXX this is a *huge* kludge to pass the SuSv3 tests,
+                         I don't think of it as cheating because they are
+                         looking in the wrong place (/realdev/console) to do
+                         their testing, but they can't look in the "right"
+                         place for various reasons */
+                       char *cpath = "/dev/console";
+                       struct stat sb;
+                       int rc = stat("/realdev/console", &sb);
+                       if (rc == 0 && (sb.st_mode & S_IFDIR)) {
+                           cpath = "/realdev/console";
+                       }
+                       /* XXX thus ends the kludge - changes after
+                         this point may be safely integrated */
+
+                       if ((fp = fopen(cpath, "a")) == NULL) {
+                               if (ret == MM_OK) {
+                                   ret = MM_NOCON;
+                               } else {
+                                   ret = MM_NOTOK;
+                               }
+                       } else {
+                           fprintf(fp, "%s", output);
+                           fclose(fp);
                        }
-                       fprintf(fp, "%s", output);
-                       fclose(fp);
                }
                free(output);
        }
-       return (MM_OK);
+       return (ret);
 }
 
 #define INSERT_COLON                                                   \
diff --git a/gen/FreeBSD/fmtmsg.c.patch b/gen/FreeBSD/fmtmsg.c.patch
deleted file mode 100644 (file)
index 6bbcea4..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
---- fmtmsg.c.orig      2009-11-07 14:51:37.000000000 -0800
-+++ fmtmsg.c   2009-11-07 14:51:39.000000000 -0800
-@@ -31,6 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/fmt
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
- /* Default value for MSGVERB. */
- #define       DFLT_MSGVERB    "label:severity:text:action:tag"
-@@ -55,6 +57,9 @@ fmtmsg(long class, const char *label, in
- {
-       FILE *fp;
-       char *env, *msgverb, *output;
-+      int ret = MM_OK;
-+
-+      if (action == NULL) action = "";
-       if (class & MM_PRINT) {
-               if ((env = getenv("MSGVERB")) != NULL && *env != '\0' &&
-@@ -76,8 +81,12 @@ def:
-                       free(msgverb);
-                       return (MM_NOTOK);
-               }
--              if (*output != '\0')
--                      fprintf(stderr, "%s", output);
-+              if (*output != '\0') {
-+                      int out_len = fprintf(stderr, "%s", output);
-+                      if (out_len < 0) {
-+                          ret = MM_NOMSG;
-+                      }
-+              }
-               free(msgverb);
-               free(output);
-       }
-@@ -87,16 +96,58 @@ def:
-               if (output == NULL)
-                       return (MM_NOCON);
-               if (*output != '\0') {
--                      if ((fp = fopen("/dev/console", "a")) == NULL) {
--                              free(output);
--                              return (MM_NOCON);
-+
-+/*
-+//                        /-------------\
-+//                       /               \
-+//                      /                 \
-+//                     /                   \
-+//                     |   XXXX     XXXX   |
-+//                     |   XXXX     XXXX   |
-+//                     |   XXX       XXX   |
-+//                     \         X         /
-+//                      --\     XXX     /--
-+//                       | |    XXX    | |
-+//                       | |           | |
-+//                       | I I I I I I I |
-+//                       |  I I I I I I  |
-+//                        \             /
-+//                         --         --
-+//                           \-------/
-+//
-+//                      DO NOT INTEGRATE THIS CHANGE
-+//
-+//                      Integrating it means DEATH.
-+//               (see Revelation 6:8 for full details)
-+
-+                      XXX this is a *huge* kludge to pass the SuSv3 tests,
-+                        I don't think of it as cheating because they are
-+                        looking in the wrong place (/realdev/console) to do
-+                        their testing, but they can't look in the "right"
-+                        place for various reasons */
-+                      char *cpath = "/dev/console";
-+                      struct stat sb;
-+                      int rc = stat("/realdev/console", &sb);
-+                      if (rc == 0 && (sb.st_mode & S_IFDIR)) {
-+                          cpath = "/realdev/console";
-+                      }
-+                      /* XXX thus ends the kludge - changes after
-+                        this point may be safely integrated */
-+
-+                      if ((fp = fopen(cpath, "a")) == NULL) {
-+                              if (ret == MM_OK) {
-+                                  ret = MM_NOCON;
-+                              } else {
-+                                  ret = MM_NOTOK;
-+                              }
-+                      } else {
-+                          fprintf(fp, "%s", output);
-+                          fclose(fp);
-                       }
--                      fprintf(fp, "%s", output);
--                      fclose(fp);
-               }
-               free(output);
-       }
--      return (MM_OK);
-+      return (ret);
- }
- #define INSERT_COLON                                                  \
index 0ff709b29f90dada88342213d8ea3a7c93679c08..f3aa885815ffc1dfdc510c0347cfc37bec728fa5 100644 (file)
@@ -122,7 +122,18 @@ The
 function returns zero if
 .Fa string
 matches the pattern specified by
-.Fa pattern ,
+.Fa pattern .
+It returns the value
+.Dv FNM_NOMATCH
+if no match is found.
+Otherwise, another non-zero value is returned on error.
+.Sh LEGACY RETURN VALUES
+The
+.Fn fnmatch
+function returns zero if
+.Fa string
+matches the pattern specified by
+.Fa pattern ;
 otherwise, it returns the value
 .Dv FNM_NOMATCH .
 .Sh SEE ALSO
diff --git a/gen/FreeBSD/fnmatch.3.patch b/gen/FreeBSD/fnmatch.3.patch
deleted file mode 100644 (file)
index 0a45f2b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- fnmatch.3.orig     2011-02-17 17:09:58.000000000 -0800
-+++ fnmatch.3  2011-02-18 12:10:47.000000000 -0800
-@@ -122,7 +122,18 @@
- function returns zero if
- .Fa string
- matches the pattern specified by
--.Fa pattern ,
-+.Fa pattern .
-+It returns the value
-+.Dv FNM_NOMATCH
-+if no match is found.
-+Otherwise, another non-zero value is returned on error.
-+.Sh LEGACY RETURN VALUES
-+The
-+.Fn fnmatch
-+function returns zero if
-+.Fa string
-+matches the pattern specified by
-+.Fa pattern ;
- otherwise, it returns the value
- .Dv FNM_NOMATCH .
- .Sh SEE ALSO
index 0799e34b455fb4a0d779bcb612938f3cf48c0fa9..51a1f9755d8365ab020e3f228d3b20e80dc9800d 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/fnmatch.c,v 1.19 2010/04/16 22:29:24 jilles Exp $");
 
+#include "xlocale_private.h"
+
 /*
  * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
  * Compares a filename or pathname to a pattern.
@@ -62,13 +64,16 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/fnmatch.c,v 1.19 2010/04/16 22:29:24 jilles
 
 #define        EOS     '\0'
 
+#define RETURN_ERROR   2       /* neither 0 or FNM_NOMATCH */
 #define RANGE_MATCH     1
 #define RANGE_NOMATCH   0
 #define RANGE_ERROR     (-1)
 
-static int rangematch(const char *, wchar_t, int, char **, mbstate_t *);
+#define RECURSION_MAX  64
+
+__private_extern__ int rangematch(const char *, wchar_t, const char *, int, char **, char **, mbstate_t *, mbstate_t *, locale_t);
 static int fnmatch1(const char *, const char *, const char *, int, mbstate_t,
-               mbstate_t);
+               mbstate_t, locale_t, int);
 
 int
 fnmatch(pattern, string, flags)
@@ -76,27 +81,38 @@ fnmatch(pattern, string, flags)
        int flags;
 {
        static const mbstate_t initial;
-
-       return (fnmatch1(pattern, string, string, flags, initial, initial));
+#if __DARWIN_UNIX03
+       return (fnmatch1(pattern, string, string, flags, initial, initial, __current_locale(), RECURSION_MAX));
+#else /* !__DARWIN_UNIX03 */
+       return (fnmatch1(pattern, string, string, flags, initial, initial, __current_locale(), RECURSION_MAX) != 0 ? FNM_NOMATCH : 0);
+#endif /* __DARWIN_UNIX03 */
 }
 
 static int
-fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs)
+fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs, loc, recursion)
        const char *pattern, *string, *stringstart;
        int flags;
        mbstate_t patmbs, strmbs;
+       locale_t loc;
+       int recursion;
 {
-       char *newp;
+       char *newp, *news;
        char c;
        wchar_t pc, sc;
        size_t pclen, sclen;
 
+       if (recursion-- <= 0)
+               return RETURN_ERROR;
        for (;;) {
-               pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs);
+               pclen = mbrtowc_l(&pc, pattern, MB_LEN_MAX, &patmbs, loc);
                if (pclen == (size_t)-1 || pclen == (size_t)-2)
+#if __DARWIN_UNIX03
+                       return (RETURN_ERROR);
+#else /* !__DARWIN_UNIX03 */
                        return (FNM_NOMATCH);
+#endif /* __DARWIN_UNIX03 */
                pattern += pclen;
-               sclen = mbrtowc(&sc, string, MB_LEN_MAX, &strmbs);
+               sclen = mbrtowc_l(&sc, string, MB_LEN_MAX, &strmbs, loc);
                if (sclen == (size_t)-1 || sclen == (size_t)-2) {
                        sc = (unsigned char)*string;
                        sclen = 1;
@@ -144,12 +160,13 @@ fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs)
                        }
 
                        /* General case, use recursion. */
+                       int ret;
                        while (sc != EOS) {
-                               if (!fnmatch1(pattern, string, stringstart,
-                                   flags, patmbs, strmbs))
-                                       return (0);
-                               sclen = mbrtowc(&sc, string, MB_LEN_MAX,
-                                   &strmbs);
+                               if ((ret = fnmatch1(pattern, string, stringstart,
+                                   flags, patmbs, strmbs, loc, recursion)) != FNM_NOMATCH)
+                                       return (ret);
+                               sclen = mbrtowc_l(&sc, string, MB_LEN_MAX,
+                                   &strmbs, loc);
                                if (sclen == (size_t)-1 ||
                                    sclen == (size_t)-2) {
                                        sc = (unsigned char)*string;
@@ -171,35 +188,45 @@ fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs)
                            ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
                                return (FNM_NOMATCH);
 
-                       switch (rangematch(pattern, sc, flags, &newp,
-                           &patmbs)) {
+                       switch (rangematch(pattern, sc, string + sclen, flags,
+                           &newp, &news, &patmbs, &strmbs, loc)) {
                        case RANGE_ERROR:
+#if __DARWIN_UNIX03
+                               return (RETURN_ERROR);
+#else /* !__DARWIN_UNIX03 */
                                goto norm;
+#endif /* __DARWIN_UNIX03 */
                        case RANGE_MATCH:
                                pattern = newp;
+                               string = news;
                                break;
                        case RANGE_NOMATCH:
                                return (FNM_NOMATCH);
                        }
-                       string += sclen;
                        break;
                case '\\':
                        if (!(flags & FNM_NOESCAPE)) {
-                               pclen = mbrtowc(&pc, pattern, MB_LEN_MAX,
-                                   &patmbs);
+                               pclen = mbrtowc_l(&pc, pattern, MB_LEN_MAX,
+                                   &patmbs, loc);
                                if (pclen == (size_t)-1 || pclen == (size_t)-2)
+#if __DARWIN_UNIX03
+                                       return (RETURN_ERROR);
+#else /* !__DARWIN_UNIX03 */
                                        return (FNM_NOMATCH);
+#endif /* __DARWIN_UNIX03 */
                                if (pclen == 0)
                                        pc = '\\';
                                pattern += pclen;
                        }
                        /* FALLTHROUGH */
                default:
+#if !__DARWIN_UNIX03
                norm:
+#endif /* !__DARWIN_UNIX03 */
                        if (pc == sc)
                                ;
                        else if ((flags & FNM_CASEFOLD) &&
-                                (towlower(pc) == towlower(sc)))
+                                (towlower_l(pc, loc) == towlower_l(sc, loc)))
                                ;
                        else
                                return (FNM_NOMATCH);
@@ -210,18 +237,22 @@ fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs)
        /* NOTREACHED */
 }
 
-static int
-rangematch(pattern, test, flags, newp, patmbs)
-       const char *pattern;
+#ifndef BUILDING_VARIANT
+__private_extern__ int
+rangematch(pattern, test, string, flags, newp, news, patmbs, strmbs, loc)
+       const char *pattern, *string;
        wchar_t test;
        int flags;
-       char **newp;
-       mbstate_t *patmbs;
+       char **newp, **news;
+       mbstate_t *patmbs, *strmbs;
+       locale_t loc;
 {
-       int negate, ok;
+       int negate, ok, special;
        wchar_t c, c2;
-       size_t pclen;
-       const char *origpat;
+       wchar_t buf[STR_LEN];   /* STR_LEN defined in collate.h */
+       size_t pclen, sclen, len;
+       const char *origpat, *cp, *savestring;
+       mbstate_t save;
 
        /*
         * A bracket expression starting with an unquoted circumflex
@@ -234,7 +265,7 @@ rangematch(pattern, test, flags, newp, patmbs)
                ++pattern;
 
        if (flags & FNM_CASEFOLD)
-               test = towlower(test);
+               test = towlower_l(test, loc);
 
        /*
         * A right bracket shall lose its special meaning and represent
@@ -244,8 +275,8 @@ rangematch(pattern, test, flags, newp, patmbs)
        ok = 0;
        origpat = pattern;
        for (;;) {
+               c = 0;
                if (*pattern == ']' && pattern > origpat) {
-                       pattern++;
                        break;
                } else if (*pattern == '\0') {
                        return (RANGE_ERROR);
@@ -253,39 +284,188 @@ rangematch(pattern, test, flags, newp, patmbs)
                        return (RANGE_NOMATCH);
                } else if (*pattern == '\\' && !(flags & FNM_NOESCAPE))
                        pattern++;
-               pclen = mbrtowc(&c, pattern, MB_LEN_MAX, patmbs);
-               if (pclen == (size_t)-1 || pclen == (size_t)-2)
-                       return (RANGE_NOMATCH);
-               pattern += pclen;
+               else if (*pattern == '[' && ((special = *(pattern + 1)) == '.' || special == '=' || special == ':')) {
+                       cp = (pattern += 2);
+                       while(cp = strchr(cp, special)) {
+                               if (*(cp + 1) == ']')
+                                       break;
+                               cp++;
+                       }
+                       if (!cp)
+                               return (RANGE_ERROR);
+                       if (special == '.') {
+treat_like_collating_symbol:
+                               len = __collate_collating_symbol(buf, STR_LEN, pattern, cp - pattern, patmbs, loc);
+                               if (len == (size_t)-1 || len == 0)
+                                       return (RANGE_ERROR);
+                               pattern = cp + 2;
+                               if (len > 1) {
+                                       wchar_t *wp, sc;
+                                       /* no multi-character collation symbols as start of range */
+                                       if (*(cp + 2) == '-' && *(cp + 3) != EOS
+                                           && *(cp + 3) != ']')
+                                               return (RANGE_ERROR);
+                                       wp = buf;
+                                       if (test != *wp++)
+                                               continue;
+                                       if (len == 1) {
+                                               ok = 1;
+                                               break;
+                                       }
+                                       memcpy(&save, strmbs, sizeof(save));
+                                       savestring = string;
+                                       while (--len > 0) {
+                                               sclen = mbrtowc_l(&sc, string, MB_LEN_MAX, strmbs, loc);
+                                               if (sclen == (size_t)-1 || sclen == (size_t)-2) {
+                                                       sc = (unsigned char)*string;
+                                                       sclen = 1;
+                                                       memset(&strmbs, 0, sizeof(strmbs));
+                                               }
+                                               if (sc != *wp++) {
+                                                       memcpy(strmbs, &save, sizeof(save));
+                                                       string = savestring;
+                                                       break;
+                                               }
+                                               string += sclen;
+                                       }
+                                       if (len == 0) {
+                                               ok = 1;
+                                               break;
+                                       }
+                                       continue; /* no match */
+                               }
+                               c = *buf;
+                       } else if (special == '=') {
+                               int ec;
+                               memcpy(&save, patmbs, sizeof(save));
+                               ec = __collate_equiv_class(pattern, cp - pattern, patmbs, loc);
+                               if (ec < 0)
+                                       return (RANGE_ERROR);
+                               if (ec == 0) {
+                                       memcpy(patmbs, &save, sizeof(save));
+                                       goto treat_like_collating_symbol;
+                               }
+                               pattern = cp + 2;
+                               /* no equivalence classes as start of range */
+                               if (*(cp + 2) == '-' && *(cp + 3) != EOS &&
+                                   *(cp + 3) != ']')
+                                       return (RANGE_ERROR);
+                               len = __collate_equiv_match(ec, NULL, 0, test, string, strlen(string), strmbs, &sclen, loc);
+                               if (len < 0)
+                                       return (RANGE_ERROR);
+                               if (len > 0) {
+                                       ok = 1;
+                                       string += sclen;
+                                       break;
+                               }
+                               continue;
+                       } else { /* special == ':' */
+                               wctype_t charclass;
+                               char name[CHARCLASS_NAME_MAX + 1];
+                               /* no character classes as start of range */
+                               if (*(cp + 2) == '-' && *(cp + 3) != EOS &&
+                                   *(cp + 3) != ']')
+                                       return (RANGE_ERROR);
+                               /* assume character class names are ascii */
+                               if (cp - pattern > CHARCLASS_NAME_MAX)
+                                       return (RANGE_ERROR);
+                               strlcpy(name, pattern, cp - pattern + 1);
+                               pattern = cp + 2;
+                               if ((charclass = wctype(name)) == 0)
+                                       return (RANGE_ERROR);
+                               if (iswctype_l(test, charclass, loc)) {
+                                       ok = 1;
+                                       break;
+                               }
+                               continue;
+                       }
+               }
+               if (!c) {
+                       pclen = mbrtowc_l(&c, pattern, MB_LEN_MAX, patmbs, loc);
+                       if (pclen == (size_t)-1 || pclen == (size_t)-2)
+                               return (RANGE_ERROR);
+                       pattern += pclen;
+               }
 
                if (flags & FNM_CASEFOLD)
-                       c = towlower(c);
+                       c = towlower_l(c, loc);
 
                if (*pattern == '-' && *(pattern + 1) != EOS &&
                    *(pattern + 1) != ']') {
                        if (*++pattern == '\\' && !(flags & FNM_NOESCAPE))
                                if (*pattern != EOS)
                                        pattern++;
-                       pclen = mbrtowc(&c2, pattern, MB_LEN_MAX, patmbs);
+                       pclen = mbrtowc_l(&c2, pattern, MB_LEN_MAX, patmbs, loc);
                        if (pclen == (size_t)-1 || pclen == (size_t)-2)
-                               return (RANGE_NOMATCH);
+                               return (RANGE_ERROR);
                        pattern += pclen;
                        if (c2 == EOS)
                                return (RANGE_ERROR);
 
+                       if (c2 == '[' && (special = *pattern) == '.' || special == '=' || special == ':') {
+                               /* no equivalence classes or character classes as end of range */
+                               if (special == '=' || special == ':')
+                                       return (RANGE_ERROR);
+                               cp = ++pattern;
+                               while(cp = strchr(cp, special)) {
+                                       if (*(cp + 1) == ']')
+                                               break;
+                                       cp++;
+                               }
+                               if (!cp)
+                                       return (RANGE_ERROR);
+                               len = __collate_collating_symbol(buf, STR_LEN, pattern, cp - pattern, patmbs, loc);
+                               /* no multi-character collation symbols as end of range */
+                               if (len != 1)
+                                       return (RANGE_ERROR);
+                               pattern = cp + 2;
+                               c2 = *buf;
+                       }
+
                        if (flags & FNM_CASEFOLD)
-                               c2 = towlower(c2);
+                               c2 = towlower_l(c2, loc);
 
-                       if (__collate_load_error ?
+                       if (loc->__collate_load_error ?
                            c <= test && test <= c2 :
-                              __collate_range_cmp(c, test) <= 0
-                           && __collate_range_cmp(test, c2) <= 0
-                          )
+                              __collate_range_cmp(c, test, loc) <= 0
+                           && __collate_range_cmp(test, c2, loc) <= 0
+                          ) {
                                ok = 1;
-               } else if (c == test)
+                               break;
+                       }
+               } else if (c == test) {
                        ok = 1;
+                       break;
+               }
        }
+       /* go to end of bracket expression */
+       special = 0;
+       while(*pattern != ']') {
+               if (*pattern == 0)
+                       return (RANGE_ERROR);
+               if (*pattern == special) {
+                       if (*++pattern == ']') {
+                               special = 0;
+                               pattern++;
+                       }
+                       continue;
+               }
+               if (!special && *pattern == '[') {
+                       special = *++pattern;
+                       if (special != '.' && special != '=' && special != ':')
+                               special = 0;
+                       else
+                               pattern++;
+                       continue;
+               }
+               pclen = mbrtowc_l(&c, pattern, MB_LEN_MAX, patmbs, loc);
+               if (pclen == (size_t)-1 || pclen == (size_t)-2)
+                       return (RANGE_ERROR);
+               pattern += pclen;
+       }
 
-       *newp = (char *)pattern;
+       *newp = (char *)++pattern;
+       *news = (char *)string;
        return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
 }
+#endif /* BUILDING_VARIANT */
diff --git a/gen/FreeBSD/fnmatch.c.patch b/gen/FreeBSD/fnmatch.c.patch
deleted file mode 100644 (file)
index b45f0ea..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
---- fnmatch.c.orig     2011-02-17 17:11:04.000000000 -0800
-+++ fnmatch.c  2011-02-18 12:00:31.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fnmatch.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/fnmatch.c,v 1.19 2010/04/16 22:29:24 jilles Exp $");
-+#include "xlocale_private.h"
-+
- /*
-  * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
-  * Compares a filename or pathname to a pattern.
-@@ -62,13 +64,16 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/fnm
- #define       EOS     '\0'
-+#define RETURN_ERROR  2       /* neither 0 or FNM_NOMATCH */
- #define RANGE_MATCH     1
- #define RANGE_NOMATCH   0
- #define RANGE_ERROR     (-1)
--static int rangematch(const char *, wchar_t, int, char **, mbstate_t *);
-+#define RECURSION_MAX 64
-+
-+__private_extern__ int rangematch(const char *, wchar_t, const char *, int, char **, char **, mbstate_t *, mbstate_t *, locale_t);
- static int fnmatch1(const char *, const char *, const char *, int, mbstate_t,
--              mbstate_t);
-+              mbstate_t, locale_t, int);
- int
- fnmatch(pattern, string, flags)
-@@ -76,27 +81,38 @@ fnmatch(pattern, string, flags)
-       int flags;
- {
-       static const mbstate_t initial;
--
--      return (fnmatch1(pattern, string, string, flags, initial, initial));
-+#if __DARWIN_UNIX03
-+      return (fnmatch1(pattern, string, string, flags, initial, initial, __current_locale(), RECURSION_MAX));
-+#else /* !__DARWIN_UNIX03 */
-+      return (fnmatch1(pattern, string, string, flags, initial, initial, __current_locale(), RECURSION_MAX) != 0 ? FNM_NOMATCH : 0);
-+#endif /* __DARWIN_UNIX03 */
- }
- static int
--fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs)
-+fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs, loc, recursion)
-       const char *pattern, *string, *stringstart;
-       int flags;
-       mbstate_t patmbs, strmbs;
-+      locale_t loc;
-+      int recursion;
- {
--      char *newp;
-+      char *newp, *news;
-       char c;
-       wchar_t pc, sc;
-       size_t pclen, sclen;
-+      if (recursion-- <= 0)
-+              return RETURN_ERROR;
-       for (;;) {
--              pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs);
-+              pclen = mbrtowc_l(&pc, pattern, MB_LEN_MAX, &patmbs, loc);
-               if (pclen == (size_t)-1 || pclen == (size_t)-2)
-+#if __DARWIN_UNIX03
-+                      return (RETURN_ERROR);
-+#else /* !__DARWIN_UNIX03 */
-                       return (FNM_NOMATCH);
-+#endif /* __DARWIN_UNIX03 */
-               pattern += pclen;
--              sclen = mbrtowc(&sc, string, MB_LEN_MAX, &strmbs);
-+              sclen = mbrtowc_l(&sc, string, MB_LEN_MAX, &strmbs, loc);
-               if (sclen == (size_t)-1 || sclen == (size_t)-2) {
-                       sc = (unsigned char)*string;
-                       sclen = 1;
-@@ -144,12 +160,13 @@ fnmatch1(pattern, string, stringstart, f
-                       }
-                       /* General case, use recursion. */
-+                      int ret;
-                       while (sc != EOS) {
--                              if (!fnmatch1(pattern, string, stringstart,
--                                  flags, patmbs, strmbs))
--                                      return (0);
--                              sclen = mbrtowc(&sc, string, MB_LEN_MAX,
--                                  &strmbs);
-+                              if ((ret = fnmatch1(pattern, string, stringstart,
-+                                  flags, patmbs, strmbs, loc, recursion)) != FNM_NOMATCH)
-+                                      return (ret);
-+                              sclen = mbrtowc_l(&sc, string, MB_LEN_MAX,
-+                                  &strmbs, loc);
-                               if (sclen == (size_t)-1 ||
-                                   sclen == (size_t)-2) {
-                                       sc = (unsigned char)*string;
-@@ -171,35 +188,45 @@ fnmatch1(pattern, string, stringstart, f
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
--                      switch (rangematch(pattern, sc, flags, &newp,
--                          &patmbs)) {
-+                      switch (rangematch(pattern, sc, string + sclen, flags,
-+                          &newp, &news, &patmbs, &strmbs, loc)) {
-                       case RANGE_ERROR:
-+#if __DARWIN_UNIX03
-+                              return (RETURN_ERROR);
-+#else /* !__DARWIN_UNIX03 */
-                               goto norm;
-+#endif /* __DARWIN_UNIX03 */
-                       case RANGE_MATCH:
-                               pattern = newp;
-+                              string = news;
-                               break;
-                       case RANGE_NOMATCH:
-                               return (FNM_NOMATCH);
-                       }
--                      string += sclen;
-                       break;
-               case '\\':
-                       if (!(flags & FNM_NOESCAPE)) {
--                              pclen = mbrtowc(&pc, pattern, MB_LEN_MAX,
--                                  &patmbs);
-+                              pclen = mbrtowc_l(&pc, pattern, MB_LEN_MAX,
-+                                  &patmbs, loc);
-                               if (pclen == (size_t)-1 || pclen == (size_t)-2)
-+#if __DARWIN_UNIX03
-+                                      return (RETURN_ERROR);
-+#else /* !__DARWIN_UNIX03 */
-                                       return (FNM_NOMATCH);
-+#endif /* __DARWIN_UNIX03 */
-                               if (pclen == 0)
-                                       pc = '\\';
-                               pattern += pclen;
-                       }
-                       /* FALLTHROUGH */
-               default:
-+#if !__DARWIN_UNIX03
-               norm:
-+#endif /* !__DARWIN_UNIX03 */
-                       if (pc == sc)
-                               ;
-                       else if ((flags & FNM_CASEFOLD) &&
--                               (towlower(pc) == towlower(sc)))
-+                               (towlower_l(pc, loc) == towlower_l(sc, loc)))
-                               ;
-                       else
-                               return (FNM_NOMATCH);
-@@ -210,18 +237,22 @@ fnmatch1(pattern, string, stringstart, f
-       /* NOTREACHED */
- }
--static int
--rangematch(pattern, test, flags, newp, patmbs)
--      const char *pattern;
-+#ifndef BUILDING_VARIANT
-+__private_extern__ int
-+rangematch(pattern, test, string, flags, newp, news, patmbs, strmbs, loc)
-+      const char *pattern, *string;
-       wchar_t test;
-       int flags;
--      char **newp;
--      mbstate_t *patmbs;
-+      char **newp, **news;
-+      mbstate_t *patmbs, *strmbs;
-+      locale_t loc;
- {
--      int negate, ok;
-+      int negate, ok, special;
-       wchar_t c, c2;
--      size_t pclen;
--      const char *origpat;
-+      wchar_t buf[STR_LEN];   /* STR_LEN defined in collate.h */
-+      size_t pclen, sclen, len;
-+      const char *origpat, *cp, *savestring;
-+      mbstate_t save;
-       /*
-        * A bracket expression starting with an unquoted circumflex
-@@ -234,7 +265,7 @@ rangematch(pattern, test, flags, newp, p
-               ++pattern;
-       if (flags & FNM_CASEFOLD)
--              test = towlower(test);
-+              test = towlower_l(test, loc);
-       /*
-        * A right bracket shall lose its special meaning and represent
-@@ -244,8 +275,8 @@ rangematch(pattern, test, flags, newp, p
-       ok = 0;
-       origpat = pattern;
-       for (;;) {
-+              c = 0;
-               if (*pattern == ']' && pattern > origpat) {
--                      pattern++;
-                       break;
-               } else if (*pattern == '\0') {
-                       return (RANGE_ERROR);
-@@ -253,39 +284,188 @@ rangematch(pattern, test, flags, newp, p
-                       return (RANGE_NOMATCH);
-               } else if (*pattern == '\\' && !(flags & FNM_NOESCAPE))
-                       pattern++;
--              pclen = mbrtowc(&c, pattern, MB_LEN_MAX, patmbs);
--              if (pclen == (size_t)-1 || pclen == (size_t)-2)
--                      return (RANGE_NOMATCH);
--              pattern += pclen;
-+              else if (*pattern == '[' && ((special = *(pattern + 1)) == '.' || special == '=' || special == ':')) {
-+                      cp = (pattern += 2);
-+                      while(cp = strchr(cp, special)) {
-+                              if (*(cp + 1) == ']')
-+                                      break;
-+                              cp++;
-+                      }
-+                      if (!cp)
-+                              return (RANGE_ERROR);
-+                      if (special == '.') {
-+treat_like_collating_symbol:
-+                              len = __collate_collating_symbol(buf, STR_LEN, pattern, cp - pattern, patmbs, loc);
-+                              if (len == (size_t)-1 || len == 0)
-+                                      return (RANGE_ERROR);
-+                              pattern = cp + 2;
-+                              if (len > 1) {
-+                                      wchar_t *wp, sc;
-+                                      /* no multi-character collation symbols as start of range */
-+                                      if (*(cp + 2) == '-' && *(cp + 3) != EOS
-+                                          && *(cp + 3) != ']')
-+                                              return (RANGE_ERROR);
-+                                      wp = buf;
-+                                      if (test != *wp++)
-+                                              continue;
-+                                      if (len == 1) {
-+                                              ok = 1;
-+                                              break;
-+                                      }
-+                                      memcpy(&save, strmbs, sizeof(save));
-+                                      savestring = string;
-+                                      while (--len > 0) {
-+                                              sclen = mbrtowc_l(&sc, string, MB_LEN_MAX, strmbs, loc);
-+                                              if (sclen == (size_t)-1 || sclen == (size_t)-2) {
-+                                                      sc = (unsigned char)*string;
-+                                                      sclen = 1;
-+                                                      memset(&strmbs, 0, sizeof(strmbs));
-+                                              }
-+                                              if (sc != *wp++) {
-+                                                      memcpy(strmbs, &save, sizeof(save));
-+                                                      string = savestring;
-+                                                      break;
-+                                              }
-+                                              string += sclen;
-+                                      }
-+                                      if (len == 0) {
-+                                              ok = 1;
-+                                              break;
-+                                      }
-+                                      continue; /* no match */
-+                              }
-+                              c = *buf;
-+                      } else if (special == '=') {
-+                              int ec;
-+                              memcpy(&save, patmbs, sizeof(save));
-+                              ec = __collate_equiv_class(pattern, cp - pattern, patmbs, loc);
-+                              if (ec < 0)
-+                                      return (RANGE_ERROR);
-+                              if (ec == 0) {
-+                                      memcpy(patmbs, &save, sizeof(save));
-+                                      goto treat_like_collating_symbol;
-+                              }
-+                              pattern = cp + 2;
-+                              /* no equivalence classes as start of range */
-+                              if (*(cp + 2) == '-' && *(cp + 3) != EOS &&
-+                                  *(cp + 3) != ']')
-+                                      return (RANGE_ERROR);
-+                              len = __collate_equiv_match(ec, NULL, 0, test, string, strlen(string), strmbs, &sclen, loc);
-+                              if (len < 0)
-+                                      return (RANGE_ERROR);
-+                              if (len > 0) {
-+                                      ok = 1;
-+                                      string += sclen;
-+                                      break;
-+                              }
-+                              continue;
-+                      } else { /* special == ':' */
-+                              wctype_t charclass;
-+                              char name[CHARCLASS_NAME_MAX + 1];
-+                              /* no character classes as start of range */
-+                              if (*(cp + 2) == '-' && *(cp + 3) != EOS &&
-+                                  *(cp + 3) != ']')
-+                                      return (RANGE_ERROR);
-+                              /* assume character class names are ascii */
-+                              if (cp - pattern > CHARCLASS_NAME_MAX)
-+                                      return (RANGE_ERROR);
-+                              strlcpy(name, pattern, cp - pattern + 1);
-+                              pattern = cp + 2;
-+                              if ((charclass = wctype(name)) == 0)
-+                                      return (RANGE_ERROR);
-+                              if (iswctype_l(test, charclass, loc)) {
-+                                      ok = 1;
-+                                      break;
-+                              }
-+                              continue;
-+                      }
-+              }
-+              if (!c) {
-+                      pclen = mbrtowc_l(&c, pattern, MB_LEN_MAX, patmbs, loc);
-+                      if (pclen == (size_t)-1 || pclen == (size_t)-2)
-+                              return (RANGE_ERROR);
-+                      pattern += pclen;
-+              }
-               if (flags & FNM_CASEFOLD)
--                      c = towlower(c);
-+                      c = towlower_l(c, loc);
-               if (*pattern == '-' && *(pattern + 1) != EOS &&
-                   *(pattern + 1) != ']') {
-                       if (*++pattern == '\\' && !(flags & FNM_NOESCAPE))
-                               if (*pattern != EOS)
-                                       pattern++;
--                      pclen = mbrtowc(&c2, pattern, MB_LEN_MAX, patmbs);
-+                      pclen = mbrtowc_l(&c2, pattern, MB_LEN_MAX, patmbs, loc);
-                       if (pclen == (size_t)-1 || pclen == (size_t)-2)
--                              return (RANGE_NOMATCH);
-+                              return (RANGE_ERROR);
-                       pattern += pclen;
-                       if (c2 == EOS)
-                               return (RANGE_ERROR);
-+                      if (c2 == '[' && (special = *pattern) == '.' || special == '=' || special == ':') {
-+                              /* no equivalence classes or character classes as end of range */
-+                              if (special == '=' || special == ':')
-+                                      return (RANGE_ERROR);
-+                              cp = ++pattern;
-+                              while(cp = strchr(cp, special)) {
-+                                      if (*(cp + 1) == ']')
-+                                              break;
-+                                      cp++;
-+                              }
-+                              if (!cp)
-+                                      return (RANGE_ERROR);
-+                              len = __collate_collating_symbol(buf, STR_LEN, pattern, cp - pattern, patmbs, loc);
-+                              /* no multi-character collation symbols as end of range */
-+                              if (len != 1)
-+                                      return (RANGE_ERROR);
-+                              pattern = cp + 2;
-+                              c2 = *buf;
-+                      }
-+
-                       if (flags & FNM_CASEFOLD)
--                              c2 = towlower(c2);
-+                              c2 = towlower_l(c2, loc);
--                      if (__collate_load_error ?
-+                      if (loc->__collate_load_error ?
-                           c <= test && test <= c2 :
--                             __collate_range_cmp(c, test) <= 0
--                          && __collate_range_cmp(test, c2) <= 0
--                         )
-+                             __collate_range_cmp(c, test, loc) <= 0
-+                          && __collate_range_cmp(test, c2, loc) <= 0
-+                         ) {
-                               ok = 1;
--              } else if (c == test)
-+                              break;
-+                      }
-+              } else if (c == test) {
-                       ok = 1;
-+                      break;
-+              }
-       }
-+      /* go to end of bracket expression */
-+      special = 0;
-+      while(*pattern != ']') {
-+              if (*pattern == 0)
-+                      return (RANGE_ERROR);
-+              if (*pattern == special) {
-+                      if (*++pattern == ']') {
-+                              special = 0;
-+                              pattern++;
-+                      }
-+                      continue;
-+              }
-+              if (!special && *pattern == '[') {
-+                      special = *++pattern;
-+                      if (special != '.' && special != '=' && special != ':')
-+                              special = 0;
-+                      else
-+                              pattern++;
-+                      continue;
-+              }
-+              pclen = mbrtowc_l(&c, pattern, MB_LEN_MAX, patmbs, loc);
-+              if (pclen == (size_t)-1 || pclen == (size_t)-2)
-+                      return (RANGE_ERROR);
-+              pattern += pclen;
-+      }
--      *newp = (char *)pattern;
-+      *newp = (char *)++pattern;
-+      *news = (char *)string;
-       return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
- }
-+#endif /* BUILDING_VARIANT */
index e904beb91e837ba8bac09d1262a1f7590edc5b41..88a3a2301db301ca1790338a58bc87fdfc066d7b 100644 (file)
@@ -33,7 +33,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
 .In sys/ipc.h
 .Ft key_t
 .Fn ftok "const char *path" "int id"
 The
 .Fn ftok
 function attempts to create a unique key suitable for use with the
-.Xr msgget 2 ,
-.Xr semget 2
+.Xr semget 2 ,
 and
 .Xr shmget 2
-functions given the
+functions, given the
 .Fa path
 of an existing file and a user-selectable
 .Fa id .
@@ -63,10 +61,17 @@ The
 function will return -1 if
 .Fa path
 does not exist or if it cannot be accessed by the calling process.
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/ipc.h>
+.Pp
+The include file
+.In sys/types.h
+is necessary.
 .Sh SEE ALSO
 .Xr semget 2 ,
 .Xr shmget 2 ,
-.Xr msgget 2
+.Xr compat 5
 .Sh HISTORY
 The
 .Fn ftok
@@ -75,9 +80,9 @@ that use the System V IPC routines.
 .Sh AUTHORS
 .An Thorsten Lockert Aq tholo@sigmasoft.com
 .Sh BUGS
-The returned key is computed based on the device minor number and inode of the
-specified
-.Fa path
+The returned key is computed based on the device minor number and inode
+of the specified
+.Fa path ,
 in combination with the lower 8 bits of the given
 .Fa id .
-Thus it is quite possible for the routine to return duplicate keys.
+Thus, it is quite possible for the routine to return duplicate keys.
diff --git a/gen/FreeBSD/ftok.3.patch b/gen/FreeBSD/ftok.3.patch
deleted file mode 100644 (file)
index 2b3cdf2..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
---- ftok.3.bsdnew      2009-11-08 14:20:21.000000000 -0800
-+++ ftok.3     2009-11-08 14:23:16.000000000 -0800
-@@ -33,7 +33,6 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In sys/types.h
- .In sys/ipc.h
- .Ft key_t
- .Fn ftok "const char *path" "int id"
-@@ -41,11 +40,10 @@
- The
- .Fn ftok
- function attempts to create a unique key suitable for use with the
--.Xr msgget 2 ,
--.Xr semget 2
-+.Xr semget 2 ,
- and
- .Xr shmget 2
--functions given the
-+functions, given the
- .Fa path
- of an existing file and a user-selectable
- .Fa id .
-@@ -63,10 +61,17 @@ The
- function will return -1 if
- .Fa path
- does not exist or if it cannot be accessed by the calling process.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/types.h>
-+.Fd #include <sys/ipc.h>
-+.Pp
-+The include file
-+.In sys/types.h
-+is necessary.
- .Sh SEE ALSO
- .Xr semget 2 ,
- .Xr shmget 2 ,
--.Xr msgget 2
-+.Xr compat 5
- .Sh HISTORY
- The
- .Fn ftok
-@@ -75,9 +80,9 @@ that use the System V IPC routines.
- .Sh AUTHORS
- .An Thorsten Lockert Aq tholo@sigmasoft.com
- .Sh BUGS
--The returned key is computed based on the device minor number and inode of the
--specified
--.Fa path
-+The returned key is computed based on the device minor number and inode
-+of the specified
-+.Fa path ,
- in combination with the lower 8 bits of the given
- .Fa id .
--Thus it is quite possible for the routine to return duplicate keys.
-+Thus, it is quite possible for the routine to return duplicate keys.
index 649a9f46f8fb8f3e5cd6e141952ff1a576848382..ea8425fb99d867d13fe0bf9b50a7ef3f36ae0637 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)getcap.c  8.3 (Berkeley) 3/25/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.23 2009/11/25 04:45:45 wollman Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <sys/types.h>
 
@@ -66,7 +68,7 @@ static char   *toprec;        /* Additional record specified by cgetset() */
 static int      gottoprec;     /* Flag indicating retrieval of toprecord */
 
 static int     cdbget(DB *, char **, const char *);
-static int     getent(char **, u_int *, char **, int, const char *, int, char *);
+static int     getent(char **, u_int *, char **, int, const char *, int, char *, locale_t);
 static int     nfcmp(char *, char *);
 
 /*
@@ -162,7 +164,7 @@ cgetent(char **buf, char **db_array, const char *name)
 {
        u_int dummy;
 
-       return (getent(buf, &dummy, db_array, -1, name, 0, NULL));
+       return (getent(buf, &dummy, db_array, -1, name, 0, NULL, __current_locale()));
 }
 
 /*
@@ -185,7 +187,7 @@ cgetent(char **buf, char **db_array, const char *name)
  */
 static int
 getent(char **cap, u_int *len, char **db_array, int fd, const char *name,
-    int depth, char *nfield)
+    int depth, char *nfield, locale_t loc)
 {
        DB *capdbp;
        char *r_end, *rp, **db_p;
@@ -426,7 +428,7 @@ tc_exp:     {
                        tcend = s;
 
                        iret = getent(&icap, &ilen, db_p, fd, tc, depth+1,
-                                     NULL);
+                                     NULL, loc);
                        newicap = icap;         /* Put into a register. */
                        newilen = ilen;
                        if (iret != 0) {
@@ -650,6 +652,7 @@ cgetnext(char **bp, char **db_array)
        int done, hadreaderr, savederrno, status;
        char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE];
        u_int dummy;
+       locale_t loc = __current_locale();
 
        if (dbp == NULL)
                dbp = db_array;
@@ -691,7 +694,7 @@ cgetnext(char **bp, char **db_array)
                                slash = 0;
                                continue;
                        }
-                       if (isspace((unsigned char)*line) ||
+                       if (isspace_l((unsigned char)*line, loc) ||
                            *line == ':' || *line == '#' || slash) {
                                if (line[len - 2] == '\\')
                                        slash = 1;
@@ -762,7 +765,7 @@ cgetnext(char **bp, char **db_array)
                 * rather than the duplicate entry record.  This is a
                 * matter of semantics that should be resolved.
                 */
-               status = getent(bp, &dummy, db_array, -1, buf, 0, NULL);
+               status = getent(bp, &dummy, db_array, -1, buf, 0, NULL, loc);
                if (status == -2 || status == -3)
                        (void)cgetclose();
 
diff --git a/gen/FreeBSD/getcap.c.patch b/gen/FreeBSD/getcap.c.patch
deleted file mode 100644 (file)
index d400e40..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
---- getcap.c.orig      2009-11-07 14:51:38.000000000 -0800
-+++ getcap.c   2009-11-07 14:51:40.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)getcap.c 8.3
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.22 2009/05/14 23:09:33 delphij Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <sys/types.h>
-@@ -66,7 +68,7 @@ static char  *toprec;        /* Additional recor
- static int     gottoprec;     /* Flag indicating retrieval of toprecord */
- static int    cdbget(DB *, char **, const char *);
--static int    getent(char **, u_int *, char **, int, const char *, int, char *);
-+static int    getent(char **, u_int *, char **, int, const char *, int, char *, locale_t);
- static int    nfcmp(char *, char *);
- /*
-@@ -162,7 +164,7 @@ cgetent(char **buf, char **db_array, con
- {
-       u_int dummy;
--      return (getent(buf, &dummy, db_array, -1, name, 0, NULL));
-+      return (getent(buf, &dummy, db_array, -1, name, 0, NULL, __current_locale()));
- }
- /*
-@@ -185,7 +187,7 @@ cgetent(char **buf, char **db_array, con
-  */
- static int
- getent(char **cap, u_int *len, char **db_array, int fd, const char *name,
--    int depth, char *nfield)
-+    int depth, char *nfield, locale_t loc)
- {
-       DB *capdbp;
-       char *r_end, *rp, **db_p;
-@@ -426,7 +428,7 @@ tc_exp:    {
-                       tcend = s;
-                       iret = getent(&icap, &ilen, db_p, fd, tc, depth+1,
--                                    NULL);
-+                                    NULL, loc);
-                       newicap = icap;         /* Put into a register. */
-                       newilen = ilen;
-                       if (iret != 0) {
-@@ -650,6 +652,7 @@ cgetnext(char **bp, char **db_array)
-       int done, hadreaderr, i, savederrno, status;
-       char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE];
-       u_int dummy;
-+      locale_t loc = __current_locale();
-       if (dbp == NULL)
-               dbp = db_array;
-@@ -691,7 +694,7 @@ cgetnext(char **bp, char **db_array)
-                               slash = 0;
-                               continue;
-                       }
--                      if (isspace((unsigned char)*line) ||
-+                      if (isspace_l((unsigned char)*line, loc) ||
-                           *line == ':' || *line == '#' || slash) {
-                               if (line[len - 2] == '\\')
-                                       slash = 1;
-@@ -763,7 +766,7 @@ cgetnext(char **bp, char **db_array)
-                * rather than the duplicate entry record.  This is a
-                * matter of semantics that should be resolved.
-                */
--              status = getent(bp, &dummy, db_array, -1, buf, 0, NULL);
-+              status = getent(bp, &dummy, db_array, -1, buf, 0, NULL, loc);
-               if (status == -2 || status == -3)
-                       (void)cgetclose();
index d06210b5d0dc46d4c9a1b437bdbcaf4238a0a939..512b88cd6de1b6bc490151f7c37f4ecc067ed4bf 100644 (file)
@@ -50,12 +50,87 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/getcwd.c,v 1.29 2007/01/09 00:27:53 imp Exp
        (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
            (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
 
-extern int __getcwd(char *, size_t);
+/*
+ * If __getcwd() ever becomes a syscall, we can remove this workaround.
+ * The problem here is that fcntl() assumes a buffer of size MAXPATHLEN,
+ * if size is less than MAXPATHLEN, we need to use a temporary buffer
+ * and see if it fits.  We also have to assume that open() or fcntl()
+ * don't fail with errno=ERANGE.
+ */
+static inline int
+__getcwd(char *buf, size_t size)
+{
+       int fd, err, save;
+       struct stat dot, pt;
+       char *b;
 
-char *
-getcwd(pt, size)
+       if ((fd = open(".", O_RDONLY)) < 0)
+               return -1;
+       if (fstat(fd, &dot) < 0) {
+               save = errno;
+               close(fd);
+               errno = save;
+               return -1;
+       }
+       /* check that the device and inode are non-zero, otherwise punt */
+       if (dot.st_dev == 0 || dot.st_ino == 0) {
+               close(fd);
+               errno = EINVAL;
+               return -1;
+       }
+       if (size < MAXPATHLEN) {
+               /* the hard case; allocate a buffer of size MAXPATHLEN to use */
+               b = (char *)alloca(MAXPATHLEN);
+               if (b == NULL) {
+                       close(fd);
+                       errno = ENOMEM; /* make sure it isn't ERANGE */
+                       return -1;
+               }
+       } else
+               b = buf;
+
+       err = fcntl(fd, F_GETPATH, b);
+       if (err) {
+               save = errno;
+               close(fd);
+               errno = save;
+               return err;
+       }
+       close(fd);
+       /*
+        * now double-check that the path returned by fcntl() has the same
+        * device and inode number as '.'.
+        */
+       if (stat(b, &pt) < 0)
+               return -1;
+       /*
+        * Since dot.st_dev and dot.st_ino are non-zero, we don't need to
+        * separately test for pt.st_dev and pt.st_ino being non-zero, because
+        * they have to match
+        */
+       if (dot.st_dev != pt.st_dev || dot.st_ino != pt.st_ino) {
+               errno = EINVAL;
+               return -1;
+       }
+       /*
+        * For the case where we allocated a buffer, check that it can fit
+        * in the real buffer, and copy it over.
+        */
+       if (size < MAXPATHLEN) {
+               if (strlen(b) >= size) {
+                       errno = ERANGE;
+                       return -1;
+               }
+               strcpy(buf, b);
+       }
+       return 0;
+}
+
+__private_extern__ char *
+__private_getcwd(pt, size, usegetpath)
        char *pt;
        size_t size;
+       int usegetpath;
 {
        struct dirent *dp;
        DIR *dir = NULL;
@@ -87,33 +162,27 @@ getcwd(pt, size)
                }
                ept = pt + size;
        } else {
-               if ((pt = malloc(ptsize = PATH_MAX)) == NULL)
+               if ((pt = malloc(ptsize = MAXPATHLEN)) == NULL)
                        return (NULL);
                ept = pt + ptsize;
        }
-       if (__getcwd(pt, ept - pt) == 0) {
-               if (*pt != '/') {
-                       bpt = pt;
-                       ept = pt + strlen(pt) - 1;
-                       while (bpt < ept) {
-                               c = *bpt;
-                               *bpt++ = *ept;
-                               *ept-- = c;
-                       }
-               }
-               return (pt);
+       if (usegetpath) {
+               if (__getcwd(pt, ept - pt) == 0) {
+                       return (pt);
+               } else if (errno == ERANGE) /* failed because buffer too small */
+                       return NULL;
        }
        bpt = ept - 1;
        *bpt = '\0';
 
        /*
-        * Allocate 1024 bytes for the string of "../"'s.
+        * Allocate MAXPATHLEN bytes for the string of "../"'s.
         * Should always be enough.  If it's not, allocate
         * as necessary.  Special case the first stat, it's ".", not "..".
         */
-       if ((up = malloc(upsize = 1024)) == NULL)
+       if ((up = malloc(upsize = MAXPATHLEN)) == NULL)
                goto err;
-       eup = up + upsize;
+       eup = up + MAXPATHLEN;
        bup = up;
        up[0] = '.';
        up[1] = '\0';
@@ -255,3 +324,11 @@ err:
        errno = save_errno;
        return (NULL);
 }
+
+char *
+getcwd(pt, size)
+       char *pt;
+       size_t size;
+{
+       return __private_getcwd(pt, size, 1);
+}
diff --git a/gen/FreeBSD/getcwd.c.patch b/gen/FreeBSD/getcwd.c.patch
deleted file mode 100644 (file)
index bd22ed8..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
---- getcwd.c.bsdnew    2009-11-08 15:25:00.000000000 -0800
-+++ getcwd.c   2009-11-08 15:30:17.000000000 -0800
-@@ -50,12 +50,87 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/get
-       (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
-           (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
--extern int __getcwd(char *, size_t);
-+/*
-+ * If __getcwd() ever becomes a syscall, we can remove this workaround.
-+ * The problem here is that fcntl() assumes a buffer of size MAXPATHLEN,
-+ * if size is less than MAXPATHLEN, we need to use a temporary buffer
-+ * and see if it fits.  We also have to assume that open() or fcntl()
-+ * don't fail with errno=ERANGE.
-+ */
-+static inline int
-+__getcwd(char *buf, size_t size)
-+{
-+      int fd, err, save;
-+      struct stat dot, pt;
-+      char *b;
-+
-+      if ((fd = open(".", O_RDONLY)) < 0)
-+              return -1;
-+      if (fstat(fd, &dot) < 0) {
-+              save = errno;
-+              close(fd);
-+              errno = save;
-+              return -1;
-+      }
-+      /* check that the device and inode are non-zero, otherwise punt */
-+      if (dot.st_dev == 0 || dot.st_ino == 0) {
-+              close(fd);
-+              errno = EINVAL;
-+              return -1;
-+      }
-+      if (size < MAXPATHLEN) {
-+              /* the hard case; allocate a buffer of size MAXPATHLEN to use */
-+              b = (char *)alloca(MAXPATHLEN);
-+              if (b == NULL) {
-+                      close(fd);
-+                      errno = ENOMEM; /* make sure it isn't ERANGE */
-+                      return -1;
-+              }
-+      } else
-+              b = buf;
--char *
--getcwd(pt, size)
-+      err = fcntl(fd, F_GETPATH, b);
-+      if (err) {
-+              save = errno;
-+              close(fd);
-+              errno = save;
-+              return err;
-+      }
-+      close(fd);
-+      /*
-+       * now double-check that the path returned by fcntl() has the same
-+       * device and inode number as '.'.
-+       */
-+      if (stat(b, &pt) < 0)
-+              return -1;
-+      /*
-+       * Since dot.st_dev and dot.st_ino are non-zero, we don't need to
-+       * separately test for pt.st_dev and pt.st_ino being non-zero, because
-+       * they have to match
-+       */
-+      if (dot.st_dev != pt.st_dev || dot.st_ino != pt.st_ino) {
-+              errno = EINVAL;
-+              return -1;
-+      }
-+      /*
-+       * For the case where we allocated a buffer, check that it can fit
-+       * in the real buffer, and copy it over.
-+       */
-+      if (size < MAXPATHLEN) {
-+              if (strlen(b) >= size) {
-+                      errno = ERANGE;
-+                      return -1;
-+              }
-+              strcpy(buf, b);
-+      }
-+      return 0;
-+}
-+
-+__private_extern__ char *
-+__private_getcwd(pt, size, usegetpath)
-       char *pt;
-       size_t size;
-+      int usegetpath;
- {
-       struct dirent *dp;
-       DIR *dir = NULL;
-@@ -87,33 +162,27 @@ getcwd(pt, size)
-               }
-               ept = pt + size;
-       } else {
--              if ((pt = malloc(ptsize = PATH_MAX)) == NULL)
-+              if ((pt = malloc(ptsize = MAXPATHLEN)) == NULL)
-                       return (NULL);
-               ept = pt + ptsize;
-       }
--      if (__getcwd(pt, ept - pt) == 0) {
--              if (*pt != '/') {
--                      bpt = pt;
--                      ept = pt + strlen(pt) - 1;
--                      while (bpt < ept) {
--                              c = *bpt;
--                              *bpt++ = *ept;
--                              *ept-- = c;
--                      }
--              }
--              return (pt);
-+      if (usegetpath) {
-+              if (__getcwd(pt, ept - pt) == 0) {
-+                      return (pt);
-+              } else if (errno == ERANGE) /* failed because buffer too small */
-+                      return NULL;
-       }
-       bpt = ept - 1;
-       *bpt = '\0';
-       /*
--       * Allocate 1024 bytes for the string of "../"'s.
-+       * Allocate MAXPATHLEN bytes for the string of "../"'s.
-        * Should always be enough.  If it's not, allocate
-        * as necessary.  Special case the first stat, it's ".", not "..".
-        */
--      if ((up = malloc(upsize = 1024)) == NULL)
-+      if ((up = malloc(upsize = MAXPATHLEN)) == NULL)
-               goto err;
--      eup = up + upsize;
-+      eup = up + MAXPATHLEN;
-       bup = up;
-       up[0] = '.';
-       up[1] = '\0';
-@@ -255,3 +324,11 @@ err:
-       errno = save_errno;
-       return (NULL);
- }
-+
-+char *
-+getcwd(pt, size)
-+      char *pt;
-+      size_t size;
-+{
-+      return __private_getcwd(pt, size, 1);
-+}
index d48103bb2894fa88b192e0cd7ac4c3ff7999e924..eed23463519a99be8834c84d5c767bcb86fdd167 100644 (file)
@@ -56,7 +56,7 @@ argument
 specifies the size of the
 .Fa name
 array.
-The returned name is null-terminated unless insufficient space is provided.
+The returned name is null-terminated, unless insufficient space is provided.
 .Pp
 The
 .Fn sethostname
@@ -68,8 +68,8 @@ which has length
 This call is restricted to the super-user and
 is normally used only when the system is bootstrapped.
 .Pp
-Host names are limited to
-.Brq Dv HOST_NAME_MAX
+Host names are limited in length to
+.Brq Dv sysconf(_SC_HOST_NAME_MAX)
 characters, not including the trailing null, currently 255.
 .Sh RETURN VALUES
 .Rv -std
@@ -101,7 +101,7 @@ The
 function conforms to
 .St -p1003.1-2001 .
 Callers should be aware that
-.Brq Dv HOST_NAME_MAX
+.Brq Dv sysconf(_SC_HOST_NAME_MAX)
 may be variable or infinite, but is guaranteed to be no less than
 .Brq Dv _POSIX_HOST_NAME_MAX .
 On older systems, this limit was defined in the non-standard header
diff --git a/gen/FreeBSD/gethostname.3.patch b/gen/FreeBSD/gethostname.3.patch
deleted file mode 100644 (file)
index e114453..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- gethostname.3.orig 2010-04-28 23:38:49.000000000 -0700
-+++ gethostname.3      2010-04-28 23:47:57.000000000 -0700
-@@ -56,7 +56,7 @@ argument
- specifies the size of the
- .Fa name
- array.
--The returned name is null-terminated unless insufficient space is provided.
-+The returned name is null-terminated, unless insufficient space is provided.
- .Pp
- The
- .Fn sethostname
-@@ -68,8 +68,8 @@ which has length
- This call is restricted to the super-user and
- is normally used only when the system is bootstrapped.
- .Pp
--Host names are limited to
--.Brq Dv HOST_NAME_MAX
-+Host names are limited in length to
-+.Brq Dv sysconf(_SC_HOST_NAME_MAX)
- characters, not including the trailing null, currently 255.
- .Sh RETURN VALUES
- .Rv -std
-@@ -101,7 +101,7 @@ The
- function conforms to
- .St -p1003.1-2001 .
- Callers should be aware that
--.Brq Dv HOST_NAME_MAX
-+.Brq Dv sysconf(_SC_HOST_NAME_MAX)
- may be variable or infinite, but is guaranteed to be no less than
- .Brq Dv _POSIX_HOST_NAME_MAX .
- On older systems, this limit was defined in the non-standard header
index 65af7160aeee6ffc554bc78c656037b8d7b28d6b..031e2c8775f493c95e2a01dd1ccfaada03ae94ea 100644 (file)
@@ -33,8 +33,10 @@ static char sccsid[] = "@(#)gethostname.c    8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $");
 
+#include <string.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
+#include <limits.h>
 
 #include <errno.h>
 #include <unistd.h>
@@ -48,10 +50,22 @@ gethostname(name, namelen)
 
        mib[0] = CTL_KERN;
        mib[1] = KERN_HOSTNAME;
+       if (namelen < MAXHOSTNAMELEN + 1) {
+               char local_buf[MAXHOSTNAMELEN + 1];
+               size_t local_len = sizeof(local_buf);
+               if (sysctl(mib, 2, local_buf, &local_len, NULL, 0) == -1) {
+                       if (errno == ENOMEM)
+                               errno = ENAMETOOLONG;
+                       return (-1);
+               }
+               strncpy(name, local_buf, namelen);
+               name[namelen - 1] = 0;
+       } else {
        if (sysctl(mib, 2, name, &namelen, NULL, 0) == -1) {
                if (errno == ENOMEM)
                        errno = ENAMETOOLONG;
                return (-1);
+               }
        }
        return (0);
 }
diff --git a/gen/FreeBSD/gethostname.c.patch b/gen/FreeBSD/gethostname.c.patch
deleted file mode 100644 (file)
index 803bd60..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---- gethostname.c.orig 2009-11-07 15:38:57.000000000 -0800
-+++ gethostname.c      2009-11-07 15:44:48.000000000 -0800
-@@ -33,8 +33,10 @@ static char sccsid[] = "@(#)gethostname.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $");
-+#include <string.h>
- #include <sys/param.h>
- #include <sys/sysctl.h>
-+#include <limits.h>
- #include <errno.h>
- #include <unistd.h>
-@@ -48,10 +50,22 @@ gethostname(name, namelen)
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_HOSTNAME;
-+      if (namelen < MAXHOSTNAMELEN + 1) {
-+              char local_buf[MAXHOSTNAMELEN + 1];
-+              size_t local_len = sizeof(local_buf);
-+              if (sysctl(mib, 2, local_buf, &local_len, NULL, 0) == -1) {
-+                      if (errno == ENOMEM)
-+                              errno = ENAMETOOLONG;
-+                      return (-1);
-+              }
-+              strncpy(name, local_buf, namelen);
-+              name[namelen - 1] = 0;
-+      } else {
-       if (sysctl(mib, 2, name, &namelen, NULL, 0) == -1) {
-               if (errno == ENOMEM)
-                       errno = ENAMETOOLONG;
-               return (-1);
-+              }
-       }
-       return (0);
- }
index 823d520c60be1c699ca150b37729cd0f62434658..f60de8de4c4a56026bbfb9d0b58c9d7f28d34296 100644 (file)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/getlogin.c,v 1.11 2009/12/05 19:04:21 ed Ex
 #define        THREAD_LOCK()   if (__isthreaded) _pthread_mutex_lock(&logname_mutex)
 #define        THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&logname_mutex)
 
-extern int             _getlogin(char *, int);
+extern int             __getlogin(char *, int);
 
 int                    _logname_valid;         /* known to setlogin() */
 static pthread_mutex_t logname_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -59,7 +59,7 @@ getlogin_basic(int *status)
        static char logname[MAXLOGNAME];
 
        if (_logname_valid == 0) {
-               if (_getlogin(logname, sizeof(logname)) < 0) {
+               if (__getlogin(logname, sizeof(logname)) < 0) {
                        *status = errno;
                        return (NULL);
                }
@@ -82,7 +82,7 @@ getlogin(void)
 }
 
 int
-getlogin_r(char *logname, int namelen)
+getlogin_r(char *logname, size_t namelen)
 {
        char    *result;
        int     len;
diff --git a/gen/FreeBSD/getlogin.c.patch b/gen/FreeBSD/getlogin.c.patch
deleted file mode 100644 (file)
index 3e8de44..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
---- getlogin.c.bsdnew  2009-12-08 00:37:57.000000000 -0800
-+++ getlogin.c 2009-12-08 00:44:06.000000000 -0800
-@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/get
- #define       THREAD_LOCK()   if (__isthreaded) _pthread_mutex_lock(&logname_mutex)
- #define       THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&logname_mutex)
--extern int            _getlogin(char *, int);
-+extern int            __getlogin(char *, int);
- int                   _logname_valid;         /* known to setlogin() */
- static pthread_mutex_t        logname_mutex = PTHREAD_MUTEX_INITIALIZER;
-@@ -59,7 +59,7 @@ getlogin_basic(int *status)
-       static char logname[MAXLOGNAME];
-       if (_logname_valid == 0) {
--              if (_getlogin(logname, sizeof(logname)) < 0) {
-+              if (__getlogin(logname, sizeof(logname)) < 0) {
-                       *status = errno;
-                       return (NULL);
-               }
-@@ -82,7 +82,7 @@ getlogin(void)
- }
- int
--getlogin_r(char *logname, int namelen)
-+getlogin_r(char *logname, size_t namelen)
- {
-       char    *result;
-       int     len;
index e5b6f179935d7fc01625826ac81e75dbb531b181..0c8283bdd3880599840b7eb71407195cd908866d 100644 (file)
 .\"     @(#)getmntinfo.3       8.1 (Berkeley) 6/9/93
 .\" $FreeBSD: src/lib/libc/gen/getmntinfo.3,v 1.13 2007/01/09 00:27:54 imp Exp $
 .\"
-.Dd June 9, 1993
+.Dd May 4, 2010
 .Dt GETMNTINFO 3
 .Os
 .Sh NAME
 .Nm getmntinfo
+.Nm getmntinfo64
 .Nd get information about mounted file systems
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In sys/param.h
 .In sys/ucred.h
 .In sys/mount.h
 .Ft int
 .Fn getmntinfo "struct statfs **mntbufp" "int flags"
+.Sh TRANSITIIONAL SYNOPSIS (NOW DEPRECATED)
+.Ft int
+.br
+.Fn getmntinfo64 "struct statfs64 **mntbufp" "int flags" ;
 .Sh DESCRIPTION
 The
 .Fn getmntinfo
 function
 returns an array of
-.Fn statfs
+.Ft statfs
 structures describing each currently mounted file system (see
 .Xr statfs 2 ) .
+As
+.Xr statfs 2
+indicates, the structure is defined differently depending on
+whether the macro _DARWIN_FEATURE_64_BIT_INODE is defined (see
+.Xr stat 2
+for more information on this macro).
 .Pp
 The
 .Fn getmntinfo
@@ -82,9 +91,26 @@ routines
 .Xr getfsstat 2
 or
 .Xr malloc 3 .
+.Sh TRANSITIONAL DESCRIPTION (NOW DEPRECATED)
+The
+.Fn getmntinfo64
+routine is equivalent to its corresponding non-64-suffixed routine,
+when 64-bit inodes are in effect.
+It was added before there was support for the symbol variants, and so is
+now deprecated.
+Instead of using it, set the
+.Dv _DARWIN_USE_64_BIT_INODE
+macro before including header files to force 64-bit inode support.
+.Pp
+The
+.Ft statfs64
+structure used by this deprecated routine is the same as the
+.Ft statfs
+structure when 64-bit inodes are in effect.
 .Sh SEE ALSO
 .Xr getfsstat 2 ,
 .Xr mount 2 ,
+.Xr stat 2 ,
 .Xr statfs 2 ,
 .Xr mount 8
 .Sh HISTORY
diff --git a/gen/FreeBSD/getmntinfo.3.patch b/gen/FreeBSD/getmntinfo.3.patch
deleted file mode 100644 (file)
index 2a3e504..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
---- getmntinfo.3.orig  2010-06-17 09:25:28.000000000 -0700
-+++ getmntinfo.3       2010-06-17 09:26:43.000000000 -0700
-@@ -28,28 +28,37 @@
- .\"     @(#)getmntinfo.3      8.1 (Berkeley) 6/9/93
- .\" $FreeBSD: src/lib/libc/gen/getmntinfo.3,v 1.13 2007/01/09 00:27:54 imp Exp $
- .\"
--.Dd June 9, 1993
-+.Dd May 4, 2010
- .Dt GETMNTINFO 3
- .Os
- .Sh NAME
- .Nm getmntinfo
-+.Nm getmntinfo64
- .Nd get information about mounted file systems
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In sys/param.h
- .In sys/ucred.h
- .In sys/mount.h
- .Ft int
- .Fn getmntinfo "struct statfs **mntbufp" "int flags"
-+.Sh TRANSITIIONAL SYNOPSIS (NOW DEPRECATED)
-+.Ft int
-+.br
-+.Fn getmntinfo64 "struct statfs64 **mntbufp" "int flags" ;
- .Sh DESCRIPTION
- The
- .Fn getmntinfo
- function
- returns an array of
--.Fn statfs
-+.Ft statfs
- structures describing each currently mounted file system (see
- .Xr statfs 2 ) .
-+As
-+.Xr statfs 2
-+indicates, the structure is defined differently depending on
-+whether the macro _DARWIN_FEATURE_64_BIT_INODE is defined (see
-+.Xr stat 2
-+for more information on this macro).
- .Pp
- The
- .Fn getmntinfo
-@@ -82,9 +91,26 @@ routines
- .Xr getfsstat 2
- or
- .Xr malloc 3 .
-+.Sh TRANSITIONAL DESCRIPTION (NOW DEPRECATED)
-+The
-+.Fn getmntinfo64
-+routine is equivalent to its corresponding non-64-suffixed routine,
-+when 64-bit inodes are in effect.
-+It was added before there was support for the symbol variants, and so is
-+now deprecated.
-+Instead of using it, set the
-+.Dv _DARWIN_USE_64_BIT_INODE
-+macro before including header files to force 64-bit inode support.
-+.Pp
-+The
-+.Ft statfs64
-+structure used by this deprecated routine is the same as the
-+.Ft statfs
-+structure when 64-bit inodes are in effect.
- .Sh SEE ALSO
- .Xr getfsstat 2 ,
- .Xr mount 2 ,
-+.Xr stat 2 ,
- .Xr statfs 2 ,
- .Xr mount 8
- .Sh HISTORY
diff --git a/gen/FreeBSD/getmntinfo64.c b/gen/FreeBSD/getmntinfo64.c
new file mode 100644 (file)
index 0000000..f4f3a28
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getmntinfo.c       8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/gen/getmntinfo.c,v 1.5 2007/01/09 00:27:54 imp Exp $");
+
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#include <stdlib.h>
+
+/*
+ * Return information about mounted filesystems.
+ */
+int
+getmntinfo64(mntbufp, flags)
+       struct statfs64 **mntbufp;
+       int flags;
+{
+       static struct statfs64 *mntbuf;
+       static int mntsize;
+       static long bufsize;
+
+       if (mntsize <= 0 && (mntsize = getfsstat64(0, 0, MNT_NOWAIT)) < 0)
+               return (0);
+       if (bufsize > 0 && (mntsize = getfsstat64(mntbuf, bufsize, flags)) < 0)
+               return (0);
+       while (bufsize <= mntsize * sizeof(struct statfs64)) {
+               if (mntbuf)
+                       free(mntbuf);
+               bufsize = (mntsize + 1) * sizeof(struct statfs64);
+               if ((mntbuf = (struct statfs64 *)malloc(bufsize)) == 0)
+                       return (0);
+               if ((mntsize = getfsstat64(mntbuf, bufsize, flags)) < 0)
+                       return (0);
+       }
+       *mntbufp = mntbuf;
+       return (mntsize);
+}
diff --git a/gen/FreeBSD/getmntinfo64.c.patch b/gen/FreeBSD/getmntinfo64.c.patch
deleted file mode 100644 (file)
index 4663c82..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---- getmntinfo.c.orig  2007-01-21 11:53:36.000000000 -0800
-+++ getmntinfo.c       2007-01-21 17:05:23.000000000 -0800
-@@ -46,25 +46,25 @@
-  * Return information about mounted filesystems.
-  */
- int
--getmntinfo(mntbufp, flags)
--      struct statfs **mntbufp;
-+getmntinfo64(mntbufp, flags)
-+      struct statfs64 **mntbufp;
-       int flags;
- {
--      static struct statfs *mntbuf;
-+      static struct statfs64 *mntbuf;
-       static int mntsize;
-       static long bufsize;
--      if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0)
-+      if (mntsize <= 0 && (mntsize = getfsstat64(0, 0, MNT_NOWAIT)) < 0)
-               return (0);
--      if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
-+      if (bufsize > 0 && (mntsize = getfsstat64(mntbuf, bufsize, flags)) < 0)
-               return (0);
--      while (bufsize <= mntsize * sizeof(struct statfs)) {
-+      while (bufsize <= mntsize * sizeof(struct statfs64)) {
-               if (mntbuf)
-                       free(mntbuf);
--              bufsize = (mntsize + 1) * sizeof(struct statfs);
--              if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0)
-+              bufsize = (mntsize + 1) * sizeof(struct statfs64);
-+              if ((mntbuf = (struct statfs64 *)malloc(bufsize)) == 0)
-                       return (0);
--              if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
-+              if ((mntsize = getfsstat64(mntbuf, bufsize, flags)) < 0)
-                       return (0);
-       }
-       *mntbufp = mntbuf;
index 5ea703ef8ed34138e711ecab7169140fba82203d..b7b9c99f081601058400acbcf482f362495dc8bb 100644 (file)
@@ -85,8 +85,7 @@ Calling
 allows the aforementioned library to learn the program name without
 modifications to the start-up code.
 .Sh SEE ALSO
-.Xr err 3 ,
-.Xr setproctitle 3
+.Xr err 3
 .Sh HISTORY
 These functions first appeared in
 .Nx 1.6 ,
diff --git a/gen/FreeBSD/getprogname.3.patch b/gen/FreeBSD/getprogname.3.patch
deleted file mode 100644 (file)
index a3fff66..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- getprogname.3.orig 2009-11-07 14:51:38.000000000 -0800
-+++ getprogname.3      2009-11-07 14:51:39.000000000 -0800
-@@ -85,8 +85,7 @@ Calling
- allows the aforementioned library to learn the program name without
- modifications to the start-up code.
- .Sh SEE ALSO
--.Xr err 3 ,
--.Xr setproctitle 3
-+.Xr err 3
- .Sh HISTORY
- These functions first appeared in
- .Nx 1.6 ,
index 4be82e32152ad56037c695d00d0ef383d5ff8dbe..a736f65685900c809522219981bb29b1b988d909 100644 (file)
@@ -3,6 +3,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/getprogname.c,v 1.4 2002/03/29 22:43:41 mar
 
 #include "namespace.h"
 #include <stdlib.h>
+#include <crt_externs.h>
+#define        __progname      (*_NSGetProgname())
 #include "un-namespace.h"
 
 #include "libc_private.h"
diff --git a/gen/FreeBSD/getprogname.c.patch b/gen/FreeBSD/getprogname.c.patch
deleted file mode 100644 (file)
index 274026c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- getprogname.c.orig 2009-11-07 14:51:38.000000000 -0800
-+++ getprogname.c      2009-11-07 14:51:39.000000000 -0800
-@@ -3,6 +3,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/get
- #include "namespace.h"
- #include <stdlib.h>
-+#include <crt_externs.h>
-+#define       __progname      (*_NSGetProgname())
- #include "un-namespace.h"
- #include "libc_private.h"
index 4473427b55a053bcfe3121b29f5ffaf935648e5f..a71c96b4e79bb31e14bc3eee31f397f0f231495d 100644 (file)
 .\"     @(#)glob.3     8.3 (Berkeley) 4/16/94
 .\" $FreeBSD: src/lib/libc/gen/glob.3,v 1.32 2007/01/09 00:27:54 imp Exp $
 .\"
-.Dd September 1, 2004
+.Dd May 20, 2008
 .Dt GLOB 3
 .Os
 .Sh NAME
 .Nm glob ,
+#ifdef UNIFDEF_BLOCKS
+.Nm glob_b ,
+#endif
 .Nm globfree
 .Nd generate pathnames matching a pattern
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In glob.h
 .Ft int
-.Fn glob "const char *pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t *pglob"
+.Fo glob
+.Fa "const char *restrict pattern"
+.Fa "int flags"
+.Fa "int (*errfunc)(const char *epath, int errno)"
+.Fa "glob_t *restrict pglob"
+.Fc
+#ifdef UNIFDEF_BLOCKS
+.Ft int
+.Fo glob_b
+.Fa "const char *restrict pattern"
+.Fa "int flags"
+.Fa "int (^errblk)(const char *epath, int errno)"
+.Fa "glob_t *restrict pglob"
+.Fc
+#endif
 .Ft void
-.Fn globfree "glob_t *pglob"
+.Fo globfree
+.Fa "glob_t *pglob"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn glob
@@ -60,7 +77,7 @@ which contains at least the following fields:
 .Bd -literal
 typedef struct {
        size_t gl_pathc;        /* count of total paths so far */
-       size_t gl_matchc;       /* count of paths matching pattern */
+       int gl_matchc;          /* count of paths matching pattern */
        size_t gl_offs;         /* reserved at beginning of gl_pathv */
        int gl_flags;           /* returned flags */
        char **gl_pathv;        /* list of paths matching pattern */
@@ -322,18 +339,39 @@ is
 or
 .Fa errfunc
 returns zero, the error is ignored.
+#ifdef UNIFDEF_BLOCKS
+.Pp
+The
+.Fn glob_b
+function is like
+.Fn glob
+except that the error callback is a block pointer instead of a function
+pointer.
+#endif
 .Pp
 The
 .Fn globfree
 function frees any space associated with
 .Fa pglob
 from a previous call(s) to
+#ifdef UNIFDEF_BLOCKS
+.Fn glob
+or
+.Fn glob_b .
+#else
 .Fn glob .
+#endif
 .Sh RETURN VALUES
 On successful completion,
 .Fn glob
+#ifdef UNIFDEF_BLOCKS
+and
+.Fn glob_b
+return zero.
+#else
 returns zero.
-In addition the fields of
+#endif
+In addition, the fields of
 .Fa pglob
 contain the values described below:
 .Bl -tag -width GLOB_NOCHECK
@@ -341,12 +379,22 @@ contain the values described below:
 contains the total number of matched pathnames so far.
 This includes other matches from previous invocations of
 .Fn glob
+#ifdef UNIFDEF_BLOCKS
+or
+.Fn glob_b
+#endif
 if
 .Dv GLOB_APPEND
 was specified.
 .It Fa gl_matchc
 contains the number of matched pathnames in the current invocation of
+#ifdef UNIFDEF_BLOCKS
+.Fn glob
+or
+.Fn glob_b .
+#else
 .Fn glob .
+#endif
 .It Fa gl_flags
 contains a copy of the
 .Fa flags
@@ -369,6 +417,10 @@ are undefined.
 .Pp
 If
 .Fn glob
+#ifdef UNIFDEF_BLOCKS
+or
+.Fn glob_b
+#endif
 terminates due to an error, it sets errno and returns one of the
 following non-zero constants, which are defined in the include
 file
@@ -414,6 +466,18 @@ g.gl_pathv[0] = "ls";
 g.gl_pathv[1] = "-l";
 execvp("ls", g.gl_pathv);
 .Ed
+.Sh CAVEATS
+The
+.Fn glob
+#ifdef UNIFDEF_BLOCKS
+and
+.Fn glob_b
+functions
+#else
+function
+#endif
+will not match filenames that begin with a period
+unless this is specifically requested (e.g., by ".*").
 .Sh SEE ALSO
 .Xr sh 1 ,
 .Xr fnmatch 3 ,
@@ -452,6 +516,11 @@ and
 .Fn globfree
 functions first appeared in
 .Bx 4.4 .
+#ifdef UNIFDEF_BLOCKS
+The
+.Fn glob_b
+function first appeared in Mac OS X 10.6.
+#endif
 .Sh BUGS
 Patterns longer than
 .Dv MAXPATHLEN
@@ -459,7 +528,13 @@ may cause unchecked errors.
 .Pp
 The
 .Fn glob
-argument
+#ifdef UNIFDEF_BLOCKS
+and
+.Fn glob_b
+functions
+#else
+function
+#endif
 may fail and set errno for any of the errors specified for the
 library routines
 .Xr stat 2 ,
diff --git a/gen/FreeBSD/glob.3.patch b/gen/FreeBSD/glob.3.patch
deleted file mode 100644 (file)
index d0099be..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
---- glob.3.orig        2011-01-26 13:57:29.000000000 -0800
-+++ glob.3     2011-01-26 14:02:29.000000000 -0800
-@@ -30,21 +30,38 @@
- .\"     @(#)glob.3    8.3 (Berkeley) 4/16/94
- .\" $FreeBSD: src/lib/libc/gen/glob.3,v 1.32 2007/01/09 00:27:54 imp Exp $
- .\"
--.Dd September 1, 2004
-+.Dd May 20, 2008
- .Dt GLOB 3
- .Os
- .Sh NAME
- .Nm glob ,
-+#ifdef UNIFDEF_BLOCKS
-+.Nm glob_b ,
-+#endif
- .Nm globfree
- .Nd generate pathnames matching a pattern
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In glob.h
- .Ft int
--.Fn glob "const char *pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t *pglob"
-+.Fo glob
-+.Fa "const char *restrict pattern"
-+.Fa "int flags"
-+.Fa "int (*errfunc)(const char *epath, int errno)"
-+.Fa "glob_t *restrict pglob"
-+.Fc
-+#ifdef UNIFDEF_BLOCKS
-+.Ft int
-+.Fo glob_b
-+.Fa "const char *restrict pattern"
-+.Fa "int flags"
-+.Fa "int (^errblk)(const char *epath, int errno)"
-+.Fa "glob_t *restrict pglob"
-+.Fc
-+#endif
- .Ft void
--.Fn globfree "glob_t *pglob"
-+.Fo globfree
-+.Fa "glob_t *pglob"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn glob
-@@ -60,7 +77,7 @@
- .Bd -literal
- typedef struct {
-       size_t gl_pathc;        /* count of total paths so far */
--      size_t gl_matchc;       /* count of paths matching pattern */
-+      int gl_matchc;          /* count of paths matching pattern */
-       size_t gl_offs;         /* reserved at beginning of gl_pathv */
-       int gl_flags;           /* returned flags */
-       char **gl_pathv;        /* list of paths matching pattern */
-@@ -322,18 +339,39 @@
- or
- .Fa errfunc
- returns zero, the error is ignored.
-+#ifdef UNIFDEF_BLOCKS
-+.Pp
-+The
-+.Fn glob_b
-+function is like
-+.Fn glob
-+except that the error callback is a block pointer instead of a function
-+pointer.
-+#endif
- .Pp
- The
- .Fn globfree
- function frees any space associated with
- .Fa pglob
- from a previous call(s) to
-+#ifdef UNIFDEF_BLOCKS
-+.Fn glob
-+or
-+.Fn glob_b .
-+#else
- .Fn glob .
-+#endif
- .Sh RETURN VALUES
- On successful completion,
- .Fn glob
-+#ifdef UNIFDEF_BLOCKS
-+and
-+.Fn glob_b
-+return zero.
-+#else
- returns zero.
--In addition the fields of
-+#endif
-+In addition, the fields of
- .Fa pglob
- contain the values described below:
- .Bl -tag -width GLOB_NOCHECK
-@@ -341,12 +379,22 @@
- contains the total number of matched pathnames so far.
- This includes other matches from previous invocations of
- .Fn glob
-+#ifdef UNIFDEF_BLOCKS
-+or
-+.Fn glob_b
-+#endif
- if
- .Dv GLOB_APPEND
- was specified.
- .It Fa gl_matchc
- contains the number of matched pathnames in the current invocation of
-+#ifdef UNIFDEF_BLOCKS
-+.Fn glob
-+or
-+.Fn glob_b .
-+#else
- .Fn glob .
-+#endif
- .It Fa gl_flags
- contains a copy of the
- .Fa flags
-@@ -369,6 +417,10 @@
- .Pp
- If
- .Fn glob
-+#ifdef UNIFDEF_BLOCKS
-+or
-+.Fn glob_b
-+#endif
- terminates due to an error, it sets errno and returns one of the
- following non-zero constants, which are defined in the include
- file
-@@ -414,6 +466,18 @@
- g.gl_pathv[1] = "-l";
- execvp("ls", g.gl_pathv);
- .Ed
-+.Sh CAVEATS
-+The
-+.Fn glob
-+#ifdef UNIFDEF_BLOCKS
-+and
-+.Fn glob_b
-+functions
-+#else
-+function
-+#endif
-+will not match filenames that begin with a period
-+unless this is specifically requested (e.g., by ".*").
- .Sh SEE ALSO
- .Xr sh 1 ,
- .Xr fnmatch 3 ,
-@@ -452,6 +516,11 @@
- .Fn globfree
- functions first appeared in
- .Bx 4.4 .
-+#ifdef UNIFDEF_BLOCKS
-+The
-+.Fn glob_b
-+function first appeared in Mac OS X 10.6.
-+#endif
- .Sh BUGS
- Patterns longer than
- .Dv MAXPATHLEN
-@@ -459,7 +528,13 @@
- .Pp
- The
- .Fn glob
--argument
-+#ifdef UNIFDEF_BLOCKS
-+and
-+.Fn glob_b
-+functions
-+#else
-+function
-+#endif
- may fail and set errno for any of the errors specified for the
- library routines
- .Xr stat 2 ,
index a289d90a3d091867aa40388dd7ccd90064565e87..e519cc607d8950665e569ba49696c5b60c156673 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)glob.c    8.3 (Berkeley) 10/13/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.28 2010/05/12 17:44:00 gordon Exp $");
 
+#include "xlocale_private.h"
+
 /*
  * glob(3) -- a superset of the one defined in POSIX 1003.2.
  *
@@ -89,6 +91,19 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.28 2010/05/12 17:44:00 gordon Ex
 
 #include "collate.h"
 
+#define GLOB_LIMIT_STRING      65536   /* number of readdirs */
+#define GLOB_LIMIT_STAT                128     /* number of stat system calls */
+#define GLOB_LIMIT_READDIR     16384   /* total buffer size of path strings */
+#define GLOB_LIMIT_PATH                1024    /* number of path elements */
+#define GLOB_LIMIT_BRACE       128     /* Number of brace calls */
+
+struct glob_limit {
+       size_t l_string;
+       size_t l_stat;  
+       size_t l_readdir;       
+       size_t l_brace;
+};
+
 #define        DOLLAR          '$'
 #define        DOT             '.'
 #define        EOS             '\0'
@@ -139,62 +154,64 @@ typedef char Char;
 #define        ismeta(c)       (((c)&M_QUOTE) != 0)
 
 
-static int      compare(const void *, const void *);
-static int      g_Ctoc(const Char *, char *, size_t);
-static int      g_lstat(Char *, struct stat *, glob_t *);
-static DIR     *g_opendir(Char *, glob_t *);
-static const Char *g_strchr(const Char *, wchar_t);
+#define compare                __gl_compare
+#define g_Ctoc         __gl_g_Ctoc
+#define g_strchr       __gl_g_strchr
+#define globextend     __gl_globextend
+#define globtilde      __gl_globtilde
+#define match          __gl_match
+__private_extern__ int  compare(const void *, const void *);
+__private_extern__ int  g_Ctoc(const Char *, char *, size_t, locale_t);
+__private_extern__ const Char *g_strchr(const Char *, wchar_t);
+__private_extern__ int  globextend(const Char *, glob_t *, struct glob_limit *, locale_t);
+__private_extern__ const Char *        
+                globtilde(const Char *, Char *, size_t, glob_t *);
+__private_extern__ int  match(Char *, Char *, Char *, locale_t);
+
+
+static int      g_lstat(Char *, struct stat *, glob_t *, locale_t);
+static DIR     *g_opendir(Char *, glob_t *, locale_t);
 #ifdef notdef
 static Char    *g_strcat(Char *, const Char *);
 #endif
-static int      g_stat(Char *, struct stat *, glob_t *);
-static int      glob0(const Char *, glob_t *, size_t *);
-static int      glob1(Char *, glob_t *, size_t *);
-static int      glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
-static int      glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
-static int      globextend(const Char *, glob_t *, size_t *);
-static const Char *    
-                globtilde(const Char *, Char *, size_t, glob_t *);
-static int      globexp1(const Char *, glob_t *, size_t *);
-static int      globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
-static int      match(Char *, Char *, Char *);
+static int      g_stat(Char *, struct stat *, glob_t *, locale_t);
+static int      glob0(const Char *, glob_t *, struct glob_limit *, locale_t);
+static int      glob1(Char *, glob_t *, struct glob_limit *, locale_t);
+static int      glob2(Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *, locale_t);
+static int      glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *, locale_t);
+static int      globexp1(const Char *, glob_t *, struct glob_limit *, locale_t);
+static int      globexp2(const Char *, const Char *, glob_t *, int *, struct glob_limit *, locale_t);
 #ifdef DEBUG
 static void     qprintf(const char *, Char *);
 #endif
 
-int
-glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
+static int
+__glob(const char *pattern, glob_t *pglob)
 {
        const char *patnext;
-       size_t limit;
+       struct glob_limit limit = { 0, 0, 0, 0 };
        Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
        mbstate_t mbs;
        wchar_t wc;
        size_t clen;
+       locale_t loc = __current_locale();
+       int mb_cur_max = MB_CUR_MAX_L(loc);
 
        patnext = pattern;
-       if (!(flags & GLOB_APPEND)) {
+       if (!(pglob->gl_flags & GLOB_APPEND)) {
                pglob->gl_pathc = 0;
                pglob->gl_pathv = NULL;
-               if (!(flags & GLOB_DOOFFS))
+               if (!(pglob->gl_flags & GLOB_DOOFFS))
                        pglob->gl_offs = 0;
        }
-       if (flags & GLOB_LIMIT) {
-               limit = pglob->gl_matchc;
-               if (limit == 0)
-                       limit = ARG_MAX;
-       } else
-               limit = 0;
-       pglob->gl_flags = flags & ~GLOB_MAGCHAR;
-       pglob->gl_errfunc = errfunc;
        pglob->gl_matchc = 0;
 
        bufnext = patbuf;
        bufend = bufnext + MAXPATHLEN - 1;
-       if (flags & GLOB_NOESCAPE) {
+       if (pglob->gl_flags & GLOB_NOESCAPE) {
                memset(&mbs, 0, sizeof(mbs));
-               while (bufend - bufnext >= MB_CUR_MAX) {
-                       clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
+               while (bufend - bufnext >= mb_cur_max) {
+                       clen = mbrtowc_l(&wc, patnext, MB_LEN_MAX, &mbs, loc);
                        if (clen == (size_t)-1 || clen == (size_t)-2)
                                return (GLOB_NOMATCH);
                        else if (clen == 0)
@@ -205,7 +222,7 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *
        } else {
                /* Protect the quoted characters. */
                memset(&mbs, 0, sizeof(mbs));
-               while (bufend - bufnext >= MB_CUR_MAX) {
+               while (bufend - bufnext >= mb_cur_max) {
                        if (*patnext == QUOTE) {
                                if (*++patnext == EOS) {
                                        *bufnext++ = QUOTE | M_PROTECT;
@@ -214,7 +231,7 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *
                                prot = M_PROTECT;
                        } else
                                prot = 0;
-                       clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
+                       clen = mbrtowc_l(&wc, patnext, MB_LEN_MAX, &mbs, loc);
                        if (clen == (size_t)-1 || clen == (size_t)-2)
                                return (GLOB_NOMATCH);
                        else if (clen == 0)
@@ -225,11 +242,34 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *
        }
        *bufnext = EOS;
 
-       if (flags & GLOB_BRACE)
-           return globexp1(patbuf, pglob, &limit);
+       if (pglob->gl_flags & GLOB_BRACE)
+           return globexp1(patbuf, pglob, &limit, loc);
        else
-           return glob0(patbuf, pglob, &limit);
+           return glob0(patbuf, pglob, &limit, loc);
+}
+
+int
+glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
+{
+#ifdef __BLOCKS__
+       pglob->gl_flags = flags & ~(GLOB_MAGCHAR | _GLOB_ERR_BLOCK);
+#else /* !__BLOCKS__ */
+       pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+#endif /* __BLOCKS__ */
+       pglob->gl_errfunc = errfunc;
+       return __glob(pattern, pglob);
+}
+
+#ifdef __BLOCKS__
+int
+glob_b(const char *pattern, int flags, int (^errblk)(const char *, int), glob_t *pglob)
+{
+       pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+       pglob->gl_flags |= _GLOB_ERR_BLOCK;
+       pglob->gl_errblk = errblk;
+       return __glob(pattern, pglob);
 }
+#endif /* __BLOCKS__ */
 
 /*
  * Expand recursively a glob {} pattern. When there is no more expansion
@@ -237,20 +277,26 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *
  * characters
  */
 static int
-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
 {
        const Char* ptr = pattern;
        int rv;
 
+       if ((pglob->gl_flags & GLOB_LIMIT) &&
+           limit->l_brace++ >= GLOB_LIMIT_BRACE) {
+               errno = 0;
+               return GLOB_NOSPACE;
+       }
+
        /* Protect a single {}, for find(1), like csh */
        if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
-               return glob0(pattern, pglob, limit);
+               return glob0(pattern, pglob, limit, loc);
 
        while ((ptr = g_strchr(ptr, LBRACE)) != NULL)
-               if (!globexp2(ptr, pattern, pglob, &rv, limit))
+               if (!globexp2(ptr, pattern, pglob, &rv, limit, loc))
                        return rv;
 
-       return glob0(pattern, pglob, limit);
+       return glob0(pattern, pglob, limit, loc);
 }
 
 
@@ -260,7 +306,7 @@ globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
  * If it fails then it tries to glob the rest of the pattern and returns.
  */
 static int
-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
+globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, struct glob_limit *limit, locale_t loc)
 {
        int     i;
        Char   *lm, *ls;
@@ -297,7 +343,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
 
        /* Non matching braces; just glob the pattern */
        if (i != 0 || *pe == EOS) {
-               *rv = glob0(patbuf, pglob, limit);
+               *rv = glob0(patbuf, pglob, limit, loc);
                return 0;
        }
 
@@ -344,7 +390,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
 #ifdef DEBUG
                                qprintf("globexp2:", patbuf);
 #endif
-                               *rv = globexp1(patbuf, pglob, limit);
+                               *rv = globexp1(patbuf, pglob, limit, loc);
 
                                /* move after the comma, to the next string */
                                pl = pm + 1;
@@ -360,10 +406,11 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *l
 
 
 
+#ifndef BUILDING_VARIANT
 /*
  * expand tilde from the passwd file.
  */
-static const Char *
+__private_extern__ const Char *
 globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
 {
        struct passwd *pwd;
@@ -421,6 +468,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
 
        return patbuf;
 }
+#endif /* BUILDING_VARIANT */
 
 
 /*
@@ -430,7 +478,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
  * if things went well, nonzero if errors occurred.
  */
 static int
-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
 {
        const Char *qpatnext;
        int err;
@@ -443,6 +491,10 @@ glob0(const Char *pattern, glob_t *pglob, size_t *limit)
 
        /* We don't need to check for buffer overflow any more. */
        while ((c = *qpatnext++) != EOS) {
+               if (c & M_PROTECT) {
+                       *bufnext++ = CHAR(c);
+                       continue;
+               } /* else */
                switch (c) {
                case LBRACKET:
                        c = *qpatnext;
@@ -493,7 +545,7 @@ glob0(const Char *pattern, glob_t *pglob, size_t *limit)
        qprintf("glob0:", patbuf);
 #endif
 
-       if ((err = glob1(patbuf, pglob, limit)) != 0)
+       if ((err = glob1(patbuf, pglob, limit, loc)) != 0)
                return(err);
 
        /*
@@ -506,7 +558,7 @@ glob0(const Char *pattern, glob_t *pglob, size_t *limit)
                if (((pglob->gl_flags & GLOB_NOCHECK) ||
                    ((pglob->gl_flags & GLOB_NOMAGIC) &&
                        !(pglob->gl_flags & GLOB_MAGCHAR))))
-                       return(globextend(pattern, pglob, limit));
+                       return(globextend(pattern, pglob, limit, loc));
                else
                        return(GLOB_NOMATCH);
        }
@@ -516,14 +568,16 @@ glob0(const Char *pattern, glob_t *pglob, size_t *limit)
        return(0);
 }
 
-static int
+#ifndef BUILDING_VARIANT
+__private_extern__ int
 compare(const void *p, const void *q)
 {
-       return(strcmp(*(char **)p, *(char **)q));
+       return(strcoll(*(char **)p, *(char **)q));
 }
+#endif /* BUILDING_VARIANT */
 
 static int
-glob1(Char *pattern, glob_t *pglob, size_t *limit)
+glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
 {
        Char pathbuf[MAXPATHLEN];
 
@@ -531,7 +585,7 @@ glob1(Char *pattern, glob_t *pglob, size_t *limit)
        if (*pattern == EOS)
                return(0);
        return(glob2(pathbuf, pathbuf, pathbuf + MAXPATHLEN - 1,
-           pattern, pglob, limit));
+           pattern, pglob, limit, loc));
 }
 
 /*
@@ -541,7 +595,7 @@ glob1(Char *pattern, glob_t *pglob, size_t *limit)
  */
 static int
 glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
-      glob_t *pglob, size_t *limit)
+      glob_t *pglob, struct glob_limit *limit, locale_t loc)
 {
        struct stat sb;
        Char *p, *q;
@@ -554,13 +608,20 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
        for (anymeta = 0;;) {
                if (*pattern == EOS) {          /* End of pattern? */
                        *pathend = EOS;
-                       if (g_lstat(pathbuf, &sb, pglob))
+                       if (g_lstat(pathbuf, &sb, pglob, loc))
                                return(0);
 
+                       if ((pglob->gl_flags & GLOB_LIMIT) &&
+                           limit->l_stat++ >= GLOB_LIMIT_STAT) {
+                               errno = 0;
+                               *pathend++ = SEP;
+                               *pathend = EOS;
+                               return GLOB_NOSPACE;
+                       }
                        if (((pglob->gl_flags & GLOB_MARK) &&
                            pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
                            || (S_ISLNK(sb.st_mode) &&
-                           (g_stat(pathbuf, &sb, pglob) == 0) &&
+                           (g_stat(pathbuf, &sb, pglob, loc) == 0) &&
                            S_ISDIR(sb.st_mode)))) {
                                if (pathend + 1 > pathend_last)
                                        return (GLOB_ABORTED);
@@ -568,7 +629,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
                                *pathend = EOS;
                        }
                        ++pglob->gl_matchc;
-                       return(globextend(pathbuf, pglob, limit));
+                       return(globextend(pathbuf, pglob, limit, loc));
                }
 
                /* Find end of next segment, copy tentatively to pathend. */
@@ -592,7 +653,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
                        }
                } else                  /* Need expansion, recurse. */
                        return(glob3(pathbuf, pathend, pathend_last, pattern, p,
-                           pglob, limit));
+                           pglob, limit, loc));
        }
        /* NOTREACHED */
 }
@@ -600,7 +661,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
 static int
 glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
       Char *pattern, Char *restpattern,
-      glob_t *pglob, size_t *limit)
+      glob_t *pglob, struct glob_limit *limit, locale_t loc)
 {
        struct dirent *dp;
        DIR *dirp;
@@ -620,15 +681,22 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
        *pathend = EOS;
        errno = 0;
 
-       if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
+       if ((dirp = g_opendir(pathbuf, pglob, loc)) == NULL) {
                /* TODO: don't call for ENOENT or ENOTDIR? */
                if (pglob->gl_errfunc) {
-                       if (g_Ctoc(pathbuf, buf, sizeof(buf)))
+                       if (g_Ctoc(pathbuf, buf, sizeof(buf), loc))
                                return (GLOB_ABORTED);
-                       if (pglob->gl_errfunc(buf, errno) ||
-                           pglob->gl_flags & GLOB_ERR)
+#ifdef __BLOCKS__
+                       if (pglob->gl_flags & _GLOB_ERR_BLOCK) {
+                               if (pglob->gl_errblk(buf, errno))
+                                       return (GLOB_ABORTED);
+                       } else
+#endif /* __BLOCKS__ */
+                       if (pglob->gl_errfunc(buf, errno))
                                return (GLOB_ABORTED);
                }
+               if (pglob->gl_flags & GLOB_ERR)
+                       return (GLOB_ABORTED);
                return(0);
        }
 
@@ -646,6 +714,14 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
                size_t clen;
                mbstate_t mbs;
 
+               if ((pglob->gl_flags & GLOB_LIMIT) &&
+                   limit->l_readdir++ >= GLOB_LIMIT_READDIR) {
+                       errno = 0;
+                       *pathend++ = SEP;
+                       *pathend = EOS;
+                       return GLOB_NOSPACE;
+               }
+
                /* Initial DOT must be matched literally. */
                if (dp->d_name[0] == DOT && *pattern != DOT)
                        continue;
@@ -653,7 +729,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
                dc = pathend;
                sc = dp->d_name;
                while (dc < pathend_last) {
-                       clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs);
+                       clen = mbrtowc_l(&wc, sc, MB_LEN_MAX, &mbs, loc);
                        if (clen == (size_t)-1 || clen == (size_t)-2) {
                                wc = *sc;
                                clen = 1;
@@ -663,12 +739,12 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
                                break;
                        sc += clen;
                }
-               if (!match(pathend, pattern, restpattern)) {
+               if (!match(pathend, pattern, restpattern, loc)) {
                        *pathend = EOS;
                        continue;
                }
                err = glob2(pathbuf, --dc, pathend_last, restpattern,
-                   pglob, limit);
+                   pglob, limit, loc);
                if (err)
                        break;
        }
@@ -681,6 +757,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
 }
 
 
+#ifndef BUILDING_VARIANT
 /*
  * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
  * add the new item, and update gl_pathc.
@@ -695,20 +772,18 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
  *     Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
  *     gl_pathv points to (gl_offs + gl_pathc + 1) items.
  */
-static int
-globextend(const Char *path, glob_t *pglob, size_t *limit)
+__private_extern__ int
+globextend(const Char *path, glob_t *pglob, struct glob_limit *limit, locale_t loc)
 {
        char **pathv;
        size_t i, newsize, len;
        char *copy;
        const Char *p;
 
-       if (*limit && pglob->gl_pathc > *limit) {
-               errno = 0;
-               return (GLOB_NOSPACE);
-       }
-
        newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
+       if ((pglob->gl_flags & GLOB_LIMIT) &&
+           newsize > GLOB_LIMIT_PATH * sizeof(*pathv))
+               goto nospace;
        pathv = pglob->gl_pathv ?
                    realloc((char *)pglob->gl_pathv, newsize) :
                    malloc(newsize);
@@ -730,24 +805,33 @@ globextend(const Char *path, glob_t *pglob, size_t *limit)
 
        for (p = path; *p++;)
                continue;
-       len = MB_CUR_MAX * (size_t)(p - path);  /* XXX overallocation */
+       len = MB_CUR_MAX_L(loc) * (size_t)(p - path);   /* XXX overallocation */
+       limit->l_string += len;
        if ((copy = malloc(len)) != NULL) {
-               if (g_Ctoc(path, copy, len)) {
+               if (g_Ctoc(path, copy, len, loc)) {
                        free(copy);
                        return (GLOB_NOSPACE);
                }
                pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
        }
        pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+
+       if ((pglob->gl_flags & GLOB_LIMIT) &&
+           (newsize + limit->l_string) >= GLOB_LIMIT_STRING)
+               goto nospace;
+
        return(copy == NULL ? GLOB_NOSPACE : 0);
+nospace:
+       errno = 0;
+       return GLOB_NOSPACE;
 }
 
 /*
  * pattern matching function for filenames.  Each occurrence of the *
  * pattern causes a recursion level.
  */
-static int
-match(Char *name, Char *pat, Char *patend)
+__private_extern__ int
+match(Char *name, Char *pat, Char *patend, locale_t loc)
 {
        int ok, negate_range;
        Char c, k;
@@ -759,7 +843,7 @@ match(Char *name, Char *pat, Char *patend)
                        if (pat == patend)
                                return(1);
                        do
-                           if (match(name, pat, patend))
+                           if (match(name, pat, patend, loc))
                                    return(1);
                        while (*name++ != EOS);
                        return(0);
@@ -775,10 +859,10 @@ match(Char *name, Char *pat, Char *patend)
                                ++pat;
                        while (((c = *pat++) & M_MASK) != M_END)
                                if ((*pat & M_MASK) == M_RNG) {
-                                       if (__collate_load_error ?
+                                       if (loc->__collate_load_error ?
                                            CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) :
-                                              __collate_range_cmp(CHAR(c), CHAR(k)) <= 0
-                                           && __collate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0
+                                              __collate_range_cmp(CHAR(c), CHAR(k), loc) <= 0
+                                           && __collate_range_cmp(CHAR(k), CHAR(pat[1]), loc) <= 0
                                           )
                                                ok = 1;
                                        pat += 2;
@@ -812,16 +896,17 @@ globfree(glob_t *pglob)
                pglob->gl_pathv = NULL;
        }
 }
+#endif /* !BUILDING_VARIANT */
 
 static DIR *
-g_opendir(Char *str, glob_t *pglob)
+g_opendir(Char *str, glob_t *pglob, locale_t loc)
 {
        char buf[MAXPATHLEN];
 
        if (!*str)
                strcpy(buf, ".");
        else {
-               if (g_Ctoc(str, buf, sizeof(buf)))
+               if (g_Ctoc(str, buf, sizeof(buf), loc))
                        return (NULL);
        }
 
@@ -832,11 +917,11 @@ g_opendir(Char *str, glob_t *pglob)
 }
 
 static int
-g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
+g_lstat(Char *fn, struct stat *sb, glob_t *pglob, locale_t loc)
 {
        char buf[MAXPATHLEN];
 
-       if (g_Ctoc(fn, buf, sizeof(buf))) {
+       if (g_Ctoc(fn, buf, sizeof(buf), loc)) {
                errno = ENAMETOOLONG;
                return (-1);
        }
@@ -846,11 +931,11 @@ g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
 }
 
 static int
-g_stat(Char *fn, struct stat *sb, glob_t *pglob)
+g_stat(Char *fn, struct stat *sb, glob_t *pglob, locale_t loc)
 {
        char buf[MAXPATHLEN];
 
-       if (g_Ctoc(fn, buf, sizeof(buf))) {
+       if (g_Ctoc(fn, buf, sizeof(buf), loc)) {
                errno = ENAMETOOLONG;
                return (-1);
        }
@@ -859,7 +944,8 @@ g_stat(Char *fn, struct stat *sb, glob_t *pglob)
        return(stat(buf, sb));
 }
 
-static const Char *
+#ifndef BUILDING_VARIANT
+__private_extern__ const Char *
 g_strchr(const Char *str, wchar_t ch)
 {
 
@@ -870,15 +956,16 @@ g_strchr(const Char *str, wchar_t ch)
        return (NULL);
 }
 
-static int
-g_Ctoc(const Char *str, char *buf, size_t len)
+__private_extern__ int
+g_Ctoc(const Char *str, char *buf, size_t len, locale_t loc)
 {
        mbstate_t mbs;
        size_t clen;
+       int mb_cur_max = MB_CUR_MAX_L(loc);
 
        memset(&mbs, 0, sizeof(mbs));
-       while (len >= MB_CUR_MAX) {
-               clen = wcrtomb(buf, *str, &mbs);
+       while (len >= mb_cur_max) {
+               clen = wcrtomb_l(buf, *str, &mbs, loc);
                if (clen == (size_t)-1)
                        return (1);
                if (*str == L'\0')
@@ -889,6 +976,7 @@ g_Ctoc(const Char *str, char *buf, size_t len)
        }
        return (1);
 }
+#endif /* !BUILDING_VARIANT */
 
 #ifdef DEBUG
 static void
diff --git a/gen/FreeBSD/glob.c.patch b/gen/FreeBSD/glob.c.patch
deleted file mode 100644 (file)
index 9a05ae4..0000000
+++ /dev/null
@@ -1,634 +0,0 @@
---- glob.c.orig        2011-01-25 17:41:37.000000000 -0800
-+++ glob.c     2011-01-26 11:50:09.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)glob.c   8.3 (
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.28 2010/05/12 17:44:00 gordon Exp $");
-+#include "xlocale_private.h"
-+
- /*
-  * glob(3) -- a superset of the one defined in POSIX 1003.2.
-  *
-@@ -89,6 +91,19 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/glo
- #include "collate.h"
-+#define GLOB_LIMIT_STRING     65536   /* number of readdirs */
-+#define GLOB_LIMIT_STAT               128     /* number of stat system calls */
-+#define GLOB_LIMIT_READDIR    16384   /* total buffer size of path strings */
-+#define GLOB_LIMIT_PATH               1024    /* number of path elements */
-+#define GLOB_LIMIT_BRACE      128     /* Number of brace calls */
-+
-+struct glob_limit {
-+      size_t l_string;
-+      size_t l_stat;  
-+      size_t l_readdir;       
-+      size_t l_brace;
-+};
-+
- #define       DOLLAR          '$'
- #define       DOT             '.'
- #define       EOS             '\0'
-@@ -139,62 +154,64 @@ typedef char Char;
- #define       ismeta(c)       (((c)&M_QUOTE) != 0)
--static int     compare(const void *, const void *);
--static int     g_Ctoc(const Char *, char *, size_t);
--static int     g_lstat(Char *, struct stat *, glob_t *);
--static DIR    *g_opendir(Char *, glob_t *);
--static const Char *g_strchr(const Char *, wchar_t);
-+#define compare               __gl_compare
-+#define g_Ctoc                __gl_g_Ctoc
-+#define g_strchr      __gl_g_strchr
-+#define globextend    __gl_globextend
-+#define globtilde     __gl_globtilde
-+#define match         __gl_match
-+__private_extern__ int         compare(const void *, const void *);
-+__private_extern__ int         g_Ctoc(const Char *, char *, size_t, locale_t);
-+__private_extern__ const Char *g_strchr(const Char *, wchar_t);
-+__private_extern__ int         globextend(const Char *, glob_t *, struct glob_limit *, locale_t);
-+__private_extern__ const Char *       
-+               globtilde(const Char *, Char *, size_t, glob_t *);
-+__private_extern__ int         match(Char *, Char *, Char *, locale_t);
-+
-+
-+static int     g_lstat(Char *, struct stat *, glob_t *, locale_t);
-+static DIR    *g_opendir(Char *, glob_t *, locale_t);
- #ifdef notdef
- static Char   *g_strcat(Char *, const Char *);
- #endif
--static int     g_stat(Char *, struct stat *, glob_t *);
--static int     glob0(const Char *, glob_t *, size_t *);
--static int     glob1(Char *, glob_t *, size_t *);
--static int     glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
--static int     glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
--static int     globextend(const Char *, glob_t *, size_t *);
--static const Char *   
--               globtilde(const Char *, Char *, size_t, glob_t *);
--static int     globexp1(const Char *, glob_t *, size_t *);
--static int     globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
--static int     match(Char *, Char *, Char *);
-+static int     g_stat(Char *, struct stat *, glob_t *, locale_t);
-+static int     glob0(const Char *, glob_t *, struct glob_limit *, locale_t);
-+static int     glob1(Char *, glob_t *, struct glob_limit *, locale_t);
-+static int     glob2(Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *, locale_t);
-+static int     glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *, locale_t);
-+static int     globexp1(const Char *, glob_t *, struct glob_limit *, locale_t);
-+static int     globexp2(const Char *, const Char *, glob_t *, int *, struct glob_limit *, locale_t);
- #ifdef DEBUG
- static void    qprintf(const char *, Char *);
- #endif
--int
--glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
-+static int
-+__glob(const char *pattern, glob_t *pglob)
- {
-       const char *patnext;
--      size_t limit;
-+      struct glob_limit limit = { 0, 0, 0, 0 };
-       Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
-       mbstate_t mbs;
-       wchar_t wc;
-       size_t clen;
-+      locale_t loc = __current_locale();
-+      int mb_cur_max = MB_CUR_MAX_L(loc);
-       patnext = pattern;
--      if (!(flags & GLOB_APPEND)) {
-+      if (!(pglob->gl_flags & GLOB_APPEND)) {
-               pglob->gl_pathc = 0;
-               pglob->gl_pathv = NULL;
--              if (!(flags & GLOB_DOOFFS))
-+              if (!(pglob->gl_flags & GLOB_DOOFFS))
-                       pglob->gl_offs = 0;
-       }
--      if (flags & GLOB_LIMIT) {
--              limit = pglob->gl_matchc;
--              if (limit == 0)
--                      limit = ARG_MAX;
--      } else
--              limit = 0;
--      pglob->gl_flags = flags & ~GLOB_MAGCHAR;
--      pglob->gl_errfunc = errfunc;
-       pglob->gl_matchc = 0;
-       bufnext = patbuf;
-       bufend = bufnext + MAXPATHLEN - 1;
--      if (flags & GLOB_NOESCAPE) {
-+      if (pglob->gl_flags & GLOB_NOESCAPE) {
-               memset(&mbs, 0, sizeof(mbs));
--              while (bufend - bufnext >= MB_CUR_MAX) {
--                      clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
-+              while (bufend - bufnext >= mb_cur_max) {
-+                      clen = mbrtowc_l(&wc, patnext, MB_LEN_MAX, &mbs, loc);
-                       if (clen == (size_t)-1 || clen == (size_t)-2)
-                               return (GLOB_NOMATCH);
-                       else if (clen == 0)
-@@ -205,7 +222,7 @@ glob(const char *pattern, int flags, int
-       } else {
-               /* Protect the quoted characters. */
-               memset(&mbs, 0, sizeof(mbs));
--              while (bufend - bufnext >= MB_CUR_MAX) {
-+              while (bufend - bufnext >= mb_cur_max) {
-                       if (*patnext == QUOTE) {
-                               if (*++patnext == EOS) {
-                                       *bufnext++ = QUOTE | M_PROTECT;
-@@ -214,7 +231,7 @@ glob(const char *pattern, int flags, int
-                               prot = M_PROTECT;
-                       } else
-                               prot = 0;
--                      clen = mbrtowc(&wc, patnext, MB_LEN_MAX, &mbs);
-+                      clen = mbrtowc_l(&wc, patnext, MB_LEN_MAX, &mbs, loc);
-                       if (clen == (size_t)-1 || clen == (size_t)-2)
-                               return (GLOB_NOMATCH);
-                       else if (clen == 0)
-@@ -225,11 +242,34 @@ glob(const char *pattern, int flags, int
-       }
-       *bufnext = EOS;
--      if (flags & GLOB_BRACE)
--          return globexp1(patbuf, pglob, &limit);
-+      if (pglob->gl_flags & GLOB_BRACE)
-+          return globexp1(patbuf, pglob, &limit, loc);
-       else
--          return glob0(patbuf, pglob, &limit);
-+          return glob0(patbuf, pglob, &limit, loc);
-+}
-+
-+int
-+glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
-+{
-+#ifdef __BLOCKS__
-+      pglob->gl_flags = flags & ~(GLOB_MAGCHAR | _GLOB_ERR_BLOCK);
-+#else /* !__BLOCKS__ */
-+      pglob->gl_flags = flags & ~GLOB_MAGCHAR;
-+#endif /* __BLOCKS__ */
-+      pglob->gl_errfunc = errfunc;
-+      return __glob(pattern, pglob);
-+}
-+
-+#ifdef __BLOCKS__
-+int
-+glob_b(const char *pattern, int flags, int (^errblk)(const char *, int), glob_t *pglob)
-+{
-+      pglob->gl_flags = flags & ~GLOB_MAGCHAR;
-+      pglob->gl_flags |= _GLOB_ERR_BLOCK;
-+      pglob->gl_errblk = errblk;
-+      return __glob(pattern, pglob);
- }
-+#endif /* __BLOCKS__ */
- /*
-  * Expand recursively a glob {} pattern. When there is no more expansion
-@@ -237,20 +277,26 @@ glob(const char *pattern, int flags, int
-  * characters
-  */
- static int
--globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
-+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
- {
-       const Char* ptr = pattern;
-       int rv;
-+      if ((pglob->gl_flags & GLOB_LIMIT) &&
-+          limit->l_brace++ >= GLOB_LIMIT_BRACE) {
-+              errno = 0;
-+              return GLOB_NOSPACE;
-+      }
-+
-       /* Protect a single {}, for find(1), like csh */
-       if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
--              return glob0(pattern, pglob, limit);
-+              return glob0(pattern, pglob, limit, loc);
-       while ((ptr = g_strchr(ptr, LBRACE)) != NULL)
--              if (!globexp2(ptr, pattern, pglob, &rv, limit))
-+              if (!globexp2(ptr, pattern, pglob, &rv, limit, loc))
-                       return rv;
--      return glob0(pattern, pglob, limit);
-+      return glob0(pattern, pglob, limit, loc);
- }
-@@ -260,7 +306,7 @@ globexp1(const Char *pattern, glob_t *pg
-  * If it fails then it tries to glob the rest of the pattern and returns.
-  */
- static int
--globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
-+globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, struct glob_limit *limit, locale_t loc)
- {
-       int     i;
-       Char   *lm, *ls;
-@@ -297,7 +343,7 @@ globexp2(const Char *ptr, const Char *pa
-       /* Non matching braces; just glob the pattern */
-       if (i != 0 || *pe == EOS) {
--              *rv = glob0(patbuf, pglob, limit);
-+              *rv = glob0(patbuf, pglob, limit, loc);
-               return 0;
-       }
-@@ -344,7 +390,7 @@ globexp2(const Char *ptr, const Char *pa
- #ifdef DEBUG
-                               qprintf("globexp2:", patbuf);
- #endif
--                              *rv = globexp1(patbuf, pglob, limit);
-+                              *rv = globexp1(patbuf, pglob, limit, loc);
-                               /* move after the comma, to the next string */
-                               pl = pm + 1;
-@@ -360,10 +406,11 @@ globexp2(const Char *ptr, const Char *pa
-+#ifndef BUILDING_VARIANT
- /*
-  * expand tilde from the passwd file.
-  */
--static const Char *
-+__private_extern__ const Char *
- globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
- {
-       struct passwd *pwd;
-@@ -421,6 +468,7 @@ globtilde(const Char *pattern, Char *pat
-       return patbuf;
- }
-+#endif /* BUILDING_VARIANT */
- /*
-@@ -430,7 +478,7 @@ globtilde(const Char *pattern, Char *pat
-  * if things went well, nonzero if errors occurred.
-  */
- static int
--glob0(const Char *pattern, glob_t *pglob, size_t *limit)
-+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
- {
-       const Char *qpatnext;
-       int err;
-@@ -443,6 +491,10 @@ glob0(const Char *pattern, glob_t *pglob
-       /* We don't need to check for buffer overflow any more. */
-       while ((c = *qpatnext++) != EOS) {
-+              if (c & M_PROTECT) {
-+                      *bufnext++ = CHAR(c);
-+                      continue;
-+              } /* else */
-               switch (c) {
-               case LBRACKET:
-                       c = *qpatnext;
-@@ -493,7 +545,7 @@ glob0(const Char *pattern, glob_t *pglob
-       qprintf("glob0:", patbuf);
- #endif
--      if ((err = glob1(patbuf, pglob, limit)) != 0)
-+      if ((err = glob1(patbuf, pglob, limit, loc)) != 0)
-               return(err);
-       /*
-@@ -506,7 +558,7 @@ glob0(const Char *pattern, glob_t *pglob
-               if (((pglob->gl_flags & GLOB_NOCHECK) ||
-                   ((pglob->gl_flags & GLOB_NOMAGIC) &&
-                       !(pglob->gl_flags & GLOB_MAGCHAR))))
--                      return(globextend(pattern, pglob, limit));
-+                      return(globextend(pattern, pglob, limit, loc));
-               else
-                       return(GLOB_NOMATCH);
-       }
-@@ -516,14 +568,16 @@ glob0(const Char *pattern, glob_t *pglob
-       return(0);
- }
--static int
-+#ifndef BUILDING_VARIANT
-+__private_extern__ int
- compare(const void *p, const void *q)
- {
--      return(strcmp(*(char **)p, *(char **)q));
-+      return(strcoll(*(char **)p, *(char **)q));
- }
-+#endif /* BUILDING_VARIANT */
- static int
--glob1(Char *pattern, glob_t *pglob, size_t *limit)
-+glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
- {
-       Char pathbuf[MAXPATHLEN];
-@@ -531,7 +585,7 @@ glob1(Char *pattern, glob_t *pglob, size
-       if (*pattern == EOS)
-               return(0);
-       return(glob2(pathbuf, pathbuf, pathbuf + MAXPATHLEN - 1,
--          pattern, pglob, limit));
-+          pattern, pglob, limit, loc));
- }
- /*
-@@ -541,7 +595,7 @@ glob1(Char *pattern, glob_t *pglob, size
-  */
- static int
- glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
--      glob_t *pglob, size_t *limit)
-+      glob_t *pglob, struct glob_limit *limit, locale_t loc)
- {
-       struct stat sb;
-       Char *p, *q;
-@@ -554,13 +608,20 @@ glob2(Char *pathbuf, Char *pathend, Char
-       for (anymeta = 0;;) {
-               if (*pattern == EOS) {          /* End of pattern? */
-                       *pathend = EOS;
--                      if (g_lstat(pathbuf, &sb, pglob))
-+                      if (g_lstat(pathbuf, &sb, pglob, loc))
-                               return(0);
-+                      if ((pglob->gl_flags & GLOB_LIMIT) &&
-+                          limit->l_stat++ >= GLOB_LIMIT_STAT) {
-+                              errno = 0;
-+                              *pathend++ = SEP;
-+                              *pathend = EOS;
-+                              return GLOB_NOSPACE;
-+                      }
-                       if (((pglob->gl_flags & GLOB_MARK) &&
-                           pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
-                           || (S_ISLNK(sb.st_mode) &&
--                          (g_stat(pathbuf, &sb, pglob) == 0) &&
-+                          (g_stat(pathbuf, &sb, pglob, loc) == 0) &&
-                           S_ISDIR(sb.st_mode)))) {
-                               if (pathend + 1 > pathend_last)
-                                       return (GLOB_ABORTED);
-@@ -568,7 +629,7 @@ glob2(Char *pathbuf, Char *pathend, Char
-                               *pathend = EOS;
-                       }
-                       ++pglob->gl_matchc;
--                      return(globextend(pathbuf, pglob, limit));
-+                      return(globextend(pathbuf, pglob, limit, loc));
-               }
-               /* Find end of next segment, copy tentatively to pathend. */
-@@ -592,7 +653,7 @@ glob2(Char *pathbuf, Char *pathend, Char
-                       }
-               } else                  /* Need expansion, recurse. */
-                       return(glob3(pathbuf, pathend, pathend_last, pattern, p,
--                          pglob, limit));
-+                          pglob, limit, loc));
-       }
-       /* NOTREACHED */
- }
-@@ -600,7 +661,7 @@ glob2(Char *pathbuf, Char *pathend, Char
- static int
- glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
-       Char *pattern, Char *restpattern,
--      glob_t *pglob, size_t *limit)
-+      glob_t *pglob, struct glob_limit *limit, locale_t loc)
- {
-       struct dirent *dp;
-       DIR *dirp;
-@@ -620,15 +681,22 @@ glob3(Char *pathbuf, Char *pathend, Char
-       *pathend = EOS;
-       errno = 0;
--      if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
-+      if ((dirp = g_opendir(pathbuf, pglob, loc)) == NULL) {
-               /* TODO: don't call for ENOENT or ENOTDIR? */
-               if (pglob->gl_errfunc) {
--                      if (g_Ctoc(pathbuf, buf, sizeof(buf)))
-+                      if (g_Ctoc(pathbuf, buf, sizeof(buf), loc))
-                               return (GLOB_ABORTED);
--                      if (pglob->gl_errfunc(buf, errno) ||
--                          pglob->gl_flags & GLOB_ERR)
-+#ifdef __BLOCKS__
-+                      if (pglob->gl_flags & _GLOB_ERR_BLOCK) {
-+                              if (pglob->gl_errblk(buf, errno))
-+                                      return (GLOB_ABORTED);
-+                      } else
-+#endif /* __BLOCKS__ */
-+                      if (pglob->gl_errfunc(buf, errno))
-                               return (GLOB_ABORTED);
-               }
-+              if (pglob->gl_flags & GLOB_ERR)
-+                      return (GLOB_ABORTED);
-               return(0);
-       }
-@@ -646,6 +714,14 @@ glob3(Char *pathbuf, Char *pathend, Char
-               size_t clen;
-               mbstate_t mbs;
-+              if ((pglob->gl_flags & GLOB_LIMIT) &&
-+                  limit->l_readdir++ >= GLOB_LIMIT_READDIR) {
-+                      errno = 0;
-+                      *pathend++ = SEP;
-+                      *pathend = EOS;
-+                      return GLOB_NOSPACE;
-+              }
-+
-               /* Initial DOT must be matched literally. */
-               if (dp->d_name[0] == DOT && *pattern != DOT)
-                       continue;
-@@ -653,7 +729,7 @@ glob3(Char *pathbuf, Char *pathend, Char
-               dc = pathend;
-               sc = dp->d_name;
-               while (dc < pathend_last) {
--                      clen = mbrtowc(&wc, sc, MB_LEN_MAX, &mbs);
-+                      clen = mbrtowc_l(&wc, sc, MB_LEN_MAX, &mbs, loc);
-                       if (clen == (size_t)-1 || clen == (size_t)-2) {
-                               wc = *sc;
-                               clen = 1;
-@@ -663,12 +739,12 @@ glob3(Char *pathbuf, Char *pathend, Char
-                               break;
-                       sc += clen;
-               }
--              if (!match(pathend, pattern, restpattern)) {
-+              if (!match(pathend, pattern, restpattern, loc)) {
-                       *pathend = EOS;
-                       continue;
-               }
-               err = glob2(pathbuf, --dc, pathend_last, restpattern,
--                  pglob, limit);
-+                  pglob, limit, loc);
-               if (err)
-                       break;
-       }
-@@ -681,6 +757,7 @@ glob3(Char *pathbuf, Char *pathend, Char
- }
-+#ifndef BUILDING_VARIANT
- /*
-  * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
-  * add the new item, and update gl_pathc.
-@@ -695,20 +772,18 @@ glob3(Char *pathbuf, Char *pathend, Char
-  *    Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
-  *    gl_pathv points to (gl_offs + gl_pathc + 1) items.
-  */
--static int
--globextend(const Char *path, glob_t *pglob, size_t *limit)
-+__private_extern__ int
-+globextend(const Char *path, glob_t *pglob, struct glob_limit *limit, locale_t loc)
- {
-       char **pathv;
-       size_t i, newsize, len;
-       char *copy;
-       const Char *p;
--      if (*limit && pglob->gl_pathc > *limit) {
--              errno = 0;
--              return (GLOB_NOSPACE);
--      }
--
-       newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
-+      if ((pglob->gl_flags & GLOB_LIMIT) &&
-+          newsize > GLOB_LIMIT_PATH * sizeof(*pathv))
-+              goto nospace;
-       pathv = pglob->gl_pathv ?
-                   realloc((char *)pglob->gl_pathv, newsize) :
-                   malloc(newsize);
-@@ -730,24 +805,33 @@ globextend(const Char *path, glob_t *pgl
-       for (p = path; *p++;)
-               continue;
--      len = MB_CUR_MAX * (size_t)(p - path);  /* XXX overallocation */
-+      len = MB_CUR_MAX_L(loc) * (size_t)(p - path);   /* XXX overallocation */
-+      limit->l_string += len;
-       if ((copy = malloc(len)) != NULL) {
--              if (g_Ctoc(path, copy, len)) {
-+              if (g_Ctoc(path, copy, len, loc)) {
-                       free(copy);
-                       return (GLOB_NOSPACE);
-               }
-               pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
-       }
-       pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-+
-+      if ((pglob->gl_flags & GLOB_LIMIT) &&
-+          (newsize + limit->l_string) >= GLOB_LIMIT_STRING)
-+              goto nospace;
-+
-       return(copy == NULL ? GLOB_NOSPACE : 0);
-+nospace:
-+      errno = 0;
-+      return GLOB_NOSPACE;
- }
- /*
-  * pattern matching function for filenames.  Each occurrence of the *
-  * pattern causes a recursion level.
-  */
--static int
--match(Char *name, Char *pat, Char *patend)
-+__private_extern__ int
-+match(Char *name, Char *pat, Char *patend, locale_t loc)
- {
-       int ok, negate_range;
-       Char c, k;
-@@ -759,7 +843,7 @@ match(Char *name, Char *pat, Char *paten
-                       if (pat == patend)
-                               return(1);
-                       do
--                          if (match(name, pat, patend))
-+                          if (match(name, pat, patend, loc))
-                                   return(1);
-                       while (*name++ != EOS);
-                       return(0);
-@@ -775,10 +859,10 @@ match(Char *name, Char *pat, Char *paten
-                               ++pat;
-                       while (((c = *pat++) & M_MASK) != M_END)
-                               if ((*pat & M_MASK) == M_RNG) {
--                                      if (__collate_load_error ?
-+                                      if (loc->__collate_load_error ?
-                                           CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) :
--                                             __collate_range_cmp(CHAR(c), CHAR(k)) <= 0
--                                          && __collate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0
-+                                             __collate_range_cmp(CHAR(c), CHAR(k), loc) <= 0
-+                                          && __collate_range_cmp(CHAR(k), CHAR(pat[1]), loc) <= 0
-                                          )
-                                               ok = 1;
-                                       pat += 2;
-@@ -812,16 +896,17 @@ globfree(glob_t *pglob)
-               pglob->gl_pathv = NULL;
-       }
- }
-+#endif /* !BUILDING_VARIANT */
- static DIR *
--g_opendir(Char *str, glob_t *pglob)
-+g_opendir(Char *str, glob_t *pglob, locale_t loc)
- {
-       char buf[MAXPATHLEN];
-       if (!*str)
-               strcpy(buf, ".");
-       else {
--              if (g_Ctoc(str, buf, sizeof(buf)))
-+              if (g_Ctoc(str, buf, sizeof(buf), loc))
-                       return (NULL);
-       }
-@@ -832,11 +917,11 @@ g_opendir(Char *str, glob_t *pglob)
- }
- static int
--g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
-+g_lstat(Char *fn, struct stat *sb, glob_t *pglob, locale_t loc)
- {
-       char buf[MAXPATHLEN];
--      if (g_Ctoc(fn, buf, sizeof(buf))) {
-+      if (g_Ctoc(fn, buf, sizeof(buf), loc)) {
-               errno = ENAMETOOLONG;
-               return (-1);
-       }
-@@ -846,11 +931,11 @@ g_lstat(Char *fn, struct stat *sb, glob_
- }
- static int
--g_stat(Char *fn, struct stat *sb, glob_t *pglob)
-+g_stat(Char *fn, struct stat *sb, glob_t *pglob, locale_t loc)
- {
-       char buf[MAXPATHLEN];
--      if (g_Ctoc(fn, buf, sizeof(buf))) {
-+      if (g_Ctoc(fn, buf, sizeof(buf), loc)) {
-               errno = ENAMETOOLONG;
-               return (-1);
-       }
-@@ -859,7 +944,8 @@ g_stat(Char *fn, struct stat *sb, glob_t
-       return(stat(buf, sb));
- }
--static const Char *
-+#ifndef BUILDING_VARIANT
-+__private_extern__ const Char *
- g_strchr(const Char *str, wchar_t ch)
- {
-@@ -870,15 +956,16 @@ g_strchr(const Char *str, wchar_t ch)
-       return (NULL);
- }
--static int
--g_Ctoc(const Char *str, char *buf, size_t len)
-+__private_extern__ int
-+g_Ctoc(const Char *str, char *buf, size_t len, locale_t loc)
- {
-       mbstate_t mbs;
-       size_t clen;
-+      int mb_cur_max = MB_CUR_MAX_L(loc);
-       memset(&mbs, 0, sizeof(mbs));
--      while (len >= MB_CUR_MAX) {
--              clen = wcrtomb(buf, *str, &mbs);
-+      while (len >= mb_cur_max) {
-+              clen = wcrtomb_l(buf, *str, &mbs, loc);
-               if (clen == (size_t)-1)
-                       return (1);
-               if (*str == L'\0')
-@@ -908,3 +995,4 @@ qprintf(const char *str, Char *s)
-       (void)printf("\n");
- }
- #endif
-+#endif /* !BUILDING_VARIANT */
index e6153ac69876bf3dff0794bf47f6e1827811b7ee..54a0fa0fe0c56cc8f09f2a6a4aa8aa5198bd7dbc 100644 (file)
@@ -35,14 +35,22 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/isatty.c,v 1.6 2007/01/09 00:27:54 imp Exp
 
 #include <termios.h>
 #include <unistd.h>
+#include <sys/filio.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <errno.h>
 
 int
 isatty(fd)
        int fd;
 {
-       int retval;
+       int retval, type;
        struct termios t;
 
-       retval = (tcgetattr(fd, &t) != -1);
+       if(ioctl(fd, FIODTYPE, &type) != -1) {
+           if((retval = (type == D_TTY)) == 0)
+               errno = ENOTTY;
+       } else
+           retval = (tcgetattr(fd, &t) != -1);
        return(retval);
 }
diff --git a/gen/FreeBSD/isatty.c.patch b/gen/FreeBSD/isatty.c.patch
deleted file mode 100644 (file)
index aba10e1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---- isatty.c.orig      2009-11-07 14:51:38.000000000 -0800
-+++ isatty.c   2009-11-07 14:51:40.000000000 -0800
-@@ -35,14 +35,22 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/isa
- #include <termios.h>
- #include <unistd.h>
-+#include <sys/filio.h>
-+#include <sys/conf.h>
-+#include <sys/ioctl.h>
-+#include <errno.h>
- int
- isatty(fd)
-       int fd;
- {
--      int retval;
-+      int retval, type;
-       struct termios t;
--      retval = (tcgetattr(fd, &t) != -1);
-+      if(ioctl(fd, FIODTYPE, &type) != -1) {
-+          if((retval = (type == D_TTY)) == 0)
-+              errno = ENOTTY;
-+      } else
-+          retval = (tcgetattr(fd, &t) != -1);
-       return(retval);
- }
index f47bf2aa0a3faad6d5756583278f2f9fad2299f4..40d6a6f25207c9b524c7492862d0eaf704bfe4b7 100644 (file)
@@ -19,6 +19,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/jrand48.c,v 1.2 2002/03/22 21:52:05 obrien
 long
 jrand48(unsigned short xseed[3])
 {
-       _dorand48(xseed);
-       return ((long) xseed[2] << 16) + (long) xseed[1];
+       uint48 tmp;
+       DORAND48(tmp, xseed);
+       return (int)((tmp >> 16) & 0xffffffff);
 }
diff --git a/gen/FreeBSD/jrand48.c.patch b/gen/FreeBSD/jrand48.c.patch
deleted file mode 100644 (file)
index bb0ec7c..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- jrand48.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ jrand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -19,6 +19,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/jra
- long
- jrand48(unsigned short xseed[3])
- {
--      _dorand48(xseed);
--      return ((long) xseed[2] << 16) + (long) xseed[1];
-+      uint48 tmp;
-+      DORAND48(tmp, xseed);
-+      return (int)((tmp >> 16) & 0xffffffff);
- }
index 8b11e08c57c464aa88b7af9622bd4adc7ccd8f76..8a13d64438a44a34b9f74ebeac0fb2502cfd1173 100644 (file)
@@ -16,18 +16,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/lcong48.c,v 1.2 2002/03/22 21:52:05 obrien
 
 #include "rand48.h"
 
-extern unsigned short _rand48_seed[3];
-extern unsigned short _rand48_mult[3];
-extern unsigned short _rand48_add;
-
 void
 lcong48(unsigned short p[7])
 {
-       _rand48_seed[0] = p[0];
-       _rand48_seed[1] = p[1];
-       _rand48_seed[2] = p[2];
-       _rand48_mult[0] = p[3];
-       _rand48_mult[1] = p[4];
-       _rand48_mult[2] = p[5];
+       LOADRAND48(_rand48_seed, &p[0]);
+       LOADRAND48(_rand48_mult, &p[3]);
        _rand48_add = p[6];
 }
diff --git a/gen/FreeBSD/lcong48.c.patch b/gen/FreeBSD/lcong48.c.patch
deleted file mode 100644 (file)
index 91ad712..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
---- lcong48.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ lcong48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -16,18 +16,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/lco
- #include "rand48.h"
--extern unsigned short _rand48_seed[3];
--extern unsigned short _rand48_mult[3];
--extern unsigned short _rand48_add;
--
- void
- lcong48(unsigned short p[7])
- {
--      _rand48_seed[0] = p[0];
--      _rand48_seed[1] = p[1];
--      _rand48_seed[2] = p[2];
--      _rand48_mult[0] = p[3];
--      _rand48_mult[1] = p[4];
--      _rand48_mult[2] = p[5];
-+      LOADRAND48(_rand48_seed, &p[0]);
-+      LOADRAND48(_rand48_mult, &p[3]);
-       _rand48_add = p[6];
- }
index cad5fa7d70f1f5357358160ffa6e7c5f572ffd05..fc483078e2c788fe8230bc93d5fe9f41b7346edc 100644 (file)
@@ -40,7 +40,7 @@
 .Sh SYNOPSIS
 .In unistd.h
 .Ft int
-.Fn lockf "int filedes" "int function" "off_t size"
+.Fn lockf "int fildes" "int function" "off_t size"
 .Sh DESCRIPTION
 The
 .Fn lockf
@@ -49,10 +49,10 @@ Calls to
 .Fn lockf
 from other processes which attempt to lock the locked file section will
 either return an error value or block until the section becomes unlocked.
-All the locks for a process are removed when the process terminates.
+All of the locks for a process are removed when the process terminates.
 .Pp
 The argument
-.Fa filedes
+.Fa fildes
 is an open file descriptor.
 The file descriptor must have been opened either for write-only
 .Dv ( O_WRONLY )
@@ -207,7 +207,7 @@ or
 and the section is already locked by another process.
 .It Bq Er EBADF
 The argument
-.Fa filedes
+.Fa fildes
 is not a valid open file descriptor.
 .Pp
 The argument
@@ -217,7 +217,7 @@ is
 or
 .Dv F_TLOCK ,
 and
-.Fa filedes
+.Fa fildes
 is not a valid file descriptor open for writing.
 .It Bq Er EDEADLK
 The argument
@@ -236,25 +236,29 @@ was interrupted by the delivery of a signal.
 The argument
 .Fa function
 is not one of
-.Dv F_ULOCK ,
 .Dv F_LOCK ,
-.Dv F_TLOCK
+.Dv F_TEST ,
+.Dv F_TLOCK ,
 or
-.Dv F_TEST .
+.Dv F_ULOCK .
 .Pp
 The argument
-.Fa filedes
-refers to a file that does not support locking.
+.Fa fildes
+refers to a file that does not support advisory locking.
 .It Bq Er ENOLCK
 The argument
 .Fa function
 is
-.Dv F_ULOCK ,
-.Dv F_LOCK
-or
+.Dv F_LOCK ,
 .Dv F_TLOCK ,
+or
+.Dv F_ULOCK
 and satisfying the lock or unlock request would result in the number
 of locked regions in the system exceeding a system-imposed limit.
+.It Bq Er EOPNOTSUPP
+The argument
+.Fa fildes
+refers to a socket; these do not support advisory locking.
 .El
 .Sh SEE ALSO
 .Xr fcntl 2 ,
diff --git a/gen/FreeBSD/lockf.3.patch b/gen/FreeBSD/lockf.3.patch
deleted file mode 100644 (file)
index 51a735f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
---- lockf.3.orig       2009-11-07 14:51:38.000000000 -0800
-+++ lockf.3    2009-11-07 14:51:40.000000000 -0800
-@@ -40,7 +40,7 @@
- .Sh SYNOPSIS
- .In unistd.h
- .Ft int
--.Fn lockf "int filedes" "int function" "off_t size"
-+.Fn lockf "int fildes" "int function" "off_t size"
- .Sh DESCRIPTION
- The
- .Fn lockf
-@@ -49,10 +49,10 @@ Calls to
- .Fn lockf
- from other processes which attempt to lock the locked file section will
- either return an error value or block until the section becomes unlocked.
--All the locks for a process are removed when the process terminates.
-+All of the locks for a process are removed when the process terminates.
- .Pp
- The argument
--.Fa filedes
-+.Fa fildes
- is an open file descriptor.
- The file descriptor must have been opened either for write-only
- .Dv ( O_WRONLY )
-@@ -207,7 +207,7 @@ or
- and the section is already locked by another process.
- .It Bq Er EBADF
- The argument
--.Fa filedes
-+.Fa fildes
- is not a valid open file descriptor.
- .Pp
- The argument
-@@ -217,7 +217,7 @@ is
- or
- .Dv F_TLOCK ,
- and
--.Fa filedes
-+.Fa fildes
- is not a valid file descriptor open for writing.
- .It Bq Er EDEADLK
- The argument
-@@ -236,25 +236,29 @@ was interrupted by the delivery of a sig
- The argument
- .Fa function
- is not one of
--.Dv F_ULOCK ,
- .Dv F_LOCK ,
--.Dv F_TLOCK
-+.Dv F_TEST ,
-+.Dv F_TLOCK ,
- or
--.Dv F_TEST .
-+.Dv F_ULOCK .
- .Pp
- The argument
--.Fa filedes
--refers to a file that does not support locking.
-+.Fa fildes
-+refers to a file that does not support advisory locking.
- .It Bq Er ENOLCK
- The argument
- .Fa function
- is
--.Dv F_ULOCK ,
--.Dv F_LOCK
--or
-+.Dv F_LOCK ,
- .Dv F_TLOCK ,
-+or
-+.Dv F_ULOCK
- and satisfying the lock or unlock request would result in the number
- of locked regions in the system exceeding a system-imposed limit.
-+.It Bq Er EOPNOTSUPP
-+The argument
-+.Fa fildes
-+refers to a socket; these do not support advisory locking.
- .El
- .Sh SEE ALSO
- .Xr fcntl 2 ,
index 3581270e7c0aa0942fec4daa196f19bd702115c9..bc8de896ccd2cc108f25b0afa2f528cc65e40b1c 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/lockf.c,v 1.10 2009/03/04 01:01:26 delphij Exp $");
 
+#ifdef VARIANT_CANCELABLE
+int __fcntl(int, int, void *);
+#else /* !VARIANT_CANCELABLE */
+int __fcntl_nocancel(int, int, void *);
+#endif /* VARIANT_CANCELABLE */
+
+
 #include "namespace.h"
 #include <errno.h>
 #include <fcntl.h>
@@ -62,9 +69,14 @@ lockf(int filedes, int function, off_t size)
                break;
        case F_TEST:
                fl.l_type = F_WRLCK;
-               if (_fcntl(filedes, F_GETLK, &fl) == -1)
+#ifdef VARIANT_CANCELABLE
+               if (__fcntl(filedes, F_GETLK, &fl) == -1)
                        return (-1);
-               if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && fl.l_pid == getpid()))
+#else /* !VARIANT_CANCELABLE */
+               if (__fcntl_nocancel(filedes, F_GETLK, &fl) == -1)
+                       return (-1);
+#endif /* VARIANT_CANCELABLE */
+               if (fl.l_type == F_UNLCK || fl.l_pid == getpid())
                        return (0);
                errno = EAGAIN;
                return (-1);
@@ -75,5 +87,10 @@ lockf(int filedes, int function, off_t size)
                /* NOTREACHED */
        }
 
-       return (_fcntl(filedes, cmd, &fl));
+#ifdef VARIANT_CANCELABLE
+       return (__fcntl(filedes, cmd, &fl));
+#else /* !VARIANT_CANCELABLE */
+       return (__fcntl_nocancel(filedes, cmd, &fl));
+#endif /* VARIANT_CANCELABLE */
 }
+
diff --git a/gen/FreeBSD/lockf.c.patch b/gen/FreeBSD/lockf.c.patch
deleted file mode 100644 (file)
index ff083eb..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
---- lockf.c.orig       2009-11-07 15:52:44.000000000 -0800
-+++ lockf.c    2009-11-07 16:04:57.000000000 -0800
-@@ -31,6 +31,13 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/lockf.c,v 1.10 2009/03/04 01:01:26 delphij Exp $");
-+#ifdef VARIANT_CANCELABLE
-+int __fcntl(int, int, void *);
-+#else /* !VARIANT_CANCELABLE */
-+int __fcntl_nocancel(int, int, void *);
-+#endif /* VARIANT_CANCELABLE */
-+
-+
- #include "namespace.h"
- #include <errno.h>
- #include <fcntl.h>
-@@ -62,9 +69,14 @@ lockf(int filedes, int function, off_t s
-               break;
-       case F_TEST:
-               fl.l_type = F_WRLCK;
--              if (_fcntl(filedes, F_GETLK, &fl) == -1)
-+#ifdef VARIANT_CANCELABLE
-+              if (__fcntl(filedes, F_GETLK, &fl) == -1)
-                       return (-1);
--              if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 && fl.l_pid == getpid()))
-+#else /* !VARIANT_CANCELABLE */
-+              if (__fcntl_nocancel(filedes, F_GETLK, &fl) == -1)
-+                      return (-1);
-+#endif /* VARIANT_CANCELABLE */
-+              if (fl.l_type == F_UNLCK || fl.l_pid == getpid())
-                       return (0);
-               errno = EAGAIN;
-               return (-1);
-@@ -75,5 +87,10 @@ lockf(int filedes, int function, off_t s
-               /* NOTREACHED */
-       }
--      return (_fcntl(filedes, cmd, &fl));
-+#ifdef VARIANT_CANCELABLE
-+      return (__fcntl(filedes, cmd, &fl));
-+#else /* !VARIANT_CANCELABLE */
-+      return (__fcntl_nocancel(filedes, cmd, &fl));
-+#endif /* VARIANT_CANCELABLE */
- }
-+
index 948b923a529d80a83c195290484eb92f2d133e7b..3b01e850a4445591d7da9fa7a890cd158fbc95c0 100644 (file)
@@ -16,11 +16,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/lrand48.c,v 1.2 2002/03/22 21:52:05 obrien
 
 #include "rand48.h"
 
-extern unsigned short _rand48_seed[3];
-
 long
 lrand48(void)
 {
-       _dorand48(_rand48_seed);
-       return ((long) _rand48_seed[2] << 15) + ((long) _rand48_seed[1] >> 1);
+       _DORAND48(_rand48_seed);
+       return (_rand48_seed >> 17) & 0x7fffffff;
 }
diff --git a/gen/FreeBSD/lrand48.c.patch b/gen/FreeBSD/lrand48.c.patch
deleted file mode 100644 (file)
index 90798d9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---- lrand48.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ lrand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -16,11 +16,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/lra
- #include "rand48.h"
--extern unsigned short _rand48_seed[3];
--
- long
- lrand48(void)
- {
--      _dorand48(_rand48_seed);
--      return ((long) _rand48_seed[2] << 15) + ((long) _rand48_seed[1] >> 1);
-+      _DORAND48(_rand48_seed);
-+      return (_rand48_seed >> 17) & 0x7fffffff;
- }
index 36e3ce811b2e6bfb0f2562db62e6fee4b6badc90..d60038bf4a9431df8045ca248ae290024a15bb45 100644 (file)
@@ -48,7 +48,7 @@
 .Ft void
 .Fo makecontext
 .Fa "ucontext_t *ucp"
-.Fa "void \*[lp]*func\*[rp]\*[lp]void\*[rp]"
+.Fa "void \*[lp]*func\*[rp]\*[lp]\*[rp]"
 .Fa "int argc" ...
 .Fc
 .Ft int
@@ -64,7 +64,9 @@ which must have previously been initialized by a call to
 and had a stack allocated for it.
 The context is modified so that it will continue execution by invoking
 .Fn func
-with the arguments provided.
+with the arguments (of type
+.Ft int )
+provided.
 The
 .Fa argc
 argument
diff --git a/gen/FreeBSD/makecontext.3.patch b/gen/FreeBSD/makecontext.3.patch
deleted file mode 100644 (file)
index 40520a8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- makecontext.3.orig 2009-11-07 14:51:38.000000000 -0800
-+++ makecontext.3      2009-11-07 14:51:39.000000000 -0800
-@@ -48,7 +48,7 @@
- .Ft void
- .Fo makecontext
- .Fa "ucontext_t *ucp"
--.Fa "void \*[lp]*func\*[rp]\*[lp]void\*[rp]"
-+.Fa "void \*[lp]*func\*[rp]\*[lp]\*[rp]"
- .Fa "int argc" ...
- .Fc
- .Ft int
-@@ -64,7 +64,9 @@ which must have previously been initiali
- and had a stack allocated for it.
- The context is modified so that it will continue execution by invoking
- .Fn func
--with the arguments provided.
-+with the arguments (of type
-+.Ft int )
-+provided.
- The
- .Fa argc
- argument
index f65ed779088abf44298b96a675e30b8b52bfbbd0..5453ceb84d5b187a606019253ab5fc4064abe2e2 100644 (file)
@@ -16,11 +16,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/mrand48.c,v 1.2 2002/03/22 21:52:05 obrien
 
 #include "rand48.h"
 
-extern unsigned short _rand48_seed[3];
-
 long
 mrand48(void)
 {
-       _dorand48(_rand48_seed);
-       return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1];
+       _DORAND48(_rand48_seed);
+       return (int)((_rand48_seed >> 16) & 0xffffffff);
 }
diff --git a/gen/FreeBSD/mrand48.c.patch b/gen/FreeBSD/mrand48.c.patch
deleted file mode 100644 (file)
index 23149dd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---- mrand48.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ mrand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -16,11 +16,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/mra
- #include "rand48.h"
--extern unsigned short _rand48_seed[3];
--
- long
- mrand48(void)
- {
--      _dorand48(_rand48_seed);
--      return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1];
-+      _DORAND48(_rand48_seed);
-+      return (int)((_rand48_seed >> 16) & 0xffffffff);
- }
index f24d12d117e6a572ba8e8efc8584573389192843..962eee10bc7f4baaa32d5c2c678e7d102980c75b 100644 (file)
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nice.c,v 1.4 2007/01/09 00:27:54 imp Exp $"
 #include <sys/resource.h>
 #include <errno.h>
 #include <unistd.h>
-
+#if __DARWIN_UNIX03
+#include <limits.h>
+#endif /* __DARWIN_UNIX03 */
 /*
  * Backwards compatible nice.
  */
@@ -46,11 +48,18 @@ int
 nice(incr)
        int incr;
 {
-       int prio;
+       int prio, rv;
 
        errno = 0;
        prio = getpriority(PRIO_PROCESS, 0);
        if (prio == -1 && errno)
                return (-1);
-       return (setpriority(PRIO_PROCESS, 0, prio + incr));
+#if __DARWIN_UNIX03
+       if (prio + incr > NZERO-1)
+               incr = NZERO-1-prio;
+#endif /* __DARWIN_UNIX03 */
+       rv = setpriority(PRIO_PROCESS, 0, prio + incr);
+       if (rv == -1 && errno == EACCES)
+               errno = EPERM;
+       return (rv == -1) ? rv : getpriority(PRIO_PROCESS, 0);
 }
diff --git a/gen/FreeBSD/nice.c.patch b/gen/FreeBSD/nice.c.patch
deleted file mode 100644 (file)
index f1a3fec..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- nice.c.orig        2009-11-07 14:51:38.000000000 -0800
-+++ nice.c     2009-11-07 14:51:40.000000000 -0800
-@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nic
- #include <sys/resource.h>
- #include <errno.h>
- #include <unistd.h>
--
-+#if __DARWIN_UNIX03
-+#include <limits.h>
-+#endif /* __DARWIN_UNIX03 */
- /*
-  * Backwards compatible nice.
-  */
-@@ -46,11 +48,18 @@ int
- nice(incr)
-       int incr;
- {
--      int prio;
-+      int prio, rv;
-       errno = 0;
-       prio = getpriority(PRIO_PROCESS, 0);
-       if (prio == -1 && errno)
-               return (-1);
--      return (setpriority(PRIO_PROCESS, 0, prio + incr));
-+#if __DARWIN_UNIX03
-+      if (prio + incr > NZERO-1)
-+              incr = NZERO-1-prio;
-+#endif /* __DARWIN_UNIX03 */
-+      rv = setpriority(PRIO_PROCESS, 0, prio + incr);
-+      if (rv == -1 && errno == EACCES)
-+              errno = EPERM;
-+      return (rv == -1) ? rv : getpriority(PRIO_PROCESS, 0);
- }
index 3a21c3f2a546f15b9becf59af71082222f92710e..1790b230f660b850105baf1c0d5f023b81702e9d 100644 (file)
@@ -19,6 +19,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nrand48.c,v 1.2 2002/03/22 21:52:05 obrien
 long
 nrand48(unsigned short xseed[3])
 {
-       _dorand48(xseed);
-       return ((long) xseed[2] << 15) + ((long) xseed[1] >> 1);
+       uint48 tmp;
+       DORAND48(tmp, xseed);
+       return (tmp >> 17) & 0x7fffffff;
 }
diff --git a/gen/FreeBSD/nrand48.c.patch b/gen/FreeBSD/nrand48.c.patch
deleted file mode 100644 (file)
index 101d6ef..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- nrand48.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ nrand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -19,6 +19,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nra
- long
- nrand48(unsigned short xseed[3])
- {
--      _dorand48(xseed);
--      return ((long) xseed[2] << 15) + ((long) xseed[1] >> 1);
-+      uint48 tmp;
-+      DORAND48(tmp, xseed);
-+      return (tmp >> 17) & 0x7fffffff;
- }
index 1892c36936d1f1c3881285416723d332ff6a6fff..b2c49dfcbb8c9b36b98387b434ffed72d3c670e9 100644 (file)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.24 2008/04/16 18:40:52 delphi
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <pthread.h>
 #include "un-namespace.h"
 
 #include "telldir.h"
@@ -65,29 +66,16 @@ __opendir2(const char *name, int flags)
        int incr;
        int saved_errno;
        int unionstack;
-       struct stat statb;
 
        /*
-        * stat() before _open() because opening of special files may be
-        * harmful.  _fstat() after open because the file may have changed.
+        * Use O_DIRECTORY to only open directories (because opening of
+        * special files may be harmful).  errno is set to ENOTDIR if
+        * not a directory.
         */
-       if (stat(name, &statb) != 0)
+       if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1)
                return (NULL);
-       if (!S_ISDIR(statb.st_mode)) {
-               errno = ENOTDIR;
-               return (NULL);
-       }
-       if ((fd = _open(name, O_RDONLY | O_NONBLOCK)) == -1)
-               return (NULL);
-       dirp = NULL;
-       if (_fstat(fd, &statb) != 0)
-               goto fail;
-       if (!S_ISDIR(statb.st_mode)) {
-               errno = ENOTDIR;
-               goto fail;
-       }
-       if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
-           (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
+       dirp = malloc(sizeof(DIR) + sizeof(struct _telldir));
+       if (dirp == NULL)
                goto fail;
 
        dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR));
@@ -111,8 +99,7 @@ __opendir2(const char *name, int flags)
 
                if (_fstatfs(fd, &sfb) < 0)
                        goto fail;
-               unionstack = !strcmp(sfb.f_fstypename, "unionfs")
-                   || (sfb.f_flags & MNT_UNION);
+               unionstack = (sfb.f_flags & MNT_UNION);
        } else {
                unionstack = 0;
        }
@@ -147,7 +134,11 @@ __opendir2(const char *name, int flags)
                                ddptr = buf + (len - space);
                        }
 
+#if __DARWIN_64_BIT_INO_T
+                       n = __getdirentries64(fd, ddptr, space, &dirp->dd_td->seekoff);
+#else /* !__DARWIN_64_BIT_INO_T */
                        n = _getdirentries(fd, ddptr, space, &dirp->dd_seek);
+#endif /* __DARWIN_64_BIT_INO_T */
                        if (n > 0) {
                                ddptr += n;
                                space -= n;
@@ -255,14 +246,18 @@ __opendir2(const char *name, int flags)
                dirp->dd_buf = malloc(dirp->dd_len);
                if (dirp->dd_buf == NULL)
                        goto fail;
+#if __DARWIN_64_BIT_INO_T
+               dirp->dd_td->seekoff = 0;
+#else /* !__DARWIN_64_BIT_INO_T */
                dirp->dd_seek = 0;
+#endif /* __DARWIN_64_BIT_INO_T */
                flags &= ~DTF_REWIND;
        }
 
        dirp->dd_loc = 0;
        dirp->dd_fd = fd;
        dirp->dd_flags = flags;
-       dirp->dd_lock = NULL;
+       dirp->dd_lock = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
 
        /*
         * Set up seek point for rewinddir.
diff --git a/gen/FreeBSD/opendir.c.patch b/gen/FreeBSD/opendir.c.patch
deleted file mode 100644 (file)
index 5453b80..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
---- opendir.c.orig     2009-11-08 17:01:43.000000000 -0800
-+++ opendir.c  2009-11-08 17:01:51.000000000 -0800
-@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/ope
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
-+#include <pthread.h>
- #include "un-namespace.h"
- #include "telldir.h"
-@@ -65,27 +66,15 @@ __opendir2(const char *name, int flags)
-       int incr;
-       int saved_errno;
-       int unionstack;
--      struct stat statb;
-       /*
--       * stat() before _open() because opening of special files may be
--       * harmful.  _fstat() after open because the file may have changed.
-+       * Use O_DIRECTORY to only open directories (because opening of
-+       * special files may be harmful).  errno is set to ENOTDIR if
-+       * not a directory.
-        */
--      if (stat(name, &statb) != 0)
--              return (NULL);
--      if (!S_ISDIR(statb.st_mode)) {
--              errno = ENOTDIR;
--              return (NULL);
--      }
--      if ((fd = _open(name, O_RDONLY | O_NONBLOCK)) == -1)
-+      if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY)) == -1)
-               return (NULL);
-       dirp = NULL;
--      if (_fstat(fd, &statb) != 0)
--              goto fail;
--      if (!S_ISDIR(statb.st_mode)) {
--              errno = ENOTDIR;
--              goto fail;
--      }
-       if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
-           (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
-               goto fail;
-@@ -147,7 +136,11 @@ __opendir2(const char *name, int flags)
-                               ddptr = buf + (len - space);
-                       }
-+#if __DARWIN_64_BIT_INO_T
-+                      n = __getdirentries64(fd, ddptr, space, &dirp->dd_td->seekoff);
-+#else /* !__DARWIN_64_BIT_INO_T */
-                       n = _getdirentries(fd, ddptr, space, &dirp->dd_seek);
-+#endif /* __DARWIN_64_BIT_INO_T */
-                       if (n > 0) {
-                               ddptr += n;
-                               space -= n;
-@@ -255,14 +248,18 @@ __opendir2(const char *name, int flags)
-               dirp->dd_buf = malloc(dirp->dd_len);
-               if (dirp->dd_buf == NULL)
-                       goto fail;
-+#if __DARWIN_64_BIT_INO_T
-+              dirp->dd_td->seekoff = 0;
-+#else /* !__DARWIN_64_BIT_INO_T */
-               dirp->dd_seek = 0;
-+#endif /* __DARWIN_64_BIT_INO_T */
-               flags &= ~DTF_REWIND;
-       }
-       dirp->dd_loc = 0;
-       dirp->dd_fd = fd;
-       dirp->dd_flags = flags;
--      dirp->dd_lock = NULL;
-+      dirp->dd_lock = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
-       /*
-        * Set up seek point for rewinddir.
index 6f78fe9fb9f696029363927e6f8f79ffe4151885..99576fdc45504727ad994ac9e1d5c33d5e7099d5 100644 (file)
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)pause.c    8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
+
+/* For the cancelable variant, we call the cancelable sigsuspend */
+#ifdef VARIANT_CANCELABLE
+#undef __DARWIN_NON_CANCELABLE
+#define __DARWIN_NON_CANCELABLE 0
+#endif /* VARIANT_CANCELABLE */
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.8 2009/12/05 19:31:38 ed Exp $");
 
@@ -42,7 +49,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.8 2009/12/05 19:31:38 ed Exp $"
 int
 __pause(void)
 {
-       return sigpause(sigblock(0L));
+       sigset_t set;
+
+       sigprocmask(0, NULL, &set);
+       return sigsuspend(&set);
 }
 __weak_reference(__pause, pause);
 __weak_reference(__pause, _pause);
diff --git a/gen/FreeBSD/pause.c.patch b/gen/FreeBSD/pause.c.patch
deleted file mode 100644 (file)
index 5b78b5e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- pause.c.orig       2009-11-07 14:51:38.000000000 -0800
-+++ pause.c    2009-11-07 14:51:40.000000000 -0800
-@@ -30,6 +30,13 @@
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)pause.c   8.1 (Berkeley) 6/4/93";
- #endif /* LIBC_SCCS and not lint */
-+
-+/* For the cancelable variant, we call the cancelable sigsuspend */
-+#ifdef VARIANT_CANCELABLE
-+#undef __DARWIN_NON_CANCELABLE
-+#define __DARWIN_NON_CANCELABLE 0
-+#endif /* VARIANT_CANCELABLE */
-+
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.7 2007/01/09 00:27:54 imp Exp $");
-@@ -42,7 +49,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/pau
- int
- __pause()
- {
--      return sigpause(sigblock(0L));
-+      sigset_t set;
-+
-+      sigprocmask(0, NULL, &set);
-+      return sigsuspend(&set);
- }
- __weak_reference(__pause, pause);
- __weak_reference(__pause, _pause);
index 12974b78bd31ce261f82b9a7fa5a6b0315ee9d3b..5f4a8c68d5c79fec4033709852b725cabb5b9ef3 100644 (file)
@@ -36,8 +36,8 @@
 .Dt POPEN 3
 .Os
 .Sh NAME
-.Nm popen ,
-.Nm pclose
+.Nm pclose ,
+.Nm popen
 .Nd process
 .Tn I/O
 .Sh LIBRARY
 .Sh SYNOPSIS
 .In stdio.h
 .Ft FILE *
-.Fn popen "const char *command" "const char *type"
+.Fo popen
+.Fa "const char *command"
+.Fa "const char *mode"
+.Fc
 .Ft int
-.Fn pclose "FILE *stream"
+.Fo pclose
+.Fa "FILE *stream"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn popen
 function
 .Dq opens
-a process by creating a bidirectional pipe
-forking,
+a process by creating a bidirectional pipe, forking,
 and invoking the shell.
 Any streams opened by previous
 .Fn popen
@@ -62,18 +66,18 @@ calls in the parent process are closed in the new child process.
 Historically,
 .Fn popen
 was implemented with a unidirectional pipe;
-hence many implementations of
+hence, many implementations of
 .Fn popen
 only allow the
-.Fa type
+.Fa mode
 argument to specify reading or writing, not both.
-Since
+Because
 .Fn popen
 is now implemented using a bidirectional pipe, the
-.Fa type
+.Fa mode
 argument may request a bidirectional data flow.
 The
-.Fa type
+.Fa mode
 argument is a pointer to a null-terminated string
 which must be
 .Ql r
@@ -88,7 +92,7 @@ The
 argument is a pointer to a null-terminated string
 containing a shell command line.
 This command is passed to
-.Pa /bin/sh
+.Pa /bin/sh ,
 using the
 .Fl c
 flag; interpretation, if any, is performed by the shell.
@@ -97,7 +101,7 @@ The return value from
 .Fn popen
 is a normal standard
 .Tn I/O
-stream in all respects
+stream in all respects,
 save that it must be closed with
 .Fn pclose
 rather than
@@ -115,12 +119,12 @@ the command's standard input is the same as that of the process that called
 .Pp
 Note that output
 .Fn popen
-streams are fully buffered by default.
+streams are fully buffered, by default.
 .Pp
 The
 .Fn pclose
-function waits for the associated process to terminate
-and returns the exit status of the command
+function waits for the associated process to terminate;
+it returns the exit status of the command,
 as returned by
 .Xr wait4 2 .
 .Sh RETURN VALUES
diff --git a/gen/FreeBSD/popen.3.patch b/gen/FreeBSD/popen.3.patch
deleted file mode 100644 (file)
index c495449..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
---- _SB/Libc/gen/FreeBSD/popen.3       2004-11-25 11:38:01.000000000 -0800
-+++ _SB/Libc/gen/FreeBSD/popen.3.edit  2006-06-28 16:55:51.000000000 -0700
-@@ -36,8 +36,8 @@
- .Dt POPEN 3
- .Os
- .Sh NAME
--.Nm popen ,
--.Nm pclose
-+.Nm pclose ,
-+.Nm popen
- .Nd process
- .Tn I/O
- .Sh LIBRARY
-@@ -45,16 +45,20 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft FILE *
--.Fn popen "const char *command" "const char *type"
-+.Fo popen
-+.Fa "const char *command"
-+.Fa "const char *mode"
-+.Fc
- .Ft int
--.Fn pclose "FILE *stream"
-+.Fo pclose
-+.Fa "FILE *stream"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn popen
- function
- .Dq opens
--a process by creating a bidirectional pipe
--forking,
-+a process by creating a bidirectional pipe, forking,
- and invoking the shell.
- Any streams opened by previous
- .Fn popen
-@@ -62,18 +66,18 @@
- Historically,
- .Fn popen
- was implemented with a unidirectional pipe;
--hence many implementations of
-+hence, many implementations of
- .Fn popen
- only allow the
--.Fa type
-+.Fa mode
- argument to specify reading or writing, not both.
--Since
-+Because
- .Fn popen
- is now implemented using a bidirectional pipe, the
--.Fa type
-+.Fa mode
- argument may request a bidirectional data flow.
- The
--.Fa type
-+.Fa mode
- argument is a pointer to a null-terminated string
- which must be
- .Ql r
-@@ -88,7 +92,7 @@
- argument is a pointer to a null-terminated string
- containing a shell command line.
- This command is passed to
--.Pa /bin/sh
-+.Pa /bin/sh ,
- using the
- .Fl c
- flag; interpretation, if any, is performed by the shell.
-@@ -97,7 +101,7 @@
- .Fn popen
- is a normal standard
- .Tn I/O
--stream in all respects
-+stream in all respects,
- save that it must be closed with
- .Fn pclose
- rather than
-@@ -115,12 +119,12 @@
- .Pp
- Note that output
- .Fn popen
--streams are fully buffered by default.
-+streams are fully buffered, by default.
- .Pp
- The
- .Fn pclose
--function waits for the associated process to terminate
--and returns the exit status of the command
-+function waits for the associated process to terminate;
-+it returns the exit status of the command,
- as returned by
- .Xr wait4 2 .
- .Sh RETURN VALUES
index 3432686a76f3f4ffa835f5b88820e52f46d6f991..d4aea86409645ab5dd415de1a0a1eb8e954b80d5 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef VARIANT_DARWINEXTSN
+#define _DARWIN_UNLIMITED_STREAMS
+#endif /* VARIANT_DARWINEXTSN */
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)popen.c    8.3 (Berkeley) 5/3/95";
 #endif /* LIBC_SCCS and not lint */
@@ -40,7 +44,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.21 2009/05/27 19:28:04 ed Exp $
 #include <sys/param.h>
 #include <sys/queue.h>
 #include <sys/wait.h>
-
+#include <sys/socket.h>
+#include <wchar.h>             /* fwide() */
 #include <signal.h>
 #include <errno.h>
 #include <unistd.h>
@@ -49,18 +54,39 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.21 2009/05/27 19:28:04 ed Exp $
 #include <string.h>
 #include <paths.h>
 #include <pthread.h>
+#include <spawn.h>
 #include "un-namespace.h"
 #include "libc_private.h"
 
-extern char **environ;
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+
+/* Our queue.h doesn't have SLIST_REMOVE_AFTER in it yet
+ * <rdar://problem/7431558> API: Add SLIST_REMOVE_AFTER to sys/queue.h (from FreeBSD)
+ */
+#ifndef SLIST_REMOVE_AFTER
+#define SLIST_REMOVE_AFTER(elm, field) do {                             \
+        SLIST_NEXT(elm, field) =                                        \
+            SLIST_NEXT(SLIST_NEXT(elm, field), field);                  \
+} while (0)
+#endif
 
+/* 3516149 - store file descriptor and use that to close to prevent blocking */
 struct pid {
        SLIST_ENTRY(pid) next;
        FILE *fp;
+       int fd;
        pid_t pid;
 };
-static SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist);
-static pthread_mutex_t pidlist_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define pidlist                __popen_pidlist
+#define pidlist_mutex  __popen_pidlist_mutex
+#ifndef BUILDING_VARIANT
+__private_extern__ SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist);
+__private_extern__ pthread_mutex_t pidlist_mutex = PTHREAD_MUTEX_INITIALIZER;
+#else /* BUILDING_VARIANT */
+extern SLIST_HEAD(, pid) pidlist;
+extern pthread_mutex_t pidlist_mutex;
+#endif /* !BUILDING_VARIANT */
 
 #define        THREAD_LOCK()   if (__isthreaded) _pthread_mutex_lock(&pidlist_mutex)
 #define        THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&pidlist_mutex)
@@ -71,84 +97,108 @@ popen(command, type)
 {
        struct pid *cur;
        FILE *iop;
-       int pdes[2], pid, twoway;
+       int pdes[2], pid, twoway, other;
        char *argv[4];
        struct pid *p;
+       posix_spawn_file_actions_t file_actions;
+       int err;
 
-       /*
-        * Lite2 introduced two-way popen() pipes using _socketpair().
-        * FreeBSD's pipe() is bidirectional, so we use that.
-        */
-       if (strchr(type, '+')) {
+       if (type == NULL) {
+               errno = EINVAL;
+               return (NULL);
+       }
+       if (strcmp(type, "r+") == 0) {
                twoway = 1;
                type = "r+";
+               if (socketpair(AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
+                       return (NULL);
        } else  {
                twoway = 0;
-               if ((*type != 'r' && *type != 'w') || type[1])
+               if ((*type != 'r' && *type != 'w') || type[1]) {
+                       errno = EINVAL;
+                       return (NULL);
+               }
+               if (pipe(pdes) < 0)
                        return (NULL);
        }
-       if (pipe(pdes) < 0)
-               return (NULL);
 
-       if ((cur = malloc(sizeof(struct pid))) == NULL) {
+       /* fdopen can now fail */
+       if (*type == 'r') {
+               iop = fdopen(pdes[0], type);
+               other = pdes[1];
+       } else {
+               iop = fdopen(pdes[1], type);
+               other = pdes[0];
+       }
+       if (iop == NULL) {
                (void)_close(pdes[0]);
                (void)_close(pdes[1]);
                return (NULL);
        }
 
+       if ((cur = malloc(sizeof(struct pid))) == NULL) {
+               (void)fclose(iop);
+               (void)_close(other);
+               return (NULL);
+       }
+
+       if ((err = posix_spawn_file_actions_init(&file_actions)) != 0) {
+               (void)fclose(iop);
+               (void)_close(other);
+               free(cur);
+               errno = err;
+               return (NULL);
+       }
+       if (*type == 'r') {
+               /*
+                * The dup2() to STDIN_FILENO is repeated to avoid
+                * writing to pdes[1], which might corrupt the
+                * parent's copy.  This isn't good enough in
+                * general, since the _exit() is no return, so
+                * the compiler is free to corrupt all the local
+                * variables.
+                */
+               (void)posix_spawn_file_actions_addclose(&file_actions, pdes[0]);
+               if (pdes[1] != STDOUT_FILENO) {
+                       (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDOUT_FILENO);
+                       (void)posix_spawn_file_actions_addclose(&file_actions, pdes[1]);
+                       if (twoway)
+                               (void)posix_spawn_file_actions_adddup2(&file_actions, STDOUT_FILENO, STDIN_FILENO);
+               } else if (twoway && (pdes[1] != STDIN_FILENO))
+                       (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDIN_FILENO);
+       } else {
+               if (pdes[0] != STDIN_FILENO) {
+                       (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[0], STDIN_FILENO);
+                       (void)posix_spawn_file_actions_addclose(&file_actions, pdes[0]);
+               }
+               (void)posix_spawn_file_actions_addclose(&file_actions, pdes[1]);
+       }
+       SLIST_FOREACH(p, &pidlist, next)
+               (void)posix_spawn_file_actions_addclose(&file_actions, p->fd);
+
        argv[0] = "sh";
        argv[1] = "-c";
        argv[2] = (char *)command;
        argv[3] = NULL;
 
-       THREAD_LOCK();
-       switch (pid = vfork()) {
-       case -1:                        /* Error. */
-               THREAD_UNLOCK();
-               (void)_close(pdes[0]);
-               (void)_close(pdes[1]);
+       err = posix_spawn(&pid, _PATH_BSHELL, &file_actions, NULL, argv, environ);
+       posix_spawn_file_actions_destroy(&file_actions);
+
+       if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */
+               (void)fclose(iop);
+               (void)_close(other);
                free(cur);
+               errno = err;
                return (NULL);
-               /* NOTREACHED */
-       case 0:                         /* Child. */
-               if (*type == 'r') {
-                       /*
-                        * The _dup2() to STDIN_FILENO is repeated to avoid
-                        * writing to pdes[1], which might corrupt the
-                        * parent's copy.  This isn't good enough in
-                        * general, since the _exit() is no return, so
-                        * the compiler is free to corrupt all the local
-                        * variables.
-                        */
-                       (void)_close(pdes[0]);
-                       if (pdes[1] != STDOUT_FILENO) {
-                               (void)_dup2(pdes[1], STDOUT_FILENO);
-                               (void)_close(pdes[1]);
-                               if (twoway)
-                                       (void)_dup2(STDOUT_FILENO, STDIN_FILENO);
-                       } else if (twoway && (pdes[1] != STDIN_FILENO))
-                               (void)_dup2(pdes[1], STDIN_FILENO);
-               } else {
-                       if (pdes[0] != STDIN_FILENO) {
-                               (void)_dup2(pdes[0], STDIN_FILENO);
-                               (void)_close(pdes[0]);
-                       }
-                       (void)_close(pdes[1]);
-               }
-               SLIST_FOREACH(p, &pidlist, next)
-                       (void)_close(fileno(p->fp));
-               _execve(_PATH_BSHELL, argv, environ);
-               _exit(127);
-               /* NOTREACHED */
+       } else if (err != 0) { /* couldn't exec the shell */
+               pid = -1;
        }
-       THREAD_UNLOCK();
 
-       /* Parent; assume fdopen can't fail. */
        if (*type == 'r') {
-               iop = fdopen(pdes[0], type);
+               cur->fd = pdes[0];
                (void)_close(pdes[1]);
        } else {
-               iop = fdopen(pdes[1], type);
+               cur->fd = pdes[1];
                (void)_close(pdes[0]);
        }
 
@@ -158,10 +208,11 @@ popen(command, type)
        THREAD_LOCK();
        SLIST_INSERT_HEAD(&pidlist, cur, next);
        THREAD_UNLOCK();
-
+       fwide(iop, -1);         /* byte stream */
        return (iop);
 }
 
+#ifndef BUILDING_VARIANT
 /*
  * pclose --
  *     Pclose returns -1 if stream is not associated with a `popened' command,
@@ -196,6 +247,10 @@ pclose(iop)
 
        (void)fclose(iop);
 
+       if (cur->pid < 0) {
+               free(cur);
+               return W_EXITCODE(127, 0);
+       }
        do {
                pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
        } while (pid == -1 && errno == EINTR);
@@ -204,3 +259,4 @@ pclose(iop)
 
        return (pid == -1 ? -1 : pstat);
 }
+#endif /* !BUILDING_VARIANT */
diff --git a/gen/FreeBSD/popen.c.patch b/gen/FreeBSD/popen.c.patch
deleted file mode 100644 (file)
index e58f314..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
---- popen.c.orig       2009-12-02 15:21:37.000000000 -0800
-+++ popen.c    2009-12-02 15:36:51.000000000 -0800
-@@ -30,6 +30,10 @@
-  * SUCH DAMAGE.
-  */
-+#ifdef VARIANT_DARWINEXTSN
-+#define _DARWIN_UNLIMITED_STREAMS
-+#endif /* VARIANT_DARWINEXTSN */
-+
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)popen.c   8.3 (Berkeley) 5/3/95";
- #endif /* LIBC_SCCS and not lint */
-@@ -40,7 +44,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/pop
- #include <sys/param.h>
- #include <sys/queue.h>
- #include <sys/wait.h>
--
-+#include <sys/socket.h>
-+#include <wchar.h>            /* fwide() */
- #include <signal.h>
- #include <errno.h>
- #include <unistd.h>
-@@ -49,18 +54,39 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/pop
- #include <string.h>
- #include <paths.h>
- #include <pthread.h>
-+#include <spawn.h>
- #include "un-namespace.h"
- #include "libc_private.h"
--extern char **environ;
-+#include <crt_externs.h>
-+#define environ (*_NSGetEnviron())
-+
-+/* Our queue.h doesn't have SLIST_REMOVE_AFTER in it yet
-+ * <rdar://problem/7431558> API: Add SLIST_REMOVE_AFTER to sys/queue.h (from FreeBSD)
-+ */
-+#ifndef SLIST_REMOVE_AFTER
-+#define SLIST_REMOVE_AFTER(elm, field) do {                             \
-+        SLIST_NEXT(elm, field) =                                        \
-+            SLIST_NEXT(SLIST_NEXT(elm, field), field);                  \
-+} while (0)
-+#endif
-+/* 3516149 - store file descriptor and use that to close to prevent blocking */
- struct pid {
-       SLIST_ENTRY(pid) next;
-       FILE *fp;
-+      int fd;
-       pid_t pid;
- };
--static SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist);
--static pthread_mutex_t pidlist_mutex = PTHREAD_MUTEX_INITIALIZER;
-+#define pidlist               __popen_pidlist
-+#define pidlist_mutex __popen_pidlist_mutex
-+#ifndef BUILDING_VARIANT
-+__private_extern__ SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist);
-+__private_extern__ pthread_mutex_t pidlist_mutex = PTHREAD_MUTEX_INITIALIZER;
-+#else /* BUILDING_VARIANT */
-+extern SLIST_HEAD(, pid) pidlist;
-+extern pthread_mutex_t pidlist_mutex;
-+#endif /* !BUILDING_VARIANT */
- #define       THREAD_LOCK()   if (__isthreaded) _pthread_mutex_lock(&pidlist_mutex)
- #define       THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&pidlist_mutex)
-@@ -71,84 +97,108 @@ popen(command, type)
- {
-       struct pid *cur;
-       FILE *iop;
--      int pdes[2], pid, twoway;
-+      int pdes[2], pid, twoway, other;
-       char *argv[4];
-       struct pid *p;
-+      posix_spawn_file_actions_t file_actions;
-+      int err;
--      /*
--       * Lite2 introduced two-way popen() pipes using _socketpair().
--       * FreeBSD's pipe() is bidirectional, so we use that.
--       */
--      if (strchr(type, '+')) {
-+      if (type == NULL) {
-+              errno = EINVAL;
-+              return (NULL);
-+      }
-+      if (strcmp(type, "r+") == 0) {
-               twoway = 1;
-               type = "r+";
-+              if (socketpair(AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
-+                      return (NULL);
-       } else  {
-               twoway = 0;
--              if ((*type != 'r' && *type != 'w') || type[1])
-+              if ((*type != 'r' && *type != 'w') || type[1]) {
-+                      errno = EINVAL;
-+                      return (NULL);
-+              }
-+              if (pipe(pdes) < 0)
-                       return (NULL);
-       }
--      if (pipe(pdes) < 0)
--              return (NULL);
--      if ((cur = malloc(sizeof(struct pid))) == NULL) {
-+      /* fdopen can now fail */
-+      if (*type == 'r') {
-+              iop = fdopen(pdes[0], type);
-+              other = pdes[1];
-+      } else {
-+              iop = fdopen(pdes[1], type);
-+              other = pdes[0];
-+      }
-+      if (iop == NULL) {
-               (void)_close(pdes[0]);
-               (void)_close(pdes[1]);
-               return (NULL);
-       }
-+      if ((cur = malloc(sizeof(struct pid))) == NULL) {
-+              (void)fclose(iop);
-+              (void)_close(other);
-+              return (NULL);
-+      }
-+
-+      if ((err = posix_spawn_file_actions_init(&file_actions)) != 0) {
-+              (void)fclose(iop);
-+              (void)_close(other);
-+              free(cur);
-+              errno = err;
-+              return (NULL);
-+      }
-+      if (*type == 'r') {
-+              /*
-+               * The dup2() to STDIN_FILENO is repeated to avoid
-+               * writing to pdes[1], which might corrupt the
-+               * parent's copy.  This isn't good enough in
-+               * general, since the _exit() is no return, so
-+               * the compiler is free to corrupt all the local
-+               * variables.
-+               */
-+              (void)posix_spawn_file_actions_addclose(&file_actions, pdes[0]);
-+              if (pdes[1] != STDOUT_FILENO) {
-+                      (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDOUT_FILENO);
-+                      (void)posix_spawn_file_actions_addclose(&file_actions, pdes[1]);
-+                      if (twoway)
-+                              (void)posix_spawn_file_actions_adddup2(&file_actions, STDOUT_FILENO, STDIN_FILENO);
-+              } else if (twoway && (pdes[1] != STDIN_FILENO))
-+                      (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDIN_FILENO);
-+      } else {
-+              if (pdes[0] != STDIN_FILENO) {
-+                      (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[0], STDIN_FILENO);
-+                      (void)posix_spawn_file_actions_addclose(&file_actions, pdes[0]);
-+              }
-+              (void)posix_spawn_file_actions_addclose(&file_actions, pdes[1]);
-+      }
-+      SLIST_FOREACH(p, &pidlist, next)
-+              (void)posix_spawn_file_actions_addclose(&file_actions, p->fd);
-+
-       argv[0] = "sh";
-       argv[1] = "-c";
-       argv[2] = (char *)command;
-       argv[3] = NULL;
--      THREAD_LOCK();
--      switch (pid = vfork()) {
--      case -1:                        /* Error. */
--              THREAD_UNLOCK();
--              (void)_close(pdes[0]);
--              (void)_close(pdes[1]);
-+      err = posix_spawn(&pid, _PATH_BSHELL, &file_actions, NULL, argv, environ);
-+      posix_spawn_file_actions_destroy(&file_actions);
-+
-+      if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */
-+              (void)fclose(iop);
-+              (void)_close(other);
-               free(cur);
-+              errno = err;
-               return (NULL);
--              /* NOTREACHED */
--      case 0:                         /* Child. */
--              if (*type == 'r') {
--                      /*
--                       * The _dup2() to STDIN_FILENO is repeated to avoid
--                       * writing to pdes[1], which might corrupt the
--                       * parent's copy.  This isn't good enough in
--                       * general, since the _exit() is no return, so
--                       * the compiler is free to corrupt all the local
--                       * variables.
--                       */
--                      (void)_close(pdes[0]);
--                      if (pdes[1] != STDOUT_FILENO) {
--                              (void)_dup2(pdes[1], STDOUT_FILENO);
--                              (void)_close(pdes[1]);
--                              if (twoway)
--                                      (void)_dup2(STDOUT_FILENO, STDIN_FILENO);
--                      } else if (twoway && (pdes[1] != STDIN_FILENO))
--                              (void)_dup2(pdes[1], STDIN_FILENO);
--              } else {
--                      if (pdes[0] != STDIN_FILENO) {
--                              (void)_dup2(pdes[0], STDIN_FILENO);
--                              (void)_close(pdes[0]);
--                      }
--                      (void)_close(pdes[1]);
--              }
--              SLIST_FOREACH(p, &pidlist, next)
--                      (void)_close(fileno(p->fp));
--              _execve(_PATH_BSHELL, argv, environ);
--              _exit(127);
--              /* NOTREACHED */
-+      } else if (err != 0) { /* couldn't exec the shell */
-+              pid = -1;
-       }
--      THREAD_UNLOCK();
--      /* Parent; assume fdopen can't fail. */
-       if (*type == 'r') {
--              iop = fdopen(pdes[0], type);
-+              cur->fd = pdes[0];
-               (void)_close(pdes[1]);
-       } else {
--              iop = fdopen(pdes[1], type);
-+              cur->fd = pdes[1];
-               (void)_close(pdes[0]);
-       }
-@@ -158,10 +208,11 @@ popen(command, type)
-       THREAD_LOCK();
-       SLIST_INSERT_HEAD(&pidlist, cur, next);
-       THREAD_UNLOCK();
--
-+      fwide(iop, -1);         /* byte stream */
-       return (iop);
- }
-+#ifndef BUILDING_VARIANT
- /*
-  * pclose --
-  *    Pclose returns -1 if stream is not associated with a `popened' command,
-@@ -196,6 +247,10 @@ pclose(iop)
-       (void)fclose(iop);
-+      if (cur->pid < 0) {
-+              free(cur);
-+              return W_EXITCODE(127, 0);
-+      }
-       do {
-               pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
-       } while (pid == -1 && errno == EINTR);
-@@ -204,3 +259,4 @@ pclose(iop)
-       return (pid == -1 ? -1 : pstat);
- }
-+#endif /* !BUILDING_VARIANT */
index 4b12fb7374cb154d3f203f7b35b496eb943e54f3..615a399b0063b5e9493fb74854df3935dce8bd78 100644 (file)
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/select.h
+.In unistd.h
 .Ft int
 .Fo pselect
 .Fa "int nfds"
-.Fa "fd_set * restrict readfds"
-.Fa "fd_set * restrict writefds"
-.Fa "fd_set * restrict exceptfds"
-.Fa "const struct timespec * restrict timeout"
-.Fa "const sigset_t * restrict newsigmask"
+.Fa "fd_set *restrict readfds"
+.Fa "fd_set *restrict writefds"
+.Fa "fd_set *restrict errorfds"
+.Fa "const struct timespec *restrict timeout"
+.Fa "const sigset_t *restrict sigmask"
 .Fc
 .Sh DESCRIPTION
 The
@@ -57,7 +57,7 @@ as a slightly stronger version of
 The
 .Fa nfds , readfds , writefds ,
 and
-.Fa exceptfds
+.Fa errorfds
 arguments are all identical to the analogous arguments of
 .Fn select .
 The
@@ -65,7 +65,7 @@ The
 argument in
 .Fn pselect
 points to a
-.Vt "const struct timespec"
+.Vt "const struct timespec" ,
 rather than the (modifiable)
 .Vt "struct timeval"
 used by
@@ -76,7 +76,7 @@ a null pointer may be passed to indicate that
 .Fn pselect
 should wait indefinitely.
 Finally,
-.Fa newsigmask
+.Fa sigmask
 specifies a signal mask which is set while waiting for input.
 When
 .Fn pselect
diff --git a/gen/FreeBSD/pselect.3.patch b/gen/FreeBSD/pselect.3.patch
deleted file mode 100644 (file)
index a1099cd..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
---- pselect.3.orig     2009-11-07 14:51:38.000000000 -0800
-+++ pselect.3  2009-11-07 14:51:39.000000000 -0800
-@@ -37,15 +37,15 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In sys/select.h
-+.In unistd.h
- .Ft int
- .Fo pselect
- .Fa "int nfds"
--.Fa "fd_set * restrict readfds"
--.Fa "fd_set * restrict writefds"
--.Fa "fd_set * restrict exceptfds"
--.Fa "const struct timespec * restrict timeout"
--.Fa "const sigset_t * restrict newsigmask"
-+.Fa "fd_set *restrict readfds"
-+.Fa "fd_set *restrict writefds"
-+.Fa "fd_set *restrict errorfds"
-+.Fa "const struct timespec *restrict timeout"
-+.Fa "const sigset_t *restrict sigmask"
- .Fc
- .Sh DESCRIPTION
- The
-@@ -57,7 +57,7 @@ as a slightly stronger version of
- The
- .Fa nfds , readfds , writefds ,
- and
--.Fa exceptfds
-+.Fa errorfds
- arguments are all identical to the analogous arguments of
- .Fn select .
- The
-@@ -65,7 +65,7 @@ The
- argument in
- .Fn pselect
- points to a
--.Vt "const struct timespec"
-+.Vt "const struct timespec" ,
- rather than the (modifiable)
- .Vt "struct timeval"
- used by
-@@ -76,7 +76,7 @@ a null pointer may be passed to indicate
- .Fn pselect
- should wait indefinitely.
- Finally,
--.Fa newsigmask
-+.Fa sigmask
- specifies a signal mask which is set while waiting for input.
- When
- .Fn pselect
index 13b25538e22eee06b641ca38db9834d935459989..4bc62fc2f5b47a41c443136fc6f5a9371b7ad65b 100644 (file)
  * SUCH DAMAGE.
  */
 
+#if defined(VARIANT_CANCELABLE) || defined(VARIANT_PRE1050)
+#undef __DARWIN_NON_CANCELABLE
+#endif /* VARIANT_CANCELABLE */
+
+#ifdef VARIANT_DARWINEXTSN
+#define _DARWIN_UNLIMITED_SELECT
+#endif /* VARIANT_DARWINEXTSN */
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $");
 
 #include "namespace.h"
+#include <sys/types.h>
 #include <sys/select.h>
 #include <sys/time.h>
+#include <unistd.h>
 
 #include <errno.h>
 #include <signal.h>
diff --git a/gen/FreeBSD/pselect.c.patch b/gen/FreeBSD/pselect.c.patch
deleted file mode 100644 (file)
index 26ecf91..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- pselect.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ pselect.c  2009-11-07 14:51:39.000000000 -0800
-@@ -27,12 +27,22 @@
-  * SUCH DAMAGE.
-  */
-+#if defined(VARIANT_CANCELABLE) || defined(VARIANT_PRE1050)
-+#undef __DARWIN_NON_CANCELABLE
-+#endif /* VARIANT_CANCELABLE */
-+
-+#ifdef VARIANT_DARWINEXTSN
-+#define _DARWIN_UNLIMITED_SELECT
-+#endif /* VARIANT_DARWINEXTSN */
-+
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $");
- #include "namespace.h"
-+#include <sys/types.h>
- #include <sys/select.h>
- #include <sys/time.h>
-+#include <unistd.h>
- #include <errno.h>
- #include <signal.h>
index c59d79ef9853ab1d9632f658ba78310987a1c008..84976af89d1f1c7ab7540af0a7fdb1cb098b042d 100644 (file)
@@ -98,6 +98,19 @@ contains a count of the strings in
 .Va sys_siglist
 and
 .Va sys_signame .
+.Sh RETURN VALUES
+.Fn strsignal
+a pointer to the desired message or a NULL value indicating an error.  This
+string is not to be freed by the caller.  Beginning with Mac OSX 10.7, this
+string is unique to each thread.
+.Sh ERRORS
+.Fn strsignal
+will fail and no additional memory will be allocated if
+one of the following are true:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+There was insufficient memory to allocate storage space for the return value in the running thread.
+.El
 .Sh SEE ALSO
 .Xr sigaction 2 ,
 .Xr perror 3 ,
diff --git a/gen/FreeBSD/psignal.3.patch b/gen/FreeBSD/psignal.3.patch
deleted file mode 100644 (file)
index fd4a161..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- psignal.3.orig     2010-05-06 12:14:16.000000000 -0700
-+++ psignal.3  2010-05-06 12:21:47.000000000 -0700
-@@ -98,6 +98,19 @@ contains a count of the strings in
- .Va sys_siglist
- and
- .Va sys_signame .
-+.Sh RETURN VALUES
-+.Fn strsignal
-+a pointer to the desired message or a NULL value indicating an error.  This
-+string is not to be freed by the caller.  Beginning with Mac OSX 10.7, this
-+string is unique to each thread.
-+.Sh ERRORS
-+.Fn strsignal
-+will fail and no additional memory will be allocated if
-+one of the following are true:
-+.Bl -tag -width Er
-+.It Bq Er ENOMEM
-+There was insufficient memory to allocate storage space for the return value in the running thread.
-+.El
- .Sh SEE ALSO
- .Xr sigaction 2 ,
- .Xr perror 3 ,
index d67f16347c2a11bd2159b03147bc686b842fb698..6bc96d6c5c8e0556b8ec4252927c360ff26fe022 100644 (file)
 .Sh NAME
 .Nm drand48 ,
 .Nm erand48 ,
+.Nm jrand48 ,
+.Nm lcong48 ,
 .Nm lrand48 ,
-.Nm nrand48 ,
 .Nm mrand48 ,
-.Nm jrand48 ,
-.Nm srand48 ,
+.Nm nrand48 ,
 .Nm seed48 ,
-.Nm lcong48
+.Nm srand48
 .Nd pseudo random number generators and initialization routines
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft double
-.Fn drand48 void
+.Fo drand48
+.Fa void
+.Fc
 .Ft double
-.Fn erand48 "unsigned short xseed[3]"
+.Fo erand48
+.Fa "unsigned short xsubi[3]"
+.Fc
 .Ft long
-.Fn lrand48 void
+.Fo jrand48
+.Fa "unsigned short xsubi[3]"
+.Fc
+.Ft void
+.Fo lcong48
+.Fa "unsigned short param[7]"
+.Fc
 .Ft long
-.Fn nrand48 "unsigned short xseed[3]"
+.Fo lrand48
+.Fa void
+.Fc
 .Ft long
-.Fn mrand48 void
+.Fo mrand48
+.Fa void
+.Fc
 .Ft long
-.Fn jrand48 "unsigned short xseed[3]"
-.Ft void
-.Fn srand48 "long seed"
+.Fo nrand48
+.Fa "unsigned short xsubi[3]"
+.Fc
 .Ft "unsigned short *"
-.Fn seed48 "unsigned short xseed[3]"
+.Fo seed48
+.Fa "unsigned short seed16v[3]"
+.Fc
 .Ft void
-.Fn lcong48 "unsigned short p[7]"
+.Fo srand48
+.Fa "long seedval"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn rand48
-family of functions generates pseudo-random numbers using a linear
+family of functions generates pseudo-random numbers, using a linear
 congruential algorithm working on integers 48 bits in size.
 The
 particular formula employed is
-r(n+1) = (a * r(n) + c) mod m
-where the default values are
-for the multiplicand a = 0xfdeece66d = 25214903917 and
-the addend c = 0xb = 11.
+r(n+1) = (a * r(n) + c) mod m.
+The default value for the multiplicand `a' is 0x5deece66d (25214903917).
+The default value for the the addend `c' is 0xb (11).
 The modulo is always fixed at m = 2 ** 48.
 r(n) is called the seed of the random number generator.
 .Pp
-For all the six generator routines described next, the first
+For the six generator routines described next, the first
 computational step is to perform a single iteration of the algorithm.
 .Pp
 The
@@ -124,7 +141,7 @@ is used to initialize the internal buffer r(n) of
 .Fn drand48 ,
 .Fn lrand48 ,
 and
-.Fn mrand48
+.Fn mrand48 ,
 such that the 32 bits of the seed value are copied into the upper 32 bits
 of r(n), with the lower 16 bits of r(n) arbitrarily being set to 0x330e.
 Additionally, the constant multiplicand and addend of the algorithm are
@@ -147,7 +164,7 @@ The
 .Fn seed48
 function
 returns a pointer to an array of 3 shorts which contains the old seed.
-This array is statically allocated, thus its contents are lost after
+This array is statically allocated; thus, its contents are lost after
 each new call to
 .Fn seed48 .
 .Pp
diff --git a/gen/FreeBSD/rand48.3.patch b/gen/FreeBSD/rand48.3.patch
deleted file mode 100644 (file)
index 362ce14..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
---- rand48.3.orig      2010-02-08 16:26:16.000000000 -0800
-+++ rand48.3   2010-02-13 19:48:39.000000000 -0800
-@@ -18,51 +18,68 @@
- .Sh NAME
- .Nm drand48 ,
- .Nm erand48 ,
-+.Nm jrand48 ,
-+.Nm lcong48 ,
- .Nm lrand48 ,
--.Nm nrand48 ,
- .Nm mrand48 ,
--.Nm jrand48 ,
--.Nm srand48 ,
-+.Nm nrand48 ,
- .Nm seed48 ,
--.Nm lcong48
-+.Nm srand48
- .Nd pseudo random number generators and initialization routines
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft double
--.Fn drand48 void
-+.Fo drand48
-+.Fa void
-+.Fc
- .Ft double
--.Fn erand48 "unsigned short xseed[3]"
-+.Fo erand48
-+.Fa "unsigned short xsubi[3]"
-+.Fc
- .Ft long
--.Fn lrand48 void
-+.Fo jrand48
-+.Fa "unsigned short xsubi[3]"
-+.Fc
-+.Ft void
-+.Fo lcong48
-+.Fa "unsigned short param[7]"
-+.Fc
- .Ft long
--.Fn nrand48 "unsigned short xseed[3]"
-+.Fo lrand48
-+.Fa void
-+.Fc
- .Ft long
--.Fn mrand48 void
-+.Fo mrand48
-+.Fa void
-+.Fc
- .Ft long
--.Fn jrand48 "unsigned short xseed[3]"
--.Ft void
--.Fn srand48 "long seed"
-+.Fo nrand48
-+.Fa "unsigned short xsubi[3]"
-+.Fc
- .Ft "unsigned short *"
--.Fn seed48 "unsigned short xseed[3]"
-+.Fo seed48
-+.Fa "unsigned short seed16v[3]"
-+.Fc
- .Ft void
--.Fn lcong48 "unsigned short p[7]"
-+.Fo srand48
-+.Fa "long seedval"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn rand48
--family of functions generates pseudo-random numbers using a linear
-+family of functions generates pseudo-random numbers, using a linear
- congruential algorithm working on integers 48 bits in size.
- The
- particular formula employed is
--r(n+1) = (a * r(n) + c) mod m
--where the default values are
--for the multiplicand a = 0xfdeece66d = 25214903917 and
--the addend c = 0xb = 11.
-+r(n+1) = (a * r(n) + c) mod m.
-+The default value for the multiplicand `a' is 0x5deece66d (25214903917).
-+The default value for the the addend `c' is 0xb (11).
- The modulo is always fixed at m = 2 ** 48.
- r(n) is called the seed of the random number generator.
- .Pp
--For all the six generator routines described next, the first
-+For the six generator routines described next, the first
- computational step is to perform a single iteration of the algorithm.
- .Pp
- The
-@@ -124,7 +141,7 @@ is used to initialize the internal buffe
- .Fn drand48 ,
- .Fn lrand48 ,
- and
--.Fn mrand48
-+.Fn mrand48 ,
- such that the 32 bits of the seed value are copied into the upper 32 bits
- of r(n), with the lower 16 bits of r(n) arbitrarily being set to 0x330e.
- Additionally, the constant multiplicand and addend of the algorithm are
-@@ -147,7 +164,7 @@ The
- .Fn seed48
- function
- returns a pointer to an array of 3 shorts which contains the old seed.
--This array is statically allocated, thus its contents are lost after
-+This array is statically allocated; thus, its contents are lost after
- each new call to
- .Fn seed48 .
- .Pp
index 0a3d83d3c0c731561f762c8de8fc72b8d7ae9302..e799eba0f088246f3cf603eea55170745baf9552 100644 (file)
@@ -19,8 +19,6 @@
 #include <math.h>
 #include <stdlib.h>
 
-void           _dorand48(unsigned short[3]);
-
 #define        RAND48_SEED_0   (0x330e)
 #define        RAND48_SEED_1   (0xabcd)
 #define        RAND48_SEED_2   (0x1234)
@@ -29,4 +27,55 @@ void         _dorand48(unsigned short[3]);
 #define        RAND48_MULT_2   (0x0005)
 #define        RAND48_ADD      (0x000b)
 
+typedef unsigned long long uint48;
+
+extern uint48 _rand48_seed;
+extern uint48 _rand48_mult;
+extern uint48 _rand48_add;
+
+#define TOUINT48(x,y,z) \
+       ((uint48)(x) + (((uint48)(y)) << 16) + (((uint48)(z)) << 32))
+
+#define RAND48_SEED    TOUINT48(RAND48_SEED_0, RAND48_SEED_1, RAND48_SEED_2)
+#define RAND48_MULT    TOUINT48(RAND48_MULT_0, RAND48_MULT_1, RAND48_MULT_2)
+
+#define LOADRAND48(l,x) \
+       (l) = TOUINT48((x)[0], (x)[1], (x)[2])
+
+#define STORERAND48(l,x) \
+       (x)[0] = (unsigned short)(l); \
+       (x)[1] = (unsigned short)((l) >> 16); \
+       (x)[2] = (unsigned short)((l) >> 32)
+
+#define _DORAND48(l) \
+       (l) = (l) * _rand48_mult + _rand48_add
+
+#define DORAND48(l,x) \
+       LOADRAND48(l, x); \
+       _DORAND48(l); \
+       STORERAND48(l, x)
+
+#include "fpmath.h"
+
+/*
+ * Optimization for speed: avoid int-to-double conversion.  Assume doubles
+ * are IEEE-754 and insert the bits directly.  To normalize, the (1 << 52)
+ * is the hidden bit, which the first set bit is shifted to.
+ */
+#define ERAND48_BEGIN \
+       union { \
+               union IEEEd2bits ieee; \
+               unsigned long long l; \
+       } u; \
+       int s
+
+#define ERAND48_END(x) \
+       u.l = ((x) & 0xffffffffffffULL); \
+       if (u.l == 0) \
+               return 0.0; \
+       u.l <<= 5; \
+       for(s = 0; !(u.l & (1LL << 52)); s++, u.l <<= 1) {} \
+       u.ieee.bits.exp = 1022 - s; \
+       return u.ieee.d
+
 #endif /* _RAND48_H_ */
diff --git a/gen/FreeBSD/rand48.h.patch b/gen/FreeBSD/rand48.h.patch
deleted file mode 100644 (file)
index 404c774..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
---- rand48.h.orig      2009-11-07 14:51:38.000000000 -0800
-+++ rand48.h   2009-11-07 14:51:39.000000000 -0800
-@@ -19,8 +19,6 @@
- #include <math.h>
- #include <stdlib.h>
--void          _dorand48(unsigned short[3]);
--
- #define       RAND48_SEED_0   (0x330e)
- #define       RAND48_SEED_1   (0xabcd)
- #define       RAND48_SEED_2   (0x1234)
-@@ -29,4 +27,55 @@ void                _dorand48(unsigned short[3]);
- #define       RAND48_MULT_2   (0x0005)
- #define       RAND48_ADD      (0x000b)
-+typedef unsigned long long uint48;
-+
-+extern uint48 _rand48_seed;
-+extern uint48 _rand48_mult;
-+extern uint48 _rand48_add;
-+
-+#define TOUINT48(x,y,z) \
-+      ((uint48)(x) + (((uint48)(y)) << 16) + (((uint48)(z)) << 32))
-+
-+#define RAND48_SEED   TOUINT48(RAND48_SEED_0, RAND48_SEED_1, RAND48_SEED_2)
-+#define RAND48_MULT   TOUINT48(RAND48_MULT_0, RAND48_MULT_1, RAND48_MULT_2)
-+
-+#define LOADRAND48(l,x) \
-+      (l) = TOUINT48((x)[0], (x)[1], (x)[2])
-+
-+#define STORERAND48(l,x) \
-+      (x)[0] = (unsigned short)(l); \
-+      (x)[1] = (unsigned short)((l) >> 16); \
-+      (x)[2] = (unsigned short)((l) >> 32)
-+
-+#define _DORAND48(l) \
-+      (l) = (l) * _rand48_mult + _rand48_add
-+
-+#define DORAND48(l,x) \
-+      LOADRAND48(l, x); \
-+      _DORAND48(l); \
-+      STORERAND48(l, x)
-+
-+#include "fpmath.h"
-+
-+/*
-+ * Optimization for speed: avoid int-to-double conversion.  Assume doubles
-+ * are IEEE-754 and insert the bits directly.  To normalize, the (1 << 52)
-+ * is the hidden bit, which the first set bit is shifted to.
-+ */
-+#define ERAND48_BEGIN \
-+      union { \
-+              union IEEEd2bits ieee; \
-+              unsigned long long l; \
-+      } u; \
-+      int s
-+
-+#define ERAND48_END(x) \
-+      u.l = ((x) & 0xffffffffffffULL); \
-+      if (u.l == 0) \
-+              return 0.0; \
-+      u.l <<= 5; \
-+      for(s = 0; !(u.l & (1LL << 52)); s++, u.l <<= 1) {} \
-+      u.ieee.bits.exp = 1022 - s; \
-+      return u.ieee.d
-+
- #endif /* _RAND48_H_ */
index a78c8b12d55c4903c3669471042c103e14a2ed34..3875cefa2a987e0bd99c914b03cd03a723990190 100644 (file)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.15 2008/05/05 14:05:23 kib Ex
 #include <errno.h>
 #include <string.h>
 #include <pthread.h>
+#include <unistd.h>
 #include "un-namespace.h"
 
 #include "libc_private.h"
@@ -61,8 +62,13 @@ _readdir_unlocked(dirp, skip)
                        dirp->dd_loc = 0;
                }
                if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
+#if __DARWIN_64_BIT_INO_T
+                       dirp->dd_size = __getdirentries64(dirp->dd_fd,
+                           dirp->dd_buf, dirp->dd_len, &dirp->dd_td->seekoff);
+#else /* !__DARWIN_64_BIT_INO_T */
                        dirp->dd_size = _getdirentries(dirp->dd_fd,
                            dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
+#endif /* __DARWIN_64_BIT_INO_T */
                        if (dirp->dd_size <= 0)
                                return (NULL);
                }
diff --git a/gen/FreeBSD/readdir.c.patch b/gen/FreeBSD/readdir.c.patch
deleted file mode 100644 (file)
index 8d7058d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
---- readdir.c.orig     2009-11-08 13:59:03.000000000 -0800
-+++ readdir.c  2009-11-08 13:59:22.000000000 -0800
-@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/rea
- #include <errno.h>
- #include <string.h>
- #include <pthread.h>
-+#include <unistd.h>
- #include "un-namespace.h"
- #include "libc_private.h"
-@@ -61,8 +62,13 @@ _readdir_unlocked(dirp, skip)
-                       dirp->dd_loc = 0;
-               }
-               if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
-+#if __DARWIN_64_BIT_INO_T
-+                      dirp->dd_size = __getdirentries64(dirp->dd_fd,
-+                          dirp->dd_buf, dirp->dd_len, &dirp->dd_td->seekoff);
-+#else /* !__DARWIN_64_BIT_INO_T */
-                       dirp->dd_size = _getdirentries(dirp->dd_fd,
-                           dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
-+#endif /* __DARWIN_64_BIT_INO_T */
-                       if (dirp->dd_size <= 0)
-                               return (NULL);
-               }
index d100be40852386a0b2ad29a4ec250a98dba1b2d4..45ac15f2963fedfe1a1e5978632be204a7811ba3 100644 (file)
@@ -33,6 +33,8 @@ static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.12 2001/12/15 05:41:
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/readpassphrase.c,v 1.6 2002/03/09 03:16:41 green Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <ctype.h>
 #include <errno.h>
@@ -59,6 +61,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
        struct termios term, oterm;
        struct sigaction sa, saveint, savehup, savequit, saveterm;
        struct sigaction savetstp, savettin, savettou;
+       locale_t loc = __current_locale();
 
        /* I suppose we could alloc on demand in this case (XXX). */
        if (bufsiz == 0) {
@@ -115,11 +118,11 @@ restart:
                if (p < end) {
                        if ((flags & RPP_SEVENBIT))
                                ch &= 0x7f;
-                       if (isalpha(ch)) {
+                       if (isalpha_l(ch, loc)) {
                                if ((flags & RPP_FORCELOWER))
-                                       ch = tolower(ch);
+                                       ch = tolower_l(ch, loc);
                                if ((flags & RPP_FORCEUPPER))
-                                       ch = toupper(ch);
+                                       ch = toupper_l(ch, loc);
                        }
                        *p++ = ch;
                }
diff --git a/gen/FreeBSD/readpassphrase.c.patch b/gen/FreeBSD/readpassphrase.c.patch
deleted file mode 100644 (file)
index ea6527a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- readpassphrase.c.orig      2009-11-07 14:51:38.000000000 -0800
-+++ readpassphrase.c   2009-11-07 14:51:39.000000000 -0800
-@@ -33,6 +33,8 @@ static const char rcsid[] = "$OpenBSD: r
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/readpassphrase.c,v 1.6 2002/03/09 03:16:41 green Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <ctype.h>
- #include <errno.h>
-@@ -59,6 +61,7 @@ readpassphrase(const char *prompt, char 
-       struct termios term, oterm;
-       struct sigaction sa, saveint, savehup, savequit, saveterm;
-       struct sigaction savetstp, savettin, savettou;
-+      locale_t loc = __current_locale();
-       /* I suppose we could alloc on demand in this case (XXX). */
-       if (bufsiz == 0) {
-@@ -115,11 +118,11 @@ restart:
-               if (p < end) {
-                       if ((flags & RPP_SEVENBIT))
-                               ch &= 0x7f;
--                      if (isalpha(ch)) {
-+                      if (isalpha_l(ch, loc)) {
-                               if ((flags & RPP_FORCELOWER))
--                                      ch = tolower(ch);
-+                                      ch = tolower_l(ch, loc);
-                               if ((flags & RPP_FORCEUPPER))
--                                      ch = toupper(ch);
-+                                      ch = toupper_l(ch, loc);
-                       }
-                       *p++ = ch;
-               }
index 507fbde6dd5acce70933565157b68cadedd5677b..d8b81f391272124e852061dc17641fd7b9221dcd 100644 (file)
 .\"     @(#)scandir.3  8.1 (Berkeley) 6/4/93
 .\" $FreeBSD: src/lib/libc/gen/scandir.3,v 1.9 2007/01/09 00:27:55 imp Exp $
 .\"
-.Dd June 4, 1993
+.Dd May 20, 2008
 .Dt SCANDIR 3
 .Os
 .Sh NAME
 .Nm scandir ,
+#ifdef UNIFDEF_BLOCKS
+.Nm scandir_b ,
+#endif
 .Nm alphasort
 .Nd scan a directory
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In sys/types.h
 .In dirent.h
 .Ft int
-.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
+.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpconst struct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst struct dirent **, const struct dirent **\\*(rp"
 .Ft int
-.Fn alphasort "const void *d1" "const void *d2"
+.Fn alphasort "const struct dirent **d1" "const struct dirent **d2"
+#ifdef UNIFDEF_BLOCKS
+.Ft int
+.Fn scandir_b "const char *dirname" "struct dirent ***namelist" "int \\*(lp^select\\*(rp\\*(lpconst struct dirent *\\*(rp" "int \\*(lp^compar\\*(rp\\*(lpconst struct dirent **, const struct dirent **\\*(rp"
+#endif
 .Sh DESCRIPTION
 The
 .Fn scandir
@@ -87,6 +92,18 @@ argument to sort the array alphabetically.
 The memory allocated for the array can be deallocated with
 .Xr free 3 ,
 by freeing each pointer in the array and then the array itself.
+#ifdef UNIFDEF_BLOCKS
+.Pp
+The
+.Fn scandir_b
+function works the same way as the
+.Fn scandir
+function, except that
+.Fa select
+and
+.Fa compar
+are blocks instead of subroutines.
+#endif
 .Sh DIAGNOSTICS
 Returns \-1 if the directory cannot be opened for reading or if
 .Xr malloc 3
@@ -103,3 +120,8 @@ and
 .Fn alphasort
 functions appeared in
 .Bx 4.2 .
+#ifdef UNIFDEF_BLOCKS
+The
+.Fn scandir_b
+function appeared in Mac OS X 10.6.
+#endif
diff --git a/gen/FreeBSD/scandir.3.patch b/gen/FreeBSD/scandir.3.patch
deleted file mode 100644 (file)
index 2152839..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
---- scandir.3.orig     2009-11-07 14:51:38.000000000 -0800
-+++ scandir.3  2009-11-07 14:51:40.000000000 -0800
-@@ -28,15 +28,16 @@
- .\"     @(#)scandir.3 8.1 (Berkeley) 6/4/93
- .\" $FreeBSD: src/lib/libc/gen/scandir.3,v 1.9 2007/01/09 00:27:55 imp Exp $
- .\"
--.Dd June 4, 1993
-+.Dd May 20, 2008
- .Dt SCANDIR 3
- .Os
- .Sh NAME
- .Nm scandir ,
-+#ifdef UNIFDEF_BLOCKS
-+.Nm scandir_b ,
-+#endif
- .Nm alphasort
- .Nd scan a directory
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In sys/types.h
- .In dirent.h
-@@ -44,6 +45,10 @@
- .Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
- .Ft int
- .Fn alphasort "const void *d1" "const void *d2"
-+#ifdef UNIFDEF_BLOCKS
-+.Ft int
-+.Fn scandir_b "const char *dirname" "struct dirent ***namelist" "int \\*(lp^select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp^compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
-+#endif
- .Sh DESCRIPTION
- The
- .Fn scandir
-@@ -76,6 +81,13 @@ argument is a pointer to a user supplied
- .Xr qsort 3
- to sort the completed array.
- If this pointer is null, the array is not sorted.
-+Note that from within the
-+.Fa compar
-+subroutine, the two arguments are of type
-+.Ft const struct dirent ** ,
-+so that a double-dereference is needed to access the fields in the
-+.Ft dirent
-+structure.
- .Pp
- The
- .Fn alphasort
-@@ -87,6 +99,18 @@ argument to sort the array alphabeticall
- The memory allocated for the array can be deallocated with
- .Xr free 3 ,
- by freeing each pointer in the array and then the array itself.
-+#ifdef UNIFDEF_BLOCKS
-+.Pp
-+The
-+.Fn scandir_b
-+function works the same way as the
-+.Fn scandir
-+function, except that
-+.Fa select
-+and
-+.Fa compar
-+are blocks instead of subroutines.
-+#endif
- .Sh DIAGNOSTICS
- Returns \-1 if the directory cannot be opened for reading or if
- .Xr malloc 3
-@@ -103,3 +127,8 @@ and
- .Fn alphasort
- functions appeared in
- .Bx 4.2 .
-+#ifdef UNIFDEF_BLOCKS
-+The
-+.Fn scandir_b
-+function appeared in Mac OS X 10.6.
-+#endif
index e21bd095d9e085f9e6c94ed75dfeefe35907d394..814f996d333aab28f84846f327a9eb601c2c8b33 100644 (file)
@@ -47,27 +47,24 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.9 2008/03/16 19:08:53 das Exp
 #include "un-namespace.h"
 
 /*
- * The DIRSIZ macro is the minimum record length which will hold the directory
+ * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
  * entry.  This requires the amount of space in struct dirent without the
  * d_name field, plus enough space for the name and a terminating nul byte
  * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
  */
-#undef DIRSIZ
-#define DIRSIZ(dp)                                                     \
-       ((sizeof(struct dirent) - sizeof(dp)->d_name) +                 \
-           (((dp)->d_namlen + 1 + 3) &~ 3))
 
 int
-scandir(dirname, namelist, select, dcomp)
+scandir(dirname, namelist, select, _dcomp)
        const char *dirname;
        struct dirent ***namelist;
-       int (*select)(struct dirent *);
-       int (*dcomp)(const void *, const void *);
+       int (*select)(const struct dirent *);
+       int (*_dcomp)(const struct dirent **, const struct dirent **);
 {
        struct dirent *d, *p, **names = NULL;
        size_t nitems = 0;
        long arraysz;
        DIR *dirp;
+       int (*dcomp)(const void *, const void *) = (void *)_dcomp; /* see <rdar://problem/10293482> */
 
        if ((dirp = opendir(dirname)) == NULL)
                return(-1);
@@ -83,7 +80,7 @@ scandir(dirname, namelist, select, dcomp)
                /*
                 * Make a minimum size copy of the data
                 */
-               p = (struct dirent *)malloc(DIRSIZ(d));
+               p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
                if (p == NULL)
                        goto fail;
                p->d_fileno = d->d_fileno;
@@ -128,8 +125,8 @@ fail:
  */
 int
 alphasort(d1, d2)
-       const void *d1;
-       const void *d2;
+       const struct dirent **d1;
+       const struct dirent **d2;
 {
        return(strcmp((*(struct dirent **)d1)->d_name,
            (*(struct dirent **)d2)->d_name));
diff --git a/gen/FreeBSD/scandir.c.patch b/gen/FreeBSD/scandir.c.patch
deleted file mode 100644 (file)
index 860cdc7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- scandir.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ scandir.c  2009-11-07 14:51:40.000000000 -0800
-@@ -47,15 +47,11 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sca
- #include "un-namespace.h"
- /*
-- * The DIRSIZ macro is the minimum record length which will hold the directory
-+ * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
-  * entry.  This requires the amount of space in struct dirent without the
-  * d_name field, plus enough space for the name and a terminating nul byte
-  * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
-  */
--#undef DIRSIZ
--#define DIRSIZ(dp)                                                    \
--      ((sizeof(struct dirent) - sizeof(dp)->d_name) +                 \
--          (((dp)->d_namlen + 1 + 3) &~ 3))
- int
- scandir(dirname, namelist, select, dcomp)
-@@ -83,7 +79,7 @@ scandir(dirname, namelist, select, dcomp
-               /*
-                * Make a minimum size copy of the data
-                */
--              p = (struct dirent *)malloc(DIRSIZ(d));
-+              p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
-               if (p == NULL)
-                       goto fail;
-               p->d_fileno = d->d_fileno;
diff --git a/gen/FreeBSD/scandir_b.c b/gen/FreeBSD/scandir_b.c
new file mode 100644 (file)
index 0000000..e13b917
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)scandir.c  8.3 (Berkeley) 1/2/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.9 2008/03/16 19:08:53 das Exp $");
+
+/*
+ * Scan the directory dirname calling select to make a list of selected
+ * directory entries then sort using qsort and compare routine dcomp.
+ * Returns the number of entries and a pointer to a list of pointers to
+ * struct dirent (through namelist). Returns -1 if there were any errors.
+ */
+
+#include "namespace.h"
+#include <dirent.h>
+#include <stdlib.h>
+#include <string.h>
+#include "un-namespace.h"
+
+/*
+ * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
+ * entry.  This requires the amount of space in struct dirent without the
+ * d_name field, plus enough space for the name and a terminating nul byte
+ * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
+ */
+
+int
+scandir_b(dirname, namelist, select, _dcomp)
+       const char *dirname;
+       struct dirent ***namelist;
+       int (^select)(const struct dirent *);
+       int (^_dcomp)(const struct dirent **, const struct dirent **);
+{
+       struct dirent *d, *p, **names = NULL;
+       size_t nitems = 0;
+       long arraysz;
+       DIR *dirp;
+       int (^dcomp)(const void *, const void *) = (void *)_dcomp; /* see <rdar://problem/10293482> */
+
+       if ((dirp = opendir(dirname)) == NULL)
+               return(-1);
+
+       arraysz = 32;   /* initial estimate of the array size */
+       names = (struct dirent **)malloc(arraysz * sizeof(struct dirent *));
+       if (names == NULL)
+               goto fail;
+
+       while ((d = readdir(dirp)) != NULL) {
+               if (select != NULL && !select(d))
+                       continue;       /* just selected names */
+               /*
+                * Make a minimum size copy of the data
+                */
+               p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
+               if (p == NULL)
+                       goto fail;
+               p->d_fileno = d->d_fileno;
+               p->d_type = d->d_type;
+               p->d_reclen = d->d_reclen;
+               p->d_namlen = d->d_namlen;
+               bcopy(d->d_name, p->d_name, p->d_namlen + 1);
+               /*
+                * Check to make sure the array has space left and
+                * realloc the maximum size.
+                */
+               if (nitems >= arraysz) {
+                       struct dirent **names2;
+
+                       names2 = (struct dirent **)realloc((char *)names,
+                               (arraysz * 2) * sizeof(struct dirent *));
+                       if (names2 == NULL) {
+                               free(p);
+                               goto fail;
+                       }
+                       names = names2;
+                       arraysz *= 2;
+               }
+               names[nitems++] = p;
+       }
+       closedir(dirp);
+       if (nitems && dcomp != NULL)
+               qsort_b(names, nitems, sizeof(struct dirent *), dcomp);
+       *namelist = names;
+       return(nitems);
+
+fail:
+       while (nitems > 0)
+               free(names[--nitems]);
+       free(names);
+       closedir(dirp);
+       return -1;
+}
diff --git a/gen/FreeBSD/scandir_b.c.patch b/gen/FreeBSD/scandir_b.c.patch
deleted file mode 100644 (file)
index f243dae..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- scandir_b.c        2009-11-07 14:51:38.000000000 -0800
-+++ scandir_b.c        2009-11-07 18:46:38.000000000 -0800
-@@ -47,22 +47,18 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sca
- #include "un-namespace.h"
- /*
-- * The DIRSIZ macro is the minimum record length which will hold the directory
-+ * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
-  * entry.  This requires the amount of space in struct dirent without the
-  * d_name field, plus enough space for the name and a terminating nul byte
-  * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
-  */
--#undef DIRSIZ
--#define DIRSIZ(dp)                                                    \
--      ((sizeof(struct dirent) - sizeof(dp)->d_name) +                 \
--          (((dp)->d_namlen + 1 + 3) &~ 3))
- int
--scandir(dirname, namelist, select, dcomp)
-+scandir_b(dirname, namelist, select, dcomp)
-       const char *dirname;
-       struct dirent ***namelist;
--      int (*select)(struct dirent *);
--      int (*dcomp)(const void *, const void *);
-+      int (^select)(struct dirent *);
-+      int (^dcomp)(const void *, const void *);
- {
-       struct dirent *d, *p, **names = NULL;
-       size_t nitems = 0;
-@@ -78,12 +74,12 @@ scandir(dirname, namelist, select, dcomp
-               goto fail;
-       while ((d = readdir(dirp)) != NULL) {
--              if (select != NULL && !(*select)(d))
-+              if (select != NULL && !select(d))
-                       continue;       /* just selected names */
-               /*
-                * Make a minimum size copy of the data
-                */
--              p = (struct dirent *)malloc(DIRSIZ(d));
-+              p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
-               if (p == NULL)
-                       goto fail;
-               p->d_fileno = d->d_fileno;
-@@ -111,7 +107,7 @@ scandir(dirname, namelist, select, dcomp
-       }
-       closedir(dirp);
-       if (nitems && dcomp != NULL)
--              qsort(names, nitems, sizeof(struct dirent *), dcomp);
-+              qsort_b(names, nitems, sizeof(struct dirent *), dcomp);
-       *namelist = names;
-       return(nitems);
-@@ -122,15 +118,3 @@ fail:
-       closedir(dirp);
-       return -1;
- }
--
--/*
-- * Alphabetic order comparison routine for those who want it.
-- */
--int
--alphasort(d1, d2)
--      const void *d1;
--      const void *d2;
--{
--      return(strcmp((*(struct dirent **)d1)->d_name,
--          (*(struct dirent **)d2)->d_name));
--}
index 94167a7b11978a40e4a8d5bd9cd4cd1dc20cdf48..73d63ffa830a65ab430b8f492ce44c7250a997e6 100644 (file)
@@ -16,24 +16,14 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/seed48.c,v 1.2 2002/03/22 21:52:05 obrien E
 
 #include "rand48.h"
 
-extern unsigned short _rand48_seed[3];
-extern unsigned short _rand48_mult[3];
-extern unsigned short _rand48_add;
-
 unsigned short *
 seed48(unsigned short xseed[3])
 {
        static unsigned short sseed[3];
 
-       sseed[0] = _rand48_seed[0];
-       sseed[1] = _rand48_seed[1];
-       sseed[2] = _rand48_seed[2];
-       _rand48_seed[0] = xseed[0];
-       _rand48_seed[1] = xseed[1];
-       _rand48_seed[2] = xseed[2];
-       _rand48_mult[0] = RAND48_MULT_0;
-       _rand48_mult[1] = RAND48_MULT_1;
-       _rand48_mult[2] = RAND48_MULT_2;
+       STORERAND48(_rand48_seed, sseed);
+       LOADRAND48(_rand48_seed, xseed);
+       _rand48_mult = RAND48_MULT;
        _rand48_add = RAND48_ADD;
        return sseed;
 }
diff --git a/gen/FreeBSD/seed48.c.patch b/gen/FreeBSD/seed48.c.patch
deleted file mode 100644 (file)
index 7efb4f1..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- seed48.c.orig      2009-11-07 14:51:38.000000000 -0800
-+++ seed48.c   2009-11-07 14:51:39.000000000 -0800
-@@ -16,24 +16,14 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/see
- #include "rand48.h"
--extern unsigned short _rand48_seed[3];
--extern unsigned short _rand48_mult[3];
--extern unsigned short _rand48_add;
--
- unsigned short *
- seed48(unsigned short xseed[3])
- {
-       static unsigned short sseed[3];
--      sseed[0] = _rand48_seed[0];
--      sseed[1] = _rand48_seed[1];
--      sseed[2] = _rand48_seed[2];
--      _rand48_seed[0] = xseed[0];
--      _rand48_seed[1] = xseed[1];
--      _rand48_seed[2] = xseed[2];
--      _rand48_mult[0] = RAND48_MULT_0;
--      _rand48_mult[1] = RAND48_MULT_1;
--      _rand48_mult[2] = RAND48_MULT_2;
-+      STORERAND48(_rand48_seed, sseed);
-+      LOADRAND48(_rand48_seed, xseed);
-+      _rand48_mult = RAND48_MULT;
-       _rand48_add = RAND48_ADD;
-       return sseed;
- }
index 4c1e5a0dca48b277f590eb19d0c2b9b6cc268b18..53b79d21d624948b6b8b82bbce7627068e5a52b3 100644 (file)
@@ -66,12 +66,15 @@ typedef struct bitcmd {
 #define        CMD2_OBITS      0x08
 #define        CMD2_UBITS      0x10
 
+#define        compress_mode   _sm_compress_mode
+
 static BITCMD  *addcmd(BITCMD *, int, int, int, u_int);
-static void     compress_mode(BITCMD *);
+__private_extern__ void                compress_mode(BITCMD *);
 #ifdef SETMODE_DEBUG
 static void     dumpmode(BITCMD *);
 #endif
 
+#ifndef BUILDING_VARIANT
 /*
  * Given the old mode and an array of bitcmd structures, apply the operations
  * described in the bitcmd structures to the old mode, and return the new mode.
@@ -145,6 +148,7 @@ common:                     if (set->cmd2 & CMD2_CLR) {
                        return (newmode);
                }
 }
+#endif /* BUILDING_VARIANT */
 
 #define        ADDCMD(a, b, c, d)                                              \
        if (set >= endset) {                                            \
@@ -163,7 +167,11 @@ common:                    if (set->cmd2 & CMD2_CLR) {
        }                                                               \
        set = addcmd(set, (a), (b), (c), (d))
 
+#ifndef VARIANT_LEGACY
+#define        STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO|S_ISTXT)
+#else /* VARIANT_LEGACY */
 #define        STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
+#endif /* !VARIANT_LEGACY */
 
 void *
 setmode(const char *p)
@@ -204,12 +212,21 @@ setmode(const char *p)
         */
        if (isdigit((unsigned char)*p)) {
                perml = strtol(p, &ep, 8);
-               if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT)) {
+#ifndef VARIANT_LEGACY
+               if (*ep || perml < 0 || perml & ~STANDARD_BITS)
+#else /* VARIANT_LEGACY */
+               if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT))
+#endif /* !VARIANT_LEGACY */
+               {
                        free(saveset);
                        return (NULL);
                }
                perm = (mode_t)perml;
+#ifndef VARIANT_LEGACY
+               ADDCMD('=', STANDARD_BITS, perm, mask);
+#else /* VARIANT_LEGACY */
                ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
+#endif /* !VARIANT_LEGACY */
                set->cmd = 0;
                return (saveset);
        }
@@ -246,7 +263,9 @@ getop:              if ((op = *p++) != '+' && op != '-' && op != '=') {
                if (op == '=')
                        equalopdone = 0;
 
+#ifdef VARIANT_LEGACY
                who &= ~S_ISTXT;
+#endif /* VARIANT_LEGACY */
                for (perm = 0, permXbits = 0;; ++p) {
                        switch (*p) {
                        case 'r':
@@ -260,7 +279,9 @@ getop:              if ((op = *p++) != '+' && op != '-' && op != '=') {
                        case 't':
                                /* If only "other" bits ignore sticky. */
                                if (!who || who & ~S_IRWXO) {
+#ifdef VARIANT_LEGACY
                                        who |= S_ISTXT;
+#endif /* VARIANT_LEGACY */
                                        perm |= S_ISTXT;
                                }
                                break;
@@ -390,13 +411,14 @@ dumpmode(BITCMD *set)
 }
 #endif
 
+#ifndef BUILDING_VARIANT
 /*
  * Given an array of bitcmd structures, compress by compacting consecutive
  * '+', '-' and 'X' commands into at most 3 commands, one of each.  The 'u',
  * 'g' and 'o' commands continue to be separate.  They could probably be
  * compacted, but it's not worth the effort.
  */
-static void
+__private_extern__ void
 compress_mode(BITCMD *set)
 {
        BITCMD *nset;
@@ -444,3 +466,4 @@ compress_mode(BITCMD *set)
                }
        }
 }
+#endif /* BUILDING_VARIANT */
diff --git a/gen/FreeBSD/setmode.c.patch b/gen/FreeBSD/setmode.c.patch
deleted file mode 100644 (file)
index 03dda3b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
---- setmode.c.orig     2009-11-08 14:13:46.000000000 -0800
-+++ setmode.c  2009-11-08 14:13:39.000000000 -0800
-@@ -66,12 +66,15 @@ typedef struct bitcmd {
- #define       CMD2_OBITS      0x08
- #define       CMD2_UBITS      0x10
-+#define       compress_mode   _sm_compress_mode
-+
- static BITCMD *addcmd(BITCMD *, int, int, int, u_int);
--static void    compress_mode(BITCMD *);
-+__private_extern__ void               compress_mode(BITCMD *);
- #ifdef SETMODE_DEBUG
- static void    dumpmode(BITCMD *);
- #endif
-+#ifndef BUILDING_VARIANT
- /*
-  * Given the old mode and an array of bitcmd structures, apply the operations
-  * described in the bitcmd structures to the old mode, and return the new mode.
-@@ -145,6 +148,7 @@ common:                    if (set->cmd2 & CMD2_CLR) {
-                       return (newmode);
-               }
- }
-+#endif /* BUILDING_VARIANT */
- #define       ADDCMD(a, b, c, d)                                              \
-       if (set >= endset) {                                            \
-@@ -163,7 +167,11 @@ common:                   if (set->cmd2 & CMD2_CLR) {
-       }                                                               \
-       set = addcmd(set, (a), (b), (c), (d))
-+#ifndef VARIANT_LEGACY
-+#define       STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO|S_ISTXT)
-+#else /* VARIANT_LEGACY */
- #define       STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
-+#endif /* !VARIANT_LEGACY */
- void *
- setmode(const char *p)
-@@ -204,12 +212,21 @@ setmode(const char *p)
-        */
-       if (isdigit((unsigned char)*p)) {
-               perml = strtol(p, &ep, 8);
--              if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT)) {
-+#ifndef VARIANT_LEGACY
-+              if (*ep || perml < 0 || perml & ~STANDARD_BITS)
-+#else /* VARIANT_LEGACY */
-+              if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT))
-+#endif /* !VARIANT_LEGACY */
-+              {
-                       free(saveset);
-                       return (NULL);
-               }
-               perm = (mode_t)perml;
-+#ifndef VARIANT_LEGACY
-+              ADDCMD('=', STANDARD_BITS, perm, mask);
-+#else /* VARIANT_LEGACY */
-               ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
-+#endif /* !VARIANT_LEGACY */
-               set->cmd = 0;
-               return (saveset);
-       }
-@@ -246,7 +263,9 @@ getop:             if ((op = *p++) != '+' && op != 
-               if (op == '=')
-                       equalopdone = 0;
-+#ifdef VARIANT_LEGACY
-               who &= ~S_ISTXT;
-+#endif /* VARIANT_LEGACY */
-               for (perm = 0, permXbits = 0;; ++p) {
-                       switch (*p) {
-                       case 'r':
-@@ -260,7 +279,9 @@ getop:             if ((op = *p++) != '+' && op != 
-                       case 't':
-                               /* If only "other" bits ignore sticky. */
-                               if (!who || who & ~S_IRWXO) {
-+#ifdef VARIANT_LEGACY
-                                       who |= S_ISTXT;
-+#endif /* VARIANT_LEGACY */
-                                       perm |= S_ISTXT;
-                               }
-                               break;
-@@ -390,13 +411,14 @@ dumpmode(BITCMD *set)
- }
- #endif
-+#ifndef BUILDING_VARIANT
- /*
-  * Given an array of bitcmd structures, compress by compacting consecutive
-  * '+', '-' and 'X' commands into at most 3 commands, one of each.  The 'u',
-  * 'g' and 'o' commands continue to be separate.  They could probably be
-  * compacted, but it's not worth the effort.
-  */
--static void
-+__private_extern__ void
- compress_mode(BITCMD *set)
- {
-       BITCMD *nset;
-@@ -444,3 +466,4 @@ compress_mode(BITCMD *set)
-               }
-       }
- }
-+#endif /* BUILDING_VARIANT */
index 654bef4161b8e2eaa8527a104e4731d8a8d5e1ed..2392a66f6a19647da21be11fac4a93d130e1cb9e 100644 (file)
@@ -3,6 +3,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.8 2002/03/29 22:43:41 mar
 
 #include <stdlib.h>
 #include <string.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <crt_externs.h>
+#define        __progname      (*_NSGetProgname())
 
 #include "libc_private.h"
 
@@ -10,10 +14,20 @@ void
 setprogname(const char *progname)
 {
        const char *p;
-
+       char buf[2*MAXCOMLEN+1];
+       int mib[2];
+       
        p = strrchr(progname, '/');
        if (p != NULL)
-               __progname = p + 1;
+               __progname = (char *)(p = p + 1);
        else
-               __progname = progname;
+               __progname = (char *)(p = progname);
+
+       strlcpy(&buf[0], (char *)(p), sizeof(buf));
+
+       mib[0] = CTL_KERN;
+       mib[1] = KERN_PROCNAME;
+
+       /* ignore errors as this is not a hard error */
+       sysctl(mib, 2, NULL, NULL, &buf[0], strlen(buf));
 }
diff --git a/gen/FreeBSD/setprogname.c.patch b/gen/FreeBSD/setprogname.c.patch
deleted file mode 100644 (file)
index dafccfd..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---- setprogname.c.orig 2009-11-07 14:51:38.000000000 -0800
-+++ setprogname.c      2009-11-07 14:51:39.000000000 -0800
-@@ -3,6 +3,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/set
- #include <stdlib.h>
- #include <string.h>
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#include <crt_externs.h>
-+#define       __progname      (*_NSGetProgname())
- #include "libc_private.h"
-@@ -10,10 +14,20 @@ void
- setprogname(const char *progname)
- {
-       const char *p;
--
-+      char buf[2*MAXCOMLEN+1];
-+      int mib[2];
-+      
-       p = strrchr(progname, '/');
-       if (p != NULL)
--              __progname = p + 1;
-+              __progname = (char *)(p = p + 1);
-       else
--              __progname = progname;
-+              __progname = (char *)(p = progname);
-+
-+      strlcpy(&buf[0], (char *)(p), sizeof(buf));
-+
-+      mib[0] = CTL_KERN;
-+      mib[1] = KERN_PROCNAME;
-+
-+      /* ignore errors as this is not a hard error */
-+      sysctl(mib, 2, NULL, NULL, &buf[0], strlen(buf));
- }
index aae9120aa067da76d952d0d6098a7000e4cbea42..6e2fd5fea48740473dbf8e3d1180745c9b16a689 100644 (file)
@@ -92,8 +92,8 @@ the new action to take place on the next signal to be caught.
 This library routine uses an extension of the
 .Xr sigaction 2
 system call that is not available in
-.Bx 4.2 ,
-hence it should not be used if backward compatibility is needed.
+.Bx 4.2 ;
+hence, it should not be used if backward compatibility is needed.
 .Sh RETURN VALUES
 .Rv -std siginterrupt
 .Sh ERRORS
diff --git a/gen/FreeBSD/siginterrupt.3.patch b/gen/FreeBSD/siginterrupt.3.patch
deleted file mode 100644 (file)
index 8b6d16b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- siginterrupt.3.orig        2009-11-07 14:51:38.000000000 -0800
-+++ siginterrupt.3     2009-11-07 14:51:40.000000000 -0800
-@@ -92,8 +92,8 @@ the new action to take place on the next
- This library routine uses an extension of the
- .Xr sigaction 2
- system call that is not available in
--.Bx 4.2 ,
--hence it should not be used if backward compatibility is needed.
-+.Bx 4.2 ;
-+hence, it should not be used if backward compatibility is needed.
- .Sh RETURN VALUES
- .Rv -std siginterrupt
- .Sh ERRORS
index d3de563b80152d9585a6f430ada0dc0b5c726b95..a22298936f77e7a8cc25e368ec992fada1c9f9d2 100644 (file)
@@ -104,4 +104,3 @@ const char *const sys_siglist[NSIG] = {
        "User defined signal 1",        /* SIGUSR1 */
        "User defined signal 2"         /* SIGUSR2 */
 };
-const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
diff --git a/gen/FreeBSD/siglist.c.patch b/gen/FreeBSD/siglist.c.patch
deleted file mode 100644 (file)
index 24677f1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
---- siglist.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ siglist.c  2009-11-07 14:51:40.000000000 -0800
-@@ -104,4 +104,3 @@ const char *const sys_siglist[NSIG] = {
-       "User defined signal 1",        /* SIGUSR1 */
-       "User defined signal 2"         /* SIGUSR2 */
- };
--const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
index 7d68346dd4c3ab056396c26463e4852fdbfc4f0b..f18d1cf399798d0b36baf7c4672861990aa5b0ce 100644 (file)
@@ -52,9 +52,7 @@
 .Pp
 .nr in-synopsis-section 1
 .\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
-or in
-.Fx Ap s
-equivalent but easier to read typedef'd version:
+or in the equivalent but easier to read typedef'd version:
 .Ft typedef "void \*(lp*sig_t\*(rp \*(lpint\*(rp" ;
 .Pp
 .Ft sig_t
@@ -67,9 +65,9 @@ is a simplified interface to the more general
 .Xr sigaction 2
 facility.
 .Pp
-Signals allow the manipulation of a process from outside its
-domain as well as allowing the process to manipulate itself or
-copies of itself (children).
+Signals allow the manipulation of a process from outside its domain,
+as well as allowing the process to manipulate itself
+or copies of itself (children).
 There are two general types of signals:
 those that cause termination of a process and those that do not.
 Signals which cause termination of a program might result from
@@ -82,11 +80,10 @@ Signals are optionally generated
 when a process resumes after being stopped,
 when the status of child processes changes,
 or when input is ready at the control terminal.
-Most signals result in the termination of the process receiving them
-if no action
-is taken; some signals instead cause the process receiving them
-to be stopped, or are simply discarded if the process has not
-requested otherwise.
+Most signals result in the termination of the process receiving them,
+if no action is taken;
+some signals instead cause the process receiving them to be stopped,
+or are simply discarded if the process has not requested otherwise.
 Except for the
 .Dv SIGKILL
 and
@@ -140,7 +137,6 @@ is possible on a descriptor (see
 .It 29 Ta Dv SIGINFO Ta "discard signal" Ta "status request from keyboard"
 .It 30 Ta Dv SIGUSR1 Ta "terminate process" Ta "User defined signal 1"
 .It 31 Ta Dv SIGUSR2 Ta "terminate process" Ta "User defined signal 2"
-.It 32 Ta Dv SIGTHR Ta "terminate process" Ta "thread interrupt"
 .El
 .Pp
 The
@@ -156,7 +152,7 @@ should be
 A
 .Dv SIG_DFL
 resets the default action.
-To ignore the signal
+To ignore the signal,
 .Fa func
 should be
 .Dv SIG_IGN .
@@ -192,7 +188,7 @@ The affected system calls include
 .Xr write 2 ,
 .Xr sendto 2 ,
 .Xr recvfrom 2 ,
-.Xr sendmsg 2
+.Xr sendmsg 2 ,
 and
 .Xr recvmsg 2
 on a communications channel or a low speed device
diff --git a/gen/FreeBSD/signal.3.patch b/gen/FreeBSD/signal.3.patch
deleted file mode 100644 (file)
index 49cdecf..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
---- signal.3.bsdnew    2009-11-08 14:20:21.000000000 -0800
-+++ signal.3   2009-11-08 14:26:22.000000000 -0800
-@@ -52,9 +52,7 @@
- .Pp
- .nr in-synopsis-section 1
- .\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
--or in
--.Fx Ap s
--equivalent but easier to read typedef'd version:
-+or in the equivalent but easier to read typedef'd version:
- .Ft typedef "void \*(lp*sig_t\*(rp \*(lpint\*(rp" ;
- .Pp
- .Ft sig_t
-@@ -67,9 +65,9 @@ is a simplified interface to the more ge
- .Xr sigaction 2
- facility.
- .Pp
--Signals allow the manipulation of a process from outside its
--domain as well as allowing the process to manipulate itself or
--copies of itself (children).
-+Signals allow the manipulation of a process from outside its domain,
-+as well as allowing the process to manipulate itself
-+or copies of itself (children).
- There are two general types of signals:
- those that cause termination of a process and those that do not.
- Signals which cause termination of a program might result from
-@@ -82,11 +80,10 @@ Signals are optionally generated
- when a process resumes after being stopped,
- when the status of child processes changes,
- or when input is ready at the control terminal.
--Most signals result in the termination of the process receiving them
--if no action
--is taken; some signals instead cause the process receiving them
--to be stopped, or are simply discarded if the process has not
--requested otherwise.
-+Most signals result in the termination of the process receiving them,
-+if no action is taken;
-+some signals instead cause the process receiving them to be stopped,
-+or are simply discarded if the process has not requested otherwise.
- Except for the
- .Dv SIGKILL
- and
-@@ -140,7 +137,6 @@ is possible on a descriptor (see
- .It 29 Ta Dv SIGINFO Ta "discard signal" Ta "status request from keyboard"
- .It 30 Ta Dv SIGUSR1 Ta "terminate process" Ta "User defined signal 1"
- .It 31 Ta Dv SIGUSR2 Ta "terminate process" Ta "User defined signal 2"
--.It 32 Ta Dv SIGTHR Ta "terminate process" Ta "thread interrupt"
- .El
- .Pp
- The
-@@ -156,7 +152,7 @@ should be
- A
- .Dv SIG_DFL
- resets the default action.
--To ignore the signal
-+To ignore the signal,
- .Fa func
- should be
- .Dv SIG_IGN .
-@@ -192,7 +188,7 @@ The affected system calls include
- .Xr write 2 ,
- .Xr sendto 2 ,
- .Xr recvfrom 2 ,
--.Xr sendmsg 2
-+.Xr sendmsg 2 ,
- and
- .Xr recvmsg 2
- on a communications channel or a low speed device
index 6407da3b4e7d2e1c9f2fd608d70ca366db476dbd..a496863df0aa6ecfa8e18532f86b849be3bb2220 100644 (file)
@@ -43,10 +43,13 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/signal.c,v 1.4 2007/01/09 00:27:55 imp Exp
 
 sigset_t _sigintr;             /* shared with siginterrupt */
 
-sig_t
-signal(s, a)
+extern int _sigaction_nobind (int sig, const struct sigaction *nsv, struct sigaction *osv);
+
+static sig_t
+signal__(s, a, bind)
        int s;
        sig_t a;
+       int bind;
 {
        struct sigaction sa, osa;
 
@@ -55,7 +58,34 @@ signal(s, a)
        sa.sa_flags = 0;
        if (!sigismember(&_sigintr, s))
                sa.sa_flags |= SA_RESTART;
+#if defined(__DYNAMIC__)
+       if (bind) {
+#endif /* __DYNAMIC__ */
        if (_sigaction(s, &sa, &osa) < 0)
                return (SIG_ERR);
+#if defined(__DYNAMIC__)
+       } else {
+           if (_sigaction_nobind(s, &sa, &osa) < 0)
+               return (SIG_ERR);
+       }
+#endif /* __DYNAMIC__ */
        return (osa.sa_handler);
 }
+
+sig_t
+signal(s, a)
+        int s;
+        sig_t a;
+{
+    return signal__(s, a, 1);
+}
+
+#if defined(__DYNAMIC__)
+sig_t
+_signal_nobind(s, a)
+        int s;
+        sig_t a;
+{
+    return signal__(s, a, 0);
+}
+#endif /* __DYNAMIC__ */
diff --git a/gen/FreeBSD/signal.c.patch b/gen/FreeBSD/signal.c.patch
deleted file mode 100644 (file)
index 9064ec8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
---- signal.c.orig      2009-11-07 14:51:38.000000000 -0800
-+++ signal.c   2009-11-07 14:51:40.000000000 -0800
-@@ -43,10 +43,13 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sig
- sigset_t _sigintr;            /* shared with siginterrupt */
--sig_t
--signal(s, a)
-+extern int _sigaction_nobind (int sig, const struct sigaction *nsv, struct sigaction *osv);
-+
-+static sig_t
-+signal__(s, a, bind)
-       int s;
-       sig_t a;
-+      int bind;
- {
-       struct sigaction sa, osa;
-@@ -55,7 +58,34 @@ signal(s, a)
-       sa.sa_flags = 0;
-       if (!sigismember(&_sigintr, s))
-               sa.sa_flags |= SA_RESTART;
-+#if defined(__DYNAMIC__)
-+      if (bind) {
-+#endif /* __DYNAMIC__ */
-       if (_sigaction(s, &sa, &osa) < 0)
-               return (SIG_ERR);
-+#if defined(__DYNAMIC__)
-+      } else {
-+          if (_sigaction_nobind(s, &sa, &osa) < 0)
-+              return (SIG_ERR);
-+      }
-+#endif /* __DYNAMIC__ */
-       return (osa.sa_handler);
- }
-+
-+sig_t
-+signal(s, a)
-+        int s;
-+        sig_t a;
-+{
-+    return signal__(s, a, 1);
-+}
-+
-+#if defined(__DYNAMIC__)
-+sig_t
-+_signal_nobind(s, a)
-+        int s;
-+        sig_t a;
-+{
-+    return signal__(s, a, 0);
-+}
-+#endif /* __DYNAMIC__ */
index 42d810d09cf5f9f6199ab7e49f1dd0e180ac5bd4..7d9c8d84d2d9d93b44df308a358983edd772dba9 100644 (file)
@@ -40,8 +40,9 @@
 The
 .Fn signbit
 macro takes an argument of
-.Fa x
-and returns non-zero if the value of its sign is negative, otherwise 0.
+.Fa x .
+It returns non-zero if the value of the argument's sign is negative,
+otherwise 0.
 .Sh SEE ALSO
 .Xr fpclassify 3 ,
 .Xr math 3
@@ -50,8 +51,3 @@ The
 .Fn signbit
 macro conforms to
 .St -isoC-99 .
-.Sh HISTORY
-The
-.Fn signbit
-macro was added in
-.Fx 5.1 .
diff --git a/gen/FreeBSD/signbit.3.patch b/gen/FreeBSD/signbit.3.patch
deleted file mode 100644 (file)
index a0dba44..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
---- signbit.3.orig     2009-11-07 14:51:38.000000000 -0800
-+++ signbit.3  2009-11-07 14:51:39.000000000 -0800
-@@ -40,8 +40,9 @@
- The
- .Fn signbit
- macro takes an argument of
--.Fa x
--and returns non-zero if the value of its sign is negative, otherwise 0.
-+.Fa x .
-+It returns non-zero if the value of the argument's sign is negative,
-+otherwise 0.
- .Sh SEE ALSO
- .Xr fpclassify 3 ,
- .Xr math 3
-@@ -50,8 +51,3 @@ The
- .Fn signbit
- macro conforms to
- .St -isoC-99 .
--.Sh HISTORY
--The
--.Fn signbit
--macro was added in
--.Fx 5.1 .
index a3c42fcdc1fb90882156f4614031c3b43a4535ac..f540a150ad23cebf290a0a503bbfca8496fd6490 100644 (file)
@@ -33,7 +33,7 @@
 .Os
 .Sh NAME
 .Nm sleep
-.Nd suspend process execution for an interval measured in seconds
+.Nd suspend thread execution for an interval measured in seconds
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .Sh DESCRIPTION
 The
 .Fn sleep
-function suspends execution of the calling process until either
+function suspends execution of the calling thread until either
 .Fa seconds
-seconds have elapsed or a signal is delivered to the process and its
+seconds have elapsed or a signal is delivered to the thread and its
 action is to invoke a signal-catching function or to terminate the
-process.
+thread or process.
 System activity may lengthen the sleep by an indeterminate amount.
 .Pp
 This function is implemented using
diff --git a/gen/FreeBSD/sleep.3.patch b/gen/FreeBSD/sleep.3.patch
deleted file mode 100644 (file)
index 0a27b75..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- sleep.3.orig       2009-11-07 14:51:38.000000000 -0800
-+++ sleep.3    2009-11-07 14:51:40.000000000 -0800
-@@ -33,7 +33,7 @@
- .Os
- .Sh NAME
- .Nm sleep
--.Nd suspend process execution for an interval measured in seconds
-+.Nd suspend thread execution for an interval measured in seconds
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
-@@ -43,11 +43,11 @@
- .Sh DESCRIPTION
- The
- .Fn sleep
--function suspends execution of the calling process until either
-+function suspends execution of the calling thread until either
- .Fa seconds
--seconds have elapsed or a signal is delivered to the process and its
-+seconds have elapsed or a signal is delivered to the thread and its
- action is to invoke a signal-catching function or to terminate the
--process.
-+thread or process.
- System activity may lengthen the sleep by an indeterminate amount.
- .Pp
- This function is implemented using
index badd7c7359f7e29861b21b0468fda68a940f9516..9d2095e356ecc4bb437816b3d9befa4c70f3ceee 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef VARIANT_CANCELABLE
+#undef __DARWIN_NON_CANCELABLE
+#define __DARWIN_NON_CANCELABLE 0
+#endif /* VARIANT_CANCELABLE */
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)sleep.c    8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
diff --git a/gen/FreeBSD/sleep.c.patch b/gen/FreeBSD/sleep.c.patch
deleted file mode 100644 (file)
index 291c010..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- sleep.c.orig       2009-11-07 14:51:38.000000000 -0800
-+++ sleep.c    2009-11-07 14:51:40.000000000 -0800
-@@ -27,6 +27,11 @@
-  * SUCH DAMAGE.
-  */
-+#ifdef VARIANT_CANCELABLE
-+#undef __DARWIN_NON_CANCELABLE
-+#define __DARWIN_NON_CANCELABLE 0
-+#endif /* VARIANT_CANCELABLE */
-+
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)sleep.c   8.1 (Berkeley) 6/4/93";
- #endif /* LIBC_SCCS and not lint */
index fd369a094c5122c57d334001581edf4504bfeb25..c9f8426055033959756704d6654c375bdd2ecc5e 100644 (file)
 
 #include "rand48.h"
 
-extern unsigned short _rand48_seed[3];
-extern unsigned short _rand48_mult[3];
-extern unsigned short _rand48_add;
-
 void
 srand48(long seed)
 {
-       _rand48_seed[0] = RAND48_SEED_0;
-       _rand48_seed[1] = (unsigned short) seed;
-       _rand48_seed[2] = (unsigned short) (seed >> 16);
-       _rand48_mult[0] = RAND48_MULT_0;
-       _rand48_mult[1] = RAND48_MULT_1;
-       _rand48_mult[2] = RAND48_MULT_2;
+       _rand48_seed = TOUINT48(RAND48_SEED_0, (unsigned short) seed, (unsigned short) (seed >> 16));
+       _rand48_mult = RAND48_MULT;
        _rand48_add = RAND48_ADD;
 }
diff --git a/gen/FreeBSD/srand48.c.patch b/gen/FreeBSD/srand48.c.patch
deleted file mode 100644 (file)
index 89f6b7f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
---- srand48.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ srand48.c  2009-11-07 14:51:39.000000000 -0800
-@@ -13,18 +13,10 @@
- #include "rand48.h"
--extern unsigned short _rand48_seed[3];
--extern unsigned short _rand48_mult[3];
--extern unsigned short _rand48_add;
--
- void
- srand48(long seed)
- {
--      _rand48_seed[0] = RAND48_SEED_0;
--      _rand48_seed[1] = (unsigned short) seed;
--      _rand48_seed[2] = (unsigned short) (seed >> 16);
--      _rand48_mult[0] = RAND48_MULT_0;
--      _rand48_mult[1] = RAND48_MULT_1;
--      _rand48_mult[2] = RAND48_MULT_2;
-+      _rand48_seed = TOUINT48(RAND48_SEED_0, (unsigned short) seed, (unsigned short) (seed >> 16));
-+      _rand48_mult = RAND48_MULT;
-       _rand48_add = RAND48_ADD;
- }
index 309e163299651934dc51c776d1d4a7ce1a689594..2b9dc6cf9e81cb790371aa380f1a381d197a9ae3 100644 (file)
@@ -45,6 +45,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb
 #include <sys/sysctl.h>
 #include <sys/resource.h>
 #include <sys/socket.h>
+#include <sys/aio.h>
+#include <sys/semaphore.h>
 
 #include <errno.h>
 #include <limits.h>
@@ -53,8 +55,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb
 #include <time.h>
 #include <unistd.h>
 
-#include "../stdlib/atexit.h"
-#include "../stdtime/tzfile.h"
+#include "../../stdlib/FreeBSD/atexit.h"
+#include "../../stdtime/FreeBSD/tzfile.h"
 
 #define        _PATH_ZONEINFO  TZDIR   /* from tzfile.h */
 
@@ -75,8 +77,9 @@ sysconf(name)
        int name;
 {
        struct rlimit rl;
+       quad_t qdvalue; /* for kern.sysv.shmmin */
        size_t len;
-       int mib[2], sverrno, value;
+       int mib[3], sverrno, value;
        long defaultresult;
        const char *path;
 
@@ -254,76 +257,91 @@ do_NAME_MAX:
                return (_POSIX_TIMERS);
 #endif
        case _SC_AIO_LISTIO_MAX:
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_AIO_LISTIO_MAX;
-               break;
        case _SC_AIO_MAX:
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_AIO_MAX;
+               mib[0] = CTL_KERN;;
+               mib[1] = KERN_AIOMAX;
                break;
+
        case _SC_AIO_PRIO_DELTA_MAX:
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_AIO_PRIO_DELTA_MAX)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_AIO_PRIO_DELTA_MAX;
                break;
+#else
+               return (-1);
+#endif
        case _SC_DELAYTIMER_MAX:
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_DELAYTIMER_MAX)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_DELAYTIMER_MAX;
                goto yesno;
+#else
+               return (-1);
+#endif
        case _SC_MQ_OPEN_MAX:
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_MQ_OPEN_MAX)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_MQ_OPEN_MAX;
                goto yesno;
+#else
+               return (-1);
+#endif
        case _SC_PAGESIZE:
                defaultresult = getpagesize();
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_PAGESIZE)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_PAGESIZE;
                goto yesno;
+#else
+               return defaultresult;
+#endif
        case _SC_RTSIG_MAX:
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_RTSIG_MAX)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_RTSIG_MAX;
                goto yesno;
+#else
+               return (-1);
+#endif
        case _SC_SEM_NSEMS_MAX:
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX;
-               goto yesno;
+               return (sysctlbyname("kern.sysv.semmns", &value, &len, NULL, 0) == -1 ? -1 : value);
+
        case _SC_SEM_VALUE_MAX:
+#if SEM_VALUE_MAX == 0
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_SEM_VALUE_MAX;
                goto yesno;
+#else
+               return (SEM_VALUE_MAX);
+#endif
        case _SC_SIGQUEUE_MAX:
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_SIGQUEUE_MAX)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_SIGQUEUE_MAX;
                goto yesno;
+#else
+               return (-1);
+#endif
        case _SC_TIMER_MAX:
+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_TIMER_MAX)
                mib[0] = CTL_P1003_1B;
                mib[1] = CTL_P1003_1B_TIMER_MAX;
+#else
+               return (-1);
+#endif
 
 yesno:         if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
                        return (-1);
                if (value == 0)
                        return (defaultresult);
                return (value);
-
        case _SC_2_PBS:
        case _SC_2_PBS_ACCOUNTING:
        case _SC_2_PBS_CHECKPOINT:
        case _SC_2_PBS_LOCATE:
        case _SC_2_PBS_MESSAGE:
        case _SC_2_PBS_TRACK:
-#if _POSIX2_PBS == 0
-#error "don't know how to determine _SC_2_PBS"
-               /*
-                * This probably requires digging through the filesystem
-                * to see if the appropriate package has been installed.
-                * Since we don't currently support this option at all,
-                * it's not worth the effort to write the code now.
-                * Figuring out which of the sub-options are supported
-                * would be even more difficult, so it's probably easier
-                * to always say ``no''.
-                */
-#else
-               return (_POSIX2_PBS);
-#endif
+               return -1;
        case _SC_ADVISORY_INFO:
 #if _POSIX_ADVISORY_INFO == 0
 #error "_POSIX_ADVISORY_INFO"
@@ -348,18 +366,12 @@ yesno:            if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
 #else
                return (_POSIX_CPUTIME);
 #endif
-#ifdef notdef
        case _SC_FILE_LOCKING:
-               /*
-                * XXX - The standard doesn't tell us how to define
-                * _POSIX_FILE_LOCKING, so we can't answer this one.
-                */
-#endif
-#if _POSIX_THREAD_SAFE_FUNCTIONS > -1
        case _SC_GETGR_R_SIZE_MAX:
+/*             return sizeof(group) + group_name_max + group_passwd_max + max_group_member*(MAXLOGNAME+1); */
+               return 4096;    /* INT_MAX is too big for Perl */
        case _SC_GETPW_R_SIZE_MAX:
-#error "somebody needs to implement this"
-#endif
+               return 4096;
        case _SC_HOST_NAME_MAX:
                return (MAXHOSTNAMELEN - 1); /* does not include \0 */
        case _SC_LOGIN_NAME_MAX:
@@ -370,10 +382,8 @@ yesno:             if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
 #else
                return (_POSIX_MONOTONIC_CLOCK);
 #endif
-#if _POSIX_MESSAGE_PASSING > -1
        case _SC_MQ_PRIO_MAX:
-               return (MQ_PRIO_MAX);
-#endif
+               return (-1);
        case _SC_READER_WRITER_LOCKS:
                return (_POSIX_READER_WRITER_LOCKS);
        case _SC_REGEXP:
@@ -410,10 +420,16 @@ yesno:            if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
                return (_POSIX_THREAD_PROCESS_SHARED);
        case _SC_THREAD_SAFE_FUNCTIONS:
                return (_POSIX_THREAD_SAFE_FUNCTIONS);
+       case _SC_THREAD_SPORADIC_SERVER:
+               return (_POSIX_THREAD_SPORADIC_SERVER);
        case _SC_THREAD_STACK_MIN:
                return (PTHREAD_STACK_MIN);
        case _SC_THREAD_THREADS_MAX:
+#ifdef PTHREAD_THREADS_MAX
                return (PTHREAD_THREADS_MAX); /* XXX wrong type! */
+#else
+               return (-1);
+#endif
        case _SC_TIMEOUTS:
                return (_POSIX_TIMEOUTS);
        case _SC_THREADS:
@@ -425,16 +441,14 @@ yesno:            if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
 #else
                return (_POSIX_TRACE);
 #endif
-#if _POSIX_TRACE > -1
        case _SC_TRACE_EVENT_FILTER:
                return (_POSIX_TRACE_EVENT_FILTER);
        case _SC_TRACE_INHERIT:
                return (_POSIX_TRACE_INHERIT);
        case _SC_TRACE_LOG:
                return (_POSIX_TRACE_LOG);
-#endif
        case _SC_TTY_NAME_MAX:
-               path = _PATH_DEV;
+               path = "/"; // should be _PATH_DEV (PR-3624562)
                goto do_NAME_MAX;
        case _SC_TYPED_MEMORY_OBJECTS:
 #if _POSIX_TYPED_MEMORY_OBJECTS == 0
@@ -491,11 +505,15 @@ yesno:            if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
                return (_V6_LPBIG_OFFBIG);
 #endif
        case _SC_ATEXIT_MAX:
-               return (ATEXIT_SIZE);
+               return (INT_MAX);       /* unlimited */
        case _SC_IOV_MAX:
+#ifdef KERN_IOV_MAX
                mib[0] = CTL_KERN;
                mib[1] = KERN_IOV_MAX;
                break;
+#else
+               return (IOV_MAX);
+#endif
        case _SC_XOPEN_CRYPT:
                return (_XOPEN_CRYPT);
        case _SC_XOPEN_ENH_I18N:
@@ -531,7 +549,8 @@ yesno:              if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
 #endif
        case _SC_XOPEN_SHM:
                sverrno = errno;
-               if (sysctlbyname("kern.ipc.shmmin", &value, &len, NULL, 
+               len = sizeof(qdvalue);
+               if (sysctlbyname("kern.sysv.shmmin", &qdvalue, &len, NULL, 
                    0) == -1) {
                        errno = sverrno;
                        return (-1);
@@ -568,11 +587,37 @@ yesno:            if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
                return (_POSIX_IPV6);
 #endif
 
+#ifdef _SC_NPROCESSORS_CONF
        case _SC_NPROCESSORS_CONF:
+#endif
+#ifdef _SC_NPROCESSORS_ONLN
        case _SC_NPROCESSORS_ONLN:
+#endif
+#if defined(_SC_NPROCESSORS_CONF) || defined(_SC_NPROCESSORS_ONLN)
                mib[0] = CTL_HW;
                mib[1] = HW_NCPU;
                break;
+#endif
+       case _SC_XBS5_ILP32_OFF32:
+               return (_XBS5_ILP32_OFF32);
+       case _SC_XBS5_ILP32_OFFBIG:
+               return (_XBS5_ILP32_OFFBIG);
+       case _SC_XBS5_LP64_OFF64:
+               return (_XBS5_LP64_OFF64);
+       case _SC_XBS5_LPBIG_OFFBIG:
+               return (_XBS5_LPBIG_OFFBIG);
+       case _SC_SS_REPL_MAX:
+               return (_POSIX_SS_REPL_MAX);
+       case _SC_TRACE_EVENT_NAME_MAX:
+               return (_POSIX_TRACE_EVENT_NAME_MAX);
+       case _SC_TRACE_NAME_MAX:
+               return (_POSIX_TRACE_NAME_MAX);
+       case _SC_TRACE_SYS_MAX:
+               return (_POSIX_TRACE_SYS_MAX);
+       case _SC_TRACE_USER_EVENT_MAX:
+               return (_POSIX_TRACE_USER_EVENT_MAX);
+       case _SC_PASS_MAX:
+               return (PASS_MAX);
 
        default:
                errno = EINVAL;
diff --git a/gen/FreeBSD/sysconf.c.patch b/gen/FreeBSD/sysconf.c.patch
deleted file mode 100644 (file)
index a392a42..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
---- sysconf.c.orig     2007-04-03 12:19:23.000000000 -0700
-+++ sysconf.c  2007-04-05 11:33:36.000000000 -0700
-@@ -45,6 +45,8 @@
- #include <sys/sysctl.h>
- #include <sys/resource.h>
- #include <sys/socket.h>
-+#include <sys/aio.h>
-+#include <sys/semaphore.h>
- #include <errno.h>
- #include <limits.h>
-@@ -75,8 +77,9 @@
-       int name;
- {
-       struct rlimit rl;
-+      quad_t qdvalue; /* for kern.sysv.shmmin */
-       size_t len;
--      int mib[2], sverrno, value;
-+      int mib[3], sverrno, value;
-       long defaultresult;
-       const char *path;
-@@ -254,76 +257,91 @@
-               return (_POSIX_TIMERS);
- #endif
-       case _SC_AIO_LISTIO_MAX:
--              mib[0] = CTL_P1003_1B;
--              mib[1] = CTL_P1003_1B_AIO_LISTIO_MAX;
--              break;
-       case _SC_AIO_MAX:
--              mib[0] = CTL_P1003_1B;
--              mib[1] = CTL_P1003_1B_AIO_MAX;
-+              mib[0] = CTL_KERN;;
-+              mib[1] = KERN_AIOMAX;
-               break;
-+
-       case _SC_AIO_PRIO_DELTA_MAX:
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_AIO_PRIO_DELTA_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_AIO_PRIO_DELTA_MAX;
-               break;
-+#else
-+              return (-1);
-+#endif
-       case _SC_DELAYTIMER_MAX:
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_DELAYTIMER_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_DELAYTIMER_MAX;
-               goto yesno;
-+#else
-+              return (-1);
-+#endif
-       case _SC_MQ_OPEN_MAX:
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_MQ_OPEN_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_MQ_OPEN_MAX;
-               goto yesno;
-+#else
-+              return (-1);
-+#endif
-       case _SC_PAGESIZE:
-               defaultresult = getpagesize();
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_PAGESIZE)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_PAGESIZE;
-               goto yesno;
-+#else
-+              return defaultresult;
-+#endif
-       case _SC_RTSIG_MAX:
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_RTSIG_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_RTSIG_MAX;
-               goto yesno;
-+#else
-+              return (-1);
-+#endif
-       case _SC_SEM_NSEMS_MAX:
--              mib[0] = CTL_P1003_1B;
--              mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX;
--              goto yesno;
-+              return (sysctlbyname("kern.sysv.semmns", &value, &len, NULL, 0) == -1 ? -1 : value);
-+
-       case _SC_SEM_VALUE_MAX:
-+#if SEM_VALUE_MAX == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SEM_VALUE_MAX;
-               goto yesno;
-+#else
-+              return (SEM_VALUE_MAX);
-+#endif
-       case _SC_SIGQUEUE_MAX:
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_SIGQUEUE_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SIGQUEUE_MAX;
-               goto yesno;
-+#else
-+              return (-1);
-+#endif
-       case _SC_TIMER_MAX:
-+#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_TIMER_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_TIMER_MAX;
-+#else
-+              return (-1);
-+#endif
- yesno:                if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
-                       return (-1);
-               if (value == 0)
-                       return (defaultresult);
-               return (value);
--
-       case _SC_2_PBS:
-       case _SC_2_PBS_ACCOUNTING:
-       case _SC_2_PBS_CHECKPOINT:
-       case _SC_2_PBS_LOCATE:
-       case _SC_2_PBS_MESSAGE:
-       case _SC_2_PBS_TRACK:
--#if _POSIX2_PBS == 0
--#error "don't know how to determine _SC_2_PBS"
--              /*
--               * This probably requires digging through the filesystem
--               * to see if the appropriate package has been installed.
--               * Since we don't currently support this option at all,
--               * it's not worth the effort to write the code now.
--               * Figuring out which of the sub-options are supported
--               * would be even more difficult, so it's probably easier
--               * to always say ``no''.
--               */
--#else
--              return (_POSIX2_PBS);
--#endif
-+              return -1;
-       case _SC_ADVISORY_INFO:
- #if _POSIX_ADVISORY_INFO == 0
- #error "_POSIX_ADVISORY_INFO"
-@@ -348,18 +366,12 @@
- #else
-               return (_POSIX_CPUTIME);
- #endif
--#ifdef notdef
-       case _SC_FILE_LOCKING:
--              /*
--               * XXX - The standard doesn't tell us how to define
--               * _POSIX_FILE_LOCKING, so we can't answer this one.
--               */
--#endif
--#if _POSIX_THREAD_SAFE_FUNCTIONS > -1
-       case _SC_GETGR_R_SIZE_MAX:
-+/*            return sizeof(group) + group_name_max + group_passwd_max + max_group_member*(MAXLOGNAME+1); */
-+              return 4096;    /* INT_MAX is too big for Perl */
-       case _SC_GETPW_R_SIZE_MAX:
--#error "somebody needs to implement this"
--#endif
-+              return 4096;
-       case _SC_HOST_NAME_MAX:
-               return (MAXHOSTNAMELEN - 1); /* does not include \0 */
-       case _SC_LOGIN_NAME_MAX:
-@@ -370,10 +382,8 @@
- #else
-               return (_POSIX_MONOTONIC_CLOCK);
- #endif
--#if _POSIX_MESSAGE_PASSING > -1
-       case _SC_MQ_PRIO_MAX:
--              return (MQ_PRIO_MAX);
--#endif
-+              return (-1);
-       case _SC_READER_WRITER_LOCKS:
-               return (_POSIX_READER_WRITER_LOCKS);
-       case _SC_REGEXP:
-@@ -410,10 +420,16 @@
-               return (_POSIX_THREAD_PROCESS_SHARED);
-       case _SC_THREAD_SAFE_FUNCTIONS:
-               return (_POSIX_THREAD_SAFE_FUNCTIONS);
-+      case _SC_THREAD_SPORADIC_SERVER:
-+              return (_POSIX_THREAD_SPORADIC_SERVER);
-       case _SC_THREAD_STACK_MIN:
-               return (PTHREAD_STACK_MIN);
-       case _SC_THREAD_THREADS_MAX:
-+#ifdef PTHREAD_THREADS_MAX
-               return (PTHREAD_THREADS_MAX); /* XXX wrong type! */
-+#else
-+              return (-1);
-+#endif
-       case _SC_TIMEOUTS:
-               return (_POSIX_TIMEOUTS);
-       case _SC_THREADS:
-@@ -425,16 +441,14 @@
- #else
-               return (_POSIX_TRACE);
- #endif
--#if _POSIX_TRACE > -1
-       case _SC_TRACE_EVENT_FILTER:
-               return (_POSIX_TRACE_EVENT_FILTER);
-       case _SC_TRACE_INHERIT:
-               return (_POSIX_TRACE_INHERIT);
-       case _SC_TRACE_LOG:
-               return (_POSIX_TRACE_LOG);
--#endif
-       case _SC_TTY_NAME_MAX:
--              path = _PATH_DEV;
-+              path = "/"; // should be _PATH_DEV (PR-3624562)
-               goto do_NAME_MAX;
-       case _SC_TYPED_MEMORY_OBJECTS:
- #if _POSIX_TYPED_MEMORY_OBJECTS == 0
-@@ -491,11 +505,15 @@
-               return (_V6_LPBIG_OFFBIG);
- #endif
-       case _SC_ATEXIT_MAX:
--              return (ATEXIT_SIZE);
-+              return (INT_MAX);       /* unlimited */
-       case _SC_IOV_MAX:
-+#ifdef KERN_IOV_MAX
-               mib[0] = CTL_KERN;
-               mib[1] = KERN_IOV_MAX;
-               break;
-+#else
-+              return (IOV_MAX);
-+#endif
-       case _SC_XOPEN_CRYPT:
-               return (_XOPEN_CRYPT);
-       case _SC_XOPEN_ENH_I18N:
-@@ -531,7 +549,8 @@
- #endif
-       case _SC_XOPEN_SHM:
-               sverrno = errno;
--              if (sysctlbyname("kern.ipc.shmmin", &value, &len, NULL, 
-+              len = sizeof(qdvalue);
-+              if (sysctlbyname("kern.sysv.shmmin", &qdvalue, &len, NULL, 
-                   0) == -1) {
-                       errno = sverrno;
-                       return (-1);
-@@ -568,11 +587,37 @@
-               return (_POSIX_IPV6);
- #endif
-+#ifdef _SC_NPROCESSORS_CONF
-       case _SC_NPROCESSORS_CONF:
-+#endif
-+#ifdef _SC_NPROCESSORS_ONLN
-       case _SC_NPROCESSORS_ONLN:
-+#endif
-+#if defined(_SC_NPROCESSORS_CONF) || defined(_SC_NPROCESSORS_ONLN)
-               mib[0] = CTL_HW;
-               mib[1] = HW_NCPU;
-               break;
-+#endif
-+      case _SC_XBS5_ILP32_OFF32:
-+              return (_XBS5_ILP32_OFF32);
-+      case _SC_XBS5_ILP32_OFFBIG:
-+              return (_XBS5_ILP32_OFFBIG);
-+      case _SC_XBS5_LP64_OFF64:
-+              return (_XBS5_LP64_OFF64);
-+      case _SC_XBS5_LPBIG_OFFBIG:
-+              return (_XBS5_LPBIG_OFFBIG);
-+      case _SC_SS_REPL_MAX:
-+              return (_POSIX_SS_REPL_MAX);
-+      case _SC_TRACE_EVENT_NAME_MAX:
-+              return (_POSIX_TRACE_EVENT_NAME_MAX);
-+      case _SC_TRACE_NAME_MAX:
-+              return (_POSIX_TRACE_NAME_MAX);
-+      case _SC_TRACE_SYS_MAX:
-+              return (_POSIX_TRACE_SYS_MAX);
-+      case _SC_TRACE_USER_EVENT_MAX:
-+              return (_POSIX_TRACE_USER_EVENT_MAX);
-+      case _SC_PASS_MAX:
-+              return (PASS_MAX);
-       default:
-               errno = EINVAL;
index 2598715ebe060b446d12ed260c16375943a308ec..8c8e4bc75549eee98fde1c2ab7c71618daa64b0c 100644 (file)
@@ -32,7 +32,7 @@
 .\"    @(#)sysctl.3    8.4 (Berkeley) 5/9/95
 .\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.63 2004/07/02 23:52:10 ru Exp $
 .\"
-.Dd January 23, 2001
+.Dd October 21, 2008
 .Dt SYSCTL 3
 .Os
 .Sh NAME
@@ -182,13 +182,21 @@ for (i = 0; i < 100; i++) {
 }
 .Ed
 .Pp
+Note:  Implementation of
+.Fn printkproc
+-- to print whatever data deemed necessary from the large
+.Vt kinfo_proc
+structure (
+.In sys/sysctl.h
+) -- is left as an exercise for the reader.
+.Pp
 The top level names are defined with a CTL_ prefix in
 .In sys/sysctl.h ,
 and are as follows.
 The next and subsequent levels down are found in the include files
 listed here, and described in separate sections below.
 .Pp
-.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
+.Bl -column CTLXMACHDEP "Next level names" -offset indent
 .It Sy "Name   Next level names        Description"
 .It "CTL_DEBUG sys/sysctl.h    Debugging"
 .It "CTL_VFS   sys/mount.h     File system"
@@ -197,7 +205,8 @@ listed here, and described in separate sections below.
 .It "CTL_MACHDEP       sys/sysctl.h    Machine dependent"
 .It "CTL_NET   sys/socket.h    Networking"
 .It "CTL_USER  sys/sysctl.h    User-level"
-.It "CTL_VM    vm/vm_param.h   Virtual memory"
+.It "CTL_VM    sys/resources.h Virtual memory (struct loadavg)"
+.It "CTL_VM    sys/vmmeter.h   Virtual memory (struct vmtotal)"
 .El
 .Pp
 For example, the following retrieves the maximum number of processes allowed
@@ -279,7 +288,7 @@ privilege may change the value.
 .It Sy "Second level name      Type    Changeable"
 .It "HW_MACHINE        string  no"
 .It "HW_MODEL  string  no"
-.It "HW_NCPU   integer no"
+.It "HW_NCPU   integer no (DEPRECATED)"
 .It "HW_BYTEORDER      integer no"
 .It "HW_PHYSMEM        integer no"
 .It "HW_MEMSIZE        integer no"
@@ -296,8 +305,16 @@ privilege may change the value.
 The machine class.
 .It Li HW_MODEL
 The machine model
-.It Li HW_NCPU
-The number of cpus.
+.It Li HW_NCPU (DEPRECATED)
+The number of cpus.  It is recommended that you use "hw.physicalcpu" "hw.physicalcpu_max" "hw.logicalcpu" or "hw.logicalcpu_max" instead.
+.It Li "hw.physicalcpu"
+The number of physical processors available in the current power management mode.
+.It Li "hw.physicalcpu_max"
+The maximum number of physical processors that could be available this boot.
+.It Li "hw.logicalcpu"
+The number of logical processors available in the current power management mode.
+.It Li "hw.logicalcpu_max"
+The maximum number of logical processors that could be available this boot.
 .It Li HW_BYTEORDER
 The byteorder (4,321, or 1,234).
 .It Li HW_PHYSMEM
@@ -346,7 +363,7 @@ information.
 .It "KERN_OSREV        integer no"
 .It "KERN_OSTYPE       string  no"
 .It "KERN_POSIX1       integer no"
-.It "KERN_PROC struct proc     no"
+.It "KERN_PROC struct kinfo_proc       no"
 .It "KERN_PROF node    not applicable"
 .It "KERN_QUANTUM      integer yes"
 .It "KERN_SAVED_IDS    integer no"
@@ -440,10 +457,8 @@ with which the system
 attempts to comply.
 .It Li KERN_PROC
 Return the entire process table, or a subset of it.
-An array of pairs of
-.Va struct proc
-followed by corresponding
-.Va struct eproc
+An array of
+.Va struct kinfo_proc
 structures is returned,
 whose size depends on the current number of such objects in the system.
 The third and fourth level names are as follows:
@@ -456,16 +471,6 @@ The third and fourth level names are as follows:
 .It "KERN_PROC_UID     A user ID"
 .It "KERN_PROC_RUID    A real user ID"
 .El
-.Pp
-If the third level name is KERN_PROC_ARGS then the command line argument
-array is returned in a flattened form, i.e., zero-terminated arguments
-follow each other.
-The total size of array is returned.
-It is also possible for a process to set its own process title this way.
-.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
-.It Sy "Third level name       Fourth level is:"
-.It "KERN_PROC_ARGS    A process ID"
-.El
 .It Li KERN_PROF
 Return profiling information about the kernel.
 If the kernel is not compiled for profiling,
@@ -731,7 +736,6 @@ privilege may change the value.
 .Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
 .It Sy "Second level name      Type    Changeable"
 .It "VM_LOADAVG        struct loadavg  no"
-.It "VM_METER  struct vmtotal  no"
 .It "VM_PAGEOUT_ALGORITHM      integer yes"
 .It "VM_SWAPPING_ENABLED       integer maybe"
 .It "VM_V_CACHE_MAX    integer yes"
@@ -748,10 +752,6 @@ privilege may change the value.
 Return the load average history.
 The returned data consists of a
 .Va struct loadavg .
-.It Li VM_METER
-Return the system wide virtual memory statistics.
-The returned data consists of a
-.Va struct vmtotal .
 .It Li VM_PAGEOUT_ALGORITHM
 0 if the statistics-based page management algorithm is in use
 or 1 if the near-LRU algorithm is in use.
@@ -848,7 +848,7 @@ identifiers, and user level identifiers
 definitions for second level network identifiers
 .It In sys/gmon.h
 definitions for third level profiling identifiers
-.It In vm/vm_param.h
+.It In mach/vm_param.h
 definitions for second level virtual memory identifiers
 .It In netinet/in.h
 definitions for third level IPv4/IPv6 identifiers and
diff --git a/gen/FreeBSD/sysctl.3.patch b/gen/FreeBSD/sysctl.3.patch
deleted file mode 100644 (file)
index 876b362..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
---- sysctl.3.orig      2010-04-28 23:38:49.000000000 -0700
-+++ sysctl.3   2010-04-29 10:13:28.000000000 -0700
-@@ -32,7 +32,7 @@
- .\"   @(#)sysctl.3    8.4 (Berkeley) 5/9/95
- .\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.63 2004/07/02 23:52:10 ru Exp $
- .\"
--.Dd January 23, 2001
-+.Dd October 21, 2008
- .Dt SYSCTL 3
- .Os
- .Sh NAME
-@@ -182,13 +182,21 @@ for (i = 0; i < 100; i++) {
- }
- .Ed
- .Pp
-+Note:  Implementation of
-+.Fn printkproc
-+-- to print whatever data deemed necessary from the large
-+.Vt kinfo_proc
-+structure (
-+.In sys/sysctl.h
-+) -- is left as an exercise for the reader.
-+.Pp
- The top level names are defined with a CTL_ prefix in
- .In sys/sysctl.h ,
- and are as follows.
- The next and subsequent levels down are found in the include files
- listed here, and described in separate sections below.
- .Pp
--.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
-+.Bl -column CTLXMACHDEP "Next level names" -offset indent
- .It Sy "Name  Next level names        Description"
- .It "CTL_DEBUG        sys/sysctl.h    Debugging"
- .It "CTL_VFS  sys/mount.h     File system"
-@@ -197,7 +205,8 @@ listed here, and described in separate s
- .It "CTL_MACHDEP      sys/sysctl.h    Machine dependent"
- .It "CTL_NET  sys/socket.h    Networking"
- .It "CTL_USER sys/sysctl.h    User-level"
--.It "CTL_VM   vm/vm_param.h   Virtual memory"
-+.It "CTL_VM   sys/resources.h Virtual memory (struct loadavg)"
-+.It "CTL_VM   sys/vmmeter.h   Virtual memory (struct vmtotal)"
- .El
- .Pp
- For example, the following retrieves the maximum number of processes allowed
-@@ -279,7 +288,7 @@ privilege may change the value.
- .It Sy "Second level name     Type    Changeable"
- .It "HW_MACHINE       string  no"
- .It "HW_MODEL string  no"
--.It "HW_NCPU  integer no"
-+.It "HW_NCPU  integer no (DEPRECATED)"
- .It "HW_BYTEORDER     integer no"
- .It "HW_PHYSMEM       integer no"
- .It "HW_MEMSIZE       integer no"
-@@ -296,8 +305,16 @@ privilege may change the value.
- The machine class.
- .It Li HW_MODEL
- The machine model
--.It Li HW_NCPU
--The number of cpus.
-+.It Li HW_NCPU (DEPRECATED)
-+The number of cpus.  It is recommended that you use "hw.physicalcpu" "hw.physicalcpu_max" "hw.logicalcpu" or "hw.logicalcpu_max" instead.
-+.It Li "hw.physicalcpu"
-+The number of physical processors available in the current power management mode.
-+.It Li "hw.physicalcpu_max"
-+The maximum number of physical processors that could be available this boot.
-+.It Li "hw.logicalcpu"
-+The number of logical processors available in the current power management mode.
-+.It Li "hw.logicalcpu_max"
-+The maximum number of logical processors that could be available this boot.
- .It Li HW_BYTEORDER
- The byteorder (4,321, or 1,234).
- .It Li HW_PHYSMEM
-@@ -346,7 +363,7 @@ information.
- .It "KERN_OSREV       integer no"
- .It "KERN_OSTYPE      string  no"
- .It "KERN_POSIX1      integer no"
--.It "KERN_PROC        struct proc     no"
-+.It "KERN_PROC        struct kinfo_proc       no"
- .It "KERN_PROF        node    not applicable"
- .It "KERN_QUANTUM     integer yes"
- .It "KERN_SAVED_IDS   integer no"
-@@ -440,10 +457,8 @@ with which the system
- attempts to comply.
- .It Li KERN_PROC
- Return the entire process table, or a subset of it.
--An array of pairs of
--.Va struct proc
--followed by corresponding
--.Va struct eproc
-+An array of
-+.Va struct kinfo_proc
- structures is returned,
- whose size depends on the current number of such objects in the system.
- The third and fourth level names are as follows:
-@@ -456,16 +471,6 @@ The third and fourth level names are as 
- .It "KERN_PROC_UID    A user ID"
- .It "KERN_PROC_RUID   A real user ID"
- .El
--.Pp
--If the third level name is KERN_PROC_ARGS then the command line argument
--array is returned in a flattened form, i.e., zero-terminated arguments
--follow each other.
--The total size of array is returned.
--It is also possible for a process to set its own process title this way.
--.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
--.It Sy "Third level name      Fourth level is:"
--.It "KERN_PROC_ARGS   A process ID"
--.El
- .It Li KERN_PROF
- Return profiling information about the kernel.
- If the kernel is not compiled for profiling,
-@@ -731,7 +736,6 @@ privilege may change the value.
- .Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
- .It Sy "Second level name     Type    Changeable"
- .It "VM_LOADAVG       struct loadavg  no"
--.It "VM_METER struct vmtotal  no"
- .It "VM_PAGEOUT_ALGORITHM     integer yes"
- .It "VM_SWAPPING_ENABLED      integer maybe"
- .It "VM_V_CACHE_MAX   integer yes"
-@@ -748,10 +752,6 @@ privilege may change the value.
- Return the load average history.
- The returned data consists of a
- .Va struct loadavg .
--.It Li VM_METER
--Return the system wide virtual memory statistics.
--The returned data consists of a
--.Va struct vmtotal .
- .It Li VM_PAGEOUT_ALGORITHM
- 0 if the statistics-based page management algorithm is in use
- or 1 if the near-LRU algorithm is in use.
-@@ -848,7 +848,7 @@ identifiers, and user level identifiers
- definitions for second level network identifiers
- .It In sys/gmon.h
- definitions for third level profiling identifiers
--.It In vm/vm_param.h
-+.It In mach/vm_param.h
- definitions for second level virtual memory identifiers
- .It In netinet/in.h
- definitions for third level IPv4/IPv6 identifiers and
index 66d82d04c7150e2c52cf5451bef93586da533de9..7205820f6882a422b37593f3b500d2e723e969c4 100644 (file)
@@ -53,8 +53,34 @@ sysctl(name, namelen, oldp, oldlenp, newp, newlen)
        void *oldp, *newp;
        size_t *oldlenp, newlen;
 {
-       if (name[0] != CTL_USER)
+       if (name[0] != CTL_USER) {
+               if (namelen == 2 && name[0] == CTL_KERN && name[1] == KERN_EXEC) {
+                       /*
+                        * 7723306: intercept kern.exec and fake a return of
+                        * a dummy string ("/" in this case)
+                        */
+                       if (newp != NULL) {
+                               errno = EPERM;
+                               return -1;
+                       }
+                       if (oldp == NULL) {
+                               if (oldlenp != NULL) *oldlenp = 2;
+                               return 0;
+                       }
+                       if (oldlenp == NULL) {
+                               errno = EFAULT;
+                               return -1;
+                       }
+                       if (*oldlenp < 2) {
+                               errno = ENOMEM;
+                               return -1;
+                       }
+                       memmove(oldp, "/", 2);
+                       *oldlenp = 2;
+                       return 0;
+               }
                return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
+       }
 
        if (newp != NULL) {
                errno = EPERM;
diff --git a/gen/FreeBSD/sysctl.c.patch b/gen/FreeBSD/sysctl.c.patch
deleted file mode 100644 (file)
index 7fa1c90..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
---- sysctl.c.orig      2010-06-30 01:03:07.000000000 -0700
-+++ sysctl.c   2010-07-01 23:10:13.000000000 -0700
-@@ -53,8 +53,34 @@ sysctl(name, namelen, oldp, oldlenp, new
-       void *oldp, *newp;
-       size_t *oldlenp, newlen;
- {
--      if (name[0] != CTL_USER)
-+      if (name[0] != CTL_USER) {
-+              if (namelen == 2 && name[0] == CTL_KERN && name[1] == KERN_EXEC) {
-+                      /*
-+                       * 7723306: intercept kern.exec and fake a return of
-+                       * a dummy string ("/" in this case)
-+                       */
-+                      if (newp != NULL) {
-+                              errno = EPERM;
-+                              return -1;
-+                      }
-+                      if (oldp == NULL) {
-+                              if (oldlenp != NULL) *oldlenp = 2;
-+                              return 0;
-+                      }
-+                      if (oldlenp == NULL) {
-+                              errno = EFAULT;
-+                              return -1;
-+                      }
-+                      if (*oldlenp < 2) {
-+                              errno = ENOMEM;
-+                              return -1;
-+                      }
-+                      memmove(oldp, "/", 2);
-+                      *oldlenp = 2;
-+                      return 0;
-+              }
-               return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
-+      }
-       if (newp != NULL) {
-               errno = EPERM;
index 9ed3413c3d4798ec50707ab299bcb4ec89a2cbda..355ed50e4fc2615fab9646f8b7ccd4717ec16468 100644 (file)
@@ -50,7 +50,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.11 2008/05/05 14:05:23 kib Ex
  * cookie may be used only once before it is freed. This option
  * is used to avoid having memory usage grow without bound.
  */
+#if !__DARWIN_UNIX03
 #define SINGLEUSE
+#endif /* !__DARWIN_UNIX03 */
 
 /*
  * return a pointer into a directory
@@ -61,14 +63,41 @@ telldir(dirp)
 {
        struct ddloc *lp;
 
+#if __DARWIN_UNIX03
+       if (__isthreaded)
+               _pthread_mutex_lock(&dirp->dd_lock);
+       LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) {
+               if (
+#if __DARWIN_64_BIT_INO_T
+                   (lp->loc_seek == dirp->dd_td->seekoff)
+#else /* !__DARWIN_64_BIT_INO_T */
+                   (lp->loc_seek == dirp->dd_seek)
+#endif /* __DARWIN_64_BIT_INO_T */
+                   && (lp->loc_loc == dirp->dd_loc))
+                       goto found;
+       }
+       if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) {
+               if (__isthreaded)
+                       _pthread_mutex_unlock(&dirp->dd_lock);
+               return (-1);
+       }
+#else /* !__DARWIN_UNIX03 */
        if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL)
                return (-1);
        if (__isthreaded)
                _pthread_mutex_lock(&dirp->dd_lock);
+#endif /* __DARWIN_UNIX03 */
        lp->loc_index = dirp->dd_td->td_loccnt++;
+#if __DARWIN_64_BIT_INO_T
+       lp->loc_seek = dirp->dd_td->seekoff;
+#else /* !__DARWIN_64_BIT_INO_T */
        lp->loc_seek = dirp->dd_seek;
+#endif /* __DARWIN_64_BIT_INO_T */
        lp->loc_loc = dirp->dd_loc;
        LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe);
+#if __DARWIN_UNIX03
+found:
+#endif /* __DARWIN_UNIX03 */
        if (__isthreaded)
                _pthread_mutex_unlock(&dirp->dd_lock);
        return (lp->loc_index);
@@ -92,23 +121,34 @@ _seekdir(dirp, loc)
        }
        if (lp == NULL)
                return;
-       if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
+       if (lp->loc_loc == dirp->dd_loc && 
+#if __DARWIN_64_BIT_INO_T
+           lp->loc_seek == dirp->dd_td->seekoff
+#else /* !__DARWIN_64_BIT_INO_T */
+           lp->loc_seek == dirp->dd_seek
+#endif /* __DARWIN_64_BIT_INO_T */
+       )
                goto found;
        (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET);
+#if __DARWIN_64_BIT_INO_T
+       dirp->dd_td->seekoff = lp->loc_seek;
+#else /* !__DARWIN_64_BIT_INO_T */
        dirp->dd_seek = lp->loc_seek;
+#endif /* __DARWIN_64_BIT_INO_T */
        dirp->dd_loc = 0;
        while (dirp->dd_loc < lp->loc_loc) {
                dp = _readdir_unlocked(dirp, 0);
                if (dp == NULL)
                        break;
        }
-found:
+found:;
 #ifdef SINGLEUSE
        LIST_REMOVE(lp, loc_lqe);
        free((caddr_t)lp);
 #endif
 }
 
+#ifndef BUILDING_VARIANT
 /*
  * Reclaim memory for telldir cookies which weren't used.
  */
@@ -127,3 +167,4 @@ _reclaim_telldir(dirp)
        }
        LIST_INIT(&dirp->dd_td->td_locq);
 }
+#endif /* !BUILDING_VARIANT */
diff --git a/gen/FreeBSD/telldir.c.patch b/gen/FreeBSD/telldir.c.patch
deleted file mode 100644 (file)
index f73f1f2..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
---- telldir.c.orig     2009-11-08 14:02:31.000000000 -0800
-+++ telldir.c  2009-11-08 14:02:24.000000000 -0800
-@@ -50,7 +50,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/tel
-  * cookie may be used only once before it is freed. This option
-  * is used to avoid having memory usage grow without bound.
-  */
-+#if !__DARWIN_UNIX03
- #define SINGLEUSE
-+#endif /* !__DARWIN_UNIX03 */
- /*
-  * return a pointer into a directory
-@@ -61,14 +63,41 @@ telldir(dirp)
- {
-       struct ddloc *lp;
-+#if __DARWIN_UNIX03
-+      if (__isthreaded)
-+              _pthread_mutex_lock(&dirp->dd_lock);
-+      LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) {
-+              if (
-+#if __DARWIN_64_BIT_INO_T
-+                  (lp->loc_seek == dirp->dd_td->seekoff)
-+#else /* !__DARWIN_64_BIT_INO_T */
-+                  (lp->loc_seek == dirp->dd_seek)
-+#endif /* __DARWIN_64_BIT_INO_T */
-+                  && (lp->loc_loc == dirp->dd_loc))
-+                      goto found;
-+      }
-+      if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) {
-+              if (__isthreaded)
-+                      _pthread_mutex_unlock(&dirp->dd_lock);
-+              return (-1);
-+      }
-+#else /* !__DARWIN_UNIX03 */
-       if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL)
-               return (-1);
-       if (__isthreaded)
-               _pthread_mutex_lock(&dirp->dd_lock);
-+#endif /* __DARWIN_UNIX03 */
-       lp->loc_index = dirp->dd_td->td_loccnt++;
-+#if __DARWIN_64_BIT_INO_T
-+      lp->loc_seek = dirp->dd_td->seekoff;
-+#else /* !__DARWIN_64_BIT_INO_T */
-       lp->loc_seek = dirp->dd_seek;
-+#endif /* __DARWIN_64_BIT_INO_T */
-       lp->loc_loc = dirp->dd_loc;
-       LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe);
-+#if __DARWIN_UNIX03
-+found:
-+#endif /* __DARWIN_UNIX03 */
-       if (__isthreaded)
-               _pthread_mutex_unlock(&dirp->dd_lock);
-       return (lp->loc_index);
-@@ -92,23 +121,34 @@ _seekdir(dirp, loc)
-       }
-       if (lp == NULL)
-               return;
--      if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek)
-+      if (lp->loc_loc == dirp->dd_loc && 
-+#if __DARWIN_64_BIT_INO_T
-+          lp->loc_seek == dirp->dd_td->seekoff
-+#else /* !__DARWIN_64_BIT_INO_T */
-+          lp->loc_seek == dirp->dd_seek
-+#endif /* __DARWIN_64_BIT_INO_T */
-+      )
-               goto found;
-       (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET);
-+#if __DARWIN_64_BIT_INO_T
-+      dirp->dd_td->seekoff = lp->loc_seek;
-+#else /* !__DARWIN_64_BIT_INO_T */
-       dirp->dd_seek = lp->loc_seek;
-+#endif /* __DARWIN_64_BIT_INO_T */
-       dirp->dd_loc = 0;
-       while (dirp->dd_loc < lp->loc_loc) {
-               dp = _readdir_unlocked(dirp, 0);
-               if (dp == NULL)
-                       break;
-       }
--found:
-+found:;
- #ifdef SINGLEUSE
-       LIST_REMOVE(lp, loc_lqe);
-       free((caddr_t)lp);
- #endif
- }
-+#ifndef BUILDING_VARIANT
- /*
-  * Reclaim memory for telldir cookies which weren't used.
-  */
-@@ -127,3 +167,4 @@ _reclaim_telldir(dirp)
-       }
-       LIST_INIT(&dirp->dd_td->td_locq);
- }
-+#endif /* !BUILDING_VARIANT */
index 93b18933654ce07a71f5b58318d6dc87b4e4f7e7..c1f0ad07b6e1c34e03ab84e825d75c8ef8dd2af2 100644 (file)
 struct ddloc {
        LIST_ENTRY(ddloc) loc_lqe; /* entry in list */
        long    loc_index;      /* key associated with structure */
+#if __DARWIN_64_BIT_INO_T
+       __darwin_off_t  loc_seek;       /* returned by lseek */
+#else /* !__DARWIN_64_BIT_INO_T */
        long    loc_seek;       /* magic cookie returned by getdirentries */
+#endif /* __DARWIN_64_BIT_INO_T */
        long    loc_loc;        /* offset of entry in buffer */
 };
 
@@ -57,10 +61,17 @@ struct ddloc {
 struct _telldir {
        LIST_HEAD(, ddloc) td_locq; /* list of locations */
        long    td_loccnt;      /* index of entry for sequential readdir's */
+#if __DARWIN_64_BIT_INO_T
+       __darwin_off_t seekoff; /* 64-bit seek offset */
+#endif /* __DARWIN_64_BIT_INO_T */
 };
 
-struct dirent  *_readdir_unlocked(DIR *, int);
+#if __DARWIN_64_BIT_INO_T
+size_t         __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep);
+#endif /* __DARWIN_64_BIT_INO_T */
+struct dirent  *_readdir_unlocked(DIR *, int) __DARWIN_INODE64(_readdir_unlocked);
 void           _reclaim_telldir(DIR *);
-void           _seekdir(DIR *, long);
+void           _seekdir(DIR *, long) __DARWIN_ALIAS_I(_seekdir);
+long           telldir(DIR *) __DARWIN_ALIAS_I(telldir);
 
 #endif
diff --git a/gen/FreeBSD/telldir.h.patch b/gen/FreeBSD/telldir.h.patch
deleted file mode 100644 (file)
index ca64554..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- telldir.h.orig     2009-11-08 13:57:20.000000000 -0800
-+++ telldir.h  2009-11-08 13:57:11.000000000 -0800
-@@ -46,7 +46,11 @@
- struct ddloc {
-       LIST_ENTRY(ddloc) loc_lqe; /* entry in list */
-       long    loc_index;      /* key associated with structure */
-+#if __DARWIN_64_BIT_INO_T
-+      __darwin_off_t  loc_seek;       /* returned by lseek */
-+#else /* !__DARWIN_64_BIT_INO_T */
-       long    loc_seek;       /* magic cookie returned by getdirentries */
-+#endif /* __DARWIN_64_BIT_INO_T */
-       long    loc_loc;        /* offset of entry in buffer */
- };
-@@ -57,10 +61,17 @@ struct ddloc {
- struct _telldir {
-       LIST_HEAD(, ddloc) td_locq; /* list of locations */
-       long    td_loccnt;      /* index of entry for sequential readdir's */
-+#if __DARWIN_64_BIT_INO_T
-+      __darwin_off_t seekoff; /* 64-bit seek offset */
-+#endif /* __DARWIN_64_BIT_INO_T */
- };
--struct dirent *_readdir_unlocked(DIR *, int);
-+#if __DARWIN_64_BIT_INO_T
-+size_t                __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep);
-+#endif /* __DARWIN_64_BIT_INO_T */
-+struct dirent *_readdir_unlocked(DIR *, int) __DARWIN_INODE64(_readdir_unlocked);
- void          _reclaim_telldir(DIR *);
--void          _seekdir(DIR *, long);
-+void          _seekdir(DIR *, long) __DARWIN_ALIAS_I(_seekdir);
-+long          telldir(DIR *) __DARWIN_ALIAS_I(telldir);
- #endif
index b79489a5c9819eddbeded1d7723784c535acd98d..ab540d6798bc37264acac8e99e222d579d087ca3 100644 (file)
@@ -33,6 +33,14 @@ static char sccsid[] = "@(#)termios.c        8.2 (Berkeley) 2/21/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.16 2009/05/07 13:49:48 ed Exp $");
 
+#if __DARWIN_UNIX03
+#ifdef VARIANT_CANCELABLE
+#include <pthread.h>
+
+extern void _pthread_testcancel(pthread_t thread, int isconforming);
+#endif /* VARIANT_CANCELABLE */
+#endif /* __DARWIN_UNIX03 */
+
 #include "namespace.h"
 #include <sys/types.h>
 #include <sys/fcntl.h>
@@ -44,6 +52,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.16 2009/05/07 13:49:48 ed Exp
 #include <unistd.h>
 #include "un-namespace.h"
 
+#ifndef BUILDING_VARIANT
 int
 tcgetattr(fd, t)
        int fd;
@@ -83,6 +92,9 @@ tcsetpgrp(int fd, pid_t pgrp)
 {
        int s;
 
+       if (isatty(fd) == 0)
+               return (-1);
+
        s = pgrp;
        return (_ioctl(fd, TIOCSPGRP, &s));
 }
@@ -93,12 +105,16 @@ tcgetpgrp(fd)
 {
        int s;
 
+       if (isatty(fd) == 0)
+               return ((pid_t)-1);
+
        if (_ioctl(fd, TIOCGPGRP, &s) < 0)
                return ((pid_t)-1);
 
        return ((pid_t)s);
 }
 
+#if 0 // Needs API review first
 pid_t
 tcgetsid(int fd)
 {
@@ -121,6 +137,7 @@ tcsetsid(int fd, pid_t pid)
 
        return (_ioctl(fd, TIOCSCTTY, NULL));
 }
+#endif
 
 speed_t
 cfgetospeed(t)
@@ -202,17 +219,24 @@ tcsendbreak(fd, len)
                return (-1);
        return (0);
 }
+#endif /* BUILDING_VARIANT */
 
 int
 __tcdrain(fd)
        int fd;
 {
+#if __DARWIN_UNIX03
+#ifdef VARIANT_CANCELABLE
+       _pthread_testcancel(pthread_self(), 1);
+#endif /* VARIANT_CANCELABLE */
+#endif /* __DARWIN_UNIX03 */
        return (_ioctl(fd, TIOCDRAIN, 0));
 }
 
 __weak_reference(__tcdrain, tcdrain);
 __weak_reference(__tcdrain, _tcdrain);
 
+#ifndef BUILDING_VARIANT
 int
 tcflush(fd, which)
        int fd, which;
@@ -249,16 +273,13 @@ tcflow(fd, action)
        case TCOON:
                return (_ioctl(fd, TIOCSTART, 0));
        case TCION:
+               return (_ioctl(fd, TIOCIXON, 0));
        case TCIOFF:
-               if (tcgetattr(fd, &term) == -1)
-                       return (-1);
-               c = term.c_cc[action == TCIOFF ? VSTOP : VSTART];
-               if (c != _POSIX_VDISABLE && _write(fd, &c, sizeof(c)) == -1)
-                       return (-1);
-               return (0);
+               return (_ioctl(fd, TIOCIXOFF, 0));
        default:
                errno = EINVAL;
                return (-1);
        }
        /* NOTREACHED */
 }
+#endif /* BUILDING_VARIANT */
diff --git a/gen/FreeBSD/termios.c.patch b/gen/FreeBSD/termios.c.patch
deleted file mode 100644 (file)
index 880c37d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
---- termios.c.orig     2009-11-08 16:27:01.000000000 -0800
-+++ termios.c  2009-11-08 16:28:15.000000000 -0800
-@@ -33,6 +33,14 @@ static char sccsid[] = "@(#)termios.c       8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.16 2009/05/07 13:49:48 ed Exp $");
-+#if __DARWIN_UNIX03
-+#ifdef VARIANT_CANCELABLE
-+#include <pthread.h>
-+
-+extern void _pthread_testcancel(pthread_t thread, int isconforming);
-+#endif /* VARIANT_CANCELABLE */
-+#endif /* __DARWIN_UNIX03 */
-+
- #include "namespace.h"
- #include <sys/types.h>
- #include <sys/fcntl.h>
-@@ -44,6 +52,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/ter
- #include <unistd.h>
- #include "un-namespace.h"
-+#ifndef BUILDING_VARIANT
- int
- tcgetattr(fd, t)
-       int fd;
-@@ -83,6 +92,9 @@ tcsetpgrp(int fd, pid_t pgrp)
- {
-       int s;
-+      if (isatty(fd) == 0)
-+              return (-1);
-+
-       s = pgrp;
-       return (_ioctl(fd, TIOCSPGRP, &s));
- }
-@@ -93,12 +105,16 @@ tcgetpgrp(fd)
- {
-       int s;
-+      if (isatty(fd) == 0)
-+              return ((pid_t)-1);
-+
-       if (_ioctl(fd, TIOCGPGRP, &s) < 0)
-               return ((pid_t)-1);
-       return ((pid_t)s);
- }
-+#if 0 // Needs API review first
- pid_t
- tcgetsid(int fd)
- {
-@@ -121,6 +137,7 @@ tcsetsid(int fd, pid_t pid)
-       return (_ioctl(fd, TIOCSCTTY, NULL));
- }
-+#endif
- speed_t
- cfgetospeed(t)
-@@ -202,17 +219,24 @@ tcsendbreak(fd, len)
-               return (-1);
-       return (0);
- }
-+#endif /* BUILDING_VARIANT */
- int
- __tcdrain(fd)
-       int fd;
- {
-+#if __DARWIN_UNIX03
-+#ifdef VARIANT_CANCELABLE
-+      _pthread_testcancel(pthread_self(), 1);
-+#endif /* VARIANT_CANCELABLE */
-+#endif /* __DARWIN_UNIX03 */
-       return (_ioctl(fd, TIOCDRAIN, 0));
- }
- __weak_reference(__tcdrain, tcdrain);
- __weak_reference(__tcdrain, _tcdrain);
-+#ifndef BUILDING_VARIANT
- int
- tcflush(fd, which)
-       int fd, which;
-@@ -249,16 +273,13 @@ tcflow(fd, action)
-       case TCOON:
-               return (_ioctl(fd, TIOCSTART, 0));
-       case TCION:
-+              return (_ioctl(fd, TIOCIXON, 0));
-       case TCIOFF:
--              if (tcgetattr(fd, &term) == -1)
--                      return (-1);
--              c = term.c_cc[action == TCIOFF ? VSTOP : VSTART];
--              if (c != _POSIX_VDISABLE && _write(fd, &c, sizeof(c)) == -1)
--                      return (-1);
--              return (0);
-+              return (_ioctl(fd, TIOCIXOFF, 0));
-       default:
-               errno = EINVAL;
-               return (-1);
-       }
-       /* NOTREACHED */
- }
-+#endif /* BUILDING_VARIANT */
index 6b63883b2b023a669b4ef08684eb4821c2126013..e69453753266df75a30bdd65003d2e64f1ff4728 100644 (file)
@@ -49,7 +49,8 @@ The
 .Fn time
 function
 returns the value of time in seconds since 0 hours, 0 minutes,
-0 seconds, January 1, 1970, Coordinated Universal Time.
+0 seconds, January 1, 1970, Coordinated Universal Time,
+without including leap seconds.
 If an error occurs,
 .Fn time
 returns the value
diff --git a/gen/FreeBSD/time.3.patch b/gen/FreeBSD/time.3.patch
deleted file mode 100644 (file)
index f8e5d2e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- time.3.orig        2009-11-07 14:51:38.000000000 -0800
-+++ time.3     2009-11-07 14:51:40.000000000 -0800
-@@ -49,7 +49,8 @@ The
- .Fn time
- function
- returns the value of time in seconds since 0 hours, 0 minutes,
--0 seconds, January 1, 1970, Coordinated Universal Time.
-+0 seconds, January 1, 1970, Coordinated Universal Time,
-+without including leap seconds.
- If an error occurs,
- .Fn time
- returns the value
index 4ab423891734e318ae6cb37b3fb984a2cc1b0c46..d77e38a9156a3baa59b3f774033a030555f70223 100644 (file)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/time.c,v 1.5 2007/01/09 00:27:55 imp Exp $"
 
 #include <sys/types.h>
 #include <sys/time.h>
+#include <fenv.h>
 
 time_t
 time(t)
@@ -42,12 +43,21 @@ time(t)
 {
        struct timeval tt;
        time_t retval;
+#ifdef FE_DFL_ENV
+       fenv_t fenv;
+#endif /* FE_DFL_ENV */
 
+#ifdef FE_DFL_ENV
+       fegetenv(&fenv); /* 3965505 - need to preserve floating point enviroment */
+#endif /* FE_DFL_ENV */
        if (gettimeofday(&tt, (struct timezone *)0) < 0)
                retval = -1;
        else
                retval = tt.tv_sec;
        if (t != NULL)
                *t = retval;
+#ifdef FE_DFL_ENV
+       fesetenv(&fenv);
+#endif /* FE_DFL_ENV */
        return (retval);
 }
diff --git a/gen/FreeBSD/time.c.patch b/gen/FreeBSD/time.c.patch
deleted file mode 100644 (file)
index 0e5a6e6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- time.c.orig        2009-11-07 14:51:38.000000000 -0800
-+++ time.c     2009-11-07 14:51:40.000000000 -0800
-@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/tim
- #include <sys/types.h>
- #include <sys/time.h>
-+#include <fenv.h>
- time_t
- time(t)
-@@ -42,12 +43,21 @@ time(t)
- {
-       struct timeval tt;
-       time_t retval;
-+#ifdef FE_DFL_ENV
-+      fenv_t fenv;
-+#endif /* FE_DFL_ENV */
-+#ifdef FE_DFL_ENV
-+      fegetenv(&fenv); /* 3965505 - need to preserve floating point enviroment */
-+#endif /* FE_DFL_ENV */
-       if (gettimeofday(&tt, (struct timezone *)0) < 0)
-               retval = -1;
-       else
-               retval = tt.tv_sec;
-       if (t != NULL)
-               *t = retval;
-+#ifdef FE_DFL_ENV
-+      fesetenv(&fenv);
-+#endif /* FE_DFL_ENV */
-       return (retval);
- }
index 6aa58c3d45d1a7cecf5c3053790cb929037e9b1c..f8e5f01d09ebb604763ed8ac6b9614176c732907 100644 (file)
@@ -43,7 +43,9 @@
 .Sh SYNOPSIS
 .In sys/times.h
 .Ft clock_t
-.Fn times "struct tms *tp"
+.Fo times
+.Fa "struct tms *buffer"
+.Fc
 .Sh DESCRIPTION
 .Bf -symbolic
 This interface is obsoleted by
@@ -61,7 +63,7 @@ of a second since
 Time.
 .Pp
 It also fills in the structure pointed to by
-.Fa tp
+.Fa buffer
 with time-accounting information.
 .Pp
 The
diff --git a/gen/FreeBSD/times.3.patch b/gen/FreeBSD/times.3.patch
deleted file mode 100644 (file)
index 619223e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- _SB/Libc/gen/FreeBSD/times.3       2003-05-20 15:21:03.000000000 -0700
-+++ _SB/Libc/gen/FreeBSD/times.3.edit  2006-06-28 16:55:51.000000000 -0700
-@@ -43,7 +43,9 @@
- .Sh SYNOPSIS
- .In sys/times.h
- .Ft clock_t
--.Fn times "struct tms *tp"
-+.Fo times
-+.Fa "struct tms *buffer"
-+.Fc
- .Sh DESCRIPTION
- .Bf -symbolic
- This interface is obsoleted by
-@@ -61,7 +63,7 @@
- Time.
- .Pp
- It also fills in the structure pointed to by
--.Fa tp
-+.Fa buffer
- with time-accounting information.
- .Pp
- The
index c1d1b4fd173a5364ef0042f03a39470d20a3ebd1..0012549ecc807fd55f83c4a965014b39d4c03f38 100644 (file)
 .Dt TTYNAME 3
 .Os
 .Sh NAME
-.Nm ttyname ,
 .Nm isatty ,
+.Nm ttyname ,
 .Nm ttyslot
 .Nd get name of associated terminal (tty) from file descriptor
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In unistd.h
-.Ft char *
-.Fn ttyname "int fd"
 .Ft int
-.Fn isatty "int fd"
+.Fo isatty
+.Fa "int fildes"
+.Fc
+.Ft char *
+.Fo ttyname
+.Fa "int fildes"
+.Fc
 .Ft int
-.Fn ttyslot void
+.Fo ttyslot
+.Fa void
+.Fc
 .Sh DESCRIPTION
 These functions operate on the system file descriptors for terminal
 type devices.
@@ -70,7 +76,7 @@ The
 .Fn isatty
 function
 determines if the file descriptor
-.Fa fd
+.Fa fildes
 refers to a valid
 terminal type device.
 .Pp
@@ -80,7 +86,7 @@ function
 gets the related device name of
 a file descriptor for which
 .Fn isatty
-is true
+is true.
 .Pp
 The
 .Fn ttyslot
@@ -94,16 +100,14 @@ The
 function
 returns the null terminated name if the device is found and
 .Fn isatty
-is true; otherwise
-a
+is true; otherwise, a
 .Dv NULL
 pointer is returned.
 .Pp
 The
 .Fn ttyslot
-function
-returns the unit number of the device file if found; otherwise
-the value zero is returned.
+function returns the unit number of the device file if found;
+otherwise, the value zero is returned.
 .Sh FILES
 .Bl -tag -width /etc/ttys -compact
 .It Pa /dev/\(**
diff --git a/gen/FreeBSD/ttyname.3.patch b/gen/FreeBSD/ttyname.3.patch
deleted file mode 100644 (file)
index 16e368b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
---- _SB/Libc/gen/FreeBSD/ttyname.3     2003-05-20 15:21:03.000000000 -0700
-+++ _SB/Libc/gen/FreeBSD/ttyname.3.edit        2006-06-28 16:55:51.000000000 -0700
-@@ -36,20 +36,26 @@
- .Dt TTYNAME 3
- .Os
- .Sh NAME
--.Nm ttyname ,
- .Nm isatty ,
-+.Nm ttyname ,
- .Nm ttyslot
- .Nd get name of associated terminal (tty) from file descriptor
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In unistd.h
--.Ft char *
--.Fn ttyname "int fd"
- .Ft int
--.Fn isatty "int fd"
-+.Fo isatty
-+.Fa "int fildes"
-+.Fc
-+.Ft char *
-+.Fo ttyname
-+.Fa "int fildes"
-+.Fc
- .Ft int
--.Fn ttyslot void
-+.Fo ttyslot
-+.Fa void
-+.Fc
- .Sh DESCRIPTION
- These functions operate on the system file descriptors for terminal
- type devices.
-@@ -70,7 +76,7 @@
- .Fn isatty
- function
- determines if the file descriptor
--.Fa fd
-+.Fa fildes
- refers to a valid
- terminal type device.
- .Pp
-@@ -80,7 +86,7 @@
- gets the related device name of
- a file descriptor for which
- .Fn isatty
--is true
-+is true.
- .Pp
- The
- .Fn ttyslot
-@@ -94,16 +100,14 @@
- function
- returns the null terminated name if the device is found and
- .Fn isatty
--is true; otherwise
--a
-+is true; otherwise, a
- .Dv NULL
- pointer is returned.
- .Pp
- The
- .Fn ttyslot
--function
--returns the unit number of the device file if found; otherwise
--the value zero is returned.
-+function returns the unit number of the device file if found;
-+otherwise, the value zero is returned.
- .Sh FILES
- .Bl -tag -width /etc/ttys -compact
- .It Pa /dev/\(**
index b4e52f7505c65f39b58a3bd153c1a07296ee34b8..aa5483aea8fd0281ccd0d14f5cc2e466c41ec03e 100644 (file)
@@ -48,11 +48,14 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/ttyname.c,v 1.16 2004/01/06 18:26:14 nectar
 #include <string.h>
 #include <paths.h>
 #include <pthread.h>
+#include <errno.h>
 #include "un-namespace.h"
 
 #include "libc_private.h"
 
-static char buf[sizeof(_PATH_DEV) + MAXNAMLEN];
+#ifndef BUILDING_VARIANT
+static pthread_once_t ttyname_buf_control = PTHREAD_ONCE_INIT;
+static char *buf = NULL;
 static char *ttyname_threaded(int fd);
 static char *ttyname_unthreaded(int fd);
 
@@ -71,31 +74,63 @@ ttyname(int fd)
                ret = ttyname_threaded(fd);
        return (ret);
 }
+#endif /* !BUILDING_VARIANT */
 
+#if __DARWIN_UNIX03
+int
+#else /* !__DARWIN_UNIX03 */
 char *
-ttyname_r(int fd, char *buf, size_t len)
+#endif /* __DARWIN_UNIX03 */
+ttyname_r(int fd, char *thrbuf, size_t len)
 {
        struct stat     sb;
-       char            *rval;
-
-       rval = NULL;
 
+#if __DARWIN_UNIX03
+       if (_fstat(fd, &sb) < 0)
+               return (EBADF);
        /* Must be a terminal. */
        if (!isatty(fd))
-               return (rval);
+               return (ENOTTY);
        /* Must be a character device. */
-       if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
-               return (rval);
+       if (!S_ISCHR(sb.st_mode))
+               return (ENOTTY);
        /* Must have enough room */
        if (len <= sizeof(_PATH_DEV))
-               return (rval);
-
-       strcpy(buf, _PATH_DEV);
-       devname_r(sb.st_rdev, S_IFCHR,
-           buf + strlen(buf), sizeof(buf) - strlen(buf));
-       return (buf);
+               return (ERANGE);
+#else /* !__DARWIN_UNIX03 */
+       /* Must be a terminal. */
+       if (!isatty(fd))
+               return (NULL);
+       /* Must be a character device. */
+       if (_fstat(fd, &sb))
+               return (NULL);
+       if (!S_ISCHR(sb.st_mode)) {
+               errno = ENOTTY;
+               return (NULL);
+       }
+       /* Must have enough room */
+       if (len <= sizeof(_PATH_DEV)) {
+               errno = ERANGE;
+               return (NULL);
+       }
+#endif /* __DARWIN_UNIX03 */
+
+       strlcpy(thrbuf, _PATH_DEV, len);
+       if (devname_r(sb.st_rdev, S_IFCHR,
+           thrbuf + strlen(thrbuf), len - strlen(thrbuf)) == NULL)
+#if __DARWIN_UNIX03
+               return (ERANGE);
+       return (0);
+#else /* !__DARWIN_UNIX03 */
+       {
+               errno = ERANGE;
+               return (NULL);
+       }
+       return (thrbuf);
+#endif /* __DARWIN_UNIX03 */
 }
 
+#ifndef BUILDING_VARIANT
 static char *
 ttyname_threaded(int fd)
 {
@@ -104,8 +139,12 @@ ttyname_threaded(int fd)
        if (ttyname_init == 0) {
                _pthread_mutex_lock(&ttyname_lock);
                if (ttyname_init == 0) {
-                       if (_pthread_key_create(&ttyname_key, free)) {
+                       /* __PTK_LIBC_TTYNAME_KEY */
+                       ttyname_key = __LIBC_PTHREAD_KEY_TTYNAME;
+                       if (pthread_key_init_np(ttyname_key, free)) {
+                               int save = errno;
                                _pthread_mutex_unlock(&ttyname_lock);
+                               errno = save;
                                return (NULL);
                        }
                        ttyname_init = 1;
@@ -117,14 +156,26 @@ ttyname_threaded(int fd)
        if ((buf = _pthread_getspecific(ttyname_key)) == NULL) {
                if ((buf = malloc(sizeof(_PATH_DEV) + MAXNAMLEN)) != NULL) {
                        if (_pthread_setspecific(ttyname_key, buf) != 0) {
+                               int save = errno;
                                free(buf);
+                               errno = save;
                                return (NULL);
                        }
                } else {
                        return (NULL);
                }
        }
+#if __DARWIN_UNIX03
+       return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN) == 0 ? buf : NULL);
+#else /* !__DARWIN_UNIX03 */
        return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN));
+#endif /* __DARWIN_UNIX03 */
+}
+
+static void
+ttyname_buf_allocate(void)
+{
+       buf = malloc(sizeof(_PATH_DEV) + MAXNAMLEN);
 }
 
 static char *
@@ -137,11 +188,25 @@ ttyname_unthreaded(int fd)
        if (tcgetattr(fd, &ttyb) < 0)
                return (NULL);
        /* Must be a character device. */
-       if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
+       if (_fstat(fd, &sb))
+               return (NULL);
+       if (!S_ISCHR(sb.st_mode)) {
+               errno = ENOTTY;
                return (NULL);
+       }
+
+       if (pthread_once(&ttyname_buf_control, ttyname_buf_allocate)
+               || !buf) {
+               errno = ENOMEM;
+               return (NULL);
+       }
 
-       strcpy(buf, _PATH_DEV);
-       devname_r(sb.st_rdev, S_IFCHR,
-           buf + strlen(buf), sizeof(buf) - strlen(buf));
+       strlcpy(buf, _PATH_DEV, sizeof(_PATH_DEV) + MAXNAMLEN);
+       if (devname_r(sb.st_rdev, S_IFCHR,
+               buf + strlen(buf), sizeof(_PATH_DEV) + MAXNAMLEN - strlen(buf)) == NULL) {
+               errno = ERANGE;
+               return (NULL);
+       }
        return (buf);
 }
+#endif /* !BUILDING_VARIANT */
diff --git a/gen/FreeBSD/ttyname.c.patch b/gen/FreeBSD/ttyname.c.patch
deleted file mode 100644 (file)
index 7871bc3..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
---- ttyname.c.orig     2010-05-01 19:18:09.000000000 -0700
-+++ ttyname.c  2010-05-03 10:18:47.000000000 -0700
-@@ -48,11 +48,14 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/tty
- #include <string.h>
- #include <paths.h>
- #include <pthread.h>
-+#include <errno.h>
- #include "un-namespace.h"
- #include "libc_private.h"
--static char buf[sizeof(_PATH_DEV) + MAXNAMLEN];
-+#ifndef BUILDING_VARIANT
-+static pthread_once_t ttyname_buf_control = PTHREAD_ONCE_INIT;
-+static char *buf = NULL;
- static char *ttyname_threaded(int fd);
- static char *ttyname_unthreaded(int fd);
-@@ -71,31 +74,63 @@ ttyname(int fd)
-               ret = ttyname_threaded(fd);
-       return (ret);
- }
-+#endif /* !BUILDING_VARIANT */
-+#if __DARWIN_UNIX03
-+int
-+#else /* !__DARWIN_UNIX03 */
- char *
--ttyname_r(int fd, char *buf, size_t len)
-+#endif /* __DARWIN_UNIX03 */
-+ttyname_r(int fd, char *thrbuf, size_t len)
- {
-       struct stat     sb;
--      char            *rval;
--
--      rval = NULL;
-+#if __DARWIN_UNIX03
-+      if (_fstat(fd, &sb) < 0)
-+              return (EBADF);
-       /* Must be a terminal. */
-       if (!isatty(fd))
--              return (rval);
-+              return (ENOTTY);
-       /* Must be a character device. */
--      if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
--              return (rval);
-+      if (!S_ISCHR(sb.st_mode))
-+              return (ENOTTY);
-       /* Must have enough room */
-       if (len <= sizeof(_PATH_DEV))
--              return (rval);
-+              return (ERANGE);
-+#else /* !__DARWIN_UNIX03 */
-+      /* Must be a terminal. */
-+      if (!isatty(fd))
-+              return (NULL);
-+      /* Must be a character device. */
-+      if (_fstat(fd, &sb))
-+              return (NULL);
-+      if (!S_ISCHR(sb.st_mode)) {
-+              errno = ENOTTY;
-+              return (NULL);
-+      }
-+      /* Must have enough room */
-+      if (len <= sizeof(_PATH_DEV)) {
-+              errno = ERANGE;
-+              return (NULL);
-+      }
-+#endif /* __DARWIN_UNIX03 */
--      strcpy(buf, _PATH_DEV);
--      devname_r(sb.st_rdev, S_IFCHR,
--          buf + strlen(buf), sizeof(buf) - strlen(buf));
--      return (buf);
-+      strlcpy(thrbuf, _PATH_DEV, len);
-+      if (devname_r(sb.st_rdev, S_IFCHR,
-+          thrbuf + strlen(thrbuf), len - strlen(thrbuf)) == NULL)
-+#if __DARWIN_UNIX03
-+              return (ERANGE);
-+      return (0);
-+#else /* !__DARWIN_UNIX03 */
-+      {
-+              errno = ERANGE;
-+              return (NULL);
-+      }
-+      return (thrbuf);
-+#endif /* __DARWIN_UNIX03 */
- }
-+#ifndef BUILDING_VARIANT
- static char *
- ttyname_threaded(int fd)
- {
-@@ -104,8 +139,12 @@ ttyname_threaded(int fd)
-       if (ttyname_init == 0) {
-               _pthread_mutex_lock(&ttyname_lock);
-               if (ttyname_init == 0) {
--                      if (_pthread_key_create(&ttyname_key, free)) {
-+                      /* __PTK_LIBC_TTYNAME_KEY */
-+                      ttyname_key = __LIBC_PTHREAD_KEY_TTYNAME;
-+                      if (pthread_key_init_np(ttyname_key, free)) {
-+                              int save = errno;
-                               _pthread_mutex_unlock(&ttyname_lock);
-+                              errno = save;
-                               return (NULL);
-                       }
-                       ttyname_init = 1;
-@@ -117,14 +156,26 @@ ttyname_threaded(int fd)
-       if ((buf = _pthread_getspecific(ttyname_key)) == NULL) {
-               if ((buf = malloc(sizeof(_PATH_DEV) + MAXNAMLEN)) != NULL) {
-                       if (_pthread_setspecific(ttyname_key, buf) != 0) {
-+                              int save = errno;
-                               free(buf);
-+                              errno = save;
-                               return (NULL);
-                       }
-               } else {
-                       return (NULL);
-               }
-       }
-+#if __DARWIN_UNIX03
-+      return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN) == 0 ? buf : NULL);
-+#else /* !__DARWIN_UNIX03 */
-       return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN));
-+#endif /* __DARWIN_UNIX03 */
-+}
-+
-+static void
-+ttyname_buf_allocate(void)
-+{
-+      buf = malloc(sizeof(_PATH_DEV) + MAXNAMLEN);
- }
- static char *
-@@ -137,11 +188,25 @@ ttyname_unthreaded(int fd)
-       if (tcgetattr(fd, &ttyb) < 0)
-               return (NULL);
-       /* Must be a character device. */
--      if (_fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
-+      if (_fstat(fd, &sb))
-+              return (NULL);
-+      if (!S_ISCHR(sb.st_mode)) {
-+              errno = ENOTTY;
-               return (NULL);
-+      }
-+
-+      if (pthread_once(&ttyname_buf_control, ttyname_buf_allocate)
-+              || !buf) {
-+              errno = ENOMEM;
-+              return (NULL);
-+      }
--      strcpy(buf, _PATH_DEV);
--      devname_r(sb.st_rdev, S_IFCHR,
--          buf + strlen(buf), sizeof(buf) - strlen(buf));
-+      strlcpy(buf, _PATH_DEV, sizeof(_PATH_DEV) + MAXNAMLEN);
-+      if (devname_r(sb.st_rdev, S_IFCHR,
-+              buf + strlen(buf), sizeof(_PATH_DEV) + MAXNAMLEN - strlen(buf)) == NULL) {
-+              errno = ERANGE;
-+              return (NULL);
-+      }
-       return (buf);
- }
-+#endif /* !BUILDING_VARIANT */
index 4b02cd9b16d77a93a092bd9cd0dbf88775c7f42a..01a681fa27e72acb605b7be77ee2f080e59d934e 100644 (file)
 .Sh SYNOPSIS
 .In unistd.h
 .Ft useconds_t
-.Fn ualarm "useconds_t microseconds" "useconds_t interval"
+.Fo ualarm
+.Fa "useconds_t useconds"
+.Fa "useconds_t interval"
+.Fc
 .Sh DESCRIPTION
 .Bf -symbolic
 This is a simplified interface to
@@ -50,7 +53,7 @@ The
 .Fn ualarm
 function
 waits a count of
-.Fa microseconds
+.Fa useconds
 before asserting the terminating signal
 .Dv SIGALRM .
 System activity or time used in processing the call may cause a slight
@@ -63,17 +66,17 @@ argument is non-zero, the
 signal will be sent
 to the process every
 .Fa interval
-microseconds after the timer expires (e.g.\& after
-.Fa microseconds
+microseconds after the timer expires (e.g., after
+.Fa useconds
 number of microseconds have passed).
 .Pp
-Due to
+Due to a
 .Xr setitimer 2
-restriction the maximum number of
-.Fa microseconds
+restriction, the maximum number of
+.Fa useconds
 and
 .Fa interval
-is limited to 100000000000000
+is limited to 100,000,000,000,000
 (in case this value fits in the unsigned integer).
 .Sh RETURN VALUES
 When the signal has successfully been caught,
diff --git a/gen/FreeBSD/ualarm.3.patch b/gen/FreeBSD/ualarm.3.patch
deleted file mode 100644 (file)
index 40f2ccb..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- ualarm.3.orig      2009-11-07 14:51:38.000000000 -0800
-+++ ualarm.3   2009-11-07 14:51:40.000000000 -0800
-@@ -39,7 +39,10 @@
- .Sh SYNOPSIS
- .In unistd.h
- .Ft useconds_t
--.Fn ualarm "useconds_t microseconds" "useconds_t interval"
-+.Fo ualarm
-+.Fa "useconds_t useconds"
-+.Fa "useconds_t interval"
-+.Fc
- .Sh DESCRIPTION
- .Bf -symbolic
- This is a simplified interface to
-@@ -50,7 +53,7 @@ The
- .Fn ualarm
- function
- waits a count of
--.Fa microseconds
-+.Fa useconds
- before asserting the terminating signal
- .Dv SIGALRM .
- System activity or time used in processing the call may cause a slight
-@@ -63,17 +66,17 @@ argument is non-zero, the
- signal will be sent
- to the process every
- .Fa interval
--microseconds after the timer expires (e.g.\& after
--.Fa microseconds
-+microseconds after the timer expires (e.g., after
-+.Fa useconds
- number of microseconds have passed).
- .Pp
--Due to
-+Due to a
- .Xr setitimer 2
--restriction the maximum number of
--.Fa microseconds
-+restriction, the maximum number of
-+.Fa useconds
- and
- .Fa interval
--is limited to 100000000000000
-+is limited to 100,000,000,000,000
- (in case this value fits in the unsigned integer).
- .Sh RETURN VALUES
- When the signal has successfully been caught,
index 3dc745f52643d8c567bc7211e1a614e95dc896fb..f19e15204a34983209bfd725e9cabdd01c05b02f 100644 (file)
 .Sh SYNOPSIS
 .In ulimit.h
 .Ft long
-.Fn ulimit "int cmd" "..."
+.Fo ulimit
+.Fa "int cmd"
+.Fa "..."
+.Fc
 .Sh DESCRIPTION
 The
 .Fn ulimit
 function will get and set process limits.
-Currently this is limited to the maximum file size.
+Currently, this is limited to the maximum file size.
 The
 .Fa cmd
 argument is one of the following:
 .Bl -tag -width ".Dv UL_GETFSIZE"
 .It Dv UL_GETFSIZE
-will return the maximum file size in units of 512 blocks of
-the current process.
+will return the maximum file size of the current process,
+in units of 512-byte blocks.
 .It Dv UL_SETFSIZE
 will attempt to set the maximum file size of the current
-process and its children with the second argument expressed as a long.
+process and its children, using the second argument (expressed as a long).
 .El
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn ulimit
 returns the value requested;
-otherwise the value \-1 is returned and the global variable
+otherwise, the value \-1 is returned and the global variable
 .Va errno
 is set to indicate the error.
 .Sh ERRORS
diff --git a/gen/FreeBSD/ulimit.3.patch b/gen/FreeBSD/ulimit.3.patch
deleted file mode 100644 (file)
index d81c748..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
---- ulimit.3.orig      2009-11-07 14:51:38.000000000 -0800
-+++ ulimit.3   2009-11-07 14:51:39.000000000 -0800
-@@ -34,28 +34,31 @@
- .Sh SYNOPSIS
- .In ulimit.h
- .Ft long
--.Fn ulimit "int cmd" "..."
-+.Fo ulimit
-+.Fa "int cmd"
-+.Fa "..."
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn ulimit
- function will get and set process limits.
--Currently this is limited to the maximum file size.
-+Currently, this is limited to the maximum file size.
- The
- .Fa cmd
- argument is one of the following:
- .Bl -tag -width ".Dv UL_GETFSIZE"
- .It Dv UL_GETFSIZE
--will return the maximum file size in units of 512 blocks of
--the current process.
-+will return the maximum file size of the current process,
-+in units of 512-byte blocks.
- .It Dv UL_SETFSIZE
- will attempt to set the maximum file size of the current
--process and its children with the second argument expressed as a long.
-+process and its children, using the second argument (expressed as a long).
- .El
- .Sh RETURN VALUES
- Upon successful completion,
- .Fn ulimit
- returns the value requested;
--otherwise the value \-1 is returned and the global variable
-+otherwise, the value \-1 is returned and the global variable
- .Va errno
- is set to indicate the error.
- .Sh ERRORS
index e9c045fcb61f2438c6eedaae93e6c35e8cda2cd8..da2efbf306237e90c74d4a48d96bdfef041020fa 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)unvis.c   8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <ctype.h>
 #include <vis.h>
@@ -60,6 +62,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp
 int
 unvis(char *cp, int c, int *astate, int flag)
 {
+       locale_t loc = __current_locale();
 
        if (flag & UNVIS_END) {
                if (*astate == S_OCTAL2 || *astate == S_OCTAL3) {
@@ -86,8 +89,8 @@ unvis(char *cp, int c, int *astate, int flag)
 
        case S_START:
                if (*astate & S_HTTP) {
-                   if (ishex(tolower(c))) {
-                       *cp = isdigit(c) ? (c - '0') : (tolower(c) - 'a');
+                   if (ishex(tolower_l(c, loc))) {
+                       *cp = isdigit_l(c, loc) ? (c - '0') : (tolower_l(c, loc) - 'a');
                        *astate = S_HEX2;
                        return (0);
                    }
@@ -212,8 +215,8 @@ unvis(char *cp, int c, int *astate, int flag)
                return (UNVIS_VALIDPUSH);
 
        case S_HEX2:    /* second mandatory hex digit */
-               if (ishex(tolower(c))) {
-                       *cp = (isdigit(c) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower(c) - 'a' + 10));
+               if (ishex(tolower_l(c, loc))) {
+                       *cp = (isdigit_l(c, loc) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower_l(c, loc) - 'a' + 10));
                }
                *astate = S_GROUND;
                return (UNVIS_VALID);
diff --git a/gen/FreeBSD/unvis.c.patch b/gen/FreeBSD/unvis.c.patch
deleted file mode 100644 (file)
index 5f139ef..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---- unvis.c.orig       2009-11-07 14:51:38.000000000 -0800
-+++ unvis.c    2009-11-07 14:51:40.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)unvis.c  8.1 
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <ctype.h>
- #include <vis.h>
-@@ -60,6 +62,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/unv
- int
- unvis(char *cp, int c, int *astate, int flag)
- {
-+      locale_t loc = __current_locale();
-       if (flag & UNVIS_END) {
-               if (*astate == S_OCTAL2 || *astate == S_OCTAL3) {
-@@ -86,8 +89,8 @@ unvis(char *cp, int c, int *astate, int 
-       case S_START:
-               if (*astate & S_HTTP) {
--                  if (ishex(tolower(c))) {
--                      *cp = isdigit(c) ? (c - '0') : (tolower(c) - 'a');
-+                  if (ishex(tolower_l(c, loc))) {
-+                      *cp = isdigit_l(c, loc) ? (c - '0') : (tolower_l(c, loc) - 'a');
-                       *astate = S_HEX2;
-                       return (0);
-                   }
-@@ -212,8 +215,8 @@ unvis(char *cp, int c, int *astate, int 
-               return (UNVIS_VALIDPUSH);
-       case S_HEX2:    /* second mandatory hex digit */
--              if (ishex(tolower(c))) {
--                      *cp = (isdigit(c) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower(c) - 'a' + 10));
-+              if (ishex(tolower_l(c, loc))) {
-+                      *cp = (isdigit_l(c, loc) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower_l(c, loc) - 'a' + 10));
-               }
-               *astate = S_GROUND;
-               return (UNVIS_VALID);
index dc6109689bd0e06df3c2e7591aeba60863408f43..e99b773da51ff826173c0670a2b0794b02468ba1 100644 (file)
 .Os
 .Sh NAME
 .Nm usleep
-.Nd suspend process execution for an interval measured in microseconds
+.Nd suspend thread execution for an interval measured in microseconds
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In unistd.h
 .Ft int
-.Fn usleep "useconds_t microseconds"
+.Fo usleep
+.Fa "useconds_t useconds"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn usleep
-function suspends execution of the calling process until either
-.Fa microseconds
-microseconds have elapsed or a signal is delivered to the process and its
-action is to invoke a signal-catching function or to terminate the
-process.
-System activity may lengthen the sleep by an indeterminate amount.
+function suspends execution of the calling thread until either
+.Fa useconds
+microseconds have elapsed
+or a signal is delivered to the thread whose action
+is to invoke a signal-catching function
+or to terminate the thread or process.
+The actual time slept may be longer, due to system latencies
+and possible limitations in the timer resolution of the hardware.
 .Pp
-This function is implemented using
-.Xr nanosleep 2
+This function is implemented, using
+.Xr nanosleep 2 ,
 by pausing for
-.Fa microseconds
+.Fa useconds
 microseconds or until a signal occurs.
 Consequently, in this implementation,
-sleeping has no effect on the state of process timers,
+sleeping has no effect on the state of process timers
 and there is no special handling for SIGALRM.
 .Sh RETURN VALUES
 .Rv -std usleep
diff --git a/gen/FreeBSD/usleep.3.patch b/gen/FreeBSD/usleep.3.patch
deleted file mode 100644 (file)
index 2a695e9..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
---- usleep.3.orig      2009-11-07 14:51:38.000000000 -0800
-+++ usleep.3   2009-11-07 14:51:40.000000000 -0800
-@@ -33,30 +33,34 @@
- .Os
- .Sh NAME
- .Nm usleep
--.Nd suspend process execution for an interval measured in microseconds
-+.Nd suspend thread execution for an interval measured in microseconds
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In unistd.h
- .Ft int
--.Fn usleep "useconds_t microseconds"
-+.Fo usleep
-+.Fa "useconds_t useconds"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn usleep
--function suspends execution of the calling process until either
--.Fa microseconds
--microseconds have elapsed or a signal is delivered to the process and its
--action is to invoke a signal-catching function or to terminate the
--process.
--System activity may lengthen the sleep by an indeterminate amount.
-+function suspends execution of the calling thread until either
-+.Fa useconds
-+microseconds have elapsed
-+or a signal is delivered to the thread whose action
-+is to invoke a signal-catching function
-+or to terminate the thread or process.
-+The actual time slept may be longer, due to system latencies
-+and possible limitations in the timer resolution of the hardware.
- .Pp
--This function is implemented using
--.Xr nanosleep 2
-+This function is implemented, using
-+.Xr nanosleep 2 ,
- by pausing for
--.Fa microseconds
-+.Fa useconds
- microseconds or until a signal occurs.
- Consequently, in this implementation,
--sleeping has no effect on the state of process timers,
-+sleeping has no effect on the state of process timers
- and there is no special handling for SIGALRM.
- .Sh RETURN VALUES
- .Rv -std usleep
index a4aa59c74cc406b9fd33e8d12b9a93b22a4f4bab..fc8054b100dfb073539af07a19402080ed87ec93 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef VARIANT_CANCELABLE
+#undef __DARWIN_NON_CANCELABLE
+#define __DARWIN_NON_CANCELABLE 0
+#endif /* VARIANT_CANCELABLE */
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)usleep.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
@@ -39,7 +44,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/usleep.c,v 1.31 2009/12/05 19:31:38 ed Exp
 #include "un-namespace.h"
 
 int
-__usleep(useconds_t useconds)
+usleep(useconds_t useconds)
 {
        struct timespec time_to_sleep;
 
@@ -47,6 +52,3 @@ __usleep(useconds_t useconds)
        time_to_sleep.tv_sec = useconds / 1000000;
        return (_nanosleep(&time_to_sleep, NULL));
 }
-
-__weak_reference(__usleep, usleep);
-__weak_reference(__usleep, _usleep);
diff --git a/gen/FreeBSD/usleep.c.patch b/gen/FreeBSD/usleep.c.patch
deleted file mode 100644 (file)
index 338b4ca..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- usleep.c.bsdnew    2009-12-08 00:38:07.000000000 -0800
-+++ usleep.c   2009-12-08 00:41:05.000000000 -0800
-@@ -27,6 +27,11 @@
-  * SUCH DAMAGE.
-  */
-+#ifdef VARIANT_CANCELABLE
-+#undef __DARWIN_NON_CANCELABLE
-+#define __DARWIN_NON_CANCELABLE 0
-+#endif /* VARIANT_CANCELABLE */
-+
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)usleep.c  8.1 (Berkeley) 6/4/93";
- #endif /* LIBC_SCCS and not lint */
-@@ -39,7 +44,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/usl
- #include "un-namespace.h"
- int
--__usleep(useconds_t useconds)
-+usleep(useconds_t useconds)
- {
-       struct timespec time_to_sleep;
-@@ -47,6 +52,3 @@ __usleep(useconds_t useconds)
-       time_to_sleep.tv_sec = useconds / 1000000;
-       return (_nanosleep(&time_to_sleep, NULL));
- }
--
--__weak_reference(__usleep, usleep);
--__weak_reference(__usleep, _usleep);
index 875fc83feb32ea98b3698d5a2a7ff3cfeebf52e6..c96ab2e335184613dae2c0c2241ea55d0d9bfdc4 100644 (file)
 .Sh SYNOPSIS
 .In utime.h
 .Ft int
-.Fn utime "const char *file" "const struct utimbuf *timep"
+.Fo utime
+.Fa "const char *path"
+.Fa "const struct utimbuf *times"
+.Fc
 .Sh DESCRIPTION
 .Bf -symbolic
 This interface is obsoleted by
@@ -48,28 +51,28 @@ This interface is obsoleted by
 .Pp
 The
 .Fn utime
-function sets the access and modification times of the named file from
-the
+function sets the access and modification times of the named file,
+based on the
 .Va actime
 and
 .Va modtime
 fields of the
 .Vt "struct utimbuf"
 pointed at by
-.Fa timep .
+.Fa times .
 .Pp
 If the times are specified (the
-.Fa timep
+.Fa times
 argument is
-.Pf non- Dv NULL )
+.Pf non- Dv NULL ) ,
 the caller must be the owner of the file or be the super-user.
 .Pp
 If the times are not specified (the
-.Fa timep
+.Fa times
 argument is
-.Dv NULL )
-the caller must be the owner of the file, have permission to write
-the file, or be the super-user.
+.Dv NULL ) ,
+the caller must be the owner of the file,
+have permission to write the file, or be the super-user.
 .Sh ERRORS
 The
 .Fn utime
diff --git a/gen/FreeBSD/utime.3.patch b/gen/FreeBSD/utime.3.patch
deleted file mode 100644 (file)
index 6e88ffe..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
---- utime.3.bsdnew     2009-11-08 14:20:21.000000000 -0800
-+++ utime.3    2009-11-08 14:32:59.000000000 -0800
-@@ -39,7 +39,10 @@
- .Sh SYNOPSIS
- .In utime.h
- .Ft int
--.Fn utime "const char *file" "const struct utimbuf *timep"
-+.Fo utime
-+.Fa "const char *path"
-+.Fa "const struct utimbuf *times"
-+.Fc
- .Sh DESCRIPTION
- .Bf -symbolic
- This interface is obsoleted by
-@@ -48,28 +51,28 @@ This interface is obsoleted by
- .Pp
- The
- .Fn utime
--function sets the access and modification times of the named file from
--the
-+function sets the access and modification times of the named file,
-+based on the
- .Va actime
- and
- .Va modtime
- fields of the
- .Vt "struct utimbuf"
- pointed at by
--.Fa timep .
-+.Fa times .
- .Pp
- If the times are specified (the
--.Fa timep
-+.Fa times
- argument is
--.Pf non- Dv NULL )
-+.Pf non- Dv NULL ) ,
- the caller must be the owner of the file or be the super-user.
- .Pp
- If the times are not specified (the
--.Fa timep
-+.Fa times
- argument is
--.Dv NULL )
--the caller must be the owner of the file, have permission to write
--the file, or be the super-user.
-+.Dv NULL ) ,
-+the caller must be the owner of the file,
-+have permission to write the file, or be the super-user.
- .Sh ERRORS
- The
- .Fn utime
index 94d1b22f0c8a6f184724062a72165335d2bf9abb..3a4b67c4ca24faaf9a8db6de70f9d313265931e7 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)vis.c     8.1 (Berkeley) 7/19/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <limits.h>
 #include <ctype.h>
@@ -50,18 +52,20 @@ vis(dst, c, flag, nextc)
        int c, nextc;
        int flag;
 {
+       locale_t loc = __current_locale();
+
        c = (unsigned char)c;
 
        if (flag & VIS_HTTPSTYLE) {
                /* Described in RFC 1808 */
-               if (!(isalnum(c) /* alpha-numeric */
+               if (!(isalnum_l(c, loc) /* alpha-numeric */
                    /* safe */
                    || c == '$' || c == '-' || c == '_' || c == '.' || c == '+'
                    /* extra */
                    || c == '!' || c == '*' || c == '\'' || c == '('
                    || c == ')' || c == ',')) {
                        *dst++ = '%';
-                       snprintf(dst, 4, (c < 16 ? "0%X" : "%X"), c);
+                       snprintf_l(dst, 4, loc, (c < 16 ? "0%X" : "%X"), c);
                        dst += 2;
                        goto done;
                }
@@ -70,7 +74,7 @@ vis(dst, c, flag, nextc)
        if ((flag & VIS_GLOB) &&
            (c == '*' || c == '?' || c == '[' || c == '#'))
                ;
-       else if (isgraph(c) ||
+       else if (isgraph_l(c, loc) ||
           ((flag & VIS_SP) == 0 && c == ' ') ||
           ((flag & VIS_TAB) == 0 && c == '\t') ||
           ((flag & VIS_NL) == 0 && c == '\n') ||
@@ -126,7 +130,7 @@ vis(dst, c, flag, nextc)
                        goto done;
                }
        }
-       if (((c & 0177) == ' ') || isgraph(c) || (flag & VIS_OCTAL)) {
+       if (((c & 0177) == ' ') || isgraph_l(c, loc) || (flag & VIS_OCTAL)) {
                *dst++ = '\\';
                *dst++ = ((u_char)c >> 6 & 07) + '0';
                *dst++ = ((u_char)c >> 3 & 07) + '0';
@@ -139,7 +143,7 @@ vis(dst, c, flag, nextc)
                c &= 0177;
                *dst++ = 'M';
        }
-       if (iscntrl(c)) {
+       if (iscntrl_l(c, loc)) {
                *dst++ = '^';
                if (c == 0177)
                        *dst++ = '?';
diff --git a/gen/FreeBSD/vis.c.patch b/gen/FreeBSD/vis.c.patch
deleted file mode 100644 (file)
index faf9578..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
---- vis.c.orig 2009-11-07 14:51:38.000000000 -0800
-+++ vis.c      2009-11-07 14:51:40.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)vis.c    8.1 (B
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <limits.h>
- #include <ctype.h>
-@@ -50,18 +52,20 @@ vis(dst, c, flag, nextc)
-       int c, nextc;
-       int flag;
- {
-+      locale_t loc = __current_locale();
-+
-       c = (unsigned char)c;
-       if (flag & VIS_HTTPSTYLE) {
-               /* Described in RFC 1808 */
--              if (!(isalnum(c) /* alpha-numeric */
-+              if (!(isalnum_l(c, loc) /* alpha-numeric */
-                   /* safe */
-                   || c == '$' || c == '-' || c == '_' || c == '.' || c == '+'
-                   /* extra */
-                   || c == '!' || c == '*' || c == '\'' || c == '('
-                   || c == ')' || c == ',')) {
-                       *dst++ = '%';
--                      snprintf(dst, 4, (c < 16 ? "0%X" : "%X"), c);
-+                      snprintf_l(dst, 4, loc, (c < 16 ? "0%X" : "%X"), c);
-                       dst += 2;
-                       goto done;
-               }
-@@ -70,7 +74,7 @@ vis(dst, c, flag, nextc)
-       if ((flag & VIS_GLOB) &&
-           (c == '*' || c == '?' || c == '[' || c == '#'))
-               ;
--      else if (isgraph(c) ||
-+      else if (isgraph_l(c, loc) ||
-          ((flag & VIS_SP) == 0 && c == ' ') ||
-          ((flag & VIS_TAB) == 0 && c == '\t') ||
-          ((flag & VIS_NL) == 0 && c == '\n') ||
-@@ -126,7 +130,7 @@ vis(dst, c, flag, nextc)
-                       goto done;
-               }
-       }
--      if (((c & 0177) == ' ') || isgraph(c) || (flag & VIS_OCTAL)) {
-+      if (((c & 0177) == ' ') || isgraph_l(c, loc) || (flag & VIS_OCTAL)) {
-               *dst++ = '\\';
-               *dst++ = ((u_char)c >> 6 & 07) + '0';
-               *dst++ = ((u_char)c >> 3 & 07) + '0';
-@@ -139,7 +143,7 @@ vis(dst, c, flag, nextc)
-               c &= 0177;
-               *dst++ = 'M';
-       }
--      if (iscntrl(c)) {
-+      if (iscntrl_l(c, loc)) {
-               *dst++ = '^';
-               if (c == 0177)
-                       *dst++ = '?';
index 46e7f72df66e92fa36c910f78adaf31d2b43579f..8bf2b1e5e89cff4704f5101745dd407085cb5aa2 100644 (file)
@@ -40,10 +40,20 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/wait.c,v 1.7 2007/01/09 00:27:56 imp Exp $"
 #include <sys/resource.h>
 #include "un-namespace.h"
 
+#ifdef VARIANT_CANCELABLE
+int __wait4(pid_t, int *, int , struct rusage *);
+#else /* !VARIANT_CANCELABLE */
+int __wait4_nocancel(pid_t, int *, int , struct rusage *);
+#endif /* VARIANT_CANCELABLE */
+
 pid_t
 __wait(int *istat)
 {
-       return (_wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
+#ifdef VARIANT_CANCELABLE
+       return (__wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
+#else /* !VARIANT_CANCELABLE */
+       return (__wait4_nocancel(WAIT_ANY, istat, 0, (struct rusage *)0));
+#endif /* VARIANT_CANCELABLE */
 }
 
 __weak_reference(__wait, wait);
diff --git a/gen/FreeBSD/wait.c.patch b/gen/FreeBSD/wait.c.patch
deleted file mode 100644 (file)
index 459adb3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
---- wait.c.orig        2009-11-07 14:51:38.000000000 -0800
-+++ wait.c     2009-11-07 14:51:40.000000000 -0800
-@@ -40,10 +40,20 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/wai
- #include <sys/resource.h>
- #include "un-namespace.h"
-+#ifdef VARIANT_CANCELABLE
-+int __wait4(pid_t, int *, int , struct rusage *);
-+#else /* !VARIANT_CANCELABLE */
-+int __wait4_nocancel(pid_t, int *, int , struct rusage *);
-+#endif /* VARIANT_CANCELABLE */
-+
- pid_t
- __wait(int *istat)
- {
--      return (_wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
-+#ifdef VARIANT_CANCELABLE
-+      return (__wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
-+#else /* !VARIANT_CANCELABLE */
-+      return (__wait4_nocancel(WAIT_ANY, istat, 0, (struct rusage *)0));
-+#endif /* VARIANT_CANCELABLE */
- }
- __weak_reference(__wait, wait);
index 47a06e8eb356a171f6728cfe0ca17873dca1c0b6..d81530f255617327841fa571d1011d7e41eb5506 100644 (file)
@@ -40,10 +40,31 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/waitpid.c,v 1.7 2007/01/09 00:27:56 imp Exp
 #include <sys/resource.h>
 #include "un-namespace.h"
 
+#if __DARWIN_UNIX03
+#include <errno.h>
+#endif /* __DARWIN_UNIX03 */
+#ifdef VARIANT_CANCELABLE
+int __wait4(pid_t, int *, int , struct rusage *);
+#else /* !VARIANT_CANCELABLE */
+int __wait4_nocancel(pid_t, int *, int , struct rusage *);
+#endif /* VARIANT_CANCELABLE */
+
 pid_t
 __waitpid(pid_t pid, int *istat, int options)
 {
-       return (_wait4(pid, istat, options, (struct rusage *)0));
+#if __DARWIN_UNIX03
+       /* POSIX: Validate waitpid() options before calling wait4() */
+       if ((options & (WCONTINUED | WNOHANG | WUNTRACED)) != options) {
+               errno = EINVAL;
+               return ((pid_t)-1);
+       }
+#endif /* __DARWIN_UNIX03 */
+
+#ifdef VARIANT_CANCELABLE
+       return (__wait4(pid, istat, options, (struct rusage *)0));
+#else /* !VARIANT_CANCELABLE */
+       return (__wait4_nocancel(pid, istat, options, (struct rusage *)0));
+#endif /* VARIANT_CANCELABLE */
 }
 
 __weak_reference(__waitpid, waitpid);
diff --git a/gen/FreeBSD/waitpid.c.patch b/gen/FreeBSD/waitpid.c.patch
deleted file mode 100644 (file)
index 13ebf93..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- waitpid.c.orig     2009-11-07 14:51:38.000000000 -0800
-+++ waitpid.c  2009-11-07 14:51:40.000000000 -0800
-@@ -40,10 +40,31 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/wai
- #include <sys/resource.h>
- #include "un-namespace.h"
-+#if __DARWIN_UNIX03
-+#include <errno.h>
-+#endif /* __DARWIN_UNIX03 */
-+#ifdef VARIANT_CANCELABLE
-+int __wait4(pid_t, int *, int , struct rusage *);
-+#else /* !VARIANT_CANCELABLE */
-+int __wait4_nocancel(pid_t, int *, int , struct rusage *);
-+#endif /* VARIANT_CANCELABLE */
-+
- pid_t
- __waitpid(pid_t pid, int *istat, int options)
- {
--      return (_wait4(pid, istat, options, (struct rusage *)0));
-+#if __DARWIN_UNIX03
-+      /* POSIX: Validate waitpid() options before calling wait4() */
-+      if ((options & (WCONTINUED | WNOHANG | WUNTRACED)) != options) {
-+              errno = EINVAL;
-+              return ((pid_t)-1);
-+      }
-+#endif        /* __DARWIN_UNIX03 */
-+
-+#ifdef VARIANT_CANCELABLE
-+      return (__wait4(pid, istat, options, (struct rusage *)0));
-+#else /* !VARIANT_CANCELABLE */
-+      return (__wait4_nocancel(pid, istat, options, (struct rusage *)0));
-+#endif /* VARIANT_CANCELABLE */
- }
- __weak_reference(__waitpid, waitpid);
diff --git a/gen/Makefile.inc b/gen/Makefile.inc
deleted file mode 100644 (file)
index 2edd5c1..0000000
+++ /dev/null
@@ -1,491 +0,0 @@
-#      @(#)Makefile.inc        8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.80 2001/08/17 22:09:15 dd Exp $
-
-# machine-dependent gen sources
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/gen/Makefile.inc"
-
-# machine-independent gen sources
-.PATH: ${.CURDIR}/gen
-CWD := ${.CURDIR}/gen
-
-CFLAGS += -I${.CURDIR}/gen
-
-GENMIGDEFS += asl_ipc.defs
-GENMIGHDRS += ${GENMIGDEFS:.defs=.h}
-GENMIGSRCS += ${GENMIGDEFS:.defs=User.c}
-
-MISRCS += ${GENMIGSRCS} NSSystemDirectories.c \
-       asl.c asl_core.c asl_file.c asl_legacy1.c asl_msg.c asl_store.c asl_util.c \
-       assumes.c \
-       backtrace.c \
-       cache.c confstr.c crypt.c devname.c disklabel.c errlst.c \
-       filesec.c fts.c \
-       get_compat.c getloadavg.c getttyent.c getusershell.c getvfsbyname.c \
-       isinf.c isnan.c \
-       malloc.c nanosleep.c nftw.c magazine_malloc.c setlogin.c \
-       sigsetops.c _simple.c stack_logging.c stack_logging_disk.c strtofflags.c syslog.c \
-       thread_stack_pcs.c uname.c utmpx-darwin.c wordexp.c \
-       platfunc.c
-
-.ifdef FEATURE_LEGACY_NXZONE_APIS
-MISRCS += zone.c
-.endif
-.if !defined(LP64)
-MISRCS += nlist.c
-.endif
-       
-# DTrace USDT probes placed in magazine_malloc.c and malloc.c
-${SYMROOTINC}/magmallocProvider.h: ${.CURDIR}/gen/magmallocProvider.d
-       ${DTRACE} -o ${.TARGET} -C -h -s ${.ALLSRC}
-magazine_malloc.${OBJSUFFIX}: ${SYMROOTINC}/magmallocProvider.h
-malloc.${OBJSUFFIX}: ${SYMROOTINC}/magmallocProvider.h
-
-# Force the ASL-related mig files to build first
-BUILDFIRST += asl_ipcUser.c
-
-CLEANFILES += ${GENMIGHDRS} ${GENMIGSRCS} ${GENMIGDEFS:.defs=Server.c}
-
-LOCALHDRS += \
-       ${.CURDIR}/gen/asl_core.h \
-       ${.CURDIR}/gen/asl_file.h \
-       ${.CURDIR}/gen/asl_ipc.defs \
-       ${.CURDIR}/gen/asl_legacy1.h \
-       ${.CURDIR}/gen/asl_msg.h \
-       ${.CURDIR}/gen/asl_private.h \
-       ${.CURDIR}/gen/asl_store.h \
-       ${.CURDIR}/gen/assumes.h \
-       ${.CURDIR}/gen/_simple.h \
-       ${.CURDIR}/gen/stack_logging.h \
-       ${.CURDIR}/gen/utmpx_thread.h
-
-CFLAGS-asl_file.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-asl_legacy1.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-asl_msg.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-asl_store.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-confstr.c += -I${.CURDIR}/darwin
-CFLAGS-fmtmsg-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-getcap-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-getttyent.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-getusershell.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-glob-fbsd.c += -UDEBUG
-
-# 4840357: workaround for compiler failure building libc_debug.a
-.if make(lib${LIB}_debug.a)
-CFLAGS-magazine_malloc.c += -funit-at-a-time
-.endif
-
-# Malloc uses count leading zeroes, not available in thumb
-#.if (${MACHINE_ARCH} == arm)
-#CFLAGS-scalable_malloc.c += -mno-thumb
-#.endif
-
-CFLAGS-stack_logging_disk.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-utmpx-nbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-wordexp.c += -D_DARWIN_UNLIMITED_STREAMS
-
-# also build 64-bit long double versions (ppc only)
-LDBLSRCS += asl.c err.c syslog.c
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS = _rand48.c alarm.c arc4random.c assert.c \
-       basename.c clock.c closedir.c ctermid.c \
-       daemon.c dirname.c drand48.c erand48.c err.c exec.c \
-       fmtcheck.c fmtmsg.c fnmatch.c ftok.c \
-       getbsize.c getcap.c getcwd.c gethostname.c getpeereid.c \
-       getlogin.c getmntinfo.c getpagesize.c getprogname.c glob.c isatty.c \
-       jrand48.c lcong48.c lockf.c lrand48.c mrand48.c nice.c nrand48.c \
-       opendir.c pause.c popen.c pselect.c psignal.c raise.c readdir.c \
-       readpassphrase.c rewinddir.c scandir.c seed48.c seekdir.c \
-       sethostname.c setmode.c setprogname.c siginterrupt.c siglist.c \
-       signal.c sleep.c srand48.c stringlist.c sysconf.c sysctl.c \
-       sysctlbyname.c sysctlnametomib.c \
-       telldir.c termios.c time.c times.c \
-       ttyname.c ttyslot.c ualarm.c ulimit.c unvis.c usleep.c utime.c vis.c \
-       wait.c wait3.c waitpid.c
-
-.ifdef FEATURE_LEGACY_64_APIS
-# special case: getmntinfo64-fbsd.c is derived from getmntinfo.c with getmntinfo64.c.patch
-.ifmake autopatch
-.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
-AUTOPATCHSRCS+= ${_cwd}/getmntinfo64-fbsd.c
-${_cwd}/getmntinfo64-fbsd.c: ${_cwd}/FreeBSD/getmntinfo.c
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${.ALLSRC:S/getmntinfo/getmntinfo64/}.patch
-.endfor # _cwd
-.else # !autopatch
-MISRCS+= getmntinfo64.c
-.endif # autopatch
-.endif # FEATURE_LEGACY_64_APIS
-
-# special case: scandir_b-fbsd.c is derived from scandir.c with scandir_b.c.patch
-.ifmake autopatch
-.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
-AUTOPATCHSRCS+= ${_cwd}/scandir_b-fbsd.c
-${_cwd}/scandir_b-fbsd.c: ${_cwd}/FreeBSD/scandir.c
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${.ALLSRC:S/scandir/scandir_b/}.patch
-.endfor # _cwd
-.else # !autopatch
-.ifdef FEATURE_BLOCKS
-MISRCS+= scandir_b.c
-.endif # FEATURE_BLOCKS
-.endif # autopatch
-
-PRE1050SRCS+= daemon.c
-.if defined(LP64)
-PRE1050SRCS+= pselect.c
-.endif
-.ifndef FEATURE_ONLY_UNIX_CONFORMANCE
-# only patch timezone.c; don't build in base variant, but in other variants
-FBSDPATCHSRCS += timezone.c
-.endif
-
-FBSDHDRS = rand48.h telldir.h
-.include "Makefile.fbsd_end"
-
-.include "Makefile.nbsd_begin"
-NBSDMISRCS = utmpx.c
-.include "Makefile.nbsd_end"
-
-# private header files
-INSTHDRS += ${.CURDIR}/gen/get_compat.h \
-       ${.CURDIR}/gen/execinfo.h
-PRIV_INSTHDRS += ${.CURDIR}/gen/stack_logging.h
-
-LEGACYSRCS += clock.c closedir.c confstr.c crypt.c fnmatch.c \
-       lockf.c nanosleep.c nftw.c nice.c opendir.c \
-       pause.c popen.c pselect.c rewinddir.c \
-       seekdir.c setmode.c sleep.c \
-       telldir.c termios.c timezone.c ttyname.c \
-       usleep.c wait.c waitpid.c
-INODE32SRCS += fts.c getmntinfo.c glob.c nftw.c opendir.c \
-       readdir.c rewinddir.c scandir.c seekdir.c telldir.c
-.ifdef FEATURE_BLOCKS
-INODE32SRCS += scandir_b.c
-.endif # FEATURE_BLOCKS
-CANCELABLESRCS += lockf.c nanosleep.c pause.c pselect.c sleep.c termios.c \
-       usleep.c wait.c waitpid.c
-CANCELABLE-DARWINEXTSNSRCS += pselect.c
-DARWINEXTSNSRCS += popen.c pselect.c
-
-DYLDSRCS += \
-       _simple.c \
-       arc4random.c \
-       closedir.c \
-       getcwd.c \
-       getpagesize.c \
-       nanosleep.c \
-       opendir.c \
-       readdir.c \
-       scandir.c \
-       sysctl.c \
-       sysctlbyname.c \
-       telldir.c \
-       usleep.c
-
-# include __dirent.h to rename DIR structure elements
-.for _src in closedir-fbsd.c opendir-fbsd.c readdir-fbsd.c rewinddir-fbsd.c \
-       scandir-fbsd.c seekdir-fbsd.c telldir-fbsd.c
-CFLAGS-${_src} += -I${.CURDIR}/gen -include __dirent.h
-.endfor
-.ifdef FEATURE_BLOCKS
-CFLAGS-scandir_b-fbsd.c += -I${.CURDIR}/gen -include __dirent.h
-.endif # FEATURE_BLOCKS
-
-# 4105292/4329702 different optimizations improves performance of
-# drand48 and erand48
-.if !make(lib${LIB}_debug.a)
-.if (${MACHINE_ARCH} == i386)
-OPTIMIZE-drand48-fbsd.c += -O1
-OPTIMIZE-erand48-fbsd.c += -O1
-.endif
-.endif
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-clock-fbsd.c += -DLIBC_ALIAS_CLOCK
-CFLAGS-closedir-fbsd.c += -DLIBC_ALIAS_CLOSEDIR
-CFLAGS-confstr.c += -DLIBC_ALIAS_CONFSTR
-CFLAGS-crypt.c += -DLIBC_ALIAS_ENCRYPT -DLIBC_ALIAS_SETKEY
-CFLAGS-fnmatch-fbsd.c += -DLIBC_ALIAS_FNMATCH
-CFLAGS-fts.c += -DLIBC_ALIAS_FTS_CHILDREN -DLIBC_ALIAS_FTS_CLOSE -DLIBC_ALIAS_FTS_OPEN -DLIBC_ALIAS_FTS_OPEN_B -DLIBC_ALIAS_FTS_READ -DLIBC_ALIAS_FTS_SET
-CFLAGS-glob-fbsd.c += -DLIBC_ALIAS_GLOB
-CFLAGS-glob_b-fbsd.c += -DLIBC_ALIAS_GLOB_B
-CFLAGS-lockf-fbsd.c += -DLIBC_ALIAS_LOCKF
-CFLAGS-nanosleep.c += -DLIBC_ALIAS_NANOSLEEP
-CFLAGS-nftw.c += -DLIBC_ALIAS_FTW -DLIBC_ALIAS_NFTW
-CFLAGS-nice-fbsd.c += -DLIBC_ALIAS_NICE
-CFLAGS-opendir-fbsd.c += -DLIBC_ALIAS___OPENDIR2 -DLIBC_ALIAS_OPENDIR
-CFLAGS-rewinddir-fbsd.c += -DLIBC_ALIAS_REWINDDIR
-CFLAGS-pause-fbsd.c += -DLIBC_ALIAS_PAUSE
-CFLAGS-popen-fbsd.c += -DLIBC_ALIAS_POPEN
-CFLAGS-pselect-fbsd.c += -DLIBC_ALIAS_PSELECT
-CFLAGS-seekdir-fbsd.c += -DLIBC_ALIAS_SEEKDIR
-CFLAGS-setmode-fbsd.c += -DLIBC_ALIAS_SETMODE
-CFLAGS-sleep-fbsd.c += -DLIBC_ALIAS_SLEEP
-CFLAGS-telldir-fbsd.c += -DLIBC_ALIAS__SEEKDIR -DLIBC_ALIAS_TELLDIR
-CFLAGS-termios-fbsd.c += -DLIBC_ALIAS_TCDRAIN
-CFLAGS-ttyname-fbsd.c += -DLIBC_ALIAS_TTYNAME_R
-CFLAGS-usleep-fbsd.c += -DLIBC_ALIAS_USLEEP
-CFLAGS-wait-fbsd.c += -DLIBC_ALIAS_WAIT
-CFLAGS-waitpid-fbsd.c += -DLIBC_ALIAS_WAITPID
-
-.if ${LIB} == "c"
-
-MAN3 += asl.3 \
-       backtrace.3 \
-       confstr.3 crypt.3 devname.3 directory.3 fts.3 ftw.3 \
-       getdomainname.3 getloadavg.3 \
-       getttyent.3 getusershell.3 getvfsbyname.3 \
-       malloc.3 malloc_size.3 malloc_zone_malloc.3 nlist.3 posix_memalign.3 \
-       pwcache.3 setjmp.3 sigsetops.3 strtofflags.3 syslog.3 \
-       tcgetpgrp.3 tcsendbreak.3 tcsetattr.3 tcsetpgrp.3 tzset.3 \
-       uname.3 wordexp.3 intro.3
-
-MAN5 += compat.5
-
-.include "Makefile.fbsd_begin"
-FBSDMAN3= alarm.3 arc4random.3 basename.3 clock.3 ctermid.3 \
-       daemon.3 dirname.3 err.3 exec.3 \
-       fmtcheck.3 fmtmsg.3 fnmatch.3 ftok.3 \
-       getbsize.3 getcap.3 getcontext.3 getcwd.3 \
-       gethostname.3 getmntinfo.3 getpagesize.3 getpass.3 \
-       getpeereid.3 getprogname.3 glob.3 \
-       lockf.3 makecontext.3 nice.3 \
-       pause.3 popen.3 pselect.3 psignal.3 \
-       raise.3 rand48.3 readpassphrase.3 \
-       scandir.3 setmode.3 \
-       siginterrupt.3 signal.3 signbit.3 sleep.3 \
-       stringlist.3 sysconf.3 sysctl.3 \
-       time.3 times.3 timezone.3 ttyname.3 \
-       ualarm.3 ucontext.3 ulimit.3 unvis.3 usleep.3 utime.3 \
-       vis.3
-.include "Makefile.fbsd_end"
-
-.include "Makefile.nbsd_begin"
-NBSDMAN3= endutxent.3 getlastlogx.3
-NBSDMAN5= utmpx.5
-.include "Makefile.nbsd_end"
-
-MLINKS+= arc4random.3 arc4random_addrandom.3   \
-         arc4random.3 arc4random_buf.3         \
-         arc4random.3 arc4random_stir.3                \
-         arc4random.3 arc4random_uniform.3
-
-MLINKS+= asl.3 asl_add_log_file.3              \
-         asl.3 asl_close.3                     \
-         asl.3 asl_free.3                      \
-         asl.3 asl_get.3                       \
-         asl.3 asl_key.3                       \
-         asl.3 asl_log.3                       \
-         asl.3 asl_new.3                       \
-         asl.3 asl_open.3                      \
-         asl.3 asl_remove_log_file.3           \
-         asl.3 asl_search.3                    \
-         asl.3 asl_send.3                      \
-         asl.3 asl_set.3                       \
-         asl.3 asl_set_filter.3                        \
-         asl.3 asl_set_query.3                 \
-         asl.3 asl_unset.3                     \
-         asl.3 asl_vlog.3                      \
-         asl.3 aslresponse_free.3              \
-         asl.3 aslresponse_next.3
-
-MLINKS+= backtrace.3 backtrace_symbols.3       \
-        backtrace.3 backtrace_symbols_fd.3
-
-MLINKS+= crypt.3 encrypt.3                     \
-         crypt.3 setkey.3
-
-MLINKS+= ctermid.3 ctermid_r.3
-
-MLINKS+= devname.3 devname_r.3
-
-MLINKS+= directory.3 closedir.3                        \
-         directory.3 dirfd.3                   \
-         directory.3 opendir.3                 \
-         directory.3 readdir.3                 \
-         directory.3 readdir_r.3               \
-         directory.3 rewinddir.3               \
-         directory.3 seekdir.3                 \
-         directory.3 telldir.3
-
-MLINKS+= endutxent.3 getutxent.3               \
-         endutxent.3 getutxid.3                        \
-         endutxent.3 getutxline.3              \
-         endutxent.3 pututxline.3              \
-         endutxent.3 setutxent.3
-
-MLINKS+= err.3 err_set_exit.3                  \
-         err.3 err_set_file.3                  \
-         err.3 errc.3                          \
-         err.3 errx.3                          \
-         err.3 verr.3                          \
-         err.3 verrc.3                         \
-         err.3 verrx.3                         \
-         err.3 vwarn.3                         \
-         err.3 vwarnc.3                                \
-         err.3 vwarnx.3                                \
-         err.3 warn.3                          \
-         err.3 warnc.3                         \
-         err.3 warnx.3
-.ifdef FEATURE_BLOCKS
-MLINKS+= err.3 err_set_exit_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= exec.3 execl.3                                \
-         exec.3 execle.3                       \
-         exec.3 execlp.3                       \
-         exec.3 execv.3                                \
-         exec.3 execvp.3
-
-MLINKS+= fts.3 fts_children.3                  \
-         fts.3 fts_close.3                     \
-         fts.3 fts_open.3                      \
-         fts.3 fts_read.3                      \
-         fts.3 fts_set.3
-.ifdef FEATURE_BLOCKS
-MLINKS+= fts.3 fts_open_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= ftw.3 nftw.3
-
-MLINKS+= getcap.3 cgetcap.3                    \
-         getcap.3 cgetclose.3                  \
-         getcap.3 cgetent.3                    \
-         getcap.3 cgetfirst.3                  \
-         getcap.3 cgetmatch.3                  \
-         getcap.3 cgetnext.3                   \
-         getcap.3 cgetnum.3                    \
-         getcap.3 cgetset.3                    \
-         getcap.3 cgetstr.3                    \
-         getcap.3 cgetustr.3
-
-MLINKS+= getcontext.3 setcontext.3
-
-MLINKS+= getcwd.3 getwd.3
-
-MLINKS+= getdomainname.3 setdomainname.3
-
-MLINKS+= getlastlogx.3 getlastlogxbyname.3     \
-         getlastlogx.3 getutmp.3               \
-         getlastlogx.3 getutmpx.3              \
-         getlastlogx.3 utmpxname.3
-
-MLINKS+= gethostname.3 sethostname.3
-
-MLINKS+= getprogname.3 setprogname.3
-
-MLINKS+= getttyent.3 endttyent.3               \
-         getttyent.3 getttynam.3               \
-         getttyent.3 setttyent.3
-
-MLINKS+= getusershell.3 endusershell.3         \
-         getusershell.3 setusershell.3
-
-MLINKS+= glob.3 globfree.3
-
-MLINKS+= malloc.3 calloc.3                     \
-         malloc.3 free.3                       \
-         malloc.3 realloc.3                    \
-         malloc.3 reallocf.3                   \
-         malloc.3 valloc.3
-
-MLINKS+= makecontext.3 swapcontext.3
-
-MLINKS+= malloc_size.3 malloc_good_size.3
-
-MLINKS+= malloc_zone_malloc.3 malloc_create_zone.3 \
-         malloc_zone_malloc.3 malloc_destroy_zone.3 \
-         malloc_zone_malloc.3 malloc_default_zone.3 \
-         malloc_zone_malloc.3 malloc_zone_from_ptr.3 \
-         malloc_zone_malloc.3 malloc_zone_calloc.3 \
-         malloc_zone_malloc.3 malloc_zone_valloc.3 \
-         malloc_zone_malloc.3 malloc_zone_realloc.3 \
-         malloc_zone_malloc.3 malloc_zone_memalign.3 \
-         malloc_zone_malloc.3 malloc_zone_free.3
-
-MLINKS+= popen.3 pclose.3
-
-MLINKS+= psignal.3 sys_siglist.3               \
-         psignal.3 sys_signame.3
-
-MLINKS+= psignal.3 strsignal.3                 \
-         psignal.3 sys_siglist.3               \
-         psignal.3 sys_signame.3
-
-MLINKS+= pwcache.3 group_from_gid.3            \
-         pwcache.3 user_from_uid.3
-
-MLINKS+= rand48.3 _rand48.3                    \
-         rand48.3 drand48.3                    \
-         rand48.3 erand48.3                    \
-         rand48.3 jrand48.3                    \
-         rand48.3 lcong48.3                    \
-         rand48.3 lrand48.3                    \
-         rand48.3 mrand48.3                    \
-         rand48.3 nrand48.3                    \
-         rand48.3 seed48.3                     \
-         rand48.3 srand48.3
-
-MLINKS+= scandir.3 alphasort.3
-.ifdef FEATURE_BLOCKS
-MLINKS+= scandir.3 scandir_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= strtofflags.3 fflagstostr.3
-
-MLINKS+= setjmp.3 _longjmp.3                   \
-         setjmp.3 _setjmp.3                    \
-         setjmp.3 longjmp.3                    \
-         setjmp.3 longjmperr.3                 \
-         setjmp.3 longjmperror.3               \
-         setjmp.3 siglongjmp.3                 \
-         setjmp.3 sigsetjmp.3
-
-MLINKS+= setmode.3 getmode.3
-
-MLINKS+= sigsetops.3 sigaddset.3               \
-         sigsetops.3 sigdelset.3               \
-         sigsetops.3 sigemptyset.3             \
-         sigsetops.3 sigfillset.3              \
-         sigsetops.3 sigismember.3
-
-MLINKS+= stringlist.3 sl_add.3                 \
-         stringlist.3 sl_find.3                        \
-         stringlist.3 sl_free.3                        \
-         stringlist.3 sl_init.3
-
-MLINKS+= sysctl.3 sysctlbyname.3               \
-         sysctl.3 sysctlnametomib.3
-
-MLINKS+= syslog.3 closelog.3                   \
-         syslog.3 openlog.3                    \
-         syslog.3 setlogmask.3                 \
-         syslog.3 vsyslog.3
-
-MLINKS+= tcsendbreak.3 tcdrain.3               \
-         tcsendbreak.3 tcflow.3                        \
-         tcsendbreak.3 tcflush.3
-
-MLINKS+= tcsetattr.3 cfgetispeed.3             \
-         tcsetattr.3 cfgetospeed.3             \
-         tcsetattr.3 cfmakeraw.3               \
-         tcsetattr.3 cfsetispeed.3             \
-         tcsetattr.3 cfsetospeed.3             \
-         tcsetattr.3 cfsetspeed.3              \
-         tcsetattr.3 tcgetattr.3
-
-MLINKS+= ttyname.3 isatty.3                    \
-         ttyname.3 ttyslot.3
-
-MLINKS+= tzset.3 tzsetwall.3
-
-MLINKS+= unvis.3 strunvis.3                    \
-         unvis.3 strunvisx.3
-
-MLINKS+= vis.3 strvis.3                                \
-         vis.3 strvisx.3
-
-MLINKS+= wordexp.3 wordfree.3
-.endif
index 06a443345a02cdfa46a1208c33511ee81c36544a..719b98fd538322f0bfef46b20359c4d695ea6973 100644 (file)
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 26, 2002
+.Dd June 29, 2006
 .Dt ENDUTXENT 3
 .Os
 .Sh NAME
 .Ft struct utmpx *
 .Fn getutxent void
 .Ft struct utmpx *
-.Fn getutxid "const struct utmpx *"
+.Fn getutxid "const struct utmpx *id"
 .Ft struct utmpx *
-.Fn getutxline "const struct utmpx *"
+.Fn getutxline "const struct utmpx *line"
 .Ft struct utmpx *
-.Fn pututxline "const struct utmpx *"
+.Fn pututxline "const struct utmpx *utx"
 .Ft void
 .Fn setutxent void
 .Sh DESCRIPTION
@@ -91,6 +91,7 @@ adds the argument
 .Xr utmpx 5
 entry line to the accounting database, replacing a previous entry for
 the same user if it exists.
+Only the superuser may write to the accounting database.
 .Ss The utmpx structure
 The
 .Nm utmpx
@@ -98,27 +99,21 @@ structure has the following definition:
 .Pp
 .Bd -literal
 struct utmpx {
-        char ut_name[_UTX_USERSIZE];    /* login name */
-        char ut_id[_UTX_IDSIZE];        /* inittab id */
-        char ut_line[_UTX_LINESIZE];    /* tty name */
-        char ut_host[_UTX_HOSTSIZE];    /* host name */
-        uint16_t ut_session;            /* session id used for windowing */
-        uint16_t ut_type;               /* type of this entry */
-        pid_t ut_pid;                   /* process id creating the entry */
-        struct {
-                uint16_t e_termination; /* process termination signal */
-                uint16_t e_exit;        /* process exit status */
-        } ut_exit;
-        struct sockaddr_storage ut_ss;  /* address where entry was made from */
-        struct timeval ut_tv;           /* time entry was created */
-        uint32_t ut_pad[10];            /* reserved for future use */
+       char ut_user[_UTX_USERSIZE];    /* login name */
+       char ut_id[_UTX_IDSIZE];        /* id */
+       char ut_line[_UTX_LINESIZE];    /* tty name */
+       pid_t ut_pid;                   /* process id creating the entry */
+       short ut_type;                  /* type of this entry */
+       struct timeval ut_tv;           /* time entry was created */
+       char ut_host[_UTX_HOSTSIZE];    /* host name */
+       __uint32_t ut_pad[16];          /* reserved for future use */
 };
 .Ed
 .Pp
 Valid entries for
 .Fa ut_type
 are:
-.Bl -tag -width LOGIN_PROCESSXX -compact -offset indent
+.Bl -tag -width ".Dv LOGIN_PROCESSXX" -compact -offset indent
 .It Dv BOOT_TIME
 Time of a system boot.
 .It Dv DEAD_PROCESS
@@ -136,11 +131,115 @@ Time after system clock change.
 Time before system clock change.
 .It Dv RUN_LVL
 Run level.
-Provided for compatibility, not used on
-.Nx .
+Provided for compatibility, not used.
 .It Dv USER_PROCESS
 A user process.
+.It Dv SHUTDOWN_TIME
+Time of system shutdown (extension to the standards).
 .El
+.Pp
+For each value of
+.Fa ut_type ,
+the other fields with meaningful values are as follows:
+.Bl -tag -width ".Dv LOGIN_PROCESSXX" -compact -offset indent
+.It Dv BOOT_TIME
+.Fa ut_tv
+.It Dv DEAD_PROCESS
+.Fa ut_id ,
+.Fa ut_pid ,
+.Fa ut_tv
+.It Dv EMPTY
+(no others)
+.It Dv INIT_PROCESS
+.Fa ut_id ,
+.Fa ut_pid ,
+.Fa ut_tv
+.It Dv LOGIN_PROCESS
+.Fa ut_id ,
+.Fa ut_user
+(implementation-defined name of the login process),
+.Fa ut_pid ,
+.Fa ut_tv
+.It Dv NEW_TIME
+.Fa ut_tv
+.It Dv OLD_TIME
+.Fa ut_tv
+.It Dv RUN_LVL
+(no used)
+.It Dv USER_PROCESS
+.Fa ut_id ,
+.Fa ut_user
+(login name of the user),
+.Fa ut_line ,
+.Fa ut_pid ,
+.Fa ut_host
+(hostname of remote user)
+.Fa ut_tv
+.It Dv SHUTDOWN_TIME
+.Fa ut_tv
+.El
+.Ss Other extensions to the standards
+The
+.Fa ut_type
+value may also be OR-ed with the following masks:
+.Bl -tag -width XXXX -compact -offset indent
+.It Dv UTMPX_AUTOFILL_MASK
+Depending on the main part of
+.Fa ut_type
+value, other fields are automatically filled in (as specified in the
+meaningful fields table above).
+In particular, the
+.Fa ut_id
+field will be set using the convention of the last four characters of the
+.Fa ut_line
+field (itself filled in automatically from the tty name of the device connected
+to the standard input, output or error, whichever is available).
+Note that it is more efficient to fill in as many values as are already
+available beforehand, rather than have then automatically filled in.
+.It Dv UTMPX_DEAD_IF_CORRESPONDING_MASK
+When
+.Fa ut_type
+value is
+.Dv DEAD_PROCESS, a call to
+.Fn pututxline
+will succeed only if a corresponding entry already exists with a
+.Fa ut_type
+value of
+.Dv USER_PROCESS .
+.El
+.Pp
+Note that the above mask values do not show up in any file format, or in
+any subsequent reads of the data.
+.Pp
+To support
+.Pa wtmpx
+and
+.Pa lastlogx
+equivalent capability,
+.Fn pututxline
+automatically writes to the appropriate files.
+Additional APIs to read these files is available in
+.Xr endutxent_wtmp 3
+and
+.Xr getlastlogx 3 .
+.Ss Backward compatibility
+Successful calls to
+.Fn pututxline
+will automatically write equivalent entries into the
+.Pa utmp ,
+.Pa wtmp
+and
+.Pa lastlog
+files.
+Programs that read these old files should work as expected.
+However, directly writing to these files does not make corresponding
+entries in
+.Pa utmpx
+and the
+.Pa wtmpx
+and
+.Pa lastlogx
+equivalent files, so such write-access is deprecated.
 .Sh RETURN VALUES
 .Fn getutxent
 returns the next entry, or
@@ -152,11 +251,45 @@ and
 return the matching structure on success, or
 .Dv NULL
 if no match was found.
+.Pp
 .Fn pututxline
 returns the structure that was successfully written, or
-.Dv NULL .
+.Dv NULL
+is returned and the global variable
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+No errors are defined for the 
+.Fn endutxent ,
+.Fn getutxent ,
+.Fn getutxid ,
+.Fn getutxline ,
+and
+.Fn setutxent
+functions.
+.Pp
+The
+.Fn pututxline
+function may fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The process does not have appropriate privileges.
+.It Bq Er EINVAL
+The
+.Dv UTMPX_DEAD_IF_CORRESPONDING_MASK
+flags was specified along with
+.Dv DEAD_PROCESS ,
+but no corresponding entry with
+.Dv USER_PROCESS
+was found.
+.El
+.Pp
+Other errors may be returned if
+.Dv UTMPX_AUTOFILL_MASK
+was specified, and a field could not be auto-filled.
 .Sh SEE ALSO
-.Xr logwtmpx 3 ,
+.Xr endutxent_wtmp 3 ,
+.Xr getlastlogx 3 ,
 .Xr utmpx 5
 .Sh STANDARDS
 The
diff --git a/gen/NetBSD/endutxent.3.patch b/gen/NetBSD/endutxent.3.patch
deleted file mode 100644 (file)
index 3b04979..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
---- endutxent.3.orig   2009-04-03 22:48:14.000000000 -0700
-+++ endutxent.3        2009-04-04 18:16:44.000000000 -0700
-@@ -34,7 +34,7 @@
- .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- .\" POSSIBILITY OF SUCH DAMAGE.
- .\"
--.Dd September 26, 2002
-+.Dd June 29, 2006
- .Dt ENDUTXENT 3
- .Os
- .Sh NAME
-@@ -54,11 +54,11 @@
- .Ft struct utmpx *
- .Fn getutxent void
- .Ft struct utmpx *
--.Fn getutxid "const struct utmpx *"
-+.Fn getutxid "const struct utmpx *id"
- .Ft struct utmpx *
--.Fn getutxline "const struct utmpx *"
-+.Fn getutxline "const struct utmpx *line"
- .Ft struct utmpx *
--.Fn pututxline "const struct utmpx *"
-+.Fn pututxline "const struct utmpx *utx"
- .Ft void
- .Fn setutxent void
- .Sh DESCRIPTION
-@@ -98,6 +98,7 @@
- .Xr utmpx 5
- entry line to the accounting database, replacing a previous entry for
- the same user if it exists.
-+Only the superuser may write to the accounting database.
- .Ss The utmpx structure
- The
- .Nm utmpx
-@@ -105,27 +106,21 @@
- .Pp
- .Bd -literal
- struct utmpx {
--        char ut_name[_UTX_USERSIZE];    /* login name */
--        char ut_id[_UTX_IDSIZE];        /* inittab id */
--        char ut_line[_UTX_LINESIZE];    /* tty name */
--        char ut_host[_UTX_HOSTSIZE];    /* host name */
--        uint16_t ut_session;            /* session id used for windowing */
--        uint16_t ut_type;               /* type of this entry */
--        pid_t ut_pid;                   /* process id creating the entry */
--        struct {
--                uint16_t e_termination; /* process termination signal */
--                uint16_t e_exit;        /* process exit status */
--        } ut_exit;
--        struct sockaddr_storage ut_ss;  /* address where entry was made from */
--        struct timeval ut_tv;           /* time entry was created */
--        uint32_t ut_pad[10];            /* reserved for future use */
-+      char ut_user[_UTX_USERSIZE];    /* login name */
-+      char ut_id[_UTX_IDSIZE];        /* id */
-+      char ut_line[_UTX_LINESIZE];    /* tty name */
-+      pid_t ut_pid;                   /* process id creating the entry */
-+      short ut_type;                  /* type of this entry */
-+      struct timeval ut_tv;           /* time entry was created */
-+      char ut_host[_UTX_HOSTSIZE];    /* host name */
-+      __uint32_t ut_pad[16];          /* reserved for future use */
- };
- .Ed
- .Pp
- Valid entries for
- .Fa ut_type
- are:
--.Bl -tag -width LOGIN_PROCESSXX -compact -offset indent
-+.Bl -tag -width ".Dv LOGIN_PROCESSXX" -compact -offset indent
- .It Dv BOOT_TIME
- Time of a system boot.
- .It Dv DEAD_PROCESS
-@@ -143,11 +138,115 @@
- Time before system clock change.
- .It Dv RUN_LVL
- Run level.
--Provided for compatibility, not used on
--.Nx .
-+Provided for compatibility, not used.
- .It Dv USER_PROCESS
- A user process.
-+.It Dv SHUTDOWN_TIME
-+Time of system shutdown (extension to the standards).
- .El
-+.Pp
-+For each value of
-+.Fa ut_type ,
-+the other fields with meaningful values are as follows:
-+.Bl -tag -width ".Dv LOGIN_PROCESSXX" -compact -offset indent
-+.It Dv BOOT_TIME
-+.Fa ut_tv
-+.It Dv DEAD_PROCESS
-+.Fa ut_id ,
-+.Fa ut_pid ,
-+.Fa ut_tv
-+.It Dv EMPTY
-+(no others)
-+.It Dv INIT_PROCESS
-+.Fa ut_id ,
-+.Fa ut_pid ,
-+.Fa ut_tv
-+.It Dv LOGIN_PROCESS
-+.Fa ut_id ,
-+.Fa ut_user
-+(implementation-defined name of the login process),
-+.Fa ut_pid ,
-+.Fa ut_tv
-+.It Dv NEW_TIME
-+.Fa ut_tv
-+.It Dv OLD_TIME
-+.Fa ut_tv
-+.It Dv RUN_LVL
-+(no used)
-+.It Dv USER_PROCESS
-+.Fa ut_id ,
-+.Fa ut_user
-+(login name of the user),
-+.Fa ut_line ,
-+.Fa ut_pid ,
-+.Fa ut_host
-+(hostname of remote user)
-+.Fa ut_tv
-+.It Dv SHUTDOWN_TIME
-+.Fa ut_tv
-+.El
-+.Ss Other extensions to the standards
-+The
-+.Fa ut_type
-+value may also be OR-ed with the following masks:
-+.Bl -tag -width XXXX -compact -offset indent
-+.It Dv UTMPX_AUTOFILL_MASK
-+Depending on the main part of
-+.Fa ut_type
-+value, other fields are automatically filled in (as specified in the
-+meaningful fields table above).
-+In particular, the
-+.Fa ut_id
-+field will be set using the convention of the last four characters of the
-+.Fa ut_line
-+field (itself filled in automatically from the tty name of the device connected
-+to the standard input, output or error, whichever is available).
-+Note that it is more efficient to fill in as many values as are already
-+available beforehand, rather than have then automatically filled in.
-+.It Dv UTMPX_DEAD_IF_CORRESPONDING_MASK
-+When
-+.Fa ut_type
-+value is
-+.Dv DEAD_PROCESS, a call to
-+.Fn pututxline
-+will succeed only if a corresponding entry already exists with a
-+.Fa ut_type
-+value of
-+.Dv USER_PROCESS .
-+.El
-+.Pp
-+Note that the above mask values do not show up in any file format, or in
-+any subsequent reads of the data.
-+.Pp
-+To support
-+.Pa wtmpx
-+and
-+.Pa lastlogx
-+equivalent capability,
-+.Fn pututxline
-+automatically writes to the appropriate files.
-+Additional APIs to read these files is available in
-+.Xr endutxent_wtmp 3
-+and
-+.Xr getlastlogx 3 .
-+.Ss Backward compatibility
-+Successful calls to
-+.Fn pututxline
-+will automatically write equivalent entries into the
-+.Pa utmp ,
-+.Pa wtmp
-+and
-+.Pa lastlog
-+files.
-+Programs that read these old files should work as expected.
-+However, directly writing to these files does not make corresponding
-+entries in
-+.Pa utmpx
-+and the
-+.Pa wtmpx
-+and
-+.Pa lastlogx
-+equivalent files, so such write-access is deprecated.
- .Sh RETURN VALUES
- .Fn getutxent
- returns the next entry, or
-@@ -159,11 +258,45 @@
- return the matching structure on success, or
- .Dv NULL
- if no match was found.
-+.Pp
- .Fn pututxline
- returns the structure that was successfully written, or
--.Dv NULL .
-+.Dv NULL
-+is returned and the global variable
-+.Va errno
-+is set to indicate the error.
-+.Sh ERRORS
-+No errors are defined for the 
-+.Fn endutxent ,
-+.Fn getutxent ,
-+.Fn getutxid ,
-+.Fn getutxline ,
-+and
-+.Fn setutxent
-+functions.
-+.Pp
-+The
-+.Fn pututxline
-+function may fail if:
-+.Bl -tag -width Er
-+.It Bq Er EPERM
-+The process does not have appropriate privileges.
-+.It Bq Er EINVAL
-+The
-+.Dv UTMPX_DEAD_IF_CORRESPONDING_MASK
-+flags was specified along with
-+.Dv DEAD_PROCESS ,
-+but no corresponding entry with
-+.Dv USER_PROCESS
-+was found.
-+.El
-+.Pp
-+Other errors may be returned if
-+.Dv UTMPX_AUTOFILL_MASK
-+was specified, and a field could not be auto-filled.
- .Sh SEE ALSO
--.Xr logwtmpx 3 ,
-+.Xr endutxent_wtmp 3 ,
-+.Xr getlastlogx 3 ,
- .Xr utmpx 5
- .Sh STANDARDS
- The
index cb7404c3156d369c9a44aac6f913fbc9073892b1..8a70bcfa3e4fda630c011a09cfe7732426a2139c 100644 (file)
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 26, 2003
+.Dd Dec 26, 2005
 .Dt GETLASTLOGX 3
 .Os
 .Sh NAME
 .Nm getlastlogx ,
+.Nm getlastlogxbyname ,
 .Nm getutmp ,
 .Nm getutmpx ,
-.Nm updlastlogx ,
-.Nm updwtmpx ,
 .Nm utmpxname
 .Nd user accounting database functions
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In utmpx.h
 .Ft struct lastlogx *
-.Fn getlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll"
+.Fn getlastlogx "uid_t uid" "struct lastlogx *ll"
+.Ft struct lastlogx *
+.Fn getlastlogxbyname "const char *name" "struct lastlogx *ll"
 .Ft void
 .Fn getutmp "const struct utmpx *ux" "struct utmp *u"
 .Ft void
 .Fn getutmpx "const struct utmp *u" "struct utmpx *ux"
 .Ft int
-.Fn updlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll"
-.Ft int
-.Fn updwtmpx "const char *file" "const struct utmpx *utx"
-.Ft int
 .Fn utmpxname "const char *fname"
 .Sh DESCRIPTION
 The
 .Fn getlastlogx
 function looks up the entry for the user with user id
 .Fa uid
-in the
-.Xr lastlogx 5
-file given by
-.Fa fname
 and returns it in
 .Fa \&ll .
 If the provided
@@ -74,8 +65,12 @@ the necessary space will be allocated by
 and should be
 .Fn free Ns d
 by the caller.
-.Pp
 The
+.Fn getlastlogxbyname
+function is similar to
+.Fn getlastlogx ,
+except the user name is passed.
+.Pp
 .Fn getutmp
 function fills out the entries in the struct utmp
 .Fa u
@@ -92,16 +87,6 @@ The sole exception is the
 field, which will be initialized to
 .Dv USER_PROCESS .
 .Pp
-The
-.Fn updlastlogx
-function tries to update the information for the user with the user id
-.Fa uid
-in the
-.Xr lastlogx 5
-file given by
-.Fa fname
-with the data supplied in
-.Fa \&ll .
 A
 .Ft struct lastlogx
 is defined like this:
@@ -110,21 +95,8 @@ struct lastlogx {
         struct timeval ll_tv;           /* time entry was created */
         char ll_line[_UTX_LINESIZE];    /* tty name */
         char ll_host[_UTX_HOSTSIZE];    /* host name */
-        struct sockaddr_storage ll_ss;  /* address where entry was made from */
 };
 .Ed
-All the fields should be filled out by the caller.
-.Pp
-The
-.Fn updwtmpx
-function updates the
-.Xr wtmpx 5
-file
-.Fa file
-with the
-.Xr utmpx 5
-entry
-.Fa utx .
 .Pp
 The
 .Fn utmpxname
@@ -134,11 +106,15 @@ database file name to
 .Fa fname .
 .Sh RETURN VALUES
 .Fn getlastlogx
-returns the found entry on success, or
+and
+.Fn getlastlogxbyname
+return the found entry on success, or
 .Dv NULL
 if it could not open the database, could not find an entry matching
 .Fa uid
-in there, or could not allocate the necessary space (in case
+or
+.Fa name ,
+or could not allocate the necessary space (in case
 .Fa \&ll
 was
 .Dv NULL ) .
@@ -147,27 +123,17 @@ was
 returns 1 on success, or 0 if the supplied file name was too long or
 did not end with
 .Sq x .
-.Pp
-.Fn updlastlogx
-and
-.Fn updwtmpx
-return 0 on success, or \-1 in case the database or file respectively
-could not be opened or the data not written into it.
 .Sh SEE ALSO
 .Xr endutxent 3 ,
-.Xr loginx 3 ,
 .Xr utmpx 5
 .Sh HISTORY
 The functions
 .Fn getutmp ,
 .Fn getutmpx ,
-.Fn updwtmpx ,
 and
 .Fn utmpxname
 first appeared in
 .Tn Solaris .
 .Nm getlastlogx
-and
-.Nm updlastlogx
 first appeared in
 .Nx 2.0 .
diff --git a/gen/NetBSD/getlastlogx.3.patch b/gen/NetBSD/getlastlogx.3.patch
deleted file mode 100644 (file)
index 0f1b420..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
---- getlastlogx.3.orig 2006-01-11 18:20:07.000000000 -0800
-+++ getlastlogx.3      2006-01-04 18:02:57.000000000 -0800
-@@ -34,42 +34,33 @@
- .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- .\" POSSIBILITY OF SUCH DAMAGE.
- .\"
--.Dd August 26, 2003
-+.Dd Dec 26, 2005
- .Dt GETLASTLOGX 3
- .Os
- .Sh NAME
- .Nm getlastlogx ,
-+.Nm getlastlogxbyname ,
- .Nm getutmp ,
- .Nm getutmpx ,
--.Nm updlastlogx ,
--.Nm updwtmpx ,
- .Nm utmpxname
- .Nd user accounting database functions
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In utmpx.h
- .Ft struct lastlogx *
--.Fn getlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll"
-+.Fn getlastlogx "uid_t uid" "struct lastlogx *ll"
-+.Ft struct lastlogx *
-+.Fn getlastlogxbyname "const char *name" "struct lastlogx *ll"
- .Ft void
- .Fn getutmp "const struct utmpx *ux" "struct utmp *u"
- .Ft void
- .Fn getutmpx "const struct utmp *u" "struct utmpx *ux"
- .Ft int
--.Fn updlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll"
--.Ft int
--.Fn updwtmpx "const char *file" "const struct utmpx *utx"
--.Ft int
- .Fn utmpxname "const char *fname"
- .Sh DESCRIPTION
- The
- .Fn getlastlogx
- function looks up the entry for the user with user id
- .Fa uid
--in the
--.Xr lastlogx 5
--file given by
--.Fa fname
- and returns it in
- .Fa \&ll .
- If the provided
-@@ -81,8 +72,12 @@
- and should be
- .Fn free Ns d
- by the caller.
--.Pp
- The
-+.Fn getlastlogxbyname
-+function is similar to
-+.Fn getlastlogx ,
-+except the user name is passed.
-+.Pp
- .Fn getutmp
- function fills out the entries in the struct utmp
- .Fa u
-@@ -99,16 +94,6 @@
- field, which will be initialized to
- .Dv USER_PROCESS .
- .Pp
--The
--.Fn updlastlogx
--function tries to update the information for the user with the user id
--.Fa uid
--in the
--.Xr lastlogx 5
--file given by
--.Fa fname
--with the data supplied in
--.Fa \&ll .
- A
- .Ft struct lastlogx
- is defined like this:
-@@ -117,21 +102,8 @@
-         struct timeval ll_tv;           /* time entry was created */
-         char ll_line[_UTX_LINESIZE];    /* tty name */
-         char ll_host[_UTX_HOSTSIZE];    /* host name */
--        struct sockaddr_storage ll_ss;  /* address where entry was made from */
- };
- .Ed
--All the fields should be filled out by the caller.
--.Pp
--The
--.Fn updwtmpx
--function updates the
--.Xr wtmpx 5
--file
--.Fa file
--with the
--.Xr utmpx 5
--entry
--.Fa utx .
- .Pp
- The
- .Fn utmpxname
-@@ -141,11 +113,15 @@
- .Fa fname .
- .Sh RETURN VALUES
- .Fn getlastlogx
--returns the found entry on success, or
-+and
-+.Fn getlastlogxbyname
-+return the found entry on success, or
- .Dv NULL
- if it could not open the database, could not find an entry matching
- .Fa uid
--in there, or could not allocate the necessary space (in case
-+or
-+.Fa name ,
-+or could not allocate the necessary space (in case
- .Fa \&ll
- was
- .Dv NULL ) .
-@@ -154,27 +130,17 @@
- returns 1 on success, or 0 if the supplied file name was too long or
- did not end with
- .Sq x .
--.Pp
--.Fn updlastlogx
--and
--.Fn updwtmpx
--return 0 on success, or \-1 in case the database or file respectively
--could not be opened or the data not written into it.
- .Sh SEE ALSO
- .Xr endutxent 3 ,
--.Xr loginx 3 ,
- .Xr utmpx 5
- .Sh HISTORY
- The functions
- .Fn getutmp ,
- .Fn getutmpx ,
--.Fn updwtmpx ,
- and
- .Fn utmpxname
- first appeared in
- .Tn Solaris .
- .Nm getlastlogx
--and
--.Nm updlastlogx
- first appeared in
- .Nx 2.0 .
index 25a803d79be10d82a96108d2836c00a02efbb09e..6068b0988a2af3079c78631de5eedd42bddcb83b 100644 (file)
@@ -31,9 +31,7 @@
 .Dt UTMPX 5
 .Os
 .Sh NAME
-.Nm utmpx ,
-.Nm wtmpx ,
-.Nm lastlogx
+.Nm utmpx
 .Nd user accounting database
 .Sh SYNOPSIS
 .In utmpx.h
@@ -53,88 +51,51 @@ The
 .Aq Pa utmpx.h
 header defines the structures and functions for logging user.
 Currently logged in users are tracked in
-.Pa /var/run/utmpx ,
-a list of all logins and logouts, as well as all shutdowns, reboots
-and date changes, is kept in
-.Pa /var/log/wtmpx ,
-and the last login of each user is noted in
-.Pa /var/log/lastlogx .
-.Pp
+.Pa /var/run/utmpx .
 The interface to the
 .Nm utmpx
 file is described in
-.Xr getutxent 3 .
+.Xr endutxent 3 .
+The file is not automatically created if they do not exist; it
+must be created manually.
 .Pp
-The
-.Nm wtmpx
-file can grow rapidly on busy systems, and is normally rotated with
-.Xr newsyslog 8 .
+Traditionally, separate files would be used to store the running log of
+the logins and logouts
+.Pf ( Pa wtmpx ) ,
+and the last login of each user
+.Pf ( Pa lastlogx ) .
+With the availability of the Apple system log facility
+.Xr asl 3 ,
+these separate files can be replace with log entries, which are automatically
+generated when
+.Nm utmpx
+entries are written.
+The API to access the logins and logouts is described in
+.Xr endutxent_wtmp 3
+while the last login info is accessible with
+.Xr getlastlogx 3 .
 .Pp
-In the event of a date change, a shutdown, or a reboot, the following
-items are logged in the
-.Nm wtmpx
-file:
-.Bl -tag -width shutdownxx -compact -offset indent
-.It Li date
-The system time has been manually or automatically updated by
-.Xr date 1 .
-The command name
-.Em date
-is recorded in the field
-.Fa ut_name .
-In the field
-.Fa ut_line ,
-the character
-.Ql \\*(Ba
-indicates the time prior to the change, and the character
-.Ql \&{
-indicates the new time.
-.It Li reboot
-.It Li shutdown
-A system reboot or shutdown has been initiated.
-The character
-.Ql \&~
-is placed in the field
-.Fa ut_line ,
-and
-.Li reboot
-or
-.Li shutdown
-in the field
-.Fa ut_name
-(see
-.Xr shutdown 8
+For compatibility, changes to
+.Nm utmpx
+are reflected in
+.Xr utmp 3
+(in the
+.Pa utmp ,
+.Pa wtmp
 and
-.Xr reboot 8 ) ,
-using
-.Xr logwtmpx 3 .
-.Pp
-.El
+.Pa lastlog
+files),
+but not the other way around.
 .Sh FILES
-.Bl -tag -width /var/log/lastlogx -compact
+.Bl -tag -width /var/log/utmpx -compact
 .It Pa /var/run/utmpx
 The
 .Nm utmpx
 file.
-.It Pa /var/log/wtmpx
-The
-.Nm wtmpx
-file.
-.It Pa /var/log/lastlogx
-The
-.Nm lastlogx
-file.
 .El
 .Sh SEE ALSO
-.Xr last 1 ,
-.Xr login 1 ,
-.Xr rwho 1 ,
-.Xr w 1 ,
-.Xr who 1 ,
+.Xr asl 3 ,
 .Xr endutxent 3 ,
-.Xr logwtmpx 3 ,
-.Xr utmp 5 ,
-.Xr ac 8 ,
-.Xr init 8 ,
-.Xr newsyslog 8 ,
-.Xr reboot 8
+.Xr endutxent_wtmp 3 ,
+.Xr getlastlogx 3 ,
+.Xr utmp 5
diff --git a/gen/NetBSD/utmpx.5.patch b/gen/NetBSD/utmpx.5.patch
deleted file mode 100644 (file)
index 49f9b47..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
---- utmpx.5.orig       2009-11-06 10:28:19.000000000 -0800
-+++ utmpx.5    2009-11-06 10:29:23.000000000 -0800
-@@ -31,9 +31,7 @@
- .Dt UTMPX 5
- .Os
- .Sh NAME
--.Nm utmpx ,
--.Nm wtmpx ,
--.Nm lastlogx
-+.Nm utmpx
- .Nd user accounting database
- .Sh SYNOPSIS
- .In utmpx.h
-@@ -53,88 +51,51 @@ The
- .Aq Pa utmpx.h
- header defines the structures and functions for logging user.
- Currently logged in users are tracked in
--.Pa /var/run/utmpx ,
--a list of all logins and logouts, as well as all shutdowns, reboots
--and date changes, is kept in
--.Pa /var/log/wtmpx ,
--and the last login of each user is noted in
--.Pa /var/log/lastlogx .
--.Pp
-+.Pa /var/run/utmpx .
- The interface to the
- .Nm utmpx
- file is described in
--.Xr getutxent 3 .
-+.Xr endutxent 3 .
-+The file is not automatically created if they do not exist; it
-+must be created manually.
- .Pp
--The
--.Nm wtmpx
--file can grow rapidly on busy systems, and is normally rotated with
--.Xr newsyslog 8 .
-+Traditionally, separate files would be used to store the running log of
-+the logins and logouts
-+.Pf ( Pa wtmpx ) ,
-+and the last login of each user
-+.Pf ( Pa lastlogx ) .
-+With the availability of the Apple system log facility
-+.Xr asl 3 ,
-+these separate files can be replace with log entries, which are automatically
-+generated when
-+.Nm utmpx
-+entries are written.
-+The API to access the logins and logouts is described in
-+.Xr endutxent_wtmp 3
-+while the last login info is accessible with
-+.Xr getlastlogx 3 .
- .Pp
--In the event of a date change, a shutdown, or a reboot, the following
--items are logged in the
--.Nm wtmpx
--file:
--.Bl -tag -width shutdownxx -compact -offset indent
--.It Li date
--The system time has been manually or automatically updated by
--.Xr date 1 .
--The command name
--.Em date
--is recorded in the field
--.Fa ut_name .
--In the field
--.Fa ut_line ,
--the character
--.Ql \\*(Ba
--indicates the time prior to the change, and the character
--.Ql \&{
--indicates the new time.
--.It Li reboot
--.It Li shutdown
--A system reboot or shutdown has been initiated.
--The character
--.Ql \&~
--is placed in the field
--.Fa ut_line ,
--and
--.Li reboot
--or
--.Li shutdown
--in the field
--.Fa ut_name
--(see
--.Xr shutdown 8
-+For compatibility, changes to
-+.Nm utmpx
-+are reflected in
-+.Xr utmp 3
-+(in the
-+.Pa utmp ,
-+.Pa wtmp
- and
--.Xr reboot 8 ) ,
--using
--.Xr logwtmpx 3 .
--.Pp
--.El
-+.Pa lastlog
-+files),
-+but not the other way around.
- .Sh FILES
--.Bl -tag -width /var/log/lastlogx -compact
-+.Bl -tag -width /var/log/utmpx -compact
- .It Pa /var/run/utmpx
- The
- .Nm utmpx
- file.
--.It Pa /var/log/wtmpx
--The
--.Nm wtmpx
--file.
--.It Pa /var/log/lastlogx
--The
--.Nm lastlogx
--file.
- .El
- .Sh SEE ALSO
--.Xr last 1 ,
--.Xr login 1 ,
--.Xr rwho 1 ,
--.Xr w 1 ,
--.Xr who 1 ,
-+.Xr asl 3 ,
- .Xr endutxent 3 ,
--.Xr logwtmpx 3 ,
--.Xr utmp 5 ,
--.Xr ac 8 ,
--.Xr init 8 ,
--.Xr newsyslog 8 ,
--.Xr reboot 8
-+.Xr endutxent_wtmp 3 ,
-+.Xr getlastlogx 3 ,
-+.Xr utmp 5
index b7497eb9823a3161b192f5b67f52d24fc7566a5c..0eda3d4659671566b977975bbcd1490f5f9c314f 100644 (file)
@@ -42,111 +42,240 @@ __RCSID("$NetBSD: utmpx.c,v 1.25 2008/04/28 20:22:59 martin Exp $");
 #include <sys/time.h>
 #include <sys/wait.h>
 
-#include <assert.h>
-#include <db.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#ifdef UNIFDEF_LEGACY_UTMP_APIS
 #include <utmp.h>
+#endif /* UNIFDEF_LEGACY_UTMP_APIS */
 #include <utmpx.h>
+#include <utmpx-darwin.h>
+#include <errno.h>
 #include <vis.h>
+#include <notify.h>
+
+/* This is the default struct _utmpx shared by the POSIX APIs */
+__private_extern__
+struct _utmpx __utx__ = {
+       __UTX_MAGIC__,                  /* magic */
+       {},                             /* ut */
+       PTHREAD_MUTEX_INITIALIZER,      /* utmpx_mutex */
+       _PATH_UTMPX,                    /* utfile */
+       NULL,                           /* fp */
+       1,                              /* utfile_system */
+       0,                              /* readonly */
+};
+
+static struct utmpx *__getutxid(struct _utmpx *, const struct utmpx *);
+
+__private_extern__ const char _utmpx_vers[] = "utmpx-1.00";
+
+__private_extern__ void
+__setutxent(struct _utmpx *U)
+{
 
-static FILE *fp;
-static int readonly = 0;
-static struct utmpx ut;
-static char utfile[MAXPATHLEN] = _PATH_UTMPX;
+       (void)memset(&U->ut, 0, sizeof(U->ut));
+       if (U->fp == NULL)
+               return;
+#ifdef __LP64__
+       (void)fseeko(U->fp, (off_t)sizeof(struct utmpx32), SEEK_SET);
+#else /* __LP64__ */
+       (void)fseeko(U->fp, (off_t)sizeof(U->ut), SEEK_SET);
+#endif /* __LP64__ */
+}
 
-static struct utmpx *utmp_update(const struct utmpx *);
+void
+_setutxent(struct _utmpx *U)
+{
+
+       TEST_UTMPX_T("_setutxent", U);
+       UTMPX_LOCK(U);
+       __setutxent(U);
+       UTMPX_UNLOCK(U);
+}
 
-static const char vers[] = "utmpx-1.00";
 
 void
 setutxent()
 {
+       _setutxent(&__utx__);
+}
 
-       (void)memset(&ut, 0, sizeof(ut));
-       if (fp == NULL)
-               return;
-       (void)fseeko(fp, (off_t)sizeof(ut), SEEK_SET);
+
+__private_extern__ void
+__endutxent(struct _utmpx *U)
+{
+       (void)memset(&U->ut, 0, sizeof(U->ut));
+       if (U->fp != NULL) {
+               int saveerrno = errno;
+               (void)fclose(U->fp);
+               errno = saveerrno;
+               U->fp = NULL;
+               U->readonly = 0;
+       }
 }
 
 
 void
-endutxent()
+_endutxent(struct _utmpx *U)
 {
+       TEST_UTMPX_T("_endutxent", U);
+       UTMPX_LOCK(U);
+       __endutxent(U);
+       UTMPX_UNLOCK(U);
+}
 
-       (void)memset(&ut, 0, sizeof(ut));
-       if (fp != NULL) {
-               (void)fclose(fp);
-               fp = NULL;
-               readonly = 0;
-       }
+
+void
+endutxent()
+{
+       _endutxent(&__utx__);
 }
 
 
-struct utmpx *
-getutxent()
+__private_extern__ struct utmpx *
+__getutxent(struct _utmpx *U)
 {
+       int saveerrno;
+#ifdef __LP64__
+       struct utmpx32 ut32;
+#endif /* __LP64__ */
 
-       if (fp == NULL) {
+       if (U->fp == NULL) {
                struct stat st;
 
-               if ((fp = fopen(utfile, "r+")) == NULL)
-                       if ((fp = fopen(utfile, "w+")) == NULL) {
-                               if ((fp = fopen(utfile, "r")) == NULL)
+               if ((U->fp = fopen(U->utfile, "r+")) == NULL)
+                       if ((U->fp = fopen(U->utfile, "w+")) == NULL) {
+                               if ((U->fp = fopen(U->utfile, "r")) == NULL)
                                        goto fail;
                                else
-                                       readonly = 1;
+                                       U->readonly = 1;
                        }
-                                       
+
+               fcntl(fileno(U->fp), F_SETFD, 1); /* set close-on-exec flag */
 
                /* get file size in order to check if new file */
-               if (fstat(fileno(fp), &st) == -1)
+               if (fstat(fileno(U->fp), &st) == -1)
                        goto failclose;
 
                if (st.st_size == 0) {
                        /* new file, add signature record */
-                       (void)memset(&ut, 0, sizeof(ut));
-                       ut.ut_type = SIGNATURE;
-                       (void)memcpy(ut.ut_user, vers, sizeof(vers));
-                       if (fwrite(&ut, sizeof(ut), 1, fp) != 1)
+#ifdef __LP64__
+                       (void)memset(&ut32, 0, sizeof(ut32));
+                       ut32.ut_type = SIGNATURE;
+                       (void)memcpy(ut32.ut_user, _utmpx_vers, sizeof(_utmpx_vers));
+                       if (fwrite(&ut32, sizeof(ut32), 1, U->fp) != 1)
+#else /* __LP64__ */
+                       (void)memset(&U->ut, 0, sizeof(U->ut));
+                       U->ut.ut_type = SIGNATURE;
+                       (void)memcpy(U->ut.ut_user, _utmpx_vers, sizeof(_utmpx_vers));
+                       if (fwrite(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
+#endif /* __LP64__ */
                                goto failclose;
                } else {
                        /* old file, read signature record */
-                       if (fread(&ut, sizeof(ut), 1, fp) != 1)
+#ifdef __LP64__
+                       if (fread(&ut32, sizeof(ut32), 1, U->fp) != 1)
+#else /* __LP64__ */
+                       if (fread(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
+#endif /* __LP64__ */
                                goto failclose;
-                       if (memcmp(ut.ut_user, vers, sizeof(vers)) != 0 ||
-                           ut.ut_type != SIGNATURE)
+#ifdef __LP64__
+                       if (memcmp(ut32.ut_user, _utmpx_vers, sizeof(_utmpx_vers)) != 0 ||
+                           ut32.ut_type != SIGNATURE)
+#else /* __LP64__ */
+                       if (memcmp(U->ut.ut_user, _utmpx_vers, sizeof(_utmpx_vers)) != 0 ||
+                           U->ut.ut_type != SIGNATURE)
+#endif /* __LP64__ */
+                       {
+                               errno = EINVAL;
                                goto failclose;
+                       }
                }
        }
 
-       if (fread(&ut, sizeof(ut), 1, fp) != 1)
+#ifdef __LP64__
+       if (fread(&ut32, sizeof(ut32), 1, U->fp) != 1)
+#else /* __LP64__ */
+       if (fread(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
+#endif /* __LP64__ */
                goto fail;
 
-       return &ut;
+#ifdef __LP64__
+       _utmpx32_64(&ut32, &U->ut);
+#endif /* __LP64__ */
+       return &U->ut;
 failclose:
-       (void)fclose(fp);
+       saveerrno = errno;
+       (void)fclose(U->fp);
+       errno = saveerrno;
+       U->fp = NULL;
 fail:
-       (void)memset(&ut, 0, sizeof(ut));
+       (void)memset(&U->ut, 0, sizeof(U->ut));
        return NULL;
 }
 
 
 struct utmpx *
-getutxid(const struct utmpx *utx)
+_getutxent(struct _utmpx *U)
 {
+       struct utmpx *ret;
+
+       TEST_UTMPX_T("_getutxent", U);
+       UTMPX_LOCK(U);
+       ret = __getutxent(U);
+       UTMPX_UNLOCK(U);
+       return ret;
+}
+
+
+struct utmpx *
+getutxent()
+{
+       return _getutxent(&__utx__);
+}
+
 
-       _DIAGASSERT(utx != NULL);
+struct utmpx *
+_getutxid(struct _utmpx *U, const struct utmpx *utx)
+{
+       struct utmpx temp;
+       const struct utmpx *ux;
+       struct utmpx *ret;
 
        if (utx->ut_type == EMPTY)
                return NULL;
 
+       TEST_UTMPX_T("_getutxid", U);
+       UTMPX_LOCK(U);
+       /* make a copy as needed, and auto-fill if requested */
+       ux = _utmpx_working_copy(utx, &temp, 1);
+       if (!ux) {
+               UTMPX_UNLOCK(U);
+               return NULL;
+       }
+
+       ret = __getutxid(U, ux);
+       UTMPX_UNLOCK(U);
+       return ret;
+}
+
+
+struct utmpx *
+getutxid(const struct utmpx *utx)
+{
+       return _getutxid(&__utx__, utx);
+}
+
+
+static struct utmpx *
+__getutxid(struct _utmpx *U, const struct utmpx *utx)
+{
+
        do {
-               if (ut.ut_type == EMPTY)
+               if (U->ut.ut_type == EMPTY)
                        continue;
                switch (utx->ut_type) {
                case EMPTY:
@@ -155,21 +284,21 @@ getutxid(const struct utmpx *utx)
                case BOOT_TIME:
                case OLD_TIME:
                case NEW_TIME:
-                       if (ut.ut_type == utx->ut_type)
-                               return &ut;
+                       if (U->ut.ut_type == utx->ut_type)
+                               return &U->ut;
                        break;
                case INIT_PROCESS:
                case LOGIN_PROCESS:
                case USER_PROCESS:
                case DEAD_PROCESS:
-                       switch (ut.ut_type) {
+                       switch (U->ut.ut_type) {
                        case INIT_PROCESS:
                        case LOGIN_PROCESS:
                        case USER_PROCESS:
                        case DEAD_PROCESS:
-                               if (memcmp(ut.ut_id, utx->ut_id,
-                                   sizeof(ut.ut_id)) == 0)
-                                       return &ut;
+                               if (memcmp(U->ut.ut_id, utx->ut_id,
+                                   sizeof(U->ut.ut_id)) == 0)
+                                       return &U->ut;
                                break;
                        default:
                                break;
@@ -178,188 +307,253 @@ getutxid(const struct utmpx *utx)
                default:
                        return NULL;
                }
-       } while (getutxent() != NULL);
+       } while (__getutxent(U) != NULL);
        return NULL;
 }
 
 
-struct utmpx *
-getutxline(const struct utmpx *utx)
+static struct utmpx *
+__getutxline(struct _utmpx *U, const struct utmpx *utx)
 {
-
-       _DIAGASSERT(utx != NULL);
-
        do {
-               switch (ut.ut_type) {
+               switch (U->ut.ut_type) {
                case EMPTY:
                        break;
                case LOGIN_PROCESS:
                case USER_PROCESS:
-                       if (strncmp(ut.ut_line, utx->ut_line,
-                           sizeof(ut.ut_line)) == 0)
-                               return &ut;
+                       if (strncmp(U->ut.ut_line, utx->ut_line,
+                           sizeof(U->ut.ut_line)) == 0)
+                               return &U->ut;
                        break;
                default:
                        break;
                }
-       } while (getutxent() != NULL);
+       } while (__getutxent(U) != NULL);
        return NULL;
 }
 
 
 struct utmpx *
-pututxline(const struct utmpx *utx)
+_getutxline(struct _utmpx *U, const struct utmpx *utx)
 {
-       struct utmpx temp, *u = NULL;
-       int gotlock = 0;
+       struct utmpx *ret;
+
+       TEST_UTMPX_T("_getutxline", U);
+       UTMPX_LOCK(U);
+       ret = __getutxline(U, utx);
+       UTMPX_UNLOCK(U);
+       return ret;
+}
 
-       _DIAGASSERT(utx != NULL);
 
-       if (utx == NULL)
+struct utmpx *
+getutxline(const struct utmpx *utx)
+{
+       return _getutxline(&__utx__, utx);
+}
+
+
+struct utmpx *
+_pututxline(struct _utmpx *U, const struct utmpx *utx)
+{
+       struct utmpx *ux;
+
+       if (utx == NULL) {
+               errno = EINVAL;
                return NULL;
+       }
 
-       if (strcmp(_PATH_UTMPX, utfile) == 0)
-               if ((fp != NULL && readonly) || (fp == NULL && geteuid() != 0))
-                       return utmp_update(utx);
+       TEST_UTMPX_T("_pututxline", U);
+       UTMPX_LOCK(U);
+       if ((ux = __pututxline(&__utx__, utx)) != NULL && __utx__.utfile_system) {
+               _utmpx_asl(ux); /* the equivalent of wtmpx and lastlogx */
+#ifdef UTMP_COMPAT
+               _write_utmp_compat(ux);
+#endif /* UTMP_COMPAT */
+       }
+       UTMPX_UNLOCK(U);
+       return ux;
+}
 
 
-       (void)memcpy(&temp, utx, sizeof(temp));
+struct utmpx *
+pututxline(const struct utmpx *utx)
+{
+       return _pututxline(&__utx__, utx);
+}
+
+__private_extern__ struct utmpx *
+__pututxline(struct _utmpx *U, const struct utmpx *utx)
+{
+       struct utmpx temp, *u = NULL, *x;
+       const struct utmpx *ux;
+#ifdef __LP64__
+       struct utmpx32 ut32;
+#endif /* __LP64__ */
+       struct flock fl;
+#define gotlock                (fl.l_start >= 0)
+
+       fl.l_start = -1; /* also means we haven't locked */
+       if (U->utfile_system)
+               if ((U->fp != NULL && U->readonly) || (U->fp == NULL && geteuid() != 0)) {
+                       errno = EPERM;
+                       return NULL;
+               }
 
-       if (fp == NULL) {
-               (void)getutxent();
-               if (fp == NULL || readonly)
+       if (U->fp == NULL) {
+               (void)__getutxent(U);
+               if (U->fp == NULL || U->readonly) {
+                       errno = EPERM;
                        return NULL;
+               }
        }
 
-       if (getutxid(&temp) == NULL) {
-               setutxent();
-               if (getutxid(&temp) == NULL) {
-                       if (lockf(fileno(fp), F_LOCK, (off_t)0) == -1)
+       /* make a copy as needed, and auto-fill if requested */
+       ux = _utmpx_working_copy(utx, &temp, 0);
+       if (!ux)
+               return NULL;
+
+       if ((x = __getutxid(U, ux)) == NULL) {
+               __setutxent(U);
+               if ((x = __getutxid(U, ux)) == NULL) {
+                       /*
+                        * utx->ut_type has any original mask bits, while
+                        * ux->ut_type has those mask bits removed.  If we
+                        * are trying to record a dead process, and
+                        * UTMPX_DEAD_IF_CORRESPONDING_MASK is set, then since
+                        * there is no matching entry, we return NULL.
+                        */
+                       if (ux->ut_type == DEAD_PROCESS &&
+                           (utx->ut_type & UTMPX_DEAD_IF_CORRESPONDING_MASK)) {
+                               errno = EINVAL;
                                return NULL;
-                       gotlock++;
-                       if (fseeko(fp, (off_t)0, SEEK_END) == -1)
+                       }
+                       /*
+                        * Replace lockf() with fcntl() and a fixed start
+                        * value.  We should already be at EOF.
+                        */
+                       if ((fl.l_start = lseek(fileno(U->fp), 0, SEEK_CUR)) < 0)
+                               return NULL;
+                       fl.l_len = 0;
+                       fl.l_whence = SEEK_SET;
+                       fl.l_type = F_WRLCK;
+                       if (fcntl(fileno(U->fp), F_SETLKW, &fl) == -1)
+                               return NULL;
+                       if (fseeko(U->fp, (off_t)0, SEEK_END) == -1)
                                goto fail;
                }
        }
 
        if (!gotlock) {
+               /*
+                * utx->ut_type has any original mask bits, while
+                * ux->ut_type has those mask bits removed.  If we
+                * are trying to record a dead process, if
+                * UTMPX_DEAD_IF_CORRESPONDING_MASK is set, but the found
+                * entry is not a (matching) USER_PROCESS, then return NULL.
+                */
+               if (ux->ut_type == DEAD_PROCESS &&
+                   (utx->ut_type & UTMPX_DEAD_IF_CORRESPONDING_MASK) &&
+                   x->ut_type != USER_PROCESS) {
+                       errno = EINVAL;
+                       return NULL;
+               }
                /* we are not appending */
-               if (fseeko(fp, -(off_t)sizeof(ut), SEEK_CUR) == -1)
+#ifdef __LP64__
+               if (fseeko(U->fp, -(off_t)sizeof(ut32), SEEK_CUR) == -1)
+#else /* __LP64__ */
+               if (fseeko(U->fp, -(off_t)sizeof(U->ut), SEEK_CUR) == -1)
+#endif /* __LP64__ */
                        return NULL;
        }
 
-       if (fwrite(&temp, sizeof (temp), 1, fp) != 1)
+#ifdef __LP64__
+       _utmpx64_32(ux, &ut32);
+       if (fwrite(&ut32, sizeof (ut32), 1, U->fp) != 1)
+#else /* __LP64__ */
+       if (fwrite(ux, sizeof (*ux), 1, U->fp) != 1)
+#endif /* __LP64__ */
                goto fail;
 
-       if (fflush(fp) == -1)
+       if (fflush(U->fp) == -1)
                goto fail;
 
-       u = memcpy(&ut, &temp, sizeof(ut));
+       u = memcpy(&U->ut, ux, sizeof(U->ut));
+       notify_post(UTMPX_CHANGE_NOTIFICATION);
 fail:
        if (gotlock) {
-               if (lockf(fileno(fp), F_ULOCK, (off_t)0) == -1)
+               int save = errno;
+               fl.l_type = F_UNLCK;
+               if (fcntl(fileno(U->fp), F_SETLK, &fl) == -1)
                        return NULL;
+               errno = save;
        }
        return u;
 }
 
 
-static struct utmpx *
-utmp_update(const struct utmpx *utx)
-{
-       char buf[sizeof(*utx) * 4 + 1];
-       pid_t pid;
-       int status;
-
-       _DIAGASSERT(utx != NULL);
-
-       (void)strvisx(buf, (const char *)(const void *)utx, sizeof(*utx),
-           VIS_WHITE);
-       switch (pid = fork()) {
-       case 0:
-               (void)execl(_PATH_UTMP_UPDATE,
-                   strrchr(_PATH_UTMP_UPDATE, '/') + 1, buf, NULL);
-               _exit(1);
-               /*NOTREACHED*/
-       case -1:
-               return NULL;
-       default:
-               if (waitpid(pid, &status, 0) == -1)
-                       return NULL;
-               if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
-                       return memcpy(&ut, utx, sizeof(ut));
-               return NULL;
-       }
-
-}
-
 /*
  * The following are extensions and not part of the X/Open spec.
  */
-int
-updwtmpx(const char *file, const struct utmpx *utx)
-{
-       int fd;
-       int saved_errno;
-
-       _DIAGASSERT(file != NULL);
-       _DIAGASSERT(utx != NULL);
-
-       fd = open(file, O_WRONLY|O_APPEND|O_SHLOCK);
-
-       if (fd == -1) {
-               if ((fd = open(file, O_CREAT|O_WRONLY|O_EXLOCK, 0644)) == -1)
-                       return -1;
-               (void)memset(&ut, 0, sizeof(ut));
-               ut.ut_type = SIGNATURE;
-               (void)memcpy(ut.ut_user, vers, sizeof(vers));
-               if (write(fd, &ut, sizeof(ut)) == -1)
-                       goto failed;
-       }
-       if (write(fd, utx, sizeof(*utx)) == -1)
-               goto failed;
-       if (close(fd) == -1)
-               return -1;
-       return 0;
-
-  failed:
-       saved_errno = errno;
-       (void) close(fd);
-       errno = saved_errno;
-       return -1;
-}
-
-
-int
-utmpxname(const char *fname)
+__private_extern__ int
+__utmpxname(struct _utmpx *U, const char *fname)
 {
        size_t len;
 
-       _DIAGASSERT(fname != NULL);
+       if (fname == NULL) {
+               if(!U->utfile_system)
+                       free(U->utfile);
+               U->utfile = _PATH_UTMPX;
+               U->utfile_system = 1;
+               __endutxent(U);
+               return 1;
+       }
 
        len = strlen(fname);
 
-       if (len >= sizeof(utfile))
+       if (len >= MAXPATHLEN)
                return 0;
 
        /* must end in x! */
        if (fname[len - 1] != 'x')
                return 0;
 
-       (void)strlcpy(utfile, fname, sizeof(utfile));
-       endutxent();
+       if (U->utfile_system)
+               U->utfile = NULL;
+       U->utfile_system = 0;
+       if ((U->utfile = reallocf(U->utfile, len + 1)) == NULL)
+               return 0;
+
+       (void)strcpy(U->utfile, fname);
+       __endutxent(U);
        return 1;
 }
 
+int
+_utmpxname(struct _utmpx *U, const char *fname)
+{
+       int ret;
+
+       TEST_UTMPX_T("_utmpxname", U);
+       UTMPX_LOCK(U);
+       ret = __utmpxname(U, fname);
+       UTMPX_UNLOCK(U);
+       return ret;
+}
+
+int
+utmpxname(const char *fname)
+{
+       return _utmpxname(&__utx__, fname);
+}
 
+#ifdef UNIFDEF_LEGACY_UTMP_APIS
 void
 getutmp(const struct utmpx *ux, struct utmp *u)
 {
 
-       _DIAGASSERT(ux != NULL);
-       _DIAGASSERT(u != NULL);
-
-       (void)memcpy(u->ut_name, ux->ut_name, sizeof(u->ut_name));
+       bzero(u, sizeof(*u));
+       (void)memcpy(u->ut_name, ux->ut_user, sizeof(u->ut_name));
        (void)memcpy(u->ut_line, ux->ut_line, sizeof(u->ut_line));
        (void)memcpy(u->ut_host, ux->ut_host, sizeof(u->ut_host));
        u->ut_time = ux->ut_tv.tv_sec;
@@ -369,82 +563,16 @@ void
 getutmpx(const struct utmp *u, struct utmpx *ux)
 {
 
-       _DIAGASSERT(ux != NULL);
-       _DIAGASSERT(u != NULL);
-
-       (void)memcpy(ux->ut_name, u->ut_name, sizeof(u->ut_name));
+       bzero(ux, sizeof(*ux));
+       (void)memcpy(ux->ut_user, u->ut_name, sizeof(u->ut_name));
+       ux->ut_user[sizeof(u->ut_name)] = 0;
        (void)memcpy(ux->ut_line, u->ut_line, sizeof(u->ut_line));
+       ux->ut_line[sizeof(u->ut_line)] = 0;
        (void)memcpy(ux->ut_host, u->ut_host, sizeof(u->ut_host));
+       ux->ut_host[sizeof(u->ut_host)] = 0;
        ux->ut_tv.tv_sec = u->ut_time;
        ux->ut_tv.tv_usec = 0;
-       (void)memset(&ux->ut_ss, 0, sizeof(ux->ut_ss));
-       ux->ut_pid = 0;
+       ux->ut_pid = getpid();
        ux->ut_type = USER_PROCESS;
-       ux->ut_session = 0;
-       ux->ut_exit.e_termination = 0;
-       ux->ut_exit.e_exit = 0;
-}
-
-struct lastlogx *
-getlastlogx(const char *fname, uid_t uid, struct lastlogx *ll)
-{
-       DBT key, data;
-       DB *db;
-
-       _DIAGASSERT(fname != NULL);
-       _DIAGASSERT(ll != NULL);
-
-       db = dbopen(fname, O_RDONLY|O_SHLOCK, 0, DB_HASH, NULL);
-
-       if (db == NULL)
-               return NULL;
-
-       key.data = &uid;
-       key.size = sizeof(uid);
-
-       if ((db->get)(db, &key, &data, 0) != 0)
-               goto error;
-
-       if (data.size != sizeof(*ll)) {
-               errno = EFTYPE;
-               goto error;
-       }
-
-       if (ll == NULL)
-               if ((ll = malloc(sizeof(*ll))) == NULL)
-                       goto done;
-
-       (void)memcpy(ll, data.data, sizeof(*ll));
-       goto done;
-error:
-       ll = NULL;
-done:
-       (db->close)(db);
-       return ll;
-}
-
-int
-updlastlogx(const char *fname, uid_t uid, struct lastlogx *ll)
-{
-       DBT key, data;
-       int error = 0;
-       DB *db;
-
-       _DIAGASSERT(fname != NULL);
-       _DIAGASSERT(ll != NULL);
-
-       db = dbopen(fname, O_RDWR|O_CREAT|O_EXLOCK, 0644, DB_HASH, NULL);
-
-       if (db == NULL)
-               return -1;
-
-       key.data = &uid;
-       key.size = sizeof(uid);
-       data.data = ll;
-       data.size = sizeof(*ll);
-       if ((db->put)(db, &key, &data, 0) != 0)
-               error = -1;
-
-       (db->close)(db);
-       return error;
 }
+#endif /* UNIFDEF_LEGACY_UTMP_APIS */
diff --git a/gen/NetBSD/utmpx.c.patch b/gen/NetBSD/utmpx.c.patch
deleted file mode 100644 (file)
index a0da286..0000000
+++ /dev/null
@@ -1,765 +0,0 @@
---- utmpx.c.orig       2010-06-24 19:43:32.000000000 -0700
-+++ utmpx.c    2010-06-29 11:25:57.000000000 -0700
-@@ -42,111 +42,240 @@ __RCSID("$NetBSD: utmpx.c,v 1.25 2008/04
- #include <sys/time.h>
- #include <sys/wait.h>
--#include <assert.h>
--#include <db.h>
--#include <errno.h>
- #include <fcntl.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
-+#ifdef UNIFDEF_LEGACY_UTMP_APIS
- #include <utmp.h>
-+#endif /* UNIFDEF_LEGACY_UTMP_APIS */
- #include <utmpx.h>
-+#include <utmpx-darwin.h>
-+#include <errno.h>
- #include <vis.h>
-+#include <notify.h>
--static FILE *fp;
--static int readonly = 0;
--static struct utmpx ut;
--static char utfile[MAXPATHLEN] = _PATH_UTMPX;
-+/* This is the default struct _utmpx shared by the POSIX APIs */
-+__private_extern__
-+struct _utmpx __utx__ = {
-+      __UTX_MAGIC__,                  /* magic */
-+      {},                             /* ut */
-+      PTHREAD_MUTEX_INITIALIZER,      /* utmpx_mutex */
-+      _PATH_UTMPX,                    /* utfile */
-+      NULL,                           /* fp */
-+      1,                              /* utfile_system */
-+      0,                              /* readonly */
-+};
-+
-+static struct utmpx *__getutxid(struct _utmpx *, const struct utmpx *);
--static struct utmpx *utmp_update(const struct utmpx *);
-+__private_extern__ const char _utmpx_vers[] = "utmpx-1.00";
--static const char vers[] = "utmpx-1.00";
-+__private_extern__ void
-+__setutxent(struct _utmpx *U)
-+{
-+
-+      (void)memset(&U->ut, 0, sizeof(U->ut));
-+      if (U->fp == NULL)
-+              return;
-+#ifdef __LP64__
-+      (void)fseeko(U->fp, (off_t)sizeof(struct utmpx32), SEEK_SET);
-+#else /* __LP64__ */
-+      (void)fseeko(U->fp, (off_t)sizeof(U->ut), SEEK_SET);
-+#endif /* __LP64__ */
-+}
- void
--setutxent()
-+_setutxent(struct _utmpx *U)
- {
--      (void)memset(&ut, 0, sizeof(ut));
--      if (fp == NULL)
--              return;
--      (void)fseeko(fp, (off_t)sizeof(ut), SEEK_SET);
-+      TEST_UTMPX_T("_setutxent", U);
-+      UTMPX_LOCK(U);
-+      __setutxent(U);
-+      UTMPX_UNLOCK(U);
- }
- void
--endutxent()
-+setutxent()
- {
-+      _setutxent(&__utx__);
-+}
-+
--      (void)memset(&ut, 0, sizeof(ut));
--      if (fp != NULL) {
--              (void)fclose(fp);
--              fp = NULL;
--              readonly = 0;
-+__private_extern__ void
-+__endutxent(struct _utmpx *U)
-+{
-+      (void)memset(&U->ut, 0, sizeof(U->ut));
-+      if (U->fp != NULL) {
-+              int saveerrno = errno;
-+              (void)fclose(U->fp);
-+              errno = saveerrno;
-+              U->fp = NULL;
-+              U->readonly = 0;
-       }
- }
--struct utmpx *
--getutxent()
-+void
-+_endutxent(struct _utmpx *U)
- {
-+      TEST_UTMPX_T("_endutxent", U);
-+      UTMPX_LOCK(U);
-+      __endutxent(U);
-+      UTMPX_UNLOCK(U);
-+}
--      if (fp == NULL) {
-+
-+void
-+endutxent()
-+{
-+      _endutxent(&__utx__);
-+}
-+
-+
-+__private_extern__ struct utmpx *
-+__getutxent(struct _utmpx *U)
-+{
-+      int saveerrno;
-+#ifdef __LP64__
-+      struct utmpx32 ut32;
-+#endif /* __LP64__ */
-+
-+      if (U->fp == NULL) {
-               struct stat st;
--              if ((fp = fopen(utfile, "r+")) == NULL)
--                      if ((fp = fopen(utfile, "w+")) == NULL) {
--                              if ((fp = fopen(utfile, "r")) == NULL)
-+              if ((U->fp = fopen(U->utfile, "r+")) == NULL)
-+                      if ((U->fp = fopen(U->utfile, "w+")) == NULL) {
-+                              if ((U->fp = fopen(U->utfile, "r")) == NULL)
-                                       goto fail;
-                               else
--                                      readonly = 1;
-+                                      U->readonly = 1;
-                       }
--                                      
-+
-+              fcntl(fileno(U->fp), F_SETFD, 1); /* set close-on-exec flag */
-               /* get file size in order to check if new file */
--              if (fstat(fileno(fp), &st) == -1)
-+              if (fstat(fileno(U->fp), &st) == -1)
-                       goto failclose;
-               if (st.st_size == 0) {
-                       /* new file, add signature record */
--                      (void)memset(&ut, 0, sizeof(ut));
--                      ut.ut_type = SIGNATURE;
--                      (void)memcpy(ut.ut_user, vers, sizeof(vers));
--                      if (fwrite(&ut, sizeof(ut), 1, fp) != 1)
-+#ifdef __LP64__
-+                      (void)memset(&ut32, 0, sizeof(ut32));
-+                      ut32.ut_type = SIGNATURE;
-+                      (void)memcpy(ut32.ut_user, _utmpx_vers, sizeof(_utmpx_vers));
-+                      if (fwrite(&ut32, sizeof(ut32), 1, U->fp) != 1)
-+#else /* __LP64__ */
-+                      (void)memset(&U->ut, 0, sizeof(U->ut));
-+                      U->ut.ut_type = SIGNATURE;
-+                      (void)memcpy(U->ut.ut_user, _utmpx_vers, sizeof(_utmpx_vers));
-+                      if (fwrite(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
-+#endif /* __LP64__ */
-                               goto failclose;
-               } else {
-                       /* old file, read signature record */
--                      if (fread(&ut, sizeof(ut), 1, fp) != 1)
-+#ifdef __LP64__
-+                      if (fread(&ut32, sizeof(ut32), 1, U->fp) != 1)
-+#else /* __LP64__ */
-+                      if (fread(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
-+#endif /* __LP64__ */
-                               goto failclose;
--                      if (memcmp(ut.ut_user, vers, sizeof(vers)) != 0 ||
--                          ut.ut_type != SIGNATURE)
-+#ifdef __LP64__
-+                      if (memcmp(ut32.ut_user, _utmpx_vers, sizeof(_utmpx_vers)) != 0 ||
-+                          ut32.ut_type != SIGNATURE)
-+#else /* __LP64__ */
-+                      if (memcmp(U->ut.ut_user, _utmpx_vers, sizeof(_utmpx_vers)) != 0 ||
-+                          U->ut.ut_type != SIGNATURE)
-+#endif /* __LP64__ */
-+                      {
-+                              errno = EINVAL;
-                               goto failclose;
-+                      }
-               }
-       }
--      if (fread(&ut, sizeof(ut), 1, fp) != 1)
-+#ifdef __LP64__
-+      if (fread(&ut32, sizeof(ut32), 1, U->fp) != 1)
-+#else /* __LP64__ */
-+      if (fread(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
-+#endif /* __LP64__ */
-               goto fail;
--      return &ut;
-+#ifdef __LP64__
-+      _utmpx32_64(&ut32, &U->ut);
-+#endif /* __LP64__ */
-+      return &U->ut;
- failclose:
--      (void)fclose(fp);
-+      saveerrno = errno;
-+      (void)fclose(U->fp);
-+      errno = saveerrno;
-+      U->fp = NULL;
- fail:
--      (void)memset(&ut, 0, sizeof(ut));
-+      (void)memset(&U->ut, 0, sizeof(U->ut));
-       return NULL;
- }
- struct utmpx *
--getutxid(const struct utmpx *utx)
-+_getutxent(struct _utmpx *U)
- {
-+      struct utmpx *ret;
-+
-+      TEST_UTMPX_T("_getutxent", U);
-+      UTMPX_LOCK(U);
-+      ret = __getutxent(U);
-+      UTMPX_UNLOCK(U);
-+      return ret;
-+}
-+
-+
-+struct utmpx *
-+getutxent()
-+{
-+      return _getutxent(&__utx__);
-+}
--      _DIAGASSERT(utx != NULL);
-+
-+struct utmpx *
-+_getutxid(struct _utmpx *U, const struct utmpx *utx)
-+{
-+      struct utmpx temp;
-+      const struct utmpx *ux;
-+      struct utmpx *ret;
-       if (utx->ut_type == EMPTY)
-               return NULL;
-+      TEST_UTMPX_T("_getutxid", U);
-+      UTMPX_LOCK(U);
-+      /* make a copy as needed, and auto-fill if requested */
-+      ux = _utmpx_working_copy(utx, &temp, 1);
-+      if (!ux) {
-+              UTMPX_UNLOCK(U);
-+              return NULL;
-+      }
-+
-+      ret = __getutxid(U, ux);
-+      UTMPX_UNLOCK(U);
-+      return ret;
-+}
-+
-+
-+struct utmpx *
-+getutxid(const struct utmpx *utx)
-+{
-+      return _getutxid(&__utx__, utx);
-+}
-+
-+
-+static struct utmpx *
-+__getutxid(struct _utmpx *U, const struct utmpx *utx)
-+{
-+
-       do {
--              if (ut.ut_type == EMPTY)
-+              if (U->ut.ut_type == EMPTY)
-                       continue;
-               switch (utx->ut_type) {
-               case EMPTY:
-@@ -155,21 +284,21 @@ getutxid(const struct utmpx *utx)
-               case BOOT_TIME:
-               case OLD_TIME:
-               case NEW_TIME:
--                      if (ut.ut_type == utx->ut_type)
--                              return &ut;
-+                      if (U->ut.ut_type == utx->ut_type)
-+                              return &U->ut;
-                       break;
-               case INIT_PROCESS:
-               case LOGIN_PROCESS:
-               case USER_PROCESS:
-               case DEAD_PROCESS:
--                      switch (ut.ut_type) {
-+                      switch (U->ut.ut_type) {
-                       case INIT_PROCESS:
-                       case LOGIN_PROCESS:
-                       case USER_PROCESS:
-                       case DEAD_PROCESS:
--                              if (memcmp(ut.ut_id, utx->ut_id,
--                                  sizeof(ut.ut_id)) == 0)
--                                      return &ut;
-+                              if (memcmp(U->ut.ut_id, utx->ut_id,
-+                                  sizeof(U->ut.ut_id)) == 0)
-+                                      return &U->ut;
-                               break;
-                       default:
-                               break;
-@@ -178,188 +307,253 @@ getutxid(const struct utmpx *utx)
-               default:
-                       return NULL;
-               }
--      } while (getutxent() != NULL);
-+      } while (__getutxent(U) != NULL);
-       return NULL;
- }
--struct utmpx *
--getutxline(const struct utmpx *utx)
-+static struct utmpx *
-+__getutxline(struct _utmpx *U, const struct utmpx *utx)
- {
--
--      _DIAGASSERT(utx != NULL);
--
-       do {
--              switch (ut.ut_type) {
-+              switch (U->ut.ut_type) {
-               case EMPTY:
-                       break;
-               case LOGIN_PROCESS:
-               case USER_PROCESS:
--                      if (strncmp(ut.ut_line, utx->ut_line,
--                          sizeof(ut.ut_line)) == 0)
--                              return &ut;
-+                      if (strncmp(U->ut.ut_line, utx->ut_line,
-+                          sizeof(U->ut.ut_line)) == 0)
-+                              return &U->ut;
-                       break;
-               default:
-                       break;
-               }
--      } while (getutxent() != NULL);
-+      } while (__getutxent(U) != NULL);
-       return NULL;
- }
- struct utmpx *
--pututxline(const struct utmpx *utx)
-+_getutxline(struct _utmpx *U, const struct utmpx *utx)
-+{
-+      struct utmpx *ret;
-+
-+      TEST_UTMPX_T("_getutxline", U);
-+      UTMPX_LOCK(U);
-+      ret = __getutxline(U, utx);
-+      UTMPX_UNLOCK(U);
-+      return ret;
-+}
-+
-+
-+struct utmpx *
-+getutxline(const struct utmpx *utx)
- {
--      struct utmpx temp, *u = NULL;
--      int gotlock = 0;
-+      return _getutxline(&__utx__, utx);
-+}
--      _DIAGASSERT(utx != NULL);
--      if (utx == NULL)
-+struct utmpx *
-+_pututxline(struct _utmpx *U, const struct utmpx *utx)
-+{
-+      struct utmpx *ux;
-+
-+      if (utx == NULL) {
-+              errno = EINVAL;
-               return NULL;
-+      }
--      if (strcmp(_PATH_UTMPX, utfile) == 0)
--              if ((fp != NULL && readonly) || (fp == NULL && geteuid() != 0))
--                      return utmp_update(utx);
-+      TEST_UTMPX_T("_pututxline", U);
-+      UTMPX_LOCK(U);
-+      if ((ux = __pututxline(&__utx__, utx)) != NULL && __utx__.utfile_system) {
-+              _utmpx_asl(ux); /* the equivalent of wtmpx and lastlogx */
-+#ifdef UTMP_COMPAT
-+              _write_utmp_compat(ux);
-+#endif /* UTMP_COMPAT */
-+      }
-+      UTMPX_UNLOCK(U);
-+      return ux;
-+}
--      (void)memcpy(&temp, utx, sizeof(temp));
-+struct utmpx *
-+pututxline(const struct utmpx *utx)
-+{
-+      return _pututxline(&__utx__, utx);
-+}
-+
-+__private_extern__ struct utmpx *
-+__pututxline(struct _utmpx *U, const struct utmpx *utx)
-+{
-+      struct utmpx temp, *u = NULL, *x;
-+      const struct utmpx *ux;
-+#ifdef __LP64__
-+      struct utmpx32 ut32;
-+#endif /* __LP64__ */
-+      struct flock fl;
-+#define gotlock               (fl.l_start >= 0)
-+
-+      fl.l_start = -1; /* also means we haven't locked */
-+      if (U->utfile_system)
-+              if ((U->fp != NULL && U->readonly) || (U->fp == NULL && geteuid() != 0)) {
-+                      errno = EPERM;
-+                      return NULL;
-+              }
--      if (fp == NULL) {
--              (void)getutxent();
--              if (fp == NULL || readonly)
-+      if (U->fp == NULL) {
-+              (void)__getutxent(U);
-+              if (U->fp == NULL || U->readonly) {
-+                      errno = EPERM;
-                       return NULL;
-+              }
-       }
--      if (getutxid(&temp) == NULL) {
--              setutxent();
--              if (getutxid(&temp) == NULL) {
--                      if (lockf(fileno(fp), F_LOCK, (off_t)0) == -1)
-+      /* make a copy as needed, and auto-fill if requested */
-+      ux = _utmpx_working_copy(utx, &temp, 0);
-+      if (!ux)
-+              return NULL;
-+
-+      if ((x = __getutxid(U, ux)) == NULL) {
-+              __setutxent(U);
-+              if ((x = __getutxid(U, ux)) == NULL) {
-+                      /*
-+                       * utx->ut_type has any original mask bits, while
-+                       * ux->ut_type has those mask bits removed.  If we
-+                       * are trying to record a dead process, and
-+                       * UTMPX_DEAD_IF_CORRESPONDING_MASK is set, then since
-+                       * there is no matching entry, we return NULL.
-+                       */
-+                      if (ux->ut_type == DEAD_PROCESS &&
-+                          (utx->ut_type & UTMPX_DEAD_IF_CORRESPONDING_MASK)) {
-+                              errno = EINVAL;
-                               return NULL;
--                      gotlock++;
--                      if (fseeko(fp, (off_t)0, SEEK_END) == -1)
-+                      }
-+                      /*
-+                       * Replace lockf() with fcntl() and a fixed start
-+                       * value.  We should already be at EOF.
-+                       */
-+                      if ((fl.l_start = lseek(fileno(U->fp), 0, SEEK_CUR)) < 0)
-+                              return NULL;
-+                      fl.l_len = 0;
-+                      fl.l_whence = SEEK_SET;
-+                      fl.l_type = F_WRLCK;
-+                      if (fcntl(fileno(U->fp), F_SETLKW, &fl) == -1)
-+                              return NULL;
-+                      if (fseeko(U->fp, (off_t)0, SEEK_END) == -1)
-                               goto fail;
-               }
-       }
-       if (!gotlock) {
-+              /*
-+               * utx->ut_type has any original mask bits, while
-+               * ux->ut_type has those mask bits removed.  If we
-+               * are trying to record a dead process, if
-+               * UTMPX_DEAD_IF_CORRESPONDING_MASK is set, but the found
-+               * entry is not a (matching) USER_PROCESS, then return NULL.
-+               */
-+              if (ux->ut_type == DEAD_PROCESS &&
-+                  (utx->ut_type & UTMPX_DEAD_IF_CORRESPONDING_MASK) &&
-+                  x->ut_type != USER_PROCESS) {
-+                      errno = EINVAL;
-+                      return NULL;
-+              }
-               /* we are not appending */
--              if (fseeko(fp, -(off_t)sizeof(ut), SEEK_CUR) == -1)
-+#ifdef __LP64__
-+              if (fseeko(U->fp, -(off_t)sizeof(ut32), SEEK_CUR) == -1)
-+#else /* __LP64__ */
-+              if (fseeko(U->fp, -(off_t)sizeof(U->ut), SEEK_CUR) == -1)
-+#endif /* __LP64__ */
-                       return NULL;
-       }
--      if (fwrite(&temp, sizeof (temp), 1, fp) != 1)
-+#ifdef __LP64__
-+      _utmpx64_32(ux, &ut32);
-+      if (fwrite(&ut32, sizeof (ut32), 1, U->fp) != 1)
-+#else /* __LP64__ */
-+      if (fwrite(ux, sizeof (*ux), 1, U->fp) != 1)
-+#endif /* __LP64__ */
-               goto fail;
--      if (fflush(fp) == -1)
-+      if (fflush(U->fp) == -1)
-               goto fail;
--      u = memcpy(&ut, &temp, sizeof(ut));
-+      u = memcpy(&U->ut, ux, sizeof(U->ut));
-+      notify_post(UTMPX_CHANGE_NOTIFICATION);
- fail:
-       if (gotlock) {
--              if (lockf(fileno(fp), F_ULOCK, (off_t)0) == -1)
-+              int save = errno;
-+              fl.l_type = F_UNLCK;
-+              if (fcntl(fileno(U->fp), F_SETLK, &fl) == -1)
-                       return NULL;
-+              errno = save;
-       }
-       return u;
- }
--static struct utmpx *
--utmp_update(const struct utmpx *utx)
--{
--      char buf[sizeof(*utx) * 4 + 1];
--      pid_t pid;
--      int status;
--
--      _DIAGASSERT(utx != NULL);
--
--      (void)strvisx(buf, (const char *)(const void *)utx, sizeof(*utx),
--          VIS_WHITE);
--      switch (pid = fork()) {
--      case 0:
--              (void)execl(_PATH_UTMP_UPDATE,
--                  strrchr(_PATH_UTMP_UPDATE, '/') + 1, buf, NULL);
--              _exit(1);
--              /*NOTREACHED*/
--      case -1:
--              return NULL;
--      default:
--              if (waitpid(pid, &status, 0) == -1)
--                      return NULL;
--              if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
--                      return memcpy(&ut, utx, sizeof(ut));
--              return NULL;
--      }
--
--}
--
- /*
-  * The following are extensions and not part of the X/Open spec.
-  */
--int
--updwtmpx(const char *file, const struct utmpx *utx)
--{
--      int fd;
--      int saved_errno;
--
--      _DIAGASSERT(file != NULL);
--      _DIAGASSERT(utx != NULL);
--
--      fd = open(file, O_WRONLY|O_APPEND|O_SHLOCK);
--
--      if (fd == -1) {
--              if ((fd = open(file, O_CREAT|O_WRONLY|O_EXLOCK, 0644)) == -1)
--                      return -1;
--              (void)memset(&ut, 0, sizeof(ut));
--              ut.ut_type = SIGNATURE;
--              (void)memcpy(ut.ut_user, vers, sizeof(vers));
--              if (write(fd, &ut, sizeof(ut)) == -1)
--                      goto failed;
--      }
--      if (write(fd, utx, sizeof(*utx)) == -1)
--              goto failed;
--      if (close(fd) == -1)
--              return -1;
--      return 0;
--
--  failed:
--      saved_errno = errno;
--      (void) close(fd);
--      errno = saved_errno;
--      return -1;
--}
--
--
--int
--utmpxname(const char *fname)
-+__private_extern__ int
-+__utmpxname(struct _utmpx *U, const char *fname)
- {
-       size_t len;
--      _DIAGASSERT(fname != NULL);
-+      if (fname == NULL) {
-+              if(!U->utfile_system)
-+                      free(U->utfile);
-+              U->utfile = _PATH_UTMPX;
-+              U->utfile_system = 1;
-+              __endutxent(U);
-+              return 1;
-+      }
-       len = strlen(fname);
--      if (len >= sizeof(utfile))
-+      if (len >= MAXPATHLEN)
-               return 0;
-       /* must end in x! */
-       if (fname[len - 1] != 'x')
-               return 0;
--      (void)strlcpy(utfile, fname, sizeof(utfile));
--      endutxent();
-+      if (U->utfile_system)
-+              U->utfile = NULL;
-+      U->utfile_system = 0;
-+      if ((U->utfile = reallocf(U->utfile, len + 1)) == NULL)
-+              return 0;
-+
-+      (void)strcpy(U->utfile, fname);
-+      __endutxent(U);
-       return 1;
- }
-+int
-+_utmpxname(struct _utmpx *U, const char *fname)
-+{
-+      int ret;
-+
-+      TEST_UTMPX_T("_utmpxname", U);
-+      UTMPX_LOCK(U);
-+      ret = __utmpxname(U, fname);
-+      UTMPX_UNLOCK(U);
-+      return ret;
-+}
-+
-+int
-+utmpxname(const char *fname)
-+{
-+      return _utmpxname(&__utx__, fname);
-+}
-+#ifdef UNIFDEF_LEGACY_UTMP_APIS
- void
- getutmp(const struct utmpx *ux, struct utmp *u)
- {
--      _DIAGASSERT(ux != NULL);
--      _DIAGASSERT(u != NULL);
--
--      (void)memcpy(u->ut_name, ux->ut_name, sizeof(u->ut_name));
-+      bzero(u, sizeof(*u));
-+      (void)memcpy(u->ut_name, ux->ut_user, sizeof(u->ut_name));
-       (void)memcpy(u->ut_line, ux->ut_line, sizeof(u->ut_line));
-       (void)memcpy(u->ut_host, ux->ut_host, sizeof(u->ut_host));
-       u->ut_time = ux->ut_tv.tv_sec;
-@@ -369,82 +563,16 @@ void
- getutmpx(const struct utmp *u, struct utmpx *ux)
- {
--      _DIAGASSERT(ux != NULL);
--      _DIAGASSERT(u != NULL);
--
--      (void)memcpy(ux->ut_name, u->ut_name, sizeof(u->ut_name));
-+      bzero(ux, sizeof(*ux));
-+      (void)memcpy(ux->ut_user, u->ut_name, sizeof(u->ut_name));
-+      ux->ut_user[sizeof(u->ut_name)] = 0;
-       (void)memcpy(ux->ut_line, u->ut_line, sizeof(u->ut_line));
-+      ux->ut_line[sizeof(u->ut_line)] = 0;
-       (void)memcpy(ux->ut_host, u->ut_host, sizeof(u->ut_host));
-+      ux->ut_host[sizeof(u->ut_host)] = 0;
-       ux->ut_tv.tv_sec = u->ut_time;
-       ux->ut_tv.tv_usec = 0;
--      (void)memset(&ux->ut_ss, 0, sizeof(ux->ut_ss));
--      ux->ut_pid = 0;
-+      ux->ut_pid = getpid();
-       ux->ut_type = USER_PROCESS;
--      ux->ut_session = 0;
--      ux->ut_exit.e_termination = 0;
--      ux->ut_exit.e_exit = 0;
--}
--
--struct lastlogx *
--getlastlogx(const char *fname, uid_t uid, struct lastlogx *ll)
--{
--      DBT key, data;
--      DB *db;
--
--      _DIAGASSERT(fname != NULL);
--      _DIAGASSERT(ll != NULL);
--
--      db = dbopen(fname, O_RDONLY|O_SHLOCK, 0, DB_HASH, NULL);
--
--      if (db == NULL)
--              return NULL;
--
--      key.data = &uid;
--      key.size = sizeof(uid);
--
--      if ((db->get)(db, &key, &data, 0) != 0)
--              goto error;
--
--      if (data.size != sizeof(*ll)) {
--              errno = EFTYPE;
--              goto error;
--      }
--
--      if (ll == NULL)
--              if ((ll = malloc(sizeof(*ll))) == NULL)
--                      goto done;
--
--      (void)memcpy(ll, data.data, sizeof(*ll));
--      goto done;
--error:
--      ll = NULL;
--done:
--      (db->close)(db);
--      return ll;
--}
--
--int
--updlastlogx(const char *fname, uid_t uid, struct lastlogx *ll)
--{
--      DBT key, data;
--      int error = 0;
--      DB *db;
--
--      _DIAGASSERT(fname != NULL);
--      _DIAGASSERT(ll != NULL);
--
--      db = dbopen(fname, O_RDWR|O_CREAT|O_EXLOCK, 0644, DB_HASH, NULL);
--
--      if (db == NULL)
--              return -1;
--
--      key.data = &uid;
--      key.size = sizeof(uid);
--      data.data = ll;
--      data.size = sizeof(*ll);
--      if ((db->put)(db, &key, &data, 0) != 0)
--              error = -1;
--
--      (db->close)(db);
--      return error;
- }
-+#endif /* UNIFDEF_LEGACY_UTMP_APIS */
diff --git a/gen/_rand48-fbsd.c b/gen/_rand48-fbsd.c
deleted file mode 100644 (file)
index da4d69e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/_rand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-uint48 _rand48_seed = RAND48_SEED;
-uint48 _rand48_mult = RAND48_MULT;
-uint48 _rand48_add = RAND48_ADD;
index db547df3bdeecfc0c2740ea3cc7a9f12aa4dff7f..7f2d49a9cb70d217afbfaf560e2d50dd3e3564a3 100644 (file)
@@ -128,3 +128,4 @@ void _simple_sfree(_SIMPLE_STRING __b);
  */
 void _simple_asl_log(int __level, const char *__facility, const char *__message);
 void _simple_asl_log_prog(int level, const char *facility, const char *message, const char *progname);
+__END_DECLS
diff --git a/gen/alarm-fbsd.c b/gen/alarm-fbsd.c
deleted file mode 120000 (symlink)
index ca8f1f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./alarm.c
\ No newline at end of file
diff --git a/gen/alarm.3 b/gen/alarm.3
deleted file mode 100644 (file)
index 9826ce1..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)alarm.3    8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/alarm.3,v 1.17 2007/01/09 00:27:52 imp Exp $
-.\"
-.Dd April 19, 1994
-.Dt ALARM 3
-.Os
-.Sh NAME
-.Nm alarm
-.Nd set signal timer alarm
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft unsigned
-.Fn alarm "unsigned seconds"
-.Sh DESCRIPTION
-.Bf -symbolic
-This interface is made obsolete by
-.Xr setitimer 2 .
-.Ef
-.Pp
-The
-.Fn alarm
-function sets a timer to deliver the signal
-.Dv SIGALRM
-to the calling process after the specified number of
-.Fa seconds .
-If an alarm has already been set with
-.Fn alarm
-but has not been delivered, another call to
-.Fn alarm
-will supersede the prior call.
-The request
-.Fn alarm "0"
-voids the current
-alarm and the signal SIGALRM will not be delivered.
-.Pp
-Due to
-.Xr setitimer 2
-restriction the maximum number of
-.Fa seconds
-allowed is 100000000.
-.Sh RETURN VALUES
-The return value of
-.Fn alarm
-is the amount of time left on the timer from a previous call to
-.Fn alarm .
-If no alarm is currently set, the return value is 0.
-.Sh SEE ALSO
-.Xr setitimer 2 ,
-.Xr sigaction 2 ,
-.Xr sigpause 2 ,
-.Xr sigvec 2 ,
-.Xr signal 3 ,
-.Xr sleep 3 ,
-.Xr ualarm 3 ,
-.Xr usleep 3
-.\" .Sh STANDARDS
-.\" The
-.\" .Fn alarm
-.\" function conforms to
-.\" .St -p1003.1-90 .
-.Sh HISTORY
-An
-.Fn alarm
-function appeared in
-.At v7 .
diff --git a/gen/arc4random-fbsd.c b/gen/arc4random-fbsd.c
deleted file mode 100644 (file)
index 869effa..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (c) 1996, David Mazieres <dm@uun.org>
- * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Arc4 random number generator for OpenBSD.
- *
- * This code is derived from section 17.1 of Applied Cryptography,
- * second edition, which describes a stream cipher allegedly
- * compatible with RSA Labs "RC4" cipher (the actual description of
- * which is a trade secret).  The same algorithm is used as a stream
- * cipher called "arcfour" in Tatu Ylonen's ssh package.
- *
- * Here the stream cipher has been modified always to include the time
- * when initializing the state.  That makes it impossible to
- * regenerate the same random sequence twice, so this can't be used
- * for encryption, but will generate good random numbers.
- *
- * RC4 is a registered trademark of RSA Laboratories.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.25 2008/09/09 09:46:36 ache Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include "libc_private.h"
-#include "un-namespace.h"
-
-struct arc4_stream {
-       u_int8_t i;
-       u_int8_t j;
-       u_int8_t s[256];
-};
-
-static int lock = 0;
-extern void spin_lock(int*);
-extern void spin_unlock(int*);
-
-#define        RANDOMDEV       "/dev/random"
-#define KEYSIZE                128
-#define        THREAD_LOCK()                                           \
-       do {                                                    \
-               if (__isthreaded)                               \
-                       spin_lock(&lock);                       \
-       } while (0)
-
-#define        THREAD_UNLOCK()                                         \
-       do {                                                    \
-               if (__isthreaded)                               \
-                       spin_unlock(&lock);                     \
-       } while (0)
-
-static struct arc4_stream rs = {
-       .i = 0,
-       .j = 0,
-       .s = {
-                 0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
-                16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
-                32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
-                48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
-                64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
-                80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
-                96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-               112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
-               128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
-               144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
-               160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
-               176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
-               192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
-               208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
-               224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
-               240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
-       }
-};
-static int rs_initialized;
-static int rs_stired;
-static int arc4_count;
-
-static inline u_int8_t arc4_getbyte(void);
-static void arc4_stir(void);
-
-static struct {
-       struct timeval  tv;
-       pid_t           pid;
-       u_int8_t        rnd[KEYSIZE];
-} rdat;
-static volatile int rs_data_available = 0;
-
-static inline void
-arc4_addrandom(u_char *dat, int datlen)
-{
-       int     n;
-       u_int8_t si;
-
-       rs.i--;
-       for (n = 0; n < 256; n++) {
-               rs.i = (rs.i + 1);
-               si = rs.s[rs.i];
-               rs.j = (rs.j + si + dat[n % datlen]);
-               rs.s[rs.i] = rs.s[rs.j];
-               rs.s[rs.j] = si;
-       }
-       rs.j = rs.i;
-}
-
-static void
-arc4_fetch(void)
-{
-       int done, fd;
-       fd = _open(RANDOMDEV, O_RDONLY, 0);
-       done = 0;
-       if (fd >= 0) {
-               if (_read(fd, &rdat, KEYSIZE) == KEYSIZE)
-                       done = 1;
-               (void)_close(fd);
-       } 
-       if (!done) {
-               (void)gettimeofday(&rdat.tv, NULL);
-               rdat.pid = getpid();
-               /* We'll just take whatever was on the stack too... */
-       }
-}
-
-static void
-arc4_stir(void)
-{
-       int n;
-       /*
-        * If we don't have data, we need some now before we can integrate
-        * it into the static buffers
-        */
-       if (!rs_data_available)
-       {
-               arc4_fetch();
-       }
-       rs_data_available = 0;
-       __sync_synchronize();
-
-       arc4_addrandom((u_char *)&rdat, KEYSIZE);
-
-       /*
-        * Throw away the first N bytes of output, as suggested in the
-        * paper "Weaknesses in the Key Scheduling Algorithm of RC4"
-        * by Fluher, Mantin, and Shamir.  N=1024 is based on
-        * suggestions in the paper "(Not So) Random Shuffles of RC4"
-        * by Ilya Mironov.
-        */
-       for (n = 0; n < 1024; n++)
-               (void) arc4_getbyte();
-       arc4_count = 1600000;
-       rs_stired = 1;
-}
-
-static inline u_int8_t
-arc4_getbyte(void)
-{
-       u_int8_t si, sj;
-
-       rs.i = (rs.i + 1);
-       si = rs.s[rs.i];
-       rs.j = (rs.j + si);
-       sj = rs.s[rs.j];
-       rs.s[rs.i] = sj;
-       rs.s[rs.j] = si;
-
-       return (rs.s[(si + sj) & 0xff]);
-}
-
-static inline u_int32_t
-arc4_getword(void)
-{
-       u_int32_t val;
-
-       val = arc4_getbyte() << 24;
-       val |= arc4_getbyte() << 16;
-       val |= arc4_getbyte() << 8;
-       val |= arc4_getbyte();
-
-       return (val);
-}
-
-/* 7944700: force restir in child */
-__private_extern__ void
-_arc4_fork_child(void)
-{
-       rs_stired = 0;
-       rs_data_available = 0;
-}
-
-static inline int
-arc4_check_stir(void)
-{
-       if (!rs_stired || arc4_count <= 0) {
-               arc4_stir();
-               return 1;
-       }
-       return 0;
-}
-
-void
-arc4random_stir(void)
-{
-       THREAD_LOCK();
-       arc4_stir();
-       THREAD_UNLOCK();
-}
-
-void
-arc4random_addrandom(u_char *dat, int datlen)
-{
-       THREAD_LOCK();
-       arc4_check_stir();
-       arc4_addrandom(dat, datlen);
-       THREAD_UNLOCK();
-}
-
-u_int32_t
-arc4random(void)
-{
-       u_int32_t rnd;
-
-       THREAD_LOCK();
-
-       int did_stir = arc4_check_stir();
-       rnd = arc4_getword();
-       arc4_count -= 4;
-
-       THREAD_UNLOCK();
-       if (did_stir)
-       {
-               /* stirring used up our data pool, we need to read in new data outside of the lock */
-               arc4_fetch();
-               rs_data_available = 1;
-               __sync_synchronize();
-       }
-
-       return (rnd);
-}
-
-void
-arc4random_buf(void *_buf, size_t n)
-{
-       u_char *buf = (u_char *)_buf;
-       int did_stir = 0;
-
-       THREAD_LOCK();
-
-       while (n--) {
-               if (arc4_check_stir())
-               {
-                       did_stir = 1;
-               }
-               buf[n] = arc4_getbyte();
-               arc4_count--;
-       }
-       
-       THREAD_UNLOCK();
-       if (did_stir)
-       {
-               /* stirring used up our data pool, we need to read in new data outside of the lock */
-               arc4_fetch();
-               rs_data_available = 1;
-               __sync_synchronize();
-       }
-}
-
-/*
- * Calculate a uniformly distributed random number less than upper_bound
- * avoiding "modulo bias".
- *
- * Uniformity is achieved by generating new random numbers until the one
- * returned is outside the range [0, 2**32 % upper_bound).  This
- * guarantees the selected random number will be inside
- * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
- * after reduction modulo upper_bound.
- */
-u_int32_t
-arc4random_uniform(u_int32_t upper_bound)
-{
-       u_int32_t r, min;
-
-       if (upper_bound < 2)
-               return (0);
-
-#if (ULONG_MAX > 0xffffffffUL)
-       min = 0x100000000UL % upper_bound;
-#else
-       /* Calculate (2**32 % upper_bound) avoiding 64-bit math */
-       if (upper_bound > 0x80000000)
-               min = 1 + ~upper_bound;         /* 2**32 - upper_bound */
-       else {
-               /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */
-               min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound;
-       }
-#endif
-
-       /*
-        * This could theoretically loop forever but each retry has
-        * p > 0.5 (worst case, usually far better) of selecting a
-        * number inside the range we need, so it should rarely need
-        * to re-roll.
-        */
-       for (;;) {
-               r = arc4random();
-               if (r >= min)
-                       break;
-       }
-
-       return (r % upper_bound);
-}
-
-#if 0
-/*-------- Test code for i386 --------*/
-#include <stdio.h>
-#include <machine/pctr.h>
-int
-main(int argc, char **argv)
-{
-       const int iter = 1000000;
-       int     i;
-       pctrval v;
-
-       v = rdtsc();
-       for (i = 0; i < iter; i++)
-               arc4random();
-       v = rdtsc() - v;
-       v /= iter;
-
-       printf("%qd cycles\n", v);
-}
-#endif
diff --git a/gen/arc4random.3 b/gen/arc4random.3
deleted file mode 120000 (symlink)
index c4c8a0f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./arc4random.3
\ No newline at end of file
index e3b99431179953f8e3406adbdacd0c4b79e20186..2f7f87668ef7490d39bd80aadf0d77f8d10c53c5 100644 (file)
--- a/gen/asl.3
+++ b/gen/asl.3
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2005-2010 Apple Inc.
+.\" Copyright (c) 2005-2011 Apple Inc.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd March 3, 2010
+.Dd October 1, 2011
 .Dt asl 3
 .Os "Mac OS X"
 .Sh NAME
@@ -39,6 +39,7 @@
 .Nm asl_key ,
 .Nm asl_log ,
 .Nm asl_log_auxiliary_location ,
+.Nm asl_log_descriptor ,
 .Nm asl_new ,
 .Nm asl_open ,
 .Nm asl_open_from_file ,
@@ -59,7 +60,7 @@
 .Ft int
 .Fo asl_add_log_file
 .Fa "aslclient asl"
-.Fa "int fd"
+.Fa "int descriptor"
 .Fc
 .Ft void
 .Fo asl_close
 .Fc
 .Ft void
 .Fo asl_close_auxiliary_file
-.Fa "int fd"
+.Fa "int descriptor"
 .Fc
 .Ft void
 .Fo asl_create_auxiliary_file
 .Fa "aslmsg msg"
 .Fa "const char *title"
 .Fa "const char *uti"
-.Fa "int *out_fd"
+.Fa "int *out_descriptor"
 .Fc
 .Ft void
 .Fo asl_free
 .Fa "const char *uti"
 .Fa "const char *url"
 .Fc
+.Ft int
+.Fo asl_log_descriptor
+.Fa "aslclient asl"
+.Fa "aslmsg msg"
+.Fa "int level"
+.Fa "int descriptor"
+.Fa "uint32_t fd_type"
+.Fc
 .Ft aslmsg
 .Fo asl_new
 .Fa "uint32_t type"
 .Fc
 .Ft aslclient
 .Fo asl_open_from_file
-.Fa "int fd"
+.Fa "int descriptor"
 .Fa "const char *ident"
 .Fa "const char *facility"
 .Fc
 .Ft int
 .Fo asl_remove_log_file
 .Fa "aslclient asl"
-.Fa "int fd"
+.Fa "int descriptor"
 .Fc
 .Ft aslresponse
 .Fo asl_search
@@ -220,10 +229,10 @@ and releases its associated resources.
 .Pp
 .Fo asl_add_log_file
 .Fa asl
-.Fa fd  
+.Fa descriptor  
 .Fc
 adds the file descriptor
-.Ar fd
+.Ar descriptor
 to the a set of file descriptors associated with the client handle
 .Ar asl .
 Each log message sent by that client handle is also written to these file descriptors.
@@ -231,7 +240,7 @@ Returns 0 on success, non-zero on failure.
 .Pp
 .Fo asl_remove_log_file
 .Fa asl
-.Fa fd  
+.Fa descriptor  
 .Fc
 removes a file descriptor from the set of file descriptors associated with a client handle.
 Returns 0 on success, non-zero on failure.
@@ -349,6 +358,17 @@ The format may also contain
 which will be substituted with the string value corresponding to the current
 .Em errno .
 .Pp
+The ASL_PREFILTER_LOG(asl, msg, level, format, ...) macro may be used in
+place of
+.Fn asl_log .
+The macro avoids processing the variable argument list in those cases where
+the message would be filtered out due to filter settings, would not be
+written to a log file associated with the aslclient, or would not be
+written to stderr.
+The macro may provide a performance benefit for some applications.
+Details on filter setting, additional log files, and aslclient options
+are described below in this manual.
+.Pp
 .Fo asl_vlog
 .Fa asl
 .Fa msg
@@ -372,6 +392,50 @@ rather than being constructed using a
 .Fn printf
 style syntax.
 .Pp
+.Fo asl_log_descriptor
+.Fa asl
+.Fa msg
+.Fa level
+.Fa descriptor
+.Fa fd_type
+.Fc
+provides functionality to use file descriptors to send logging data to ASL.
+.Ar asl
+is retained by ASL and must still be closed by the caller by calling
+.Fn asl_close
+if the caller loses reference to it.
+.Ar msg
+is copied by ASL and similarly must still be freed by the caller by calling
+.Fn asl_free
+if the caller loses reference to it.  Any changes made to it after calling
+.Fn asl_log_descriptor()
+are not applicable to the message used.
+.Ar descriptor is treated differentlty based on the value of
+.Ar fd_type .
+.Pp
+If
+.Ar fd_type
+is ASL_LOG_DESCRIPTOR_READ, the descriptor must be open for read access.  ASL
+uses
+.Xr dispatch 2
+to read from the descriptor as data becomes available.  These data are line
+buffered and passed to
+.Fn asl_log .
+When EOF is read, ASL will
+.Xr close 2
+.Ar descriptor ..
+.Pp
+If
+.Ar fd_type
+is ASL_LOG_DESCRIPTOR_WRITE, the descriptor is closed and a new writable
+descriptor is created with the same fileno.  Any data written to this new
+descriptor are line buffered and passed to
+.Fn asl_log .
+When EOF is sent, no further data are read.  The caller is responsible for
+closing the new descriptor.  One common use for this API is to redirect writes
+to stdout or stderr to ASL by passing STDOUT_FILENO or STDERR_FILENO as
+.Ar descriptor .
+.Pp
 .Fo asl_search
 .Fa asl
 .Fa msg
@@ -408,7 +472,7 @@ and all of its associated resources.
 .Fa msg
 .Fa title
 .Fa uti
-.Fa out_fd
+.Fa out_descriptor
 .Fc
 Creates an auxiliary file that may be used by the client to save arbitrary data.
 When the file is closed using
@@ -440,10 +504,10 @@ By default, messages (and auxiliary files) are world-readable.
 Access may be limited by setting values for the ReadUID and ReadGID keys.
 .Pp
 .Fo asl_close_auxiliary_file
-.Fa fd
+.Fa descriptor
 .Fc
 closes the file descriptor
-.Ar fd 
+.Ar descriptor 
 previously returned by a call to
 .Fn asl_create_auxiliary_file .
 .Pp
@@ -471,12 +535,12 @@ the life-cycle of this file must be managed by some external system.
 The file will not be removed when the corresponding log message expired from the ASL data store.
 .Pp
 .Fo asl_open_from_file
-.Fa fd
+.Fa descriptor
 .Fa facility
 .Fa opts
 .Fc
 creates a client handle for an open file descriptor
-.Fa fd .
+.Fa descriptor .
 This routine may be used in conjunction with
 .Fo asl_create_auxiliary_file
 .Fc 
index 9da93151229951a73ca5a30a2486dbf6cc04ed01..1948c9274cf0babeaf4646a54148877c216992db 100644 (file)
--- a/gen/asl.c
+++ b/gen/asl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2004-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
@@ -21,6 +21,7 @@
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <assert.h>
 #include <string.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -46,6 +47,7 @@
 #include <servers/bootstrap.h>
 #include <pthread.h>
 #include <dispatch/dispatch.h>
+#include <libkern/OSAtomic.h>
 #include <asl_ipc.h>
 #include "asl_core.h"
 #include "asl_msg.h"
 
 #define FETCH_BATCH    256
 
+#define LEVEL_MASK   0x0000000f
+#define EVAL_MASK    0x000000f0
+#define EVAL_IGNORE  0x00000000
+#define EVAL_ASLFILE 0x00000010
+#define EVAL_SEND    0x00000020
+#define EVAL_TUNNEL  0x00000040
+#define EVAL_FILE    0x00000080
+
 /* forward */
 time_t asl_parse_time(const char *);
 const char *asl_syslog_faciliy_num_to_name(int n);
-__private_extern__ int _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_message);
+static int _asl_send_message(aslclient ac, uint32_t eval, asl_msg_t *msg, const char *mstring);
 __private_extern__ asl_client_t *_asl_open_default();
 
-/* private asl_msg SPI */
-__private_extern__ uint32_t _asl_msg_string_length_aux(asl_msg_t *msg, asl_msg_aux_t *aux);
-__private_extern__ uint32_t _asl_msg_to_string_buffer_aux(asl_msg_t *msg, asl_msg_aux_t *aux, char *buf, uint32_t bufsize);
-
 /* private asl_file SPI */
 __private_extern__ uint32_t asl_file_open_write_fd(int fd, asl_file_t **s);
 
+/* private asl_msg SPI */
+__private_extern__ asl_string_t *asl_msg_to_string_raw(uint32_t encoding, asl_msg_t *msg, int tf);
+
 /* notify SPI */
 uint32_t notify_register_plain(const char *name, int *out_token);
 
@@ -124,6 +133,8 @@ _asl_fork_child()
 
        _asl_global.port_lookup_once = 0;
        _asl_global.server_port = MACH_PORT_NULL;
+
+       pthread_mutex_init(&(_asl_global.lock), NULL);
 }
 
 /*
@@ -213,13 +224,30 @@ _asl_notify_close()
 static void
 _asl_global_init()
 {
-       dispatch_once(&_asl_global.port_lookup_once, ^{
+       if (_asl_global.server_port == MACH_PORT_NULL)
+       {
+               mach_port_t newport = MACH_PORT_NULL;
                char *str = getenv("ASL_DISABLE");
                if ((str == NULL) || strcmp(str, "1"))
                {
-                       bootstrap_look_up(bootstrap_port, ASL_SERVICE_NAME, &_asl_global.server_port);
+                       bootstrap_look_up(bootstrap_port, ASL_SERVICE_NAME, &newport);
+                       if (newport != MACH_PORT_NULL)
+                       {
+                               if (!OSAtomicCompareAndSwap32Barrier(MACH_PORT_NULL, newport, (int32_t *)&_asl_global.server_port))
+                               {
+                                       mach_port_deallocate(mach_task_self(), newport);
+                               }
+                       }
                }
-       });
+       }
+}
+
+static void
+_asl_global_reset()
+{
+       mach_port_t tmp = _asl_global.server_port;
+       _asl_global.server_port = MACH_PORT_NULL;
+       mach_port_deallocate(mach_task_self(), tmp);
 }
 
 aslclient
@@ -290,6 +318,8 @@ asl_open(const char *ident, const char *facility, uint32_t opts)
 
        if (asl->options & ASL_OPT_STDERR) asl_add_output((aslclient)asl, fileno(stderr), ASL_MSG_FMT_STD, ASL_TIME_FMT_LCL, ASL_ENCODE_SAFE);
 
+       asl->refcount = 1;
+
        return (aslclient)asl;
 }
 
@@ -362,19 +392,21 @@ asl_open_from_file(int fd, const char *ident, const char *facility)
        }
 
        asl->aslfileid = 1;
+       asl->refcount = 1;
 
        return (aslclient)asl;
 }
 
-void
-asl_close(aslclient ac)
+__private_extern__ void
+asl_client_release(asl_client_t *asl)
 {
-       asl_client_t *asl;
        uint32_t i;
 
-       asl = (asl_client_t *)ac;
        if (asl == NULL) return;
 
+       if(OSAtomicDecrement32(&asl->refcount) > 0)
+               return;
+
        free(asl->name);
        free(asl->facility);
 
@@ -400,6 +432,25 @@ asl_close(aslclient ac)
        free(asl);
 }
 
+void
+asl_close(aslclient ac)
+{
+       asl_client_release((asl_client_t *)ac);
+}
+
+__private_extern__ asl_client_t *
+asl_client_retain(asl_client_t *asl)
+{
+       int32_t new;
+
+       if (asl == NULL) return NULL;
+
+       new = OSAtomicIncrement32(&asl->refcount);
+       assert(new >= 1);
+
+       return asl;
+}
+
 __private_extern__ asl_client_t *
 _asl_open_default()
 {
@@ -650,18 +701,126 @@ asl_set_filter(aslclient ac, int f)
        return last;
 }
 
+/*
+ * Evaluate client / message / level to determine what to do with a message.
+ * Checks filters, tunneling, and log files.  Returns EVAL_IGNORE if the message
+ * can be ignored.  Otherwise it returns the bits below, ORed with the level.
+ *
+ * EVAL_ASLFILE - will write to an asl file (see asl_open_from_file)
+ * EVAL_SEND - will send to syslogd
+ * EVAL_TUNNEL - will send to syslogd with tunneling enabled
+ * EVAL_FILE - will write to file
+ */
+uint32_t
+_asl_evaluate_send(aslclient ac, aslmsg msg, int slevel)
+{
+       asl_client_t *asl = (asl_client_t *)ac;
+       uint32_t level, lmask, filter, status, tunnel;
+       int check, out;
+       uint64_t v64;
+       const char *val;
+
+       if (asl == NULL)
+       {
+               asl = _asl_open_default();
+               if (asl == NULL) return EVAL_IGNORE;
+       }
+
+       check = ASL_LEVEL_DEBUG;
+       if (slevel >= 0) check = slevel;
+
+       val = asl_get((aslmsg)msg, ASL_KEY_LEVEL);
+       if (val != NULL) check = atoi(val);
+
+       if (check < ASL_LEVEL_EMERG) check = ASL_LEVEL_EMERG;
+       else if (check > ASL_LEVEL_DEBUG) check = ASL_LEVEL_DEBUG;
+       level = check;
+
+       out = check;
+
+       if (asl->aslfile != NULL) return (out | EVAL_ASLFILE);
+
+       lmask = ASL_FILTER_MASK(level);
+
+       if (!(asl->options & ASL_OPT_NO_REMOTE))
+       {
+               pthread_mutex_lock(&_asl_global.lock);
+
+               if (_asl_global.rc_change_token >= 0)
+               {
+                       /* initialize or re-check process-specific and master filters  */
+                       check = 0;
+                       status = notify_check(_asl_global.rc_change_token, &check);
+                       if ((status == NOTIFY_STATUS_OK) && (check != 0))
+                       {
+                               if (_asl_global.master_token >= 0)
+                               {
+                                       v64 = 0;
+                                       status = notify_get_state(_asl_global.master_token, &v64);
+                                       if (status == NOTIFY_STATUS_OK) _asl_global.master_filter = v64;
+                               }
+
+                               if (_asl_global.notify_token >= 0)
+                               {
+                                       v64 = 0;
+                                       status = notify_get_state(_asl_global.notify_token, &v64);
+                                       if (status == NOTIFY_STATUS_OK) _asl_global.proc_filter = v64;
+                               }
+                       }
+               }
+
+               pthread_mutex_unlock(&_asl_global.lock);
+       }
+
+       filter = asl->filter & 0xff;
+       tunnel = (asl->filter & ASL_FILTER_MASK_TUNNEL) >> 8;
+
+       /* master filter overrides local filter */
+       if (_asl_global.master_filter != 0)
+       {
+               filter = _asl_global.master_filter;
+               tunnel = 1;
+       }
+
+       /* process-specific filter overrides local and master */
+       if (_asl_global.proc_filter != 0)
+       {
+               filter = _asl_global.proc_filter;
+               tunnel = 1;
+       }
+
+       if ((filter != 0) && ((filter & lmask) != 0))
+       {
+               out |= EVAL_SEND;
+               if (tunnel != 0) out |= EVAL_TUNNEL;
+               if (asl->fd_count > 0) out |= EVAL_FILE;
+
+               return out;
+       }
+
+       if ((asl->options & ASL_OPT_SYSLOG_LEGACY) && (filter != 0) && ((filter & lmask) == 0))
+       {
+               return EVAL_IGNORE;
+       }
+
+       if (asl->fd_count > 0) return (out | EVAL_FILE);
+
+       return EVAL_IGNORE;
+}
+
 #endif /* BUILDING_VARIANT */
 
 /*
- * asl_vlog: Similar to asl_log, but taking a va_list instead of a list of
- * arguments.
+ * _asl_lib_vlog
+ * Internal routine used by asl_vlog.
  * msg:  an aslmsg
- * level: the log level of the associated message
- * format: A formating string followed by a list of arguments, like vprintf()
+ * eval: log level and send flags for the message
+ * format: A formating string
+ * ap: va_list for the format
  * returns 0 for success, non-zero for failure
  */
-int
-asl_vlog(aslclient ac, aslmsg msg, int level, const char *format, va_list ap)
+static int
+_asl_lib_vlog(aslclient ac, uint32_t eval, aslmsg msg, const char *format, va_list ap)
 {
        int saved_errno = errno;
        int status;
@@ -752,167 +911,80 @@ asl_vlog(aslclient ac, aslmsg msg, int level, const char *format, va_list ap)
 
        if (str == NULL) return -1;
 
-       status = _asl_send_message(ac, (asl_msg_t *)msg, level, str);
+       status = _asl_send_message(ac, eval, (asl_msg_t *)msg, str);
        free(str);
 
        return status;
 }
 
 /*
- * asl_log: log a message with a particular log level 
+ * asl_vlog
+ * Similar to asl_log, but take a va_list instead of a list of arguments.
  * msg:  an aslmsg
- * level: the log level
- * format: A formating string followed by a list of arguments, like printf()
+ * level: the log level of the associated message
+ * format: A formating string
+ * ap: va_list for the format
  * returns 0 for success, non-zero for failure
  */
 int
-asl_log(aslclient ac, aslmsg a, int level, const char *format, ...)
+asl_vlog(aslclient ac, aslmsg msg, int level, const char *format, va_list ap)
 {
-       va_list ap;
-       int status;
+       uint32_t eval = _asl_evaluate_send(ac, msg, level);
+       if (eval == EVAL_IGNORE) return 0;
 
-       if (format == NULL) return -1;
+       return _asl_lib_vlog(ac, eval, msg, format, ap);
+}
+
+/*
+ * _asl_lib_log
+ * SPI used by ASL_PREFILTER_LOG. Converts format arguments to a va_list and
+ * forwards the call to _asl_lib_vlog.
+ * msg:  an aslmsg
+ * eval: log level and send flags for the message
+ * format: A formating string
+ * ... args for format
+ * returns 0 for success, non-zero for failure
+ */
+int
+_asl_lib_log(aslclient ac, uint32_t eval, aslmsg msg, const char *format, ...)
+{
+       int status;
+       if (eval == EVAL_IGNORE) return 0;
 
+       va_list ap;
        va_start(ap, format);
-       status = asl_vlog(ac, a, level, format, ap);
+       status = _asl_lib_vlog(ac, eval, msg, format, ap);
        va_end(ap);
 
        return status;
 }
 
-#ifndef BUILDING_VARIANT
-
-static asl_msg_t *
-_asl_merge_msg_aux0(asl_msg_t *msg, asl_msg_aux_0_t aux0)
+/*
+ * asl_log
+ * Processes an ASL log message.
+ * msg:  an aslmsg
+ * level: the log level of the associated message
+ * format: A formating string
+ * ... args for format
+ * returns 0 for success, non-zero for failure
+ */
+int
+asl_log(aslclient ac, aslmsg msg, int level, const char *format, ...)
 {
-       const char *key, *val;
-       asl_msg_t *out;
-       uint32_t x;
-       int klevel, ktime, knano, khost, ksender, kfac, kpid, kuid, kgid, kmsg, kaux, kuti, kurl;
-
-       out = asl_msg_new(ASL_TYPE_MSG);
-       if (out == NULL) return NULL;
-
-       klevel = 0;
-       ktime = 0;
-       knano = 0;
-       khost = 0;
-       ksender= 0;
-       kfac = 0;
-       kpid = 0;
-       kuid = 0;
-       kgid = 0;
-       kmsg = 0;
-       kaux = 0;
-       kuti = 0;
-       kurl = 0;
-
-       key = NULL;
-       val = NULL;
-
-       for (x = asl_msg_fetch(msg, 0, &key, &val, NULL); x != IndexNull; x = asl_msg_fetch(msg, x, &key, &val, NULL))
-       {
-               if (streq(key, ASL_KEY_LEVEL))
-               {
-                       klevel = 1;
-                       if (aux0.level != NULL) asl_msg_set_key_val(out, key, aux0.level);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_TIME))
-               {
-                       ktime = 1;
-                       if (aux0.time != NULL) asl_msg_set_key_val(out, key, aux0.time);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_TIME_NSEC))
-               {
-                       knano = 1;
-                       if (aux0.nano != NULL) asl_msg_set_key_val(out, key, aux0.nano);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_HOST))
-               {
-                       khost = 1;
-                       if (aux0.host != NULL) asl_msg_set_key_val(out, key, aux0.host);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_SENDER))
-               {
-                       ksender = 1;
-                       if (aux0.sender != NULL) asl_msg_set_key_val(out, key, aux0.sender);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_FACILITY))
-               {
-                       kfac = 1;
-                       if (aux0.facility != NULL) asl_msg_set_key_val(out, key, aux0.facility);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_PID))
-               {
-                       kpid = 1;
-                       if (aux0.pid != NULL) asl_msg_set_key_val(out, key, aux0.pid);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_UID))
-               {
-                       kuid = 1;
-                       if (aux0.uid != NULL) asl_msg_set_key_val(out, key, aux0.uid);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_GID))
-               {
-                       kgid = 1;
-                       if (aux0.gid != NULL) asl_msg_set_key_val(out, key, aux0.gid);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_MSG))
-               {
-                       kmsg = 1;
-                       if (aux0.message != NULL) asl_msg_set_key_val(out, key, aux0.message);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_AUX_TITLE))
-               {
-                       kaux = 1;
-                       if (aux0.auxtitle != NULL) asl_msg_set_key_val(out, key, aux0.auxtitle);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_AUX_UTI))
-               {
-                       kuti = 1;
-                       if (aux0.auxuti != NULL) asl_msg_set_key_val(out, key, aux0.auxuti);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else if (streq(key, ASL_KEY_AUX_URL))
-               {
-                       kurl = 1;
-                       if (aux0.auxurl != NULL) asl_msg_set_key_val(out, key, aux0.auxurl);
-                       else asl_msg_set_key_val(out, key, val);
-               }
-               else
-               {
-                       asl_msg_set_key_val(out, key, val);
-               }
-       }
-
-       if ((klevel == 0) && (aux0.level != NULL)) asl_msg_set_key_val(out, ASL_KEY_LEVEL, aux0.level);
-       if ((ktime == 0) && (aux0.time != NULL)) asl_msg_set_key_val(out, ASL_KEY_TIME, aux0.time);
-       if ((knano == 0) && (aux0.nano != NULL)) asl_msg_set_key_val(out, ASL_KEY_TIME_NSEC, aux0.nano);
-       if ((khost == 0) && (aux0.host != NULL)) asl_msg_set_key_val(out, ASL_KEY_HOST, aux0.host);
-       if ((ksender == 0) && (aux0.sender != NULL)) asl_msg_set_key_val(out, ASL_KEY_SENDER, aux0.sender);
-       if ((kfac == 0) && (aux0.facility != NULL)) asl_msg_set_key_val(out, ASL_KEY_FACILITY, aux0.facility);
-       if ((kpid == 0) && (aux0.pid != NULL)) asl_msg_set_key_val(out, ASL_KEY_PID, aux0.pid);
-       if ((kuid == 0) && (aux0.uid != NULL)) asl_msg_set_key_val(out, ASL_KEY_UID, aux0.uid);
-       if ((kgid == 0) && (aux0.gid != NULL)) asl_msg_set_key_val(out, ASL_KEY_GID, aux0.gid);
-       if ((kmsg == 0) && (aux0.message != NULL)) asl_msg_set_key_val(out, ASL_KEY_MSG, aux0.message);
-       if ((kaux == 0) && (aux0.auxtitle != NULL)) asl_msg_set_key_val(out, ASL_KEY_AUX_TITLE, aux0.auxtitle);
-       if ((kuti == 0) && (aux0.auxuti != NULL)) asl_msg_set_key_val(out, ASL_KEY_AUX_UTI, aux0.auxuti);
-       if ((kurl == 0) && (aux0.auxurl != NULL)) asl_msg_set_key_val(out, ASL_KEY_AUX_URL, aux0.auxurl);
-
-       return out;
+       int status;
+       uint32_t eval = _asl_evaluate_send(ac, msg, level);
+       if (eval == EVAL_IGNORE) return 0;
+       
+       va_list ap;
+       va_start(ap, format);
+       status = _asl_lib_vlog(ac, eval, msg, format, ap);
+       va_end(ap);
+       
+       return status;
 }
 
+#ifndef BUILDING_VARIANT
+
 /*
  * asl_get_filter: gets the values for the local, master, and remote filters, 
  * and indicates which one is active.
@@ -980,31 +1052,27 @@ asl_get_filter(aslclient ac, int *local, int *master, int *remote, int *active)
        return 0;
 }
 
-/*
- * asl_send: send a message 
- * This routine may be used instead of asl_log() or asl_vlog() if asl_set() 
- * has been used to set all of a message's attributes.
- * msg:  an aslmsg
- * returns 0 for success, non-zero for failure
- */
-__private_extern__ int
-_asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_message)
+static int
+_asl_send_message(aslclient ac, uint32_t eval, asl_msg_t *msg, const char *mstring)
 {
-       vm_address_t out;
-       uint32_t i, len, outlen, level, lmask, outstatus, filter, fd_write;
+       uint32_t i, len, level, lmask, outstatus, filter, fd_write;
        uint64_t v64;
        const char *val;
-       char *name, *x, *str;
+       char *name, *x;
        time_t tick;
        struct timeval tval;
-       int status, check, tunnel;
+       int status, check;
        asl_client_t *asl;
        int use_global_lock;
        kern_return_t kstatus;
-       char aux_level[64], aux_time[64], aux_nano[64], aux_pid[64], aux_uid[64], aux_gid[64];
-       char *aux_option, aux_host[_POSIX_HOST_NAME_MAX];
-       asl_msg_aux_t aux;
-       asl_msg_aux_0_t aux0;
+       char aux_val[64];
+       char aux_host[_POSIX_HOST_NAME_MAX];
+       asl_msg_t *aux;
+
+       if (eval == EVAL_IGNORE) return 0;
+
+       level = eval & LEVEL_MASK;
+       eval &= EVAL_MASK;
 
        use_global_lock = 0;
        asl = (asl_client_t *)ac;
@@ -1015,118 +1083,50 @@ _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_mess
                use_global_lock = 1;
        }
 
-       if (asl->aslfile != NULL)
-       {
-               use_global_lock = 1;
-       }
-
-       level = ASL_LEVEL_DEBUG;
-       if (slevel >= 0) level = slevel;
-
-       val = asl_get((aslmsg)msg, ASL_KEY_LEVEL);
-       if (val != NULL)
-       {
-               check = atoi(val);
-               if (check < ASL_LEVEL_EMERG) check = ASL_LEVEL_EMERG;
-               else if (check > ASL_LEVEL_DEBUG) check = ASL_LEVEL_DEBUG;
-               level = check;
-       }
-
-       lmask = ASL_FILTER_MASK(level);
-
-       if (!(asl->options & ASL_OPT_NO_REMOTE))
-       {
-               pthread_mutex_lock(&_asl_global.lock);
-
-               if (_asl_global.rc_change_token >= 0)
-               {
-                       /* initialize or re-check process-specific and master filters  */
-                       check = 0;
-                       status = notify_check(_asl_global.rc_change_token, &check);
-                       if ((status == NOTIFY_STATUS_OK) && (check != 0))
-                       {
-                               if (_asl_global.master_token >= 0)
-                               {
-                                       v64 = 0;
-                                       status = notify_get_state(_asl_global.master_token, &v64);
-                                       if (status == NOTIFY_STATUS_OK) _asl_global.master_filter = v64;
-                               }
-
-                               if (_asl_global.notify_token >= 0)
-                               {
-                                       v64 = 0;
-                                       status = notify_get_state(_asl_global.notify_token, &v64);
-                                       if (status == NOTIFY_STATUS_OK) _asl_global.proc_filter = v64;
-                               }
-                       }
-               }
-
-               pthread_mutex_unlock(&_asl_global.lock);
-       }
-
-       filter = asl->filter & 0xff;
-       tunnel = (asl->filter & ASL_FILTER_MASK_TUNNEL) >> 8;
-
-       /* master filter overrides local filter */
-       if (_asl_global.master_filter != 0)
-       {
-               filter = _asl_global.master_filter;
-               tunnel = 1;
-       }
-
-       /* process-specific filter overrides local and master */
-       if (_asl_global.proc_filter != 0)
-       {
-               filter = _asl_global.proc_filter;
-               tunnel = 1;
-       }
+       if (asl->aslfile != NULL) use_global_lock = 1;
 
        /* 
         * Time, TimeNanoSec, Host, PID, UID, and GID values get set here.
         * Also sets Sender & Facility (if unset) and "ASLOption store" if remote control is active.
         */
+       aux = asl_msg_new(ASL_TYPE_MSG);
 
-       aux.type = ASL_MSG_TYPE_AUX_0;
-
-       memset(&aux0, 0, sizeof(asl_msg_aux_0_t));
-       aux.data.aux0 = &aux0;
+       if (mstring != NULL) asl_msg_set_key_val(aux, ASL_KEY_MSG, mstring);
 
-       aux0.message = aux_message;
-
-       snprintf(aux_level, sizeof(aux_level), "%u", level);
-       aux0.level = aux_level;
+       snprintf(aux_val, sizeof(aux_val), "%u", level);
+       asl_msg_set_key_val(aux, ASL_KEY_LEVEL, aux_val);
 
        memset(&tval, 0, sizeof(struct timeval));
 
        status = gettimeofday(&tval, NULL);
        if (status == 0)
        {
-               snprintf(aux_time, sizeof(aux_time), "%lu", tval.tv_sec);
-               snprintf(aux_nano, sizeof(aux_nano), "%d", tval.tv_usec * 1000);
-               aux0.time = aux_time;
-               aux0.nano = aux_nano;
+               snprintf(aux_val, sizeof(aux_val), "%lu", tval.tv_sec);
+               asl_msg_set_key_val(aux, ASL_KEY_TIME, aux_val);
+               snprintf(aux_val, sizeof(aux_val), "%d", tval.tv_usec * 1000);
+               asl_msg_set_key_val(aux, ASL_KEY_TIME_NSEC, aux_val);
        }
        else
        {
                tick = time(NULL);
-               snprintf(aux_time, sizeof(aux_time), "%lu", tick);
-               aux0.time = aux_time;
+               snprintf(aux_val, sizeof(aux_val), "%lu", tick);
+               asl_msg_set_key_val(aux, ASL_KEY_TIME, aux_val);
        }
 
        memset(&aux_host, 0, _POSIX_HOST_NAME_MAX);
        if (gethostname(aux_host, _POSIX_HOST_NAME_MAX) == 0)
        {
-               aux0.host = aux_host;
+               asl_msg_set_key_val(aux, ASL_KEY_HOST, aux_host);
        }
 
-       snprintf(aux_pid, sizeof(aux_pid), "%u", getpid());
-       aux0.pid = aux_pid;
+       snprintf(aux_val, sizeof(aux_val), "%u", getpid());
+       asl_msg_set_key_val(aux, ASL_KEY_PID, aux_val);
 
-       snprintf(aux_uid, sizeof(aux_uid), "%d", getuid());
-       aux0.uid = aux_uid;
+       snprintf(aux_val, sizeof(aux_val), "%d", getuid());
+       asl_msg_set_key_val(aux, ASL_KEY_UID, aux_val);
 
-       snprintf(aux_gid, sizeof(aux_uid), "%d", getgid());
-       aux0.gid = aux_gid;
+       snprintf(aux_val, sizeof(aux_val), "%d", getgid());
+       asl_msg_set_key_val(aux, ASL_KEY_GID, aux_val);
 
        /*
         * Set Sender if needed
@@ -1137,7 +1137,7 @@ _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_mess
                if ((ac != NULL) && (ac->name != NULL))
                {
                        /* Use the Sender name from the client handle */
-                       aux0.sender = ac->name;
+                       asl_msg_set_key_val(aux, ASL_KEY_SENDER, ac->name);
                }
                else
                {
@@ -1157,8 +1157,8 @@ _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_mess
                                }
                        }
 
-                       if (_asl_global.sender != NULL) aux0.sender = _asl_global.sender;
-                       else aux0.sender = "Unknown";
+                       if (_asl_global.sender != NULL) asl_msg_set_key_val(aux, ASL_KEY_SENDER, _asl_global.sender);
+                       else asl_msg_set_key_val(aux, ASL_KEY_SENDER, "Unknown");
                }
        }
 
@@ -1171,25 +1171,25 @@ _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_mess
                if ((ac != NULL) && (ac->facility != NULL))
                {
                        /* Use the Facility name from the client handle */
-                       aux0.facility = ac->facility;
+                       asl_msg_set_key_val(aux, ASL_KEY_FACILITY, ac->facility);
                }
        }
 
-       /* Set "ASLOption store" if remote control is active */
-
-       aux_option = NULL;
+       /* Set "ASLOption store" if tunneling */
 
-       if (tunnel != 0)
+       if (eval & EVAL_TUNNEL)
        {
                val = asl_get((aslmsg)msg, ASL_KEY_OPTION);
                if (val == NULL)
                {
-                       aux0.option = ASL_OPT_STORE;
+                       asl_msg_set_key_val(aux, ASL_KEY_OPTION, ASL_OPT_STORE);
                }
                else
                {
+                       char *aux_option = NULL;
                        asprintf(&aux_option, "%s %s", ASL_OPT_STORE, val);
-                       aux0.option = aux_option;
+                       asl_msg_set_key_val(aux, ASL_KEY_OPTION, aux_option);
+                       free(aux_option);
                }
        }
 
@@ -1197,91 +1197,80 @@ _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_mess
 
        if (use_global_lock != 0) pthread_mutex_lock(&_asl_global.lock);
 
+       aux = asl_msg_merge(aux, msg);
+
        /*
         * If there is an aslfile this is a stand-alone file client.
         * Just save to the file.
         */
        if (asl->aslfile != NULL)
        {
-               asl_msg_t *merged_msg;
-
                outstatus = ASL_STATUS_FAILED;
 
-               merged_msg = _asl_merge_msg_aux0(msg, aux0);
-               if (merged_msg != NULL)
+               if (aux != NULL)
                {
-                       outstatus = asl_file_save(asl->aslfile, (aslmsg)merged_msg, &(asl->aslfileid));
+                       outstatus = asl_file_save(asl->aslfile, (aslmsg)aux, &(asl->aslfileid));
                        asl->aslfileid++;
-                       asl_msg_release(merged_msg);
                }
 
+               asl_msg_release(aux);
+
                if (use_global_lock != 0) pthread_mutex_unlock(&_asl_global.lock);
                return outstatus;
        }
 
        _asl_global_init();
-       if ((_asl_global.server_port != MACH_PORT_NULL) && (filter != 0) && ((filter & lmask) != 0))
+       outstatus = 0;
+
+       if ((_asl_global.server_port != MACH_PORT_NULL) && (eval & EVAL_SEND))
        {
-               len = _asl_msg_string_length_aux(msg, &aux);
+               asl_string_t *send_str;
+               const char *str;
+               size_t vmsize;
+
+               send_str = asl_msg_to_string_raw(ASL_STRING_MIG, aux, 0);
+               len = asl_string_length(send_str);
+               vmsize = asl_string_allocated_size(send_str);
+               str = asl_string_free_return_bytes(send_str);
 
                if (len != 0)
                {
                        /* send a mach message to syslogd */
-                       out = 0;
-                       outlen = len + 11;
-                       kstatus = vm_allocate(mach_task_self(), &out, outlen, TRUE);
-                       if (kstatus == KERN_SUCCESS)
+                       kstatus = _asl_server_message(_asl_global.server_port, (caddr_t)str, len);
+                       if (kstatus != KERN_SUCCESS)
                        {
-                               memset((void *)out, 0, outlen);
-                               snprintf((char *)out, 12, "%10u ", len);
-
-                               status = _asl_msg_to_string_buffer_aux(msg, &aux, (char *)(out + 11), len);
-                               if (status == 0)
+                               /* retry once if the call failed */
+                               _asl_global_reset();
+                               _asl_global_init();
+                               kstatus = _asl_server_message(_asl_global.server_port, (caddr_t)str, len);
+                               if (kstatus != KERN_SUCCESS)
                                {
-                                       if (kstatus == KERN_SUCCESS) kstatus = _asl_server_message(_asl_global.server_port, (caddr_t)out, outlen);
-                                       else vm_deallocate(mach_task_self(), out, outlen);
-
-                                       if (kstatus == KERN_SUCCESS) outstatus = 0;
-                               }
-                               else
-                               {
-                                       vm_deallocate(mach_task_self(), (vm_address_t)out, outlen);
+                                       _asl_global_reset();
+                                       vm_deallocate(mach_task_self(), (vm_address_t)str, vmsize);
+                                       outstatus = -1;
                                }
                        }
                }
        }
 
-       if (aux_option != NULL) free(aux_option);
-       aux0.option = NULL;
-
-       outstatus = 0;
-
        /* messages from syslog() get filtered on the way out to stderr */
        fd_write = 1;
        if ((asl->options & ASL_OPT_SYSLOG_LEGACY) && (filter != 0) && ((filter & lmask) == 0)) fd_write = 0;
 
        if ((fd_write != 0) && (asl->fd_count > 0))
        {
-               asl_msg_t *merged_msg;
-
-               /*
-                * It's easier to merge the aux fields with the msg into a new message
-                * than to have asl_format_messge deal with two inputs.  Since this is
-                * an infrequently used code path, we pay a small price to merge them
-                * here and save a lot of code complexity.
-                */
-
-               merged_msg = _asl_merge_msg_aux0(msg, aux0);
-               if (merged_msg != NULL)
+               if (aux != NULL)
                {
                        /* write to file descriptors */
 
                        for (i = 0; i < asl->fd_count; i++)
                        {
+                               char *str;
+
                                if (asl->fd_list[i] < 0) continue;
 
                                len = 0;
-                               str = asl_format_message(merged_msg, asl->fd_mfmt[i], asl->fd_tfmt[i], asl->fd_encoding[i], &len);
+                               str = asl_format_message(aux, asl->fd_mfmt[i], asl->fd_tfmt[i], asl->fd_encoding[i], &len);
                                if (str == NULL) continue;
 
                                status = write(asl->fd_list[i], str, len - 1);
@@ -1293,20 +1282,32 @@ _asl_send_message(aslclient ac, asl_msg_t *msg, int slevel, const char *aux_mess
 
                                free(str);
                        }
-
-                       asl_msg_release(merged_msg);
                }
        }
 
+       asl_msg_release(aux);
+
        if (use_global_lock != 0) pthread_mutex_unlock(&_asl_global.lock);
 
        return outstatus;
 }
 
+/*
+ * asl_send: send a message 
+ * This routine may be used instead of asl_log() or asl_vlog() if asl_set() 
+ * has been used to set all of a message's attributes.
+ * eval:  hints about what to do with the message
+ * msg:  an aslmsg
+ * returns 0 for success, non-zero for failure
+ */
 int
 asl_send(aslclient ac, aslmsg msg)
 {
-       return _asl_send_message(ac, (asl_msg_t *)msg, -1, NULL);
+       int status = 0;
+       uint32_t eval = _asl_evaluate_send(ac, msg, -1);
+       if (eval != 0) status = _asl_send_message(ac, eval, (asl_msg_t *)msg, NULL);
+
+       return status;
 }
 
 static int
@@ -1338,38 +1339,50 @@ _asl_aux_save_context(asl_aux_context_t *ctx)
  * new auxiliary file.
  */
 static int
-_asl_auxiliary(aslmsg msg, const char *title, const char *uti, const char *url, int *out_fd)
+_asl_auxiliary(asl_msg_t *msg, const char *title, const char *uti, const char *url, int *out_fd)
 {
-       asl_msg_t *merged_msg;
-       asl_msg_aux_t aux;
-       asl_msg_aux_0_t aux0;
+       asl_msg_t *aux;
+       asl_string_t *send_str;
+       const char *str;
        fileport_t fileport;
        kern_return_t kstatus;
-       uint32_t outlen, newurllen, len, where;
+       size_t len, vmsize;
+       uint32_t newurllen, where;
        int status, fd, fdpair[2];
-       caddr_t out, newurl;
+       caddr_t newurl;
        dispatch_queue_t pipe_q;
        dispatch_io_t pipe_channel;
        dispatch_semaphore_t sem;
 
-       aux.type = ASL_MSG_TYPE_AUX_0;
+       aux = asl_msg_new(ASL_TYPE_MSG);
+
+       if (title != NULL)
+       {
+               asl_msg_set_key_val(aux, ASL_KEY_AUX_TITLE, title);
+       }
 
-       memset(&aux0, 0, sizeof(asl_msg_aux_0_t));
-       aux.data.aux0 = &aux0;
+       if (uti == NULL)
+       {
+               asl_msg_set_key_val(aux, ASL_KEY_AUX_UTI, "public.data");
+       }
+       else
+       {
+               asl_msg_set_key_val(aux, ASL_KEY_AUX_UTI, uti);
+       }
 
-       aux0.auxtitle = title;
-       if (uti == NULL) aux0.auxuti = "public.data";
-       else aux0.auxuti = uti;
-       aux0.auxurl = url;
+       if (url != NULL)
+       {
+               asl_msg_set_key_val(aux, ASL_KEY_AUX_URL, url);
+       }
 
-       merged_msg = _asl_merge_msg_aux0((asl_msg_t *)msg, aux0);
-       if (merged_msg == NULL) return -1;
+       aux = asl_msg_merge(aux, msg);
 
        /* if (out_fd == NULL), this is from asl_log_auxiliary_location */
        if (out_fd == NULL)
        {
-               status = _asl_send_message(NULL, merged_msg, -1, NULL);
-               asl_msg_release(merged_msg);
+               uint32_t eval = _asl_evaluate_send(NULL, (aslmsg)aux, -1);
+               status = _asl_send_message(NULL, eval, aux, NULL);
+               asl_msg_release(aux);
                return status;
        }
 
@@ -1422,13 +1435,15 @@ _asl_auxiliary(aslmsg msg, const char *title, const char *uti, const char *url,
                                {
                                        const char *bytes = NULL;
                                        char *encoded;
+                                       uint32_t eval;
 
                                        dispatch_data_t md = dispatch_data_create_map(pipedata, (const void **)&bytes, &len);
                                        encoded = asl_core_encode_buffer(bytes, len);
-                                       asl_set((aslmsg)merged_msg, ASL_KEY_AUX_DATA, encoded);
+                                       asl_msg_set_key_val(aux, ASL_KEY_AUX_DATA, encoded);
                                        free(encoded);
-                                       _asl_send_message(NULL, merged_msg, -1, NULL);
-                                       asl_msg_release(merged_msg);
+                                       eval = _asl_evaluate_send(NULL, (aslmsg)aux, -1);
+                                       _asl_send_message(NULL, eval, aux, NULL);
+                                       asl_msg_release(aux);
                                        dispatch_release(md);
                                }
                        }
@@ -1447,29 +1462,15 @@ _asl_auxiliary(aslmsg msg, const char *title, const char *uti, const char *url,
        _asl_global_init();
        if (_asl_global.server_port == MACH_PORT_NULL) return -1;
 
-       len = _asl_msg_string_length_aux(merged_msg, NULL);
-       if (len == 0) 
-       {
-               asl_msg_release(merged_msg);
-               return -1;
-       }
-
-       outlen = len + 11;
-       kstatus = vm_allocate(mach_task_self(), (vm_address_t *)&out, outlen, TRUE);
-       if (kstatus != KERN_SUCCESS)
-       {
-               asl_msg_release(merged_msg);
-               return -1;
-       }
-
-       memset(out, 0, outlen);
-       snprintf((char *)out, 12, "%10u ", len);
+       send_str = asl_msg_to_string_raw(ASL_STRING_MIG, aux, 0);
+       len = asl_string_length(send_str);
+       vmsize = asl_string_allocated_size(send_str);
+       str = asl_string_free_return_bytes(send_str);
 
-       status = _asl_msg_to_string_buffer_aux(merged_msg, NULL, (char *)(out + 11), len);
-       if (status != 0)
+       if (len == 0) 
        {
-               asl_msg_release(merged_msg);
-               vm_deallocate(mach_task_self(), (vm_address_t)out, outlen);
+               asl_msg_release(aux);
+               vm_deallocate(mach_task_self(), (vm_address_t)str, vmsize);
                return -1;
        }
 
@@ -1477,28 +1478,37 @@ _asl_auxiliary(aslmsg msg, const char *title, const char *uti, const char *url,
        fileport = MACH_PORT_NULL;
        status = KERN_SUCCESS;
 
-       kstatus = _asl_server_create_aux_link(_asl_global.server_port, out, outlen, &fileport, &newurl, &newurllen, &status);
+       kstatus = _asl_server_create_aux_link(_asl_global.server_port, (caddr_t)str, len, &fileport, &newurl, &newurllen, &status);
        if (kstatus != KERN_SUCCESS)
        {
-               asl_msg_release(merged_msg);
-               return -1;
+               /* retry once if the call failed */
+               _asl_global_reset();
+               _asl_global_init();
+               kstatus = _asl_server_create_aux_link(_asl_global.server_port, (caddr_t)str, len, &fileport, &newurl, &newurllen, &status);
+               if (kstatus != KERN_SUCCESS)
+               {
+                       _asl_global_reset();
+                       vm_deallocate(mach_task_self(), (vm_address_t)str, vmsize);
+                       asl_msg_release(aux);
+                       return -1;
+               }
        }
 
        if (status != 0)
        {
-               asl_msg_release(merged_msg);
+               asl_msg_release(aux);
                return status;
        }
 
        if (newurl != NULL)
        {
-               asl_msg_set_key_val(merged_msg, ASL_KEY_AUX_URL, newurl);
+               asl_msg_set_key_val(aux, ASL_KEY_AUX_URL, newurl);
                vm_deallocate(mach_task_self(), (vm_address_t)newurl, newurllen);
        }
 
        if (fileport == MACH_PORT_NULL)
        {
-               asl_msg_release(merged_msg);
+               asl_msg_release(aux);
                return -1;
        }
 
@@ -1506,7 +1516,7 @@ _asl_auxiliary(aslmsg msg, const char *title, const char *uti, const char *url,
        mach_port_deallocate(mach_task_self(), fileport);
        if (fd < 0)
        {
-               asl_msg_release(merged_msg);
+               asl_msg_release(aux);
                status = -1;
        }
        else
@@ -1521,7 +1531,7 @@ _asl_auxiliary(aslmsg msg, const char *title, const char *uti, const char *url,
                        *out_fd = fd;
 
                        ctx->fd = fd;
-                       ctx->msg = merged_msg;
+                       ctx->msg = aux;
 
                        status = _asl_aux_save_context(ctx);
                }
@@ -1535,13 +1545,13 @@ asl_create_auxiliary_file(aslmsg msg, const char *title, const char *uti, int *o
 {
        if (out_fd == NULL) return -1;
 
-       return _asl_auxiliary(msg, title, uti, NULL, out_fd);
+       return _asl_auxiliary((asl_msg_t *)msg, title, uti, NULL, out_fd);
 }
 
 int
 asl_log_auxiliary_location(aslmsg msg, const char *title, const char *uti, const char *url)
 {
-       return _asl_auxiliary(msg, title, uti, url, NULL);
+       return _asl_auxiliary((asl_msg_t *)msg, title, uti, url, NULL);
 }
 
 /*
@@ -1603,7 +1613,8 @@ asl_close_auxiliary_file(int fd)
 
        if (aux_msg != NULL)
        {
-               if (_asl_send_message(NULL, aux_msg, -1, NULL) != ASL_STATUS_OK) status = -1;
+               uint32_t eval = _asl_evaluate_send(NULL, (aslmsg)aux_msg, -1);
+               if (_asl_send_message(NULL, eval, aux_msg, NULL) != ASL_STATUS_OK) status = -1;
                asl_msg_release(aux_msg);
        }
 
@@ -1779,7 +1790,19 @@ _asl_search_memory(aslclient ac, aslmsg a)
 
                status = 0;
                kstatus = _asl_server_query(_asl_global.server_port, vmstr, len, qmin, FETCH_BATCH, 0, (caddr_t *)&res, &reslen, &cmax, (int *)&status, &sec);
-               if (kstatus != KERN_SUCCESS) break;
+               if (kstatus != KERN_SUCCESS)
+               {
+                       /* retry once if the call failed */
+                       _asl_global_reset();
+                       _asl_global_init();
+                       kstatus = _asl_server_query(_asl_global.server_port, vmstr, len, qmin, FETCH_BATCH, 0, (caddr_t *)&res, &reslen, &cmax, (int *)&status, &sec);
+                       if (kstatus != KERN_SUCCESS)
+                       {
+                               _asl_global_reset();
+                               break;
+                       }
+               }
+
                if (res == NULL) break;
 
                batch = asl_list_from_string(res);
@@ -1787,7 +1810,7 @@ _asl_search_memory(aslclient ac, aslmsg a)
 
                status = _asl_search_concat_results(batch, &out);
                if (status != ASL_STATUS_OK) break;
-               if (out->count < FETCH_BATCH) break;
+               if ((out == NULL) || (out->count < FETCH_BATCH)) break;
 
                if (cmax >= qmin) qmin = cmax + 1;
        }
@@ -1817,11 +1840,22 @@ asl_store_location()
        status = ASL_STATUS_OK;
 
        kstatus = _asl_server_query(_asl_global.server_port, NULL, 0, 0, -1, 0, (caddr_t *)&res, &reslen, &cmax, (int *)&status, &sec);
+       if (kstatus != KERN_SUCCESS)
+       {
+               /* retry once if the call failed */
+               _asl_global_reset();
+               _asl_global_init();
+               kstatus = _asl_server_query(_asl_global.server_port, NULL, 0, 0, -1, 0, (caddr_t *)&res, &reslen, &cmax, (int *)&status, &sec);
+       }
 
        /* res should never be returned, but just to be certain we don't leak VM ... */
        if (res != NULL) vm_deallocate(mach_task_self(), (vm_address_t)res, reslen);
 
-       if (kstatus != KERN_SUCCESS) return ASL_STORE_LOCATION_FILE;
+       if (kstatus != KERN_SUCCESS)
+       {
+               _asl_global_reset();
+               return ASL_STORE_LOCATION_FILE;
+       }
 
        if (status == ASL_STATUS_OK) return ASL_STORE_LOCATION_MEMORY;
        return ASL_STORE_LOCATION_FILE;
index ec2c4ac120e834f2998e30921abf180d30813ed0..29e132d0716ae30612566249d5b75ac69be9f721 100644 (file)
@@ -1,38 +1,43 @@
 /*
- * Copyright (c) 2007 Apple Inc.  All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc.  All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
- * "Portions Copyright (c) 2007 Apple Inc.  All Rights
- * Reserved.  This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License').  You may not use this file
- * except in compliance with the License.  Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <ctype.h>
+#include <stdio.h>
 #include <asl_core.h>
-#include <stdlib.h>
+#include <asl_private.h>
 #include <string.h>
 #include <membership.h>
 #include <pthread.h>
+#include <libkern/OSAtomic.h>
+
+#define ASL_STRING_QUANTUM 256
+static const char *cvis_7_13 = "abtnvfr";
 
 /*
  * Message ID generation
  */
 static uint64_t _asl_core_msg_next_id = 1;
-static pthread_mutex_t msg_id_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t core_lock = PTHREAD_MUTEX_INITIALIZER;
 
 #define mix(a, b, c) \
 { \
@@ -238,14 +243,14 @@ asl_core_new_msg_id(uint64_t start)
 {
        uint64_t out;
 
-       pthread_mutex_lock(&msg_id_lock);
+       pthread_mutex_lock(&core_lock);
 
        if (start != 0) _asl_core_msg_next_id = start;
 
        out = _asl_core_msg_next_id;
        _asl_core_msg_next_id++;
 
-       pthread_mutex_unlock(&msg_id_lock);
+       pthread_mutex_unlock(&core_lock);
 
        return out;
 }
@@ -370,7 +375,7 @@ asl_core_decode_buffer(const char *in, char **buf, uint32_t *len)
 {
        uint8_t v;
        uint32_t i, j, n, outlen;
-       uint32_t lfu[2];
+       uint8_t lfu[2];
        char *out;
 
        if (buf == NULL) return -1;
@@ -387,11 +392,15 @@ asl_core_decode_buffer(const char *in, char **buf, uint32_t *len)
        /* determine output length and check for invalid input */
        for (i = 2; i < n; i++)
        {
-               if (in[i] == lfu[1])
+               v = in[i];
+               if (v == lfu[1])
                {
-                       if ((i + 1) == n) return -1;
                        i++;
-                       if ((in[i] < 1) || (in[i] > 2)) return -1;
+                       if (i == n) return -1;
+
+                       v = in[i];
+                       if ((v < 1) || (v > 2)) return -1;
+
                        outlen++;
                }
                else outlen++;
@@ -423,3 +432,463 @@ asl_core_decode_buffer(const char *in, char **buf, uint32_t *len)
        *buf = out;
        return 0;
 }
+
+/* asl_string_t support */
+
+asl_string_t *
+asl_string_new(uint32_t encoding)
+{
+       asl_string_t *str = (asl_string_t *)calloc(1, sizeof(asl_string_t));
+       if (str == NULL) return NULL;
+
+       str->encoding = encoding;
+       str->delta = ASL_STRING_QUANTUM;
+       if (encoding & ASL_STRING_VM) str->delta = PAGE_SIZE;
+       str->bufsize = 0;
+       str->cursor = 0;
+
+       if (encoding & ASL_STRING_LEN) asl_string_append_no_encoding(str, "         0 ");
+       return str;
+}
+
+void
+asl_string_free(asl_string_t *str)
+{
+       if (str == NULL) return;
+
+       if (str->encoding & ASL_STRING_VM)
+       {
+               vm_deallocate(mach_task_self(), (vm_address_t)str->buf, str->bufsize);
+       }
+       else
+       {
+               free(str->buf);
+       }
+
+       free(str);
+}
+
+char *
+asl_string_free_return_bytes(asl_string_t *str)
+{
+       char *out;
+       if (str == NULL) return NULL;
+
+       out = str->buf; 
+       free(str);
+       return out;
+}
+
+char *
+asl_string_bytes(asl_string_t *str)
+{
+       if (str == NULL) return NULL;
+       return str->buf;
+}
+
+/* length includes trailing nul */
+size_t
+asl_string_length(asl_string_t *str)
+{
+       if (str == NULL) return 0;
+       if (str->cursor == 0) return 0;
+
+       return str->cursor + 1;
+}
+
+size_t
+asl_string_allocated_size(asl_string_t *str)
+{
+       if (str == NULL) return 0;
+       return str->bufsize;
+}
+
+static int
+_asl_string_grow(asl_string_t *str, size_t len)
+{
+       size_t newlen = 0;
+
+       if (str == NULL) return -1;
+       if (len == 0) return 0;
+
+       if (str->bufsize == 0)
+       {
+               newlen = ((len + str->delta - 1) / str->delta) * str->delta;
+       }
+       else
+       {
+               /* used size is (str->cursor + 1) including tailiing nul */
+               if (len <= (str->bufsize - (str->cursor + 1))) return 0;
+
+               /* really this is ((str->cursor + 1) + len + (str->delta - 1)) */
+               newlen = ((str->cursor + len + str->delta) / str->delta) * str->delta;
+       }
+
+       if (str->encoding & ASL_STRING_VM)
+       {
+               kern_return_t kstatus;
+               vm_address_t new = 0;
+
+               kstatus = vm_allocate(mach_task_self(), &new, newlen, TRUE);
+               if (kstatus != KERN_SUCCESS)
+               {
+                       new = 0;
+                       newlen = 0;
+                       return -1;
+               }
+       
+               if (str->buf != NULL)
+               {
+                       memcpy((void *)new, str->buf, str->bufsize);
+                       vm_deallocate(mach_task_self(), (vm_address_t)str->buf, str->bufsize);
+               }
+
+               str->buf = (char *)new;
+               str->bufsize = newlen;
+       }
+       else
+       {
+               str->buf = reallocf(str->buf, newlen);
+               if (str->buf == NULL)
+               {
+                       str->cursor = 0;
+                       str->bufsize = 0;
+                       return -1;
+               }
+
+               str->bufsize = newlen;
+       }
+
+       return 0;
+}
+
+asl_string_t *
+asl_string_append_char_no_encoding(asl_string_t *str, const char c)
+{
+       size_t len;
+       
+       if (str == NULL) return NULL;
+
+       len = 1;
+       if (str->bufsize == 0) len++;
+
+       if (_asl_string_grow(str, len) < 0) return str;
+
+       str->buf[str->cursor] = c;
+       str->cursor++;
+       str->buf[str->cursor] = '\0';
+
+       if (str->encoding & ASL_STRING_LEN)
+       {
+               char tmp[11];
+               snprintf(tmp, sizeof(tmp), "%10lu", str->cursor - 10);
+               memcpy(str->buf, tmp, 10);
+       }
+
+       return str;
+}
+
+asl_string_t *
+asl_string_append_no_encoding(asl_string_t *str, const char *app)
+{
+       size_t len, applen;
+
+       if (str == NULL) return NULL;
+       if (app == NULL) return str;
+
+       applen = strlen(app);
+       len = applen;
+       if (str->bufsize == 0) len++;
+
+       if (_asl_string_grow(str, len) < 0) return str;
+
+       memcpy(str->buf + str->cursor, app, applen);
+
+       str->cursor += applen;
+       str->buf[str->cursor] = '\0';
+
+       if (str->encoding & ASL_STRING_LEN)
+       {
+               char tmp[11];
+               snprintf(tmp, sizeof(tmp), "%10lu", str->cursor - 10);
+               memcpy(str->buf, tmp, 10);
+       }
+
+       return str;
+}
+
+static asl_string_t *
+asl_string_append_internal(asl_string_t *str, const char *app, int encode_space)
+{
+       uint8_t x;
+       const char *p;
+
+       if (str == NULL) return NULL;
+       if (app == NULL) return str;
+
+       switch (str->encoding & ASL_ENCODE_MASK)
+       {
+               case ASL_ENCODE_NONE:
+               {
+                       return asl_string_append_no_encoding(str, app);
+               }
+               case ASL_ENCODE_SAFE: 
+               {
+                       /* minor encoding to reduce the likelyhood of spoof attacks */
+                       const char *p;
+       
+                       for (p = app; *p != '\0'; p++)
+                       {
+                               if ((*p == 10) || (*p == 13))
+                               {
+                                       asl_string_append_no_encoding(str, "\n\t");
+                               }
+                               else if (*p == 8)
+                               {
+                                       asl_string_append_no_encoding(str, "^H");
+                               }
+                               else
+                               {
+                                       asl_string_append_char_no_encoding(str, *p);
+                               }
+                       }
+
+                       return str;
+               }
+               case ASL_ENCODE_ASL:
+               {
+                       for (p = app; *p != '\0'; p++)
+                       {
+                               int meta = 0;
+
+                               x = *p;
+                               
+                               /* Meta chars get \M prefix */
+                               if (x >= 128)
+                               {
+                                       /* except meta-space, which is \240 */
+                                       if (x == 160)
+                                       {
+                                               asl_string_append_no_encoding(str, "\\240");
+                                               continue;
+                                       }
+                                       
+                                       asl_string_append_no_encoding(str, "\\M");
+                                       x &= 0x7f;
+                                       meta = 1;
+                               }
+                               
+                               /* space is either ' ' or \s */
+                               if (x == 32)
+                               {
+                                       if (encode_space == 0)
+                                       {
+                                               asl_string_append_char_no_encoding(str, ' ');
+                                               continue;
+                                       }
+                                       
+                                       asl_string_append_no_encoding(str, "\\s");
+                                       continue;
+                               }
+                               
+                               /* \ is escaped */
+                               if ((meta == 0) && (x == 92))
+                               {
+                                       asl_string_append_no_encoding(str, "\\\\");
+                                       continue;
+                               }
+                               
+                               /* [ and ] are escaped in ASL encoding */
+                               if ((str->encoding & ASL_ENCODE_ASL) && (meta == 0) && ((*p == 91) || (*p == 93)))
+                               {
+                                       if (*p == '[') asl_string_append_no_encoding(str, "\\[");
+                                       else asl_string_append_no_encoding(str, "\\]");
+                                       continue;
+                               }
+                               
+                               /* DEL is \^? */
+                               if (x == 127)
+                               {
+                                       if (meta == 0)
+                                       {
+                                               asl_string_append_char_no_encoding(str, '\\');
+                                       }
+                                       
+                                       asl_string_append_no_encoding(str, "^?");
+                                       continue;
+                               }
+                               
+                               /* 33-126 are printable (add a '-' prefix for meta) */
+                               if ((x >= 33) && (x <= 126))
+                               {
+                                       if (meta == 1)
+                                       {
+                                               asl_string_append_char_no_encoding(str, '-');
+                                       }
+                                       
+                                       asl_string_append_char_no_encoding(str, x);
+                                       continue;
+                               }
+                               
+                               /* non-meta BEL, BS, HT, NL, VT, NP, CR (7-13) are \a, \b, \t, \n, \v, \f, and \r */
+                               if ((meta == 0) && (x >= 7) && (x <= 13))
+                               {
+                                       asl_string_append_char_no_encoding(str, '\\');
+                                       asl_string_append_char_no_encoding(str, cvis_7_13[x - 7]);
+                                       continue;
+                               }
+                               
+                               /* 0 - 31 are ^@ - ^_ (non-meta get a leading \) */
+                               if (x <= 31)
+                               {
+                                       if (meta == 0)
+                                       {
+                                               asl_string_append_char_no_encoding(str, '\\');
+                                       }
+                                       
+                                       asl_string_append_char_no_encoding(str, '^');
+                                       asl_string_append_char_no_encoding(str, 64 + x);
+                                       continue;
+                               }
+
+                               asl_string_append_char_no_encoding(str, x);
+                       }
+
+                       return str;
+               }
+               case ASL_ENCODE_XML:
+               {
+                       for (p = app; *p != '\0'; p++)
+                       {
+                               x = *p;
+                               
+                               if (x == '&')
+                               {
+                                       asl_string_append_no_encoding(str, "&amp;");
+                               }
+                               else if (x == '<')
+                               {
+                                       asl_string_append_no_encoding(str, "&lt;");
+                               }
+                               else if (x == '>')
+                               {
+                                       asl_string_append_no_encoding(str, "&gt;");
+                               }
+                               else if (x == '"')
+                               {
+                                       asl_string_append_no_encoding(str, "&quot;");
+                               }
+                               else if (x == '\'')
+                               {
+                                       asl_string_append_no_encoding(str, "&apos;");
+                               }
+                               else if (iscntrl(x))
+                               {
+                                       char tmp[8];
+                                       snprintf(tmp, sizeof(tmp), "&#x%02hhx;", x);
+                                       asl_string_append_no_encoding(str, tmp);
+                               }
+                               else
+                               {
+                                       asl_string_append_char_no_encoding(str, x);
+                               }
+                       }
+               }
+               default:
+               {
+                       return str;
+               }
+       }
+
+       return str;
+}
+
+asl_string_t *
+asl_string_append(asl_string_t *str, const char *app)
+{
+       return asl_string_append_internal(str, app, 0);
+}
+
+asl_string_t *
+asl_string_append_asl_key(asl_string_t *str, const char *app)
+{
+       return asl_string_append_internal(str, app, 1);
+}
+
+asl_string_t *
+asl_string_append_op(asl_string_t *str, uint32_t op)
+{
+       char opstr[8];
+       uint32_t i;
+       
+       if (str == NULL) return NULL;
+       
+       if (op == ASL_QUERY_OP_NULL)
+       {
+               return asl_string_append_char_no_encoding(str, '.');
+       }
+       
+       i = 0;
+       if (op & ASL_QUERY_OP_CASEFOLD) opstr[i++] = 'C';
+       
+       if (op & ASL_QUERY_OP_REGEX) opstr[i++] = 'R';
+       
+       if (op & ASL_QUERY_OP_NUMERIC) opstr[i++] = 'N';
+       
+       if (op & ASL_QUERY_OP_PREFIX)
+       {
+               if (op & ASL_QUERY_OP_SUFFIX) opstr[i++] = 'S';
+               else opstr[i++] = 'A';
+       }
+       if (op & ASL_QUERY_OP_SUFFIX) opstr[i++] = 'Z';
+       
+       switch (op & ASL_QUERY_OP_TRUE)
+       {
+               case ASL_QUERY_OP_EQUAL:
+                       opstr[i++] = '=';
+                       break;
+               case ASL_QUERY_OP_GREATER:
+                       opstr[i++] = '>';
+                       break;
+               case ASL_QUERY_OP_GREATER_EQUAL:
+                       opstr[i++] = '>';
+                       opstr[i++] = '=';
+                       break;
+               case ASL_QUERY_OP_LESS:
+                       opstr[i++] = '<';
+                       break;
+               case ASL_QUERY_OP_LESS_EQUAL:
+                       opstr[i++] = '<';
+                       opstr[i++] = '=';
+                       break;
+               case ASL_QUERY_OP_NOT_EQUAL:
+                       opstr[i++] = '!';
+                       break;
+               case ASL_QUERY_OP_TRUE:
+                       opstr[i++] = 'T';
+                       break;
+               default:
+                       break;
+       }
+       
+       if (i == 0)
+       {
+               return asl_string_append_char_no_encoding(str, '.');
+       }
+       
+       opstr[i] = '\0';
+       return asl_string_append_no_encoding(str, opstr);
+}
+
+asl_string_t *
+asl_string_append_xml_tag(asl_string_t *str, const char *tag, const char *s)
+{
+       asl_string_append_no_encoding(str, "\t\t<");
+       asl_string_append_no_encoding(str, tag);
+       asl_string_append_no_encoding(str, ">");
+       asl_string_append_no_encoding(str, s);
+       asl_string_append_no_encoding(str, "</");
+       asl_string_append_no_encoding(str, tag);
+       asl_string_append_no_encoding(str, ">\n");
+       return str;
+}
index 10292fb7ed6168688588487695c6799607aba62e..fdd5edbba6c5d87bf99ff206b881aba26427e75e 100644 (file)
@@ -2,33 +2,40 @@
 #define __ASL_CORE_H__
 
 /*
- * Copyright (c) 2007 Apple Inc.  All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc.  All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
- * "Portions Copyright (c) 2007 Apple Inc.  All Rights
- * Reserved.  This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License').  You may not use this file
- * except in compliance with the License.  Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
 
+#include <stdlib.h>
 #include <stdint.h>
 #include <Availability.h>
 
-#define asl_msg_list_t asl_search_result_t
+typedef struct
+{
+       uint32_t encoding;
+       size_t delta;
+       size_t bufsize;
+       size_t cursor;
+       char *buf;
+} asl_string_t;
 
 #define ASL_STATUS_OK               0
 #define ASL_STATUS_INVALID_ARG      1
 #define ASL_QUERY_MATCH_FALSE    0x40000000
 #define ASL_QUERY_MATCH_ERROR    0x20000000
 
+#define ASL_ENCODE_NONE                0
+#define ASL_ENCODE_SAFE                1
+#define ASL_ENCODE_ASL         2
+#define ASL_ENCODE_XML         3
+#define ASL_ENCODE_MASK                0x0000000f
+#define ASL_STRING_VM          0x80000000
+#define ASL_STRING_LEN         0x40000000
+
+#define ASL_STRING_MIG         0xc0000002
+
 uint32_t asl_core_string_hash(const char *str, uint32_t len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
 const char *asl_core_error(uint32_t code) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
 uint32_t asl_core_check_access(int32_t msgu, int32_t msgg, int32_t readu, int32_t readg, uint16_t flags) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
@@ -84,4 +101,17 @@ uint64_t asl_core_new_msg_id(uint64_t start) __OSX_AVAILABLE_STARTING(__MAC_10_5
 char *asl_core_encode_buffer(const char *in, uint32_t len) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0);
 int32_t asl_core_decode_buffer(const char *in, char **buf, uint32_t *len) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0);
 
-#endif __ASL_CORE_H__
+asl_string_t *asl_string_new(uint32_t encoding) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+char *asl_string_free_return_bytes(asl_string_t *str) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+void asl_string_free(asl_string_t *str) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+char *asl_string_bytes(asl_string_t *str) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+size_t asl_string_length(asl_string_t *str) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+size_t asl_string_allocated_size(asl_string_t *str) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_string_t *asl_string_append(asl_string_t *str, const char *app) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_string_t *asl_string_append_asl_key(asl_string_t *str, const char *app) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_string_t *asl_string_append_op(asl_string_t *str, uint32_t op) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_string_t *asl_string_append_no_encoding(asl_string_t *str, const char *app) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_string_t *asl_string_append_char_no_encoding(asl_string_t *str, const char c) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_string_t *asl_string_append_xml_tag(asl_string_t *str, const char *tag, const char *s) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+
+#endif /* __ASL_CORE_H__ */
diff --git a/gen/asl_fd.c b/gen/asl_fd.c
new file mode 100644 (file)
index 0000000..74e3838
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/event.h>
+#include <asl.h>
+#include <asl_private.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <dispatch/dispatch.h>
+
+/* asl.c */
+__private_extern__ void asl_client_release(asl_client_t *asl);
+__private_extern__ asl_client_t *asl_client_retain(asl_client_t *asl);
+
+#define BUF_SIZE 512
+
+static dispatch_queue_t redirect_serial_q;
+static dispatch_group_t read_source_group;
+
+typedef struct {
+    int level;
+    asl_client_t *asl;
+    asl_msg_t *msg;
+
+    /* Buffered reading */
+    char *buf;
+    char *w;
+
+    dispatch_source_t read_source;
+} asl_redirect_t;
+
+static asl_redirect_t *redirect_descriptors = NULL;
+static int n_redirect_descriptors = 0;
+
+/* Read from the FD until there is no more to read and redirect to ASL.
+ * Preconditions:
+ *      1: called from the appropriate serial queue for operating on
+ *         redirect_descriptors
+ *      2: descriptor corresponds to a valid entry in redirect_descriptors
+ *
+ * Return values:
+ *      If the pipe is closed, EOF is returned regardless of how many bytes
+ *      were processed.  If the pipe is still open, the number of read bytes
+ *      is returned.
+ */
+static inline int _read_redirect(int descriptor, int flush) {
+    int total_read = 0;
+    int nbytes;
+    asl_redirect_t *aslr = &redirect_descriptors[descriptor];
+
+    while ((nbytes = read(descriptor, aslr->w, BUF_SIZE - (aslr->w - aslr->buf) - 1)) > 0) {
+        char *s, *p;
+
+        /* Increment our returned number read */
+        total_read += nbytes;
+
+        nbytes += (aslr->w - aslr->buf);
+        aslr->buf[nbytes] = '\0';
+
+        /* One line at a time */
+        for (p=aslr->buf; *p && (p - aslr->buf) < nbytes; p = s + 1) {
+            // Find null or \n
+            for (s=p; *s && *s != '\n'; s++);
+            if (*s == '\n') {
+                *s='\0';
+                asl_log((aslclient)aslr->asl, (aslmsg)aslr->msg, aslr->level, "%s", p);
+            } else if (aslr->buf != p) {
+                memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
+                aslr->w = aslr->buf + (s - p);
+                break;
+            } else if (nbytes == BUF_SIZE - 1) {
+                asl_log((aslclient)aslr->asl, (aslmsg)aslr->msg, aslr->level, "%s", p);
+                aslr->w = aslr->buf;
+                break;
+            }
+        }
+    }
+
+    /* Flush if requested or we're at EOF */
+    if (flush || nbytes == 0) {
+        if (aslr->w > aslr->buf) {
+            *aslr->w = '\0';
+            asl_log((aslclient)aslr->asl, (aslmsg)aslr->msg, aslr->level, "%s", aslr->buf);
+        }
+    }
+
+    if (nbytes == 0)
+        return EOF;
+    return total_read;
+}
+
+static void read_from_source(void *_source) {
+    dispatch_source_t source = (dispatch_source_t)_source;
+    int descriptor = dispatch_source_get_handle(source);
+    if (_read_redirect(descriptor, 0) == EOF) {
+        dispatch_source_cancel(source);
+    }
+}
+
+static void cancel_source(void *_source) {
+    dispatch_source_t source = (dispatch_source_t)_source;
+    int descriptor = dispatch_source_get_handle(source);
+    asl_redirect_t *aslr = &redirect_descriptors[descriptor];
+
+    /* Flush the buffer */
+    _read_redirect(descriptor, 1);
+
+    close(descriptor);
+
+    asl_client_release(aslr->asl);
+    asl_msg_release(aslr->msg);
+    free(aslr->buf);
+
+    memset(aslr, 0, sizeof(*aslr));
+    dispatch_release(source);
+    dispatch_group_leave(read_source_group);
+}
+
+
+static void redirect_atexit(void) {
+    int i;
+
+    /* stdout is linebuffered, so flush the buffer */
+    if (redirect_descriptors[STDOUT_FILENO].buf)
+        fflush(stdout);
+
+    /* Cancel all of our dispatch sources, so they flush to ASL */
+    for (i=0; i < n_redirect_descriptors; i++)
+        if (redirect_descriptors[i].read_source)
+            dispatch_source_cancel(redirect_descriptors[i].read_source);
+
+    /* Wait at least three seconds for our sources to flush to ASL */
+    dispatch_group_wait(read_source_group, dispatch_time(DISPATCH_TIME_NOW, 3LL * NSEC_PER_SEC));
+}
+
+static void asl_descriptor_init(void *ctx __unused)
+{
+    assert((redirect_descriptors = calloc(16, sizeof(*redirect_descriptors))) != NULL);
+    n_redirect_descriptors = 16;
+
+    redirect_serial_q = dispatch_queue_create("com.apple.asl-redirect", NULL);
+    assert(redirect_serial_q != NULL);
+
+    read_source_group = dispatch_group_create();
+    assert(read_source_group != NULL);
+
+    atexit(redirect_atexit);
+}
+
+static int asl_log_from_descriptor(aslclient ac, aslmsg am, int level, int descriptor) {
+    int err __block = 0;
+    static dispatch_once_t once_control;
+    dispatch_once_f(&once_control, NULL, asl_descriptor_init);
+    asl_client_t *asl = (asl_client_t *)ac;
+    asl_msg_t *msg = (asl_msg_t *)am;
+
+    if (descriptor < 0)
+        return EBADF;
+
+    if (msg != NULL) {
+        msg = asl_msg_copy(msg);
+        if (msg == NULL)
+            return ENOMEM;
+    }
+
+    dispatch_sync(redirect_serial_q, ^{
+        dispatch_source_t read_source;
+
+        /* Reallocate if we need more space */
+        if (descriptor >= n_redirect_descriptors) {
+            size_t new_n = 1 << (ffs(descriptor) + 1);
+            asl_redirect_t *new_array = realloc(redirect_descriptors, new_n * sizeof(*redirect_descriptors));
+            if (!new_array) {
+                err = errno;
+                return;
+            }
+            redirect_descriptors = new_array;
+            memset(redirect_descriptors + n_redirect_descriptors, 0, new_n - n_redirect_descriptors);
+            n_redirect_descriptors = new_n;
+        }
+        
+        /* If we're already listening on it, return error. */
+        if (redirect_descriptors[descriptor].buf != NULL) {
+            err = EBADF;
+            return;
+        }
+        
+        /* Initialize our buffer */
+        redirect_descriptors[descriptor].buf = (char *)malloc(BUF_SIZE);
+        if (redirect_descriptors[descriptor].buf == NULL) {
+            err = errno;
+            return;
+        }
+        redirect_descriptors[descriptor].w = redirect_descriptors[descriptor].buf;
+        
+        /* Store our ASL settings */
+        redirect_descriptors[descriptor].level = level;
+        redirect_descriptors[descriptor].asl = asl_client_retain(asl);
+        redirect_descriptors[descriptor].msg = msg;
+        
+        /* Don't block on reads from this descriptor */
+        (void)fcntl(descriptor, F_SETFL, O_NONBLOCK);
+        
+        /* Start listening */
+        read_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, descriptor, 0, redirect_serial_q);
+        redirect_descriptors[descriptor].read_source = read_source;
+        dispatch_set_context(read_source, read_source);
+        dispatch_source_set_event_handler_f(read_source, read_from_source);
+        dispatch_source_set_cancel_handler_f(read_source, cancel_source);
+        dispatch_group_enter(read_source_group);
+        dispatch_resume(read_source);
+    });
+
+    if (err) {
+        asl_msg_release(msg);
+    }
+    
+    return err;
+}
+
+int asl_log_descriptor(aslclient ac, aslmsg am, int level, int descriptor, uint32_t fd_type) {
+    int pipepair[2];
+    int retval;
+    int oerrno = errno;
+
+    if (fd_type == ASL_LOG_DESCRIPTOR_READ)
+        return asl_log_from_descriptor(ac, am, level, descriptor);
+
+    assert(fd_type == ASL_LOG_DESCRIPTOR_WRITE);
+
+    /* Create pipe */
+    if (pipe(pipepair) == -1) {
+        retval = errno;
+        errno = oerrno;
+        return retval;
+    }
+    
+    /* Close the read descriptor but not the write descriptor on exec */
+    if (fcntl(pipepair[0], F_SETFD, FD_CLOEXEC) == -1) {
+        retval = errno;
+        errno = oerrno;
+        return retval;
+    }
+
+    /* Replace the existing descriptor */
+    if (dup2(pipepair[1], descriptor) == -1) {
+        close(pipepair[0]);
+        close(pipepair[1]);
+        retval = errno;
+        errno = oerrno;
+        return retval;
+    }
+
+    /* If we capture STDOUT_FILENO, make sure we linebuffer stdout */
+    if (descriptor == STDOUT_FILENO)
+        setlinebuf(stdout);
+    
+    /* Close the duplicate descriptors since they've been reassigned */
+    close(pipepair[1]);
+
+    /* Hand off the read end of our pipe to asl_log_descriptor */
+    return asl_log_from_descriptor(ac, am, level, pipepair[0]);
+}
index 6c7c63a415d43b47d9f7f95ac7a4024a641f1d59..7a8c4cbedfba10956f1e82bdb9ea86c1a189ae6c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
@@ -38,6 +38,7 @@
 #include <sys/time.h>
 #include <asl_private.h>
 #include <asl_legacy1.h>
+#include <TargetConditionals.h>
 
 extern time_t asl_parse_time(const char *str);
 extern int asl_msg_cmp(aslmsg a, aslmsg b);
@@ -266,6 +267,9 @@ asl_file_open_write_fd(int fd, asl_file_t **s)
 __private_extern__ int
 asl_file_create(const char *path, uid_t uid, gid_t gid, mode_t mode)
 {
+#if TARGET_OS_EMBEDDED
+       return open(path, O_RDWR | O_CREAT | O_EXCL, mode);
+#else
        acl_t acl;
        uuid_t uuid;
        acl_entry_t entry;
@@ -273,9 +277,15 @@ asl_file_create(const char *path, uid_t uid, gid_t gid, mode_t mode)
        int status;
        int fd = -1;
 
+       /* -1 means don't set ACL for uid or gid */
+       if ((uid == -1) && (gid == -1))
+       {
+               return open(path, O_RDWR | O_CREAT | O_EXCL, mode);
+       }
+
        acl = acl_init(1);
 
-       if (gid != 0)
+       if ((gid != 0) && (gid != -1))
        {
                status = mbr_gid_to_uuid(gid, uuid);
                if (status != 0) goto asl_file_create_return;
@@ -296,7 +306,7 @@ asl_file_create(const char *path, uid_t uid, gid_t gid, mode_t mode)
                if (status != 0) goto asl_file_create_return;
        }
        
-       if (uid != 0)
+       if ((uid != 0) && (uid != -1))
        {
                status = mbr_uid_to_uuid(uid, uuid);
                if (status != 0) goto asl_file_create_return;
@@ -332,6 +342,7 @@ asl_file_create_return:
        
        acl_free(acl);
        return fd;
+#endif
 }
 
 uint32_t
index 491cca100375785ac7cefd6d18ae682f9a8a3a78..d550d8d961dd9beaaa7d82b17cbf62a7180cecf3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
@@ -147,4 +147,4 @@ uint64_t asl_file_ctime(asl_file_t *s) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IP
 
 uint32_t asl_file_compact(asl_file_t *s, const char *path, mode_t mode, uid_t uid, gid_t gid) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
 
-#endif __ASL_FILE_H__
+#endif /* __ASL_FILE_H__ */
index c7ef1d37c44d5010f519e5aa3241308f9a7e9f49..537bbe2ace6f1b120c0fa757ee35b57dce06212d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
index 5a7a000b75e5dffe96c07be6f962a396fca58689..8bd9ba1ac13a1dde2f00cda2e99b66956c045168 100644 (file)
@@ -1,26 +1,24 @@
 /*
- * Copyright (c) 2007 Apple Inc.  All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc.  All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
- * "Portions Copyright (c) 2007 Apple Inc.  All Rights
- * Reserved.  This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License').  You may not use this file
- * except in compliance with the License.  Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
- */
+ * @APPLE_LICENSE_HEADER_END@ */
 
 #include <asl_core.h>
 #include <asl_legacy1.h>
@@ -244,6 +242,7 @@ slotlist_init(asl_legacy1_t *s, uint32_t count)
        uint32_t i, si, status, hash, addslot;
        uint64_t xid;
        uint8_t t;
+       size_t rcount;
        char tmp[DB_RECORD_LEN];
 
        /* Start at first slot after the header */
@@ -257,8 +256,8 @@ slotlist_init(asl_legacy1_t *s, uint32_t count)
 
        for (i = 1; i < count; i++)
        {
-               status = fread(tmp, DB_RECORD_LEN, 1, s->db);
-               if (status != 1) return ASL_STATUS_READ_FAILED;
+               rcount = fread(tmp, DB_RECORD_LEN, 1, s->db);
+               if (rcount != 1) return ASL_STATUS_READ_FAILED;
 
                t = tmp[0];
                addslot = 0;
@@ -306,6 +305,7 @@ asl_legacy1_open(const char *path, asl_legacy1_t **out)
        asl_legacy1_t *s;
        struct stat sb;
        int status;
+       size_t rcount;
        char cbuf[DB_RECORD_LEN];
        off_t fsize;
        uint32_t count;
@@ -327,8 +327,8 @@ asl_legacy1_open(const char *path, asl_legacy1_t **out)
        }
 
        memset(cbuf, 0, DB_RECORD_LEN);
-       status = fread(cbuf, DB_RECORD_LEN, 1, s->db);
-       if (status != 1)
+       rcount = fread(cbuf, DB_RECORD_LEN, 1, s->db);
+       if (rcount != 1)
        {
                fclose(s->db);
                free(s);
@@ -368,7 +368,9 @@ string_fetch_slot(asl_legacy1_t *s, uint32_t slot, char **out)
 {
        off_t offset;
        uint8_t type;
-       uint32_t status, next, len, x, remaining;
+       uint32_t next, x, remaining;
+       size_t rcount, len;
+       int status;
        char *outstr, *p, tmp[DB_RECORD_LEN];
 
        if (s == NULL) return ASL_STATUS_INVALID_STORE;
@@ -380,8 +382,8 @@ string_fetch_slot(asl_legacy1_t *s, uint32_t slot, char **out)
 
        if (status < 0) return ASL_STATUS_READ_FAILED;
 
-       status = fread(tmp, DB_RECORD_LEN, 1, s->db);
-       if (status != 1) return ASL_STATUS_READ_FAILED;
+       rcount = fread(tmp, DB_RECORD_LEN, 1, s->db);
+       if (rcount != 1) return ASL_STATUS_READ_FAILED;
 
        type = tmp[0];
        if (type != DB_TYPE_STRING) return ASL_STATUS_INVALID_STRING;
@@ -415,8 +417,8 @@ string_fetch_slot(asl_legacy1_t *s, uint32_t slot, char **out)
                        return ASL_STATUS_READ_FAILED;
                }
 
-               status = fread(tmp, DB_RECORD_LEN, 1, s->db);
-               if (status != 1)
+               rcount = fread(tmp, DB_RECORD_LEN, 1, s->db);
+               if (rcount != 1)
                {
                        free(outstr);
                        return ASL_STATUS_READ_FAILED;
@@ -550,7 +552,9 @@ msg_fetch(asl_legacy1_t *s, uint32_t slot, aslmsg *out)
        uint32_t status, i, n, kvcount, next;
        uint16_t flags;
        uint64_t sid;
+       size_t rcount;
        aslmsg msg;
+       int fstatus;
        char *p, tmp[DB_RECORD_LEN], *key, *val;
 
        if (s == NULL) return ASL_STATUS_INVALID_STORE;
@@ -559,12 +563,12 @@ msg_fetch(asl_legacy1_t *s, uint32_t slot, aslmsg *out)
        *out = NULL;
 
        offset = slot * DB_RECORD_LEN;
-       status = fseek(s->db, offset, SEEK_SET);
+       fstatus = fseek(s->db, offset, SEEK_SET);
 
-       if (status < 0) return ASL_STATUS_READ_FAILED;
+       if (fstatus < 0) return ASL_STATUS_READ_FAILED;
 
-       status = fread(tmp, DB_RECORD_LEN, 1, s->db);
-       if (status != 1) return ASL_STATUS_READ_FAILED;
+       rcount = fread(tmp, DB_RECORD_LEN, 1, s->db);
+       if (rcount != 1) return ASL_STATUS_READ_FAILED;
 
        flags = _asl_get_16(tmp + MSG_OFF_KEY_FLAGS);
 
@@ -594,15 +598,15 @@ msg_fetch(asl_legacy1_t *s, uint32_t slot, aslmsg *out)
        while (next != 0)
        {
                offset = next * DB_RECORD_LEN;
-               status = fseek(s->db, offset, SEEK_SET);
-               if (status < 0)
+               fstatus = fseek(s->db, offset, SEEK_SET);
+               if (fstatus < 0)
                {
                        free(out);
                        return ASL_STATUS_READ_FAILED;
                }
 
-               status = fread(tmp, DB_RECORD_LEN, 1, s->db);
-               if (status != 1)
+               rcount = fread(tmp, DB_RECORD_LEN, 1, s->db);
+               if (rcount != 1)
                {
                        free(out);
                        return ASL_STATUS_READ_FAILED;
index eff42d9c27270e6e38cb4c857082cf0ee2072f6e..a2efcde1a9d95ca5ce702904ba6dc9341b97a514 100644 (file)
@@ -2,28 +2,26 @@
 #define __ASL_LEGACY1_H__
 
 /*
- * Copyright (c) 2007 Apple Inc.  All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc.  All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
- * "Portions Copyright (c) 2007 Apple Inc.  All Rights
- * Reserved.  This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License').  You may not use this file
- * except in compliance with the License.  Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
- */
+ * @APPLE_LICENSE_HEADER_END@ */
 
 /*
  * ASL Database VERSION 1 (LEGACY)
index d82420923ef702658f4d6edd082e81a545896a11..5c611b9fe3e83978501b2bff012fc7e8585750e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
 #define MFMT_STR 4
 #define MFMT_MSG 5
 
-#define TFMT_SEC 0
-#define TFMT_UTC 1
-#define TFMT_LCL 2
-
-#define XML_TAG_KEY 0
-#define XML_TAG_STRING 1
-#define XML_TAG_DATA 2
+#define SEC_PER_HOUR 3600
 
 #define forever for(;;)
 
 #define AUX_0_OPTION    0x00000200
 #define AUX_0_LEVEL     0x00000400
 
-/* character encoding lengths */
-static const uint8_t char_encode_len[128] =
-{
-       2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1,
-       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3
-};
-
-static const char *cvis_7_13 = "abtnvfr";
-
 extern time_t asl_parse_time(const char *in);
 
 /* from asl_util.c */
@@ -901,6 +884,67 @@ asl_msg_set_key_val(asl_msg_t *msg, const char *key, const char *val)
        return asl_msg_set_key_val_op(msg, key, val, 0);
 }
 
+/*
+ * Merge a key / val into a message (only ASL_TYPE_MSG).
+ * Adds the key / val if the key is not found.
+ * Does not replace the value if the key is found.
+ */
+static void
+_asl_msg_merge_key_val(asl_msg_t *msg, const char *key, const char *val)
+{
+       uint32_t i, slot;
+       asl_msg_t *page;
+
+       if (msg == NULL) return;
+       if (key == NULL) return;
+
+       slot = IndexNull;
+       page = NULL;
+
+       i = _asl_msg_index(msg, key, &slot, &page);
+       if (i != IndexNull) return;
+
+       asl_msg_set_key_val_op(msg, key, val, 0);
+}
+
+/*
+ * Merge msg into target (does not replace existing keys).
+ * Creates a new asl_msg_t if target is NULL.
+ * Returns target.
+ */
+asl_msg_t *
+asl_msg_merge(asl_msg_t *target, asl_msg_t *msg)
+{
+       uint32_t x, slot, op, isnew = 0;
+       const char *key, *val;
+       asl_msg_t *page;
+
+       if (msg == NULL) return target;
+
+       if (target == NULL)
+       {
+               isnew = 1;
+               target = asl_msg_new(ASL_TYPE_MSG);
+       }
+
+       for (x = _asl_msg_fetch_internal(msg, 0, &key, &val, &op, &page, &slot); x != IndexNull; x = _asl_msg_fetch_internal(msg, x, &key, &val, &op, &page, &slot))
+       {
+               if (isnew == 1) asl_msg_set_key_val_op(target, key, val, 0);
+               else _asl_msg_merge_key_val(target, key, val);
+       }
+
+       return target;
+}
+
+/*
+ * Copy msg.
+ */
+asl_msg_t *
+asl_msg_copy(asl_msg_t *msg)
+{
+       return asl_msg_merge(NULL, msg);
+}
+
 /*
  * asl_msg_unset
  * Frees external key and val strings, but does not try to reclaim data space.
@@ -1360,1170 +1404,274 @@ asl_msg_cmp(asl_msg_t *a, asl_msg_t *b)
        return _asl_msg_test(b, a);
 }
 
-static void
-_asl_encode_char(char *buf, uint32_t *cursor, uint32_t c, uint32_t encode, uint32_t encode_space)
-{
-       char *p;
-       int meta;
-
-       meta = 0;
 
-       p = buf + *cursor;
+static char *
+_asl_time_string(const char *fmt, const char *str)
+{
+       time_t tick, off;
+       struct tm stm;
+       char *ltime;
+       char *out;
+       char ltbuf[32];
+       out = NULL;
+       time_t min;
+       const char *p = fmt;
 
-       /* NUL is not allowed */
-       if (c == 0) return;
+       tick = 0;
+       if (str != NULL) tick = asl_parse_time(str);
 
-       /* Meta chars get \M prefix */
-       if (c >= 128)
+       /* default format is local time zone */
+       if ((fmt == NULL) || (!strcasecmp(fmt, "lcl")) || (!strcasecmp(fmt, "local")))
        {
-               /* except meta-space, which is \240 */
-               if (c == 160)
-               {
-                       *p++ = '\\';
-                       *p++ = '2';
-                       *p++ = '4';
-                       *p++ = '0';
-                       *p = '\0';
-                       *cursor = *cursor + 4;
-                       return;
-               }
-
-               *p++ = '\\';
-               *p++ = 'M';
-               *p = '\0';
-               *cursor = *cursor + 2;
-               c &= 0x7f;
-               meta = 1;
+               ltime = ctime_r(&tick, ltbuf);
+               if (ltime == NULL) return NULL;
+               ltime[19] = '\0';
+               asprintf(&out, "%s", ltime + 4);
+               return out;
        }
 
-       /* space is either ' ' or \s */
-       if (c == 32)
+       if ((!strcasecmp(fmt, "sec")) || (!strcasecmp(fmt, "raw")))
        {
-               if (encode_space == 0)
-               {
-                       *p++ = ' ';
-                       *p = '\0';
-                       *cursor = *cursor + 1;
-                       return;
-               }
-
-               *p++ = '\\';
-               *p++ = 's';
-               *p = '\0';
-               *cursor = *cursor + 2;
-               return;
+               asprintf(&out, "%lu", tick);
+               return out;
        }
 
-       /* \ is escaped */
-       if ((meta == 0) && (c == 92))
+       if (!strcasecmp(fmt, "j"))
        {
-               *p++ = '\\';
-               *p++ = c;
-               *p = '\0';
-               *cursor = *cursor + 2;
-               return;
+               if (NULL == localtime_r(&tick, &stm)) return NULL;
+               asprintf(&out, "%d-%02d-%02d %02d:%02d:%02d", stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec);
+               return out;
        }
 
-       /* [ and ] are escaped in ASL encoding */
-       if ((encode == ASL_ENCODE_ASL) && (meta == 0) && ((c == 91) || (c == 93)))
+       if ((!strcasecmp(fmt, "utc")) || (!strcasecmp(fmt, "zulu")))
        {
-               *p++ = '\\';
-               *p++ = c;
-               *p = '\0';
-               *cursor = *cursor + 2;
-               return;
+               if (NULL == gmtime_r(&tick, &stm)) return NULL;
+               asprintf(&out, "%d-%02d-%02d %02d:%02d:%02dZ", stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec);
+               return out;
        }
 
-       /* DEL is \^? */
-       if (c == 127)
+       if ((fmt[1] == '\0') && (((fmt[0] >= 'a') && (fmt[0] <= 'z')) || ((fmt[0] >= 'A') && (fmt[0] <= 'Z'))))
        {
-               if (meta == 0)
-               {
-                       *p++ = '\\';
-                       *cursor = *cursor + 1;
-               }
+               char z = fmt[0];
+               if (z >= 'a') z -= 32;
 
-               *p++ = '^';
-               *p++ = '?';
-               *p = '\0';
-               *cursor = *cursor + 2;
-               return;
+               if (z == 'Z') off = 0;
+               else if ((z >= 'A') && (z <= 'I')) off = ((z - 'A') + 1) * SEC_PER_HOUR;
+               else if ((z >= 'K') && (z <= 'M')) off = (z - 'A') * SEC_PER_HOUR;
+               else if ((z >= 'N') && (z <= 'Y')) off = ('M' - z) * SEC_PER_HOUR;
+               else return NULL;
        }
-
-       /* 33-126 are printable (add a '-' prefix for meta) */
-       if ((c >= 33) && (c <= 126))
+       else
        {
-               if (meta == 1)
+               if ((*p == '-') || (*p == '+')) p++;
+               if ((*p) >= '0' && (*p <= '9'))
                {
-                       *p++ = '-';
-                       *cursor = *cursor + 1;
-               }
-
-               *p++ = c;
-               *p = '\0';
-               *cursor = *cursor + 1;
-               return;
-       }
-
-       /* non-meta BEL, BS, HT, NL, VT, NP, CR (7-13) are \a, \b, \t, \n, \v, \f, and \r */
-       if ((meta == 0) && (c >= 7) && (c <= 13))
-       {
-               *p++ = '\\';
-               *p++ = cvis_7_13[c - 7];
-               *p = '\0';
-               *cursor = *cursor + 2;
-               return;
-       }
+                       off = atoi(p);
+                       if (fmt[0] == '-') off *= -1;
+                       off *= SEC_PER_HOUR;
 
-       /* 0 - 31 are ^@ - ^_ (non-meta get a leading \) */
-       if ((c >= 0) && (c <= 31))
-       {
-               if (meta == 0)
+                       p = strchr(p, ':');
+                       if (p != NULL)
+                       {
+                               min = atoi(p + 1);
+                               if (fmt[0] == '-') min *= -1;
+                               min *= 60;
+                               off += min;
+                       }
+               }
+               else
                {
-                       *p++ = '\\';
-                       *cursor = *cursor + 1;
+                       return NULL;
                }
-
-               *p++ = '^';
-               *p++ = 64 + c;
-               *p = '\0';
-               *cursor = *cursor + 2;
-               return;
        }
 
-       return;
-}
-
-static uint32_t
-_asl_append_string_length(const char *s, uint32_t encode, uint32_t escspace)
-{
-       uint32_t i, n, spextra, outlen;
-       uint8_t c;
-
-       if (s == NULL) return 0;
+       tick += off;
 
-       outlen = 0;
+       memset(&stm, 0, sizeof (struct tm));
+       if (NULL == gmtime_r(&tick, &stm)) return NULL;
 
-       if (encode == ASL_ENCODE_NONE)
+       if ((fmt[0] >= 'A') && (fmt[0] <= 'Z'))
        {
-               /* no encoding - just need enough space for the string */
-               return strlen(s);
+               asprintf(&out, "%d-%02d-%02d %02d:%02d:%02d%c", stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec, fmt[0]);
        }
-       else if (encode == ASL_ENCODE_SAFE)
+       else if ((fmt[0] >= 'a') && (fmt[0] <= 'z'))
        {
-               /* minor encoding to reduce the likelyhood of spoof attacks */
-               n = 0;
-               for (i = 0; s[i] != '\0'; i++)
-               {
-                       n++;
-                       c = s[i];
-                       if ((c == 10) || (c == 13) || (c == 8)) n++;
-               }
-
-               return n;
+               asprintf(&out, "%d-%02d-%02d %02d:%02d:%02d%c", stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec, fmt[0] - 32);
        }
-
-       spextra = 0;
-       if (escspace != 0) spextra = 1;
-
-       n = 0;
-       for (i = 0; s[i] != '\0'; i++)
+       else if ((fmt[0] >= '0') && (fmt[0] <= '9'))
        {
-               c = s[i];
-
-               if (c >= 128)
-               {
-                       n += 4;
-               }
-               else if ((c == 91) || (c == 93))
-               {
-                       if (encode == ASL_ENCODE_ASL) n += 2;
-                       else n += 1;
-               }
-               else
-               {
-                       n += char_encode_len[c];
-                       if (c == 32) n += spextra;
-               }
+               asprintf(&out, "%d-%02d-%02d %02d:%02d:%02d+%s", stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec, fmt);
+       }
+       else
+       {
+               asprintf(&out, "%d-%02d-%02d %02d:%02d:%02d%s", stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour, stm.tm_min, stm.tm_sec, fmt);
        }
 
-       return n;
+       return out;
 }
 
-
-/*
- * Append a string using the requested encoding to a buffer.
- */
-static void
-_asl_append_string(char *buf, uint32_t bufsize, uint32_t *cursor, const char *s, uint32_t encode, uint32_t escspace)
+/* called from asl_format_message and _asl_send_message */
+__private_extern__ asl_string_t *
+asl_msg_to_string_raw(uint32_t encoding, asl_msg_t *msg, const char *tfmt)
 {
-       uint32_t i, n, spextra;
-       uint8_t c;
-       char *p;
-
-       if (buf == NULL) return;
-       if (cursor == NULL) return;
-       if (s == NULL) return;
+       uint32_t i, x, count;
+       char *vtime;
+       const char *key, *val;
+       asl_string_t *str;
 
-       if (encode == ASL_ENCODE_NONE)
-       {
-               /* no encoding - just use enough space and copy the string */
+       if (msg == NULL) return NULL;
 
-               n = strlen(s);
-               if (n == 0) return;
+       count = asl_msg_count(msg);
+       if (count == 0) return NULL;
 
-               assert((*cursor + n) < bufsize);
+       str = asl_string_new(encoding);
+       if (str == NULL) return NULL;
 
-               memcpy(buf + *cursor, s, n);
-               *cursor = *cursor + n;
+       key = NULL;
+       val = NULL;
+       i = 0;
 
-               return;
-       }
-       else if (encode == ASL_ENCODE_SAFE)
+       for (x = asl_msg_fetch(msg, 0, &key, &val, NULL); x != IndexNull; x = asl_msg_fetch(msg, x, &key, &val, NULL))
        {
-               /*
-                * Minor encoding to reduce the likelyhood of spoof attacks.
-                *
-                * - append a tab after newlines
-                * - translate \r to newline & append a tab
-                * - map backspace to ^H
-                *
-                * Note that there may be UTF-8 characters that could be used in a spoof
-                * attack that we don't check.  Caveat Reador.
-                */
-               n = 0;
-               for (i = 0; s[i] != '\0'; i++)
-               {
-                       n++;
-                       c = s[i];
-                       if ((c == 10) || (c == 13) || (c == 8)) n++;
-               }
-
-               if (n == 0) return;
+               if (key == NULL) continue;
 
-               assert((*cursor + n) < bufsize);
+               if (i > 0) asl_string_append_char_no_encoding(str, ' ');
 
-               p = buf + *cursor;
+               asl_string_append_char_no_encoding(str, '[');
+               asl_string_append_asl_key(str, key);
 
-               for (i = 0; s[i] != '\0'; i++)
+               if (!strcmp(key, ASL_KEY_TIME))
                {
-                       c = s[i];
-                       if ((c == 10) || (c == 13))
-                       {
-                               *p++ = '\n';
-                               *p++ = '\t';
-                               *cursor = *cursor + 2;
-                       }
-                       else if (c == 8)
+                       asl_string_append_char_no_encoding(str, ' ');
+                       vtime = NULL;
+
+                       if (val != NULL) vtime = _asl_time_string(tfmt, val);
+
+                       if (vtime != NULL)
                        {
-                               *p++ = '^';
-                               *p++ = 'H';
-                               *cursor = *cursor + 2;
+                               asl_string_append_no_encoding(str, vtime);
+                               free(vtime);
                        }
                        else
                        {
-                               *p++ = c;
-                               *cursor = *cursor + 1;
+                               asl_string_append_char_no_encoding(str, '0');
                        }
                }
-
-               return;
-       }
-
-       spextra = 0;
-
-       if (escspace != 0) spextra = 1;
-
-       n = 0;
-       for (i = 0; s[i] != '\0'; i++)
-       {
-               c = s[i];
-
-               if (c >= 128)
-               {
-                       n += 4;
-               }
-               else if ((c == 91) || (c == 93))
-               {
-                       if (encode == ASL_ENCODE_ASL) n += 2;
-                       else n += 1;
-               }
-               else
+               else if (val != NULL)
                {
-                       n += char_encode_len[c];
-                       if (c == 32) n += spextra;
+                       asl_string_append_char_no_encoding(str, ' ');
+                       asl_string_append(str, val);
                }
-       }
-
-       if (n == 0) return;
-
-       assert((*cursor + n) < bufsize);
-
-       for (i = 0; s[i] != '\0'; i++)
-       {
-               c = s[i];
-               _asl_encode_char(buf, cursor, c, encode, escspace);
-       }
-}
-
-
-static uint32_t
-_asl_append_xml_string_length(const char *s)
-{
-       uint32_t i, n;
-       uint8_t c;
-
-       if (s == NULL) return 0;
 
-       n = 0;
-       for (i = 0; s[i] != '\0'; i++)
-       {
-               c = s[i];
+               asl_string_append_char_no_encoding(str, ']');
 
-               /*
-                * XML wants &amp; &lt; &gt; &quot; and &apos;
-                * We use &#xnn; for control chars.
-                * Everything else just gets printed "as is" (we know the input is UTF8)
-                */
-               if (c == '&') n += 5;
-               else if (c == '<') n += 4;
-               else if (c == '>') n += 4;
-               else if (c == '"') n += 6;
-               else if (c == '\'') n += 6;
-               else if (iscntrl(c)) n += 6;
-               else n += 1;
+               i++;
        }
 
-       return n;
+       return str;
 }
 
-static int
-_asl_append_xml_string(char *buf, uint32_t bufsize, uint32_t *cursor, const char *s)
+static asl_string_t *
+_asl_string_append_asl_msg(asl_string_t *str, asl_msg_t *msg)
 {
-       uint32_t i, n;
-       uint8_t c;
-       char tmp[8], *p;
+       const char *key, *val;
+       uint32_t i, op, n;
 
-       if (buf == NULL) return -1;
-       if (cursor == NULL) return -1;
-       if (s == NULL) return -1;
+       if (msg == NULL) return str;
 
+       if (msg->type == ASL_TYPE_QUERY) asl_string_append(str, "Q ");
+
+       i = 0;
        n = 0;
-       for (i = 0; s[i] != '\0'; i++)
+
+       forever 
        {
-               c = s[i];
+               key = NULL;
+               val = NULL;
 
-               /*
-                * XML wants &amp; &lt; &gt; &quot; and &apos;
-                * We use &#xnn; for control chars.
-                * Everything else just gets printed "as is" (we know the input is UTF8)
-                */
-               if (c == '&') n += 5;
-               else if (c == '<') n += 4;
-               else if (c == '>') n += 4;
-               else if (c == '"') n += 6;
-               else if (c == '\'') n += 6;
-               else if (iscntrl(c)) n += 6;
-               else n += 1;
-       }
+               i = asl_msg_fetch(msg, i, &key, &val, &op);
+               if (key != NULL)
+               {
+                       if (n != 0)     asl_string_append_char_no_encoding(str, ' ');
+                       n++;
 
-       if (n == 0) return 0;
+                       asl_string_append_char_no_encoding(str, '[');
 
-       assert((*cursor + n) < bufsize);
-       p = buf + *cursor;
+                       if (msg->type == ASL_TYPE_QUERY)
+                       {
+                               asl_string_append_op(str, op);
+                               asl_string_append_char_no_encoding(str, ' ');
+                       }
 
-       for (i = 0; s[i] != '\0'; i++)
-       {
-               c = s[i];
+                       asl_string_append_asl_key(str, key);
 
-               if (c == '&')
-               {
-                       memcpy(p, "&amp;", 5);
-                       p += 5;
-                       *cursor = *cursor + 5;
-               }
-               else if (c == '<')
-               {
-                       memcpy(p, "&lt;", 4);
-                       p += 4;
-                       *cursor = *cursor + 4;
-               }
-               else if (c == '>')
-               {
-                       memcpy(p, "&gt;", 4);
-                       p += 4;
-                       *cursor = *cursor + 4;
-               }
-               else if (c == '"')
-               {
-                       memcpy(p, "&quot;", 6);
-                       p += 6;
-                       *cursor = *cursor + 6;
-               }
-               else if (c == '\'')
-               {
-                       memcpy(p, "&apos;", 6);
-                       p += 6;
-                       *cursor = *cursor + 6;
-               }
-               else if (iscntrl(c))
-               {
-                       snprintf(tmp, sizeof(tmp), "&#x%02hhx;", c);
-                       memcpy(p, tmp, 6);
-                       p += 6;
-                       *cursor = *cursor + 6;
-               }
-               else
-               {
-                       *p++ = c;
-                       *cursor = *cursor + 1;
+                       if (val != NULL)
+                       {
+                               asl_string_append_char_no_encoding(str, ' ');
+                               asl_string_append(str, val);
+                       }
+
+                       asl_string_append_char_no_encoding(str, ']');
                }
+
+               if (i == IndexNull) break;
        }
 
-       return 0;
+       return str;
 }
 
-static uint32_t
-_asl_append_xml_tag_length(int tag, const char *s)
+char *
+asl_msg_to_string(asl_msg_t *msg, uint32_t *len)
 {
-       uint32_t len, slen;
-
-       len = 0;
-
-       if (tag == XML_TAG_KEY)
-       {
-               len += 14; /* "\t\t<key>" + "</key>\n" */
-               len += _asl_append_xml_string_length(s);
-       }
-       else if (tag == XML_TAG_STRING)
-       {
-               len += 20; /* "\t\t<string>" + "</string>\n" */
-               len += _asl_append_xml_string_length(s);
-       }
-       else if (tag == XML_TAG_DATA)
-       {
-               len += 16; /* "\t\t<data>" + "</data>\n" */
-               slen = strlen(s);
-               len += ((len + 2) / 3) * 4;
-       }
+       char *out;
+       asl_string_t *str = asl_string_new(ASL_ENCODE_ASL);
+       if (str == NULL) return NULL;
 
-       return len;
+       str = _asl_string_append_asl_msg(str, msg);
+       *len = asl_string_length(str);
+       out = asl_string_free_return_bytes(str);
+       return out;
 }
 
-/* called from asl_format_message */
-static void
-_asl_append_xml_tag(char *buf, uint32_t bufsize, uint32_t *cursor, int tag, const char *s)
+static uint32_t
+_asl_msg_op_from_string(char *o)
 {
-       char *b64;
+       uint32_t op, i;
 
-       if (buf == NULL) return;
-       if (cursor == NULL) return;
+       op = ASL_QUERY_OP_NULL;
 
-       if (tag == XML_TAG_KEY)
-       {
-               _asl_append_string(buf, bufsize, cursor, "\t\t<key>", ASL_ENCODE_NONE, 0);
-               _asl_append_xml_string(buf, bufsize, cursor, s);
-               _asl_append_string(buf, bufsize, cursor, "</key>\n", ASL_ENCODE_NONE, 0);
-               return;
-       }
-       else if (tag == XML_TAG_STRING)
+       if (o == NULL) return op;
+
+       for (i = 0; o[i] != '\0'; i++)
        {
-               _asl_append_string(buf, bufsize, cursor, "\t\t<string>", ASL_ENCODE_NONE, 0);
-               _asl_append_xml_string(buf, bufsize, cursor, s);
-               _asl_append_string(buf, bufsize, cursor, "</string>\n", ASL_ENCODE_NONE, 0);
-               return;
+               if (o[i] == '.') return ASL_QUERY_OP_NULL;
+               if (o[i] == 'C') op |= ASL_QUERY_OP_CASEFOLD;
+               if (o[i] == 'R') op |= ASL_QUERY_OP_REGEX;
+               if (o[i] == 'N') op |= ASL_QUERY_OP_NUMERIC;
+               if (o[i] == 'S') op |= ASL_QUERY_OP_SUBSTRING;
+               if (o[i] == 'A') op |= ASL_QUERY_OP_PREFIX;
+               if (o[i] == 'Z') op |= ASL_QUERY_OP_SUFFIX;
+               if (o[i] == '<') op |= ASL_QUERY_OP_LESS;
+               if (o[i] == '>') op |= ASL_QUERY_OP_GREATER;
+               if (o[i] == '=') op |= ASL_QUERY_OP_EQUAL;
+               if (o[i] == '!') op |= ASL_QUERY_OP_NOT_EQUAL;
+               if (o[i] == 'T') op |= ASL_QUERY_OP_TRUE;
        }
-       else if (tag == XML_TAG_DATA)
-       {
-               _asl_append_string(buf, bufsize, cursor, "\t\t<data>", ASL_ENCODE_NONE, 0);
-               b64 = (char *)asl_b64_encode((uint8_t *)s, strlen(s));
-               if (b64 != NULL)
-               {
-                       _asl_append_string(buf, bufsize, cursor, b64, ASL_ENCODE_NONE, 0);
-                       free(b64);
-               }
 
-               _asl_append_string(buf, bufsize, cursor, "</data>\n", ASL_ENCODE_NONE, 0);
-               return;
-       }
+       return op;
 }
 
-static uint32_t
-_asl_append_op_length(uint32_t op)
+static char *
+_asl_msg_get_next_word(char **p, uint32_t *tt, uint32_t spacedel)
 {
-       uint32_t i;
-
-       if (op == ASL_QUERY_OP_NULL) return 1;
+       char *str, *out, c, oval;
+       uint32_t i, len, n, outlen;
 
-       i = 0;
+       *tt = TOKEN_NULL;
 
-       if (op & ASL_QUERY_OP_CASEFOLD) i++;
-       if (op & ASL_QUERY_OP_REGEX) i++;
-       if (op & ASL_QUERY_OP_NUMERIC) i++;
-       if (op & ASL_QUERY_OP_PREFIX) i++;
-       if (op & ASL_QUERY_OP_SUFFIX) i++;
-
-       switch (op & ASL_QUERY_OP_TRUE)
-       {
-               case ASL_QUERY_OP_EQUAL:
-               case ASL_QUERY_OP_GREATER:
-               case ASL_QUERY_OP_LESS:
-               case ASL_QUERY_OP_NOT_EQUAL:
-               case ASL_QUERY_OP_TRUE:
-                       i++;
-                       break;
-               case ASL_QUERY_OP_LESS_EQUAL:
-               case ASL_QUERY_OP_GREATER_EQUAL:
-                       i += 2;
-                       break;
-               default:
-                       break;
-       }
-
-       if (i == 0) return 1;
-       return i;
-}
-
-
-static void
-_asl_append_op(char *buf, uint32_t bufsize, uint32_t *cursor, uint32_t op)
-{
-       char opstr[8];
-       uint32_t i;
-
-       if (buf == NULL) return;
-       if (cursor == NULL) return;
-
-       if (op == ASL_QUERY_OP_NULL)
-       {
-               _asl_append_string(buf, bufsize, cursor, ".", ASL_ENCODE_NONE, 0);
-               return;
-       }
-
-       i = 0;
-       if (op & ASL_QUERY_OP_CASEFOLD) opstr[i++] = 'C';
-
-       if (op & ASL_QUERY_OP_REGEX) opstr[i++] = 'R';
-
-       if (op & ASL_QUERY_OP_NUMERIC) opstr[i++] = 'N';
-
-       if (op & ASL_QUERY_OP_PREFIX)
-       {
-               if (op & ASL_QUERY_OP_SUFFIX) opstr[i++] = 'S';
-               else opstr[i++] = 'A';
-       }
-       if (op & ASL_QUERY_OP_SUFFIX) opstr[i++] = 'Z';
-
-       switch (op & ASL_QUERY_OP_TRUE)
-       {
-               case ASL_QUERY_OP_EQUAL:
-                       opstr[i++] = '=';
-                       break;
-               case ASL_QUERY_OP_GREATER:
-                       opstr[i++] = '>';
-                       break;
-               case ASL_QUERY_OP_GREATER_EQUAL:
-                       opstr[i++] = '>';
-                       opstr[i++] = '=';
-                       break;
-               case ASL_QUERY_OP_LESS:
-                       opstr[i++] = '<';
-                       break;
-               case ASL_QUERY_OP_LESS_EQUAL:
-                       opstr[i++] = '<';
-                       opstr[i++] = '=';
-                       break;
-               case ASL_QUERY_OP_NOT_EQUAL:
-                       opstr[i++] = '!';
-                       break;
-               case ASL_QUERY_OP_TRUE:
-                       opstr[i++] = 'T';
-                       break;
-               default:
-                       break;
-       }
-
-       if (i == 0)
-       {
-               _asl_append_string(buf, bufsize, cursor,  ".", ASL_ENCODE_NONE, 0);
-               return;
-       }
-
-       opstr[i] = '\0';
-       _asl_append_string(buf, bufsize, cursor, opstr, ASL_ENCODE_NONE, 0);
-}
-
-static char *
-_asl_time_string(int fmt, const char *str)
-{
-       time_t tick;
-       struct tm *stm;
-       char *ltime;
-       char *out;
-       char ltbuf[32];
-       out = NULL;
-
-       tick = 0;
-       if (str != NULL) tick = asl_parse_time(str);
-
-       if (fmt == TFMT_SEC)
-       {
-               asprintf(&out, "%lu", tick);
-               return out;
-       }
-
-       if (fmt == TFMT_UTC)
-       {
-               stm = gmtime(&tick);
-               asprintf(&out, "%d.%02d.%02d %02d:%02d:%02d UTC", stm->tm_year + 1900, stm->tm_mon + 1, stm->tm_mday, stm->tm_hour, stm->tm_min, stm->tm_sec);
-               return out;
-       }
-
-       if (fmt == TFMT_LCL)
-       {
-               ltime = ctime_r(&tick, ltbuf);
-               if (ltime == NULL) return NULL;
-               ltime[19] = '\0';
-               asprintf(&out, "%s", ltime + 4);
-               return out;
-       }
-
-       return NULL;
-}
-
-/* called from asl_format_message */
-static char *
-_asl_msg_to_string_time_fmt(asl_msg_t *msg, uint32_t *len, int tf)
-{
-       uint32_t i, x, count, bufsize, cursor;
-       char *buf, *timestr;
-       const char *key, *val;
-
-       *len = 0;
-
-       if (msg == NULL) return NULL;
-
-       timestr = NULL;
-       buf = NULL;
-
-       count = asl_msg_count(msg);
-
-       if (count == 0) return NULL;
-
-       key = NULL;
-       val = NULL;
-
-       /* first pass: determine output string length */
-       bufsize = 0;
-       i = 0;
-
-       for (x = asl_msg_fetch(msg, 0, &key, &val, NULL); x != IndexNull; x = asl_msg_fetch(msg, x, &key, &val, NULL))
-       {
-               if (key == NULL) continue;
-
-               if (i > 0) bufsize += 1; /* " " */
-
-               /* "[" */
-               bufsize += 1;
-
-               bufsize += _asl_append_string_length(key, ASL_ENCODE_ASL, 1);
-
-               if ((tf != TFMT_SEC) && (!strcmp(key, ASL_KEY_TIME)))
-               {
-                       timestr = _asl_time_string(tf, val);
-                       if (timestr != NULL)
-                       {
-                               /* " " */
-                               bufsize += 1;
-                               bufsize += _asl_append_string_length(timestr, ASL_ENCODE_ASL, 0);
-                       }
-               }
-               else if (val != NULL)
-               {
-                       /* " " */
-                       bufsize += 1;
-                       bufsize += _asl_append_string_length(val, ASL_ENCODE_ASL, 0);
-               }
-
-               /* "]" */
-               bufsize += 1;
-
-               i++;
-       }
-
-       /* "\n\0" */
-       bufsize += 2;
-
-       /* allocate the output string */
-       buf = malloc(bufsize);
-       if (buf == NULL) return NULL;
-
-       cursor = 0;
-       i = 0;
-
-       /* second pass: construct the output string */
-
-       for (x = asl_msg_fetch(msg, 0, &key, &val, NULL); x != IndexNull; x = asl_msg_fetch(msg, x, &key, &val, NULL))
-       {
-               if (key == NULL) continue;
-
-               if (i > 0)
-               {
-                       assert(cursor < bufsize);
-                       buf[cursor++] = ' ';
-               }
-
-               assert(cursor < bufsize);
-               buf[cursor++] = '[';
-
-               _asl_append_string(buf, bufsize, &cursor, key, ASL_ENCODE_ASL, 1);
-
-               if ((tf != TFMT_SEC) && (!strcmp(key, ASL_KEY_TIME)))
-               {
-                       if (timestr != NULL)
-                       {
-                               assert(cursor < bufsize);
-                               buf[cursor++] = ' ';
-                               _asl_append_string(buf, bufsize, &cursor, timestr, ASL_ENCODE_ASL, 0);
-                               free(timestr);
-                       }
-               }
-               else if (val != NULL)
-               {
-                       assert(cursor < bufsize);
-                       buf[cursor++] = ' ';
-                       _asl_append_string(buf, bufsize, &cursor, val, ASL_ENCODE_ASL, 0);
-               }
-
-               assert(cursor < bufsize);
-               buf[cursor++] = ']';
-
-               i++;
-       }
-
-       assert((cursor + 1) < bufsize);
-       buf[cursor++] = '\n';
-       buf[cursor] = '\0';
-
-       *len = bufsize;
-       return buf;
-}
-
-static uint32_t
-_msg_length_helper(uint32_t *i, uint32_t type, const char *key, const char *val, uint32_t op)
-{
-       uint32_t outlen;
-
-       outlen = 0;
-
-       if (*i > 0) outlen = 1; /* " " */
-       *i = *i + 1;
-
-       /* "[" */
-       outlen += 1;
-
-       if (type == ASL_TYPE_QUERY)
-       {
-               outlen += _asl_append_op_length(op);
-
-               /* " " */
-               outlen += 1;
-       }
-
-       outlen += _asl_append_string_length(key, ASL_ENCODE_ASL, 1);
-
-       if (val != NULL)
-       {
-               /* " " */
-               outlen += 1;
-               outlen += _asl_append_string_length(val, ASL_ENCODE_ASL, 0);
-       }
-
-       /* "]" */
-       outlen += 1;
-
-       return outlen;
-}
-
-__private_extern__ uint32_t
-_asl_msg_string_length_aux(asl_msg_t *msg, asl_msg_aux_t *aux)
-{
-       uint32_t i, x, slot, op, outlen, auxbits, type;
-       char *s;
-       const char *key, *val;
-       asl_msg_t *page;
-
-       s = NULL;
-       type = ASL_TYPE_MSG;
-
-       outlen = 0;
-       if ((msg != NULL) && (msg->type == ASL_TYPE_QUERY))
-       {
-               type = ASL_TYPE_QUERY;
-               outlen = 2; /* "Q " */
-               if (asl_msg_count(msg) == 0) return outlen + 1;
-       }
-
-       auxbits = 0;
-
-       key = NULL;
-       val = NULL;
-       op = 0;
-       i = 0;
-
-       /* process aux keys */
-       if ((aux != NULL) && (aux->type == ASL_MSG_TYPE_AUX_0))
-       {
-               if (aux->data.aux0->level != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_LEVEL, aux->data.aux0->level, op);
-                       auxbits |= AUX_0_LEVEL;
-               }
-
-               if (aux->data.aux0->time != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_TIME, aux->data.aux0->time, op);
-                       auxbits |= AUX_0_TIME;
-               }
-
-               if (aux->data.aux0->nano != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_TIME_NSEC, aux->data.aux0->nano, op);
-                       auxbits |= AUX_0_TIME_NSEC;
-               }
-
-               if (aux->data.aux0->host != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_HOST, aux->data.aux0->host, op);
-                       auxbits |= AUX_0_HOST;
-               }
-
-               if (aux->data.aux0->sender != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_SENDER, aux->data.aux0->sender, op);
-                       auxbits |= AUX_0_SENDER;
-               }
-
-               if (aux->data.aux0->facility != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_FACILITY, aux->data.aux0->facility, op);
-                       auxbits |= AUX_0_FACILITY;
-               }
-
-               if (aux->data.aux0->pid != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_PID, aux->data.aux0->pid, op);
-                       auxbits |= AUX_0_PID;
-               }
-
-               if (aux->data.aux0->uid != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_UID, aux->data.aux0->uid, op);
-                       auxbits |= AUX_0_UID;
-               }
-
-               if (aux->data.aux0->gid != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_GID, aux->data.aux0->gid, op);
-                       auxbits |= AUX_0_GID;
-               }
-
-               if (aux->data.aux0->message != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_MSG, aux->data.aux0->message, op);
-                       auxbits |= AUX_0_MSG;
-               }
-
-               if (aux->data.aux0->option != NULL)
-               {
-                       outlen += _msg_length_helper(&i, type, ASL_KEY_OPTION, aux->data.aux0->option, op);
-                       auxbits |= AUX_0_OPTION;
-               }
-       }
-
-       page = NULL;
-       slot = IndexNull;
-
-       for (x = _asl_msg_fetch_internal(msg, 0, &key, &val, &op, &page, &slot); x != IndexNull; x = _asl_msg_fetch_internal(msg, x, &key, &val, &op, &page, &slot))
-       {
-               if ((key == NULL) || (page == NULL) || (slot == IndexNull)) continue;
-
-               /* ignore in msg if an override value was supplied in aux */
-               if ((page->key[slot] == ASL_STD_KEY_LEVEL) && (auxbits & AUX_0_LEVEL)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_TIME) && (auxbits & AUX_0_TIME)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_NANO) && (auxbits & AUX_0_TIME_NSEC)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_HOST) && (auxbits & AUX_0_HOST)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_SENDER) && (auxbits & AUX_0_SENDER)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_FACILITY) && (auxbits & AUX_0_FACILITY)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_PID) && (auxbits & AUX_0_PID)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_UID) && (auxbits & AUX_0_UID)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_GID) && (auxbits & AUX_0_GID)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_MESSAGE) && (auxbits & AUX_0_MSG)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_OPTION) && (auxbits & AUX_0_OPTION)) continue;
-
-               outlen += _msg_length_helper(&i, type, key, val, op);
-       }
-
-       if (outlen > 0) outlen++; /* trailing NUL */
-
-       return outlen;
-}
-
-uint32_t
-asl_msg_string_length(asl_msg_t *msg)
-{
-       return _asl_msg_string_length_aux(msg, NULL);
-}
-
-static void
-_msg_to_string_buffer_helper(uint32_t *i, uint32_t type, char *buf, uint32_t bufsize, uint32_t *cursor, const char *key, const char *val, uint32_t op)
-{
-       if (*i > 0)
-       {
-               assert(*cursor < bufsize);
-               buf[*cursor] = ' ';
-               *cursor = *cursor + 1;
-       }
-
-       *i = *i + 1;
-
-       assert(*cursor < bufsize);
-       buf[*cursor] = '[';
-       *cursor = *cursor + 1;
-
-       if (type == ASL_TYPE_QUERY)
-       {
-               _asl_append_op(buf, bufsize, cursor, op);
-
-               assert(*cursor < bufsize);
-               buf[*cursor] = ' ';
-               *cursor = *cursor + 1;
-       }
-
-       _asl_append_string(buf, bufsize, cursor, key, ASL_ENCODE_ASL, 1);
-
-       if (val != NULL)
-       {
-               assert(*cursor < bufsize);
-               buf[*cursor] = ' ';
-               *cursor = *cursor + 1;
-
-               _asl_append_string(buf, bufsize, cursor, val, ASL_ENCODE_ASL, 0);
-       }
-
-       assert(*cursor < bufsize);
-       buf[*cursor] = ']';
-       *cursor = *cursor + 1;
-}
-
-__private_extern__ uint32_t
-_asl_msg_to_string_buffer_aux(asl_msg_t *msg, asl_msg_aux_t *aux, char *buf, uint32_t bufsize)
-{
-       uint32_t i, x, slot, op, cursor, auxbits, type;
-       char *s;
-       const char *key, *val;
-       asl_msg_t *page;
-
-       cursor = 0;
-
-       if (buf == NULL) return -1;
-
-       s = NULL;
-       type = ASL_TYPE_MSG;
-
-       if ((msg != NULL) && (msg->type == ASL_TYPE_QUERY))
-       {
-               type = ASL_TYPE_QUERY;
-               assert((cursor + 1) < bufsize);
-               buf[cursor++] = 'Q';
-               buf[cursor++] = ' ';
-               if (asl_msg_count(msg) == 0) 
-               {
-                       assert(cursor < bufsize);
-                       buf[cursor] = '\0';
-                       return 0;
-               }
-       }
-
-       auxbits = 0;
-
-       key = NULL;
-       val = NULL;
-       op = 0;
-       i = 0;
-
-       /* process aux keys */
-       if ((aux != NULL) && (aux->type == ASL_MSG_TYPE_AUX_0))
-       {
-               if (aux->data.aux0->level != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_LEVEL, aux->data.aux0->level, op);
-                       auxbits |= AUX_0_LEVEL;
-               }
-
-               if (aux->data.aux0->time != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_TIME, aux->data.aux0->time, op);
-                       auxbits |= AUX_0_TIME;
-               }
-
-               if (aux->data.aux0->nano != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_TIME_NSEC, aux->data.aux0->nano, op);
-                       auxbits |= AUX_0_TIME_NSEC;
-               }
-
-               if (aux->data.aux0->host != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_HOST, aux->data.aux0->host, op);
-                       auxbits |= AUX_0_HOST;
-               }
-
-               if (aux->data.aux0->sender != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_SENDER, aux->data.aux0->sender, op);
-                       auxbits |= AUX_0_SENDER;
-               }
-
-               if (aux->data.aux0->facility != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_FACILITY, aux->data.aux0->facility, op);
-                       auxbits |= AUX_0_FACILITY;
-               }
-
-               if (aux->data.aux0->pid != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_PID, aux->data.aux0->pid, op);
-                       auxbits |= AUX_0_PID;
-               }
-
-               if (aux->data.aux0->uid != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_UID, aux->data.aux0->uid, op);
-                       auxbits |= AUX_0_UID;
-               }
-
-               if (aux->data.aux0->gid != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_GID, aux->data.aux0->gid, op);
-                       auxbits |= AUX_0_GID;
-               }
-
-               if (aux->data.aux0->message != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_MSG, aux->data.aux0->message, op);
-                       auxbits |= AUX_0_MSG;
-               }
-
-               if (aux->data.aux0->option != NULL)
-               {
-                       _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, ASL_KEY_OPTION, aux->data.aux0->option, op);
-                       auxbits |= AUX_0_OPTION;
-               }
-       }
-
-       page = NULL;
-       slot = IndexNull;
-
-       for (x = _asl_msg_fetch_internal(msg, 0, &key, &val, &op, &page, &slot); x != IndexNull; x = _asl_msg_fetch_internal(msg, x, &key, &val, &op, &page, &slot))
-       {
-               if ((key == NULL) || (page == NULL) || (slot == IndexNull)) continue;
-
-               /* ignore in msg if an override value was supplied in aux */
-               if ((page->key[slot] == ASL_STD_KEY_LEVEL) && (auxbits & AUX_0_LEVEL)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_TIME) && (auxbits & AUX_0_TIME)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_NANO) && (auxbits & AUX_0_TIME_NSEC)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_HOST) && (auxbits & AUX_0_HOST)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_SENDER) && (auxbits & AUX_0_SENDER)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_FACILITY) && (auxbits & AUX_0_FACILITY)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_PID) && (auxbits & AUX_0_PID)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_UID) && (auxbits & AUX_0_UID)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_GID) && (auxbits & AUX_0_GID)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_MESSAGE) && (auxbits & AUX_0_MSG)) continue;
-               if ((page->key[slot] == ASL_STD_KEY_OPTION) && (auxbits & AUX_0_OPTION)) continue;
-
-               _msg_to_string_buffer_helper(&i, type, buf, bufsize, &cursor, key, val, op);
-       }
-
-       assert(cursor < bufsize);
-       buf[cursor] = '\0';
-
-       return 0;
-}
-
-uint32_t
-asl_msg_to_string_buffer(asl_msg_t *msg, char *buf, uint32_t bufsize)
-{
-       return _asl_msg_to_string_buffer_aux(msg, NULL, buf, bufsize);
-}
-
-char *
-asl_msg_to_string(asl_msg_t *in, uint32_t *len)
-{
-       uint32_t status, outlen;
-       char *out;
-
-       *len = 0;
-
-       if (in == NULL) return NULL;
-
-       out = NULL;
-       outlen = _asl_msg_string_length_aux(in, NULL);
-       if (outlen == 0) return NULL;
-
-       out = malloc(outlen);
-       if (out == NULL) return NULL;
-
-       status = _asl_msg_to_string_buffer_aux(in, NULL, out, outlen);
-       if (status != 0)
-       {
-               free(out);
-               return NULL;
-       }
-
-       *len = outlen;
-       return out;
-}
-
-static uint32_t
-_asl_msg_op_from_string(char *o)
-{
-       uint32_t op, i;
-
-       op = ASL_QUERY_OP_NULL;
-
-       if (o == NULL) return op;
-
-       for (i = 0; o[i] != '\0'; i++)
-       {
-               if (o[i] == '.') return ASL_QUERY_OP_NULL;
-               if (o[i] == 'C') op |= ASL_QUERY_OP_CASEFOLD;
-               if (o[i] == 'R') op |= ASL_QUERY_OP_REGEX;
-               if (o[i] == 'N') op |= ASL_QUERY_OP_NUMERIC;
-               if (o[i] == 'S') op |= ASL_QUERY_OP_SUBSTRING;
-               if (o[i] == 'A') op |= ASL_QUERY_OP_PREFIX;
-               if (o[i] == 'Z') op |= ASL_QUERY_OP_SUFFIX;
-               if (o[i] == '<') op |= ASL_QUERY_OP_LESS;
-               if (o[i] == '>') op |= ASL_QUERY_OP_GREATER;
-               if (o[i] == '=') op |= ASL_QUERY_OP_EQUAL;
-               if (o[i] == '!') op |= ASL_QUERY_OP_NOT_EQUAL;
-               if (o[i] == 'T') op |= ASL_QUERY_OP_TRUE;
-       }
-
-       return op;
-}
-
-static char *
-_asl_msg_get_next_word(char **p, uint32_t *tt, uint32_t spacedel)
-{
-       char *str, *out, c, oval;
-       uint32_t i, len, n, outlen;
-
-       *tt = TOKEN_NULL;
-
-       if (p == NULL) return NULL;
-       if (*p == NULL) return NULL;
-       if (**p == '\0') return NULL;
+       if (p == NULL) return NULL;
+       if (*p == NULL) return NULL;
+       if (**p == '\0') return NULL;
 
        /* skip one space if it's there (word separator) */
        if (**p == ' ') (*p)++;
@@ -2868,47 +2016,30 @@ asl_msg_from_string(const char *buf)
 }
 
 char *
-asl_list_to_string(asl_search_result_t *list, uint32_t *outlen)
+asl_list_to_string(asl_search_result_t *list, uint32_t *len)
 {
-       uint32_t i, len, newlen;
-       char *msgbuf, *out;
+       uint32_t i;
+       char tmp[16];
+       char *out;
+       asl_string_t *str = asl_string_new(ASL_ENCODE_ASL);
+       if (str == NULL) return NULL;
 
        if (list == NULL) return NULL;
        if (list->count == 0) return NULL;
        if (list->msg == NULL) return NULL;
 
-       out = NULL;
-       asprintf(&out, "%u\n", list->count);
-       if (out == NULL) return NULL;
-       *outlen = strlen(out) + 1;
+       snprintf(tmp, sizeof(tmp), "%u", list->count);
+       asl_string_append(str, tmp);
+       asl_string_append_char_no_encoding(str, '\n');
 
        for (i = 0; i < list->count; i++)
        {
-               len = 0;
-               msgbuf = asl_msg_to_string(list->msg[i], &len);
-               if (msgbuf == NULL)
-               {
-                       free(out);
-                       *outlen = 0;
-                       return NULL;
-               }
-
-               newlen = *outlen + len;
-               out = reallocf(out, newlen);
-               if (out == NULL)
-               {
-                       *outlen = 0;
-                       return NULL;
-               }
-
-               memmove((out + *outlen - 1), msgbuf, len);
-               out[newlen - 2] = '\n';
-               out[newlen - 1] = '\0';
-               *outlen = newlen;
-
-               free(msgbuf);
+               _asl_string_append_asl_msg(str, list->msg[i]);
+               asl_string_append_char_no_encoding(str, '\n');
        }
 
+       *len = asl_string_length(str);
+       out = asl_string_free_return_bytes(str);
        return out;
 }
 
@@ -2972,7 +2103,96 @@ _asl_level_string(int level)
        if (level == ASL_LEVEL_NOTICE) return ASL_STRING_NOTICE;
        if (level == ASL_LEVEL_INFO) return ASL_STRING_INFO;
        if (level == ASL_LEVEL_DEBUG) return ASL_STRING_DEBUG;
-       return "Unknown";
+       return "unknown";
+}
+
+/*
+ * Find the value for a key in a message and append a formatted value to str.
+ * kf may be a simple (no embedded white space) key, or one of (key) or ((key)(format)).
+ * WARNING: modifies kf!
+ */
+static asl_string_t *
+_asl_string_append_value_for_key_format(asl_string_t *str, asl_msg_t *msg, char *kf, const char *tfmt)
+{
+       uint32_t i, get_fmt;
+       char *key, *fmt;
+       const char *mval;
+
+       if (str == NULL) return NULL;
+       if (msg == NULL) return str;
+       if (kf == NULL) return str;
+
+       key = NULL;
+       fmt = NULL;
+       get_fmt = 0;
+
+       for (i = 0; kf[i] != '\0'; i++)
+       {
+               if (kf[i] == ')')
+               {
+                       kf[i] = '\0';
+                       get_fmt = 1;
+               }
+               else if (kf[i] != '(')
+               {
+                       if (key == NULL) key = kf + i;
+                       else if ((get_fmt == 1) && (fmt == NULL)) fmt = kf + i;
+               }
+       }
+
+       if (key == NULL) return str;
+
+       asl_msg_lookup(msg, key, &mval, NULL);
+       if (mval == NULL) return str;
+
+       if (!strcmp(key, ASL_KEY_TIME))
+       {
+               char *fval = NULL;
+
+               /* format in $((Time)(fmt)) overrides tfmt */
+               if (fmt == NULL)
+               {
+                       fval = _asl_time_string(tfmt, mval);
+               }
+               else
+               {
+                       fval = _asl_time_string(fmt, mval);
+               }
+
+               if (fval != NULL)
+               {
+                       asl_string_append_no_encoding(str, fval);
+                       free(fval);
+               }
+               else
+               {
+                       asl_string_append_char_no_encoding(str, '0');
+               }
+
+               return str;
+       }
+
+       /* Level: num str */
+       if (!strcmp(key, ASL_KEY_LEVEL))
+       {
+               if (fmt == NULL)
+               {
+                       asl_string_append_no_encoding(str, mval);
+               }
+               else if (!strcmp(fmt, "str"))
+               {
+                       mval = _asl_level_string(atoi(mval));
+                       asl_string_append_no_encoding(str, mval);
+               }
+               else
+               {
+                       asl_string_append_no_encoding(str, mval);
+               }
+
+               return str;
+       }
+
+       return asl_string_append(str, mval);
 }
 
 /*
@@ -2982,18 +2202,19 @@ _asl_level_string(int level)
 char *
 asl_format_message(asl_msg_t *msg, const char *mfmt, const char *tfmt, uint32_t text_encoding, uint32_t *len)
 {
-       char *buf, *tstr, *k, c[2], skey[512];
-       const char *hstr, *sstr, *pstr, *mstr, *lstr, *rprc, *rpid, *v, *key, *val;
-       int i, j, l, mf, tf, paren, oval, level;
-       uint32_t x, cursor, bufsize;
+       char *out, *vtime, *k, c, skey[512];
+       const char *vhost, *vpid, *vsender, *vmessage, *vlevel, *vrefproc, *vrefpid, *v, *key, *val;
+       int i, j, l, mf, paren, oval, level;
+       uint32_t x, cursor;
+       asl_string_t *str;
+       uint8_t *b64;
 
-       buf = NULL;
+       out = NULL;
        *len = 0;
 
        if (msg == NULL) return NULL;
 
        mf = MFMT_RAW;
-       tf = TFMT_SEC;
 
        if (mfmt == NULL) mf = MFMT_RAW;
        else if (!strcmp(mfmt, ASL_MSG_FMT_RAW)) mf = MFMT_RAW;
@@ -3003,260 +2224,181 @@ asl_format_message(asl_msg_t *msg, const char *mfmt, const char *tfmt, uint32_t
        else if (!strcmp(mfmt, ASL_MSG_FMT_MSG)) mf = MFMT_MSG;
        else mf = MFMT_STR;
 
-       if (tfmt == NULL) tf = TFMT_SEC;
-       else if (!strcmp(tfmt, ASL_TIME_FMT_SEC)) tf = TFMT_SEC;
-       else if (!strcmp(tfmt, ASL_TIME_FMT_UTC)) tf = TFMT_UTC;
-       else if (!strcmp(tfmt, ASL_TIME_FMT_LCL)) tf = TFMT_LCL;
-
        if (mf == MFMT_RAW)
        {
-               return _asl_msg_to_string_time_fmt(msg, len, tf);
+               str = asl_msg_to_string_raw(text_encoding, msg, tfmt);
+               asl_string_append_char_no_encoding(str, '\n');
+
+               *len = asl_string_length(str);
+               out = asl_string_free_return_bytes(str);
+               return out;
        }
 
        if (mf == MFMT_MSG)
        {
-               mstr = NULL;
-               if (asl_msg_lookup(msg, ASL_KEY_MSG, &mstr, NULL) != 0) return NULL;
+               vmessage = NULL;
 
-               bufsize = _asl_append_string_length(mstr, text_encoding, 0);
-               bufsize += 2; /* \n\0 */
+               if (asl_msg_lookup(msg, ASL_KEY_MSG, &vmessage, NULL) != 0) return NULL;
 
-               buf = malloc(bufsize);
-               if (buf == NULL) return NULL;
+               str = asl_string_new(text_encoding);
+               if (str == NULL) return NULL;
 
-               cursor = 0;
-               _asl_append_string(buf, bufsize, &cursor, mstr, text_encoding, 0);
+               asl_string_append(str, vmessage);
+               asl_string_append_char_no_encoding(str, '\n');
 
-               buf[cursor++] = '\n';
-               buf[cursor] = '\0';
-
-               *len = bufsize;
-               return buf;
+               *len = asl_string_length(str);
+               out = asl_string_free_return_bytes(str);
+               return out;
        }
 
        if ((mf == MFMT_STD) || (mf == MFMT_BSD))
        {
-               /* BSD:  Mth dd hh:mm:ss host sender[pid]: message */
-               /* BSD:  Mth dd hh:mm:ss host sender[pid] (refproc[refpid]): message */
-               /* STD:  Mth dd hh:mm:ss host sender[pid] <Level>: message */
-               /* STD:  Mth dd hh:mm:ss host sender[pid] (refproc[refpid]) <Level>: message */
+               /* COMMON:  Mth dd hh:mm:ss host sender[pid] (refproc[refpid])*/
+               /* BSD:  <COMMON>: message */
+               /* STD:  <COMMON> <Level>: message */
 
                v = NULL;
-               hstr = NULL;
-               sstr = NULL;
-               pstr = NULL;
-               mstr = NULL;
-               lstr = NULL;
-               rprc = NULL;
-               rpid = NULL;
+               vhost = NULL;
+               vsender = NULL;
+               vpid = NULL;
+               vmessage = NULL;
+               vlevel = NULL;
+               vrefproc = NULL;
+               vrefpid = NULL;
 
                asl_msg_lookup(msg, ASL_KEY_TIME, &v, NULL);
-               tstr = _asl_time_string(tf, v);
-
-               asl_msg_lookup(msg, ASL_KEY_HOST, &hstr, NULL);
-               asl_msg_lookup(msg, ASL_KEY_SENDER, &sstr, NULL);
-               asl_msg_lookup(msg, ASL_KEY_PID, &pstr, NULL);
-               asl_msg_lookup(msg, ASL_KEY_MSG, &mstr, NULL);
-
-               asl_msg_lookup(msg, ASL_KEY_REF_PROC, &rprc, NULL);
-               asl_msg_lookup(msg, ASL_KEY_REF_PID, &rpid, NULL);
+               vtime = _asl_time_string(tfmt, v);
 
                level = 7;
+               asl_msg_lookup(msg, ASL_KEY_LEVEL, &vlevel, NULL);
+               if (vlevel != NULL) level = atoi(vlevel);
 
-               if (mf == MFMT_STD)
-               {
-                       asl_msg_lookup(msg, ASL_KEY_LEVEL, &lstr, NULL);
-                       if (lstr != NULL) level = atoi(lstr);
-
-                       lstr = _asl_level_string(level);
-               }
-
-               if (hstr == NULL) hstr = "unknown";
-               if (sstr == NULL) sstr = "unknown";
-
-               /* first pass: calculate output line length */
-               bufsize = 0;
-
-               if (tstr == NULL) bufsize++;
-               else bufsize += _asl_append_string_length(tstr, ASL_ENCODE_NONE, 0);
-
-               /* " " */
-               bufsize++;
-
-               bufsize += _asl_append_string_length(hstr, text_encoding, 0);
-
-               /* " " */
-               bufsize++;
-
-               bufsize += _asl_append_string_length(sstr, text_encoding, 0);
-
-               if ((pstr != NULL) && (strcmp(pstr, "-1")))
-               {
-                       /* "[" + "]" */
-                       bufsize += 2;
-                       bufsize += _asl_append_string_length(pstr, ASL_ENCODE_NONE, 0);
-               }
-
-               if ((rprc != NULL) || (rpid != NULL)) bufsize += 3; /* " (" + ")" */
-
-               if (rprc != NULL) bufsize += _asl_append_string_length(rprc, text_encoding, 0);
-               if (rpid != NULL)
-               {
-                       /* "[" + "]" */
-                       bufsize += 2;
-                       bufsize += _asl_append_string_length(rpid, ASL_ENCODE_NONE, 0);
-               }
-
-               if (mf == MFMT_STD)
-               {
-                       /* " <" + ">" */
-                       bufsize += 3;
-                       bufsize += _asl_append_string_length(lstr, ASL_ENCODE_NONE, 0);
-               }
-
-               /* ": " */
-               bufsize += 2;
-
-               if (mstr != NULL) bufsize += _asl_append_string_length(mstr, text_encoding, 0);
+               asl_msg_lookup(msg, ASL_KEY_HOST, &vhost, NULL);
+               if (vhost == NULL) vhost = "unknown";
 
-               /* "\n\0" */
-               bufsize += 2;
+               asl_msg_lookup(msg, ASL_KEY_SENDER, &vsender, NULL);
+               if (vsender == NULL) vsender = "unknown";
 
-               /* second pass: construct the output line */
+               asl_msg_lookup(msg, ASL_KEY_PID, &vpid, NULL);
+               asl_msg_lookup(msg, ASL_KEY_MSG, &vmessage, NULL);
+               asl_msg_lookup(msg, ASL_KEY_REF_PROC, &vrefproc, NULL);
+               asl_msg_lookup(msg, ASL_KEY_REF_PID, &vrefpid, NULL);
 
-               buf = malloc(bufsize);
-               if (buf == NULL) return NULL;
+               /* COMMON */
+               str = asl_string_new(text_encoding);
+               if (str == NULL) return NULL;
 
-               cursor = 0;
-
-               if (tstr == NULL)
+               if (vtime != NULL)
                {
-                       buf[cursor++] = '0';
+                       asl_string_append(str, vtime);
+                       free(vtime);
                }
                else
                {
-                       _asl_append_string(buf, bufsize, &cursor, tstr, ASL_ENCODE_NONE, 0);
-                       free(tstr);
+                       asl_string_append_char_no_encoding(str, '0');
                }
 
-               buf[cursor++] = ' ';
-
-               _asl_append_string(buf, bufsize, &cursor, hstr, text_encoding, 0);
-
-               buf[cursor++] = ' ';
-
-               _asl_append_string(buf, bufsize, &cursor, sstr, text_encoding, 0);
+               asl_string_append_char_no_encoding(str, ' ');
+               asl_string_append(str, vhost);
+               asl_string_append_char_no_encoding(str, ' ');
+               asl_string_append(str, vsender);
 
-               if ((pstr != NULL) && (strcmp(pstr, "-1")))
+               if ((vpid != NULL) && (strcmp(vpid, "-1")))
                {
-                       buf[cursor++] = '[';
-                       _asl_append_string(buf, bufsize, &cursor, pstr, ASL_ENCODE_NONE, 0);
-                       buf[cursor++] = ']';
+                       asl_string_append_char_no_encoding(str, '[');
+                       asl_string_append(str, vpid);
+                       asl_string_append_char_no_encoding(str, ']');
                }
 
-               if ((rprc != NULL) || (rpid != NULL))
-               {
-                       buf[cursor++] = ' ';
-                       buf[cursor++] = '(';
-               }
+               if ((vrefproc != NULL) || (vrefpid != NULL)) asl_string_append_no_encoding(str, " (");
 
-               if (rprc != NULL) _asl_append_string(buf, bufsize, &cursor, rprc, text_encoding, 0);
-               if (rpid != NULL)
+               if (vrefproc != NULL) asl_string_append(str, vrefproc);
+               if (vrefpid != NULL)
                {
-                       buf[cursor++] = '[';
-                       _asl_append_string(buf, bufsize, &cursor, rpid, ASL_ENCODE_NONE, 0);
-                       buf[cursor++] = ']';
+                       asl_string_append_char_no_encoding(str, '[');
+                       asl_string_append(str, vrefpid);
+                       asl_string_append_char_no_encoding(str, ']');
                }
 
-               if ((rprc != NULL) || (rpid != NULL)) buf[cursor++] = ')';
+               if ((vrefproc != NULL) || (vrefpid != NULL)) asl_string_append_char_no_encoding(str, ')');
 
                if (mf == MFMT_STD)
                {
-                       buf[cursor++] = ' ';
-                       buf[cursor++] = '<';
-                       _asl_append_string(buf, bufsize, &cursor, _asl_level_string(level), ASL_ENCODE_NONE, 0);
-                       buf[cursor++] = '>';
+                       asl_string_append_no_encoding(str, " <");
+                       asl_string_append(str, _asl_level_string(level));
+                       asl_string_append_char_no_encoding(str, '>');
                }
 
-               buf[cursor++] = ':';
-               buf[cursor++] = ' ';
-
-               if (mstr != NULL) _asl_append_string(buf, bufsize, &cursor, mstr, text_encoding, 0);
-
-               buf[cursor++] = '\n';
-               buf[cursor++] = '\0';
+               asl_string_append_no_encoding(str, ": ");
+               if (vmessage != NULL) asl_string_append(str, vmessage);
+               asl_string_append_char_no_encoding(str, '\n');
 
-               *len = bufsize;
-               return buf;
+               *len = asl_string_length(str);
+               out = asl_string_free_return_bytes(str);
+               return out;
        }
 
        if (mf == MFMT_XML)
        {
-               /* first pass: calculate output line length */
-               tstr = NULL;
-               bufsize = 0;
-
-               bufsize += 8; /* "\t<dict>\n" */
-
-               for (x = asl_msg_fetch(msg, 0, &key, &val, NULL); x != IndexNull; x = asl_msg_fetch(msg, x, &key, &val, NULL))
-               {
-                       if (asl_is_utf8(key) == 1)
-                       {
-                               bufsize += _asl_append_xml_tag_length(XML_TAG_KEY, key);
-                               if (!strcmp(key, ASL_KEY_TIME))
-                               {
-                                       tstr = _asl_time_string(tf, val);
-                                       bufsize += _asl_append_xml_tag_length(XML_TAG_STRING, tstr);
-                               }
-                               else
-                               {
-                                       if (asl_is_utf8(val) == 1) bufsize += _asl_append_xml_tag_length(XML_TAG_STRING, val);
-                                       else bufsize += _asl_append_xml_tag_length(XML_TAG_DATA, val);
-                               }
-                       }
-               }
-
-               bufsize += 10; /* "\t</dict>\n\0" */
+               str = asl_string_new(text_encoding);
+               if (str == NULL) return NULL;
 
-               /* second pass: construct the output line */
-
-               buf = malloc(bufsize);
-               if (buf == NULL) return NULL;
-
-               cursor = 0;
-
-               _asl_append_string(buf, bufsize, &cursor, "\t<dict>\n", ASL_ENCODE_NONE, 0);
+               asl_string_append_char_no_encoding(str, '\t');
+               asl_string_append(str, "<dict>");
+               asl_string_append_char_no_encoding(str, '\n');
 
                for (x = asl_msg_fetch(msg, 0, &key, &val, NULL); x != IndexNull; x = asl_msg_fetch(msg, x, &key, &val, NULL))
                {
                        if (asl_is_utf8(key) == 1)
                        {
-                               _asl_append_xml_tag(buf, bufsize, &cursor, XML_TAG_KEY, key);
+                               asl_string_append_xml_tag(str, "key", key);
                                if (!strcmp(key, ASL_KEY_TIME))
                                {
-                                       _asl_append_xml_tag(buf, bufsize, &cursor, XML_TAG_STRING, tstr);
+                                       vtime = _asl_time_string(tfmt, val);
+                                       if (vtime != NULL)
+                                       {
+                                               asl_string_append_xml_tag(str, "string", vtime);
+                                               free(vtime);
+                                       }
+                                       else
+                                       {
+                                               asl_string_append_xml_tag(str, "string", "0");
+                                       }
                                }
                                else
                                {
-                                       if (asl_is_utf8(val) == 1) _asl_append_xml_tag(buf, bufsize, &cursor, XML_TAG_STRING, val);
-                                       else _asl_append_xml_tag(buf, bufsize, &cursor, XML_TAG_DATA, val);
+                                       if (asl_is_utf8(val) == 1) asl_string_append_xml_tag(str, "string", val);
+                                       else
+                                       {
+                                               b64 = asl_b64_encode((uint8_t *)val, strlen(val));
+                                               asl_string_append_xml_tag(str, "data", (char *)b64);
+                                               free(b64);
+                                       }
                                }
                        }
                }
 
-               _asl_append_string(buf, bufsize, &cursor, "\t</dict>\n", ASL_ENCODE_NONE, 0);
-
-               buf[cursor] = '\0';
+               asl_string_append_char_no_encoding(str, '\t');
+               asl_string_append(str, "</dict>");
+               asl_string_append_char_no_encoding(str, '\n');
 
-               if (tstr != NULL) free(tstr);
-
-               *len = bufsize;
-               return buf;
+               *len = asl_string_length(str);
+               out = asl_string_free_return_bytes(str);
+               return out;
        }
 
-       /* custom format */
+       /*
+        * Custom format
+        * The format string may contain arbitrary characters.
+        * Keys are identified by $Key or $(Key).  The value for
+        * that key is substituted.  If there are alterate formats
+        * for the value (for example a time may be formatted as
+        * raw seconds, in UTC, or a local timezone), then the
+        * key may be $((Key)(Format)).  "\$" prints a plain "$".
+        */
 
-       c[1] = '\0';
+       str = asl_string_new(text_encoding);
+       if (str == NULL) return NULL;
 
        /*
         * We need enough space to copy any keys found in mfmt.
@@ -3277,174 +2419,58 @@ asl_format_message(asl_msg_t *msg, const char *mfmt, const char *tfmt, uint32_t
                if (k == NULL) return NULL;
        }
 
-       /* first pass: calculate output line length */
-
-       tstr = NULL;
-       bufsize = 0;
+       cursor = 0;
 
        for (i = 0; mfmt[i] != '\0'; i++)
        {
                if (mfmt[i] == '$')
                {
-                       i++;
                        paren = 0;
 
-                       if (mfmt[i] == '(')
-                       {
-                               paren = 1;
-                               i++;
-                       }
-
-                       l = 0;
-
-                       for (j = i; mfmt[j] != '\0'; j++)
-                       {
-                               c[0] = '\0';
-                               if (mfmt[j] == '\\') c[0] = mfmt[++j];
-                               else if ((paren == 1) && (mfmt[j] ==')')) break;
-                               else if (mfmt[j] != ' ') c[0] = mfmt[j];
-
-                               if (c[0] == '\0') break;
-
-                               k[l] = c[0];
-                               k[l + 1] = '\0';
-                               l++;
-                       }
-
-                       if (paren == 1) j++;
-                       i = j;
-                       if (l > 0)
+                       /* scan key, (key) or ((key)(format)) */
+                       for (j = i + 1; mfmt[j] != 0; j++)
                        {
-                               v = NULL;
-
-                               if (asl_msg_lookup(msg, k, &v, NULL) == 0)
+                               if (mfmt[j] == '(')
                                {
-                                       if (!strcmp(k, ASL_KEY_TIME))
-                                       {
-                                               tstr = _asl_time_string(tf, v);
-                                               bufsize += _asl_append_string_length(tstr, ASL_ENCODE_NONE, 0);
-                                       }
-                                       else
-                                       {
-                                               bufsize += _asl_append_string_length(v, ASL_ENCODE_NONE, 0);
-                                       }
+                                       paren++;
                                }
-                       }
-               }
-
-               if (mfmt[i] == '\\')
-               {
-                       i++;
-                       if (mfmt[i] == '$') bufsize++;
-                       else if (mfmt[i] == 'e') bufsize += 2;
-                       else if (mfmt[i] == 's') bufsize++;
-                       else if (mfmt[i] == 'a') bufsize += 2;
-                       else if (mfmt[i] == 'b') bufsize += 2;
-                       else if (mfmt[i] == 'f') bufsize += 2;
-                       else if (mfmt[i] == 'n') bufsize += 2;
-                       else if (mfmt[i] == 'r') bufsize += 2;
-                       else if (mfmt[i] == 't') bufsize += 2;
-                       else if (mfmt[i] == 'v') bufsize += 2;
-                       else if (mfmt[i] == '\'') bufsize += 2;
-                       else if (mfmt[i] == '\\') bufsize += 2;
-                       else if (isdigit(mfmt[i]))
-                       {
-                               oval = mfmt[i] - '0';
-                               if (isdigit(mfmt[i+1]))
+                               else if (mfmt[j] == ')')
                                {
-                                       i++;
-                                       oval = (oval * 8) + (mfmt[i] - '0');
-                                       if (isdigit(mfmt[i+1]))
+                                       if (paren > 0) paren--;
+                                       if (paren == 0)
                                        {
-                                               i++;
-                                               oval = (oval * 8) + (mfmt[i] - '0');
+                                               j++;
+                                               break;
                                        }
                                }
-
-                               c[0] = oval;
-                               bufsize += _asl_append_string_length(c, ASL_ENCODE_NONE, 0);
-                       }
-                       continue;
-               }
-
-               if (mfmt[i] == '\0') break;
-               c[0] = mfmt[i];
-               bufsize += _asl_append_string_length(c, ASL_ENCODE_NONE, 0);
-       }
-
-       bufsize += 2; /* "\n\0" */
-
-       /* second pass: construct the output line */
-
-       buf = malloc(bufsize);
-       if (buf == NULL) return NULL;
-
-       cursor = 0;
-
-       for (i = 0; mfmt[i] != '\0'; i++)
-       {
-               if (mfmt[i] == '$')
-               {
-                       i++;
-                       paren = 0;
-
-                       if (mfmt[i] == '(')
-                       {
-                               paren = 1;
-                               i++;
-                       }
-
-                       l = 0;
-
-                       for (j = i; mfmt[j] != '\0'; j++)
-                       {
-                               c[0] = '\0';
-                               if (mfmt[j] == '\\') c[0] = mfmt[++j];
-                               else if ((paren == 1) && (mfmt[j] ==')')) break;
-                               else if (mfmt[j] != ' ') c[0] = mfmt[j];
-
-                               if (c[0] == '\0') break;
-
-                               k[l] = c[0];
-                               k[l + 1] = '\0';
-                               l++;
+                               else if (((mfmt[j] == ' ') || (mfmt[j] == '\t')) && (paren == 0)) break;
                        }
 
-                       if (paren == 1) j++;
-                       i = j;
-                       if (l > 0)
-                       {
-                               v = NULL;
+                       /* mfmt[i + 1] is the first char of the key or a '('. mfmt[j] is one char past the end. */
+                       l = j - (i + 1);
+                       memcpy(k, mfmt+i+1, l);
+                       k[l] = '\0';
+                       _asl_string_append_value_for_key_format(str, msg, k, tfmt);
 
-                               if (asl_msg_lookup(msg, k, &v, NULL) == 0)
-                               {
-                                       if (!strcmp(k, ASL_KEY_TIME))
-                                       {
-                                               _asl_append_string(buf, bufsize, &cursor, tstr, ASL_ENCODE_NONE, 0);
-                                       }
-                                       else
-                                       {
-                                               _asl_append_string(buf, bufsize, &cursor, v, ASL_ENCODE_NONE, 0);
-                                       }
-                               }
-                       }
+                       i = j - 1;
+                       continue;
                }
 
                if (mfmt[i] == '\\')
                {
                        i++;
-                       if (mfmt[i] == '$') _asl_append_string(buf, bufsize, &cursor, "$", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'e') _asl_append_string(buf, bufsize, &cursor, "\e", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 's') _asl_append_string(buf, bufsize, &cursor, " ", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'a') _asl_append_string(buf, bufsize, &cursor, "\a", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'b') _asl_append_string(buf, bufsize, &cursor, "\b", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'f') _asl_append_string(buf, bufsize, &cursor, "\f", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'n') _asl_append_string(buf, bufsize, &cursor, "\n", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'r') _asl_append_string(buf, bufsize, &cursor, "\r", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 't') _asl_append_string(buf, bufsize, &cursor, "\t", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == 'v') _asl_append_string(buf, bufsize, &cursor, "\v", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == '\'') _asl_append_string(buf, bufsize, &cursor, "\'", ASL_ENCODE_NONE, 0);
-                       else if (mfmt[i] == '\\') _asl_append_string(buf, bufsize, &cursor, "\\", ASL_ENCODE_NONE, 0);
+                       if (mfmt[i] == '$') asl_string_append_char_no_encoding(str, '$');
+                       else if (mfmt[i] == 'e') asl_string_append_char_no_encoding(str, '\e');
+                       else if (mfmt[i] == 's') asl_string_append_char_no_encoding(str, ' ');
+                       else if (mfmt[i] == 'a') asl_string_append_char_no_encoding(str, '\a');
+                       else if (mfmt[i] == 'b') asl_string_append_char_no_encoding(str, '\b');
+                       else if (mfmt[i] == 'f') asl_string_append_char_no_encoding(str, '\f');
+                       else if (mfmt[i] == 'n') asl_string_append_char_no_encoding(str, '\n');
+                       else if (mfmt[i] == 'r') asl_string_append_char_no_encoding(str, '\r');
+                       else if (mfmt[i] == 't') asl_string_append_char_no_encoding(str, '\t');
+                       else if (mfmt[i] == 'v') asl_string_append_char_no_encoding(str, '\v');
+                       else if (mfmt[i] == '\'') asl_string_append_char_no_encoding(str, '\'');
+                       else if (mfmt[i] == '\\') asl_string_append_char_no_encoding(str, '\\');
                        else if (isdigit(mfmt[i]))
                        {
                                oval = mfmt[i] - '0';
@@ -3458,25 +2484,23 @@ asl_format_message(asl_msg_t *msg, const char *mfmt, const char *tfmt, uint32_t
                                                oval = (oval * 8) + (mfmt[i] - '0');
                                        }
                                }
-                               c[0] = oval;
-                               _asl_append_string(buf, bufsize, &cursor, c, ASL_ENCODE_NONE, 0);
+                               c = oval;
+                               asl_string_append_char_no_encoding(str, c);
                        }
                        continue;
                }
 
                if (mfmt[i] == '\0') break;
-               c[0] = mfmt[i];
-               _asl_append_string(buf, bufsize, &cursor, c, ASL_ENCODE_NONE, 0);
+               asl_string_append_char_no_encoding(str, mfmt[i]);
        }
 
-       buf[cursor++] = '\n';
-       buf[cursor] = '\0';
-
-       if (tstr != NULL) free(tstr);
        if (k != skey) free(k);
 
-       *len = bufsize;
-       return buf;
+       asl_string_append_char_no_encoding(str, '\n');
+
+       *len = asl_string_length(str);
+       out = asl_string_free_return_bytes(str);
+       return out;
 }
 
 /*
index c1876b2ce1a02d223df6c73324cb88527cbb3da0..dc9a9dc95f0f243002db436e01a4584498cdd4dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
@@ -25,6 +25,7 @@
 #define __ASL_MSG_H__
 
 #include <stdint.h>
+#include <asl_private.h>
 
 #define IndexNull ((uint32_t)-1)
 
 
 #define ASL_PRIVATE_KEY_BASE  0x8200
 
-#define ASL_MSG_TYPE_AUX_0     0
-
-typedef struct
-{
-       const char *level;
-       const char *time;
-       const char *nano;
-       const char *host;
-       const char *sender;
-       const char *facility;
-       const char *pid;
-       const char *uid;
-       const char *gid;
-       const char *message;
-       const char *option;
-       const char *auxtitle;
-       const char *auxuti;
-       const char *auxurl;
-} asl_msg_aux_0_t;
-
-typedef struct
-{
-       uint32_t type;
-       union
-       {
-               asl_msg_aux_0_t *aux0;
-       } data;
-} asl_msg_aux_t;
-
 typedef struct asl_msg_s
 {
        uint32_t type;
        int32_t refcount;
        uint32_t count;
        uint32_t data_size;
-       void *aux;
        struct asl_msg_s *next;
        uint16_t key[ASL_MSG_PAGE_SLOTS];
        uint16_t val[ASL_MSG_PAGE_SLOTS];
@@ -121,6 +92,15 @@ typedef struct asl_msg_s
        char data[ASL_MSG_PAGE_DATA_SIZE];
 } asl_msg_t;
 
+typedef struct __aslresponse
+{
+       uint32_t count;
+       uint32_t curr;
+       asl_msg_t **msg;
+} asl_msg_list_t;
+
+#define asl_search_result_t asl_msg_list_t
+
 asl_msg_t *asl_msg_new(uint32_t type) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 asl_msg_t *asl_msg_retain(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 void asl_msg_release(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
@@ -129,10 +109,19 @@ int asl_msg_set_key_val(asl_msg_t *msg, const char *key, const char *val) __OSX_
 int asl_msg_set_key_val_op(asl_msg_t *msg, const char *key, const char *val, uint32_t op) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 void asl_msg_unset(asl_msg_t *msg, const char *key) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 
+asl_msg_t *asl_msg_copy(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+asl_msg_t *asl_msg_merge(asl_msg_t *target, asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_1);
+
 int asl_msg_lookup(asl_msg_t *msg, const char *key, const char **valout, uint32_t *opout) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 uint32_t asl_msg_fetch(asl_msg_t *msg, uint32_t n, const char **keyout, const char **valout, uint32_t *opout) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 
 uint32_t asl_msg_type(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 uint32_t asl_msg_count(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 
+char *asl_msg_to_string(asl_msg_t *in, uint32_t *len) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0);
+char *asl_list_to_string(asl_search_result_t *, uint32_t *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+asl_search_result_t *asl_list_from_string(const char *buf) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+
+char *asl_format_message(asl_msg_t *msg, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding, uint32_t *outlen) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+
 #endif /* __ASL_MSG_H__ */
index a10cc64992163ece92cbe1d69edaaedab71e2d36..be092c797c0095eabd8760f85cb20cb30bd15340 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
 #define ASL_TIME_FMT_UTC "utc"
 #define ASL_TIME_FMT_LCL "lcl"
 
-#define ASL_ENCODE_NONE 0
-#define ASL_ENCODE_SAFE 1
-#define ASL_ENCODE_VIS  2
-#define ASL_ENCODE_ASL  3
-
 #define ASL_OPT_IGNORE "ignore"
 #define ASL_OPT_STORE "store"
 
@@ -89,25 +84,13 @@ typedef struct __aslclient
        uint64_t aslfileid;
        uint32_t reserved1;
        void *reserved2;
+       int32_t refcount;
 } asl_client_t;
 
-typedef struct __aslresponse
-{
-       uint32_t count;
-       uint32_t curr;
-       asl_msg_t **msg;
-} asl_search_result_t;
-
 __BEGIN_DECLS
 
 int asl_add_output(aslclient asl, int fd, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
 int asl_remove_output(aslclient asl, int fd) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-char *asl_format_message(asl_msg_t *msg, const char *msg_fmt, const char *time_fmt, uint32_t text_encoding, uint32_t *outlen) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-uint32_t asl_msg_string_length(asl_msg_t *msg) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
-uint32_t asl_msg_to_string_buffer(asl_msg_t *msg, char *buf, uint32_t bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
-char *asl_msg_to_string(asl_msg_t *in, uint32_t *len) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0);
-asl_search_result_t *asl_list_from_string(const char *buf) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-char *asl_list_to_string(asl_search_result_t *, uint32_t *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
 int asl_store_location() __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 int asl_get_filter(aslclient asl, int *local, int *master, int *remote, int *active) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 char *asl_remote_notify_name() __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
index d8a04991baa3d1bc0ac5d92f5cad48880297083d..a4d0fcaceb0405f54177946c31b0180fd7169921 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
index b24a5864bb0a8b442286b6ee80225b0d64e28485..d56d152e94886efc6f2c8ffee976bcfdeec84e2e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  *
@@ -81,4 +81,4 @@ uint32_t asl_store_sweep_file_cache(asl_store_t *s) __OSX_AVAILABLE_STARTING(__M
 
 uint32_t asl_store_open_aux(asl_store_t *s, aslmsg msg, int *fd, char **url) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 
-#endif __ASL_STORE_H__
+#endif /* __ASL_STORE_H__ */
index 6f7d706fdd2cefa80f30c51f7c61ed5e1ab6e052..108fa175e2ad9c927eee77386c0481f52d7519c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2008 Apple Inc.  All rights reserved.
+ * Copyright (c) 2006-2011 Apple Inc.  All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
diff --git a/gen/assert-fbsd.c b/gen/assert-fbsd.c
deleted file mode 100644 (file)
index 2e1c0b1..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)assert.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
-
-#include <assert.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "CrashReporterClient.h"
-#include "_simple.h"
-
-void
-__assert_rtn(func, file, line, failedexpr)
-       const char *func, *file;
-       int line;
-       const char *failedexpr;
-{
-       if (func == (const char *)-1L) {
-               /* 8462256: special case to replace __eprintf */
-               _simple_dprintf(STDERR_FILENO,
-                    "%s:%u: failed assertion `%s'\n", file, line, failedexpr);
-               if (!CRGetCrashLogMessage()) {
-                       _SIMPLE_STRING s = _simple_salloc();
-                       if (s) {
-                               _simple_sprintf(s,
-                                 "%s:%u: failed assertion `%s'\n",
-                                 file, line, failedexpr);
-                               CRSetCrashLogMessage(_simple_string(s));
-                       } else
-                               CRSetCrashLogMessage(failedexpr);
-               }
-       } else if (func == NULL) {
-               _simple_dprintf(STDERR_FILENO,
-                    "Assertion failed: (%s), file %s, line %d.\n", failedexpr,
-                    file, line);
-               if (!CRGetCrashLogMessage()) {
-                       _SIMPLE_STRING s = _simple_salloc();
-                       if (s) {
-                               _simple_sprintf(s,
-                                 "Assertion failed: (%s), file %s, line %d.\n",
-                                 failedexpr, file, line);
-                               CRSetCrashLogMessage(_simple_string(s));
-                       } else
-                               CRSetCrashLogMessage(failedexpr);
-               }
-       } else {
-               _simple_dprintf(STDERR_FILENO,
-                    "Assertion failed: (%s), function %s, file %s, line %d.\n",
-                    failedexpr, func, file, line);
-               if (!CRGetCrashLogMessage()) {
-                       _SIMPLE_STRING s = _simple_salloc();
-                       if (s) {
-                               _simple_sprintf(s,
-                                 "Assertion failed: (%s), function %s, file %s, line %d.\n",
-                                 failedexpr, func, file, line);
-                               CRSetCrashLogMessage(_simple_string(s));
-                       } else
-                               CRSetCrashLogMessage(failedexpr);
-               }
-       }
-       abort();
-       /* NOTREACHED */
-}
index 076e59cb3808abd727d192eb7077e29d39d4fdcc..444c629cd2a5ce01f594a1f6513a4dcb715aecd4 100644 (file)
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #include <mach-o/loader.h>
+#include <mach-o/fat.h>
+#include <mach-o/arch.h>
+#include <mach-o/getsect.h>
+#include <pthread.h>
 #include <sys/types.h>
 #include <execinfo.h>
 #include <stdio.h>
 #include <dlfcn.h>
 #include <asl.h>
 #include <errno.h>
+#include <pthread.h>
 #include "assumes.h"
 
-/* TODO: Re-enable after deciding how best to interact with this symbol. */
-/*
- * NOTE: 8006611: converted to using libCrashReporterClient.a, so shouldn't
- * use __crashreporter_info__.
- */
-#if 0
-static char __crashreporter_info_buff__[2048];
-const char *__crashreporter_info__ = &__crashreporter_info_buff__[0];
-asm (".desc __crashreporter_info__, 0x10");
-#endif
-
+#define OSX_ASSUME_LOG_REDIRECT_SECT_NAME "__osx_log_func"
 #define osx_atomic_cmpxchg(p, o, n) __sync_bool_compare_and_swap((p), (o), (n))
 
+static bool _osx_should_abort_on_assumes = false;
+
 static const char *
 _osx_basename(const char *p)
 {
        return ((strrchr(p, '/') ? : p - 1) + 1);
 }
 
-static char *
-_osx_get_build(void)
+static void
+_osx_get_build(char *build, size_t sz)
 {
-       static char s_build[16];
-       static long s_once = 0;
-       if (osx_atomic_cmpxchg(&s_once, 0, 1)) {
-               int mib[] = { CTL_KERN, KERN_OSVERSION };
-               size_t sz = sizeof(s_build);
+       /* Get the build every time. We used to cache it, but if PID 1 experiences
+        * an assumes() failure before the build has been set, that would mean that
+        * all future failures would get bad build info. So we fetch it every time.
+        * Since assumes() failures are on the slow path anyway, not a huge deal.
+        */
+       int mib[] = { CTL_KERN, KERN_OSVERSION };
 
-               (void)sysctl(mib, 2, s_build, &sz, NULL, 0);
+       size_t oldsz = sz;
+       int r = sysctl(mib, 2, build, &sz, NULL, 0);
+       if (r == 0 && sz == 1) {
+               (void)strlcpy(build, "99Z999", oldsz);
        }
-       
-       return s_build;
 }
 
 static void
 _osx_get_image_uuid(void *hdr, uuid_t uuid)
 {
 #if __LP64__
-       struct mach_header_64 *_hdr = (struct mach_header_64 *)hdr;
+       struct mach_header_64 *hdr32or64 = (struct mach_header_64 *)hdr;
 #else
-       struct mach_header *_hdr = (struct mach_header *)hdr;
+       struct mach_header *hdr32or64 = (struct mach_header *)hdr;
 #endif /* __LP64__ */
 
        size_t i = 0;
-       size_t next = sizeof(*_hdr);
+       size_t next = sizeof(*hdr32or64);
        struct load_command *cur = NULL;
-       for (i = 0; i < _hdr->ncmds; i++) {
-               cur = (struct load_command *)((uintptr_t)_hdr + next);
+       for (i = 0; i < hdr32or64->ncmds; i++) {
+               cur = (struct load_command *)((uintptr_t)hdr32or64 + next);
                if (cur->cmd == LC_UUID) {
                        struct uuid_command *cmd = (struct uuid_command *)cur;
                        uuid_copy(uuid, cmd->uuid);
                        break;
                }
+
                next += cur->cmdsize;
        }
-       
-       if (i == _hdr->ncmds) {
+
+       if (i == hdr32or64->ncmds) {
                uuid_clear(uuid);
        }
 }
 
-void
-_osx_assumes_log(uint64_t code)
+static void
+_osx_abort_on_assumes_once(void)
 {
-       Dl_info info;
+       /* Embedded boot-args can get pretty long. Let's just hope this is big
+        * enough.
+        */
+       char bootargs[2048];
+       size_t len = sizeof(bootargs) - 1;
 
+       if (sysctlbyname("kern.bootargs", bootargs, &len, NULL, 0) == 0) {
+               if (strnstr(bootargs, "-osx_assumes_fatal", len)) {
+                       _osx_should_abort_on_assumes = true;
+               }
+       }
+}
+
+static bool
+_osx_abort_on_assumes(void)
+{
+       static pthread_once_t once = PTHREAD_ONCE_INIT;
+       bool result = false;
+
+       if (getpid() != 1) {
+               if (getenv("OSX_ASSUMES_FATAL")) {
+                       result = true;
+               } else {
+                       pthread_once(&once, _osx_abort_on_assumes_once);
+                       result = _osx_should_abort_on_assumes;
+               }
+       } else {
+               if (getenv("OSX_ASSUMES_FATAL_PID1")) {
+                       result = true;
+               }
+       }
+
+       return result;
+}
+
+#if __LP64__
+static osx_redirect_t
+_osx_find_log_redirect_func(struct mach_header_64 *hdr)
+{
+       osx_redirect_t result = NULL;
+
+       char name[128];
+       unsigned long size = 0;
+       uint8_t *data = getsectiondata(hdr, "__TEXT", OSX_ASSUME_LOG_REDIRECT_SECT_NAME, &size);
+       if (data && size < sizeof(name) - 2) {
+               /* Ensure NUL termination. */
+               (void)strlcpy(name, (const char *)data, size + 1);
+               result = dlsym(RTLD_DEFAULT, name);
+       }
+
+       return result;
+}
+#else
+static osx_redirect_t
+_osx_find_log_redirect_func(struct mach_header *hdr)
+{
+       osx_redirect_t result = NULL;
+
+       char name[128];
+       unsigned long size = 0;
+       uint8_t *data = getsectiondata(hdr, "__TEXT", OSX_ASSUME_LOG_REDIRECT_SECT_NAME, &size);
+       if (data && size < sizeof(name) - 2) {
+               (void)strlcpy(name, (const char *)data, size + 1);
+               result = dlsym(RTLD_DEFAULT, name);
+       }
+
+       return result;
+}
+#endif
+
+static bool
+_osx_log_redirect(void *hdr, const char *msg)
+{
+       bool result = false;
+
+       osx_redirect_t redirect_func = _osx_find_log_redirect_func(hdr);
+       if (redirect_func) {
+               result = redirect_func(msg);
+       }
+
+       return result;
+}
+
+__attribute__((always_inline))
+static void
+_osx_construct_message(const char *prefix, uint64_t code, aslmsg asl_message, Dl_info *info, char *buff, size_t sz)
+{
        const char *image_name = NULL;
        uintptr_t offset = 0;
        uuid_string_t uuid_str;
-       
-       void *arr[2];
-       /* Get our caller's address so we can look it up with dladdr(3) and
-        * get info about the image.
-        */
-       if (backtrace(arr, 2) == 2) {
-               /* dladdr(3) returns non-zero on success... for some reason. */
-               if (dladdr(arr[1], &info)) {
-                       uuid_t uuid;
-                       _osx_get_image_uuid(info.dli_fbase, uuid);
-
-                       uuid_unparse(uuid, uuid_str);
-                       image_name = _osx_basename(info.dli_fname);
-                       
-                       offset = arr[1] - info.dli_fbase;
-               }
-       } else {
-               uuid_t null_uuid;
-               uuid_string_t uuid_str;
+
+       void *ret = __builtin_return_address(0);
+       if (dladdr(ret, info)) {
+               uuid_t uuid;
+               _osx_get_image_uuid(info->dli_fbase, uuid);
                
-               uuid_clear(null_uuid);
-               uuid_unparse(null_uuid, uuid_str);
+               uuid_unparse(uuid, uuid_str);
+               image_name = _osx_basename(info->dli_fname);
                
-               image_name = "unknown";
+               offset = ret - info->dli_fbase;
        }
-       
+
        char name[256];
        (void)snprintf(name, sizeof(name), "com.apple.assumes.%s", image_name);
-       
+
        char sig[64];
        (void)snprintf(sig, sizeof(sig), "%s:%lu", uuid_str, offset);
 
        char result[24];
        (void)snprintf(result, sizeof(result), "0x%llx", code);
 
-       char *prefix = "Bug";
-       char message[1024];
-       (void)snprintf(message, sizeof(message), "%s: %s: %s + %lu [%s]: %s", prefix, _osx_get_build(), image_name, offset, uuid_str, result);
-
-       aslmsg msg = asl_new(ASL_TYPE_MSG);
-       if (msg != NULL) {
-               /* MessageTracer messages aren't logged to the regular syslog store, so
-                * we pre-log the message without any MessageTracer attributes so that
-                * we can see it in our regular syslog.
-                */
-               (void)asl_log(NULL, msg, ASL_LEVEL_ERR, "%s", message);
-       
-               (void)asl_set(msg, "com.apple.message.domain", name);
-               (void)asl_set(msg, "com.apple.message.signature", sig);
-               (void)asl_set(msg, "com.apple.message.value", result);
-
-               (void)asl_log(NULL, msg, ASL_LEVEL_ERR, "%s", message);
-               asl_free(msg);
-       }
+       char build[16];
+       size_t bsz = sizeof(build);
+       _osx_get_build(build, bsz);
+
+       (void)snprintf(buff, sz, "%s: %s: %s + %lu [%s]: %s", prefix, build, image_name, offset, uuid_str, result);
+
+       (void)asl_set(asl_message, "com.apple.message.domain", name);
+       (void)asl_set(asl_message, "com.apple.message.signature", sig);
+       (void)asl_set(asl_message, "com.apple.message.value", result);
 }
 
-/* For osx_assert(). We need to think more about how best to set the __crashreporter_info__ string.
- * For example, calling into two functions will basically smash the register state at the time of
- * the assertion failure, causing potentially valuable information to be lost. Also, just setting
- * the __crashreporter_info__ to a static string only involves one instruction, whereas a function
- * call involves... well, more.
- */
-#if 0
 void
-osx_hardware_trap(const char *fmt, ...)
+_osx_assumes_log(uint64_t code)
 {
-       va_list ap;
-       va_start(ap, fmt);
-       
-       osx_hardware_trapv(fmt, ap);
-       
-       va_end(ap);
+       aslmsg asl_message = asl_new(ASL_TYPE_MSG);
+       if (asl_message) {
+               Dl_info info;
+               char message[256];
+               _osx_construct_message("Bug", code, asl_message, &info, message, sizeof(message));
+               if (!_osx_log_redirect(info.dli_fbase, message)) {
+                       /* MessageTracer messages aren't logged to the regular syslog store,
+                        * so we log the message without any MessageTracer attributes so
+                        * that we can see it in our regular syslog.
+                        */
+                       (void)asl_log(NULL, NULL, ASL_LEVEL_ERR, "%s", message);
+                       (void)asl_log(NULL, asl_message, ASL_LEVEL_ERR, "%s", message);
+               }
+
+               asl_free(asl_message);
+       }
+
+       if (_osx_abort_on_assumes()) {
+               __builtin_trap();
+       }
+}
+
+char *
+_osx_assert_log(uint64_t code)
+{
+       char *result = NULL;
+
+       aslmsg asl_message = asl_new(ASL_TYPE_MSG);
+       if (asl_message) {
+               Dl_info info;
+               char message[256];
+               _osx_construct_message("Fatal bug", code, asl_message, &info, message, sizeof(message));
+               if (!_osx_log_redirect(info.dli_fbase, message)) {
+                       (void)asl_log(NULL, NULL, ASL_LEVEL_ERR, "%s", message);
+                       (void)asl_log(NULL, asl_message, ASL_LEVEL_ERR, "%s", message);
+               }
+               
+               asl_free(asl_message);
+               result = strdup(message);
+       }
+
+#if LIBC_NO_LIBCRASHREPORTERCLIENT
+       /* There is no crash report information facility on embedded, which is
+        * really regrettable. Fortunately, all we need to capture is the value
+        * which tripped up the assertion. We can just stuff that into the thread's 
+        * name.
+        */
+       char name[64];
+       (void)pthread_getname_np(pthread_self(), name, sizeof(name));
+
+       char newname[64];
+       if (strlen(name) == 0) {
+               (void)snprintf(newname, sizeof(newname), "[Fatal bug: 0x%llx]", code);
+       } else {
+               (void)snprintf(newname, sizeof(newname), "%s [Fatal bug: 0x%llx]", name, code);
+       }
+
+       (void)pthread_setname_np(newname);
+#endif
+
+       return result;
 }
 
 void
-osx_hardware_trapv(const char *fmt, va_list ap)
+_osx_assumes_log_ctx(osx_log_callout_t callout, void *ctx, uint64_t code)
+{
+       aslmsg asl_message = asl_new(ASL_TYPE_MSG);
+       if (asl_message) {
+               Dl_info info;
+               char message[256];
+               _osx_construct_message("Bug", code, asl_message, &info, message, sizeof(message));
+
+               (void)callout(asl_message, ctx, message);
+               asl_free(asl_message);
+       }
+
+       if (_osx_abort_on_assumes()) {
+               __builtin_trap();
+       }
+}
+
+char *
+_osx_assert_log_ctx(osx_log_callout_t callout, void *ctx, uint64_t code)
 {
-       (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), fmt, ap);
-       fflush(NULL);
-       __builtin_trap();
+       char *result = NULL;
+
+       aslmsg asl_message = asl_new(ASL_TYPE_MSG);
+       if (asl_message) {
+               Dl_info info;
+               char message[256];
+               _osx_construct_message("Fatal bug", code, asl_message, &info, message, sizeof(message));
+
+               (void)callout(asl_message, ctx, message);
+               asl_free(asl_message);
+               result = strdup(message);
+       }
+}
+
+extern void
+_osx_avoid_tail_call(void)
+{
+       // no-op
 }
-#endif
index 4f266c445d5a3b81bbffbb3fc89487b495596385..70eb97d0f194d515636f53a7f663cf667ea6eb4f 100644 (file)
@@ -6,6 +6,7 @@
 __BEGIN_DECLS
 
 #include <Availability.h>
+#include <TargetConditionals.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdarg.h>
@@ -16,6 +17,7 @@ __BEGIN_DECLS
 #define osx_fastpath(x)        ((typeof(x))__builtin_expect((long)(x), ~0l))
 #define osx_slowpath(x)        ((typeof(x))__builtin_expect((long)(x), 0l))
 #define osx_constant(x) __builtin_constant_p((x))
+#define osx_hardware_trap() __builtin_trap()
 
 #define __OSX_COMPILETIME_ASSERT__(e) ({ \
        char __compile_time_assert__[(e) ? 1 : -1];     \
@@ -25,36 +27,201 @@ __BEGIN_DECLS
 #define osx_fastpath(x)        (x)
 #define osx_slowpath(x)        (x)
 #define osx_constant(x) ((long)0)
+#define osx_hardware_trap() abort()
 
 #define __OSX_COMPILETIME_ASSERT__(e) (e)
 #endif /* __GNUC__ */
 
+typedef bool (*osx_redirect_t)(const char *);
+
+/* The asl_message argument is an aslmsg that, when given to asl_log(), will
+ * direct the message to the MessageTracer diagnostic messages store rather than
+ * the default system log store.
+ */
+typedef bool (*osx_log_callout_t)(aslmsg asl_message, void *ctx, const char *);
+
+#if TARGET_OS_IPHONE
+#define osx_set_crash_message(arg) /* no-op */
+#else
+#include <CrashReporterClient.h>
+#define osx_set_crash_message(arg) _crc_make_setter(message, (arg))
+#endif
+
 #define osx_assumes(e) ({ \
        typeof(e) _e = osx_fastpath(e); /* Force evaluation of 'e' */ \
        if (!_e) { \
                if (osx_constant(e)) { \
                        __OSX_COMPILETIME_ASSERT__(e); \
                } \
-               _osx_assumes_log((uintptr_t)_e); \
+               _osx_assumes_log((uint64_t)(uintptr_t)_e); \
+               _osx_avoid_tail_call(); \
        } \
        _e; \
 })
 
 #define osx_assumes_zero(e) ({ \
-       typeof(e) _e = osx_slowpath(e); /* Force evaluation of 'e' */ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e) { \
+               if (osx_constant(e)) { \
+                       __OSX_COMPILETIME_ASSERT__(!e); \
+               } \
+               _osx_assumes_log((uint64_t)(uintptr_t)_e); \
+               _osx_avoid_tail_call(); \
+       } \
+       _e; \
+})
+
+/* This variant is for use with old-style POSIX APIs that return -1 on failure
+ * and set errno. If the return code is -1, the value logged will be as though
+ * osx_assumes_zero(errno) was used. It encapsulates the following pattern:
+ *
+ * int tubes[2];
+ * if (pipe(tubes) == -1) {
+ *     (void)osx_assumes_zero(errno);
+ * }
+ */
+#define posix_assumes_zero(e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e == (typeof(e))-1) { \
+               _osx_assumes_log((uint64_t)(uintptr_t)errno); \
+               _osx_avoid_tail_call(); \
+       } \
+       _e; \
+})
+
+#define osx_assert(e) ({ \
+       typeof(e) _e = osx_fastpath(e); \
+       if (!_e) { \
+               if (osx_constant(e)) { \
+                       __OSX_COMPILETIME_ASSERT__(e); \
+               } \
+\
+               char *message = _osx_assert_log((uint64_t)(uintptr_t)_e); \
+               osx_set_crash_message(message); \
+               osx_hardware_trap(); \
+               free(message); \
+       } \
+})
+
+#define osx_assert_zero(e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e) { \
+               if (osx_constant(e)) { \
+                       __OSX_COMPILETIME_ASSERT__(!e); \
+               } \
+\
+               char *message = _osx_assert_log((uint64_t)(uintptr_t)_e); \
+               osx_set_crash_message(message); \
+               osx_hardware_trap(); \
+               free(message); \
+       } \
+})
+
+#define posix_assert_zero(e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e == (typeof(e))-1) { \
+               char *message = _osx_assert_log((uint64_t)(uintptr_t)errno); \
+               osx_set_crash_message(message); \
+               osx_hardware_trap(); \
+               free(message); \
+       } \
+})
+
+/* These are for defining your own assumes()-like wrapper calls so that you can
+ * log additional information, such as the about-PID, sender, etc. They're
+ * generally not useful for direct inclusion in your code.
+ */
+#define osx_assumes_ctx(f, ctx, e) ({ \
+       typeof(e) _e = osx_fastpath(e); \
+       if (!_e) { \
+               if (osx_constant(e)) { \
+                       __OSX_COMPILETIME_ASSERT__(e); \
+               } \
+               _osx_assumes_log_ctx(f, ctx, (uintptr_t)_e); \
+               _osx_avoid_tail_call(); \
+       } \
+       _e; \
+})
+
+#define osx_assumes_zero_ctx(f, ctx, e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
        if (_e) { \
                if (osx_constant(e)) { \
                        __OSX_COMPILETIME_ASSERT__(!e); \
                } \
-               _osx_assumes_log((uintptr_t)_e); \
+               _osx_assumes_log_ctx((f), (ctx), (uintptr_t)_e); \
+               _osx_avoid_tail_call(); \
        } \
        _e; \
 })
 
+#define posix_assumes_zero_ctx(f, ctx, e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e == (typeof(e))-1) { \
+               _osx_assumes_log_ctx((f), (ctx), (uintptr_t)errno); \
+               _osx_avoid_tail_call(); \
+       } \
+       _e; \
+})
+
+#define osx_assert_ctx(f, ctx, e) ({ \
+       typeof(e) _e = osx_fastpath(e); \
+       if (!_e) { \
+               if (osx_constant(e)) { \
+                       __OSX_COMPILETIME_ASSERT__(e); \
+               } \
+\
+               char *message = _osx_assert_log_ctx((f), (ctx), (uint64_t)(uintptr_t)_e); \
+               osx_set_crash_message(message); \
+               osx_hardware_trap(); \
+               free(message); \
+       } \
+})
+
+#define osx_assert_zero_ctx(f, ctx, e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e) { \
+               if (osx_constant(e)) { \
+                       __OSX_COMPILETIME_ASSERT__(!e); \
+               } \
+\
+               char *message = _osx_assert_log_ctx((f), (ctx), (uint64_t)(uintptr_t)_e); \
+               osx_set_crash_message(message); \
+               osx_hardware_trap(); \
+               free(message); \
+       } \
+})
+
+#define posix_assert_zero_ctx(f, ctx, e) ({ \
+       typeof(e) _e = osx_slowpath(e); \
+       if (_e == (typeof(e))-1) { \
+               char *message = _osx_assert_log_ctx((f), (ctx), (uint64_t)(uintptr_t)errno); \
+               osx_set_crash_message(message); \
+               osx_hardware_trap(); \
+               free(message); \
+       } \
+})
+
 __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3)
 extern void
 _osx_assumes_log(uint64_t code);
 
+__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0)
+extern char *
+_osx_assert_log(uint64_t code);
+
+__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0)
+extern void
+_osx_assumes_log_ctx(osx_log_callout_t callout, void *ctx, uint64_t code);
+
+__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0)
+extern char *
+_osx_assert_log_ctx(osx_log_callout_t callout, void *ctx, uint64_t code);
+
+__OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0)
+extern void
+_osx_avoid_tail_call(void);
+
 __END_DECLS
 
 #endif /* __OSX_ASSUMES_H__ */
diff --git a/gen/basename-fbsd.c b/gen/basename-fbsd.c
deleted file mode 100644 (file)
index 3de44fb..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if 0
-#ifndef lint
-static char rcsid[] = "$OpenBSD: basename.c,v 1.4 1999/05/30 17:10:30 espie Exp $";
-#endif /* not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.7 2002/12/30 01:41:14 marcel Exp $");
-
-#include <errno.h>
-#include <libgen.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-
-#if __DARWIN_UNIX03
-#define const /**/
-#endif
-
-char *
-basename(path)
-       const char *path;
-{
-       static char *bname = NULL;
-       const char *endp, *startp;
-
-       if (bname == NULL) {
-               bname = (char *)malloc(MAXPATHLEN);
-               if (bname == NULL)
-                       return(NULL);
-       }
-
-       /* Empty or NULL string gets treated as "." */
-       if (path == NULL || *path == '\0') {
-               (void)strcpy(bname, ".");
-               return(bname);
-       }
-
-       /* Strip trailing slashes */
-       endp = path + strlen(path) - 1;
-       while (endp > path && *endp == '/')
-               endp--;
-
-       /* All slashes becomes "/" */
-       if (endp == path && *endp == '/') {
-               (void)strcpy(bname, "/");
-               return(bname);
-       }
-
-       /* Find the start of the base */
-       startp = endp;
-       while (startp > path && *(startp - 1) != '/')
-               startp--;
-
-       if (endp - startp + 2 > MAXPATHLEN) {
-               errno = ENAMETOOLONG;
-               return(NULL);
-       }
-       (void)strncpy(bname, startp, endp - startp + 1);
-       bname[endp - startp + 1] = '\0';
-       return(bname);
-}
diff --git a/gen/basename.3 b/gen/basename.3
deleted file mode 100644 (file)
index a9300b3..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-.\"
-.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\"    derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
-.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $
-.\" $FreeBSD: src/lib/libc/gen/basename.3,v 1.7 2004/07/02 23:52:10 ru Exp $
-.\"
-.Dd August 17, 1997
-.Dt BASENAME 3
-.Os
-.Sh NAME
-.Nm basename
-.Nd extract the base portion of a pathname
-.Sh SYNOPSIS
-.In libgen.h
-.Ft char *
-.Fo basename
-.Fa "char *path"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn basename
-function
-returns the last component from the pathname pointed to by
-.Fa path ,
-deleting any trailing
-.Sq \&/
-characters.
-If
-.Fa path
-consists entirely of
-.Sq \&/
-characters, a pointer to the string
-.Qq \&/
-is returned.
-If
-.Fa path
-is a null pointer or the empty string, a pointer to the string
-.Qq \&.
-is returned.
-.Sh RETURN VALUES
-On successful completion,
-.Fn basename
-returns a pointer to the last component of
-.Fa path .
-.Pp
-If
-.Fn basename
-fails, a null pointer is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er ENAMETOOLONG
-The path component to be returned was larger than
-.Dv MAXPATHLEN .
-.El
-.Sh WARNINGS
-The
-.Fn basename
-function
-returns a pointer to internal static storage space
-that will be overwritten by subsequent calls.
-The function may modify the string pointed to by
-.Fa path .
-.Sh LEGACY SYNOPSIS
-.Fd #include <libgen.h>
-.Pp
-.Ft char *
-.br
-.Fo basename
-.Fa "const char *path"
-.Fc ;
-.Pp
-In legacy mode,
-.Fa path
-will not be changed.
-.Sh SEE ALSO
-.Xr basename 1 ,
-.Xr dirname 1 ,
-.Xr dirname 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn basename
-function conforms to
-.St -xpg4.2 .
-.Sh HISTORY
-The
-.Fn basename
-function first appeared in
-.Ox 2.2
-and
-.Fx 4.2 .
-.Sh AUTHORS
-.An "Todd C. Miller" Aq Todd.Miller@courtesan.com
diff --git a/gen/clock-fbsd.c b/gen/clock-fbsd.c
deleted file mode 120000 (symlink)
index 7a89aae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./clock.c
\ No newline at end of file
diff --git a/gen/clock.3 b/gen/clock.3
deleted file mode 120000 (symlink)
index 8eb0ebf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./clock.3
\ No newline at end of file
diff --git a/gen/closedir-fbsd.c b/gen/closedir-fbsd.c
deleted file mode 100644 (file)
index 10bfe5e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)closedir.c 8.1 (Berkeley) 6/10/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/closedir.c,v 1.13 2007/12/03 14:33:50 des Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <dirent.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "telldir.h"
-
-/*
- * close a directory.
- */
-int
-closedir(dirp)
-       DIR *dirp;
-{
-       int fd;
-
-       if (__isthreaded)
-               _pthread_mutex_lock(&dirp->dd_lock);
-#if !__DARWIN_UNIX03
-       _seekdir(dirp, dirp->dd_rewind);        /* free seekdir storage */
-#endif /* __DARWIN_UNIX03 */
-       fd = dirp->dd_fd;
-       dirp->dd_fd = -1;
-       dirp->dd_loc = 0;
-       free((void *)dirp->dd_buf);
-       _reclaim_telldir(dirp);
-       if (__isthreaded) {
-               _pthread_mutex_unlock(&dirp->dd_lock);
-               _pthread_mutex_destroy(&dirp->dd_lock);
-       }
-       free((void *)dirp);
-       return(_close(fd));
-}
index b207ecfb9b5c6c5e3d84ac339f0e647a1ad4361d..e5fff633df3e97ba45071abd9340d4d36c35d5c6 100644 (file)
@@ -123,6 +123,11 @@ In addition, the following errors may be reported:
 The value of the
 .Fa name
 argument is invalid.
+.It Bq Er ENOMEM
+Insufficient storage space is available.
+.It Bq Er EIO
+I/O error communicating with
+.Xr opendirectoryd 8 .
 .El
 .Sh LEGACY ERRORS
 If the call to
index 419571be5df9026f729cbe1a7a120595daef946c..196d195c4fac56dd0b7a21a6002f88463097c057 100644 (file)
@@ -120,16 +120,31 @@ confstr(name, buf, len)
 
        case _CS_XBS5_ILP32_OFF32_LINTFLAGS:            /* legacy */
 
+       case _CS_POSIX_V6_ILP32_OFFBIG_LIBS:
+       case _CS_XBS5_ILP32_OFFBIG_LIBS:                /* legacy */
+
+       case _CS_XBS5_ILP32_OFFBIG_LINTFLAGS:           /* legacy */
+
+       case _CS_POSIX_V6_LP64_OFF64_LIBS:
+       case _CS_XBS5_LP64_OFF64_LIBS:                  /* legacy */
+
+       case _CS_XBS5_LP64_OFF64_LINTFLAGS:             /* legacy */
+
+       case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS:
+       case _CS_XBS5_LPBIG_OFFBIG_LIBS:                /* legacy */
+
+       case _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS:           /* legacy */
+               /* No special flags... yet */
+               p = "";
+               goto docopy;
+
        case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS:
        case _CS_XBS5_ILP32_OFFBIG_CFLAGS:              /* legacy */
 
        case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
        case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:             /* legacy */
-
-       case _CS_POSIX_V6_ILP32_OFFBIG_LIBS:
-       case _CS_XBS5_ILP32_OFFBIG_LIBS:                /* legacy */
-
-       case _CS_XBS5_ILP32_OFFBIG_LINTFLAGS:           /* legacy */
+               p = "-W 32";
+               goto docopy;
 
        case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
        case _CS_XBS5_LP64_OFF64_CFLAGS:                /* legacy */
@@ -137,23 +152,12 @@ confstr(name, buf, len)
        case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
        case _CS_XBS5_LP64_OFF64_LDFLAGS:               /* legacy */
 
-       case _CS_POSIX_V6_LP64_OFF64_LIBS:
-       case _CS_XBS5_LP64_OFF64_LIBS:                  /* legacy */
-
-       case _CS_XBS5_LP64_OFF64_LINTFLAGS:             /* legacy */
-
        case _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS:
        case _CS_XBS5_LPBIG_OFFBIG_CFLAGS:              /* legacy */
 
        case _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS:
        case _CS_XBS5_LPBIG_OFFBIG_LDFLAGS:             /* legacy */
-
-       case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS:
-       case _CS_XBS5_LPBIG_OFFBIG_LIBS:                /* legacy */
-
-       case _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS:           /* legacy */
-               /* No special flags... yet */
-               p = "";
+               p = "-W 64";
                goto docopy;
 
        case _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS:
@@ -172,8 +176,11 @@ docopy:
                        errno = ENOMEM;
                        return (CONFSTR_ERR_RET);
                }
-               if (_dirhelper(DIRHELPER_USER_LOCAL, p, PATH_MAX) == NULL)
+               if (_dirhelper(DIRHELPER_USER_LOCAL, p, PATH_MAX) == NULL) {
+                       if (errno != ENOMEM)
+                               errno = EIO;
                        return (CONFSTR_ERR_RET);
+               }
                goto docopy;
 
        case _CS_DARWIN_USER_TEMP_DIR:
@@ -182,6 +189,7 @@ docopy:
                        return (CONFSTR_ERR_RET);
                }
                if (_dirhelper(DIRHELPER_USER_LOCAL_TEMP, p, PATH_MAX) == NULL) {
+                       int dh_errno = errno;
                        /*
                         * If _dirhelper() fails, try TMPDIR and P_tmpdir,
                         * finally failing otherwise.
@@ -190,6 +198,10 @@ docopy:
                                goto docopy;
                        if (access(p = P_tmpdir, W_OK) == 0)
                                goto docopy;
+                       if (dh_errno == ENOMEM)
+                               errno = ENOMEM;
+                       else
+                               errno = EIO;
                        return (CONFSTR_ERR_RET);
                }
                goto docopy;
@@ -199,8 +211,11 @@ docopy:
                        errno = ENOMEM;
                        return (CONFSTR_ERR_RET);
                }
-               if (_dirhelper(DIRHELPER_USER_LOCAL_CACHE, p, PATH_MAX) == NULL)
+               if (_dirhelper(DIRHELPER_USER_LOCAL_CACHE, p, PATH_MAX) == NULL) {
+                       if (errno != ENOMEM)
+                               errno = EIO;
                        return (CONFSTR_ERR_RET);
+               }
                goto docopy;
 
        default:
diff --git a/gen/ctermid-fbsd.c b/gen/ctermid-fbsd.c
deleted file mode 120000 (symlink)
index 0300f3c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ctermid.c
\ No newline at end of file
diff --git a/gen/ctermid.3 b/gen/ctermid.3
deleted file mode 100644 (file)
index 2085245..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ctermid.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/ctermid.3,v 1.12 2007/01/09 00:27:53 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt CTERMID 3
-.Os
-.Sh NAME
-.Nm ctermid ,
-.Nm ctermid_r
-.Nd generate terminal pathname
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft char *
-.Fn ctermid "char *s"
-.Ft char *
-.Fn ctermid_r "char *s"
-.Sh DESCRIPTION
-The
-.Fn ctermid
-function generates a string that, when used as a pathname, refers to
-the current controlling terminal of the calling process.
-.Pp
-If
-.Fa s
-is the
-.Dv NULL
-pointer, a pointer to a static area is returned.
-Otherwise, the pathname is copied into the memory referenced by
-.Fa s .
-The argument
-.Fa s
-is assumed to be at least
-.Dv L_ctermid
-(as defined in the include
-file
-.In stdio.h )
-bytes long.
-.Pp
-The
-.Fn ctermid_r
-function
-provides the same functionality as
-.Fn ctermid ,
-except that if
-.Fa s
-is a
-.Dv NULL
-pointer,
-.Dv NULL
-is returned.
-.Pp
-The current implementation simply returns
-.Ql /dev/tty .
-.Sh RETURN VALUES
-Upon successful completion, a
-.Pf non- Dv NULL
-pointer is returned.
-Otherwise, a
-.Dv NULL
-pointer is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The current implementation detects no error conditions.
-.Sh SEE ALSO
-.Xr ttyname 3
-.Sh STANDARDS
-The
-.Fn ctermid
-function conforms to
-.St -p1003.1-88 .
-.Sh BUGS
-By default the
-.Fn ctermid
-function
-writes all information to an internal static object.
-Subsequent calls to
-.Fn ctermid
-will modify the same object.
diff --git a/gen/daemon-fbsd.c b/gen/daemon-fbsd.c
deleted file mode 100644 (file)
index ea9a15f..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)daemon.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $");
-
-#ifndef VARIANT_PRE1050
-#include <mach/mach.h>
-#include <servers/bootstrap.h>
-#endif /* !VARIANT_PRE1050 */
-#include "namespace.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#ifndef VARIANT_PRE1050
-static void
-move_to_root_bootstrap(void)
-{
-       mach_port_t parent_port = 0;
-       mach_port_t previous_port = 0;
-
-       do {
-               if (previous_port) {
-                       mach_port_deallocate(mach_task_self(), previous_port);
-                       previous_port = parent_port;
-               } else {
-                       previous_port = bootstrap_port;
-               }
-
-               if (bootstrap_parent(previous_port, &parent_port) != 0) {
-                       return;
-               }
-       } while (parent_port != previous_port);
-
-       task_set_bootstrap_port(mach_task_self(), parent_port);
-       bootstrap_port = parent_port;
-}
-#endif /* !VARIANT_PRE1050 */
-
-int daemon(int, int) __DARWIN_1050(daemon);
-
-int
-daemon(nochdir, noclose)
-       int nochdir, noclose;
-{
-       struct sigaction osa, sa;
-       int fd;
-       pid_t newgrp;
-       int oerrno;
-       int osa_ok;
-
-       /* A SIGHUP may be thrown when the parent exits below. */
-       sigemptyset(&sa.sa_mask);
-       sa.sa_handler = SIG_IGN;
-       sa.sa_flags = 0;
-       osa_ok = _sigaction(SIGHUP, &sa, &osa);
-#ifndef VARIANT_PRE1050
-       move_to_root_bootstrap();
-#endif /* !VARIANT_PRE1050 */
-       switch (fork()) {
-       case -1:
-               return (-1);
-       case 0:
-               break;
-       default:
-               _exit(0);
-       }
-
-       newgrp = setsid();
-       oerrno = errno;
-       if (osa_ok != -1)
-               _sigaction(SIGHUP, &osa, NULL);
-
-       if (newgrp == -1) {
-               errno = oerrno;
-               return (-1);
-       }
-
-       if (!nochdir)
-               (void)chdir("/");
-
-       if (!noclose && (fd = _open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
-               (void)_dup2(fd, STDIN_FILENO);
-               (void)_dup2(fd, STDOUT_FILENO);
-               (void)_dup2(fd, STDERR_FILENO);
-               if (fd > 2)
-                       (void)_close(fd);
-       }
-       return (0);
-}
diff --git a/gen/daemon.3 b/gen/daemon.3
deleted file mode 100644 (file)
index a2d9f2b..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)daemon.3    8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/daemon.3,v 1.15 2007/01/09 00:27:53 imp Exp $
-.\"
-.Dd June 9, 1993
-.Dt DAEMON 3
-.Os
-.Sh NAME
-.Nm daemon
-.Nd run in the background
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fn daemon "int nochdir" "int noclose"
-.Sh DESCRIPTION
-The
-.Fn daemon
-function is for programs wishing to detach themselves from the
-controlling terminal and run in the background as system daemons.
-On Mac OS X, the use of this API is discouraged in favor of using
-.Xr launchd 8 .
-.Pp
-Unless the argument
-.Fa nochdir
-is non-zero,
-.Fn daemon
-changes the current working directory to the root
-.Pq Pa / .
-.Pp
-Unless the argument
-.Fa noclose
-is non-zero,
-.Fn daemon
-will redirect standard input, standard output, and standard error to
-.Pa /dev/null .
-.Sh RETURN VALUES
-.Rv -std daemon
-.Sh ERRORS
-The
-.Fn daemon
-function may fail and set
-.Va errno
-for any of the errors specified for the library functions
-.Xr fork 2
-and
-.Xr setsid 2 .
-.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr setsid 2 ,
-.Xr sigaction 2
-.Sh HISTORY
-The
-.Fn daemon
-function first appeared in
-.Bx 4.4 .
-.Sh CAVEATS
-Unless the
-.Fa noclose
-argument is non-zero,
-.Fn daemon
-will close the first three file descriptors and redirect them to
-.Pa /dev/null .
-Normally, these correspond to standard input, standard output, and
-standard error.
-However, if any of those file descriptors refer to something else, they
-will still be closed, resulting in incorrect behavior of the calling program.
-This can happen if any of standard input, standard output, or standard
-error have been closed before the program was run.
-Programs using
-.Fn daemon
-should therefore either call
-.Fn daemon
-before opening any files or sockets, or verify that any file
-descriptors obtained have values greater than 2.
-.Pp
-The
-.Fn daemon
-function temporarily ignores
-.Dv SIGHUP
-while calling
-.Xr setsid 2
-to prevent a parent session group leader's calls to
-.Xr fork 2
-and then
-.Xr _exit 2
-from prematurely terminating the child process.
index df63d69d1b8f976fbaa43744c147bbd8e3dac0f7..4faf967b2e94754885f08dc42bc9a01014fa6153 100644 (file)
@@ -163,9 +163,12 @@ The
 .Fn dirfd
 function
 returns the integer file descriptor associated with the named
-.Em directory stream ,
-see
+.Em directory stream 
+on success, see
 .Xr open 2 .
+On failure, \-1 is returned and the global variable
+.Va errno
+is set to indicate the error.
 .Pp
 Sample code which searches a directory for entry ``name'' is:
 .Bd -literal -offset indent
diff --git a/gen/dirfd.c b/gen/dirfd.c
new file mode 100644 (file)
index 0000000..15ab391
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <dirent.h>
+#include <errno.h>
+#include <stdlib.h>
+
+int dirfd(DIR *dirp) {
+    if (dirp == NULL || dirp->__dd_fd < 0) {
+        errno = EINVAL;
+        return -1;
+    }
+
+    return dirp->__dd_fd;
+}
diff --git a/gen/dirname-fbsd.c b/gen/dirname-fbsd.c
deleted file mode 100644 (file)
index 5164e18..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*     $OpenBSD: dirname.c,v 1.13 2005/08/08 08:05:33 espie Exp $      */
-
-/*
- * Copyright (c) 1997, 2004 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/dirname.c,v 1.8 2008/11/03 05:19:45 delphij Exp $");
-
-#include <errno.h>
-#include <libgen.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-
-#if __DARWIN_UNIX03
-#define const /**/
-#endif
-
-char *
-dirname(const char *path)
-{
-       static char *dname = NULL;
-       size_t len;
-       const char *endp;
-
-       if (dname == NULL) {
-               dname = (char *)malloc(MAXPATHLEN);
-               if (dname == NULL)
-                       return(NULL);
-       }
-
-       /* Empty or NULL string gets treated as "." */
-       if (path == NULL || *path == '\0') {
-               dname[0] = '.';
-               dname[1] = '\0';
-               return (dname);
-       }
-
-       /* Strip any trailing slashes */
-       endp = path + strlen(path) - 1;
-       while (endp > path && *endp == '/')
-               endp--;
-
-       /* Find the start of the dir */
-       while (endp > path && *endp != '/')
-               endp--;
-
-       /* Either the dir is "/" or there are no slashes */
-       if (endp == path) {
-               dname[0] = *endp == '/' ? '/' : '.';
-               dname[1] = '\0';
-               return (dname);
-       } else {
-               /* Move forward past the separating slashes */
-               do {
-                       endp--;
-               } while (endp > path && *endp == '/');
-       }
-
-       len = endp - path + 1;
-       if (len >= MAXPATHLEN) {
-               errno = ENAMETOOLONG;
-               return (NULL);
-       }
-       memcpy(dname, path, len);
-       dname[len] = '\0';
-       return (dname);
-}
diff --git a/gen/dirname.3 b/gen/dirname.3
deleted file mode 100644 (file)
index 330b426..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-.\" $OpenBSD: dirname.3,v 1.17 2007/05/31 19:19:28 jmc Exp $
-.\"
-.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/dirname.3,v 1.10 2008/11/03 05:19:45 delphij Exp $
-.\"
-.Dd October 12, 2006
-.Dt DIRNAME 3
-.Os
-.Sh NAME
-.Nm dirname
-.Nd extract the directory part of a pathname
-.Sh SYNOPSIS
-.In libgen.h
-.Ft char *
-.Fo dirname
-.Fa "char *path"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn dirname
-function is the converse of
-.Xr basename 3 ;
-it returns a pointer to the parent directory of the pathname pointed to by
-.Fa path .
-Any trailing
-.Sq \&/
-characters are not counted as part of the directory
-name.
-If
-.Fa path
-is a null pointer, the empty string, or contains no
-.Sq \&/
-characters,
-.Fn dirname
-returns a pointer to the string
-.Qq \&. ,
-signifying the current directory.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn dirname
-function
-returns a pointer to internal storage space allocated on the first call
-that will be overwritten
-by subsequent calls.
-.Pp
-Other vendor implementations of
-.Fn dirname
-may modify the contents of the string passed to
-.Fn dirname ;
-if portability is desired,
-this should be taken into account when writing code which calls this function.
-.Sh LEGACY SYNOPSIS
-.Fd #include <libgen.h>
-.Pp
-.Ft char *
-.br
-.Fo dirname
-.Fa "const char *path"
-.Fc ;
-.Pp
-In legacy mode,
-.Fa path
-will not be changed.
-.Sh RETURN VALUES
-On successful completion,
-.Fn dirname
-returns a pointer to the parent directory of
-.Fa path .
-.Pp
-If
-.Fn dirname
-fails, a null pointer is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er ENAMETOOLONG
-The path component to be returned was larger than
-.Dv MAXPATHLEN .
-.El
-.Sh SEE ALSO
-.Xr basename 1 ,
-.Xr dirname 1 ,
-.Xr basename 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn dirname
-function conforms to
-.St -xpg4.2 .
-.Sh HISTORY
-The
-.Fn dirname
-function first appeared in
-.Ox 2.2
-and
-.Fx 4.2 .
-.Sh AUTHORS
-.An "Todd C. Miller"
diff --git a/gen/drand48-fbsd.c b/gen/drand48-fbsd.c
deleted file mode 100644 (file)
index 52e9693..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/drand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-double
-drand48(void)
-{
-       ERAND48_BEGIN;
-       _DORAND48(_rand48_seed);
-       ERAND48_END(_rand48_seed);
-}
diff --git a/gen/endutxent.3 b/gen/endutxent.3
deleted file mode 100644 (file)
index 719b98f..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-.\"    $NetBSD: endutxent.3,v 1.5 2008/04/30 13:10:50 martin Exp $
-.\"
-.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Thomas Klausner.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd June 29, 2006
-.Dt ENDUTXENT 3
-.Os
-.Sh NAME
-.Nm endutxent ,
-.Nm getutxent ,
-.Nm getutxid ,
-.Nm getutxline ,
-.Nm pututxline ,
-.Nm setutxent
-.Nd user accounting database functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In utmpx.h
-.Ft void
-.Fn endutxent void
-.Ft struct utmpx *
-.Fn getutxent void
-.Ft struct utmpx *
-.Fn getutxid "const struct utmpx *id"
-.Ft struct utmpx *
-.Fn getutxline "const struct utmpx *line"
-.Ft struct utmpx *
-.Fn pututxline "const struct utmpx *utx"
-.Ft void
-.Fn setutxent void
-.Sh DESCRIPTION
-These functions provide access to the
-.Xr utmpx 5
-user accounting database.
-.Pp
-.Fn getutxent
-reads the next entry from the database;
-if the database was not yet open, it also opens it.
-.Fn setutxent
-resets the database, so that the next
-.Fn getutxent
-call will get the first entry.
-.Fn endutxent
-closes the database.
-.Pp
-.Fn getutxid
-returns the next entry of the type specified in its argument's
-.Va ut_type
-field, or
-.Dv NULL
-if none is found.
-.Fn getutxline
-returns the next
-.Dv LOGIN_PROCESS
-or
-.Dv USER_PROCESS
-entry which has the same name as specified in the
-.Va ut_line
-field, or
-.Dv NULL
-if no match is found.
-.Pp
-.Fn pututxline
-adds the argument
-.Xr utmpx 5
-entry line to the accounting database, replacing a previous entry for
-the same user if it exists.
-Only the superuser may write to the accounting database.
-.Ss The utmpx structure
-The
-.Nm utmpx
-structure has the following definition:
-.Pp
-.Bd -literal
-struct utmpx {
-       char ut_user[_UTX_USERSIZE];    /* login name */
-       char ut_id[_UTX_IDSIZE];        /* id */
-       char ut_line[_UTX_LINESIZE];    /* tty name */
-       pid_t ut_pid;                   /* process id creating the entry */
-       short ut_type;                  /* type of this entry */
-       struct timeval ut_tv;           /* time entry was created */
-       char ut_host[_UTX_HOSTSIZE];    /* host name */
-       __uint32_t ut_pad[16];          /* reserved for future use */
-};
-.Ed
-.Pp
-Valid entries for
-.Fa ut_type
-are:
-.Bl -tag -width ".Dv LOGIN_PROCESSXX" -compact -offset indent
-.It Dv BOOT_TIME
-Time of a system boot.
-.It Dv DEAD_PROCESS
-A session leader exited.
-.It Dv EMPTY
-No valid user accounting information.
-.It Dv INIT_PROCESS
-A process spawned by
-.Xr init 8 .
-.It Dv LOGIN_PROCESS
-The session leader of a logged-in user.
-.It Dv NEW_TIME
-Time after system clock change.
-.It Dv OLD_TIME
-Time before system clock change.
-.It Dv RUN_LVL
-Run level.
-Provided for compatibility, not used.
-.It Dv USER_PROCESS
-A user process.
-.It Dv SHUTDOWN_TIME
-Time of system shutdown (extension to the standards).
-.El
-.Pp
-For each value of
-.Fa ut_type ,
-the other fields with meaningful values are as follows:
-.Bl -tag -width ".Dv LOGIN_PROCESSXX" -compact -offset indent
-.It Dv BOOT_TIME
-.Fa ut_tv
-.It Dv DEAD_PROCESS
-.Fa ut_id ,
-.Fa ut_pid ,
-.Fa ut_tv
-.It Dv EMPTY
-(no others)
-.It Dv INIT_PROCESS
-.Fa ut_id ,
-.Fa ut_pid ,
-.Fa ut_tv
-.It Dv LOGIN_PROCESS
-.Fa ut_id ,
-.Fa ut_user
-(implementation-defined name of the login process),
-.Fa ut_pid ,
-.Fa ut_tv
-.It Dv NEW_TIME
-.Fa ut_tv
-.It Dv OLD_TIME
-.Fa ut_tv
-.It Dv RUN_LVL
-(no used)
-.It Dv USER_PROCESS
-.Fa ut_id ,
-.Fa ut_user
-(login name of the user),
-.Fa ut_line ,
-.Fa ut_pid ,
-.Fa ut_host
-(hostname of remote user)
-.Fa ut_tv
-.It Dv SHUTDOWN_TIME
-.Fa ut_tv
-.El
-.Ss Other extensions to the standards
-The
-.Fa ut_type
-value may also be OR-ed with the following masks:
-.Bl -tag -width XXXX -compact -offset indent
-.It Dv UTMPX_AUTOFILL_MASK
-Depending on the main part of
-.Fa ut_type
-value, other fields are automatically filled in (as specified in the
-meaningful fields table above).
-In particular, the
-.Fa ut_id
-field will be set using the convention of the last four characters of the
-.Fa ut_line
-field (itself filled in automatically from the tty name of the device connected
-to the standard input, output or error, whichever is available).
-Note that it is more efficient to fill in as many values as are already
-available beforehand, rather than have then automatically filled in.
-.It Dv UTMPX_DEAD_IF_CORRESPONDING_MASK
-When
-.Fa ut_type
-value is
-.Dv DEAD_PROCESS, a call to
-.Fn pututxline
-will succeed only if a corresponding entry already exists with a
-.Fa ut_type
-value of
-.Dv USER_PROCESS .
-.El
-.Pp
-Note that the above mask values do not show up in any file format, or in
-any subsequent reads of the data.
-.Pp
-To support
-.Pa wtmpx
-and
-.Pa lastlogx
-equivalent capability,
-.Fn pututxline
-automatically writes to the appropriate files.
-Additional APIs to read these files is available in
-.Xr endutxent_wtmp 3
-and
-.Xr getlastlogx 3 .
-.Ss Backward compatibility
-Successful calls to
-.Fn pututxline
-will automatically write equivalent entries into the
-.Pa utmp ,
-.Pa wtmp
-and
-.Pa lastlog
-files.
-Programs that read these old files should work as expected.
-However, directly writing to these files does not make corresponding
-entries in
-.Pa utmpx
-and the
-.Pa wtmpx
-and
-.Pa lastlogx
-equivalent files, so such write-access is deprecated.
-.Sh RETURN VALUES
-.Fn getutxent
-returns the next entry, or
-.Dv NULL
-on failure (end of database or problems reading from the database).
-.Fn getutxid
-and
-.Fn getutxline
-return the matching structure on success, or
-.Dv NULL
-if no match was found.
-.Pp
-.Fn pututxline
-returns the structure that was successfully written, or
-.Dv NULL
-is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-No errors are defined for the 
-.Fn endutxent ,
-.Fn getutxent ,
-.Fn getutxid ,
-.Fn getutxline ,
-and
-.Fn setutxent
-functions.
-.Pp
-The
-.Fn pututxline
-function may fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The process does not have appropriate privileges.
-.It Bq Er EINVAL
-The
-.Dv UTMPX_DEAD_IF_CORRESPONDING_MASK
-flags was specified along with
-.Dv DEAD_PROCESS ,
-but no corresponding entry with
-.Dv USER_PROCESS
-was found.
-.El
-.Pp
-Other errors may be returned if
-.Dv UTMPX_AUTOFILL_MASK
-was specified, and a field could not be auto-filled.
-.Sh SEE ALSO
-.Xr endutxent_wtmp 3 ,
-.Xr getlastlogx 3 ,
-.Xr utmpx 5
-.Sh STANDARDS
-The
-.Fn endutxent ,
-.Fn getutxent ,
-.Fn getutxid ,
-.Fn getutxline ,
-.Fn pututxline ,
-.Fn setutxent
-all conform to
-.St -p1003.1-2001
-(XSI extension), and previously to
-.St -xpg4.2 .
-The fields
-.Fa ut_user ,
-.Fa ut_id ,
-.Fa ut_line ,
-.Fa ut_pid ,
-.Fa ut_type ,
-and
-.Fa ut_tv
-conform to
-.St -p1003.1-2001
-(XSI extension), and previously to
-.St -xpg4.2 .
-.\" .Fa ut_host ,
-.\" .Fa ut_session ,
-.\" .Fa ut_exit ,
-.\" and
-.\" .Fa ut_ss
-.\" are from
-.\" SVR3/4?
-.\" .Dv RUN_LVL
-.\" is for compatibility with
-.\" what exactly?
-.\" .Sh HISTORY
-.\" The
-.\" .Nm utmpx ,
-.\" .Nm wtmpx ,
-.\" and
-.\" .Nm lastlogx
-.\" files first appeared in
-.\" SVR3? 4?
diff --git a/gen/endutxent.3.orig b/gen/endutxent.3.orig
deleted file mode 100644 (file)
index 06a4433..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-.\"    $NetBSD: endutxent.3,v 1.5 2008/04/30 13:10:50 martin Exp $
-.\"
-.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Thomas Klausner.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd September 26, 2002
-.Dt ENDUTXENT 3
-.Os
-.Sh NAME
-.Nm endutxent ,
-.Nm getutxent ,
-.Nm getutxid ,
-.Nm getutxline ,
-.Nm pututxline ,
-.Nm setutxent
-.Nd user accounting database functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In utmpx.h
-.Ft void
-.Fn endutxent void
-.Ft struct utmpx *
-.Fn getutxent void
-.Ft struct utmpx *
-.Fn getutxid "const struct utmpx *"
-.Ft struct utmpx *
-.Fn getutxline "const struct utmpx *"
-.Ft struct utmpx *
-.Fn pututxline "const struct utmpx *"
-.Ft void
-.Fn setutxent void
-.Sh DESCRIPTION
-These functions provide access to the
-.Xr utmpx 5
-user accounting database.
-.Pp
-.Fn getutxent
-reads the next entry from the database;
-if the database was not yet open, it also opens it.
-.Fn setutxent
-resets the database, so that the next
-.Fn getutxent
-call will get the first entry.
-.Fn endutxent
-closes the database.
-.Pp
-.Fn getutxid
-returns the next entry of the type specified in its argument's
-.Va ut_type
-field, or
-.Dv NULL
-if none is found.
-.Fn getutxline
-returns the next
-.Dv LOGIN_PROCESS
-or
-.Dv USER_PROCESS
-entry which has the same name as specified in the
-.Va ut_line
-field, or
-.Dv NULL
-if no match is found.
-.Pp
-.Fn pututxline
-adds the argument
-.Xr utmpx 5
-entry line to the accounting database, replacing a previous entry for
-the same user if it exists.
-.Ss The utmpx structure
-The
-.Nm utmpx
-structure has the following definition:
-.Pp
-.Bd -literal
-struct utmpx {
-        char ut_name[_UTX_USERSIZE];    /* login name */
-        char ut_id[_UTX_IDSIZE];        /* inittab id */
-        char ut_line[_UTX_LINESIZE];    /* tty name */
-        char ut_host[_UTX_HOSTSIZE];    /* host name */
-        uint16_t ut_session;            /* session id used for windowing */
-        uint16_t ut_type;               /* type of this entry */
-        pid_t ut_pid;                   /* process id creating the entry */
-        struct {
-                uint16_t e_termination; /* process termination signal */
-                uint16_t e_exit;        /* process exit status */
-        } ut_exit;
-        struct sockaddr_storage ut_ss;  /* address where entry was made from */
-        struct timeval ut_tv;           /* time entry was created */
-        uint32_t ut_pad[10];            /* reserved for future use */
-};
-.Ed
-.Pp
-Valid entries for
-.Fa ut_type
-are:
-.Bl -tag -width LOGIN_PROCESSXX -compact -offset indent
-.It Dv BOOT_TIME
-Time of a system boot.
-.It Dv DEAD_PROCESS
-A session leader exited.
-.It Dv EMPTY
-No valid user accounting information.
-.It Dv INIT_PROCESS
-A process spawned by
-.Xr init 8 .
-.It Dv LOGIN_PROCESS
-The session leader of a logged-in user.
-.It Dv NEW_TIME
-Time after system clock change.
-.It Dv OLD_TIME
-Time before system clock change.
-.It Dv RUN_LVL
-Run level.
-Provided for compatibility, not used on
-.Nx .
-.It Dv USER_PROCESS
-A user process.
-.El
-.Sh RETURN VALUES
-.Fn getutxent
-returns the next entry, or
-.Dv NULL
-on failure (end of database or problems reading from the database).
-.Fn getutxid
-and
-.Fn getutxline
-return the matching structure on success, or
-.Dv NULL
-if no match was found.
-.Fn pututxline
-returns the structure that was successfully written, or
-.Dv NULL .
-.Sh SEE ALSO
-.Xr logwtmpx 3 ,
-.Xr utmpx 5
-.Sh STANDARDS
-The
-.Fn endutxent ,
-.Fn getutxent ,
-.Fn getutxid ,
-.Fn getutxline ,
-.Fn pututxline ,
-.Fn setutxent
-all conform to
-.St -p1003.1-2001
-(XSI extension), and previously to
-.St -xpg4.2 .
-The fields
-.Fa ut_user ,
-.Fa ut_id ,
-.Fa ut_line ,
-.Fa ut_pid ,
-.Fa ut_type ,
-and
-.Fa ut_tv
-conform to
-.St -p1003.1-2001
-(XSI extension), and previously to
-.St -xpg4.2 .
-.\" .Fa ut_host ,
-.\" .Fa ut_session ,
-.\" .Fa ut_exit ,
-.\" and
-.\" .Fa ut_ss
-.\" are from
-.\" SVR3/4?
-.\" .Dv RUN_LVL
-.\" is for compatibility with
-.\" what exactly?
-.\" .Sh HISTORY
-.\" The
-.\" .Nm utmpx ,
-.\" .Nm wtmpx ,
-.\" and
-.\" .Nm lastlogx
-.\" files first appeared in
-.\" SVR3? 4?
diff --git a/gen/erand48-fbsd.c b/gen/erand48-fbsd.c
deleted file mode 100644 (file)
index 9887547..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/erand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-double
-erand48(unsigned short xseed[3])
-{
-       uint48 tmp;
-       ERAND48_BEGIN;
-       DORAND48(tmp, xseed);
-       ERAND48_END(tmp);
-}
diff --git a/gen/err-fbsd.c b/gen/err-fbsd.c
deleted file mode 100644 (file)
index e6e03f6..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.15 2008/04/03 20:36:44 imp Exp $");
-
-#include "namespace.h"
-#include <err.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <vis.h>
-#include "un-namespace.h"
-
-#ifdef __BLOCKS__
-#include <Block.h>
-#endif /* __BLOCKS__ */
-#include "libc_private.h"
-
-#define ERR_EXIT_UNDEF 0
-#ifdef __BLOCKS__
-#define ERR_EXIT_BLOCK 1
-#endif /* __BLOCKS__ */
-#define ERR_EXIT_FUNC  2
-struct _e_err_exit {
-       unsigned int type;
-#ifdef __BLOCKS__
-       union {
-#endif /* __BLOCKS__ */
-               void (*func)(int);
-#ifdef __BLOCKS__
-               void (^block)(int);
-       };
-#endif /* __BLOCKS__ */
-};
-
-#ifdef BUILDING_VARIANT
-
-__private_extern__ FILE *_e_err_file; /* file to use for error output */
-__private_extern__ struct _e_err_exit _e_err_exit;
-__private_extern__ void _e_visprintf(FILE * __restrict, const char * __restrict, va_list);
-
-#else /* !BUILDING_VARIANT */
-
-__private_extern__ FILE *_e_err_file = NULL; /* file to use for error output */
-__private_extern__ struct _e_err_exit _e_err_exit = {ERR_EXIT_UNDEF};
-
-/*
- * zero means pass as is
- * 255 means use \nnn (octal)
- * otherwise use \x (x is value)
- * (NUL isn't used)
- */
-static unsigned char escape[256] = {
-     /* NUL */
-        0, /* Unused: strings can't contain nulls */
-     /*      SOH  STX  ETX  EOT  ENQ  ACK  BEL */
-            255, 255, 255, 255, 255, 255, 'a',
-     /* BS   HT   NL   VT   NP   CR   SO   SI  */
-       'b',  0,   0,  'v', 'f', 'r', 255, 255,
-     /* DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
-       255, 255, 255, 255, 255, 255, 255, 255,
-     /* CAN  EM   SUB  ESC  FS   GS   RS   US  */
-       255, 255, 255, 255, 255, 255, 255, 255,
-     /* the rest are zero */
-};
-
-/*
- * Make characters visible.  If we can't allocate enough
- * memory, we fall back on vfprintf().
- */
-__private_extern__ void
-_e_visprintf(FILE * __restrict stream, const char * __restrict format, va_list ap)
-{
-       int failed = 0;
-       char *str, *visstr;
-       va_list backup;
-
-       va_copy(backup, ap);
-       vasprintf(&str, format, ap);
-       if (str != NULL) {
-               if ((visstr = malloc(4 * strlen(str) + 1)) != NULL) {
-                       unsigned char *fp = (unsigned char *)str;
-                       unsigned char *tp = (unsigned char *)visstr;
-                       while(*fp) {
-                               switch(escape[*fp]) {
-                               case 0:
-                                       *tp++ = *fp;
-                                       break;
-                               case 255:
-                                       sprintf((char *)tp, "\\%03o", *fp);
-                                       tp += 4;
-                                       break;
-                               default:
-                                       *tp++ = '\\';
-                                       *tp++ = escape[*fp];
-                                       break;
-                               }
-                               fp++;
-                       }
-                       *tp = 0;
-                       fputs(visstr, stream);
-                       free(visstr);
-               } else
-                       failed = 1;
-               free(str);
-       } else
-               failed = 1;
-       if (failed)
-               vfprintf(stream, format, backup);
-       va_end(backup);
-}
-
-/*
- * This is declared to take a `void *' so that the caller is not required
- * to include <stdio.h> first.  However, it is really a `FILE *', and the
- * manual page documents it as such.
- */
-void
-err_set_file(void *fp)
-{
-       if (fp)
-               _e_err_file = fp;
-       else
-               _e_err_file = stderr;
-}
-
-void
-err_set_exit(void (*ef)(int))
-{
-       _e_err_exit.type = ERR_EXIT_FUNC;
-       _e_err_exit.func = ef;
-}
-
-#ifdef __BLOCKS__
-void
-err_set_exit_b(void (^ef)(int))
-{
-       _e_err_exit.type = ERR_EXIT_BLOCK;
-       _e_err_exit.block = Block_copy(ef);
-}
-#endif /* __BLOCKS__ */
-#endif /* !BUILDING_VARIANT */
-
-__weak_reference(_err, err);
-
-void
-_err(int eval, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       verrc(eval, errno, fmt, ap);
-       va_end(ap);
-}
-
-void
-verr(eval, fmt, ap)
-       int eval;
-       const char *fmt;
-       va_list ap;
-{
-       verrc(eval, errno, fmt, ap);
-}
-
-void
-errc(int eval, int code, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       verrc(eval, code, fmt, ap);
-       va_end(ap);
-}
-
-void
-verrc(int eval, int code, const char *fmt, va_list ap)
-{
-       if (_e_err_file == 0)
-               err_set_file((FILE *)0);
-       fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL) {
-               _e_visprintf(_e_err_file, fmt, ap);
-               fprintf(_e_err_file, ": ");
-       }
-       fprintf(_e_err_file, "%s\n", strerror(code));
-       if (_e_err_exit.type)
-#ifdef __BLOCKS__
-               if (_e_err_exit.type == ERR_EXIT_BLOCK)
-                       _e_err_exit.block(eval);
-               else
-#endif /* __BLOCKS__ */
-                       _e_err_exit.func(eval);
-       exit(eval);
-}
-
-void
-errx(int eval, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       verrx(eval, fmt, ap);
-       va_end(ap);
-}
-
-void
-verrx(int eval, const char *fmt, va_list ap)
-{
-       if (_e_err_file == 0)
-               err_set_file((FILE *)0);
-       fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL)
-               _e_visprintf(_e_err_file, fmt, ap);
-       fprintf(_e_err_file, "\n");
-       if (_e_err_exit.type)
-#ifdef __BLOCKS__
-               if (_e_err_exit.type == ERR_EXIT_BLOCK)
-                       _e_err_exit.block(eval);
-               else
-#endif /* __BLOCKS__ */
-                       _e_err_exit.func(eval);
-       exit(eval);
-}
-
-__weak_reference(_warn, warn);
-
-void
-_warn(const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       vwarnc(errno, fmt, ap);
-       va_end(ap);
-}
-
-void
-vwarn(const char *fmt, va_list ap)
-{
-       vwarnc(errno, fmt, ap);
-}
-
-void
-warnc(int code, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       vwarnc(code, fmt, ap);
-       va_end(ap);
-}
-
-void
-vwarnc(int code, const char *fmt, va_list ap)
-{
-       if (_e_err_file == 0)
-               err_set_file((FILE *)0);
-       fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL) {
-               _e_visprintf(_e_err_file, fmt, ap);
-               fprintf(_e_err_file, ": ");
-       }
-       fprintf(_e_err_file, "%s\n", strerror(code));
-}
-
-void
-warnx(const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-       vwarnx(fmt, ap);
-       va_end(ap);
-}
-
-void
-vwarnx(const char *fmt, va_list ap)
-{
-       if (_e_err_file == 0)
-               err_set_file((FILE *)0);
-       fprintf(_e_err_file, "%s: ", _getprogname());
-       if (fmt != NULL)
-               _e_visprintf(_e_err_file, fmt, ap);
-       fprintf(_e_err_file, "\n");
-}
diff --git a/gen/err.3 b/gen/err.3
deleted file mode 100644 (file)
index a4c953f..0000000
--- a/gen/err.3
+++ /dev/null
@@ -1,263 +0,0 @@
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    From: @(#)err.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/err.3,v 1.24 2008/10/31 15:14:40 rwatson Exp $
-.\"
-.Dd May 20, 2008
-.Dt ERR 3
-.Os
-.Sh NAME
-.Nm err ,
-.Nm verr ,
-.Nm errc ,
-.Nm verrc ,
-.Nm errx ,
-.Nm verrx ,
-.Nm warn ,
-.Nm vwarn ,
-.Nm warnc ,
-.Nm vwarnc ,
-.Nm warnx ,
-.Nm vwarnx ,
-.Nm err_set_exit ,
-#ifdef UNIFDEF_BLOCKS
-.Nm err_set_exit_b ,
-#endif
-.Nm err_set_file
-.Nd formatted error messages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In err.h
-.Ft void
-.Fn err "int eval" "const char *fmt" "..."
-.Ft void
-.Fn err_set_exit "void (*exitf)(int)"
-#ifdef UNIFDEF_BLOCKS
-.Ft void
-.Fn err_set_exit_b "void (^exitb)(int)"
-#endif
-.Ft void
-.Fn err_set_file "void *vfp"
-.Ft void
-.Fn errc "int eval" "int code" "const char *fmt" "..."
-.Ft void
-.Fn errx "int eval" "const char *fmt" "..."
-.Ft void
-.Fn warn "const char *fmt" "..."
-.Ft void
-.Fn warnc "int code" "const char *fmt" "..."
-.Ft void
-.Fn warnx "const char *fmt" "..."
-.In stdarg.h
-.Ft void
-.Fn verr "int eval" "const char *fmt" "va_list args"
-.Ft void
-.Fn verrc "int eval" "int code" "const char *fmt" "va_list args"
-.Ft void
-.Fn verrx "int eval" "const char *fmt" "va_list args"
-.Ft void
-.Fn vwarn "const char *fmt" "va_list args"
-.Ft void
-.Fn vwarnc "int code" "const char *fmt" "va_list args"
-.Ft void
-.Fn vwarnx "const char *fmt" "va_list args"
-.Sh DESCRIPTION
-The
-.Fn err
-and
-.Fn warn
-family of functions display a formatted error message on the standard
-error output, or on another file specified using the
-.Fn err_set_file
-function.
-In all cases, the last component of the program name, a colon character,
-and a space are output.
-If the
-.Fa fmt
-argument is not NULL, the
-.Xr printf 3 Ns
--like formatted error message is output.
-The output is terminated by a newline character.
-.Pp
-The
-.Fn err ,
-.Fn errc ,
-.Fn verr ,
-.Fn verrc ,
-.Fn warn ,
-.Fn warnc ,
-.Fn vwarn ,
-and
-.Fn vwarnc
-functions append an error message obtained from
-.Xr strerror 3
-based on a supplied error code value or the global variable
-.Va errno ,
-preceded by another colon and space unless the
-.Fa fmt
-argument is
-.Dv NULL .
-.Pp
-In the case of the
-.Fn errc ,
-.Fn verrc ,
-.Fn warnc ,
-and
-.Fn vwarnc
-functions,
-the
-.Fa code
-argument is used to look up the error message.
-.Pp
-The
-.Fn err ,
-.Fn verr ,
-.Fn warn ,
-and
-.Fn vwarn
-functions use the global variable
-.Va errno
-to look up the error message.
-.Pp
-The
-.Fn errx
-and
-.Fn warnx
-functions do not append an error message.
-.Pp
-The
-.Fn err ,
-.Fn verr ,
-.Fn errc ,
-.Fn verrc ,
-.Fn errx ,
-and
-.Fn verrx
-functions do not return, but exit with the value of the argument
-.Fa eval .
-It is recommended that the standard values defined in
-.Xr sysexits 3
-be used for the value of
-.Fa eval .
-The
-.Fn err_set_exit
-function can be used to specify a function which is called before
-.Xr exit 3
-to perform any necessary cleanup; passing a null function pointer for
-.Va exitf
-resets the hook to do nothing.
-#ifdef UNIFDEF_BLOCKS
-The
-.Fn err_set_exit_b
-function is like
-.Fn err_set_exit
-except it takes a block pointer instead of a function pointer.
-.Bd -ragged -offset indent
-Note: The
-.Fn Block_copy
-function (defined in
-.In Blocks.h )
-is used by
-.Fn err_set_exit_b
-to make a copy of the block, especially for the case when a stack-based
-block might go out of scope when the subroutine returns.
-.Ed
-.Pp
-#endif
-The
-.Fn err_set_file
-function sets the output stream used by the other functions.
-Its
-.Fa vfp
-argument must be either a pointer to an open stream
-(possibly already converted to void *)
-or a null pointer
-(in which case the output stream is set to standard error).
-.Sh EXAMPLES
-Display the current errno information string and exit:
-.Bd -literal -offset indent
-if ((p = malloc(size)) == NULL)
-       err(EX_OSERR, NULL);
-if ((fd = open(file_name, O_RDONLY, 0)) == -1)
-       err(EX_NOINPUT, "%s", file_name);
-.Ed
-.Pp
-Display an error message and exit:
-.Bd -literal -offset indent
-if (tm.tm_hour < START_TIME)
-       errx(EX_DATAERR, "too early, wait until %s",
-           start_time_string);
-.Ed
-.Pp
-Warn of an error:
-.Bd -literal -offset indent
-if ((fd = open(raw_device, O_RDONLY, 0)) == -1)
-       warnx("%s: %s: trying the block device",
-           raw_device, strerror(errno));
-if ((fd = open(block_device, O_RDONLY, 0)) == -1)
-       err(EX_OSFILE, "%s", block_device);
-.Ed
-.Pp
-Warn of an error without using the global variable
-.Va errno :
-.Bd -literal -offset indent
-error = my_function(); /* returns a value from <errno.h> */
-if (error != 0)
-       warnc(error, "my_function");
-.Ed
-.Sh SEE ALSO
-.Xr exit 3 ,
-.Xr fmtmsg 3 ,
-.Xr printf 3 ,
-.Xr strerror 3 ,
-.Xr sysexits 3
-.Sh HISTORY
-The
-.Fn err
-and
-.Fn warn
-functions first appeared in
-.Bx 4.4 .
-The
-.Fn err_set_exit
-and
-.Fn err_set_file
-functions first appeared in
-.Fx 2.1 .
-The
-.Fn errc
-and
-.Fn warnc
-functions first appeared in
-.Fx 3.0 .
-#ifdef UNIFDEF_BLOCKS
-The
-.Fn err_set_exit_b
-function first appeared in Mac OS X 10.6.
-#endif
index d0c2cd6f9c47ed7b8f7e7ad48c649008ff9dc640..bde5422cedf91dc342fd21da169ae26123366c01 100644 (file)
@@ -184,6 +184,8 @@ const char *const sys_errlist[] = {
        "Policy not found",                     /* 103 - ENOPOLICY */
        "State not recoverable",                /* 104 - ENOTRECOVERABLE */
        "Previous owner died",                  /* 105 - EOWNERDEAD */
+
+       "Interface output queue is full",       /* 106 - EQFULL */
 };
 
 const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);
diff --git a/gen/exec-fbsd.c b/gen/exec-fbsd.c
deleted file mode 100644 (file)
index 86cf335..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)exec.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/exec.c,v 1.27 2009/12/05 18:55:16 ed Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <paths.h>
-
-#include <stdarg.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-
-int
-_execvpe(const char *name, char * const argv[], char * const envp[]);
-
-int
-execl(const char *name, const char *arg, ...)
-{
-       va_list ap;
-       const char **argv;
-       int n;
-
-       va_start(ap, arg);
-       n = 1;
-       while (va_arg(ap, char *) != NULL)
-               n++;
-       va_end(ap);
-       argv = alloca((n + 1) * sizeof(*argv));
-       if (argv == NULL) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       va_start(ap, arg);
-       n = 1;
-       argv[0] = arg;
-       while ((argv[n] = va_arg(ap, char *)) != NULL)
-               n++;
-       va_end(ap);
-       return (_execve(name, __DECONST(char **, argv), environ));
-}
-
-int
-execle(const char *name, const char *arg, ...)
-{
-       va_list ap;
-       const char **argv;
-       char **envp;
-       int n;
-
-       va_start(ap, arg);
-       n = 1;
-       while (va_arg(ap, char *) != NULL)
-               n++;
-       va_end(ap);
-       argv = alloca((n + 1) * sizeof(*argv));
-       if (argv == NULL) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       va_start(ap, arg);
-       n = 1;
-       argv[0] = arg;
-       while ((argv[n] = va_arg(ap, char *)) != NULL)
-               n++;
-       envp = va_arg(ap, char **);
-       va_end(ap);
-       return (_execve(name, __DECONST(char **, argv), envp));
-}
-
-int
-execlp(const char *name, const char *arg, ...)
-{
-       va_list ap;
-       const char **argv;
-       int n;
-
-       va_start(ap, arg);
-       n = 1;
-       while (va_arg(ap, char *) != NULL)
-               n++;
-       va_end(ap);
-       argv = alloca((n + 1) * sizeof(*argv));
-       if (argv == NULL) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       va_start(ap, arg);
-       n = 1;
-       argv[0] = arg;
-       while ((argv[n] = va_arg(ap, char *)) != NULL)
-               n++;
-       va_end(ap);
-       return (execvp(name, __DECONST(char **, argv)));
-}
-
-int
-execv(name, argv)
-       const char *name;
-       char * const *argv;
-{
-       (void)_execve(name, argv, environ);
-       return (-1);
-}
-
-int
-execvp(const char *name, char * const *argv)
-{
-       return (_execvpe(name, argv, environ));
-}
-
-static int
-execvPe(const char *name, const char *path, char * const *argv,
-    char * const *envp)
-{
-       const char **memp;
-       size_t cnt, lp, ln;
-       int eacces, save_errno;
-       char *cur, buf[MAXPATHLEN];
-       const char *p, *bp;
-       struct stat sb;
-
-       eacces = 0;
-
-       /* If it's an absolute or relative path name, it's easy. */
-       if (index(name, '/')) {
-               bp = name;
-               cur = NULL;
-               goto retry;
-       }
-       bp = buf;
-
-       /* If it's an empty path name, fail in the usual POSIX way. */
-       if (*name == '\0') {
-               errno = ENOENT;
-               return (-1);
-       }
-
-       cur = alloca(strlen(path) + 1);
-       if (cur == NULL) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       strcpy(cur, path);
-       while ((p = strsep(&cur, ":")) != NULL) {
-               /*
-                * It's a SHELL path -- double, leading and trailing colons
-                * mean the current directory.
-                */
-               if (*p == '\0') {
-                       p = ".";
-                       lp = 1;
-               } else
-                       lp = strlen(p);
-               ln = strlen(name);
-
-               /*
-                * If the path is too long complain.  This is a possible
-                * security issue; given a way to make the path too long
-                * the user may execute the wrong program.
-                */
-               if (lp + ln + 2 > sizeof(buf)) {
-                       (void)_write(STDERR_FILENO, "execvP: ", 8);
-                       (void)_write(STDERR_FILENO, p, lp);
-                       (void)_write(STDERR_FILENO, ": path too long\n",
-                           16);
-                       continue;
-               }
-               bcopy(p, buf, lp);
-               buf[lp] = '/';
-               bcopy(name, buf + lp + 1, ln);
-               buf[lp + ln + 1] = '\0';
-
-retry:         (void)_execve(bp, argv, envp);
-               switch (errno) {
-               case E2BIG:
-                       goto done;
-               case ELOOP:
-               case ENAMETOOLONG:
-               case ENOENT:
-                       break;
-               case ENOEXEC:
-                       for (cnt = 0; argv[cnt]; ++cnt)
-                               ;
-                       memp = alloca((cnt + 2) * sizeof(char *));
-                       if (memp == NULL) {
-                               /* errno = ENOMEM; XXX override ENOEXEC? */
-                               goto done;
-                       }
-                       memp[0] = "sh";
-                       memp[1] = bp;
-                       bcopy(argv + 1, memp + 2, cnt * sizeof(char *));
-                       (void)_execve(_PATH_BSHELL,
-                           __DECONST(char **, memp), envp);
-                       goto done;
-               case ENOMEM:
-                       goto done;
-               case ENOTDIR:
-                       break;
-               case ETXTBSY:
-                       /*
-                        * We used to retry here, but sh(1) doesn't.
-                        */
-                       goto done;
-               default:
-                       /*
-                        * EACCES may be for an inaccessible directory or
-                        * a non-executable file.  Call stat() to decide
-                        * which.  This also handles ambiguities for EFAULT
-                        * and EIO, and undocumented errors like ESTALE.
-                        * We hope that the race for a stat() is unimportant.
-                        */
-                       save_errno = errno;
-                       if (stat(bp, &sb) != 0)
-                               break;
-                       if (save_errno == EACCES) {
-                               eacces = 1;
-                               continue;
-                       }
-                       errno = save_errno;
-                       goto done;
-               }
-       }
-       if (eacces)
-               errno = EACCES;
-       else if (cur)
-               errno = ENOENT;
-       /* else use existing errno from _execve */
-done:
-       return (-1);
-}
-
-int
-execvP(const char *name, const char *path, char * const argv[])
-{
-       return execvPe(name, path, argv, environ);
-}
-
-__private_extern__ int
-_execvpe(const char *name, char * const argv[], char * const envp[])
-{
-       const char *path;
-
-       /* Get the path we're searching. */
-       if ((path = getenv("PATH")) == NULL)
-               path = _PATH_DEFPATH;
-
-       return (execvPe(name, path, argv, envp));
-}
diff --git a/gen/exec.3 b/gen/exec.3
deleted file mode 100644 (file)
index 2f49ef3..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)exec.3     8.3 (Berkeley) 1/24/94
-.\" $FreeBSD: src/lib/libc/gen/exec.3,v 1.28 2008/06/23 05:22:06 ed Exp $
-.\"
-.Dd January 24, 1994
-.Dt EXEC 3
-.Os
-.Sh NAME
-.Nm execl ,
-.Nm execle ,
-.Nm execlp ,
-.Nm execv ,
-.Nm execvp ,
-.Nm execvP
-.Nd execute a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Vt extern char **environ ;
-.Ft int
-.Fo execl
-.Fa "const char *path"
-.Fa "const char *arg0"
-.Fa ... /* "(char *)0" */
-.Fc
-.Ft int
-.Fo execle
-.Fa "const char *path"
-.Fa "const char *arg0"
-.Fa ...
-.Fa /*
-.Bk -words
-.Fa "(char *)0" "char *const envp[]" */
-.Ek
-.Fc
-.Ft int
-.Fo execlp
-.Fa "const char *file"
-.Fa "const char *arg0"
-.Fa ... /* "(char *)0" */
-.Fc
-.Ft int
-.Fo execv
-.Fa "const char *path"
-.Fa "char *const argv[]"
-.Fc
-.Ft int
-.Fo execvp
-.Fa "const char *file"
-.Fa "char *const argv[]"
-.Fc
-.Ft int
-.Fo execvP
-.Fa "const char *file"
-.Fa "const char *search_path"
-.Fa "char *const argv[]"
-.Fc
-.Sh DESCRIPTION
-The
-.Nm exec
-family of functions replaces the current process image with a
-new process image.
-The functions described in this manual page are front-ends for the function
-.Xr execve 2 .
-(See the manual page for
-.Xr execve 2
-for detailed information about the replacement of the current process.)
-.Pp
-The initial argument for these functions is the pathname of a file which
-is to be executed.
-.Pp
-The
-.Fa "const char *arg0"
-and subsequent ellipses in the
-.Fn execl ,
-.Fn execlp ,
-and
-.Fn execle
-functions can be thought of as
-.Em arg0 ,
-.Em arg1 ,
-\&...,
-.Em argn .
-Together they describe a list of one or more pointers to null-terminated
-strings that represent the argument list available to the executed program.
-The first argument, by convention, should point to the file name associated
-with the file being executed.
-The list of arguments
-.Em must
-be terminated by a
-.Dv NULL
-pointer.
-.Pp
-The
-.Fn execv ,
-.Fn execvp ,
-and
-.Fn execvP
-functions provide an array of pointers to null-terminated strings that
-represent the argument list available to the new program.
-The first argument, by convention, should point to the file name associated
-with the file being executed.
-The array of pointers
-.Sy must
-be terminated by a
-.Dv NULL
-pointer.
-.Pp
-The
-.Fn execle
-function also specifies the environment of the executed process
-by following the
-.Dv NULL
-pointer that terminates the list of arguments in the argument list
-or the pointer to the argv array with an additional argument.
-This additional argument is an array of pointers to null-terminated strings
-and
-.Em must
-be terminated by a
-.Dv NULL
-pointer.
-The other functions take the environment for the new process image from the
-external variable
-.Va environ
-in the current process.
-.Pp
-Some of these functions have special semantics.
-.Pp
-The functions
-.Fn execlp ,
-.Fn execvp ,
-and
-.Fn execvP
-will duplicate the actions of the shell in searching for an executable file
-if the specified file name does not contain a slash
-.Dq Li /
-character.
-For
-.Fn execlp
-and
-.Fn execvp ,
-search path is the path specified in the environment by
-.Dq Ev PATH
-variable.
-If this variable is not specified,
-the default path is set according to the
-.Dv _PATH_DEFPATH
-definition in
-.In paths.h ,
-which is set to
-.Dq Ev /usr/bin:/bin .
-For
-.Fn execvP ,
-the search path is specified as an argument to the function.
-In addition, certain errors are treated specially.
-.Pp
-If an error is ambiguous (for simplicity, we shall consider all
-errors except
-.Er ENOEXEC
-as being ambiguous here, although only the critical error
-.Er EACCES
-is really ambiguous),
-then these functions will act as if they stat the file to determine
-whether the file exists and has suitable execute permissions.
-If it does, they will return immediately with the global variable
-.Va errno
-restored to the value set by
-.Fn execve .
-Otherwise, the search will be continued.
-If the search completes without performing a successful
-.Fn execve
-or terminating due to an error,
-these functions will return with the global variable
-.Va errno
-set to
-.Er EACCES
-or
-.Er ENOENT
-according to whether at least one file with suitable execute permissions
-was found.
-.Pp
-If the header of a file is not recognized (the attempted
-.Fn execve
-returned
-.Er ENOEXEC ) ,
-these functions will execute the shell with the path of
-the file as its first argument.
-(If this attempt fails, no further searching is done.)
-.Sh RETURN VALUES
-If any of the
-.Fn exec
-functions returns, an error will have occurred.
-The return value is \-1, and the global variable
-.Va errno
-will be set to indicate the error.
-.Sh FILES
-.Bl -tag -width /bin/sh -compact
-.It Pa /bin/sh
-The shell.
-.El
-.Sh COMPATIBILITY
-Historically, the default path for the
-.Fn execlp
-and
-.Fn execvp
-functions was
-.Dq Pa :/bin:/usr/bin .
-This was changed to place the current directory last to enhance system
-security.
-.Pp
-The behavior of
-.Fn execlp
-and
-.Fn execvp
-when errors occur while attempting to execute the file is not quite historic
-practice, and has not traditionally been documented and is not specified
-by the
-.Tn POSIX
-standard.
-.Pp
-Traditionally, the functions
-.Fn execlp
-and
-.Fn execvp
-ignored all errors except for the ones described above and
-.Er ETXTBSY ,
-upon which they retried after sleeping for several seconds, and
-.Er ENOMEM
-and
-.Er E2BIG ,
-upon which they returned.
-They now return for
-.Er ETXTBSY ,
-and determine existence and executability more carefully.
-In particular,
-.Er EACCES
-for inaccessible directories in the path prefix is no longer
-confused with
-.Er EACCES
-for files with unsuitable execute permissions.
-In
-.Bx 4.4 ,
-they returned upon all errors except
-.Er EACCES ,
-.Er ENOENT ,
-.Er ENOEXEC
-and
-.Er ETXTBSY .
-This was inferior to the traditional error handling,
-since it breaks the ignoring of errors for path prefixes
-and only improves the handling of the unusual ambiguous error
-.Er EFAULT
-and the unusual error
-.Er EIO .
-The behaviour was changed to match the behaviour of
-.Xr sh 1 .
-.Sh ERRORS
-The
-.Fn execl ,
-.Fn execle ,
-.Fn execlp ,
-.Fn execvp ,
-and
-.Fn execvP
-functions
-may fail and set
-.Va errno
-for any of the errors specified for the library functions
-.Xr execve 2
-and
-.Xr malloc 3 .
-.Pp
-The
-.Fn execv
-function may fail and set
-.Va errno
-for any of the errors specified for the library function
-.Xr execve 2 .
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr execve 2 ,
-.Xr fork 2 ,
-.Xr ptrace 2 ,
-.Xr environ 7
-.Sh STANDARDS
-The
-.Fn execl ,
-.Fn execv ,
-.Fn execle ,
-.Fn execlp ,
-and
-.Fn execvp
-functions
-conform to
-.St -p1003.1-88 .
-The
-.Fn execvP
-function first appeared in
-.Fx 5.2 .
diff --git a/gen/fmtcheck-fbsd.c b/gen/fmtcheck-fbsd.c
deleted file mode 120000 (symlink)
index b7c0fe8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fmtcheck.c
\ No newline at end of file
diff --git a/gen/fmtcheck.3 b/gen/fmtcheck.3
deleted file mode 120000 (symlink)
index a1e1fc6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fmtcheck.3
\ No newline at end of file
diff --git a/gen/fmtmsg-fbsd.c b/gen/fmtmsg-fbsd.c
deleted file mode 100644 (file)
index e912693..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*-
- * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/fmtmsg.c,v 1.6 2009/11/08 14:02:54 brueffer Exp $");
-
-#include <fmtmsg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* Default value for MSGVERB. */
-#define        DFLT_MSGVERB    "label:severity:text:action:tag"
-
-/* Maximum valid size for a MSGVERB. */
-#define        MAX_MSGVERB     sizeof(DFLT_MSGVERB)
-
-static char    *printfmt(char *, long, const char *, int, const char *,
-                   const char *, const char *);
-static char    *nextcomp(const char *);
-static const char
-               *sevinfo(int);
-static int      validmsgverb(const char *);
-
-static const char *validlist[] = {
-       "label", "severity", "text", "action", "tag", NULL
-};
-
-int
-fmtmsg(long class, const char *label, int sev, const char *text,
-    const char *action, const char *tag)
-{
-       FILE *fp;
-       char *env, *msgverb, *output;
-       int ret = MM_OK;
-
-       if (action == NULL) action = "";
-
-       if (class & MM_PRINT) {
-               if ((env = getenv("MSGVERB")) != NULL && *env != '\0' &&
-                   strlen(env) <= strlen(DFLT_MSGVERB)) {
-                       if ((msgverb = strdup(env)) == NULL)
-                               return (MM_NOTOK);
-                       else if (validmsgverb(msgverb) == 0) {
-                               free(msgverb);
-                               goto def;
-                       }
-               } else {
-def:
-                       if ((msgverb = strdup(DFLT_MSGVERB)) == NULL)
-                               return (MM_NOTOK);
-               }
-               output = printfmt(msgverb, class, label, sev, text, action,
-                   tag);
-               if (output == NULL) {
-                       free(msgverb);
-                       return (MM_NOTOK);
-               }
-               if (*output != '\0') {
-                       int out_len = fprintf(stderr, "%s", output);
-                       if (out_len < 0) {
-                           ret = MM_NOMSG;
-                       }
-               }
-               free(msgverb);
-               free(output);
-       }
-       if (class & MM_CONSOLE) {
-               output = printfmt(DFLT_MSGVERB, class, label, sev, text,
-                   action, tag);
-               if (output == NULL)
-                       return (MM_NOCON);
-               if (*output != '\0') {
-
-/*
-//                        /-------------\
-//                       /               \
-//                      /                 \
-//                     /                   \
-//                     |   XXXX     XXXX   |
-//                     |   XXXX     XXXX   |
-//                     |   XXX       XXX   |
-//                     \         X         /
-//                      --\     XXX     /--
-//                       | |    XXX    | |
-//                       | |           | |
-//                       | I I I I I I I |
-//                       |  I I I I I I  |
-//                        \             /
-//                         --         --
-//                           \-------/
-//
-//                      DO NOT INTEGRATE THIS CHANGE
-//
-//                      Integrating it means DEATH.
-//               (see Revelation 6:8 for full details)
-
-                       XXX this is a *huge* kludge to pass the SuSv3 tests,
-                         I don't think of it as cheating because they are
-                         looking in the wrong place (/realdev/console) to do
-                         their testing, but they can't look in the "right"
-                         place for various reasons */
-                       char *cpath = "/dev/console";
-                       struct stat sb;
-                       int rc = stat("/realdev/console", &sb);
-                       if (rc == 0 && (sb.st_mode & S_IFDIR)) {
-                           cpath = "/realdev/console";
-                       }
-                       /* XXX thus ends the kludge - changes after
-                         this point may be safely integrated */
-
-                       if ((fp = fopen(cpath, "a")) == NULL) {
-                               if (ret == MM_OK) {
-                                   ret = MM_NOCON;
-                               } else {
-                                   ret = MM_NOTOK;
-                               }
-                       } else {
-                           fprintf(fp, "%s", output);
-                           fclose(fp);
-                       }
-               }
-               free(output);
-       }
-       return (ret);
-}
-
-#define INSERT_COLON                                                   \
-       if (*output != '\0')                                            \
-               strlcat(output, ": ", size)
-#define INSERT_NEWLINE                                                 \
-       if (*output != '\0')                                            \
-               strlcat(output, "\n", size)
-#define INSERT_SPACE                                                   \
-       if (*output != '\0')                                            \
-               strlcat(output, " ", size)
-
-/*
- * Returns NULL on memory allocation failure, otherwise returns a pointer to
- * a newly malloc()'d output buffer.
- */
-static char *
-printfmt(char *msgverb, long class, const char *label, int sev,
-    const char *text, const char *act, const char *tag)
-{
-       size_t size;
-       char *comp, *output;
-       const char *sevname;
-
-       size = 32;
-       if (label != MM_NULLLBL)
-               size += strlen(label);
-       if ((sevname = sevinfo(sev)) != NULL)
-               size += strlen(sevname);
-       if (text != MM_NULLTXT)
-               size += strlen(text);
-       if (act != MM_NULLACT)
-               size += strlen(act);
-       if (tag != MM_NULLTAG)
-               size += strlen(tag);
-
-       if ((output = malloc(size)) == NULL)
-               return (NULL);
-       *output = '\0';
-       while ((comp = nextcomp(msgverb)) != NULL) {
-               if (strcmp(comp, "label") == 0 && label != MM_NULLLBL) {
-                       INSERT_COLON;
-                       strlcat(output, label, size);
-               } else if (strcmp(comp, "severity") == 0 && sevname != NULL) {
-                       INSERT_COLON;
-                       strlcat(output, sevinfo(sev), size);
-               } else if (strcmp(comp, "text") == 0 && text != MM_NULLTXT) {
-                       INSERT_COLON;
-                       strlcat(output, text, size);
-               } else if (strcmp(comp, "action") == 0 && act != MM_NULLACT) {
-                       INSERT_NEWLINE;
-                       strlcat(output, "TO FIX: ", size);
-                       strlcat(output, act, size);
-               } else if (strcmp(comp, "tag") == 0 && tag != MM_NULLTAG) {
-                       INSERT_SPACE;
-                       strlcat(output, tag, size);
-               }
-       }
-       INSERT_NEWLINE;
-       return (output);
-}
-
-/*
- * Returns a component of a colon delimited string.  NULL is returned to
- * indicate that there are no remaining components.  This function must be
- * called until it returns NULL in order for the local state to be cleared.
- */
-static char *
-nextcomp(const char *msgverb)
-{
-       static char lmsgverb[MAX_MSGVERB], *state;
-       char *retval;
-       
-       if (*lmsgverb == '\0') {
-               strlcpy(lmsgverb, msgverb, sizeof(lmsgverb));
-               retval = strtok_r(lmsgverb, ":", &state);
-       } else {
-               retval = strtok_r(NULL, ":", &state);
-       }
-       if (retval == NULL)
-               *lmsgverb = '\0';
-       return (retval);
-}
-
-static const char *
-sevinfo(int sev)
-{
-
-       switch (sev) {
-       case MM_HALT:
-               return ("HALT");
-       case MM_ERROR:
-               return ("ERROR");
-       case MM_WARNING:
-               return ("WARNING");
-       case MM_INFO:
-               return ("INFO");
-       default:
-               return (NULL);
-       }
-}
-
-/*
- * Returns 1 if the msgverb list is valid, otherwise 0.
- */
-static int
-validmsgverb(const char *msgverb)
-{
-       char *msgcomp;
-       int i, equality;
-
-       equality = 0;
-       while ((msgcomp = nextcomp(msgverb)) != NULL) {
-               equality--;
-               for (i = 0; validlist[i] != NULL; i++) {
-                       if (strcmp(msgcomp, validlist[i]) == 0)
-                               equality++;
-               }
-       }
-       return (!equality);
-}
diff --git a/gen/fmtmsg.3 b/gen/fmtmsg.3
deleted file mode 120000 (symlink)
index a22c44c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fmtmsg.3
\ No newline at end of file
diff --git a/gen/fnmatch-fbsd.c b/gen/fnmatch-fbsd.c
deleted file mode 100644 (file)
index 51a1f97..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 1989, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fnmatch.c  8.2 (Berkeley) 4/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/fnmatch.c,v 1.19 2010/04/16 22:29:24 jilles Exp $");
-
-#include "xlocale_private.h"
-
-/*
- * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
- * Compares a filename or pathname to a pattern.
- */
-
-/*
- * Some notes on multibyte character support:
- * 1. Patterns with illegal byte sequences match nothing.
- * 2. Illegal byte sequences in the "string" argument are handled by treating
- *    them as single-byte characters with a value of the first byte of the
- *    sequence cast to wchar_t.
- * 3. Multibyte conversion state objects (mbstate_t) are passed around and
- *    used for most, but not all, conversions. Further work will be required
- *    to support state-dependent encodings.
- */
-
-#include <fnmatch.h>
-#include <limits.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "collate.h"
-
-#define        EOS     '\0'
-
-#define RETURN_ERROR   2       /* neither 0 or FNM_NOMATCH */
-#define RANGE_MATCH     1
-#define RANGE_NOMATCH   0
-#define RANGE_ERROR     (-1)
-
-#define RECURSION_MAX  64
-
-__private_extern__ int rangematch(const char *, wchar_t, const char *, int, char **, char **, mbstate_t *, mbstate_t *, locale_t);
-static int fnmatch1(const char *, const char *, const char *, int, mbstate_t,
-               mbstate_t, locale_t, int);
-
-int
-fnmatch(pattern, string, flags)
-       const char *pattern, *string;
-       int flags;
-{
-       static const mbstate_t initial;
-#if __DARWIN_UNIX03
-       return (fnmatch1(pattern, string, string, flags, initial, initial, __current_locale(), RECURSION_MAX));
-#else /* !__DARWIN_UNIX03 */
-       return (fnmatch1(pattern, string, string, flags, initial, initial, __current_locale(), RECURSION_MAX) != 0 ? FNM_NOMATCH : 0);
-#endif /* __DARWIN_UNIX03 */
-}
-
-static int
-fnmatch1(pattern, string, stringstart, flags, patmbs, strmbs, loc, recursion)
-       const char *pattern, *string, *stringstart;
-       int flags;
-       mbstate_t patmbs, strmbs;
-       locale_t loc;
-       int recursion;
-{
-       char *newp, *news;
-       char c;
-       wchar_t pc, sc;
-       size_t pclen, sclen;
-
-       if (recursion-- <= 0)
-               return RETURN_ERROR;
-       for (;;) {
-               pclen = mbrtowc_l(&pc, pattern, MB_LEN_MAX, &patmbs, loc);
-               if (pclen == (size_t)-1 || pclen == (size_t)-2)
-#if __DARWIN_UNIX03
-                       return (RETURN_ERROR);
-#else /* !__DARWIN_UNIX03 */
-                       return (FNM_NOMATCH);
-#endif /* __DARWIN_UNIX03 */
-               pattern += pclen;
-               sclen = mbrtowc_l(&sc, string, MB_LEN_MAX, &strmbs, loc);
-               if (sclen == (size_t)-1 || sclen == (size_t)-2) {
-                       sc = (unsigned char)*string;
-                       sclen = 1;
-                       memset(&strmbs, 0, sizeof(strmbs));
-               }
-               switch (pc) {
-               case EOS:
-                       if ((flags & FNM_LEADING_DIR) && sc == '/')
-                               return (0);
-                       return (sc == EOS ? 0 : FNM_NOMATCH);
-               case '?':
-                       if (sc == EOS)
-                               return (FNM_NOMATCH);
-                       if (sc == '/' && (flags & FNM_PATHNAME))
-                               return (FNM_NOMATCH);
-                       if (sc == '.' && (flags & FNM_PERIOD) &&
-                           (string == stringstart ||
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
-                       string += sclen;
-                       break;
-               case '*':
-                       c = *pattern;
-                       /* Collapse multiple stars. */
-                       while (c == '*')
-                               c = *++pattern;
-
-                       if (sc == '.' && (flags & FNM_PERIOD) &&
-                           (string == stringstart ||
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
-
-                       /* Optimize for pattern with * at end or before /. */
-                       if (c == EOS)
-                               if (flags & FNM_PATHNAME)
-                                       return ((flags & FNM_LEADING_DIR) ||
-                                           strchr(string, '/') == NULL ?
-                                           0 : FNM_NOMATCH);
-                               else
-                                       return (0);
-                       else if (c == '/' && flags & FNM_PATHNAME) {
-                               if ((string = strchr(string, '/')) == NULL)
-                                       return (FNM_NOMATCH);
-                               break;
-                       }
-
-                       /* General case, use recursion. */
-                       int ret;
-                       while (sc != EOS) {
-                               if ((ret = fnmatch1(pattern, string, stringstart,
-                                   flags, patmbs, strmbs, loc, recursion)) != FNM_NOMATCH)
-                                       return (ret);
-                               sclen = mbrtowc_l(&sc, string, MB_LEN_MAX,
-                                   &strmbs, loc);
-                               if (sclen == (size_t)-1 ||
-                                   sclen == (size_t)-2) {
-                                       sc = (unsigned char)*string;
-                                       sclen = 1;
-                                       memset(&strmbs, 0, sizeof(strmbs));
-                               }
-                               if (sc == '/' && flags & FNM_PATHNAME)
-                                       break;
-                               string += sclen;
-                       }
-                       return (FNM_NOMATCH);
-               case '[':
-                       if (sc == EOS)
-                               return (FNM_NOMATCH);
-                       if (sc == '/' && (flags & FNM_PATHNAME))
-                               return (FNM_NOMATCH);
-                       if (sc == '.' && (flags & FNM_PERIOD) &&
-                           (string == stringstart ||
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
-
-                       switch (rangematch(pattern, sc, string + sclen, flags,
-                           &newp, &news, &patmbs, &strmbs, loc)) {
-                       case RANGE_ERROR:
-#if __DARWIN_UNIX03
-                               return (RETURN_ERROR);
-#else /* !__DARWIN_UNIX03 */
-                               goto norm;
-#endif /* __DARWIN_UNIX03 */
-                       case RANGE_MATCH:
-                               pattern = newp;
-                               string = news;
-                               break;
-                       case RANGE_NOMATCH:
-                               return (FNM_NOMATCH);
-                       }
-                       break;
-               case '\\':
-                       if (!(flags & FNM_NOESCAPE)) {
-                               pclen = mbrtowc_l(&pc, pattern, MB_LEN_MAX,
-                                   &patmbs, loc);
-                               if (pclen == (size_t)-1 || pclen == (size_t)-2)
-#if __DARWIN_UNIX03
-                                       return (RETURN_ERROR);
-#else /* !__DARWIN_UNIX03 */
-                                       return (FNM_NOMATCH);
-#endif /* __DARWIN_UNIX03 */
-                               if (pclen == 0)
-                                       pc = '\\';
-                               pattern += pclen;
-                       }
-                       /* FALLTHROUGH */
-               default:
-#if !__DARWIN_UNIX03
-               norm:
-#endif /* !__DARWIN_UNIX03 */
-                       if (pc == sc)
-                               ;
-                       else if ((flags & FNM_CASEFOLD) &&
-                                (towlower_l(pc, loc) == towlower_l(sc, loc)))
-                               ;
-                       else
-                               return (FNM_NOMATCH);
-                       string += sclen;
-                       break;
-               }
-       }
-       /* NOTREACHED */
-}
-
-#ifndef BUILDING_VARIANT
-__private_extern__ int
-rangematch(pattern, test, string, flags, newp, news, patmbs, strmbs, loc)
-       const char *pattern, *string;
-       wchar_t test;
-       int flags;
-       char **newp, **news;
-       mbstate_t *patmbs, *strmbs;
-       locale_t loc;
-{
-       int negate, ok, special;
-       wchar_t c, c2;
-       wchar_t buf[STR_LEN];   /* STR_LEN defined in collate.h */
-       size_t pclen, sclen, len;
-       const char *origpat, *cp, *savestring;
-       mbstate_t save;
-
-       /*
-        * A bracket expression starting with an unquoted circumflex
-        * character produces unspecified results (IEEE 1003.2-1992,
-        * 3.13.2).  This implementation treats it like '!', for
-        * consistency with the regular expression syntax.
-        * J.T. Conklin (conklin@ngai.kaleida.com)
-        */
-       if ( (negate = (*pattern == '!' || *pattern == '^')) )
-               ++pattern;
-
-       if (flags & FNM_CASEFOLD)
-               test = towlower_l(test, loc);
-
-       /*
-        * A right bracket shall lose its special meaning and represent
-        * itself in a bracket expression if it occurs first in the list.
-        * -- POSIX.2 2.8.3.2
-        */
-       ok = 0;
-       origpat = pattern;
-       for (;;) {
-               c = 0;
-               if (*pattern == ']' && pattern > origpat) {
-                       break;
-               } else if (*pattern == '\0') {
-                       return (RANGE_ERROR);
-               } else if (*pattern == '/' && (flags & FNM_PATHNAME)) {
-                       return (RANGE_NOMATCH);
-               } else if (*pattern == '\\' && !(flags & FNM_NOESCAPE))
-                       pattern++;
-               else if (*pattern == '[' && ((special = *(pattern + 1)) == '.' || special == '=' || special == ':')) {
-                       cp = (pattern += 2);
-                       while(cp = strchr(cp, special)) {
-                               if (*(cp + 1) == ']')
-                                       break;
-                               cp++;
-                       }
-                       if (!cp)
-                               return (RANGE_ERROR);
-                       if (special == '.') {
-treat_like_collating_symbol:
-                               len = __collate_collating_symbol(buf, STR_LEN, pattern, cp - pattern, patmbs, loc);
-                               if (len == (size_t)-1 || len == 0)
-                                       return (RANGE_ERROR);
-                               pattern = cp + 2;
-                               if (len > 1) {
-                                       wchar_t *wp, sc;
-                                       /* no multi-character collation symbols as start of range */
-                                       if (*(cp + 2) == '-' && *(cp + 3) != EOS
-                                           && *(cp + 3) != ']')
-                                               return (RANGE_ERROR);
-                                       wp = buf;
-                                       if (test != *wp++)
-                                               continue;
-                                       if (len == 1) {
-                                               ok = 1;
-                                               break;
-                                       }
-                                       memcpy(&save, strmbs, sizeof(save));
-                                       savestring = string;
-                                       while (--len > 0) {
-                                               sclen = mbrtowc_l(&sc, string, MB_LEN_MAX, strmbs, loc);
-                                               if (sclen == (size_t)-1 || sclen == (size_t)-2) {
-                                                       sc = (unsigned char)*string;
-                                                       sclen = 1;
-                                                       memset(&strmbs, 0, sizeof(strmbs));
-                                               }
-                                               if (sc != *wp++) {
-                                                       memcpy(strmbs, &save, sizeof(save));
-                                                       string = savestring;
-                                                       break;
-                                               }
-                                               string += sclen;
-                                       }
-                                       if (len == 0) {
-                                               ok = 1;
-                                               break;
-                                       }
-                                       continue; /* no match */
-                               }
-                               c = *buf;
-                       } else if (special == '=') {
-                               int ec;
-                               memcpy(&save, patmbs, sizeof(save));
-                               ec = __collate_equiv_class(pattern, cp - pattern, patmbs, loc);
-                               if (ec < 0)
-                                       return (RANGE_ERROR);
-                               if (ec == 0) {
-                                       memcpy(patmbs, &save, sizeof(save));
-                                       goto treat_like_collating_symbol;
-                               }
-                               pattern = cp + 2;
-                               /* no equivalence classes as start of range */
-                               if (*(cp + 2) == '-' && *(cp + 3) != EOS &&
-                                   *(cp + 3) != ']')
-                                       return (RANGE_ERROR);
-                               len = __collate_equiv_match(ec, NULL, 0, test, string, strlen(string), strmbs, &sclen, loc);
-                               if (len < 0)
-                                       return (RANGE_ERROR);
-                               if (len > 0) {
-                                       ok = 1;
-                                       string += sclen;
-                                       break;
-                               }
-                               continue;
-                       } else { /* special == ':' */
-                               wctype_t charclass;
-                               char name[CHARCLASS_NAME_MAX + 1];
-                               /* no character classes as start of range */
-                               if (*(cp + 2) == '-' && *(cp + 3) != EOS &&
-                                   *(cp + 3) != ']')
-                                       return (RANGE_ERROR);
-                               /* assume character class names are ascii */
-                               if (cp - pattern > CHARCLASS_NAME_MAX)
-                                       return (RANGE_ERROR);
-                               strlcpy(name, pattern, cp - pattern + 1);
-                               pattern = cp + 2;
-                               if ((charclass = wctype(name)) == 0)
-                                       return (RANGE_ERROR);
-                               if (iswctype_l(test, charclass, loc)) {
-                                       ok = 1;
-                                       break;
-                               }
-                               continue;
-                       }
-               }
-               if (!c) {
-                       pclen = mbrtowc_l(&c, pattern, MB_LEN_MAX, patmbs, loc);
-                       if (pclen == (size_t)-1 || pclen == (size_t)-2)
-                               return (RANGE_ERROR);
-                       pattern += pclen;
-               }
-
-               if (flags & FNM_CASEFOLD)
-                       c = towlower_l(c, loc);
-
-               if (*pattern == '-' && *(pattern + 1) != EOS &&
-                   *(pattern + 1) != ']') {
-                       if (*++pattern == '\\' && !(flags & FNM_NOESCAPE))
-                               if (*pattern != EOS)
-                                       pattern++;
-                       pclen = mbrtowc_l(&c2, pattern, MB_LEN_MAX, patmbs, loc);
-                       if (pclen == (size_t)-1 || pclen == (size_t)-2)
-                               return (RANGE_ERROR);
-                       pattern += pclen;
-                       if (c2 == EOS)
-                               return (RANGE_ERROR);
-
-                       if (c2 == '[' && (special = *pattern) == '.' || special == '=' || special == ':') {
-                               /* no equivalence classes or character classes as end of range */
-                               if (special == '=' || special == ':')
-                                       return (RANGE_ERROR);
-                               cp = ++pattern;
-                               while(cp = strchr(cp, special)) {
-                                       if (*(cp + 1) == ']')
-                                               break;
-                                       cp++;
-                               }
-                               if (!cp)
-                                       return (RANGE_ERROR);
-                               len = __collate_collating_symbol(buf, STR_LEN, pattern, cp - pattern, patmbs, loc);
-                               /* no multi-character collation symbols as end of range */
-                               if (len != 1)
-                                       return (RANGE_ERROR);
-                               pattern = cp + 2;
-                               c2 = *buf;
-                       }
-
-                       if (flags & FNM_CASEFOLD)
-                               c2 = towlower_l(c2, loc);
-
-                       if (loc->__collate_load_error ?
-                           c <= test && test <= c2 :
-                              __collate_range_cmp(c, test, loc) <= 0
-                           && __collate_range_cmp(test, c2, loc) <= 0
-                          ) {
-                               ok = 1;
-                               break;
-                       }
-               } else if (c == test) {
-                       ok = 1;
-                       break;
-               }
-       }
-       /* go to end of bracket expression */
-       special = 0;
-       while(*pattern != ']') {
-               if (*pattern == 0)
-                       return (RANGE_ERROR);
-               if (*pattern == special) {
-                       if (*++pattern == ']') {
-                               special = 0;
-                               pattern++;
-                       }
-                       continue;
-               }
-               if (!special && *pattern == '[') {
-                       special = *++pattern;
-                       if (special != '.' && special != '=' && special != ':')
-                               special = 0;
-                       else
-                               pattern++;
-                       continue;
-               }
-               pclen = mbrtowc_l(&c, pattern, MB_LEN_MAX, patmbs, loc);
-               if (pclen == (size_t)-1 || pclen == (size_t)-2)
-                       return (RANGE_ERROR);
-               pattern += pclen;
-       }
-
-       *newp = (char *)++pattern;
-       *news = (char *)string;
-       return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
-}
-#endif /* BUILDING_VARIANT */
diff --git a/gen/fnmatch.3 b/gen/fnmatch.3
deleted file mode 100644 (file)
index f3aa885..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Guido van Rossum.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fnmatch.3  8.3 (Berkeley) 4/28/95
-.\" $FreeBSD: src/lib/libc/gen/fnmatch.3,v 1.19 2007/01/09 00:27:53 imp Exp $
-.\"
-.Dd July 18, 2004
-.Dt FNMATCH 3
-.Os
-.Sh NAME
-.Nm fnmatch
-.Nd test whether a filename or pathname matches a shell-style pattern
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fnmatch.h
-.Ft int
-.Fn fnmatch "const char *pattern" "const char *string" "int flags"
-.Sh DESCRIPTION
-The
-.Fn fnmatch
-function
-matches patterns according to the rules used by the shell.
-It checks the string specified by the
-.Fa string
-argument to see if it matches the pattern specified by the
-.Fa pattern
-argument.
-.Pp
-The
-.Fa flags
-argument modifies the interpretation of
-.Fa pattern
-and
-.Fa string .
-The value of
-.Fa flags
-is the bitwise inclusive
-.Tn OR
-of any of the following
-constants, which are defined in the include file
-.In fnmatch.h .
-.Bl -tag -width FNM_PATHNAME
-.It Dv FNM_NOESCAPE
-Normally, every occurrence of a backslash
-.Pq Ql \e
-followed by a character in
-.Fa pattern
-is replaced by that character.
-This is done to negate any special meaning for the character.
-If the
-.Dv FNM_NOESCAPE
-flag is set, a backslash character is treated as an ordinary character.
-.It Dv FNM_PATHNAME
-Slash characters in
-.Fa string
-must be explicitly matched by slashes in
-.Fa pattern .
-If this flag is not set, then slashes are treated as regular characters.
-.It Dv FNM_PERIOD
-Leading periods in
-.Fa string
-must be explicitly matched by periods in
-.Fa pattern .
-If this flag is not set, then leading periods are treated as regular
-characters.
-The definition of
-.Dq leading
-is related to the specification of
-.Dv FNM_PATHNAME .
-A period is always
-.Dq leading
-if it is the first character in
-.Fa string .
-Additionally, if
-.Dv FNM_PATHNAME
-is set,
-a period is
-leading
-if it immediately follows a slash.
-.It Dv FNM_LEADING_DIR
-Ignore
-.Dq Li /*
-rest after successful
-.Fa pattern
-matching.
-.It Dv FNM_CASEFOLD
-Ignore case distinctions in both the
-.Fa pattern
-and the
-.Fa string .
-.El
-.Sh RETURN VALUES
-The
-.Fn fnmatch
-function returns zero if
-.Fa string
-matches the pattern specified by
-.Fa pattern .
-It returns the value
-.Dv FNM_NOMATCH
-if no match is found.
-Otherwise, another non-zero value is returned on error.
-.Sh LEGACY RETURN VALUES
-The
-.Fn fnmatch
-function returns zero if
-.Fa string
-matches the pattern specified by
-.Fa pattern ;
-otherwise, it returns the value
-.Dv FNM_NOMATCH .
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr glob 3 ,
-.Xr regex 3
-.Sh STANDARDS
-The current implementation of the
-.Fn fnmatch
-function
-.Em does not
-conform to
-.St -p1003.2 .
-Collating symbol expressions, equivalence class expressions and
-character class expressions are not supported.
-.Sh HISTORY
-The
-.Fn fnmatch
-function first appeared in
-.Bx 4.4 .
-.Sh BUGS
-The pattern
-.Ql *
-matches the empty string, even if
-.Dv FNM_PATHNAME
-is specified.
diff --git a/gen/ftok-fbsd.c b/gen/ftok-fbsd.c
deleted file mode 120000 (symlink)
index 19e8277..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ftok.c
\ No newline at end of file
diff --git a/gen/ftok.3 b/gen/ftok.3
deleted file mode 100644 (file)
index 88a3a23..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-.\" Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\"    derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/ftok.3,v 1.17 2009/07/13 12:53:43 trasz Exp $
-.Dd July 9, 2009
-.Os
-.Dt FTOK 3
-.Sh NAME
-.Nm ftok
-.Nd create IPC identifier from path name
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/ipc.h
-.Ft key_t
-.Fn ftok "const char *path" "int id"
-.Sh DESCRIPTION
-The
-.Fn ftok
-function attempts to create a unique key suitable for use with the
-.Xr semget 2 ,
-and
-.Xr shmget 2
-functions, given the
-.Fa path
-of an existing file and a user-selectable
-.Fa id .
-.Pp
-The specified
-.Fa path
-must specify an existing file that is accessible to the calling process
-or the call will fail.
-Also, note that links to files will return the
-same key, given the same
-.Fa id .
-.Sh RETURN VALUES
-The
-.Fn ftok
-function will return -1 if
-.Fa path
-does not exist or if it cannot be accessed by the calling process.
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/ipc.h>
-.Pp
-The include file
-.In sys/types.h
-is necessary.
-.Sh SEE ALSO
-.Xr semget 2 ,
-.Xr shmget 2 ,
-.Xr compat 5
-.Sh HISTORY
-The
-.Fn ftok
-function originates with System V and is typically used by programs
-that use the System V IPC routines.
-.Sh AUTHORS
-.An Thorsten Lockert Aq tholo@sigmasoft.com
-.Sh BUGS
-The returned key is computed based on the device minor number and inode
-of the specified
-.Fa path ,
-in combination with the lower 8 bits of the given
-.Fa id .
-Thus, it is quite possible for the routine to return duplicate keys.
diff --git a/gen/getbsize-fbsd.c b/gen/getbsize-fbsd.c
deleted file mode 120000 (symlink)
index e8f2107..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getbsize.c
\ No newline at end of file
diff --git a/gen/getbsize.3 b/gen/getbsize.3
deleted file mode 120000 (symlink)
index 387ed66..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getbsize.3
\ No newline at end of file
diff --git a/gen/getcap-fbsd.c b/gen/getcap-fbsd.c
deleted file mode 100644 (file)
index ea8425f..0000000
+++ /dev/null
@@ -1,1058 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Casey Leedom of Lawrence Livermore National Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getcap.c   8.3 (Berkeley) 3/25/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.23 2009/11/25 04:45:45 wollman Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include <db.h>
-
-#define        BFRAG           1024
-#define        BSIZE           1024
-#define        ESC             ('[' & 037)     /* ASCII ESC */
-#define        MAX_RECURSION   32              /* maximum getent recursion */
-#define        SFRAG           100             /* cgetstr mallocs in SFRAG chunks */
-
-#define RECOK  (char)0
-#define TCERR  (char)1
-#define        SHADOW  (char)2
-
-static size_t   topreclen;     /* toprec length */
-static char    *toprec;        /* Additional record specified by cgetset() */
-static int      gottoprec;     /* Flag indicating retrieval of toprecord */
-
-static int     cdbget(DB *, char **, const char *);
-static int     getent(char **, u_int *, char **, int, const char *, int, char *, locale_t);
-static int     nfcmp(char *, char *);
-
-/*
- * Cgetset() allows the addition of a user specified buffer to be added
- * to the database array, in effect "pushing" the buffer on top of the
- * virtual database. 0 is returned on success, -1 on failure.
- */
-int
-cgetset(const char *ent)
-{
-       if (ent == NULL) {
-               if (toprec)
-                       free(toprec);
-                toprec = NULL;
-                topreclen = 0;
-                return (0);
-        }
-        topreclen = strlen(ent);
-        if ((toprec = malloc (topreclen + 1)) == NULL) {
-               errno = ENOMEM;
-                return (-1);
-       }
-       gottoprec = 0;
-        (void)strcpy(toprec, ent);
-        return (0);
-}
-
-/*
- * Cgetcap searches the capability record buf for the capability cap with
- * type `type'.  A pointer to the value of cap is returned on success, NULL
- * if the requested capability couldn't be found.
- *
- * Specifying a type of ':' means that nothing should follow cap (:cap:).
- * In this case a pointer to the terminating ':' or NUL will be returned if
- * cap is found.
- *
- * If (cap, '@') or (cap, terminator, '@') is found before (cap, terminator)
- * return NULL.
- */
-char *
-cgetcap(char *buf, const char *cap, int type)
-{
-       char *bp;
-       const char *cp;
-
-       bp = buf;
-       for (;;) {
-               /*
-                * Skip past the current capability field - it's either the
-                * name field if this is the first time through the loop, or
-                * the remainder of a field whose name failed to match cap.
-                */
-               for (;;)
-                       if (*bp == '\0')
-                               return (NULL);
-                       else
-                               if (*bp++ == ':')
-                                       break;
-
-               /*
-                * Try to match (cap, type) in buf.
-                */
-               for (cp = cap; *cp == *bp && *bp != '\0'; cp++, bp++)
-                       continue;
-               if (*cp != '\0')
-                       continue;
-               if (*bp == '@')
-                       return (NULL);
-               if (type == ':') {
-                       if (*bp != '\0' && *bp != ':')
-                               continue;
-                       return(bp);
-               }
-               if (*bp != type)
-                       continue;
-               bp++;
-               return (*bp == '@' ? NULL : bp);
-       }
-       /* NOTREACHED */
-}
-
-/*
- * Cgetent extracts the capability record name from the NULL terminated file
- * array db_array and returns a pointer to a malloc'd copy of it in buf.
- * Buf must be retained through all subsequent calls to cgetcap, cgetnum,
- * cgetflag, and cgetstr, but may then be free'd.  0 is returned on success,
- * -1 if the requested record couldn't be found, -2 if a system error was
- * encountered (couldn't open/read a file, etc.), and -3 if a potential
- * reference loop is detected.
- */
-int
-cgetent(char **buf, char **db_array, const char *name)
-{
-       u_int dummy;
-
-       return (getent(buf, &dummy, db_array, -1, name, 0, NULL, __current_locale()));
-}
-
-/*
- * Getent implements the functions of cgetent.  If fd is non-negative,
- * *db_array has already been opened and fd is the open file descriptor.  We
- * do this to save time and avoid using up file descriptors for tc=
- * recursions.
- *
- * Getent returns the same success/failure codes as cgetent.  On success, a
- * pointer to a malloc'ed capability record with all tc= capabilities fully
- * expanded and its length (not including trailing ASCII NUL) are left in
- * *cap and *len.
- *
- * Basic algorithm:
- *     + Allocate memory incrementally as needed in chunks of size BFRAG
- *       for capability buffer.
- *     + Recurse for each tc=name and interpolate result.  Stop when all
- *       names interpolated, a name can't be found, or depth exceeds
- *       MAX_RECURSION.
- */
-static int
-getent(char **cap, u_int *len, char **db_array, int fd, const char *name,
-    int depth, char *nfield, locale_t loc)
-{
-       DB *capdbp;
-       char *r_end, *rp, **db_p;
-       int myfd, eof, foundit, retval;
-       char *record, *cbuf;
-       int tc_not_resolved;
-       char pbuf[_POSIX_PATH_MAX];
-
-       /*
-        * Return with ``loop detected'' error if we've recursed more than
-        * MAX_RECURSION times.
-        */
-       if (depth > MAX_RECURSION)
-               return (-3);
-
-       /*
-        * Check if we have a top record from cgetset().
-         */
-       if (depth == 0 && toprec != NULL && cgetmatch(toprec, name) == 0) {
-               if ((record = malloc (topreclen + BFRAG)) == NULL) {
-                       errno = ENOMEM;
-                       return (-2);
-               }
-               (void)strcpy(record, toprec);
-               myfd = 0;
-               db_p = db_array;
-               rp = record + topreclen + 1;
-               r_end = rp + BFRAG;
-               goto tc_exp;
-       }
-       /*
-        * Allocate first chunk of memory.
-        */
-       if ((record = malloc(BFRAG)) == NULL) {
-               errno = ENOMEM;
-               return (-2);
-       }
-       r_end = record + BFRAG;
-       foundit = 0;
-       /*
-        * Loop through database array until finding the record.
-        */
-
-       for (db_p = db_array; *db_p != NULL; db_p++) {
-               eof = 0;
-
-               /*
-                * Open database if not already open.
-                */
-
-               if (fd >= 0) {
-                       (void)lseek(fd, (off_t)0, SEEK_SET);
-                       myfd = 0;
-               } else {
-                       (void)snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p);
-                       if ((capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))
-                            != NULL) {
-                               free(record);
-                               retval = cdbget(capdbp, &record, name);
-                               if (retval < 0) {
-                                       /* no record available */
-                                       (void)capdbp->close(capdbp);
-                                       return (retval);
-                               }
-                               /* save the data; close frees it */
-                               cbuf = strdup(record);
-                               if (capdbp->close(capdbp) < 0) {
-                                       free(cbuf);
-                                       return (-2);
-                               }
-                               if (cbuf == NULL) {
-                                       errno = ENOMEM;
-                                       return (-2);
-                               }
-                               *len = strlen(cbuf);
-                               *cap = cbuf;
-                               return (retval);
-                       } else {
-                               fd = _open(*db_p, O_RDONLY, 0);
-                               if (fd < 0)
-                                       continue;
-                               myfd = 1;
-                       }
-               }
-               /*
-                * Find the requested capability record ...
-                */
-               {
-               char buf[BUFSIZ];
-               char *b_end, *bp;
-               int c;
-
-               /*
-                * Loop invariants:
-                *      There is always room for one more character in record.
-                *      R_end always points just past end of record.
-                *      Rp always points just past last character in record.
-                *      B_end always points just past last character in buf.
-                *      Bp always points at next character in buf.
-                */
-               b_end = buf;
-               bp = buf;
-               for (;;) {
-
-                       /*
-                        * Read in a line implementing (\, newline)
-                        * line continuation.
-                        */
-                       rp = record;
-                       for (;;) {
-                               if (bp >= b_end) {
-                                       int n;
-
-                                       n = _read(fd, buf, sizeof(buf));
-                                       if (n <= 0) {
-                                               if (myfd)
-                                                       (void)_close(fd);
-                                               if (n < 0) {
-                                                       free(record);
-                                                       return (-2);
-                                               } else {
-                                                       fd = -1;
-                                                       eof = 1;
-                                                       break;
-                                               }
-                                       }
-                                       b_end = buf+n;
-                                       bp = buf;
-                               }
-
-                               c = *bp++;
-                               if (c == '\n') {
-                                       if (rp > record && *(rp-1) == '\\') {
-                                               rp--;
-                                               continue;
-                                       } else
-                                               break;
-                               }
-                               *rp++ = c;
-
-                               /*
-                                * Enforce loop invariant: if no room
-                                * left in record buffer, try to get
-                                * some more.
-                                */
-                               if (rp >= r_end) {
-                                       u_int pos;
-                                       size_t newsize;
-
-                                       pos = rp - record;
-                                       newsize = r_end - record + BFRAG;
-                                       record = reallocf(record, newsize);
-                                       if (record == NULL) {
-                                               errno = ENOMEM;
-                                               if (myfd)
-                                                       (void)_close(fd);
-                                               return (-2);
-                                       }
-                                       r_end = record + newsize;
-                                       rp = record + pos;
-                               }
-                       }
-                               /* loop invariant let's us do this */
-                       *rp++ = '\0';
-
-                       /*
-                        * If encountered eof check next file.
-                        */
-                       if (eof)
-                               break;
-
-                       /*
-                        * Toss blank lines and comments.
-                        */
-                       if (*record == '\0' || *record == '#')
-                               continue;
-
-                       /*
-                        * See if this is the record we want ...
-                        */
-                       if (cgetmatch(record, name) == 0) {
-                               if (nfield == NULL || !nfcmp(nfield, record)) {
-                                       foundit = 1;
-                                       break;  /* found it! */
-                               }
-                       }
-               }
-       }
-               if (foundit)
-                       break;
-       }
-
-       if (!foundit) {
-               free(record);
-               return (-1);
-       }
-
-       /*
-        * Got the capability record, but now we have to expand all tc=name
-        * references in it ...
-        */
-tc_exp:        {
-               char *newicap, *s;
-               int newilen;
-               u_int ilen;
-               int diff, iret, tclen;
-               char *icap, *scan, *tc, *tcstart, *tcend;
-
-               /*
-                * Loop invariants:
-                *      There is room for one more character in record.
-                *      R_end points just past end of record.
-                *      Rp points just past last character in record.
-                *      Scan points at remainder of record that needs to be
-                *      scanned for tc=name constructs.
-                */
-               scan = record;
-               tc_not_resolved = 0;
-               for (;;) {
-                       if ((tc = cgetcap(scan, "tc", '=')) == NULL)
-                               break;
-
-                       /*
-                        * Find end of tc=name and stomp on the trailing `:'
-                        * (if present) so we can use it to call ourselves.
-                        */
-                       s = tc;
-                       for (;;)
-                               if (*s == '\0')
-                                       break;
-                               else
-                                       if (*s++ == ':') {
-                                               *(s - 1) = '\0';
-                                               break;
-                                       }
-                       tcstart = tc - 3;
-                       tclen = s - tcstart;
-                       tcend = s;
-
-                       iret = getent(&icap, &ilen, db_p, fd, tc, depth+1,
-                                     NULL, loc);
-                       newicap = icap;         /* Put into a register. */
-                       newilen = ilen;
-                       if (iret != 0) {
-                               /* an error */
-                               if (iret < -1) {
-                                       if (myfd)
-                                               (void)_close(fd);
-                                       free(record);
-                                       return (iret);
-                               }
-                               if (iret == 1)
-                                       tc_not_resolved = 1;
-                               /* couldn't resolve tc */
-                               if (iret == -1) {
-                                       *(s - 1) = ':';
-                                       scan = s - 1;
-                                       tc_not_resolved = 1;
-                                       continue;
-
-                               }
-                       }
-                       /* not interested in name field of tc'ed record */
-                       s = newicap;
-                       for (;;)
-                               if (*s == '\0')
-                                       break;
-                               else
-                                       if (*s++ == ':')
-                                               break;
-                       newilen -= s - newicap;
-                       newicap = s;
-
-                       /* make sure interpolated record is `:'-terminated */
-                       s += newilen;
-                       if (*(s-1) != ':') {
-                               *s = ':';       /* overwrite NUL with : */
-                               newilen++;
-                       }
-
-                       /*
-                        * Make sure there's enough room to insert the
-                        * new record.
-                        */
-                       diff = newilen - tclen;
-                       if (diff >= r_end - rp) {
-                               u_int pos, tcpos, tcposend;
-                               size_t newsize;
-
-                               pos = rp - record;
-                               newsize = r_end - record + diff + BFRAG;
-                               tcpos = tcstart - record;
-                               tcposend = tcend - record;
-                               record = reallocf(record, newsize);
-                               if (record == NULL) {
-                                       errno = ENOMEM;
-                                       if (myfd)
-                                               (void)_close(fd);
-                                       free(icap);
-                                       return (-2);
-                               }
-                               r_end = record + newsize;
-                               rp = record + pos;
-                               tcstart = record + tcpos;
-                               tcend = record + tcposend;
-                       }
-
-                       /*
-                        * Insert tc'ed record into our record.
-                        */
-                       s = tcstart + newilen;
-                       bcopy(tcend, s, rp - tcend);
-                       bcopy(newicap, tcstart, newilen);
-                       rp += diff;
-                       free(icap);
-
-                       /*
-                        * Start scan on `:' so next cgetcap works properly
-                        * (cgetcap always skips first field).
-                        */
-                       scan = s-1;
-               }
-
-       }
-       /*
-        * Close file (if we opened it), give back any extra memory, and
-        * return capability, length and success.
-        */
-       if (myfd)
-               (void)_close(fd);
-       *len = rp - record - 1; /* don't count NUL */
-       if (r_end > rp)
-               if ((record =
-                    reallocf(record, (size_t)(rp - record))) == NULL) {
-                       errno = ENOMEM;
-                       return (-2);
-               }
-
-       *cap = record;
-       if (tc_not_resolved)
-               return (1);
-       return (0);
-}
-
-static int
-cdbget(DB *capdbp, char **bp, const char *name)
-{
-       DBT key, data;
-       char *namebuf;
-
-       namebuf = strdup(name);
-       if (namebuf == NULL)
-               return (-2);
-       key.data = namebuf;
-       key.size = strlen(namebuf);
-
-       for (;;) {
-               /* Get the reference. */
-               switch(capdbp->get(capdbp, &key, &data, 0)) {
-               case -1:
-                       free(namebuf);
-                       return (-2);
-               case 1:
-                       free(namebuf);
-                       return (-1);
-               }
-
-               /* If not an index to another record, leave. */
-               if (((char *)data.data)[0] != SHADOW)
-                       break;
-
-               key.data = (char *)data.data + 1;
-               key.size = data.size - 1;
-       }
-
-       *bp = (char *)data.data + 1;
-       free(namebuf);
-       return (((char *)(data.data))[0] == TCERR ? 1 : 0);
-}
-
-/*
- * Cgetmatch will return 0 if name is one of the names of the capability
- * record buf, -1 if not.
- */
-int
-cgetmatch(const char *buf, const char *name)
-{
-       const char *np, *bp;
-
-       if (name == NULL || *name == '\0')
-               return -1;
-
-       /*
-        * Start search at beginning of record.
-        */
-       bp = buf;
-       for (;;) {
-               /*
-                * Try to match a record name.
-                */
-               np = name;
-               for (;;)
-                       if (*np == '\0')
-                               if (*bp == '|' || *bp == ':' || *bp == '\0')
-                                       return (0);
-                               else
-                                       break;
-                       else
-                               if (*bp++ != *np++)
-                                       break;
-
-               /*
-                * Match failed, skip to next name in record.
-                */
-               bp--;   /* a '|' or ':' may have stopped the match */
-               for (;;)
-                       if (*bp == '\0' || *bp == ':')
-                               return (-1);    /* match failed totally */
-                       else
-                               if (*bp++ == '|')
-                                       break;  /* found next name */
-       }
-}
-
-
-
-
-
-int
-cgetfirst(char **buf, char **db_array)
-{
-       (void)cgetclose();
-       return (cgetnext(buf, db_array));
-}
-
-static FILE *pfp;
-static int slash;
-static char **dbp;
-
-int
-cgetclose(void)
-{
-       if (pfp != NULL) {
-               (void)fclose(pfp);
-               pfp = NULL;
-       }
-       dbp = NULL;
-       gottoprec = 0;
-       slash = 0;
-       return(0);
-}
-
-/*
- * Cgetnext() gets either the first or next entry in the logical database
- * specified by db_array.  It returns 0 upon completion of the database, 1
- * upon returning an entry with more remaining, and -1 if an error occurs.
- */
-int
-cgetnext(char **bp, char **db_array)
-{
-       size_t len;
-       int done, hadreaderr, savederrno, status;
-       char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE];
-       u_int dummy;
-       locale_t loc = __current_locale();
-
-       if (dbp == NULL)
-               dbp = db_array;
-
-       if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) {
-               (void)cgetclose();
-               return (-1);
-       }
-       for (;;) {
-               if (toprec && !gottoprec) {
-                       gottoprec = 1;
-                       line = toprec;
-               } else {
-                       line = fgetln(pfp, &len);
-                       if (line == NULL && pfp) {
-                               hadreaderr = ferror(pfp);
-                               if (hadreaderr)
-                                       savederrno = errno;
-                               fclose(pfp);
-                               pfp = NULL;
-                               if (hadreaderr) {
-                                       cgetclose();
-                                       errno = savederrno;
-                                       return (-1);
-                               } else {
-                                       if (*++dbp == NULL) {
-                                               (void)cgetclose();
-                                               return (0);
-                                       } else if ((pfp =
-                                           fopen(*dbp, "r")) == NULL) {
-                                               (void)cgetclose();
-                                               return (-1);
-                                       } else
-                                               continue;
-                               }
-                       } else
-                               line[len - 1] = '\0';
-                       if (len == 1) {
-                               slash = 0;
-                               continue;
-                       }
-                       if (isspace_l((unsigned char)*line, loc) ||
-                           *line == ':' || *line == '#' || slash) {
-                               if (line[len - 2] == '\\')
-                                       slash = 1;
-                               else
-                                       slash = 0;
-                               continue;
-                       }
-                       if (line[len - 2] == '\\')
-                               slash = 1;
-                       else
-                               slash = 0;
-               }
-
-
-               /*
-                * Line points to a name line.
-                */
-               done = 0;
-               np = nbuf;
-               for (;;) {
-                       for (cp = line; *cp != '\0'; cp++) {
-                               if (*cp == ':') {
-                                       *np++ = ':';
-                                       done = 1;
-                                       break;
-                               }
-                               if (*cp == '\\')
-                                       break;
-                               *np++ = *cp;
-                       }
-                       if (done) {
-                               *np = '\0';
-                               break;
-                       } else { /* name field extends beyond the line */
-                               line = fgetln(pfp, &len);
-                               if (line == NULL && pfp) {
-                                       /* Name extends beyond the EOF! */
-                                       hadreaderr = ferror(pfp);
-                                       if (hadreaderr)
-                                               savederrno = errno;
-                                       fclose(pfp);
-                                       pfp = NULL;
-                                       if (hadreaderr) {
-                                               cgetclose();
-                                               errno = savederrno;
-                                               return (-1);
-                                       } else {
-                                               cgetclose();
-                                               return (-1);
-                                       }
-                               } else
-                                       line[len - 1] = '\0';
-                       }
-               }
-               rp = buf;
-               for(cp = nbuf; *cp != '\0'; cp++)
-                       if (*cp == '|' || *cp == ':')
-                               break;
-                       else
-                               *rp++ = *cp;
-
-               *rp = '\0';
-               /*
-                * XXX
-                * Last argument of getent here should be nbuf if we want true
-                * sequential access in the case of duplicates.
-                * With NULL, getent will return the first entry found
-                * rather than the duplicate entry record.  This is a
-                * matter of semantics that should be resolved.
-                */
-               status = getent(bp, &dummy, db_array, -1, buf, 0, NULL, loc);
-               if (status == -2 || status == -3)
-                       (void)cgetclose();
-
-               return (status + 1);
-       }
-       /* NOTREACHED */
-}
-
-/*
- * Cgetstr retrieves the value of the string capability cap from the
- * capability record pointed to by buf.  A pointer to a decoded, NUL
- * terminated, malloc'd copy of the string is returned in the char *
- * pointed to by str.  The length of the string not including the trailing
- * NUL is returned on success, -1 if the requested string capability
- * couldn't be found, -2 if a system error was encountered (storage
- * allocation failure).
- */
-int
-cgetstr(char *buf, const char *cap, char **str)
-{
-       u_int m_room;
-       char *bp, *mp;
-       int len;
-       char *mem;
-
-       /*
-        * Find string capability cap
-        */
-       bp = cgetcap(buf, cap, '=');
-       if (bp == NULL)
-               return (-1);
-
-       /*
-        * Conversion / storage allocation loop ...  Allocate memory in
-        * chunks SFRAG in size.
-        */
-       if ((mem = malloc(SFRAG)) == NULL) {
-               errno = ENOMEM;
-               return (-2);    /* couldn't even allocate the first fragment */
-       }
-       m_room = SFRAG;
-       mp = mem;
-
-       while (*bp != ':' && *bp != '\0') {
-               /*
-                * Loop invariants:
-                *      There is always room for one more character in mem.
-                *      Mp always points just past last character in mem.
-                *      Bp always points at next character in buf.
-                */
-               if (*bp == '^') {
-                       bp++;
-                       if (*bp == ':' || *bp == '\0')
-                               break;  /* drop unfinished escape */
-                       if (*bp == '?') {
-                               *mp++ = '\177';
-                               bp++;
-                       } else
-                               *mp++ = *bp++ & 037;
-               } else if (*bp == '\\') {
-                       bp++;
-                       if (*bp == ':' || *bp == '\0')
-                               break;  /* drop unfinished escape */
-                       if ('0' <= *bp && *bp <= '7') {
-                               int n, i;
-
-                               n = 0;
-                               i = 3;  /* maximum of three octal digits */
-                               do {
-                                       n = n * 8 + (*bp++ - '0');
-                               } while (--i && '0' <= *bp && *bp <= '7');
-                               *mp++ = n;
-                       }
-                       else switch (*bp++) {
-                               case 'b': case 'B':
-                                       *mp++ = '\b';
-                                       break;
-                               case 't': case 'T':
-                                       *mp++ = '\t';
-                                       break;
-                               case 'n': case 'N':
-                                       *mp++ = '\n';
-                                       break;
-                               case 'f': case 'F':
-                                       *mp++ = '\f';
-                                       break;
-                               case 'r': case 'R':
-                                       *mp++ = '\r';
-                                       break;
-                               case 'e': case 'E':
-                                       *mp++ = ESC;
-                                       break;
-                               case 'c': case 'C':
-                                       *mp++ = ':';
-                                       break;
-                               default:
-                                       /*
-                                        * Catches '\', '^', and
-                                        *  everything else.
-                                        */
-                                       *mp++ = *(bp-1);
-                                       break;
-                       }
-               } else
-                       *mp++ = *bp++;
-               m_room--;
-
-               /*
-                * Enforce loop invariant: if no room left in current
-                * buffer, try to get some more.
-                */
-               if (m_room == 0) {
-                       size_t size = mp - mem;
-
-                       if ((mem = reallocf(mem, size + SFRAG)) == NULL)
-                               return (-2);
-                       m_room = SFRAG;
-                       mp = mem + size;
-               }
-       }
-       *mp++ = '\0';   /* loop invariant let's us do this */
-       m_room--;
-       len = mp - mem - 1;
-
-       /*
-        * Give back any extra memory and return value and success.
-        */
-       if (m_room != 0)
-               if ((mem = reallocf(mem, (size_t)(mp - mem))) == NULL)
-                       return (-2);
-       *str = mem;
-       return (len);
-}
-
-/*
- * Cgetustr retrieves the value of the string capability cap from the
- * capability record pointed to by buf.  The difference between cgetustr()
- * and cgetstr() is that cgetustr does not decode escapes but rather treats
- * all characters literally.  A pointer to a  NUL terminated malloc'd
- * copy of the string is returned in the char pointed to by str.  The
- * length of the string not including the trailing NUL is returned on success,
- * -1 if the requested string capability couldn't be found, -2 if a system
- * error was encountered (storage allocation failure).
- */
-int
-cgetustr(char *buf, const char *cap, char **str)
-{
-       u_int m_room;
-       char *bp, *mp;
-       int len;
-       char *mem;
-
-       /*
-        * Find string capability cap
-        */
-       if ((bp = cgetcap(buf, cap, '=')) == NULL)
-               return (-1);
-
-       /*
-        * Conversion / storage allocation loop ...  Allocate memory in
-        * chunks SFRAG in size.
-        */
-       if ((mem = malloc(SFRAG)) == NULL) {
-               errno = ENOMEM;
-               return (-2);    /* couldn't even allocate the first fragment */
-       }
-       m_room = SFRAG;
-       mp = mem;
-
-       while (*bp != ':' && *bp != '\0') {
-               /*
-                * Loop invariants:
-                *      There is always room for one more character in mem.
-                *      Mp always points just past last character in mem.
-                *      Bp always points at next character in buf.
-                */
-               *mp++ = *bp++;
-               m_room--;
-
-               /*
-                * Enforce loop invariant: if no room left in current
-                * buffer, try to get some more.
-                */
-               if (m_room == 0) {
-                       size_t size = mp - mem;
-
-                       if ((mem = reallocf(mem, size + SFRAG)) == NULL)
-                               return (-2);
-                       m_room = SFRAG;
-                       mp = mem + size;
-               }
-       }
-       *mp++ = '\0';   /* loop invariant let's us do this */
-       m_room--;
-       len = mp - mem - 1;
-
-       /*
-        * Give back any extra memory and return value and success.
-        */
-       if (m_room != 0)
-               if ((mem = reallocf(mem, (size_t)(mp - mem))) == NULL)
-                       return (-2);
-       *str = mem;
-       return (len);
-}
-
-/*
- * Cgetnum retrieves the value of the numeric capability cap from the
- * capability record pointed to by buf.  The numeric value is returned in
- * the long pointed to by num.  0 is returned on success, -1 if the requested
- * numeric capability couldn't be found.
- */
-int
-cgetnum(char *buf, const char *cap, long *num)
-{
-       long n;
-       int base, digit;
-       char *bp;
-
-       /*
-        * Find numeric capability cap
-        */
-       bp = cgetcap(buf, cap, '#');
-       if (bp == NULL)
-               return (-1);
-
-       /*
-        * Look at value and determine numeric base:
-        *      0x... or 0X...  hexadecimal,
-        * else 0...            octal,
-        * else                 decimal.
-        */
-       if (*bp == '0') {
-               bp++;
-               if (*bp == 'x' || *bp == 'X') {
-                       bp++;
-                       base = 16;
-               } else
-                       base = 8;
-       } else
-               base = 10;
-
-       /*
-        * Conversion loop ...
-        */
-       n = 0;
-       for (;;) {
-               if ('0' <= *bp && *bp <= '9')
-                       digit = *bp - '0';
-               else if ('a' <= *bp && *bp <= 'f')
-                       digit = 10 + *bp - 'a';
-               else if ('A' <= *bp && *bp <= 'F')
-                       digit = 10 + *bp - 'A';
-               else
-                       break;
-
-               if (digit >= base)
-                       break;
-
-               n = n * base + digit;
-               bp++;
-       }
-
-       /*
-        * Return value and success.
-        */
-       *num = n;
-       return (0);
-}
-
-
-/*
- * Compare name field of record.
- */
-static int
-nfcmp(char *nf, char *rec)
-{
-       char *cp, tmp;
-       int ret;
-
-       for (cp = rec; *cp != ':'; cp++)
-               ;
-
-       tmp = *(cp + 1);
-       *(cp + 1) = '\0';
-       ret = strcmp(nf, rec);
-       *(cp + 1) = tmp;
-
-       return (ret);
-}
diff --git a/gen/getcap-fbsd.c.orig b/gen/getcap-fbsd.c.orig
deleted file mode 100644 (file)
index 649a9f4..0000000
+++ /dev/null
@@ -1,1055 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Casey Leedom of Lawrence Livermore National Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getcap.c   8.3 (Berkeley) 3/25/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.23 2009/11/25 04:45:45 wollman Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include <db.h>
-
-#define        BFRAG           1024
-#define        BSIZE           1024
-#define        ESC             ('[' & 037)     /* ASCII ESC */
-#define        MAX_RECURSION   32              /* maximum getent recursion */
-#define        SFRAG           100             /* cgetstr mallocs in SFRAG chunks */
-
-#define RECOK  (char)0
-#define TCERR  (char)1
-#define        SHADOW  (char)2
-
-static size_t   topreclen;     /* toprec length */
-static char    *toprec;        /* Additional record specified by cgetset() */
-static int      gottoprec;     /* Flag indicating retrieval of toprecord */
-
-static int     cdbget(DB *, char **, const char *);
-static int     getent(char **, u_int *, char **, int, const char *, int, char *);
-static int     nfcmp(char *, char *);
-
-/*
- * Cgetset() allows the addition of a user specified buffer to be added
- * to the database array, in effect "pushing" the buffer on top of the
- * virtual database. 0 is returned on success, -1 on failure.
- */
-int
-cgetset(const char *ent)
-{
-       if (ent == NULL) {
-               if (toprec)
-                       free(toprec);
-                toprec = NULL;
-                topreclen = 0;
-                return (0);
-        }
-        topreclen = strlen(ent);
-        if ((toprec = malloc (topreclen + 1)) == NULL) {
-               errno = ENOMEM;
-                return (-1);
-       }
-       gottoprec = 0;
-        (void)strcpy(toprec, ent);
-        return (0);
-}
-
-/*
- * Cgetcap searches the capability record buf for the capability cap with
- * type `type'.  A pointer to the value of cap is returned on success, NULL
- * if the requested capability couldn't be found.
- *
- * Specifying a type of ':' means that nothing should follow cap (:cap:).
- * In this case a pointer to the terminating ':' or NUL will be returned if
- * cap is found.
- *
- * If (cap, '@') or (cap, terminator, '@') is found before (cap, terminator)
- * return NULL.
- */
-char *
-cgetcap(char *buf, const char *cap, int type)
-{
-       char *bp;
-       const char *cp;
-
-       bp = buf;
-       for (;;) {
-               /*
-                * Skip past the current capability field - it's either the
-                * name field if this is the first time through the loop, or
-                * the remainder of a field whose name failed to match cap.
-                */
-               for (;;)
-                       if (*bp == '\0')
-                               return (NULL);
-                       else
-                               if (*bp++ == ':')
-                                       break;
-
-               /*
-                * Try to match (cap, type) in buf.
-                */
-               for (cp = cap; *cp == *bp && *bp != '\0'; cp++, bp++)
-                       continue;
-               if (*cp != '\0')
-                       continue;
-               if (*bp == '@')
-                       return (NULL);
-               if (type == ':') {
-                       if (*bp != '\0' && *bp != ':')
-                               continue;
-                       return(bp);
-               }
-               if (*bp != type)
-                       continue;
-               bp++;
-               return (*bp == '@' ? NULL : bp);
-       }
-       /* NOTREACHED */
-}
-
-/*
- * Cgetent extracts the capability record name from the NULL terminated file
- * array db_array and returns a pointer to a malloc'd copy of it in buf.
- * Buf must be retained through all subsequent calls to cgetcap, cgetnum,
- * cgetflag, and cgetstr, but may then be free'd.  0 is returned on success,
- * -1 if the requested record couldn't be found, -2 if a system error was
- * encountered (couldn't open/read a file, etc.), and -3 if a potential
- * reference loop is detected.
- */
-int
-cgetent(char **buf, char **db_array, const char *name)
-{
-       u_int dummy;
-
-       return (getent(buf, &dummy, db_array, -1, name, 0, NULL));
-}
-
-/*
- * Getent implements the functions of cgetent.  If fd is non-negative,
- * *db_array has already been opened and fd is the open file descriptor.  We
- * do this to save time and avoid using up file descriptors for tc=
- * recursions.
- *
- * Getent returns the same success/failure codes as cgetent.  On success, a
- * pointer to a malloc'ed capability record with all tc= capabilities fully
- * expanded and its length (not including trailing ASCII NUL) are left in
- * *cap and *len.
- *
- * Basic algorithm:
- *     + Allocate memory incrementally as needed in chunks of size BFRAG
- *       for capability buffer.
- *     + Recurse for each tc=name and interpolate result.  Stop when all
- *       names interpolated, a name can't be found, or depth exceeds
- *       MAX_RECURSION.
- */
-static int
-getent(char **cap, u_int *len, char **db_array, int fd, const char *name,
-    int depth, char *nfield)
-{
-       DB *capdbp;
-       char *r_end, *rp, **db_p;
-       int myfd, eof, foundit, retval;
-       char *record, *cbuf;
-       int tc_not_resolved;
-       char pbuf[_POSIX_PATH_MAX];
-
-       /*
-        * Return with ``loop detected'' error if we've recursed more than
-        * MAX_RECURSION times.
-        */
-       if (depth > MAX_RECURSION)
-               return (-3);
-
-       /*
-        * Check if we have a top record from cgetset().
-         */
-       if (depth == 0 && toprec != NULL && cgetmatch(toprec, name) == 0) {
-               if ((record = malloc (topreclen + BFRAG)) == NULL) {
-                       errno = ENOMEM;
-                       return (-2);
-               }
-               (void)strcpy(record, toprec);
-               myfd = 0;
-               db_p = db_array;
-               rp = record + topreclen + 1;
-               r_end = rp + BFRAG;
-               goto tc_exp;
-       }
-       /*
-        * Allocate first chunk of memory.
-        */
-       if ((record = malloc(BFRAG)) == NULL) {
-               errno = ENOMEM;
-               return (-2);
-       }
-       r_end = record + BFRAG;
-       foundit = 0;
-       /*
-        * Loop through database array until finding the record.
-        */
-
-       for (db_p = db_array; *db_p != NULL; db_p++) {
-               eof = 0;
-
-               /*
-                * Open database if not already open.
-                */
-
-               if (fd >= 0) {
-                       (void)lseek(fd, (off_t)0, SEEK_SET);
-                       myfd = 0;
-               } else {
-                       (void)snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p);
-                       if ((capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0))
-                            != NULL) {
-                               free(record);
-                               retval = cdbget(capdbp, &record, name);
-                               if (retval < 0) {
-                                       /* no record available */
-                                       (void)capdbp->close(capdbp);
-                                       return (retval);
-                               }
-                               /* save the data; close frees it */
-                               cbuf = strdup(record);
-                               if (capdbp->close(capdbp) < 0) {
-                                       free(cbuf);
-                                       return (-2);
-                               }
-                               if (cbuf == NULL) {
-                                       errno = ENOMEM;
-                                       return (-2);
-                               }
-                               *len = strlen(cbuf);
-                               *cap = cbuf;
-                               return (retval);
-                       } else {
-                               fd = _open(*db_p, O_RDONLY, 0);
-                               if (fd < 0)
-                                       continue;
-                               myfd = 1;
-                       }
-               }
-               /*
-                * Find the requested capability record ...
-                */
-               {
-               char buf[BUFSIZ];
-               char *b_end, *bp;
-               int c;
-
-               /*
-                * Loop invariants:
-                *      There is always room for one more character in record.
-                *      R_end always points just past end of record.
-                *      Rp always points just past last character in record.
-                *      B_end always points just past last character in buf.
-                *      Bp always points at next character in buf.
-                */
-               b_end = buf;
-               bp = buf;
-               for (;;) {
-
-                       /*
-                        * Read in a line implementing (\, newline)
-                        * line continuation.
-                        */
-                       rp = record;
-                       for (;;) {
-                               if (bp >= b_end) {
-                                       int n;
-
-                                       n = _read(fd, buf, sizeof(buf));
-                                       if (n <= 0) {
-                                               if (myfd)
-                                                       (void)_close(fd);
-                                               if (n < 0) {
-                                                       free(record);
-                                                       return (-2);
-                                               } else {
-                                                       fd = -1;
-                                                       eof = 1;
-                                                       break;
-                                               }
-                                       }
-                                       b_end = buf+n;
-                                       bp = buf;
-                               }
-
-                               c = *bp++;
-                               if (c == '\n') {
-                                       if (rp > record && *(rp-1) == '\\') {
-                                               rp--;
-                                               continue;
-                                       } else
-                                               break;
-                               }
-                               *rp++ = c;
-
-                               /*
-                                * Enforce loop invariant: if no room
-                                * left in record buffer, try to get
-                                * some more.
-                                */
-                               if (rp >= r_end) {
-                                       u_int pos;
-                                       size_t newsize;
-
-                                       pos = rp - record;
-                                       newsize = r_end - record + BFRAG;
-                                       record = reallocf(record, newsize);
-                                       if (record == NULL) {
-                                               errno = ENOMEM;
-                                               if (myfd)
-                                                       (void)_close(fd);
-                                               return (-2);
-                                       }
-                                       r_end = record + newsize;
-                                       rp = record + pos;
-                               }
-                       }
-                               /* loop invariant let's us do this */
-                       *rp++ = '\0';
-
-                       /*
-                        * If encountered eof check next file.
-                        */
-                       if (eof)
-                               break;
-
-                       /*
-                        * Toss blank lines and comments.
-                        */
-                       if (*record == '\0' || *record == '#')
-                               continue;
-
-                       /*
-                        * See if this is the record we want ...
-                        */
-                       if (cgetmatch(record, name) == 0) {
-                               if (nfield == NULL || !nfcmp(nfield, record)) {
-                                       foundit = 1;
-                                       break;  /* found it! */
-                               }
-                       }
-               }
-       }
-               if (foundit)
-                       break;
-       }
-
-       if (!foundit) {
-               free(record);
-               return (-1);
-       }
-
-       /*
-        * Got the capability record, but now we have to expand all tc=name
-        * references in it ...
-        */
-tc_exp:        {
-               char *newicap, *s;
-               int newilen;
-               u_int ilen;
-               int diff, iret, tclen;
-               char *icap, *scan, *tc, *tcstart, *tcend;
-
-               /*
-                * Loop invariants:
-                *      There is room for one more character in record.
-                *      R_end points just past end of record.
-                *      Rp points just past last character in record.
-                *      Scan points at remainder of record that needs to be
-                *      scanned for tc=name constructs.
-                */
-               scan = record;
-               tc_not_resolved = 0;
-               for (;;) {
-                       if ((tc = cgetcap(scan, "tc", '=')) == NULL)
-                               break;
-
-                       /*
-                        * Find end of tc=name and stomp on the trailing `:'
-                        * (if present) so we can use it to call ourselves.
-                        */
-                       s = tc;
-                       for (;;)
-                               if (*s == '\0')
-                                       break;
-                               else
-                                       if (*s++ == ':') {
-                                               *(s - 1) = '\0';
-                                               break;
-                                       }
-                       tcstart = tc - 3;
-                       tclen = s - tcstart;
-                       tcend = s;
-
-                       iret = getent(&icap, &ilen, db_p, fd, tc, depth+1,
-                                     NULL);
-                       newicap = icap;         /* Put into a register. */
-                       newilen = ilen;
-                       if (iret != 0) {
-                               /* an error */
-                               if (iret < -1) {
-                                       if (myfd)
-                                               (void)_close(fd);
-                                       free(record);
-                                       return (iret);
-                               }
-                               if (iret == 1)
-                                       tc_not_resolved = 1;
-                               /* couldn't resolve tc */
-                               if (iret == -1) {
-                                       *(s - 1) = ':';
-                                       scan = s - 1;
-                                       tc_not_resolved = 1;
-                                       continue;
-
-                               }
-                       }
-                       /* not interested in name field of tc'ed record */
-                       s = newicap;
-                       for (;;)
-                               if (*s == '\0')
-                                       break;
-                               else
-                                       if (*s++ == ':')
-                                               break;
-                       newilen -= s - newicap;
-                       newicap = s;
-
-                       /* make sure interpolated record is `:'-terminated */
-                       s += newilen;
-                       if (*(s-1) != ':') {
-                               *s = ':';       /* overwrite NUL with : */
-                               newilen++;
-                       }
-
-                       /*
-                        * Make sure there's enough room to insert the
-                        * new record.
-                        */
-                       diff = newilen - tclen;
-                       if (diff >= r_end - rp) {
-                               u_int pos, tcpos, tcposend;
-                               size_t newsize;
-
-                               pos = rp - record;
-                               newsize = r_end - record + diff + BFRAG;
-                               tcpos = tcstart - record;
-                               tcposend = tcend - record;
-                               record = reallocf(record, newsize);
-                               if (record == NULL) {
-                                       errno = ENOMEM;
-                                       if (myfd)
-                                               (void)_close(fd);
-                                       free(icap);
-                                       return (-2);
-                               }
-                               r_end = record + newsize;
-                               rp = record + pos;
-                               tcstart = record + tcpos;
-                               tcend = record + tcposend;
-                       }
-
-                       /*
-                        * Insert tc'ed record into our record.
-                        */
-                       s = tcstart + newilen;
-                       bcopy(tcend, s, rp - tcend);
-                       bcopy(newicap, tcstart, newilen);
-                       rp += diff;
-                       free(icap);
-
-                       /*
-                        * Start scan on `:' so next cgetcap works properly
-                        * (cgetcap always skips first field).
-                        */
-                       scan = s-1;
-               }
-
-       }
-       /*
-        * Close file (if we opened it), give back any extra memory, and
-        * return capability, length and success.
-        */
-       if (myfd)
-               (void)_close(fd);
-       *len = rp - record - 1; /* don't count NUL */
-       if (r_end > rp)
-               if ((record =
-                    reallocf(record, (size_t)(rp - record))) == NULL) {
-                       errno = ENOMEM;
-                       return (-2);
-               }
-
-       *cap = record;
-       if (tc_not_resolved)
-               return (1);
-       return (0);
-}
-
-static int
-cdbget(DB *capdbp, char **bp, const char *name)
-{
-       DBT key, data;
-       char *namebuf;
-
-       namebuf = strdup(name);
-       if (namebuf == NULL)
-               return (-2);
-       key.data = namebuf;
-       key.size = strlen(namebuf);
-
-       for (;;) {
-               /* Get the reference. */
-               switch(capdbp->get(capdbp, &key, &data, 0)) {
-               case -1:
-                       free(namebuf);
-                       return (-2);
-               case 1:
-                       free(namebuf);
-                       return (-1);
-               }
-
-               /* If not an index to another record, leave. */
-               if (((char *)data.data)[0] != SHADOW)
-                       break;
-
-               key.data = (char *)data.data + 1;
-               key.size = data.size - 1;
-       }
-
-       *bp = (char *)data.data + 1;
-       free(namebuf);
-       return (((char *)(data.data))[0] == TCERR ? 1 : 0);
-}
-
-/*
- * Cgetmatch will return 0 if name is one of the names of the capability
- * record buf, -1 if not.
- */
-int
-cgetmatch(const char *buf, const char *name)
-{
-       const char *np, *bp;
-
-       if (name == NULL || *name == '\0')
-               return -1;
-
-       /*
-        * Start search at beginning of record.
-        */
-       bp = buf;
-       for (;;) {
-               /*
-                * Try to match a record name.
-                */
-               np = name;
-               for (;;)
-                       if (*np == '\0')
-                               if (*bp == '|' || *bp == ':' || *bp == '\0')
-                                       return (0);
-                               else
-                                       break;
-                       else
-                               if (*bp++ != *np++)
-                                       break;
-
-               /*
-                * Match failed, skip to next name in record.
-                */
-               bp--;   /* a '|' or ':' may have stopped the match */
-               for (;;)
-                       if (*bp == '\0' || *bp == ':')
-                               return (-1);    /* match failed totally */
-                       else
-                               if (*bp++ == '|')
-                                       break;  /* found next name */
-       }
-}
-
-
-
-
-
-int
-cgetfirst(char **buf, char **db_array)
-{
-       (void)cgetclose();
-       return (cgetnext(buf, db_array));
-}
-
-static FILE *pfp;
-static int slash;
-static char **dbp;
-
-int
-cgetclose(void)
-{
-       if (pfp != NULL) {
-               (void)fclose(pfp);
-               pfp = NULL;
-       }
-       dbp = NULL;
-       gottoprec = 0;
-       slash = 0;
-       return(0);
-}
-
-/*
- * Cgetnext() gets either the first or next entry in the logical database
- * specified by db_array.  It returns 0 upon completion of the database, 1
- * upon returning an entry with more remaining, and -1 if an error occurs.
- */
-int
-cgetnext(char **bp, char **db_array)
-{
-       size_t len;
-       int done, hadreaderr, savederrno, status;
-       char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE];
-       u_int dummy;
-
-       if (dbp == NULL)
-               dbp = db_array;
-
-       if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) {
-               (void)cgetclose();
-               return (-1);
-       }
-       for (;;) {
-               if (toprec && !gottoprec) {
-                       gottoprec = 1;
-                       line = toprec;
-               } else {
-                       line = fgetln(pfp, &len);
-                       if (line == NULL && pfp) {
-                               hadreaderr = ferror(pfp);
-                               if (hadreaderr)
-                                       savederrno = errno;
-                               fclose(pfp);
-                               pfp = NULL;
-                               if (hadreaderr) {
-                                       cgetclose();
-                                       errno = savederrno;
-                                       return (-1);
-                               } else {
-                                       if (*++dbp == NULL) {
-                                               (void)cgetclose();
-                                               return (0);
-                                       } else if ((pfp =
-                                           fopen(*dbp, "r")) == NULL) {
-                                               (void)cgetclose();
-                                               return (-1);
-                                       } else
-                                               continue;
-                               }
-                       } else
-                               line[len - 1] = '\0';
-                       if (len == 1) {
-                               slash = 0;
-                               continue;
-                       }
-                       if (isspace((unsigned char)*line) ||
-                           *line == ':' || *line == '#' || slash) {
-                               if (line[len - 2] == '\\')
-                                       slash = 1;
-                               else
-                                       slash = 0;
-                               continue;
-                       }
-                       if (line[len - 2] == '\\')
-                               slash = 1;
-                       else
-                               slash = 0;
-               }
-
-
-               /*
-                * Line points to a name line.
-                */
-               done = 0;
-               np = nbuf;
-               for (;;) {
-                       for (cp = line; *cp != '\0'; cp++) {
-                               if (*cp == ':') {
-                                       *np++ = ':';
-                                       done = 1;
-                                       break;
-                               }
-                               if (*cp == '\\')
-                                       break;
-                               *np++ = *cp;
-                       }
-                       if (done) {
-                               *np = '\0';
-                               break;
-                       } else { /* name field extends beyond the line */
-                               line = fgetln(pfp, &len);
-                               if (line == NULL && pfp) {
-                                       /* Name extends beyond the EOF! */
-                                       hadreaderr = ferror(pfp);
-                                       if (hadreaderr)
-                                               savederrno = errno;
-                                       fclose(pfp);
-                                       pfp = NULL;
-                                       if (hadreaderr) {
-                                               cgetclose();
-                                               errno = savederrno;
-                                               return (-1);
-                                       } else {
-                                               cgetclose();
-                                               return (-1);
-                                       }
-                               } else
-                                       line[len - 1] = '\0';
-                       }
-               }
-               rp = buf;
-               for(cp = nbuf; *cp != '\0'; cp++)
-                       if (*cp == '|' || *cp == ':')
-                               break;
-                       else
-                               *rp++ = *cp;
-
-               *rp = '\0';
-               /*
-                * XXX
-                * Last argument of getent here should be nbuf if we want true
-                * sequential access in the case of duplicates.
-                * With NULL, getent will return the first entry found
-                * rather than the duplicate entry record.  This is a
-                * matter of semantics that should be resolved.
-                */
-               status = getent(bp, &dummy, db_array, -1, buf, 0, NULL);
-               if (status == -2 || status == -3)
-                       (void)cgetclose();
-
-               return (status + 1);
-       }
-       /* NOTREACHED */
-}
-
-/*
- * Cgetstr retrieves the value of the string capability cap from the
- * capability record pointed to by buf.  A pointer to a decoded, NUL
- * terminated, malloc'd copy of the string is returned in the char *
- * pointed to by str.  The length of the string not including the trailing
- * NUL is returned on success, -1 if the requested string capability
- * couldn't be found, -2 if a system error was encountered (storage
- * allocation failure).
- */
-int
-cgetstr(char *buf, const char *cap, char **str)
-{
-       u_int m_room;
-       char *bp, *mp;
-       int len;
-       char *mem;
-
-       /*
-        * Find string capability cap
-        */
-       bp = cgetcap(buf, cap, '=');
-       if (bp == NULL)
-               return (-1);
-
-       /*
-        * Conversion / storage allocation loop ...  Allocate memory in
-        * chunks SFRAG in size.
-        */
-       if ((mem = malloc(SFRAG)) == NULL) {
-               errno = ENOMEM;
-               return (-2);    /* couldn't even allocate the first fragment */
-       }
-       m_room = SFRAG;
-       mp = mem;
-
-       while (*bp != ':' && *bp != '\0') {
-               /*
-                * Loop invariants:
-                *      There is always room for one more character in mem.
-                *      Mp always points just past last character in mem.
-                *      Bp always points at next character in buf.
-                */
-               if (*bp == '^') {
-                       bp++;
-                       if (*bp == ':' || *bp == '\0')
-                               break;  /* drop unfinished escape */
-                       if (*bp == '?') {
-                               *mp++ = '\177';
-                               bp++;
-                       } else
-                               *mp++ = *bp++ & 037;
-               } else if (*bp == '\\') {
-                       bp++;
-                       if (*bp == ':' || *bp == '\0')
-                               break;  /* drop unfinished escape */
-                       if ('0' <= *bp && *bp <= '7') {
-                               int n, i;
-
-                               n = 0;
-                               i = 3;  /* maximum of three octal digits */
-                               do {
-                                       n = n * 8 + (*bp++ - '0');
-                               } while (--i && '0' <= *bp && *bp <= '7');
-                               *mp++ = n;
-                       }
-                       else switch (*bp++) {
-                               case 'b': case 'B':
-                                       *mp++ = '\b';
-                                       break;
-                               case 't': case 'T':
-                                       *mp++ = '\t';
-                                       break;
-                               case 'n': case 'N':
-                                       *mp++ = '\n';
-                                       break;
-                               case 'f': case 'F':
-                                       *mp++ = '\f';
-                                       break;
-                               case 'r': case 'R':
-                                       *mp++ = '\r';
-                                       break;
-                               case 'e': case 'E':
-                                       *mp++ = ESC;
-                                       break;
-                               case 'c': case 'C':
-                                       *mp++ = ':';
-                                       break;
-                               default:
-                                       /*
-                                        * Catches '\', '^', and
-                                        *  everything else.
-                                        */
-                                       *mp++ = *(bp-1);
-                                       break;
-                       }
-               } else
-                       *mp++ = *bp++;
-               m_room--;
-
-               /*
-                * Enforce loop invariant: if no room left in current
-                * buffer, try to get some more.
-                */
-               if (m_room == 0) {
-                       size_t size = mp - mem;
-
-                       if ((mem = reallocf(mem, size + SFRAG)) == NULL)
-                               return (-2);
-                       m_room = SFRAG;
-                       mp = mem + size;
-               }
-       }
-       *mp++ = '\0';   /* loop invariant let's us do this */
-       m_room--;
-       len = mp - mem - 1;
-
-       /*
-        * Give back any extra memory and return value and success.
-        */
-       if (m_room != 0)
-               if ((mem = reallocf(mem, (size_t)(mp - mem))) == NULL)
-                       return (-2);
-       *str = mem;
-       return (len);
-}
-
-/*
- * Cgetustr retrieves the value of the string capability cap from the
- * capability record pointed to by buf.  The difference between cgetustr()
- * and cgetstr() is that cgetustr does not decode escapes but rather treats
- * all characters literally.  A pointer to a  NUL terminated malloc'd
- * copy of the string is returned in the char pointed to by str.  The
- * length of the string not including the trailing NUL is returned on success,
- * -1 if the requested string capability couldn't be found, -2 if a system
- * error was encountered (storage allocation failure).
- */
-int
-cgetustr(char *buf, const char *cap, char **str)
-{
-       u_int m_room;
-       char *bp, *mp;
-       int len;
-       char *mem;
-
-       /*
-        * Find string capability cap
-        */
-       if ((bp = cgetcap(buf, cap, '=')) == NULL)
-               return (-1);
-
-       /*
-        * Conversion / storage allocation loop ...  Allocate memory in
-        * chunks SFRAG in size.
-        */
-       if ((mem = malloc(SFRAG)) == NULL) {
-               errno = ENOMEM;
-               return (-2);    /* couldn't even allocate the first fragment */
-       }
-       m_room = SFRAG;
-       mp = mem;
-
-       while (*bp != ':' && *bp != '\0') {
-               /*
-                * Loop invariants:
-                *      There is always room for one more character in mem.
-                *      Mp always points just past last character in mem.
-                *      Bp always points at next character in buf.
-                */
-               *mp++ = *bp++;
-               m_room--;
-
-               /*
-                * Enforce loop invariant: if no room left in current
-                * buffer, try to get some more.
-                */
-               if (m_room == 0) {
-                       size_t size = mp - mem;
-
-                       if ((mem = reallocf(mem, size + SFRAG)) == NULL)
-                               return (-2);
-                       m_room = SFRAG;
-                       mp = mem + size;
-               }
-       }
-       *mp++ = '\0';   /* loop invariant let's us do this */
-       m_room--;
-       len = mp - mem - 1;
-
-       /*
-        * Give back any extra memory and return value and success.
-        */
-       if (m_room != 0)
-               if ((mem = reallocf(mem, (size_t)(mp - mem))) == NULL)
-                       return (-2);
-       *str = mem;
-       return (len);
-}
-
-/*
- * Cgetnum retrieves the value of the numeric capability cap from the
- * capability record pointed to by buf.  The numeric value is returned in
- * the long pointed to by num.  0 is returned on success, -1 if the requested
- * numeric capability couldn't be found.
- */
-int
-cgetnum(char *buf, const char *cap, long *num)
-{
-       long n;
-       int base, digit;
-       char *bp;
-
-       /*
-        * Find numeric capability cap
-        */
-       bp = cgetcap(buf, cap, '#');
-       if (bp == NULL)
-               return (-1);
-
-       /*
-        * Look at value and determine numeric base:
-        *      0x... or 0X...  hexadecimal,
-        * else 0...            octal,
-        * else                 decimal.
-        */
-       if (*bp == '0') {
-               bp++;
-               if (*bp == 'x' || *bp == 'X') {
-                       bp++;
-                       base = 16;
-               } else
-                       base = 8;
-       } else
-               base = 10;
-
-       /*
-        * Conversion loop ...
-        */
-       n = 0;
-       for (;;) {
-               if ('0' <= *bp && *bp <= '9')
-                       digit = *bp - '0';
-               else if ('a' <= *bp && *bp <= 'f')
-                       digit = 10 + *bp - 'a';
-               else if ('A' <= *bp && *bp <= 'F')
-                       digit = 10 + *bp - 'A';
-               else
-                       break;
-
-               if (digit >= base)
-                       break;
-
-               n = n * base + digit;
-               bp++;
-       }
-
-       /*
-        * Return value and success.
-        */
-       *num = n;
-       return (0);
-}
-
-
-/*
- * Compare name field of record.
- */
-static int
-nfcmp(char *nf, char *rec)
-{
-       char *cp, tmp;
-       int ret;
-
-       for (cp = rec; *cp != ':'; cp++)
-               ;
-
-       tmp = *(cp + 1);
-       *(cp + 1) = '\0';
-       ret = strcmp(nf, rec);
-       *(cp + 1) = tmp;
-
-       return (ret);
-}
diff --git a/gen/getcap.3 b/gen/getcap.3
deleted file mode 120000 (symlink)
index ef16ef7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getcap.3
\ No newline at end of file
diff --git a/gen/getcontext.3 b/gen/getcontext.3
deleted file mode 120000 (symlink)
index 178b6ef..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getcontext.3
\ No newline at end of file
diff --git a/gen/getcwd-fbsd.c b/gen/getcwd-fbsd.c
deleted file mode 100644 (file)
index 512b88c..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (c) 1989, 1991, 1993, 1995
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getcwd.c   8.5 (Berkeley) 2/7/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getcwd.c,v 1.29 2007/01/09 00:27:53 imp Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#define        ISDOT(dp) \
-       (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
-           (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
-
-/*
- * If __getcwd() ever becomes a syscall, we can remove this workaround.
- * The problem here is that fcntl() assumes a buffer of size MAXPATHLEN,
- * if size is less than MAXPATHLEN, we need to use a temporary buffer
- * and see if it fits.  We also have to assume that open() or fcntl()
- * don't fail with errno=ERANGE.
- */
-static inline int
-__getcwd(char *buf, size_t size)
-{
-       int fd, err, save;
-       struct stat dot, pt;
-       char *b;
-
-       if ((fd = open(".", O_RDONLY)) < 0)
-               return -1;
-       if (fstat(fd, &dot) < 0) {
-               save = errno;
-               close(fd);
-               errno = save;
-               return -1;
-       }
-       /* check that the device and inode are non-zero, otherwise punt */
-       if (dot.st_dev == 0 || dot.st_ino == 0) {
-               close(fd);
-               errno = EINVAL;
-               return -1;
-       }
-       if (size < MAXPATHLEN) {
-               /* the hard case; allocate a buffer of size MAXPATHLEN to use */
-               b = (char *)alloca(MAXPATHLEN);
-               if (b == NULL) {
-                       close(fd);
-                       errno = ENOMEM; /* make sure it isn't ERANGE */
-                       return -1;
-               }
-       } else
-               b = buf;
-
-       err = fcntl(fd, F_GETPATH, b);
-       if (err) {
-               save = errno;
-               close(fd);
-               errno = save;
-               return err;
-       }
-       close(fd);
-       /*
-        * now double-check that the path returned by fcntl() has the same
-        * device and inode number as '.'.
-        */
-       if (stat(b, &pt) < 0)
-               return -1;
-       /*
-        * Since dot.st_dev and dot.st_ino are non-zero, we don't need to
-        * separately test for pt.st_dev and pt.st_ino being non-zero, because
-        * they have to match
-        */
-       if (dot.st_dev != pt.st_dev || dot.st_ino != pt.st_ino) {
-               errno = EINVAL;
-               return -1;
-       }
-       /*
-        * For the case where we allocated a buffer, check that it can fit
-        * in the real buffer, and copy it over.
-        */
-       if (size < MAXPATHLEN) {
-               if (strlen(b) >= size) {
-                       errno = ERANGE;
-                       return -1;
-               }
-               strcpy(buf, b);
-       }
-       return 0;
-}
-
-__private_extern__ char *
-__private_getcwd(pt, size, usegetpath)
-       char *pt;
-       size_t size;
-       int usegetpath;
-{
-       struct dirent *dp;
-       DIR *dir = NULL;
-       dev_t dev;
-       ino_t ino;
-       int first;
-       char *bpt, *bup;
-       struct stat s;
-       dev_t root_dev;
-       ino_t root_ino;
-       size_t ptsize, upsize;
-       int save_errno;
-       char *ept, *eup, *up, c;
-
-       /*
-        * If no buffer specified by the user, allocate one as necessary.
-        * If a buffer is specified, the size has to be non-zero.  The path
-        * is built from the end of the buffer backwards.
-        */
-       if (pt) {
-               ptsize = 0;
-               if (!size) {
-                       errno = EINVAL;
-                       return (NULL);
-               }
-               if (size == 1) {
-                       errno = ERANGE;
-                       return (NULL);
-               }
-               ept = pt + size;
-       } else {
-               if ((pt = malloc(ptsize = MAXPATHLEN)) == NULL)
-                       return (NULL);
-               ept = pt + ptsize;
-       }
-       if (usegetpath) {
-               if (__getcwd(pt, ept - pt) == 0) {
-                       return (pt);
-               } else if (errno == ERANGE) /* failed because buffer too small */
-                       return NULL;
-       }
-       bpt = ept - 1;
-       *bpt = '\0';
-
-       /*
-        * Allocate MAXPATHLEN bytes for the string of "../"'s.
-        * Should always be enough.  If it's not, allocate
-        * as necessary.  Special case the first stat, it's ".", not "..".
-        */
-       if ((up = malloc(upsize = MAXPATHLEN)) == NULL)
-               goto err;
-       eup = up + MAXPATHLEN;
-       bup = up;
-       up[0] = '.';
-       up[1] = '\0';
-
-       /* Save root values, so know when to stop. */
-       if (stat("/", &s))
-               goto err;
-       root_dev = s.st_dev;
-       root_ino = s.st_ino;
-
-       errno = 0;                      /* XXX readdir has no error return. */
-
-       for (first = 1;; first = 0) {
-               /* Stat the current level. */
-               if (lstat(up, &s))
-                       goto err;
-
-               /* Save current node values. */
-               ino = s.st_ino;
-               dev = s.st_dev;
-
-               /* Check for reaching root. */
-               if (root_dev == dev && root_ino == ino) {
-                       *--bpt = '/';
-                       /*
-                        * It's unclear that it's a requirement to copy the
-                        * path to the beginning of the buffer, but it's always
-                        * been that way and stuff would probably break.
-                        */
-                       bcopy(bpt, pt, ept - bpt);
-                       free(up);
-                       return (pt);
-               }
-
-               /*
-                * Build pointer to the parent directory, allocating memory
-                * as necessary.  Max length is 3 for "../", the largest
-                * possible component name, plus a trailing NUL.
-                */
-               while (bup + 3  + MAXNAMLEN + 1 >= eup) {
-                       if ((up = reallocf(up, upsize *= 2)) == NULL)
-                               goto err;
-                       bup = up;
-                       eup = up + upsize;
-               }
-               *bup++ = '.';
-               *bup++ = '.';
-               *bup = '\0';
-
-               /* Open and stat parent directory. */
-               if (!(dir = opendir(up)) || _fstat(dirfd(dir), &s))
-                       goto err;
-
-               /* Add trailing slash for next directory. */
-               *bup++ = '/';
-               *bup = '\0';
-
-               /*
-                * If it's a mount point, have to stat each element because
-                * the inode number in the directory is for the entry in the
-                * parent directory, not the inode number of the mounted file.
-                */
-               save_errno = 0;
-               if (s.st_dev == dev) {
-                       for (;;) {
-                               if (!(dp = readdir(dir)))
-                                       goto notfound;
-                               if (dp->d_fileno == ino)
-                                       break;
-                       }
-               } else
-                       for (;;) {
-                               if (!(dp = readdir(dir)))
-                                       goto notfound;
-                               if (ISDOT(dp))
-                                       continue;
-                               bcopy(dp->d_name, bup, dp->d_namlen + 1);
-
-                               /* Save the first error for later. */
-                               if (lstat(up, &s)) {
-                                       if (!save_errno)
-                                               save_errno = errno;
-                                       errno = 0;
-                                       continue;
-                               }
-                               if (s.st_dev == dev && s.st_ino == ino)
-                                       break;
-                       }
-
-               /*
-                * Check for length of the current name, preceding slash,
-                * leading slash.
-                */
-               while (bpt - pt < dp->d_namlen + (first ? 1 : 2)) {
-                       size_t len, off;
-
-                       if (!ptsize) {
-                               errno = ERANGE;
-                               goto err;
-                       }
-                       off = bpt - pt;
-                       len = ept - bpt;
-                       if ((pt = reallocf(pt, ptsize *= 2)) == NULL)
-                               goto err;
-                       bpt = pt + off;
-                       ept = pt + ptsize;
-                       bcopy(bpt, ept - len, len);
-                       bpt = ept - len;
-               }
-               if (!first)
-                       *--bpt = '/';
-               bpt -= dp->d_namlen;
-               bcopy(dp->d_name, bpt, dp->d_namlen);
-               (void) closedir(dir);
-               dir = NULL;
-
-               /* Truncate any file name. */
-               *bup = '\0';
-       }
-
-notfound:
-       /*
-        * If readdir set errno, use it, not any saved error; otherwise,
-        * didn't find the current directory in its parent directory, set
-        * errno to ENOENT.
-        */
-       if (!errno)
-               errno = save_errno ? save_errno : ENOENT;
-       /* FALLTHROUGH */
-err:
-       save_errno = errno;
-
-       if (ptsize)
-               free(pt);
-       if (dir)
-               (void) closedir(dir);
-       free(up);
-
-       errno = save_errno;
-       return (NULL);
-}
-
-char *
-getcwd(pt, size)
-       char *pt;
-       size_t size;
-{
-       return __private_getcwd(pt, size, 1);
-}
diff --git a/gen/getcwd.3 b/gen/getcwd.3
deleted file mode 120000 (symlink)
index 063912c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getcwd.3
\ No newline at end of file
diff --git a/gen/gethostname-fbsd.c b/gen/gethostname-fbsd.c
deleted file mode 100644 (file)
index 031e2c8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostname.c      8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $");
-
-#include <string.h>
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <limits.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-int
-gethostname(name, namelen)
-       char *name;
-       size_t namelen;
-{
-       int mib[2];
-
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_HOSTNAME;
-       if (namelen < MAXHOSTNAMELEN + 1) {
-               char local_buf[MAXHOSTNAMELEN + 1];
-               size_t local_len = sizeof(local_buf);
-               if (sysctl(mib, 2, local_buf, &local_len, NULL, 0) == -1) {
-                       if (errno == ENOMEM)
-                               errno = ENAMETOOLONG;
-                       return (-1);
-               }
-               strncpy(name, local_buf, namelen);
-               name[namelen - 1] = 0;
-       } else {
-       if (sysctl(mib, 2, name, &namelen, NULL, 0) == -1) {
-               if (errno == ENOMEM)
-                       errno = ENAMETOOLONG;
-               return (-1);
-               }
-       }
-       return (0);
-}
diff --git a/gen/gethostname.3 b/gen/gethostname.3
deleted file mode 100644 (file)
index eed2346..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)gethostname.3      8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/gethostname.3,v 1.17 2007/01/09 00:27:54 imp Exp $
-.\"
-.Dd August 18, 2003
-.Dt GETHOSTNAME 3
-.Os
-.Sh NAME
-.Nm gethostname ,
-.Nm sethostname
-.Nd get/set name of current host
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn gethostname "char *name" "size_t namelen"
-.Ft int
-.Fn sethostname "const char *name" "int namelen"
-.Sh DESCRIPTION
-The
-.Fn gethostname
-function
-returns the standard host name for the current processor, as
-previously set by
-.Fn sethostname .
-The
-.Fa namelen
-argument
-specifies the size of the
-.Fa name
-array.
-The returned name is null-terminated, unless insufficient space is provided.
-.Pp
-The
-.Fn sethostname
-function
-sets the name of the host machine to be
-.Fa name ,
-which has length
-.Fa namelen .
-This call is restricted to the super-user and
-is normally used only when the system is bootstrapped.
-.Pp
-Host names are limited in length to
-.Brq Dv sysconf(_SC_HOST_NAME_MAX)
-characters, not including the trailing null, currently 255.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following errors may be returned by these calls:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa name
-or
-.Fa namelen
-argument gave an
-invalid address.
-.It Bq Er ENAMETOOLONG
-The current host name is longer than
-.Fa namelen .
-(For
-.Fn gethostname
-only.)
-.It Bq Er EPERM
-The caller tried to set the host name and was not the super-user.
-.El
-.Sh SEE ALSO
-.Xr sysconf 3 ,
-.Xr sysctl 3
-.Sh STANDARDS
-The
-.Fn gethostname
-function conforms to
-.St -p1003.1-2001 .
-Callers should be aware that
-.Brq Dv sysconf(_SC_HOST_NAME_MAX)
-may be variable or infinite, but is guaranteed to be no less than
-.Brq Dv _POSIX_HOST_NAME_MAX .
-On older systems, this limit was defined in the non-standard header
-.In sys/param.h
-as
-.Dv MAXHOSTNAMELEN ,
-and counted the terminating null.
-The
-.Fn sethostname
-function and the error returns for
-.Fn gethostname
-are not standardized.
-.Sh HISTORY
-The
-.Fn gethostname
-function appeared in
-.Bx 4.2 .
-The
-.Fa namelen
-argument to
-.Fn gethostname
-was changed to
-.Vt size_t
-in
-.Fx 5.2
-for alignment with
-.St -p1003.1-2001 .
diff --git a/gen/getlastlogx.3 b/gen/getlastlogx.3
deleted file mode 100644 (file)
index 8a70bcf..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-.\"    $NetBSD: getlastlogx.3,v 1.2 2008/04/30 13:10:50 martin Exp $
-.\"
-.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Thomas Klausner.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd Dec 26, 2005
-.Dt GETLASTLOGX 3
-.Os
-.Sh NAME
-.Nm getlastlogx ,
-.Nm getlastlogxbyname ,
-.Nm getutmp ,
-.Nm getutmpx ,
-.Nm utmpxname
-.Nd user accounting database functions
-.Sh SYNOPSIS
-.In utmpx.h
-.Ft struct lastlogx *
-.Fn getlastlogx "uid_t uid" "struct lastlogx *ll"
-.Ft struct lastlogx *
-.Fn getlastlogxbyname "const char *name" "struct lastlogx *ll"
-.Ft void
-.Fn getutmp "const struct utmpx *ux" "struct utmp *u"
-.Ft void
-.Fn getutmpx "const struct utmp *u" "struct utmpx *ux"
-.Ft int
-.Fn utmpxname "const char *fname"
-.Sh DESCRIPTION
-The
-.Fn getlastlogx
-function looks up the entry for the user with user id
-.Fa uid
-and returns it in
-.Fa \&ll .
-If the provided
-.Fa \&ll
-is
-.Dv NULL ,
-the necessary space will be allocated by
-.Fn getlastlogx
-and should be
-.Fn free Ns d
-by the caller.
-The
-.Fn getlastlogxbyname
-function is similar to
-.Fn getlastlogx ,
-except the user name is passed.
-.Pp
-.Fn getutmp
-function fills out the entries in the struct utmp
-.Fa u
-with the data provided in the struct utmpx
-.Fa ux .
-.Fn getutmpx
-does the opposite, filling out the entries in the struct utmpx
-.Fa ux
-with the data provided in the struct utmp
-.Fa u ,
-and initializing all the unknown fields to 0.
-The sole exception is the
-.Fa ut_type
-field, which will be initialized to
-.Dv USER_PROCESS .
-.Pp
-A
-.Ft struct lastlogx
-is defined like this:
-.Bd -literal
-struct lastlogx {
-        struct timeval ll_tv;           /* time entry was created */
-        char ll_line[_UTX_LINESIZE];    /* tty name */
-        char ll_host[_UTX_HOSTSIZE];    /* host name */
-};
-.Ed
-.Pp
-The
-.Fn utmpxname
-function sets the default
-.Xr utmpx 5
-database file name to
-.Fa fname .
-.Sh RETURN VALUES
-.Fn getlastlogx
-and
-.Fn getlastlogxbyname
-return the found entry on success, or
-.Dv NULL
-if it could not open the database, could not find an entry matching
-.Fa uid
-or
-.Fa name ,
-or could not allocate the necessary space (in case
-.Fa \&ll
-was
-.Dv NULL ) .
-.Pp
-.Fn utmpxname
-returns 1 on success, or 0 if the supplied file name was too long or
-did not end with
-.Sq x .
-.Sh SEE ALSO
-.Xr endutxent 3 ,
-.Xr utmpx 5
-.Sh HISTORY
-The functions
-.Fn getutmp ,
-.Fn getutmpx ,
-and
-.Fn utmpxname
-first appeared in
-.Tn Solaris .
-.Nm getlastlogx
-first appeared in
-.Nx 2.0 .
diff --git a/gen/getlastlogx.3.orig b/gen/getlastlogx.3.orig
deleted file mode 100644 (file)
index cb7404c..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-.\"    $NetBSD: getlastlogx.3,v 1.2 2008/04/30 13:10:50 martin Exp $
-.\"
-.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Thomas Klausner.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd August 26, 2003
-.Dt GETLASTLOGX 3
-.Os
-.Sh NAME
-.Nm getlastlogx ,
-.Nm getutmp ,
-.Nm getutmpx ,
-.Nm updlastlogx ,
-.Nm updwtmpx ,
-.Nm utmpxname
-.Nd user accounting database functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In utmpx.h
-.Ft struct lastlogx *
-.Fn getlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll"
-.Ft void
-.Fn getutmp "const struct utmpx *ux" "struct utmp *u"
-.Ft void
-.Fn getutmpx "const struct utmp *u" "struct utmpx *ux"
-.Ft int
-.Fn updlastlogx "const char *fname" "uid_t uid" "struct lastlogx *ll"
-.Ft int
-.Fn updwtmpx "const char *file" "const struct utmpx *utx"
-.Ft int
-.Fn utmpxname "const char *fname"
-.Sh DESCRIPTION
-The
-.Fn getlastlogx
-function looks up the entry for the user with user id
-.Fa uid
-in the
-.Xr lastlogx 5
-file given by
-.Fa fname
-and returns it in
-.Fa \&ll .
-If the provided
-.Fa \&ll
-is
-.Dv NULL ,
-the necessary space will be allocated by
-.Fn getlastlogx
-and should be
-.Fn free Ns d
-by the caller.
-.Pp
-The
-.Fn getutmp
-function fills out the entries in the struct utmp
-.Fa u
-with the data provided in the struct utmpx
-.Fa ux .
-.Fn getutmpx
-does the opposite, filling out the entries in the struct utmpx
-.Fa ux
-with the data provided in the struct utmp
-.Fa u ,
-and initializing all the unknown fields to 0.
-The sole exception is the
-.Fa ut_type
-field, which will be initialized to
-.Dv USER_PROCESS .
-.Pp
-The
-.Fn updlastlogx
-function tries to update the information for the user with the user id
-.Fa uid
-in the
-.Xr lastlogx 5
-file given by
-.Fa fname
-with the data supplied in
-.Fa \&ll .
-A
-.Ft struct lastlogx
-is defined like this:
-.Bd -literal
-struct lastlogx {
-        struct timeval ll_tv;           /* time entry was created */
-        char ll_line[_UTX_LINESIZE];    /* tty name */
-        char ll_host[_UTX_HOSTSIZE];    /* host name */
-        struct sockaddr_storage ll_ss;  /* address where entry was made from */
-};
-.Ed
-All the fields should be filled out by the caller.
-.Pp
-The
-.Fn updwtmpx
-function updates the
-.Xr wtmpx 5
-file
-.Fa file
-with the
-.Xr utmpx 5
-entry
-.Fa utx .
-.Pp
-The
-.Fn utmpxname
-function sets the default
-.Xr utmpx 5
-database file name to
-.Fa fname .
-.Sh RETURN VALUES
-.Fn getlastlogx
-returns the found entry on success, or
-.Dv NULL
-if it could not open the database, could not find an entry matching
-.Fa uid
-in there, or could not allocate the necessary space (in case
-.Fa \&ll
-was
-.Dv NULL ) .
-.Pp
-.Fn utmpxname
-returns 1 on success, or 0 if the supplied file name was too long or
-did not end with
-.Sq x .
-.Pp
-.Fn updlastlogx
-and
-.Fn updwtmpx
-return 0 on success, or \-1 in case the database or file respectively
-could not be opened or the data not written into it.
-.Sh SEE ALSO
-.Xr endutxent 3 ,
-.Xr loginx 3 ,
-.Xr utmpx 5
-.Sh HISTORY
-The functions
-.Fn getutmp ,
-.Fn getutmpx ,
-.Fn updwtmpx ,
-and
-.Fn utmpxname
-first appeared in
-.Tn Solaris .
-.Nm getlastlogx
-and
-.Nm updlastlogx
-first appeared in
-.Nx 2.0 .
diff --git a/gen/getlogin-fbsd.c b/gen/getlogin-fbsd.c
deleted file mode 100644 (file)
index f60de8d..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getlogin.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getlogin.c,v 1.11 2009/12/05 19:04:21 ed Exp $");
-
-#include <sys/param.h>
-#include <errno.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include "namespace.h"
-#include <pthread.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-
-#define        THREAD_LOCK()   if (__isthreaded) _pthread_mutex_lock(&logname_mutex)
-#define        THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&logname_mutex)
-
-extern int             __getlogin(char *, int);
-
-int                    _logname_valid;         /* known to setlogin() */
-static pthread_mutex_t logname_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static char *
-getlogin_basic(int *status)
-{
-       static char logname[MAXLOGNAME];
-
-       if (_logname_valid == 0) {
-               if (__getlogin(logname, sizeof(logname)) < 0) {
-                       *status = errno;
-                       return (NULL);
-               }
-               _logname_valid = 1;
-       }
-       *status = 0;
-       return (*logname ? logname : NULL);
-}
-
-char *
-getlogin(void)
-{
-       char    *result;
-       int     status;
-
-       THREAD_LOCK();
-       result = getlogin_basic(&status);
-       THREAD_UNLOCK();
-       return (result);
-}
-
-int
-getlogin_r(char *logname, size_t namelen)
-{
-       char    *result;
-       int     len;
-       int     status;
-       
-       THREAD_LOCK();
-       result = getlogin_basic(&status);
-       if (status == 0) {
-               if ((len = strlen(result) + 1) > namelen)
-                       status = ERANGE;
-               else
-                       strncpy(logname, result, len);
-       }
-       THREAD_UNLOCK();
-       return (status);
-}
diff --git a/gen/getmntinfo-fbsd.c b/gen/getmntinfo-fbsd.c
deleted file mode 120000 (symlink)
index abe4b01..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getmntinfo.c
\ No newline at end of file
diff --git a/gen/getmntinfo.3 b/gen/getmntinfo.3
deleted file mode 100644 (file)
index 0c8283b..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)getmntinfo.3       8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/gen/getmntinfo.3,v 1.13 2007/01/09 00:27:54 imp Exp $
-.\"
-.Dd May 4, 2010
-.Dt GETMNTINFO 3
-.Os
-.Sh NAME
-.Nm getmntinfo
-.Nm getmntinfo64
-.Nd get information about mounted file systems
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/ucred.h
-.In sys/mount.h
-.Ft int
-.Fn getmntinfo "struct statfs **mntbufp" "int flags"
-.Sh TRANSITIIONAL SYNOPSIS (NOW DEPRECATED)
-.Ft int
-.br
-.Fn getmntinfo64 "struct statfs64 **mntbufp" "int flags" ;
-.Sh DESCRIPTION
-The
-.Fn getmntinfo
-function
-returns an array of
-.Ft statfs
-structures describing each currently mounted file system (see
-.Xr statfs 2 ) .
-As
-.Xr statfs 2
-indicates, the structure is defined differently depending on
-whether the macro _DARWIN_FEATURE_64_BIT_INODE is defined (see
-.Xr stat 2
-for more information on this macro).
-.Pp
-The
-.Fn getmntinfo
-function
-passes its
-.Fa flags
-argument transparently to
-.Xr getfsstat 2 .
-.Sh RETURN VALUES
-On successful completion,
-.Fn getmntinfo
-returns a count of the number of elements in the array.
-The pointer to the array is stored into
-.Fa mntbufp .
-.Pp
-If an error occurs, zero is returned and the external variable
-.Va errno
-is set to indicate the error.
-Although the pointer
-.Fa mntbufp
-will be unmodified, any information previously returned by
-.Fn getmntinfo
-will be lost.
-.Sh ERRORS
-The
-.Fn getmntinfo
-function
-may fail and set errno for any of the errors specified for the library
-routines
-.Xr getfsstat 2
-or
-.Xr malloc 3 .
-.Sh TRANSITIONAL DESCRIPTION (NOW DEPRECATED)
-The
-.Fn getmntinfo64
-routine is equivalent to its corresponding non-64-suffixed routine,
-when 64-bit inodes are in effect.
-It was added before there was support for the symbol variants, and so is
-now deprecated.
-Instead of using it, set the
-.Dv _DARWIN_USE_64_BIT_INODE
-macro before including header files to force 64-bit inode support.
-.Pp
-The
-.Ft statfs64
-structure used by this deprecated routine is the same as the
-.Ft statfs
-structure when 64-bit inodes are in effect.
-.Sh SEE ALSO
-.Xr getfsstat 2 ,
-.Xr mount 2 ,
-.Xr stat 2 ,
-.Xr statfs 2 ,
-.Xr mount 8
-.Sh HISTORY
-The
-.Fn getmntinfo
-function first appeared in
-.Bx 4.4 .
-.Sh BUGS
-The
-.Fn getmntinfo
-function writes the array of structures to an internal static object
-and returns
-a pointer to that object.
-Subsequent calls to
-.Fn getmntinfo
-will modify the same object.
-.Pp
-The memory allocated by
-.Fn getmntinfo
-cannot be
-.Xr free 3 Ns 'd
-by the application.
diff --git a/gen/getmntinfo64-fbsd.c b/gen/getmntinfo64-fbsd.c
deleted file mode 100644 (file)
index f4f3a28..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getmntinfo.c       8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getmntinfo.c,v 1.5 2007/01/09 00:27:54 imp Exp $");
-
-#include <sys/param.h>
-#include <sys/ucred.h>
-#include <sys/mount.h>
-#include <stdlib.h>
-
-/*
- * Return information about mounted filesystems.
- */
-int
-getmntinfo64(mntbufp, flags)
-       struct statfs64 **mntbufp;
-       int flags;
-{
-       static struct statfs64 *mntbuf;
-       static int mntsize;
-       static long bufsize;
-
-       if (mntsize <= 0 && (mntsize = getfsstat64(0, 0, MNT_NOWAIT)) < 0)
-               return (0);
-       if (bufsize > 0 && (mntsize = getfsstat64(mntbuf, bufsize, flags)) < 0)
-               return (0);
-       while (bufsize <= mntsize * sizeof(struct statfs64)) {
-               if (mntbuf)
-                       free(mntbuf);
-               bufsize = (mntsize + 1) * sizeof(struct statfs64);
-               if ((mntbuf = (struct statfs64 *)malloc(bufsize)) == 0)
-                       return (0);
-               if ((mntsize = getfsstat64(mntbuf, bufsize, flags)) < 0)
-                       return (0);
-       }
-       *mntbufp = mntbuf;
-       return (mntsize);
-}
diff --git a/gen/getmntinfo64-fbsd.c.orig b/gen/getmntinfo64-fbsd.c.orig
deleted file mode 100644 (file)
index 24b7886..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getmntinfo.c       8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getmntinfo.c,v 1.5 2007/01/09 00:27:54 imp Exp $");
-
-#include <sys/param.h>
-#include <sys/ucred.h>
-#include <sys/mount.h>
-#include <stdlib.h>
-
-/*
- * Return information about mounted filesystems.
- */
-int
-getmntinfo(mntbufp, flags)
-       struct statfs **mntbufp;
-       int flags;
-{
-       static struct statfs *mntbuf;
-       static int mntsize;
-       static long bufsize;
-
-       if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0)
-               return (0);
-       if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
-               return (0);
-       while (bufsize <= mntsize * sizeof(struct statfs)) {
-               if (mntbuf)
-                       free(mntbuf);
-               bufsize = (mntsize + 1) * sizeof(struct statfs);
-               if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0)
-                       return (0);
-               if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
-                       return (0);
-       }
-       *mntbufp = mntbuf;
-       return (mntsize);
-}
diff --git a/gen/getpagesize-fbsd.c b/gen/getpagesize-fbsd.c
deleted file mode 120000 (symlink)
index 4b61652..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getpagesize.c
\ No newline at end of file
diff --git a/gen/getpagesize.3 b/gen/getpagesize.3
deleted file mode 120000 (symlink)
index fbeaba6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getpagesize.3
\ No newline at end of file
diff --git a/gen/getpass.3 b/gen/getpass.3
deleted file mode 120000 (symlink)
index c9ce40a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getpass.3
\ No newline at end of file
diff --git a/gen/getpeereid-fbsd.c b/gen/getpeereid-fbsd.c
deleted file mode 120000 (symlink)
index 843d1f4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getpeereid.c
\ No newline at end of file
diff --git a/gen/getpeereid.3 b/gen/getpeereid.3
deleted file mode 120000 (symlink)
index 222f1b4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getpeereid.3
\ No newline at end of file
diff --git a/gen/getprogname-fbsd.c b/gen/getprogname-fbsd.c
deleted file mode 100644 (file)
index a736f65..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/getprogname.c,v 1.4 2002/03/29 22:43:41 markm Exp $");
-
-#include "namespace.h"
-#include <stdlib.h>
-#include <crt_externs.h>
-#define        __progname      (*_NSGetProgname())
-#include "un-namespace.h"
-
-#include "libc_private.h"
-
-__weak_reference(_getprogname, getprogname);
-
-const char *
-_getprogname(void)
-{
-
-       return (__progname);
-}
diff --git a/gen/getprogname.3 b/gen/getprogname.3
deleted file mode 100644 (file)
index b7b9c99..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-.\"
-.\" Copyright (c) 2001 Christopher G. Demetriou
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"          This product includes software developed for the
-.\"          NetBSD Project.  See http://www.netbsd.org/ for
-.\"          information about NetBSD.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\"    derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/getprogname.3,v 1.5 2001/10/01 16:08:51 ru Exp $
-.\"
-.Dd May 1, 2001
-.Dt GETPROGNAME 3
-.Os
-.Sh NAME
-.Nm getprogname ,
-.Nm setprogname
-.Nd get or set the program name
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft const char *
-.Fn getprogname "void"
-.Ft void
-.Fn setprogname "const char *progname"
-.Sh DESCRIPTION
-The
-.Fn getprogname
-and
-.Fn setprogname
-functions manipulate the name of the current program.
-They are used by error-reporting routines to produce
-consistent output.
-.Pp
-The
-.Fn getprogname
-function returns the name of the program.
-If the name has not been set yet, it will return
-.Dv NULL .
-.Pp
-The
-.Fn setprogname
-function sets the name of the program to be the last component of the
-.Fa progname
-argument.
-Since a pointer to the given string is kept as the program name,
-it should not be modified for the rest of the program's lifetime.
-.Pp
-In
-.Fx ,
-the name of the program is set by the start-up code that is run before
-.Fn main ;
-thus,
-running
-.Fn setprogname
-is not necessary.
-Programs that desire maximum portability should still call it;
-on another operating system,
-these functions may be implemented in a portability library.
-Calling
-.Fn setprogname
-allows the aforementioned library to learn the program name without
-modifications to the start-up code.
-.Sh SEE ALSO
-.Xr err 3
-.Sh HISTORY
-These functions first appeared in
-.Nx 1.6 ,
-and made their way into
-.Fx 4.4 .
diff --git a/gen/glob-fbsd.c b/gen/glob-fbsd.c
deleted file mode 100644 (file)
index cc80496..0000000
+++ /dev/null
@@ -1,998 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)glob.c     8.3 (Berkeley) 10/13/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.28 2010/05/12 17:44:00 gordon Exp $");
-
-#include "xlocale_private.h"
-
-/*
- * glob(3) -- a superset of the one defined in POSIX 1003.2.
- *
- * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
- *
- * Optional extra services, controlled by flags not defined by POSIX:
- *
- * GLOB_QUOTE:
- *     Escaping convention: \ inhibits any special meaning the following
- *     character might have (except \ at end of string is retained).
- * GLOB_MAGCHAR:
- *     Set in gl_flags if pattern contained a globbing character.
- * GLOB_NOMAGIC:
- *     Same as GLOB_NOCHECK, but it will only append pattern if it did
- *     not contain any magic characters.  [Used in csh style globbing]
- * GLOB_ALTDIRFUNC:
- *     Use alternately specified directory access functions.
- * GLOB_TILDE:
- *     expand ~user/foo to the /home/dir/of/user/foo
- * GLOB_BRACE:
- *     expand {1,2}{a,b} to 1a 1b 2a 2b
- * gl_matchc:
- *     Number of matches in the current invocation of glob.
- */
-
-/*
- * Some notes on multibyte character support:
- * 1. Patterns with illegal byte sequences match nothing - even if
- *    GLOB_NOCHECK is specified.
- * 2. Illegal byte sequences in filenames are handled by treating them as
- *    single-byte characters with a value of the first byte of the sequence
- *    cast to wchar_t.
- * 3. State-dependent encodings are not currently supported.
- */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <dirent.h>
-#include <errno.h>
-#include <glob.h>
-#include <limits.h>
-#include <pwd.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <wchar.h>
-
-#include "collate.h"
-
-#define GLOB_LIMIT_STRING      65536   /* number of readdirs */
-#define GLOB_LIMIT_STAT                128     /* number of stat system calls */
-#define GLOB_LIMIT_READDIR     16384   /* total buffer size of path strings */
-#define GLOB_LIMIT_PATH                1024    /* number of path elements */
-#define GLOB_LIMIT_BRACE       128     /* Number of brace calls */
-
-struct glob_limit {
-       size_t l_string;
-       size_t l_stat;  
-       size_t l_readdir;       
-       size_t l_brace;
-};
-
-#define        DOLLAR          '$'
-#define        DOT             '.'
-#define        EOS             '\0'
-#define        LBRACKET        '['
-#define        NOT             '!'
-#define        QUESTION        '?'
-#define        QUOTE           '\\'
-#define        RANGE           '-'
-#define        RBRACKET        ']'
-#define        SEP             '/'
-#define        STAR            '*'
-#define        TILDE           '~'
-#define        UNDERSCORE      '_'
-#define        LBRACE          '{'
-#define        RBRACE          '}'
-#define        SLASH           '/'
-#define        COMMA           ','
-
-#ifndef DEBUG
-
-#define        M_QUOTE         0x8000000000ULL
-#define        M_PROTECT       0x4000000000ULL
-#define        M_MASK          0xffffffffffULL
-#define        M_CHAR          0x00ffffffffULL
-
-typedef uint_fast64_t Char;
-
-#else
-
-#define        M_QUOTE         0x80
-#define        M_PROTECT       0x40
-#define        M_MASK          0xff
-#define        M_CHAR          0x7f
-
-typedef char Char;
-
-#endif
-
-
-#define        CHAR(c)         ((Char)((c)&M_CHAR))
-#define        META(c)         ((Char)((c)|M_QUOTE))
-#define        M_ALL           META('*')
-#define        M_END           META(']')
-#define        M_NOT           META('!')
-#define        M_ONE           META('?')
-#define        M_RNG           META('-')
-#define        M_SET           META('[')
-#define        ismeta(c)       (((c)&M_QUOTE) != 0)
-
-
-#define compare                __gl_compare
-#define g_Ctoc         __gl_g_Ctoc
-#define g_strchr       __gl_g_strchr
-#define globextend     __gl_globextend
-#define globtilde      __gl_globtilde
-#define match          __gl_match
-__private_extern__ int  compare(const void *, const void *);
-__private_extern__ int  g_Ctoc(const Char *, char *, size_t, locale_t);
-__private_extern__ const Char *g_strchr(const Char *, wchar_t);
-__private_extern__ int  globextend(const Char *, glob_t *, struct glob_limit *, locale_t);
-__private_extern__ const Char *        
-                globtilde(const Char *, Char *, size_t, glob_t *);
-__private_extern__ int  match(Char *, Char *, Char *, locale_t);
-
-
-static int      g_lstat(Char *, struct stat *, glob_t *, locale_t);
-static DIR     *g_opendir(Char *, glob_t *, locale_t);
-#ifdef notdef
-static Char    *g_strcat(Char *, const Char *);
-#endif
-static int      g_stat(Char *, struct stat *, glob_t *, locale_t);
-static int      glob0(const Char *, glob_t *, struct glob_limit *, locale_t);
-static int      glob1(Char *, glob_t *, struct glob_limit *, locale_t);
-static int      glob2(Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *, locale_t);
-static int      glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, struct glob_limit *, locale_t);
-static int      globexp1(const Char *, glob_t *, struct glob_limit *, locale_t);
-static int      globexp2(const Char *, const Char *, glob_t *, int *, struct glob_limit *, locale_t);
-#ifdef DEBUG
-static void     qprintf(const char *, Char *);
-#endif
-
-static int
-__glob(const char *pattern, glob_t *pglob)
-{
-       const char *patnext;
-       struct glob_limit limit = { 0, 0, 0, 0 };
-       Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
-       mbstate_t mbs;
-       wchar_t wc;
-       size_t clen;
-       locale_t loc = __current_locale();
-       int mb_cur_max = MB_CUR_MAX_L(loc);
-
-       patnext = pattern;
-       if (!(pglob->gl_flags & GLOB_APPEND)) {
-               pglob->gl_pathc = 0;
-               pglob->gl_pathv = NULL;
-               if (!(pglob->gl_flags & GLOB_DOOFFS))
-                       pglob->gl_offs = 0;
-       }
-       pglob->gl_matchc = 0;
-
-       bufnext = patbuf;
-       bufend = bufnext + MAXPATHLEN - 1;
-       if (pglob->gl_flags & GLOB_NOESCAPE) {
-               memset(&mbs, 0, sizeof(mbs));
-               while (bufend - bufnext >= mb_cur_max) {
-                       clen = mbrtowc_l(&wc, patnext, MB_LEN_MAX, &mbs, loc);
-                       if (clen == (size_t)-1 || clen == (size_t)-2)
-                               return (GLOB_NOMATCH);
-                       else if (clen == 0)
-                               break;
-                       *bufnext++ = wc;
-                       patnext += clen;
-               }
-       } else {
-               /* Protect the quoted characters. */
-               memset(&mbs, 0, sizeof(mbs));
-               while (bufend - bufnext >= mb_cur_max) {
-                       if (*patnext == QUOTE) {
-                               if (*++patnext == EOS) {
-                                       *bufnext++ = QUOTE | M_PROTECT;
-                                       continue;
-                               }
-                               prot = M_PROTECT;
-                       } else
-                               prot = 0;
-                       clen = mbrtowc_l(&wc, patnext, MB_LEN_MAX, &mbs, loc);
-                       if (clen == (size_t)-1 || clen == (size_t)-2)
-                               return (GLOB_NOMATCH);
-                       else if (clen == 0)
-                               break;
-                       *bufnext++ = wc | prot;
-                       patnext += clen;
-               }
-       }
-       *bufnext = EOS;
-
-       if (pglob->gl_flags & GLOB_BRACE)
-           return globexp1(patbuf, pglob, &limit, loc);
-       else
-           return glob0(patbuf, pglob, &limit, loc);
-}
-
-int
-glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
-{
-#ifdef __BLOCKS__
-       pglob->gl_flags = flags & ~(GLOB_MAGCHAR | _GLOB_ERR_BLOCK);
-#else /* !__BLOCKS__ */
-       pglob->gl_flags = flags & ~GLOB_MAGCHAR;
-#endif /* __BLOCKS__ */
-       pglob->gl_errfunc = errfunc;
-       return __glob(pattern, pglob);
-}
-
-#ifdef __BLOCKS__
-int
-glob_b(const char *pattern, int flags, int (^errblk)(const char *, int), glob_t *pglob)
-{
-       pglob->gl_flags = flags & ~GLOB_MAGCHAR;
-       pglob->gl_flags |= _GLOB_ERR_BLOCK;
-       pglob->gl_errblk = errblk;
-       return __glob(pattern, pglob);
-}
-#endif /* __BLOCKS__ */
-
-/*
- * Expand recursively a glob {} pattern. When there is no more expansion
- * invoke the standard globbing routine to glob the rest of the magic
- * characters
- */
-static int
-globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
-{
-       const Char* ptr = pattern;
-       int rv;
-
-       if ((pglob->gl_flags & GLOB_LIMIT) &&
-           limit->l_brace++ >= GLOB_LIMIT_BRACE) {
-               errno = 0;
-               return GLOB_NOSPACE;
-       }
-
-       /* Protect a single {}, for find(1), like csh */
-       if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
-               return glob0(pattern, pglob, limit, loc);
-
-       while ((ptr = g_strchr(ptr, LBRACE)) != NULL)
-               if (!globexp2(ptr, pattern, pglob, &rv, limit, loc))
-                       return rv;
-
-       return glob0(pattern, pglob, limit, loc);
-}
-
-
-/*
- * Recursive brace globbing helper. Tries to expand a single brace.
- * If it succeeds then it invokes globexp1 with the new pattern.
- * If it fails then it tries to glob the rest of the pattern and returns.
- */
-static int
-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, struct glob_limit *limit, locale_t loc)
-{
-       int     i;
-       Char   *lm, *ls;
-       const Char *pe, *pm, *pm1, *pl;
-       Char    patbuf[MAXPATHLEN];
-
-       /* copy part up to the brace */
-       for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
-               continue;
-       *lm = EOS;
-       ls = lm;
-
-       /* Find the balanced brace */
-       for (i = 0, pe = ++ptr; *pe; pe++)
-               if (*pe == LBRACKET) {
-                       /* Ignore everything between [] */
-                       for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
-                               continue;
-                       if (*pe == EOS) {
-                               /*
-                                * We could not find a matching RBRACKET.
-                                * Ignore and just look for RBRACE
-                                */
-                               pe = pm;
-                       }
-               }
-               else if (*pe == LBRACE)
-                       i++;
-               else if (*pe == RBRACE) {
-                       if (i == 0)
-                               break;
-                       i--;
-               }
-
-       /* Non matching braces; just glob the pattern */
-       if (i != 0 || *pe == EOS) {
-               *rv = glob0(patbuf, pglob, limit, loc);
-               return 0;
-       }
-
-       for (i = 0, pl = pm = ptr; pm <= pe; pm++)
-               switch (*pm) {
-               case LBRACKET:
-                       /* Ignore everything between [] */
-                       for (pm1 = pm++; *pm != RBRACKET && *pm != EOS; pm++)
-                               continue;
-                       if (*pm == EOS) {
-                               /*
-                                * We could not find a matching RBRACKET.
-                                * Ignore and just look for RBRACE
-                                */
-                               pm = pm1;
-                       }
-                       break;
-
-               case LBRACE:
-                       i++;
-                       break;
-
-               case RBRACE:
-                       if (i) {
-                           i--;
-                           break;
-                       }
-                       /* FALLTHROUGH */
-               case COMMA:
-                       if (i && *pm == COMMA)
-                               break;
-                       else {
-                               /* Append the current string */
-                               for (lm = ls; (pl < pm); *lm++ = *pl++)
-                                       continue;
-                               /*
-                                * Append the rest of the pattern after the
-                                * closing brace
-                                */
-                               for (pl = pe + 1; (*lm++ = *pl++) != EOS;)
-                                       continue;
-
-                               /* Expand the current pattern */
-#ifdef DEBUG
-                               qprintf("globexp2:", patbuf);
-#endif
-                               *rv = globexp1(patbuf, pglob, limit, loc);
-
-                               /* move after the comma, to the next string */
-                               pl = pm + 1;
-                       }
-                       break;
-
-               default:
-                       break;
-               }
-       *rv = 0;
-       return 0;
-}
-
-
-
-#ifndef BUILDING_VARIANT
-/*
- * expand tilde from the passwd file.
- */
-__private_extern__ const Char *
-globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
-{
-       struct passwd *pwd;
-       char *h;
-       const Char *p;
-       Char *b, *eb;
-
-       if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
-               return pattern;
-
-       /* 
-        * Copy up to the end of the string or / 
-        */
-       eb = &patbuf[patbuf_len - 1];
-       for (p = pattern + 1, h = (char *) patbuf;
-           h < (char *)eb && *p && *p != SLASH; *h++ = *p++)
-               continue;
-
-       *h = EOS;
-
-       if (((char *) patbuf)[0] == EOS) {
-               /*
-                * handle a plain ~ or ~/ by expanding $HOME first (iff
-                * we're not running setuid or setgid) and then trying
-                * the password file
-                */
-               if (issetugid() != 0 ||
-                   (h = getenv("HOME")) == NULL) {
-                       if (((h = getlogin()) != NULL &&
-                            (pwd = getpwnam(h)) != NULL) ||
-                           (pwd = getpwuid(getuid())) != NULL)
-                               h = pwd->pw_dir;
-                       else
-                               return pattern;
-               }
-       }
-       else {
-               /*
-                * Expand a ~user
-                */
-               if ((pwd = getpwnam((char*) patbuf)) == NULL)
-                       return pattern;
-               else
-                       h = pwd->pw_dir;
-       }
-
-       /* Copy the home directory */
-       for (b = patbuf; b < eb && *h; *b++ = *h++)
-               continue;
-
-       /* Append the rest of the pattern */
-       while (b < eb && (*b++ = *p++) != EOS)
-               continue;
-       *b = EOS;
-
-       return patbuf;
-}
-#endif /* BUILDING_VARIANT */
-
-
-/*
- * The main glob() routine: compiles the pattern (optionally processing
- * quotes), calls glob1() to do the real pattern matching, and finally
- * sorts the list (unless unsorted operation is requested).  Returns 0
- * if things went well, nonzero if errors occurred.
- */
-static int
-glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
-{
-       const Char *qpatnext;
-       int err;
-       size_t oldpathc;
-       Char *bufnext, c, patbuf[MAXPATHLEN];
-
-       qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
-       oldpathc = pglob->gl_pathc;
-       bufnext = patbuf;
-
-       /* We don't need to check for buffer overflow any more. */
-       while ((c = *qpatnext++) != EOS) {
-               if (c & M_PROTECT) {
-                       *bufnext++ = CHAR(c);
-                       continue;
-               } /* else */
-               switch (c) {
-               case LBRACKET:
-                       c = *qpatnext;
-                       if (c == NOT)
-                               ++qpatnext;
-                       if (*qpatnext == EOS ||
-                           g_strchr(qpatnext+1, RBRACKET) == NULL) {
-                               *bufnext++ = LBRACKET;
-                               if (c == NOT)
-                                       --qpatnext;
-                               break;
-                       }
-                       *bufnext++ = M_SET;
-                       if (c == NOT)
-                               *bufnext++ = M_NOT;
-                       c = *qpatnext++;
-                       do {
-                               *bufnext++ = CHAR(c);
-                               if (*qpatnext == RANGE &&
-                                   (c = qpatnext[1]) != RBRACKET) {
-                                       *bufnext++ = M_RNG;
-                                       *bufnext++ = CHAR(c);
-                                       qpatnext += 2;
-                               }
-                       } while ((c = *qpatnext++) != RBRACKET);
-                       pglob->gl_flags |= GLOB_MAGCHAR;
-                       *bufnext++ = M_END;
-                       break;
-               case QUESTION:
-                       pglob->gl_flags |= GLOB_MAGCHAR;
-                       *bufnext++ = M_ONE;
-                       break;
-               case STAR:
-                       pglob->gl_flags |= GLOB_MAGCHAR;
-                       /* collapse adjacent stars to one,
-                        * to avoid exponential behavior
-                        */
-                       if (bufnext == patbuf || bufnext[-1] != M_ALL)
-                           *bufnext++ = M_ALL;
-                       break;
-               default:
-                       *bufnext++ = CHAR(c);
-                       break;
-               }
-       }
-       *bufnext = EOS;
-#ifdef DEBUG
-       qprintf("glob0:", patbuf);
-#endif
-
-       if ((err = glob1(patbuf, pglob, limit, loc)) != 0)
-               return(err);
-
-       /*
-        * If there was no match we are going to append the pattern
-        * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
-        * and the pattern did not contain any magic characters
-        * GLOB_NOMAGIC is there just for compatibility with csh.
-        */
-       if (pglob->gl_pathc == oldpathc) {
-               if (((pglob->gl_flags & GLOB_NOCHECK) ||
-                   ((pglob->gl_flags & GLOB_NOMAGIC) &&
-                       !(pglob->gl_flags & GLOB_MAGCHAR))))
-                       return(globextend(pattern, pglob, limit, loc));
-               else
-                       return(GLOB_NOMATCH);
-       }
-       if (!(pglob->gl_flags & GLOB_NOSORT))
-               qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
-                   pglob->gl_pathc - oldpathc, sizeof(char *), compare);
-       return(0);
-}
-
-#ifndef BUILDING_VARIANT
-__private_extern__ int
-compare(const void *p, const void *q)
-{
-       return(strcoll(*(char **)p, *(char **)q));
-}
-#endif /* BUILDING_VARIANT */
-
-static int
-glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit, locale_t loc)
-{
-       Char pathbuf[MAXPATHLEN];
-
-       /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
-       if (*pattern == EOS)
-               return(0);
-       return(glob2(pathbuf, pathbuf, pathbuf + MAXPATHLEN - 1,
-           pattern, pglob, limit, loc));
-}
-
-/*
- * The functions glob2 and glob3 are mutually recursive; there is one level
- * of recursion for each segment in the pattern that contains one or more
- * meta characters.
- */
-static int
-glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
-      glob_t *pglob, struct glob_limit *limit, locale_t loc)
-{
-       struct stat sb;
-       Char *p, *q;
-       int anymeta;
-
-       /*
-        * Loop over pattern segments until end of pattern or until
-        * segment with meta character found.
-        */
-       for (anymeta = 0;;) {
-               if (*pattern == EOS) {          /* End of pattern? */
-                       *pathend = EOS;
-                       if (g_lstat(pathbuf, &sb, pglob, loc))
-                               return(0);
-
-                       if ((pglob->gl_flags & GLOB_LIMIT) &&
-                           limit->l_stat++ >= GLOB_LIMIT_STAT) {
-                               errno = 0;
-                               *pathend++ = SEP;
-                               *pathend = EOS;
-                               return GLOB_NOSPACE;
-                       }
-                       if (((pglob->gl_flags & GLOB_MARK) &&
-                           pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
-                           || (S_ISLNK(sb.st_mode) &&
-                           (g_stat(pathbuf, &sb, pglob, loc) == 0) &&
-                           S_ISDIR(sb.st_mode)))) {
-                               if (pathend + 1 > pathend_last)
-                                       return (GLOB_ABORTED);
-                               *pathend++ = SEP;
-                               *pathend = EOS;
-                       }
-                       ++pglob->gl_matchc;
-                       return(globextend(pathbuf, pglob, limit, loc));
-               }
-
-               /* Find end of next segment, copy tentatively to pathend. */
-               q = pathend;
-               p = pattern;
-               while (*p != EOS && *p != SEP) {
-                       if (ismeta(*p))
-                               anymeta = 1;
-                       if (q + 1 > pathend_last)
-                               return (GLOB_ABORTED);
-                       *q++ = *p++;
-               }
-
-               if (!anymeta) {         /* No expansion, do next segment. */
-                       pathend = q;
-                       pattern = p;
-                       while (*pattern == SEP) {
-                               if (pathend + 1 > pathend_last)
-                                       return (GLOB_ABORTED);
-                               *pathend++ = *pattern++;
-                       }
-               } else                  /* Need expansion, recurse. */
-                       return(glob3(pathbuf, pathend, pathend_last, pattern, p,
-                           pglob, limit, loc));
-       }
-       /* NOTREACHED */
-}
-
-static int
-glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
-      Char *pattern, Char *restpattern,
-      glob_t *pglob, struct glob_limit *limit, locale_t loc)
-{
-       struct dirent *dp;
-       DIR *dirp;
-       int err;
-       char buf[MAXPATHLEN];
-
-       /*
-        * The readdirfunc declaration can't be prototyped, because it is
-        * assigned, below, to two functions which are prototyped in glob.h
-        * and dirent.h as taking pointers to differently typed opaque
-        * structures.
-        */
-       struct dirent *(*readdirfunc)();
-
-       if (pathend > pathend_last)
-               return (GLOB_ABORTED);
-       *pathend = EOS;
-       errno = 0;
-
-       if ((dirp = g_opendir(pathbuf, pglob, loc)) == NULL) {
-               /* TODO: don't call for ENOENT or ENOTDIR? */
-               if (pglob->gl_errfunc) {
-                       if (g_Ctoc(pathbuf, buf, sizeof(buf), loc))
-                               return (GLOB_ABORTED);
-#ifdef __BLOCKS__
-                       if (pglob->gl_flags & _GLOB_ERR_BLOCK) {
-                               if (pglob->gl_errblk(buf, errno))
-                                       return (GLOB_ABORTED);
-                       } else
-#endif /* __BLOCKS__ */
-                       if (pglob->gl_errfunc(buf, errno))
-                               return (GLOB_ABORTED);
-               }
-               if (pglob->gl_flags & GLOB_ERR)
-                       return (GLOB_ABORTED);
-               return(0);
-       }
-
-       err = 0;
-
-       /* Search directory for matching names. */
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               readdirfunc = pglob->gl_readdir;
-       else
-               readdirfunc = readdir;
-       while ((dp = (*readdirfunc)(dirp))) {
-               char *sc;
-               Char *dc;
-               wchar_t wc;
-               size_t clen;
-               mbstate_t mbs;
-
-               if ((pglob->gl_flags & GLOB_LIMIT) &&
-                   limit->l_readdir++ >= GLOB_LIMIT_READDIR) {
-                       errno = 0;
-                       *pathend++ = SEP;
-                       *pathend = EOS;
-                       return GLOB_NOSPACE;
-               }
-
-               /* Initial DOT must be matched literally. */
-               if (dp->d_name[0] == DOT && *pattern != DOT)
-                       continue;
-               memset(&mbs, 0, sizeof(mbs));
-               dc = pathend;
-               sc = dp->d_name;
-               while (dc < pathend_last) {
-                       clen = mbrtowc_l(&wc, sc, MB_LEN_MAX, &mbs, loc);
-                       if (clen == (size_t)-1 || clen == (size_t)-2) {
-                               wc = *sc;
-                               clen = 1;
-                               memset(&mbs, 0, sizeof(mbs));
-                       }
-                       if ((*dc++ = wc) == EOS)
-                               break;
-                       sc += clen;
-               }
-               if (!match(pathend, pattern, restpattern, loc)) {
-                       *pathend = EOS;
-                       continue;
-               }
-               err = glob2(pathbuf, --dc, pathend_last, restpattern,
-                   pglob, limit, loc);
-               if (err)
-                       break;
-       }
-
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               (*pglob->gl_closedir)(dirp);
-       else
-               closedir(dirp);
-       return(err);
-}
-
-
-#ifndef BUILDING_VARIANT
-/*
- * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
- * add the new item, and update gl_pathc.
- *
- * This assumes the BSD realloc, which only copies the block when its size
- * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
- * behavior.
- *
- * Return 0 if new item added, error code if memory couldn't be allocated.
- *
- * Invariant of the glob_t structure:
- *     Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
- *     gl_pathv points to (gl_offs + gl_pathc + 1) items.
- */
-__private_extern__ int
-globextend(const Char *path, glob_t *pglob, struct glob_limit *limit, locale_t loc)
-{
-       char **pathv;
-       size_t i, newsize, len;
-       char *copy;
-       const Char *p;
-
-       newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
-       if ((pglob->gl_flags & GLOB_LIMIT) &&
-           newsize > GLOB_LIMIT_PATH * sizeof(*pathv))
-               goto nospace;
-       pathv = pglob->gl_pathv ?
-                   realloc((char *)pglob->gl_pathv, newsize) :
-                   malloc(newsize);
-       if (pathv == NULL) {
-               if (pglob->gl_pathv) {
-                       free(pglob->gl_pathv);
-                       pglob->gl_pathv = NULL;
-               }
-               return(GLOB_NOSPACE);
-       }
-
-       if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
-               /* first time around -- clear initial gl_offs items */
-               pathv += pglob->gl_offs;
-               for (i = pglob->gl_offs + 1; --i > 0; )
-                       *--pathv = NULL;
-       }
-       pglob->gl_pathv = pathv;
-
-       for (p = path; *p++;)
-               continue;
-       len = MB_CUR_MAX_L(loc) * (size_t)(p - path);   /* XXX overallocation */
-       limit->l_string += len;
-       if ((copy = malloc(len)) != NULL) {
-               if (g_Ctoc(path, copy, len, loc)) {
-                       free(copy);
-                       return (GLOB_NOSPACE);
-               }
-               pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
-       }
-       pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-
-       if ((pglob->gl_flags & GLOB_LIMIT) &&
-           (newsize + limit->l_string) >= GLOB_LIMIT_STRING)
-               goto nospace;
-
-       return(copy == NULL ? GLOB_NOSPACE : 0);
-nospace:
-       errno = 0;
-       return GLOB_NOSPACE;
-}
-
-/*
- * pattern matching function for filenames.  Each occurrence of the *
- * pattern causes a recursion level.
- */
-__private_extern__ int
-match(Char *name, Char *pat, Char *patend, locale_t loc)
-{
-       int ok, negate_range;
-       Char c, k;
-
-       while (pat < patend) {
-               c = *pat++;
-               switch (c & M_MASK) {
-               case M_ALL:
-                       if (pat == patend)
-                               return(1);
-                       do
-                           if (match(name, pat, patend, loc))
-                                   return(1);
-                       while (*name++ != EOS);
-                       return(0);
-               case M_ONE:
-                       if (*name++ == EOS)
-                               return(0);
-                       break;
-               case M_SET:
-                       ok = 0;
-                       if ((k = *name++) == EOS)
-                               return(0);
-                       if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
-                               ++pat;
-                       while (((c = *pat++) & M_MASK) != M_END)
-                               if ((*pat & M_MASK) == M_RNG) {
-                                       if (loc->__collate_load_error ?
-                                           CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) :
-                                              __collate_range_cmp(CHAR(c), CHAR(k), loc) <= 0
-                                           && __collate_range_cmp(CHAR(k), CHAR(pat[1]), loc) <= 0
-                                          )
-                                               ok = 1;
-                                       pat += 2;
-                               } else if (c == k)
-                                       ok = 1;
-                       if (ok == negate_range)
-                               return(0);
-                       break;
-               default:
-                       if (*name++ != c)
-                               return(0);
-                       break;
-               }
-       }
-       return(*name == EOS);
-}
-
-/* Free allocated data belonging to a glob_t structure. */
-void
-globfree(glob_t *pglob)
-{
-       size_t i;
-       char **pp;
-
-       if (pglob->gl_pathv != NULL) {
-               pp = pglob->gl_pathv + pglob->gl_offs;
-               for (i = pglob->gl_pathc; i--; ++pp)
-                       if (*pp)
-                               free(*pp);
-               free(pglob->gl_pathv);
-               pglob->gl_pathv = NULL;
-       }
-}
-#endif /* !BUILDING_VARIANT */
-
-static DIR *
-g_opendir(Char *str, glob_t *pglob, locale_t loc)
-{
-       char buf[MAXPATHLEN];
-
-       if (!*str)
-               strcpy(buf, ".");
-       else {
-               if (g_Ctoc(str, buf, sizeof(buf), loc))
-                       return (NULL);
-       }
-
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               return((*pglob->gl_opendir)(buf));
-
-       return(opendir(buf));
-}
-
-static int
-g_lstat(Char *fn, struct stat *sb, glob_t *pglob, locale_t loc)
-{
-       char buf[MAXPATHLEN];
-
-       if (g_Ctoc(fn, buf, sizeof(buf), loc)) {
-               errno = ENAMETOOLONG;
-               return (-1);
-       }
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               return((*pglob->gl_lstat)(buf, sb));
-       return(lstat(buf, sb));
-}
-
-static int
-g_stat(Char *fn, struct stat *sb, glob_t *pglob, locale_t loc)
-{
-       char buf[MAXPATHLEN];
-
-       if (g_Ctoc(fn, buf, sizeof(buf), loc)) {
-               errno = ENAMETOOLONG;
-               return (-1);
-       }
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               return((*pglob->gl_stat)(buf, sb));
-       return(stat(buf, sb));
-}
-
-#ifndef BUILDING_VARIANT
-__private_extern__ const Char *
-g_strchr(const Char *str, wchar_t ch)
-{
-
-       do {
-               if (*str == ch)
-                       return (str);
-       } while (*str++);
-       return (NULL);
-}
-
-__private_extern__ int
-g_Ctoc(const Char *str, char *buf, size_t len, locale_t loc)
-{
-       mbstate_t mbs;
-       size_t clen;
-       int mb_cur_max = MB_CUR_MAX_L(loc);
-
-       memset(&mbs, 0, sizeof(mbs));
-       while (len >= mb_cur_max) {
-               clen = wcrtomb_l(buf, *str, &mbs, loc);
-               if (clen == (size_t)-1)
-                       return (1);
-               if (*str == L'\0')
-                       return (0);
-               str++;
-               buf += clen;
-               len -= clen;
-       }
-       return (1);
-}
-
-#ifdef DEBUG
-static void
-qprintf(const char *str, Char *s)
-{
-       Char *p;
-
-       (void)printf("%s:\n", str);
-       for (p = s; *p; p++)
-               (void)printf("%c", CHAR(*p));
-       (void)printf("\n");
-       for (p = s; *p; p++)
-               (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
-       (void)printf("\n");
-       for (p = s; *p; p++)
-               (void)printf("%c", ismeta(*p) ? '_' : ' ');
-       (void)printf("\n");
-}
-#endif
-#endif /* !BUILDING_VARIANT */
diff --git a/gen/glob.3 b/gen/glob.3
deleted file mode 100644 (file)
index a71c96b..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993, 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Guido van Rossum.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)glob.3     8.3 (Berkeley) 4/16/94
-.\" $FreeBSD: src/lib/libc/gen/glob.3,v 1.32 2007/01/09 00:27:54 imp Exp $
-.\"
-.Dd May 20, 2008
-.Dt GLOB 3
-.Os
-.Sh NAME
-.Nm glob ,
-#ifdef UNIFDEF_BLOCKS
-.Nm glob_b ,
-#endif
-.Nm globfree
-.Nd generate pathnames matching a pattern
-.Sh SYNOPSIS
-.In glob.h
-.Ft int
-.Fo glob
-.Fa "const char *restrict pattern"
-.Fa "int flags"
-.Fa "int (*errfunc)(const char *epath, int errno)"
-.Fa "glob_t *restrict pglob"
-.Fc
-#ifdef UNIFDEF_BLOCKS
-.Ft int
-.Fo glob_b
-.Fa "const char *restrict pattern"
-.Fa "int flags"
-.Fa "int (^errblk)(const char *epath, int errno)"
-.Fa "glob_t *restrict pglob"
-.Fc
-#endif
-.Ft void
-.Fo globfree
-.Fa "glob_t *pglob"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn glob
-function
-is a pathname generator that implements the rules for file name pattern
-matching used by the shell.
-.Pp
-The include file
-.In glob.h
-defines the structure type
-.Fa glob_t ,
-which contains at least the following fields:
-.Bd -literal
-typedef struct {
-       size_t gl_pathc;        /* count of total paths so far */
-       int gl_matchc;          /* count of paths matching pattern */
-       size_t gl_offs;         /* reserved at beginning of gl_pathv */
-       int gl_flags;           /* returned flags */
-       char **gl_pathv;        /* list of paths matching pattern */
-} glob_t;
-.Ed
-.Pp
-The argument
-.Fa pattern
-is a pointer to a pathname pattern to be expanded.
-The
-.Fn glob
-argument
-matches all accessible pathnames against the pattern and creates
-a list of the pathnames that match.
-In order to have access to a pathname,
-.Fn glob
-requires search permission on every component of a path except the last
-and read permission on each directory of any filename component of
-.Fa pattern
-that contains any of the special characters
-.Ql * ,
-.Ql ?\&
-or
-.Ql \&[ .
-.Pp
-The
-.Fn glob
-argument
-stores the number of matched pathnames into the
-.Fa gl_pathc
-field, and a pointer to a list of pointers to pathnames into the
-.Fa gl_pathv
-field.
-The first pointer after the last pathname is
-.Dv NULL .
-If the pattern does not match any pathnames, the returned number of
-matched paths is set to zero.
-.Pp
-It is the caller's responsibility to create the structure pointed to by
-.Fa pglob .
-The
-.Fn glob
-function allocates other space as needed, including the memory pointed
-to by
-.Fa gl_pathv .
-.Pp
-The argument
-.Fa flags
-is used to modify the behavior of
-.Fn glob .
-The value of
-.Fa flags
-is the bitwise inclusive
-.Tn OR
-of any of the following
-values defined in
-.In glob.h :
-.Bl -tag -width GLOB_ALTDIRFUNC
-.It Dv GLOB_APPEND
-Append pathnames generated to the ones from a previous call (or calls)
-to
-.Fn glob .
-The value of
-.Fa gl_pathc
-will be the total matches found by this call and the previous call(s).
-The pathnames are appended to, not merged with the pathnames returned by
-the previous call(s).
-Between calls, the caller must not change the setting of the
-.Dv GLOB_DOOFFS
-flag, nor change the value of
-.Fa gl_offs
-when
-.Dv GLOB_DOOFFS
-is set, nor (obviously) call
-.Fn globfree
-for
-.Fa pglob .
-.It Dv GLOB_DOOFFS
-Make use of the
-.Fa gl_offs
-field.
-If this flag is set,
-.Fa gl_offs
-is used to specify how many
-.Dv NULL
-pointers to prepend to the beginning
-of the
-.Fa gl_pathv
-field.
-In other words,
-.Fa gl_pathv
-will point to
-.Fa gl_offs
-.Dv NULL
-pointers,
-followed by
-.Fa gl_pathc
-pathname pointers, followed by a
-.Dv NULL
-pointer.
-.It Dv GLOB_ERR
-Causes
-.Fn glob
-to return when it encounters a directory that it cannot open or read.
-Ordinarily,
-.Fn glob
-continues to find matches.
-.It Dv GLOB_MARK
-Each pathname that is a directory that matches
-.Fa pattern
-has a slash
-appended.
-.It Dv GLOB_NOCHECK
-If
-.Fa pattern
-does not match any pathname, then
-.Fn glob
-returns a list
-consisting of only
-.Fa pattern ,
-with the number of total pathnames set to 1, and the number of matched
-pathnames set to 0.
-The effect of backslash escaping is present in the pattern returned.
-.It Dv GLOB_NOESCAPE
-By default, a backslash
-.Pq Ql \e
-character is used to escape the following character in the pattern,
-avoiding any special interpretation of the character.
-If
-.Dv GLOB_NOESCAPE
-is set, backslash escaping is disabled.
-.It Dv GLOB_NOSORT
-By default, the pathnames are sorted in ascending
-.Tn ASCII
-order;
-this flag prevents that sorting (speeding up
-.Fn glob ) .
-.El
-.Pp
-The following values may also be included in
-.Fa flags ,
-however, they are non-standard extensions to
-.St -p1003.2 .
-.Bl -tag -width GLOB_ALTDIRFUNC
-.It Dv GLOB_ALTDIRFUNC
-The following additional fields in the pglob structure have been
-initialized with alternate functions for glob to use to open, read,
-and close directories and to get stat information on names found
-in those directories.
-.Bd -literal
-void *(*gl_opendir)(const char * name);
-struct dirent *(*gl_readdir)(void *);
-void (*gl_closedir)(void *);
-int (*gl_lstat)(const char *name, struct stat *st);
-int (*gl_stat)(const char *name, struct stat *st);
-.Ed
-.Pp
-This extension is provided to allow programs such as
-.Xr restore 8
-to provide globbing from directories stored on tape.
-.It Dv GLOB_BRACE
-Pre-process the pattern string to expand
-.Ql {pat,pat,...}
-strings like
-.Xr csh 1 .
-The pattern
-.Ql {}
-is left unexpanded for historical reasons (and
-.Xr csh 1
-does the same thing to
-ease typing
-of
-.Xr find 1
-patterns).
-.It Dv GLOB_MAGCHAR
-Set by the
-.Fn glob
-function if the pattern included globbing characters.
-See the description of the usage of the
-.Fa gl_matchc
-structure member for more details.
-.It Dv GLOB_NOMAGIC
-Is the same as
-.Dv GLOB_NOCHECK
-but it only appends the
-.Fa pattern
-if it does not contain any of the special characters ``*'', ``?'' or ``[''.
-.Dv GLOB_NOMAGIC
-is provided to simplify implementing the historic
-.Xr csh 1
-globbing behavior and should probably not be used anywhere else.
-.It Dv GLOB_TILDE
-Expand patterns that start with
-.Ql ~
-to user name home directories.
-.It Dv GLOB_LIMIT
-Limit the total number of returned pathnames to the value provided in
-.Fa gl_matchc
-(default
-.Dv ARG_MAX ) .
-This option should be set for programs
-that can be coerced into a denial of service attack
-via patterns that expand to a very large number of matches,
-such as a long string of
-.Ql */../*/.. .
-.El
-.Pp
-If, during the search, a directory is encountered that cannot be opened
-or read and
-.Fa errfunc
-is
-.Pf non- Dv NULL ,
-.Fn glob
-calls
-.Fa \*(lp*errfunc\*(rp Ns ( Fa path , errno ) .
-This may be unintuitive: a pattern like
-.Ql */Makefile
-will try to
-.Xr stat 2
-.Ql foo/Makefile
-even if
-.Ql foo
-is not a directory, resulting in a
-call to
-.Fa errfunc .
-The error routine can suppress this action by testing for
-.Er ENOENT
-and
-.Er ENOTDIR ;
-however, the
-.Dv GLOB_ERR
-flag will still cause an immediate
-return when this happens.
-.Pp
-If
-.Fa errfunc
-returns non-zero,
-.Fn glob
-stops the scan and returns
-.Dv GLOB_ABORTED
-after setting
-.Fa gl_pathc
-and
-.Fa gl_pathv
-to reflect any paths already matched.
-This also happens if an error is encountered and
-.Dv GLOB_ERR
-is set in
-.Fa flags ,
-regardless of the return value of
-.Fa errfunc ,
-if called.
-If
-.Dv GLOB_ERR
-is not set and either
-.Fa errfunc
-is
-.Dv NULL
-or
-.Fa errfunc
-returns zero, the error is ignored.
-#ifdef UNIFDEF_BLOCKS
-.Pp
-The
-.Fn glob_b
-function is like
-.Fn glob
-except that the error callback is a block pointer instead of a function
-pointer.
-#endif
-.Pp
-The
-.Fn globfree
-function frees any space associated with
-.Fa pglob
-from a previous call(s) to
-#ifdef UNIFDEF_BLOCKS
-.Fn glob
-or
-.Fn glob_b .
-#else
-.Fn glob .
-#endif
-.Sh RETURN VALUES
-On successful completion,
-.Fn glob
-#ifdef UNIFDEF_BLOCKS
-and
-.Fn glob_b
-return zero.
-#else
-returns zero.
-#endif
-In addition, the fields of
-.Fa pglob
-contain the values described below:
-.Bl -tag -width GLOB_NOCHECK
-.It Fa gl_pathc
-contains the total number of matched pathnames so far.
-This includes other matches from previous invocations of
-.Fn glob
-#ifdef UNIFDEF_BLOCKS
-or
-.Fn glob_b
-#endif
-if
-.Dv GLOB_APPEND
-was specified.
-.It Fa gl_matchc
-contains the number of matched pathnames in the current invocation of
-#ifdef UNIFDEF_BLOCKS
-.Fn glob
-or
-.Fn glob_b .
-#else
-.Fn glob .
-#endif
-.It Fa gl_flags
-contains a copy of the
-.Fa flags
-argument with the bit
-.Dv GLOB_MAGCHAR
-set if
-.Fa pattern
-contained any of the special characters ``*'', ``?'' or ``['', cleared
-if not.
-.It Fa gl_pathv
-contains a pointer to a
-.Dv NULL Ns -terminated
-list of matched pathnames.
-However, if
-.Fa gl_pathc
-is zero, the contents of
-.Fa gl_pathv
-are undefined.
-.El
-.Pp
-If
-.Fn glob
-#ifdef UNIFDEF_BLOCKS
-or
-.Fn glob_b
-#endif
-terminates due to an error, it sets errno and returns one of the
-following non-zero constants, which are defined in the include
-file
-.In glob.h :
-.Bl -tag -width GLOB_NOCHECK
-.It Dv GLOB_NOSPACE
-An attempt to allocate memory failed, or if
-.Fa errno
-was 0
-.Dv GLOB_LIMIT
-was specified in the flags and
-.Fa pglob\->gl_matchc
-or more patterns were matched.
-.It Dv GLOB_ABORTED
-The scan was stopped because an error was encountered and either
-.Dv GLOB_ERR
-was set or
-.Fa \*(lp*errfunc\*(rp\*(lp\*(rp
-returned non-zero.
-.It Dv GLOB_NOMATCH
-The pattern did not match a pathname and
-.Dv GLOB_NOCHECK
-was not set.
-.El
-.Pp
-The arguments
-.Fa pglob\->gl_pathc
-and
-.Fa pglob\->gl_pathv
-are still set as specified above.
-.Sh EXAMPLES
-A rough equivalent of
-.Ql "ls -l *.c *.h"
-can be obtained with the
-following code:
-.Bd -literal -offset indent
-glob_t g;
-
-g.gl_offs = 2;
-glob("*.c", GLOB_DOOFFS, NULL, &g);
-glob("*.h", GLOB_DOOFFS | GLOB_APPEND, NULL, &g);
-g.gl_pathv[0] = "ls";
-g.gl_pathv[1] = "-l";
-execvp("ls", g.gl_pathv);
-.Ed
-.Sh CAVEATS
-The
-.Fn glob
-#ifdef UNIFDEF_BLOCKS
-and
-.Fn glob_b
-functions
-#else
-function
-#endif
-will not match filenames that begin with a period
-unless this is specifically requested (e.g., by ".*").
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr fnmatch 3 ,
-.Xr regexp 3
-.Sh STANDARDS
-The current implementation of the
-.Fn glob
-function
-.Em does not
-conform to
-.St -p1003.2 .
-Collating symbol expressions, equivalence class expressions and
-character class expressions are not supported.
-.Pp
-The flags
-.Dv GLOB_ALTDIRFUNC ,
-.Dv GLOB_BRACE ,
-.Dv GLOB_LIMIT ,
-.Dv GLOB_MAGCHAR ,
-.Dv GLOB_NOMAGIC ,
-and
-.Dv GLOB_TILDE ,
-and the fields
-.Fa gl_matchc
-and
-.Fa gl_flags
-are extensions to the
-.Tn POSIX
-standard and
-should not be used by applications striving for strict
-conformance.
-.Sh HISTORY
-The
-.Fn glob
-and
-.Fn globfree
-functions first appeared in
-.Bx 4.4 .
-#ifdef UNIFDEF_BLOCKS
-The
-.Fn glob_b
-function first appeared in Mac OS X 10.6.
-#endif
-.Sh BUGS
-Patterns longer than
-.Dv MAXPATHLEN
-may cause unchecked errors.
-.Pp
-The
-.Fn glob
-#ifdef UNIFDEF_BLOCKS
-and
-.Fn glob_b
-functions
-#else
-function
-#endif
-may fail and set errno for any of the errors specified for the
-library routines
-.Xr stat 2 ,
-.Xr closedir 3 ,
-.Xr opendir 3 ,
-.Xr readdir 3 ,
-.Xr malloc 3 ,
-and
-.Xr free 3 .
diff --git a/gen/isatty-fbsd.c b/gen/isatty-fbsd.c
deleted file mode 100644 (file)
index 54a0fa0..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)isatty.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/isatty.c,v 1.6 2007/01/09 00:27:54 imp Exp $");
-
-#include <termios.h>
-#include <unistd.h>
-#include <sys/filio.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-
-int
-isatty(fd)
-       int fd;
-{
-       int retval, type;
-       struct termios t;
-
-       if(ioctl(fd, FIODTYPE, &type) != -1) {
-           if((retval = (type == D_TTY)) == 0)
-               errno = ENOTTY;
-       } else
-           retval = (tcgetattr(fd, &t) != -1);
-       return(retval);
-}
diff --git a/gen/jrand48-fbsd.c b/gen/jrand48-fbsd.c
deleted file mode 100644 (file)
index 40d6a6f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/jrand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-long
-jrand48(unsigned short xseed[3])
-{
-       uint48 tmp;
-       DORAND48(tmp, xseed);
-       return (int)((tmp >> 16) & 0xffffffff);
-}
diff --git a/gen/lcong48-fbsd.c b/gen/lcong48-fbsd.c
deleted file mode 100644 (file)
index 8a13d64..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/lcong48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-void
-lcong48(unsigned short p[7])
-{
-       LOADRAND48(_rand48_seed, &p[0]);
-       LOADRAND48(_rand48_mult, &p[3]);
-       _rand48_add = p[6];
-}
diff --git a/gen/lockf-fbsd.c b/gen/lockf-fbsd.c
deleted file mode 100644 (file)
index bc8de89..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*     $NetBSD: lockf.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/lockf.c,v 1.10 2009/03/04 01:01:26 delphij Exp $");
-
-#ifdef VARIANT_CANCELABLE
-int __fcntl(int, int, void *);
-#else /* !VARIANT_CANCELABLE */
-int __fcntl_nocancel(int, int, void *);
-#endif /* VARIANT_CANCELABLE */
-
-
-#include "namespace.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-int
-lockf(int filedes, int function, off_t size)
-{
-       struct flock fl;
-       int cmd;
-
-       fl.l_start = 0;
-       fl.l_len = size;
-       fl.l_whence = SEEK_CUR;
-
-       switch (function) {
-       case F_ULOCK:
-               cmd = F_SETLK;
-               fl.l_type = F_UNLCK;
-               break;
-       case F_LOCK:
-               cmd = F_SETLKW;
-               fl.l_type = F_WRLCK;
-               break;
-       case F_TLOCK:
-               cmd = F_SETLK;
-               fl.l_type = F_WRLCK;
-               break;
-       case F_TEST:
-               fl.l_type = F_WRLCK;
-#ifdef VARIANT_CANCELABLE
-               if (__fcntl(filedes, F_GETLK, &fl) == -1)
-                       return (-1);
-#else /* !VARIANT_CANCELABLE */
-               if (__fcntl_nocancel(filedes, F_GETLK, &fl) == -1)
-                       return (-1);
-#endif /* VARIANT_CANCELABLE */
-               if (fl.l_type == F_UNLCK || fl.l_pid == getpid())
-                       return (0);
-               errno = EAGAIN;
-               return (-1);
-               /* NOTREACHED */
-       default:
-               errno = EINVAL;
-               return (-1);
-               /* NOTREACHED */
-       }
-
-#ifdef VARIANT_CANCELABLE
-       return (__fcntl(filedes, cmd, &fl));
-#else /* !VARIANT_CANCELABLE */
-       return (__fcntl_nocancel(filedes, cmd, &fl));
-#endif /* VARIANT_CANCELABLE */
-}
-
diff --git a/gen/lockf.3 b/gen/lockf.3
deleted file mode 100644 (file)
index fc48307..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-.\" $NetBSD: lockf.3,v 1.10 2008/04/30 13:10:50 martin Exp $
-.\"
-.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Klaus Klein and S.P. Zeidler.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/lockf.3,v 1.14 2009/03/04 01:01:26 delphij Exp $
-.\"
-.Dd December 19, 1997
-.Dt LOCKF 3
-.Os
-.Sh NAME
-.Nm lockf
-.Nd record locking on files
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn lockf "int fildes" "int function" "off_t size"
-.Sh DESCRIPTION
-The
-.Fn lockf
-function allows sections of a file to be locked with advisory-mode locks.
-Calls to
-.Fn lockf
-from other processes which attempt to lock the locked file section will
-either return an error value or block until the section becomes unlocked.
-All of the locks for a process are removed when the process terminates.
-.Pp
-The argument
-.Fa fildes
-is an open file descriptor.
-The file descriptor must have been opened either for write-only
-.Dv ( O_WRONLY )
-or read/write
-.Dv ( O_RDWR )
-operation.
-.Pp
-The
-.Fa function
-argument is a control value which specifies the action to be taken.
-The permissible values for
-.Fa function
-are as follows:
-.Bl -tag -width F_ULOCKXX -compact -offset indent
-.It Sy Function
-.Sy Description
-.It Dv F_ULOCK
-unlock locked sections
-.It Dv F_LOCK
-lock a section for exclusive use
-.It Dv F_TLOCK
-test and lock a section for exclusive use
-.It Dv F_TEST
-test a section for locks by other processes
-.El
-.Pp
-.Dv F_ULOCK
-removes locks from a section of the file;
-.Dv F_LOCK
-and
-.Dv F_TLOCK
-both lock a section of a file if the section is available;
-.Dv F_TEST
-detects if a lock by another process is present on the specified section.
-.Pp
-The
-.Fa size
-argument is the number of contiguous bytes to be locked or
-unlocked.
-The section to be locked or unlocked starts at the current
-offset in the file and extends forward for a positive size or backward
-for a negative size (the preceding bytes up to but not including the
-current offset).
-However, it is not permitted to lock a section that
-starts or extends before the beginning of the file.
-If
-.Fa size
-is 0, the section from the current offset through the largest possible
-file offset is locked (that is, from the current offset through the
-present or any future end-of-file).
-.Pp
-The sections locked with
-.Dv F_LOCK
-or
-.Dv F_TLOCK
-may, in whole or in part, contain or be contained by a previously
-locked section for the same process.
-When this occurs, or if adjacent
-locked sections would occur, the sections are combined into a single
-locked section.
-If the request would cause the number of locks to
-exceed a system-imposed limit, the request will fail.
-.Pp
-.Dv F_LOCK
-and
-.Dv F_TLOCK
-requests differ only by the action taken if the section is not
-available.
-.Dv F_LOCK
-blocks the calling process until the section is available.
-.Dv F_TLOCK
-makes the function fail if the section is already locked by another
-process.
-.Pp
-File locks are released on first close by the locking process of any
-file descriptor for the file.
-.Pp
-.Dv F_ULOCK
-requests release (wholly or in part) one or more locked sections
-controlled by the process.
-Locked sections will be unlocked starting
-at the current file offset through
-.Fa size
-bytes or to the end of file if size is 0.
-When all of a locked section
-is not released (that is, when the beginning or end of the area to be
-unlocked falls within a locked section), the remaining portions of
-that section are still locked by the process.
-Releasing the center
-portion of a locked section will cause the remaining locked beginning
-and end portions to become two separate locked sections.
-If the
-request would cause the number of locks in the system to exceed a
-system-imposed limit, the request will fail.
-.Pp
-An
-.Dv F_ULOCK
-request in which size is non-zero and the offset of the last byte of
-the requested section is the maximum value for an object of type
-off_t, when the process has an existing lock in which size is 0 and
-which includes the last byte of the requested section, will be treated
-as a request to unlock from the start of the requested section with a
-size equal to 0.
-Otherwise an
-.Dv F_ULOCK
-request will attempt to unlock only the requested section.
-.Pp
-A potential for deadlock occurs if a process controlling a locked
-region is put to sleep by attempting to lock the locked region of
-another process.
-This implementation detects that sleeping until a
-locked region is unlocked would cause a deadlock and fails with an
-.Er EDEADLK
-error.
-.Pp
-The
-.Fn lockf ,
-.Xr fcntl 2 ,
-and
-.Xr flock 2
-locks are compatible.
-Processes using different locking interfaces can cooperate
-over the same file safely.
-However, only one of such interfaces should be used within
-the same process.
-If a file is locked by a process through
-.Xr flock 2 ,
-any record within the file will be seen as locked
-from the viewpoint of another process using
-.Xr fcntl 2
-or
-.Fn lockf ,
-and vice versa.
-.Pp
-Blocking on a section is interrupted by any signal.
-.Sh RETURN VALUES
-.Rv -std lockf
-In the case of a failure, existing locks are not changed.
-.Sh ERRORS
-The
-.Fn lockf
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The argument
-.Fa function
-is
-.Dv F_TLOCK
-or
-.Dv F_TEST
-and the section is already locked by another process.
-.It Bq Er EBADF
-The argument
-.Fa fildes
-is not a valid open file descriptor.
-.Pp
-The argument
-.Fa function
-is
-.Dv F_LOCK
-or
-.Dv F_TLOCK ,
-and
-.Fa fildes
-is not a valid file descriptor open for writing.
-.It Bq Er EDEADLK
-The argument
-.Fa function
-is
-.Dv F_LOCK
-and a deadlock is detected.
-.It Bq Er EINTR
-The argument
-.Fa function
-is F_LOCK
-and
-.Fn lockf
-was interrupted by the delivery of a signal.
-.It Bq Er EINVAL
-The argument
-.Fa function
-is not one of
-.Dv F_LOCK ,
-.Dv F_TEST ,
-.Dv F_TLOCK ,
-or
-.Dv F_ULOCK .
-.Pp
-The argument
-.Fa fildes
-refers to a file that does not support advisory locking.
-.It Bq Er ENOLCK
-The argument
-.Fa function
-is
-.Dv F_LOCK ,
-.Dv F_TLOCK ,
-or
-.Dv F_ULOCK
-and satisfying the lock or unlock request would result in the number
-of locked regions in the system exceeding a system-imposed limit.
-.It Bq Er EOPNOTSUPP
-The argument
-.Fa fildes
-refers to a socket; these do not support advisory locking.
-.El
-.Sh SEE ALSO
-.Xr fcntl 2 ,
-.Xr flock 2
-.Sh STANDARDS
-The
-.Fn lockf
-function conforms to
-.St -xpg4.2 .
diff --git a/gen/lrand48-fbsd.c b/gen/lrand48-fbsd.c
deleted file mode 100644 (file)
index 3b01e85..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/lrand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-long
-lrand48(void)
-{
-       _DORAND48(_rand48_seed);
-       return (_rand48_seed >> 17) & 0x7fffffff;
-}
index e6b69980ff672d6b95dec1db12f1d32cbc49ac8f..6290df5be7b7d5d8b5c857624644dc18dc0dc0af 100644 (file)
@@ -81,6 +81,9 @@
 
 #define DEBUG_MADVISE                  0
 
+// <rdar://problem/10397726>
+#define RELAXED_INVARIANT_CHECKS 1
+
 #if DEBUG_MALLOC
 #warning DEBUG_MALLOC ENABLED
 # define INLINE
@@ -929,17 +932,17 @@ __private_extern__ uint64_t malloc_entropy[2];
 
 /********************* VERY LOW LEVEL UTILITIES  ************************/
 
-#if DEBUG_MALLOC || DEBUG_CLIENT
 static void
 szone_sleep(void)
 {
-
-    if (getenv("MallocErrorSleep")) {
+    if (getenv("MallocErrorStop")) {
+       _malloc_printf(ASL_LEVEL_NOTICE, "*** sending SIGSTOP to help debug\n");
+       kill(getpid(), SIGSTOP);
+    } else if (getenv("MallocErrorSleep")) {
        _malloc_printf(ASL_LEVEL_NOTICE, "*** sleeping to help debug\n");
        sleep(3600); // to help debug
     }
 }
-#endif
 
 // msg prints after fmt, ...
 static NOINLINE void
@@ -982,11 +985,8 @@ szone_error(szone_t *szone, int is_corruption, const char *msg, const void *ptr,
     malloc_error_break();
 #if DEBUG_MALLOC
     szone_print(szone, 1);
-    szone_sleep();
 #endif
-#if DEBUG_CLIENT
     szone_sleep();
-#endif
     // Call abort() if this is a memory corruption error and the abort on 
     // corruption flag is set, or if any error should abort.
     if ((is_corruption && (szone->debug_flags & SCALABLE_MALLOC_ABORT_ON_CORRUPTION)) ||
@@ -1218,7 +1218,7 @@ _szone_default_reader(task_t task, vm_address_t address, vm_size_t size, void **
        ((((uintptr_t)pthread_self()) >> vm_page_shift) * 2654435761UL) >> (32 - szone->num_tiny_magazines_mask_shift)
 #endif
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
 /*
  * These commpage routines provide fast access to the logical cpu number
  * of the calling processor assuming no pre-emption occurs. 
@@ -2630,6 +2630,9 @@ tiny_free_no_lock(szone_t *szone, magazine_t *tiny_mag_ptr, mag_index_t mag_inde
             uintptr_t lo = trunc_page((uintptr_t)original_ptr);
             uintptr_t hi = round_page((uintptr_t)original_ptr + original_size);
        
+           tiny_free_list_remove_ptr(szone, tiny_mag_ptr, ptr, msize);
+           set_tiny_meta_header_in_use(ptr, msize);
+
            OSAtomicIncrement32Barrier(&(node->pinned_to_depot));
            SZONE_MAGAZINE_PTR_UNLOCK(szone, tiny_mag_ptr);
 #if TARGET_OS_EMBEDDED
@@ -2639,6 +2642,9 @@ tiny_free_no_lock(szone_t *szone, magazine_t *tiny_mag_ptr, mag_index_t mag_inde
 #endif
            SZONE_MAGAZINE_PTR_LOCK(szone, tiny_mag_ptr);
            OSAtomicDecrement32Barrier(&(node->pinned_to_depot));
+
+           set_tiny_meta_header_free(ptr, msize);
+           tiny_free_list_add_ptr(szone, tiny_mag_ptr, ptr, msize);
         }
        
 #if !TARGET_OS_EMBEDDED
@@ -2944,6 +2950,7 @@ tiny_check_region(szone_t *szone, region_t region)
            /* move to next block */
            ptr += TINY_BYTES_FOR_MSIZE(msize);
        } else {
+#if !RELAXED_INVARIANT_CHECKS
            /*
             * Free blocks must have been coalesced, we cannot have a free block following another
             * free block.
@@ -2953,6 +2960,7 @@ tiny_check_region(szone_t *szone, region_t region)
                  ptr, msize);
                return 0;
            }
+#endif // RELAXED_INVARIANT_CHECKS
            prev_free = 1;
            /*
             * Check the integrity of this block's entry in its freelist.
@@ -4426,6 +4434,9 @@ small_free_no_lock(szone_t *szone, magazine_t *small_mag_ptr, mag_index_t mag_in
             uintptr_t lo = trunc_page((uintptr_t)original_ptr);
             uintptr_t hi = round_page((uintptr_t)original_ptr + original_size);
 
+           small_free_list_remove_ptr(szone, small_mag_ptr, ptr, msize);
+           small_meta_header_set_in_use(meta_headers, index, msize);
+
            OSAtomicIncrement32Barrier(&(node->pinned_to_depot));
            SZONE_MAGAZINE_PTR_UNLOCK(szone, small_mag_ptr);
 #if TARGET_OS_EMBEDDED
@@ -4435,7 +4446,10 @@ small_free_no_lock(szone_t *szone, magazine_t *small_mag_ptr, mag_index_t mag_in
 #endif
            SZONE_MAGAZINE_PTR_LOCK(szone, small_mag_ptr);
            OSAtomicDecrement32Barrier(&(node->pinned_to_depot));
-        }
+
+           small_meta_header_set_is_free(meta_headers, index, msize);
+           small_free_list_add_ptr(szone, small_mag_ptr, ptr, msize);
+       }
 
 #if !TARGET_OS_EMBEDDED
        if (0 < bytes_used || 0 < node->pinned_to_depot) {
@@ -4709,11 +4723,13 @@ small_check_region(szone_t *szone, region_t region)
                  ptr, szone->num_small_regions, region_end);
                return 0;
            }
+#if !RELAXED_INVARIANT_CHECKS
            if (SMALL_BYTES_FOR_MSIZE(msize) > szone->large_threshold) {
                malloc_printf("*** invariant broken for %p this small msize=%d - size is too large\n",
                  ptr, msize_and_free);
                return 0;
            }
+#endif // RELAXED_INVARIANT_CHECKS
            ptr += SMALL_BYTES_FOR_MSIZE(msize);
            prev_free = 0;
        } else {
@@ -4725,10 +4741,12 @@ small_check_region(szone_t *szone, region_t region)
                malloc_printf("*** invariant broken for free block %p this msize=%d\n", ptr, msize);
                return 0;
            }
+#if !RELAXED_INVARIANT_CHECKS
            if (prev_free) {
                malloc_printf("*** invariant broken for %p (2 free in a row)\n", ptr);
                return 0;
            }
+#endif
            previous = free_list_unchecksum_ptr(szone, &free_head->previous);
            next = free_list_unchecksum_ptr(szone, &free_head->next);
            if (previous && !SMALL_PTR_IS_FREE(previous)) {
diff --git a/gen/makecontext.3 b/gen/makecontext.3
deleted file mode 100644 (file)
index d60038b..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-.\" Copyright (c) 2002 Packet Design, LLC.
-.\" All rights reserved.
-.\"
-.\" Subject to the following obligations and disclaimer of warranty,
-.\" use and redistribution of this software, in source or object code
-.\" forms, with or without modifications are expressly permitted by
-.\" Packet Design; provided, however, that:
-.\"
-.\"    (i)  Any and all reproductions of the source or object code
-.\"         must include the copyright notice above and the following
-.\"         disclaimer of warranties; and
-.\"    (ii) No rights are granted, in any manner or form, to use
-.\"         Packet Design trademarks, including the mark "PACKET DESIGN"
-.\"         on advertising, endorsements, or otherwise except as such
-.\"         appears in the above copyright notice or in the software.
-.\"
-.\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
-.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
-.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
-.\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
-.\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
-.\" OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
-.\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
-.\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
-.\" RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
-.\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
-.\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
-.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
-.\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
-.\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-.\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
-.\" THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/makecontext.3,v 1.4 2002/12/19 09:40:21 ru Exp $
-.\"
-.Dd September 10, 2002
-.Dt MAKECONTEXT 3
-.Os
-.Sh NAME
-.Nm makecontext , swapcontext
-.Nd modify and exchange user thread contexts
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ucontext.h
-.Ft void
-.Fo makecontext
-.Fa "ucontext_t *ucp"
-.Fa "void \*[lp]*func\*[rp]\*[lp]\*[rp]"
-.Fa "int argc" ...
-.Fc
-.Ft int
-.Fn swapcontext "ucontext_t *oucp" "const ucontext_t *ucp"
-.Sh DESCRIPTION
-The
-.Fn makecontext
-function
-modifies the user thread context pointed to by
-.Fa ucp ,
-which must have previously been initialized by a call to
-.Xr getcontext 3
-and had a stack allocated for it.
-The context is modified so that it will continue execution by invoking
-.Fn func
-with the arguments (of type
-.Ft int )
-provided.
-The
-.Fa argc
-argument
-must be equal to the number of additional arguments provided to
-.Fn makecontext
-and also equal to the number of arguments to
-.Fn func ,
-or else the behavior is undefined.
-.Pp
-The
-.Fa "ucp->uc_link"
-argument
-must be initialized before calling
-.Fn makecontext
-and determines the action to take when
-.Fn func
-returns:
-if equal to
-.Dv NULL ,
-the process exits;
-otherwise,
-.Fn setcontext "ucp->uc_link"
-is implicitly invoked.
-.Pp
-The
-.Fn swapcontext
-function
-saves the current thread context in
-.Fa "*oucp"
-and makes
-.Fa "*ucp"
-the currently active context.
-.Sh RETURN VALUES
-If successful,
-.Fn swapcontext
-returns zero;
-otherwise \-1 is returned and the global variable
-.Va errno
-is set appropriately.
-.Sh ERRORS
-The
-.Fn swapcontext
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOMEM
-There is not enough stack space in
-.Fa ucp
-to complete the operation.
-.El
-.Sh SEE ALSO
-.Xr setcontext 3 ,
-.Xr ucontext 3
index 92e44dc2dee177576aa49d95bee76fa68728f1b7..09a047a320c635990343a1a13e2a399fbcef92be 100644 (file)
@@ -98,7 +98,6 @@ static int malloc_debug_file = STDERR_FILENO;
  * 3 - a new default zone has been created and another environment variable scan
  */
 __private_extern__ int malloc_def_zone_state = 0;
-__private_extern__ malloc_zone_t *__zone0 = NULL;
 
 static const char Malloc_Facility[] = "com.apple.Libsystem.malloc";
 
@@ -218,7 +217,7 @@ malloc_error_break(void) {
 
 __private_extern__ boolean_t __stack_logging_locked();
 
-__private_extern__ __attribute__((noinline)) int
+__private_extern__ __attribute__((noinline)) __attribute__((used)) int
 malloc_gdb_po_unsafe(void) {
   // In order to implement "po" other data formatters in gdb, the debugger
   // calls functions that call malloc.  The debugger will  only run one thread 
@@ -405,7 +404,7 @@ set_flags_from_environment(void) {
     malloc_debug_flags = SCALABLE_MALLOC_ABORT_ON_CORRUPTION; // Set always on 64-bit processes
 #else
     int libSystemVersion  = NSVersionOfLinkTimeLibrary("System");
-    if ((-1 != libSystemVersion) && ((libSystemVersion >> 16) < 126))
+    if ((-1 != libSystemVersion) && ((libSystemVersion >> 16) < 126) /* Lion or greater */)
        malloc_debug_flags = 0;
     else
        malloc_debug_flags = SCALABLE_MALLOC_ABORT_ON_CORRUPTION;
@@ -619,24 +618,6 @@ malloc_destroy_zone(malloc_zone_t *zone) {
     zone->destroy(zone);
 }
 
-/* called from the {put,set,unset}env routine */
-__private_extern__ void
-__malloc_check_env_name(const char *name)
-{
-    MALLOC_LOCK();
-    /*
-     * 
-     * 2. malloc will no longer take notice of *programmatic* changes to the MALLOC_* environment variables 
-     * (i.e. calls to putenv() or setenv() that manipulate these environment variables.)
-     *
-     */
-#if 0 
-    if(malloc_def_zone_state == 2 && strncmp(name, "Malloc", 6) == 0)
-       malloc_def_zone_state = 1;
-#endif
-    MALLOC_UNLOCK();
-}
-
 /*********     Block creation and manipulation ************/
 
 static void
@@ -1392,6 +1373,7 @@ malloc_error(void (*func)(int)))(int) {
 extern void __stack_logging_fork_prepare();
 extern void __stack_logging_fork_parent();
 extern void __stack_logging_fork_child();
+extern void __stack_logging_early_finished();
 
 void
 _malloc_fork_prepare() {
diff --git a/gen/mrand48-fbsd.c b/gen/mrand48-fbsd.c
deleted file mode 100644 (file)
index 5453ceb..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/mrand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-long
-mrand48(void)
-{
-       _DORAND48(_rand48_seed);
-       return (int)((_rand48_seed >> 16) & 0xffffffff);
-}
diff --git a/gen/nice-fbsd.c b/gen/nice-fbsd.c
deleted file mode 100644 (file)
index 962eee1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)nice.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/nice.c,v 1.4 2007/01/09 00:27:54 imp Exp $");
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <errno.h>
-#include <unistd.h>
-#if __DARWIN_UNIX03
-#include <limits.h>
-#endif /* __DARWIN_UNIX03 */
-/*
- * Backwards compatible nice.
- */
-int
-nice(incr)
-       int incr;
-{
-       int prio, rv;
-
-       errno = 0;
-       prio = getpriority(PRIO_PROCESS, 0);
-       if (prio == -1 && errno)
-               return (-1);
-#if __DARWIN_UNIX03
-       if (prio + incr > NZERO-1)
-               incr = NZERO-1-prio;
-#endif /* __DARWIN_UNIX03 */
-       rv = setpriority(PRIO_PROCESS, 0, prio + incr);
-       if (rv == -1 && errno == EACCES)
-               errno = EPERM;
-       return (rv == -1) ? rv : getpriority(PRIO_PROCESS, 0);
-}
diff --git a/gen/nice.3 b/gen/nice.3
deleted file mode 120000 (symlink)
index 79148b9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./nice.3
\ No newline at end of file
diff --git a/gen/nrand48-fbsd.c b/gen/nrand48-fbsd.c
deleted file mode 100644 (file)
index 1790b23..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/nrand48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-long
-nrand48(unsigned short xseed[3])
-{
-       uint48 tmp;
-       DORAND48(tmp, xseed);
-       return (tmp >> 17) & 0x7fffffff;
-}
diff --git a/gen/opendir-fbsd.c b/gen/opendir-fbsd.c
deleted file mode 100644 (file)
index 86c2e40..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)opendir.c  8.8 (Berkeley) 5/1/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.24 2008/04/16 18:40:52 delphij Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "un-namespace.h"
-
-#include "telldir.h"
-/*
- * Open a directory.
- */
-DIR *
-opendir(const char *name)
-{
-
-       return (__opendir2(name, DTF_HIDEW|DTF_NODUP));
-}
-
-DIR *
-__opendir2(const char *name, int flags)
-{
-       DIR *dirp;
-       int fd;
-       int incr;
-       int saved_errno;
-       int unionstack;
-
-       /*
-        * Use O_DIRECTORY to only open directories (because opening of
-        * special files may be harmful).  errno is set to ENOTDIR if
-        * not a directory.
-        */
-       if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY)) == -1)
-               return (NULL);
-       dirp = NULL;
-       if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
-           (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
-               goto fail;
-
-       dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR));
-       LIST_INIT(&dirp->dd_td->td_locq);
-       dirp->dd_td->td_loccnt = 0;
-
-       /*
-        * Use the system page size if that is a multiple of DIRBLKSIZ.
-        * Hopefully this can be a big win someday by allowing page
-        * trades to user space to be done by _getdirentries().
-        */
-       incr = getpagesize();
-       if ((incr % DIRBLKSIZ) != 0) 
-               incr = DIRBLKSIZ;
-
-       /*
-        * Determine whether this directory is the top of a union stack.
-        */
-       if (flags & DTF_NODUP) {
-               struct statfs sfb;
-
-               if (_fstatfs(fd, &sfb) < 0)
-                       goto fail;
-               unionstack = !strcmp(sfb.f_fstypename, "unionfs")
-                   || (sfb.f_flags & MNT_UNION);
-       } else {
-               unionstack = 0;
-       }
-
-       if (unionstack) {
-               int len = 0;
-               int space = 0;
-               char *buf = 0;
-               char *ddptr = 0;
-               char *ddeptr;
-               int n;
-               struct dirent **dpv;
-
-               /*
-                * The strategy here is to read all the directory
-                * entries into a buffer, sort the buffer, and
-                * remove duplicate entries by setting the inode
-                * number to zero.
-                */
-
-               do {
-                       /*
-                        * Always make at least DIRBLKSIZ bytes
-                        * available to _getdirentries
-                        */
-                       if (space < DIRBLKSIZ) {
-                               space += incr;
-                               len += incr;
-                               buf = reallocf(buf, len);
-                               if (buf == NULL)
-                                       goto fail;
-                               ddptr = buf + (len - space);
-                       }
-
-#if __DARWIN_64_BIT_INO_T
-                       n = __getdirentries64(fd, ddptr, space, &dirp->dd_td->seekoff);
-#else /* !__DARWIN_64_BIT_INO_T */
-                       n = _getdirentries(fd, ddptr, space, &dirp->dd_seek);
-#endif /* __DARWIN_64_BIT_INO_T */
-                       if (n > 0) {
-                               ddptr += n;
-                               space -= n;
-                       }
-               } while (n > 0);
-
-               ddeptr = ddptr;
-               flags |= __DTF_READALL;
-
-               /*
-                * Re-open the directory.
-                * This has the effect of rewinding back to the
-                * top of the union stack and is needed by
-                * programs which plan to fchdir to a descriptor
-                * which has also been read -- see fts.c.
-                */
-               if (flags & DTF_REWIND) {
-                       (void)_close(fd);
-                       if ((fd = _open(name, O_RDONLY)) == -1) {
-                               saved_errno = errno;
-                               free(buf);
-                               free(dirp);
-                               errno = saved_errno;
-                               return (NULL);
-                       }
-               }
-
-               /*
-                * There is now a buffer full of (possibly) duplicate
-                * names.
-                */
-               dirp->dd_buf = buf;
-
-               /*
-                * Go round this loop twice...
-                *
-                * Scan through the buffer, counting entries.
-                * On the second pass, save pointers to each one.
-                * Then sort the pointers and remove duplicate names.
-                */
-               for (dpv = 0;;) {
-                       n = 0;
-                       ddptr = buf;
-                       while (ddptr < ddeptr) {
-                               struct dirent *dp;
-
-                               dp = (struct dirent *) ddptr;
-                               if ((long)dp & 03L)
-                                       break;
-                               if ((dp->d_reclen <= 0) ||
-                                   (dp->d_reclen > (ddeptr + 1 - ddptr)))
-                                       break;
-                               ddptr += dp->d_reclen;
-                               if (dp->d_fileno) {
-                                       if (dpv)
-                                               dpv[n] = dp;
-                                       n++;
-                               }
-                       }
-
-                       if (dpv) {
-                               struct dirent *xp;
-
-                               /*
-                                * This sort must be stable.
-                                */
-                               mergesort(dpv, n, sizeof(*dpv), alphasort);
-
-                               dpv[n] = NULL;
-                               xp = NULL;
-
-                               /*
-                                * Scan through the buffer in sort order,
-                                * zapping the inode number of any
-                                * duplicate names.
-                                */
-                               for (n = 0; dpv[n]; n++) {
-                                       struct dirent *dp = dpv[n];
-
-                                       if ((xp == NULL) ||
-                                           strcmp(dp->d_name, xp->d_name)) {
-                                               xp = dp;
-                                       } else {
-                                               dp->d_fileno = 0;
-                                       }
-                                       if (dp->d_type == DT_WHT &&
-                                           (flags & DTF_HIDEW))
-                                               dp->d_fileno = 0;
-                               }
-
-                               free(dpv);
-                               break;
-                       } else {
-                               dpv = malloc((n+1) * sizeof(struct dirent *));
-                               if (dpv == NULL)
-                                       break;
-                       }
-               }
-
-               dirp->dd_len = len;
-               dirp->dd_size = ddptr - dirp->dd_buf;
-       } else {
-               dirp->dd_len = incr;
-               dirp->dd_size = 0;
-               dirp->dd_buf = malloc(dirp->dd_len);
-               if (dirp->dd_buf == NULL)
-                       goto fail;
-#if __DARWIN_64_BIT_INO_T
-               dirp->dd_td->seekoff = 0;
-#else /* !__DARWIN_64_BIT_INO_T */
-               dirp->dd_seek = 0;
-#endif /* __DARWIN_64_BIT_INO_T */
-               flags &= ~DTF_REWIND;
-       }
-
-       dirp->dd_loc = 0;
-       dirp->dd_fd = fd;
-       dirp->dd_flags = flags;
-       dirp->dd_lock = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
-
-       /*
-        * Set up seek point for rewinddir.
-        */
-       dirp->dd_rewind = telldir(dirp);
-
-       return (dirp);
-
-fail:
-       saved_errno = errno;
-       free(dirp);
-       (void)_close(fd);
-       errno = saved_errno;
-       return (NULL);
-}
diff --git a/gen/pause-fbsd.c b/gen/pause-fbsd.c
deleted file mode 100644 (file)
index 99576fd..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)pause.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-/* For the cancelable variant, we call the cancelable sigsuspend */
-#ifdef VARIANT_CANCELABLE
-#undef __DARWIN_NON_CANCELABLE
-#define __DARWIN_NON_CANCELABLE 0
-#endif /* VARIANT_CANCELABLE */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.8 2009/12/05 19:31:38 ed Exp $");
-
-#include <signal.h>
-#include <unistd.h>
-
-/*
- * Backwards compatible pause.
- */
-int
-__pause(void)
-{
-       sigset_t set;
-
-       sigprocmask(0, NULL, &set);
-       return sigsuspend(&set);
-}
-__weak_reference(__pause, pause);
-__weak_reference(__pause, _pause);
diff --git a/gen/pause-fbsd.c.orig b/gen/pause-fbsd.c.orig
deleted file mode 100644 (file)
index 6f78fe9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)pause.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.8 2009/12/05 19:31:38 ed Exp $");
-
-#include <signal.h>
-#include <unistd.h>
-
-/*
- * Backwards compatible pause.
- */
-int
-__pause(void)
-{
-       return sigpause(sigblock(0L));
-}
-__weak_reference(__pause, pause);
-__weak_reference(__pause, _pause);
diff --git a/gen/pause.3 b/gen/pause.3
deleted file mode 120000 (symlink)
index bf777f1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./pause.3
\ No newline at end of file
index 0bb3bb1c7e2943e98cdbbae5ccbeb7e0dd444e7c..07730c14c7c85884ff9ee9393b79f4e4700bfcc1 100644 (file)
 #if defined(__i386__) || defined(__x86_64__)
 
 #include <stdlib.h>
-#include <platfunc.h>
 #include <machine/cpu_capabilities.h>
+#include "platfunc.h"
 
 #define PLAT_CAP_MASK (kHasMMX | kHasSSE | kHasSSE2 | kHasSSE3 | kCache32 | kCache64 | kCache128 | kFastThreadLocalStorage | kHasSupplementalSSE3 | k64Bit | kHasSSE4_1 | kHasSSE4_2 | kHasAES | kInOrderPipeline | kSlow | kUP)
 
+inline static int __get_cpu_capabilities() {
+       return *((int32_t*)_COMM_PAGE_CPU_CAPABILITIES);
+}
+
 inline static int num_cpus(int capabilities) {
        return (capabilities & kNumCPUs) >> kNumCPUsShift;
 }
 
 /* TODO: If 8151810 is fixed (or full support for visibility("internal") is added), change this to visibility("internal") */
 void __attribute__((visibility("hidden"))) *find_platform_function(const platfunc_descriptor *descriptors[]) {
-       int cap = _get_cpu_capabilities(),
+       int cap = __get_cpu_capabilities(),
            have_cpus = num_cpus(cap);
 
        for (int i = 0; descriptors[i] != 0; i++) {
diff --git a/gen/popen-fbsd.c b/gen/popen-fbsd.c
deleted file mode 100644 (file)
index d4aea86..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software written by Ken Arnold and
- * published in UNIX Review, Vol. 6, No. 8.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef VARIANT_DARWINEXTSN
-#define _DARWIN_UNLIMITED_STREAMS
-#endif /* VARIANT_DARWINEXTSN */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)popen.c    8.3 (Berkeley) 5/3/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.21 2009/05/27 19:28:04 ed Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <wchar.h>             /* fwide() */
-#include <signal.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <paths.h>
-#include <pthread.h>
-#include <spawn.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-
-/* Our queue.h doesn't have SLIST_REMOVE_AFTER in it yet
- * <rdar://problem/7431558> API: Add SLIST_REMOVE_AFTER to sys/queue.h (from FreeBSD)
- */
-#ifndef SLIST_REMOVE_AFTER
-#define SLIST_REMOVE_AFTER(elm, field) do {                             \
-        SLIST_NEXT(elm, field) =                                        \
-            SLIST_NEXT(SLIST_NEXT(elm, field), field);                  \
-} while (0)
-#endif
-
-/* 3516149 - store file descriptor and use that to close to prevent blocking */
-struct pid {
-       SLIST_ENTRY(pid) next;
-       FILE *fp;
-       int fd;
-       pid_t pid;
-};
-#define pidlist                __popen_pidlist
-#define pidlist_mutex  __popen_pidlist_mutex
-#ifndef BUILDING_VARIANT
-__private_extern__ SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist);
-__private_extern__ pthread_mutex_t pidlist_mutex = PTHREAD_MUTEX_INITIALIZER;
-#else /* BUILDING_VARIANT */
-extern SLIST_HEAD(, pid) pidlist;
-extern pthread_mutex_t pidlist_mutex;
-#endif /* !BUILDING_VARIANT */
-
-#define        THREAD_LOCK()   if (__isthreaded) _pthread_mutex_lock(&pidlist_mutex)
-#define        THREAD_UNLOCK() if (__isthreaded) _pthread_mutex_unlock(&pidlist_mutex)
-
-FILE *
-popen(command, type)
-       const char *command, *type;
-{
-       struct pid *cur;
-       FILE *iop;
-       int pdes[2], pid, twoway, other;
-       char *argv[4];
-       struct pid *p;
-       posix_spawn_file_actions_t file_actions;
-       int err;
-
-       if (type == NULL) {
-               errno = EINVAL;
-               return (NULL);
-       }
-       if (strcmp(type, "r+") == 0) {
-               twoway = 1;
-               type = "r+";
-               if (socketpair(AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
-                       return (NULL);
-       } else  {
-               twoway = 0;
-               if ((*type != 'r' && *type != 'w') || type[1]) {
-                       errno = EINVAL;
-                       return (NULL);
-               }
-               if (pipe(pdes) < 0)
-                       return (NULL);
-       }
-
-       /* fdopen can now fail */
-       if (*type == 'r') {
-               iop = fdopen(pdes[0], type);
-               other = pdes[1];
-       } else {
-               iop = fdopen(pdes[1], type);
-               other = pdes[0];
-       }
-       if (iop == NULL) {
-               (void)_close(pdes[0]);
-               (void)_close(pdes[1]);
-               return (NULL);
-       }
-
-       if ((cur = malloc(sizeof(struct pid))) == NULL) {
-               (void)fclose(iop);
-               (void)_close(other);
-               return (NULL);
-       }
-
-       if ((err = posix_spawn_file_actions_init(&file_actions)) != 0) {
-               (void)fclose(iop);
-               (void)_close(other);
-               free(cur);
-               errno = err;
-               return (NULL);
-       }
-       if (*type == 'r') {
-               /*
-                * The dup2() to STDIN_FILENO is repeated to avoid
-                * writing to pdes[1], which might corrupt the
-                * parent's copy.  This isn't good enough in
-                * general, since the _exit() is no return, so
-                * the compiler is free to corrupt all the local
-                * variables.
-                */
-               (void)posix_spawn_file_actions_addclose(&file_actions, pdes[0]);
-               if (pdes[1] != STDOUT_FILENO) {
-                       (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDOUT_FILENO);
-                       (void)posix_spawn_file_actions_addclose(&file_actions, pdes[1]);
-                       if (twoway)
-                               (void)posix_spawn_file_actions_adddup2(&file_actions, STDOUT_FILENO, STDIN_FILENO);
-               } else if (twoway && (pdes[1] != STDIN_FILENO))
-                       (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[1], STDIN_FILENO);
-       } else {
-               if (pdes[0] != STDIN_FILENO) {
-                       (void)posix_spawn_file_actions_adddup2(&file_actions, pdes[0], STDIN_FILENO);
-                       (void)posix_spawn_file_actions_addclose(&file_actions, pdes[0]);
-               }
-               (void)posix_spawn_file_actions_addclose(&file_actions, pdes[1]);
-       }
-       SLIST_FOREACH(p, &pidlist, next)
-               (void)posix_spawn_file_actions_addclose(&file_actions, p->fd);
-
-       argv[0] = "sh";
-       argv[1] = "-c";
-       argv[2] = (char *)command;
-       argv[3] = NULL;
-
-       err = posix_spawn(&pid, _PATH_BSHELL, &file_actions, NULL, argv, environ);
-       posix_spawn_file_actions_destroy(&file_actions);
-
-       if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */
-               (void)fclose(iop);
-               (void)_close(other);
-               free(cur);
-               errno = err;
-               return (NULL);
-       } else if (err != 0) { /* couldn't exec the shell */
-               pid = -1;
-       }
-
-       if (*type == 'r') {
-               cur->fd = pdes[0];
-               (void)_close(pdes[1]);
-       } else {
-               cur->fd = pdes[1];
-               (void)_close(pdes[0]);
-       }
-
-       /* Link into list of file descriptors. */
-       cur->fp = iop;
-       cur->pid = pid;
-       THREAD_LOCK();
-       SLIST_INSERT_HEAD(&pidlist, cur, next);
-       THREAD_UNLOCK();
-       fwide(iop, -1);         /* byte stream */
-       return (iop);
-}
-
-#ifndef BUILDING_VARIANT
-/*
- * pclose --
- *     Pclose returns -1 if stream is not associated with a `popened' command,
- *     if already `pclosed', or waitpid returns an error.
- */
-int
-pclose(iop)
-       FILE *iop;
-{
-       struct pid *cur, *last = NULL;
-       int pstat;
-       pid_t pid;
-
-       /*
-        * Find the appropriate file pointer and remove it from the list.
-        */
-       THREAD_LOCK();
-       SLIST_FOREACH(cur, &pidlist, next) {
-               if (cur->fp == iop)
-                       break;
-               last = cur;
-       }
-       if (cur == NULL) {
-               THREAD_UNLOCK();
-               return (-1);
-       }
-       if (last == NULL)
-               SLIST_REMOVE_HEAD(&pidlist, next);
-       else
-               SLIST_REMOVE_AFTER(last, next);
-       THREAD_UNLOCK();
-
-       (void)fclose(iop);
-
-       if (cur->pid < 0) {
-               free(cur);
-               return W_EXITCODE(127, 0);
-       }
-       do {
-               pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
-       } while (pid == -1 && errno == EINTR);
-
-       free(cur);
-
-       return (pid == -1 ? -1 : pstat);
-}
-#endif /* !BUILDING_VARIANT */
diff --git a/gen/popen.3 b/gen/popen.3
deleted file mode 100644 (file)
index 5f4a8c6..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)popen.3    8.2 (Berkeley) 5/3/95
-.\" $FreeBSD: src/lib/libc/gen/popen.3,v 1.16 2003/06/08 10:01:51 charnier Exp $
-.\"
-.Dd May 3, 1995
-.Dt POPEN 3
-.Os
-.Sh NAME
-.Nm pclose ,
-.Nm popen
-.Nd process
-.Tn I/O
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft FILE *
-.Fo popen
-.Fa "const char *command"
-.Fa "const char *mode"
-.Fc
-.Ft int
-.Fo pclose
-.Fa "FILE *stream"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn popen
-function
-.Dq opens
-a process by creating a bidirectional pipe, forking,
-and invoking the shell.
-Any streams opened by previous
-.Fn popen
-calls in the parent process are closed in the new child process.
-Historically,
-.Fn popen
-was implemented with a unidirectional pipe;
-hence, many implementations of
-.Fn popen
-only allow the
-.Fa mode
-argument to specify reading or writing, not both.
-Because
-.Fn popen
-is now implemented using a bidirectional pipe, the
-.Fa mode
-argument may request a bidirectional data flow.
-The
-.Fa mode
-argument is a pointer to a null-terminated string
-which must be
-.Ql r
-for reading,
-.Ql w
-for writing, or
-.Ql r+
-for reading and writing.
-.Pp
-The
-.Fa command
-argument is a pointer to a null-terminated string
-containing a shell command line.
-This command is passed to
-.Pa /bin/sh ,
-using the
-.Fl c
-flag; interpretation, if any, is performed by the shell.
-.Pp
-The return value from
-.Fn popen
-is a normal standard
-.Tn I/O
-stream in all respects,
-save that it must be closed with
-.Fn pclose
-rather than
-.Fn fclose .
-Writing to such a stream
-writes to the standard input of the command;
-the command's standard output is the same as that of the process that called
-.Fn popen ,
-unless this is altered by the command itself.
-Conversely, reading from a
-.Dq popened
-stream reads the command's standard output, and
-the command's standard input is the same as that of the process that called
-.Fn popen .
-.Pp
-Note that output
-.Fn popen
-streams are fully buffered, by default.
-.Pp
-The
-.Fn pclose
-function waits for the associated process to terminate;
-it returns the exit status of the command,
-as returned by
-.Xr wait4 2 .
-.Sh RETURN VALUES
-The
-.Fn popen
-function returns
-.Dv NULL
-if the
-.Xr fork 2
-or
-.Xr pipe 2
-calls fail,
-or if it cannot allocate memory.
-.Pp
-The
-.Fn pclose
-function
-returns \-1 if
-.Fa stream
-is not associated with a
-.Dq popened
-command, if
-.Fa stream
-already
-.Dq pclosed ,
-or if
-.Xr wait4 2
-returns an error.
-.Sh ERRORS
-The
-.Fn popen
-function does not reliably set
-.Va errno .
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr fork 2 ,
-.Xr pipe 2 ,
-.Xr wait4 2 ,
-.Xr fclose 3 ,
-.Xr fflush 3 ,
-.Xr fopen 3 ,
-.Xr stdio 3 ,
-.Xr system 3
-.Sh BUGS
-Since the standard input of a command opened for reading
-shares its seek offset with the process that called
-.Fn popen ,
-if the original process has done a buffered read,
-the command's input position may not be as expected.
-Similarly, the output from a command opened for writing
-may become intermingled with that of the original process.
-The latter can be avoided by calling
-.Xr fflush 3
-before
-.Fn popen .
-.Pp
-Failure to execute the shell
-is indistinguishable from the shell's failure to execute command,
-or an immediate exit of the command.
-The only hint is an exit status of 127.
-.Pp
-The
-.Fn popen
-function
-always calls
-.Xr sh 1 ,
-never calls
-.Xr csh 1 .
-.Sh HISTORY
-A
-.Fn popen
-and a
-.Fn pclose
-function appeared in
-.At v7 .
-.Pp
-Bidirectional functionality was added in
-.Fx 2.2.6 .
diff --git a/gen/pselect-fbsd.c b/gen/pselect-fbsd.c
deleted file mode 100644 (file)
index 4bc62fc..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2000 Massachusetts Institute of Technology
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that both the above copyright notice and this
- * permission notice appear in all copies, that both the above
- * copyright notice and this permission notice appear in all
- * supporting documentation, and that the name of M.I.T. not be used
- * in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.  M.I.T. makes
- * no representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied
- * warranty.
- *
- * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
- * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
- * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(VARIANT_CANCELABLE) || defined(VARIANT_PRE1050)
-#undef __DARWIN_NON_CANCELABLE
-#endif /* VARIANT_CANCELABLE */
-
-#ifdef VARIANT_DARWINEXTSN
-#define _DARWIN_UNLIMITED_SELECT
-#endif /* VARIANT_DARWINEXTSN */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <signal.h>
-#include "un-namespace.h"
-
-__weak_reference(__pselect, pselect);
-
-/*
- * Emulate the POSIX 1003.1g-2000 `pselect' interface.  This is the
- * same as the traditional BSD `select' function, except that it uses
- * a timespec rather than a timeval, doesn't modify the timeout argument,
- * and allows the user to specify a signal mask to apply during the select.
- */
-int
-__pselect(int count, fd_set * __restrict rfds, fd_set * __restrict wfds, 
-       fd_set * __restrict efds, const struct timespec * __restrict timo, 
-       const sigset_t * __restrict mask)
-{
-       sigset_t omask;
-       struct timeval tvtimo, *tvp;
-       int rv, sverrno;
-
-       if (timo) {
-               TIMESPEC_TO_TIMEVAL(&tvtimo, timo);
-               tvp = &tvtimo;
-       } else
-               tvp = 0;
-
-       if (mask != 0) {
-               rv = _sigprocmask(SIG_SETMASK, mask, &omask);
-               if (rv != 0)
-                       return rv;
-       }
-
-       rv = _select(count, rfds, wfds, efds, tvp);
-       if (mask != 0) {
-               sverrno = errno;
-               _sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
-               errno = sverrno;
-       }
-
-       return rv;
-}
diff --git a/gen/pselect.3 b/gen/pselect.3
deleted file mode 100644 (file)
index 615a399..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-.\"
-.\" Copyright 2002 Massachusetts Institute of Technology
-.\"
-.\" Permission to use, copy, modify, and distribute this software and
-.\" its documentation for any purpose and without fee is hereby
-.\" granted, provided that both the above copyright notice and this
-.\" permission notice appear in all copies, that both the above
-.\" copyright notice and this permission notice appear in all
-.\" supporting documentation, and that the name of M.I.T. not be used
-.\" in advertising or publicity pertaining to distribution of the
-.\" software without specific, written prior permission.  M.I.T. makes
-.\" no representations about the suitability of this software for any
-.\" purpose.  It is provided "as is" without express or implied
-.\" warranty.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
-.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
-.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/pselect.3,v 1.4 2002/12/18 10:13:54 ru Exp $
-.\"
-.Dd June 16, 2002
-.Dt PSELECT 3
-.Os
-.Sh NAME
-.Nm pselect
-.Nd synchronous I/O multiplexing a la POSIX.1g
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fo pselect
-.Fa "int nfds"
-.Fa "fd_set *restrict readfds"
-.Fa "fd_set *restrict writefds"
-.Fa "fd_set *restrict errorfds"
-.Fa "const struct timespec *restrict timeout"
-.Fa "const sigset_t *restrict sigmask"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn pselect
-function was introduced by
-.St -p1003.1g-2000
-as a slightly stronger version of
-.Xr select 2 .
-The
-.Fa nfds , readfds , writefds ,
-and
-.Fa errorfds
-arguments are all identical to the analogous arguments of
-.Fn select .
-The
-.Fa timeout
-argument in
-.Fn pselect
-points to a
-.Vt "const struct timespec" ,
-rather than the (modifiable)
-.Vt "struct timeval"
-used by
-.Fn select ;
-as in
-.Fn select ,
-a null pointer may be passed to indicate that
-.Fn pselect
-should wait indefinitely.
-Finally,
-.Fa sigmask
-specifies a signal mask which is set while waiting for input.
-When
-.Fn pselect
-returns, the original signal mask is restored.
-.Pp
-See
-.Xr select 2
-for a more detailed discussion of the semantics of this interface, and
-for macros used to manipulate the
-.Vt "fd_set"
-data type.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn pselect
-function is implemented in the C library as a wrapper around
-.Fn select .
-.Sh RETURN VALUES
-The
-.Fn pselect
-function returns the same values and under the same conditions as
-.Fn select .
-.Sh ERRORS
-The
-.Fn pselect
-function may fail for any of the reasons documented for
-.Xr select 2
-and (if a signal mask is provided)
-.Xr sigprocmask 2 .
-.Sh SEE ALSO
-.Xr kqueue 2 ,
-.Xr poll 2 ,
-.Xr select 2 ,
-.Xr sigprocmask 2
-.Sh STANDARDS
-The
-.Fn pselect
-function conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn pselect
-function first appeared in
-.Fx 5.0 .
-.Sh AUTHORS
-The
-.Fn pselect
-function and this manual page were written by
-.An Garrett Wollman Aq wollman@FreeBSD.org .
diff --git a/gen/psignal-fbsd.c b/gen/psignal-fbsd.c
deleted file mode 120000 (symlink)
index 993ff39..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./psignal.c
\ No newline at end of file
diff --git a/gen/psignal.3 b/gen/psignal.3
deleted file mode 100644 (file)
index 84976af..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)psignal.3  8.2 (Berkeley) 2/27/95
-.\" $FreeBSD: src/lib/libc/gen/psignal.3,v 1.17 2007/01/09 00:27:54 imp Exp $
-.\"
-.Dd February 27, 1995
-.Dt PSIGNAL 3
-.Os
-.Sh NAME
-.Nm psignal ,
-.Nm strsignal ,
-.Nm sys_siglist ,
-.Nm sys_signame
-.Nd system signal messages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft void
-.Fn psignal "unsigned sig" "const char *s"
-.Vt extern const char * const sys_siglist[] ;
-.Vt extern const char * const sys_signame[] ;
-.In string.h
-.Ft "char *"
-.Fn strsignal "int sig"
-.Sh DESCRIPTION
-The
-.Fn psignal
-and
-.Fn strsignal
-functions locate the descriptive message
-string for a signal number.
-.Pp
-The
-.Fn strsignal
-function accepts a signal number argument
-.Fa sig
-and returns a pointer to the corresponding message string.
-.Pp
-The
-.Fn psignal
-function accepts a signal number argument
-.Fa sig
-and writes it to the standard error.
-If the argument
-.Fa s
-is
-.Pf non- Dv NULL
-and does not point to the null character,
-.Fa s
-is written to the standard error file descriptor
-prior to the message string,
-immediately followed by a colon and a space.
-If the signal number is not recognized
-.Pq Xr sigaction 2 ,
-the string
-.Dq "Unknown signal
-is produced.
-.Pp
-The message strings can be accessed directly
-through the external array
-.Va sys_siglist ,
-indexed by recognized signal numbers.
-The external array
-.Va sys_signame
-is used similarly and
-contains short, lower-case abbreviations for signals
-which are useful for recognizing signal names
-in user input.
-The defined variable
-.Dv NSIG
-contains a count of the strings in
-.Va sys_siglist
-and
-.Va sys_signame .
-.Sh RETURN VALUES
-.Fn strsignal
-a pointer to the desired message or a NULL value indicating an error.  This
-string is not to be freed by the caller.  Beginning with Mac OSX 10.7, this
-string is unique to each thread.
-.Sh ERRORS
-.Fn strsignal
-will fail and no additional memory will be allocated if
-one of the following are true:
-.Bl -tag -width Er
-.It Bq Er ENOMEM
-There was insufficient memory to allocate storage space for the return value in the running thread.
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr perror 3 ,
-.Xr strerror 3
-.Sh HISTORY
-The
-.Fn psignal
-function appeared in
-.Bx 4.2 .
diff --git a/gen/raise-fbsd.c b/gen/raise-fbsd.c
deleted file mode 120000 (symlink)
index 9229902..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./raise.c
\ No newline at end of file
diff --git a/gen/raise.3 b/gen/raise.3
deleted file mode 120000 (symlink)
index 87dfefd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./raise.3
\ No newline at end of file
diff --git a/gen/rand48.3 b/gen/rand48.3
deleted file mode 100644 (file)
index 6bc96d6..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-.\" Copyright (c) 1993 Martin Birgmeier
-.\" All rights reserved.
-.\"
-.\" You may redistribute unmodified or modified versions of this source
-.\" code provided that the above copyright notice and this and the
-.\" following conditions are retained.
-.\"
-.\" This software is provided ``as is'', and comes with no warranties
-.\" of any kind. I shall in no event be liable for anything that happens
-.\" to anyone/anything when using this software.
-.\"
-.\"     @(#)rand48.3 V1.0 MB 8 Oct 1993
-.\" $FreeBSD: src/lib/libc/gen/rand48.3,v 1.17 2005/01/20 09:17:02 ru Exp $
-.\"
-.Dd October 8, 1993
-.Dt RAND48 3
-.Os
-.Sh NAME
-.Nm drand48 ,
-.Nm erand48 ,
-.Nm jrand48 ,
-.Nm lcong48 ,
-.Nm lrand48 ,
-.Nm mrand48 ,
-.Nm nrand48 ,
-.Nm seed48 ,
-.Nm srand48
-.Nd pseudo random number generators and initialization routines
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft double
-.Fo drand48
-.Fa void
-.Fc
-.Ft double
-.Fo erand48
-.Fa "unsigned short xsubi[3]"
-.Fc
-.Ft long
-.Fo jrand48
-.Fa "unsigned short xsubi[3]"
-.Fc
-.Ft void
-.Fo lcong48
-.Fa "unsigned short param[7]"
-.Fc
-.Ft long
-.Fo lrand48
-.Fa void
-.Fc
-.Ft long
-.Fo mrand48
-.Fa void
-.Fc
-.Ft long
-.Fo nrand48
-.Fa "unsigned short xsubi[3]"
-.Fc
-.Ft "unsigned short *"
-.Fo seed48
-.Fa "unsigned short seed16v[3]"
-.Fc
-.Ft void
-.Fo srand48
-.Fa "long seedval"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn rand48
-family of functions generates pseudo-random numbers, using a linear
-congruential algorithm working on integers 48 bits in size.
-The
-particular formula employed is
-r(n+1) = (a * r(n) + c) mod m.
-The default value for the multiplicand `a' is 0x5deece66d (25214903917).
-The default value for the the addend `c' is 0xb (11).
-The modulo is always fixed at m = 2 ** 48.
-r(n) is called the seed of the random number generator.
-.Pp
-For the six generator routines described next, the first
-computational step is to perform a single iteration of the algorithm.
-.Pp
-The
-.Fn drand48
-and
-.Fn erand48
-functions
-return values of type double.
-The full 48 bits of r(n+1) are
-loaded into the mantissa of the returned value, with the exponent set
-such that the values produced lie in the interval [0.0, 1.0).
-.Pp
-The
-.Fn lrand48
-and
-.Fn nrand48
-functions
-return values of type long in the range
-[0, 2**31-1].
-The high-order (31) bits of
-r(n+1) are loaded into the lower bits of the returned value, with
-the topmost (sign) bit set to zero.
-.Pp
-The
-.Fn mrand48
-and
-.Fn jrand48
-functions
-return values of type long in the range
-[-2**31, 2**31-1].
-The high-order (32) bits of
-r(n+1) are loaded into the returned value.
-.Pp
-The
-.Fn drand48 ,
-.Fn lrand48 ,
-and
-.Fn mrand48
-functions
-use an internal buffer to store r(n).
-For these functions
-the initial value of r(0) = 0x1234abcd330e = 20017429951246.
-.Pp
-On the other hand,
-.Fn erand48 ,
-.Fn nrand48 ,
-and
-.Fn jrand48
-use a user-supplied buffer to store the seed r(n),
-which consists of an array of 3 shorts, where the zeroth member
-holds the least significant bits.
-.Pp
-All functions share the same multiplicand and addend.
-.Pp
-The
-.Fn srand48
-function
-is used to initialize the internal buffer r(n) of
-.Fn drand48 ,
-.Fn lrand48 ,
-and
-.Fn mrand48 ,
-such that the 32 bits of the seed value are copied into the upper 32 bits
-of r(n), with the lower 16 bits of r(n) arbitrarily being set to 0x330e.
-Additionally, the constant multiplicand and addend of the algorithm are
-reset to the default values given above.
-.Pp
-The
-.Fn seed48
-function
-also initializes the internal buffer r(n) of
-.Fn drand48 ,
-.Fn lrand48 ,
-and
-.Fn mrand48 ,
-but here all 48 bits of the seed can be specified in an array of 3 shorts,
-where the zeroth member specifies the lowest bits.
-Again,
-the constant multiplicand and addend of the algorithm are
-reset to the default values given above.
-The
-.Fn seed48
-function
-returns a pointer to an array of 3 shorts which contains the old seed.
-This array is statically allocated; thus, its contents are lost after
-each new call to
-.Fn seed48 .
-.Pp
-Finally,
-.Fn lcong48
-allows full control over the multiplicand and addend used in
-.Fn drand48 ,
-.Fn erand48 ,
-.Fn lrand48 ,
-.Fn nrand48 ,
-.Fn mrand48 ,
-and
-.Fn jrand48 ,
-and the seed used in
-.Fn drand48 ,
-.Fn lrand48 ,
-and
-.Fn mrand48 .
-An array of 7 shorts is passed as argument; the first three shorts are
-used to initialize the seed; the second three are used to initialize the
-multiplicand; and the last short is used to initialize the addend.
-It is thus not possible to use values greater than 0xffff as the addend.
-.Pp
-Note that all three methods of seeding the random number generator
-always also set the multiplicand and addend for any of the six
-generator calls.
-.Pp
-For a more powerful random number generator, see
-.Xr random 3 .
-.Sh SEE ALSO
-.Xr rand 3 ,
-.Xr random 3
-.Sh AUTHORS
-.An Martin Birgmeier
diff --git a/gen/rand48.h b/gen/rand48.h
deleted file mode 100644 (file)
index e799eba..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- *
- * $FreeBSD: src/lib/libc/gen/rand48.h,v 1.2 2002/02/01 01:32:19 obrien Exp $
- */
-
-#ifndef _RAND48_H_
-#define _RAND48_H_
-
-#include <math.h>
-#include <stdlib.h>
-
-#define        RAND48_SEED_0   (0x330e)
-#define        RAND48_SEED_1   (0xabcd)
-#define        RAND48_SEED_2   (0x1234)
-#define        RAND48_MULT_0   (0xe66d)
-#define        RAND48_MULT_1   (0xdeec)
-#define        RAND48_MULT_2   (0x0005)
-#define        RAND48_ADD      (0x000b)
-
-typedef unsigned long long uint48;
-
-extern uint48 _rand48_seed;
-extern uint48 _rand48_mult;
-extern uint48 _rand48_add;
-
-#define TOUINT48(x,y,z) \
-       ((uint48)(x) + (((uint48)(y)) << 16) + (((uint48)(z)) << 32))
-
-#define RAND48_SEED    TOUINT48(RAND48_SEED_0, RAND48_SEED_1, RAND48_SEED_2)
-#define RAND48_MULT    TOUINT48(RAND48_MULT_0, RAND48_MULT_1, RAND48_MULT_2)
-
-#define LOADRAND48(l,x) \
-       (l) = TOUINT48((x)[0], (x)[1], (x)[2])
-
-#define STORERAND48(l,x) \
-       (x)[0] = (unsigned short)(l); \
-       (x)[1] = (unsigned short)((l) >> 16); \
-       (x)[2] = (unsigned short)((l) >> 32)
-
-#define _DORAND48(l) \
-       (l) = (l) * _rand48_mult + _rand48_add
-
-#define DORAND48(l,x) \
-       LOADRAND48(l, x); \
-       _DORAND48(l); \
-       STORERAND48(l, x)
-
-#include "fpmath.h"
-
-/*
- * Optimization for speed: avoid int-to-double conversion.  Assume doubles
- * are IEEE-754 and insert the bits directly.  To normalize, the (1 << 52)
- * is the hidden bit, which the first set bit is shifted to.
- */
-#define ERAND48_BEGIN \
-       union { \
-               union IEEEd2bits ieee; \
-               unsigned long long l; \
-       } u; \
-       int s
-
-#define ERAND48_END(x) \
-       u.l = ((x) & 0xffffffffffffULL); \
-       if (u.l == 0) \
-               return 0.0; \
-       u.l <<= 5; \
-       for(s = 0; !(u.l & (1LL << 52)); s++, u.l <<= 1) {} \
-       u.ieee.bits.exp = 1022 - s; \
-       return u.ieee.d
-
-#endif /* _RAND48_H_ */
diff --git a/gen/readdir-fbsd.c b/gen/readdir-fbsd.c
deleted file mode 100644 (file)
index 3875cef..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)readdir.c  8.3 (Berkeley) 9/29/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.15 2008/05/05 14:05:23 kib Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <dirent.h>
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "telldir.h"
-
-/*
- * get next entry in a directory.
- */
-struct dirent *
-_readdir_unlocked(dirp, skip)
-       DIR *dirp;
-       int skip;
-{
-       struct dirent *dp;
-
-       for (;;) {
-               if (dirp->dd_loc >= dirp->dd_size) {
-                       if (dirp->dd_flags & __DTF_READALL)
-                               return (NULL);
-                       dirp->dd_loc = 0;
-               }
-               if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
-#if __DARWIN_64_BIT_INO_T
-                       dirp->dd_size = __getdirentries64(dirp->dd_fd,
-                           dirp->dd_buf, dirp->dd_len, &dirp->dd_td->seekoff);
-#else /* !__DARWIN_64_BIT_INO_T */
-                       dirp->dd_size = _getdirentries(dirp->dd_fd,
-                           dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
-#endif /* __DARWIN_64_BIT_INO_T */
-                       if (dirp->dd_size <= 0)
-                               return (NULL);
-               }
-               dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc);
-               if ((long)dp & 03L)     /* bogus pointer check */
-                       return (NULL);
-               if (dp->d_reclen <= 0 ||
-                   dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc)
-                       return (NULL);
-               dirp->dd_loc += dp->d_reclen;
-               if (dp->d_ino == 0 && skip)
-                       continue;
-               if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW))
-                       continue;
-               return (dp);
-       }
-}
-
-struct dirent *
-readdir(dirp)
-       DIR *dirp;
-{
-       struct dirent   *dp;
-
-       if (__isthreaded) {
-               _pthread_mutex_lock(&dirp->dd_lock);
-               dp = _readdir_unlocked(dirp, 1);
-               _pthread_mutex_unlock(&dirp->dd_lock);
-       }
-       else
-               dp = _readdir_unlocked(dirp, 1);
-       return (dp);
-}
-
-int
-readdir_r(dirp, entry, result)
-       DIR *dirp;
-       struct dirent *entry;
-       struct dirent **result;
-{
-       struct dirent *dp;
-       int saved_errno;
-
-       saved_errno = errno;
-       errno = 0;
-       if (__isthreaded) {
-               _pthread_mutex_lock(&dirp->dd_lock);
-               if ((dp = _readdir_unlocked(dirp, 1)) != NULL)
-                       memcpy(entry, dp, _GENERIC_DIRSIZ(dp));
-               _pthread_mutex_unlock(&dirp->dd_lock);
-       }
-       else if ((dp = _readdir_unlocked(dirp, 1)) != NULL)
-               memcpy(entry, dp, _GENERIC_DIRSIZ(dp));
-
-       if (errno != 0) {
-               if (dp == NULL)
-                       return (errno);
-       } else
-               errno = saved_errno;
-
-       if (dp != NULL)
-               *result = entry;
-       else
-               *result = NULL;
-
-       return (0);
-}
diff --git a/gen/readpassphrase-fbsd.c b/gen/readpassphrase-fbsd.c
deleted file mode 100644 (file)
index 45ac15f..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*     $OpenBSD: readpassphrase.c,v 1.12 2001/12/15 05:41:00 millert Exp $     */
-
-/*
- * Copyright (c) 2000 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.12 2001/12/15 05:41:00 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/readpassphrase.c,v 1.6 2002/03/09 03:16:41 green Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <pwd.h>
-#include <signal.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
-#include <readpassphrase.h>
-#include "un-namespace.h"
-
-static volatile sig_atomic_t signo;
-
-static void handler(int);
-
-char *
-readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
-{
-       ssize_t nr;
-       int input, output, save_errno;
-       char ch, *p, *end;
-       struct termios term, oterm;
-       struct sigaction sa, saveint, savehup, savequit, saveterm;
-       struct sigaction savetstp, savettin, savettou;
-       locale_t loc = __current_locale();
-
-       /* I suppose we could alloc on demand in this case (XXX). */
-       if (bufsiz == 0) {
-               errno = EINVAL;
-               return(NULL);
-       }
-
-restart:
-       /*
-        * Read and write to /dev/tty if available.  If not, read from
-        * stdin and write to stderr unless a tty is required.
-        */
-       if ((input = output = _open(_PATH_TTY, O_RDWR)) == -1) {
-               if (flags & RPP_REQUIRE_TTY) {
-                       errno = ENOTTY;
-                       return(NULL);
-               }
-               input = STDIN_FILENO;
-               output = STDERR_FILENO;
-       }
-
-       /*
-        * Catch signals that would otherwise cause the user to end
-        * up with echo turned off in the shell.  Don't worry about
-        * things like SIGALRM and SIGPIPE for now.
-        */
-       sigemptyset(&sa.sa_mask);
-       sa.sa_flags = 0;                /* don't restart system calls */
-       sa.sa_handler = handler;
-       (void)_sigaction(SIGINT, &sa, &saveint);
-       (void)_sigaction(SIGHUP, &sa, &savehup);
-       (void)_sigaction(SIGQUIT, &sa, &savequit);
-       (void)_sigaction(SIGTERM, &sa, &saveterm);
-       (void)_sigaction(SIGTSTP, &sa, &savetstp);
-       (void)_sigaction(SIGTTIN, &sa, &savettin);
-       (void)_sigaction(SIGTTOU, &sa, &savettou);
-
-       /* Turn off echo if possible. */
-       if (tcgetattr(input, &oterm) == 0) {
-               memcpy(&term, &oterm, sizeof(term));
-               if (!(flags & RPP_ECHO_ON))
-                       term.c_lflag &= ~(ECHO | ECHONL);
-               if (term.c_cc[VSTATUS] != _POSIX_VDISABLE)
-                       term.c_cc[VSTATUS] = _POSIX_VDISABLE;
-               (void)tcsetattr(input, TCSAFLUSH|TCSASOFT, &term);
-       } else {
-               memset(&term, 0, sizeof(term));
-               memset(&oterm, 0, sizeof(oterm));
-       }
-
-       (void)_write(output, prompt, strlen(prompt));
-       end = buf + bufsiz - 1;
-       for (p = buf; (nr = _read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r';) {
-               if (p < end) {
-                       if ((flags & RPP_SEVENBIT))
-                               ch &= 0x7f;
-                       if (isalpha_l(ch, loc)) {
-                               if ((flags & RPP_FORCELOWER))
-                                       ch = tolower_l(ch, loc);
-                               if ((flags & RPP_FORCEUPPER))
-                                       ch = toupper_l(ch, loc);
-                       }
-                       *p++ = ch;
-               }
-       }
-       *p = '\0';
-       save_errno = errno;
-       if (!(term.c_lflag & ECHO))
-               (void)_write(output, "\n", 1);
-
-       /* Restore old terminal settings and signals. */
-       if (memcmp(&term, &oterm, sizeof(term)) != 0)
-               (void)tcsetattr(input, TCSANOW|TCSASOFT, &oterm);
-       (void)_sigaction(SIGINT, &saveint, NULL);
-       (void)_sigaction(SIGHUP, &savehup, NULL);
-       (void)_sigaction(SIGQUIT, &savequit, NULL);
-       (void)_sigaction(SIGTERM, &saveterm, NULL);
-       (void)_sigaction(SIGTSTP, &savetstp, NULL);
-       (void)_sigaction(SIGTTIN, &savettin, NULL);
-       (void)_sigaction(SIGTTOU, &savettou, NULL);
-       if (input != STDIN_FILENO)
-               (void)_close(input);
-
-       /*
-        * If we were interrupted by a signal, resend it to ourselves
-        * now that we have restored the signal handlers.
-        */
-       if (signo) {
-               kill(getpid(), signo); 
-               switch (signo) {
-               case SIGTSTP:
-               case SIGTTIN:
-               case SIGTTOU:
-                       signo = 0;
-                       goto restart;
-               }
-       }
-
-       errno = save_errno;
-       return(nr == -1 ? NULL : buf);
-}
-
-char *
-getpass(const char *prompt)
-{
-       static char buf[_PASSWORD_LEN + 1];
-
-       if (readpassphrase(prompt, buf, sizeof(buf), RPP_ECHO_OFF) == NULL)
-               buf[0] = '\0';
-       return(buf);
-}
-
-static void handler(int s)
-{
-
-       signo = s;
-}
diff --git a/gen/readpassphrase.3 b/gen/readpassphrase.3
deleted file mode 120000 (symlink)
index ce01f5d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./readpassphrase.3
\ No newline at end of file
diff --git a/gen/rewinddir-fbsd.c b/gen/rewinddir-fbsd.c
deleted file mode 120000 (symlink)
index e39837e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rewinddir.c
\ No newline at end of file
diff --git a/gen/scandir-fbsd.c b/gen/scandir-fbsd.c
deleted file mode 100644 (file)
index 7f2b13d..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)scandir.c  8.3 (Berkeley) 1/2/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.9 2008/03/16 19:08:53 das Exp $");
-
-/*
- * Scan the directory dirname calling select to make a list of selected
- * directory entries then sort using qsort and compare routine dcomp.
- * Returns the number of entries and a pointer to a list of pointers to
- * struct dirent (through namelist). Returns -1 if there were any errors.
- */
-
-#include "namespace.h"
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include "un-namespace.h"
-
-/*
- * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
- * entry.  This requires the amount of space in struct dirent without the
- * d_name field, plus enough space for the name and a terminating nul byte
- * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
- */
-
-int
-scandir(dirname, namelist, select, dcomp)
-       const char *dirname;
-       struct dirent ***namelist;
-       int (*select)(struct dirent *);
-       int (*dcomp)(const void *, const void *);
-{
-       struct dirent *d, *p, **names = NULL;
-       size_t nitems = 0;
-       long arraysz;
-       DIR *dirp;
-
-       if ((dirp = opendir(dirname)) == NULL)
-               return(-1);
-
-       arraysz = 32;   /* initial estimate of the array size */
-       names = (struct dirent **)malloc(arraysz * sizeof(struct dirent *));
-       if (names == NULL)
-               goto fail;
-
-       while ((d = readdir(dirp)) != NULL) {
-               if (select != NULL && !(*select)(d))
-                       continue;       /* just selected names */
-               /*
-                * Make a minimum size copy of the data
-                */
-               p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
-               if (p == NULL)
-                       goto fail;
-               p->d_fileno = d->d_fileno;
-               p->d_type = d->d_type;
-               p->d_reclen = d->d_reclen;
-               p->d_namlen = d->d_namlen;
-               bcopy(d->d_name, p->d_name, p->d_namlen + 1);
-               /*
-                * Check to make sure the array has space left and
-                * realloc the maximum size.
-                */
-               if (nitems >= arraysz) {
-                       struct dirent **names2;
-
-                       names2 = (struct dirent **)realloc((char *)names,
-                               (arraysz * 2) * sizeof(struct dirent *));
-                       if (names2 == NULL) {
-                               free(p);
-                               goto fail;
-                       }
-                       names = names2;
-                       arraysz *= 2;
-               }
-               names[nitems++] = p;
-       }
-       closedir(dirp);
-       if (nitems && dcomp != NULL)
-               qsort(names, nitems, sizeof(struct dirent *), dcomp);
-       *namelist = names;
-       return(nitems);
-
-fail:
-       while (nitems > 0)
-               free(names[--nitems]);
-       free(names);
-       closedir(dirp);
-       return -1;
-}
-
-/*
- * Alphabetic order comparison routine for those who want it.
- */
-int
-alphasort(d1, d2)
-       const void *d1;
-       const void *d2;
-{
-       return(strcmp((*(struct dirent **)d1)->d_name,
-           (*(struct dirent **)d2)->d_name));
-}
diff --git a/gen/scandir.3 b/gen/scandir.3
deleted file mode 100644 (file)
index 7998581..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)scandir.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/scandir.3,v 1.9 2007/01/09 00:27:55 imp Exp $
-.\"
-.Dd May 20, 2008
-.Dt SCANDIR 3
-.Os
-.Sh NAME
-.Nm scandir ,
-#ifdef UNIFDEF_BLOCKS
-.Nm scandir_b ,
-#endif
-.Nm alphasort
-.Nd scan a directory
-.Sh SYNOPSIS
-.In sys/types.h
-.In dirent.h
-.Ft int
-.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
-.Ft int
-.Fn alphasort "const void *d1" "const void *d2"
-#ifdef UNIFDEF_BLOCKS
-.Ft int
-.Fn scandir_b "const char *dirname" "struct dirent ***namelist" "int \\*(lp^select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp^compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
-#endif
-.Sh DESCRIPTION
-The
-.Fn scandir
-function
-reads the directory
-.Fa dirname
-and builds an array of pointers to directory
-entries using
-.Xr malloc 3 .
-It returns the number of entries in the array.
-A pointer to the array of directory entries is stored in the location
-referenced by
-.Fa namelist .
-.Pp
-The
-.Fa select
-argument is a pointer to a user supplied subroutine which is called by
-.Fn scandir
-to select which entries are to be included in the array.
-The select routine is passed a
-pointer to a directory entry and should return a non-zero
-value if the directory entry is to be included in the array.
-If
-.Fa select
-is null, then all the directory entries will be included.
-.Pp
-The
-.Fa compar
-argument is a pointer to a user supplied subroutine which is passed to
-.Xr qsort 3
-to sort the completed array.
-If this pointer is null, the array is not sorted.
-Note that from within the
-.Fa compar
-subroutine, the two arguments are of type
-.Ft const struct dirent ** ,
-so that a double-dereference is needed to access the fields in the
-.Ft dirent
-structure.
-.Pp
-The
-.Fn alphasort
-function
-is a routine which can be used for the
-.Fa compar
-argument to sort the array alphabetically.
-.Pp
-The memory allocated for the array can be deallocated with
-.Xr free 3 ,
-by freeing each pointer in the array and then the array itself.
-#ifdef UNIFDEF_BLOCKS
-.Pp
-The
-.Fn scandir_b
-function works the same way as the
-.Fn scandir
-function, except that
-.Fa select
-and
-.Fa compar
-are blocks instead of subroutines.
-#endif
-.Sh DIAGNOSTICS
-Returns \-1 if the directory cannot be opened for reading or if
-.Xr malloc 3
-cannot allocate enough memory to hold all the data structures.
-.Sh SEE ALSO
-.Xr directory 3 ,
-.Xr malloc 3 ,
-.Xr qsort 3 ,
-.Xr dir 5
-.Sh HISTORY
-The
-.Fn scandir
-and
-.Fn alphasort
-functions appeared in
-.Bx 4.2 .
-#ifdef UNIFDEF_BLOCKS
-The
-.Fn scandir_b
-function appeared in Mac OS X 10.6.
-#endif
diff --git a/gen/scandir_b-fbsd.c b/gen/scandir_b-fbsd.c
deleted file mode 100644 (file)
index 7cdea7b..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)scandir.c  8.3 (Berkeley) 1/2/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.9 2008/03/16 19:08:53 das Exp $");
-
-/*
- * Scan the directory dirname calling select to make a list of selected
- * directory entries then sort using qsort and compare routine dcomp.
- * Returns the number of entries and a pointer to a list of pointers to
- * struct dirent (through namelist). Returns -1 if there were any errors.
- */
-
-#include "namespace.h"
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include "un-namespace.h"
-
-/*
- * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
- * entry.  This requires the amount of space in struct dirent without the
- * d_name field, plus enough space for the name and a terminating nul byte
- * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
- */
-
-int
-scandir_b(dirname, namelist, select, dcomp)
-       const char *dirname;
-       struct dirent ***namelist;
-       int (^select)(struct dirent *);
-       int (^dcomp)(const void *, const void *);
-{
-       struct dirent *d, *p, **names = NULL;
-       size_t nitems = 0;
-       long arraysz;
-       DIR *dirp;
-
-       if ((dirp = opendir(dirname)) == NULL)
-               return(-1);
-
-       arraysz = 32;   /* initial estimate of the array size */
-       names = (struct dirent **)malloc(arraysz * sizeof(struct dirent *));
-       if (names == NULL)
-               goto fail;
-
-       while ((d = readdir(dirp)) != NULL) {
-               if (select != NULL && !select(d))
-                       continue;       /* just selected names */
-               /*
-                * Make a minimum size copy of the data
-                */
-               p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
-               if (p == NULL)
-                       goto fail;
-               p->d_fileno = d->d_fileno;
-               p->d_type = d->d_type;
-               p->d_reclen = d->d_reclen;
-               p->d_namlen = d->d_namlen;
-               bcopy(d->d_name, p->d_name, p->d_namlen + 1);
-               /*
-                * Check to make sure the array has space left and
-                * realloc the maximum size.
-                */
-               if (nitems >= arraysz) {
-                       struct dirent **names2;
-
-                       names2 = (struct dirent **)realloc((char *)names,
-                               (arraysz * 2) * sizeof(struct dirent *));
-                       if (names2 == NULL) {
-                               free(p);
-                               goto fail;
-                       }
-                       names = names2;
-                       arraysz *= 2;
-               }
-               names[nitems++] = p;
-       }
-       closedir(dirp);
-       if (nitems && dcomp != NULL)
-               qsort_b(names, nitems, sizeof(struct dirent *), dcomp);
-       *namelist = names;
-       return(nitems);
-
-fail:
-       while (nitems > 0)
-               free(names[--nitems]);
-       free(names);
-       closedir(dirp);
-       return -1;
-}
diff --git a/gen/seed48-fbsd.c b/gen/seed48-fbsd.c
deleted file mode 100644 (file)
index 73d63ff..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/seed48.c,v 1.2 2002/03/22 21:52:05 obrien Exp $");
-
-#include "rand48.h"
-
-unsigned short *
-seed48(unsigned short xseed[3])
-{
-       static unsigned short sseed[3];
-
-       STORERAND48(_rand48_seed, sseed);
-       LOADRAND48(_rand48_seed, xseed);
-       _rand48_mult = RAND48_MULT;
-       _rand48_add = RAND48_ADD;
-       return sseed;
-}
diff --git a/gen/seekdir-fbsd.c b/gen/seekdir-fbsd.c
deleted file mode 120000 (symlink)
index d04fec6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./seekdir.c
\ No newline at end of file
diff --git a/gen/sethostname-fbsd.c b/gen/sethostname-fbsd.c
deleted file mode 120000 (symlink)
index 2501195..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./sethostname.c
\ No newline at end of file
diff --git a/gen/setmode-fbsd.c b/gen/setmode-fbsd.c
deleted file mode 100644 (file)
index 53b79d2..0000000
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (c) 1989, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Dave Borman at Cray Research, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setmode.c  8.2 (Berkeley) 3/25/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/setmode.c,v 1.11 2007/01/09 00:27:55 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <signal.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#ifdef SETMODE_DEBUG
-#include <stdio.h>
-#endif
-#include "un-namespace.h"
-
-#define        SET_LEN 6               /* initial # of bitcmd struct to malloc */
-#define        SET_LEN_INCR 4          /* # of bitcmd structs to add as needed */
-
-typedef struct bitcmd {
-       char    cmd;
-       char    cmd2;
-       mode_t  bits;
-} BITCMD;
-
-#define        CMD2_CLR        0x01
-#define        CMD2_SET        0x02
-#define        CMD2_GBITS      0x04
-#define        CMD2_OBITS      0x08
-#define        CMD2_UBITS      0x10
-
-#define        compress_mode   _sm_compress_mode
-
-static BITCMD  *addcmd(BITCMD *, int, int, int, u_int);
-__private_extern__ void                compress_mode(BITCMD *);
-#ifdef SETMODE_DEBUG
-static void     dumpmode(BITCMD *);
-#endif
-
-#ifndef BUILDING_VARIANT
-/*
- * Given the old mode and an array of bitcmd structures, apply the operations
- * described in the bitcmd structures to the old mode, and return the new mode.
- * Note that there is no '=' command; a strict assignment is just a '-' (clear
- * bits) followed by a '+' (set bits).
- */
-mode_t
-getmode(const void *bbox, mode_t omode)
-{
-       const BITCMD *set;
-       mode_t clrval, newmode, value;
-
-       set = (const BITCMD *)bbox;
-       newmode = omode;
-       for (value = 0;; set++)
-               switch(set->cmd) {
-               /*
-                * When copying the user, group or other bits around, we "know"
-                * where the bits are in the mode so that we can do shifts to
-                * copy them around.  If we don't use shifts, it gets real
-                * grundgy with lots of single bit checks and bit sets.
-                */
-               case 'u':
-                       value = (newmode & S_IRWXU) >> 6;
-                       goto common;
-
-               case 'g':
-                       value = (newmode & S_IRWXG) >> 3;
-                       goto common;
-
-               case 'o':
-                       value = newmode & S_IRWXO;
-common:                        if (set->cmd2 & CMD2_CLR) {
-                               clrval =
-                                   (set->cmd2 & CMD2_SET) ?  S_IRWXO : value;
-                               if (set->cmd2 & CMD2_UBITS)
-                                       newmode &= ~((clrval<<6) & set->bits);
-                               if (set->cmd2 & CMD2_GBITS)
-                                       newmode &= ~((clrval<<3) & set->bits);
-                               if (set->cmd2 & CMD2_OBITS)
-                                       newmode &= ~(clrval & set->bits);
-                       }
-                       if (set->cmd2 & CMD2_SET) {
-                               if (set->cmd2 & CMD2_UBITS)
-                                       newmode |= (value<<6) & set->bits;
-                               if (set->cmd2 & CMD2_GBITS)
-                                       newmode |= (value<<3) & set->bits;
-                               if (set->cmd2 & CMD2_OBITS)
-                                       newmode |= value & set->bits;
-                       }
-                       break;
-
-               case '+':
-                       newmode |= set->bits;
-                       break;
-
-               case '-':
-                       newmode &= ~set->bits;
-                       break;
-
-               case 'X':
-                       if (omode & (S_IFDIR|S_IXUSR|S_IXGRP|S_IXOTH))
-                               newmode |= set->bits;
-                       break;
-
-               case '\0':
-               default:
-#ifdef SETMODE_DEBUG
-                       (void)printf("getmode:%04o -> %04o\n", omode, newmode);
-#endif
-                       return (newmode);
-               }
-}
-#endif /* BUILDING_VARIANT */
-
-#define        ADDCMD(a, b, c, d)                                              \
-       if (set >= endset) {                                            \
-               BITCMD *newset;                                         \
-               setlen += SET_LEN_INCR;                                 \
-               newset = realloc(saveset, sizeof(BITCMD) * setlen);     \
-               if (!newset) {                                          \
-                       if (saveset)                                    \
-                               free(saveset);                          \
-                       saveset = NULL;                                 \
-                       return (NULL);                                  \
-               }                                                       \
-               set = newset + (set - saveset);                         \
-               saveset = newset;                                       \
-               endset = newset + (setlen - 2);                         \
-       }                                                               \
-       set = addcmd(set, (a), (b), (c), (d))
-
-#ifndef VARIANT_LEGACY
-#define        STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO|S_ISTXT)
-#else /* VARIANT_LEGACY */
-#define        STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
-#endif /* !VARIANT_LEGACY */
-
-void *
-setmode(const char *p)
-{
-       int perm, who;
-       char op, *ep;
-       BITCMD *set, *saveset, *endset;
-       sigset_t sigset, sigoset;
-       mode_t mask;
-       int equalopdone=0, permXbits, setlen;
-       long perml;
-
-       if (!*p)
-               return (NULL);
-
-       /*
-        * Get a copy of the mask for the permissions that are mask relative.
-        * Flip the bits, we want what's not set.  Since it's possible that
-        * the caller is opening files inside a signal handler, protect them
-        * as best we can.
-        */
-       sigfillset(&sigset);
-        (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
-       (void)umask(mask = umask(0));
-       mask = ~mask;
-        (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
-
-       setlen = SET_LEN + 2;
-
-       if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
-               return (NULL);
-       saveset = set;
-       endset = set + (setlen - 2);
-
-       /*
-        * If an absolute number, get it and return; disallow non-octal digits
-        * or illegal bits.
-        */
-       if (isdigit((unsigned char)*p)) {
-               perml = strtol(p, &ep, 8);
-#ifndef VARIANT_LEGACY
-               if (*ep || perml < 0 || perml & ~STANDARD_BITS)
-#else /* VARIANT_LEGACY */
-               if (*ep || perml < 0 || perml & ~(STANDARD_BITS|S_ISTXT))
-#endif /* !VARIANT_LEGACY */
-               {
-                       free(saveset);
-                       return (NULL);
-               }
-               perm = (mode_t)perml;
-#ifndef VARIANT_LEGACY
-               ADDCMD('=', STANDARD_BITS, perm, mask);
-#else /* VARIANT_LEGACY */
-               ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
-#endif /* !VARIANT_LEGACY */
-               set->cmd = 0;
-               return (saveset);
-       }
-
-       /*
-        * Build list of structures to set/clear/copy bits as described by
-        * each clause of the symbolic mode.
-        */
-       for (;;) {
-               /* First, find out which bits might be modified. */
-               for (who = 0;; ++p) {
-                       switch (*p) {
-                       case 'a':
-                               who |= STANDARD_BITS;
-                               break;
-                       case 'u':
-                               who |= S_ISUID|S_IRWXU;
-                               break;
-                       case 'g':
-                               who |= S_ISGID|S_IRWXG;
-                               break;
-                       case 'o':
-                               who |= S_IRWXO;
-                               break;
-                       default:
-                               goto getop;
-                       }
-               }
-
-getop:         if ((op = *p++) != '+' && op != '-' && op != '=') {
-                       free(saveset);
-                       return (NULL);
-               }
-               if (op == '=')
-                       equalopdone = 0;
-
-#ifdef VARIANT_LEGACY
-               who &= ~S_ISTXT;
-#endif /* VARIANT_LEGACY */
-               for (perm = 0, permXbits = 0;; ++p) {
-                       switch (*p) {
-                       case 'r':
-                               perm |= S_IRUSR|S_IRGRP|S_IROTH;
-                               break;
-                       case 's':
-                               /* If only "other" bits ignore set-id. */
-                               if (!who || who & ~S_IRWXO)
-                                       perm |= S_ISUID|S_ISGID;
-                               break;
-                       case 't':
-                               /* If only "other" bits ignore sticky. */
-                               if (!who || who & ~S_IRWXO) {
-#ifdef VARIANT_LEGACY
-                                       who |= S_ISTXT;
-#endif /* VARIANT_LEGACY */
-                                       perm |= S_ISTXT;
-                               }
-                               break;
-                       case 'w':
-                               perm |= S_IWUSR|S_IWGRP|S_IWOTH;
-                               break;
-                       case 'X':
-                               permXbits = S_IXUSR|S_IXGRP|S_IXOTH;
-                               break;
-                       case 'x':
-                               perm |= S_IXUSR|S_IXGRP|S_IXOTH;
-                               break;
-                       case 'u':
-                       case 'g':
-                       case 'o':
-                               /*
-                                * When ever we hit 'u', 'g', or 'o', we have
-                                * to flush out any partial mode that we have,
-                                * and then do the copying of the mode bits.
-                                */
-                               if (perm) {
-                                       ADDCMD(op, who, perm, mask);
-                                       perm = 0;
-                               }
-                               if (op == '=')
-                                       equalopdone = 1;
-                               if (op == '+' && permXbits) {
-                                       ADDCMD('X', who, permXbits, mask);
-                                       permXbits = 0;
-                               }
-                               ADDCMD(*p, who, op, mask);
-                               break;
-
-                       default:
-                               /*
-                                * Add any permissions that we haven't already
-                                * done.
-                                */
-                               if (perm || (op == '=' && !equalopdone)) {
-                                       if (op == '=')
-                                               equalopdone = 1;
-                                       ADDCMD(op, who, perm, mask);
-                                       perm = 0;
-                               }
-                               if (permXbits) {
-                                       ADDCMD('X', who, permXbits, mask);
-                                       permXbits = 0;
-                               }
-                               goto apply;
-                       }
-               }
-
-apply:         if (!*p)
-                       break;
-               if (*p != ',')
-                       goto getop;
-               ++p;
-       }
-       set->cmd = 0;
-#ifdef SETMODE_DEBUG
-       (void)printf("Before compress_mode()\n");
-       dumpmode(saveset);
-#endif
-       compress_mode(saveset);
-#ifdef SETMODE_DEBUG
-       (void)printf("After compress_mode()\n");
-       dumpmode(saveset);
-#endif
-       return (saveset);
-}
-
-static BITCMD *
-addcmd(BITCMD *set, int op, int who, int oparg, u_int mask)
-{
-       switch (op) {
-       case '=':
-               set->cmd = '-';
-               set->bits = who ? who : STANDARD_BITS;
-               set++;
-
-               op = '+';
-               /* FALLTHROUGH */
-       case '+':
-       case '-':
-       case 'X':
-               set->cmd = op;
-               set->bits = (who ? who : mask) & oparg;
-               break;
-
-       case 'u':
-       case 'g':
-       case 'o':
-               set->cmd = op;
-               if (who) {
-                       set->cmd2 = ((who & S_IRUSR) ? CMD2_UBITS : 0) |
-                                   ((who & S_IRGRP) ? CMD2_GBITS : 0) |
-                                   ((who & S_IROTH) ? CMD2_OBITS : 0);
-                       set->bits = (mode_t)~0;
-               } else {
-                       set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS;
-                       set->bits = mask;
-               }
-
-               if (oparg == '+')
-                       set->cmd2 |= CMD2_SET;
-               else if (oparg == '-')
-                       set->cmd2 |= CMD2_CLR;
-               else if (oparg == '=')
-                       set->cmd2 |= CMD2_SET|CMD2_CLR;
-               break;
-       }
-       return (set + 1);
-}
-
-#ifdef SETMODE_DEBUG
-static void
-dumpmode(BITCMD *set)
-{
-       for (; set->cmd; ++set)
-               (void)printf("cmd: '%c' bits %04o%s%s%s%s%s%s\n",
-                   set->cmd, set->bits, set->cmd2 ? " cmd2:" : "",
-                   set->cmd2 & CMD2_CLR ? " CLR" : "",
-                   set->cmd2 & CMD2_SET ? " SET" : "",
-                   set->cmd2 & CMD2_UBITS ? " UBITS" : "",
-                   set->cmd2 & CMD2_GBITS ? " GBITS" : "",
-                   set->cmd2 & CMD2_OBITS ? " OBITS" : "");
-}
-#endif
-
-#ifndef BUILDING_VARIANT
-/*
- * Given an array of bitcmd structures, compress by compacting consecutive
- * '+', '-' and 'X' commands into at most 3 commands, one of each.  The 'u',
- * 'g' and 'o' commands continue to be separate.  They could probably be
- * compacted, but it's not worth the effort.
- */
-__private_extern__ void
-compress_mode(BITCMD *set)
-{
-       BITCMD *nset;
-       int setbits, clrbits, Xbits, op;
-
-       for (nset = set;;) {
-               /* Copy over any 'u', 'g' and 'o' commands. */
-               while ((op = nset->cmd) != '+' && op != '-' && op != 'X') {
-                       *set++ = *nset++;
-                       if (!op)
-                               return;
-               }
-
-               for (setbits = clrbits = Xbits = 0;; nset++) {
-                       if ((op = nset->cmd) == '-') {
-                               clrbits |= nset->bits;
-                               setbits &= ~nset->bits;
-                               Xbits &= ~nset->bits;
-                       } else if (op == '+') {
-                               setbits |= nset->bits;
-                               clrbits &= ~nset->bits;
-                               Xbits &= ~nset->bits;
-                       } else if (op == 'X')
-                               Xbits |= nset->bits & ~setbits;
-                       else
-                               break;
-               }
-               if (clrbits) {
-                       set->cmd = '-';
-                       set->cmd2 = 0;
-                       set->bits = clrbits;
-                       set++;
-               }
-               if (setbits) {
-                       set->cmd = '+';
-                       set->cmd2 = 0;
-                       set->bits = setbits;
-                       set++;
-               }
-               if (Xbits) {
-                       set->cmd = 'X';
-                       set->cmd2 = 0;
-                       set->bits = Xbits;
-                       set++;
-               }
-       }
-}
-#endif /* BUILDING_VARIANT */
diff --git a/gen/setmode.3 b/gen/setmode.3
deleted file mode 120000 (symlink)
index cbe4269..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setmode.3
\ No newline at end of file
diff --git a/gen/setprogname-fbsd.c b/gen/setprogname-fbsd.c
deleted file mode 100644 (file)
index 2392a66..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.8 2002/03/29 22:43:41 markm Exp $");
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <crt_externs.h>
-#define        __progname      (*_NSGetProgname())
-
-#include "libc_private.h"
-
-void
-setprogname(const char *progname)
-{
-       const char *p;
-       char buf[2*MAXCOMLEN+1];
-       int mib[2];
-       
-       p = strrchr(progname, '/');
-       if (p != NULL)
-               __progname = (char *)(p = p + 1);
-       else
-               __progname = (char *)(p = progname);
-
-       strlcpy(&buf[0], (char *)(p), sizeof(buf));
-
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_PROCNAME;
-
-       /* ignore errors as this is not a hard error */
-       sysctl(mib, 2, NULL, NULL, &buf[0], strlen(buf));
-}
diff --git a/gen/siginterrupt-fbsd.c b/gen/siginterrupt-fbsd.c
deleted file mode 120000 (symlink)
index 73b87a5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./siginterrupt.c
\ No newline at end of file
diff --git a/gen/siginterrupt.3 b/gen/siginterrupt.3
deleted file mode 100644 (file)
index 6e2fd5f..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" Copyright (c) 1985, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)siginterrupt.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/siginterrupt.3,v 1.15 2007/01/09 00:27:55 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt SIGINTERRUPT 3
-.Os
-.Sh NAME
-.Nm siginterrupt
-.Nd allow signals to interrupt system calls
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn siginterrupt "int sig" "int flag"
-.Sh DESCRIPTION
-The
-.Fn siginterrupt
-function
-is used to change the system call restart
-behavior when a system call is interrupted by the specified signal.
-If the flag is false (0), then system calls will be restarted if
-they are interrupted by the specified signal
-and no data has been transferred yet.
-System call restart has been the default behavior since
-.Bx 4.2 ,
-and is the default behaviour for
-.Xr signal 3
-on
-.Fx .
-.Pp
-If the flag is true (1),
-then restarting of system calls is disabled.
-If a system call is interrupted by the specified signal
-and no data has been transferred,
-the system call will return \-1 with the global variable
-.Va errno
-set to
-.Er EINTR .
-Interrupted system calls that have started transferring
-data will return the amount of data actually transferred.
-System call interrupt is the signal behavior found on
-.Bx 4.1
-and
-.At V
-systems.
-.Pp
-Note that the new
-.Bx 4.2
-signal handling semantics are not
-altered in any other way.
-Most notably, signal handlers always remain installed until
-explicitly changed by a subsequent
-.Xr sigaction 2
-call, and the signal mask operates as documented in
-.Xr sigaction 2 .
-Programs may switch between restartable and interruptible
-system call operation as often as desired in the execution of a program.
-.Pp
-Issuing a
-.Fn siginterrupt 3
-call during the execution of a signal handler will cause
-the new action to take place on the next signal to be caught.
-.Sh NOTES
-This library routine uses an extension of the
-.Xr sigaction 2
-system call that is not available in
-.Bx 4.2 ;
-hence, it should not be used if backward compatibility is needed.
-.Sh RETURN VALUES
-.Rv -std siginterrupt
-.Sh ERRORS
-The
-.Fn siginterrupt
-call fails if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa sig
-argument
-is not a valid signal number.
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr sigblock 2 ,
-.Xr sigpause 2 ,
-.Xr sigsetmask 2 ,
-.Xr signal 3
-.Sh HISTORY
-The
-.Fn siginterrupt
-function appeared in
-.Bx 4.3 .
diff --git a/gen/siglist-fbsd.c b/gen/siglist-fbsd.c
deleted file mode 100644 (file)
index a222989..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)siglist.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/siglist.c,v 1.6 2007/01/20 08:24:01 maxim Exp $");
-
-#include <signal.h>
-
-const char *const sys_signame[NSIG] = {
-       "Signal 0",
-       "hup",                          /* SIGHUP */
-       "int",                          /* SIGINT */
-       "quit",                         /* SIGQUIT */
-       "ill",                          /* SIGILL */
-       "trap",                         /* SIGTRAP */
-       "abrt",                         /* SIGABRT */
-       "emt",                          /* SIGEMT */
-       "fpe",                          /* SIGFPE */
-       "kill",                         /* SIGKILL */
-       "bus",                          /* SIGBUS */
-       "segv",                         /* SIGSEGV */
-       "sys",                          /* SIGSYS */
-       "pipe",                         /* SIGPIPE */
-       "alrm",                         /* SIGALRM */
-       "term",                         /* SIGTERM */
-       "urg",                          /* SIGURG */
-       "stop",                         /* SIGSTOP */
-       "tstp",                         /* SIGTSTP */
-       "cont",                         /* SIGCONT */
-       "chld",                         /* SIGCHLD */
-       "ttin",                         /* SIGTTIN */
-       "ttou",                         /* SIGTTOU */
-       "io",                           /* SIGIO */
-       "xcpu",                         /* SIGXCPU */
-       "xfsz",                         /* SIGXFSZ */
-       "vtalrm",                       /* SIGVTALRM */
-       "prof",                         /* SIGPROF */
-       "winch",                        /* SIGWINCH */
-       "info",                         /* SIGINFO */
-       "usr1",                         /* SIGUSR1 */
-       "usr2"                          /* SIGUSR2 */
-};
-
-const char *const sys_siglist[NSIG] = {
-       "Signal 0",
-       "Hangup",                       /* SIGHUP */
-       "Interrupt",                    /* SIGINT */
-       "Quit",                         /* SIGQUIT */
-       "Illegal instruction",          /* SIGILL */
-       "Trace/BPT trap",               /* SIGTRAP */
-       "Abort trap",                   /* SIGABRT */
-       "EMT trap",                     /* SIGEMT */
-       "Floating point exception",     /* SIGFPE */
-       "Killed",                       /* SIGKILL */
-       "Bus error",                    /* SIGBUS */
-       "Segmentation fault",           /* SIGSEGV */
-       "Bad system call",              /* SIGSYS */
-       "Broken pipe",                  /* SIGPIPE */
-       "Alarm clock",                  /* SIGALRM */
-       "Terminated",                   /* SIGTERM */
-       "Urgent I/O condition",         /* SIGURG */
-       "Suspended (signal)",           /* SIGSTOP */
-       "Suspended",                    /* SIGTSTP */
-       "Continued",                    /* SIGCONT */
-       "Child exited",                 /* SIGCHLD */
-       "Stopped (tty input)",          /* SIGTTIN */
-       "Stopped (tty output)",         /* SIGTTOU */
-       "I/O possible",                 /* SIGIO */
-       "Cputime limit exceeded",       /* SIGXCPU */
-       "Filesize limit exceeded",      /* SIGXFSZ */
-       "Virtual timer expired",        /* SIGVTALRM */
-       "Profiling timer expired",      /* SIGPROF */
-       "Window size changes",          /* SIGWINCH */
-       "Information request",          /* SIGINFO */
-       "User defined signal 1",        /* SIGUSR1 */
-       "User defined signal 2"         /* SIGUSR2 */
-};
diff --git a/gen/signal-fbsd.c b/gen/signal-fbsd.c
deleted file mode 100644 (file)
index a496863..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1985, 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)signal.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/signal.c,v 1.4 2007/01/09 00:27:55 imp Exp $");
-
-/*
- * Almost backwards compatible signal.
- */
-#include "namespace.h"
-#include <signal.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-
-sigset_t _sigintr;             /* shared with siginterrupt */
-
-extern int _sigaction_nobind (int sig, const struct sigaction *nsv, struct sigaction *osv);
-
-static sig_t
-signal__(s, a, bind)
-       int s;
-       sig_t a;
-       int bind;
-{
-       struct sigaction sa, osa;
-
-       sa.sa_handler = a;
-       sigemptyset(&sa.sa_mask);
-       sa.sa_flags = 0;
-       if (!sigismember(&_sigintr, s))
-               sa.sa_flags |= SA_RESTART;
-#if defined(__DYNAMIC__)
-       if (bind) {
-#endif /* __DYNAMIC__ */
-       if (_sigaction(s, &sa, &osa) < 0)
-               return (SIG_ERR);
-#if defined(__DYNAMIC__)
-       } else {
-           if (_sigaction_nobind(s, &sa, &osa) < 0)
-               return (SIG_ERR);
-       }
-#endif /* __DYNAMIC__ */
-       return (osa.sa_handler);
-}
-
-sig_t
-signal(s, a)
-        int s;
-        sig_t a;
-{
-    return signal__(s, a, 1);
-}
-
-#if defined(__DYNAMIC__)
-sig_t
-_signal_nobind(s, a)
-        int s;
-        sig_t a;
-{
-    return signal__(s, a, 0);
-}
-#endif /* __DYNAMIC__ */
diff --git a/gen/signal.3 b/gen/signal.3
deleted file mode 100644 (file)
index f18d1cf..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)signal.3   8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/signal.3,v 1.43 2008/07/17 21:54:23 simon Exp $
-.\"
-.Dd June 7, 2004
-.Dt SIGNAL 3
-.Os
-.Sh NAME
-.Nm signal
-.Nd simplified software signal facilities
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
-.\" The prototype for signal(3) cannot be cleanly marked up in -mdoc
-.\" without the following lower-level tweak.
-.nr in-synopsis-section 0
-.Pp
-.Ft "void \*(lp*" Ns
-.Fo signal
-.Fa "int sig"
-.Fa "void \*(lp*func\*(rp\*(lpint\*(rp"
-.Fc Ns
-.Ft "\*(rp\*(lpint\*(rp" ;
-.Pp
-.nr in-synopsis-section 1
-.\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
-or in the equivalent but easier to read typedef'd version:
-.Ft typedef "void \*(lp*sig_t\*(rp \*(lpint\*(rp" ;
-.Pp
-.Ft sig_t
-.Fn signal "int sig" "sig_t func"
-.Sh DESCRIPTION
-This
-.Fn signal
-facility
-is a simplified interface to the more general
-.Xr sigaction 2
-facility.
-.Pp
-Signals allow the manipulation of a process from outside its domain,
-as well as allowing the process to manipulate itself
-or copies of itself (children).
-There are two general types of signals:
-those that cause termination of a process and those that do not.
-Signals which cause termination of a program might result from
-an irrecoverable error or might be the result of a user at a terminal
-typing the `interrupt' character.
-Signals are used when a process is stopped because it wishes to access
-its control terminal while in the background (see
-.Xr tty 4 ) .
-Signals are optionally generated
-when a process resumes after being stopped,
-when the status of child processes changes,
-or when input is ready at the control terminal.
-Most signals result in the termination of the process receiving them,
-if no action is taken;
-some signals instead cause the process receiving them to be stopped,
-or are simply discarded if the process has not requested otherwise.
-Except for the
-.Dv SIGKILL
-and
-.Dv SIGSTOP
-signals, the
-.Fn signal
-function allows for a signal to be caught, to be ignored, or to generate
-an interrupt.
-These signals are defined in the file
-.In signal.h :
-.Bl -column No ".Dv SIGVTALRM" "create core image"
-.It Sy "No     Name    Default Action  Description"
-.It 1 Ta Dv SIGHUP Ta "terminate process" Ta "terminal line hangup"
-.It 2 Ta Dv SIGINT Ta "terminate process" Ta "interrupt program"
-.It 3 Ta Dv SIGQUIT Ta "create core image" Ta "quit program"
-.It 4 Ta Dv SIGILL Ta "create core image" Ta "illegal instruction"
-.It 5 Ta Dv SIGTRAP Ta "create core image" Ta "trace trap"
-.It 6 Ta Dv SIGABRT Ta "create core image" Ta "abort program"
-(formerly
-.Dv SIGIOT )
-.It 7 Ta Dv SIGEMT Ta "create core image" Ta "emulate instruction executed"
-.It 8 Ta Dv SIGFPE Ta "create core image" Ta "floating-point exception"
-.It 9 Ta Dv SIGKILL Ta "terminate process" Ta "kill program"
-.It 10 Ta Dv SIGBUS Ta "create core image" Ta "bus error"
-.It 11 Ta Dv SIGSEGV Ta "create core image" Ta "segmentation violation"
-.It 12 Ta Dv SIGSYS Ta "create core image" Ta "non-existent system call invoked"
-.It 13 Ta Dv SIGPIPE Ta "terminate process" Ta "write on a pipe with no reader"
-.It 14 Ta Dv SIGALRM Ta "terminate process" Ta "real-time timer expired"
-.It 15 Ta Dv SIGTERM Ta "terminate process" Ta "software termination signal"
-.It 16 Ta Dv SIGURG Ta "discard signal" Ta "urgent condition present on socket"
-.It 17 Ta Dv SIGSTOP Ta "stop process" Ta "stop (cannot be caught or ignored)"
-.It 18 Ta Dv SIGTSTP Ta "stop process" Ta "stop signal generated from keyboard"
-.It 19 Ta Dv SIGCONT Ta "discard signal" Ta "continue after stop"
-.It 20 Ta Dv SIGCHLD Ta "discard signal" Ta "child status has changed"
-.It 21 Ta Dv SIGTTIN Ta "stop process" Ta "background read attempted from"
-control terminal
-.It 22 Ta Dv SIGTTOU Ta "stop process" Ta "background write attempted to"
-control terminal
-.It 23 Ta Dv SIGIO Ta "discard signal" Ta Tn "I/O"
-is possible on a descriptor (see
-.Xr fcntl 2 )
-.It 24 Ta Dv SIGXCPU Ta "terminate process" Ta "cpu time limit exceeded (see"
-.Xr setrlimit 2 )
-.It 25 Ta Dv SIGXFSZ Ta "terminate process" Ta "file size limit exceeded (see"
-.Xr setrlimit 2 )
-.It 26 Ta Dv SIGVTALRM Ta "terminate process" Ta "virtual time alarm (see"
-.Xr setitimer 2 )
-.It 27 Ta Dv SIGPROF Ta "terminate process" Ta "profiling timer alarm (see"
-.Xr setitimer 2 )
-.It 28 Ta Dv SIGWINCH Ta "discard signal" Ta "Window size change"
-.It 29 Ta Dv SIGINFO Ta "discard signal" Ta "status request from keyboard"
-.It 30 Ta Dv SIGUSR1 Ta "terminate process" Ta "User defined signal 1"
-.It 31 Ta Dv SIGUSR2 Ta "terminate process" Ta "User defined signal 2"
-.El
-.Pp
-The
-.Fa sig
-argument specifies which signal was received.
-The
-.Fa func
-procedure allows a user to choose the action upon receipt of a signal.
-To set the default action of the signal to occur as listed above,
-.Fa func
-should be
-.Dv SIG_DFL .
-A
-.Dv SIG_DFL
-resets the default action.
-To ignore the signal,
-.Fa func
-should be
-.Dv SIG_IGN .
-This will cause subsequent instances of the signal to be ignored
-and pending instances to be discarded.
-If
-.Dv SIG_IGN
-is not used,
-further occurrences of the signal are
-automatically blocked and
-.Fa func
-is called.
-.Pp
-The handled signal is unblocked when the
-function returns and
-the process continues from where it left off when the signal occurred.
-.Bf -symbolic
-Unlike previous signal facilities, the handler
-func() remains installed after a signal has been delivered.
-.Ef
-.Pp
-For some system calls, if a signal is caught while the call is
-executing and the call is prematurely terminated,
-the call is automatically restarted.
-Any handler installed with
-.Xr signal 3
-will have the
-.Dv SA_RESTART
-flag set, meaning that any restartable system call will not return on
-receipt of a signal.
-The affected system calls include
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr sendto 2 ,
-.Xr recvfrom 2 ,
-.Xr sendmsg 2 ,
-and
-.Xr recvmsg 2
-on a communications channel or a low speed device
-and during a
-.Xr ioctl 2
-or
-.Xr wait 2 .
-However, calls that have already committed are not restarted,
-but instead return a partial success (for example, a short read count).
-These semantics could be changed with
-.Xr siginterrupt 3 .
-.Pp
-When a process which has installed signal handlers forks,
-the child process inherits the signals.
-All caught signals may be reset to their default action by a call
-to the
-.Xr execve 2
-function;
-ignored signals remain ignored.
-.Pp
-If a process explicitly specifies
-.Dv SIG_IGN
-as the action for the signal
-.Dv SIGCHLD ,
-the system will not create zombie processes when children
-of the calling process exit.
-As a consequence, the system will discard the exit status
-from the child processes.
-If the calling process subsequently issues a call to
-.Xr wait 2
-or equivalent, it will block until all of the calling process's
-children terminate, and then return a value of \-1 with
-.Va errno
-set to
-.Er ECHILD .
-.Pp
-See
-.Xr sigaction 2
-for a list of functions
-that are considered safe for use in signal handlers.
-.Sh RETURN VALUES
-The previous action is returned on a successful call.
-Otherwise, SIG_ERR is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn signal
-function
-will fail and no action will take place if one of the
-following occur:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa sig
-argument
-is not a valid signal number.
-.It Bq Er EINVAL
-An attempt is made to ignore or supply a handler for
-.Dv SIGKILL
-or
-.Dv SIGSTOP .
-.El
-.Sh SEE ALSO
-.Xr kill 1 ,
-.Xr kill 2 ,
-.Xr ptrace 2 ,
-.Xr sigaction 2 ,
-.Xr sigaltstack 2 ,
-.Xr sigprocmask 2 ,
-.Xr sigsuspend 2 ,
-.Xr wait 2 ,
-.Xr fpsetmask 3 ,
-.Xr setjmp 3 ,
-.Xr siginterrupt 3 ,
-.Xr tty 4
-.Sh HISTORY
-The
-.Nm
-facility appeared in
-.Bx 4.0 .
-The option to avoid the creation of child zombies through ignoring
-.Dv SIGCHLD
-appeared in
-.Fx 5.0 .
diff --git a/gen/signbit.3 b/gen/signbit.3
deleted file mode 100644 (file)
index 7d9c8d8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-.\" Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/signbit.3,v 1.3 2003/02/24 22:53:20 ru Exp $
-.\"
-.Dd February 11, 2003
-.Dt SIGNBIT 3
-.Os
-.Sh NAME
-.Nm signbit
-.Nd "determine whether a floating-point number's sign is negative"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In math.h
-.Ft int
-.Fn signbit "real-floating x"
-.Sh DESCRIPTION
-The
-.Fn signbit
-macro takes an argument of
-.Fa x .
-It returns non-zero if the value of the argument's sign is negative,
-otherwise 0.
-.Sh SEE ALSO
-.Xr fpclassify 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn signbit
-macro conforms to
-.St -isoC-99 .
diff --git a/gen/sleep-fbsd.c b/gen/sleep-fbsd.c
deleted file mode 100644 (file)
index 9d2095e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef VARIANT_CANCELABLE
-#undef __DARWIN_NON_CANCELABLE
-#define __DARWIN_NON_CANCELABLE 0
-#endif /* VARIANT_CANCELABLE */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sleep.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sleep.c,v 1.33 2009/12/05 19:31:38 ed Exp $");
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <time.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-unsigned int
-__sleep(unsigned int seconds)
-{
-       struct timespec time_to_sleep;
-       struct timespec time_remaining;
-
-       /*
-        * Avoid overflow when `seconds' is huge.  This assumes that
-        * the maximum value for a time_t is >= INT_MAX.
-        */
-       if (seconds > INT_MAX)
-               return (seconds - INT_MAX + __sleep(INT_MAX));
-
-       time_to_sleep.tv_sec = seconds;
-       time_to_sleep.tv_nsec = 0;
-       if (_nanosleep(&time_to_sleep, &time_remaining) != -1)
-               return (0);
-       if (errno != EINTR)
-               return (seconds);               /* best guess */
-       return (time_remaining.tv_sec +
-               (time_remaining.tv_nsec != 0)); /* round up */
-}
-
-__weak_reference(__sleep, sleep);
-__weak_reference(__sleep, _sleep);
diff --git a/gen/sleep.3 b/gen/sleep.3
deleted file mode 100644 (file)
index f540a15..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)sleep.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/sleep.3,v 1.17 2007/01/09 00:27:55 imp Exp $
-.\"
-.Dd February 13, 1998
-.Dt SLEEP 3
-.Os
-.Sh NAME
-.Nm sleep
-.Nd suspend thread execution for an interval measured in seconds
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft unsigned int
-.Fn sleep "unsigned int seconds"
-.Sh DESCRIPTION
-The
-.Fn sleep
-function suspends execution of the calling thread until either
-.Fa seconds
-seconds have elapsed or a signal is delivered to the thread and its
-action is to invoke a signal-catching function or to terminate the
-thread or process.
-System activity may lengthen the sleep by an indeterminate amount.
-.Pp
-This function is implemented using
-.Xr nanosleep 2
-by pausing for
-.Fa seconds
-seconds or until a signal occurs.
-Consequently, in this implementation,
-sleeping has no effect on the state of process timers,
-and there is no special handling for SIGALRM.
-.Sh RETURN VALUES
-If the
-.Fn sleep
-function returns because the requested time has elapsed, the value
-returned will be zero.
-If the
-.Fn sleep
-function returns due to the delivery of a signal, the value returned
-will be the unslept amount (the requested time minus the time actually
-slept) in seconds.
-.Sh SEE ALSO
-.Xr nanosleep 2 ,
-.Xr usleep 3
-.Sh STANDARDS
-The
-.Fn sleep
-function conforms to
-.St -p1003.1-90 .
-.Sh HISTORY
-A
-.Fn sleep
-function appeared in
-.At v7 .
diff --git a/gen/srand48-fbsd.c b/gen/srand48-fbsd.c
deleted file mode 100644 (file)
index c9f8426..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 1993 Martin Birgmeier
- * All rights reserved.
- *
- * You may redistribute unmodified or modified versions of this source
- * code provided that the above copyright notice and this and the
- * following conditions are retained.
- *
- * This software is provided ``as is'', and comes with no warranties
- * of any kind. I shall in no event be liable for anything that happens
- * to anyone/anything when using this software.
- */
-
-#include "rand48.h"
-
-void
-srand48(long seed)
-{
-       _rand48_seed = TOUINT48(RAND48_SEED_0, (unsigned short) seed, (unsigned short) (seed >> 16));
-       _rand48_mult = RAND48_MULT;
-       _rand48_add = RAND48_ADD;
-}
index 42953c89a44b1ecb09d8e6d9faaf45cced1f0ad0..6fcc0b51924f5d6adaee4cae5a529ca6c283c3c5 100644 (file)
@@ -118,8 +118,9 @@ unsigned stack_logging_get_unique_stack(unsigned **table, unsigned *table_num_pa
 stack_logging_record_list_t *stack_logging_the_record_list = NULL;
 
 int stack_logging_enable_logging = 0;
-
 int stack_logging_dontcompact = 0;
+int stack_logging_finished_init = 0;
+int stack_logging_postponed = 0;
 
 static int stack_logging_spin_lock = 0;
 
index ff7079d78bf73a66ec241a5a6e16cac98ba94723..5f0137ab705de8085c52506efa77cf988d2f09a8 100644 (file)
@@ -41,6 +41,8 @@
 
 extern int stack_logging_enable_logging; /* when clear, no logging takes place */
 extern int stack_logging_dontcompact; /* default is to compact; when set does not compact alloc/free logs; useful for tracing history */
+extern int stack_logging_finished_init; /* set after we've returned from the Libsystem initialiser */
+extern int stack_logging_postponed; /* set if we needed to postpone logging till after initialisation */
 
 
 extern void stack_logging_log_stack(unsigned type, unsigned arg1, unsigned arg2, unsigned arg3, unsigned result, unsigned num_hot_to_skip);
index 5a48ca35a9dc13d0ce8a0189c7f653db37d99f04..00a0caed92a2b59b218a940bd48e64c70ff91c92 100644 (file)
@@ -170,6 +170,7 @@ static OSSpinLock stack_logging_lock = OS_SPINLOCK_INIT;
 extern void __stack_logging_fork_prepare();
 extern void __stack_logging_fork_parent();
 extern void __stack_logging_fork_child();
+extern void __stack_logging_early_finished();
 
 // support for gdb and others checking for stack_logging locks
 __private_extern__ boolean_t __stack_logging_locked();
@@ -249,6 +250,13 @@ __create_uniquing_table(void)
        return uniquing_table;
 }
 
+static void
+__destroy_uniquing_table(backtrace_uniquing_table* table)
+{
+       deallocate_pages(table->table, table->tableSize);
+       deallocate_pages(table, sizeof(backtrace_uniquing_table));
+}
+
 static void 
 __expand_uniquing_table(backtrace_uniquing_table *uniquing_table)
 {
@@ -388,6 +396,17 @@ append_int(char * filename, pid_t pid, size_t maxLength)
        }
 }
 
+/*
+ * <rdar://problem/11128080> if we needed to call confstr during init then setting this
+ * flag will postpone stack logging until after Libsystem's initialiser has run.
+ */
+static void
+postpone_stack_logging(void)
+{
+       _malloc_printf(ASL_LEVEL_INFO, "stack logging postponed until after initialization.\n");
+       stack_logging_postponed = 1;
+}
+
 /*
  * Check various temporary directory options starting with _PATH_TMP and use confstr.
  * Allocating and releasing target buffer is the caller's responsibility.
@@ -400,10 +419,20 @@ get_writeable_temp_dir(char* target)
                strlcpy(target, _PATH_TMP, (size_t)PATH_MAX);
                return true;
        }
-       size_t n = confstr(_CS_DARWIN_USER_TEMP_DIR, target, (size_t) PATH_MAX);
-       if ((n > 0) && (n < PATH_MAX)) return true;
-       n = confstr(_CS_DARWIN_USER_CACHE_DIR, target, (size_t) PATH_MAX);
-       if ((n > 0) && (n < PATH_MAX)) return true;
+       if (getenv("TMPDIR") && (-1 != access(getenv("TMPDIR"), W_OK))) {
+               strlcpy(target, getenv("TMPDIR"), (size_t)PATH_MAX);
+               return true;
+       }
+       if (stack_logging_finished_init) {
+               size_t n = confstr(_CS_DARWIN_USER_TEMP_DIR, target, (size_t) PATH_MAX);
+               if ((n > 0) && (n < PATH_MAX)) return true;
+               n = confstr(_CS_DARWIN_USER_CACHE_DIR, target, (size_t) PATH_MAX);
+               if ((n > 0) && (n < PATH_MAX)) return true;
+       } else {
+               /* <rdar://problem/11128080> Can't call confstr during init, so postpone
+                logging till after */
+               postpone_stack_logging();
+       }
        /* No writeable tmp directory found. Maybe shd try /private/var/tmp for device here ... */
        *target = '\0';
        return false;
@@ -458,7 +487,9 @@ create_log_file(void)
        }
        if (!use_alternate_location || (access(stack_log_location, W_OK) == -1)) {
                if (!get_writeable_temp_dir(stack_log_location)) {
-                       _malloc_printf(ASL_LEVEL_INFO, "No writeable tmp dir\n");
+                       if (!stack_logging_postponed) {
+                               _malloc_printf(ASL_LEVEL_INFO, "No writeable tmp dir\n");
+                       }
                        return NULL;
                }
                if (0 != strcmp(stack_log_location, _PATH_TMP))
@@ -809,7 +840,7 @@ prepare_to_log_stacks(void)
                        disable_stack_logging();
                        return;
                }
-               
+
                // Store and use the buffer offsets in shared memory so that they can be accessed remotely
                pre_write_buffers->start_index_offset = 0ull;
                pre_write_buffers->next_free_index_buffer_offset = 0;
@@ -822,8 +853,9 @@ prepare_to_log_stacks(void)
                        disable_stack_logging();
                        return;
                }
-               
-               stack_buffer = (vm_address_t*)allocate_pages((uint64_t)round_page(sizeof(vm_address_t) * STACK_LOGGING_MAX_STACK_SIZE));
+
+               uint64_t stack_buffer_sz = (uint64_t)round_page(sizeof(vm_address_t) * STACK_LOGGING_MAX_STACK_SIZE);
+               stack_buffer = (vm_address_t*)allocate_pages(stack_buffer_sz);
                if (!stack_buffer) {
                        _malloc_printf(ASL_LEVEL_INFO, "error while allocating stack trace buffer\n");
                        disable_stack_logging();
@@ -833,10 +865,20 @@ prepare_to_log_stacks(void)
                // malloc() can be called by the following, so these need to be done outside the stack_logging_lock but after the buffers have been set up.
                atexit(delete_log_files);               // atexit() can call malloc()
                reap_orphaned_log_files(true);          // this calls opendir() which calls malloc()
-               
+
                // this call ensures that the log files exist; analyzing processes will rely on this assumption.
                if (create_log_file() == NULL) {
-                       disable_stack_logging();
+                       /* postponement support requires cleaning up these structures now */
+                       __destroy_uniquing_table(pre_write_buffers->uniquing_table);
+                       deallocate_pages(stack_buffer, stack_buffer_sz);
+                       stack_buffer = NULL;
+
+                       munmap(pre_write_buffers, full_shared_mem_size);
+                       pre_write_buffers = NULL;
+
+                       if (!stack_logging_postponed) {
+                               disable_stack_logging();
+                       }
                        return;
                }
        }
@@ -845,7 +887,7 @@ prepare_to_log_stacks(void)
 void
 __disk_stack_logging_log_stack(uint32_t type_flags, uintptr_t zone_ptr, uintptr_t size, uintptr_t ptr_arg, uintptr_t return_val, uint32_t num_hot_to_skip)
 {
-       if (!stack_logging_enable_logging) return;
+       if (!stack_logging_enable_logging || stack_logging_postponed) return;
        
        // check incoming data
        if (type_flags & stack_logging_type_alloc && type_flags & stack_logging_type_dealloc) {
@@ -877,7 +919,8 @@ __disk_stack_logging_log_stack(uint32_t type_flags, uintptr_t zone_ptr, uintptr_
        prepare_to_log_stacks();
 
        // since there could have been a fatal (to stack logging) error such as the log files not being created, check this variable before continuing
-       if (!stack_logging_enable_logging) return;
+       if (!stack_logging_enable_logging || stack_logging_postponed) return;
+
        vm_address_t self_thread = (vm_address_t)pthread_self();        // use pthread_self() rather than mach_thread_self() to avoid system call
        
        // lock and enter
@@ -972,8 +1015,14 @@ __stack_logging_fork_child() {
        OSSpinLockUnlock(&stack_logging_lock);
 }
 
+void
+__stack_logging_early_finished() {
+       stack_logging_finished_init = 1;
+       stack_logging_postponed = 0;
+}
+
 boolean_t
-__stack_logging_locked() 
+__stack_logging_locked()
 {
        bool acquired_lock = OSSpinLockTry(&stack_logging_lock);
        if (acquired_lock) OSSpinLockUnlock(&stack_logging_lock);
diff --git a/gen/stringlist-fbsd.c b/gen/stringlist-fbsd.c
deleted file mode 120000 (symlink)
index 8dfffde..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./stringlist.c
\ No newline at end of file
diff --git a/gen/stringlist.3 b/gen/stringlist.3
deleted file mode 120000 (symlink)
index 7a75e09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./stringlist.3
\ No newline at end of file
diff --git a/gen/sync_volume_np.3 b/gen/sync_volume_np.3
new file mode 100644 (file)
index 0000000..87934af
--- /dev/null
@@ -0,0 +1,81 @@
+.\" Copyright (c) 2011 Apple Computer, Inc.  All rights reserved.
+.\"
+.\" @APPLE_LICENSE_HEADER_START@
+.\"
+.\" The contents of this file constitute Original Code as defined in and
+.\" are subject to the Apple Public Source License Version 1.1 (the
+.\" "License").  You may not use this file except in compliance with the
+.\" License.  Please obtain a copy of the License at
+.\" http://www.apple.com/publicsource and read it before using this file.
+.\"
+.\" This Original Code and all software distributed under the License are
+.\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
+.\" License for the specific language governing rights and limitations
+.\" under the License.
+.\"
+.\" @APPLE_LICENSE_HEADER_END@
+.\"
+.Dd October 
+.Dt SYNC_VOLUME_NP 3
+.Os
+.Sh NAME
+.Nm sync_volume_np
+.Nd Sync a mounted filesystem
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In unistd.h
+.Ft int
+.Fn sync_volume_np "const char *path" "int flags"
+.Ft int
+.Fn fsync_volume_np "int fd" "int flags"
+.Sh DESCRIPTION
+The
+.Fn sync_volume_np
+function causes data and metadata on the filesystem containing
+.Ar path
+to be synced to disk; this may be any file or directory on that filesystem.  The
+.Fn fsync_volume_np
+does the same thing, but using an open file descriptor for that
+filesystem.
+Both functions take a flags parameter, with the currently-defined
+options:
+.Bl -tag -width SYNC_VOLUME_FULLSYNC -offset indent
+.It SYNC_VOLUME_FULLSYNC
+Request that the data and metadata be written to the disk hardware;
+if not set, then the hardware may keep it in cache.
+.It SYNC_VOLUME_WAIT
+Wait for the data and metadata to be written; if not set, then
+it will return when the requests have been made.
+.El
+.Sh RETURN VALUES
+Both functions return 0 on success, and a non-zero error code on error.
+.Sh ERRORS
+The
+.Fn fsync_volume_np
+function may return
+.Er EBADF
+if the
+.Ar fd
+parameter is not a valid, open file descriptor.
+The
+.Fn sync_volume_np
+function may return errors if:
+.Bl -tag -width ENAMETOOLONG
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix.
+.It Bq Er EIO
+An I/O error occurs while reading from or writing to the file system.
+.It Bq Er ELOOP
+Too many symbolic links are encountered in translating the pathname.
+This is taken to be indicative of a looping symbolic link.
+.It Bq Er ENAMETOOLONG
+A component of a pathname exceeds {NAME_MAX} characters, or an entire path name exceeds {PATH_MAX} characters.
+.It Bq Er ENOENT
+The named file does not exist.
+.It Bq Er ENOTDIR
+A component of the path prefix is not a directory.
+.El
diff --git a/gen/sync_volume_np.c b/gen/sync_volume_np.c
new file mode 100644 (file)
index 0000000..a87e257
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <System/sys/fsctl.h>
+
+/*
+ * Sync a mounted filesystem, without syncing others.
+ * There are currently two flags that can be used:
+ *
+ * SYNC_VOLUME_FULLSYNC causes it to try to push the
+ * data to the platter (otherwise, it just pushes it
+ * to the disk drive, where it may remain in cache
+ * for a while).
+ *
+ * SYNC_VOLUME_WAIT causes it to wait until the writes
+ * have completed.  Otherwise, it'll return as soon
+ * as the requests have been made.
+ *
+ * The functions are a simple wrapper for fsctl, and
+ * return what it does.
+ */
+
+int
+sync_volume_np(const char *path, int flags) {
+       int full_sync = 0;
+       int terrno;
+       int rv;
+
+       if (flags & SYNC_VOLUME_FULLSYNC)
+               full_sync |= FSCTL_SYNC_FULLSYNC;
+
+       if (flags & SYNC_VOLUME_WAIT)
+               full_sync |= FSCTL_SYNC_WAIT;
+
+       terrno = errno;
+       rv = (fsctl(path, FSCTL_SYNC_VOLUME, &full_sync, 0) == -1) ? errno : 0;
+       errno = terrno;
+       return rv;
+}
+
+int
+fsync_volume_np(int fd, int flags) {
+       int full_sync = 0;
+       int terrno;
+       int rv;
+
+       if (flags & SYNC_VOLUME_FULLSYNC)
+               full_sync |= FSCTL_SYNC_FULLSYNC;
+
+       if (flags & SYNC_VOLUME_WAIT)
+               full_sync |= FSCTL_SYNC_WAIT;
+
+       terrno = errno;
+       rv = (ffsctl(fd, FSCTL_SYNC_VOLUME, &full_sync, 0) == -1) ? errno : 0;
+       errno = terrno;
+       return rv;
+}
+
diff --git a/gen/sysconf-fbsd.c b/gen/sysconf-fbsd.c
deleted file mode 100644 (file)
index 7f84622..0000000
+++ /dev/null
@@ -1,627 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Sean Eric Fagan of Cygnus Support.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sysconf.c  8.2 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb Exp $");
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/sysctl.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-#include <sys/aio.h>
-#include <sys/semaphore.h>
-
-#include <errno.h>
-#include <limits.h>
-#include <paths.h>
-#include <pthread.h>           /* we just need the limits */
-#include <time.h>
-#include <unistd.h>
-
-#include "../stdlib/atexit.h"
-#include "../stdtime/tzfile.h"
-
-#define        _PATH_ZONEINFO  TZDIR   /* from tzfile.h */
-
-/*
- * sysconf --
- *     get configurable system variables.
- *
- * XXX
- * POSIX 1003.1 (ISO/IEC 9945-1, 4.8.1.3) states that the variable values
- * not change during the lifetime of the calling process.  This would seem
- * to require that any change to system limits kill all running processes.
- * A workaround might be to cache the values when they are first retrieved
- * and then simply return the cached value on subsequent calls.  This is
- * less useful than returning up-to-date values, however.
- */
-long
-sysconf(name)
-       int name;
-{
-       struct rlimit rl;
-       quad_t qdvalue; /* for kern.sysv.shmmin */
-       size_t len;
-       int mib[3], sverrno, value;
-       long defaultresult;
-       const char *path;
-
-       len = sizeof(value);
-       defaultresult = -1;
-
-       switch (name) {
-       case _SC_ARG_MAX:
-               mib[0] = CTL_KERN;
-               mib[1] = KERN_ARGMAX;
-               break;
-       case _SC_CHILD_MAX:
-               if (getrlimit(RLIMIT_NPROC, &rl) != 0)
-                       return (-1);
-               if (rl.rlim_cur == RLIM_INFINITY)
-                       return (-1);
-               if (rl.rlim_cur > LONG_MAX) {
-                       errno = EOVERFLOW;
-                       return (-1);
-               }
-               return ((long)rl.rlim_cur);
-       case _SC_CLK_TCK:
-               return (CLK_TCK);
-       case _SC_NGROUPS_MAX:
-               mib[0] = CTL_KERN;
-               mib[1] = KERN_NGROUPS;
-               break;
-       case _SC_OPEN_MAX:
-       case _SC_STREAM_MAX:    /* assume fds run out before memory does */
-               if (getrlimit(RLIMIT_NOFILE, &rl) != 0)
-                       return (-1);
-               if (rl.rlim_cur == RLIM_INFINITY)
-                       return (-1);
-               if (rl.rlim_cur > LONG_MAX) {
-                       errno = EOVERFLOW;
-                       return (-1);
-               }
-               return ((long)rl.rlim_cur);
-       case _SC_JOB_CONTROL:
-               return (_POSIX_JOB_CONTROL);
-       case _SC_SAVED_IDS:
-               /* XXX - must be 1 */
-               mib[0] = CTL_KERN;
-               mib[1] = KERN_SAVED_IDS;
-               goto yesno;
-       case _SC_VERSION:
-               mib[0] = CTL_KERN;
-               mib[1] = KERN_POSIX1;
-               break;
-       case _SC_BC_BASE_MAX:
-               return (BC_BASE_MAX);
-       case _SC_BC_DIM_MAX:
-               return (BC_DIM_MAX);
-       case _SC_BC_SCALE_MAX:
-               return (BC_SCALE_MAX);
-       case _SC_BC_STRING_MAX:
-               return (BC_STRING_MAX);
-       case _SC_COLL_WEIGHTS_MAX:
-               return (COLL_WEIGHTS_MAX);
-       case _SC_EXPR_NEST_MAX:
-               return (EXPR_NEST_MAX);
-       case _SC_LINE_MAX:
-               return (LINE_MAX);
-       case _SC_RE_DUP_MAX:
-               return (RE_DUP_MAX);
-       case _SC_2_VERSION:
-               /*
-                * This is something of a lie, but it would be silly at
-                * this point to try to deduce this from the contents
-                * of the filesystem.
-                */
-               return (_POSIX2_VERSION);
-       case _SC_2_C_BIND:
-               return (_POSIX2_C_BIND);
-       case _SC_2_C_DEV:
-               return (_POSIX2_C_DEV);
-       case _SC_2_CHAR_TERM:
-               return (_POSIX2_CHAR_TERM);
-       case _SC_2_FORT_DEV:
-               return (_POSIX2_FORT_DEV);
-       case _SC_2_FORT_RUN:
-               return (_POSIX2_FORT_RUN);
-       case _SC_2_LOCALEDEF:
-               return (_POSIX2_LOCALEDEF);
-       case _SC_2_SW_DEV:
-               return (_POSIX2_SW_DEV);
-       case _SC_2_UPE:
-               return (_POSIX2_UPE);
-       case _SC_TZNAME_MAX:
-               path = _PATH_ZONEINFO;
-do_NAME_MAX:
-               sverrno = errno;
-               errno = 0;
-               value = pathconf(path, _PC_NAME_MAX);
-               if (value == -1 && errno != 0)
-                       return (-1);
-               errno = sverrno;
-               return (value);
-
-       case _SC_ASYNCHRONOUS_IO:
-#if _POSIX_ASYNCHRONOUS_IO == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_ASYNCHRONOUS_IO;
-               break;
-#else
-               return (_POSIX_ASYNCHRONOUS_IO);
-#endif
-       case _SC_MAPPED_FILES:
-               return (_POSIX_MAPPED_FILES);
-       case _SC_MEMLOCK:
-               return (_POSIX_MEMLOCK);
-       case _SC_MEMLOCK_RANGE:
-               return (_POSIX_MEMLOCK_RANGE);
-       case _SC_MEMORY_PROTECTION:
-               return (_POSIX_MEMORY_PROTECTION);
-       case _SC_MESSAGE_PASSING:
-#if _POSIX_MESSAGE_PASSING == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_MESSAGE_PASSING;
-               goto yesno;
-#else
-               return (_POSIX_MESSAGE_PASSING);
-#endif
-       case _SC_PRIORITIZED_IO:
-#if _POSIX_PRIORITIZED_IO == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_PRIORITIZED_IO;
-               goto yesno;
-#else
-               return (_POSIX_PRIORITIZED_IO);
-#endif
-       case _SC_PRIORITY_SCHEDULING:
-#if _POSIX_PRIORITY_SCHEDULING == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_PRIORITY_SCHEDULING;
-               goto yesno;
-#else
-               return (_POSIX_PRIORITY_SCHEDULING);
-#endif
-       case _SC_REALTIME_SIGNALS:
-#if _POSIX_REALTIME_SIGNALS == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_REALTIME_SIGNALS;
-               goto yesno;
-#else
-               return (_POSIX_REALTIME_SIGNALS);
-#endif
-       case _SC_SEMAPHORES:
-#if _POSIX_SEMAPHORES == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SEMAPHORES;
-               goto yesno;
-#else
-               return (_POSIX_SEMAPHORES);
-#endif
-       case _SC_FSYNC:
-               return (_POSIX_FSYNC);
-
-       case _SC_SHARED_MEMORY_OBJECTS:
-               return (_POSIX_SHARED_MEMORY_OBJECTS);
-       case _SC_SYNCHRONIZED_IO:
-#if _POSIX_SYNCHRONIZED_IO == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SYNCHRONIZED_IO;
-               goto yesno;
-#else
-               return (_POSIX_SYNCHRONIZED_IO);
-#endif
-       case _SC_TIMERS:
-#if _POSIX_TIMERS == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_TIMERS;
-               goto yesno;
-#else
-               return (_POSIX_TIMERS);
-#endif
-       case _SC_AIO_LISTIO_MAX:
-       case _SC_AIO_MAX:
-               mib[0] = CTL_KERN;;
-               mib[1] = KERN_AIOMAX;
-               break;
-
-       case _SC_AIO_PRIO_DELTA_MAX:
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_AIO_PRIO_DELTA_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_AIO_PRIO_DELTA_MAX;
-               break;
-#else
-               return (-1);
-#endif
-       case _SC_DELAYTIMER_MAX:
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_DELAYTIMER_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_DELAYTIMER_MAX;
-               goto yesno;
-#else
-               return (-1);
-#endif
-       case _SC_MQ_OPEN_MAX:
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_MQ_OPEN_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_MQ_OPEN_MAX;
-               goto yesno;
-#else
-               return (-1);
-#endif
-       case _SC_PAGESIZE:
-               defaultresult = getpagesize();
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_PAGESIZE)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_PAGESIZE;
-               goto yesno;
-#else
-               return defaultresult;
-#endif
-       case _SC_RTSIG_MAX:
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_RTSIG_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_RTSIG_MAX;
-               goto yesno;
-#else
-               return (-1);
-#endif
-       case _SC_SEM_NSEMS_MAX:
-               return (sysctlbyname("kern.sysv.semmns", &value, &len, NULL, 0) == -1 ? -1 : value);
-
-       case _SC_SEM_VALUE_MAX:
-#if SEM_VALUE_MAX == 0
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SEM_VALUE_MAX;
-               goto yesno;
-#else
-               return (SEM_VALUE_MAX);
-#endif
-       case _SC_SIGQUEUE_MAX:
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_SIGQUEUE_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_SIGQUEUE_MAX;
-               goto yesno;
-#else
-               return (-1);
-#endif
-       case _SC_TIMER_MAX:
-#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_TIMER_MAX)
-               mib[0] = CTL_P1003_1B;
-               mib[1] = CTL_P1003_1B_TIMER_MAX;
-#else
-               return (-1);
-#endif
-
-yesno:         if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
-                       return (-1);
-               if (value == 0)
-                       return (defaultresult);
-               return (value);
-       case _SC_2_PBS:
-       case _SC_2_PBS_ACCOUNTING:
-       case _SC_2_PBS_CHECKPOINT:
-       case _SC_2_PBS_LOCATE:
-       case _SC_2_PBS_MESSAGE:
-       case _SC_2_PBS_TRACK:
-               return -1;
-       case _SC_ADVISORY_INFO:
-#if _POSIX_ADVISORY_INFO == 0
-#error "_POSIX_ADVISORY_INFO"
-#else
-               return (_POSIX_ADVISORY_INFO);
-#endif
-       case _SC_BARRIERS:
-#if _POSIX_BARRIERS == 0
-#error "_POSIX_BARRIERS"
-#else
-               return (_POSIX_BARRIERS);
-#endif
-       case _SC_CLOCK_SELECTION:
-#if _POSIX_CLOCK_SELECTION == 0
-#error "_POSIX_CLOCK_SELECTION"
-#else
-               return (_POSIX_CLOCK_SELECTION);
-#endif
-       case _SC_CPUTIME:
-#if _POSIX_CPUTIME == 0
-#error "_POSIX_CPUTIME"
-#else
-               return (_POSIX_CPUTIME);
-#endif
-       case _SC_FILE_LOCKING:
-       case _SC_GETGR_R_SIZE_MAX:
-/*             return sizeof(group) + group_name_max + group_passwd_max + max_group_member*(MAXLOGNAME+1); */
-               return 4096;    /* INT_MAX is too big for Perl */
-       case _SC_GETPW_R_SIZE_MAX:
-               return 4096;
-       case _SC_HOST_NAME_MAX:
-               return (MAXHOSTNAMELEN - 1); /* does not include \0 */
-       case _SC_LOGIN_NAME_MAX:
-               return (MAXLOGNAME);
-       case _SC_MONOTONIC_CLOCK:
-#if _POSIX_MONOTONIC_CLOCK == 0
-#error "_POSIX_MONOTONIC_CLOCK"
-#else
-               return (_POSIX_MONOTONIC_CLOCK);
-#endif
-       case _SC_MQ_PRIO_MAX:
-               return (-1);
-       case _SC_READER_WRITER_LOCKS:
-               return (_POSIX_READER_WRITER_LOCKS);
-       case _SC_REGEXP:
-               return (_POSIX_REGEXP);
-       case _SC_SHELL:
-               return (_POSIX_SHELL);
-       case _SC_SPAWN:
-               return (_POSIX_SPAWN);
-       case _SC_SPIN_LOCKS:
-               return (_POSIX_SPIN_LOCKS);
-       case _SC_SPORADIC_SERVER:
-#if _POSIX_SPORADIC_SERVER == 0
-#error "_POSIX_SPORADIC_SERVER"
-#else
-               return (_POSIX_SPORADIC_SERVER);
-#endif
-       case _SC_THREAD_ATTR_STACKADDR:
-               return (_POSIX_THREAD_ATTR_STACKADDR);
-       case _SC_THREAD_ATTR_STACKSIZE:
-               return (_POSIX_THREAD_ATTR_STACKSIZE);
-       case _SC_THREAD_CPUTIME:
-               return (_POSIX_THREAD_CPUTIME);
-       case _SC_THREAD_DESTRUCTOR_ITERATIONS:
-               return (PTHREAD_DESTRUCTOR_ITERATIONS);
-       case _SC_THREAD_KEYS_MAX:
-               return (PTHREAD_KEYS_MAX);
-       case _SC_THREAD_PRIO_INHERIT:
-               return (_POSIX_THREAD_PRIO_INHERIT);
-       case _SC_THREAD_PRIO_PROTECT:
-               return (_POSIX_THREAD_PRIO_PROTECT);
-       case _SC_THREAD_PRIORITY_SCHEDULING:
-               return (_POSIX_THREAD_PRIORITY_SCHEDULING);
-       case _SC_THREAD_PROCESS_SHARED:
-               return (_POSIX_THREAD_PROCESS_SHARED);
-       case _SC_THREAD_SAFE_FUNCTIONS:
-               return (_POSIX_THREAD_SAFE_FUNCTIONS);
-       case _SC_THREAD_SPORADIC_SERVER:
-               return (_POSIX_THREAD_SPORADIC_SERVER);
-       case _SC_THREAD_STACK_MIN:
-               return (PTHREAD_STACK_MIN);
-       case _SC_THREAD_THREADS_MAX:
-#ifdef PTHREAD_THREADS_MAX
-               return (PTHREAD_THREADS_MAX); /* XXX wrong type! */
-#else
-               return (-1);
-#endif
-       case _SC_TIMEOUTS:
-               return (_POSIX_TIMEOUTS);
-       case _SC_THREADS:
-               return (_POSIX_THREADS);
-       case _SC_TRACE:
-#if _POSIX_TRACE == 0
-#error "_POSIX_TRACE"
-               /* While you're implementing this, also do the ones below. */
-#else
-               return (_POSIX_TRACE);
-#endif
-       case _SC_TRACE_EVENT_FILTER:
-               return (_POSIX_TRACE_EVENT_FILTER);
-       case _SC_TRACE_INHERIT:
-               return (_POSIX_TRACE_INHERIT);
-       case _SC_TRACE_LOG:
-               return (_POSIX_TRACE_LOG);
-       case _SC_TTY_NAME_MAX:
-               path = "/"; // should be _PATH_DEV (PR-3624562)
-               goto do_NAME_MAX;
-       case _SC_TYPED_MEMORY_OBJECTS:
-#if _POSIX_TYPED_MEMORY_OBJECTS == 0
-#error "_POSIX_TYPED_MEMORY_OBJECTS"
-#else
-               return (_POSIX_TYPED_MEMORY_OBJECTS);
-#endif
-       case _SC_V6_ILP32_OFF32:
-#if _V6_ILP32_OFF32 == 0
-               if (sizeof(int) * CHAR_BIT == 32 &&
-                   sizeof(int) == sizeof(long) &&
-                   sizeof(long) == sizeof(void *) &&
-                   sizeof(void *) == sizeof(off_t))
-                       return 1;
-               else
-                       return -1;
-#else
-               return (_V6_ILP32_OFF32);
-#endif
-       case _SC_V6_ILP32_OFFBIG:
-#if _V6_ILP32_OFFBIG == 0
-               if (sizeof(int) * CHAR_BIT == 32 &&
-                   sizeof(int) == sizeof(long) &&
-                   sizeof(long) == sizeof(void *) &&
-                   sizeof(off_t) * CHAR_BIT >= 64)
-                       return 1;
-               else
-                       return -1;
-#else
-               return (_V6_ILP32_OFFBIG);
-#endif
-       case _SC_V6_LP64_OFF64:
-#if _V6_LP64_OFF64 == 0
-               if (sizeof(int) * CHAR_BIT == 32 &&
-                   sizeof(long) * CHAR_BIT == 64 &&
-                   sizeof(long) == sizeof(void *) &&
-                   sizeof(void *) == sizeof(off_t))
-                       return 1;
-               else
-                       return -1;
-#else
-               return (_V6_LP64_OFF64);
-#endif
-       case _SC_V6_LPBIG_OFFBIG:
-#if _V6_LPBIG_OFFBIG == 0
-               if (sizeof(int) * CHAR_BIT >= 32 &&
-                   sizeof(long) * CHAR_BIT >= 64 &&
-                   sizeof(void *) * CHAR_BIT >= 64 &&
-                   sizeof(off_t) * CHAR_BIT >= 64)
-                       return 1;
-               else
-                       return -1;
-#else
-               return (_V6_LPBIG_OFFBIG);
-#endif
-       case _SC_ATEXIT_MAX:
-               return (INT_MAX);       /* unlimited */
-       case _SC_IOV_MAX:
-#ifdef KERN_IOV_MAX
-               mib[0] = CTL_KERN;
-               mib[1] = KERN_IOV_MAX;
-               break;
-#else
-               return (IOV_MAX);
-#endif
-       case _SC_XOPEN_CRYPT:
-               return (_XOPEN_CRYPT);
-       case _SC_XOPEN_ENH_I18N:
-               return (_XOPEN_ENH_I18N);
-       case _SC_XOPEN_LEGACY:
-               return (_XOPEN_LEGACY);
-       case _SC_XOPEN_REALTIME:
-#if _XOPEN_REALTIME == 0
-               sverrno = errno;
-               value = sysconf(_SC_ASYNCHRONOUS_IO) > 0 &&
-                       sysconf(_SC_MEMLOCK) > 0 &&
-                       sysconf(_SC_MEMLOCK_RANGE) > 0 &&
-                       sysconf(_SC_MESSAGE_PASSING) > 0 &&
-                       sysconf(_SC_PRIORITY_SCHEDULING) > 0 &&
-                       sysconf(_SC_REALTIME_SIGNALS) > 0 &&
-                       sysconf(_SC_SEMAPHORES) > 0 &&
-                       sysconf(_SC_SHARED_MEMORY_OBJECTS) > 0 &&
-                       sysconf(_SC_SYNCHRONIZED_IO) > 0 &&
-                       sysconf(_SC_TIMERS) > 0;
-               errno = sverrno;
-               if (value)
-                       return (200112L);
-               else
-                       return (-1);
-#else
-               return (_XOPEN_REALTIME);
-#endif
-       case _SC_XOPEN_REALTIME_THREADS:
-#if _XOPEN_REALTIME_THREADS == 0
-#error "_XOPEN_REALTIME_THREADS"
-#else
-               return (_XOPEN_REALTIME_THREADS);
-#endif
-       case _SC_XOPEN_SHM:
-               sverrno = errno;
-               len = sizeof(qdvalue);
-               if (sysctlbyname("kern.sysv.shmmin", &qdvalue, &len, NULL, 
-                   0) == -1) {
-                       errno = sverrno;
-                       return (-1);
-               }
-               errno = sverrno;
-               return (1);
-       case _SC_XOPEN_STREAMS:
-               return (_XOPEN_STREAMS);
-       case _SC_XOPEN_UNIX:
-               return (_XOPEN_UNIX);
-#ifdef _XOPEN_VERSION
-       case _SC_XOPEN_VERSION:
-               return (_XOPEN_VERSION);
-#endif
-#ifdef _XOPEN_XCU_VERSION
-       case _SC_XOPEN_XCU_VERSION:
-               return (_XOPEN_XCU_VERSION);
-#endif
-       case _SC_SYMLOOP_MAX:
-               return (MAXSYMLINKS);
-       case _SC_RAW_SOCKETS:
-               return (_POSIX_RAW_SOCKETS);
-       case _SC_IPV6:
-#if _POSIX_IPV6 == 0
-               sverrno = errno;
-               value = socket(PF_INET6, SOCK_DGRAM, 0);
-               errno = sverrno;
-               if (value >= 0) {
-                       close(value);
-                       return (200112L);
-               } else
-                       return (0);
-#else
-               return (_POSIX_IPV6);
-#endif
-
-#ifdef _SC_NPROCESSORS_CONF
-       case _SC_NPROCESSORS_CONF:
-#endif
-#ifdef _SC_NPROCESSORS_ONLN
-       case _SC_NPROCESSORS_ONLN:
-#endif
-#if defined(_SC_NPROCESSORS_CONF) || defined(_SC_NPROCESSORS_ONLN)
-               mib[0] = CTL_HW;
-               mib[1] = HW_NCPU;
-               break;
-#endif
-       case _SC_XBS5_ILP32_OFF32:
-               return (_XBS5_ILP32_OFF32);
-       case _SC_XBS5_ILP32_OFFBIG:
-               return (_XBS5_ILP32_OFFBIG);
-       case _SC_XBS5_LP64_OFF64:
-               return (_XBS5_LP64_OFF64);
-       case _SC_XBS5_LPBIG_OFFBIG:
-               return (_XBS5_LPBIG_OFFBIG);
-       case _SC_SS_REPL_MAX:
-               return (_POSIX_SS_REPL_MAX);
-       case _SC_TRACE_EVENT_NAME_MAX:
-               return (_POSIX_TRACE_EVENT_NAME_MAX);
-       case _SC_TRACE_NAME_MAX:
-               return (_POSIX_TRACE_NAME_MAX);
-       case _SC_TRACE_SYS_MAX:
-               return (_POSIX_TRACE_SYS_MAX);
-       case _SC_TRACE_USER_EVENT_MAX:
-               return (_POSIX_TRACE_USER_EVENT_MAX);
-       case _SC_PASS_MAX:
-               return (PASS_MAX);
-
-       default:
-               errno = EINVAL;
-               return (-1);
-       }
-       return (sysctl(mib, 2, &value, &len, NULL, 0) == -1 ? -1 : value);
-}
diff --git a/gen/sysconf.3 b/gen/sysconf.3
deleted file mode 120000 (symlink)
index c7e48c6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./sysconf.3
\ No newline at end of file
diff --git a/gen/sysctl-fbsd.c b/gen/sysctl-fbsd.c
deleted file mode 100644 (file)
index 7205820..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sysctl.c   8.2 (Berkeley) 1/4/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/sysctl.c,v 1.6 2007/01/09 00:27:55 imp Exp $");
-
-#include <sys/param.h>
-#include <sys/sysctl.h>
-
-#include <errno.h>
-#include <limits.h>
-#include <paths.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
-    void *newp, size_t newlen);
-
-int
-sysctl(name, namelen, oldp, oldlenp, newp, newlen)
-       int *name;
-       u_int namelen;
-       void *oldp, *newp;
-       size_t *oldlenp, newlen;
-{
-       if (name[0] != CTL_USER) {
-               if (namelen == 2 && name[0] == CTL_KERN && name[1] == KERN_EXEC) {
-                       /*
-                        * 7723306: intercept kern.exec and fake a return of
-                        * a dummy string ("/" in this case)
-                        */
-                       if (newp != NULL) {
-                               errno = EPERM;
-                               return -1;
-                       }
-                       if (oldp == NULL) {
-                               if (oldlenp != NULL) *oldlenp = 2;
-                               return 0;
-                       }
-                       if (oldlenp == NULL) {
-                               errno = EFAULT;
-                               return -1;
-                       }
-                       if (*oldlenp < 2) {
-                               errno = ENOMEM;
-                               return -1;
-                       }
-                       memmove(oldp, "/", 2);
-                       *oldlenp = 2;
-                       return 0;
-               }
-               return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
-       }
-
-       if (newp != NULL) {
-               errno = EPERM;
-               return (-1);
-       }
-       if (namelen != 2) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       switch (name[1]) {
-       case USER_CS_PATH:
-               if (oldp && *oldlenp < sizeof(_PATH_STDPATH)) {
-                       errno = ENOMEM;
-                       return -1;
-               }
-               *oldlenp = sizeof(_PATH_STDPATH);
-               if (oldp != NULL)
-                       memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH));
-               return (0);
-       }
-
-       if (oldp && *oldlenp < sizeof(int)) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       *oldlenp = sizeof(int);
-       if (oldp == NULL)
-               return (0);
-
-       switch (name[1]) {
-       case USER_BC_BASE_MAX:
-               *(int *)oldp = BC_BASE_MAX;
-               return (0);
-       case USER_BC_DIM_MAX:
-               *(int *)oldp = BC_DIM_MAX;
-               return (0);
-       case USER_BC_SCALE_MAX:
-               *(int *)oldp = BC_SCALE_MAX;
-               return (0);
-       case USER_BC_STRING_MAX:
-               *(int *)oldp = BC_STRING_MAX;
-               return (0);
-       case USER_COLL_WEIGHTS_MAX:
-               *(int *)oldp = COLL_WEIGHTS_MAX;
-               return (0);
-       case USER_EXPR_NEST_MAX:
-               *(int *)oldp = EXPR_NEST_MAX;
-               return (0);
-       case USER_LINE_MAX:
-               *(int *)oldp = LINE_MAX;
-               return (0);
-       case USER_RE_DUP_MAX:
-               *(int *)oldp = RE_DUP_MAX;
-               return (0);
-       case USER_POSIX2_VERSION:
-               *(int *)oldp = _POSIX2_VERSION;
-               return (0);
-       case USER_POSIX2_C_BIND:
-#ifdef POSIX2_C_BIND
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_C_DEV:
-#ifdef POSIX2_C_DEV
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_CHAR_TERM:
-#ifdef POSIX2_CHAR_TERM
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_FORT_DEV:
-#ifdef POSIX2_FORT_DEV
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_FORT_RUN:
-#ifdef POSIX2_FORT_RUN
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_LOCALEDEF:
-#ifdef POSIX2_LOCALEDEF
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_SW_DEV:
-#ifdef POSIX2_SW_DEV
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_POSIX2_UPE:
-#ifdef POSIX2_UPE
-               *(int *)oldp = 1;
-#else
-               *(int *)oldp = 0;
-#endif
-               return (0);
-       case USER_STREAM_MAX:
-               *(int *)oldp = FOPEN_MAX;
-               return (0);
-       case USER_TZNAME_MAX:
-               *(int *)oldp = NAME_MAX;
-               return (0);
-       default:
-               errno = EINVAL;
-               return (-1);
-       }
-       /* NOTREACHED */
-}
diff --git a/gen/sysctl.3 b/gen/sysctl.3
deleted file mode 100644 (file)
index 8c8e4bc..0000000
+++ /dev/null
@@ -1,870 +0,0 @@
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)sysctl.3    8.4 (Berkeley) 5/9/95
-.\" $FreeBSD: src/lib/libc/gen/sysctl.3,v 1.63 2004/07/02 23:52:10 ru Exp $
-.\"
-.Dd October 21, 2008
-.Dt SYSCTL 3
-.Os
-.Sh NAME
-.Nm sysctl ,
-.Nm sysctlbyname ,
-.Nm sysctlnametomib
-.Nd get or set system information
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/sysctl.h
-.Ft int
-.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
-.Ft int
-.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen"
-.Ft int
-.Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep"
-.Sh DESCRIPTION
-The
-.Fn sysctl
-function retrieves system information and allows processes with
-appropriate privileges to set system information.
-The information available from
-.Fn sysctl
-consists of integers, strings, and tables.
-Information may be retrieved and set from the command interface
-using the
-.Xr sysctl 8
-utility.
-.Pp
-Unless explicitly noted below,
-.Fn sysctl
-returns a consistent snapshot of the data requested.
-Consistency is obtained by locking the destination
-buffer into memory so that the data may be copied out without blocking.
-Calls to
-.Fn sysctl
-are serialized to avoid deadlock.
-.Pp
-The state is described using a ``Management Information Base'' (MIB)
-style name, listed in
-.Fa name ,
-which is a
-.Fa namelen
-length array of integers.
-.Pp
-The
-.Fn sysctlbyname
-function accepts an ASCII representation of the name and internally
-looks up the integer name vector.
-Apart from that, it behaves the same
-as the standard
-.Fn sysctl
-function.
-.Pp
-The information is copied into the buffer specified by
-.Fa oldp .
-The size of the buffer is given by the location specified by
-.Fa oldlenp
-before the call,
-and that location gives the amount of data copied after a successful call
-and after a call that returns with the error code
-.Er ENOMEM .
-If the amount of data available is greater
-than the size of the buffer supplied,
-the call supplies as much data as fits in the buffer provided
-and returns with the error code
-.Er ENOMEM .
-If the old value is not desired,
-.Fa oldp
-and
-.Fa oldlenp
-should be set to NULL.
-.Pp
-The size of the available data can be determined by calling
-.Fn sysctl
-with the
-.Dv NULL
-argument for
-.Fa oldp .
-The size of the available data will be returned in the location pointed to by
-.Fa oldlenp .
-For some operations, the amount of space may change often.
-For these operations,
-the system attempts to round up so that the returned size is
-large enough for a call to return the data shortly thereafter.
-.Pp
-To set a new value,
-.Fa newp
-is set to point to a buffer of length
-.Fa newlen
-from which the requested value is to be taken.
-If a new value is not to be set,
-.Fa newp
-should be set to NULL and
-.Fa newlen
-set to 0.
-.Pp
-The
-.Fn sysctlnametomib
-function accepts an ASCII representation of the name,
-looks up the integer name vector,
-and returns the numeric representation in the mib array pointed to by
-.Fa mibp .
-The number of elements in the mib array is given by the location specified by
-.Fa sizep
-before the call,
-and that location gives the number of entries copied after a successful call.
-The resulting
-.Fa mib
-and
-.Fa size
-may be used in subsequent
-.Fn sysctl
-calls to get the data associated with the requested ASCII name.
-This interface is intended for use by applications that want to
-repeatedly request the same variable (the
-.Fn sysctl
-function runs in about a third the time as the same request made via the
-.Fn sysctlbyname
-function).
-The
-.Fn sysctlnametomib
-function is also useful for fetching mib prefixes and then adding
-a final component.
-For example, to fetch process information
-for processes with pid's less than 100:
-.Pp
-.Bd -literal -offset indent -compact
-int i, mib[4];
-size_t len;
-struct kinfo_proc kp;
-
-/* Fill out the first three components of the mib */
-len = 4;
-sysctlnametomib("kern.proc.pid", mib, &len);
-
-/* Fetch and print entries for pid's < 100 */
-for (i = 0; i < 100; i++) {
-       mib[3] = i;
-       len = sizeof(kp);
-       if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
-               perror("sysctl");
-       else if (len > 0)
-               printkproc(&kp);
-}
-.Ed
-.Pp
-Note:  Implementation of
-.Fn printkproc
--- to print whatever data deemed necessary from the large
-.Vt kinfo_proc
-structure (
-.In sys/sysctl.h
-) -- is left as an exercise for the reader.
-.Pp
-The top level names are defined with a CTL_ prefix in
-.In sys/sysctl.h ,
-and are as follows.
-The next and subsequent levels down are found in the include files
-listed here, and described in separate sections below.
-.Pp
-.Bl -column CTLXMACHDEP "Next level names" -offset indent
-.It Sy "Name   Next level names        Description"
-.It "CTL_DEBUG sys/sysctl.h    Debugging"
-.It "CTL_VFS   sys/mount.h     File system"
-.It "CTL_HW    sys/sysctl.h    Generic CPU, I/O"
-.It "CTL_KERN  sys/sysctl.h    High kernel limits"
-.It "CTL_MACHDEP       sys/sysctl.h    Machine dependent"
-.It "CTL_NET   sys/socket.h    Networking"
-.It "CTL_USER  sys/sysctl.h    User-level"
-.It "CTL_VM    sys/resources.h Virtual memory (struct loadavg)"
-.It "CTL_VM    sys/vmmeter.h   Virtual memory (struct vmtotal)"
-.El
-.Pp
-For example, the following retrieves the maximum number of processes allowed
-in the system:
-.Pp
-.Bd -literal -offset indent -compact
-int mib[2], maxproc;
-size_t len;
-
-mib[0] = CTL_KERN;
-mib[1] = KERN_MAXPROC;
-len = sizeof(maxproc);
-sysctl(mib, 2, &maxproc, &len, NULL, 0);
-.Ed
-.Pp
-To retrieve the standard search path for the system utilities:
-.Pp
-.Bd -literal -offset indent -compact
-int mib[2];
-size_t len;
-char *p;
-
-mib[0] = CTL_USER;
-mib[1] = USER_CS_PATH;
-sysctl(mib, 2, NULL, &len, NULL, 0);
-p = malloc(len);
-sysctl(mib, 2, p, &len, NULL, 0);
-.Ed
-.Ss CTL_DEBUG
-The debugging variables vary from system to system.
-A debugging variable may be added or deleted without need to recompile
-.Fn sysctl
-to know about it.
-Each time it runs,
-.Fn sysctl
-gets the list of debugging variables from the kernel and
-displays their current values.
-The system defines twenty
-.Pq Vt "struct ctldebug"
-variables named
-.Va debug0
-through
-.Va debug19 .
-They are declared as separate variables so that they can be
-individually initialized at the location of their associated variable.
-The loader prevents multiple use of the same variable by issuing errors
-if a variable is initialized in more than one place.
-For example, to export the variable
-.Va dospecialcheck
-as a debugging variable, the following declaration would be used:
-.Pp
-.Bd -literal -offset indent -compact
-int dospecialcheck = 1;
-struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
-.Ed
-.Ss CTL_VFS
-A distinguished second level name, VFS_GENERIC,
-is used to get general information about all file systems.
-One of its third level identifiers is VFS_MAXTYPENUM
-that gives the highest valid file system type number.
-Its other third level identifier is VFS_CONF that
-returns configuration information about the file system
-type given as a fourth level identifier (see
-.Xr getvfsbyname 3
-as an example of its use).
-The remaining second level identifiers are the
-file system type number returned by a
-.Xr statfs 2
-call or from VFS_CONF.
-The third level identifiers available for each file system
-are given in the header file that defines the mount
-argument structure for that file system.
-.Ss CTL_HW
-The string and integer information available for the CTL_HW level
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-.Bl -column "Second level nameXXXXXX" integerXXX -offset indent
-.It Sy "Second level name      Type    Changeable"
-.It "HW_MACHINE        string  no"
-.It "HW_MODEL  string  no"
-.It "HW_NCPU   integer no (DEPRECATED)"
-.It "HW_BYTEORDER      integer no"
-.It "HW_PHYSMEM        integer no"
-.It "HW_MEMSIZE        integer no"
-.It "HW_USERMEM        integer no"
-.It "HW_PAGESIZE       integer no"
-.It "HW_FLOATINGPOINT  integer no"
-.It "HW_MACHINE_ARCH   string  no"
-.\".It "HW_DISKNAMES   integer no"
-.\".It "HW_DISKSTATS   integer no"
-.El
-.Pp
-.Bl -tag -width 6n
-.It Li HW_MACHINE
-The machine class.
-.It Li HW_MODEL
-The machine model
-.It Li HW_NCPU (DEPRECATED)
-The number of cpus.  It is recommended that you use "hw.physicalcpu" "hw.physicalcpu_max" "hw.logicalcpu" or "hw.logicalcpu_max" instead.
-.It Li "hw.physicalcpu"
-The number of physical processors available in the current power management mode.
-.It Li "hw.physicalcpu_max"
-The maximum number of physical processors that could be available this boot.
-.It Li "hw.logicalcpu"
-The number of logical processors available in the current power management mode.
-.It Li "hw.logicalcpu_max"
-The maximum number of logical processors that could be available this boot.
-.It Li HW_BYTEORDER
-The byteorder (4,321, or 1,234).
-.It Li HW_PHYSMEM
-The bytes of physical memory represented by a 32-bit integer (for backward compatibility). Use HW_MEMSIZE instead.
-.It Li HW_MEMSIZE
-The bytes of physical memory represented by a 64-bit integer.
-.It Li HW_USERMEM
-The bytes of non-kernel memory.
-.It Li HW_PAGESIZE
-The software page size.
-.It Li HW_FLOATINGPOINT
-Nonzero if the floating point support is in hardware.
-.It Li HW_MACHINE_ARCH
-The machine dependent architecture type.
-.\".It Fa HW_DISKNAMES
-.\".It Fa HW_DISKSTATS
-.El
-.Ss CTL_KERN
-The string and integer information available for the CTL_KERN level
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-The types of data currently available are process information,
-system vnodes, the open file entries, routing table entries,
-virtual memory statistics, load average history, and clock rate
-information.
-.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
-.It Sy "Second level name      Type    Changeable"
-.It "KERN_ARGMAX       integer no"
-.It "KERN_BOOTFILE     string  yes"
-.It "KERN_BOOTTIME     struct timeval  no"
-.It "KERN_CLOCKRATE    struct clockinfo        no"
-.It "KERN_FILE struct file     no"
-.It "KERN_HOSTID       integer yes"
-.It "KERN_HOSTNAME     string  yes"
-.It "KERN_JOB_CONTROL  integer no"
-.It "KERN_MAXFILES     integer yes"
-.It "KERN_MAXFILESPERPROC      integer yes"
-.It "KERN_MAXPROC      integer no"
-.It "KERN_MAXPROCPERUID        integer yes"
-.It "KERN_MAXVNODES    integer yes"
-.It "KERN_NGROUPS      integer no"
-.It "KERN_NISDOMAINNAME        string  yes"
-.It "KERN_OSRELDATE    integer no"
-.It "KERN_OSRELEASE    string  no"
-.It "KERN_OSREV        integer no"
-.It "KERN_OSTYPE       string  no"
-.It "KERN_POSIX1       integer no"
-.It "KERN_PROC struct kinfo_proc       no"
-.It "KERN_PROF node    not applicable"
-.It "KERN_QUANTUM      integer yes"
-.It "KERN_SAVED_IDS    integer no"
-.It "KERN_SECURELVL    integer raise only"
-.It "KERN_UPDATEINTERVAL       integer no"
-.It "KERN_VERSION      string  no"
-.It "KERN_VNODE        struct vnode    no"
-.El
-.Pp
-.Bl -tag -width 6n
-.It Li KERN_ARGMAX
-The maximum bytes of argument to
-.Xr execve 2 .
-.It Li KERN_BOOTFILE
-The full pathname of the file from which the kernel was loaded.
-.It Li KERN_BOOTTIME
-A
-.Va struct timeval
-structure is returned.
-This structure contains the time that the system was booted.
-.It Li KERN_CLOCKRATE
-A
-.Va struct clockinfo
-structure is returned.
-This structure contains the clock, statistics clock and profiling clock
-frequencies, the number of micro-seconds per hz tick and the skew rate.
-.It Li KERN_FILE
-Return the entire file table.
-The returned data consists of a single
-.Va struct filehead
-followed by an array of
-.Va struct file ,
-whose size depends on the current number of such objects in the system.
-.It Li KERN_HOSTID
-Get or set the host id.
-.It Li KERN_HOSTNAME
-Get or set the hostname.
-.It Li KERN_JOB_CONTROL
-Return 1 if job control is available on this system, otherwise 0.
-.It Li KERN_MAXFILES
-The maximum number of files that may be open in the system.
-.It Li KERN_MAXFILESPERPROC
-The maximum number of files that may be open for a single process.
-This limit only applies to processes with an effective uid of nonzero
-at the time of the open request.
-Files that have already been opened are not affected if the limit
-or the effective uid is changed.
-.It Li KERN_MAXPROC
-The maximum number of concurrent processes the system will allow.
-.It Li KERN_MAXPROCPERUID
-The maximum number of concurrent processes the system will allow
-for a single effective uid.
-This limit only applies to processes with an effective uid of nonzero
-at the time of a fork request.
-Processes that have already been started are not affected if the limit
-is changed.
-.It Li KERN_MAXVNODES
-The maximum number of vnodes available on the system.
-.It Li KERN_NGROUPS
-The maximum number of supplemental groups.
-.It Li KERN_NISDOMAINNAME
-The name of the current YP/NIS domain.
-.It Li KERN_OSRELDATE
-The kernel release version in the format
-.Ar M Ns Ar mm Ns Ar R Ns Ar xx ,
-where
-.Ar M
-is the major version,
-.Ar mm
-is the two digit minor version,
-.Ar R
-is 0 if release branch, otherwise 1,
-and
-.Ar xx
-is updated when the available APIs change.
-.Pp
-The userland release version is available from
-.In osreldate.h ;
-parse this file if you need to get the release version of
-the currently installed userland.
-.It Li KERN_OSRELEASE
-The system release string.
-.It Li KERN_OSREV
-The system revision string.
-.It Li KERN_OSTYPE
-The system type string.
-.It Li KERN_POSIX1
-The version of
-.St -p1003.1
-with which the system
-attempts to comply.
-.It Li KERN_PROC
-Return the entire process table, or a subset of it.
-An array of
-.Va struct kinfo_proc
-structures is returned,
-whose size depends on the current number of such objects in the system.
-The third and fourth level names are as follows:
-.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
-.It "Third level name  Fourth level is:"
-.It "KERN_PROC_ALL     None"
-.It "KERN_PROC_PID     A process ID"
-.It "KERN_PROC_PGRP    A process group"
-.It "KERN_PROC_TTY     A tty device"
-.It "KERN_PROC_UID     A user ID"
-.It "KERN_PROC_RUID    A real user ID"
-.El
-.It Li KERN_PROF
-Return profiling information about the kernel.
-If the kernel is not compiled for profiling,
-attempts to retrieve any of the KERN_PROF values will
-fail with
-.Er ENOENT .
-The third level names for the string and integer profiling information
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
-.It Sy "Third level name       Type    Changeable"
-.It "GPROF_STATE       integer yes"
-.It "GPROF_COUNT       u_short[\|]     yes"
-.It "GPROF_FROMS       u_short[\|]     yes"
-.It "GPROF_TOS struct tostruct yes"
-.It "GPROF_GMONPARAM   struct gmonparam        no"
-.El
-.Pp
-The variables are as follows:
-.Bl -tag -width 6n
-.It Li GPROF_STATE
-Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
-is running or stopped.
-.It Li GPROF_COUNT
-Array of statistical program counter counts.
-.It Li GPROF_FROMS
-Array indexed by program counter of call-from points.
-.It Li GPROF_TOS
-Array of
-.Va struct tostruct
-describing destination of calls and their counts.
-.It Li GPROF_GMONPARAM
-Structure giving the sizes of the above arrays.
-.El
-.It Li KERN_QUANTUM
-The maximum period of time, in microseconds, for which a process is allowed
-to run without being preempted if other processes are in the run queue.
-.It Li KERN_SAVED_IDS
-Returns 1 if saved set-group and saved set-user ID is available.
-.It Li KERN_SECURELVL
-The system security level.
-This level may be raised by processes with appropriate privilege.
-It may not be lowered.
-.It Li KERN_VERSION
-The system version string.
-.It Li KERN_VNODE
-Return the entire vnode table.
-Note, the vnode table is not necessarily a consistent snapshot of
-the system.
-The returned data consists of an array whose size depends on the
-current number of such objects in the system.
-Each element of the array contains the kernel address of a vnode
-.Va struct vnode *
-followed by the vnode itself
-.Va struct vnode .
-.El
-.Ss CTL_MACHDEP
-The set of variables defined is architecture dependent.
-The following variables are defined for the i386 architecture.
-.Bl -column "CONSOLE_DEVICEXXX" "struct bootinfoXXX" -offset indent
-.It Sy "Second level name      Type    Changeable"
-.It Li "CPU_CONSDEV    dev_t   no"
-.It Li "CPU_ADJKERNTZ  int     yes"
-.It Li "CPU_DISRTCSET  int     yes"
-.It Li "CPU_BOOTINFO   struct bootinfo no"
-.It Li "CPU_WALLCLOCK  int     yes"
-.El
-.Ss CTL_NET
-The string and integer information available for the CTL_NET level
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
-.It Sy "Second level name      Type    Changeable"
-.It "PF_ROUTE  routing messages        no"
-.It "PF_INET   IPv4 values     yes"
-.It "PF_INET6  IPv6 values     yes"
-.El
-.Pp
-.Bl -tag -width 6n
-.It Li PF_ROUTE
-Return the entire routing table or a subset of it.
-The data is returned as a sequence of routing messages (see
-.Xr route 4
-for the header file, format and meaning).
-The length of each message is contained in the message header.
-.Pp
-The third level name is a protocol number, which is currently always 0.
-The fourth level name is an address family, which may be set to 0 to
-select all address families.
-The fifth and sixth level names are as follows:
-.Bl -column "Fifth level nameXXXXXX" "Sixth level is:XXX" -offset indent
-.It Sy "Fifth level name       Sixth level is:"
-.It "NET_RT_FLAGS      rtflags"
-.It "NET_RT_DUMP       None"
-.It "NET_RT_IFLIST     0 or if_index"
-.It "NET_RT_IFMALIST   0 or if_index"
-.El
-.Pp
-The
-.Dv NET_RT_IFMALIST
-name returns information about multicast group memberships on all interfaces
-if 0 is specified, or for the interface specified by
-.Va if_index .
-.It Li PF_INET
-Get or set various global information about the IPv4
-(Internet Protocol version 4).
-The third level name is the protocol.
-The fourth level name is the variable name.
-The currently defined protocols and names are:
-.Bl -column ProtocolXX VariableXX TypeXX ChangeableXX
-.It Sy "Protocol       Variable        Type    Changeable"
-.It "icmp      bmcastecho      integer yes"
-.It "icmp      maskrepl        integer yes"
-.It "ip        forwarding      integer yes"
-.It "ip        redirect        integer yes"
-.It "ip        ttl     integer yes"
-.It "udp       checksum        integer yes"
-.El
-.Pp
-The variables are as follows:
-.Bl -tag -width 6n
-.It Li icmp.bmcastecho
-Returns 1 if an ICMP echo request to a broadcast or multicast address is
-to be answered.
-.It Li icmp.maskrepl
-Returns 1 if ICMP network mask requests are to be answered.
-.It Li ip.forwarding
-Returns 1 when IP forwarding is enabled for the host,
-meaning that the host is acting as a router.
-.It Li ip.redirect
-Returns 1 when ICMP redirects may be sent by the host.
-This option is ignored unless the host is routing IP packets,
-and should normally be enabled on all systems.
-.It Li ip.ttl
-The maximum time-to-live (hop count) value for an IP packet sourced by
-the system.
-This value applies to normal transport protocols, not to ICMP.
-.It Li udp.checksum
-Returns 1 when UDP checksums are being computed and checked.
-Disabling UDP checksums is strongly discouraged.
-.Pp
-For variables net.inet.*.ipsec, please refer to
-.Xr ipsec 4 .
-.El
-.It Li PF_INET6
-Get or set various global information about the IPv6
-(Internet Protocol version 6).
-The third level name is the protocol.
-The fourth level name is the variable name.
-.Pp
-For variables net.inet6.* please refer to
-.Xr inet6 4 .
-For variables net.inet6.*.ipsec6, please refer to
-.Xr ipsec 4 .
-.El
-.Ss CTL_USER
-The string and integer information available for the CTL_USER level
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
-.It Sy "Second level name      Type    Changeable"
-.It "USER_BC_BASE_MAX  integer no"
-.It "USER_BC_DIM_MAX   integer no"
-.It "USER_BC_SCALE_MAX integer no"
-.It "USER_BC_STRING_MAX        integer no"
-.It "USER_COLL_WEIGHTS_MAX     integer no"
-.It "USER_CS_PATH      string  no"
-.It "USER_EXPR_NEST_MAX        integer no"
-.It "USER_LINE_MAX     integer no"
-.It "USER_POSIX2_CHAR_TERM     integer no"
-.It "USER_POSIX2_C_BIND        integer no"
-.It "USER_POSIX2_C_DEV integer no"
-.It "USER_POSIX2_FORT_DEV      integer no"
-.It "USER_POSIX2_FORT_RUN      integer no"
-.It "USER_POSIX2_LOCALEDEF     integer no"
-.It "USER_POSIX2_SW_DEV        integer no"
-.It "USER_POSIX2_UPE   integer no"
-.It "USER_POSIX2_VERSION       integer no"
-.It "USER_RE_DUP_MAX   integer no"
-.It "USER_STREAM_MAX   integer no"
-.It "USER_TZNAME_MAX   integer no"
-.El
-.Bl -tag -width 6n
-.Pp
-.It Li USER_BC_BASE_MAX
-The maximum ibase/obase values in the
-.Xr bc 1
-utility.
-.It Li USER_BC_DIM_MAX
-The maximum array size in the
-.Xr bc 1
-utility.
-.It Li USER_BC_SCALE_MAX
-The maximum scale value in the
-.Xr bc 1
-utility.
-.It Li USER_BC_STRING_MAX
-The maximum string length in the
-.Xr bc 1
-utility.
-.It Li USER_COLL_WEIGHTS_MAX
-The maximum number of weights that can be assigned to any entry of
-the LC_COLLATE order keyword in the locale definition file.
-.It Li USER_CS_PATH
-Return a value for the
-.Ev PATH
-environment variable that finds all the standard utilities.
-.It Li USER_EXPR_NEST_MAX
-The maximum number of expressions that can be nested within
-parenthesis by the
-.Xr expr 1
-utility.
-.It Li USER_LINE_MAX
-The maximum length in bytes of a text-processing utility's input
-line.
-.It Li USER_POSIX2_CHAR_TERM
-Return 1 if the system supports at least one terminal type capable of
-all operations described in
-.St -p1003.2 ,
-otherwise 0.
-.It Li USER_POSIX2_C_BIND
-Return 1 if the system's C-language development facilities support the
-C-Language Bindings Option, otherwise 0.
-.It Li USER_POSIX2_C_DEV
-Return 1 if the system supports the C-Language Development Utilities Option,
-otherwise 0.
-.It Li USER_POSIX2_FORT_DEV
-Return 1 if the system supports the FORTRAN Development Utilities Option,
-otherwise 0.
-.It Li USER_POSIX2_FORT_RUN
-Return 1 if the system supports the FORTRAN Runtime Utilities Option,
-otherwise 0.
-.It Li USER_POSIX2_LOCALEDEF
-Return 1 if the system supports the creation of locales, otherwise 0.
-.It Li USER_POSIX2_SW_DEV
-Return 1 if the system supports the Software Development Utilities Option,
-otherwise 0.
-.It Li USER_POSIX2_UPE
-Return 1 if the system supports the User Portability Utilities Option,
-otherwise 0.
-.It Li USER_POSIX2_VERSION
-The version of
-.St -p1003.2
-with which the system attempts to comply.
-.It Li USER_RE_DUP_MAX
-The maximum number of repeated occurrences of a regular expression
-permitted when using interval notation.
-.It Li USER_STREAM_MAX
-The minimum maximum number of streams that a process may have open
-at any one time.
-.It Li USER_TZNAME_MAX
-The minimum maximum number of types supported for the name of a
-timezone.
-.El
-.Ss CTL_VM
-The string and integer information available for the CTL_VM level
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
-.It Sy "Second level name      Type    Changeable"
-.It "VM_LOADAVG        struct loadavg  no"
-.It "VM_PAGEOUT_ALGORITHM      integer yes"
-.It "VM_SWAPPING_ENABLED       integer maybe"
-.It "VM_V_CACHE_MAX    integer yes"
-.It "VM_V_CACHE_MIN    integer yes"
-.It "VM_V_FREE_MIN     integer yes"
-.It "VM_V_FREE_RESERVED        integer yes"
-.It "VM_V_FREE_TARGET  integer yes"
-.It "VM_V_INACTIVE_TARGET      integer yes"
-.It "VM_V_PAGEOUT_FREE_MIN     integer yes"
-.El
-.Pp
-.Bl -tag -width 6n
-.It Li VM_LOADAVG
-Return the load average history.
-The returned data consists of a
-.Va struct loadavg .
-.It Li VM_PAGEOUT_ALGORITHM
-0 if the statistics-based page management algorithm is in use
-or 1 if the near-LRU algorithm is in use.
-.It Li VM_SWAPPING_ENABLED
-1 if process swapping is enabled or 0 if disabled.
-This variable is
-permanently set to 0 if the kernel was built with swapping disabled.
-.It Li VM_V_CACHE_MAX
-Maximum desired size of the cache queue.
-.It Li VM_V_CACHE_MIN
-Minimum desired size of the cache queue.
-If the cache queue size
-falls very far below this value, the pageout daemon is awakened.
-.It Li VM_V_FREE_MIN
-Minimum amount of memory (cache memory plus free memory)
-required to be available before a process waiting on memory will be
-awakened.
-.It Li VM_V_FREE_RESERVED
-Processes will awaken the pageout daemon and wait for memory if the
-number of free and cached pages drops below this value.
-.It Li VM_V_FREE_TARGET
-The total amount of free memory (including cache memory) that the
-pageout daemon tries to maintain.
-.It Li VM_V_INACTIVE_TARGET
-The desired number of inactive pages that the pageout daemon should
-achieve when it runs.
-Inactive pages can be quickly inserted into
-process address space when needed.
-.It Li VM_V_PAGEOUT_FREE_MIN
-If the amount of free and cache memory falls below this value, the
-pageout daemon will enter "memory conserving mode" to avoid deadlock.
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following errors may be reported:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The buffer
-.Fa name ,
-.Fa oldp ,
-.Fa newp ,
-or length pointer
-.Fa oldlenp
-contains an invalid address.
-.It Bq Er EINVAL
-The
-.Fa name
-array is less than two or greater than CTL_MAXNAME.
-.It Bq Er EINVAL
-A non-null
-.Fa newp
-is given and its specified length in
-.Fa newlen
-is too large or too small.
-.It Bq Er ENOMEM
-The length pointed to by
-.Fa oldlenp
-is too short to hold the requested value.
-.It Bq Er ENOMEM
-The smaller of either the length pointed to by
-.Fa oldlenp
-or the estimated size of the returned data exceeds the
-system limit on locked memory.
-.It Bq Er ENOMEM
-Locking the buffer
-.Fa oldp ,
-or a portion of the buffer if the estimated size of the data
-to be returned is smaller,
-would cause the process to exceed its per-process locked memory limit.
-.It Bq Er ENOTDIR
-The
-.Fa name
-array specifies an intermediate rather than terminal name.
-.It Bq Er EISDIR
-The
-.Fa name
-array specifies a terminal name, but the actual name is not terminal.
-.It Bq Er ENOENT
-The
-.Fa name
-array specifies a value that is unknown.
-.It Bq Er EPERM
-An attempt is made to set a read-only value.
-.It Bq Er EPERM
-A process without appropriate privilege attempts to set a value.
-.El
-.Sh FILES
-.Bl -tag -width <netinet/icmpXvar.h> -compact
-.It In sys/sysctl.h
-definitions for top level identifiers, second level kernel and hardware
-identifiers, and user level identifiers
-.It In sys/socket.h
-definitions for second level network identifiers
-.It In sys/gmon.h
-definitions for third level profiling identifiers
-.It In mach/vm_param.h
-definitions for second level virtual memory identifiers
-.It In netinet/in.h
-definitions for third level IPv4/IPv6 identifiers and
-fourth level IPv4/v6 identifiers
-.It In netinet/icmp_var.h
-definitions for fourth level ICMP identifiers
-.It In netinet/icmp6.h
-definitions for fourth level ICMPv6 identifiers
-.It In netinet/udp_var.h
-definitions for fourth level UDP identifiers
-.El
-.Sh SEE ALSO
-.Xr sysconf 3 ,
-.Xr sysctl 8
-.Sh HISTORY
-The
-.Fn sysctl
-function first appeared in
-.Bx 4.4 .
diff --git a/gen/sysctlbyname-fbsd.c b/gen/sysctlbyname-fbsd.c
deleted file mode 120000 (symlink)
index b04c734..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./sysctlbyname.c
\ No newline at end of file
diff --git a/gen/sysctlnametomib-fbsd.c b/gen/sysctlnametomib-fbsd.c
deleted file mode 120000 (symlink)
index 47688f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./sysctlnametomib.c
\ No newline at end of file
diff --git a/gen/telldir-fbsd.c b/gen/telldir-fbsd.c
deleted file mode 100644 (file)
index 355ed50..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)telldir.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.11 2008/05/05 14:05:23 kib Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <dirent.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "telldir.h"
-
-/*
- * The option SINGLEUSE may be defined to say that a telldir
- * cookie may be used only once before it is freed. This option
- * is used to avoid having memory usage grow without bound.
- */
-#if !__DARWIN_UNIX03
-#define SINGLEUSE
-#endif /* !__DARWIN_UNIX03 */
-
-/*
- * return a pointer into a directory
- */
-long
-telldir(dirp)
-       DIR *dirp;
-{
-       struct ddloc *lp;
-
-#if __DARWIN_UNIX03
-       if (__isthreaded)
-               _pthread_mutex_lock(&dirp->dd_lock);
-       LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) {
-               if (
-#if __DARWIN_64_BIT_INO_T
-                   (lp->loc_seek == dirp->dd_td->seekoff)
-#else /* !__DARWIN_64_BIT_INO_T */
-                   (lp->loc_seek == dirp->dd_seek)
-#endif /* __DARWIN_64_BIT_INO_T */
-                   && (lp->loc_loc == dirp->dd_loc))
-                       goto found;
-       }
-       if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) {
-               if (__isthreaded)
-                       _pthread_mutex_unlock(&dirp->dd_lock);
-               return (-1);
-       }
-#else /* !__DARWIN_UNIX03 */
-       if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL)
-               return (-1);
-       if (__isthreaded)
-               _pthread_mutex_lock(&dirp->dd_lock);
-#endif /* __DARWIN_UNIX03 */
-       lp->loc_index = dirp->dd_td->td_loccnt++;
-#if __DARWIN_64_BIT_INO_T
-       lp->loc_seek = dirp->dd_td->seekoff;
-#else /* !__DARWIN_64_BIT_INO_T */
-       lp->loc_seek = dirp->dd_seek;
-#endif /* __DARWIN_64_BIT_INO_T */
-       lp->loc_loc = dirp->dd_loc;
-       LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe);
-#if __DARWIN_UNIX03
-found:
-#endif /* __DARWIN_UNIX03 */
-       if (__isthreaded)
-               _pthread_mutex_unlock(&dirp->dd_lock);
-       return (lp->loc_index);
-}
-
-/*
- * seek to an entry in a directory.
- * Only values returned by "telldir" should be passed to seekdir.
- */
-void
-_seekdir(dirp, loc)
-       DIR *dirp;
-       long loc;
-{
-       struct ddloc *lp;
-       struct dirent *dp;
-
-       LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) {
-               if (lp->loc_index == loc)
-                       break;
-       }
-       if (lp == NULL)
-               return;
-       if (lp->loc_loc == dirp->dd_loc && 
-#if __DARWIN_64_BIT_INO_T
-           lp->loc_seek == dirp->dd_td->seekoff
-#else /* !__DARWIN_64_BIT_INO_T */
-           lp->loc_seek == dirp->dd_seek
-#endif /* __DARWIN_64_BIT_INO_T */
-       )
-               goto found;
-       (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET);
-#if __DARWIN_64_BIT_INO_T
-       dirp->dd_td->seekoff = lp->loc_seek;
-#else /* !__DARWIN_64_BIT_INO_T */
-       dirp->dd_seek = lp->loc_seek;
-#endif /* __DARWIN_64_BIT_INO_T */
-       dirp->dd_loc = 0;
-       while (dirp->dd_loc < lp->loc_loc) {
-               dp = _readdir_unlocked(dirp, 0);
-               if (dp == NULL)
-                       break;
-       }
-found:;
-#ifdef SINGLEUSE
-       LIST_REMOVE(lp, loc_lqe);
-       free((caddr_t)lp);
-#endif
-}
-
-#ifndef BUILDING_VARIANT
-/*
- * Reclaim memory for telldir cookies which weren't used.
- */
-void
-_reclaim_telldir(dirp)
-       DIR *dirp;
-{
-       struct ddloc *lp;
-       struct ddloc *templp;
-
-       lp = LIST_FIRST(&dirp->dd_td->td_locq);
-       while (lp != NULL) {
-               templp = lp;
-               lp = LIST_NEXT(lp, loc_lqe);
-               free(templp);
-       }
-       LIST_INIT(&dirp->dd_td->td_locq);
-}
-#endif /* !BUILDING_VARIANT */
diff --git a/gen/telldir.h b/gen/telldir.h
deleted file mode 100644 (file)
index c1f0ad0..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Copyright (c) 2000
- *     Daniel Eischen.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/gen/telldir.h,v 1.3 2008/05/05 14:05:23 kib Exp $
- */
-
-#ifndef _TELLDIR_H_
-#define        _TELLDIR_H_
-
-#include <sys/queue.h>
-
-/*
- * One of these structures is malloced to describe the current directory
- * position each time telldir is called. It records the current magic
- * cookie returned by getdirentries and the offset within the buffer
- * associated with that return value.
- */
-struct ddloc {
-       LIST_ENTRY(ddloc) loc_lqe; /* entry in list */
-       long    loc_index;      /* key associated with structure */
-#if __DARWIN_64_BIT_INO_T
-       __darwin_off_t  loc_seek;       /* returned by lseek */
-#else /* !__DARWIN_64_BIT_INO_T */
-       long    loc_seek;       /* magic cookie returned by getdirentries */
-#endif /* __DARWIN_64_BIT_INO_T */
-       long    loc_loc;        /* offset of entry in buffer */
-};
-
-/*
- * One of these structures is malloced for each DIR to record telldir
- * positions.
- */
-struct _telldir {
-       LIST_HEAD(, ddloc) td_locq; /* list of locations */
-       long    td_loccnt;      /* index of entry for sequential readdir's */
-#if __DARWIN_64_BIT_INO_T
-       __darwin_off_t seekoff; /* 64-bit seek offset */
-#endif /* __DARWIN_64_BIT_INO_T */
-};
-
-#if __DARWIN_64_BIT_INO_T
-size_t         __getdirentries64(int fd, void *buf, size_t bufsize, __darwin_off_t *basep);
-#endif /* __DARWIN_64_BIT_INO_T */
-struct dirent  *_readdir_unlocked(DIR *, int) __DARWIN_INODE64(_readdir_unlocked);
-void           _reclaim_telldir(DIR *);
-void           _seekdir(DIR *, long) __DARWIN_ALIAS_I(_seekdir);
-long           telldir(DIR *) __DARWIN_ALIAS_I(telldir);
-
-#endif
diff --git a/gen/termios-fbsd.c b/gen/termios-fbsd.c
deleted file mode 100644 (file)
index ab540d6..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)termios.c  8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.16 2009/05/07 13:49:48 ed Exp $");
-
-#if __DARWIN_UNIX03
-#ifdef VARIANT_CANCELABLE
-#include <pthread.h>
-
-extern void _pthread_testcancel(pthread_t thread, int isconforming);
-#endif /* VARIANT_CANCELABLE */
-#endif /* __DARWIN_UNIX03 */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include <errno.h>
-#include <termios.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#ifndef BUILDING_VARIANT
-int
-tcgetattr(fd, t)
-       int fd;
-       struct termios *t;
-{
-
-       return (_ioctl(fd, TIOCGETA, t));
-}
-
-int
-tcsetattr(fd, opt, t)
-       int fd, opt;
-       const struct termios *t;
-{
-       struct termios localterm;
-
-       if (opt & TCSASOFT) {
-               localterm = *t;
-               localterm.c_cflag |= CIGNORE;
-               t = &localterm;
-       }
-       switch (opt & ~TCSASOFT) {
-       case TCSANOW:
-               return (_ioctl(fd, TIOCSETA, t));
-       case TCSADRAIN:
-               return (_ioctl(fd, TIOCSETAW, t));
-       case TCSAFLUSH:
-               return (_ioctl(fd, TIOCSETAF, t));
-       default:
-               errno = EINVAL;
-               return (-1);
-       }
-}
-
-int
-tcsetpgrp(int fd, pid_t pgrp)
-{
-       int s;
-
-       if (isatty(fd) == 0)
-               return (-1);
-
-       s = pgrp;
-       return (_ioctl(fd, TIOCSPGRP, &s));
-}
-
-pid_t
-tcgetpgrp(fd)
-       int fd;
-{
-       int s;
-
-       if (isatty(fd) == 0)
-               return ((pid_t)-1);
-
-       if (_ioctl(fd, TIOCGPGRP, &s) < 0)
-               return ((pid_t)-1);
-
-       return ((pid_t)s);
-}
-
-#if 0 // Needs API review first
-pid_t
-tcgetsid(int fd)
-{
-       int s;
-
-       if (_ioctl(fd, TIOCGSID, &s) < 0)
-               return ((pid_t)-1);
-
-       return ((pid_t)s);
-}
-
-int
-tcsetsid(int fd, pid_t pid)
-{
-
-       if (pid != getsid(0)) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       return (_ioctl(fd, TIOCSCTTY, NULL));
-}
-#endif
-
-speed_t
-cfgetospeed(t)
-       const struct termios *t;
-{
-
-       return (t->c_ospeed);
-}
-
-speed_t
-cfgetispeed(t)
-       const struct termios *t;
-{
-
-       return (t->c_ispeed);
-}
-
-int
-cfsetospeed(t, speed)
-       struct termios *t;
-       speed_t speed;
-{
-
-       t->c_ospeed = speed;
-       return (0);
-}
-
-int
-cfsetispeed(t, speed)
-       struct termios *t;
-       speed_t speed;
-{
-
-       t->c_ispeed = speed;
-       return (0);
-}
-
-int
-cfsetspeed(t, speed)
-       struct termios *t;
-       speed_t speed;
-{
-
-       t->c_ispeed = t->c_ospeed = speed;
-       return (0);
-}
-
-/*
- * Make a pre-existing termios structure into "raw" mode: character-at-a-time
- * mode with no characters interpreted, 8-bit data path.
- */
-void
-cfmakeraw(t)
-       struct termios *t;
-{
-
-       t->c_iflag &= ~(IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR);
-       t->c_iflag |= IGNBRK;
-       t->c_oflag &= ~OPOST;
-       t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP|PENDIN);
-       t->c_cflag &= ~(CSIZE|PARENB);
-       t->c_cflag |= CS8|CREAD;
-       t->c_cc[VMIN] = 1;
-       t->c_cc[VTIME] = 0;
-}
-
-int
-tcsendbreak(fd, len)
-       int fd, len;
-{
-       struct timeval sleepytime;
-
-       sleepytime.tv_sec = 0;
-       sleepytime.tv_usec = 400000;
-       if (_ioctl(fd, TIOCSBRK, 0) == -1)
-               return (-1);
-       (void)_select(0, 0, 0, 0, &sleepytime);
-       if (_ioctl(fd, TIOCCBRK, 0) == -1)
-               return (-1);
-       return (0);
-}
-#endif /* BUILDING_VARIANT */
-
-int
-__tcdrain(fd)
-       int fd;
-{
-#if __DARWIN_UNIX03
-#ifdef VARIANT_CANCELABLE
-       _pthread_testcancel(pthread_self(), 1);
-#endif /* VARIANT_CANCELABLE */
-#endif /* __DARWIN_UNIX03 */
-       return (_ioctl(fd, TIOCDRAIN, 0));
-}
-
-__weak_reference(__tcdrain, tcdrain);
-__weak_reference(__tcdrain, _tcdrain);
-
-#ifndef BUILDING_VARIANT
-int
-tcflush(fd, which)
-       int fd, which;
-{
-       int com;
-
-       switch (which) {
-       case TCIFLUSH:
-               com = FREAD;
-               break;
-       case TCOFLUSH:
-               com = FWRITE;
-               break;
-       case TCIOFLUSH:
-               com = FREAD | FWRITE;
-               break;
-       default:
-               errno = EINVAL;
-               return (-1);
-       }
-       return (_ioctl(fd, TIOCFLUSH, &com));
-}
-
-int
-tcflow(fd, action)
-       int fd, action;
-{
-       struct termios term;
-       u_char c;
-
-       switch (action) {
-       case TCOOFF:
-               return (_ioctl(fd, TIOCSTOP, 0));
-       case TCOON:
-               return (_ioctl(fd, TIOCSTART, 0));
-       case TCION:
-               return (_ioctl(fd, TIOCIXON, 0));
-       case TCIOFF:
-               return (_ioctl(fd, TIOCIXOFF, 0));
-       default:
-               errno = EINVAL;
-               return (-1);
-       }
-       /* NOTREACHED */
-}
-#endif /* BUILDING_VARIANT */
index 3004f5fe8b8950c0be01229df1b885bfcefa141a..a145831006ac553d80180687926a08cbc9cdb86b 100644 (file)
@@ -28,7 +28,7 @@
 #include <mach/vm_statistics.h>
 #include <stdlib.h>
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
 #define FP_LINK_OFFSET 1
 #elif defined(__ppc__) || defined(__ppc64__)
 #define FP_LINK_OFFSET 2
@@ -39,7 +39,7 @@
 #define        INSTACK(a)      ((a) >= stackbot && (a) <= stacktop)
 #if defined(__ppc__) || defined(__ppc64__) || defined(__x86_64__)
 #define        ISALIGNED(a)    ((((uintptr_t)(a)) & 0xf) == 0)
-#elif defined(__arm__)
+#elif defined(__arm__) 
 #define        ISALIGNED(a)    ((((uintptr_t)(a)) & 0x1) == 0)
 #elif defined(__i386__)
 #define        ISALIGNED(a)    ((((uintptr_t)(a)) & 0xf) == 8)
@@ -67,7 +67,7 @@ _thread_stack_pcs(vm_address_t *buffer, unsigned max, unsigned *nb, unsigned ski
      * optimization).  We now inline the code to get the stack frame pointer,
      * so we are consistent about the stack frame.
      */
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
     frame = __builtin_frame_address(0);
 #elif defined(__ppc__) || defined(__ppc64__)
     /* __builtin_frame_address IS BROKEN IN BEAKER: RADAR #2340421 */
diff --git a/gen/time-fbsd.c b/gen/time-fbsd.c
deleted file mode 100644 (file)
index d77e38a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)time.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/time.c,v 1.5 2007/01/09 00:27:55 imp Exp $");
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <fenv.h>
-
-time_t
-time(t)
-       time_t *t;
-{
-       struct timeval tt;
-       time_t retval;
-#ifdef FE_DFL_ENV
-       fenv_t fenv;
-#endif /* FE_DFL_ENV */
-
-#ifdef FE_DFL_ENV
-       fegetenv(&fenv); /* 3965505 - need to preserve floating point enviroment */
-#endif /* FE_DFL_ENV */
-       if (gettimeofday(&tt, (struct timezone *)0) < 0)
-               retval = -1;
-       else
-               retval = tt.tv_sec;
-       if (t != NULL)
-               *t = retval;
-#ifdef FE_DFL_ENV
-       fesetenv(&fenv);
-#endif /* FE_DFL_ENV */
-       return (retval);
-}
diff --git a/gen/time.3 b/gen/time.3
deleted file mode 100644 (file)
index e694537..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)time.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/time.3,v 1.15 2007/01/09 00:27:55 imp Exp $
-.\"
-.Dd July 18, 2003
-.Dt TIME 3
-.Os
-.Sh NAME
-.Nm time
-.Nd get time of day
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In time.h
-.Ft time_t
-.Fn time "time_t *tloc"
-.Sh DESCRIPTION
-The
-.Fn time
-function
-returns the value of time in seconds since 0 hours, 0 minutes,
-0 seconds, January 1, 1970, Coordinated Universal Time,
-without including leap seconds.
-If an error occurs,
-.Fn time
-returns the value
-.Po Vt time_t Pc Ns \-1 .
-.Pp
-The return value is also stored in
-.No \&* Ns Va tloc ,
-provided that
-.Va tloc
-is non-null.
-.Sh ERRORS
-The
-.Fn time
-function may fail for any of the reasons described in
-.Xr gettimeofday 2 .
-.Sh SEE ALSO
-.Xr gettimeofday 2 ,
-.Xr ctime 3
-.Sh STANDARDS
-The
-.Nm
-function conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-A
-.Fn time
-function appeared in
-.At v6 .
-.Sh BUGS
-Neither
-.St -isoC-99
-nor
-.St -p1003.1-2001
-requires
-.Fn time
-to set
-.Va errno
-on failure; thus, it is impossible for an application to distinguish
-the valid time value \-1 (representing the last UTC second of 1969)
-from the error return value.
-.Pp
-Systems conforming to earlier versions of the C and
-.Tn POSIX
-standards (including older versions of
-.Fx )
-did not set
-.No \&* Ns Va tloc
-in the error case.
diff --git a/gen/times-fbsd.c b/gen/times-fbsd.c
deleted file mode 120000 (symlink)
index 4391258..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./times.c
\ No newline at end of file
diff --git a/gen/times.3 b/gen/times.3
deleted file mode 100644 (file)
index f8e5f01..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)times.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/times.3,v 1.10 2001/10/01 16:08:51 ru Exp $
-.\"
-.Dd June 4, 1993
-.Dt TIMES 3
-.Os
-.Sh NAME
-.Nm times
-.Nd process times
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/times.h
-.Ft clock_t
-.Fo times
-.Fa "struct tms *buffer"
-.Fc
-.Sh DESCRIPTION
-.Bf -symbolic
-This interface is obsoleted by
-.Xr getrusage 2
-and
-.Xr gettimeofday 2 .
-.Ef
-.Pp
-The
-.Fn times
-function returns the value of time in
-.Dv CLK_TCK Ns 's
-of a second since
-0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal
-Time.
-.Pp
-It also fills in the structure pointed to by
-.Fa buffer
-with time-accounting information.
-.Pp
-The
-.Vt tms
-structure is defined as follows:
-.Bd -literal -offset indent
-struct tms {
-       clock_t tms_utime;
-       clock_t tms_stime;
-       clock_t tms_cutime;
-       clock_t tms_cstime;
-};
-.Ed
-.Pp
-The elements of this structure are defined as follows:
-.Bl -tag -width ".Va tms_cutime"
-.It Va tms_utime
-The
-.Tn CPU
-time charged for the execution of user instructions.
-.It Va tms_stime
-The
-.Tn CPU
-time charged for execution by the system on behalf of
-the process.
-.It Va tms_cutime
-The sum of the
-.Va tms_utime Ns s
-and
-.Va tms_cutime Ns s
-of the child processes.
-.It Va tms_cstime
-The sum of the
-.Fa tms_stime Ns s
-and
-.Fa tms_cstime Ns s
-of the child processes.
-.El
-.Pp
-All times are in
-.Dv CLK_TCK Ns 's
-of a second.
-.Pp
-The times of a terminated child process are included in the
-.Va tms_cutime
-and
-.Va tms_cstime
-elements of the parent when one of the
-.Xr wait 2
-functions returns the process ID of the terminated child to the parent.
-If an error occurs,
-.Fn times
-returns the value
-.Pq Po Vt clock_t Pc Ns \-1 ,
-and sets
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The
-.Fn times
-function
-may fail and set the global variable
-.Va errno
-for any of the errors specified for the library
-routines
-.Xr getrusage 2
-and
-.Xr gettimeofday 2 .
-.Sh SEE ALSO
-.Xr time 1 ,
-.Xr getrusage 2 ,
-.Xr gettimeofday 2 ,
-.Xr wait 2 ,
-.Xr clocks 7
-.Sh STANDARDS
-The
-.Fn times
-function
-conforms to
-.St -p1003.1-88 .
diff --git a/gen/timezone-fbsd.c b/gen/timezone-fbsd.c
deleted file mode 120000 (symlink)
index acd447d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./timezone.c
\ No newline at end of file
diff --git a/gen/timezone.3 b/gen/timezone.3
deleted file mode 120000 (symlink)
index 39479a8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./timezone.3
\ No newline at end of file
diff --git a/gen/ttyname-fbsd.c b/gen/ttyname-fbsd.c
deleted file mode 100644 (file)
index aa5483a..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ttyname.c  8.2 (Berkeley) 1/27/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/ttyname.c,v 1.16 2004/01/06 18:26:14 nectar Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <unistd.h>
-#include <string.h>
-#include <paths.h>
-#include <pthread.h>
-#include <errno.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-
-#ifndef BUILDING_VARIANT
-static pthread_once_t ttyname_buf_control = PTHREAD_ONCE_INIT;
-static char *buf = NULL;
-static char *ttyname_threaded(int fd);
-static char *ttyname_unthreaded(int fd);
-
-static pthread_mutex_t ttyname_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_key_t   ttyname_key;
-static int             ttyname_init = 0;
-
-char *
-ttyname(int fd)
-{
-       char           *ret;
-
-       if (__isthreaded == 0)
-               ret = ttyname_unthreaded(fd);
-       else
-               ret = ttyname_threaded(fd);
-       return (ret);
-}
-#endif /* !BUILDING_VARIANT */
-
-#if __DARWIN_UNIX03
-int
-#else /* !__DARWIN_UNIX03 */
-char *
-#endif /* __DARWIN_UNIX03 */
-ttyname_r(int fd, char *thrbuf, size_t len)
-{
-       struct stat     sb;
-
-#if __DARWIN_UNIX03
-       if (_fstat(fd, &sb) < 0)
-               return (EBADF);
-       /* Must be a terminal. */
-       if (!isatty(fd))
-               return (ENOTTY);
-       /* Must be a character device. */
-       if (!S_ISCHR(sb.st_mode))
-               return (ENOTTY);
-       /* Must have enough room */
-       if (len <= sizeof(_PATH_DEV))
-               return (ERANGE);
-#else /* !__DARWIN_UNIX03 */
-       /* Must be a terminal. */
-       if (!isatty(fd))
-               return (NULL);
-       /* Must be a character device. */
-       if (_fstat(fd, &sb))
-               return (NULL);
-       if (!S_ISCHR(sb.st_mode)) {
-               errno = ENOTTY;
-               return (NULL);
-       }
-       /* Must have enough room */
-       if (len <= sizeof(_PATH_DEV)) {
-               errno = ERANGE;
-               return (NULL);
-       }
-#endif /* __DARWIN_UNIX03 */
-
-       strlcpy(thrbuf, _PATH_DEV, len);
-       if (devname_r(sb.st_rdev, S_IFCHR,
-           thrbuf + strlen(thrbuf), len - strlen(thrbuf)) == NULL)
-#if __DARWIN_UNIX03
-               return (ERANGE);
-       return (0);
-#else /* !__DARWIN_UNIX03 */
-       {
-               errno = ERANGE;
-               return (NULL);
-       }
-       return (thrbuf);
-#endif /* __DARWIN_UNIX03 */
-}
-
-#ifndef BUILDING_VARIANT
-static char *
-ttyname_threaded(int fd)
-{
-       char    *buf;
-
-       if (ttyname_init == 0) {
-               _pthread_mutex_lock(&ttyname_lock);
-               if (ttyname_init == 0) {
-                       /* __PTK_LIBC_TTYNAME_KEY */
-                       ttyname_key = __LIBC_PTHREAD_KEY_TTYNAME;
-                       if (pthread_key_init_np(ttyname_key, free)) {
-                               int save = errno;
-                               _pthread_mutex_unlock(&ttyname_lock);
-                               errno = save;
-                               return (NULL);
-                       }
-                       ttyname_init = 1;
-               }
-               _pthread_mutex_unlock(&ttyname_lock);
-       }
-
-       /* Must have thread specific data field to put data */
-       if ((buf = _pthread_getspecific(ttyname_key)) == NULL) {
-               if ((buf = malloc(sizeof(_PATH_DEV) + MAXNAMLEN)) != NULL) {
-                       if (_pthread_setspecific(ttyname_key, buf) != 0) {
-                               int save = errno;
-                               free(buf);
-                               errno = save;
-                               return (NULL);
-                       }
-               } else {
-                       return (NULL);
-               }
-       }
-#if __DARWIN_UNIX03
-       return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN) == 0 ? buf : NULL);
-#else /* !__DARWIN_UNIX03 */
-       return (ttyname_r(fd, buf, sizeof(_PATH_DEV) + MAXNAMLEN));
-#endif /* __DARWIN_UNIX03 */
-}
-
-static void
-ttyname_buf_allocate(void)
-{
-       buf = malloc(sizeof(_PATH_DEV) + MAXNAMLEN);
-}
-
-static char *
-ttyname_unthreaded(int fd)
-{
-       struct stat     sb;
-       struct termios  ttyb;
-
-       /* Must be a terminal. */
-       if (tcgetattr(fd, &ttyb) < 0)
-               return (NULL);
-       /* Must be a character device. */
-       if (_fstat(fd, &sb))
-               return (NULL);
-       if (!S_ISCHR(sb.st_mode)) {
-               errno = ENOTTY;
-               return (NULL);
-       }
-
-       if (pthread_once(&ttyname_buf_control, ttyname_buf_allocate)
-               || !buf) {
-               errno = ENOMEM;
-               return (NULL);
-       }
-
-       strlcpy(buf, _PATH_DEV, sizeof(_PATH_DEV) + MAXNAMLEN);
-       if (devname_r(sb.st_rdev, S_IFCHR,
-               buf + strlen(buf), sizeof(_PATH_DEV) + MAXNAMLEN - strlen(buf)) == NULL) {
-               errno = ERANGE;
-               return (NULL);
-       }
-       return (buf);
-}
-#endif /* !BUILDING_VARIANT */
diff --git a/gen/ttyname.3 b/gen/ttyname.3
deleted file mode 100644 (file)
index 0012549..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ttyname.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/ttyname.3,v 1.10 2002/12/18 13:33:02 ru Exp $
-.\"
-.Dd June 4, 1993
-.Dt TTYNAME 3
-.Os
-.Sh NAME
-.Nm isatty ,
-.Nm ttyname ,
-.Nm ttyslot
-.Nd get name of associated terminal (tty) from file descriptor
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fo isatty
-.Fa "int fildes"
-.Fc
-.Ft char *
-.Fo ttyname
-.Fa "int fildes"
-.Fc
-.Ft int
-.Fo ttyslot
-.Fa void
-.Fc
-.Sh DESCRIPTION
-These functions operate on the system file descriptors for terminal
-type devices.
-These descriptors are not related to the standard
-.Tn I/O
-.Dv FILE
-typedef, but refer to the special device files found in
-.Pa /dev
-and named
-.Pa /dev/tty Ns Ar xx
-and for which an entry exists
-in the initialization file
-.Pa /etc/ttys .
-(See
-.Xr ttys 5 . )
-.Pp
-The
-.Fn isatty
-function
-determines if the file descriptor
-.Fa fildes
-refers to a valid
-terminal type device.
-.Pp
-The
-.Fn ttyname
-function
-gets the related device name of
-a file descriptor for which
-.Fn isatty
-is true.
-.Pp
-The
-.Fn ttyslot
-function
-fetches the current process' control terminal number from the
-.Xr ttys 5
-file entry.
-.Sh RETURN VALUES
-The
-.Fn ttyname
-function
-returns the null terminated name if the device is found and
-.Fn isatty
-is true; otherwise, a
-.Dv NULL
-pointer is returned.
-.Pp
-The
-.Fn ttyslot
-function returns the unit number of the device file if found;
-otherwise, the value zero is returned.
-.Sh FILES
-.Bl -tag -width /etc/ttys -compact
-.It Pa /dev/\(**
-.It Pa /etc/ttys
-.El
-.Sh SEE ALSO
-.Xr ioctl 2 ,
-.Xr ttys 5
-.Sh HISTORY
-A
-.Fn isatty ,
-.Fn ttyname ,
-and
-.Fn ttyslot
-function
-appeared in
-.At v7 .
-.Sh BUGS
-The
-.Fn ttyname
-function leaves its result in an internal static object and returns
-a pointer to that object.
-Subsequent calls to
-.Fn ttyname
-will modify the same object.
diff --git a/gen/ttyslot-fbsd.c b/gen/ttyslot-fbsd.c
deleted file mode 120000 (symlink)
index 7e772b8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ttyslot.c
\ No newline at end of file
diff --git a/gen/ualarm-fbsd.c b/gen/ualarm-fbsd.c
deleted file mode 120000 (symlink)
index a1e562f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ualarm.c
\ No newline at end of file
diff --git a/gen/ualarm.3 b/gen/ualarm.3
deleted file mode 100644 (file)
index 01a681f..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     From: @(#)ualarm.3     8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/gen/ualarm.3,v 1.20 2007/01/09 00:27:56 imp Exp $
-.\"
-.Dd April 19, 1994
-.Dt UALARM 3
-.Os
-.Sh NAME
-.Nm ualarm
-.Nd schedule signal after specified time
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft useconds_t
-.Fo ualarm
-.Fa "useconds_t useconds"
-.Fa "useconds_t interval"
-.Fc
-.Sh DESCRIPTION
-.Bf -symbolic
-This is a simplified interface to
-.Xr setitimer 2 .
-.Ef
-.Pp
-The
-.Fn ualarm
-function
-waits a count of
-.Fa useconds
-before asserting the terminating signal
-.Dv SIGALRM .
-System activity or time used in processing the call may cause a slight
-delay.
-.Pp
-If the
-.Fa interval
-argument is non-zero, the
-.Dv SIGALRM
-signal will be sent
-to the process every
-.Fa interval
-microseconds after the timer expires (e.g., after
-.Fa useconds
-number of microseconds have passed).
-.Pp
-Due to a
-.Xr setitimer 2
-restriction, the maximum number of
-.Fa useconds
-and
-.Fa interval
-is limited to 100,000,000,000,000
-(in case this value fits in the unsigned integer).
-.Sh RETURN VALUES
-When the signal has successfully been caught,
-.Fn ualarm
-returns the amount of time left on the clock.
-.Sh NOTES
-A microsecond is 0.000001 seconds.
-.Sh SEE ALSO
-.Xr getitimer 2 ,
-.Xr setitimer 2 ,
-.Xr sigpause 2 ,
-.Xr sigvec 2 ,
-.Xr alarm 3 ,
-.Xr signal 3 ,
-.Xr sleep 3 ,
-.Xr usleep 3
-.Sh HISTORY
-The
-.Fn ualarm
-function appeared in
-.Bx 4.3 .
diff --git a/gen/ucontext.3 b/gen/ucontext.3
deleted file mode 120000 (symlink)
index 2defc9a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ucontext.3
\ No newline at end of file
diff --git a/gen/ulimit-fbsd.c b/gen/ulimit-fbsd.c
deleted file mode 120000 (symlink)
index 30722f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ulimit.c
\ No newline at end of file
diff --git a/gen/ulimit.3 b/gen/ulimit.3
deleted file mode 100644 (file)
index f19e152..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-.\" Copyright (c) 2002 Kyle Martin.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/gen/ulimit.3,v 1.5 2003/01/04 01:11:49 tjr Exp $
-.\"
-.Dd January 4, 2003
-.Dt ULIMIT 3
-.Os
-.Sh NAME
-.Nm ulimit
-.Nd get and set process limits
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ulimit.h
-.Ft long
-.Fo ulimit
-.Fa "int cmd"
-.Fa "..."
-.Fc
-.Sh DESCRIPTION
-The
-.Fn ulimit
-function will get and set process limits.
-Currently, this is limited to the maximum file size.
-The
-.Fa cmd
-argument is one of the following:
-.Bl -tag -width ".Dv UL_GETFSIZE"
-.It Dv UL_GETFSIZE
-will return the maximum file size of the current process,
-in units of 512-byte blocks.
-.It Dv UL_SETFSIZE
-will attempt to set the maximum file size of the current
-process and its children, using the second argument (expressed as a long).
-.El
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn ulimit
-returns the value requested;
-otherwise, the value \-1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn ulimit
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The command specified was invalid.
-.It Bq Er EPERM
-The limit specified to
-.Fn ulimit
-would have raised the maximum limit value,
-and the caller is not the super-user.
-.El
-.Sh SEE ALSO
-.Xr getrlimit 2
-.Sh STANDARDS
-The
-.Fn ulimit
-function conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn ulimit
-function first appeared in
-.Fx 5.0 .
-.Sh BUGS
-The
-.Fn ulimit
-function provides limited precision for
-setting and retrieving process limits.
-If there is a need for greater precision than the
-type
-.Vt long
-provides, the
-.Xr getrlimit 2
-and
-.Xr setrlimit 2
-functions should be considered.
diff --git a/gen/unvis-fbsd.c b/gen/unvis-fbsd.c
deleted file mode 100644 (file)
index da2efbf..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)unvis.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <ctype.h>
-#include <vis.h>
-
-/*
- * decode driven by state machine
- */
-#define        S_GROUND        0       /* haven't seen escape char */
-#define        S_START         1       /* start decoding special sequence */
-#define        S_META          2       /* metachar started (M) */
-#define        S_META1         3       /* metachar more, regular char (-) */
-#define        S_CTRL          4       /* control char started (^) */
-#define        S_OCTAL2        5       /* octal digit 2 */
-#define        S_OCTAL3        6       /* octal digit 3 */
-#define        S_HEX2          7       /* hex digit 2 */
-
-#define        S_HTTP          0x080   /* %HEXHEX escape */
-
-#define        isoctal(c)      (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
-#define        ishex(c)        ((((u_char)(c)) >= '0' && ((u_char)(c)) <= '9') || (((u_char)(c)) >= 'a' && ((u_char)(c)) <= 'f'))
-
-/*
- * unvis - decode characters previously encoded by vis
- */
-int
-unvis(char *cp, int c, int *astate, int flag)
-{
-       locale_t loc = __current_locale();
-
-       if (flag & UNVIS_END) {
-               if (*astate == S_OCTAL2 || *astate == S_OCTAL3) {
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               }
-               return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD);
-       }
-
-       switch (*astate & ~S_HTTP) {
-
-       case S_GROUND:
-               *cp = 0;
-               if (c == '\\') {
-                       *astate = S_START;
-                       return (0);
-               }
-               if (flag & VIS_HTTPSTYLE && c == '%') {
-                       *astate = S_START | S_HTTP;
-                       return (0);
-               }
-               *cp = c;
-               return (UNVIS_VALID);
-
-       case S_START:
-               if (*astate & S_HTTP) {
-                   if (ishex(tolower_l(c, loc))) {
-                       *cp = isdigit_l(c, loc) ? (c - '0') : (tolower_l(c, loc) - 'a');
-                       *astate = S_HEX2;
-                       return (0);
-                   }
-               }
-               switch(c) {
-               case '\\':
-                       *cp = c;
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case '0': case '1': case '2': case '3':
-               case '4': case '5': case '6': case '7':
-                       *cp = (c - '0');
-                       *astate = S_OCTAL2;
-                       return (0);
-               case 'M':
-                       *cp = 0200;
-                       *astate = S_META;
-                       return (0);
-               case '^':
-                       *astate = S_CTRL;
-                       return (0);
-               case 'n':
-                       *cp = '\n';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 'r':
-                       *cp = '\r';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 'b':
-                       *cp = '\b';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 'a':
-                       *cp = '\007';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 'v':
-                       *cp = '\v';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 't':
-                       *cp = '\t';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 'f':
-                       *cp = '\f';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 's':
-                       *cp = ' ';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case 'E':
-                       *cp = '\033';
-                       *astate = S_GROUND;
-                       return (UNVIS_VALID);
-               case '\n':
-                       /*
-                        * hidden newline
-                        */
-                       *astate = S_GROUND;
-                       return (UNVIS_NOCHAR);
-               case '$':
-                       /*
-                        * hidden marker
-                        */
-                       *astate = S_GROUND;
-                       return (UNVIS_NOCHAR);
-               }
-               *astate = S_GROUND;
-               return (UNVIS_SYNBAD);
-
-       case S_META:
-               if (c == '-')
-                       *astate = S_META1;
-               else if (c == '^')
-                       *astate = S_CTRL;
-               else {
-                       *astate = S_GROUND;
-                       return (UNVIS_SYNBAD);
-               }
-               return (0);
-
-       case S_META1:
-               *astate = S_GROUND;
-               *cp |= c;
-               return (UNVIS_VALID);
-
-       case S_CTRL:
-               if (c == '?')
-                       *cp |= 0177;
-               else
-                       *cp |= c & 037;
-               *astate = S_GROUND;
-               return (UNVIS_VALID);
-
-       case S_OCTAL2:  /* second possible octal digit */
-               if (isoctal(c)) {
-                       /*
-                        * yes - and maybe a third
-                        */
-                       *cp = (*cp << 3) + (c - '0');
-                       *astate = S_OCTAL3;
-                       return (0);
-               }
-               /*
-                * no - done with current sequence, push back passed char
-                */
-               *astate = S_GROUND;
-               return (UNVIS_VALIDPUSH);
-
-       case S_OCTAL3:  /* third possible octal digit */
-               *astate = S_GROUND;
-               if (isoctal(c)) {
-                       *cp = (*cp << 3) + (c - '0');
-                       return (UNVIS_VALID);
-               }
-               /*
-                * we were done, push back passed char
-                */
-               return (UNVIS_VALIDPUSH);
-
-       case S_HEX2:    /* second mandatory hex digit */
-               if (ishex(tolower_l(c, loc))) {
-                       *cp = (isdigit_l(c, loc) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower_l(c, loc) - 'a' + 10));
-               }
-               *astate = S_GROUND;
-               return (UNVIS_VALID);
-
-       default:
-               /*
-                * decoder in unknown state - (probably uninitialized)
-                */
-               *astate = S_GROUND;
-               return (UNVIS_SYNBAD);
-       }
-}
-
-/*
- * strunvis - decode src into dst
- *
- *     Number of chars decoded into dst is returned, -1 on error.
- *     Dst is null terminated.
- */
-
-int
-strunvis(char *dst, const char *src)
-{
-       char c;
-       char *start = dst;
-       int state = 0;
-
-       while ( (c = *src++) ) {
-       again:
-               switch (unvis(dst, c, &state, 0)) {
-               case UNVIS_VALID:
-                       dst++;
-                       break;
-               case UNVIS_VALIDPUSH:
-                       dst++;
-                       goto again;
-               case 0:
-               case UNVIS_NOCHAR:
-                       break;
-               default:
-                       return (-1);
-               }
-       }
-       if (unvis(dst, c, &state, UNVIS_END) == UNVIS_VALID)
-               dst++;
-       *dst = '\0';
-       return (dst - start);
-}
-
-int
-strunvisx(char *dst, const char *src, int flag)
-{
-       char c;
-       char *start = dst;
-       int state = 0;
-    
-       while ( (c = *src++) ) {
-       again:
-               switch (unvis(dst, c, &state, flag)) {
-               case UNVIS_VALID:
-                       dst++;
-                       break;
-               case UNVIS_VALIDPUSH:
-                       dst++;
-                       goto again;
-               case 0:
-               case UNVIS_NOCHAR:
-                       break;
-               default:
-                       return (-1);
-               }
-       }
-       if (unvis(dst, c, &state, UNVIS_END) == UNVIS_VALID)
-               dst++;
-       *dst = '\0';
-       return (dst - start);
-}
diff --git a/gen/unvis.3 b/gen/unvis.3
deleted file mode 120000 (symlink)
index 7571719..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./unvis.3
\ No newline at end of file
diff --git a/gen/usleep-fbsd.c b/gen/usleep-fbsd.c
deleted file mode 100644 (file)
index fc8054b..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef VARIANT_CANCELABLE
-#undef __DARWIN_NON_CANCELABLE
-#define __DARWIN_NON_CANCELABLE 0
-#endif /* VARIANT_CANCELABLE */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)usleep.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/usleep.c,v 1.31 2009/12/05 19:31:38 ed Exp $");
-
-#include "namespace.h"
-#include <time.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-int
-usleep(useconds_t useconds)
-{
-       struct timespec time_to_sleep;
-
-       time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
-       time_to_sleep.tv_sec = useconds / 1000000;
-       return (_nanosleep(&time_to_sleep, NULL));
-}
diff --git a/gen/usleep.3 b/gen/usleep.3
deleted file mode 100644 (file)
index e99b773..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)usleep.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/usleep.3,v 1.19 2007/01/09 00:27:56 imp Exp $
-.\"
-.Dd February 13, 1998
-.Dt USLEEP 3
-.Os
-.Sh NAME
-.Nm usleep
-.Nd suspend thread execution for an interval measured in microseconds
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fo usleep
-.Fa "useconds_t useconds"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn usleep
-function suspends execution of the calling thread until either
-.Fa useconds
-microseconds have elapsed
-or a signal is delivered to the thread whose action
-is to invoke a signal-catching function
-or to terminate the thread or process.
-The actual time slept may be longer, due to system latencies
-and possible limitations in the timer resolution of the hardware.
-.Pp
-This function is implemented, using
-.Xr nanosleep 2 ,
-by pausing for
-.Fa useconds
-microseconds or until a signal occurs.
-Consequently, in this implementation,
-sleeping has no effect on the state of process timers
-and there is no special handling for SIGALRM.
-.Sh RETURN VALUES
-.Rv -std usleep
-.Sh ERRORS
-The
-.Fn usleep
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINTR
-A signal was delivered to the process and its
-action was to invoke a signal-catching function.
-.El
-.Sh SEE ALSO
-.Xr nanosleep 2 ,
-.Xr sleep 3
-.Sh HISTORY
-The
-.Fn usleep
-function appeared in
-.Bx 4.3 .
diff --git a/gen/utime-fbsd.c b/gen/utime-fbsd.c
deleted file mode 120000 (symlink)
index ad13533..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./utime.c
\ No newline at end of file
diff --git a/gen/utime.3 b/gen/utime.3
deleted file mode 100644 (file)
index c96ab2e..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)utime.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/utime.3,v 1.14 2007/01/09 00:27:56 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt UTIME 3
-.Os
-.Sh NAME
-.Nm utime
-.Nd set file times
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In utime.h
-.Ft int
-.Fo utime
-.Fa "const char *path"
-.Fa "const struct utimbuf *times"
-.Fc
-.Sh DESCRIPTION
-.Bf -symbolic
-This interface is obsoleted by
-.Xr utimes 2 .
-.Ef
-.Pp
-The
-.Fn utime
-function sets the access and modification times of the named file,
-based on the
-.Va actime
-and
-.Va modtime
-fields of the
-.Vt "struct utimbuf"
-pointed at by
-.Fa times .
-.Pp
-If the times are specified (the
-.Fa times
-argument is
-.Pf non- Dv NULL ) ,
-the caller must be the owner of the file or be the super-user.
-.Pp
-If the times are not specified (the
-.Fa times
-argument is
-.Dv NULL ) ,
-the caller must be the owner of the file,
-have permission to write the file, or be the super-user.
-.Sh ERRORS
-The
-.Fn utime
-function may fail and set
-.Va errno
-for any of the errors specified for the library function
-.Xr utimes 2 .
-.Sh SEE ALSO
-.Xr stat 2 ,
-.Xr utimes 2
-.Sh STANDARDS
-The
-.Fn utime
-function conforms to
-.St -p1003.1-88 .
-.Sh HISTORY
-A
-.Fn utime
-function appeared in
-.At v7 .
diff --git a/gen/utmpx-nbsd.c b/gen/utmpx-nbsd.c
deleted file mode 100644 (file)
index 0eda3d4..0000000
+++ /dev/null
@@ -1,578 +0,0 @@
-/*     $NetBSD: utmpx.c,v 1.25 2008/04/28 20:22:59 martin Exp $         */
-
-/*-
- * Copyright (c) 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include <sys/cdefs.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: utmpx.c,v 1.25 2008/04/28 20:22:59 martin Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef UNIFDEF_LEGACY_UTMP_APIS
-#include <utmp.h>
-#endif /* UNIFDEF_LEGACY_UTMP_APIS */
-#include <utmpx.h>
-#include <utmpx-darwin.h>
-#include <errno.h>
-#include <vis.h>
-#include <notify.h>
-
-/* This is the default struct _utmpx shared by the POSIX APIs */
-__private_extern__
-struct _utmpx __utx__ = {
-       __UTX_MAGIC__,                  /* magic */
-       {},                             /* ut */
-       PTHREAD_MUTEX_INITIALIZER,      /* utmpx_mutex */
-       _PATH_UTMPX,                    /* utfile */
-       NULL,                           /* fp */
-       1,                              /* utfile_system */
-       0,                              /* readonly */
-};
-
-static struct utmpx *__getutxid(struct _utmpx *, const struct utmpx *);
-
-__private_extern__ const char _utmpx_vers[] = "utmpx-1.00";
-
-__private_extern__ void
-__setutxent(struct _utmpx *U)
-{
-
-       (void)memset(&U->ut, 0, sizeof(U->ut));
-       if (U->fp == NULL)
-               return;
-#ifdef __LP64__
-       (void)fseeko(U->fp, (off_t)sizeof(struct utmpx32), SEEK_SET);
-#else /* __LP64__ */
-       (void)fseeko(U->fp, (off_t)sizeof(U->ut), SEEK_SET);
-#endif /* __LP64__ */
-}
-
-void
-_setutxent(struct _utmpx *U)
-{
-
-       TEST_UTMPX_T("_setutxent", U);
-       UTMPX_LOCK(U);
-       __setutxent(U);
-       UTMPX_UNLOCK(U);
-}
-
-
-void
-setutxent()
-{
-       _setutxent(&__utx__);
-}
-
-
-__private_extern__ void
-__endutxent(struct _utmpx *U)
-{
-       (void)memset(&U->ut, 0, sizeof(U->ut));
-       if (U->fp != NULL) {
-               int saveerrno = errno;
-               (void)fclose(U->fp);
-               errno = saveerrno;
-               U->fp = NULL;
-               U->readonly = 0;
-       }
-}
-
-
-void
-_endutxent(struct _utmpx *U)
-{
-       TEST_UTMPX_T("_endutxent", U);
-       UTMPX_LOCK(U);
-       __endutxent(U);
-       UTMPX_UNLOCK(U);
-}
-
-
-void
-endutxent()
-{
-       _endutxent(&__utx__);
-}
-
-
-__private_extern__ struct utmpx *
-__getutxent(struct _utmpx *U)
-{
-       int saveerrno;
-#ifdef __LP64__
-       struct utmpx32 ut32;
-#endif /* __LP64__ */
-
-       if (U->fp == NULL) {
-               struct stat st;
-
-               if ((U->fp = fopen(U->utfile, "r+")) == NULL)
-                       if ((U->fp = fopen(U->utfile, "w+")) == NULL) {
-                               if ((U->fp = fopen(U->utfile, "r")) == NULL)
-                                       goto fail;
-                               else
-                                       U->readonly = 1;
-                       }
-
-               fcntl(fileno(U->fp), F_SETFD, 1); /* set close-on-exec flag */
-
-               /* get file size in order to check if new file */
-               if (fstat(fileno(U->fp), &st) == -1)
-                       goto failclose;
-
-               if (st.st_size == 0) {
-                       /* new file, add signature record */
-#ifdef __LP64__
-                       (void)memset(&ut32, 0, sizeof(ut32));
-                       ut32.ut_type = SIGNATURE;
-                       (void)memcpy(ut32.ut_user, _utmpx_vers, sizeof(_utmpx_vers));
-                       if (fwrite(&ut32, sizeof(ut32), 1, U->fp) != 1)
-#else /* __LP64__ */
-                       (void)memset(&U->ut, 0, sizeof(U->ut));
-                       U->ut.ut_type = SIGNATURE;
-                       (void)memcpy(U->ut.ut_user, _utmpx_vers, sizeof(_utmpx_vers));
-                       if (fwrite(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
-#endif /* __LP64__ */
-                               goto failclose;
-               } else {
-                       /* old file, read signature record */
-#ifdef __LP64__
-                       if (fread(&ut32, sizeof(ut32), 1, U->fp) != 1)
-#else /* __LP64__ */
-                       if (fread(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
-#endif /* __LP64__ */
-                               goto failclose;
-#ifdef __LP64__
-                       if (memcmp(ut32.ut_user, _utmpx_vers, sizeof(_utmpx_vers)) != 0 ||
-                           ut32.ut_type != SIGNATURE)
-#else /* __LP64__ */
-                       if (memcmp(U->ut.ut_user, _utmpx_vers, sizeof(_utmpx_vers)) != 0 ||
-                           U->ut.ut_type != SIGNATURE)
-#endif /* __LP64__ */
-                       {
-                               errno = EINVAL;
-                               goto failclose;
-                       }
-               }
-       }
-
-#ifdef __LP64__
-       if (fread(&ut32, sizeof(ut32), 1, U->fp) != 1)
-#else /* __LP64__ */
-       if (fread(&U->ut, sizeof(U->ut), 1, U->fp) != 1)
-#endif /* __LP64__ */
-               goto fail;
-
-#ifdef __LP64__
-       _utmpx32_64(&ut32, &U->ut);
-#endif /* __LP64__ */
-       return &U->ut;
-failclose:
-       saveerrno = errno;
-       (void)fclose(U->fp);
-       errno = saveerrno;
-       U->fp = NULL;
-fail:
-       (void)memset(&U->ut, 0, sizeof(U->ut));
-       return NULL;
-}
-
-
-struct utmpx *
-_getutxent(struct _utmpx *U)
-{
-       struct utmpx *ret;
-
-       TEST_UTMPX_T("_getutxent", U);
-       UTMPX_LOCK(U);
-       ret = __getutxent(U);
-       UTMPX_UNLOCK(U);
-       return ret;
-}
-
-
-struct utmpx *
-getutxent()
-{
-       return _getutxent(&__utx__);
-}
-
-
-struct utmpx *
-_getutxid(struct _utmpx *U, const struct utmpx *utx)
-{
-       struct utmpx temp;
-       const struct utmpx *ux;
-       struct utmpx *ret;
-
-       if (utx->ut_type == EMPTY)
-               return NULL;
-
-       TEST_UTMPX_T("_getutxid", U);
-       UTMPX_LOCK(U);
-       /* make a copy as needed, and auto-fill if requested */
-       ux = _utmpx_working_copy(utx, &temp, 1);
-       if (!ux) {
-               UTMPX_UNLOCK(U);
-               return NULL;
-       }
-
-       ret = __getutxid(U, ux);
-       UTMPX_UNLOCK(U);
-       return ret;
-}
-
-
-struct utmpx *
-getutxid(const struct utmpx *utx)
-{
-       return _getutxid(&__utx__, utx);
-}
-
-
-static struct utmpx *
-__getutxid(struct _utmpx *U, const struct utmpx *utx)
-{
-
-       do {
-               if (U->ut.ut_type == EMPTY)
-                       continue;
-               switch (utx->ut_type) {
-               case EMPTY:
-                       return NULL;
-               case RUN_LVL:
-               case BOOT_TIME:
-               case OLD_TIME:
-               case NEW_TIME:
-                       if (U->ut.ut_type == utx->ut_type)
-                               return &U->ut;
-                       break;
-               case INIT_PROCESS:
-               case LOGIN_PROCESS:
-               case USER_PROCESS:
-               case DEAD_PROCESS:
-                       switch (U->ut.ut_type) {
-                       case INIT_PROCESS:
-                       case LOGIN_PROCESS:
-                       case USER_PROCESS:
-                       case DEAD_PROCESS:
-                               if (memcmp(U->ut.ut_id, utx->ut_id,
-                                   sizeof(U->ut.ut_id)) == 0)
-                                       return &U->ut;
-                               break;
-                       default:
-                               break;
-                       }
-                       break;
-               default:
-                       return NULL;
-               }
-       } while (__getutxent(U) != NULL);
-       return NULL;
-}
-
-
-static struct utmpx *
-__getutxline(struct _utmpx *U, const struct utmpx *utx)
-{
-       do {
-               switch (U->ut.ut_type) {
-               case EMPTY:
-                       break;
-               case LOGIN_PROCESS:
-               case USER_PROCESS:
-                       if (strncmp(U->ut.ut_line, utx->ut_line,
-                           sizeof(U->ut.ut_line)) == 0)
-                               return &U->ut;
-                       break;
-               default:
-                       break;
-               }
-       } while (__getutxent(U) != NULL);
-       return NULL;
-}
-
-
-struct utmpx *
-_getutxline(struct _utmpx *U, const struct utmpx *utx)
-{
-       struct utmpx *ret;
-
-       TEST_UTMPX_T("_getutxline", U);
-       UTMPX_LOCK(U);
-       ret = __getutxline(U, utx);
-       UTMPX_UNLOCK(U);
-       return ret;
-}
-
-
-struct utmpx *
-getutxline(const struct utmpx *utx)
-{
-       return _getutxline(&__utx__, utx);
-}
-
-
-struct utmpx *
-_pututxline(struct _utmpx *U, const struct utmpx *utx)
-{
-       struct utmpx *ux;
-
-       if (utx == NULL) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       TEST_UTMPX_T("_pututxline", U);
-       UTMPX_LOCK(U);
-       if ((ux = __pututxline(&__utx__, utx)) != NULL && __utx__.utfile_system) {
-               _utmpx_asl(ux); /* the equivalent of wtmpx and lastlogx */
-#ifdef UTMP_COMPAT
-               _write_utmp_compat(ux);
-#endif /* UTMP_COMPAT */
-       }
-       UTMPX_UNLOCK(U);
-       return ux;
-}
-
-
-struct utmpx *
-pututxline(const struct utmpx *utx)
-{
-       return _pututxline(&__utx__, utx);
-}
-
-__private_extern__ struct utmpx *
-__pututxline(struct _utmpx *U, const struct utmpx *utx)
-{
-       struct utmpx temp, *u = NULL, *x;
-       const struct utmpx *ux;
-#ifdef __LP64__
-       struct utmpx32 ut32;
-#endif /* __LP64__ */
-       struct flock fl;
-#define gotlock                (fl.l_start >= 0)
-
-       fl.l_start = -1; /* also means we haven't locked */
-       if (U->utfile_system)
-               if ((U->fp != NULL && U->readonly) || (U->fp == NULL && geteuid() != 0)) {
-                       errno = EPERM;
-                       return NULL;
-               }
-
-       if (U->fp == NULL) {
-               (void)__getutxent(U);
-               if (U->fp == NULL || U->readonly) {
-                       errno = EPERM;
-                       return NULL;
-               }
-       }
-
-       /* make a copy as needed, and auto-fill if requested */
-       ux = _utmpx_working_copy(utx, &temp, 0);
-       if (!ux)
-               return NULL;
-
-       if ((x = __getutxid(U, ux)) == NULL) {
-               __setutxent(U);
-               if ((x = __getutxid(U, ux)) == NULL) {
-                       /*
-                        * utx->ut_type has any original mask bits, while
-                        * ux->ut_type has those mask bits removed.  If we
-                        * are trying to record a dead process, and
-                        * UTMPX_DEAD_IF_CORRESPONDING_MASK is set, then since
-                        * there is no matching entry, we return NULL.
-                        */
-                       if (ux->ut_type == DEAD_PROCESS &&
-                           (utx->ut_type & UTMPX_DEAD_IF_CORRESPONDING_MASK)) {
-                               errno = EINVAL;
-                               return NULL;
-                       }
-                       /*
-                        * Replace lockf() with fcntl() and a fixed start
-                        * value.  We should already be at EOF.
-                        */
-                       if ((fl.l_start = lseek(fileno(U->fp), 0, SEEK_CUR)) < 0)
-                               return NULL;
-                       fl.l_len = 0;
-                       fl.l_whence = SEEK_SET;
-                       fl.l_type = F_WRLCK;
-                       if (fcntl(fileno(U->fp), F_SETLKW, &fl) == -1)
-                               return NULL;
-                       if (fseeko(U->fp, (off_t)0, SEEK_END) == -1)
-                               goto fail;
-               }
-       }
-
-       if (!gotlock) {
-               /*
-                * utx->ut_type has any original mask bits, while
-                * ux->ut_type has those mask bits removed.  If we
-                * are trying to record a dead process, if
-                * UTMPX_DEAD_IF_CORRESPONDING_MASK is set, but the found
-                * entry is not a (matching) USER_PROCESS, then return NULL.
-                */
-               if (ux->ut_type == DEAD_PROCESS &&
-                   (utx->ut_type & UTMPX_DEAD_IF_CORRESPONDING_MASK) &&
-                   x->ut_type != USER_PROCESS) {
-                       errno = EINVAL;
-                       return NULL;
-               }
-               /* we are not appending */
-#ifdef __LP64__
-               if (fseeko(U->fp, -(off_t)sizeof(ut32), SEEK_CUR) == -1)
-#else /* __LP64__ */
-               if (fseeko(U->fp, -(off_t)sizeof(U->ut), SEEK_CUR) == -1)
-#endif /* __LP64__ */
-                       return NULL;
-       }
-
-#ifdef __LP64__
-       _utmpx64_32(ux, &ut32);
-       if (fwrite(&ut32, sizeof (ut32), 1, U->fp) != 1)
-#else /* __LP64__ */
-       if (fwrite(ux, sizeof (*ux), 1, U->fp) != 1)
-#endif /* __LP64__ */
-               goto fail;
-
-       if (fflush(U->fp) == -1)
-               goto fail;
-
-       u = memcpy(&U->ut, ux, sizeof(U->ut));
-       notify_post(UTMPX_CHANGE_NOTIFICATION);
-fail:
-       if (gotlock) {
-               int save = errno;
-               fl.l_type = F_UNLCK;
-               if (fcntl(fileno(U->fp), F_SETLK, &fl) == -1)
-                       return NULL;
-               errno = save;
-       }
-       return u;
-}
-
-
-/*
- * The following are extensions and not part of the X/Open spec.
- */
-__private_extern__ int
-__utmpxname(struct _utmpx *U, const char *fname)
-{
-       size_t len;
-
-       if (fname == NULL) {
-               if(!U->utfile_system)
-                       free(U->utfile);
-               U->utfile = _PATH_UTMPX;
-               U->utfile_system = 1;
-               __endutxent(U);
-               return 1;
-       }
-
-       len = strlen(fname);
-
-       if (len >= MAXPATHLEN)
-               return 0;
-
-       /* must end in x! */
-       if (fname[len - 1] != 'x')
-               return 0;
-
-       if (U->utfile_system)
-               U->utfile = NULL;
-       U->utfile_system = 0;
-       if ((U->utfile = reallocf(U->utfile, len + 1)) == NULL)
-               return 0;
-
-       (void)strcpy(U->utfile, fname);
-       __endutxent(U);
-       return 1;
-}
-
-int
-_utmpxname(struct _utmpx *U, const char *fname)
-{
-       int ret;
-
-       TEST_UTMPX_T("_utmpxname", U);
-       UTMPX_LOCK(U);
-       ret = __utmpxname(U, fname);
-       UTMPX_UNLOCK(U);
-       return ret;
-}
-
-int
-utmpxname(const char *fname)
-{
-       return _utmpxname(&__utx__, fname);
-}
-
-#ifdef UNIFDEF_LEGACY_UTMP_APIS
-void
-getutmp(const struct utmpx *ux, struct utmp *u)
-{
-
-       bzero(u, sizeof(*u));
-       (void)memcpy(u->ut_name, ux->ut_user, sizeof(u->ut_name));
-       (void)memcpy(u->ut_line, ux->ut_line, sizeof(u->ut_line));
-       (void)memcpy(u->ut_host, ux->ut_host, sizeof(u->ut_host));
-       u->ut_time = ux->ut_tv.tv_sec;
-}
-
-void
-getutmpx(const struct utmp *u, struct utmpx *ux)
-{
-
-       bzero(ux, sizeof(*ux));
-       (void)memcpy(ux->ut_user, u->ut_name, sizeof(u->ut_name));
-       ux->ut_user[sizeof(u->ut_name)] = 0;
-       (void)memcpy(ux->ut_line, u->ut_line, sizeof(u->ut_line));
-       ux->ut_line[sizeof(u->ut_line)] = 0;
-       (void)memcpy(ux->ut_host, u->ut_host, sizeof(u->ut_host));
-       ux->ut_host[sizeof(u->ut_host)] = 0;
-       ux->ut_tv.tv_sec = u->ut_time;
-       ux->ut_tv.tv_usec = 0;
-       ux->ut_pid = getpid();
-       ux->ut_type = USER_PROCESS;
-}
-#endif /* UNIFDEF_LEGACY_UTMP_APIS */
diff --git a/gen/utmpx.5 b/gen/utmpx.5
deleted file mode 100644 (file)
index 6068b09..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-.\"    $NetBSD: utmpx.5,v 1.7 2008/04/30 13:10:57 martin Exp $
-.\"
-.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Thomas Klausner.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd January 31, 2007
-.Dt UTMPX 5
-.Os
-.Sh NAME
-.Nm utmpx
-.Nd user accounting database
-.Sh SYNOPSIS
-.In utmpx.h
-.Sh DESCRIPTION
-In contrast to
-.Pa utmp
-and
-.Pa wtmp ,
-the extended databases in
-.Pa utmpx
-and
-.Pa wtmpx
-reserve more space for logging hostnames, and also
-information on a process' ID, termination signal and exit status.
-.Pp
-The
-.Aq Pa utmpx.h
-header defines the structures and functions for logging user.
-Currently logged in users are tracked in
-.Pa /var/run/utmpx .
-The interface to the
-.Nm utmpx
-file is described in
-.Xr endutxent 3 .
-The file is not automatically created if they do not exist; it
-must be created manually.
-.Pp
-Traditionally, separate files would be used to store the running log of
-the logins and logouts
-.Pf ( Pa wtmpx ) ,
-and the last login of each user
-.Pf ( Pa lastlogx ) .
-With the availability of the Apple system log facility
-.Xr asl 3 ,
-these separate files can be replace with log entries, which are automatically
-generated when
-.Nm utmpx
-entries are written.
-The API to access the logins and logouts is described in
-.Xr endutxent_wtmp 3
-while the last login info is accessible with
-.Xr getlastlogx 3 .
-.Pp
-For compatibility, changes to
-.Nm utmpx
-are reflected in
-.Xr utmp 3
-(in the
-.Pa utmp ,
-.Pa wtmp
-and
-.Pa lastlog
-files),
-but not the other way around.
-.Sh FILES
-.Bl -tag -width /var/log/utmpx -compact
-.It Pa /var/run/utmpx
-The
-.Nm utmpx
-file.
-.El
-.Sh SEE ALSO
-.Xr asl 3 ,
-.Xr endutxent 3 ,
-.Xr endutxent_wtmp 3 ,
-.Xr getlastlogx 3 ,
-.Xr utmp 5
diff --git a/gen/vis-fbsd.c b/gen/vis-fbsd.c
deleted file mode 100644 (file)
index 3a4b67c..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vis.c      8.1 (Berkeley) 7/19/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <limits.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <vis.h>
-
-#define        isoctal(c)      (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
-
-/*
- * vis - visually encode characters
- */
-char *
-vis(dst, c, flag, nextc)
-       char *dst;
-       int c, nextc;
-       int flag;
-{
-       locale_t loc = __current_locale();
-
-       c = (unsigned char)c;
-
-       if (flag & VIS_HTTPSTYLE) {
-               /* Described in RFC 1808 */
-               if (!(isalnum_l(c, loc) /* alpha-numeric */
-                   /* safe */
-                   || c == '$' || c == '-' || c == '_' || c == '.' || c == '+'
-                   /* extra */
-                   || c == '!' || c == '*' || c == '\'' || c == '('
-                   || c == ')' || c == ',')) {
-                       *dst++ = '%';
-                       snprintf_l(dst, 4, loc, (c < 16 ? "0%X" : "%X"), c);
-                       dst += 2;
-                       goto done;
-               }
-       }
-
-       if ((flag & VIS_GLOB) &&
-           (c == '*' || c == '?' || c == '[' || c == '#'))
-               ;
-       else if (isgraph_l(c, loc) ||
-          ((flag & VIS_SP) == 0 && c == ' ') ||
-          ((flag & VIS_TAB) == 0 && c == '\t') ||
-          ((flag & VIS_NL) == 0 && c == '\n') ||
-          ((flag & VIS_SAFE) && (c == '\b' || c == '\007' || c == '\r'))) {
-               *dst++ = c;
-               if (c == '\\' && (flag & VIS_NOSLASH) == 0)
-                       *dst++ = '\\';
-               *dst = '\0';
-               return (dst);
-       }
-
-       if (flag & VIS_CSTYLE) {
-               switch(c) {
-               case '\n':
-                       *dst++ = '\\';
-                       *dst++ = 'n';
-                       goto done;
-               case '\r':
-                       *dst++ = '\\';
-                       *dst++ = 'r';
-                       goto done;
-               case '\b':
-                       *dst++ = '\\';
-                       *dst++ = 'b';
-                       goto done;
-               case '\a':
-                       *dst++ = '\\';
-                       *dst++ = 'a';
-                       goto done;
-               case '\v':
-                       *dst++ = '\\';
-                       *dst++ = 'v';
-                       goto done;
-               case '\t':
-                       *dst++ = '\\';
-                       *dst++ = 't';
-                       goto done;
-               case '\f':
-                       *dst++ = '\\';
-                       *dst++ = 'f';
-                       goto done;
-               case ' ':
-                       *dst++ = '\\';
-                       *dst++ = 's';
-                       goto done;
-               case '\0':
-                       *dst++ = '\\';
-                       *dst++ = '0';
-                       if (isoctal(nextc)) {
-                               *dst++ = '0';
-                               *dst++ = '0';
-                       }
-                       goto done;
-               }
-       }
-       if (((c & 0177) == ' ') || isgraph_l(c, loc) || (flag & VIS_OCTAL)) {
-               *dst++ = '\\';
-               *dst++ = ((u_char)c >> 6 & 07) + '0';
-               *dst++ = ((u_char)c >> 3 & 07) + '0';
-               *dst++ = ((u_char)c & 07) + '0';
-               goto done;
-       }
-       if ((flag & VIS_NOSLASH) == 0)
-               *dst++ = '\\';
-       if (c & 0200) {
-               c &= 0177;
-               *dst++ = 'M';
-       }
-       if (iscntrl_l(c, loc)) {
-               *dst++ = '^';
-               if (c == 0177)
-                       *dst++ = '?';
-               else
-                       *dst++ = c + '@';
-       } else {
-               *dst++ = '-';
-               *dst++ = c;
-       }
-done:
-       *dst = '\0';
-       return (dst);
-}
-
-/*
- * strvis, strvisx - visually encode characters from src into dst
- *
- *     Dst must be 4 times the size of src to account for possible
- *     expansion.  The length of dst, not including the trailing NUL,
- *     is returned.
- *
- *     Strvisx encodes exactly len bytes from src into dst.
- *     This is useful for encoding a block of data.
- */
-int
-strvis(dst, src, flag)
-       char *dst;
-       const char *src;
-       int flag;
-{
-       char c;
-       char *start;
-
-       for (start = dst; (c = *src); )
-               dst = vis(dst, c, flag, *++src);
-       *dst = '\0';
-       return (dst - start);
-}
-
-int
-strvisx(dst, src, len, flag)
-       char *dst;
-       const char *src;
-       size_t len;
-       int flag;
-{
-       int c;
-       char *start;
-
-       for (start = dst; len > 1; len--) {
-               c = *src;
-               dst = vis(dst, c, flag, *++src);
-       }
-       if (len)
-               dst = vis(dst, *src, flag, '\0');
-       *dst = '\0';
-
-       return (dst - start);
-}
diff --git a/gen/vis.3 b/gen/vis.3
deleted file mode 120000 (symlink)
index 66ce53e..0000000
--- a/gen/vis.3
+++ /dev/null
@@ -1 +0,0 @@
-./vis.3
\ No newline at end of file
diff --git a/gen/wait-fbsd.c b/gen/wait-fbsd.c
deleted file mode 100644 (file)
index 8bf2b1e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)wait.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/wait.c,v 1.7 2007/01/09 00:27:56 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-#include "un-namespace.h"
-
-#ifdef VARIANT_CANCELABLE
-int __wait4(pid_t, int *, int , struct rusage *);
-#else /* !VARIANT_CANCELABLE */
-int __wait4_nocancel(pid_t, int *, int , struct rusage *);
-#endif /* VARIANT_CANCELABLE */
-
-pid_t
-__wait(int *istat)
-{
-#ifdef VARIANT_CANCELABLE
-       return (__wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
-#else /* !VARIANT_CANCELABLE */
-       return (__wait4_nocancel(WAIT_ANY, istat, 0, (struct rusage *)0));
-#endif /* VARIANT_CANCELABLE */
-}
-
-__weak_reference(__wait, wait);
-__weak_reference(__wait, _wait);
diff --git a/gen/wait3-fbsd.c b/gen/wait3-fbsd.c
deleted file mode 120000 (symlink)
index 5852191..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wait3.c
\ No newline at end of file
diff --git a/gen/waitpid-fbsd.c b/gen/waitpid-fbsd.c
deleted file mode 100644 (file)
index d81530f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)waitpid.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/waitpid.c,v 1.7 2007/01/09 00:27:56 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-#include "un-namespace.h"
-
-#if __DARWIN_UNIX03
-#include <errno.h>
-#endif /* __DARWIN_UNIX03 */
-#ifdef VARIANT_CANCELABLE
-int __wait4(pid_t, int *, int , struct rusage *);
-#else /* !VARIANT_CANCELABLE */
-int __wait4_nocancel(pid_t, int *, int , struct rusage *);
-#endif /* VARIANT_CANCELABLE */
-
-pid_t
-__waitpid(pid_t pid, int *istat, int options)
-{
-#if __DARWIN_UNIX03
-       /* POSIX: Validate waitpid() options before calling wait4() */
-       if ((options & (WCONTINUED | WNOHANG | WUNTRACED)) != options) {
-               errno = EINVAL;
-               return ((pid_t)-1);
-       }
-#endif /* __DARWIN_UNIX03 */
-
-#ifdef VARIANT_CANCELABLE
-       return (__wait4(pid, istat, options, (struct rusage *)0));
-#else /* !VARIANT_CANCELABLE */
-       return (__wait4_nocancel(pid, istat, options, (struct rusage *)0));
-#endif /* VARIANT_CANCELABLE */
-}
-
-__weak_reference(__waitpid, waitpid);
-__weak_reference(__waitpid, _waitpid);
diff --git a/gen/zone.c b/gen/zone.c
deleted file mode 100644 (file)
index 51824f8..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#import <objc/zone.h>
-#import <stdio.h>
-#import <libc.h>
-#import <pthread.h>
-#import <stdlib.h>
-#import <unistd.h>
-
-#define OBSOLETED
-
-static pthread_mutex_t _zone_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-enum {
-    nXDefaultMallocZone = 0,
-    nXCreateZone,
-    nXNameZone,
-    nXZoneMalloc,
-    nXZoneRealloc,
-    nXZoneCalloc,
-    nXZoneFree,
-    nXDestroyZone,
-    nXZoneFromPtr,
-    nXZonePtrInfo,
-    nXMallocCheck,
-    _nXMallocDumpZones
-};
-static char *once[] = {
-    "NXDefaultMallocZone",
-    "NXCreateZone",
-    "NXNameZone",
-    "NXZoneMalloc",
-    "NXZoneRealloc",
-    "NXZoneCalloc",
-    "NXZoneFree",
-    "NXDestroyZone",
-    "NXZoneFromPtr",
-    "NXZonePtrInfo",
-    "NXMallocCheck",
-    "_NXMallocDumpZones"
-};
-
-extern int __is_threaded;
-
-/*********     NX functions    ************/
-
-static void
-_deprecated(int index)
-{
-    if(__is_threaded)
-       pthread_mutex_lock(&_zone_mutex);
-    if(once[index]) {
-       fprintf(stderr, "*** %s[%d]: %s() is deprecated and will be removed in the future\n", getprogname(), getpid(), once[index]);
-       once[index] = NULL;
-    }
-    if(__is_threaded)
-       pthread_mutex_unlock(&_zone_mutex);
-}
-
-malloc_zone_t *NXDefaultMallocZone() {
-    _deprecated(nXDefaultMallocZone);
-    return malloc_default_zone();
-}
-
-malloc_zone_t *NXCreateZone(size_t startsize, size_t granularity, int canfree) {
-    _deprecated(nXCreateZone);
-    return malloc_create_zone(startsize, 0);
-}
-
-void NXNameZone(malloc_zone_t *z, const char *name) {
-    _deprecated(nXNameZone);
-    malloc_set_zone_name(z, name);
-}
-
-void *NXZoneMalloc(malloc_zone_t *zone, size_t size) {
-    _deprecated(nXZoneMalloc);
-    return malloc_zone_malloc(zone, size);
-}
-
-void *NXZoneRealloc(malloc_zone_t *zone, void *ptr, size_t size) {
-    _deprecated(nXZoneRealloc);
-    return malloc_zone_realloc(zone, ptr, size);
-}
-
-void *NXZoneCalloc(malloc_zone_t *zone, size_t num_items, size_t size) {
-    _deprecated(nXZoneCalloc);
-    return malloc_zone_calloc(zone, num_items, size);
-}
-
-void NXZoneFree(malloc_zone_t *zone, void *ptr) {
-    _deprecated(nXZoneFromPtr);
-    malloc_zone_free(zone, ptr);
-}
-
-void NXDestroyZone(malloc_zone_t *zone) {
-    _deprecated(nXDestroyZone);
-    if (zone == malloc_default_zone()) return; // we avoid destroying child zones
-    malloc_destroy_zone(zone);
-}
-
-NXZone *NXZoneFromPtr(void *ptr) {
-    NXZone     *zone = malloc_zone_from_ptr(ptr);
-    _deprecated(nXZoneFromPtr);
-    if (!zone) {
-        malloc_printf("*** NXZoneFromPtr() did not find any zone for %p; returning default\n", ptr);
-        zone = NX_NOZONE;
-    }
-    return zone;
-}
-
-#ifndef OBSOLETED
-void NXAddRegion(void *start, size_t size, malloc_zone_t *zone) {
-    malloc_printf("*** OBSOLETE: NXAddRegion()\n");
-}
-
-void NXRemoveRegion(void *start) {
-    malloc_printf("*** OBSOLETE: NXRemoveRegion()\n");
-}
-#endif /* OBSOLETED */
-
-void NXZonePtrInfo(void *ptr) {
-    _deprecated(nXZonePtrInfo);
-    malloc_zone_print_ptr_info(ptr);
-}
-
-int NXMallocCheck(void) {
-    _deprecated(nXMallocCheck);
-    malloc_zone_check(NULL);
-    return 1;
-}
-
-void _NXMallocDumpZones(void) {
-    _deprecated(_nXMallocDumpZones);
-    malloc_zone_print(NULL, 0);
-}
-
-/*****************     UNIMPLEMENTED ENTRY POINTS      ********************/
-
-#ifndef OBSOLETED
-void NXMergeZone(malloc_zone_t *z) {
-    static char warned = 0;
-    if (!warned) {
-        malloc_printf("*** NXMergeZone() now obsolete, does nothing\n");
-        warned = 1;
-    }
-}
-
-boolean_t NXProtectZone(malloc_zone_t *zone, int protection) {
-    malloc_printf("*** NXProtectZone() is obsolete\n");
-    return 0;
-}
-
-malloc_zone_t *NXCreateChildZone(malloc_zone_t *parentzone, size_t startsize, size_t granularity, int canfree) {
-    // We can not remove this one as it is still used by IndexingKit
-    static char warned = 0;
-    if (!warned) {
-        malloc_printf("*** NXCreateChildZone() now obsolete, has been defined to create new zone\n");
-        warned = 1;
-    }
-    return NXCreateZone(startsize, granularity, canfree);
-}
-
-void _NXMallocDumpFrees(void) {
-    malloc_printf("*** OBSOLETE: _NXMallocDumpFrees()\n");
-}
-#endif /* OBSOLETED */
diff --git a/gmon/Makefile.inc b/gmon/Makefile.inc
deleted file mode 100644 (file)
index bc42757..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#      from @(#)Makefile.inc   8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/gmon/Makefile.inc,v 1.8 2001/03/27 17:26:47 ru Exp $
-
-# gmon sources
-.PATH: ${.CURDIR}/gmon
-
-MISRCS+= gmon.c 
-
-.if ${LIB} == "c"
-MAN3 += moncontrol.3
-
-MLINKS += moncontrol.3 monstartup.3
-.endif
-
-GFLAGS = -O -pipe -Wmost -g -fno-common
-.if $(MACHINE_ARCH) != arm
-GFLAGS += -force_cpusubtype_ALL
-.endif
-.if ${GCC_42} != YES
-GFLAGS += -no-cpp-precomp
-.endif
-.ifdef SDKROOT
-GFLAGS += -isysroot '${SDKROOT}'
-.endif # SDKROOT
-
-# mcount cannot be compiled with profiling
-gmon.po: 
-       ${MYCC} -arch ${CCARCH} ${GFLAGS} \
-               -I${.CURDIR}/include \
-               -I${SYMROOT}/include \
-               -I${INCLUDEDIR} \
-               -I${INCLUDEDIR}/objc \
-               ${PRIVINC} \
-               -c ${.CURDIR}/gmon/gmon.c -o gmon.po
-
-#gmon.po: gmon.o
-#      cp gmon.o gmon.po
index 20ce8551afb59abfb884dbe9c41168fdcd4697e7..ff2f4edc43aeadba15e1efee2b62f2455d6ce0f3 100644 (file)
  *     Added support for dynamic shared libraries.  Also removed the code that
  *     had been ifdef'ed out for profiling fixed shared libraries and
  *     objective-C.
+ * 
+ *  29-Aug-11 Vishal Patel (vishal_patel) at Apple
+ *     Removed code that made calls to deprecated syscalls profil() and 
+ *     add_profil(). The syscalls are not supported since 2008 and planned
+ *     to be completely removed soon. Similarly the monitor apis are also
+ *     deprecated.
+ *
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
@@ -152,68 +159,11 @@ typedef struct {
 static mon_t *mon = NULL;
 static unsigned long nmon = 0;
 
-static void monsetup(
-    mon_t *m,
-    char *lowpc,
-    char *highpc);
-static long getprofhz(
-    void);
-
 void
 moninit(
 void)
 {
-#ifndef __LP64__
-    const struct section *section;
-#else
-    const struct section_64 *section;
-#endif
-    char *lowpc, *highpc;
-    unsigned long i;
-
-       monreset();
-       init = 1;
-
-       section = getsectbyname("__TEXT", "__text");
-       lowpc = (char *)section->addr,
-       highpc = (char *)(section->addr + section->size);
-
-       if(mon == NULL){
-           if((mon = malloc(sizeof(mon_t))) == NULL){
-               write(2, MSG, sizeof(MSG) - 1);
-               return;
-           }
-           nmon = 1;
-           memset(mon, '\0', sizeof(mon_t));
-       }
-       /*
-        * To continue to make monstartup() and the functions that existed
-        * before adding multiple profiling areas working correctly the new
-        * calls to get the dyld loaded code profiled are made after
-        * the first mon_t is allocated so that they will not use the 
-        * first mon_t and the old calls will always use the first mon_t
-        * in the list.
-        */
-       monsetup(mon, lowpc, highpc);
-
-       profil(mon->sbuf + sizeof(gmonhdr_t),
-              mon->ssiz - sizeof(gmonhdr_t),
-              (u_long)mon->lowpc, mon->scale);
-       for(i = 1; i < nmon; i++)
-           add_profil(mon[i].sbuf + sizeof(gmonhdr_t),
-                      mon[i].ssiz - sizeof(gmonhdr_t),
-                      (u_long)mon[i].lowpc, mon[i].scale);
-       init = 0;
-       profiling = 0;
-
-#if defined(__DYNAMIC__)
-        /*
-        * Call _dyld_moninit() if the dyld is present.  This is done after the
-        * above calls so the dynamic libraries will be added after the
-        * executable.
-        */
-       _dyld_moninit(monaddition);
-#endif
+       return; // Deprecated api. do nothing
 }
 
 void
@@ -221,16 +171,7 @@ monstartup(
 char *lowpc,
 char *highpc)
 {
-       monreset();
-       if(mon == NULL){
-           if((mon = malloc(sizeof(mon_t))) == NULL){
-               write(2, MSG, sizeof(MSG) - 1);
-               return;
-           }
-           nmon = 1;
-           memset(mon, '\0', sizeof(mon_t));
-       }
-       monsetup(mon, lowpc, highpc);
+       return; // Deprecated api. do nothing
 }
 
 /*
@@ -242,314 +183,21 @@ monaddition(
 char *lowpc,
 char *highpc)
 {
-    char save_profiling;
-    mon_t *m;
-
-       if(mon == NULL){
-           monstartup(lowpc, highpc);
-           return;
-       }
-       save_profiling = profiling;
-       profiling = -1;
-       if((mon = realloc(mon, (nmon + 1) * sizeof(mon_t))) == NULL){
-           write(2, MSG, sizeof(MSG) - 1);
-           return;
-       }
-       m = mon + nmon;
-       memset(m, '\0', sizeof(mon_t));
-       nmon++;
-       monsetup(m, lowpc, highpc);
-       profiling = save_profiling;
-}
-
-static
-void
-monsetup(
-mon_t *m,
-char *lowpc,
-char *highpc)
-{
-    long monsize;
-    char *buffer;
-    kern_return_t ret;
-    gmonhdr_t *p;
-    uintptr_t o;
-
-       /*
-        * round lowpc and highpc to multiples of the density we're using
-        * so the rest of the scaling (here and in gprof) stays in longs.
-        */
-       lowpc = (char *)ROUNDDOWN((uintptr_t)lowpc,
-                                 HISTFRACTION * sizeof(HISTCOUNTER));
-       m->lowpc = lowpc;
-       highpc = (char *)ROUNDUP((uintptr_t)highpc,
-                                HISTFRACTION * sizeof(HISTCOUNTER));
-       m->highpc = highpc;
-
-       if(m->froms)
-           vm_deallocate(mach_task_self(),
-                         (vm_address_t)m->froms,
-                         (vm_size_t)(m->textsize / HASHFRACTION));
-       m->textsize = highpc - lowpc;
-       ret = vm_allocate(mach_task_self(),
-                         (vm_address_t *)&m->froms,
-                         (vm_size_t)(m->textsize / HASHFRACTION),
-                          TRUE);
-       if(ret != KERN_SUCCESS){
-           write(2, MSG, sizeof(MSG) - 1);
-           m->froms = 0;
-           return;
-       }
-
-       if(m->sbuf)
-           vm_deallocate(mach_task_self(),
-                         (vm_address_t)m->sbuf,
-                         (vm_size_t)m->ssiz);
-       monsize = (m->textsize / HISTFRACTION) + sizeof(gmonhdr_t);
-       ret = vm_allocate(mach_task_self(),
-                         (vm_address_t *)&buffer,
-                         (vm_size_t)monsize,
-                          TRUE);
-       if(ret != KERN_SUCCESS){
-           write(2, MSG, sizeof(MSG) - 1);
-           m->sbuf = 0;
-           return;
-       }
-
-       if(m->tos)
-           vm_deallocate(mach_task_self(),
-                         (vm_address_t)m->tos,
-                         (vm_size_t)(m->tolimit * sizeof(tostruct_t)));
-       m->tolimit = m->textsize * ARCDENSITY / 100;
-       if(m->tolimit < MINARCS){
-           m->tolimit = MINARCS;
-       }
-       else if(m->tolimit > 65534){
-           m->tolimit = 65534;
-       }
-       ret =  vm_allocate(mach_task_self(), 
-                          (vm_address_t *)&m->tos,
-                          (vm_size_t)(m->tolimit * sizeof(tostruct_t)),
-                           TRUE);
-       if(ret != KERN_SUCCESS){
-           write(2, MSG, sizeof(MSG) - 1);
-           m->tos = 0;
-           return;
-       }
-       m->tos[0].link = 0; /* a nop since tos was vm_allocated and is zero */
-
-       /*
-        * If this is call to monsetup() was via monstartup() (m == mon) then
-        * it is using or reusing the first pc range and then the pc sample 
-        * buffer can be setup by the system call profil() via monitor() via
-        * a moncontrol(1) call.
-        *
-        * Otherwise this is call to monsetup() was via monaddition() and a
-        * new system call is needed to add an additional pc sample buffer in
-        * the kernel.
-        */
-       if(m == mon && !init){
-           monitor(lowpc, highpc, buffer, monsize, m->tolimit);
-       }
-       else{
-           /* monitor() functionality */
-           m->sbuf = buffer;
-           m->ssiz = monsize;
-           p = (gmonhdr_t *)m->sbuf;
-           memset(p, '\0', sizeof(gmonhdr_t));
-           p->lpc = (uintptr_t)m->lowpc;
-           p->hpc = (uintptr_t)m->highpc;
-           p->ncnt = m->ssiz;
-           p->version = GMONVERSION;
-           p->profrate = getprofhz();
-           o = highpc - lowpc;
-           if((monsize - sizeof(gmonhdr_t)) < o)
-/* POSSIBLE BUG, if "(float) (monsize - sizeof(gmonhdr_t))/ o)" is zero
- * then m->scale will be set to zero and the add_profil() call will disable
- * profiling */
-               m->scale = ((float) (monsize - sizeof(gmonhdr_t))/ o) *
-                          SCALE_1_TO_1;
-           else
-               m->scale = SCALE_1_TO_1;
-
-            /* moncontrol(mode == 1) functionality */
-           if(!init)
-               add_profil(m->sbuf + sizeof(gmonhdr_t),
-                          m->ssiz - sizeof(gmonhdr_t),
-                          (uintptr_t)m->lowpc, m->scale);
-       }
+       return; // Deprecated api. do nothing
 }
 
 void
 monreset(
 void)
 {
-    unsigned long i;
-    mon_t *m;
-    gmonhdr_t *p;
-
-       moncontrol(0);
-       if(mon == NULL)
-           return;
-       for(i = 0; i < nmon; i++){
-           m = mon + i;
-           if(m->sbuf != NULL){
-               memset(m->sbuf, '\0', m->ssiz);
-               p = (gmonhdr_t *)m->sbuf;
-               p->lpc = (uintptr_t)m->lowpc;
-               p->hpc = (uintptr_t)m->highpc;
-               p->ncnt = m->ssiz;
-               p->version = GMONVERSION;
-               p->profrate = getprofhz();
-           }
-           if(m->froms != NULL)
-               memset(m->froms, '\0', m->textsize / HASHFRACTION);
-           if(m->tos != NULL)
-               memset(m->tos, '\0', m->tolimit * sizeof(tostruct_t));
-       }
-       order = 0;
-       moncontrol(1);
+       return; // Deprecated api. do nothing
 }
 
 void
 monoutput(
 const char *filename)
 {
-    int fd;
-    unsigned long i, fromindex, endfrom, toindex;
-    uint32_t magic;
-    gmon_data_t sample_data, arc_data, dyld_data;
-    char *frompc;
-    rawarc_order_t rawarc_order;
-    mon_t *m;
-    uint32_t image_count;
-    intptr_t image_header;
-    const char *image_name;
-
-       moncontrol(0);
-       m = mon;
-       if(m == NULL)
-           return;
-       fd = creat(filename, 0666);
-       if(fd < 0){
-           perror("mcount: gmon.out");
-           return;
-       }
-
-#ifndef __LP64__
-       magic = GMON_MAGIC;
-#else
-       magic = GMON_MAGIC_64;
-#endif
-       write(fd, &magic, sizeof(uint32_t));
-
-#if defined(__DYNAMIC__)
-        {
-           image_count = _dyld_image_count();
-           if(image_count > 1){
-#ifdef DYLD_DEBUG
-               printf("image_count = %lu\n", image_count - 1);
-               for(i = 1; i < image_count; i++){
-                   image_header = _dyld_get_image_header(i);
-                   printf("\timage_header %p\n", image_header);
-                   image_name = _dyld_get_image_name(i);
-                   printf("\timage_name %s\n", image_name);
-               }
-#endif
-               /*
-                * Calculate the dyld_data.size.
-                */
-               dyld_data.type = GMONTYPE_DYLD2_STATE;
-               dyld_data.size = sizeof(uint32_t) +
-                   sizeof(intptr_t) * (image_count - 1);
-               for(i = 1; i < image_count; i++){
-                   image_name = _dyld_get_image_name(i);
-                   dyld_data.size += strlen(image_name) + 1;
-               }
-
-               /*
-                * Write the dyld_data.
-                */
-               write(fd, &dyld_data, sizeof(gmon_data_t));
-               image_count--;
-               write(fd, &image_count, sizeof(uint32_t));
-               image_count++;
-               for(i = 1; i < image_count; i++){
-                   image_header = (intptr_t)_dyld_get_image_header(i);
-                   write(fd, &image_header, sizeof(intptr_t));
-                   image_name = _dyld_get_image_name(i);
-                   write(fd, image_name, strlen(image_name) + 1);
-               }
-           }
-       }
-#endif
-       for(i = 0; i < nmon; i++){
-           m = mon + i;
-#ifdef DEBUG
-           fprintf(stderr, "[monoutput] sbuf %p ssiz %d\n", m->sbuf, m->ssiz);
-#endif
-           sample_data.type = GMONTYPE_SAMPLES;
-           sample_data.size = m->ssiz;
-           write(fd, &sample_data, sizeof(gmon_data_t));
-           /*
-            * Write the gmonhdr_t and the pc-sample buffer.  Note the
-            * gmonhdr_t is in sbuf at the beginning of sbuf already
-            * filled in.
-            */
-           write(fd, m->sbuf, m->ssiz);
-
-           /*
-            * Now write out the raw arcs.
-            */
-           endfrom = m->textsize / (HASHFRACTION * sizeof(*m->froms));
-           arc_data.type = GMONTYPE_ARCS_ORDERS;
-           arc_data.size = 0;
-#ifdef DEBUG
-           fprintf(stderr, "[monoutput] raw arcs, total %lu\n", endfrom);
-#endif
-           for(fromindex = 0; fromindex < endfrom; fromindex++){
-               if(m->froms[fromindex] == 0){
-                   continue;
-               }
-#ifdef DEBUG
-               fprintf(stderr, "[monoutput] raw arc count at index[%lu] %u\n",
-                       fromindex, m->froms[fromindex]);
-#endif
-               frompc = m->lowpc +
-                        (fromindex * HASHFRACTION * sizeof(*m->froms));
-               for(toindex = m->froms[fromindex];
-                   toindex != 0;
-                   toindex = m->tos[toindex].link){
-                   arc_data.size += sizeof(rawarc_order_t);
-               }
-           }
-           write(fd, &arc_data, sizeof(gmon_data_t));
-
-           for(fromindex = 0; fromindex < endfrom; fromindex++){
-               if(m->froms[fromindex] == 0){
-                   continue;
-               }
-               frompc = m->lowpc +
-                        (fromindex * HASHFRACTION * sizeof(*m->froms));
-               for(toindex = m->froms[fromindex];
-                   toindex != 0;
-                   toindex = m->tos[toindex].link){
-#ifdef DEBUG
-                   fprintf(stderr, "[monoutput] frompc %p selfpc %p "
-                           "count %ld order %lu\n", frompc,
-                           m->tos[toindex].selfpc,
-                           m->tos[toindex].count, m->tos[toindex].order);
-#endif
-                   rawarc_order.raw_frompc = (uintptr_t)frompc;
-                   rawarc_order.raw_selfpc = (uintptr_t)
-                                              m->tos[toindex].selfpc;
-                   rawarc_order.raw_count = m->tos[toindex].count;
-                   rawarc_order.raw_order = m->tos[toindex].order;
-                   write(fd, &rawarc_order, sizeof(rawarc_order_t));
-               }
-           }
-       }
-       close(fd);
+       return; // Deprecated api. do nothing
 }
 
 void
@@ -560,37 +208,7 @@ char *buf,
 int bufsiz,
 int nfunc) /* nfunc is not used; available for compatability only. */
 {
-    intptr_t o;
-    gmonhdr_t *p;
-    mon_t *m;
-
-       moncontrol(0);
-       m = mon;
-       if(m == NULL)
-           return;
-       if(lowpc == 0){
-           moncontrol(0);
-           monoutput("gmon.out");
-           return;
-       }
-       m->sbuf = buf;
-       m->ssiz = bufsiz;
-       p = (gmonhdr_t *)buf;
-       memset(p, '\0', sizeof(gmonhdr_t));
-       p->lpc = (uintptr_t)lowpc;
-       p->hpc = (uintptr_t)highpc;
-       p->ncnt = m->ssiz;
-       p->version = GMONVERSION;
-       p->profrate = getprofhz();
-       bufsiz -= sizeof(gmonhdr_t);
-       if(bufsiz <= 0)
-           return;
-       o = highpc - lowpc;
-       if(bufsiz < o)
-           m->scale = ((float) bufsiz / o) * SCALE_1_TO_1;
-       else
-           m->scale = SCALE_1_TO_1;
-       moncontrol(1);
+       return; // Deprecated api. do nothing
 }
 
 /*
@@ -602,28 +220,7 @@ void
 moncontrol(
 int mode)
 {
-    mon_t *m;
-    unsigned long i;
-
-       if(mode){
-           /* start */
-           m = mon;
-           if(m != NULL){
-               profil(m->sbuf + sizeof(gmonhdr_t),
-                      m->ssiz - sizeof(gmonhdr_t),
-                      (u_long)m->lowpc, m->scale);
-               for(i = 1; i < nmon; i++)
-                   add_profil(mon[i].sbuf + sizeof(gmonhdr_t),
-                              mon[i].ssiz - sizeof(gmonhdr_t),
-                              (u_long)mon[i].lowpc, mon[i].scale);
-               profiling = 0;
-           }
-       }
-       else{
-           /* stop */
-           profil((char *)0, 0, 0, 0);
-           profiling = -1;
-       }
+       return; // Deprecated api. do nothing
 }
 
 void
@@ -631,145 +228,5 @@ moncount(
 char *frompc,
 char *selfpc)
 {
-    unsigned short *frompcindex;
-    tostruct_t *top, *prevtop;
-    unsigned long i, toindex;
-    mon_t *m;
-
-       m = mon;
-       if(m == NULL)
-           return;
-       /*
-        * Check that we are profiling and that we aren't recursively invoked.
-        * This should really be a test and set instruction in changing the
-        * value of profiling.
-        */
-       if(profiling)
-           return;
-       profiling++;
-
-
-#ifdef DEBUG
-       fprintf(stderr, "[moncount] frompc %p selfpc %p\n", frompc, selfpc);
-#endif
-       frompcindex = (unsigned short *)frompc;
-
-       /*
-        * check that frompcindex is a reasonable pc value.
-        * for example: signal catchers get called from the stack,
-        *              not from text space.  too bad.
-        */
-       for(i = 0; i < nmon; i++){
-           m = mon + i;
-           if((uintptr_t)frompcindex >= (uintptr_t)m->lowpc &&
-              (uintptr_t)frompcindex <  (uintptr_t)m->highpc)
-               break;
-       }
-       if(i == nmon){
-           goto done;
-       }
-       else{
-           frompcindex = (unsigned short *)
-                 ((uintptr_t)frompcindex - (uintptr_t)m->lowpc);
-       }
-       frompcindex =
-           &m->froms[((uintptr_t)frompcindex) / (HASHFRACTION * sizeof(*m->froms))];
-       toindex = *frompcindex;
-       if(toindex == 0){
-           /*
-            *  first time traversing this arc
-            */
-           toindex = ++m->tos[0].link;
-           if(toindex >= m->tolimit){
-               goto overflow;
-           }
-           *frompcindex = toindex;
-           top = &m->tos[toindex];
-           top->selfpc = (uintptr_t)selfpc;
-           top->count = 1;
-           top->link = 0;
-           top->order = ++order;
-           goto done;
-       }
-       top = &m->tos[toindex];
-       if(top->selfpc == (uintptr_t)selfpc){
-           /*
-            * arc at front of chain; usual case.
-            */
-           top->count++;
-           goto done;
-       }
-       /*
-        * have to go looking down chain for it.
-        * top points to what we are looking at,
-        * prevtop points to previous top.
-        * we know it is not at the head of the chain.
-        */
-       for(; /* goto done */; ){
-           if(top->link == 0){
-               /*
-                * top is end of the chain and none of the chain
-                * had top->selfpc == selfpc.
-                * so we allocate a new tostruct_t
-                * and link it to the head of the chain.
-                */
-               toindex = ++m->tos[0].link;
-               if(toindex >= m->tolimit){
-                   goto overflow;
-               }
-               top = &m->tos[toindex];
-               top->selfpc = (uintptr_t)selfpc;
-               top->count = 1;
-               top->link = *frompcindex;
-               top->order = ++order;
-               *frompcindex = toindex;
-               goto done;
-           }
-           /*
-            * otherwise, check the next arc on the chain.
-            */
-           prevtop = top;
-           top = &m->tos[top->link];
-           if(top->selfpc == (uintptr_t)selfpc){
-               /*
-                * there it is.
-                * increment its count
-                * move it to the head of the chain.
-                */
-               top->count++;
-               toindex = prevtop->link;
-               prevtop->link = top->link;
-               top->link = *frompcindex;
-               *frompcindex = toindex;
-               goto done;
-           }
-       }
-done:
-       profiling--;
-       return;
-
-overflow:
-       profiling++; /* halt further profiling */
-#define        TOLIMIT "mcount: tos overflow\n"
-       write(2, TOLIMIT, sizeof(TOLIMIT) - 1);
-}
-
-/*
- * Get the profiling rate.
- */
-static
-long
-getprofhz(void)
-{
-    int mib[2];
-    size_t size;
-    struct clockinfo clockrate;
-
-        mib[0] = CTL_KERN;
-        mib[1] = KERN_CLOCKRATE;
-        clockrate.profhz = 1;
-        size = sizeof(clockrate);
-        if(sysctl(mib, 2, &clockrate, &size, NULL, 0) < 0)
-               ;
-        return(clockrate.profhz);
+       return; //Deprecated api. do nothing
 }
diff --git a/i386/gen/Makefile.inc b/i386/gen/Makefile.inc
deleted file mode 100644 (file)
index f759c80..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-.PATH: ${.CURDIR}/i386/gen
-
-MDSRCS+= _ctx_start.S \
-       _setcontext.S \
-       getcontext.S \
-       getmcontext.c \
-       icacheinval.s \
-       makecontext.c \
-       mcount.s \
-       setcontext.c \
-       setjmperr.c \
-       swapcontext.c \
-       cpu_number.s
-
-.for _src in makecontext.c setcontext.c swapcontext.c
-CFLAGS-${_src} += -fomit-frame-pointer
-# -pg and -fomit-frame-pointer don't work together, so just use -g
-${_src:R}.po: ${_src} _STANDARD_DEBUG
-.endfor
-
-CFLAGS += -I${.CURDIR}/i386/gen
-
-DYLDSRCS += icacheinval.s \
-       cpu_number.s
diff --git a/i386/pthreads/Makefile.inc b/i386/pthreads/Makefile.inc
deleted file mode 100644 (file)
index 7fd652c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-.PATH: ${.CURDIR}/i386/pthreads
-MDSRCS += \
-       init_cpu_capabilities.c \
-       get_cpu_capabilities.s \
-       preempt.s \
-       pthread_mutex_lock.s \
-       pthread_set_self.s \
-       pthread_self.s \
-       pthread_getspecific.s \
-       start_wqthread.s \
-       thread_start.s
-
-DYLDSRCS += \
-       preempt.s \
-       pthread_set_self.s \
-       pthread_self.s \
-       pthread_getspecific.s
diff --git a/i386/pthreads/get_cpu_capabilities.s b/i386/pthreads/get_cpu_capabilities.s
deleted file mode 100644 (file)
index 51cd899..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/* Get the cpu_capabilities bit vector out of the comm page */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-.text
-.align 2, 0x90
-.private_extern __get_cpu_capabilities
-__get_cpu_capabilities:
-       movl    _COMM_PAGE_CPU_CAPABILITIES, %eax
-       ret
index d9684aa1ab9b3a844529fbfc6025526a333ce514..c0ac80161edffbc4e726bcb44bc6bc5c3fd420e9 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-
+#include <architecture/i386/asm_help.h>
 
        .text
        .align  2
@@ -45,7 +45,9 @@ __commpage_pthread_mutex_lock:
        decl    %edx                        // decrement max spin count
        jnz     1b                          // keep spinning
 2:
-       movl    $(_COMM_PAGE_PFZ_MUTEX_LOCK), %ecx
+       EXTERN_TO_REG(_commpage_pfz_base, %ecx)
+       movl    (%ecx), %ecx
+       addl    $(_COMM_TEXT_PFZ_MUTEX_LOCK_OFFSET), %ecx
        call    *%ecx
        testl   %ebx,%ebx                   // pending preemption?
        jz      3f
diff --git a/i386/stdlib/gdtoa.mk b/i386/stdlib/gdtoa.mk
deleted file mode 100644 (file)
index 383aebe..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# Long double is 80 bits
-GDTOA_FBSDSRCS+= gdtoa-strtopx.c machdep_ldisx.c
diff --git a/i386/string/Makefile.inc b/i386/string/Makefile.inc
deleted file mode 100644 (file)
index 36d022d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Version$
-#
-# i386-optimised string functions.
-#
-#
-#
-.PATH: ${.CURDIR}/i386/string
-MDSRCS += \
-       bcopy.c \
-       bcopy_scalar.s \
-       bcopy_sse2.s \
-       bcopy_sse3x.s \
-       bcopy_sse42.s \
-       bzero.c \
-       bzero_scalar.s \
-       bzero_sse2.s \
-       bzero_sse42.s \
-       __bzero.s \
-       longcopy_sse3x.s \
-       memset_pattern_sse2.s \
-       ffs.s \
-       memcpy.c \
-       memmove.c \
-       strlcat.s \
-       strlcpy.s \
-       strlen.s \
-       strcpy.s \
-       strcmp.s \
-       strncpy.s \
-       strncmp.s \
-       memcmp.s \
-       memset.s
-
-SUPPRESSSRCS += bcmp.c
-
-DYLDSRCS += \
-       __bzero.s \
-       bcopy_scalar.s \
-       bzero_scalar.s \
-       ffs.s \
-       memcmp.s \
-       memset_pattern_sse2.s \
-       strcmp.s \
-       strlen.s
diff --git a/i386/sys/Makefile.inc b/i386/sys/Makefile.inc
deleted file mode 100644 (file)
index 7a83351..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.PATH: ${.CURDIR}/i386/sys
-
-AINC+= -I${.CURDIR}/i386/sys
-
-MDSRCS+= OSAtomic.s \
-       atomic.c \
-       i386_gettimeofday_asm.s \
-       mach_absolute_time.c \
-       mach_absolute_time_asm.s \
-       _setjmp.s \
-       setjmp.s \
-       _sigtramp.s \
-       spinlocks_asm.s \
-       spinlocks.s
-
-DYLDSRCS += \
-       OSAtomic.s \
-       i386_gettimeofday_asm.s \
-       mach_absolute_time_asm.s \
-       spinlocks_asm.s
index 49834cee87caed1c8f6e47b7daaa0940e019aea0..138e5c07cc673d705ae1d33aa6f3e7dc3a5d2207 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <machine/cpu_capabilities.h>
 #include <platfunc.h>
+#include <architecture/i386/asm_help.h>
 
 #define ATOMIC_UP      0
 #define ATOMIC_MP      1
@@ -396,8 +397,10 @@ _OSAtomicFifoEnqueue:
        xorl    %ebx,%ebx       // clear "preemption pending" flag
        movl    16(%esp),%edi   // %edi == ptr to list head
        movl    20(%esp),%esi   // %esi == new
+       EXTERN_TO_REG(_commpage_pfz_base,%ecx)
+       movl    (%ecx), %ecx
+       addl    $(_COMM_TEXT_PFZ_ENQUEUE_OFFSET), %ecx
        movl    24(%esp),%edx   // %edx == offset
-       movl    $(_COMM_PAGE_PFZ_ENQUEUE), %ecx
        call    *%ecx
        testl   %ebx,%ebx       // pending preemption?
        jz      1f
@@ -416,8 +419,10 @@ _OSAtomicFifoDequeue:
        pushl   %ebx
        xorl    %ebx,%ebx       // clear "preemption pending" flag
        movl    16(%esp),%edi   // %edi == ptr to list head
+       PICIFY(_commpage_pfz_base)
+       movl    (%edx),%ecx
        movl    20(%esp),%edx   // %edx == offset
-       movl    $(_COMM_PAGE_PFZ_DEQUEUE), %ecx
+       addl    $(_COMM_TEXT_PFZ_DEQUEUE_OFFSET), %ecx
        call    *%ecx
        testl   %ebx,%ebx       // pending preemption?
        jz      1f
index 100d570a0a0c0567f83ffd405916621da439da82..db74be935fadfa1841fee0b255f3df0e36670ee7 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
+#include <_types.h>
 
 #ifdef _NLS_PRIVATE
 /*
@@ -82,7 +83,7 @@ struct _nls_msg_hdr {
 
 #endif /* _NLS_PRIVATE */
 
-#define        NL_SETD         0
+#define        NL_SETD         1
 #define        NL_CAT_LOCALE   1
 
 typedef struct __nl_cat_d {
@@ -90,9 +91,9 @@ typedef struct __nl_cat_d {
        int     __size;
 } *nl_catd;
 
-#ifndef _NL_ITEM_DECLARED
-typedef        __nl_item       nl_item;
-#define        _NL_ITEM_DECLARED
+#ifndef _NL_ITEM
+typedef __darwin_nl_item        nl_item;
+#define _NL_ITEM
 #endif
 
 __BEGIN_DECLS
diff --git a/include/FreeBSD/nl_types.h.patch b/include/FreeBSD/nl_types.h.patch
deleted file mode 100644 (file)
index c411b64..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- nl_types.h.orig    2010-10-29 00:51:39.000000000 -0700
-+++ nl_types.h 2010-10-29 00:53:25.000000000 -0700
-@@ -43,6 +43,7 @@
- #include <sys/cdefs.h>
- #include <sys/types.h>
-+#include <_types.h>
- #ifdef _NLS_PRIVATE
- /*
-@@ -82,7 +83,7 @@
- #endif        /* _NLS_PRIVATE */
--#define       NL_SETD         0
-+#define       NL_SETD         1
- #define       NL_CAT_LOCALE   1
- typedef struct __nl_cat_d {
-@@ -90,9 +91,9 @@
-       int     __size;
- } *nl_catd;
--#ifndef _NL_ITEM_DECLARED
--typedef       __nl_item       nl_item;
--#define       _NL_ITEM_DECLARED
-+#ifndef _NL_ITEM
-+typedef __darwin_nl_item        nl_item;
-+#define _NL_ITEM
- #endif
- __BEGIN_DECLS
diff --git a/include/Makefile.inc b/include/Makefile.inc
deleted file mode 100644 (file)
index 83d8b47..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-.include "${.CURDIR}/include/arpa/Makefile.inc"
-.include "${.CURDIR}/include/libkern/Makefile.inc"
-.include "${.CURDIR}/include/protocols/Makefile.inc"
-.include "${.CURDIR}/include/malloc/Makefile.inc"
-.ifdef FEATURE_LEGACY_NXZONE_APIS
-.include "${.CURDIR}/include/objc/Makefile.inc"
-.endif
-.include "${.CURDIR}/include/secure/Makefile.inc"
-.include "${.CURDIR}/include/sys/Makefile.inc"
-.include "${.CURDIR}/include/xlocale/Makefile.inc"
-
-INC_INSTHDRS += NSSystemDirectories.h \
-               _locale.h \
-               _structs.h \
-               _types.h \
-               _wctype.h \
-               _xlocale.h \
-               aio.h \
-               alloca.h \
-               ar.h \
-               asl.h \
-               assert.h \
-               asm.h \
-               bitstring.h \
-               cpio.h \
-               crt_externs.h \
-               ctype.h \
-               db.h \
-               dirent.h \
-               disktab.h \
-               err.h \
-               errno.h \
-               fcntl.h \
-               fmtmsg.h \
-               fnmatch.h \
-               fsproperties.h \
-               fstab.h \
-               fts.h \
-               ftw.h \
-               getopt.h \
-               glob.h \
-               grp.h \
-               inttypes.h \
-               iso646.h \
-               langinfo.h \
-               libc.h \
-               libgen.h \
-               limits.h \
-               locale.h \
-               memory.h \
-               monetary.h \
-               monitor.h \
-               mpool.h \
-               ndbm.h \
-               nl_types.h \
-               nlist.h \
-               paths.h \
-               poll.h \
-               pwd.h \
-               ranlib.h \
-               readpassphrase.h \
-               regex.h \
-               runetype.h \
-               search.h \
-               semaphore.h \
-               setjmp.h \
-               sgtty.h \
-               signal.h \
-               spawn.h \
-               stab.h \
-               standards.h \
-               stdbool.h \
-               stddef.h \
-               stdio.h \
-               stdint.h \
-               stdlib.h \
-               strhash.h \
-               string.h \
-               stringlist.h \
-               strings.h \
-               struct.h \
-               sysexits.h \
-               syslog.h \
-               tar.h \
-               termios.h \
-               time.h \
-               timeconv.h \
-               ttyent.h \
-               ucontext.h \
-               ulimit.h \
-               unistd.h \
-               util.h \
-               utime.h \
-               utmpx.h \
-               vis.h \
-               wchar.h \
-               wctype.h \
-               wordexp.h \
-               xlocale.h
-
-.ifdef FEATURE_LEGACY_RUNE_APIS
-INC_INSTHDRS += rune.h
-.endif
-
-.ifdef FEATURE_LEGACY_UTMP_APIS
-INC_INSTHDRS += utmp.h
-.endif
-
-.PATH: ${.CURDIR}/include
-CWD := ${.CURDIR}/include
-
-MAN3 += sysexits.3
-
-INC_INSTHDRS := ${INC_INSTHDRS:S/^/${.CURDIR}\/include\//}
-INSTHDRS += ${INC_INSTHDRS}
-
-LOCALHDRS += ${.CURDIR}/include/spawn_private.h
-
-.include "Makefile.nbsd_begin"
-NBSDHDRS = utmpx.h
-.include "Makefile.nbsd_end"
-
-.include "Makefile.fbsd_begin"
-FBSDHDRS= nl_types.h
-.include "Makefile.fbsd_end"
-
index a68db01e4918a636f9985b121fdd50bc0b7dc2b9..616b4c031b476f9dd2fa6c094525fcea459d8dc2 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
 /*     $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $    */
 
 /*-
 #ifndef        _UTMPX_H_
 #define        _UTMPX_H_
 
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/socket.h>
+#include <_types.h>
 #include <sys/time.h>
+#include <sys/cdefs.h>
+#include <Availability.h>
+
+#ifndef _PID_T
+#define _PID_T
+typedef __darwin_pid_t     pid_t;
+#endif
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#ifndef _UID_T
+#define _UID_T
+typedef __darwin_uid_t     uid_t;
+#endif
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
 
 #define        _PATH_UTMPX             "/var/run/utmpx"
-#define        _PATH_WTMPX             "/var/log/wtmpx"
-#define        _PATH_LASTLOGX          "/var/log/lastlogx"
-#define        _PATH_UTMP_UPDATE       "/usr/libexec/utmp_update"
 
-#define _UTX_USERSIZE  32
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define        UTMPX_FILE      _PATH_UTMPX
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
+
+#define _UTX_USERSIZE  256     /* matches MAXLOGNAME */
 #define _UTX_LINESIZE  32
 #define        _UTX_IDSIZE     4
 #define _UTX_HOSTSIZE  256
 
-#if defined(_NETBSD_SOURCE)
-#define UTX_USERSIZE   _UTX_USERSIZE
-#define UTX_LINESIZE   _UTX_LINESIZE
-#define        UTX_IDSIZE      _UTX_IDSIZE
-#define UTX_HOSTSIZE   _UTX_HOSTSIZE
-#endif
-
 #define EMPTY          0
 #define RUN_LVL                1
 #define BOOT_TIME      2
 #define USER_PROCESS   7
 #define DEAD_PROCESS   8
 
-#if defined(_NETBSD_SOURCE)
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
 #define ACCOUNTING     9
 #define SIGNATURE      10
-#endif
+#define SHUTDOWN_TIME  11
+
+#define UTMPX_AUTOFILL_MASK                    0x8000
+#define UTMPX_DEAD_IF_CORRESPONDING_MASK       0x4000
+
+/* notify(3) change notification name */
+#define UTMPX_CHANGE_NOTIFICATION              "com.apple.system.utmpx"
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
 
 /*
  * The following structure describes the fields of the utmpx entries
- * stored in _PATH_UTMPX or _PATH_WTMPX. This is not the format the
+ * stored in _PATH_UTMPX. This is not the format the
  * entries are stored in the files, and application should only access
  * entries using routines described in getutxent(3).
  */
 
+#ifdef _UTMPX_COMPAT
 #define ut_user ut_name
 #define ut_xtime ut_tv.tv_sec
+#endif /* _UTMPX_COMPAT */
 
 struct utmpx {
-       char ut_name[_UTX_USERSIZE];    /* login name */
-       char ut_id[_UTX_IDSIZE];        /* inittab id */
+       char ut_user[_UTX_USERSIZE];    /* login name */
+       char ut_id[_UTX_IDSIZE];        /* id */
        char ut_line[_UTX_LINESIZE];    /* tty name */
-       char ut_host[_UTX_HOSTSIZE];    /* host name */
-       uint16_t ut_session;            /* session id used for windowing */
-       uint16_t ut_type;               /* type of this entry */
        pid_t ut_pid;                   /* process id creating the entry */
-       struct {
-               uint16_t e_termination; /* process termination signal */
-               uint16_t e_exit;        /* process exit status */
-       } ut_exit;
-       struct sockaddr_storage ut_ss;  /* address where entry was made from */
+       short ut_type;                  /* type of this entry */
        struct timeval ut_tv;           /* time entry was created */
-       uint32_t ut_pad[10];            /* reserved for future use */
+       char ut_host[_UTX_HOSTSIZE];    /* host name */
+       __uint32_t ut_pad[16];          /* reserved for future use */
 };
 
-#if defined(_NETBSD_SOURCE)
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
 struct lastlogx {
        struct timeval ll_tv;           /* time entry was created */
        char ll_line[_UTX_LINESIZE];    /* tty name */
        char ll_host[_UTX_HOSTSIZE];    /* host name */
-       struct sockaddr_storage ll_ss;  /* address where entry was made from */
 };
-#endif /* !_XOPEN_SOURCE */
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
 
 __BEGIN_DECLS
 
-void setutxent __P((void));
-void endutxent __P((void));
-struct utmpx *getutxent __P((void));
-struct utmpx *getutxid __P((const struct utmpx *));
-struct utmpx *getutxline __P((const struct utmpx *));
-struct utmpx *pututxline __P((const struct utmpx *));
-
-#if defined(_NETBSD_SOURCE)
-int updwtmpx __P((const char *, const struct utmpx *));
-int lastlogxname __P((const char *));
-#ifdef __LIBC12_SOURCE__
-struct lastlogx *getlastlogx __P((uid_t, struct lastlogx *));
-struct lastlogx *__getlastlogx13 __P((const char *, uid_t, struct lastlogx *));
-#else
-struct lastlogx *getlastlogx __P((const char *, uid_t, struct lastlogx *))
-       __RENAME(__getlastlogx13);
-#endif
-int updlastlogx __P((const char *, uid_t, struct lastlogx *));
-struct utmp;
-void getutmp __P((const struct utmpx *, struct utmp *));
-void getutmpx __P((const struct utmp *, struct utmpx *));
-
-int utmpxname __P((const char *));
-
-#endif /* _NETBSD_SOURCE */
+void   endutxent(void);
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+void   endutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+struct lastlogx *
+       getlastlogx(uid_t, struct lastlogx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+struct lastlogx *
+       getlastlogxbyname(const char*, struct lastlogx *)__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+#ifdef UNIFDEF_LEGACY_UTMP_APIS
+struct utmp;   /* forward reference */
+void   getutmp(const struct utmpx *, struct utmp *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+void   getutmpx(const struct utmp *, struct utmpx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+#endif /* UNIFDEF_LEGACY_UTMP_APIS */
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
+
+struct utmpx *
+       getutxent(void);
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+struct utmpx *
+       getutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
+
+struct utmpx *
+       getutxid(const struct utmpx *);
+struct utmpx *
+       getutxline(const struct utmpx *);
+struct utmpx *
+       pututxline(const struct utmpx *);
+void   setutxent(void);
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+void   setutxent_wtmp(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+int    utmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+int    wtmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
 
 __END_DECLS
 
diff --git a/include/NetBSD/utmpx.h.patch b/include/NetBSD/utmpx.h.patch
deleted file mode 100644 (file)
index 3006f1c..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-Index: utmpx.h
-===================================================================
---- utmpx.h    (revision 59377)
-+++ utmpx.h    (working copy)
-@@ -1,3 +1,25 @@
-+/*
-+ * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
-+ *
-+ * @APPLE_LICENSE_HEADER_START@
-+ * 
-+ * This file contains Original Code and/or Modifications of Original Code
-+ * as defined in and that are subject to the Apple Public Source License
-+ * Version 2.0 (the 'License'). You may not use this file except in
-+ * compliance with the License. Please obtain a copy of the License at
-+ * http://www.opensource.apple.com/apsl/ and read it before using this
-+ * file.
-+ * 
-+ * The Original Code and all software distributed under the License are
-+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
-+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
-+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
-+ * Please see the License for the specific language governing rights and
-+ * limitations under the License.
-+ * 
-+ * @APPLE_LICENSE_HEADER_END@
-+ */
- /*    $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $    */
- /*-
-@@ -38,28 +60,34 @@
- #ifndef       _UTMPX_H_
- #define       _UTMPX_H_
-+#include <_types.h>
-+#include <sys/time.h>
- #include <sys/cdefs.h>
--#include <sys/featuretest.h>
--#include <sys/socket.h>
--#include <sys/time.h>
-+#include <Availability.h>
-+#ifndef _PID_T
-+#define _PID_T
-+typedef __darwin_pid_t     pid_t;
-+#endif
-+
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-+#ifndef _UID_T
-+#define _UID_T
-+typedef __darwin_uid_t     uid_t;
-+#endif
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-+
- #define       _PATH_UTMPX             "/var/run/utmpx"
--#define       _PATH_WTMPX             "/var/log/wtmpx"
--#define       _PATH_LASTLOGX          "/var/log/lastlogx"
--#define       _PATH_UTMP_UPDATE       "/usr/libexec/utmp_update"
--#define _UTX_USERSIZE 32
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-+#define       UTMPX_FILE      _PATH_UTMPX
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-+
-+#define _UTX_USERSIZE 256     /* matches MAXLOGNAME */
- #define _UTX_LINESIZE 32
- #define       _UTX_IDSIZE     4
- #define _UTX_HOSTSIZE 256
--#if defined(_NETBSD_SOURCE)
--#define UTX_USERSIZE  _UTX_USERSIZE
--#define UTX_LINESIZE  _UTX_LINESIZE
--#define       UTX_IDSIZE      _UTX_IDSIZE
--#define UTX_HOSTSIZE  _UTX_HOSTSIZE
--#endif
--
- #define EMPTY         0
- #define RUN_LVL               1
- #define BOOT_TIME     2
-@@ -70,75 +98,88 @@
- #define USER_PROCESS  7
- #define DEAD_PROCESS  8
--#if defined(_NETBSD_SOURCE)
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
- #define ACCOUNTING    9
- #define SIGNATURE     10
--#endif
-+#define SHUTDOWN_TIME 11
-+#define UTMPX_AUTOFILL_MASK                   0x8000
-+#define UTMPX_DEAD_IF_CORRESPONDING_MASK      0x4000
-+
-+/* notify(3) change notification name */
-+#define UTMPX_CHANGE_NOTIFICATION             "com.apple.system.utmpx"
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-+
- /*
-  * The following structure describes the fields of the utmpx entries
-- * stored in _PATH_UTMPX or _PATH_WTMPX. This is not the format the
-+ * stored in _PATH_UTMPX. This is not the format the
-  * entries are stored in the files, and application should only access
-  * entries using routines described in getutxent(3).
-  */
-+#ifdef _UTMPX_COMPAT
- #define ut_user ut_name
- #define ut_xtime ut_tv.tv_sec
-+#endif /* _UTMPX_COMPAT */
- struct utmpx {
--      char ut_name[_UTX_USERSIZE];    /* login name */
--      char ut_id[_UTX_IDSIZE];        /* inittab id */
-+      char ut_user[_UTX_USERSIZE];    /* login name */
-+      char ut_id[_UTX_IDSIZE];        /* id */
-       char ut_line[_UTX_LINESIZE];    /* tty name */
--      char ut_host[_UTX_HOSTSIZE];    /* host name */
--      uint16_t ut_session;            /* session id used for windowing */
--      uint16_t ut_type;               /* type of this entry */
-       pid_t ut_pid;                   /* process id creating the entry */
--      struct {
--              uint16_t e_termination; /* process termination signal */
--              uint16_t e_exit;        /* process exit status */
--      } ut_exit;
--      struct sockaddr_storage ut_ss;  /* address where entry was made from */
-+      short ut_type;                  /* type of this entry */
-       struct timeval ut_tv;           /* time entry was created */
--      uint32_t ut_pad[10];            /* reserved for future use */
-+      char ut_host[_UTX_HOSTSIZE];    /* host name */
-+      __uint32_t ut_pad[16];          /* reserved for future use */
- };
--#if defined(_NETBSD_SOURCE)
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
- struct lastlogx {
-       struct timeval ll_tv;           /* time entry was created */
-       char ll_line[_UTX_LINESIZE];    /* tty name */
-       char ll_host[_UTX_HOSTSIZE];    /* host name */
--      struct sockaddr_storage ll_ss;  /* address where entry was made from */
- };
--#endif        /* !_XOPEN_SOURCE */
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
- __BEGIN_DECLS
--void setutxent __P((void));
--void endutxent __P((void));
--struct utmpx *getutxent __P((void));
--struct utmpx *getutxid __P((const struct utmpx *));
--struct utmpx *getutxline __P((const struct utmpx *));
--struct utmpx *pututxline __P((const struct utmpx *));
-+void  endutxent(void);
--#if defined(_NETBSD_SOURCE)
--int updwtmpx __P((const char *, const struct utmpx *));
--int lastlogxname __P((const char *));
--#ifdef __LIBC12_SOURCE__
--struct lastlogx *getlastlogx __P((uid_t, struct lastlogx *));
--struct lastlogx *__getlastlogx13 __P((const char *, uid_t, struct lastlogx *));
--#else
--struct lastlogx *getlastlogx __P((const char *, uid_t, struct lastlogx *))
--      __RENAME(__getlastlogx13);
--#endif
--int updlastlogx __P((const char *, uid_t, struct lastlogx *));
--struct utmp;
--void getutmp __P((const struct utmpx *, struct utmp *));
--void getutmpx __P((const struct utmp *, struct utmpx *));
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-+void  endutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+struct lastlogx *
-+      getlastlogx(uid_t, struct lastlogx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+struct lastlogx *
-+      getlastlogxbyname(const char*, struct lastlogx *)__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+#ifdef UNIFDEF_LEGACY_UTMP_APIS
-+struct utmp;  /* forward reference */
-+void  getutmp(const struct utmpx *, struct utmp *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+void  getutmpx(const struct utmp *, struct utmpx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+#endif /* UNIFDEF_LEGACY_UTMP_APIS */
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
--int utmpxname __P((const char *));
-+struct utmpx *
-+      getutxent(void);
--#endif /* _NETBSD_SOURCE */
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-+struct utmpx *
-+      getutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-+struct utmpx *
-+      getutxid(const struct utmpx *);
-+struct utmpx *
-+      getutxline(const struct utmpx *);
-+struct utmpx *
-+      pututxline(const struct utmpx *);
-+void  setutxent(void);
-+
-+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-+void  setutxent_wtmp(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+int   utmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+int   wtmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-+#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-+
- __END_DECLS
- #endif /* !_UTMPX_H_ */
diff --git a/include/arpa/Makefile.inc b/include/arpa/Makefile.inc
deleted file mode 100644 (file)
index a4fb7b4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-ARPA_INSTHDRS += ftp.h \
-                 nameser_compat.h \
-                 telnet.h \
-                 tftp.h 
-ARPA_INSTHDRS := ${ARPA_INSTHDRS:S/^/${.CURDIR}\/include\/arpa\//}
index 1761e9ba8660e1e2f3726ed71318431a71ea7245..ec4799efff5de4a2a6d6f2a2fb9c4fc37c1c989e 100644 (file)
@@ -49,10 +49,6 @@ typedef struct __aslresponse *aslresponse;
  * the prototypes of asl_log and asl_vlog correctly.
  * The "-p" option to headerdoc2html is required.
  */
-#ifndef __DARWIN_LDBL_COMPAT2
-/*! @parseOnly */
-#define __DARWIN_LDBL_COMPAT2(a)
-#endif
 #ifndef __printflike
 /*! @parseOnly */
 #define __printflike(a,b)
@@ -170,8 +166,43 @@ typedef struct __aslresponse *aslresponse;
 #define ASL_OPT_NO_REMOTE   0x00000004
 /*! @/defineblock */
 
+/*! @defineblock File Descriptor Types
+ * Instructions on how to treat the file descriptor in asl_log_descriptor().
+ */
+#define ASL_LOG_DESCRIPTOR_READ  1
+#define ASL_LOG_DESCRIPTOR_WRITE 2
+
+/*!
+ * ASL_PREFILTER_LOG is a macro similar to asl_log(), but it first checks
+ * if the message will simply be ignored due to local filter settings.
+ * This prevents the variable argument list from being evaluated.
+ * Note that the message may still be processed if it will be written
+ * to a file or stderr.
+ *
+ * @param asl
+ *    (input) An ASL client handle
+ * @param msg
+ *    (input) An aslmsg (default attributes will be supplied if msg is NULL)
+ * @param level
+ *    (input) Log level (ASL_LEVEL_DEBUG to ASL_LEVEL_EMERG)
+ * @param format
+ *    (input) A printf() - style format string followed by a list of arguments
+ */
+#define ASL_PREFILTER_LOG(asl, msg, level, format, ...) \
+       do { \
+               aslclient _asl = (asl); \
+               aslmsg _msg = (msg); \
+               uint32_t _asl_eval = _asl_evaluate_send(_asl, _msg, (level)); \
+               if (_asl_eval != 0) _asl_lib_log(_asl, _asl_eval, _msg, (format), ## __VA_ARGS__); \
+       } while (0)
+
 __BEGIN_DECLS
 
+/* ASL Library SPI - do not call directly */
+int _asl_lib_log(aslclient asl, uint32_t eval, aslmsg msg, const char *format, ...) __printflike(4, 5);
+
+uint32_t _asl_evaluate_send(aslclient asl, aslmsg msg, int level);
+
 /*!
  * Initialize a connection to the ASL server.
  *
@@ -217,11 +248,11 @@ void asl_close(aslclient asl);
  *
  * @param asl
  *    (input) An ASL client handle
- * @param fd
+ * @param descriptor
  *    (input) A file descriptor
  * @result Returns 0 on success, non-zero on failure
 */
-int asl_add_log_file(aslclient asl, int fd);
+int asl_add_log_file(aslclient asl, int descriptor);
 
 /*!
  * Stop writing log messages to the given file descriptor.
@@ -229,11 +260,11 @@ int asl_add_log_file(aslclient asl, int fd);
  *
  * @param asl
  *    (input) An ASL client handle
- * @param fd
+ * @param descriptor
  *    (input) A file descriptor
  * @result Returns 0 on success, non-zero on failure
  */
-int asl_remove_log_file(aslclient asl, int fd);
+int asl_remove_log_file(aslclient asl, int descriptor);
 
 /*!
  * Set a filter for messages being sent to the server.
@@ -324,11 +355,7 @@ const char *asl_get(aslmsg msg, const char *key);
  *    (input) A printf() - style format string followed by a list of arguments
  * @result Returns 0 for success, non-zero for failure
  */
-#ifdef __DARWIN_LDBL_COMPAT2
-int asl_log(aslclient asl, aslmsg msg, int level, const char *format, ...) __DARWIN_LDBL_COMPAT2(asl_log) __printflike(4, 5);
-#else
 int asl_log(aslclient asl, aslmsg msg, int level, const char *format, ...) __printflike(4, 5);
-#endif
 
 /*!
  * Log a message with a particular log level.
@@ -346,11 +373,7 @@ int asl_log(aslclient asl, aslmsg msg, int level, const char *format, ...) __pri
  *    (input) A va_list containing the values for the format string
  * @result Returns 0 for success, non-zero for failure
  */
-#ifdef __DARWIN_LDBL_COMPAT2
-int asl_vlog(aslclient asl, aslmsg msg, int level, const char *format, va_list ap) __DARWIN_LDBL_COMPAT2(asl_vlog) __printflike(4, 0);
-#else
 int asl_vlog(aslclient asl, aslmsg msg, int level, const char *format, va_list ap) __printflike(4, 0);
-#endif
 
 /*!
  * Log a message.
@@ -424,7 +447,7 @@ void aslresponse_free(aslresponse r);
  * The log entry will include any keys and values found in msg, and it will include the title
  * and Uniform Type Identifier specified.  If NULL is supplied as a value for the uti parameter,
  * the type "public.data" is used.  Console.app will display a hyperlink to the file.
- * Output parameter out_fd will contain a readable and writable file descriptor for the new
+ * Output parameter out_descriptor will contain a readable and writable file descriptor for the new
  * auxiliary file. 
  *
  * By default, the file will be world-readable.  If the message contains a ReadUID and/or a
@@ -441,11 +464,11 @@ void aslresponse_free(aslresponse r);
  *    (input) A title string for the file
  * @param uti
  *    (input) Uniform Type Identifier for the file
- * @param out_fd
+ * @param out_descriptor
  *    (output) A writable file descriptor
  * @result Returns 0 for success, non-zero for failure
  */
-int asl_create_auxiliary_file(aslmsg msg, const char *title, const char *uti, int *out_fd)
+int asl_create_auxiliary_file(aslmsg msg, const char *title, const char *uti, int *out_descriptor)
 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
 
 /*!
@@ -453,11 +476,11 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
  * syslogd will log the message provided to asl_create_auxiliary_file() when this routine
  * is called.
  *
- * @param fd
+ * @param descriptor
  *    (input) The file descriptor
  * @result Returns 0 for success, non-zero for failure
  */
-int asl_close_auxiliary_file(int fd)
+int asl_close_auxiliary_file(int descriptor)
 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
 
 /*!
@@ -494,7 +517,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
  * Note that per-message read access controls (ReadUID and ReadGID) and message expire
  * times (ASLExpireTime) keys have no effect for messages written to this file.
  *
- * @param fd
+ * @param descriptor
  *    (input) A file descriptor
  * @param ident
  *    (input) Sender name
@@ -502,9 +525,54 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
  *    (input) Facility name
  * @result An aslclient
  */
-aslclient asl_open_from_file(int fd, const char *ident, const char *facility)
+aslclient asl_open_from_file(int descriptor, const char *ident, const char *facility)
 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0);
 
+/*!
+ * This API provides functionality to use file descriptors to send logging
+ * data to ASL.
+ *
+ * asl is retained by ASL and must still be closed by the caller by calling
+ * asl_close() if the caller loses reference to it.  msg is copied by ASL and
+ * similarly must still be freed by the caller by calling asl_free() if the
+ * caller loses reference to it.  Any changes made to it after calling
+ * asl_log_descriptor() are not applicable to the message used. descriptor
+ * is treated differentlty based on the value of fd_type.
+ *
+ * If fd_type is ASL_LOG_DESCRIPTOR_READ, the descriptor must be open for read
+ * access.  ASL uses GCD to read from the descriptor as data becomes available.
+ * These data are line buffered and passed to asl_log.  When EOF is read, the
+ * descriptor is closed.
+ *
+ * Example:
+ * asl_log_descriptor(c, m, ASL_LEVEL_NOTICE, STDIN_FILENO, ASL_LOG_DESCRIPTOR_READ);
+ *
+ * If fd_type is ASL_LOG_DESCRIPTOR_WRITE, the descriptor is closed and a new
+ * writable descriptor is created with the same fileno.  Any data written to
+ * this new descriptor are line buffered and passed to asl_log.  When EOF is
+ * sent, no further data are read.  The caller is responsible for closing the
+ * new descriptor.  One common use for this API is to redirect writes to stdout
+ * or stderr to ASL by passing STDOUT_FILENO or STDERR_FILENO as descriptor.
+ *
+ * Example:
+ * asl_log_descriptor(c, m, ASL_LEVEL_NOTICE, STDOUT_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
+ * asl_log_descriptor(c, m, ASL_LEVEL_ERR, STDERR_FILENO, ASL_LOG_DESCRIPTOR_WRITE);
+ *
+ * @param asl
+ *    (input) An ASL client handle
+ * @param msg
+ *    (input) An aslmsg (default attributes will be supplied if msg is NULL)
+ * @param level
+ *    (input) Log level (ASL_LEVEL_DEBUG to ASL_LEVEL_EMERG)
+ * @param descriptor
+ *    (input) An open file descriptor to read from
+ * @param fd_type
+ *    (input) Either ASL_LOG_DESCRIPTOR_READ or ASL_LOG_DESCRIPTOR_WRITE
+ * @result Returns 0 for success, non-zero for failure
+ */
+int asl_log_descriptor(aslclient asl, aslmsg msg, int level, int descriptor, uint32_t fd_type)
+__OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_1);
+
 __END_DECLS
 
 #endif /* __ASL_H__ */
index 0d761342d59909b12c54e08c9fd2ecfe392d8e7f..b52baae158451cf62168b81a5b7c44c7ba2e4399 100644 (file)
@@ -63,6 +63,7 @@
  */
 #include <_types.h>
 #include <sys/dirent.h>
+#include <sys/cdefs.h>
 #include <Availability.h>
 
 struct _telldir;               /* forward reference */
@@ -81,28 +82,23 @@ typedef struct {
        struct _telldir *__dd_td; /* telldir position recording */
 } DIR;
 
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+
 /* definitions for library routines operating on directories. */
 #define        DIRBLKSIZ       1024
 
-#define        dirfd(dirp)     ((dirp)->__dd_fd)
-
 /* flags for opendir2 */
 #define DTF_HIDEW      0x0001  /* hide whiteout entries */
 #define DTF_NODUP      0x0002  /* don't return duplicate names */
 #define DTF_REWIND     0x0004  /* rewind after reading union stack */
 #define __DTF_READALL  0x0008  /* everything has been read */
 
-#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
 
 #ifndef KERNEL
 
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-int alphasort(const void *, const void *) __DARWIN_INODE64(alphasort);
-#endif /* not POSIX */
+
 //Begin-Libc
 #ifndef LIBC_ALIAS_CLOSEDIR
 //End-Libc
@@ -112,25 +108,7 @@ int closedir(DIR *) __DARWIN_ALIAS(closedir);
 int closedir(DIR *) LIBC_ALIAS(closedir);
 #endif /* !LIBC_ALIAS_CLOSEDIR */
 //End-Libc
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-int getdirentries(int, char *, int, long *)
-//Begin-Libc
-#ifndef __LIBC__
-//End-Libc
-#if __DARWIN_64_BIT_INO_T
-/*
- * getdirentries() doesn't work when 64-bit inodes is in effect, so we
- * generate a link error.
- */
-                                               __asm("_getdirentries_is_not_available_when_64_bit_inodes_are_in_effect")
-#else /* !__DARWIN_64_BIT_INO_T */
-                                               __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_6, __IPHONE_2_0,__IPHONE_2_0)
-#endif /* __DARWIN_64_BIT_INO_T */
-//Begin-Libc
-#endif /* !__LIBC__ */
-//End-Libc
-;
-#endif /* not POSIX */
+
 //Begin-Libc
 #ifndef LIBC_ALIAS_OPENDIR
 //End-Libc
@@ -140,19 +118,10 @@ DIR *opendir(const char *) __DARWIN_ALIAS_I(opendir);
 DIR *opendir(const char *) LIBC_ALIAS_I(opendir);
 #endif /* !LIBC_ALIAS_OPENDIR */
 //End-Libc
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-//Begin-Libc
-#ifndef LIBC_ALIAS___OPENDIR2
-//End-Libc
-DIR *__opendir2(const char *, int) __DARWIN_ALIAS_I(__opendir2);
-//Begin-Libc
-#else /* LIBC_ALIAS___OPENDIR2 */
-DIR *__opendir2(const char *, int) LIBC_ALIAS_I(__opendir2);
-#endif /* !LIBC_ALIAS___OPENDIR2 */
-//End-Libc
-#endif /* not POSIX */
+
 struct dirent *readdir(DIR *) __DARWIN_INODE64(readdir);
 int readdir_r(DIR *, struct dirent *, struct dirent **) __DARWIN_INODE64(readdir_r);
+
 //Begin-Libc
 #ifndef LIBC_ALIAS_REWINDDIR
 //End-Libc
@@ -162,14 +131,7 @@ void rewinddir(DIR *) __DARWIN_ALIAS_I(rewinddir);
 void rewinddir(DIR *) LIBC_ALIAS_I(rewinddir);
 #endif /* !LIBC_ALIAS_REWINDDIR */
 //End-Libc
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-int scandir(const char *, struct dirent ***,
-    int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir);
-#ifdef __BLOCKS__
-int scandir_b(const char *, struct dirent ***,
-    int (^)(struct dirent *), int (^)(const void *, const void *)) __DARWIN_INODE64(scandir_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
-#endif /* __BLOCKS__ */
-#endif /* not POSIX */
+
 //Begin-Libc
 #ifndef LIBC_ALIAS_SEEKDIR
 //End-Libc
@@ -179,6 +141,7 @@ void seekdir(DIR *, long) __DARWIN_ALIAS_I(seekdir);
 void seekdir(DIR *, long) LIBC_ALIAS_I(seekdir);
 #endif /* !LIBC_ALIAS_SEEKDIR */
 //End-Libc
+
 //Begin-Libc
 #ifndef LIBC_ALIAS_TELLDIR
 //End-Libc
@@ -188,7 +151,80 @@ long telldir(DIR *) __DARWIN_ALIAS_I(telldir);
 long telldir(DIR *) LIBC_ALIAS_I(telldir);
 #endif /* !LIBC_ALIAS_TELLDIR */
 //End-Libc
+
+__END_DECLS
+
+
+/* Additional functionality provided by:
+ * POSIX.1-2008
+ */
+
+#if __DARWIN_C_LEVEL >= 200809L
+__BEGIN_DECLS
+
+int alphasort(const struct dirent **, const struct dirent **) __DARWIN_INODE64(alphasort);
+
+#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8) || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)
+#include <errno.h>
+#include <stdlib.h>
+#define dirfd(dirp) ({                         \
+    DIR *_dirp = (dirp);                       \
+    int ret = -1;                              \
+    if (_dirp == NULL || _dirp->__dd_fd < 0)   \
+        errno = EINVAL;                        \
+    else                                       \
+       ret = _dirp->__dd_fd;                   \
+    ret;                                       \
+})
+#else
+int dirfd(DIR *dirp) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+#endif
+
+int scandir(const char *, struct dirent ***,
+    int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)) __DARWIN_INODE64(scandir);
+#ifdef __BLOCKS__
+int scandir_b(const char *, struct dirent ***,
+    int (^)(const struct dirent *), int (^)(const struct dirent **, const struct dirent **)) __DARWIN_INODE64(scandir_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+#endif /* __BLOCKS__ */
+
+__END_DECLS
+#endif /* __DARWIN_C_LEVEL >= 200809L */
+
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+__BEGIN_DECLS
+
+int getdirentries(int, char *, int, long *)
+
+//Begin-Libc
+#ifndef __LIBC__
+//End-Libc
+#if __DARWIN_64_BIT_INO_T
+/*
+ * getdirentries() doesn't work when 64-bit inodes is in effect, so we
+ * generate a link error.
+ */
+                                               __asm("_getdirentries_is_not_available_when_64_bit_inodes_are_in_effect")
+#else /* !__DARWIN_64_BIT_INO_T */
+                                               __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_6, __IPHONE_2_0,__IPHONE_2_0)
+#endif /* __DARWIN_64_BIT_INO_T */
+//Begin-Libc
+#endif /* !__LIBC__ */
+//End-Libc
+;
+
+//Begin-Libc
+#ifndef LIBC_ALIAS___OPENDIR2
+//End-Libc
+DIR *__opendir2(const char *, int) __DARWIN_ALIAS_I(__opendir2);
+//Begin-Libc
+#else /* LIBC_ALIAS___OPENDIR2 */
+DIR *__opendir2(const char *, int) LIBC_ALIAS_I(__opendir2);
+#endif /* !LIBC_ALIAS___OPENDIR2 */
+//End-Libc
+
 __END_DECLS
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
 
 #endif /* !KERNEL */
 
index 4383e2df00059e2621f09e73d9b5aef6d7518d77..ee4eae99d552771c9b8403b7942e9fcfdb242bfb 100644 (file)
 #include <Availability.h>
 
 __BEGIN_DECLS
-void   err(int, const char *, ...) __DARWIN_LDBL_COMPAT(err) __dead2 __printflike(2, 3);
-void   verr(int, const char *, __darwin_va_list) __DARWIN_LDBL_COMPAT(verr) __dead2 __printflike(2, 0);
-void   errc(int, int, const char *, ...) __DARWIN_LDBL_COMPAT(errc) __dead2 __printflike(3, 4);
-void   verrc(int, int, const char *, __darwin_va_list) __DARWIN_LDBL_COMPAT(verrc) __dead2 __printflike(3, 0);
-void   errx(int, const char *, ...) __DARWIN_LDBL_COMPAT(errx) __dead2 __printflike(2, 3);
-void   verrx(int, const char *, __darwin_va_list) __DARWIN_LDBL_COMPAT(verrx) __dead2 __printflike(2, 0);
-void   warn(const char *, ...) __DARWIN_LDBL_COMPAT(warn) __printflike(1, 2);
-void   vwarn(const char *, __darwin_va_list) __DARWIN_LDBL_COMPAT(vwarn) __printflike(1, 0);
-void   warnc(int, const char *, ...) __DARWIN_LDBL_COMPAT(warnc) __printflike(2, 3);
-void   vwarnc(int, const char *, __darwin_va_list) __DARWIN_LDBL_COMPAT(vwarnc) __printflike(2, 0);
-void   warnx(const char *, ...) __DARWIN_LDBL_COMPAT(warnx) __printflike(1, 2);
-void   vwarnx(const char *, __darwin_va_list) __DARWIN_LDBL_COMPAT(vwarnx) __printflike(1, 0);
+void   err(int, const char *, ...) __dead2 __printflike(2, 3);
+void   verr(int, const char *, __darwin_va_list) __dead2 __printflike(2, 0);
+void   errc(int, int, const char *, ...) __dead2 __printflike(3, 4);
+void   verrc(int, int, const char *, __darwin_va_list) __dead2 __printflike(3, 0);
+void   errx(int, const char *, ...) __dead2 __printflike(2, 3);
+void   verrx(int, const char *, __darwin_va_list) __dead2 __printflike(2, 0);
+void   warn(const char *, ...) __printflike(1, 2);
+void   vwarn(const char *, __darwin_va_list) __printflike(1, 0);
+void   warnc(int, const char *, ...) __printflike(2, 3);
+void   vwarnc(int, const char *, __darwin_va_list) __printflike(2, 0);
+void   warnx(const char *, ...) __printflike(1, 2);
+void   vwarnx(const char *, __darwin_va_list) __printflike(1, 0);
 void   err_set_file(void *);
 void   err_set_exit(void (*)(int));
 #ifdef __BLOCKS__
diff --git a/include/grp.h b/include/grp.h
deleted file mode 100644 (file)
index 10f230e..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)grp.h       8.2 (Berkeley) 1/21/94
- */
-
-#ifndef _GRP_H_
-#define        _GRP_H_
-
-#include <_types.h>
-
-#ifndef _GID_T
-typedef __darwin_gid_t gid_t;          /* [XBD] */
-#define _GID_T
-#endif
-
-/*
- * Although the definition of size_t is not mandated by [TSF], the function
- * prototypes defined by [TSF] for the thread reentrant functions include
- * it as a type for their 4th arguments, so we define it here.
- */
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef __darwin_size_t        size_t;         /* [???] */
-#endif
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        _PATH_GROUP             "/etc/group"
-#endif
-
-struct group {
-       char    *gr_name;               /* [XBD] group name */
-       char    *gr_passwd;             /* [???] group password */
-       gid_t   gr_gid;                 /* [XBD] group id */
-       char    **gr_mem;               /* [XBD] group members */
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-/* [XBD] */
-struct group *getgrgid(gid_t);
-struct group *getgrnam(const char *);
-/* [TSF] */
-int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
-int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
-/* [XSI] */
-struct group *getgrent(void);
-void setgrent(void);
-void endgrent(void);
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#if !defined(_XOPEN_SOURCE) || defined(_DARWIN_C_SOURCE)
-char *group_from_gid(gid_t, int);
-#endif
-void setgrfile(const char *);
-int setgroupent(int);
-#endif
-__END_DECLS
-
-#endif /* !_GRP_H_ */
index 1beb2c0d9b94bcecf65418b8c760160597722b52..1f9738c0276b2076de2050a804659ef8262b7b35 100644 (file)
 #if !defined(_INTTYPES_H_)
 #define _INTTYPES_H_
 
-#  undef __PRI_8_LENGTH_MODIFIER__
-#  undef __PRI_64_LENGTH_MODIFIER__
-#  undef __SCN_64_LENGTH_MODIFIER__
-
-#  if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 > 1020
-#    define __PRI_8_LENGTH_MODIFIER__ "hh"
-#    define __PRI_64_LENGTH_MODIFIER__ "ll"
-#    define __SCN_64_LENGTH_MODIFIER__ "ll"
-#  else
-/* These could be "hh", "ll", and "ll" respectively, but that doesn't work on
-   10.2, and these do.  Note that there's no way to use scanf to scan a
-   decimal into a 'char' argument on 10.2, so "hh" is used unconditionally
-   and programs that use it won't work on Jaguar.  */
-#    define __PRI_8_LENGTH_MODIFIER__ ""  /* none */
-#    define __PRI_64_LENGTH_MODIFIER__ "q"
-#    define __SCN_64_LENGTH_MODIFIER__ "q"
-#  endif
+#  define __PRI_8_LENGTH_MODIFIER__ "hh"
+#  define __PRI_64_LENGTH_MODIFIER__ "ll"
+#  define __SCN_64_LENGTH_MODIFIER__ "ll"
 #  define __PRI_MAX_LENGTH_MODIFIER__ "j"
 #  define __SCN_MAX_LENGTH_MODIFIER__ "j"
 
 #  define PRIxMAX        __PRI_MAX_LENGTH_MODIFIER__ "x"
 #  define PRIXMAX        __PRI_MAX_LENGTH_MODIFIER__ "X"
 
-#  if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 > 1020
-#    define SCNd8         __PRI_8_LENGTH_MODIFIER__ "d"
-#    define SCNi8         __PRI_8_LENGTH_MODIFIER__ "i"
-#    define SCNo8         __PRI_8_LENGTH_MODIFIER__ "o"
-#    define SCNu8         __PRI_8_LENGTH_MODIFIER__ "u"
-#    define SCNx8         __PRI_8_LENGTH_MODIFIER__ "x"
-#  else
-#    define SCNd8         "hhd"
-#    define SCNi8         "hhi"
-#    define SCNo8         "hho"
-#    define SCNu8         "hhu"
-#    define SCNx8         "hhx"
-#  endif
+#  define SCNd8         __PRI_8_LENGTH_MODIFIER__ "d"
+#  define SCNi8         __PRI_8_LENGTH_MODIFIER__ "i"
+#  define SCNo8         __PRI_8_LENGTH_MODIFIER__ "o"
+#  define SCNu8         __PRI_8_LENGTH_MODIFIER__ "u"
+#  define SCNx8         __PRI_8_LENGTH_MODIFIER__ "x"
 
 #  define SCNd16        "hd"
 #  define SCNi16        "hi"
diff --git a/include/libkern/Makefile.inc b/include/libkern/Makefile.inc
deleted file mode 100644 (file)
index bf3bf18..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-LIBKERN_INSTHDRS += OSAtomic.h OSCacheControl.h
-
-.ifdef FEATURE_MEM_THERM_NOTIFICATION_APIS
-LIBKERN_INSTHDRS += OSMemoryNotification.h OSThermalNotification.h
-.endif
-
-LIBKERN_INSTHDRS := ${LIBKERN_INSTHDRS:S/^/${.CURDIR}\/include\/libkern\//}
index 6a62bd3e68fe3695badb82080a9046f6dce53da0..7cb7d63770f03ca968d6cf0407336775dfdad2b6 100644 (file)
@@ -136,8 +136,6 @@ int32_t     OSAtomicDecrement32Barrier( volatile int32_t *__theValue )
             { return OSAtomicAdd32Barrier( -1, __theValue); }
 
 
-#if defined(__ppc64__) || defined(__i386__) || defined(__x86_64__) || defined(__arm__)
-
 /*! @abstract Atomically adds two 64-bit values.
     @discussion
        This function adds the value given by <code>__theAmount</code> to the
@@ -198,9 +196,6 @@ int64_t     OSAtomicDecrement64Barrier( volatile int64_t *__theValue )
             { return OSAtomicAdd64Barrier( -1, __theValue); }
 
 
-#endif  /* defined(__ppc64__) || defined(__i386__) || defined(__x86_64__) || defined(__arm__) */
-
-
 /*! @group Boolean functions (AND, OR, XOR)
  * 
  * @discussion Functions in this group come in four variants for each operation:
@@ -470,8 +465,6 @@ bool        OSAtomicCompareAndSwapLong( long __oldValue, long __newValue, volatile long
 bool   OSAtomicCompareAndSwapLongBarrier( long __oldValue, long __newValue, volatile long *__theValue ) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
 
 
-#if defined(__ppc64__) || defined(__i386__) || defined(__x86_64__) || defined(__arm__)
-
 /*! @abstract Compare and swap for <code>uint64_t</code> values.
     @discussion
        This function compares the value in <code>__oldValue</code> to the value
@@ -496,8 +489,6 @@ bool    OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volati
  */
 bool    OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue ) __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_3_2);
 
-#endif  /* defined(__ppc64__) || defined(__i386__) || defined(__x86_64__) || defined(__arm__) */
-
 
 /* Test and set.  They return the original value of the bit, and operate on bit (0x80>>(n&7))
  * in byte ((char*)theAddress + (n>>3)).
index ee6714bbede5d86dfed22d335038ded79564524f..d4e450bba76aca4159692155c4c362cc27728a15 100644 (file)
@@ -25,6 +25,7 @@
 #define _OSMEMORYNOTIFICATION_H_
 
 #include <sys/cdefs.h>
+#include <Availability.h>
 
 /*
 **  OSMemoryNotification.h
@@ -33,6 +34,9 @@
 **  pressure reaches certain thresholds. Notifications are triggered in both directions
 **  so clients can manage their memory usage more and less aggressively.
 **
+**  All of these functions and data types are iOS-only and deprecated in iOS 5.0. Applications
+**  should listen to UIKit memory warnings (didReceiveMemoryWarning or
+**  UIApplicationDidReceiveMemoryWarningNotification) instead.
 */
 
 __BEGIN_DECLS
@@ -41,12 +45,16 @@ struct timeval;
 
 /*
 ** Opaque type for notification object
+**
+** DEPRECATED. Use UIKit memory notification system.
 */
  
 typedef struct _OSMemoryNotification * OSMemoryNotificationRef;
 
 /*
 ** Threshold values for notifications
+**
+** DEPRECATED. Use UIKit memory notification system.
 */
  
 typedef enum {
@@ -62,37 +70,51 @@ typedef enum {
 ** returns: 0 on success
 **          ENOMEM if insufficient memory or resources exists to create the notification object
 **          EINVAL if the threshold is not a valid notification level
+**
+** DEPRECATED. Use UIKit memory notification system.
 */
 
-int OSMemoryNotificationCreate(OSMemoryNotificationRef *note);
+int OSMemoryNotificationCreate(OSMemoryNotificationRef *note)   __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
 
 /*
 ** returns: 0 on success
 **          EINVAL if the notification is not an initialized notification object
+ **
+ ** DEPRECATED. Use UIKit memory notification system.
 */
 
-int OSMemoryNotificationDestroy(OSMemoryNotificationRef note);
+int OSMemoryNotificationDestroy(OSMemoryNotificationRef note)   __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
 
 /*
 ** Block waiting for notification
 ** returns: 0 on success, with the level that triggered the notification in the level param
 **          EINVAL if the notification object is invalid
 **          ETIMEDOUT if abstime passes before notification occurs
+**
+**  'note' is now ignored.
+**
+** DEPRECATED. Use UIKit memory notification system.
 */
-int OSMemoryNotificationWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level);
-int OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime);
+int OSMemoryNotificationWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level)    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
+int OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
 
 /*
 ** Simple polling interface to detect current memory pressure level
+**
+** DEPRECATED. This is not a reliable way to discover the system's memory condition and
+**             the level is not meaningful in iOS 5.0 and later. Use UIKit memory notification
+**             system instead, with no need to check the level.
 */
 
-OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void);
+OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void)    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
 
 /*
 ** External notify(3) string for manual notification setup
+**
+** DEPRECATED. Use UIKit memory notification system.
 */
 
-extern const char *kOSMemoryNotificationName;
+extern const char *kOSMemoryNotificationName    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
 
 __END_DECLS
 
index 02b2823a8b7452bd95aeb0d220a1ed69727ca4f6..ad19e7e8f0715602d4d390781d6b638b7a09ec11 100644 (file)
@@ -57,6 +57,7 @@ enum {
        kOSThermalMitigationDisableMapsHalo,
        kOSThermalMitigationAppTerminate,
        kOSThermalMitigationDeviceRestart,
+       kOSThermalMitigationThermalTableReady,
        kOSThermalMitigationCount
 };
 
index 968de199310ee6f32ae30a14057bd1f05089d088..2f9385d420a39a3b30ce11ef613a6152208c31c3 100644 (file)
 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS    4
 #define _POSIX_THREAD_KEYS_MAX                         128
 #define _POSIX_THREAD_THREADS_MAX              64
+
+#define PTHREAD_DESTRUCTOR_ITERATIONS  4
+#define PTHREAD_KEYS_MAX               512
+#define PTHREAD_STACK_MIN              8192
 #endif /* __DARWIN_C_LEVEL >= 199506L */
 
 #if __DARWIN_C_LEVEL >= 200112
 #define _POSIX_RE_DUP_MAX              _POSIX2_RE_DUP_MAX
 #endif /* __DARWIN_C_LEVEL >= 200112 */
 
-#if __DARWIN_C_LEVEL >= 200809L
-#define PTHREAD_DESTRUCTOR_ITERATIONS  4
-#define PTHREAD_KEYS_MAX               512
-#define PTHREAD_STACK_MIN              8192
-#endif /* __DARWIN_C_LEVEL >= 200809L */
-
 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
 #define OFF_MIN                LLONG_MIN       /* min value for an off_t */
 #define OFF_MAX                LLONG_MAX       /* max value for an off_t */
diff --git a/include/malloc/Makefile.inc b/include/malloc/Makefile.inc
deleted file mode 100644 (file)
index 47a51ee..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-MALLOC_INSTHDRS += malloc.h
-MALLOC_INSTHDRS := ${MALLOC_INSTHDRS:S/^/${.CURDIR}\/include\/malloc\//}
diff --git a/include/nl_types.h b/include/nl_types.h
deleted file mode 100644 (file)
index db74be9..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*     $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $  */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by J.T. Conklin.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/include/nl_types.h,v 1.11 2005/02/27 16:20:53 phantom Exp $
- */
-
-#ifndef _NL_TYPES_H_
-#define _NL_TYPES_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <_types.h>
-
-#ifdef _NLS_PRIVATE
-/*
- * MESSAGE CATALOG FILE FORMAT.
- *
- * The NetBSD/FreeBSD message catalog format is similar to the format used by
- * Svr4 systems.  The differences are:
- *   * fixed byte order (big endian)
- *   * fixed data field sizes
- *
- * A message catalog contains four data types: a catalog header, one
- * or more set headers, one or more message headers, and one or more
- * text strings.
- */
-
-#define _NLS_MAGIC     0xff88ff89
-
-struct _nls_cat_hdr {
-       int32_t __magic;
-       int32_t __nsets;
-       int32_t __mem;
-       int32_t __msg_hdr_offset;
-       int32_t __msg_txt_offset;
-} ;
-
-struct _nls_set_hdr {
-       int32_t __setno;        /* set number: 0 < x <= NL_SETMAX */
-       int32_t __nmsgs;        /* number of messages in the set  */
-       int32_t __index;        /* index of first msg_hdr in msg_hdr table */
-} ;
-
-struct _nls_msg_hdr {
-       int32_t __msgno;        /* msg number: 0 < x <= NL_MSGMAX */
-       int32_t __msglen;
-       int32_t __offset;
-} ;
-
-#endif /* _NLS_PRIVATE */
-
-#define        NL_SETD         1
-#define        NL_CAT_LOCALE   1
-
-typedef struct __nl_cat_d {
-       void    *__data;
-       int     __size;
-} *nl_catd;
-
-#ifndef _NL_ITEM
-typedef __darwin_nl_item        nl_item;
-#define _NL_ITEM
-#endif
-
-__BEGIN_DECLS
-nl_catd  catopen(const char *, int);
-char    *catgets(nl_catd, int, int, const char *)
-       __attribute__((__format_arg__(4)));
-int     catclose(nl_catd);
-__END_DECLS
-
-#endif /* _NL_TYPES_H_ */
diff --git a/include/objc/Makefile.inc b/include/objc/Makefile.inc
deleted file mode 100644 (file)
index a4f8fad..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-OBJC_INSTHDRS += malloc.h zone.h
-OBJC_INSTHDRS := ${OBJC_INSTHDRS:S/^/${.CURDIR}\/include\/objc\//}
diff --git a/include/objc/malloc.h b/include/objc/malloc.h
deleted file mode 100644 (file)
index bccba72..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#warning "Use <malloc/malloc.h> instead of <objc/malloc.h>"
-#include <malloc/malloc.h>
diff --git a/include/objc/zone.h b/include/objc/zone.h
deleted file mode 100644 (file)
index 2a84ce0..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 1999, 2007 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#ifndef _OBJC_ZONE_H_
-#define _OBJC_ZONE_H_
-
-#import <malloc/malloc.h>
-
-typedef malloc_zone_t NXZone;
-
-#define NX_NOZONE  ((NXZone *)0)
-
-/*********     Interface to zone based malloc  ************/
-
-#include <sys/cdefs.h>
-
-#warning All the routines in objc/zone.h are deprecated and will be removed in the future
-
-__BEGIN_DECLS
-extern NXZone *NXDefaultMallocZone(void) __deprecated;
-    // Returns the default zone used by the malloc(3) calls
-
-extern NXZone *NXCreateZone(size_t startSize, size_t granularity, int canFree) __deprecated;
-    // Create a new zone with its own memory pool.
-    // canfree: if 0 the allocator will never free memory and mallocing will be fast
-
-extern void NXNameZone(NXZone *z, const char *name) __deprecated;
-    // name a zone; The string will be copied
-
-extern void *NXZoneMalloc(malloc_zone_t *zone, size_t size) __deprecated;
-
-extern void *NXZoneRealloc(malloc_zone_t *zone, void *ptr, size_t size) __deprecated;
-
-extern void *NXZoneCalloc(NXZone *zonep, size_t numElems, size_t byteSize) __deprecated;
-    // Allocates and then clears
-
-extern void NXZoneFree(malloc_zone_t *zone, void *ptr) __deprecated;
-
-extern void NXDestroyZone(malloc_zone_t *zone) __deprecated;
-
-extern NXZone *NXZoneFromPtr(void *ptr) __deprecated;
-    // Returns the zone for a pointer, or NX_NOZONE if not in any zone.
-    // The ptr must have been returned from a malloc or realloc call.
-__END_DECLS
-
-#endif /* _OBJC_ZONE_H_ */
diff --git a/include/protocols/Makefile.inc b/include/protocols/Makefile.inc
deleted file mode 100644 (file)
index 5158f77..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-PROTO_INSTHDRS += routed.h \
-                  rwhod.h \
-                  talkd.h \
-                  timed.h
-PROTO_INSTHDRS := ${PROTO_INSTHDRS:S/^/${.CURDIR}\/include\/protocols\//}
diff --git a/include/pwd.h b/include/pwd.h
deleted file mode 100644 (file)
index 30ce226..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*     $NetBSD: pwd.h,v 1.11 1997/08/16 13:47:21 lukem Exp $   */
-
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- * Portions Copyright(C) 1995, Jason Downs.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)pwd.h       8.2 (Berkeley) 1/21/94
- */
-
-#ifndef _PWD_H_
-#define        _PWD_H_
-
-#include <_types.h>
-
-#ifndef _GID_T
-typedef __darwin_gid_t         gid_t;
-#define _GID_T
-#endif
-
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef        __darwin_size_t         size_t;
-#endif
-
-#ifndef _UID_T
-typedef __darwin_uid_t         uid_t;
-#define _UID_T
-#endif
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        _PATH_PWD               "/etc"
-#define        _PATH_PASSWD            "/etc/passwd"
-#define        _PASSWD                 "passwd"
-#define        _PATH_MASTERPASSWD      "/etc/master.passwd"
-#define        _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
-#define        _MASTERPASSWD           "master.passwd"
-
-#define        _PATH_MP_DB             "/etc/pwd.db"
-#define        _MP_DB                  "pwd.db"
-#define        _PATH_SMP_DB            "/etc/spwd.db"
-#define        _SMP_DB                 "spwd.db"
-
-#define        _PATH_PWD_MKDB          "/usr/sbin/pwd_mkdb"
-
-#define        _PW_KEYBYNAME           '1'     /* stored by name */
-#define        _PW_KEYBYNUM            '2'     /* stored by entry in the "file" */
-#define        _PW_KEYBYUID            '3'     /* stored by uid */
-
-#define        _PASSWORD_EFMT1         '_'     /* extended encryption format */
-
-#define        _PASSWORD_LEN           128     /* max length, not counting NULL */
-
-#define _PASSWORD_NOUID                0x01    /* flag for no specified uid. */
-#define _PASSWORD_NOGID                0x02    /* flag for no specified gid. */
-#define _PASSWORD_NOCHG                0x04    /* flag for no specified change. */
-#define _PASSWORD_NOEXP                0x08    /* flag for no specified expire. */
-
-#define _PASSWORD_WARNDAYS     14      /* days to warn about expiry */
-#define _PASSWORD_CHGNOW       -1      /* special day to force password
-                                        * change at next login */
-#endif
-
-struct passwd {
-       char    *pw_name;               /* user name */
-       char    *pw_passwd;             /* encrypted password */
-       uid_t   pw_uid;                 /* user uid */
-       gid_t   pw_gid;                 /* user gid */
-       __darwin_time_t pw_change;              /* password change time */
-       char    *pw_class;              /* user access class */
-       char    *pw_gecos;              /* Honeywell login info */
-       char    *pw_dir;                /* home directory */
-       char    *pw_shell;              /* default shell */
-       __darwin_time_t pw_expire;              /* account expiration */
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-struct passwd  *getpwuid(uid_t);
-struct passwd  *getpwnam(const char *);
-int             getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
-int             getpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **);
-struct passwd  *getpwent(void);
-#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
-int             setpassent(int);
-char           *user_from_uid(uid_t, int);
-#endif
-void            setpwent(void);
-void            endpwent(void);
-__END_DECLS
-
-#endif /* !_PWD_H_ */
index f348c9a4ca54c57cc08097e926f039c9e9e9442b..d362ab4660bc4fc854282219b885fdac2d1b22ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
+/*
+ * Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ * 
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 /*-
  * Copyright (c) 1992 Henry Spencer.
  * Copyright (c) 1992, 1993
 #define        _REGEX_H_
 
 #include <_types.h>
+#include <Availability.h>
 
+/*********/
 /* types */
+/*********/
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+#ifndef        __cplusplus
+#ifndef        _WCHAR_T
+#define        _WCHAR_T
+typedef        __darwin_wchar_t        wchar_t;
+#endif /* _WCHAR_T */
+#endif /* __cplusplus */
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+
 typedef __darwin_off_t regoff_t;
 
 #ifndef _SIZE_T
@@ -84,53 +123,87 @@ typedef struct {
        regoff_t rm_eo;         /* end of match */
 } regmatch_t;
 
+/*******************/
 /* regcomp() flags */
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        REG_BASIC       0000
-#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
-#define        REG_EXTENDED    0001
-#define        REG_ICASE       0002
-#define        REG_NOSUB       0004
-#define        REG_NEWLINE     0010
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        REG_NOSPEC      0020
-#define        REG_PEND        0040
-#define        REG_DUMP        0200
-#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+/*******************/
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+#define        REG_BASIC       0000    /* Basic regular expressions (synonym for 0) */
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+
+#define        REG_EXTENDED    0001    /* Extended regular expressions */
+#define        REG_ICASE       0002    /* Compile ignoring upper/lower case */
+#define        REG_NOSUB       0004    /* Compile only reporting success/failure */
+#define        REG_NEWLINE     0010    /* Compile for newline-sensitive matching */
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+#define        REG_NOSPEC      0020    /* Compile turning off all special characters */
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED  >= __MAC_10_8 \
+ || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+#define        REG_LITERAL     REG_NOSPEC
+#endif
+
+#define        REG_PEND        0040    /* Use re_endp as end pointer */
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED  >= __MAC_10_8 \
+ || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+#define        REG_MINIMAL     0100    /* Compile using minimal repetition */
+#define        REG_UNGREEDY    REG_MINIMAL
+#endif
+
+#define        REG_DUMP        0200    /* Unused */
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED  >= __MAC_10_8 \
+ || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+#define        REG_ENHANCED    0400    /* Additional (non-POSIX) features */
+#endif
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+
+/********************/
 /* regerror() flags */
+/********************/
 #define        REG_ENOSYS       (-1)   /* Reserved */
-#define        REG_NOMATCH      1
-#define        REG_BADPAT       2
-#define        REG_ECOLLATE     3
-#define        REG_ECTYPE       4
-#define        REG_EESCAPE      5
-#define        REG_ESUBREG      6
-#define        REG_EBRACK       7
-#define        REG_EPAREN       8
-#define        REG_EBRACE       9
-#define        REG_BADBR       10
-#define        REG_ERANGE      11
-#define        REG_ESPACE      12
-#define        REG_BADRPT      13
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        REG_EMPTY       14
-#define        REG_ASSERT      15
-#define        REG_INVARG      16
-#define        REG_ILLSEQ      17
+#define        REG_NOMATCH      1      /* regexec() function failed to match */
+#define        REG_BADPAT       2      /* invalid regular expression */
+#define        REG_ECOLLATE     3      /* invalid collating element */
+#define        REG_ECTYPE       4      /* invalid character class */
+#define        REG_EESCAPE      5      /* trailing backslash (\) */
+#define        REG_ESUBREG      6      /* invalid backreference number */
+#define        REG_EBRACK       7      /* brackets ([ ]) not balanced */
+#define        REG_EPAREN       8      /* parentheses not balanced */
+#define        REG_EBRACE       9      /* braces not balanced */
+#define        REG_BADBR       10      /* invalid repetition count(s) */
+#define        REG_ERANGE      11      /* invalid character range */
+#define        REG_ESPACE      12      /* out of memory */
+#define        REG_BADRPT      13      /* repetition-operator operand invalid */
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+#define        REG_EMPTY       14      /* Unused */
+#define        REG_ASSERT      15      /* Unused */
+#define        REG_INVARG      16      /* invalid argument to regex routine */
+#define        REG_ILLSEQ      17      /* illegal byte sequence */
+
 #define        REG_ATOI        255     /* convert name to number (!) */
 #define        REG_ITOA        0400    /* convert number to name (!) */
-#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
 
+/*******************/
 /* regexec() flags */
-#define        REG_NOTBOL      00001
-#define        REG_NOTEOL      00002
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        REG_STARTEND    00004
-#define        REG_TRACE       00400   /* tracing of execution */
-#define        REG_LARGE       01000   /* force large representation */
+/*******************/
+#define        REG_NOTBOL      00001   /* First character not at beginning of line */
+#define        REG_NOTEOL      00002   /* Last character not at end of line */
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+#define        REG_STARTEND    00004   /* String start/end in pmatch[0] */
+#define        REG_TRACE       00400   /* Unused */
+#define        REG_LARGE       01000   /* Unused */
 #define        REG_BACKR       02000   /* force use of backref code */
-#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED  >= __MAC_10_8 \
+ || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0
+#define        REG_BACKTRACKING_MATCHER        REG_BACKR
+#endif
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
 
 __BEGIN_DECLS
 //Begin-Libc
@@ -150,6 +223,31 @@ size_t     regerror(int, const regex_t * __restrict, char * __restrict, size_t);
 int    regexec(const regex_t * __restrict, const char * __restrict, size_t,
            regmatch_t __pmatch[ __restrict], int);
 void   regfree(regex_t *);
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+
+/* Darwin extensions */
+int    regncomp(regex_t * __restrict, const char * __restrict, size_t, int)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    regnexec(const regex_t * __restrict, const char * __restrict, size_t,
+           size_t, regmatch_t __pmatch[ __restrict], int)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    regwcomp(regex_t * __restrict, const wchar_t * __restrict, int)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    regwexec(const regex_t * __restrict, const wchar_t * __restrict, size_t,
+           regmatch_t __pmatch[ __restrict], int)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    regwncomp(regex_t * __restrict, const wchar_t * __restrict, size_t, int)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    regwnexec(const regex_t * __restrict, const wchar_t * __restrict,
+           size_t, size_t, regmatch_t __pmatch[ __restrict], int)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
 __END_DECLS
 
+#ifdef _USE_EXTENDED_LOCALES_
+#include <xlocale/_regex.h>
+#endif /* _USE_EXTENDED_LOCALES_ */
+
 #endif /* !_REGEX_H_ */
diff --git a/include/secure/Makefile.inc b/include/secure/Makefile.inc
deleted file mode 100644 (file)
index d355e87..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-SECURE_INSTHDRS += _common.h   \
-                  _string.h    \
-                   _stdio.h
-
-SECURE_INSTHDRS := ${SECURE_INSTHDRS:S/^/${.CURDIR}\/include\/secure\//}
index e04c9c5521e38dfe8ea15916a75d9b8556736df0..49caf72af2db8361cb2cbac0c9d653f84efe6434 100644 (file)
 /* sprintf, vsprintf, snprintf, vsnprintf */
 
 extern int __sprintf_chk (char * __restrict, int, size_t,
-                         const char * __restrict, ...)
-  __DARWIN_LDBL_COMPAT (__sprintf_chk);
+                         const char * __restrict, ...);
 
 #define sprintf(str, ...) \
   __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
 
 extern int __snprintf_chk (char * __restrict, size_t, int, size_t,
-                          const char * __restrict, ...)
-  __DARWIN_LDBL_COMPAT (__snprintf_chk);
+                          const char * __restrict, ...);
 
 #if __DARWIN_C_LEVEL >= 200112L
 #define snprintf(str, len, ...) \
   __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
 
 extern int __vsprintf_chk (char * __restrict, int, size_t,
-                          const char * __restrict, va_list)
-  __DARWIN_LDBL_COMPAT (__vsprintf_chk);
+                          const char * __restrict, va_list);
 
 #define vsprintf(str, format, ap) \
   __builtin___vsprintf_chk (str, 0, __darwin_obsz(str), format, ap)
 
 extern int __vsnprintf_chk (char * __restrict, size_t, int, size_t,
-                           const char * __restrict, va_list)
-  __DARWIN_LDBL_COMPAT (__vsnprintf_chk);
+                           const char * __restrict, va_list);
 
 #define vsnprintf(str, len, format, ap) \
   __builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)
index 4fced23b3ff011c3b26f9c22a33457a4ab912c86..8e6b4a864d7ea51af46a969b10a475b812053d83 100644 (file)
 #ifndef _BSD_SETJMP_H
 #define _BSD_SETJMP_H
 
-#include <machine/setjmp.h>
+#include <sys/cdefs.h>
+
+#if defined(__x86_64__)
+/*
+ * _JBLEN is number of ints required to save the following:
+ * rflags, rip, rbp, rsp, rbx, r12, r13, r14, r15... these are 8 bytes each
+ * mxcsr, fp control word, sigmask... these are 4 bytes each
+ * add 16 ints for future expansion needs...
+ */
+#define _JBLEN ((9 * 2) + 3 + 16)
+typedef int jmp_buf[_JBLEN];
+typedef int sigjmp_buf[_JBLEN + 1];
+
+#elif defined(__i386__)
+
+/*
+ * _JBLEN is number of ints required to save the following:
+ * eax, ebx, ecx, edx, edi, esi, ebp, esp, ss, eflags, eip,
+ * cs, de, es, fs, gs == 16 ints
+ * onstack, mask = 2 ints
+ */
+
+#define _JBLEN (18)
+typedef int jmp_buf[_JBLEN];
+typedef int sigjmp_buf[_JBLEN + 1];
+
+#elif defined(__arm__)
+
+#include <machine/signal.h>
+
+/*
+ *     _JBLEN is number of ints required to save the following:
+ *     r4-r8, r10, fp, sp, lr, sig  == 10 register_t sized
+ *     s16-s31 == 16 register_t sized + 1 int for FSTMX
+ *     1 extra int for future use
+ */
+#define _JBLEN         (10 + 16 + 2)
+#define _JBLEN_MAX     _JBLEN
+
+typedef int jmp_buf[_JBLEN];
+typedef int sigjmp_buf[_JBLEN + 1];
+
+#else
+#      error Undefined platform for setjmp
+#endif
+
+__BEGIN_DECLS
+extern int     setjmp(jmp_buf);
+extern void longjmp(jmp_buf, int) __dead2;
+
+#ifndef _ANSI_SOURCE
+int    _setjmp(jmp_buf);
+void   _longjmp(jmp_buf, int) __dead2;
+int    sigsetjmp(sigjmp_buf, int);
+void   siglongjmp(sigjmp_buf, int) __dead2;
+#endif /* _ANSI_SOURCE  */
+
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
+void   longjmperror(void);
+#endif /* neither ANSI nor POSIX */
+__END_DECLS
 
 #endif /* _BSD_SETJMP_H */
index 174b5958078979513afeeda6f96fe32fa126052a..a0346980edef1c0c727ce318aa75d328fbff4efa 100644 (file)
 #include <spawn.h>
 #include <sys/cdefs.h>
 #include <Availability.h>
+#include <TargetConditionals.h>
 
 int     posix_spawnattr_getpcontrol_np(const posix_spawnattr_t * __restrict, int * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
 int     posix_spawnattr_setpcontrol_np(posix_spawnattr_t *, const int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
 
+int     posix_spawnattr_getapptype_np(const posix_spawnattr_t * __restrict, int * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int     posix_spawnattr_setapptype_np(posix_spawnattr_t *, const int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+
+int    posix_spawnattr_setcpumonitor(posix_spawnattr_t * __restrict, uint64_t, uint64_t) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    posix_spawnattr_getcpumonitor(posix_spawnattr_t * __restrict, uint64_t *, uint64_t *) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+
+#if TARGET_OS_EMBEDDED
+int     posix_spawnattr_setjetsam(posix_spawnattr_t * __restrict attr,
+               short flags, int priority, int high_water_mark) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_5_0);
+#endif
+
 #endif /* !defined _SPAWN_PRIVATE_H_*/
index 3608903bc4cb16d9aa26ba47aa3c972bd39f8912..b2860ed6b593eec7ab40e9d98e47577e1cdf9c5b 100644 (file)
@@ -257,7 +257,7 @@ FILE        *fopen(const char * __restrict, const char * __restrict) LIBC_ALIAS(fopen);
 #endif /* !LIBC_ALIAS_FOPEN */
 //End-Libc
 #endif /* (DARWIN_UNLIMITED_STREAMS || _DARWIN_C_SOURCE) */
-int     fprintf(FILE * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(fprintf) __printflike(2, 3);
+int     fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3);
 int     fputc(int, FILE *);
 //Begin-Libc
 #ifndef LIBC_ALIAS_FPUTS
@@ -280,7 +280,7 @@ FILE        *freopen(const char * __restrict, const char * __restrict,
                  FILE * __restrict) LIBC_ALIAS(freopen);
 #endif /* !LIBC_ALIAS_FREOPEN */
 //End-Libc
-int     fscanf(FILE * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(fscanf) __scanflike(2, 3);
+int     fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3);
 int     fseek(FILE *, long, int);
 int     fsetpos(FILE *, const fpos_t *);
 long    ftell(FILE *);
@@ -297,24 +297,24 @@ int        getc(FILE *);
 int     getchar(void);
 char   *gets(char *);
 void    perror(const char *);
-int     printf(const char * __restrict, ...) __DARWIN_LDBL_COMPAT(printf) __printflike(1, 2);
+int     printf(const char * __restrict, ...) __printflike(1, 2);
 int     putc(int, FILE *);
 int     putchar(int);
 int     puts(const char *);
 int     remove(const char *);
 int     rename (const char *, const char *);
 void    rewind(FILE *);
-int     scanf(const char * __restrict, ...) __DARWIN_LDBL_COMPAT(scanf) __scanflike(1, 2);
+int     scanf(const char * __restrict, ...) __scanflike(1, 2);
 void    setbuf(FILE * __restrict, char * __restrict);
 int     setvbuf(FILE * __restrict, char * __restrict, int, size_t);
-int     sprintf(char * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(sprintf) __printflike(2, 3);
-int     sscanf(const char * __restrict, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(sscanf) __scanflike(2, 3);
+int     sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3);
+int     sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3);
 FILE   *tmpfile(void);
 char   *tmpnam(char *);
 int     ungetc(int, FILE *);
-int     vfprintf(FILE * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vfprintf) __printflike(2, 0);
-int     vprintf(const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vprintf) __printflike(1, 0);
-int     vsprintf(char * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vsprintf) __printflike(2, 0);
+int     vfprintf(FILE * __restrict, const char * __restrict, va_list) __printflike(2, 0);
+int     vprintf(const char * __restrict, va_list) __printflike(1, 0);
+int     vsprintf(char * __restrict, const char * __restrict, va_list) __printflike(2, 0);
 __END_DECLS
 
 
@@ -388,7 +388,7 @@ __END_DECLS
 /* Functions internal to the implementation. */
 __BEGIN_DECLS
 int    __srget(FILE *);
-int    __svfscanf(FILE *, const char *, va_list) __DARWIN_LDBL_COMPAT(__svfscanf) __scanflike(2, 0);
+int    __svfscanf(FILE *, const char *, va_list) __scanflike(2, 0);
 int    __swbuf(int, FILE *);
 __END_DECLS
 
@@ -479,11 +479,11 @@ __END_DECLS
 
 #if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus)
 __BEGIN_DECLS
-int     snprintf(char * __restrict, size_t, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(snprintf) __printflike(3, 4);
-int     vfscanf(FILE * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vfscanf) __scanflike(2, 0);
-int     vscanf(const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vscanf) __scanflike(1, 0);
-int     vsnprintf(char * __restrict, size_t, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vsnprintf) __printflike(3, 0);
-int     vsscanf(const char * __restrict, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vsscanf) __scanflike(2, 0);
+int     snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4);
+int     vfscanf(FILE * __restrict, const char * __restrict, va_list) __scanflike(2, 0);
+int     vscanf(const char * __restrict, va_list) __scanflike(1, 0);
+int     vsnprintf(char * __restrict, size_t, const char * __restrict, va_list) __printflike(3, 0);
+int     vsscanf(const char * __restrict, const char * __restrict, va_list) __scanflike(2, 0);
 __END_DECLS
 #endif /* __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus) */
 
@@ -500,8 +500,8 @@ typedef __darwin_ssize_t        ssize_t;
 #endif
 
 __BEGIN_DECLS
-int    dprintf(int, const char * __restrict, ...) __DARWIN_LDBL_COMPAT(dprintf) __printflike(2, 3) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
-int    vdprintf(int, const char * __restrict, va_list) __DARWIN_LDBL_COMPAT(vdprintf) __printflike(2, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+int    dprintf(int, const char * __restrict, ...) __printflike(2, 3) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+int    vdprintf(int, const char * __restrict, va_list) __printflike(2, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 __END_DECLS
@@ -516,14 +516,14 @@ __BEGIN_DECLS
 extern __const int sys_nerr;           /* perror(3) external variables */
 extern __const char *__const sys_errlist[];
 
-int     asprintf(char **, const char *, ...) __DARWIN_LDBL_COMPAT(asprintf) __printflike(2, 3);
+int     asprintf(char **, const char *, ...) __printflike(2, 3);
 char   *ctermid_r(char *);
 char   *fgetln(FILE *, size_t *);
 __const char *fmtcheck(const char *, const char *);
 int     fpurge(FILE *);
 void    setbuffer(FILE *, char *, int);
 int     setlinebuf(FILE *);
-int     vasprintf(char **, const char *, va_list) __DARWIN_LDBL_COMPAT(vasprintf) __printflike(2, 0);
+int     vasprintf(char **, const char *, va_list) __printflike(2, 0);
 FILE   *zopen(const char *, const char *, int);
 
 
index 24058047c2aaee1c1cf2533cfd7f25e059bb6f62..e4aa81b43bf85fa690452540fa20a8403b577abd 100644 (file)
@@ -188,7 +188,7 @@ double       strtod(const char *, char **) __DARWIN_ALIAS(strtod);
 float   strtof(const char *, char **) __DARWIN_ALIAS(strtof);
 long    strtol(const char *, char **, int);
 long double
-        strtold(const char *, char **) __DARWIN_LDBL_COMPAT(strtold);
+        strtold(const char *, char **);
 #if !__DARWIN_NO_LONG_LONG
 long long 
         strtoll(const char *, char **, int);
diff --git a/include/sys/Makefile.inc b/include/sys/Makefile.inc
deleted file mode 100644 (file)
index 253cb16..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-SYS_INSTHDRS += acl.h statvfs.h
-
-SYS_INSTHDRS := ${SYS_INSTHDRS:S/^/${.CURDIR}\/include\/sys\//}
index 9e59b1cbb845a63218cb9b2abd8d737f79ef9cb9..c0badcc20f51a3bdf7349396a269e4fadfbb5297 100644 (file)
  */
 #include_next <sys/cdefs.h>
 #ifndef _LIBC_NO_FEATURE_VERIFICATION
-#if defined(__arm__)
-#  include <arm/libc-features.h>
-#elif defined(__i386__)
-#  include <i386/libc-features.h>
-#elif defined(__ppc__)
-#  include <ppc/libc-features.h>
-#elif defined(__ppc64__)
-#  include <ppc64/libc-features.h>
-#elif defined(__x86_64__)
-#  include <x86_64/libc-features.h>
+#if defined(__arm__) || defined(__i386__) || defined(__x86_64__)
+#  include "libc-features.h"
 #else
 #  error "Unknown architecture."
 #endif
index 1cd221c36f2ac7183cc8c4360c4826abdc95483c..3f582dab08c8d5ac2c9fed69a24c98393dd827a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002-2006, 2008-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -199,19 +199,9 @@ typedef __darwin_useconds_t        useconds_t;
 #endif /* __DARWIN_C_LEVEL */
 
 #define        __ILP32_OFF32          (-1)
-#define        __ILP32_OFFBIG         (-1)
-#define        __LP64_OFF64           (-1)
-#define        __LPBIG_OFFBIG         (-1)
-
-#ifdef __LP64__
-#undef __LP64_OFF64
-#define __LP64_OFF64           (1)
-#undef __LPBIG_OFFBIG
-#define __LPBIG_OFFBIG         (1)
-#else
-#undef __ILP32_OFFBIG
-#define __ILP32_OFFBIG         (1)
-#endif
+#define        __ILP32_OFFBIG         (1)
+#define        __LP64_OFF64           (1)
+#define        __LPBIG_OFFBIG         (1)
 
 #if __DARWIN_C_LEVEL >= 200112L
 #define        _POSIX_V6_ILP32_OFF32           __ILP32_OFF32
@@ -861,6 +851,7 @@ int  iruserok_sa(const void *, int, int, const char *, const char *);
 int     issetugid(void);
 char   *mkdtemp(char *);
 int     mknod(const char *, mode_t, dev_t);
+int     mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
 int     mkstemp(char *);
 int     mkstemps(char *, int);
 char   *mktemp(char *);
@@ -977,6 +968,12 @@ int         searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned in
 int     fsctl(const char *,unsigned long,void*,unsigned int);
 int     ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
 
+#define        SYNC_VOLUME_FULLSYNC    0x01    /* Flush data and metadata to platter, not just to disk cache */
+#define SYNC_VOLUME_WAIT       0x02    /* Wait for sync to complete */
+
+int    fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+int    sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+
 extern int optreset;
 
 __END_DECLS
diff --git a/include/utmpx.h b/include/utmpx.h
deleted file mode 100644 (file)
index 616b4c0..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*     $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $    */
-
-/*-
- * Copyright (c) 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef        _UTMPX_H_
-#define        _UTMPX_H_
-
-#include <_types.h>
-#include <sys/time.h>
-#include <sys/cdefs.h>
-#include <Availability.h>
-
-#ifndef _PID_T
-#define _PID_T
-typedef __darwin_pid_t     pid_t;
-#endif
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#ifndef _UID_T
-#define _UID_T
-typedef __darwin_uid_t     uid_t;
-#endif
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-#define        _PATH_UTMPX             "/var/run/utmpx"
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define        UTMPX_FILE      _PATH_UTMPX
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-#define _UTX_USERSIZE  256     /* matches MAXLOGNAME */
-#define _UTX_LINESIZE  32
-#define        _UTX_IDSIZE     4
-#define _UTX_HOSTSIZE  256
-
-#define EMPTY          0
-#define RUN_LVL                1
-#define BOOT_TIME      2
-#define OLD_TIME       3
-#define NEW_TIME       4
-#define INIT_PROCESS   5
-#define LOGIN_PROCESS  6
-#define USER_PROCESS   7
-#define DEAD_PROCESS   8
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-#define ACCOUNTING     9
-#define SIGNATURE      10
-#define SHUTDOWN_TIME  11
-
-#define UTMPX_AUTOFILL_MASK                    0x8000
-#define UTMPX_DEAD_IF_CORRESPONDING_MASK       0x4000
-
-/* notify(3) change notification name */
-#define UTMPX_CHANGE_NOTIFICATION              "com.apple.system.utmpx"
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-/*
- * The following structure describes the fields of the utmpx entries
- * stored in _PATH_UTMPX. This is not the format the
- * entries are stored in the files, and application should only access
- * entries using routines described in getutxent(3).
- */
-
-#ifdef _UTMPX_COMPAT
-#define ut_user ut_name
-#define ut_xtime ut_tv.tv_sec
-#endif /* _UTMPX_COMPAT */
-
-struct utmpx {
-       char ut_user[_UTX_USERSIZE];    /* login name */
-       char ut_id[_UTX_IDSIZE];        /* id */
-       char ut_line[_UTX_LINESIZE];    /* tty name */
-       pid_t ut_pid;                   /* process id creating the entry */
-       short ut_type;                  /* type of this entry */
-       struct timeval ut_tv;           /* time entry was created */
-       char ut_host[_UTX_HOSTSIZE];    /* host name */
-       __uint32_t ut_pad[16];          /* reserved for future use */
-};
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-struct lastlogx {
-       struct timeval ll_tv;           /* time entry was created */
-       char ll_line[_UTX_LINESIZE];    /* tty name */
-       char ll_host[_UTX_HOSTSIZE];    /* host name */
-};
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-__BEGIN_DECLS
-
-void   endutxent(void);
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-void   endutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-struct lastlogx *
-       getlastlogx(uid_t, struct lastlogx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-struct lastlogx *
-       getlastlogxbyname(const char*, struct lastlogx *)__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-#ifdef UNIFDEF_LEGACY_UTMP_APIS
-struct utmp;   /* forward reference */
-void   getutmp(const struct utmpx *, struct utmp *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-void   getutmpx(const struct utmp *, struct utmpx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-#endif /* UNIFDEF_LEGACY_UTMP_APIS */
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-struct utmpx *
-       getutxent(void);
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-struct utmpx *
-       getutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-struct utmpx *
-       getutxid(const struct utmpx *);
-struct utmpx *
-       getutxline(const struct utmpx *);
-struct utmpx *
-       pututxline(const struct utmpx *);
-void   setutxent(void);
-
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
-void   setutxent_wtmp(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-int    utmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-int    wtmpxname(const char *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
-#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
-
-__END_DECLS
-
-#endif /* !_UTMPX_H_ */
index fe527fd388174be14d4e1bba5bf466cdbc80f5a5..fdb80ad4eb080b35cf59d76eb3e4eb14eeee523a 100644 (file)
@@ -124,8 +124,8 @@ wchar_t     *fgetws(wchar_t * __restrict, int, FILE * __restrict);
 wint_t fputwc(wchar_t, FILE *);
 int    fputws(const wchar_t * __restrict, FILE * __restrict);
 int    fwide(FILE *, int);
-int    fwprintf(FILE * __restrict, const wchar_t * __restrict, ...) __DARWIN_LDBL_COMPAT(fwprintf);
-int    fwscanf(FILE * __restrict, const wchar_t * __restrict, ...) __DARWIN_LDBL_COMPAT(fwscanf);
+int    fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
+int    fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
 wint_t getwc(FILE *);
 wint_t getwchar(void);
 size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
@@ -136,15 +136,14 @@ size_t    mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
            mbstate_t * __restrict);
 wint_t putwc(wchar_t, FILE *);
 wint_t putwchar(wchar_t);
-int    swprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-           ...) __DARWIN_LDBL_COMPAT(swprintf);
-int    swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...) __DARWIN_LDBL_COMPAT(swscanf);
+int    swprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict, ...);
+int    swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
 wint_t ungetwc(wint_t, FILE *);
 int    vfwprintf(FILE * __restrict, const wchar_t * __restrict,
-           __darwin_va_list) __DARWIN_LDBL_COMPAT(vfwprintf);
+           __darwin_va_list);
 int    vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-           __darwin_va_list) __DARWIN_LDBL_COMPAT(vswprintf);
-int    vwprintf(const wchar_t * __restrict, __darwin_va_list) __DARWIN_LDBL_COMPAT(vwprintf);
+           __darwin_va_list);
+int    vwprintf(const wchar_t * __restrict, __darwin_va_list);
 size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
 wchar_t        *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
 wchar_t        *wcschr(const wchar_t *, wchar_t);
@@ -186,8 +185,8 @@ int wmemcmp(const wchar_t *, const wchar_t *, size_t);
 wchar_t        *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
 wchar_t        *wmemmove(wchar_t *, const wchar_t *, size_t);
 wchar_t        *wmemset(wchar_t *, wchar_t, size_t);
-int    wprintf(const wchar_t * __restrict, ...) __DARWIN_LDBL_COMPAT(wprintf);
-int    wscanf(const wchar_t * __restrict, ...) __DARWIN_LDBL_COMPAT(wscanf);
+int    wprintf(const wchar_t * __restrict, ...);
+int    wscanf(const wchar_t * __restrict, ...);
 int    wcswidth(const wchar_t *, size_t);
 int    wcwidth(wchar_t);
 __END_DECLS
@@ -202,13 +201,13 @@ __END_DECLS
 #if __DARWIN_C_LEVEL >= 200112L || defined(_C99_SOURCE) || defined(__cplusplus)
 __BEGIN_DECLS
 int    vfwscanf(FILE * __restrict, const wchar_t * __restrict,
-           __darwin_va_list) __DARWIN_LDBL_COMPAT(vfwscanf);
+           __darwin_va_list);
 int    vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
-           __darwin_va_list) __DARWIN_LDBL_COMPAT(vswscanf);
-int    vwscanf(const wchar_t * __restrict, __darwin_va_list) __DARWIN_LDBL_COMPAT(vwscanf);
+           __darwin_va_list);
+int    vwscanf(const wchar_t * __restrict, __darwin_va_list);
 float  wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
 long double
-       wcstold(const wchar_t * __restrict, wchar_t ** __restrict) __DARWIN_LDBL_COMPAT(wcstold);
+       wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
 #if !__DARWIN_NO_LONG_LONG
 long long
        wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);
index ccb0a4308fe4aae50d7d885b7eaf77a25e8e7d2f..7772f6c366ac14103e3a0cc76e585c8cce7cc44b 100644 (file)
@@ -91,6 +91,9 @@ __END_DECLS
 #ifdef _MONETARY_H_
 #include <xlocale/_monetary.h>
 #endif /* _MONETARY_H_ */
+#ifdef _REGEX_H_
+#include <xlocale/_regex.h>
+#endif /* _REGEX_H_ */
 #ifdef _STDIO_H_
 #include <xlocale/_stdio.h>
 #endif /* _STDIO_H_ */
diff --git a/include/xlocale/Makefile.inc b/include/xlocale/Makefile.inc
deleted file mode 100644 (file)
index 03bc781..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-INCXLOCALE_INSTHDRS += __wctype.h _ctype.h _inttypes.h _langinfo.h \
-                       _monetary.h _stdlib.h _stdio.h _string.h \
-                       _time.h _wchar.h _wctype.h
-
-INCXLOCALE_INSTHDRS := ${INCXLOCALE_INSTHDRS:S/^/${.CURDIR}\/include\/xlocale\//}
-XLOCALE_INSTHDRS += ${INCXLOCALE_INSTHDRS}
diff --git a/include/xlocale/_regex.h b/include/xlocale/_regex.h
new file mode 100644 (file)
index 0000000..8321764
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#ifndef _XLOCALE__REGEX_H_
+#define _XLOCALE__REGEX_H_
+
+__BEGIN_DECLS
+
+int    regcomp_l(regex_t * __restrict, const char * __restrict, int,
+           locale_t __restrict)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+
+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
+
+int    regncomp_l(regex_t * __restrict, const char * __restrict, size_t,
+           int, locale_t __restrict)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+int    regwcomp_l(regex_t * __restrict, const wchar_t * __restrict,
+           int, locale_t __restrict)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+int    regwnexec_l(const regex_t * __restrict, const wchar_t * __restrict,
+           size_t, size_t, regmatch_t __pmatch[ __restrict], int,
+           locale_t __restrict)
+           __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA);
+
+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
+
+__END_DECLS
+
+#endif /* _XLOCALE__REGEX_H_ */
index f9fdf8694c1d850f27e993e7cbaa97418c88fc5b..64ff86f02ae384804e41e8a20e5700ff53aa3518 100644 (file)
 __BEGIN_DECLS
 
 int     fprintf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
-        __DARWIN_LDBL_COMPAT2(fprintf_l) __printflike(3, 4);
+        __printflike(3, 4);
 int     fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
-        __DARWIN_LDBL_COMPAT2(fscanf_l) __scanflike(3, 4);
+        __scanflike(3, 4);
 int     printf_l(locale_t, const char * __restrict, ...)
-        __DARWIN_LDBL_COMPAT2(printf_l) __printflike(2, 3);
+        __printflike(2, 3);
 int     scanf_l(locale_t, const char * __restrict, ...)
-        __DARWIN_LDBL_COMPAT2(scanf_l) __scanflike(2, 3);
+        __scanflike(2, 3);
 int     sprintf_l(char * __restrict, locale_t, const char * __restrict, ...)
-        __DARWIN_LDBL_COMPAT2(sprintf_l) __printflike(3, 4);
+        __printflike(3, 4);
 int     sscanf_l(const char * __restrict, locale_t, const char * __restrict, ...) 
-        __DARWIN_LDBL_COMPAT2(sscanf_l) __scanflike(3, 4);
+        __scanflike(3, 4);
 int     vfprintf_l(FILE * __restrict, locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vfprintf_l) __printflike(3, 0);
+        __printflike(3, 0);
 int     vprintf_l(locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vprintf_l) __printflike(2, 0);
+        __printflike(2, 0);
 int     vsprintf_l(char * __restrict, locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vsprintf_l) __printflike(3, 0);
+        __printflike(3, 0);
 
 #if __DARWIN_C_LEVEL >= 200112L
 int     snprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, ...)
-        __DARWIN_LDBL_COMPAT2(snprintf_l) __printflike(4, 5);
+        __printflike(4, 5);
 int     vfscanf_l(FILE * __restrict, locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vfscanf_l) __scanflike(3, 0);
+        __scanflike(3, 0);
 int     vscanf_l(locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vscanf_l) __scanflike(2, 0);
+        __scanflike(2, 0);
 int     vsnprintf_l(char * __restrict, size_t, locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vsnprintf_l) __printflike(4, 0);
+        __printflike(4, 0);
 int     vsscanf_l(const char * __restrict, locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vsscanf_l) __scanflike(3, 0);
+        __scanflike(3, 0);
 #endif
 
 #if __DARWIN_C_LEVEL >= 200809L
 int     dprintf_l(int, locale_t, const char * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(dprintf_l) __printflike(3, 4) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+        __printflike(3, 4) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 int     vdprintf_l(int, locale_t, const char * __restrict, va_list)
-        __DARWIN_LDBL_COMPAT2(vdprintf_l) __printflike(3, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
+        __printflike(3, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
 #endif
 
 
 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
 int     asprintf_l(char **, locale_t, const char *, ...)
-        __DARWIN_LDBL_COMPAT2(asprintf_l) __printflike(3, 4);
+        __printflike(3, 4);
 int     vasprintf_l(char **, locale_t, const char *, va_list)
-        __DARWIN_LDBL_COMPAT2(vasprintf_l) __printflike(3, 0);
+        __printflike(3, 0);
 #endif
 
 __END_DECLS
index 494a917157556fbe422ee0eae5afb1fb21dae68b..e5076d69ca1529a4094c9be30aaba8a5ed0d4702 100644 (file)
@@ -41,8 +41,7 @@ double         strtod_l(const char *, char **, locale_t) __DARWIN_ALIAS(strtod_l);
 float   strtof_l(const char *, char **, locale_t) __DARWIN_ALIAS(strtof_l);
 long    strtol_l(const char *, char **, int, locale_t);
 long double
-        strtold_l(const char *, char **, locale_t)
-            __DARWIN_LDBL_COMPAT2(strtold_l);
+        strtold_l(const char *, char **, locale_t);
 long long
         strtoll_l(const char *, char **, int, locale_t);
 #if !__DARWIN_NO_LONG_LONG
index c3c8974e32b4e0f2fd0f3ab85458880abc160cbd..fbfb2f7eeed5d45cf933b425919d88e5980d8b0f 100644 (file)
@@ -31,10 +31,8 @@ wint_t       fgetwc_l(FILE *, locale_t);
 wchar_t        *fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t);
 wint_t fputwc_l(wchar_t, FILE *, locale_t);
 int    fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t);
-int    fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(fwprintf_l);
-int    fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(fwscanf_l);
+int    fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int    fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
 wint_t getwc_l(FILE *, locale_t);
 wint_t getwchar_l(locale_t);
 size_t mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict,
@@ -47,19 +45,15 @@ size_t      mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t,
 wint_t putwc_l(wchar_t, FILE *, locale_t);
 wint_t putwchar_l(wchar_t, locale_t);
 int    swprintf_l(wchar_t * __restrict, size_t n, locale_t,
-               const wchar_t * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(swprintf_l);
+               const wchar_t * __restrict, ...);
 int    swscanf_l(const wchar_t * __restrict, locale_t,
-               const wchar_t * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(swscanf_l);
+               const wchar_t * __restrict, ...);
 wint_t ungetwc_l(wint_t, FILE *, locale_t);
 int    vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-               __darwin_va_list) __DARWIN_LDBL_COMPAT2(vfwprintf_l);
+               __darwin_va_list);
 int    vswprintf_l(wchar_t * __restrict, size_t n, locale_t,
-               const wchar_t * __restrict, __darwin_va_list)
-               __DARWIN_LDBL_COMPAT2(vswprintf_l);
-int    vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list)
-               __DARWIN_LDBL_COMPAT2(vwprintf_l);
+               const wchar_t * __restrict, __darwin_va_list);
+int    vwprintf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
 size_t wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict,
            locale_t);
 int    wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
@@ -89,10 +83,8 @@ size_t       wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t,
            locale_t);
 int    wctob_l(wint_t, locale_t);
 int    wcwidth_l(wchar_t, locale_t);
-int    wprintf_l(locale_t, const wchar_t * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(wprintf_l);
-int    wscanf_l(locale_t, const wchar_t * __restrict, ...)
-               __DARWIN_LDBL_COMPAT2(wscanf_l);
+int    wprintf_l(locale_t, const wchar_t * __restrict, ...);
+int    wscanf_l(locale_t, const wchar_t * __restrict, ...);
 __END_DECLS
  
  
@@ -104,16 +96,13 @@ __END_DECLS
 #if __DARWIN_C_LEVEL >= 200112L
 __BEGIN_DECLS
 int    vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
-               __darwin_va_list) __DARWIN_LDBL_COMPAT2(vfwscanf_l);
+               __darwin_va_list);
 int    vswscanf_l(const wchar_t * __restrict, locale_t,
-               const wchar_t * __restrict, __darwin_va_list)
-               __DARWIN_LDBL_COMPAT2(vswscanf_l);
-int    vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list)
-               __DARWIN_LDBL_COMPAT2(vwscanf_l);
+               const wchar_t * __restrict, __darwin_va_list);
+int    vwscanf_l(locale_t, const wchar_t * __restrict, __darwin_va_list);
 float  wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
 long double
-       wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t)
-           __DARWIN_LDBL_COMPAT2(wcstold_l);
+       wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t);
 #if !__DARWIN_NO_LONG_LONG
 long long
        wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
diff --git a/internat/Makefile.inc b/internat/Makefile.inc
deleted file mode 100644 (file)
index b9a0457..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-.PATH: ${.CURDIR}/${MACHINE_ARCH}/internat ${.CURDIR}/internat
-
-MISRCS += NXCType.c     NXIsCntrl.c   NXIsPrint.c   NXIsXDigit.c  _NXToLower.c \
-        NXIsAlNum.c   NXIsDigit.c   NXIsPunct.c   NXToAscii.c   _NXToUpper.c \
-        NXIsAlpha.c   NXIsGraph.c   NXIsSpace.c   NXToLower.c \
-        NXIsAscii.c   NXIsLower.c   NXIsUpper.c   NXToUpper.c 
diff --git a/internat/NXCType.c b/internat/NXCType.c
deleted file mode 100644 (file)
index b54ee1d..0000000
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#pragma CC_NO_MACH_TEXT_SECTIONS
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-/*
- * This file contains global data and the size of the global data can NOT
- * change or otherwise it would make the shared library incompatable.  This
- * file has NOT been padded to allow more data to be added to it because the
- * sizeof(char) is not expected to change.
- */
-#include "NXCType.h"
-
-const unsigned int _NX_CTypeTable_[1 + 256] = {
-
-/* One extra char in table: */ 0,
-/*    0        .notdef */      _CTYPE_C,
-/*    1        .notdef */      _CTYPE_C,
-/*    2        .notdef */      _CTYPE_C,
-/*    3        .notdef */      _CTYPE_C,
-/*    4        .notdef */      _CTYPE_C,
-/*    5        .notdef */      _CTYPE_C,
-/*    6        .notdef */      _CTYPE_C,
-/*    7        .notdef */      _CTYPE_C,
-
-/*    8        .notdef */      _CTYPE_C,
-/*    9        .notdef */      _CTYPE_C|_CTYPE_S,
-/*   10        .notdef */      _CTYPE_C|_CTYPE_S,
-/*   11        .notdef */      _CTYPE_C|_CTYPE_S,
-/*   12        .notdef */      _CTYPE_C|_CTYPE_S,
-/*   13        .notdef */      _CTYPE_C|_CTYPE_S,
-/*   14        .notdef */      _CTYPE_C,
-/*   15        .notdef */      _CTYPE_C,
-
-/*   16        .notdef */      _CTYPE_C,
-/*   17        .notdef */      _CTYPE_C,
-/*   18        .notdef */      _CTYPE_C,
-/*   19        .notdef */      _CTYPE_C,
-/*   20        .notdef */      _CTYPE_C,
-/*   21        .notdef */      _CTYPE_C,
-/*   22        .notdef */      _CTYPE_C,
-/*   23        .notdef */      _CTYPE_C,
-
-/*   24        .notdef */      _CTYPE_C,
-/*   25        .notdef */      _CTYPE_C,
-/*   26        .notdef */      _CTYPE_C,
-/*   27        .notdef */      _CTYPE_C,
-/*   28        .notdef */      _CTYPE_C,
-/*   29        .notdef */      _CTYPE_C,
-/*   30        .notdef */      _CTYPE_C,
-/*   31        .notdef */      _CTYPE_C,
-
-/*   32        space */        _CTYPE_S|_CTYPE_B,
-/*   33        exclam */       _CTYPE_P,
-/*   34        quotedbl */     _CTYPE_P,
-/*   35        numbersign */   _CTYPE_P,
-/*   36        dollar */       _CTYPE_P,
-/*   37        percent */      _CTYPE_P,
-/*   38        ampersand */    _CTYPE_P,
-/*   39        quoteright */   _CTYPE_P,
-
-/*   40        parenleft */    _CTYPE_P,
-/*   41        parenright */   _CTYPE_P,
-/*   42        asterisk */     _CTYPE_P,
-/*   43        plus */         _CTYPE_P,
-/*   44        comma */        _CTYPE_P,
-/*   45        hyphen */       _CTYPE_P,
-/*   46        period */       _CTYPE_P,
-/*   47        slash */        _CTYPE_P,
-
-/*   48        zero */         _CTYPE_D,
-/*   49        one */          _CTYPE_D,
-/*   50        two */          _CTYPE_D,
-/*   51        three */        _CTYPE_D,
-/*   52        four */         _CTYPE_D,
-/*   53        five */         _CTYPE_D,
-/*   54        six */          _CTYPE_D,
-/*   55        seven */        _CTYPE_D,
-
-/*   56        eight */        _CTYPE_D,
-/*   57        nine */         _CTYPE_D,
-/*   58        colon */        _CTYPE_P,
-/*   59        semicolon */    _CTYPE_P,
-/*   60        less */         _CTYPE_P,
-/*   61        equal */        _CTYPE_P,
-/*   62        greater */      _CTYPE_P,
-/*   63        question */     _CTYPE_P,
-
-/*   64        at */           _CTYPE_P,
-/*   65        A */            _CTYPE_U|_CTYPE_X,
-/*   66        B */            _CTYPE_U|_CTYPE_X,
-/*   67        C */            _CTYPE_U|_CTYPE_X,
-/*   68        D */            _CTYPE_U|_CTYPE_X,
-/*   69        E */            _CTYPE_U|_CTYPE_X,
-/*   70        F */            _CTYPE_U|_CTYPE_X,
-/*   71        G */            _CTYPE_U,
-
-/*   72        H */    _CTYPE_U,
-/*   73        I */    _CTYPE_U,
-/*   74        J */    _CTYPE_U,
-/*   75        K */    _CTYPE_U,
-/*   76        L */    _CTYPE_U,
-/*   77        M */    _CTYPE_U,
-/*   78        N */    _CTYPE_U,
-/*   79        O */    _CTYPE_U,
-
-/*   80        P */    _CTYPE_U,
-/*   81        Q */    _CTYPE_U,
-/*   82        R */    _CTYPE_U,
-/*   83        S */    _CTYPE_U,
-/*   84        T */    _CTYPE_U,
-/*   85        U */    _CTYPE_U,
-/*   86        V */    _CTYPE_U,
-/*   87        W */    _CTYPE_U,
-
-/*   88        X */    _CTYPE_U,
-/*   89        Y */    _CTYPE_U,
-/*   90        Z */    _CTYPE_U,
-/*   91        bracketleft */  _CTYPE_P,
-/*   92        backslash */    _CTYPE_P,
-/*   93        bracketright */ _CTYPE_P,
-/*   94        asciicircum */  _CTYPE_P,
-/*   95        underscore */   _CTYPE_P,
-
-/*   96        quoteleft */    _CTYPE_P,
-/*   97        a */    _CTYPE_L|_CTYPE_X,
-/*   98        b */    _CTYPE_L|_CTYPE_X,
-/*   99        c */    _CTYPE_L|_CTYPE_X,
-/*  100        d */    _CTYPE_L|_CTYPE_X,
-/*  101        e */    _CTYPE_L|_CTYPE_X,
-/*  102        f */    _CTYPE_L|_CTYPE_X,
-/*  103        g */    _CTYPE_L,
-
-/*  104        h */    _CTYPE_L,
-/*  105        i */    _CTYPE_L,
-/*  106        j */    _CTYPE_L,
-/*  107        k */    _CTYPE_L,
-/*  108        l */    _CTYPE_L,
-/*  109        m */    _CTYPE_L,
-/*  110        n */    _CTYPE_L,
-/*  111        o */    _CTYPE_L,
-
-/*  112        p */    _CTYPE_L,
-/*  113        q */    _CTYPE_L,
-/*  114        r */    _CTYPE_L,
-/*  115        s */    _CTYPE_L,
-/*  116        t */    _CTYPE_L,
-/*  117        u */    _CTYPE_L,
-/*  118        v */    _CTYPE_L,
-/*  119        w */    _CTYPE_L,
-
-/*  120        x */    _CTYPE_L,
-/*  121        y */    _CTYPE_L,
-/*  122        z */    _CTYPE_L,
-/*  123        braceleft */    _CTYPE_P,
-/*  124        bar */          _CTYPE_P,
-/*  125        braceright */   _CTYPE_P,
-/*  126        asciitilde */   _CTYPE_P,
-/*  127        .notdef */      _CTYPE_C,
-
-/*  128        .notdef */      _CTYPE_C,
-/*  129        Agrave */       _CTYPE_U,
-/*  130        Aacute */       _CTYPE_U,
-/*  131        Acircumflex */  _CTYPE_U,
-/*  132        Atilde */       _CTYPE_U,
-/*  133        Adieresis */    _CTYPE_U,
-/*  134        Aring */        _CTYPE_U,
-/*  135        Ccedilla */     _CTYPE_U,
-
-/*  136        Egrave */       _CTYPE_U,
-/*  137        Eacute */       _CTYPE_U,
-/*  138        Ecircumflex */  _CTYPE_U,
-/*  139        Edieresis */    _CTYPE_U,
-/*  140        Igrave */       _CTYPE_U,
-/*  141        Iacute */       _CTYPE_U,
-/*  142        Icircumflex */  _CTYPE_U,
-/*  143        Idieresis */    _CTYPE_U,
-
-/*  144        Eth */          _CTYPE_U,
-/*  145        Ntilde */       _CTYPE_U,
-/*  146        Ograve */       _CTYPE_U,
-/*  147        Oacute */       _CTYPE_U,
-/*  148        Ocircumflex */  _CTYPE_U,
-/*  149        Otilde */       _CTYPE_U,
-/*  150        Odieresis */    _CTYPE_U,
-/*  151        Ugrave */       _CTYPE_U,
-
-/*  152        Uacute */       _CTYPE_U,
-/*  153        Ucircumflex */  _CTYPE_U,
-/*  154        Udieresis */    _CTYPE_U,
-/*  155        Yacute */       _CTYPE_U,
-/*  156        Thorn */        _CTYPE_U,
-/*  157        mu */           _CTYPE_P,
-/*  158        multiply */     _CTYPE_P,
-/*  159        divide */       _CTYPE_P,
-
-/*  160        copyright */    _CTYPE_P,
-/*  161        exclamdown */   _CTYPE_P,
-/*  162        cent */         _CTYPE_P,
-/*  163        sterling */     _CTYPE_P,
-/*  164        fraction */     _CTYPE_P,
-/*  165        yen */          _CTYPE_P,
-/*  166        florin */       _CTYPE_P,
-/*  167        section */      _CTYPE_P,
-
-/*  168        currency */     _CTYPE_P,
-/*  169        quotesingle */  _CTYPE_P,
-/*  170        quotedblleft */ _CTYPE_P,
-/*  171        guillemotleft */ _CTYPE_P,
-/*  172        guilsinglleft */ _CTYPE_P,
-/*  173        guilsinglright */ _CTYPE_P,
-/*  174        fi */           _CTYPE_L,
-/*  175        fl */           _CTYPE_L,
-
-/*  176        registered */   _CTYPE_P,
-/*  177        endash */       _CTYPE_P,
-/*  178        dagger */       _CTYPE_P,
-/*  179        daggerdbl */    _CTYPE_P,
-/*  180        periodcentered */ _CTYPE_P,
-/*  181        brokenbar */    _CTYPE_P,
-/*  182        paragraph */    _CTYPE_P,
-/*  183        bullet */       _CTYPE_P,
-
-/*  184        quotesinglbase */ _CTYPE_P,
-/*  185        quotedblbase */ _CTYPE_P,
-/*  186        quotedblright */ _CTYPE_P,
-/*  187        guillemotright */ _CTYPE_P,
-/*  188        ellipsis */     _CTYPE_P,
-/*  189        perthousand */  _CTYPE_P,
-/*  190        logicalnot */   _CTYPE_P,
-/*  191        questiondown */ _CTYPE_P,
-
-/*  192        onesuperior */  _CTYPE_P,
-/*  193        grave */        _CTYPE_P,
-/*  194        acute */        _CTYPE_P,
-/*  195        circumflex */   _CTYPE_P,
-/*  196        tilde */        _CTYPE_P,
-/*  197        macron */       _CTYPE_P,
-/*  198        breve */        _CTYPE_P,
-/*  199        dotaccent */    _CTYPE_P,
-
-/*  200        dieresis */     _CTYPE_P,
-/*  201        twosuperior */  _CTYPE_P,
-/*  202        ring */         _CTYPE_P,
-/*  203        cedilla */      _CTYPE_P,
-/*  204        threesuperior */ _CTYPE_P,
-/*  205        hungarumlaut */ _CTYPE_P,
-/*  206        ogonek */       _CTYPE_P,
-/*  207        caron */        _CTYPE_P,
-
-/*  208        emdash */       _CTYPE_P,
-/*  209        plusminus */    _CTYPE_P,
-/*  210        onequarter */   _CTYPE_P,
-/*  211        onehalf */      _CTYPE_P,
-/*  212        threequarters */ _CTYPE_P,
-/*  213        agrave */       _CTYPE_L,
-/*  214        aacute */       _CTYPE_L,
-/*  215        acircumflex */  _CTYPE_L,
-
-/*  216        atilde */       _CTYPE_L,
-/*  217        adieresis */    _CTYPE_L,
-/*  218        aring */        _CTYPE_L,
-/*  219        ccedilla */     _CTYPE_L,
-/*  220        egrave */       _CTYPE_L,
-/*  221        eacute */       _CTYPE_L,
-/*  222        ecircumflex */  _CTYPE_L,
-/*  223        edieresis */    _CTYPE_L,
-
-/*  224        igrave */       _CTYPE_L,
-/*  225        AE */           _CTYPE_U,
-/*  226        iacute */       _CTYPE_L,
-/*  227        ordfeminine */  _CTYPE_P,
-/*  228        icircumflex */  _CTYPE_L,
-/*  229        idieresis */    _CTYPE_L,
-/*  230        eth */          _CTYPE_L,
-/*  231        ntilde */       _CTYPE_L,
-
-/*  232        Lslash */       _CTYPE_U,
-/*  233        Oslash */       _CTYPE_U,
-/*  234        OE */           _CTYPE_U,
-/*  235        ordmasculine */ _CTYPE_P,
-/*  236        ograve */       _CTYPE_L,
-/*  237        oacute */       _CTYPE_L,
-/*  238        ocircumflex */  _CTYPE_L,
-/*  239        otilde */       _CTYPE_L,
-
-/*  240        odieresis */    _CTYPE_L,
-/*  241        ae */           _CTYPE_L,
-/*  242        ugrave */       _CTYPE_L,
-/*  243        uacute */       _CTYPE_L,
-/*  244        ucircumflex */  _CTYPE_L,
-/*  245        dotlessi */     _CTYPE_L,
-/*  246        udieresis */    _CTYPE_L,
-/*  247        yacute */       _CTYPE_L,
-
-/*  248        lslash */       _CTYPE_L,
-/*  249        oslash */       _CTYPE_L,
-/*  250        oe */           _CTYPE_L,
-/*  251        germandbls */   _CTYPE_L,
-/*  252        thorn */        _CTYPE_L,
-/*  253        ydieresis */    _CTYPE_L,
-/*  254        .notdef */      _CTYPE_C,
-/*  255        .notdef */      _CTYPE_C,
-};
-
-/*
- * Upper to lower and lower to upper table for NeXTStep encoding (256
- * characters).  An entry of zero means it's not an upper or lower case
- * thing (i.e., isn't alphabetic).  Otherwise, the value at a given
- * position is the opposite case equivalent.  E.g., the entry for the
- * "A" position is "a" and the entry for position "a" is "A".
- *
- * There are some pathological cases: ydieresis, germandbls, and the
- * fi & fl ligatures don't have "other case" equivalents; therefore
- * they're entered as themselves because they are in fact "lower case"
- * and the Type table lists them as _CTYPE_L.
- */
-const unsigned char _NX_ULTable_[256] = {
-/*    0        .notdef */      0,
-/*    1        .notdef */      0,
-/*    2        .notdef */      0,
-/*    3        .notdef */      0,
-/*    4        .notdef */      0,
-/*    5        .notdef */      0,
-/*    6        .notdef */      0,
-/*    7        .notdef */      0,
-/*    8        .notdef */      0,
-/*    9        .notdef */      0,
-/*   10        .notdef */      0,
-/*   11        .notdef */      0,
-/*   12        .notdef */      0,
-/*   13        .notdef */      0,
-/*   14        .notdef */      0,
-/*   15        .notdef */      0,
-/*   16        .notdef */      0,
-/*   17        .notdef */      0,
-/*   18        .notdef */      0,
-/*   19        .notdef */      0,
-/*   20        .notdef */      0,
-/*   21        .notdef */      0,
-/*   22        .notdef */      0,
-/*   23        .notdef */      0,
-/*   24        .notdef */      0,
-/*   25        .notdef */      0,
-/*   26        .notdef */      0,
-/*   27        .notdef */      0,
-/*   28        .notdef */      0,
-/*   29        .notdef */      0,
-/*   30        .notdef */      0,
-/*   31        .notdef */      0,
-/*   32        space */        0,
-/*   33        exclam */       0,
-/*   34        quotedbl */     0,
-/*   35        numbersign */   0,
-/*   36        dollar */       0,
-/*   37        percent */      0,
-/*   38        ampersand */    0,
-/*   39        quoteright */   0,
-/*   40        parenleft */    0,
-/*   41        parenright */   0,
-/*   42        asterisk */     0,
-/*   43        plus */         0,
-/*   44        comma */        0,
-/*   45        hyphen */       0,
-/*   46        period */       0,
-/*   47        slash */        0,
-/*   48        zero */         0,
-/*   49        one */          0,
-/*   50        two */          0,
-/*   51        three */        0,
-/*   52        four */         0,
-/*   53        five */         0,
-/*   54        six */          0,
-/*   55        seven */        0,
-/*   56        eight */        0,
-/*   57        nine */         0,
-/*   58        colon */        0,
-/*   59        semicolon */    0,
-/*   60        less */         0,
-/*   61        equal */        0,
-/*   62        greater */      0,
-/*   63        question */     0,
-/*   64        at */           0,
-/*   65        A */            97,
-/*   66        B */            98,
-/*   67        C */            99,
-/*   68        D */            100,
-/*   69        E */            101,
-/*   70        F */            102,
-/*   71        G */            103,
-/*   72        H */            104,
-/*   73        I */    105,
-/*   74        J */    106,
-/*   75        K */    107,
-/*   76        L */    108,
-/*   77        M */    109,
-/*   78        N */    110,
-/*   79        O */    111,
-/*   80        P */    112,
-/*   81        Q */    113,
-/*   82        R */    114,
-/*   83        S */    115,
-/*   84        T */    116,
-/*   85        U */    117,
-/*   86        V */    118,
-/*   87        W */    119,
-/*   88        X */    120,
-/*   89        Y */    121,
-/*   90        Z */    122,
-/*   91        bracketleft */  0,
-/*   92        backslash */    0,
-/*   93        bracketright */ 0,
-/*   94        asciicircum */  0,
-/*   95        underscore */   0,
-/*   96        quoteleft */    0,
-/*   97        a */    65,
-/*   98        b */    66,
-/*   99        c */    67,
-/*  100        d */    68,
-/*  101        e */    69,
-/*  102        f */    70,
-/*  103        g */    71,
-/*  104        h */    72,
-/*  105        i */    73,
-/*  106        j */    74,
-/*  107        k */    75,
-/*  108        l */    76,
-/*  109        m */    77,
-/*  110        n */    78,
-/*  111        o */    79,
-/*  112        p */    80,
-/*  113        q */    81,
-/*  114        r */    82,
-/*  115        s */    83,
-/*  116        t */    84,
-/*  117        u */    85,
-/*  118        v */    86,
-/*  119        w */    87,
-/*  120        x */    88,
-/*  121        y */    89,
-/*  122        z */    90,
-/*  123        braceleft */    0,
-/*  124        bar */          0,
-/*  125        braceright */   0,
-/*  126        asciitilde */   0,
-/*  127        .notdef */      0,
-/*  128        .notdef */      0,
-/*  129        Agrave */       213,
-/*  130        Aacute */       214,
-/*  131        Acircumflex */  215,
-/*  132        Atilde */       216,
-/*  133        Adieresis */    217,
-/*  134        Aring */        218,
-/*  135        Ccedilla */     219,
-/*  136        Egrave */       220,
-/*  137        Eacute */       221,
-/*  138        Ecircumflex */  222,
-/*  139        Edieresis */    223,
-/*  140        Igrave */       224,
-/*  141        Iacute */       226,
-/*  142        Icircumflex */  228,
-/*  143        Idieresis */    229,
-/*  144        Eth */          230,
-/*  145        Ntilde */       231,
-/*  146        Ograve */       236,
-/*  147        Oacute */       237,
-/*  148        Ocircumflex */  238,
-/*  149        Otilde */       239,
-/*  150        Odieresis */    240,
-/*  151        Ugrave */       242,
-/*  152        Uacute */       243,
-/*  153        Ucircumflex */  244,
-/*  154        Udieresis */    246,
-/*  155        Yacute */       247,
-/*  156        Thorn */        252,
-/*  157        mu */           0,
-/*  158        multiply */     0,
-/*  159        divide */       0,
-/*  160        copyright */    0,
-/*  161        exclamdown */   0,
-/*  162        cent */         0,
-/*  163        sterling */     0,
-/*  164        fraction */     0,
-/*  165        yen */          0,
-/*  166        florin */       0,
-/*  167        section */      0,
-/*  168        currency */     0,
-/*  169        quotesingle */  0,
-/*  170        quotedblleft */ 0,
-/*  171        guillemotleft */ 0,
-/*  172        guilsinglleft */ 0,
-/*  173        guilsinglright */ 0,
-/*  174        fi */           174,    /* is self */
-/*  175        fl */           175,    /* is self */
-/*  176        registered */   0,
-/*  177        endash */       0,
-/*  178        dagger */       0,
-/*  179        daggerdbl */    0,
-/*  180        periodcentered */ 0,
-/*  181        brokenbar */    0,
-/*  182        paragraph */    0,
-/*  183        bullet */       0,
-/*  184        quotesinglbase */ 0,
-/*  185        quotedblbase */ 0,
-/*  186        quotedblright */ 0,
-/*  187        guillemotright */ 0,
-/*  188        ellipsis */     0,
-/*  189        perthousand */  0,
-/*  190        logicalnot */   0,
-/*  191        questiondown */ 0,
-/*  192        onesuperior */  0,
-/*  193        grave */        0,
-/*  194        acute */        0,
-/*  195        circumflex */   0,
-/*  196        tilde */        0,
-/*  197        macron */       0,
-/*  198        breve */        0,
-/*  199        dotaccent */    0,
-/*  200        dieresis */     0,
-/*  201        twosuperior */  0,
-/*  202        ring */         0,
-/*  203        cedilla */      0,
-/*  204        threesuperior */ 0,
-/*  205        hungarumlaut */ 0,
-/*  206        ogonek */       0,
-/*  207        caron */        0,
-/*  208        emdash */       0,
-/*  209        plusminus */    0,
-/*  210        onequarter */   0,
-/*  211        onehalf */      0,
-/*  212        threequarters */ 0,
-/*  213        agrave */       129,
-/*  214        aacute */       130,
-/*  215        acircumflex */  131,
-/*  216        atilde */       132,
-/*  217        adieresis */    133,
-/*  218        aring */        134,
-/*  219        ccedilla */     135,
-/*  220        egrave */       136,
-/*  221        eacute */       137,
-/*  222        ecircumflex */  138,
-/*  223        edieresis */    139,
-/*  224        igrave */       140,
-/*  225        AE */           241,
-/*  226        iacute */       141,
-/*  227        ordfeminine */  0,
-/*  228        icircumflex */  142,
-/*  229        idieresis */    143,
-/*  230        eth */          144,
-/*  231        ntilde */       145,
-/*  232        Lslash */       248,
-/*  233        Oslash */       249,
-/*  234        OE */           250,
-/*  235        ordmasculine */ 0,
-/*  236        ograve */       146,
-/*  237        oacute */       147,
-/*  238        ocircumflex */  148,
-/*  239        otilde */       149,
-/*  240        odieresis */    150,
-/*  241        ae */           225,
-/*  242        ugrave */       151,
-/*  243        uacute */       152,
-/*  244        ucircumflex */  153,
-/*  245        dotlessi */     245,    /* is self */
-/*  246        udieresis */    154,
-/*  247        yacute */       155,
-/*  248        lslash */       232,
-/*  249        oslash */       233,
-/*  250        oe */           234,
-/*  251        germandbls */   251,    /* is self */
-/*  252        thorn */        156,
-/*  253        ydieresis */    253,    /* is self */
-/*  254        .notdef */      0,
-/*  255        .notdef */      0
-};
-
diff --git a/internat/NXCType.h b/internat/NXCType.h
deleted file mode 100644 (file)
index 5b379f0..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*     NXCType.h */
-
-/* Copyright (c) 1990 NeXT, Inc. - 8/21/90 RM */
-/* patterned after ctype.h ; for 8-bit encoding, Europe only */
-
-#ifndef _NXCTYPE_H
-#define _NXCTYPE_H
-
-#include <ctype.h>
-
-extern int NXIsAlNum(unsigned c);
-extern int NXIsAlpha(unsigned c);
-extern int NXIsCntrl(unsigned c);
-extern int NXIsDigit(unsigned c);
-extern int NXIsGraph(unsigned c);
-extern int NXIsLower(unsigned c);
-extern int NXIsPrint(unsigned c);
-extern int NXIsPunct(unsigned c);
-extern int NXIsSpace(unsigned c);
-extern int NXIsUpper(unsigned c);
-extern int NXIsXDigit(unsigned c);
-extern int _NXToLower(unsigned c);
-extern int _NXToUpper(unsigned c);
-extern int NXToLower(unsigned c);
-extern int NXToUpper(unsigned c);
-extern int NXIsAscii(unsigned c);
-extern unsigned char *NXToAscii(unsigned c);
-
-/*
- * Data structures used by the internationized NX... versions of the
- * ctype(3) routines.  These structures are private to the above routines
- * and should NOT be referenced by the application.
- */
-extern const unsigned int _NX_CTypeTable_[];   /* char types */
-extern const unsigned char _NX_ULTable_[];     /* case conversion table */
-
-#endif /* _NXCTYPE_H */
diff --git a/internat/NXIsAlNum.c b/internat/NXIsAlNum.c
deleted file mode 100644 (file)
index 35670e0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsAlNum(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_U|_CTYPE_L|_CTYPE_D)));
-       return 0;
-}
diff --git a/internat/NXIsAlpha.c b/internat/NXIsAlpha.c
deleted file mode 100644 (file)
index 509673d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-
-int NXIsAlpha(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_U|_CTYPE_L)));
-       return 0;
-}
diff --git a/internat/NXIsAscii.c b/internat/NXIsAscii.c
deleted file mode 100644 (file)
index fc6f4bf..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int
-NXIsAscii(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       return (c <= 0177);
-}
diff --git a/internat/NXIsCntrl.c b/internat/NXIsCntrl.c
deleted file mode 100644 (file)
index 53263d0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsCntrl(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_C)));
-       return 0;
-}
diff --git a/internat/NXIsDigit.c b/internat/NXIsDigit.c
deleted file mode 100644 (file)
index 7e62966..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsDigit(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_D)));
-       return 0;
-}
diff --git a/internat/NXIsGraph.c b/internat/NXIsGraph.c
deleted file mode 100644 (file)
index af5c690..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsGraph(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_D)));
-       return 1;
-               /* NOTE: for 3.0, everything > 256 is probably Kanji, so say is graphic */
-}
diff --git a/internat/NXIsLower.c b/internat/NXIsLower.c
deleted file mode 100644 (file)
index dda9d4c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsLower(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_L)));
-       return 0;
-}
diff --git a/internat/NXIsPrint.c b/internat/NXIsPrint.c
deleted file mode 100644 (file)
index 0ef9eeb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsPrint(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_D|_CTYPE_B)));
-       return 1;
-               /* NOTE: for 3.0, everything > 255 is probably Kanji, so say printable... */
-}
diff --git a/internat/NXIsPunct.c b/internat/NXIsPunct.c
deleted file mode 100644 (file)
index 67206b7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsPunct(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_P)));
-       return 0;
-}
diff --git a/internat/NXIsSpace.c b/internat/NXIsSpace.c
deleted file mode 100644 (file)
index 24b0919..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsSpace(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_S)));
-       return 0;
-}
diff --git a/internat/NXIsUpper.c b/internat/NXIsUpper.c
deleted file mode 100644 (file)
index df31408..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsUpper(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_U)));
-       return 0;
-}
diff --git a/internat/NXIsXDigit.c b/internat/NXIsXDigit.c
deleted file mode 100644 (file)
index 3099b31..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int NXIsXDigit(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if (c < 256)
-               return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_D|_CTYPE_X)));
-       return 0;
-}
diff --git a/internat/NXToAscii.c b/internat/NXToAscii.c
deleted file mode 100644 (file)
index 8dc50e9..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-unsigned char *
-NXToAscii(c)
-       unsigned int c;
-{
-       static unsigned char woops[] = " ";
-
-       FIXSIGNEDCHAR(c);
-       if (c < 128) {          /* handle stuff already ASCII */
-               woops[0] = c;
-               return (unsigned char *) woops;
-       }
-       switch (c) {
-               case 128:       /* Figspace */
-                       return (unsigned char *) " ";
-               case 129:       /* Agrave */
-               case 130:       /* Aacute */
-               case 131:       /* Acircumflex */
-               case 132:       /* Atilde */
-               case 133:       /* Adieresis */
-               case 134:       /* Aring */
-                       return (unsigned char *) "A";
-               case 135:       /* Ccedilla */
-                       return (unsigned char *) "C";
-               case 136:       /* Egrave */
-               case 137:       /* Eacute */
-               case 138:       /* Ecircumflex */
-               case 139:       /* Edieresis */
-                       return (unsigned char *) "E";
-               case 140:       /* Igrave */
-               case 141:       /* Iacute */
-               case 142:       /* Icircumflex */
-               case 143:       /* Idieresis */
-                       return (unsigned char *) "I";
-               case 145:       /* Ntilde */
-                       return (unsigned char *) "N";
-               case 146:       /* Ograve */
-               case 147:       /* Oacute */
-               case 148:       /* Ocircumflex */
-               case 149:       /* Otilde */
-               case 150:       /* Odieresis */
-               case 233:       /* Oslash */
-                       return (unsigned char *) "O";
-               case 151:       /* Ugrave */
-               case 152:       /* Uacute */
-               case 153:       /* Ucircumflex */
-               case 154:       /* Udieresis */
-                       return (unsigned char *) "U";
-               case 155:       /* Yacute */
-                       return (unsigned char *) "Y";
-               case 230:       /* eth */
-               case 144:       /* Eth */
-                       return (unsigned char *) "TH";
-               case 156:       /* Thorn */
-               case 252:       /* thorn */
-                       return (unsigned char *) "th";
-
-               case 174:       /* fi */
-                       return (unsigned char *) "fi";
-               case 175:       /* fl */
-                       return (unsigned char *) "fl";
-
-               case 213:       /* agrave */
-               case 214:       /* aacute */
-               case 215:       /* acircumflex */
-               case 216:       /* atilde */
-               case 217:       /* adieresis */
-               case 218:       /* aring */
-                       return (unsigned char *) "a";
-               case 219:       /* ccedilla */
-                       return (unsigned char *) "c";
-               case 220:       /* egrave */
-               case 221:       /* eacute */
-               case 222:       /* ecircumflex */
-               case 223:       /* edieresis */
-                       return (unsigned char *) "e";
-               case 225:       /* AE */
-                       return (unsigned char *) "AE";
-               case 224:       /* igrave */
-               case 226:       /* iacute */
-               case 228:       /* icircumflex */
-               case 229:       /* idieresis */
-                       return (unsigned char *) "i";
-               case 231:       /* ntilde */
-                       return (unsigned char *) "n";
-               case 232:       /* Lslash */
-                       return (unsigned char *) "L";
-               case 234:       /* OE */
-                       return (unsigned char *) "OE";
-               case 236:       /* ograve */
-               case 237:       /* oacute */
-               case 238:       /* ocircumflex */
-               case 239:       /* otilde */
-               case 240:       /* odieresis */
-               case 249:       /* oslash */
-                       return (unsigned char *) "o";
-               case 241:       /* ae */
-                       return (unsigned char *) "ae";
-               case 242:       /* ugrave */
-               case 243:       /* uacute */
-               case 244:       /* ucircumflex */
-               case 246:       /* udieresis */
-                       return (unsigned char *) "u";
-               case 245:       /* dotlessi */
-                       return (unsigned char *) "i";
-               case 247:       /* yacute */
-               case 253:       /* ydieresis */
-                       return (unsigned char *) "y";
-               case 248:       /* lslash */
-                       return (unsigned char *) "l";
-               case 250:       /* oe */
-                       return (unsigned char *) "oe";
-               case 251:       /* germandbls */
-                       return (unsigned char *) "ss";
-               /*
-                * non-letter cases:
-                */
-               case 158:       /* multiply */          
-                       return (unsigned char *) "x";
-               case 159:       /* divide */            
-                       return (unsigned char *) "/";
-
-               case 161:       /* exclamdown */        
-                       return (unsigned char *) "!";
-               case 169:       /* quotesingle */       
-                       return (unsigned char *) "'";
-
-               case 170:       /* quotedblleft */
-               case 186:       /* quotedblright */
-               case 185:       /* quotedblbase */
-                       return (unsigned char *) "\"";
-               case 171:       /* guillemotleft */
-                       return (unsigned char *) "<<";
-               case 187:       /* guillemotright */
-                       return (unsigned char *) ">>";
-               case 184:       /* quotesinglbase */
-                       return (unsigned char *) "'";
-               case 172:       /* guilsinglleft */
-                       return (unsigned char *) "<";
-               case 173:       /* guilsinglright */
-                       return (unsigned char *) ">";
-               case 180:       /* periodcentered */
-                       return (unsigned char *) ".";
-               case 181:       /* brokenbar */
-                       return (unsigned char *) "|";
-               case 183:       /* bullet */
-                       return (unsigned char *) "*";
-               case 188:       /* ellipsis */
-                       return (unsigned char *) "...";
-               case 191:       /* questiondown */
-                       return (unsigned char *) "?";
-               case 192:       /* onesuperior */
-                       return (unsigned char *) "1";
-               case 201:       /* twosuperior */
-                       return (unsigned char *) "2";
-               case 204:       /* threesuperior */
-                       return (unsigned char *) "3";
-               case 208:       /* emdash */
-                       return (unsigned char *) "--";
-               case 209:       /* plusminus */
-                       return (unsigned char *) "+-";
-               case 210:       /* onequarter */
-                       return (unsigned char *) "1/4";
-               case 211:       /* onehalf */
-                       return (unsigned char *) "1/2";
-               case 212:       /* threequarters */
-                       return (unsigned char *) "3/4";
-               case 227:       /* ordfeminine */
-                       return (unsigned char *) "a";
-               case 235:       /* ordmasculine */
-                       return (unsigned char *) "o";
-               case 157:       /* mu */
-                       return (unsigned char *) "u";
-               case 160:       /* copyright */
-                       return (unsigned char *) "(C)";
-               case 163:       /* sterling */
-                       return (unsigned char *) "L";
-               case 164:       /* fraction */
-                       return (unsigned char *) "/";
-               case 165:       /* yen */
-                       return (unsigned char *) "Y";
-               case 166:       /* florin */
-                       return (unsigned char *) "f";
-               case 176:       /* registered */
-                       return (unsigned char *) "(R)";
-               case 190:       /* logicalnot */
-               case 177:       /* endash */
-                       return (unsigned char *) "-";
-               case 178:       /* dagger */
-                       return (unsigned char *) "+";
-               case 179:       /* daggerdbl */
-                       return (unsigned char *) "++";
-               case 189:       /* perthousand */
-                       return (unsigned char *) "0/00";
-               case 193:       /* grave */
-                       return (unsigned char *) "`";
-               case 194:       /* acute */
-                       return (unsigned char *) "'";
-               case 195:       /* circumflex */
-                       return (unsigned char *) "^";
-               case 196:       /* tilde */
-                       return (unsigned char *) "~";
-
-               /*
-                * Default & fallback cases:
-                */
-               case 162:       /* cent */
-               case 167:       /* section */
-               case 168:       /* currency */
-               case 182:       /* paragraph */
-               case 197:       /* macron */
-               case 198:       /* breve */
-               case 199:       /* dotaccent */
-               case 200:       /* dieresis */
-               case 202:       /* ring */
-               case 203:       /* cedilla */
-               case 205:       /* hungarumlaut */
-               case 206:       /* ogonek */
-               case 207:       /* caron */
-               default:
-                       return (unsigned char *) "_";
-       }
-}
diff --git a/internat/NXToLower.c b/internat/NXToLower.c
deleted file mode 100644 (file)
index 9b5939a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int
-NXToLower(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       return (NXIsUpper(c) ? ((unsigned int )(_NX_ULTable_)[c]) : c);
-}
diff --git a/internat/NXToUpper.c b/internat/NXToUpper.c
deleted file mode 100644 (file)
index 49955e5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int
-NXToUpper(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       return (NXIsLower(c) ? ((unsigned int )(_NX_ULTable_)[c]) : c);
-}
diff --git a/internat/_NXToLower.c b/internat/_NXToLower.c
deleted file mode 100644 (file)
index 70b2d08..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int
-_NXToLower(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if ((c < 256) && NXIsUpper(c))
-               return ((unsigned int )(_NX_ULTable_)[c]);
-       return c;
-}
diff --git a/internat/_NXToUpper.c b/internat/_NXToUpper.c
deleted file mode 100644 (file)
index f1f5f7a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright 1990, NeXT, Inc.
- */
-
-#include "NXCType.h"
-#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF
-
-int
-_NXToUpper(c)
-       unsigned int c;
-{
-       FIXSIGNEDCHAR(c);
-       if ((c < 256) && NXIsLower(c))
-               return ((unsigned int )(_NX_ULTable_)[c]);
-       return c;
-}
diff --git a/interposable.list b/interposable.list
deleted file mode 100644 (file)
index f9ec86a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-_malloc_printf
-__malloc_fork_prepare
-__malloc_fork_parent
-__malloc_fork_child
-_vfree
-_malloc
-_free
-_realloc
-_calloc
-_malloc_size
-_malloc_good_size
-_malloc_zone_valloc
-_valloc
-_malloc_create_zone
-_malloc_default_zone
-_malloc_destroy_zone
-_malloc_get_all_zones
-_malloc_get_zone_name
-_malloc_zone_calloc
-_malloc_zone_check
-_malloc_zone_free
-_malloc_zone_from_ptr
-_malloc_zone_log
-_malloc_zone_malloc
-_malloc_zone_memalign
-_posix_memalign
-_malloc_zone_print
-_malloc_zone_print_ptr_info
-_malloc_zone_realloc
-_malloc_zone_register
-_malloc_zone_unregister
-_malloc_zone_batch_malloc
-_malloc_zone_batch_free
index 7006e017b3e491f84cf05e4623c7befb5f8e28a0..e2b2b8357b5323134b8193989169fff7ca3573d3 100644 (file)
@@ -45,33 +45,32 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ascii.c,v 1.1 2008/01/21 23:48:12 ache E
 #include "mblocal.h"
 
 static size_t  _ascii_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _ascii_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _ascii_mbsinit(const mbstate_t *, locale_t);
 static size_t  _ascii_mbsnrtowcs(wchar_t * __restrict dst,
                    const char ** __restrict src, size_t nms, size_t len,
-                   mbstate_t * __restrict ps __unused);
+                   mbstate_t * __restrict ps __unused, locale_t);
 static size_t  _ascii_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 static size_t  _ascii_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                   size_t, size_t, mbstate_t * __restrict);
+                   size_t, size_t, mbstate_t * __restrict, locale_t);
 
-int
-_ascii_init(_RuneLocale *rl)
+__private_extern__ int
+_ascii_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _ascii_mbrtowc;
-       __mbsinit = _ascii_mbsinit;
-       __mbsnrtowcs = _ascii_mbsnrtowcs;
-       __wcrtomb = _ascii_wcrtomb;
-       __wcsnrtombs = _ascii_wcsnrtombs;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 1;
-       __mb_sb_limit = 128;
+       xrl->__mbrtowc = _ascii_mbrtowc;
+       xrl->__mbsinit = _ascii_mbsinit;
+       xrl->__mbsnrtowcs = _ascii_mbsnrtowcs;
+       xrl->__wcrtomb = _ascii_wcrtomb;
+       xrl->__wcsnrtombs = _ascii_wcsnrtombs;
+       xrl->__mb_cur_max = 1;
+       xrl->__mb_sb_limit = 128;
        return(0);
 }
 
 static int
-_ascii_mbsinit(const mbstate_t *ps __unused)
+_ascii_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused)
 {
 
        /*
@@ -83,7 +82,7 @@ _ascii_mbsinit(const mbstate_t *ps __unused)
 
 static size_t
 _ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps __unused)
+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
 
        if (s == NULL)
@@ -103,7 +102,7 @@ _ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 
 static size_t
 _ascii_wcrtomb(char * __restrict s, wchar_t wc,
-    mbstate_t * __restrict ps __unused)
+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
 
        if (s == NULL)
@@ -119,7 +118,7 @@ _ascii_wcrtomb(char * __restrict s, wchar_t wc,
 
 static size_t
 _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps __unused)
+    size_t nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
        const char *s;
        size_t nchr;
@@ -153,7 +152,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
 
 static size_t
 _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps __unused)
+    size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
        const wchar_t *s;
        size_t nchr;
diff --git a/locale/FreeBSD/ascii.c.patch b/locale/FreeBSD/ascii.c.patch
deleted file mode 100644 (file)
index aa45979..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-Index: ascii.c
-===================================================================
---- ascii.c    (revision 47445)
-+++ ascii.c    (working copy)
-@@ -45,33 +45,32 @@
- #include "mblocal.h"
- static size_t _ascii_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _ascii_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _ascii_mbsinit(const mbstate_t *, locale_t);
- static size_t _ascii_mbsnrtowcs(wchar_t * __restrict dst,
-                   const char ** __restrict src, size_t nms, size_t len,
--                  mbstate_t * __restrict ps __unused);
-+                  mbstate_t * __restrict ps __unused, locale_t);
- static size_t _ascii_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- static size_t _ascii_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
--                  size_t, size_t, mbstate_t * __restrict);
-+                  size_t, size_t, mbstate_t * __restrict, locale_t);
--int
--_ascii_init(_RuneLocale *rl)
-+__private_extern__ int
-+_ascii_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _ascii_mbrtowc;
--      __mbsinit = _ascii_mbsinit;
--      __mbsnrtowcs = _ascii_mbsnrtowcs;
--      __wcrtomb = _ascii_wcrtomb;
--      __wcsnrtombs = _ascii_wcsnrtombs;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 1;
--      __mb_sb_limit = 128;
-+      xrl->__mbrtowc = _ascii_mbrtowc;
-+      xrl->__mbsinit = _ascii_mbsinit;
-+      xrl->__mbsnrtowcs = _ascii_mbsnrtowcs;
-+      xrl->__wcrtomb = _ascii_wcrtomb;
-+      xrl->__wcsnrtombs = _ascii_wcsnrtombs;
-+      xrl->__mb_cur_max = 1;
-+      xrl->__mb_sb_limit = 128;
-       return(0);
- }
- static int
--_ascii_mbsinit(const mbstate_t *ps __unused)
-+_ascii_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused)
- {
-       /*
-@@ -83,7 +82,7 @@
- static size_t
- _ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps __unused)
-+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       if (s == NULL)
-@@ -103,7 +102,7 @@
- static size_t
- _ascii_wcrtomb(char * __restrict s, wchar_t wc,
--    mbstate_t * __restrict ps __unused)
-+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       if (s == NULL)
-@@ -119,7 +118,7 @@
- static size_t
- _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
--    size_t nms, size_t len, mbstate_t * __restrict ps __unused)
-+    size_t nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       const char *s;
-       size_t nchr;
-@@ -153,7 +152,7 @@
- static size_t
- _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
--    size_t nwc, size_t len, mbstate_t * __restrict ps __unused)
-+    size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       const wchar_t *s;
-       size_t nchr;
index ef2fd4e0d251e1b581107598e9069d407727b017..12c88ba286ca4cd8ea0b1c20fbd4d7e367d14364 100644 (file)
@@ -41,6 +41,8 @@ static char sccsid[] = "@(#)big5.c    8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <errno.h>
 #include <runetype.h>
@@ -49,33 +51,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache E
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
-
 static size_t  _BIG5_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _BIG5_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _BIG5_mbsinit(const mbstate_t *, locale_t);
 static size_t  _BIG5_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 
 typedef struct {
        wchar_t ch;
 } _BIG5State;
 
-int
-_BIG5_init(_RuneLocale *rl)
+__private_extern__ int
+_BIG5_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _BIG5_mbrtowc;
-       __wcrtomb = _BIG5_wcrtomb;
-       __mbsinit = _BIG5_mbsinit;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 2;
-       __mb_sb_limit = 128;
+       xrl->__mbrtowc = _BIG5_mbrtowc;
+       xrl->__wcrtomb = _BIG5_wcrtomb;
+       xrl->__mbsinit = _BIG5_mbsinit;
+       xrl->__mb_cur_max = 2;
+       xrl->__mb_sb_limit = 128;
        return (0);
 }
 
 static int
-_BIG5_mbsinit(const mbstate_t *ps)
+_BIG5_mbsinit(const mbstate_t *ps, locale_t loc __unused)
 {
 
        return (ps == NULL || ((const _BIG5State *)ps)->ch == 0);
@@ -91,7 +90,7 @@ _big5_check(u_int c)
 
 static size_t
 _BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps)
+    mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _BIG5State *bs;
        wchar_t wc;
@@ -151,7 +150,7 @@ _BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 }
 
 static size_t
-_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _BIG5State *bs;
 
diff --git a/locale/FreeBSD/big5.c.patch b/locale/FreeBSD/big5.c.patch
deleted file mode 100644 (file)
index 96c1988..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
---- big5.c.orig        2009-11-09 15:24:27.000000000 -0800
-+++ big5.c     2009-11-09 18:41:35.000000000 -0800
-@@ -41,6 +41,8 @@ static char sccsid[] = "@(#)big5.c   8.1 (
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <errno.h>
- #include <runetype.h>
-@@ -49,33 +51,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
--
- static size_t _BIG5_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _BIG5_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _BIG5_mbsinit(const mbstate_t *, locale_t);
- static size_t _BIG5_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- typedef struct {
-       wchar_t ch;
- } _BIG5State;
--int
--_BIG5_init(_RuneLocale *rl)
-+__private_extern__ int
-+_BIG5_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _BIG5_mbrtowc;
--      __wcrtomb = _BIG5_wcrtomb;
--      __mbsinit = _BIG5_mbsinit;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 2;
--      __mb_sb_limit = 128;
-+      xrl->__mbrtowc = _BIG5_mbrtowc;
-+      xrl->__wcrtomb = _BIG5_wcrtomb;
-+      xrl->__mbsinit = _BIG5_mbsinit;
-+      xrl->__mb_cur_max = 2;
-+      xrl->__mb_sb_limit = 128;
-       return (0);
- }
- static int
--_BIG5_mbsinit(const mbstate_t *ps)
-+_BIG5_mbsinit(const mbstate_t *ps, locale_t loc __unused)
- {
-       return (ps == NULL || ((const _BIG5State *)ps)->ch == 0);
-@@ -91,7 +90,7 @@ _big5_check(u_int c)
- static size_t
- _BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+    mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _BIG5State *bs;
-       wchar_t wc;
-@@ -151,7 +150,7 @@ _BIG5_mbrtowc(wchar_t * __restrict pwc, 
- }
- static size_t
--_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _BIG5State *bs;
index da9d1e5103b527bf6edcf3449827f635c2435cad..39447a21fdab23bf8e72af55bf914f2c069e8b23 100644 (file)
 .Os
 .Sh NAME
 .Nm btowc ,
-.Nm wctob
+.Nm btowc_l ,
+.Nm wctob ,
+.Nm wctob_l
 .Nd "convert between wide and single-byte characters"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
+.In stdio.h
 .In wchar.h
 .Ft wint_t
-.Fn btowc "int c"
+.Fo btowc
+.Fa "int c"
+.Fc
 .Ft int
-.Fn wctob "wint_t c"
+.Fo wctob
+.Fa "wint_t c"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft wint_t
+.Fo btowc_l
+.Fa "int c"
+.Fa "locale_t loc"
+.Fc
+.Ft int
+.Fo wctob_l
+.Fa "wint_t c"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn btowc
@@ -59,10 +78,29 @@ or not able to be represented as a single byte in the initial shift state,
 .Fn wctob
 returns
 .Dv WEOF .
+.Pp
+While the
+.Fn btowc
+and
+.Fn wctob
+functions use the current locale, the
+.Fn btowc_l
+and
+.Fn wctob_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
+.Sh LEGACY SYNOPSIS
+.Pp
+The include file
+.In stdio.h
+is not necessary for these functions.
 .Sh SEE ALSO
 .Xr mbrtowc 3 ,
 .Xr multibyte 3 ,
-.Xr wcrtomb 3
+.Xr wcrtomb 3 ,
+.Xr xlocale 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn btowc
diff --git a/locale/FreeBSD/btowc.3.patch b/locale/FreeBSD/btowc.3.patch
deleted file mode 100644 (file)
index 039e86e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
---- btowc.3.orig       2009-11-09 15:05:25.000000000 -0800
-+++ btowc.3    2009-11-09 15:05:25.000000000 -0800
-@@ -29,16 +29,35 @@
- .Os
- .Sh NAME
- .Nm btowc ,
--.Nm wctob
-+.Nm btowc_l ,
-+.Nm wctob ,
-+.Nm wctob_l
- .Nd "convert between wide and single-byte characters"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
-+.In stdio.h
- .In wchar.h
- .Ft wint_t
--.Fn btowc "int c"
-+.Fo btowc
-+.Fa "int c"
-+.Fc
- .Ft int
--.Fn wctob "wint_t c"
-+.Fo wctob
-+.Fa "wint_t c"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft wint_t
-+.Fo btowc_l
-+.Fa "int c"
-+.Fa "locale_t loc"
-+.Fc
-+.Ft int
-+.Fo wctob_l
-+.Fa "wint_t c"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn btowc
-@@ -59,10 +78,29 @@ or not able to be represented as a singl
- .Fn wctob
- returns
- .Dv WEOF .
-+.Pp
-+While the
-+.Fn btowc
-+and
-+.Fn wctob
-+functions use the current locale, the
-+.Fn btowc_l
-+and
-+.Fn wctob_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
-+.Sh LEGACY SYNOPSIS
-+.Pp
-+The include file
-+.In stdio.h
-+is not necessary for these functions.
- .Sh SEE ALSO
- .Xr mbrtowc 3 ,
- .Xr multibyte 3 ,
--.Xr wcrtomb 3
-+.Xr wcrtomb 3 ,
-+.Xr xlocale 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn btowc
index 44b501e28479e1462e2154c9a5a438f9cdcdcc31..38122e751b1d09cfc369fd2f8d56ce7dcd212252 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 wint_t
-btowc(int c)
+btowc_l(int c, locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs = initial;
        char cc;
        wchar_t wc;
 
+       NORMALIZE_LOCALE(loc);
        if (c == EOF)
                return (WEOF);
        /*
@@ -47,7 +50,13 @@ btowc(int c)
         * counts.
         */
        cc = (char)c;
-       if (__mbrtowc(&wc, &cc, 1, &mbs) > 1)
+       if (loc->__lc_ctype->__mbrtowc(&wc, &cc, 1, &mbs, loc) > 1)
                return (WEOF);
        return (wc);
 }
+
+wint_t
+btowc(int c)
+{
+       return btowc_l(c, __current_locale());
+}
diff --git a/locale/FreeBSD/btowc.c.patch b/locale/FreeBSD/btowc.c.patch
deleted file mode 100644 (file)
index b9a02cd..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
---- btowc.c.orig       2009-11-09 15:05:25.000000000 -0800
-+++ btowc.c    2009-11-09 15:05:25.000000000 -0800
-@@ -27,18 +27,21 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <wchar.h>
- #include "mblocal.h"
- wint_t
--btowc(int c)
-+btowc_l(int c, locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs = initial;
-       char cc;
-       wchar_t wc;
-+      NORMALIZE_LOCALE(loc);
-       if (c == EOF)
-               return (WEOF);
-       /*
-@@ -47,7 +50,13 @@ btowc(int c)
-        * counts.
-        */
-       cc = (char)c;
--      if (__mbrtowc(&wc, &cc, 1, &mbs) > 1)
-+      if (loc->__lc_ctype->__mbrtowc(&wc, &cc, 1, &mbs, loc) > 1)
-               return (WEOF);
-       return (wc);
- }
-+
-+wint_t
-+btowc(int c)
-+{
-+      return btowc_l(c, __current_locale());
-+}
index 184fac6114096c4d48ac9b4f90636bc749573026..268db3f6ff82c341b167704dbe3b350c474c49e3 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.35 2005/02/27 20:31:13 ru Exp $");
 
+#include "xlocale_private.h"
+/* assumes the locale_t variable is named loc */
+#define __collate_chain_equiv_table    (loc->__lc_collate->__chain_equiv_table)
+#define __collate_chain_pri_table      (loc->__lc_collate->__chain_pri_table)
+#define __collate_char_pri_table       (loc->__lc_collate->__char_pri_table)
+#define __collate_info                 (&loc->__lc_collate->__info)
+#define __collate_large_char_pri_table (loc->__lc_collate->__large_char_pri_table)
+#define __collate_substitute_table     (loc->__lc_collate->__substitute_table)
+
 #include "namespace.h"
 #include <arpa/inet.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
+#include <wchar.h>
 #include <errno.h>
 #include <unistd.h>
 #include <sysexits.h>
+#include <ctype.h>
 #include "un-namespace.h"
 
 #include "collate.h"
@@ -44,36 +56,50 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.35 2005/02/27 20:31:13 ru
 
 #include "libc_private.h"
 
-int __collate_load_error = 1;
-int __collate_substitute_nontrivial;
-
-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;
-
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+static void wntohl(wchar_t *, int);
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
 void __collate_err(int ex, const char *f) __dead2;
 
-int
-__collate_load_tables(const char *encoding)
+/*
+ * Normally, the __collate_* routines should all be __private_extern__,
+ * but grep is using them (3715846).  Until we can provide an alternative,
+ * we leave them public, and provide a read-only __collate_load_error variable
+ */
+#undef __collate_load_error
+int __collate_load_error = 1;
+
+__private_extern__ int
+__collate_load_tables(const char *encoding, locale_t loc)
 {
        FILE *fp;
-       int i, saverr, chains;
-       uint32_t u32;
+       int i, saverr, chains, z;
        char strbuf[STR_LEN], buf[PATH_MAX];
-       void *TMP_substitute_table, *TMP_char_pri_table, *TMP_chain_pri_table;
-       static char collate_encoding[ENCODING_LEN + 1];
+       struct __xlocale_st_collate *TMP;
+       static struct __xlocale_st_collate *cache = NULL;
+       struct __collate_st_info info;
+       void *vp;
 
        /* 'encoding' must be already checked. */
        if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
-               __collate_load_error = 1;
+               loc->__collate_load_error = 1;
+               if (loc == &__global_locale)
+                       __collate_load_error = 1;
+               XL_RELEASE(loc->__lc_collate);
+               loc->__lc_collate = NULL;
                return (_LDP_CACHE);
        }
 
        /*
         * If the locale name is the same as our cache, use the cache.
         */
-       if (strcmp(encoding, collate_encoding) == 0) {
-               __collate_load_error = 0;
+       if (cache && strcmp(encoding, cache->__encoding) == 0) {
+               loc->__collate_load_error = 0;
+               if (loc == &__global_locale)
+                       __collate_load_error = 0;
+               XL_RELEASE(loc->__lc_collate);
+               loc->__lc_collate = cache;
+               XL_RETAIN(loc->__lc_collate);
                return (_LDP_CACHE);
        }
 
@@ -97,9 +123,7 @@ __collate_load_tables(const char *encoding)
                return (_LDP_ERROR);
        }
        chains = -1;
-       if (strcmp(strbuf, COLLATE_VERSION) == 0)
-               chains = 0;
-       else if (strcmp(strbuf, COLLATE_VERSION1_2) == 0)
+       if (strcmp(strbuf, COLLATE_VERSION1_1A) == 0)
                chains = 1;
        if (chains < 0) {
                (void)fclose(fp);
@@ -107,13 +131,21 @@ __collate_load_tables(const char *encoding)
                return (_LDP_ERROR);
        }
        if (chains) {
-               if (fread(&u32, sizeof(u32), 1, fp) != 1) {
+               if (fread(&info, sizeof(info), 1, fp) != 1) {
                        saverr = errno;
                        (void)fclose(fp);
                        errno = saverr;
                        return (_LDP_ERROR);
                }
-               if ((chains = (int)ntohl(u32)) < 1) {
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+               for(z = 0; z < info.directive_count; z++) {
+                       info.undef_pri[z] = ntohl(info.undef_pri[z]);
+                       info.subst_count[z] = ntohl(info.subst_count[z]);
+               }
+               info.chain_count = ntohl(info.chain_count);
+               info.large_pri_count = ntohl(info.large_pri_count);
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
+               if ((chains = info.chain_count) < 0) {
                        (void)fclose(fp);
                        errno = EFTYPE;
                        return (_LDP_ERROR);
@@ -121,143 +153,446 @@ __collate_load_tables(const char *encoding)
        } else
                chains = TABLE_SIZE;
 
-       if ((TMP_substitute_table =
-            malloc(sizeof(__collate_substitute_table))) == NULL) {
+       i = sizeof(struct __xlocale_st_collate)
+           + sizeof(struct __collate_st_chain_pri) * chains
+           + sizeof(struct __collate_st_large_char_pri) * info.large_pri_count;
+       for(z = 0; z < info.directive_count; z++)
+               i += sizeof(struct __collate_st_subst) * info.subst_count[z];
+       if ((TMP = (struct __xlocale_st_collate *)malloc(i)) == NULL) {
                saverr = errno;
                (void)fclose(fp);
                errno = saverr;
                return (_LDP_ERROR);
        }
-       if ((TMP_char_pri_table =
-            malloc(sizeof(__collate_char_pri_table))) == NULL) {
-               saverr = errno;
-               free(TMP_substitute_table);
-               (void)fclose(fp);
-               errno = saverr;
-               return (_LDP_ERROR);
-       }
-       if ((TMP_chain_pri_table =
-            malloc(sizeof(*__collate_chain_pri_table) * chains)) == NULL) {
-               saverr = errno;
-               free(TMP_substitute_table);
-               free(TMP_char_pri_table);
-               (void)fclose(fp);
-               errno = saverr;
-               return (_LDP_ERROR);
-       }
+       TMP->__refcount = 2; /* one for the locale, one for the cache */
+       TMP->__free_extra = NULL;
 
 #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); \
+               free(TMP); \
                (void)fclose(d); \
                errno = saverr; \
                return (_LDP_ERROR); \
        } \
 }
 
-       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), chains, fp);
+       /* adjust size to read the remaining in one chunk */
+       i -= offsetof(struct __xlocale_st_collate, __char_pri_table);
+       FREAD(TMP->__char_pri_table, i, 1, fp);
        (void)fclose(fp);
 
-       (void)strcpy(collate_encoding, encoding);
-       if (__collate_substitute_table_ptr != NULL)
-               free(__collate_substitute_table_ptr);
-       __collate_substitute_table_ptr = TMP_substitute_table;
-       if (__collate_char_pri_table_ptr != NULL)
-               free(__collate_char_pri_table_ptr);
-       __collate_char_pri_table_ptr = TMP_char_pri_table;
-       for (i = 0; i < UCHAR_MAX + 1; i++) {
-               __collate_char_pri_table[i].prim =
-                   ntohl(__collate_char_pri_table[i].prim);
-               __collate_char_pri_table[i].sec =
-                   ntohl(__collate_char_pri_table[i].sec);
-       }
-       if (__collate_chain_pri_table != NULL)
-               free(__collate_chain_pri_table);
-       __collate_chain_pri_table = TMP_chain_pri_table;
-       for (i = 0; i < chains; i++) {
-               __collate_chain_pri_table[i].prim =
-                   ntohl(__collate_chain_pri_table[i].prim);
-               __collate_chain_pri_table[i].sec =
-                   ntohl(__collate_chain_pri_table[i].sec);
-       }
-       __collate_substitute_nontrivial = 0;
-       for (i = 0; i < UCHAR_MAX + 1; i++) {
-               if (__collate_substitute_table[i][0] != i ||
-                   __collate_substitute_table[i][1] != 0) {
-                       __collate_substitute_nontrivial = 1;
-                       break;
+       vp = (void *)(TMP + 1);
+
+       /* the COLLATE_SUBST_DUP optimization relies on COLL_WEIGHTS_MAX == 2 */
+       if (info.subst_count[0] > 0) {
+               TMP->__substitute_table[0] = (struct __collate_st_subst *)vp;
+               vp += info.subst_count[0] * sizeof(struct __collate_st_subst);
+       } else
+               TMP->__substitute_table[0] = NULL;
+       if (info.flags & COLLATE_SUBST_DUP)
+               TMP->__substitute_table[1] = TMP->__substitute_table[0];
+       else if (info.subst_count[1] > 0) {
+               TMP->__substitute_table[1] = (struct __collate_st_subst *)vp;
+               vp += info.subst_count[1] * sizeof(struct __collate_st_subst);
+       } else
+               TMP->__substitute_table[1] = NULL;
+
+       if (chains > 0) {
+               TMP->__chain_pri_table = (struct __collate_st_chain_pri *)vp;
+               vp += chains * sizeof(struct __collate_st_chain_pri);
+       } else
+               TMP->__chain_pri_table = NULL;
+       if (info.large_pri_count > 0)
+               TMP->__large_char_pri_table = (struct __collate_st_large_char_pri *)vp;
+       else
+               TMP->__large_char_pri_table = NULL;
+
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+       {
+               struct __collate_st_char_pri *p = TMP->__char_pri_table;
+               for(i = UCHAR_MAX + 1; i-- > 0; p++) {
+                       for(z = 0; z < info.directive_count; z++)
+                               p->pri[z] = ntohl(p->pri[z]);
+               }
+       }
+       for(z = 0; z < info.directive_count; z++)
+               if (info.subst_count[z] > 0) {
+                       struct __collate_st_subst *p = TMP->__substitute_table[z];
+                       for(i = info.subst_count[z]; i-- > 0; p++) {
+                               p->val = ntohl(p->val);
+                               wntohl(p->str, STR_LEN);
+                       }
+               }
+       {
+               struct __collate_st_chain_pri *p = TMP->__chain_pri_table;
+               for(i = chains; i-- > 0; p++) {
+                       wntohl(p->str, STR_LEN);
+                       for(z = 0; z < info.directive_count; z++)
+                               p->pri[z] = ntohl(p->pri[z]);
+               }
+       }
+       if (info.large_pri_count > 0) {
+               struct __collate_st_large_char_pri *p = TMP->__large_char_pri_table;
+               for(i = info.large_pri_count; i-- > 0; p++) {
+                       p->val = ntohl(p->val);
+                       for(z = 0; z < info.directive_count; z++)
+                               p->pri.pri[z] = ntohl(p->pri.pri[z]);
                }
        }
-       __collate_load_error = 0;
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
+       (void)strcpy(TMP->__encoding, encoding);
+       (void)memcpy(&TMP->__info, &info, sizeof(info));
+       XL_RELEASE(cache);
+       cache = TMP;
+       XL_RELEASE(loc->__lc_collate);
+       loc->__lc_collate = cache;
+       /* no need to retain, since we set __refcount to 2 above */
+       
+       loc->__collate_substitute_nontrivial = (info.subst_count[0] > 0 || info.subst_count[1] > 0);
+       loc->__collate_load_error = 0;
+       if (loc == &__global_locale)
+               __collate_load_error = 0;
 
        return (_LDP_LOADED);
 }
 
-u_char *
-__collate_substitute(const u_char *s)
+static int
+__collate_wcsnlen(const wchar_t *s, int len)
+{
+       int n = 0;
+       while (*s && n < len) {
+               s++;
+               n++;
+       }
+       return n;
+}
+
+static struct __collate_st_subst *
+substsearch(const wchar_t key, struct __collate_st_subst *tab, int n)
+{
+       int low = 0;
+       int high = n - 1;
+       int next, compar;
+       struct __collate_st_subst *p;
+
+       while (low <= high) {
+               next = (low + high) / 2;
+               p = tab + next;
+               compar = key - p->val;
+               if (compar == 0)
+                       return p;
+               if (compar > 0)
+                       low = next + 1;
+               else
+                       high = next - 1;
+       }
+       return NULL;
+}
+
+__private_extern__ wchar_t *
+__collate_substitute(const wchar_t *s, int which, locale_t loc)
 {
        int dest_len, len, nlen;
-       int delta = strlen(s);
-       u_char *dest_str = NULL;
+       int n, delta, nsubst;
+       wchar_t *dest_str = NULL;
+       const wchar_t *fp;
+       struct __collate_st_subst *subst, *match;
 
        if (s == NULL || *s == '\0')
-               return (__collate_strdup(""));
-       delta += delta / 8;
-       dest_str = malloc(dest_len = delta);
+               return (__collate_wcsdup(L""));
+       dest_len = wcslen(s);
+       nsubst = __collate_info->subst_count[which];
+       if (nsubst <= 0)
+               return __collate_wcsdup(s);
+       subst = __collate_substitute_table[which];
+       delta = dest_len / 4;
+       if (delta < 2)
+               delta = 2;
+       dest_str = (wchar_t *)malloc((dest_len += delta) * sizeof(wchar_t));
        if (dest_str == NULL)
                __collate_err(EX_OSERR, __func__);
        len = 0;
        while (*s) {
-               nlen = len + strlen(__collate_substitute_table[*s]);
+               if ((match = substsearch(*s, subst, nsubst)) != NULL) {
+                       fp = match->str;
+                       n = __collate_wcsnlen(fp, STR_LEN);
+               } else {
+                       fp = s;
+                       n = 1;
+               }
+               nlen = len + n;
                if (dest_len <= nlen) {
-                       dest_str = reallocf(dest_str, dest_len = nlen + delta);
+                       dest_str = reallocf(dest_str, (dest_len = nlen + delta) * sizeof(wchar_t));
                        if (dest_str == NULL)
                                __collate_err(EX_OSERR, __func__);
                }
-               (void)strcpy(dest_str + len, __collate_substitute_table[*s++]);
-               len = nlen;
+               wcsncpy(dest_str + len, fp, n);
+               len += n;
+               s++;
        }
+       dest_str[len] = 0;
        return (dest_str);
 }
 
-void
-__collate_lookup(const u_char *t, int *len, int *prim, int *sec)
+static struct __collate_st_chain_pri *
+chainsearch(const wchar_t *key, int *len, locale_t loc)
+{
+       int low = 0;
+       int high = __collate_info->chain_count - 1;
+       int next, compar, l;
+       struct __collate_st_chain_pri *p;
+       struct __collate_st_chain_pri *tab = __collate_chain_pri_table;
+
+       while (low <= high) {
+               next = (low + high) / 2;
+               p = tab + next;
+               compar = *key - *p->str;
+               if (compar == 0) {
+                       l = __collate_wcsnlen(p->str, STR_LEN);
+                       compar = wcsncmp(key, p->str, l);
+                       if (compar == 0) {
+                               *len = l;
+                               return p;
+                       }
+               }
+               if (compar > 0)
+                       low = next + 1;
+               else
+                       high = next - 1;
+       }
+       return NULL;
+}
+
+static struct __collate_st_large_char_pri *
+largesearch(const wchar_t key, locale_t loc)
+{
+       int low = 0;
+       int high = __collate_info->large_pri_count - 1;
+       int next, compar;
+       struct __collate_st_large_char_pri *p;
+       struct __collate_st_large_char_pri *tab = __collate_large_char_pri_table;
+
+       while (low <= high) {
+               next = (low + high) / 2;
+               p = tab + next;
+               compar = key - p->val;
+               if (compar == 0)
+                       return p;
+               if (compar > 0)
+                       low = next + 1;
+               else
+                       high = next - 1;
+       }
+       return NULL;
+}
+
+__private_extern__ void
+__collate_lookup_l(const wchar_t *t, int *len, int *prim, int *sec, locale_t loc)
 {
        struct __collate_st_chain_pri *p2;
+       int l;
 
        *len = 1;
        *prim = *sec = 0;
-       for (p2 = __collate_chain_pri_table; p2->str[0] != '\0'; p2++) {
-               if (*t == p2->str[0] &&
-                   strncmp(t, p2->str, strlen(p2->str)) == 0) {
-                       *len = strlen(p2->str);
-                       *prim = p2->prim;
-                       *sec = p2->sec;
+       p2 = chainsearch(t, &l, loc);
+       /* use the chain if prim >= 0 */
+       if (p2 && p2->pri[0] >= 0) {
+               *len = l;
+               *prim = p2->pri[0];
+               *sec = p2->pri[1];
+               return;
+       }
+       if (*t <= UCHAR_MAX) {
+               *prim = __collate_char_pri_table[*t].pri[0];
+               *sec = __collate_char_pri_table[*t].pri[1];
+               return;
+       }
+       if (__collate_info->large_pri_count > 0) {
+               struct __collate_st_large_char_pri *match;
+               match = largesearch(*t, loc);
+               if (match) {
+                       *prim = match->pri.pri[0];
+                       *sec = match->pri.pri[1];
+                       return;
+               }
+       }
+       *prim = (l = __collate_info->undef_pri[0]) >= 0 ? l : *t - l;
+       *sec = (l = __collate_info->undef_pri[1]) >= 0 ? l : *t - l;
+}
+
+/*
+ * This is only provided for programs (like grep) that are calling this
+ * private function.  This will go away eventually.
+ */
+void
+__collate_lookup(const unsigned char *t, int *len, int *prim, int *sec)
+{
+       locale_t loc = __current_locale();
+       wchar_t *w = __collate_mbstowcs((const char *)t, loc);
+       int sverrno;
+
+       __collate_lookup_l(w, len, prim, sec, loc);
+       sverrno = errno;
+       free(w);
+       errno = sverrno;
+}
+__private_extern__ void
+__collate_lookup_which(const wchar_t *t, int *len, int *pri, int which, locale_t loc)
+{
+       struct __collate_st_chain_pri *p2;
+       int p, l;
+
+       *len = 1;
+       *pri = 0;
+       p2 = chainsearch(t, &l, loc);
+       if (p2) {
+               p = p2->pri[which];
+               /* use the chain if pri >= 0 */
+               if (p >= 0) {
+                       *len = l;
+                       *pri = p;
+                       return;
+               }
+       }
+       if (*t <= UCHAR_MAX) {
+               *pri = __collate_char_pri_table[*t].pri[which];
+               return;
+       }
+       if (__collate_info->large_pri_count > 0) {
+               struct __collate_st_large_char_pri *match;
+               match = largesearch(*t, loc);
+               if (match) {
+                       *pri = match->pri.pri[which];
                        return;
                }
        }
-       *prim = __collate_char_pri_table[*t].prim;
-       *sec = __collate_char_pri_table[*t].sec;
+       *pri = (l = __collate_info->undef_pri[which]) >= 0 ? l : *t - l;
 }
 
-u_char *
-__collate_strdup(u_char *s)
+__private_extern__ wchar_t *
+__collate_mbstowcs(const char *s, locale_t loc)
 {
-       u_char *t = strdup(s);
+       static const mbstate_t initial;
+       mbstate_t st;
+       size_t len;
+       const char *ss;
+       wchar_t *wcs;
 
-       if (t == NULL)
+       ss = s;
+       st = initial;
+       if ((len = mbsrtowcs_l(NULL, &ss, 0, &st, loc)) == (size_t)-1)
+               return NULL;
+       if ((wcs = (wchar_t *)malloc((len + 1) * sizeof(wchar_t))) == NULL)
                __collate_err(EX_OSERR, __func__);
-       return (t);
+       st = initial;
+       mbsrtowcs_l(wcs, &s, len, &st, loc);
+       wcs[len] = 0;
+
+       return (wcs);
 }
 
-void
+__private_extern__ wchar_t *
+__collate_wcsdup(const wchar_t *s)
+{
+       size_t len = wcslen(s) + 1;
+       wchar_t *wcs;
+
+       if ((wcs = (wchar_t *)malloc(len * sizeof(wchar_t))) == NULL)
+               __collate_err(EX_OSERR, __func__);
+       wcscpy(wcs, s);
+       return (wcs);
+}
+
+__private_extern__ void
+__collate_xfrm(const wchar_t *src, wchar_t **xf, locale_t loc)
+{
+       int pri, len;
+       size_t slen;
+       const wchar_t *t;
+       wchar_t *tt = NULL, *tr = NULL;
+       int direc, pass;
+       wchar_t *xfp;
+       struct __collate_st_info *info = __collate_info;
+       int sverrno;
+
+       for(pass = 0; pass < COLL_WEIGHTS_MAX; pass++)
+               xf[pass] = NULL;
+       for(pass = 0; pass < info->directive_count; pass++) {
+               direc = info->directive[pass];
+               if (pass == 0 || !(info->flags & COLLATE_SUBST_DUP)) {
+                       sverrno = errno;
+                       free(tt);
+                       errno = sverrno;
+                       tt = __collate_substitute(src, pass, loc);
+               }
+               if (direc & DIRECTIVE_BACKWARD) {
+                       wchar_t *bp, *fp, c;
+                       sverrno = errno;
+                       free(tr);
+                       errno = sverrno;
+                       tr = __collate_wcsdup(tt ? tt : src);
+                       bp = tr;
+                       fp = tr + wcslen(tr) - 1;
+                       while(bp < fp) {
+                               c = *bp;
+                               *bp++ = *fp;
+                               *fp-- = c;
+                       }
+                       t = (const wchar_t *)tr;
+               } else if (tt)
+                       t = (const wchar_t *)tt;
+               else
+                       t = (const wchar_t *)src;
+               sverrno = errno;
+               if ((xf[pass] = (wchar_t *)malloc(sizeof(wchar_t) * (wcslen(t) + 1))) == NULL) {
+                       errno = sverrno;
+                       slen = 0;
+                       goto end;
+               }
+               errno = sverrno;
+               xfp = xf[pass];
+               if (direc & DIRECTIVE_POSITION) {
+                       while(*t) {
+                               __collate_lookup_which(t, &len, &pri, pass, loc);
+                               t += len;
+                               if (pri <= 0) {
+                                       if (pri < 0) {
+                                               errno = EINVAL;
+                                               slen = 0;
+                                               goto end;
+                                       }
+                                       pri = COLLATE_MAX_PRIORITY;
+                               }
+                               *xfp++ = pri;
+                       }
+               } else {
+                       while(*t) {
+                               __collate_lookup_which(t, &len, &pri, pass, loc);
+                               t += len;
+                               if (pri <= 0) {
+                                       if (pri < 0) {
+                                               errno = EINVAL;
+                                               slen = 0;
+                                               goto end;
+                                       }
+                                       continue;
+                               }
+                               *xfp++ = pri;
+                       }
+               }
+               *xfp = 0;
+       }
+  end:
+       sverrno = errno;
+       free(tt);
+       free(tr);
+       errno = sverrno;
+}
+
+__private_extern__ void
 __collate_err(int ex, const char *f)
 {
        const char *s;
@@ -275,24 +610,394 @@ __collate_err(int ex, const char *f)
        exit(ex);
 }
 
+/*
+ * __collate_collating_symbol takes the multibyte string specified by
+ * src and slen, and using ps, converts that to a wide character.  Then
+ * it is checked to verify it is a collating symbol, and then copies
+ * it to the wide character string specified by dst and dlen (the
+ * results are not null terminated).  The length of the wide characters
+ * copied to dst is returned if successful.  Zero is returned if no such
+ * collating symbol exists.  (size_t)-1 is returned if there are wide-character
+ * conversion errors, if the length of the converted string is greater that
+ * STR_LEN or if dlen is too small.  It is up to the calling routine to
+ * preserve the mbstate_t structure as needed.
+ */
+__private_extern__ size_t
+__collate_collating_symbol(wchar_t *dst, size_t dlen, const char *src, size_t slen, mbstate_t *ps, locale_t loc)
+{
+       wchar_t wname[STR_LEN];
+       wchar_t w, *wp;
+       size_t len, l;
+
+       /* POSIX locale */
+       if (loc->__collate_load_error) {
+               if (dlen < 1)
+                       return (size_t)-1;
+               if (slen != 1 || !isascii(*src))
+                       return 0;
+               *dst = *src;
+               return 1;
+       }
+       for(wp = wname, len = 0; slen > 0; len++) {
+               l = mbrtowc_l(&w, src, slen, ps, loc);
+               if (l == (size_t)-1 || l == (size_t)-2)
+                       return (size_t)-1;
+               if (l == 0)
+                       break;
+               if (len >= STR_LEN)
+                       return -1;
+               *wp++ = w;
+               src += l;
+               slen = (long)slen - (long)l;
+       }
+       if (len == 0 || len > dlen)
+               return (size_t)-1;
+       if (len == 1) {
+               if (*wname <= UCHAR_MAX) {
+                       if (__collate_char_pri_table[*wname].pri[0] >= 0) {
+                               if (dlen > 0)
+                                       *dst = *wname;
+                               return 1;
+                       }
+                       return 0;
+               } else if (__collate_info->large_pri_count > 0) {
+                       struct __collate_st_large_char_pri *match;
+                       match = largesearch(*wname, loc);
+                       if (match && match->pri.pri[0] >= 0) {
+                               if (dlen > 0)
+                                       *dst = *wname;
+                               return 1;
+                       }
+               }
+               return 0;
+       }
+       *wp = 0;
+       if (__collate_info->chain_count > 0) {
+               struct __collate_st_chain_pri *match;
+               int ll;
+               match = chainsearch(wname, &ll, loc);
+               if (match) {
+                       if (ll < dlen)
+                               dlen = ll;
+                       wcsncpy(dst, wname, dlen);
+                       return ll;
+               }
+       }
+       return 0;
+}
+
+/*
+ * __collate_equiv_class returns the equivalence class number for the symbol
+ * specified by src and slen, using ps to convert from multi-byte to wide
+ * character.  Zero is returned if the symbol is not in an equivalence
+ * class.  -1 is returned if there are wide character conversion error,
+ * if there are any greater-than-8-bit characters or if a multi-byte symbol
+ * is greater or equal to STR_LEN in length.  It is up to the calling
+ * routine to preserve the mbstate_t structure as needed.
+ */
+__private_extern__ int
+__collate_equiv_class(const char *src, size_t slen, mbstate_t *ps, locale_t loc)
+{
+       wchar_t wname[STR_LEN];
+       wchar_t w, *wp;
+       size_t len, l;
+       int e;
+
+       /* POSIX locale */
+       if (loc->__collate_load_error)
+               return 0;
+       for(wp = wname, len = 0; slen > 0; len++) {
+               l = mbrtowc_l(&w, src, slen, ps, loc);
+               if (l == (size_t)-1 || l == (size_t)-2)
+                       return -1;
+               if (l == 0)
+                       break;
+               if (len >= STR_LEN)
+                       return -1;
+               *wp++ = w;
+               src += l;
+               slen = (long)slen - (long)l;
+       }
+       if (len == 0)
+               return -1;
+       if (len == 1) {
+               e = -1;
+               if (*wname <= UCHAR_MAX)
+                       e = __collate_char_pri_table[*wname].pri[0];
+               else if (__collate_info->large_pri_count > 0) {
+                       struct __collate_st_large_char_pri *match;
+                       match = largesearch(*wname, loc);
+                       if (match)
+                               e = match->pri.pri[0];
+               }
+               if (e == 0)
+                       return IGNORE_EQUIV_CLASS;
+               return e > 0 ? e : 0;
+       }
+       *wp = 0;
+       if (__collate_info->chain_count > 0) {
+               struct __collate_st_chain_pri *match;
+               int ll;
+               match = chainsearch(wname, &ll, loc);
+               if (match) {
+                       e = match->pri[0];
+                       if (e == 0)
+                               return IGNORE_EQUIV_CLASS;
+                       return e < 0 ? -e : e;
+               }
+       }
+       return 0;
+}
+
+/*
+ * __collate_equiv_match tries to match any single or multi-character symbol
+ * in equivalence class equiv_class in the multi-byte string specified by src
+ * and slen.  If start is non-zero, it is taken to be the first (pre-converted)
+ * wide character.  Subsequence wide characters, if needed, will use ps in
+ * the conversion.  On a successful match, the length of the matched string
+ * is returned (including the start character).  If dst is non-NULL, the
+ * matched wide-character string is copied to dst, a wide character array of
+ * length dlen (the results are not zero-terminated).  If rlen is non-NULL,
+ * the number of character in src actually used is returned.  Zero is
+ * returned by __collate_equiv_match if there is no match.  (size_t)-1 is
+ * returned on error: if there were conversion errors or if dlen is too small
+ * to accept the results.  On no match or error, ps is restored to its incoming
+ * state.
+ */
+size_t
+__collate_equiv_match(int equiv_class, wchar_t *dst, size_t dlen, wchar_t start, const char *src, size_t slen, mbstate_t *ps, size_t *rlen, locale_t loc)
+{
+       wchar_t w;
+       size_t len, l, clen;
+       int i;
+       wchar_t buf[STR_LEN], *wp;
+       mbstate_t save;
+       const char *s = src;
+       size_t sl = slen;
+       struct __collate_st_chain_pri *ch = NULL;
+
+       /* POSIX locale */
+       if (loc->__collate_load_error)
+               return (size_t)-1;
+       if (equiv_class == IGNORE_EQUIV_CLASS)
+               equiv_class = 0;
+       if (ps)
+               save = *ps;
+       wp = buf;
+       len = clen = 0;
+       if (start) {
+               *wp++ = start;
+               len = 1;
+       }
+       /* convert up to the max chain length */
+       while(sl > 0 && len < __collate_info->chain_max_len) {
+               l = mbrtowc_l(&w, s, sl, ps, loc);
+               if (l == (size_t)-1 || l == (size_t)-2 || l == 0)
+                       break;
+               *wp++ = w;
+               s += l;
+               clen += l;
+               sl -= l;
+               len++;
+       }
+       *wp = 0;
+       if (len > 1 && (ch = chainsearch(buf, &i, loc)) != NULL) {
+               int e = ch->pri[0];
+               if (e < 0)
+                       e = -e;
+               if (e == equiv_class)
+                       goto found;
+       }
+       /* try single character */
+       i = 1;
+       if (*buf <= UCHAR_MAX) {
+               if (equiv_class == __collate_char_pri_table[*buf].pri[0])
+                       goto found;
+       } else if (__collate_info->large_pri_count > 0) {
+               struct __collate_st_large_char_pri *match;
+               match = largesearch(*buf, loc);
+               if (match && equiv_class == match->pri.pri[0])
+                       goto found;
+       }
+       /* no match */
+       if (ps)
+               *ps = save;
+       return 0;
+found:
+       /* if we converted more than we used, restore to initial and reconvert
+        * up to what did match */
+       if (i < len) {
+               len = i;
+               if (ps)
+                       *ps = save;
+               if (start)
+                       i--;
+               clen = 0;
+               while(i-- > 0) {
+                       l = mbrtowc_l(&w, src, slen, ps, loc);
+                       src += l;
+                       clen += l;
+                       slen -= l;
+               }
+       }
+       if (dst) {
+               if (dlen < len) {
+                       if (ps)
+                               *ps = save;
+                       return (size_t)-1;
+               }
+               for(wp = buf; len > 0; len--)
+                   *dst++ = *wp++;
+       }
+       if (rlen)
+               *rlen = clen;
+       return len;
+}
+
+/*
+ * __collate_equiv_value returns the primary collation value for the given
+ * collating symbol specified by str and len.  Zero or negative is return
+ * if the collating symbol was not found.  (Use by the bracket code in TRE.)
+ */
+__private_extern__ int
+__collate_equiv_value(locale_t loc, const wchar_t *str, size_t len)
+{
+       int e;
+
+       if (len < 1 || len >= STR_LEN)
+               return -1;
+
+       /* POSIX locale */
+       if (loc->__collate_load_error)
+               return (len == 1 && *str <= UCHAR_MAX) ? *str : -1;
+
+       if (len == 1) {
+               e = -1;
+               if (*str <= UCHAR_MAX)
+                       e = __collate_char_pri_table[*str].pri[0];
+               else if (__collate_info->large_pri_count > 0) {
+                       struct __collate_st_large_char_pri *match;
+                       match = largesearch(*str, loc);
+                       if (match)
+                               e = match->pri.pri[0];
+               }
+               if (e == 0)
+                       return IGNORE_EQUIV_CLASS;
+               return e > 0 ? e : 0;
+       }
+       if (__collate_info->chain_count > 0) {
+               wchar_t name[STR_LEN];
+               struct __collate_st_chain_pri *match;
+               int ll;
+
+               wcsncpy(name, str, len);
+               name[len] = 0;
+               match = chainsearch(name, &ll, loc);
+               if (match) {
+                       e = match->pri[0];
+                       if (e == 0)
+                               return IGNORE_EQUIV_CLASS;
+                       return e < 0 ? -e : e;
+               }
+       }
+       return 0;
+}
+
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+static void
+wntohl(wchar_t *str, int len)
+{
+       for(; *str && len > 0; str++, len--)
+               *str = ntohl(*str);
+}
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
+
 #ifdef COLLATE_DEBUG
+static char *
+show(int c)
+{
+       static char buf[5];
+
+       if (c >=32 && c <= 126)
+               sprintf(buf, "'%c' ", c);
+       else
+               sprintf(buf, "\\x{%02x}", c);
+       return buf;
+}
+
+static char *
+showwcs(const wchar_t *t, int len)
+{
+       static char buf[64];
+       char *cp = buf;
+
+       for(; *t && len > 0; len--, t++) {
+               if (*t >=32 && *t <= 126)
+                       *cp++ = *t;
+               else {
+                       sprintf(cp, "\\x{%02x}", *t);
+                       cp += strlen(cp);
+               }
+       }
+       *cp = 0;
+       return buf;
+}
+
 void
 __collate_print_tables()
 {
-       int i;
-       struct __collate_st_chain_pri *p2;
+       int i, z;
+       locale_t loc = __current_locale();
 
-       printf("Substitute table:\n");
-       for (i = 0; i < UCHAR_MAX + 1; i++)
-           if (i != *__collate_substitute_table[i])
-               printf("\t'%c' --> \"%s\"\n", i,
-                      __collate_substitute_table[i]);
-       printf("Chain priority table:\n");
-       for (p2 = __collate_chain_pri_table; p2->str[0] != '\0'; p2++)
-               printf("\t\"%s\" : %d %d\n", p2->str, p2->prim, p2->sec);
+       printf("Info: p=%d s=%d f=0x%02x m=%d dc=%d up=%d us=%d pc=%d sc=%d cc=%d lc=%d\n",
+           __collate_info->directive[0], __collate_info->directive[1],
+           __collate_info->flags, __collate_info->chain_max_len,
+           __collate_info->directive_count,
+           __collate_info->undef_pri[0], __collate_info->undef_pri[1],
+           __collate_info->subst_count[0], __collate_info->subst_count[1],
+           __collate_info->chain_count, __collate_info->large_pri_count);
+       for(z = 0; z < __collate_info->directive_count; z++) {
+               if (__collate_info->subst_count[z] > 0) {
+                       struct __collate_st_subst *p2 = __collate_substitute_table[z];
+                       if (z == 0 && (__collate_info->flags & COLLATE_SUBST_DUP))
+                               printf("Both substitute tables:\n");
+                       else
+                               printf("Substitute table %d:\n", z);
+                       for (i = __collate_info->subst_count[z]; i-- > 0; p2++)
+                               printf("\t%s --> \"%s\"\n",
+                                       show(p2->val),
+                                       showwcs(p2->str, STR_LEN));
+               }
+       }
+       if (__collate_info->chain_count > 0) {
+               printf("Chain priority table:\n");
+               struct __collate_st_chain_pri *p2 = __collate_chain_pri_table;
+               for (i = __collate_info->chain_count; i-- > 0; p2++) {
+                       printf("\t\"%s\" :", showwcs(p2->str, STR_LEN));
+                       for(z = 0; z < __collate_info->directive_count; z++)
+                               printf(" %d", p2->pri[z]);
+                       putchar('\n');
+               }
+       }
        printf("Char priority table:\n");
-       for (i = 0; i < UCHAR_MAX + 1; i++)
-               printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
-                      __collate_char_pri_table[i].sec);
+       {
+               struct __collate_st_char_pri *p2 = __collate_char_pri_table;
+               for (i = 0; i < UCHAR_MAX + 1; i++, p2++) {
+                       printf("\t%s :", show(i));
+                       for(z = 0; z < __collate_info->directive_count; z++)
+                               printf(" %d", p2->pri[z]);
+                       putchar('\n');
+               }
+       }
+       if (__collate_info->large_pri_count > 0) {
+               struct __collate_st_large_char_pri *p2 = __collate_large_char_pri_table;
+               printf("Large priority table:\n");
+               for (i = __collate_info->large_pri_count; i-- > 0; p2++) {
+                       printf("\t%s :", show(p2->val));
+                       for(z = 0; z < __collate_info->directive_count; z++)
+                               printf(" %d", p2->pri.pri[z]);
+                       putchar('\n');
+               }
+       }
 }
 #endif
diff --git a/locale/FreeBSD/collate.c.patch b/locale/FreeBSD/collate.c.patch
deleted file mode 100644 (file)
index 8a08e16..0000000
+++ /dev/null
@@ -1,1019 +0,0 @@
---- collate.c.bsdnew   2009-11-09 15:05:25.000000000 -0800
-+++ collate.c  2009-11-09 15:20:20.000000000 -0800
-@@ -28,14 +28,26 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.35 2005/02/27 20:31:13 ru Exp $");
-+#include "xlocale_private.h"
-+/* assumes the locale_t variable is named loc */
-+#define __collate_chain_equiv_table   (loc->__lc_collate->__chain_equiv_table)
-+#define __collate_chain_pri_table     (loc->__lc_collate->__chain_pri_table)
-+#define __collate_char_pri_table      (loc->__lc_collate->__char_pri_table)
-+#define __collate_info                        (&loc->__lc_collate->__info)
-+#define __collate_large_char_pri_table        (loc->__lc_collate->__large_char_pri_table)
-+#define __collate_substitute_table    (loc->__lc_collate->__substitute_table)
-+
- #include "namespace.h"
- #include <arpa/inet.h>
- #include <stdio.h>
- #include <stdlib.h>
-+#include <stddef.h>
- #include <string.h>
-+#include <wchar.h>
- #include <errno.h>
- #include <unistd.h>
- #include <sysexits.h>
-+#include <ctype.h>
- #include "un-namespace.h"
- #include "collate.h"
-@@ -44,36 +56,50 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "libc_private.h"
--int __collate_load_error = 1;
--int __collate_substitute_nontrivial;
--
--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;
--
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-+static void wntohl(wchar_t *, int);
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
- void __collate_err(int ex, const char *f) __dead2;
--int
--__collate_load_tables(const char *encoding)
-+/*
-+ * Normally, the __collate_* routines should all be __private_extern__,
-+ * but grep is using them (3715846).  Until we can provide an alternative,
-+ * we leave them public, and provide a read-only __collate_load_error variable
-+ */
-+#undef __collate_load_error
-+int __collate_load_error = 1;
-+
-+__private_extern__ int
-+__collate_load_tables(const char *encoding, locale_t loc)
- {
-       FILE *fp;
--      int i, saverr, chains;
--      uint32_t u32;
-+      int i, saverr, chains, z;
-       char strbuf[STR_LEN], buf[PATH_MAX];
--      void *TMP_substitute_table, *TMP_char_pri_table, *TMP_chain_pri_table;
--      static char collate_encoding[ENCODING_LEN + 1];
-+      struct __xlocale_st_collate *TMP;
-+      static struct __xlocale_st_collate *cache = NULL;
-+      struct __collate_st_info info;
-+      void *vp;
-       /* 'encoding' must be already checked. */
-       if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
--              __collate_load_error = 1;
-+              loc->__collate_load_error = 1;
-+              if (loc == &__global_locale)
-+                      __collate_load_error = 1;
-+              XL_RELEASE(loc->__lc_collate);
-+              loc->__lc_collate = NULL;
-               return (_LDP_CACHE);
-       }
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
--      if (strcmp(encoding, collate_encoding) == 0) {
--              __collate_load_error = 0;
-+      if (cache && strcmp(encoding, cache->__encoding) == 0) {
-+              loc->__collate_load_error = 0;
-+              if (loc == &__global_locale)
-+                      __collate_load_error = 0;
-+              XL_RELEASE(loc->__lc_collate);
-+              loc->__lc_collate = cache;
-+              XL_RETAIN(loc->__lc_collate);
-               return (_LDP_CACHE);
-       }
-@@ -97,9 +123,7 @@ __collate_load_tables(const char *encodi
-               return (_LDP_ERROR);
-       }
-       chains = -1;
--      if (strcmp(strbuf, COLLATE_VERSION) == 0)
--              chains = 0;
--      else if (strcmp(strbuf, COLLATE_VERSION1_2) == 0)
-+      if (strcmp(strbuf, COLLATE_VERSION1_1A) == 0)
-               chains = 1;
-       if (chains < 0) {
-               (void)fclose(fp);
-@@ -107,13 +131,21 @@ __collate_load_tables(const char *encodi
-               return (_LDP_ERROR);
-       }
-       if (chains) {
--              if (fread(&u32, sizeof(u32), 1, fp) != 1) {
-+              if (fread(&info, sizeof(info), 1, fp) != 1) {
-                       saverr = errno;
-                       (void)fclose(fp);
-                       errno = saverr;
-                       return (_LDP_ERROR);
-               }
--              if ((chains = (int)ntohl(u32)) < 1) {
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-+              for(z = 0; z < info.directive_count; z++) {
-+                      info.undef_pri[z] = ntohl(info.undef_pri[z]);
-+                      info.subst_count[z] = ntohl(info.subst_count[z]);
-+              }
-+              info.chain_count = ntohl(info.chain_count);
-+              info.large_pri_count = ntohl(info.large_pri_count);
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-+              if ((chains = info.chain_count) < 0) {
-                       (void)fclose(fp);
-                       errno = EFTYPE;
-                       return (_LDP_ERROR);
-@@ -121,143 +153,446 @@ __collate_load_tables(const char *encodi
-       } else
-               chains = TABLE_SIZE;
--      if ((TMP_substitute_table =
--           malloc(sizeof(__collate_substitute_table))) == NULL) {
-+      i = sizeof(struct __xlocale_st_collate)
-+          + sizeof(struct __collate_st_chain_pri) * chains
-+          + sizeof(struct __collate_st_large_char_pri) * info.large_pri_count;
-+      for(z = 0; z < info.directive_count; z++)
-+              i += sizeof(struct __collate_st_subst) * info.subst_count[z];
-+      if ((TMP = (struct __xlocale_st_collate *)malloc(i)) == NULL) {
-               saverr = errno;
-               (void)fclose(fp);
-               errno = saverr;
-               return (_LDP_ERROR);
-       }
--      if ((TMP_char_pri_table =
--           malloc(sizeof(__collate_char_pri_table))) == NULL) {
--              saverr = errno;
--              free(TMP_substitute_table);
--              (void)fclose(fp);
--              errno = saverr;
--              return (_LDP_ERROR);
--      }
--      if ((TMP_chain_pri_table =
--           malloc(sizeof(*__collate_chain_pri_table) * chains)) == NULL) {
--              saverr = errno;
--              free(TMP_substitute_table);
--              free(TMP_char_pri_table);
--              (void)fclose(fp);
--              errno = saverr;
--              return (_LDP_ERROR);
--      }
-+      TMP->__refcount = 2; /* one for the locale, one for the cache */
-+      TMP->__free_extra = NULL;
- #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); \
-+              free(TMP); \
-               (void)fclose(d); \
-               errno = saverr; \
-               return (_LDP_ERROR); \
-       } \
- }
--      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), chains, fp);
-+      /* adjust size to read the remaining in one chunk */
-+      i -= offsetof(struct __xlocale_st_collate, __char_pri_table);
-+      FREAD(TMP->__char_pri_table, i, 1, fp);
-       (void)fclose(fp);
--      (void)strcpy(collate_encoding, encoding);
--      if (__collate_substitute_table_ptr != NULL)
--              free(__collate_substitute_table_ptr);
--      __collate_substitute_table_ptr = TMP_substitute_table;
--      if (__collate_char_pri_table_ptr != NULL)
--              free(__collate_char_pri_table_ptr);
--      __collate_char_pri_table_ptr = TMP_char_pri_table;
--      for (i = 0; i < UCHAR_MAX + 1; i++) {
--              __collate_char_pri_table[i].prim =
--                  ntohl(__collate_char_pri_table[i].prim);
--              __collate_char_pri_table[i].sec =
--                  ntohl(__collate_char_pri_table[i].sec);
--      }
--      if (__collate_chain_pri_table != NULL)
--              free(__collate_chain_pri_table);
--      __collate_chain_pri_table = TMP_chain_pri_table;
--      for (i = 0; i < chains; i++) {
--              __collate_chain_pri_table[i].prim =
--                  ntohl(__collate_chain_pri_table[i].prim);
--              __collate_chain_pri_table[i].sec =
--                  ntohl(__collate_chain_pri_table[i].sec);
--      }
--      __collate_substitute_nontrivial = 0;
--      for (i = 0; i < UCHAR_MAX + 1; i++) {
--              if (__collate_substitute_table[i][0] != i ||
--                  __collate_substitute_table[i][1] != 0) {
--                      __collate_substitute_nontrivial = 1;
--                      break;
-+      vp = (void *)(TMP + 1);
-+
-+      /* the COLLATE_SUBST_DUP optimization relies on COLL_WEIGHTS_MAX == 2 */
-+      if (info.subst_count[0] > 0) {
-+              TMP->__substitute_table[0] = (struct __collate_st_subst *)vp;
-+              vp += info.subst_count[0] * sizeof(struct __collate_st_subst);
-+      } else
-+              TMP->__substitute_table[0] = NULL;
-+      if (info.flags & COLLATE_SUBST_DUP)
-+              TMP->__substitute_table[1] = TMP->__substitute_table[0];
-+      else if (info.subst_count[1] > 0) {
-+              TMP->__substitute_table[1] = (struct __collate_st_subst *)vp;
-+              vp += info.subst_count[1] * sizeof(struct __collate_st_subst);
-+      } else
-+              TMP->__substitute_table[1] = NULL;
-+
-+      if (chains > 0) {
-+              TMP->__chain_pri_table = (struct __collate_st_chain_pri *)vp;
-+              vp += chains * sizeof(struct __collate_st_chain_pri);
-+      } else
-+              TMP->__chain_pri_table = NULL;
-+      if (info.large_pri_count > 0)
-+              TMP->__large_char_pri_table = (struct __collate_st_large_char_pri *)vp;
-+      else
-+              TMP->__large_char_pri_table = NULL;
-+
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-+      {
-+              struct __collate_st_char_pri *p = TMP->__char_pri_table;
-+              for(i = UCHAR_MAX + 1; i-- > 0; p++) {
-+                      for(z = 0; z < info.directive_count; z++)
-+                              p->pri[z] = ntohl(p->pri[z]);
-               }
-       }
--      __collate_load_error = 0;
-+      for(z = 0; z < info.directive_count; z++)
-+              if (info.subst_count[z] > 0) {
-+                      struct __collate_st_subst *p = TMP->__substitute_table[z];
-+                      for(i = info.subst_count[z]; i-- > 0; p++) {
-+                              p->val = ntohl(p->val);
-+                              wntohl(p->str, STR_LEN);
-+                      }
-+              }
-+      {
-+              struct __collate_st_chain_pri *p = TMP->__chain_pri_table;
-+              for(i = chains; i-- > 0; p++) {
-+                      wntohl(p->str, STR_LEN);
-+                      for(z = 0; z < info.directive_count; z++)
-+                              p->pri[z] = ntohl(p->pri[z]);
-+              }
-+      }
-+      if (info.large_pri_count > 0) {
-+              struct __collate_st_large_char_pri *p = TMP->__large_char_pri_table;
-+              for(i = info.large_pri_count; i-- > 0; p++) {
-+                      p->val = ntohl(p->val);
-+                      for(z = 0; z < info.directive_count; z++)
-+                              p->pri.pri[z] = ntohl(p->pri.pri[z]);
-+              }
-+      }
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-+      (void)strcpy(TMP->__encoding, encoding);
-+      (void)memcpy(&TMP->__info, &info, sizeof(info));
-+      XL_RELEASE(cache);
-+      cache = TMP;
-+      XL_RELEASE(loc->__lc_collate);
-+      loc->__lc_collate = cache;
-+      /* no need to retain, since we set __refcount to 2 above */
-+      
-+      loc->__collate_substitute_nontrivial = (info.subst_count[0] > 0 || info.subst_count[1] > 0);
-+      loc->__collate_load_error = 0;
-+      if (loc == &__global_locale)
-+              __collate_load_error = 0;
-       return (_LDP_LOADED);
- }
--u_char *
--__collate_substitute(const u_char *s)
-+static int
-+__collate_wcsnlen(const wchar_t *s, int len)
-+{
-+      int n = 0;
-+      while (*s && n < len) {
-+              s++;
-+              n++;
-+      }
-+      return n;
-+}
-+
-+static struct __collate_st_subst *
-+substsearch(const wchar_t key, struct __collate_st_subst *tab, int n)
-+{
-+      int low = 0;
-+      int high = n - 1;
-+      int next, compar;
-+      struct __collate_st_subst *p;
-+
-+      while (low <= high) {
-+              next = (low + high) / 2;
-+              p = tab + next;
-+              compar = key - p->val;
-+              if (compar == 0)
-+                      return p;
-+              if (compar > 0)
-+                      low = next + 1;
-+              else
-+                      high = next - 1;
-+      }
-+      return NULL;
-+}
-+
-+__private_extern__ wchar_t *
-+__collate_substitute(const wchar_t *s, int which, locale_t loc)
- {
-       int dest_len, len, nlen;
--      int delta = strlen(s);
--      u_char *dest_str = NULL;
-+      int n, delta, nsubst;
-+      wchar_t *dest_str = NULL;
-+      const wchar_t *fp;
-+      struct __collate_st_subst *subst, *match;
-       if (s == NULL || *s == '\0')
--              return (__collate_strdup(""));
--      delta += delta / 8;
--      dest_str = malloc(dest_len = delta);
-+              return (__collate_wcsdup(L""));
-+      dest_len = wcslen(s);
-+      nsubst = __collate_info->subst_count[which];
-+      if (nsubst <= 0)
-+              return __collate_wcsdup(s);
-+      subst = __collate_substitute_table[which];
-+      delta = dest_len / 4;
-+      if (delta < 2)
-+              delta = 2;
-+      dest_str = (wchar_t *)malloc((dest_len += delta) * sizeof(wchar_t));
-       if (dest_str == NULL)
-               __collate_err(EX_OSERR, __func__);
-       len = 0;
-       while (*s) {
--              nlen = len + strlen(__collate_substitute_table[*s]);
-+              if ((match = substsearch(*s, subst, nsubst)) != NULL) {
-+                      fp = match->str;
-+                      n = __collate_wcsnlen(fp, STR_LEN);
-+              } else {
-+                      fp = s;
-+                      n = 1;
-+              }
-+              nlen = len + n;
-               if (dest_len <= nlen) {
--                      dest_str = reallocf(dest_str, dest_len = nlen + delta);
-+                      dest_str = reallocf(dest_str, (dest_len = nlen + delta) * sizeof(wchar_t));
-                       if (dest_str == NULL)
-                               __collate_err(EX_OSERR, __func__);
-               }
--              (void)strcpy(dest_str + len, __collate_substitute_table[*s++]);
--              len = nlen;
-+              wcsncpy(dest_str + len, fp, n);
-+              len += n;
-+              s++;
-       }
-+      dest_str[len] = 0;
-       return (dest_str);
- }
--void
--__collate_lookup(const u_char *t, int *len, int *prim, int *sec)
-+static struct __collate_st_chain_pri *
-+chainsearch(const wchar_t *key, int *len, locale_t loc)
-+{
-+      int low = 0;
-+      int high = __collate_info->chain_count - 1;
-+      int next, compar, l;
-+      struct __collate_st_chain_pri *p;
-+      struct __collate_st_chain_pri *tab = __collate_chain_pri_table;
-+
-+      while (low <= high) {
-+              next = (low + high) / 2;
-+              p = tab + next;
-+              compar = *key - *p->str;
-+              if (compar == 0) {
-+                      l = __collate_wcsnlen(p->str, STR_LEN);
-+                      compar = wcsncmp(key, p->str, l);
-+                      if (compar == 0) {
-+                              *len = l;
-+                              return p;
-+                      }
-+              }
-+              if (compar > 0)
-+                      low = next + 1;
-+              else
-+                      high = next - 1;
-+      }
-+      return NULL;
-+}
-+
-+static struct __collate_st_large_char_pri *
-+largesearch(const wchar_t key, locale_t loc)
-+{
-+      int low = 0;
-+      int high = __collate_info->large_pri_count - 1;
-+      int next, compar;
-+      struct __collate_st_large_char_pri *p;
-+      struct __collate_st_large_char_pri *tab = __collate_large_char_pri_table;
-+
-+      while (low <= high) {
-+              next = (low + high) / 2;
-+              p = tab + next;
-+              compar = key - p->val;
-+              if (compar == 0)
-+                      return p;
-+              if (compar > 0)
-+                      low = next + 1;
-+              else
-+                      high = next - 1;
-+      }
-+      return NULL;
-+}
-+
-+__private_extern__ void
-+__collate_lookup_l(const wchar_t *t, int *len, int *prim, int *sec, locale_t loc)
- {
-       struct __collate_st_chain_pri *p2;
-+      int l;
-       *len = 1;
-       *prim = *sec = 0;
--      for (p2 = __collate_chain_pri_table; p2->str[0] != '\0'; p2++) {
--              if (*t == p2->str[0] &&
--                  strncmp(t, p2->str, strlen(p2->str)) == 0) {
--                      *len = strlen(p2->str);
--                      *prim = p2->prim;
--                      *sec = p2->sec;
-+      p2 = chainsearch(t, &l, loc);
-+      /* use the chain if prim >= 0 */
-+      if (p2 && p2->pri[0] >= 0) {
-+              *len = l;
-+              *prim = p2->pri[0];
-+              *sec = p2->pri[1];
-+              return;
-+      }
-+      if (*t <= UCHAR_MAX) {
-+              *prim = __collate_char_pri_table[*t].pri[0];
-+              *sec = __collate_char_pri_table[*t].pri[1];
-+              return;
-+      }
-+      if (__collate_info->large_pri_count > 0) {
-+              struct __collate_st_large_char_pri *match;
-+              match = largesearch(*t, loc);
-+              if (match) {
-+                      *prim = match->pri.pri[0];
-+                      *sec = match->pri.pri[1];
-+                      return;
-+              }
-+      }
-+      *prim = (l = __collate_info->undef_pri[0]) >= 0 ? l : *t - l;
-+      *sec = (l = __collate_info->undef_pri[1]) >= 0 ? l : *t - l;
-+}
-+
-+/*
-+ * This is only provided for programs (like grep) that are calling this
-+ * private function.  This will go away eventually.
-+ */
-+void
-+__collate_lookup(const unsigned char *t, int *len, int *prim, int *sec)
-+{
-+      locale_t loc = __current_locale();
-+      wchar_t *w = __collate_mbstowcs((const char *)t, loc);
-+      int sverrno;
-+
-+      __collate_lookup_l(w, len, prim, sec, loc);
-+      sverrno = errno;
-+      free(w);
-+      errno = sverrno;
-+}
-+ 
-+__private_extern__ void
-+__collate_lookup_which(const wchar_t *t, int *len, int *pri, int which, locale_t loc)
-+{
-+      struct __collate_st_chain_pri *p2;
-+      int p, l;
-+
-+      *len = 1;
-+      *pri = 0;
-+      p2 = chainsearch(t, &l, loc);
-+      if (p2) {
-+              p = p2->pri[which];
-+              /* use the chain if pri >= 0 */
-+              if (p >= 0) {
-+                      *len = l;
-+                      *pri = p;
-                       return;
-               }
-       }
--      *prim = __collate_char_pri_table[*t].prim;
--      *sec = __collate_char_pri_table[*t].sec;
-+      if (*t <= UCHAR_MAX) {
-+              *pri = __collate_char_pri_table[*t].pri[which];
-+              return;
-+      }
-+      if (__collate_info->large_pri_count > 0) {
-+              struct __collate_st_large_char_pri *match;
-+              match = largesearch(*t, loc);
-+              if (match) {
-+                      *pri = match->pri.pri[which];
-+                      return;
-+              }
-+      }
-+      *pri = (l = __collate_info->undef_pri[which]) >= 0 ? l : *t - l;
-+}
-+
-+__private_extern__ wchar_t *
-+__collate_mbstowcs(const char *s, locale_t loc)
-+{
-+      static const mbstate_t initial;
-+      mbstate_t st;
-+      size_t len;
-+      const char *ss;
-+      wchar_t *wcs;
-+
-+      ss = s;
-+      st = initial;
-+      if ((len = mbsrtowcs_l(NULL, &ss, 0, &st, loc)) == (size_t)-1)
-+              return NULL;
-+      if ((wcs = (wchar_t *)malloc((len + 1) * sizeof(wchar_t))) == NULL)
-+              __collate_err(EX_OSERR, __func__);
-+      st = initial;
-+      mbsrtowcs_l(wcs, &s, len, &st, loc);
-+      wcs[len] = 0;
-+
-+      return (wcs);
- }
--u_char *
--__collate_strdup(u_char *s)
-+__private_extern__ wchar_t *
-+__collate_wcsdup(const wchar_t *s)
- {
--      u_char *t = strdup(s);
-+      size_t len = wcslen(s) + 1;
-+      wchar_t *wcs;
--      if (t == NULL)
-+      if ((wcs = (wchar_t *)malloc(len * sizeof(wchar_t))) == NULL)
-               __collate_err(EX_OSERR, __func__);
--      return (t);
-+      wcscpy(wcs, s);
-+      return (wcs);
- }
--void
-+__private_extern__ void
-+__collate_xfrm(const wchar_t *src, wchar_t **xf, locale_t loc)
-+{
-+      int pri, len;
-+      size_t slen;
-+      const wchar_t *t;
-+      wchar_t *tt = NULL, *tr = NULL;
-+      int direc, pass;
-+      wchar_t *xfp;
-+      struct __collate_st_info *info = __collate_info;
-+      int sverrno;
-+
-+      for(pass = 0; pass < COLL_WEIGHTS_MAX; pass++)
-+              xf[pass] = NULL;
-+      for(pass = 0; pass < info->directive_count; pass++) {
-+              direc = info->directive[pass];
-+              if (pass == 0 || !(info->flags & COLLATE_SUBST_DUP)) {
-+                      sverrno = errno;
-+                      free(tt);
-+                      errno = sverrno;
-+                      tt = __collate_substitute(src, pass, loc);
-+              }
-+              if (direc & DIRECTIVE_BACKWARD) {
-+                      wchar_t *bp, *fp, c;
-+                      sverrno = errno;
-+                      free(tr);
-+                      errno = sverrno;
-+                      tr = __collate_wcsdup(tt ? tt : src);
-+                      bp = tr;
-+                      fp = tr + wcslen(tr) - 1;
-+                      while(bp < fp) {
-+                              c = *bp;
-+                              *bp++ = *fp;
-+                              *fp-- = c;
-+                      }
-+                      t = (const wchar_t *)tr;
-+              } else if (tt)
-+                      t = (const wchar_t *)tt;
-+              else
-+                      t = (const wchar_t *)src;
-+              sverrno = errno;
-+              if ((xf[pass] = (wchar_t *)malloc(sizeof(wchar_t) * (wcslen(t) + 1))) == NULL) {
-+                      errno = sverrno;
-+                      slen = 0;
-+                      goto end;
-+              }
-+              errno = sverrno;
-+              xfp = xf[pass];
-+              if (direc & DIRECTIVE_POSITION) {
-+                      while(*t) {
-+                              __collate_lookup_which(t, &len, &pri, pass, loc);
-+                              t += len;
-+                              if (pri <= 0) {
-+                                      if (pri < 0) {
-+                                              errno = EINVAL;
-+                                              slen = 0;
-+                                              goto end;
-+                                      }
-+                                      pri = COLLATE_MAX_PRIORITY;
-+                              }
-+                              *xfp++ = pri;
-+                      }
-+              } else {
-+                      while(*t) {
-+                              __collate_lookup_which(t, &len, &pri, pass, loc);
-+                              t += len;
-+                              if (pri <= 0) {
-+                                      if (pri < 0) {
-+                                              errno = EINVAL;
-+                                              slen = 0;
-+                                              goto end;
-+                                      }
-+                                      continue;
-+                              }
-+                              *xfp++ = pri;
-+                      }
-+              }
-+              *xfp = 0;
-+      }
-+  end:
-+      sverrno = errno;
-+      free(tt);
-+      free(tr);
-+      errno = sverrno;
-+}
-+
-+__private_extern__ void
- __collate_err(int ex, const char *f)
- {
-       const char *s;
-@@ -275,24 +610,345 @@ __collate_err(int ex, const char *f)
-       exit(ex);
- }
-+/*
-+ * __collate_collating_symbol takes the multibyte string specified by
-+ * src and slen, and using ps, converts that to a wide character.  Then
-+ * it is checked to verify it is a collating symbol, and then copies
-+ * it to the wide character string specified by dst and dlen (the
-+ * results are not null terminated).  The length of the wide characters
-+ * copied to dst is returned if successful.  Zero is returned if no such
-+ * collating symbol exists.  (size_t)-1 is returned if there are wide-character
-+ * conversion errors, if the length of the converted string is greater that
-+ * STR_LEN or if dlen is too small.  It is up to the calling routine to
-+ * preserve the mbstate_t structure as needed.
-+ */
-+__private_extern__ size_t
-+__collate_collating_symbol(wchar_t *dst, size_t dlen, const char *src, size_t slen, mbstate_t *ps, locale_t loc)
-+{
-+      wchar_t wname[STR_LEN];
-+      wchar_t w, *wp;
-+      size_t len, l;
-+
-+      /* POSIX locale */
-+      if (loc->__collate_load_error) {
-+              if (dlen < 1)
-+                      return (size_t)-1;
-+              if (slen != 1 || !isascii(*src))
-+                      return 0;
-+              *dst = *src;
-+              return 1;
-+      }
-+      for(wp = wname, len = 0; slen > 0; len++) {
-+              l = mbrtowc_l(&w, src, slen, ps, loc);
-+              if (l == (size_t)-1 || l == (size_t)-2)
-+                      return (size_t)-1;
-+              if (l == 0)
-+                      break;
-+              if (len >= STR_LEN)
-+                      return -1;
-+              *wp++ = w;
-+              src += l;
-+              slen = (long)slen - (long)l;
-+      }
-+      if (len == 0 || len > dlen)
-+              return (size_t)-1;
-+      if (len == 1) {
-+              if (*wname <= UCHAR_MAX) {
-+                      if (__collate_char_pri_table[*wname].pri[0] >= 0) {
-+                              if (dlen > 0)
-+                                      *dst = *wname;
-+                              return 1;
-+                      }
-+                      return 0;
-+              } else if (__collate_info->large_pri_count > 0) {
-+                      struct __collate_st_large_char_pri *match;
-+                      match = largesearch(*wname, loc);
-+                      if (match && match->pri.pri[0] >= 0) {
-+                              if (dlen > 0)
-+                                      *dst = *wname;
-+                              return 1;
-+                      }
-+              }
-+              return 0;
-+      }
-+      *wp = 0;
-+      if (__collate_info->chain_count > 0) {
-+              struct __collate_st_chain_pri *match;
-+              int ll;
-+              match = chainsearch(wname, &ll, loc);
-+              if (match) {
-+                      if (ll < dlen)
-+                              dlen = ll;
-+                      wcsncpy(dst, wname, dlen);
-+                      return ll;
-+              }
-+      }
-+      return 0;
-+}
-+
-+/*
-+ * __collate_equiv_class returns the equivalence class number for the symbol
-+ * specified by src and slen, using ps to convert from multi-byte to wide
-+ * character.  Zero is returned if the symbol is not in an equivalence
-+ * class.  -1 is returned if there are wide character conversion error,
-+ * if there are any greater-than-8-bit characters or if a multi-byte symbol
-+ * is greater or equal to STR_LEN in length.  It is up to the calling
-+ * routine to preserve the mbstate_t structure as needed.
-+ */
-+__private_extern__ int
-+__collate_equiv_class(const char *src, size_t slen, mbstate_t *ps, locale_t loc)
-+{
-+      wchar_t wname[STR_LEN];
-+      wchar_t w, *wp;
-+      size_t len, l;
-+      int e;
-+
-+      /* POSIX locale */
-+      if (loc->__collate_load_error)
-+              return 0;
-+      for(wp = wname, len = 0; slen > 0; len++) {
-+              l = mbrtowc_l(&w, src, slen, ps, loc);
-+              if (l == (size_t)-1 || l == (size_t)-2)
-+                      return -1;
-+              if (l == 0)
-+                      break;
-+              if (len >= STR_LEN)
-+                      return -1;
-+              *wp++ = w;
-+              src += l;
-+              slen = (long)slen - (long)l;
-+      }
-+      if (len == 0)
-+              return -1;
-+      if (len == 1) {
-+              e = -1;
-+              if (*wname <= UCHAR_MAX)
-+                      e = __collate_char_pri_table[*wname].pri[0];
-+              else if (__collate_info->large_pri_count > 0) {
-+                      struct __collate_st_large_char_pri *match;
-+                      match = largesearch(*wname, loc);
-+                      if (match)
-+                              e = match->pri.pri[0];
-+              }
-+              if (e == 0)
-+                      return IGNORE_EQUIV_CLASS;
-+              return e > 0 ? e : 0;
-+      }
-+      *wp = 0;
-+      if (__collate_info->chain_count > 0) {
-+              struct __collate_st_chain_pri *match;
-+              int ll;
-+              match = chainsearch(wname, &ll, loc);
-+              if (match) {
-+                      e = match->pri[0];
-+                      if (e == 0)
-+                              return IGNORE_EQUIV_CLASS;
-+                      return e < 0 ? -e : e;
-+              }
-+      }
-+      return 0;
-+}
-+
-+/*
-+ * __collate_equiv_match tries to match any single or multi-character symbol
-+ * in equivalence class equiv_class in the multi-byte string specified by src
-+ * and slen.  If start is non-zero, it is taken to be the first (pre-converted)
-+ * wide character.  Subsequence wide characters, if needed, will use ps in
-+ * the conversion.  On a successful match, the length of the matched string
-+ * is returned (including the start character).  If dst is non-NULL, the
-+ * matched wide-character string is copied to dst, a wide character array of
-+ * length dlen (the results are not zero-terminated).  If rlen is non-NULL,
-+ * the number of character in src actually used is returned.  Zero is
-+ * returned by __collate_equiv_match if there is no match.  (size_t)-1 is
-+ * returned on error: if there were conversion errors or if dlen is too small
-+ * to accept the results.  On no match or error, ps is restored to its incoming
-+ * state.
-+ */
-+size_t
-+__collate_equiv_match(int equiv_class, wchar_t *dst, size_t dlen, wchar_t start, const char *src, size_t slen, mbstate_t *ps, size_t *rlen, locale_t loc)
-+{
-+      wchar_t w;
-+      size_t len, l, clen;
-+      int i;
-+      wchar_t buf[STR_LEN], *wp;
-+      mbstate_t save;
-+      const char *s = src;
-+      size_t sl = slen;
-+      struct __collate_st_chain_pri *ch = NULL;
-+
-+      /* POSIX locale */
-+      if (loc->__collate_load_error)
-+              return (size_t)-1;
-+      if (equiv_class == IGNORE_EQUIV_CLASS)
-+              equiv_class = 0;
-+      if (ps)
-+              save = *ps;
-+      wp = buf;
-+      len = clen = 0;
-+      if (start) {
-+              *wp++ = start;
-+              len = 1;
-+      }
-+      /* convert up to the max chain length */
-+      while(sl > 0 && len < __collate_info->chain_max_len) {
-+              l = mbrtowc_l(&w, s, sl, ps, loc);
-+              if (l == (size_t)-1 || l == (size_t)-2 || l == 0)
-+                      break;
-+              *wp++ = w;
-+              s += l;
-+              clen += l;
-+              sl -= l;
-+              len++;
-+      }
-+      *wp = 0;
-+      if (len > 1 && (ch = chainsearch(buf, &i, loc)) != NULL) {
-+              int e = ch->pri[0];
-+              if (e < 0)
-+                      e = -e;
-+              if (e == equiv_class)
-+                      goto found;
-+      }
-+      /* try single character */
-+      i = 1;
-+      if (*buf <= UCHAR_MAX) {
-+              if (equiv_class == __collate_char_pri_table[*buf].pri[0])
-+                      goto found;
-+      } else if (__collate_info->large_pri_count > 0) {
-+              struct __collate_st_large_char_pri *match;
-+              match = largesearch(*buf, loc);
-+              if (match && equiv_class == match->pri.pri[0])
-+                      goto found;
-+      }
-+      /* no match */
-+      if (ps)
-+              *ps = save;
-+      return 0;
-+found:
-+      /* if we converted more than we used, restore to initial and reconvert
-+       * up to what did match */
-+      if (i < len) {
-+              len = i;
-+              if (ps)
-+                      *ps = save;
-+              if (start)
-+                      i--;
-+              clen = 0;
-+              while(i-- > 0) {
-+                      l = mbrtowc_l(&w, src, slen, ps, loc);
-+                      src += l;
-+                      clen += l;
-+                      slen -= l;
-+              }
-+      }
-+      if (dst) {
-+              if (dlen < len) {
-+                      if (ps)
-+                              *ps = save;
-+                      return (size_t)-1;
-+              }
-+              for(wp = buf; len > 0; len--)
-+                  *dst++ = *wp++;
-+      }
-+      if (rlen)
-+              *rlen = clen;
-+      return len;
-+}
-+
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-+static void
-+wntohl(wchar_t *str, int len)
-+{
-+      for(; *str && len > 0; str++, len--)
-+              *str = ntohl(*str);
-+}
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-+
- #ifdef COLLATE_DEBUG
-+static char *
-+show(int c)
-+{
-+      static char buf[5];
-+
-+      if (c >=32 && c <= 126)
-+              sprintf(buf, "'%c' ", c);
-+      else
-+              sprintf(buf, "\\x{%02x}", c);
-+      return buf;
-+}
-+
-+static char *
-+showwcs(const wchar_t *t, int len)
-+{
-+      static char buf[64];
-+      char *cp = buf;
-+
-+      for(; *t && len > 0; len--, t++) {
-+              if (*t >=32 && *t <= 126)
-+                      *cp++ = *t;
-+              else {
-+                      sprintf(cp, "\\x{%02x}", *t);
-+                      cp += strlen(cp);
-+              }
-+      }
-+      *cp = 0;
-+      return buf;
-+}
-+
- void
- __collate_print_tables()
- {
--      int i;
--      struct __collate_st_chain_pri *p2;
-+      int i, z;
-+      locale_t loc = __current_locale();
--      printf("Substitute table:\n");
--      for (i = 0; i < UCHAR_MAX + 1; i++)
--          if (i != *__collate_substitute_table[i])
--              printf("\t'%c' --> \"%s\"\n", i,
--                     __collate_substitute_table[i]);
--      printf("Chain priority table:\n");
--      for (p2 = __collate_chain_pri_table; p2->str[0] != '\0'; p2++)
--              printf("\t\"%s\" : %d %d\n", p2->str, p2->prim, p2->sec);
-+      printf("Info: p=%d s=%d f=0x%02x m=%d dc=%d up=%d us=%d pc=%d sc=%d cc=%d lc=%d\n",
-+          __collate_info->directive[0], __collate_info->directive[1],
-+          __collate_info->flags, __collate_info->chain_max_len,
-+          __collate_info->directive_count,
-+          __collate_info->undef_pri[0], __collate_info->undef_pri[1],
-+          __collate_info->subst_count[0], __collate_info->subst_count[1],
-+          __collate_info->chain_count, __collate_info->large_pri_count);
-+      for(z = 0; z < __collate_info->directive_count; z++) {
-+              if (__collate_info->subst_count[z] > 0) {
-+                      struct __collate_st_subst *p2 = __collate_substitute_table[z];
-+                      if (z == 0 && (__collate_info->flags & COLLATE_SUBST_DUP))
-+                              printf("Both substitute tables:\n");
-+                      else
-+                              printf("Substitute table %d:\n", z);
-+                      for (i = __collate_info->subst_count[z]; i-- > 0; p2++)
-+                              printf("\t%s --> \"%s\"\n",
-+                                      show(p2->val),
-+                                      showwcs(p2->str, STR_LEN));
-+              }
-+      }
-+      if (__collate_info->chain_count > 0) {
-+              printf("Chain priority table:\n");
-+              struct __collate_st_chain_pri *p2 = __collate_chain_pri_table;
-+              for (i = __collate_info->chain_count; i-- > 0; p2++) {
-+                      printf("\t\"%s\" :", showwcs(p2->str, STR_LEN));
-+                      for(z = 0; z < __collate_info->directive_count; z++)
-+                              printf(" %d", p2->pri[z]);
-+                      putchar('\n');
-+              }
-+      }
-       printf("Char priority table:\n");
--      for (i = 0; i < UCHAR_MAX + 1; i++)
--              printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
--                     __collate_char_pri_table[i].sec);
-+      {
-+              struct __collate_st_char_pri *p2 = __collate_char_pri_table;
-+              for (i = 0; i < UCHAR_MAX + 1; i++, p2++) {
-+                      printf("\t%s :", show(i));
-+                      for(z = 0; z < __collate_info->directive_count; z++)
-+                              printf(" %d", p2->pri[z]);
-+                      putchar('\n');
-+              }
-+      }
-+      if (__collate_info->large_pri_count > 0) {
-+              struct __collate_st_large_char_pri *p2 = __collate_large_char_pri_table;
-+              printf("Large priority table:\n");
-+              for (i = __collate_info->large_pri_count; i-- > 0; p2++) {
-+                      printf("\t%s :", show(p2->val));
-+                      for(z = 0; z < __collate_info->directive_count; z++)
-+                              printf(" %d", p2->pri.pri[z]);
-+                      putchar('\n');
-+              }
-+      }
- }
- #endif
index a8d2176b2e264b5d5bbed2ef30f839ada3b94caf..f50babab00a3162d1d1bfe83f0e29d5017017b9f 100644 (file)
 #define        _COLLATE_H_
 
 #include <sys/cdefs.h>
+#ifndef __LIBC__
 #include <sys/types.h>
+#endif /* !__LIBC__ */
 #include <limits.h>
 
 #define STR_LEN 10
 #define TABLE_SIZE 100
 #define COLLATE_VERSION    "1.0\n"
+#define COLLATE_VERSION1_1 "1.1\n"
+#define COLLATE_VERSION1_1A "1.1A\n"
 #define COLLATE_VERSION1_2 "1.2\n"
 
+/* see discussion in string/FreeBSD/strxfrm for this value */
+#define COLLATE_MAX_PRIORITY ((1 << 24) - 1)
+
+#define DIRECTIVE_UNDEF 0x00
+#define DIRECTIVE_FORWARD 0x01
+#define DIRECTIVE_BACKWARD 0x02
+#define DIRECTIVE_POSITION 0x04
+
+#define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
+
+#define COLLATE_SUBST_DUP 0x0001
+
+#define IGNORE_EQUIV_CLASS 1
+
+struct __collate_st_info {
+       __uint8_t directive[COLL_WEIGHTS_MAX];
+       __uint8_t flags;
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+       __uint8_t directive_count:4;
+       __uint8_t chain_max_len:4;
+#else
+       __uint8_t chain_max_len:4;
+       __uint8_t directive_count:4;
+#endif
+       __int32_t undef_pri[COLL_WEIGHTS_MAX];
+       __int32_t subst_count[COLL_WEIGHTS_MAX];
+       __int32_t chain_count;
+       __int32_t large_pri_count;
+};
+
 struct __collate_st_char_pri {
-       int prim, sec;
+       __int32_t pri[COLL_WEIGHTS_MAX];
 };
 struct __collate_st_chain_pri {
-       u_char str[STR_LEN];
-       int prim, sec;
+       __darwin_wchar_t str[STR_LEN];
+       __int32_t pri[COLL_WEIGHTS_MAX];
+};
+struct __collate_st_large_char_pri {
+       __int32_t val;
+       struct __collate_st_char_pri pri;
+};
+struct __collate_st_subst {
+       __int32_t val;
+       __darwin_wchar_t str[STR_LEN];
 };
 
+#ifndef __LIBC__
 extern int __collate_load_error;
 extern int __collate_substitute_nontrivial;
-#define __collate_substitute_table (*__collate_substitute_table_ptr)
-extern u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
 #define __collate_char_pri_table (*__collate_char_pri_table_ptr)
 extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
 extern struct __collate_st_chain_pri *__collate_chain_pri_table;
+extern __int32_t *__collate_chain_equiv_table;
+extern struct __collate_st_info __collate_info;
+#endif /* !__LIBC__ */
 
 __BEGIN_DECLS
-u_char *__collate_strdup(u_char *);
-u_char *__collate_substitute(const u_char *);
-int    __collate_load_tables(const char *);
-void   __collate_lookup(const u_char *, int *, int *, int *);
-int    __collate_range_cmp(int, int);
+#ifdef __LIBC__
+__darwin_wchar_t       *__collate_mbstowcs(const char *, locale_t);
+__darwin_wchar_t       *__collate_wcsdup(const __darwin_wchar_t *);
+__darwin_wchar_t       *__collate_substitute(const __darwin_wchar_t *, int, locale_t);
+int    __collate_load_tables(const char *, locale_t);
+void   __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t);
+void   __collate_lookup_which(const __darwin_wchar_t *, int *, int *, int, locale_t);
+void   __collate_xfrm(const __darwin_wchar_t *, __darwin_wchar_t **, locale_t);
+int    __collate_range_cmp(__darwin_wchar_t, __darwin_wchar_t, locale_t);
+size_t __collate_collating_symbol(__darwin_wchar_t *, size_t, const char *, size_t, __darwin_mbstate_t *, locale_t);
+int    __collate_equiv_class(const char *, size_t, __darwin_mbstate_t *, locale_t);
+size_t __collate_equiv_match(int, __darwin_wchar_t *, size_t, __darwin_wchar_t, const char *, size_t, __darwin_mbstate_t *, size_t *, locale_t);
+#else /* !__LIBC__ */
+void   __collate_lookup(const unsigned char *, int *, int *, int *);
+#endif /* __LIBC__ */
 #ifdef COLLATE_DEBUG
 void   __collate_print_tables(void);
 #endif
diff --git a/locale/FreeBSD/collate.h.patch b/locale/FreeBSD/collate.h.patch
deleted file mode 100644 (file)
index 342a518..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
---- collate.h.bsdnew   2009-11-09 15:05:25.000000000 -0800
-+++ collate.h  2009-11-09 15:21:14.000000000 -0800
-@@ -31,36 +31,90 @@
- #define       _COLLATE_H_
- #include <sys/cdefs.h>
-+#ifndef __LIBC__
- #include <sys/types.h>
-+#endif /* !__LIBC__ */
- #include <limits.h>
- #define STR_LEN 10
- #define TABLE_SIZE 100
- #define COLLATE_VERSION    "1.0\n"
-+#define COLLATE_VERSION1_1 "1.1\n"
-+#define COLLATE_VERSION1_1A "1.1A\n"
- #define COLLATE_VERSION1_2 "1.2\n"
-+/* see discussion in string/FreeBSD/strxfrm for this value */
-+#define COLLATE_MAX_PRIORITY ((1 << 24) - 1)
-+
-+#define DIRECTIVE_UNDEF 0x00
-+#define DIRECTIVE_FORWARD 0x01
-+#define DIRECTIVE_BACKWARD 0x02
-+#define DIRECTIVE_POSITION 0x04
-+
-+#define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
-+
-+#define COLLATE_SUBST_DUP 0x0001
-+
-+#define IGNORE_EQUIV_CLASS 1
-+
-+struct __collate_st_info {
-+      __uint8_t directive[COLL_WEIGHTS_MAX];
-+      __uint8_t flags;
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-+      __uint8_t directive_count:4;
-+      __uint8_t chain_max_len:4;
-+#else
-+      __uint8_t chain_max_len:4;
-+      __uint8_t directive_count:4;
-+#endif
-+      __int32_t undef_pri[COLL_WEIGHTS_MAX];
-+      __int32_t subst_count[COLL_WEIGHTS_MAX];
-+      __int32_t chain_count;
-+      __int32_t large_pri_count;
-+};
-+
- struct __collate_st_char_pri {
--      int prim, sec;
-+      __int32_t pri[COLL_WEIGHTS_MAX];
- };
- struct __collate_st_chain_pri {
--      u_char str[STR_LEN];
--      int prim, sec;
-+      __darwin_wchar_t str[STR_LEN];
-+      __int32_t pri[COLL_WEIGHTS_MAX];
-+};
-+struct __collate_st_large_char_pri {
-+      __int32_t val;
-+      struct __collate_st_char_pri pri;
-+};
-+struct __collate_st_subst {
-+      __int32_t val;
-+      __darwin_wchar_t str[STR_LEN];
- };
-+#ifndef __LIBC__
- extern int __collate_load_error;
- extern int __collate_substitute_nontrivial;
--#define __collate_substitute_table (*__collate_substitute_table_ptr)
--extern u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
- #define __collate_char_pri_table (*__collate_char_pri_table_ptr)
- extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
- extern struct __collate_st_chain_pri *__collate_chain_pri_table;
-+extern __int32_t *__collate_chain_equiv_table;
-+extern struct __collate_st_info __collate_info;
-+#endif /* !__LIBC__ */
- __BEGIN_DECLS
--u_char        *__collate_strdup(u_char *);
--u_char        *__collate_substitute(const u_char *);
--int   __collate_load_tables(const char *);
--void  __collate_lookup(const u_char *, int *, int *, int *);
--int   __collate_range_cmp(int, int);
-+#ifdef __LIBC__
-+__darwin_wchar_t      *__collate_mbstowcs(const char *, locale_t);
-+__darwin_wchar_t      *__collate_wcsdup(const __darwin_wchar_t *);
-+__darwin_wchar_t      *__collate_substitute(const __darwin_wchar_t *, int, locale_t);
-+int   __collate_load_tables(const char *, locale_t);
-+void  __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t);
-+void  __collate_lookup_which(const __darwin_wchar_t *, int *, int *, int, locale_t);
-+void  __collate_xfrm(const __darwin_wchar_t *, __darwin_wchar_t **, locale_t);
-+int   __collate_range_cmp(__darwin_wchar_t, __darwin_wchar_t, locale_t);
-+size_t        __collate_collating_symbol(__darwin_wchar_t *, size_t, const char *, size_t, __darwin_mbstate_t *, locale_t);
-+int   __collate_equiv_class(const char *, size_t, __darwin_mbstate_t *, locale_t);
-+size_t        __collate_equiv_match(int, __darwin_wchar_t *, size_t, __darwin_wchar_t, const char *, size_t, __darwin_mbstate_t *, size_t *, locale_t);
-+#else /* !__LIBC__ */
-+void  __collate_lookup(const unsigned char *, int *, int *, int *);
-+#endif /* __LIBC__ */
- #ifdef COLLATE_DEBUG
- void  __collate_print_tables(void);
- #endif
index dde67a4e09488e48da403b4fca4727680f06b470..7f135bcc94bbbf3c0738f43bcb91e6ba787804f5 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/collcmp.c,v 1.18 2005/02/27 14:54:23 phantom Exp $");
 
-#include <string.h>
+#include <xlocale.h>
+#include <wchar.h>
 #include "collate.h"
 
 /*
  * Compare two characters using collate
  */
 
-int __collate_range_cmp(int c1, int c2)
+__private_extern__ int
+__collate_range_cmp(wchar_t c1, wchar_t c2, locale_t loc)
 {
-       static char s1[2], s2[2];
+       static wchar_t s1[2], s2[2];
 
        s1[0] = c1;
        s2[0] = c2;
-       return (strcoll(s1, s2));
+       return (wcscoll_l(s1, s2, loc));
 }
diff --git a/locale/FreeBSD/collcmp.c.patch b/locale/FreeBSD/collcmp.c.patch
deleted file mode 100644 (file)
index d985e29..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---- collcmp.c.bsdnew   2009-11-09 15:05:25.000000000 -0800
-+++ collcmp.c  2009-11-09 15:23:31.000000000 -0800
-@@ -27,18 +27,20 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/collcmp.c,v 1.18 2005/02/27 14:54:23 phantom Exp $");
--#include <string.h>
-+#include <xlocale.h>
-+#include <wchar.h>
- #include "collate.h"
- /*
-  * Compare two characters using collate
-  */
--int __collate_range_cmp(int c1, int c2)
-+__private_extern__ int
-+__collate_range_cmp(wchar_t c1, wchar_t c2, locale_t loc)
- {
--      static char s1[2], s2[2];
-+      static wchar_t s1[2], s2[2];
-       s1[0] = c1;
-       s2[0] = c2;
--      return (strcoll(s1, s2));
-+      return (wcscoll_l(s1, s2, loc));
- }
index f3bbaa115f8004e05317961a769bb03b205aa4a5..aa91313b62e7f127a89a868dfe1c88e6b8e4f1ea 100644 (file)
@@ -111,6 +111,12 @@ They are available as macros, defined in the include file
 .In ctype.h ,
 or as true functions in the C library.
 See the specific manual pages for more information.
+.Pp
+Extended locale versions of these functions are documented in
+.Xr ctype_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh SEE ALSO
 .Xr digittoint 3 ,
 .Xr isalnum 3 ,
@@ -134,7 +140,8 @@ See the specific manual pages for more information.
 .Xr tolower 3 ,
 .Xr toupper 3 ,
 .Xr wctype 3 ,
-.Xr ascii 7
+.Xr ascii 7 ,
+.Xr ctype_l 3
 .Sh STANDARDS
 These functions, except for
 .Fn digittoint ,
diff --git a/locale/FreeBSD/ctype.3.patch b/locale/FreeBSD/ctype.3.patch
deleted file mode 100644 (file)
index d43340c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- ctype.3.orig       2009-11-09 15:05:25.000000000 -0800
-+++ ctype.3    2009-11-09 15:05:26.000000000 -0800
-@@ -111,6 +111,12 @@ They are available as macros, defined in
- .In ctype.h ,
- or as true functions in the C library.
- See the specific manual pages for more information.
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr ctype_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh SEE ALSO
- .Xr digittoint 3 ,
- .Xr isalnum 3 ,
-@@ -134,7 +140,8 @@ See the specific manual pages for more i
- .Xr tolower 3 ,
- .Xr toupper 3 ,
- .Xr wctype 3 ,
--.Xr ascii 7
-+.Xr ascii 7 ,
-+.Xr ctype_l 3
- .Sh STANDARDS
- These functions, except for
- .Fn digittoint ,
index e3a71dd38eda27226b03b97c8366cf4ab1bbbe5c..3e86f72bb83219b2acd1c83abb6dbf825d547c70 100644 (file)
 .Dt DIGITTOINT 3
 .Os
 .Sh NAME
-.Nm digittoint
+.Nm digittoint ,
+.Nm digittoint_l
 .Nd convert a numeric character to its integer value
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In ctype.h
 .Ft int
-.Fn digittoint "int c"
+.Fo digittoint
+.Fa "int c"
+.Fc
+.In xlocale.h
+.In ctype.h
+.Ft int
+.Fo digittoint_l
+.Fa "int c"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn digittoint
 function converts a numeric character to its corresponding integer value.
 The character can be any decimal digit or hexadecimal digit.
 With hexadecimal characters, the case of the values does not matter.
+.Pp
+While the
+.Fn digittoint
+function uses the current locale, the
+.Fn digittoint_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn digittoint
@@ -56,4 +74,5 @@ the function will return 0.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr isdigit 3 ,
-.Xr isxdigit 3
+.Xr isxdigit 3 ,
+.Xr xlocale 3
diff --git a/locale/FreeBSD/digittoint.3.patch b/locale/FreeBSD/digittoint.3.patch
deleted file mode 100644 (file)
index 3bb6a14..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
---- digittoint.3.orig  2009-11-09 15:05:25.000000000 -0800
-+++ digittoint.3       2009-11-09 15:05:26.000000000 -0800
-@@ -32,20 +32,38 @@
- .Dt DIGITTOINT 3
- .Os
- .Sh NAME
--.Nm digittoint
-+.Nm digittoint ,
-+.Nm digittoint_l
- .Nd convert a numeric character to its integer value
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In ctype.h
- .Ft int
--.Fn digittoint "int c"
-+.Fo digittoint
-+.Fa "int c"
-+.Fc
-+.In xlocale.h
-+.In ctype.h
-+.Ft int
-+.Fo digittoint_l
-+.Fa "int c"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn digittoint
- function converts a numeric character to its corresponding integer value.
- The character can be any decimal digit or hexadecimal digit.
- With hexadecimal characters, the case of the values does not matter.
-+.Pp
-+While the
-+.Fn digittoint
-+function uses the current locale, the
-+.Fn digittoint_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn digittoint
-@@ -56,4 +74,5 @@ the function will return 0.
- .Sh SEE ALSO
- .Xr ctype 3 ,
- .Xr isdigit 3 ,
--.Xr isxdigit 3
-+.Xr isxdigit 3 ,
-+.Xr xlocale 3
index 6ae525a67f2ab30fb52447293be39207811723d9..1b60aa3a034cc53cec0db037a173e8480cceac4a 100644 (file)
@@ -41,6 +41,8 @@ static char sccsid[] = "@(#)euc.c     8.1 (Berkeley) 6/4/93";
 #include <sys/param.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <runetype.h>
@@ -49,13 +51,11 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Ex
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
-
 static size_t  _EUC_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _EUC_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _EUC_mbsinit(const mbstate_t *, locale_t);
 static size_t  _EUC_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 
 typedef struct {
        int     count[4];
@@ -69,12 +69,20 @@ typedef struct {
        int     want;
 } _EucState;
 
-int
-_EUC_init(_RuneLocale *rl)
+/* This will be called by the XL_RELEASE() macro to free the extra storage */
+static void
+_EUC_free_extra(struct __xlocale_st_runelocale *xrl)
+{
+       free(xrl->_CurrentRuneLocale.__variable);
+}
+
+__private_extern__ int
+_EUC_init(struct __xlocale_st_runelocale *xrl)
 {
        _EucInfo *ei;
        int x, new__mb_cur_max;
        char *v, *e;
+       _RuneLocale *rl = &xrl->_CurrentRuneLocale;
 
        if (rl->__variable == NULL)
                return (EFTYPE);
@@ -113,24 +121,22 @@ _EUC_init(_RuneLocale *rl)
        }
        rl->__variable = ei;
        rl->__variable_len = sizeof(_EucInfo);
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = new__mb_cur_max;
-       __mbrtowc = _EUC_mbrtowc;
-       __wcrtomb = _EUC_wcrtomb;
-       __mbsinit = _EUC_mbsinit;
-       __mb_sb_limit = 256;
+       xrl->__mb_cur_max = new__mb_cur_max;
+       xrl->__mbrtowc = _EUC_mbrtowc;
+       xrl->__wcrtomb = _EUC_wcrtomb;
+       xrl->__mbsinit = _EUC_mbsinit;
+       xrl->__mb_sb_limit = 256;
+       xrl->__free_extra = (__free_extra_t)_EUC_free_extra;
        return (0);
 }
 
 static int
-_EUC_mbsinit(const mbstate_t *ps)
+_EUC_mbsinit(const mbstate_t *ps, locale_t loc __unused)
 {
 
        return (ps == NULL || ((const _EucState *)ps)->want == 0);
 }
 
-#define        CEI     ((_EucInfo *)(_CurrentRuneLocale->__variable))
-
 #define        _SS2    0x008e
 #define        _SS3    0x008f
 
@@ -146,16 +152,18 @@ _euc_set(u_int c)
 
 static size_t
 _EUC_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps)
+    mbstate_t * __restrict ps, locale_t loc)
 {
        _EucState *es;
        int i, set, want;
        wchar_t wc;
        const char *os;
+       struct __xlocale_st_runelocale *rl = loc->__lc_ctype;
+       _EucInfo *CEI = (_EucInfo *)rl->_CurrentRuneLocale.__variable;
 
        es = (_EucState *)ps;
 
-       if (es->want < 0 || es->want > MB_CUR_MAX || es->set < 0 ||
+       if (es->want < 0 || es->want > rl->__mb_cur_max || es->set < 0 ||
            es->set > 3) {
                errno = EINVAL;
                return ((size_t)-1);
@@ -218,11 +226,12 @@ _EUC_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 }
 
 static size_t
-_EUC_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_EUC_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
 {
        _EucState *es;
        wchar_t m, nm;
        int i, len;
+       _EucInfo *CEI = (_EucInfo *)loc->__lc_ctype->_CurrentRuneLocale.__variable;
 
        es = (_EucState *)ps;
 
diff --git a/locale/FreeBSD/euc.c.patch b/locale/FreeBSD/euc.c.patch
deleted file mode 100644 (file)
index 816b75b..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
---- euc.c.bsdnew       2009-11-09 15:05:25.000000000 -0800
-+++ euc.c      2009-11-09 15:44:21.000000000 -0800
-@@ -41,6 +41,8 @@ static char sccsid[] = "@(#)euc.c    8.1 (B
- #include <sys/param.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <runetype.h>
-@@ -49,13 +51,11 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
--
- static size_t _EUC_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _EUC_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _EUC_mbsinit(const mbstate_t *, locale_t);
- static size_t _EUC_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- typedef struct {
-       int     count[4];
-@@ -69,12 +69,20 @@ typedef struct {
-       int     want;
- } _EucState;
--int
--_EUC_init(_RuneLocale *rl)
-+/* This will be called by the XL_RELEASE() macro to free the extra storage */
-+static void
-+_EUC_free_extra(struct __xlocale_st_runelocale *xrl)
-+{
-+      free(xrl->_CurrentRuneLocale.__variable);
-+}
-+
-+__private_extern__ int
-+_EUC_init(struct __xlocale_st_runelocale *xrl)
- {
-       _EucInfo *ei;
-       int x, new__mb_cur_max;
-       char *v, *e;
-+      _RuneLocale *rl = &xrl->_CurrentRuneLocale;
-       if (rl->__variable == NULL)
-               return (EFTYPE);
-@@ -113,24 +121,22 @@ _EUC_init(_RuneLocale *rl)
-       }
-       rl->__variable = ei;
-       rl->__variable_len = sizeof(_EucInfo);
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = new__mb_cur_max;
--      __mbrtowc = _EUC_mbrtowc;
--      __wcrtomb = _EUC_wcrtomb;
--      __mbsinit = _EUC_mbsinit;
--      __mb_sb_limit = 256;
-+      xrl->__mb_cur_max = new__mb_cur_max;
-+      xrl->__mbrtowc = _EUC_mbrtowc;
-+      xrl->__wcrtomb = _EUC_wcrtomb;
-+      xrl->__mbsinit = _EUC_mbsinit;
-+      xrl->__mb_sb_limit = 256;
-+      xrl->__free_extra = (__free_extra_t)_EUC_free_extra;
-       return (0);
- }
- static int
--_EUC_mbsinit(const mbstate_t *ps)
-+_EUC_mbsinit(const mbstate_t *ps, locale_t loc __unused)
- {
-       return (ps == NULL || ((const _EucState *)ps)->want == 0);
- }
--#define       CEI     ((_EucInfo *)(_CurrentRuneLocale->__variable))
--
- #define       _SS2    0x008e
- #define       _SS3    0x008f
-@@ -146,16 +152,18 @@ _euc_set(u_int c)
- static size_t
- _EUC_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+    mbstate_t * __restrict ps, locale_t loc)
- {
-       _EucState *es;
-       int i, set, want;
-       wchar_t wc;
-       const char *os;
-+      struct __xlocale_st_runelocale *rl = loc->__lc_ctype;
-+      _EucInfo *CEI = (_EucInfo *)rl->_CurrentRuneLocale.__variable;
-       es = (_EucState *)ps;
--      if (es->want < 0 || es->want > MB_CUR_MAX || es->set < 0 ||
-+      if (es->want < 0 || es->want > rl->__mb_cur_max || es->set < 0 ||
-           es->set > 3) {
-               errno = EINVAL;
-               return ((size_t)-1);
-@@ -218,11 +226,12 @@ _EUC_mbrtowc(wchar_t * __restrict pwc, c
- }
- static size_t
--_EUC_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_EUC_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
- {
-       _EucState *es;
-       wchar_t m, nm;
-       int i, len;
-+      _EucInfo *CEI = (_EucInfo *)loc->__lc_ctype->_CurrentRuneLocale.__variable;
-       es = (_EucState *)ps;
index ab08f3f2cbd5cef2647340a837e8dcb6df49c3a0..180c80035b18a8f0accbf217c43e0a2b3d06f0a2 100644 (file)
@@ -31,7 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/fix_grouping.c,v 1.8 2003/06/26 10:46:16
 #include <limits.h>
 #include <stddef.h>
 
-static const char nogrouping[] = { CHAR_MAX, '\0' };
+static const char nogrouping[] = { '\0' };
+static const char __nogrouping[] = { CHAR_MAX, '\0' };
 
 /*
  * Internal helper used to convert grouping sequences from string
@@ -84,3 +85,14 @@ __fix_locale_grouping_str(const char *str)
        *dst = '\0';
        return str;
 }
+
+/*
+ * internal helpers for SUSv3 compatibility.  Since "nogrouping" needs to
+ * be just an empty string, we provide a routine to substitute __nogrouping
+ * so we don't have to modify code that expects CHAR_MAX.
+ */
+__private_extern__ const char *
+__fix_nogrouping(const char *str)
+{
+       return ((str == NULL || *str == '\0') ? __nogrouping : str);
+}
diff --git a/locale/FreeBSD/fix_grouping.c.patch b/locale/FreeBSD/fix_grouping.c.patch
deleted file mode 100644 (file)
index 43adfce..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---- fix_grouping.c.orig        2009-11-09 15:05:25.000000000 -0800
-+++ fix_grouping.c     2009-11-09 15:05:25.000000000 -0800
-@@ -31,7 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <limits.h>
- #include <stddef.h>
--static const char nogrouping[] = { CHAR_MAX, '\0' };
-+static const char nogrouping[] = { '\0' };
-+static const char __nogrouping[] = { CHAR_MAX, '\0' };
- /*
-  * Internal helper used to convert grouping sequences from string
-@@ -84,3 +85,14 @@ __fix_locale_grouping_str(const char *st
-       *dst = '\0';
-       return str;
- }
-+
-+/*
-+ * internal helpers for SUSv3 compatibility.  Since "nogrouping" needs to
-+ * be just an empty string, we provide a routine to substitute __nogrouping
-+ * so we don't have to modify code that expects CHAR_MAX.
-+ */
-+__private_extern__ const char *
-+__fix_nogrouping(const char *str)
-+{
-+      return ((str == NULL || *str == '\0') ? __nogrouping : str);
-+}
index 67f2b0e5d7f424d01b0c56473c0d313d1b402ceb..c63d05028c0bd1e0d80a46fb586ff2a74d0a7188 100644 (file)
@@ -32,6 +32,8 @@
 #include <sys/param.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <runetype.h>
 #include <stdlib.h>
@@ -39,35 +41,34 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
+#define GB18030_MB_CUR_MAX     4
 
 static size_t  _GB18030_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _GB18030_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _GB18030_mbsinit(const mbstate_t *, locale_t);
 static size_t  _GB18030_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 
 typedef struct {
        int     count;
        u_char  bytes[4];
 } _GB18030State;
 
-int
-_GB18030_init(_RuneLocale *rl)
+__private_extern__ int
+_GB18030_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _GB18030_mbrtowc;
-       __wcrtomb = _GB18030_wcrtomb;
-       __mbsinit = _GB18030_mbsinit;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 4;
-       __mb_sb_limit = 128;
+       xrl->__mbrtowc = _GB18030_mbrtowc;
+       xrl->__wcrtomb = _GB18030_wcrtomb;
+       xrl->__mbsinit = _GB18030_mbsinit;
+       xrl->__mb_cur_max = GB18030_MB_CUR_MAX;
+       xrl->__mb_sb_limit = 128;
 
        return (0);
 }
 
 static int
-_GB18030_mbsinit(const mbstate_t *ps)
+_GB18030_mbsinit(const mbstate_t *ps, locale_t loc __unused)
 {
 
        return (ps == NULL || ((const _GB18030State *)ps)->count == 0);
@@ -75,7 +76,7 @@ _GB18030_mbsinit(const mbstate_t *ps)
 
 static size_t
 _GB18030_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
-    size_t n, mbstate_t * __restrict ps)
+    size_t n, mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _GB18030State *gs;
        wchar_t wch;
@@ -95,7 +96,7 @@ _GB18030_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
                pwc = NULL;
        }
 
-       ncopy = MIN(MIN(n, MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
+       ncopy = MIN(MIN(n, GB18030_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
        memcpy(gs->bytes + gs->count, s, ncopy);
        ocount = gs->count;
        gs->count += ncopy;
@@ -158,7 +159,7 @@ ilseq:
 }
 
 static size_t
-_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _GB18030State *gs;
        size_t len;
diff --git a/locale/FreeBSD/gb18030.c.patch b/locale/FreeBSD/gb18030.c.patch
deleted file mode 100644 (file)
index 10f81f8..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
---- gb18030.c.bsdnew   2009-11-09 15:05:25.000000000 -0800
-+++ gb18030.c  2009-11-09 15:50:31.000000000 -0800
-@@ -32,6 +32,8 @@
- #include <sys/param.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <runetype.h>
- #include <stdlib.h>
-@@ -39,35 +41,34 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
-+#define GB18030_MB_CUR_MAX    4
- static size_t _GB18030_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _GB18030_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _GB18030_mbsinit(const mbstate_t *, locale_t);
- static size_t _GB18030_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- typedef struct {
-       int     count;
-       u_char  bytes[4];
- } _GB18030State;
--int
--_GB18030_init(_RuneLocale *rl)
-+__private_extern__ int
-+_GB18030_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _GB18030_mbrtowc;
--      __wcrtomb = _GB18030_wcrtomb;
--      __mbsinit = _GB18030_mbsinit;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 4;
--      __mb_sb_limit = 128;
-+      xrl->__mbrtowc = _GB18030_mbrtowc;
-+      xrl->__wcrtomb = _GB18030_wcrtomb;
-+      xrl->__mbsinit = _GB18030_mbsinit;
-+      xrl->__mb_cur_max = GB18030_MB_CUR_MAX;
-+      xrl->__mb_sb_limit = 128;
-       return (0);
- }
- static int
--_GB18030_mbsinit(const mbstate_t *ps)
-+_GB18030_mbsinit(const mbstate_t *ps, locale_t loc __unused)
- {
-       return (ps == NULL || ((const _GB18030State *)ps)->count == 0);
-@@ -75,7 +76,7 @@ _GB18030_mbsinit(const mbstate_t *ps)
- static size_t
- _GB18030_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
--    size_t n, mbstate_t * __restrict ps)
-+    size_t n, mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _GB18030State *gs;
-       wchar_t wch;
-@@ -95,7 +96,7 @@ _GB18030_mbrtowc(wchar_t * __restrict pw
-               pwc = NULL;
-       }
--      ncopy = MIN(MIN(n, MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
-+      ncopy = MIN(MIN(n, GB18030_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
-       memcpy(gs->bytes + gs->count, s, ncopy);
-       ocount = gs->count;
-       gs->count += ncopy;
-@@ -158,7 +159,7 @@ ilseq:
- }
- static size_t
--_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _GB18030State *gs;
-       size_t len;
index 5f47bd0e8374426d60854f6d0d87106e8a51311a..a84b1cfeaf1b163291d8d410a6986fc5d968d90e 100644 (file)
@@ -28,6 +28,8 @@
 #include <sys/param.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <runetype.h>
 #include <stdlib.h>
@@ -35,34 +37,32 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
+#define GB2312_MB_CUR_MAX      2
 
 static size_t  _GB2312_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _GB2312_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _GB2312_mbsinit(const mbstate_t *, locale_t);
 static size_t  _GB2312_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
-
+                   mbstate_t * __restrict, locale_t);
 typedef struct {
        int     count;
        u_char  bytes[2];
 } _GB2312State;
 
-int
-_GB2312_init(_RuneLocale *rl)
+__private_extern__ int
+_GB2312_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       _CurrentRuneLocale = rl;
-       __mbrtowc = _GB2312_mbrtowc;
-       __wcrtomb = _GB2312_wcrtomb;
-       __mbsinit = _GB2312_mbsinit;
-       __mb_cur_max = 2;
-       __mb_sb_limit = 128;
+       xrl->__mbrtowc = _GB2312_mbrtowc;
+       xrl->__wcrtomb = _GB2312_wcrtomb;
+       xrl->__mbsinit = _GB2312_mbsinit;
+       xrl->__mb_cur_max = GB2312_MB_CUR_MAX;
+       xrl->__mb_sb_limit = 128;
        return (0);
 }
 
 static int
-_GB2312_mbsinit(const mbstate_t *ps)
+_GB2312_mbsinit(const mbstate_t *ps, locale_t loc __unused)
 {
 
        return (ps == NULL || ((const _GB2312State *)ps)->count == 0);
@@ -93,7 +93,7 @@ _GB2312_check(const char *str, size_t n)
 
 static size_t
 _GB2312_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps)
+    mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _GB2312State *gs;
        wchar_t wc;
@@ -113,7 +113,7 @@ _GB2312_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
                pwc = NULL;
        }
 
-       ncopy = MIN(MIN(n, MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
+       ncopy = MIN(MIN(n, GB2312_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
        memcpy(gs->bytes + gs->count, s, ncopy);
        ocount = gs->count;
        gs->count += ncopy;
@@ -133,7 +133,7 @@ _GB2312_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 }
 
 static size_t
-_GB2312_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_GB2312_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _GB2312State *gs;
 
diff --git a/locale/FreeBSD/gb2312.c.patch b/locale/FreeBSD/gb2312.c.patch
deleted file mode 100644 (file)
index 7912ed0..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
---- gb2312.c.bsdnew    2009-11-09 15:05:25.000000000 -0800
-+++ gb2312.c   2009-11-09 16:10:25.000000000 -0800
-@@ -28,6 +28,8 @@
- #include <sys/param.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <runetype.h>
- #include <stdlib.h>
-@@ -35,34 +37,32 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
-+#define GB2312_MB_CUR_MAX     2
- static size_t _GB2312_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _GB2312_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _GB2312_mbsinit(const mbstate_t *, locale_t);
- static size_t _GB2312_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
--
-+                  mbstate_t * __restrict, locale_t);
- typedef struct {
-       int     count;
-       u_char  bytes[2];
- } _GB2312State;
--int
--_GB2312_init(_RuneLocale *rl)
-+__private_extern__ int
-+_GB2312_init(struct __xlocale_st_runelocale *xrl)
- {
--      _CurrentRuneLocale = rl;
--      __mbrtowc = _GB2312_mbrtowc;
--      __wcrtomb = _GB2312_wcrtomb;
--      __mbsinit = _GB2312_mbsinit;
--      __mb_cur_max = 2;
--      __mb_sb_limit = 128;
-+      xrl->__mbrtowc = _GB2312_mbrtowc;
-+      xrl->__wcrtomb = _GB2312_wcrtomb;
-+      xrl->__mbsinit = _GB2312_mbsinit;
-+      xrl->__mb_cur_max = GB2312_MB_CUR_MAX;
-+      xrl->__mb_sb_limit = 128;
-       return (0);
- }
- static int
--_GB2312_mbsinit(const mbstate_t *ps)
-+_GB2312_mbsinit(const mbstate_t *ps, locale_t loc __unused)
- {
-       return (ps == NULL || ((const _GB2312State *)ps)->count == 0);
-@@ -93,7 +93,7 @@ _GB2312_check(const char *str, size_t n)
- static size_t
- _GB2312_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+    mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _GB2312State *gs;
-       wchar_t wc;
-@@ -113,7 +113,7 @@ _GB2312_mbrtowc(wchar_t * __restrict pwc
-               pwc = NULL;
-       }
--      ncopy = MIN(MIN(n, MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
-+      ncopy = MIN(MIN(n, GB2312_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
-       memcpy(gs->bytes + gs->count, s, ncopy);
-       ocount = gs->count;
-       gs->count += ncopy;
-@@ -133,7 +133,7 @@ _GB2312_mbrtowc(wchar_t * __restrict pwc
- }
- static size_t
--_GB2312_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_GB2312_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _GB2312State *gs;
index 3b30f1031aca96aacfa9c772ab7762374e211711..c38338b1309b89b57075bc66fddcf16d5d5cb4b4 100644 (file)
@@ -34,6 +34,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <errno.h>
 #include <runetype.h>
@@ -42,33 +44,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Ex
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
-
 static size_t  _GBK_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _GBK_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _GBK_mbsinit(const mbstate_t *, locale_t);
 static size_t  _GBK_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 
 typedef struct {
        wchar_t ch;
 } _GBKState;
 
-int
-_GBK_init(_RuneLocale *rl)
+__private_extern__ int
+_GBK_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _GBK_mbrtowc;
-       __wcrtomb = _GBK_wcrtomb;
-       __mbsinit = _GBK_mbsinit;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 2;
-       __mb_sb_limit = 128;
+       xrl->__mbrtowc = _GBK_mbrtowc;
+       xrl->__wcrtomb = _GBK_wcrtomb;
+       xrl->__mbsinit = _GBK_mbsinit;
+       xrl->__mb_cur_max = 2;
+       xrl->__mb_sb_limit = 128;
        return (0);
 }
 
 static int
-_GBK_mbsinit(const mbstate_t *ps)
+_GBK_mbsinit(const mbstate_t *ps, locale_t loc __unused)
 {
 
        return (ps == NULL || ((const _GBKState *)ps)->ch == 0);
@@ -84,7 +83,7 @@ _gbk_check(u_int c)
 
 static size_t
 _GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps)
+    mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _GBKState *gs;
        wchar_t wc;
@@ -144,7 +143,7 @@ _GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 }
 
 static size_t
-_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _GBKState *gs;
 
diff --git a/locale/FreeBSD/gbk.c.patch b/locale/FreeBSD/gbk.c.patch
deleted file mode 100644 (file)
index df89765..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
---- gbk.c.orig 2009-11-09 15:05:25.000000000 -0800
-+++ gbk.c      2009-11-09 16:27:30.000000000 -0800
-@@ -34,6 +34,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <errno.h>
- #include <runetype.h>
-@@ -42,33 +44,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
--
- static size_t _GBK_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _GBK_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _GBK_mbsinit(const mbstate_t *, locale_t);
- static size_t _GBK_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- typedef struct {
-       wchar_t ch;
- } _GBKState;
--int
--_GBK_init(_RuneLocale *rl)
-+__private_extern__ int
-+_GBK_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _GBK_mbrtowc;
--      __wcrtomb = _GBK_wcrtomb;
--      __mbsinit = _GBK_mbsinit;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 2;
--      __mb_sb_limit = 128;
-+      xrl->__mbrtowc = _GBK_mbrtowc;
-+      xrl->__wcrtomb = _GBK_wcrtomb;
-+      xrl->__mbsinit = _GBK_mbsinit;
-+      xrl->__mb_cur_max = 2;
-+      xrl->__mb_sb_limit = 128;
-       return (0);
- }
- static int
--_GBK_mbsinit(const mbstate_t *ps)
-+_GBK_mbsinit(const mbstate_t *ps, locale_t loc __unused)
- {
-       return (ps == NULL || ((const _GBKState *)ps)->ch == 0);
-@@ -84,7 +83,7 @@ _gbk_check(u_int c)
- static size_t
- _GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+    mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _GBKState *gs;
-       wchar_t wc;
-@@ -144,7 +143,7 @@ _GBK_mbrtowc(wchar_t * __restrict pwc, c
- }
- static size_t
--_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _GBKState *gs;
index 85fb66b89b76ce7b3219e12bd04040809554c5ba..961b9b33c222d842b288146f4a6b7b759cedebbb 100644 (file)
@@ -58,7 +58,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''"
@@ -92,6 +92,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr isalpha 3 ,
 .Xr isdigit 3 ,
 .Xr iswalnum 3 ,
diff --git a/locale/FreeBSD/isalnum.3.patch b/locale/FreeBSD/isalnum.3.patch
deleted file mode 100644 (file)
index 0bb3f5a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- isalnum.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ isalnum.3  2009-11-10 13:22:59.000000000 -0800
-@@ -58,7 +58,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''"
-@@ -92,6 +92,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr isalpha 3 ,
- .Xr isdigit 3 ,
- .Xr iswalnum 3 ,
index 7369cb53a2a9e8c5018abe2edeec042c236da5d0..3d9ad13c54b264062671b5eef87cb0f705a36c3b 100644 (file)
@@ -58,7 +58,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
@@ -90,6 +90,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr islower 3 ,
 .Xr isupper 3 ,
 .Xr iswalpha 3 ,
diff --git a/locale/FreeBSD/isalpha.3.patch b/locale/FreeBSD/isalpha.3.patch
deleted file mode 100644 (file)
index 9263ce3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- isalpha.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ isalpha.3  2009-11-10 13:24:18.000000000 -0800
-@@ -58,7 +58,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
-@@ -90,6 +90,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr islower 3 ,
- .Xr isupper 3 ,
- .Xr iswalpha 3 ,
index bdba080afa5f72542b8db3a7a4e7f514b88ddbb0..5a4aef27df232c92f8a0a25f75bb3cc3576fc429 100644 (file)
@@ -74,6 +74,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswblank 3 ,
 .Xr ascii 7
 .Sh STANDARDS
diff --git a/locale/FreeBSD/isblank.3.patch b/locale/FreeBSD/isblank.3.patch
deleted file mode 100644 (file)
index 1da0af0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- isblank.3.orig     2009-11-30 16:10:19.000000000 -0800
-+++ isblank.3  2009-11-30 16:10:19.000000000 -0800
-@@ -74,6 +74,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswblank 3 ,
- .Xr ascii 7
- .Sh STANDARDS
index b12e912d4b0e4d87b323614220588d47d8e40578..bb7045db219930931e3440a9f2f7fd2804a60ac1 100644 (file)
@@ -54,7 +54,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&000\ NUL \t001\ SOH \t002\ STX \t003\ ETX \t004\ EOT"
@@ -82,6 +82,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswcntrl 3 ,
 .Xr ascii 7
 .Sh STANDARDS
diff --git a/locale/FreeBSD/iscntrl.3.patch b/locale/FreeBSD/iscntrl.3.patch
deleted file mode 100644 (file)
index cbb58e0..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- iscntrl.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ iscntrl.3  2009-11-10 13:33:05.000000000 -0800
-@@ -54,7 +54,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&000\ NUL \t001\ SOH \t002\ STX \t003\ ETX \t004\ EOT"
-@@ -82,6 +82,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswcntrl 3 ,
- .Xr ascii 7
- .Sh STANDARDS
index 587df338068d44aa916fb1e61d106c2e05bfc62c..0fffb886cc99d23f596dec02ccf85385982b173c 100644 (file)
@@ -87,6 +87,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswdigit 3 ,
 .Xr multibyte 3 ,
 .Xr ascii 7
diff --git a/locale/FreeBSD/isdigit.3.patch b/locale/FreeBSD/isdigit.3.patch
deleted file mode 100644 (file)
index 0ddb02e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- isdigit.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ isdigit.3  2009-11-10 13:34:59.000000000 -0800
-@@ -87,6 +87,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswdigit 3 ,
- .Xr multibyte 3 ,
- .Xr ascii 7
index bc2ada6d02472befb5e2d568c619e3336a769c39..f20973fc4fb6ea47fe12a9fdfcc69c75171b7a1f 100644 (file)
@@ -57,7 +57,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
@@ -97,6 +97,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswgraph 3 ,
 .Xr ascii 7
 .Sh STANDARDS
diff --git a/locale/FreeBSD/isgraph.3.patch b/locale/FreeBSD/isgraph.3.patch
deleted file mode 100644 (file)
index 99180c0..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- isgraph.3.orig     2009-11-30 16:10:19.000000000 -0800
-+++ isgraph.3  2009-11-30 16:11:41.000000000 -0800
-@@ -57,7 +57,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
-@@ -97,6 +97,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswgraph 3 ,
- .Xr ascii 7
- .Sh STANDARDS
index 35d6718ed6c36d9a4522f8284c9877e95ba97b6d..9ee26b51203aa31130a15f4fb156e81152b5aa6c 100644 (file)
@@ -49,7 +49,8 @@ returns non-zero if the character tests true.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr isphonogram 3 ,
-.Xr iswideogram 3
+.Xr iswideogram 3 ,
+.Xr isalnum_l
 .Sh HISTORY
 The
 .Fn isideogram
diff --git a/locale/FreeBSD/isideogram.3.patch b/locale/FreeBSD/isideogram.3.patch
deleted file mode 100644 (file)
index 9d5ebc4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- isideogram.3.orig  2009-11-09 15:05:25.000000000 -0800
-+++ isideogram.3       2009-11-09 15:05:26.000000000 -0800
-@@ -49,7 +49,8 @@ returns non-zero if the character tests 
- .Sh SEE ALSO
- .Xr ctype 3 ,
- .Xr isphonogram 3 ,
--.Xr iswideogram 3
-+.Xr iswideogram 3 ,
-+.Xr isalnum_l
- .Sh HISTORY
- The
- .Fn isideogram
index 889ece190b573f30794af0ebf26d57ce367cd7dd..066d7d699f81f9c3a69b373dcf424c67e08db106 100644 (file)
@@ -81,6 +81,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswlower 3 ,
 .Xr tolower 3 ,
 .Xr ascii 7
diff --git a/locale/FreeBSD/islower.3.patch b/locale/FreeBSD/islower.3.patch
deleted file mode 100644 (file)
index 102cc14..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- islower.3.orig     2009-11-09 15:05:25.000000000 -0800
-+++ islower.3  2009-11-09 15:05:26.000000000 -0800
-@@ -81,6 +81,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswlower 3 ,
- .Xr tolower 3 ,
- .Xr ascii 7
index 57a575a1d717e69c9b3b69fa82ba869da741c707..39db048815a57135de7ed177be0dd5a53937dab0 100644 (file)
@@ -49,7 +49,8 @@ returns non-zero if the character tests true.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr isideogram 3 ,
-.Xr iswphonogram 3
+.Xr iswphonogram 3 ,
+.Xr isalnum_l
 .Sh HISTORY
 The
 .Fn isphonogram
diff --git a/locale/FreeBSD/isphonogram.3.patch b/locale/FreeBSD/isphonogram.3.patch
deleted file mode 100644 (file)
index 10bff7a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- isphonogram.3.orig 2009-11-09 15:05:25.000000000 -0800
-+++ isphonogram.3      2009-11-09 15:05:26.000000000 -0800
-@@ -49,7 +49,8 @@ returns non-zero if the character tests 
- .Sh SEE ALSO
- .Xr ctype 3 ,
- .Xr isideogram 3 ,
--.Xr iswphonogram 3
-+.Xr iswphonogram 3 ,
-+.Xr isalnum_l
- .Sh HISTORY
- The
- .Fn isphonogram
index 70c18072d8f6105a127a35d09723cc21a28a4cdf..25ae0b5d422fbb96dc3a99444b8cca3118bbd0d1 100644 (file)
@@ -55,7 +55,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&040\ sp \t041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$''"
@@ -95,6 +95,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswprint 3 ,
 .Xr ascii 7
 .Sh STANDARDS
diff --git a/locale/FreeBSD/isprint.3.patch b/locale/FreeBSD/isprint.3.patch
deleted file mode 100644 (file)
index 4e71b97..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- isprint.3.orig     2009-11-30 16:10:19.000000000 -0800
-+++ isprint.3  2009-11-30 16:10:29.000000000 -0800
-@@ -55,7 +55,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&040\ sp \t041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$''"
-@@ -95,6 +95,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswprint 3 ,
- .Xr ascii 7
- .Sh STANDARDS
index 1b471664e32d524573f37a5c76f2e5c64fb00365..b4fcfa3e8d921c770f573e8df978b6ffd85db2cc 100644 (file)
@@ -47,7 +47,7 @@
 .Sh DESCRIPTION
 The
 .Fn ispunct
-function tests for any printing character except for space
+function tests for any printing character, except for space
 .Pq Ql "\ "
 or a
 character for which
@@ -59,7 +59,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
@@ -87,6 +87,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswpunct 3 ,
 .Xr ascii 7
 .Sh STANDARDS
diff --git a/locale/FreeBSD/ispunct.3.patch b/locale/FreeBSD/ispunct.3.patch
deleted file mode 100644 (file)
index d59803f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- ispunct.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ ispunct.3  2009-11-10 13:17:02.000000000 -0800
-@@ -47,7 +47,7 @@
- .Sh DESCRIPTION
- The
- .Fn ispunct
--function tests for any printing character except for space
-+function tests for any printing character, except for space
- .Pq Ql "\ "
- or a
- character for which
-@@ -59,7 +59,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
-@@ -87,6 +87,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswpunct 3 ,
- .Xr ascii 7
- .Sh STANDARDS
index e474f3e56f1c6312c25bde22390201c6972c4dab..a98a1599f6782a9795b7a85ce20bd1adb0daf794 100644 (file)
@@ -55,7 +55,8 @@ returns non-zero if the character tests true.
 .Xr ctype 3 ,
 .Xr isascii 3 ,
 .Xr iswrune 3 ,
-.Xr ascii 7
+.Xr ascii 7 ,
+.Xr isalnum_l
 .Sh HISTORY
 The
 .Fn isrune
diff --git a/locale/FreeBSD/isrune.3.patch b/locale/FreeBSD/isrune.3.patch
deleted file mode 100644 (file)
index b268fac..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- isrune.3.orig      2009-11-09 15:05:25.000000000 -0800
-+++ isrune.3   2009-11-09 15:05:26.000000000 -0800
-@@ -55,7 +55,8 @@ returns non-zero if the character tests 
- .Xr ctype 3 ,
- .Xr isascii 3 ,
- .Xr iswrune 3 ,
--.Xr ascii 7
-+.Xr ascii 7 ,
-+.Xr isalnum_l
- .Sh HISTORY
- The
- .Fn isrune
index 46588ec8034da075bcc391f4fe8c391999277ab3..f6fa79a43dc3f24d95c68bbd5dc25abe41c77e97 100644 (file)
@@ -54,9 +54,9 @@ For any locale, this includes the following standard characters:
 .It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''"
 .El
 .Pp
-In the "C" locale
+In the "C" locale,
 .Fn isspace
-successful test is limited to this characters only.
+successful test is limited to these characters only.
 The value of the argument must be representable as an
 .Vt "unsigned char"
 or the value of
@@ -78,6 +78,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswspace 3 ,
 .Xr multibyte 3 ,
 .Xr ascii 7
diff --git a/locale/FreeBSD/isspace.3.patch b/locale/FreeBSD/isspace.3.patch
deleted file mode 100644 (file)
index d1a8f9a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- isspace.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ isspace.3  2009-11-10 13:45:41.000000000 -0800
-@@ -54,9 +54,9 @@ For any locale, this includes the follow
- .It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''"
- .El
- .Pp
--In the "C" locale
-+In the "C" locale,
- .Fn isspace
--successful test is limited to this characters only.
-+successful test is limited to these characters only.
- The value of the argument must be representable as an
- .Vt "unsigned char"
- or the value of
-@@ -78,6 +78,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswspace 3 ,
- .Xr multibyte 3 ,
- .Xr ascii 7
index f356b4a30aa9f8030e8375f84209f0417fbdf538..0a0ab37e26c485721b81f9d02a0d56adfd5828c7 100644 (file)
@@ -48,7 +48,8 @@ function returns zero if the character tests false and
 returns non-zero if the character tests true.
 .Sh SEE ALSO
 .Xr ctype 3 ,
-.Xr iswspecial 3
+.Xr iswspecial 3 ,
+.Xr isalnum_l
 .Sh HISTORY
 The
 .Fn isspecial
diff --git a/locale/FreeBSD/isspecial.3.patch b/locale/FreeBSD/isspecial.3.patch
deleted file mode 100644 (file)
index d427920..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- isspecial.3.orig   2009-11-09 15:05:25.000000000 -0800
-+++ isspecial.3        2009-11-09 15:05:26.000000000 -0800
-@@ -48,7 +48,8 @@ function returns zero if the character t
- returns non-zero if the character tests true.
- .Sh SEE ALSO
- .Xr ctype 3 ,
--.Xr iswspecial 3
-+.Xr iswspecial 3 ,
-+.Xr isalnum_l
- .Sh HISTORY
- The
- .Fn isspecial
index 3d84bef3df7669cae8c0f97624745d6e0751a7bf..c3274c6251364232d6a74354b8c517e20f4df0f2 100644 (file)
@@ -54,7 +54,7 @@ or the value of
 .Dv EOF .
 .Pp
 In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
+(preceded by their numeric values, in octal):
 .Pp
 .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
 .It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
@@ -81,6 +81,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswupper 3 ,
 .Xr toupper 3 ,
 .Xr ascii 7
diff --git a/locale/FreeBSD/isupper.3.patch b/locale/FreeBSD/isupper.3.patch
deleted file mode 100644 (file)
index 3cd6e29..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- isupper.3.bsdnew   2009-11-10 13:13:10.000000000 -0800
-+++ isupper.3  2009-11-10 13:48:09.000000000 -0800
-@@ -54,7 +54,7 @@ or the value of
- .Dv EOF .
- .Pp
- In the ASCII character set, this includes the following characters
--(with their numeric values shown in octal):
-+(preceded by their numeric values, in octal):
- .Pp
- .Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
- .It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
-@@ -81,6 +81,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswupper 3 ,
- .Xr toupper 3 ,
- .Xr ascii 7
index f50a1b5f09364ed636dd2c85b69b25e40489f361..d501ea9ce49c67844c8431f9dcf37df9fa16faf8 100644 (file)
@@ -107,9 +107,15 @@ for use with wide characters
 or
 .Vt wint_t ) .
 See the description for the similarly-named single byte classification
-functions (like
+functions (such as
 .Xr isalnum 3 ) ,
 for details.
+.Pp
+Extended locale versions of these functions are documented in
+.Xr iswalnum_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The functions return zero if the character tests false and
 return non-zero if the character tests true.
@@ -132,6 +138,7 @@ return non-zero if the character tests true.
 .Xr isspace 3 ,
 .Xr isspecial 3 ,
 .Xr isupper 3 ,
+.Xr iswalnum_l 3 ,
 .Xr isxdigit 3 ,
 .Xr wctype 3
 .Sh STANDARDS
@@ -143,7 +150,7 @@ except
 .Fn iswideogram ,
 .Fn iswnumber ,
 .Fn iswphonogram ,
-.Fn iswrune
+.Fn iswrune ,
 and
 .Fn iswspecial ,
 which are
diff --git a/locale/FreeBSD/iswalnum.3.patch b/locale/FreeBSD/iswalnum.3.patch
deleted file mode 100644 (file)
index bedec9e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---- iswalnum.3.orig    2009-11-09 15:05:25.000000000 -0800
-+++ iswalnum.3 2009-11-09 15:05:26.000000000 -0800
-@@ -107,9 +107,15 @@ for use with wide characters
- or
- .Vt wint_t ) .
- See the description for the similarly-named single byte classification
--functions (like
-+functions (such as
- .Xr isalnum 3 ) ,
- for details.
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr iswalnum_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The functions return zero if the character tests false and
- return non-zero if the character tests true.
-@@ -132,6 +138,7 @@ return non-zero if the character tests t
- .Xr isspace 3 ,
- .Xr isspecial 3 ,
- .Xr isupper 3 ,
-+.Xr iswalnum_l 3 ,
- .Xr isxdigit 3 ,
- .Xr wctype 3
- .Sh STANDARDS
-@@ -143,7 +150,7 @@ except
- .Fn iswideogram ,
- .Fn iswnumber ,
- .Fn iswphonogram ,
--.Fn iswrune
-+.Fn iswrune ,
- and
- .Fn iswspecial ,
- which are
index 7315a655106d85a48ad9735699699fae4629d91d..b1c2faad65c1691a2fb0976e2c425ee4e33ff4fb 100644 (file)
@@ -88,6 +88,7 @@ The
 function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
+.Xr isalnum_l 3 ,
 .Xr iswxdigit 3 ,
 .Xr ascii 7
 .Sh STANDARDS
diff --git a/locale/FreeBSD/isxdigit.3.patch b/locale/FreeBSD/isxdigit.3.patch
deleted file mode 100644 (file)
index 4c5e7f0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- isxdigit.3.bsdnew  2009-11-10 13:13:11.000000000 -0800
-+++ isxdigit.3 2009-11-10 13:48:37.000000000 -0800
-@@ -88,6 +88,7 @@ The
- function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
-+.Xr isalnum_l 3 ,
- .Xr iswxdigit 3 ,
- .Xr ascii 7
- .Sh STANDARDS
index 932165ff67e42e3516b2f96e2a1312ff0d23fb01..6a08e150f05fd5b4583aa5bfa8bdf6883581df56 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.15 2004/04/25 19:56:50 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -44,9 +46,9 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.15 2004/04/25 19:56:50 ache
 
 static int split_lines(char *, const char *);
 
-int
+__private_extern__ int
 __part_load_locale(const char *name,
-               int *using_locale,
+               unsigned char *using_locale,
                char **locale_buf,
                const char *category_filename,
                int locale_buf_size_max,
@@ -60,20 +62,6 @@ __part_load_locale(const char *name,
        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 the locale name is the same as our cache, use the cache.
-        */
-       if (*locale_buf != NULL && strcmp(name, *locale_buf) == 0) {
-               *using_locale = 1;
-               return (_LDP_CACHE);
-       }
-
        /*
         * Slurp the locale file into the cache.
         */
@@ -115,9 +103,7 @@ __part_load_locale(const char *name,
        num_lines = split_lines(p, plim);
        if (num_lines >= locale_buf_size_max)
                num_lines = locale_buf_size_max;
-       else if (num_lines >= locale_buf_size_min)
-               num_lines = locale_buf_size_min;
-       else {
+       else if (num_lines < locale_buf_size_min) {
                errno = EFTYPE;
                goto bad_lbuf;
        }
@@ -164,3 +150,9 @@ split_lines(char *p, const char *plim)
        return (i);
 }
 
+__private_extern__ void
+__ldpart_free_extra(struct __xlocale_st_ldpart *lp)
+{
+       if (lp)
+               free(lp->_locale_buf);
+}
diff --git a/locale/FreeBSD/ldpart.c.patch b/locale/FreeBSD/ldpart.c.patch
deleted file mode 100644 (file)
index ddfe6ea..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
---- ldpart.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ ldpart.c   2009-11-09 15:05:25.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.15 2004/04/25 19:56:50 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <sys/types.h>
- #include <sys/stat.h>
-@@ -44,9 +46,9 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- static int split_lines(char *, const char *);
--int
-+__private_extern__ int
- __part_load_locale(const char *name,
--              int *using_locale,
-+              unsigned char *using_locale,
-               char **locale_buf,
-               const char *category_filename,
-               int locale_buf_size_max,
-@@ -60,20 +62,6 @@ __part_load_locale(const char *name,
-       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 the locale name is the same as our cache, use the cache.
--       */
--      if (*locale_buf != NULL && strcmp(name, *locale_buf) == 0) {
--              *using_locale = 1;
--              return (_LDP_CACHE);
--      }
--
-       /*
-        * Slurp the locale file into the cache.
-        */
-@@ -115,9 +103,7 @@ __part_load_locale(const char *name,
-       num_lines = split_lines(p, plim);
-       if (num_lines >= locale_buf_size_max)
-               num_lines = locale_buf_size_max;
--      else if (num_lines >= locale_buf_size_min)
--              num_lines = locale_buf_size_min;
--      else {
-+      else if (num_lines < locale_buf_size_min) {
-               errno = EFTYPE;
-               goto bad_lbuf;
-       }
-@@ -164,3 +150,9 @@ split_lines(char *p, const char *plim)
-       return (i);
- }
-+__private_extern__ void
-+__ldpart_free_extra(struct __xlocale_st_ldpart *lp)
-+{
-+      if (lp)
-+              free(lp->_locale_buf);
-+}
index 02e0c9502b09a062131ecda8c2ace0ab16a939a4..938f735bc7b08f81505e4608f28378256d8baa97 100644 (file)
@@ -33,7 +33,7 @@
 #define _LDP_ERROR  (-1)
 #define _LDP_CACHE  1
 
-int    __part_load_locale(const char *, int*, char **, const char *,
+int    __part_load_locale(const char *, unsigned char *, char **, const char *,
                    int, int, const char **);
 
 #endif /* !_LDPART_H_ */
diff --git a/locale/FreeBSD/ldpart.h.patch b/locale/FreeBSD/ldpart.h.patch
deleted file mode 100644 (file)
index e15d894..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- ldpart.h.orig      2009-11-09 15:05:25.000000000 -0800
-+++ ldpart.h   2009-11-09 15:05:25.000000000 -0800
-@@ -33,7 +33,7 @@
- #define _LDP_ERROR  (-1)
- #define _LDP_CACHE  1
--int   __part_load_locale(const char *, int*, char **, const char *,
-+int   __part_load_locale(const char *, unsigned char *, char **, const char *,
-                   int, int, const char **);
- #endif /* !_LDPART_H_ */
index 488b5728c332fdc2e8952cd8c1e921ebaddb8951..2874ca6c3a9f444e14bdcffdda423b94c856eb5c 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.14 2003/06/26 10:46:16 phantom Exp $");
 
+#include "xlocale_private.h"
+
 #include <stddef.h>
+#include <string.h>
 
 #include "ldpart.h"
 #include "lmessages.h"
@@ -45,47 +48,76 @@ static const struct lc_messages_T _C_messages_locale = {
        "no"            /* nostr */
 };
 
-static struct lc_messages_T _messages_locale;
-static int     _messages_using_locale;
-static char    *_messages_locale_buf;
-
-int
-__messages_load_locale(const char *name)
+__private_extern__ int
+__messages_load_locale(const char *name, locale_t loc)
 {
        int ret;
+       struct __xlocale_st_messages *xp;
+       static struct __xlocale_st_messages *cache = NULL;
+
+       /* 'name' must be already checked. */
+       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+               loc->_messages_using_locale = 0;
+               XL_RELEASE(loc->__lc_messages);
+               loc->__lc_messages = NULL;
+               return (_LDP_CACHE);
+       }
 
-       ret = __part_load_locale(name, &_messages_using_locale,
-                 &_messages_locale_buf, "LC_MESSAGES",
+       /*
+        * If the locale name is the same as our cache, use the cache.
+        */
+       if (cache && cache->_messages_locale_buf && strcmp(name, cache->_messages_locale_buf) == 0) {
+               loc->_messages_using_locale = 1;
+               XL_RELEASE(loc->__lc_messages);
+               loc->__lc_messages = cache;
+               XL_RETAIN(loc->__lc_messages);
+               return (_LDP_CACHE);
+       }
+       if ((xp = (struct __xlocale_st_messages *)malloc(sizeof(*xp))) == NULL)
+               return _LDP_ERROR;
+       xp->__refcount = 1;
+       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
+       xp->_messages_locale_buf = NULL;
+
+       ret = __part_load_locale(name, &loc->_messages_using_locale,
+                 &xp->_messages_locale_buf, "LC_MESSAGES/LC_MESSAGES",
                  LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
-                 (const char **)&_messages_locale);
+                 (const char **)&xp->_messages_locale);
        if (ret == _LDP_LOADED) {
-               if (_messages_locale.yesstr == NULL)
-                       _messages_locale.yesstr = empty;
-               if (_messages_locale.nostr == NULL)
-                       _messages_locale.nostr = empty;
-       }
+               if (xp->_messages_locale.yesstr == NULL)
+                       xp->_messages_locale.yesstr = empty;
+               if (xp->_messages_locale.nostr == NULL)
+                       xp->_messages_locale.nostr = empty;
+               XL_RELEASE(loc->__lc_messages);
+               loc->__lc_messages = xp;
+               XL_RELEASE(cache);
+               cache = xp;
+               XL_RETAIN(cache);
+       } else if (ret == _LDP_ERROR)
+               free(xp);
        return (ret);
 }
 
-struct lc_messages_T *
-__get_current_messages_locale(void)
+__private_extern__ struct lc_messages_T *
+__get_current_messages_locale(locale_t loc)
 {
-       return (_messages_using_locale
-               ? &_messages_locale
+       return (loc->_messages_using_locale
+               ? &loc->__lc_messages->_messages_locale
                : (struct lc_messages_T *)&_C_messages_locale);
 }
 
 #ifdef LOCALE_DEBUG
 void
 msgdebug() {
+locale_t loc = __current_locale();
 printf(        "yesexpr = %s\n"
        "noexpr = %s\n"
        "yesstr = %s\n"
        "nostr = %s\n",
-       _messages_locale.yesexpr,
-       _messages_locale.noexpr,
-       _messages_locale.yesstr,
-       _messages_locale.nostr
+       loc->__lc_messages->_messages_locale.yesexpr,
+       loc->__lc_messages->_messages_locale.noexpr,
+       loc->__lc_messages->_messages_locale.yesstr,
+       loc->__lc_messages->_messages_locale.nostr
 );
 }
 #endif /* LOCALE_DEBUG */
diff --git a/locale/FreeBSD/lmessages.c.patch b/locale/FreeBSD/lmessages.c.patch
deleted file mode 100644 (file)
index 459c0ee..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
---- lmessages.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ lmessages.c        2009-11-09 15:05:25.000000000 -0800
-@@ -27,7 +27,10 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.14 2003/06/26 10:46:16 phantom Exp $");
-+#include "xlocale_private.h"
-+
- #include <stddef.h>
-+#include <string.h>
- #include "ldpart.h"
- #include "lmessages.h"
-@@ -45,47 +48,76 @@ static const struct lc_messages_T _C_mes
-       "no"            /* nostr */
- };
--static struct lc_messages_T _messages_locale;
--static int    _messages_using_locale;
--static char   *_messages_locale_buf;
--
--int
--__messages_load_locale(const char *name)
-+__private_extern__ int
-+__messages_load_locale(const char *name, locale_t loc)
- {
-       int ret;
-+      struct __xlocale_st_messages *xp;
-+      static struct __xlocale_st_messages *cache = NULL;
-+
-+      /* 'name' must be already checked. */
-+      if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-+              loc->_messages_using_locale = 0;
-+              XL_RELEASE(loc->__lc_messages);
-+              loc->__lc_messages = NULL;
-+              return (_LDP_CACHE);
-+      }
--      ret = __part_load_locale(name, &_messages_using_locale,
--                &_messages_locale_buf, "LC_MESSAGES",
-+      /*
-+       * If the locale name is the same as our cache, use the cache.
-+       */
-+      if (cache && cache->_messages_locale_buf && strcmp(name, cache->_messages_locale_buf) == 0) {
-+              loc->_messages_using_locale = 1;
-+              XL_RELEASE(loc->__lc_messages);
-+              loc->__lc_messages = cache;
-+              XL_RETAIN(loc->__lc_messages);
-+              return (_LDP_CACHE);
-+      }
-+      if ((xp = (struct __xlocale_st_messages *)malloc(sizeof(*xp))) == NULL)
-+              return _LDP_ERROR;
-+      xp->__refcount = 1;
-+      xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-+      xp->_messages_locale_buf = NULL;
-+
-+      ret = __part_load_locale(name, &loc->_messages_using_locale,
-+                &xp->_messages_locale_buf, "LC_MESSAGES/LC_MESSAGES",
-                 LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
--                (const char **)&_messages_locale);
-+                (const char **)&xp->_messages_locale);
-       if (ret == _LDP_LOADED) {
--              if (_messages_locale.yesstr == NULL)
--                      _messages_locale.yesstr = empty;
--              if (_messages_locale.nostr == NULL)
--                      _messages_locale.nostr = empty;
--      }
-+              if (xp->_messages_locale.yesstr == NULL)
-+                      xp->_messages_locale.yesstr = empty;
-+              if (xp->_messages_locale.nostr == NULL)
-+                      xp->_messages_locale.nostr = empty;
-+              XL_RELEASE(loc->__lc_messages);
-+              loc->__lc_messages = xp;
-+              XL_RELEASE(cache);
-+              cache = xp;
-+              XL_RETAIN(cache);
-+      } else if (ret == _LDP_ERROR)
-+              free(xp);
-       return (ret);
- }
--struct lc_messages_T *
--__get_current_messages_locale(void)
-+__private_extern__ struct lc_messages_T *
-+__get_current_messages_locale(locale_t loc)
- {
--      return (_messages_using_locale
--              ? &_messages_locale
-+      return (loc->_messages_using_locale
-+              ? &loc->__lc_messages->_messages_locale
-               : (struct lc_messages_T *)&_C_messages_locale);
- }
- #ifdef LOCALE_DEBUG
- void
- msgdebug() {
-+locale_t loc = __current_locale();
- printf(       "yesexpr = %s\n"
-       "noexpr = %s\n"
-       "yesstr = %s\n"
-       "nostr = %s\n",
--      _messages_locale.yesexpr,
--      _messages_locale.noexpr,
--      _messages_locale.yesstr,
--      _messages_locale.nostr
-+      loc->__lc_messages->_messages_locale.yesexpr,
-+      loc->__lc_messages->_messages_locale.noexpr,
-+      loc->__lc_messages->_messages_locale.yesstr,
-+      loc->__lc_messages->_messages_locale.nostr
- );
- }
- #endif /* LOCALE_DEBUG */
index ee690ae7c1cc82711fbce8b26792a22a41d084bb..47f08a914586282a7d88d188c26ce7ae282ae77d 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _LMESSAGES_H_
 #define        _LMESSAGES_H_
 
+#include <xlocale.h>
+
 struct lc_messages_T {
        const char      *yesexpr;
        const char      *noexpr;
@@ -36,7 +38,7 @@ struct        lc_messages_T {
        const char      *nostr;
 };
 
-struct lc_messages_T *__get_current_messages_locale(void);
-int    __messages_load_locale(const char *);
+struct lc_messages_T *__get_current_messages_locale(locale_t);
+int    __messages_load_locale(const char *, locale_t);
 
 #endif /* !_LMESSAGES_H_ */
diff --git a/locale/FreeBSD/lmessages.h.patch b/locale/FreeBSD/lmessages.h.patch
deleted file mode 100644 (file)
index 601ac82..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- lmessages.h.orig   2009-11-09 15:05:25.000000000 -0800
-+++ lmessages.h        2009-11-09 15:05:25.000000000 -0800
-@@ -29,6 +29,8 @@
- #ifndef _LMESSAGES_H_
- #define       _LMESSAGES_H_
-+#include <xlocale.h>
-+
- struct        lc_messages_T {
-       const char      *yesexpr;
-       const char      *noexpr;
-@@ -36,7 +38,7 @@ struct       lc_messages_T {
-       const char      *nostr;
- };
--struct lc_messages_T *__get_current_messages_locale(void);
--int   __messages_load_locale(const char *);
-+struct lc_messages_T *__get_current_messages_locale(locale_t);
-+int   __messages_load_locale(const char *, locale_t);
- #endif /* !_LMESSAGES_H_ */
index e3e709585c3237c5c8a6b1e38870f9f9a756bd45..24091eaf5d3953be8c94b8c81515af60845163e5 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.19 2003/06/26 10:46:16 phantom Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "ldpart.h"
 #include "lmonetary.h"
 
-extern int __mlocale_changed;
 extern const char * __fix_locale_grouping_str(const char *);
 
 #define LCMONETARY_SIZE_FULL (sizeof(struct lc_monetary_T) / sizeof(char *))
@@ -50,7 +52,7 @@ static const struct lc_monetary_T _C_monetary_locale = {
        empty,          /* currency_symbol */
        empty,          /* mon_decimal_point */
        empty,          /* mon_thousands_sep */
-       numempty,       /* mon_grouping */
+       empty,          /* mon_grouping [C99 7.11.2.1]*/
        empty,          /* positive_sign */
        empty,          /* negative_sign */
        numempty,       /* int_frac_digits */
@@ -69,10 +71,6 @@ static const struct lc_monetary_T _C_monetary_locale = {
        numempty        /* int_n_sign_posn */
 };
 
-static struct lc_monetary_T _monetary_locale;
-static int     _monetary_using_locale;
-static char    *_monetary_locale_buf;
-
 static char
 cnv(const char *str)
 {
@@ -83,23 +81,57 @@ cnv(const char *str)
        return ((char)i);
 }
 
-int
-__monetary_load_locale(const char *name)
+__private_extern__ int
+__monetary_load_locale(const char *name, locale_t loc)
 {
        int ret;
+       struct __xlocale_st_monetary *xp;
+       static struct __xlocale_st_monetary *cache = NULL;
+
+       /* 'name' must be already checked. */
+       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+               if (!loc->_monetary_using_locale)
+                       return (_LDP_CACHE);
+               loc->_monetary_using_locale = 0;
+               XL_RELEASE(loc->__lc_monetary);
+               loc->__lc_monetary = NULL;
+               loc->__mlocale_changed = 1;
+               return (_LDP_CACHE);
+       }
 
-       ret = __part_load_locale(name, &_monetary_using_locale,
-               &_monetary_locale_buf, "LC_MONETARY",
+       if (loc->_monetary_using_locale && strcmp(name, loc->__lc_monetary->_monetary_locale_buf) == 0)
+               return (_LDP_CACHE);
+       /*
+        * If the locale name is the same as our cache, use the cache.
+        */
+       if (cache && cache->_monetary_locale_buf && strcmp(name, cache->_monetary_locale_buf) == 0) {
+               loc->_monetary_using_locale = 1;
+               XL_RELEASE(loc->__lc_monetary);
+               loc->__lc_monetary = cache;
+               XL_RETAIN(loc->__lc_monetary);
+               loc->__mlocale_changed = 1;
+               return (_LDP_CACHE);
+       }
+       if ((xp = (struct __xlocale_st_monetary *)malloc(sizeof(*xp))) == NULL)
+               return _LDP_ERROR;
+       xp->__refcount = 1;
+       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
+       xp->_monetary_locale_buf = NULL;
+
+       ret = __part_load_locale(name, &loc->_monetary_using_locale,
+               &xp->_monetary_locale_buf, "LC_MONETARY",
                LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN,
-               (const char **)&_monetary_locale);
+               (const char **)&xp->_monetary_locale);
        if (ret != _LDP_ERROR)
-               __mlocale_changed = 1;
+               loc->__mlocale_changed = 1;
+       else
+               free(xp);
        if (ret == _LDP_LOADED) {
-               _monetary_locale.mon_grouping =
-                    __fix_locale_grouping_str(_monetary_locale.mon_grouping);
+               xp->_monetary_locale.mon_grouping =
+                    __fix_locale_grouping_str(xp->_monetary_locale.mon_grouping);
 
-#define M_ASSIGN_CHAR(NAME) (((char *)_monetary_locale.NAME)[0] = \
-                            cnv(_monetary_locale.NAME))
+#define M_ASSIGN_CHAR(NAME) (((char *)xp->_monetary_locale.NAME)[0] = \
+                            cnv(xp->_monetary_locale.NAME))
 
                M_ASSIGN_CHAR(int_frac_digits);
                M_ASSIGN_CHAR(frac_digits);
@@ -117,9 +149,9 @@ __monetary_load_locale(const char *name)
                 */
 #define        M_ASSIGN_ICHAR(NAME)                                            \
                do {                                                    \
-                       if (_monetary_locale.int_##NAME == NULL)        \
-                               _monetary_locale.int_##NAME =           \
-                                   _monetary_locale.NAME;              \
+                       if (xp->_monetary_locale.int_##NAME == NULL)    \
+                               xp->_monetary_locale.int_##NAME =       \
+                                   xp->_monetary_locale.NAME;          \
                        else                                            \
                                M_ASSIGN_CHAR(int_##NAME);              \
                } while (0)
@@ -130,21 +162,27 @@ __monetary_load_locale(const char *name)
                M_ASSIGN_ICHAR(n_sep_by_space);
                M_ASSIGN_ICHAR(p_sign_posn);
                M_ASSIGN_ICHAR(n_sign_posn);
+               XL_RELEASE(loc->__lc_monetary);
+               loc->__lc_monetary = xp;
+               XL_RELEASE(cache);
+               cache = xp;
+               XL_RETAIN(cache);
        }
        return (ret);
 }
 
-struct lc_monetary_T *
-__get_current_monetary_locale(void)
+__private_extern__ struct lc_monetary_T *
+__get_current_monetary_locale(locale_t loc)
 {
-       return (_monetary_using_locale
-               ? &_monetary_locale
+       return (loc->_monetary_using_locale
+               ? &loc->__lc_monetary->_monetary_locale
                : (struct lc_monetary_T *)&_C_monetary_locale);
 }
 
 #ifdef LOCALE_DEBUG
 void
 monetdebug() {
+locale_t loc = __current_locale();
 printf(        "int_curr_symbol = %s\n"
        "currency_symbol = %s\n"
        "mon_decimal_point = %s\n"
@@ -166,27 +204,27 @@ printf(   "int_curr_symbol = %s\n"
        "int_n_sep_by_space = %d\n"
        "int_p_sign_posn = %d\n"
        "int_n_sign_posn = %d\n",
-       _monetary_locale.int_curr_symbol,
-       _monetary_locale.currency_symbol,
-       _monetary_locale.mon_decimal_point,
-       _monetary_locale.mon_thousands_sep,
-       _monetary_locale.mon_grouping,
-       _monetary_locale.positive_sign,
-       _monetary_locale.negative_sign,
-       _monetary_locale.int_frac_digits[0],
-       _monetary_locale.frac_digits[0],
-       _monetary_locale.p_cs_precedes[0],
-       _monetary_locale.p_sep_by_space[0],
-       _monetary_locale.n_cs_precedes[0],
-       _monetary_locale.n_sep_by_space[0],
-       _monetary_locale.p_sign_posn[0],
-       _monetary_locale.n_sign_posn[0],
-       _monetary_locale.int_p_cs_precedes[0],
-       _monetary_locale.int_p_sep_by_space[0],
-       _monetary_locale.int_n_cs_precedes[0],
-       _monetary_locale.int_n_sep_by_space[0],
-       _monetary_locale.int_p_sign_posn[0],
-       _monetary_locale.int_n_sign_posn[0]
+       loc->__lc_monetary->_monetary_locale.int_curr_symbol,
+       loc->__lc_monetary->_monetary_locale.currency_symbol,
+       loc->__lc_monetary->_monetary_locale.mon_decimal_point,
+       loc->__lc_monetary->_monetary_locale.mon_thousands_sep,
+       loc->__lc_monetary->_monetary_locale.mon_grouping,
+       loc->__lc_monetary->_monetary_locale.positive_sign,
+       loc->__lc_monetary->_monetary_locale.negative_sign,
+       loc->__lc_monetary->_monetary_locale.int_frac_digits[0],
+       loc->__lc_monetary->_monetary_locale.frac_digits[0],
+       loc->__lc_monetary->_monetary_locale.p_cs_precedes[0],
+       loc->__lc_monetary->_monetary_locale.p_sep_by_space[0],
+       loc->__lc_monetary->_monetary_locale.n_cs_precedes[0],
+       loc->__lc_monetary->_monetary_locale.n_sep_by_space[0],
+       loc->__lc_monetary->_monetary_locale.p_sign_posn[0],
+       loc->__lc_monetary->_monetary_locale.n_sign_posn[0],
+       loc->__lc_monetary->_monetary_locale.int_p_cs_precedes[0],
+       loc->__lc_monetary->_monetary_locale.int_p_sep_by_space[0],
+       loc->__lc_monetary->_monetary_locale.int_n_cs_precedes[0],
+       loc->__lc_monetary->_monetary_locale.int_n_sep_by_space[0],
+       loc->__lc_monetary->_monetary_locale.int_p_sign_posn[0],
+       loc->__lc_monetary->_monetary_locale.int_n_sign_posn[0]
 );
 }
 #endif /* LOCALE_DEBUG */
diff --git a/locale/FreeBSD/lmonetary.c.patch b/locale/FreeBSD/lmonetary.c.patch
deleted file mode 100644 (file)
index 4014d5b..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
---- lmonetary.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ lmonetary.c        2009-11-09 15:05:25.000000000 -0800
-@@ -27,14 +27,16 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.19 2003/06/26 10:46:16 phantom Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stddef.h>
- #include <stdlib.h>
-+#include <string.h>
- #include "ldpart.h"
- #include "lmonetary.h"
--extern int __mlocale_changed;
- extern const char * __fix_locale_grouping_str(const char *);
- #define LCMONETARY_SIZE_FULL (sizeof(struct lc_monetary_T) / sizeof(char *))
-@@ -50,7 +52,7 @@ static const struct lc_monetary_T _C_mon
-       empty,          /* currency_symbol */
-       empty,          /* mon_decimal_point */
-       empty,          /* mon_thousands_sep */
--      numempty,       /* mon_grouping */
-+      empty,          /* mon_grouping [C99 7.11.2.1]*/
-       empty,          /* positive_sign */
-       empty,          /* negative_sign */
-       numempty,       /* int_frac_digits */
-@@ -69,10 +71,6 @@ static const struct lc_monetary_T _C_mon
-       numempty        /* int_n_sign_posn */
- };
--static struct lc_monetary_T _monetary_locale;
--static int    _monetary_using_locale;
--static char   *_monetary_locale_buf;
--
- static char
- cnv(const char *str)
- {
-@@ -83,23 +81,57 @@ cnv(const char *str)
-       return ((char)i);
- }
--int
--__monetary_load_locale(const char *name)
-+__private_extern__ int
-+__monetary_load_locale(const char *name, locale_t loc)
- {
-       int ret;
-+      struct __xlocale_st_monetary *xp;
-+      static struct __xlocale_st_monetary *cache = NULL;
-+
-+      /* 'name' must be already checked. */
-+      if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-+              if (!loc->_monetary_using_locale)
-+                      return (_LDP_CACHE);
-+              loc->_monetary_using_locale = 0;
-+              XL_RELEASE(loc->__lc_monetary);
-+              loc->__lc_monetary = NULL;
-+              loc->__mlocale_changed = 1;
-+              return (_LDP_CACHE);
-+      }
-+
-+      if (loc->_monetary_using_locale && strcmp(name, loc->__lc_monetary->_monetary_locale_buf) == 0)
-+              return (_LDP_CACHE);
-+      /*
-+       * If the locale name is the same as our cache, use the cache.
-+       */
-+      if (cache && cache->_monetary_locale_buf && strcmp(name, cache->_monetary_locale_buf) == 0) {
-+              loc->_monetary_using_locale = 1;
-+              XL_RELEASE(loc->__lc_monetary);
-+              loc->__lc_monetary = cache;
-+              XL_RETAIN(loc->__lc_monetary);
-+              loc->__mlocale_changed = 1;
-+              return (_LDP_CACHE);
-+      }
-+      if ((xp = (struct __xlocale_st_monetary *)malloc(sizeof(*xp))) == NULL)
-+              return _LDP_ERROR;
-+      xp->__refcount = 1;
-+      xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-+      xp->_monetary_locale_buf = NULL;
--      ret = __part_load_locale(name, &_monetary_using_locale,
--              &_monetary_locale_buf, "LC_MONETARY",
-+      ret = __part_load_locale(name, &loc->_monetary_using_locale,
-+              &xp->_monetary_locale_buf, "LC_MONETARY",
-               LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN,
--              (const char **)&_monetary_locale);
-+              (const char **)&xp->_monetary_locale);
-       if (ret != _LDP_ERROR)
--              __mlocale_changed = 1;
-+              loc->__mlocale_changed = 1;
-+      else
-+              free(xp);
-       if (ret == _LDP_LOADED) {
--              _monetary_locale.mon_grouping =
--                   __fix_locale_grouping_str(_monetary_locale.mon_grouping);
-+              xp->_monetary_locale.mon_grouping =
-+                   __fix_locale_grouping_str(xp->_monetary_locale.mon_grouping);
--#define M_ASSIGN_CHAR(NAME) (((char *)_monetary_locale.NAME)[0] = \
--                           cnv(_monetary_locale.NAME))
-+#define M_ASSIGN_CHAR(NAME) (((char *)xp->_monetary_locale.NAME)[0] = \
-+                           cnv(xp->_monetary_locale.NAME))
-               M_ASSIGN_CHAR(int_frac_digits);
-               M_ASSIGN_CHAR(frac_digits);
-@@ -117,9 +149,9 @@ __monetary_load_locale(const char *name)
-                */
- #define       M_ASSIGN_ICHAR(NAME)                                            \
-               do {                                                    \
--                      if (_monetary_locale.int_##NAME == NULL)        \
--                              _monetary_locale.int_##NAME =           \
--                                  _monetary_locale.NAME;              \
-+                      if (xp->_monetary_locale.int_##NAME == NULL)    \
-+                              xp->_monetary_locale.int_##NAME =       \
-+                                  xp->_monetary_locale.NAME;          \
-                       else                                            \
-                               M_ASSIGN_CHAR(int_##NAME);              \
-               } while (0)
-@@ -130,21 +162,27 @@ __monetary_load_locale(const char *name)
-               M_ASSIGN_ICHAR(n_sep_by_space);
-               M_ASSIGN_ICHAR(p_sign_posn);
-               M_ASSIGN_ICHAR(n_sign_posn);
-+              XL_RELEASE(loc->__lc_monetary);
-+              loc->__lc_monetary = xp;
-+              XL_RELEASE(cache);
-+              cache = xp;
-+              XL_RETAIN(cache);
-       }
-       return (ret);
- }
--struct lc_monetary_T *
--__get_current_monetary_locale(void)
-+__private_extern__ struct lc_monetary_T *
-+__get_current_monetary_locale(locale_t loc)
- {
--      return (_monetary_using_locale
--              ? &_monetary_locale
-+      return (loc->_monetary_using_locale
-+              ? &loc->__lc_monetary->_monetary_locale
-               : (struct lc_monetary_T *)&_C_monetary_locale);
- }
- #ifdef LOCALE_DEBUG
- void
- monetdebug() {
-+locale_t loc = __current_locale();
- printf(       "int_curr_symbol = %s\n"
-       "currency_symbol = %s\n"
-       "mon_decimal_point = %s\n"
-@@ -166,27 +204,27 @@ printf(  "int_curr_symbol = %s\n"
-       "int_n_sep_by_space = %d\n"
-       "int_p_sign_posn = %d\n"
-       "int_n_sign_posn = %d\n",
--      _monetary_locale.int_curr_symbol,
--      _monetary_locale.currency_symbol,
--      _monetary_locale.mon_decimal_point,
--      _monetary_locale.mon_thousands_sep,
--      _monetary_locale.mon_grouping,
--      _monetary_locale.positive_sign,
--      _monetary_locale.negative_sign,
--      _monetary_locale.int_frac_digits[0],
--      _monetary_locale.frac_digits[0],
--      _monetary_locale.p_cs_precedes[0],
--      _monetary_locale.p_sep_by_space[0],
--      _monetary_locale.n_cs_precedes[0],
--      _monetary_locale.n_sep_by_space[0],
--      _monetary_locale.p_sign_posn[0],
--      _monetary_locale.n_sign_posn[0],
--      _monetary_locale.int_p_cs_precedes[0],
--      _monetary_locale.int_p_sep_by_space[0],
--      _monetary_locale.int_n_cs_precedes[0],
--      _monetary_locale.int_n_sep_by_space[0],
--      _monetary_locale.int_p_sign_posn[0],
--      _monetary_locale.int_n_sign_posn[0]
-+      loc->__lc_monetary->_monetary_locale.int_curr_symbol,
-+      loc->__lc_monetary->_monetary_locale.currency_symbol,
-+      loc->__lc_monetary->_monetary_locale.mon_decimal_point,
-+      loc->__lc_monetary->_monetary_locale.mon_thousands_sep,
-+      loc->__lc_monetary->_monetary_locale.mon_grouping,
-+      loc->__lc_monetary->_monetary_locale.positive_sign,
-+      loc->__lc_monetary->_monetary_locale.negative_sign,
-+      loc->__lc_monetary->_monetary_locale.int_frac_digits[0],
-+      loc->__lc_monetary->_monetary_locale.frac_digits[0],
-+      loc->__lc_monetary->_monetary_locale.p_cs_precedes[0],
-+      loc->__lc_monetary->_monetary_locale.p_sep_by_space[0],
-+      loc->__lc_monetary->_monetary_locale.n_cs_precedes[0],
-+      loc->__lc_monetary->_monetary_locale.n_sep_by_space[0],
-+      loc->__lc_monetary->_monetary_locale.p_sign_posn[0],
-+      loc->__lc_monetary->_monetary_locale.n_sign_posn[0],
-+      loc->__lc_monetary->_monetary_locale.int_p_cs_precedes[0],
-+      loc->__lc_monetary->_monetary_locale.int_p_sep_by_space[0],
-+      loc->__lc_monetary->_monetary_locale.int_n_cs_precedes[0],
-+      loc->__lc_monetary->_monetary_locale.int_n_sep_by_space[0],
-+      loc->__lc_monetary->_monetary_locale.int_p_sign_posn[0],
-+      loc->__lc_monetary->_monetary_locale.int_n_sign_posn[0]
- );
- }
- #endif /* LOCALE_DEBUG */
index e278ea51351187f28d984d79912fddb8d35b6cdf..b7c3d0fd0a9c075a8f1335d5ec5634c056393338 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _LMONETARY_H_
 #define        _LMONETARY_H_
 
+#include <xlocale.h>
+
 struct lc_monetary_T {
        const char      *int_curr_symbol;
        const char      *currency_symbol;
@@ -53,7 +55,7 @@ struct lc_monetary_T {
        const char      *int_n_sign_posn;
 };
 
-struct lc_monetary_T *__get_current_monetary_locale(void);
-int    __monetary_load_locale(const char *);
+struct lc_monetary_T *__get_current_monetary_locale(locale_t);
+int    __monetary_load_locale(const char *, locale_t);
 
 #endif /* !_LMONETARY_H_ */
diff --git a/locale/FreeBSD/lmonetary.h.patch b/locale/FreeBSD/lmonetary.h.patch
deleted file mode 100644 (file)
index 826c1be..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- lmonetary.h.orig   2009-11-09 15:05:25.000000000 -0800
-+++ lmonetary.h        2009-11-09 15:05:25.000000000 -0800
-@@ -29,6 +29,8 @@
- #ifndef _LMONETARY_H_
- #define       _LMONETARY_H_
-+#include <xlocale.h>
-+
- struct lc_monetary_T {
-       const char      *int_curr_symbol;
-       const char      *currency_symbol;
-@@ -53,7 +55,7 @@ struct lc_monetary_T {
-       const char      *int_n_sign_posn;
- };
--struct lc_monetary_T *__get_current_monetary_locale(void);
--int   __monetary_load_locale(const char *);
-+struct lc_monetary_T *__get_current_monetary_locale(locale_t);
-+int   __monetary_load_locale(const char *, locale_t);
- #endif /* !_LMONETARY_H_ */
index ff9c94871e6a5096bc2e0bc89b0939b07bc375bc..adfa25b4dc0ada62aaa1c25716e428d60fd832b8 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.16 2003/06/26 10:46:16 phantom Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
+#include <string.h>
 
 #include "ldpart.h"
 #include "lnumeric.h"
 
-extern int __nlocale_changed;
 extern const char *__fix_locale_grouping_str(const char *);
 
 #define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *))
 
-static char    numempty[] = { CHAR_MAX, '\0' };
-
 static const struct lc_numeric_T _C_numeric_locale = {
        ".",            /* decimal_point */
        "",             /* thousands_sep */
-       numempty        /* grouping */
+       ""              /* grouping [C99 7.11.2.1]*/
 };
 
-static struct lc_numeric_T _numeric_locale;
-static int     _numeric_using_locale;
-static char    *_numeric_locale_buf;
-
-int
-__numeric_load_locale(const char *name)
+__private_extern__ int
+__numeric_load_locale(const char *name, locale_t loc)
 {
        int ret;
+       struct __xlocale_st_numeric *xp;
+       static struct __xlocale_st_numeric *cache = NULL;
+
+       /* 'name' must be already checked. */
+       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+               if (!loc->_numeric_using_locale)
+                       return (_LDP_CACHE);
+               loc->_numeric_using_locale = 0;
+               XL_RELEASE(loc->__lc_numeric);
+               loc->__lc_numeric = NULL;
+               loc->__nlocale_changed = 1;
+               return (_LDP_CACHE);
+       }
+
+       if (loc->_numeric_using_locale && strcmp(name, loc->__lc_numeric->_numeric_locale_buf) == 0)
+               return (_LDP_CACHE);
+       /*
+        * If the locale name is the same as our cache, use the cache.
+        */
+       if (cache && cache->_numeric_locale_buf && strcmp(name, cache->_numeric_locale_buf) == 0) {
+               loc->_numeric_using_locale = 1;
+               XL_RELEASE(loc->__lc_numeric);
+               loc->__lc_numeric = cache;
+               XL_RETAIN(loc->__lc_numeric);
+               loc->__nlocale_changed = 1;
+               return (_LDP_CACHE);
+       }
+       if ((xp = (struct __xlocale_st_numeric *)malloc(sizeof(*xp))) == NULL)
+               return _LDP_ERROR;
+       xp->__refcount = 1;
+       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
+       xp->_numeric_locale_buf = NULL;
 
-       ret = __part_load_locale(name, &_numeric_using_locale,
-               &_numeric_locale_buf, "LC_NUMERIC",
+       ret = __part_load_locale(name, &loc->_numeric_using_locale,
+               &xp->_numeric_locale_buf, "LC_NUMERIC",
                LCNUMERIC_SIZE, LCNUMERIC_SIZE,
-               (const char **)&_numeric_locale);
+               (const char **)&xp->_numeric_locale);
        if (ret != _LDP_ERROR)
-               __nlocale_changed = 1;
+               loc->__nlocale_changed = 1;
+       else
+               free(xp);
        if (ret == _LDP_LOADED) {
                /* Can't be empty according to C99 */
-               if (*_numeric_locale.decimal_point == '\0')
-                       _numeric_locale.decimal_point =
+               if (*xp->_numeric_locale.decimal_point == '\0')
+                       xp->_numeric_locale.decimal_point =
                            _C_numeric_locale.decimal_point;
-               _numeric_locale.grouping =
-                   __fix_locale_grouping_str(_numeric_locale.grouping);
+               xp->_numeric_locale.grouping =
+                   __fix_locale_grouping_str(xp->_numeric_locale.grouping);
+               XL_RELEASE(loc->__lc_numeric);
+               loc->__lc_numeric = xp;
+               XL_RELEASE(cache);
+               cache = xp;
+               XL_RETAIN(cache);
        }
        return (ret);
 }
 
-struct lc_numeric_T *
-__get_current_numeric_locale(void)
+__private_extern__ struct lc_numeric_T *
+__get_current_numeric_locale(locale_t loc)
 {
-       return (_numeric_using_locale
-               ? &_numeric_locale
+       return (loc->_numeric_using_locale
+               ? &loc->__lc_numeric->_numeric_locale
                : (struct lc_numeric_T *)&_C_numeric_locale);
 }
 
 #ifdef LOCALE_DEBUG
 void
 numericdebug(void) {
+locale_t loc = __current_locale();
 printf(        "decimal_point = %s\n"
        "thousands_sep = %s\n"
        "grouping = %s\n",
-       _numeric_locale.decimal_point,
-       _numeric_locale.thousands_sep,
-       _numeric_locale.grouping
+       loc->__lc_numeric->_numeric_locale.decimal_point,
+       loc->__lc_numeric->_numeric_locale.thousands_sep,
+       loc->__lc_numeric->_numeric_locale.grouping
 );
 }
 #endif /* LOCALE_DEBUG */
diff --git a/locale/FreeBSD/lnumeric.c.patch b/locale/FreeBSD/lnumeric.c.patch
deleted file mode 100644 (file)
index 50a02e5..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
---- lnumeric.c.orig    2009-11-09 15:05:25.000000000 -0800
-+++ lnumeric.c 2009-11-09 15:05:25.000000000 -0800
-@@ -27,67 +27,103 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.16 2003/06/26 10:46:16 phantom Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
-+#include <string.h>
- #include "ldpart.h"
- #include "lnumeric.h"
--extern int __nlocale_changed;
- extern const char *__fix_locale_grouping_str(const char *);
- #define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *))
--static char   numempty[] = { CHAR_MAX, '\0' };
--
- static const struct lc_numeric_T _C_numeric_locale = {
-       ".",            /* decimal_point */
-       "",             /* thousands_sep */
--      numempty        /* grouping */
-+      ""              /* grouping [C99 7.11.2.1]*/
- };
--static struct lc_numeric_T _numeric_locale;
--static int    _numeric_using_locale;
--static char   *_numeric_locale_buf;
--
--int
--__numeric_load_locale(const char *name)
-+__private_extern__ int
-+__numeric_load_locale(const char *name, locale_t loc)
- {
-       int ret;
-+      struct __xlocale_st_numeric *xp;
-+      static struct __xlocale_st_numeric *cache = NULL;
-+
-+      /* 'name' must be already checked. */
-+      if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-+              if (!loc->_numeric_using_locale)
-+                      return (_LDP_CACHE);
-+              loc->_numeric_using_locale = 0;
-+              XL_RELEASE(loc->__lc_numeric);
-+              loc->__lc_numeric = NULL;
-+              loc->__nlocale_changed = 1;
-+              return (_LDP_CACHE);
-+      }
-+
-+      if (loc->_numeric_using_locale && strcmp(name, loc->__lc_numeric->_numeric_locale_buf) == 0)
-+              return (_LDP_CACHE);
-+      /*
-+       * If the locale name is the same as our cache, use the cache.
-+       */
-+      if (cache && cache->_numeric_locale_buf && strcmp(name, cache->_numeric_locale_buf) == 0) {
-+              loc->_numeric_using_locale = 1;
-+              XL_RELEASE(loc->__lc_numeric);
-+              loc->__lc_numeric = cache;
-+              XL_RETAIN(loc->__lc_numeric);
-+              loc->__nlocale_changed = 1;
-+              return (_LDP_CACHE);
-+      }
-+      if ((xp = (struct __xlocale_st_numeric *)malloc(sizeof(*xp))) == NULL)
-+              return _LDP_ERROR;
-+      xp->__refcount = 1;
-+      xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-+      xp->_numeric_locale_buf = NULL;
--      ret = __part_load_locale(name, &_numeric_using_locale,
--              &_numeric_locale_buf, "LC_NUMERIC",
-+      ret = __part_load_locale(name, &loc->_numeric_using_locale,
-+              &xp->_numeric_locale_buf, "LC_NUMERIC",
-               LCNUMERIC_SIZE, LCNUMERIC_SIZE,
--              (const char **)&_numeric_locale);
-+              (const char **)&xp->_numeric_locale);
-       if (ret != _LDP_ERROR)
--              __nlocale_changed = 1;
-+              loc->__nlocale_changed = 1;
-+      else
-+              free(xp);
-       if (ret == _LDP_LOADED) {
-               /* Can't be empty according to C99 */
--              if (*_numeric_locale.decimal_point == '\0')
--                      _numeric_locale.decimal_point =
-+              if (*xp->_numeric_locale.decimal_point == '\0')
-+                      xp->_numeric_locale.decimal_point =
-                           _C_numeric_locale.decimal_point;
--              _numeric_locale.grouping =
--                  __fix_locale_grouping_str(_numeric_locale.grouping);
-+              xp->_numeric_locale.grouping =
-+                  __fix_locale_grouping_str(xp->_numeric_locale.grouping);
-+              XL_RELEASE(loc->__lc_numeric);
-+              loc->__lc_numeric = xp;
-+              XL_RELEASE(cache);
-+              cache = xp;
-+              XL_RETAIN(cache);
-       }
-       return (ret);
- }
--struct lc_numeric_T *
--__get_current_numeric_locale(void)
-+__private_extern__ struct lc_numeric_T *
-+__get_current_numeric_locale(locale_t loc)
- {
--      return (_numeric_using_locale
--              ? &_numeric_locale
-+      return (loc->_numeric_using_locale
-+              ? &loc->__lc_numeric->_numeric_locale
-               : (struct lc_numeric_T *)&_C_numeric_locale);
- }
- #ifdef LOCALE_DEBUG
- void
- numericdebug(void) {
-+locale_t loc = __current_locale();
- printf(       "decimal_point = %s\n"
-       "thousands_sep = %s\n"
-       "grouping = %s\n",
--      _numeric_locale.decimal_point,
--      _numeric_locale.thousands_sep,
--      _numeric_locale.grouping
-+      loc->__lc_numeric->_numeric_locale.decimal_point,
-+      loc->__lc_numeric->_numeric_locale.thousands_sep,
-+      loc->__lc_numeric->_numeric_locale.grouping
- );
- }
- #endif /* LOCALE_DEBUG */
index 9678c1f02c1a0ecd752917dfa235cd02303ef627..e91835c96d84926286b156db1a37de4b814d5763 100644 (file)
 #ifndef _LNUMERIC_H_
 #define        _LNUMERIC_H_
 
+#include <xlocale.h>
+
 struct lc_numeric_T {
        const char      *decimal_point;
        const char      *thousands_sep;
        const char      *grouping;
 };
 
-struct lc_numeric_T *__get_current_numeric_locale(void);
-int    __numeric_load_locale(const char *);
+struct lc_numeric_T *__get_current_numeric_locale(locale_t);
+int    __numeric_load_locale(const char *, locale_t);
 
 #endif /* !_LNUMERIC_H_ */
diff --git a/locale/FreeBSD/lnumeric.h.patch b/locale/FreeBSD/lnumeric.h.patch
deleted file mode 100644 (file)
index 7635d21..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- lnumeric.h.orig    2009-11-09 15:05:25.000000000 -0800
-+++ lnumeric.h 2009-11-09 15:05:25.000000000 -0800
-@@ -29,13 +29,15 @@
- #ifndef _LNUMERIC_H_
- #define       _LNUMERIC_H_
-+#include <xlocale.h>
-+
- struct lc_numeric_T {
-       const char      *decimal_point;
-       const char      *thousands_sep;
-       const char      *grouping;
- };
--struct lc_numeric_T *__get_current_numeric_locale(void);
--int   __numeric_load_locale(const char *);
-+struct lc_numeric_T *__get_current_numeric_locale(locale_t);
-+int   __numeric_load_locale(const char *, locale_t);
- #endif /* !_LNUMERIC_H_ */
index 092f670238c489fdd713fdf520c24cf086c2f19d..01df550706f0a993df3e84ec77b7d2cc55d9f540 100644 (file)
 .Dt LOCALECONV 3
 .Os
 .Sh NAME
-.Nm localeconv
+.Nm localeconv ,
+.Nm localeconv_l
 .Nd natural language formatting for C
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In locale.h
 .Ft struct lconv *
-.Fn localeconv "void"
+.Fo localeconv
+.Fa "void"
+.Fc
+.In xlocale.h
+.Ft struct lconv *
+.Fo localeconv_l
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn localeconv
@@ -197,6 +205,14 @@ a value that is not in the current locale.
 A
 .Dv CHAR_MAX
 result similarly denotes an unavailable value.
+.Pp
+While the
+.Fn localeconv
+function uses the current locale, the
+.Fn localeconv_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn localeconv
@@ -209,7 +225,8 @@ or
 No errors are defined.
 .Sh SEE ALSO
 .Xr setlocale 3 ,
-.Xr strfmon 3
+.Xr strfmon 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn localeconv
diff --git a/locale/FreeBSD/localeconv.3.patch b/locale/FreeBSD/localeconv.3.patch
deleted file mode 100644 (file)
index 6a8e459..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
---- localeconv.3.orig  2009-11-09 15:05:25.000000000 -0800
-+++ localeconv.3       2009-11-09 15:05:26.000000000 -0800
-@@ -36,14 +36,22 @@
- .Dt LOCALECONV 3
- .Os
- .Sh NAME
--.Nm localeconv
-+.Nm localeconv ,
-+.Nm localeconv_l
- .Nd natural language formatting for C
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In locale.h
- .Ft struct lconv *
--.Fn localeconv "void"
-+.Fo localeconv
-+.Fa "void"
-+.Fc
-+.In xlocale.h
-+.Ft struct lconv *
-+.Fo localeconv_l
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn localeconv
-@@ -197,6 +205,14 @@ a value that is not in the current local
- A
- .Dv CHAR_MAX
- result similarly denotes an unavailable value.
-+.Pp
-+While the
-+.Fn localeconv
-+function uses the current locale, the
-+.Fn localeconv_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn localeconv
-@@ -209,7 +225,8 @@ or
- No errors are defined.
- .Sh SEE ALSO
- .Xr setlocale 3 ,
--.Xr strfmon 3
-+.Xr strfmon 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn localeconv
index 919fd0233c302efc6bd408a0c22f55b51a883614..11afdb51d9fd1a559018b21f3ce15e496d9a48cc 100644 (file)
@@ -34,11 +34,71 @@ static char sccsid[] = "@(#)localeconv.c    8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23 phantom Exp $");
 
+#include "xlocale_private.h"
+
+#include <limits.h>
 #include <locale.h>
 
 #include "lmonetary.h"
 #include "lnumeric.h"
 
+#ifdef __APPLE_PR3417676_HACK__
+/*------------------------------------------------------------------------
+ * PR-3417676: We need to provide a way to force "C" locale style number
+ * formatting independent of the locale setting.  We provide private
+ * routines to get and set a flag that tells localeconv() to either return
+ * a "C" struct lconv, or the one dependent on the actual locale.
+ *------------------------------------------------------------------------*/
+static char empty[] = "";
+static char numempty[] = { CHAR_MAX, '\0' };
+
+/*
+ * Default (C) locale conversion.
+ */
+static struct lconv _C_lconv = {
+       ".",                    /* decimal_point */
+       empty,                  /* thousands_sep */
+       numempty,               /* grouping */
+       empty,                  /* int_curr_symbol */
+       empty,                  /* currency_symbol */
+       empty,                  /* mon_decimal_point */
+       empty,                  /* mon_thousands_sep */
+       numempty,               /* mon_grouping */
+       empty,                  /* positive_sign */
+       empty,                  /* negative_sign */
+       CHAR_MAX,               /* int_frac_digits */
+       CHAR_MAX,               /* frac_digits */
+       CHAR_MAX,               /* p_cs_precedes */
+       CHAR_MAX,               /* p_sep_by_space */
+       CHAR_MAX,               /* n_cs_precedes */
+       CHAR_MAX,               /* n_sep_by_space */
+       CHAR_MAX,               /* p_sign_posn */
+       CHAR_MAX,               /* n_sign_posn */
+       CHAR_MAX,               /* int_p_cs_precedes */
+       CHAR_MAX,               /* int_n_cs_precedes */
+       CHAR_MAX,               /* int_p_sep_by_space */
+       CHAR_MAX,               /* int_n_sep_by_space */
+       CHAR_MAX,               /* int_p_sign_posn */
+       CHAR_MAX,               /* int_n_sign_posn */
+};
+static int _onlyClocaleconv = 0;
+
+int
+__getonlyClocaleconv(void)
+{
+    return _onlyClocaleconv;
+}
+
+int
+__setonlyClocaleconv(int val)
+{
+    int prev = _onlyClocaleconv;
+
+    _onlyClocaleconv = val;
+    return prev;
+}
+#endif /* __APPLE_PR3417676_HACK__ */
+
 /* 
  * The localeconv() function constructs a struct lconv from the current
  * monetary and numeric locales.
@@ -48,25 +108,28 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23
  * lconv structure are computed only when the monetary or numeric 
  * locale has been changed.
  */
-int __mlocale_changed = 1;
-int __nlocale_changed = 1;
 
 /*
  * Return the current locale conversion.
  */
 struct lconv *
-localeconv()
+localeconv_l(locale_t loc)
 {
-    static struct lconv ret;
+    struct lconv *lc;
+
+    NORMALIZE_LOCALE(loc);
 
-    if (__mlocale_changed) {
+    if (loc->__mlocale_changed) {
+      XL_LOCK(loc);
+      if (loc->__mlocale_changed) {
        /* LC_MONETARY part */
         struct lc_monetary_T * mptr; 
+       struct lconv *lc = &loc->__lc_localeconv;
 
-#define M_ASSIGN_STR(NAME) (ret.NAME = (char*)mptr->NAME)
-#define M_ASSIGN_CHAR(NAME) (ret.NAME = mptr->NAME[0])
+#define M_ASSIGN_STR(NAME) (lc->NAME = (char*)mptr->NAME)
+#define M_ASSIGN_CHAR(NAME) (lc->NAME = mptr->NAME[0])
 
-       mptr = __get_current_monetary_locale();
+       mptr = __get_current_monetary_locale(loc);
        M_ASSIGN_STR(int_curr_symbol);
        M_ASSIGN_STR(currency_symbol);
        M_ASSIGN_STR(mon_decimal_point);
@@ -88,21 +151,45 @@ localeconv()
        M_ASSIGN_CHAR(int_n_sep_by_space);
        M_ASSIGN_CHAR(int_p_sign_posn);
        M_ASSIGN_CHAR(int_n_sign_posn);
-       __mlocale_changed = 0;
+       loc->__mlocale_changed = 0;
+      }
+      XL_UNLOCK(loc);
     }
 
-    if (__nlocale_changed) {
+    if (loc->__nlocale_changed) {
+      XL_LOCK(loc);
+      if (loc->__nlocale_changed) {
        /* LC_NUMERIC part */
         struct lc_numeric_T * nptr; 
+       struct lconv *lc = &loc->__lc_localeconv;
 
-#define N_ASSIGN_STR(NAME) (ret.NAME = (char*)nptr->NAME)
+#define N_ASSIGN_STR(NAME) (lc->NAME = (char*)nptr->NAME)
 
-       nptr = __get_current_numeric_locale();
+       nptr = __get_current_numeric_locale(loc);
        N_ASSIGN_STR(decimal_point);
        N_ASSIGN_STR(thousands_sep);
        N_ASSIGN_STR(grouping);
-       __nlocale_changed = 0;
+       loc->__nlocale_changed = 0;
+      }
+      XL_UNLOCK(loc);
     }
 
-    return (&ret);
+    return &loc->__lc_localeconv;
+}
+
+/*
+ * Return the current locale conversion.
+ */
+struct lconv *
+localeconv()
+{
+#ifdef __APPLE_PR3417676_HACK__
+    /*--------------------------------------------------------------------
+     * If _onlyClocaleconv is non-zero, just return __lconv, which is a "C"
+     * struct lconv *.  Otherwise, do the normal thing.
+     *--------------------------------------------------------------------*/
+    if (_onlyClocaleconv)
+       return &_C_lconv;
+#endif /* __APPLE_PR3417676_HACK__ */
+    return localeconv_l(__current_locale());
 }
diff --git a/locale/FreeBSD/localeconv.c.patch b/locale/FreeBSD/localeconv.c.patch
deleted file mode 100644 (file)
index 393277f..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
---- localeconv.c.orig  2009-11-09 15:05:25.000000000 -0800
-+++ localeconv.c       2009-11-09 15:05:26.000000000 -0800
-@@ -34,11 +34,71 @@ static char sccsid[] = "@(#)localeconv.c
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23 phantom Exp $");
-+#include "xlocale_private.h"
-+
-+#include <limits.h>
- #include <locale.h>
- #include "lmonetary.h"
- #include "lnumeric.h"
-+#ifdef __APPLE_PR3417676_HACK__
-+/*------------------------------------------------------------------------
-+ * PR-3417676: We need to provide a way to force "C" locale style number
-+ * formatting independent of the locale setting.  We provide private
-+ * routines to get and set a flag that tells localeconv() to either return
-+ * a "C" struct lconv, or the one dependent on the actual locale.
-+ *------------------------------------------------------------------------*/
-+static char empty[] = "";
-+static char numempty[] = { CHAR_MAX, '\0' };
-+
-+/*
-+ * Default (C) locale conversion.
-+ */
-+static struct lconv _C_lconv = {
-+      ".",                    /* decimal_point */
-+      empty,                  /* thousands_sep */
-+      numempty,               /* grouping */
-+      empty,                  /* int_curr_symbol */
-+      empty,                  /* currency_symbol */
-+      empty,                  /* mon_decimal_point */
-+      empty,                  /* mon_thousands_sep */
-+      numempty,               /* mon_grouping */
-+      empty,                  /* positive_sign */
-+      empty,                  /* negative_sign */
-+      CHAR_MAX,               /* int_frac_digits */
-+      CHAR_MAX,               /* frac_digits */
-+      CHAR_MAX,               /* p_cs_precedes */
-+      CHAR_MAX,               /* p_sep_by_space */
-+      CHAR_MAX,               /* n_cs_precedes */
-+      CHAR_MAX,               /* n_sep_by_space */
-+      CHAR_MAX,               /* p_sign_posn */
-+      CHAR_MAX,               /* n_sign_posn */
-+      CHAR_MAX,               /* int_p_cs_precedes */
-+      CHAR_MAX,               /* int_n_cs_precedes */
-+      CHAR_MAX,               /* int_p_sep_by_space */
-+      CHAR_MAX,               /* int_n_sep_by_space */
-+      CHAR_MAX,               /* int_p_sign_posn */
-+      CHAR_MAX,               /* int_n_sign_posn */
-+};
-+static int _onlyClocaleconv = 0;
-+
-+int
-+__getonlyClocaleconv(void)
-+{
-+    return _onlyClocaleconv;
-+}
-+
-+int
-+__setonlyClocaleconv(int val)
-+{
-+    int prev = _onlyClocaleconv;
-+
-+    _onlyClocaleconv = val;
-+    return prev;
-+}
-+#endif /* __APPLE_PR3417676_HACK__ */
-+
- /* 
-  * The localeconv() function constructs a struct lconv from the current
-  * monetary and numeric locales.
-@@ -48,25 +108,28 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * lconv structure are computed only when the monetary or numeric 
-  * locale has been changed.
-  */
--int __mlocale_changed = 1;
--int __nlocale_changed = 1;
- /*
-  * Return the current locale conversion.
-  */
- struct lconv *
--localeconv()
-+localeconv_l(locale_t loc)
- {
--    static struct lconv ret;
-+    struct lconv *lc;
-+
-+    NORMALIZE_LOCALE(loc);
--    if (__mlocale_changed) {
-+    if (loc->__mlocale_changed) {
-+      XL_LOCK(loc);
-+      if (loc->__mlocale_changed) {
-       /* LC_MONETARY part */
-         struct lc_monetary_T * mptr; 
-+      struct lconv *lc = &loc->__lc_localeconv;
--#define M_ASSIGN_STR(NAME) (ret.NAME = (char*)mptr->NAME)
--#define M_ASSIGN_CHAR(NAME) (ret.NAME = mptr->NAME[0])
-+#define M_ASSIGN_STR(NAME) (lc->NAME = (char*)mptr->NAME)
-+#define M_ASSIGN_CHAR(NAME) (lc->NAME = mptr->NAME[0])
--      mptr = __get_current_monetary_locale();
-+      mptr = __get_current_monetary_locale(loc);
-       M_ASSIGN_STR(int_curr_symbol);
-       M_ASSIGN_STR(currency_symbol);
-       M_ASSIGN_STR(mon_decimal_point);
-@@ -88,21 +151,45 @@ localeconv()
-       M_ASSIGN_CHAR(int_n_sep_by_space);
-       M_ASSIGN_CHAR(int_p_sign_posn);
-       M_ASSIGN_CHAR(int_n_sign_posn);
--      __mlocale_changed = 0;
-+      loc->__mlocale_changed = 0;
-+      }
-+      XL_UNLOCK(loc);
-     }
--    if (__nlocale_changed) {
-+    if (loc->__nlocale_changed) {
-+      XL_LOCK(loc);
-+      if (loc->__nlocale_changed) {
-       /* LC_NUMERIC part */
-         struct lc_numeric_T * nptr; 
-+      struct lconv *lc = &loc->__lc_localeconv;
--#define N_ASSIGN_STR(NAME) (ret.NAME = (char*)nptr->NAME)
-+#define N_ASSIGN_STR(NAME) (lc->NAME = (char*)nptr->NAME)
--      nptr = __get_current_numeric_locale();
-+      nptr = __get_current_numeric_locale(loc);
-       N_ASSIGN_STR(decimal_point);
-       N_ASSIGN_STR(thousands_sep);
-       N_ASSIGN_STR(grouping);
--      __nlocale_changed = 0;
-+      loc->__nlocale_changed = 0;
-+      }
-+      XL_UNLOCK(loc);
-     }
--    return (&ret);
-+    return &loc->__lc_localeconv;
-+}
-+
-+/*
-+ * Return the current locale conversion.
-+ */
-+struct lconv *
-+localeconv()
-+{
-+#ifdef __APPLE_PR3417676_HACK__
-+    /*--------------------------------------------------------------------
-+     * If _onlyClocaleconv is non-zero, just return __lconv, which is a "C"
-+     * struct lconv *.  Otherwise, do the normal thing.
-+     *--------------------------------------------------------------------*/
-+    if (_onlyClocaleconv)
-+      return &_C_lconv;
-+#endif /* __APPLE_PR3417676_HACK__ */
-+    return localeconv_l(__current_locale());
- }
index adfd58ad873b1f99f9962a5e996aaa757cc9c6d1..c3530e1dc70857169170aced3c07fed231757e59 100644 (file)
 .Dt MBLEN 3
 .Os
 .Sh NAME
-.Nm mblen
+.Nm mblen ,
+.Nm mblen_l
 .Nd get number of bytes in a character
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn mblen "const char *mbchar" "size_t nbytes"
+.Fo mblen
+.Fa "const char *s"
+.Fa "size_t n"
+.Fc
+.In stdlib.h
+.In xlocale.h
+.Ft int
+.Fo mblen_l
+.Fa "const char *s"
+.Fa "size_t n"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn mblen
-function computes the length in bytes
+function computes the length, in bytes,
 of a multibyte character
-.Fa mbchar
+.Fa s ,
 according to the current conversion state.
 Up to
-.Fa nbytes
+.Fa n
 bytes are examined.
 .Pp
 A call with a null
-.Fa mbchar
+.Fa s
 pointer returns nonzero if the current locale requires shift states,
-zero otherwise;
-if shift states are required, the shift state is reset to the initial state.
+zero otherwise.
+If shift states are required, the shift state is reset to the initial state.
+.Pp
+Although the
+.Fn mblen
+function uses the current locale, the
+.Fn mblen_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If
-.Fa mbchar
+.Fa s
 is
 .Dv NULL ,
 the
@@ -72,14 +92,14 @@ function returns nonzero if shift states are supported,
 zero otherwise.
 .Pp
 Otherwise, if
-.Fa mbchar
+.Fa s
 is not a null pointer,
 .Fn mblen
 either returns 0 if
-.Fa mbchar
+.Fa s
 represents the null wide character, or returns
 the number of bytes processed in
-.Fa mbchar ,
+.Fa s ,
 or returns \-1 if no multibyte character
 could be recognized or converted.
 In this case,
@@ -98,7 +118,8 @@ The internal conversion state is not valid.
 .Sh SEE ALSO
 .Xr mbrlen 3 ,
 .Xr mbtowc 3 ,
-.Xr multibyte 3
+.Xr multibyte 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mblen
diff --git a/locale/FreeBSD/mblen.3.patch b/locale/FreeBSD/mblen.3.patch
deleted file mode 100644 (file)
index 193f576..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
---- mblen.3.orig       2009-11-09 15:05:25.000000000 -0800
-+++ mblen.3    2009-11-09 15:05:26.000000000 -0800
-@@ -37,33 +37,53 @@
- .Dt MBLEN 3
- .Os
- .Sh NAME
--.Nm mblen
-+.Nm mblen ,
-+.Nm mblen_l
- .Nd get number of bytes in a character
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft int
--.Fn mblen "const char *mbchar" "size_t nbytes"
-+.Fo mblen
-+.Fa "const char *s"
-+.Fa "size_t n"
-+.Fc
-+.In stdlib.h
-+.In xlocale.h
-+.Ft int
-+.Fo mblen_l
-+.Fa "const char *s"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn mblen
--function computes the length in bytes
-+function computes the length, in bytes,
- of a multibyte character
--.Fa mbchar
-+.Fa s ,
- according to the current conversion state.
- Up to
--.Fa nbytes
-+.Fa n
- bytes are examined.
- .Pp
- A call with a null
--.Fa mbchar
-+.Fa s
- pointer returns nonzero if the current locale requires shift states,
--zero otherwise;
--if shift states are required, the shift state is reset to the initial state.
-+zero otherwise.
-+If shift states are required, the shift state is reset to the initial state.
-+.Pp
-+Although the
-+.Fn mblen
-+function uses the current locale, the
-+.Fn mblen_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If
--.Fa mbchar
-+.Fa s
- is
- .Dv NULL ,
- the
-@@ -72,14 +92,14 @@ function returns nonzero if shift states
- zero otherwise.
- .Pp
- Otherwise, if
--.Fa mbchar
-+.Fa s
- is not a null pointer,
- .Fn mblen
- either returns 0 if
--.Fa mbchar
-+.Fa s
- represents the null wide character, or returns
- the number of bytes processed in
--.Fa mbchar ,
-+.Fa s ,
- or returns \-1 if no multibyte character
- could be recognized or converted.
- In this case,
-@@ -98,7 +118,8 @@ The internal conversion state is not val
- .Sh SEE ALSO
- .Xr mbrlen 3 ,
- .Xr mbtowc 3 ,
--.Xr multibyte 3
-+.Xr multibyte 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mblen
index 2891e90e99bd9588898fe7d3d6d6c44e3730f606..f6bfa52790dc55d6749eccb00bd2eadab75eb5cc 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 int
-mblen(const char *s, size_t n)
+mblen_l(const char *s, size_t n, locale_t loc)
 {
        static const mbstate_t initial;
-       static mbstate_t mbs;
        size_t rval;
 
+       NORMALIZE_LOCALE(loc);
        if (s == NULL) {
                /* No support for state dependent encodings. */
-               mbs = initial;
+               loc->__mbs_mblen = initial;
                return (0);
        }
-       rval = __mbrtowc(NULL, s, n, &mbs);
+       rval = loc->__lc_ctype->__mbrtowc(NULL, s, n, &loc->__mbs_mblen, loc);
        if (rval == (size_t)-1 || rval == (size_t)-2)
                return (-1);
        return ((int)rval);
 }
+
+int
+mblen(const char *s, size_t n)
+{
+       return mblen_l(s, n, __current_locale());
+}
diff --git a/locale/FreeBSD/mblen.c.patch b/locale/FreeBSD/mblen.c.patch
deleted file mode 100644 (file)
index 5d8f912..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
---- mblen.c.orig       2009-11-09 15:05:25.000000000 -0800
-+++ mblen.c    2009-11-09 15:05:25.000000000 -0800
-@@ -27,24 +27,32 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <wchar.h>
- #include "mblocal.h"
- int
--mblen(const char *s, size_t n)
-+mblen_l(const char *s, size_t n, locale_t loc)
- {
-       static const mbstate_t initial;
--      static mbstate_t mbs;
-       size_t rval;
-+      NORMALIZE_LOCALE(loc);
-       if (s == NULL) {
-               /* No support for state dependent encodings. */
--              mbs = initial;
-+              loc->__mbs_mblen = initial;
-               return (0);
-       }
--      rval = __mbrtowc(NULL, s, n, &mbs);
-+      rval = loc->__lc_ctype->__mbrtowc(NULL, s, n, &loc->__mbs_mblen, loc);
-       if (rval == (size_t)-1 || rval == (size_t)-2)
-               return (-1);
-       return ((int)rval);
- }
-+
-+int
-+mblen(const char *s, size_t n)
-+{
-+      return mblen_l(s, n, __current_locale());
-+}
index c1a716d660ee46ca4a71cbba467358ce23da930b..f5d3fc19a8b8c8aa9ba21306e7fe30a1953d8dcc 100644 (file)
 /*
  * Rune initialization function prototypes.
  */
-int    _none_init(_RuneLocale *);
-int    _ascii_init(_RuneLocale *);
-int    _UTF8_init(_RuneLocale *);
-int    _EUC_init(_RuneLocale *);
-int    _GB18030_init(_RuneLocale *);
-int    _GB2312_init(_RuneLocale *);
-int    _GBK_init(_RuneLocale *);
-int    _BIG5_init(_RuneLocale *);
-int    _MSKanji_init(_RuneLocale *);
+__private_extern__ int _none_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _ascii_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _UTF2_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _UTF8_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _EUC_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _GB18030_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _GB2312_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _GBK_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _BIG5_init(struct __xlocale_st_runelocale *);
+__private_extern__ int _MSKanji_init(struct __xlocale_st_runelocale *);
 
-/*
- * Conversion function pointers for current encoding.
- */
-extern size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
-    size_t, mbstate_t * __restrict);
-extern int (*__mbsinit)(const mbstate_t *);
-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 (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
-    size_t, size_t, mbstate_t * __restrict);
+__private_extern__ size_t       _none_mbrtowc(wchar_t * __restrict, const char * __restrict,
+                    size_t, mbstate_t * __restrict, locale_t);
+__private_extern__ int  _none_mbsinit(const mbstate_t *, locale_t);
+__private_extern__ size_t       _none_mbsnrtowcs(wchar_t * __restrict dst,
+                    const char ** __restrict src, size_t nms, size_t len,
+                    mbstate_t * __restrict ps __unused, locale_t);
+__private_extern__ size_t       _none_wcrtomb(char * __restrict, wchar_t,
+                    mbstate_t * __restrict, locale_t);
+__private_extern__ size_t       _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
+                    size_t, size_t, mbstate_t * __restrict, locale_t);
 
 extern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict,
-    size_t, size_t, mbstate_t * __restrict);
+    size_t, size_t, mbstate_t * __restrict, locale_t);
 extern size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict,
-    size_t, size_t, mbstate_t * __restrict);
+    size_t, size_t, mbstate_t * __restrict, locale_t);
 
 #endif /* _MBLOCAL_H_ */
diff --git a/locale/FreeBSD/mblocal.h.patch b/locale/FreeBSD/mblocal.h.patch
deleted file mode 100644 (file)
index ed7ca59..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
---- mblocal.h.orig     2009-11-09 15:05:25.000000000 -0800
-+++ mblocal.h  2009-11-09 19:00:41.000000000 -0800
-@@ -34,31 +34,31 @@
- /*
-  * Rune initialization function prototypes.
-  */
--int   _none_init(_RuneLocale *);
--int   _ascii_init(_RuneLocale *);
--int   _UTF8_init(_RuneLocale *);
--int   _EUC_init(_RuneLocale *);
--int   _GB18030_init(_RuneLocale *);
--int   _GB2312_init(_RuneLocale *);
--int   _GBK_init(_RuneLocale *);
--int   _BIG5_init(_RuneLocale *);
--int   _MSKanji_init(_RuneLocale *);
-+__private_extern__ int        _none_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _ascii_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _UTF2_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _UTF8_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _EUC_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _GB18030_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _GB2312_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _GBK_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _BIG5_init(struct __xlocale_st_runelocale *);
-+__private_extern__ int        _MSKanji_init(struct __xlocale_st_runelocale *);
--/*
-- * Conversion function pointers for current encoding.
-- */
--extern size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
--    size_t, mbstate_t * __restrict);
--extern int (*__mbsinit)(const mbstate_t *);
--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 (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
--    size_t, size_t, mbstate_t * __restrict);
-+__private_extern__ size_t       _none_mbrtowc(wchar_t * __restrict, const char * __restrict,
-+                    size_t, mbstate_t * __restrict, locale_t);
-+__private_extern__ int  _none_mbsinit(const mbstate_t *, locale_t);
-+__private_extern__ size_t       _none_mbsnrtowcs(wchar_t * __restrict dst,
-+                    const char ** __restrict src, size_t nms, size_t len,
-+                    mbstate_t * __restrict ps __unused, locale_t);
-+__private_extern__ size_t       _none_wcrtomb(char * __restrict, wchar_t,
-+                    mbstate_t * __restrict, locale_t);
-+__private_extern__ size_t       _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-+                    size_t, size_t, mbstate_t * __restrict, locale_t);
- extern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict,
--    size_t, size_t, mbstate_t * __restrict);
-+    size_t, size_t, mbstate_t * __restrict, locale_t);
- extern size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict,
--    size_t, size_t, mbstate_t * __restrict);
-+    size_t, size_t, mbstate_t * __restrict, locale_t);
- #endif        /* _MBLOCAL_H_ */
index ce33175353b5ac8b22941156132e7e47afcab725..ca7be65345c594d9d4dab41eaffb415f9e4ab0a0 100644 (file)
 .Dt MBRLEN 3
 .Os
 .Sh NAME
-.Nm mbrlen
+.Nm mbrlen ,
+.Nm mbrlen_l
 .Nd "get number of bytes in a character (restartable)"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft size_t
-.Fn mbrlen "const char * restrict s" "size_t n" "mbstate_t * restrict ps"
+.Fo mbrlen
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "mbstate_t *restrict ps"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft size_t
+.Fo mbrlen_l
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn mbrlen
 function inspects at most
 .Fa n
-bytes pointed to by
-.Fa s
+bytes, pointed to by
+.Fa s ,
 to determine the number of bytes needed to complete the next
 multibyte character.
 .Pp
@@ -63,7 +77,7 @@ It is equivalent to:
 .Pp
 .Dl "mbrtowc(NULL, s, n, ps);"
 .Pp
-Except that when
+Except that, when
 .Fa ps
 is a
 .Dv NULL
@@ -72,6 +86,14 @@ pointer,
 uses its own static, internal
 .Vt mbstate_t
 object to keep track of the shift state.
+.Pp
+Although the
+.Fn mbrlen
+function uses the current locale, the
+.Fn mbrlen_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn mbrlen
@@ -137,7 +159,8 @@ The conversion state is invalid.
 .Sh SEE ALSO
 .Xr mblen 3 ,
 .Xr mbrtowc 3 ,
-.Xr multibyte 3
+.Xr multibyte 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbrlen
diff --git a/locale/FreeBSD/mbrlen.3.patch b/locale/FreeBSD/mbrlen.3.patch
deleted file mode 100644 (file)
index 8bfba2d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
---- mbrlen.3.orig      2009-11-09 15:05:25.000000000 -0800
-+++ mbrlen.3   2009-11-09 15:05:25.000000000 -0800
-@@ -28,21 +28,35 @@
- .Dt MBRLEN 3
- .Os
- .Sh NAME
--.Nm mbrlen
-+.Nm mbrlen ,
-+.Nm mbrlen_l
- .Nd "get number of bytes in a character (restartable)"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft size_t
--.Fn mbrlen "const char * restrict s" "size_t n" "mbstate_t * restrict ps"
-+.Fo mbrlen
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fa "mbstate_t *restrict ps"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo mbrlen_l
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn mbrlen
- function inspects at most
- .Fa n
--bytes pointed to by
--.Fa s
-+bytes, pointed to by
-+.Fa s ,
- to determine the number of bytes needed to complete the next
- multibyte character.
- .Pp
-@@ -63,7 +77,7 @@ It is equivalent to:
- .Pp
- .Dl "mbrtowc(NULL, s, n, ps);"
- .Pp
--Except that when
-+Except that, when
- .Fa ps
- is a
- .Dv NULL
-@@ -72,6 +86,14 @@ pointer,
- uses its own static, internal
- .Vt mbstate_t
- object to keep track of the shift state.
-+.Pp
-+Although the
-+.Fn mbrlen
-+function uses the current locale, the
-+.Fn mbrlen_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn mbrlen
-@@ -137,7 +159,8 @@ The conversion state is invalid.
- .Sh SEE ALSO
- .Xr mblen 3 ,
- .Xr mbrtowc 3 ,
--.Xr multibyte 3
-+.Xr multibyte 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mbrlen
index 33f7ea02c0b37080deb576dc13d062f59cf57498..2f0227ad977216bdd6819e8983bb5fbca24829fe 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 #include "mblocal.h"
 
 size_t
-mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
+mbrlen_l(const char * __restrict s, size_t n, mbstate_t * __restrict ps,
+    locale_t loc)
 {
-       static mbstate_t mbs;
-
+       NORMALIZE_LOCALE(loc);
        if (ps == NULL)
-               ps = &mbs;
-       return (__mbrtowc(NULL, s, n, ps));
+               ps = &loc->__mbs_mbrlen;
+       return (loc->__lc_ctype->__mbrtowc(NULL, s, n, ps, loc));
+}
+
+size_t
+mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
+{
+       return mbrlen_l(s, n, ps, __current_locale());
 }
diff --git a/locale/FreeBSD/mbrlen.c.patch b/locale/FreeBSD/mbrlen.c.patch
deleted file mode 100644 (file)
index 24365a7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- mbrlen.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ mbrlen.c   2009-11-09 15:05:25.000000000 -0800
-@@ -27,15 +27,23 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #include "mblocal.h"
- size_t
--mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
-+mbrlen_l(const char * __restrict s, size_t n, mbstate_t * __restrict ps,
-+    locale_t loc)
- {
--      static mbstate_t mbs;
--
-+      NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
--              ps = &mbs;
--      return (__mbrtowc(NULL, s, n, ps));
-+              ps = &loc->__mbs_mbrlen;
-+      return (loc->__lc_ctype->__mbrtowc(NULL, s, n, ps, loc));
-+}
-+
-+size_t
-+mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
-+{
-+      return mbrlen_l(s, n, ps, __current_locale());
- }
index ab7138eb5417303e840abd28771742f7d8b3cbfa..406618419a07541e6e78d5908bbd902881d9d807 100644 (file)
@@ -28,7 +28,8 @@
 .Dt MBRTOWC 3
 .Os
 .Sh NAME
-.Nm mbrtowc
+.Nm mbrtowc ,
+.Nm mbrtowc_l
 .Nd "convert a character to a wide-character code (restartable)"
 .Sh LIBRARY
 .Lb libc
 .In wchar.h
 .Ft size_t
 .Fo mbrtowc
-.Fa "wchar_t * restrict pwc" "const char * restrict s" "size_t n"
-.Fa "mbstate_t * restrict ps"
+.Fa "wchar_t *restrict pwc"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "mbstate_t *restrict ps"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft size_t
+.Fo mbrtowc_l
+.Fa "wchar_t *restrict pwc"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn mbrtowc
 function inspects at most
 .Fa n
-bytes pointed to by
-.Fa s
+bytes, pointed to by
+.Fa s ,
 to determine the number of bytes needed to complete the next multibyte
 character.
 If a character can be completed, and
@@ -65,14 +78,14 @@ is
 .Fn mbrtowc
 behaves as if
 .Fa pwc
-was
+were
 .Dv NULL ,
 .Fa s
-was an empty string
-.Pq Qq
+were an empty string
+.Pq Qq ,
 and
 .Fa n
-was 1.
+were 1.
 .Pp
 The
 .Vt mbstate_t
@@ -86,6 +99,14 @@ uses an internal, static
 .Vt mbstate_t
 object, which is initialized to the initial conversion state
 at program startup.
+.Pp
+While the
+.Fn mbrtowc
+function uses the current locale, the
+.Fn mbrtowc_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn mbrtowc
@@ -131,7 +152,8 @@ The conversion state is invalid.
 .Xr mbtowc 3 ,
 .Xr multibyte 3 ,
 .Xr setlocale 3 ,
-.Xr wcrtomb 3
+.Xr wcrtomb 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbrtowc
diff --git a/locale/FreeBSD/mbrtowc.3.patch b/locale/FreeBSD/mbrtowc.3.patch
deleted file mode 100644 (file)
index 1b42524..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
---- mbrtowc.3.orig     2009-11-09 15:05:25.000000000 -0800
-+++ mbrtowc.3  2009-11-09 15:05:25.000000000 -0800
-@@ -28,7 +28,8 @@
- .Dt MBRTOWC 3
- .Os
- .Sh NAME
--.Nm mbrtowc
-+.Nm mbrtowc ,
-+.Nm mbrtowc_l
- .Nd "convert a character to a wide-character code (restartable)"
- .Sh LIBRARY
- .Lb libc
-@@ -36,16 +37,28 @@
- .In wchar.h
- .Ft size_t
- .Fo mbrtowc
--.Fa "wchar_t * restrict pwc" "const char * restrict s" "size_t n"
--.Fa "mbstate_t * restrict ps"
-+.Fa "wchar_t *restrict pwc"
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fa "mbstate_t *restrict ps"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo mbrtowc_l
-+.Fa "wchar_t *restrict pwc"
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn mbrtowc
- function inspects at most
- .Fa n
--bytes pointed to by
--.Fa s
-+bytes, pointed to by
-+.Fa s ,
- to determine the number of bytes needed to complete the next multibyte
- character.
- If a character can be completed, and
-@@ -65,14 +78,14 @@ is
- .Fn mbrtowc
- behaves as if
- .Fa pwc
--was
-+were
- .Dv NULL ,
- .Fa s
--was an empty string
--.Pq Qq
-+were an empty string
-+.Pq Qq ,
- and
- .Fa n
--was 1.
-+were 1.
- .Pp
- The
- .Vt mbstate_t
-@@ -86,6 +99,14 @@ uses an internal, static
- .Vt mbstate_t
- object, which is initialized to the initial conversion state
- at program startup.
-+.Pp
-+While the
-+.Fn mbrtowc
-+function uses the current locale, the
-+.Fn mbrtowc_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn mbrtowc
-@@ -131,7 +152,8 @@ The conversion state is invalid.
- .Xr mbtowc 3 ,
- .Xr multibyte 3 ,
- .Xr setlocale 3 ,
--.Xr wcrtomb 3
-+.Xr wcrtomb 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mbrtowc
index 9b19d1046b51c866072ca920f7a12e94308662cc..023c8b25160d2d6d85e0fae9d4e74978de3a1c33 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 #include "mblocal.h"
 
+size_t
+mbrtowc_l(wchar_t * __restrict pwc, const char * __restrict s,
+    size_t n, mbstate_t * __restrict ps, locale_t loc)
+{
+       NORMALIZE_LOCALE(loc);
+       if (ps == NULL)
+               ps = &loc->__mbs_mbrtowc;
+       return (loc->__lc_ctype->__mbrtowc(pwc, s, n, ps, loc));
+}
+
 size_t
 mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
     size_t n, mbstate_t * __restrict ps)
 {
-       static mbstate_t mbs;
-
-       if (ps == NULL)
-               ps = &mbs;
-       return (__mbrtowc(pwc, s, n, ps));
+       return mbrtowc_l(pwc, s, n, ps, __current_locale());
 }
diff --git a/locale/FreeBSD/mbrtowc.c.patch b/locale/FreeBSD/mbrtowc.c.patch
deleted file mode 100644 (file)
index 85053f4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- mbrtowc.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ mbrtowc.c  2009-11-09 15:05:25.000000000 -0800
-@@ -27,16 +27,24 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #include "mblocal.h"
- size_t
-+mbrtowc_l(wchar_t * __restrict pwc, const char * __restrict s,
-+    size_t n, mbstate_t * __restrict ps, locale_t loc)
-+{
-+      NORMALIZE_LOCALE(loc);
-+      if (ps == NULL)
-+              ps = &loc->__mbs_mbrtowc;
-+      return (loc->__lc_ctype->__mbrtowc(pwc, s, n, ps, loc));
-+}
-+
-+size_t
- mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
-     size_t n, mbstate_t * __restrict ps)
- {
--      static mbstate_t mbs;
--
--      if (ps == NULL)
--              ps = &mbs;
--      return (__mbrtowc(pwc, s, n, ps));
-+      return mbrtowc_l(pwc, s, n, ps, __current_locale());
- }
index e2a9e46143b0e36e0230bce4829c7c11dea09790..8dfa1bf3f7cf3e84effba30bcc238fb5010a201e 100644 (file)
@@ -28,7 +28,8 @@
 .Dt MBSINIT 3
 .Os
 .Sh NAME
-.Nm mbsinit
+.Nm mbsinit ,
+.Nm mbsinit_l
 .Nd "determine conversion object status"
 .Sh LIBRARY
 .Lb libc
 .In wchar.h
 .Ft int
 .Fn mbsinit "const mbstate_t *ps"
+.In wchar.h
+.In xlocale.h
+.Ft int
+.Fn mbsinit_l "const mbstate_t *ps" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn mbsinit
@@ -44,6 +49,14 @@ function determines whether the
 object pointed to by
 .Fa ps
 describes an initial conversion state.
+.Pp
+While the
+.Fn mbsinit
+function uses the current locale, the
+.Fn mbsinit_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn mbsinit
@@ -51,15 +64,16 @@ function returns non-zero if
 .Fa ps
 is
 .Dv NULL
-or describes an initial conversion state,
-otherwise it returns zero.
+or describes an initial conversion state;
+otherwise, it returns zero.
 .Sh SEE ALSO
 .Xr mbrlen 3 ,
 .Xr mbrtowc 3 ,
 .Xr mbsrtowcs 3 ,
 .Xr multibyte 3 ,
 .Xr wcrtomb 3 ,
-.Xr wcsrtombs 3
+.Xr wcsrtombs 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbsinit
diff --git a/locale/FreeBSD/mbsinit.3.patch b/locale/FreeBSD/mbsinit.3.patch
deleted file mode 100644 (file)
index 4d83a50..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
---- mbsinit.3.orig     2009-11-09 15:05:25.000000000 -0800
-+++ mbsinit.3  2009-11-09 15:05:25.000000000 -0800
-@@ -28,7 +28,8 @@
- .Dt MBSINIT 3
- .Os
- .Sh NAME
--.Nm mbsinit
-+.Nm mbsinit ,
-+.Nm mbsinit_l
- .Nd "determine conversion object status"
- .Sh LIBRARY
- .Lb libc
-@@ -36,6 +37,10 @@
- .In wchar.h
- .Ft int
- .Fn mbsinit "const mbstate_t *ps"
-+.In wchar.h
-+.In xlocale.h
-+.Ft int
-+.Fn mbsinit_l "const mbstate_t *ps" "locale_t loc"
- .Sh DESCRIPTION
- The
- .Fn mbsinit
-@@ -44,6 +49,14 @@ function determines whether the
- object pointed to by
- .Fa ps
- describes an initial conversion state.
-+.Pp
-+While the
-+.Fn mbsinit
-+function uses the current locale, the
-+.Fn mbsinit_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn mbsinit
-@@ -51,15 +64,16 @@ function returns non-zero if
- .Fa ps
- is
- .Dv NULL
--or describes an initial conversion state,
--otherwise it returns zero.
-+or describes an initial conversion state;
-+otherwise, it returns zero.
- .Sh SEE ALSO
- .Xr mbrlen 3 ,
- .Xr mbrtowc 3 ,
- .Xr mbsrtowcs 3 ,
- .Xr multibyte 3 ,
- .Xr wcrtomb 3 ,
--.Xr wcsrtombs 3
-+.Xr wcsrtombs 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mbsinit
index cddb56726acdd68f5027134bb9fc49936aea6b52..bbc22667e944ce7802d73e92eff0c326dfb2ca20 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 #include "mblocal.h"
 
 int
-mbsinit(const mbstate_t *ps)
+mbsinit_l(const mbstate_t *ps, locale_t loc)
 {
 
-       return (__mbsinit(ps));
+       NORMALIZE_LOCALE(loc);
+       return (loc->__lc_ctype->__mbsinit(ps, loc));
+}
+
+int
+mbsinit(const mbstate_t *ps)
+{
+       return mbsinit_l(ps, __current_locale());
 }
diff --git a/locale/FreeBSD/mbsinit.c.patch b/locale/FreeBSD/mbsinit.c.patch
deleted file mode 100644 (file)
index 7635c85..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- mbsinit.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ mbsinit.c  2009-11-09 15:05:25.000000000 -0800
-@@ -27,12 +27,21 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #include "mblocal.h"
- int
--mbsinit(const mbstate_t *ps)
-+mbsinit_l(const mbstate_t *ps, locale_t loc)
- {
--      return (__mbsinit(ps));
-+      NORMALIZE_LOCALE(loc);
-+      return (loc->__lc_ctype->__mbsinit(ps, loc));
-+}
-+
-+int
-+mbsinit(const mbstate_t *ps)
-+{
-+      return mbsinit_l(ps, __current_locale());
- }
index 3e65b154b58b589a3fb44ce044bd776ff5a8e99a..41cdd8631a36f113e7bed1163acf51fd613530f0 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -34,31 +36,40 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 t
 #include "mblocal.h"
 
 size_t
-mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps)
+mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
 {
-       static mbstate_t mbs;
-
+       NORMALIZE_LOCALE(loc);
        if (ps == NULL)
-               ps = &mbs;
-       return (__mbsnrtowcs(dst, src, nms, len, ps));
+               ps = &loc->__mbs_mbsnrtowcs;
+       return (loc->__lc_ctype->__mbsnrtowcs(dst, src, nms, len, ps, loc));
 }
 
 size_t
-__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
+mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
     size_t nms, size_t len, mbstate_t * __restrict ps)
+{
+       return mbsnrtowcs_l(dst, src, nms, len, ps, __current_locale());
+}
+
+__private_extern__ size_t
+__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
 {
        const char *s;
        size_t nchr;
        wchar_t wc;
        size_t nb;
+       size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
+           size_t, mbstate_t * __restrict, locale_t)
+           = loc->__lc_ctype->__mbrtowc;
 
        s = *src;
        nchr = 0;
 
        if (dst == NULL) {
                for (;;) {
-                       if ((nb = __mbrtowc(&wc, s, nms, ps)) == (size_t)-1)
+                       if ((nb = __mbrtowc(&wc, s, nms, ps, loc)) == (size_t)-1)
                                /* Invalid sequence - mbrtowc() sets errno. */
                                return ((size_t)-1);
                        else if (nb == 0 || nb == (size_t)-2)
@@ -71,7 +82,7 @@ __mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
        }
 
        while (len-- > 0) {
-               if ((nb = __mbrtowc(dst, s, nms, ps)) == (size_t)-1) {
+               if ((nb = __mbrtowc(dst, s, nms, ps, loc)) == (size_t)-1) {
                        *src = s;
                        return ((size_t)-1);
                } else if (nb == (size_t)-2) {
diff --git a/locale/FreeBSD/mbsnrtowcs.c.patch b/locale/FreeBSD/mbsnrtowcs.c.patch
deleted file mode 100644 (file)
index 9b03c7c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- mbsnrtowcs.c.orig  2009-11-09 15:05:25.000000000 -0800
-+++ mbsnrtowcs.c       2009-11-09 15:05:25.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <stdlib.h>
-@@ -34,31 +36,40 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "mblocal.h"
- size_t
--mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
--    size_t nms, size_t len, mbstate_t * __restrict ps)
-+mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
-+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
--      static mbstate_t mbs;
--
-+      NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
--              ps = &mbs;
--      return (__mbsnrtowcs(dst, src, nms, len, ps));
-+              ps = &loc->__mbs_mbsnrtowcs;
-+      return (loc->__lc_ctype->__mbsnrtowcs(dst, src, nms, len, ps, loc));
- }
- size_t
--__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
-+mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-     size_t nms, size_t len, mbstate_t * __restrict ps)
- {
-+      return mbsnrtowcs_l(dst, src, nms, len, ps, __current_locale());
-+}
-+
-+__private_extern__ size_t
-+__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
-+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
-+{
-       const char *s;
-       size_t nchr;
-       wchar_t wc;
-       size_t nb;
-+      size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
-+          size_t, mbstate_t * __restrict, locale_t)
-+          = loc->__lc_ctype->__mbrtowc;
-       s = *src;
-       nchr = 0;
-       if (dst == NULL) {
-               for (;;) {
--                      if ((nb = __mbrtowc(&wc, s, nms, ps)) == (size_t)-1)
-+                      if ((nb = __mbrtowc(&wc, s, nms, ps, loc)) == (size_t)-1)
-                               /* Invalid sequence - mbrtowc() sets errno. */
-                               return ((size_t)-1);
-                       else if (nb == 0 || nb == (size_t)-2)
-@@ -71,7 +82,7 @@ __mbsnrtowcs_std(wchar_t * __restrict ds
-       }
-       while (len-- > 0) {
--              if ((nb = __mbrtowc(dst, s, nms, ps)) == (size_t)-1) {
-+              if ((nb = __mbrtowc(dst, s, nms, ps, loc)) == (size_t)-1) {
-                       *src = s;
-                       return ((size_t)-1);
-               } else if (nb == (size_t)-2) {
index dce9c781c87a0ec2594af2517ab4a25ea6ce39f1..ff6e6990825eac55a10c8ee621852224a1cf7ad9 100644 (file)
 .Dt MBSRTOWCS 3
 .Os
 .Sh NAME
+.Nm mbsnrtowcs ,
+.Nm mbsnrtowcs_l ,
 .Nm mbsrtowcs ,
-.Nm mbsnrtowcs
+.Nm mbsrtowcs_l
 .Nd "convert a character string to a wide-character string (restartable)"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft size_t
+.Fo mbsnrtowcs
+.Fa "wchar_t *restrict dst"
+.Fa "const char **restrict src"
+.Fa "size_t nms"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
+.Fc
+.Ft size_t
 .Fo mbsrtowcs
-.Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t len"
-.Fa "mbstate_t * restrict ps"
+.Fa "wchar_t *restrict dst"
+.Fa "const char **restrict src"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
 .Fc
+.In wchar.h
+.In xlocale.h
 .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"
+.Fo mbsrtowcs_l
+.Fa "wchar_t *restrict dst"
+.Fa "const char **restrict src"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
+.Fc
+.Ft size_t
+.Fo mbsnrtowcs_l
+.Fa "wchar_t *restrict dst"
+.Fa "const char **restrict src"
+.Fa "size_t nms"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn mbsrtowcs
-function converts a sequence of multibyte characters pointed to indirectly by
-.Fa src
-into a sequence of corresponding wide characters and stores at most
+function converts a sequence of multibyte characters, pointed to indirectly by
+.Fa src ,
+into a sequence of corresponding wide characters. It stores at most
 .Fa len
 of them in the
 .Vt wchar_t
@@ -97,6 +123,18 @@ except that conversion stops after reading at most
 .Fa nms
 bytes from the buffer pointed to by
 .Fa src .
+.Pp
+While the
+.Fn mbsrtowcs
+and
+.Fn mbsnrtowcs
+functions use the current locale, the
+.Fn mbsrtowcs_l
+and
+.Fn mbsnrtowcs_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn mbsrtowcs
@@ -123,7 +161,8 @@ The conversion state is invalid.
 .Xr mbrtowc 3 ,
 .Xr mbstowcs 3 ,
 .Xr multibyte 3 ,
-.Xr wcsrtombs 3
+.Xr wcsrtombs 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbsrtowcs
diff --git a/locale/FreeBSD/mbsrtowcs.3.patch b/locale/FreeBSD/mbsrtowcs.3.patch
deleted file mode 100644 (file)
index ad11bb0..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
---- mbsrtowcs.3.orig   2009-11-09 15:05:25.000000000 -0800
-+++ mbsrtowcs.3        2009-11-09 15:05:26.000000000 -0800
-@@ -27,29 +27,55 @@
- .Dt MBSRTOWCS 3
- .Os
- .Sh NAME
-+.Nm mbsnrtowcs ,
-+.Nm mbsnrtowcs_l ,
- .Nm mbsrtowcs ,
--.Nm mbsnrtowcs
-+.Nm mbsrtowcs_l
- .Nd "convert a character string to a wide-character string (restartable)"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft size_t
-+.Fo mbsnrtowcs
-+.Fa "wchar_t *restrict dst"
-+.Fa "const char **restrict src"
-+.Fa "size_t nms"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
-+.Fc
-+.Ft size_t
- .Fo mbsrtowcs
--.Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t len"
--.Fa "mbstate_t * restrict ps"
-+.Fa "wchar_t *restrict dst"
-+.Fa "const char **restrict src"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
- .Fc
-+.In wchar.h
-+.In xlocale.h
- .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"
-+.Fo mbsrtowcs_l
-+.Fa "wchar_t *restrict dst"
-+.Fa "const char **restrict src"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
-+.Fc
-+.Ft size_t
-+.Fo mbsnrtowcs_l
-+.Fa "wchar_t *restrict dst"
-+.Fa "const char **restrict src"
-+.Fa "size_t nms"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn mbsrtowcs
--function converts a sequence of multibyte characters pointed to indirectly by
--.Fa src
--into a sequence of corresponding wide characters and stores at most
-+function converts a sequence of multibyte characters, pointed to indirectly by
-+.Fa src ,
-+into a sequence of corresponding wide characters. It stores at most
- .Fa len
- of them in the
- .Vt wchar_t
-@@ -97,6 +123,18 @@ except that conversion stops after readi
- .Fa nms
- bytes from the buffer pointed to by
- .Fa src .
-+.Pp
-+While the
-+.Fn mbsrtowcs
-+and
-+.Fn mbsnrtowcs
-+functions use the current locale, the
-+.Fn mbsrtowcs_l
-+and
-+.Fn mbsnrtowcs_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn mbsrtowcs
-@@ -123,7 +161,8 @@ The conversion state is invalid.
- .Xr mbrtowc 3 ,
- .Xr mbstowcs 3 ,
- .Xr multibyte 3 ,
--.Xr wcsrtombs 3
-+.Xr wcsrtombs 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mbsrtowcs
index 12feaab5ead0d1b04b69269c748630c050771139..da8b1e41cbac9bbbc3b9948111caacf36c6bc32c 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
 
+size_t
+mbsrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
+    mbstate_t * __restrict ps, locale_t loc)
+{
+       NORMALIZE_LOCALE(loc);
+       if (ps == NULL)
+               ps = &loc->__mbs_mbsrtowcs;
+       return (loc->__lc_ctype->__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps, loc));
+}
+
 size_t
 mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
     mbstate_t * __restrict ps)
 {
-       static mbstate_t mbs;
-
-       if (ps == NULL)
-               ps = &mbs;
-       return (__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps));
+       return mbsrtowcs_l(dst, src, len, ps, __current_locale());
 }
diff --git a/locale/FreeBSD/mbsrtowcs.c.patch b/locale/FreeBSD/mbsrtowcs.c.patch
deleted file mode 100644 (file)
index 47831aa..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- mbsrtowcs.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ mbsrtowcs.c        2009-11-09 15:05:25.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <stdlib.h>
-@@ -34,12 +36,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "mblocal.h"
- size_t
-+mbsrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
-+    mbstate_t * __restrict ps, locale_t loc)
-+{
-+      NORMALIZE_LOCALE(loc);
-+      if (ps == NULL)
-+              ps = &loc->__mbs_mbsrtowcs;
-+      return (loc->__lc_ctype->__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps, loc));
-+}
-+
-+size_t
- mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
-     mbstate_t * __restrict ps)
- {
--      static mbstate_t mbs;
--
--      if (ps == NULL)
--              ps = &mbs;
--      return (__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps));
-+      return mbsrtowcs_l(dst, src, len, ps, __current_locale());
- }
index f710b8b4bbf13736487dfe1862a8f778b0a49fd0..9e52e79f04c1f2fe62cdebf7725aa19a01bd19c4 100644 (file)
@@ -37,7 +37,8 @@
 .Dt MBSTOWCS 3
 .Os
 .Sh NAME
-.Nm mbstowcs
+.Nm mbstowcs ,
+.Nm mbstowcs_l
 .Nd convert a character string to a wide-character string
 .Sh LIBRARY
 .Lb libc
 .In stdlib.h
 .Ft size_t
 .Fo mbstowcs
-.Fa "wchar_t * restrict wcstring" "const char * restrict mbstring"
-.Fa "size_t nwchars"
+.Fa "wchar_t *restrict pwcs"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fc
+.In stdlib.h
+.In xlocale.h
+.Ft size_t
+.Fo mbstowcs_l
+.Fa "wchar_t *restrict pwcs"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn mbstowcs
 function converts a multibyte character string
-.Fa mbstring
-beginning in the initial conversion state
+.Fa s ,
+beginning in the initial conversion state,
 into a wide character string
-.Fa wcstring .
+.Fa pwcs .
 No more than
-.Fa nwchars
+.Fa n
 wide characters are stored.
-A terminating null wide character is appended if there is room.
+A terminating null wide character is appended, if there is room.
+.Pp
+Although the
+.Fn mbstowcs
+function uses the current locale, the
+.Fn mbstowcs_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn mbstowcs
@@ -79,7 +98,8 @@ The conversion state is invalid.
 .Sh SEE ALSO
 .Xr mbsrtowcs 3 ,
 .Xr mbtowc 3 ,
-.Xr multibyte 3
+.Xr multibyte 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbstowcs
diff --git a/locale/FreeBSD/mbstowcs.3.patch b/locale/FreeBSD/mbstowcs.3.patch
deleted file mode 100644 (file)
index 075f58b..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- mbstowcs.3.orig    2009-11-09 15:05:25.000000000 -0800
-+++ mbstowcs.3 2009-11-09 15:05:26.000000000 -0800
-@@ -37,7 +37,8 @@
- .Dt MBSTOWCS 3
- .Os
- .Sh NAME
--.Nm mbstowcs
-+.Nm mbstowcs ,
-+.Nm mbstowcs_l
- .Nd convert a character string to a wide-character string
- .Sh LIBRARY
- .Lb libc
-@@ -45,21 +46,39 @@
- .In stdlib.h
- .Ft size_t
- .Fo mbstowcs
--.Fa "wchar_t * restrict wcstring" "const char * restrict mbstring"
--.Fa "size_t nwchars"
-+.Fa "wchar_t *restrict pwcs"
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fc
-+.In stdlib.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo mbstowcs_l
-+.Fa "wchar_t *restrict pwcs"
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn mbstowcs
- function converts a multibyte character string
--.Fa mbstring
--beginning in the initial conversion state
-+.Fa s ,
-+beginning in the initial conversion state,
- into a wide character string
--.Fa wcstring .
-+.Fa pwcs .
- No more than
--.Fa nwchars
-+.Fa n
- wide characters are stored.
--A terminating null wide character is appended if there is room.
-+A terminating null wide character is appended, if there is room.
-+.Pp
-+Although the
-+.Fn mbstowcs
-+function uses the current locale, the
-+.Fn mbstowcs_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn mbstowcs
-@@ -79,7 +98,8 @@ The conversion state is invalid.
- .Sh SEE ALSO
- .Xr mbsrtowcs 3 ,
- .Xr mbtowc 3 ,
--.Xr multibyte 3
-+.Xr multibyte 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mbstowcs
index 2de87924eed3a0131779ce58b4c4db6dfefd6ff6..80bc4fe4dfaa0c9a948d7f70742cc4e13af976b9 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 size_t
-mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
+mbstowcs_l(wchar_t * __restrict pwcs, const char * __restrict s, size_t n,
+    locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
        const char *sp;
 
+       NORMALIZE_LOCALE(loc);
        mbs = initial;
        sp = s;
-       return (__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs));
+       return (loc->__lc_ctype->__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs, loc));
+}
+
+size_t
+mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
+{
+       return mbstowcs_l(pwcs, s, n, __current_locale());
 }
diff --git a/locale/FreeBSD/mbstowcs.c.patch b/locale/FreeBSD/mbstowcs.c.patch
deleted file mode 100644 (file)
index f0834b0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- mbstowcs.c.bsdnew  2009-11-09 15:05:25.000000000 -0800
-+++ mbstowcs.c 2009-11-09 16:20:59.000000000 -0800
-@@ -27,19 +27,29 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdlib.h>
- #include <wchar.h>
- #include "mblocal.h"
- size_t
--mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
-+mbstowcs_l(wchar_t * __restrict pwcs, const char * __restrict s, size_t n,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       const char *sp;
-+      NORMALIZE_LOCALE(loc);
-       mbs = initial;
-       sp = s;
--      return (__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs));
-+      return (loc->__lc_ctype->__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs, loc));
-+}
-+
-+size_t
-+mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
-+{
-+      return mbstowcs_l(pwcs, s, n, __current_locale());
- }
index 9481c63fe6cf6145b9e3f61257d150ab979d3c08..b4ec67636a5e391779dc04d2d3004210e8a25809 100644 (file)
@@ -37,7 +37,8 @@
 .Dt MBTOWC 3
 .Os
 .Sh NAME
-.Nm mbtowc
+.Nm mbtowc ,
+.Nm mbtowc_l
 .Nd convert a character to a wide-character code
 .Sh LIBRARY
 .Lb libc
 .In stdlib.h
 .Ft int
 .Fo mbtowc
-.Fa "wchar_t * restrict wcharp" "const char * restrict mbchar"
-.Fa "size_t nbytes"
+.Fa "wchar_t *restrict pwc"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fc
+.In stdlib.h
+.In xlocale.h
+.Ft int
+.Fo mbtowc_l
+.Fa "wchar_t *restrict pwc"
+.Fa "const char *restrict s"
+.Fa "size_t n"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn mbtowc
 function converts a multibyte character
-.Fa mbchar
-into a wide character according to the current conversion state,
+.Fa s
+into a wide character, according to the current conversion state,
 and stores the result
 in the object pointed to by
-.Fa wcharp .
+.Fa pwc .
 Up to
-.Fa nbytes
+.Fa n
 bytes are examined.
 .Pp
 A call with a null
-.Fa mbchar
+.Fa s
 pointer returns nonzero if the current encoding requires shift states,
 zero otherwise;
 if shift states are required, the shift state is reset to the initial state.
+.Pp
+While the
+.Fn mbtowc
+function uses the current locale, the
+.Fn mbtowc_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If
-.Fa mbchar
+.Fa s
 is
 .Dv NULL ,
 the
@@ -77,14 +96,14 @@ function returns nonzero if shift states are supported,
 zero otherwise.
 .Pp
 Otherwise, if
-.Fa mbchar
+.Fa s
 is not a null pointer,
 .Fn mbtowc
 either returns 0 if
-.Fa mbchar
+.Fa s
 represents the null wide character, or returns
 the number of bytes processed in
-.Fa mbchar ,
+.Fa s ,
 or returns \-1 if no multibyte character
 could be recognized or converted.
 In this case,
@@ -106,7 +125,8 @@ The internal conversion state is invalid.
 .Xr mbrtowc 3 ,
 .Xr mbstowcs 3 ,
 .Xr multibyte 3 ,
-.Xr wctomb 3
+.Xr wctomb 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn mbtowc
diff --git a/locale/FreeBSD/mbtowc.3.patch b/locale/FreeBSD/mbtowc.3.patch
deleted file mode 100644 (file)
index 8bfdf86..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
---- mbtowc.3.orig      2009-11-09 15:05:25.000000000 -0800
-+++ mbtowc.3   2009-11-09 15:05:26.000000000 -0800
-@@ -37,7 +37,8 @@
- .Dt MBTOWC 3
- .Os
- .Sh NAME
--.Nm mbtowc
-+.Nm mbtowc ,
-+.Nm mbtowc_l
- .Nd convert a character to a wide-character code
- .Sh LIBRARY
- .Lb libc
-@@ -45,30 +46,48 @@
- .In stdlib.h
- .Ft int
- .Fo mbtowc
--.Fa "wchar_t * restrict wcharp" "const char * restrict mbchar"
--.Fa "size_t nbytes"
-+.Fa "wchar_t *restrict pwc"
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fc
-+.In stdlib.h
-+.In xlocale.h
-+.Ft int
-+.Fo mbtowc_l
-+.Fa "wchar_t *restrict pwc"
-+.Fa "const char *restrict s"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn mbtowc
- function converts a multibyte character
--.Fa mbchar
--into a wide character according to the current conversion state,
-+.Fa s
-+into a wide character, according to the current conversion state,
- and stores the result
- in the object pointed to by
--.Fa wcharp .
-+.Fa pwc .
- Up to
--.Fa nbytes
-+.Fa n
- bytes are examined.
- .Pp
- A call with a null
--.Fa mbchar
-+.Fa s
- pointer returns nonzero if the current encoding requires shift states,
- zero otherwise;
- if shift states are required, the shift state is reset to the initial state.
-+.Pp
-+While the
-+.Fn mbtowc
-+function uses the current locale, the
-+.Fn mbtowc_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If
--.Fa mbchar
-+.Fa s
- is
- .Dv NULL ,
- the
-@@ -77,14 +96,14 @@ function returns nonzero if shift states
- zero otherwise.
- .Pp
- Otherwise, if
--.Fa mbchar
-+.Fa s
- is not a null pointer,
- .Fn mbtowc
- either returns 0 if
--.Fa mbchar
-+.Fa s
- represents the null wide character, or returns
- the number of bytes processed in
--.Fa mbchar ,
-+.Fa s ,
- or returns \-1 if no multibyte character
- could be recognized or converted.
- In this case,
-@@ -106,7 +125,8 @@ The internal conversion state is invalid
- .Xr mbrtowc 3 ,
- .Xr mbstowcs 3 ,
- .Xr multibyte 3 ,
--.Xr wctomb 3
-+.Xr wctomb 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn mbtowc
index 5e3a3683e62bb24c4fa71a3be80e666e8cbb4934..aeb75b7be5e5b70d10f9a2a9742915f6c7f39eea 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 int
-mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
+mbtowc_l(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
+    locale_t loc)
 {
        static const mbstate_t initial;
-       static mbstate_t mbs;
        size_t rval;
 
+       NORMALIZE_LOCALE(loc);
        if (s == NULL) {
                /* No support for state dependent encodings. */
-               mbs = initial;
+               loc->__mbs_mbtowc = initial;
                return (0);
        }
-       rval = __mbrtowc(pwc, s, n, &mbs);
+       rval = loc->__lc_ctype->__mbrtowc(pwc, s, n, &loc->__mbs_mbtowc, loc);
        if (rval == (size_t)-1 || rval == (size_t)-2)
                return (-1);
        return ((int)rval);
 }
+
+int
+mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
+{
+       return mbtowc_l(pwc, s, n, __current_locale());
+}
diff --git a/locale/FreeBSD/mbtowc.c.patch b/locale/FreeBSD/mbtowc.c.patch
deleted file mode 100644 (file)
index daa1b84..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
---- mbtowc.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ mbtowc.c   2009-11-09 15:05:25.000000000 -0800
-@@ -27,24 +27,33 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <wchar.h>
- #include "mblocal.h"
- int
--mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
-+mbtowc_l(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
--      static mbstate_t mbs;
-       size_t rval;
-+      NORMALIZE_LOCALE(loc);
-       if (s == NULL) {
-               /* No support for state dependent encodings. */
--              mbs = initial;
-+              loc->__mbs_mbtowc = initial;
-               return (0);
-       }
--      rval = __mbrtowc(pwc, s, n, &mbs);
-+      rval = loc->__lc_ctype->__mbrtowc(pwc, s, n, &loc->__mbs_mbtowc, loc);
-       if (rval == (size_t)-1 || rval == (size_t)-2)
-               return (-1);
-       return ((int)rval);
- }
-+
-+int
-+mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
-+{
-+      return mbtowc_l(pwc, s, n, __current_locale());
-+}
index 609004d79f53a109f61b6b522ae6be2829beb076..3bf9a4d66a82bcad64144039e553499a2618afa2 100644 (file)
@@ -39,6 +39,8 @@ static char sccsid[] = "@(#)mskanji.c 1.0 (Phase One) 5/5/95";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <errno.h>
 #include <runetype.h>
@@ -47,33 +49,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ach
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
-
 static size_t  _MSKanji_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _MSKanji_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _MSKanji_mbsinit(const mbstate_t *, locale_t);
 static size_t  _MSKanji_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 
 typedef struct {
        wchar_t ch;
 } _MSKanjiState;
 
-int
-_MSKanji_init(_RuneLocale *rl)
+__private_extern__ int
+_MSKanji_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _MSKanji_mbrtowc;
-       __wcrtomb = _MSKanji_wcrtomb;
-       __mbsinit = _MSKanji_mbsinit;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 2;
-       __mb_sb_limit = 256;
+       xrl->__mbrtowc = _MSKanji_mbrtowc;
+       xrl->__wcrtomb = _MSKanji_wcrtomb;
+       xrl->__mbsinit = _MSKanji_mbsinit;
+       xrl->__mb_cur_max = 2;
+       xrl->__mb_sb_limit = 256;
        return (0);
 }
 
 static int
-_MSKanji_mbsinit(const mbstate_t *ps)
+_MSKanji_mbsinit(const mbstate_t *ps, locale_t loc __unused)
 {
 
        return (ps == NULL || ((const _MSKanjiState *)ps)->ch == 0);
@@ -81,7 +80,7 @@ _MSKanji_mbsinit(const mbstate_t *ps)
 
 static size_t
 _MSKanji_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps)
+    mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _MSKanjiState *ms;
        wchar_t wc;
@@ -138,7 +137,7 @@ _MSKanji_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 }
 
 static size_t
-_MSKanji_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_MSKanji_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
 {
        _MSKanjiState *ms;
        int len, i;
diff --git a/locale/FreeBSD/mskanji.c.patch b/locale/FreeBSD/mskanji.c.patch
deleted file mode 100644 (file)
index 1399fa9..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
---- mskanji.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ mskanji.c  2009-11-09 16:30:02.000000000 -0800
-@@ -39,6 +39,8 @@ static char sccsid[] = "@(#)mskanji.c        1.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <errno.h>
- #include <runetype.h>
-@@ -47,33 +49,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
--
- static size_t _MSKanji_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _MSKanji_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _MSKanji_mbsinit(const mbstate_t *, locale_t);
- static size_t _MSKanji_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- typedef struct {
-       wchar_t ch;
- } _MSKanjiState;
--int
--_MSKanji_init(_RuneLocale *rl)
-+__private_extern__ int
-+_MSKanji_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _MSKanji_mbrtowc;
--      __wcrtomb = _MSKanji_wcrtomb;
--      __mbsinit = _MSKanji_mbsinit;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 2;
--      __mb_sb_limit = 256;
-+      xrl->__mbrtowc = _MSKanji_mbrtowc;
-+      xrl->__wcrtomb = _MSKanji_wcrtomb;
-+      xrl->__mbsinit = _MSKanji_mbsinit;
-+      xrl->__mb_cur_max = 2;
-+      xrl->__mb_sb_limit = 256;
-       return (0);
- }
- static int
--_MSKanji_mbsinit(const mbstate_t *ps)
-+_MSKanji_mbsinit(const mbstate_t *ps, locale_t loc __unused)
- {
-       return (ps == NULL || ((const _MSKanjiState *)ps)->ch == 0);
-@@ -81,7 +80,7 @@ _MSKanji_mbsinit(const mbstate_t *ps)
- static size_t
- _MSKanji_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+    mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _MSKanjiState *ms;
-       wchar_t wc;
-@@ -138,7 +137,7 @@ _MSKanji_mbrtowc(wchar_t * __restrict pw
- }
- static size_t
--_MSKanji_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_MSKanji_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
- {
-       _MSKanjiState *ms;
-       int len, i;
index aa6ba6894db8e5d1eea44545724fb346fb5120bd..d2b959f0eef8569265fb45ddb1d24df8b0312bbc 100644 (file)
@@ -29,7 +29,8 @@
 .Dt NEXTWCTYPE 3
 .Os
 .Sh NAME
-.Nm nextwctype
+.Nm nextwctype ,
+.Nm nextwctype_l
 .Nd "iterate through character classes"
 .Sh LIBRARY
 .Lb libc
@@ -37,6 +38,9 @@
 .In wctype.h
 .Ft wint_t
 .Fn nextwctype "wint_t ch" "wctype_t wct"
+.In xlocale.h
+.Ft wint_t
+.Fn nextwctype_l "wint_t ch" "wctype_t wct" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn nextwctype
@@ -48,6 +52,14 @@ If
 .Fa ch
 is \-1, the search begins at the first member of
 .Fa wct .
+.Pp
+While the
+.Fn nextwctype
+function uses the current locale, the
+ .Fn nextwctype_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn nextwctype
@@ -59,7 +71,8 @@ extension and should not be used where the standard
 .Fn iswctype
 function would suffice.
 .Sh SEE ALSO
-.Xr wctype 3
+.Xr wctype 3 ,
+.Xr xlocale 3
 .Sh HISTORY
 The
 .Fn nextwctype
diff --git a/locale/FreeBSD/nextwctype.3.patch b/locale/FreeBSD/nextwctype.3.patch
deleted file mode 100644 (file)
index 82fac93..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- nextwctype.3.orig  2009-11-10 13:13:11.000000000 -0800
-+++ nextwctype.3       2009-11-10 14:53:56.000000000 -0800
-@@ -29,7 +29,8 @@
- .Dt NEXTWCTYPE 3
- .Os
- .Sh NAME
--.Nm nextwctype
-+.Nm nextwctype ,
-+.Nm nextwctype_l
- .Nd "iterate through character classes"
- .Sh LIBRARY
- .Lb libc
-@@ -37,6 +38,9 @@
- .In wctype.h
- .Ft wint_t
- .Fn nextwctype "wint_t ch" "wctype_t wct"
-+.In xlocale.h
-+.Ft wint_t
-+.Fn nextwctype_l "wint_t ch" "wctype_t wct" "locale_t loc"
- .Sh DESCRIPTION
- The
- .Fn nextwctype
-@@ -48,6 +52,14 @@ If
- .Fa ch
- is \-1, the search begins at the first member of
- .Fa wct .
-+.Pp
-+While the
-+.Fn nextwctype
-+function uses the current locale, the
-+ .Fn nextwctype_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn nextwctype
-@@ -59,7 +71,8 @@ extension and should not be used where t
- .Fn iswctype
- function would suffice.
- .Sh SEE ALSO
--.Xr wctype 3
-+.Xr wctype 3 ,
-+.Xr xlocale 3
- .Sh HISTORY
- The
- .Fn nextwctype
index 89c63df81889f41797145cefbb1b1c0e6f2eb199..75e505600d09bc6125f263968b2fef2d448ba1cb 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <runetype.h>
 #include <wchar.h>
 #include <wctype.h>
 
 wint_t
-nextwctype(wint_t wc, wctype_t wct)
+nextwctype_l(wint_t wc, wctype_t wct, locale_t loc)
 {
        size_t lim;
-       _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext;
+       _RuneRange *rr;
        _RuneEntry *base, *re;
        int noinc;
+       _RuneLocale *rl = &loc->__lc_ctype->_CurrentRuneLocale;
 
        noinc = 0;
        if (wc < _CACHED_RUNES) {
                wc++;
                while (wc < _CACHED_RUNES) {
-                       if (_CurrentRuneLocale->__runetype[wc] & wct)
+                       if (rl->__runetype[wc] & wct)
                                return (wc);
                        wc++;
                }
                wc--;
        }
+       rr = &rl->__runetype_ext;
        if (rr->__ranges != NULL && wc < rr->__ranges[0].__min) {
                wc = rr->__ranges[0].__min;
                noinc = 1;
@@ -88,3 +92,9 @@ found:
        }
        return (-1);
 }
+
+wint_t
+nextwctype(wint_t wc, wctype_t wct)
+{
+       return nextwctype_l(wc, wct, __current_locale());
+}
diff --git a/locale/FreeBSD/nextwctype.c.patch b/locale/FreeBSD/nextwctype.c.patch
deleted file mode 100644 (file)
index 4fb3399..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- nextwctype.c.orig  2009-11-09 15:05:25.000000000 -0800
-+++ nextwctype.c       2009-11-09 15:05:26.000000000 -0800
-@@ -27,28 +27,32 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <runetype.h>
- #include <wchar.h>
- #include <wctype.h>
- wint_t
--nextwctype(wint_t wc, wctype_t wct)
-+nextwctype_l(wint_t wc, wctype_t wct, locale_t loc)
- {
-       size_t lim;
--      _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext;
-+      _RuneRange *rr;
-       _RuneEntry *base, *re;
-       int noinc;
-+      _RuneLocale *rl = &loc->__lc_ctype->_CurrentRuneLocale;
-       noinc = 0;
-       if (wc < _CACHED_RUNES) {
-               wc++;
-               while (wc < _CACHED_RUNES) {
--                      if (_CurrentRuneLocale->__runetype[wc] & wct)
-+                      if (rl->__runetype[wc] & wct)
-                               return (wc);
-                       wc++;
-               }
-               wc--;
-       }
-+      rr = &rl->__runetype_ext;
-       if (rr->__ranges != NULL && wc < rr->__ranges[0].__min) {
-               wc = rr->__ranges[0].__min;
-               noinc = 1;
-@@ -88,3 +92,9 @@ found:
-       }
-       return (-1);
- }
-+
-+wint_t
-+nextwctype(wint_t wc, wctype_t wct)
-+{
-+      return nextwctype_l(wc, wct, __current_locale());
-+}
index 1185739a8b5ecdfa7e7a400c2ab8d8377a876b30..3d846deb113cff078bef484523a69e04558d5a47 100644 (file)
 .Dt NL_LANGINFO 3
 .Os
 .Sh NAME
-.Nm nl_langinfo
+.Nm nl_langinfo ,
+.Nm nl_langinfo_l
 .Nd language information
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In langinfo.h
 .Ft char *
-.Fn nl_langinfo "nl_item item"
+.Fo nl_langinfo
+.Fa "nl_item item"
+.Fc
+.In langinfo.h
+.In xlocale.h
+.Ft char *
+.Fo nl_langinfo_l
+.Fa "nl_item item"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn nl_langinfo
@@ -76,8 +86,17 @@ if the identified language was
 Portuguese, and
 .Qq Li Sun
 if the identified language was English.
+.Pp
+While the
+.Fn nl_langinfo
+function uses the current locale, the
+.Fn nl_langinfo_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh SEE ALSO
-.Xr setlocale 3
+.Xr setlocale 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn nl_langinfo
diff --git a/locale/FreeBSD/nl_langinfo.3.patch b/locale/FreeBSD/nl_langinfo.3.patch
deleted file mode 100644 (file)
index d10c7b3..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- nl_langinfo.3.orig 2009-11-30 16:10:29.000000000 -0800
-+++ nl_langinfo.3      2009-11-30 16:10:30.000000000 -0800
-@@ -28,14 +28,24 @@
- .Dt NL_LANGINFO 3
- .Os
- .Sh NAME
--.Nm nl_langinfo
-+.Nm nl_langinfo ,
-+.Nm nl_langinfo_l
- .Nd language information
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In langinfo.h
- .Ft char *
--.Fn nl_langinfo "nl_item item"
-+.Fo nl_langinfo
-+.Fa "nl_item item"
-+.Fc
-+.In langinfo.h
-+.In xlocale.h
-+.Ft char *
-+.Fo nl_langinfo_l
-+.Fa "nl_item item"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn nl_langinfo
-@@ -76,8 +86,17 @@ if the identified language was
- Portuguese, and
- .Qq Li Sun
- if the identified language was English.
-+.Pp
-+While the
-+.Fn nl_langinfo
-+function uses the current locale, the
-+.Fn nl_langinfo_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh SEE ALSO
--.Xr setlocale 3
-+.Xr setlocale 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn nl_langinfo
index 22d27a3e450f820f84ce237cc08c96c033ce049a..8a69f901c86060a830eda1c41602d57d47a677b2 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/nl_langinfo.c,v 1.17 2003/06/26 10:46:16 phantom Exp $");
 
+#include "xlocale_private.h"
+
 #include <langinfo.h>
 #include <limits.h>
 #include <locale.h>
@@ -36,62 +38,66 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/nl_langinfo.c,v 1.17 2003/06/26 10:46:16
 #include "lnumeric.h"
 #include "lmessages.h"
 #include "lmonetary.h"
-#include "../stdtime/timelocal.h"
+#include "timelocal.h"
 
 #define _REL(BASE) ((int)item-BASE)
 
 char *
-nl_langinfo(nl_item item)
+nl_langinfo_l(nl_item item, locale_t loc)
 {
-   char *ret, *s, *cs;
+   char *ret, *cs;
+   const char *s;
    static char *csym = NULL;
 
+   NORMALIZE_LOCALE(loc);
    switch (item) {
        case CODESET:
                ret = "";
-               if ((s = setlocale(LC_CTYPE, NULL)) != NULL) {
+               if ((s = querylocale(LC_CTYPE_MASK, loc)) != NULL) {
                        if ((cs = strchr(s, '.')) != NULL)
                                ret = cs + 1;
                        else if (strcmp(s, "C") == 0 ||
                                 strcmp(s, "POSIX") == 0)
                                ret = "US-ASCII";
+                       else if (strcmp(s, "UTF-8") == 0)
+                               ret = "UTF-8";
                }
                break;
        case D_T_FMT:
-               ret = (char *) __get_current_time_locale()->c_fmt;
+               ret = (char *) __get_current_time_locale(loc)->c_fmt;
                break;
        case D_FMT:
-               ret = (char *) __get_current_time_locale()->x_fmt;
+               ret = (char *) __get_current_time_locale(loc)->x_fmt;
                break;
        case T_FMT:
-               ret = (char *) __get_current_time_locale()->X_fmt;
+               ret = (char *) __get_current_time_locale(loc)->X_fmt;
                break;
        case T_FMT_AMPM:
-               ret = (char *) __get_current_time_locale()->ampm_fmt;
+               ret = (char *) __get_current_time_locale(loc)->ampm_fmt;
                break;
        case AM_STR:
-               ret = (char *) __get_current_time_locale()->am;
+               ret = (char *) __get_current_time_locale(loc)->am;
                break;
        case PM_STR:
-               ret = (char *) __get_current_time_locale()->pm;
+               ret = (char *) __get_current_time_locale(loc)->pm;
                break;
        case DAY_1: case DAY_2: case DAY_3:
        case DAY_4: case DAY_5: case DAY_6: case DAY_7:
-               ret = (char*) __get_current_time_locale()->weekday[_REL(DAY_1)];
+               ret = (char*) __get_current_time_locale(loc)->weekday[_REL(DAY_1)];
                break;
        case ABDAY_1: case ABDAY_2: case ABDAY_3:
        case ABDAY_4: case ABDAY_5: case ABDAY_6: case ABDAY_7:
-               ret = (char*) __get_current_time_locale()->wday[_REL(ABDAY_1)];
+               ret = (char*) __get_current_time_locale(loc)->wday[_REL(ABDAY_1)];
                break;
        case MON_1: case MON_2: case MON_3: case MON_4:
        case MON_5: case MON_6: case MON_7: case MON_8:
        case MON_9: case MON_10: case MON_11: case MON_12:
-               ret = (char*) __get_current_time_locale()->month[_REL(MON_1)];
+               ret = (char*) __get_current_time_locale(loc)->month[_REL(MON_1)];
                break;
        case ABMON_1: case ABMON_2: case ABMON_3: case ABMON_4:
        case ABMON_5: case ABMON_6: case ABMON_7: case ABMON_8:
        case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12:
-               ret = (char*) __get_current_time_locale()->mon[_REL(ABMON_1)];
+               ret = (char*) __get_current_time_locale(loc)->mon[_REL(ABMON_1)];
                break;
        case ERA:
                /* XXX: need to be implemented  */
@@ -114,16 +120,16 @@ nl_langinfo(nl_item item)
                ret = "";
                break;
        case RADIXCHAR:
-               ret = (char*) __get_current_numeric_locale()->decimal_point;
+               ret = (char*) __get_current_numeric_locale(loc)->decimal_point;
                break;
        case THOUSEP:
-               ret = (char*) __get_current_numeric_locale()->thousands_sep;
+               ret = (char*) __get_current_numeric_locale(loc)->thousands_sep;
                break;
        case YESEXPR:
-               ret = (char*) __get_current_messages_locale()->yesexpr;
+               ret = (char*) __get_current_messages_locale(loc)->yesexpr;
                break;
        case NOEXPR:
-               ret = (char*) __get_current_messages_locale()->noexpr;
+               ret = (char*) __get_current_messages_locale(loc)->noexpr;
                break;
        /*
         * YESSTR and NOSTR items marked with LEGACY are available, but not
@@ -131,25 +137,25 @@ nl_langinfo(nl_item item)
         * they're subject to remove in future specification editions.
         */
        case YESSTR:            /* LEGACY  */
-               ret = (char*) __get_current_messages_locale()->yesstr;
+               ret = (char*) __get_current_messages_locale(loc)->yesstr;
                break;
        case NOSTR:             /* LEGACY  */
-               ret = (char*) __get_current_messages_locale()->nostr;
+               ret = (char*) __get_current_messages_locale(loc)->nostr;
                break;
        /*
         * SUSv2 special formatted currency string 
         */
        case CRNCYSTR:
                ret = "";
-               cs = (char*) __get_current_monetary_locale()->currency_symbol;
+               cs = (char*) __get_current_monetary_locale(loc)->currency_symbol;
                if (*cs != '\0') {
-                       char pos = localeconv()->p_cs_precedes;
+                       char pos = localeconv_l(loc)->p_cs_precedes;
 
-                       if (pos == localeconv()->n_cs_precedes) {
+                       if (pos == localeconv_l(loc)->n_cs_precedes) {
                                char psn = '\0';
 
                                if (pos == CHAR_MAX) {
-                                       if (strcmp(cs, __get_current_monetary_locale()->mon_decimal_point) == 0)
+                                       if (strcmp(cs, __get_current_monetary_locale(loc)->mon_decimal_point) == 0)
                                                psn = '.';
                                } else
                                        psn = pos ? '-' : '+';
@@ -166,10 +172,19 @@ nl_langinfo(nl_item item)
                }
                break;
        case D_MD_ORDER:        /* FreeBSD local extension */
-               ret = (char *) __get_current_time_locale()->md_order;
+               ret = (char *) __get_current_time_locale(loc)->md_order;
                break;
        default:
-               ret = "";
+               return "";      /* do not consult POSIX */
+   }
+   if (ret && !ret[0] && item != D_MD_ORDER && item != CODESET && loc != _c_locale) {
+       ret = nl_langinfo_l(item, _c_locale);
    }
    return (ret);
 }
+
+char *
+nl_langinfo(nl_item item)
+{
+       return (nl_langinfo_l(item, __current_locale()));
+}
diff --git a/locale/FreeBSD/nl_langinfo.c.patch b/locale/FreeBSD/nl_langinfo.c.patch
deleted file mode 100644 (file)
index 7e05fb5..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
---- nl_langinfo.c.orig 2009-11-09 18:47:29.000000000 -0800
-+++ nl_langinfo.c      2009-11-09 18:47:34.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/nl_langinfo.c,v 1.17 2003/06/26 10:46:16 phantom Exp $");
-+#include "xlocale_private.h"
-+
- #include <langinfo.h>
- #include <limits.h>
- #include <locale.h>
-@@ -36,62 +38,66 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "lnumeric.h"
- #include "lmessages.h"
- #include "lmonetary.h"
--#include "../stdtime/timelocal.h"
-+#include "timelocal.h"
- #define _REL(BASE) ((int)item-BASE)
- char *
--nl_langinfo(nl_item item)
-+nl_langinfo_l(nl_item item, locale_t loc)
- {
--   char *ret, *s, *cs;
-+   char *ret, *cs;
-+   const char *s;
-    static char *csym = NULL;
-+   NORMALIZE_LOCALE(loc);
-    switch (item) {
-       case CODESET:
-               ret = "";
--              if ((s = setlocale(LC_CTYPE, NULL)) != NULL) {
-+              if ((s = querylocale(LC_CTYPE_MASK, loc)) != NULL) {
-                       if ((cs = strchr(s, '.')) != NULL)
-                               ret = cs + 1;
-                       else if (strcmp(s, "C") == 0 ||
-                                strcmp(s, "POSIX") == 0)
-                               ret = "US-ASCII";
-+                      else if (strcmp(s, "UTF-8") == 0)
-+                              ret = "UTF-8";
-               }
-               break;
-       case D_T_FMT:
--              ret = (char *) __get_current_time_locale()->c_fmt;
-+              ret = (char *) __get_current_time_locale(loc)->c_fmt;
-               break;
-       case D_FMT:
--              ret = (char *) __get_current_time_locale()->x_fmt;
-+              ret = (char *) __get_current_time_locale(loc)->x_fmt;
-               break;
-       case T_FMT:
--              ret = (char *) __get_current_time_locale()->X_fmt;
-+              ret = (char *) __get_current_time_locale(loc)->X_fmt;
-               break;
-       case T_FMT_AMPM:
--              ret = (char *) __get_current_time_locale()->ampm_fmt;
-+              ret = (char *) __get_current_time_locale(loc)->ampm_fmt;
-               break;
-       case AM_STR:
--              ret = (char *) __get_current_time_locale()->am;
-+              ret = (char *) __get_current_time_locale(loc)->am;
-               break;
-       case PM_STR:
--              ret = (char *) __get_current_time_locale()->pm;
-+              ret = (char *) __get_current_time_locale(loc)->pm;
-               break;
-       case DAY_1: case DAY_2: case DAY_3:
-       case DAY_4: case DAY_5: case DAY_6: case DAY_7:
--              ret = (char*) __get_current_time_locale()->weekday[_REL(DAY_1)];
-+              ret = (char*) __get_current_time_locale(loc)->weekday[_REL(DAY_1)];
-               break;
-       case ABDAY_1: case ABDAY_2: case ABDAY_3:
-       case ABDAY_4: case ABDAY_5: case ABDAY_6: case ABDAY_7:
--              ret = (char*) __get_current_time_locale()->wday[_REL(ABDAY_1)];
-+              ret = (char*) __get_current_time_locale(loc)->wday[_REL(ABDAY_1)];
-               break;
-       case MON_1: case MON_2: case MON_3: case MON_4:
-       case MON_5: case MON_6: case MON_7: case MON_8:
-       case MON_9: case MON_10: case MON_11: case MON_12:
--              ret = (char*) __get_current_time_locale()->month[_REL(MON_1)];
-+              ret = (char*) __get_current_time_locale(loc)->month[_REL(MON_1)];
-               break;
-       case ABMON_1: case ABMON_2: case ABMON_3: case ABMON_4:
-       case ABMON_5: case ABMON_6: case ABMON_7: case ABMON_8:
-       case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12:
--              ret = (char*) __get_current_time_locale()->mon[_REL(ABMON_1)];
-+              ret = (char*) __get_current_time_locale(loc)->mon[_REL(ABMON_1)];
-               break;
-       case ERA:
-               /* XXX: need to be implemented  */
-@@ -114,16 +120,16 @@ nl_langinfo(nl_item item)
-               ret = "";
-               break;
-       case RADIXCHAR:
--              ret = (char*) __get_current_numeric_locale()->decimal_point;
-+              ret = (char*) __get_current_numeric_locale(loc)->decimal_point;
-               break;
-       case THOUSEP:
--              ret = (char*) __get_current_numeric_locale()->thousands_sep;
-+              ret = (char*) __get_current_numeric_locale(loc)->thousands_sep;
-               break;
-       case YESEXPR:
--              ret = (char*) __get_current_messages_locale()->yesexpr;
-+              ret = (char*) __get_current_messages_locale(loc)->yesexpr;
-               break;
-       case NOEXPR:
--              ret = (char*) __get_current_messages_locale()->noexpr;
-+              ret = (char*) __get_current_messages_locale(loc)->noexpr;
-               break;
-       /*
-        * YESSTR and NOSTR items marked with LEGACY are available, but not
-@@ -131,25 +137,25 @@ nl_langinfo(nl_item item)
-        * they're subject to remove in future specification editions.
-        */
-       case YESSTR:            /* LEGACY  */
--              ret = (char*) __get_current_messages_locale()->yesstr;
-+              ret = (char*) __get_current_messages_locale(loc)->yesstr;
-               break;
-       case NOSTR:             /* LEGACY  */
--              ret = (char*) __get_current_messages_locale()->nostr;
-+              ret = (char*) __get_current_messages_locale(loc)->nostr;
-               break;
-       /*
-        * SUSv2 special formatted currency string 
-        */
-       case CRNCYSTR:
-               ret = "";
--              cs = (char*) __get_current_monetary_locale()->currency_symbol;
-+              cs = (char*) __get_current_monetary_locale(loc)->currency_symbol;
-               if (*cs != '\0') {
--                      char pos = localeconv()->p_cs_precedes;
-+                      char pos = localeconv_l(loc)->p_cs_precedes;
--                      if (pos == localeconv()->n_cs_precedes) {
-+                      if (pos == localeconv_l(loc)->n_cs_precedes) {
-                               char psn = '\0';
-                               if (pos == CHAR_MAX) {
--                                      if (strcmp(cs, __get_current_monetary_locale()->mon_decimal_point) == 0)
-+                                      if (strcmp(cs, __get_current_monetary_locale(loc)->mon_decimal_point) == 0)
-                                               psn = '.';
-                               } else
-                                       psn = pos ? '-' : '+';
-@@ -166,10 +172,19 @@ nl_langinfo(nl_item item)
-               }
-               break;
-       case D_MD_ORDER:        /* FreeBSD local extension */
--              ret = (char *) __get_current_time_locale()->md_order;
-+              ret = (char *) __get_current_time_locale(loc)->md_order;
-               break;
-       default:
--              ret = "";
-+              return "";      /* do not consult POSIX */
-+   }
-+   if (ret && !ret[0] && item != D_MD_ORDER && item != CODESET && loc != _c_locale) {
-+       ret = nl_langinfo_l(item, _c_locale);
-    }
-    return (ret);
- }
-+
-+char *
-+nl_langinfo(nl_item item)
-+{
-+      return (nl_langinfo_l(item, __current_locale()));
-+}
index cc94e471cb94326f5daf1f38ac9a60561d1bfb70..c3c75cf6a4151740ef102fa8c137a0c4cf05dbd7 100644 (file)
@@ -37,6 +37,8 @@ static char sccsid[] = "@(#)none.c    8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <runetype.h>
@@ -47,39 +49,27 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache E
 #include <wchar.h>
 #include "mblocal.h"
 
-static size_t  _none_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _none_mbsinit(const mbstate_t *);
-static size_t  _none_mbsnrtowcs(wchar_t * __restrict dst,
-                   const char ** __restrict src, size_t nms, size_t len,
-                   mbstate_t * __restrict ps __unused);
-static size_t  _none_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
-static size_t  _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                   size_t, size_t, mbstate_t * __restrict);
-
 /* setup defaults */
 
 int __mb_cur_max = 1;
 int __mb_sb_limit = 256; /* Expected to be <= _CACHED_RUNES */
 
-int
-_none_init(_RuneLocale *rl)
+__private_extern__ int
+_none_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _none_mbrtowc;
-       __mbsinit = _none_mbsinit;
-       __mbsnrtowcs = _none_mbsnrtowcs;
-       __wcrtomb = _none_wcrtomb;
-       __wcsnrtombs = _none_wcsnrtombs;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 1;
-       __mb_sb_limit = 256;
+       xrl->__mbrtowc = _none_mbrtowc;
+       xrl->__mbsinit = _none_mbsinit;
+       xrl->__mbsnrtowcs = _none_mbsnrtowcs;
+       xrl->__wcrtomb = _none_wcrtomb;
+       xrl->__wcsnrtombs = _none_wcsnrtombs;
+       xrl->__mb_cur_max = 1;
+       xrl->__mb_sb_limit = 256;
        return(0);
 }
 
-static int
-_none_mbsinit(const mbstate_t *ps __unused)
+__private_extern__ int
+_none_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused)
 {
 
        /*
@@ -89,9 +79,9 @@ _none_mbsinit(const mbstate_t *ps __unused)
        return (1);
 }
 
-static size_t
+__private_extern__ size_t
 _none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps __unused)
+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
 
        if (s == NULL)
@@ -105,9 +95,9 @@ _none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
        return (*s == '\0' ? 0 : 1);
 }
 
-static size_t
+__private_extern__ size_t
 _none_wcrtomb(char * __restrict s, wchar_t wc,
-    mbstate_t * __restrict ps __unused)
+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
 
        if (s == NULL)
@@ -121,9 +111,9 @@ _none_wcrtomb(char * __restrict s, wchar_t wc,
        return (1);
 }
 
-static size_t
+__private_extern__ 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 nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
        const char *s;
        size_t nchr;
@@ -146,9 +136,9 @@ _none_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
        return (nchr);
 }
 
-static size_t
+__private_extern__ size_t
 _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps __unused)
+    size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
 {
        const wchar_t *s;
        size_t nchr;
@@ -179,16 +169,3 @@ _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
        *src = s;
        return (nchr);
 }
-
-/* setup defaults */
-
-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 (*__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 (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
-    size_t, size_t, mbstate_t * __restrict) = _none_wcsnrtombs;
-
diff --git a/locale/FreeBSD/none.c.patch b/locale/FreeBSD/none.c.patch
deleted file mode 100644 (file)
index 405e5fd..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
---- none.c.orig        2009-11-09 18:24:17.000000000 -0800
-+++ none.c     2009-11-10 11:08:33.000000000 -0800
-@@ -37,6 +37,8 @@ static char sccsid[] = "@(#)none.c   8.1 (
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <runetype.h>
-@@ -47,39 +49,27 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--static size_t _none_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _none_mbsinit(const mbstate_t *);
--static size_t _none_mbsnrtowcs(wchar_t * __restrict dst,
--                  const char ** __restrict src, size_t nms, size_t len,
--                  mbstate_t * __restrict ps __unused);
--static size_t _none_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
--static size_t _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
--                  size_t, size_t, mbstate_t * __restrict);
--
- /* setup defaults */
- int __mb_cur_max = 1;
- int __mb_sb_limit = 256; /* Expected to be <= _CACHED_RUNES */
--int
--_none_init(_RuneLocale *rl)
-+__private_extern__ int
-+_none_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _none_mbrtowc;
--      __mbsinit = _none_mbsinit;
--      __mbsnrtowcs = _none_mbsnrtowcs;
--      __wcrtomb = _none_wcrtomb;
--      __wcsnrtombs = _none_wcsnrtombs;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 1;
--      __mb_sb_limit = 256;
-+      xrl->__mbrtowc = _none_mbrtowc;
-+      xrl->__mbsinit = _none_mbsinit;
-+      xrl->__mbsnrtowcs = _none_mbsnrtowcs;
-+      xrl->__wcrtomb = _none_wcrtomb;
-+      xrl->__wcsnrtombs = _none_wcsnrtombs;
-+      xrl->__mb_cur_max = 1;
-+      xrl->__mb_sb_limit = 256;
-       return(0);
- }
--static int
--_none_mbsinit(const mbstate_t *ps __unused)
-+__private_extern__ int
-+_none_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused)
- {
-       /*
-@@ -89,9 +79,9 @@ _none_mbsinit(const mbstate_t *ps __unus
-       return (1);
- }
--static size_t
-+__private_extern__ size_t
- _none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps __unused)
-+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       if (s == NULL)
-@@ -105,9 +95,9 @@ _none_mbrtowc(wchar_t * __restrict pwc, 
-       return (*s == '\0' ? 0 : 1);
- }
--static size_t
-+__private_extern__ size_t
- _none_wcrtomb(char * __restrict s, wchar_t wc,
--    mbstate_t * __restrict ps __unused)
-+    mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       if (s == NULL)
-@@ -121,9 +111,9 @@ _none_wcrtomb(char * __restrict s, wchar
-       return (1);
- }
--static size_t
-+__private_extern__ 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 nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       const char *s;
-       size_t nchr;
-@@ -146,9 +136,9 @@ _none_mbsnrtowcs(wchar_t * __restrict ds
-       return (nchr);
- }
--static size_t
-+__private_extern__ size_t
- _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
--    size_t nwc, size_t len, mbstate_t * __restrict ps __unused)
-+    size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
- {
-       const wchar_t *s;
-       size_t nchr;
-@@ -179,16 +169,3 @@ _none_wcsnrtombs(char * __restrict dst, 
-       *src = s;
-       return (nchr);
- }
--
--/* setup defaults */
--
--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 (*__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 (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
--    size_t, size_t, mbstate_t * __restrict) = _none_wcsnrtombs;
--
index e5ecfe8b3323cefaff882865a570577ef3f522bc..59637617398c7cf6a623c19fe0c258e05f910aec 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifndef RUNEOFF32
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)rune.c     8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/rune.c,v 1.12 2004/07/29 06:16:19 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <arpa/inet.h>
 #include <errno.h>
 #include <runetype.h>
+#else
+#include "runetype.h"
+#endif /* !RUNEOFF32 */
 #include <stdio.h>
+#ifndef RUNEOFF32
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include "un-namespace.h"
+#endif /* !RUNEOFF32 */
 
-_RuneLocale *
+#if defined(__LP64__) || defined(RUNEOFF32)
+/*
+ * Because the LC_CTYPE files were created with a 32-bit program, we need
+ * to adjust for the larger pointers in LP64 (the longs have already been
+ * replaced by 32-bit equivalents).  Also, natural alignment will pad
+ * 64-bit types to 8-byte boundaries, and make structures containing
+ * 64-bit types sized to 8-byte boundaries.
+ */
+#include <stddef.h>
+#ifndef RUNEOFF32
+#include "rune32.h"
+#define BYTES32BITS            4
+#define BYTES64BITS            8
+/* whether to skip over a pointer or not (one-to-one with off64) */
+int skip[] = {
+       1,
+       1,
+       0,
+       1,
+       0,
+       1,
+       0,
+       1,
+       1,
+       1,
+       0
+};
+#endif /* !RUNEOFF32 */
+int off64[] = {
+       offsetof(_RuneLocale, __sgetrune),
+       offsetof(_RuneLocale, __sputrune),
+       offsetof(_RuneLocale, __runetype_ext),
+       offsetof(_RuneLocale, __runetype_ext) + offsetof(_RuneRange, __ranges),
+       offsetof(_RuneLocale, __maplower_ext),
+       offsetof(_RuneLocale, __maplower_ext) + offsetof(_RuneRange, __ranges),
+       offsetof(_RuneLocale, __mapupper_ext),
+       offsetof(_RuneLocale, __mapupper_ext) + offsetof(_RuneRange, __ranges),
+       offsetof(_RuneLocale, __variable),
+       offsetof(_RuneLocale, __charclasses),
+       sizeof(_RuneLocale)
+};
+#define        NOFF                    (sizeof(off64) / sizeof(int))
+#ifdef RUNEOFF32
+/*
+ * This program generates a header file (on stdout) that containes the 32-bit
+ * offsets, plus some 32-bit sizes
+ */
+main()
+{
+       int i;
+       printf("#define SIZEOF32_RUNEENTRY %d\n", sizeof(_RuneEntry));
+       printf("#define SIZEOF32_RUNELOCALE %d\n", sizeof(_RuneLocale));
+       printf("int off32[] = {\n");
+       for(i = 0; i < NOFF; i++)
+               printf("\t%d,\n", off64[i]);
+       printf("};\n");
+       return 0;
+}
+#endif /* RUNEOFF32 */
+#else /* !__LP64__ && !RUNEOFF32 */
+#define        SIZEOF32_RUNELOCALE     sizeof(_RuneLocale)
+#endif /* __LP64__ || RUNEOFF32 */
+
+#ifndef RUNEOFF32
+struct __xlocale_st_runelocale *
 _Read_RuneMagi(fp)
        FILE *fp;
 {
-       char *data;
+       struct __xlocale_st_runelocale *data;
        void *lastp;
        _RuneLocale *rl;
        _RuneEntry *rr;
@@ -65,13 +137,20 @@ _Read_RuneMagi(fp)
        if (_fstat(fileno(fp), &sb) < 0)
                return (NULL);
 
-       if (sb.st_size < sizeof(_RuneLocale)) {
+       if (sb.st_size < SIZEOF32_RUNELOCALE) {
                errno = EFTYPE;
                return (NULL);
        }
 
-       if ((data = malloc(sb.st_size)) == NULL)
+#ifdef __LP64__
+       /* will adjust later */
+       if ((data = (struct __xlocale_st_runelocale *)malloc(sizeof(struct __xlocale_st_runelocale))) == NULL)
+#else /* !__LP64__ */
+       if ((data = (struct __xlocale_st_runelocale *)malloc(sizeof(struct __xlocale_st_runelocale) - sizeof(_RuneLocale) + sb.st_size)) == NULL)
+#endif /* __LP64__ */
                return (NULL);
+       data->__refcount = 1;
+       data->__free_extra = NULL;
 
        errno = 0;
        rewind(fp); /* Someone might have read the magic number once already */
@@ -82,26 +161,43 @@ _Read_RuneMagi(fp)
                return (NULL);
        }
 
-       if (fread(data, sb.st_size, 1, fp) != 1) {
+       rl = &data->_CurrentRuneLocale;
+
+#ifdef __LP64__
+       if (fread(rl, SIZEOF32_RUNELOCALE, 1, fp) != 1)
+#else /* !__LP64__ */
+       if (fread(rl, sb.st_size, 1, fp) != 1)
+#endif /* __LP64__ */
+       {
                saverr = errno;
                free(data);
                errno = saverr;
                return (NULL);
        }
 
-       rl = (_RuneLocale *)data;
-       lastp = data + sb.st_size;
+#ifndef __LP64__
+       lastp = (char *)rl + sb.st_size;
 
        rl->__variable = rl + 1;
+#endif /* __LP64__ */
 
-       if (memcmp(rl->__magic, _RUNE_MAGIC_1, sizeof(rl->__magic))) {
+       if (memcmp(rl->__magic, _RUNE_MAGIC_A, sizeof(rl->__magic))) {
                free(data);
                errno = EFTYPE;
                return (NULL);
        }
 
+#ifdef __LP64__
+       /* shift things into the right position */
+       for (x = NOFF - 2; x >= 0; x--)
+               memmove((char *)rl + off64[x] + (skip[x] ? BYTES64BITS : 0),
+                       (char *)rl + off32[x] + (skip[x] ? BYTES32BITS : 0),
+                       off32[x + 1] - off32[x] - (skip[x] ? BYTES32BITS : 0));
+#endif /* __LP64__ */
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
        rl->__invalid_rune = ntohl(rl->__invalid_rune);
        rl->__variable_len = ntohl(rl->__variable_len);
+       rl->__ncharclasses = ntohl(rl->__ncharclasses);
        rl->__runetype_ext.__nranges = ntohl(rl->__runetype_ext.__nranges);
        rl->__maplower_ext.__nranges = ntohl(rl->__maplower_ext.__nranges);
        rl->__mapupper_ext.__nranges = ntohl(rl->__mapupper_ext.__nranges);
@@ -111,7 +207,54 @@ _Read_RuneMagi(fp)
                rl->__maplower[x] = ntohl(rl->__maplower[x]);
                rl->__mapupper[x] = ntohl(rl->__mapupper[x]);
        }
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
 
+#ifdef __LP64__
+       {
+       int count = rl->__runetype_ext.__nranges + rl->__maplower_ext.__nranges
+           + rl->__mapupper_ext.__nranges;
+       int extra = sb.st_size - SIZEOF32_RUNELOCALE - count * SIZEOF32_RUNEENTRY - rl->__ncharclasses * sizeof(_RuneCharClass);
+       _RuneEntry *rp;
+
+       if (extra < 0) {
+               saverr = errno;
+               free(data);
+               errno = saverr;
+               return (NULL);
+       }
+       if ((data = (struct __xlocale_st_runelocale *)reallocf(data, sizeof(struct __xlocale_st_runelocale)
+           + count * sizeof(_RuneEntry)
+           + rl->__ncharclasses * sizeof(_RuneCharClass)
+           + extra)) == NULL)
+               return (NULL);
+       rl = &data->_CurrentRuneLocale;
+       rl->__variable = rl + 1;
+       rp = (_RuneEntry *)rl->__variable;
+       for (x = 0; x < count; x++, rp++)
+               if (fread(rp, SIZEOF32_RUNEENTRY, 1, fp) != 1) {
+                       saverr = errno;
+                       free(data);
+                       errno = saverr;
+                       return (NULL);
+               }
+       if (rl->__ncharclasses > 0) {
+               if (fread(rp, sizeof(_RuneCharClass), rl->__ncharclasses, fp) != rl->__ncharclasses) {
+                       saverr = errno;
+                       free(data);
+                       errno = saverr;
+                       return (NULL);
+               }
+               rp = (_RuneEntry *)((char *)rp + rl->__ncharclasses * sizeof(_RuneCharClass));
+       }
+       if (extra > 0 && fread(rp, extra, 1, fp) != 1) {
+               saverr = errno;
+               free(data);
+               errno = saverr;
+               return (NULL);
+       }
+       lastp = (char *)rp + extra;
+       }
+#endif /* __LP64__ */
        rl->__runetype_ext.__ranges = (_RuneEntry *)rl->__variable;
        rl->__variable = rl->__runetype_ext.__ranges +
            rl->__runetype_ext.__nranges;
@@ -142,8 +285,10 @@ _Read_RuneMagi(fp)
        for (x = 0; x < rl->__runetype_ext.__nranges; ++x) {
                rr = rl->__runetype_ext.__ranges;
 
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
                rr[x].__min = ntohl(rr[x].__min);
                rr[x].__max = ntohl(rr[x].__max);
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
                if ((rr[x].__map = ntohl(rr[x].__map)) == 0) {
                        int len = rr[x].__max - rr[x].__min + 1;
                        rr[x].__types = rl->__variable;
@@ -153,12 +298,15 @@ _Read_RuneMagi(fp)
                                errno = EFTYPE;
                                return (NULL);
                        }
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
                        while (len-- > 0)
                                rr[x].__types[len] = ntohl(rr[x].__types[len]);
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
                } else
                        rr[x].__types = 0;
        }
 
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
        for (x = 0; x < rl->__maplower_ext.__nranges; ++x) {
                rr = rl->__maplower_ext.__ranges;
 
@@ -174,6 +322,22 @@ _Read_RuneMagi(fp)
                rr[x].__max = ntohl(rr[x].__max);
                rr[x].__map = ntohl(rr[x].__map);
        }
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
+
+       if (rl->__ncharclasses > 0) {
+               rl->__charclasses = (_RuneCharClass *)rl->__variable;
+               rl->__variable = (void *)(rl->__charclasses + rl->__ncharclasses);
+               if (rl->__variable > lastp) {
+                       free(data);
+                       errno = EFTYPE;
+                       return (NULL);
+               }
+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+               for (x = 0; x < rl->__ncharclasses; ++x)
+                       rl->__charclasses[x].__mask = ntohl(rl->__charclasses[x].__mask);
+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
+       }
+
        if (((char *)rl->__variable) + rl->__variable_len > (char *)lastp) {
                free(data);
                errno = EFTYPE;
@@ -195,5 +359,7 @@ _Read_RuneMagi(fp)
        if (!rl->__mapupper_ext.__nranges)
                rl->__mapupper_ext.__ranges = 0;
 
-       return (rl);
+       data->__datasize = lastp - (void *)data;
+       return (data);
 }
+#endif /* !RUNEOFF32 */
diff --git a/locale/FreeBSD/rune.c.patch b/locale/FreeBSD/rune.c.patch
deleted file mode 100644 (file)
index 402153d..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-Index: rune.c
-===================================================================
---- rune.c     (revision 59751)
-+++ rune.c     (working copy)
-@@ -34,28 +34,100 @@
-  * SUCH DAMAGE.
-  */
-+#ifndef RUNEOFF32
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)rune.c    8.1 (Berkeley) 6/4/93";
- #endif /* LIBC_SCCS and not lint */
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/rune.c,v 1.12 2004/07/29 06:16:19 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <arpa/inet.h>
- #include <errno.h>
- #include <runetype.h>
-+#else
-+#include "runetype.h"
-+#endif /* !RUNEOFF32 */
- #include <stdio.h>
-+#ifndef RUNEOFF32
- #include <string.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include "un-namespace.h"
-+#endif /* !RUNEOFF32 */
--_RuneLocale *
-+#if defined(__LP64__) || defined(RUNEOFF32)
-+/*
-+ * Because the LC_CTYPE files were created with a 32-bit program, we need
-+ * to adjust for the larger pointers in LP64 (the longs have already been
-+ * replaced by 32-bit equivalents).  Also, natural alignment will pad
-+ * 64-bit types to 8-byte boundaries, and make structures containing
-+ * 64-bit types sized to 8-byte boundaries.
-+ */
-+#include <stddef.h>
-+#ifndef RUNEOFF32
-+#include "rune32.h"
-+#define BYTES32BITS           4
-+#define BYTES64BITS           8
-+/* whether to skip over a pointer or not (one-to-one with off64) */
-+int skip[] = {
-+      1,
-+      1,
-+      0,
-+      1,
-+      0,
-+      1,
-+      0,
-+      1,
-+      1,
-+      1,
-+      0
-+};
-+#endif /* !RUNEOFF32 */
-+int off64[] = {
-+      offsetof(_RuneLocale, __sgetrune),
-+      offsetof(_RuneLocale, __sputrune),
-+      offsetof(_RuneLocale, __runetype_ext),
-+      offsetof(_RuneLocale, __runetype_ext) + offsetof(_RuneRange, __ranges),
-+      offsetof(_RuneLocale, __maplower_ext),
-+      offsetof(_RuneLocale, __maplower_ext) + offsetof(_RuneRange, __ranges),
-+      offsetof(_RuneLocale, __mapupper_ext),
-+      offsetof(_RuneLocale, __mapupper_ext) + offsetof(_RuneRange, __ranges),
-+      offsetof(_RuneLocale, __variable),
-+      offsetof(_RuneLocale, __charclasses),
-+      sizeof(_RuneLocale)
-+};
-+#define       NOFF                    (sizeof(off64) / sizeof(int))
-+#ifdef RUNEOFF32
-+/*
-+ * This program generates a header file (on stdout) that containes the 32-bit
-+ * offsets, plus some 32-bit sizes
-+ */
-+main()
-+{
-+      int i;
-+      printf("#define SIZEOF32_RUNEENTRY %d\n", sizeof(_RuneEntry));
-+      printf("#define SIZEOF32_RUNELOCALE %d\n", sizeof(_RuneLocale));
-+      printf("int off32[] = {\n");
-+      for(i = 0; i < NOFF; i++)
-+              printf("\t%d,\n", off64[i]);
-+      printf("};\n");
-+      return 0;
-+}
-+#endif /* RUNEOFF32 */
-+#else /* !__LP64__ && !RUNEOFF32 */
-+#define       SIZEOF32_RUNELOCALE     sizeof(_RuneLocale)
-+#endif /* __LP64__ || RUNEOFF32 */
-+
-+#ifndef RUNEOFF32
-+struct __xlocale_st_runelocale *
- _Read_RuneMagi(fp)
-       FILE *fp;
- {
--      char *data;
-+      struct __xlocale_st_runelocale *data;
-       void *lastp;
-       _RuneLocale *rl;
-       _RuneEntry *rr;
-@@ -65,13 +137,20 @@
-       if (_fstat(fileno(fp), &sb) < 0)
-               return (NULL);
--      if (sb.st_size < sizeof(_RuneLocale)) {
-+      if (sb.st_size < SIZEOF32_RUNELOCALE) {
-               errno = EFTYPE;
-               return (NULL);
-       }
--      if ((data = malloc(sb.st_size)) == NULL)
-+#ifdef __LP64__
-+      /* will adjust later */
-+      if ((data = (struct __xlocale_st_runelocale *)malloc(sizeof(struct __xlocale_st_runelocale))) == NULL)
-+#else /* !__LP64__ */
-+      if ((data = (struct __xlocale_st_runelocale *)malloc(sizeof(struct __xlocale_st_runelocale) - sizeof(_RuneLocale) + sb.st_size)) == NULL)
-+#endif /* __LP64__ */
-               return (NULL);
-+      data->__refcount = 1;
-+      data->__free_extra = NULL;
-       errno = 0;
-       rewind(fp); /* Someone might have read the magic number once already */
-@@ -82,26 +161,43 @@
-               return (NULL);
-       }
--      if (fread(data, sb.st_size, 1, fp) != 1) {
-+      rl = &data->_CurrentRuneLocale;
-+
-+#ifdef __LP64__
-+      if (fread(rl, SIZEOF32_RUNELOCALE, 1, fp) != 1)
-+#else /* !__LP64__ */
-+      if (fread(rl, sb.st_size, 1, fp) != 1)
-+#endif /* __LP64__ */
-+      {
-               saverr = errno;
-               free(data);
-               errno = saverr;
-               return (NULL);
-       }
--      rl = (_RuneLocale *)data;
--      lastp = data + sb.st_size;
-+#ifndef __LP64__
-+      lastp = (char *)rl + sb.st_size;
-       rl->__variable = rl + 1;
-+#endif /* __LP64__ */
--      if (memcmp(rl->__magic, _RUNE_MAGIC_1, sizeof(rl->__magic))) {
-+      if (memcmp(rl->__magic, _RUNE_MAGIC_A, sizeof(rl->__magic))) {
-               free(data);
-               errno = EFTYPE;
-               return (NULL);
-       }
-+#ifdef __LP64__
-+      /* shift things into the right position */
-+      for (x = NOFF - 2; x >= 0; x--)
-+              memmove((char *)rl + off64[x] + (skip[x] ? BYTES64BITS : 0),
-+                      (char *)rl + off32[x] + (skip[x] ? BYTES32BITS : 0),
-+                      off32[x + 1] - off32[x] - (skip[x] ? BYTES32BITS : 0));
-+#endif /* __LP64__ */
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-       rl->__invalid_rune = ntohl(rl->__invalid_rune);
-       rl->__variable_len = ntohl(rl->__variable_len);
-+      rl->__ncharclasses = ntohl(rl->__ncharclasses);
-       rl->__runetype_ext.__nranges = ntohl(rl->__runetype_ext.__nranges);
-       rl->__maplower_ext.__nranges = ntohl(rl->__maplower_ext.__nranges);
-       rl->__mapupper_ext.__nranges = ntohl(rl->__mapupper_ext.__nranges);
-@@ -111,7 +207,54 @@
-               rl->__maplower[x] = ntohl(rl->__maplower[x]);
-               rl->__mapupper[x] = ntohl(rl->__mapupper[x]);
-       }
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-+#ifdef __LP64__
-+      {
-+      int count = rl->__runetype_ext.__nranges + rl->__maplower_ext.__nranges
-+          + rl->__mapupper_ext.__nranges;
-+      int extra = sb.st_size - SIZEOF32_RUNELOCALE - count * SIZEOF32_RUNEENTRY - rl->__ncharclasses * sizeof(_RuneCharClass);
-+      _RuneEntry *rp;
-+
-+      if (extra < 0) {
-+              saverr = errno;
-+              free(data);
-+              errno = saverr;
-+              return (NULL);
-+      }
-+      if ((data = (struct __xlocale_st_runelocale *)reallocf(data, sizeof(struct __xlocale_st_runelocale)
-+          + count * sizeof(_RuneEntry)
-+          + rl->__ncharclasses * sizeof(_RuneCharClass)
-+          + extra)) == NULL)
-+              return (NULL);
-+      rl = &data->_CurrentRuneLocale;
-+      rl->__variable = rl + 1;
-+      rp = (_RuneEntry *)rl->__variable;
-+      for (x = 0; x < count; x++, rp++)
-+              if (fread(rp, SIZEOF32_RUNEENTRY, 1, fp) != 1) {
-+                      saverr = errno;
-+                      free(data);
-+                      errno = saverr;
-+                      return (NULL);
-+              }
-+      if (rl->__ncharclasses > 0) {
-+              if (fread(rp, sizeof(_RuneCharClass), rl->__ncharclasses, fp) != rl->__ncharclasses) {
-+                      saverr = errno;
-+                      free(data);
-+                      errno = saverr;
-+                      return (NULL);
-+              }
-+              rp = (_RuneEntry *)((char *)rp + rl->__ncharclasses * sizeof(_RuneCharClass));
-+      }
-+      if (extra > 0 && fread(rp, extra, 1, fp) != 1) {
-+              saverr = errno;
-+              free(data);
-+              errno = saverr;
-+              return (NULL);
-+      }
-+      lastp = (char *)rp + extra;
-+      }
-+#endif /* __LP64__ */
-       rl->__runetype_ext.__ranges = (_RuneEntry *)rl->__variable;
-       rl->__variable = rl->__runetype_ext.__ranges +
-           rl->__runetype_ext.__nranges;
-@@ -142,8 +285,10 @@
-       for (x = 0; x < rl->__runetype_ext.__nranges; ++x) {
-               rr = rl->__runetype_ext.__ranges;
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-               rr[x].__min = ntohl(rr[x].__min);
-               rr[x].__max = ntohl(rr[x].__max);
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-               if ((rr[x].__map = ntohl(rr[x].__map)) == 0) {
-                       int len = rr[x].__max - rr[x].__min + 1;
-                       rr[x].__types = rl->__variable;
-@@ -153,12 +298,15 @@
-                               errno = EFTYPE;
-                               return (NULL);
-                       }
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-                       while (len-- > 0)
-                               rr[x].__types[len] = ntohl(rr[x].__types[len]);
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-               } else
-                       rr[x].__types = 0;
-       }
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-       for (x = 0; x < rl->__maplower_ext.__nranges; ++x) {
-               rr = rl->__maplower_ext.__ranges;
-@@ -174,6 +322,22 @@
-               rr[x].__max = ntohl(rr[x].__max);
-               rr[x].__map = ntohl(rr[x].__map);
-       }
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-+
-+      if (rl->__ncharclasses > 0) {
-+              rl->__charclasses = (_RuneCharClass *)rl->__variable;
-+              rl->__variable = (void *)(rl->__charclasses + rl->__ncharclasses);
-+              if (rl->__variable > lastp) {
-+                      free(data);
-+                      errno = EFTYPE;
-+                      return (NULL);
-+              }
-+#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-+              for (x = 0; x < rl->__ncharclasses; ++x)
-+                      rl->__charclasses[x].__mask = ntohl(rl->__charclasses[x].__mask);
-+#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-+      }
-+
-       if (((char *)rl->__variable) + rl->__variable_len > (char *)lastp) {
-               free(data);
-               errno = EFTYPE;
-@@ -195,5 +359,7 @@
-       if (!rl->__mapupper_ext.__nranges)
-               rl->__mapupper_ext.__ranges = 0;
--      return (rl);
-+      data->__datasize = lastp - (void *)data;
-+      return (data);
- }
-+#endif /* !RUNEOFF32 */
diff --git a/locale/FreeBSD/rune32.h b/locale/FreeBSD/rune32.h
new file mode 100644 (file)
index 0000000..c3dfe30
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * This file is statically generated by running:
+ *   cc -arch i386 -D_LIBC_NO_FEATURE_VERIFICATION -DRUNEOFF32 -o rune32 locale/FreeBSD/rune.c
+ */
+
+#define SIZEOF32_RUNEENTRY 16
+#define SIZEOF32_RUNELOCALE 3164
+int off32[] = {
+       40,
+       44,
+       3124,
+       3128,
+       3132,
+       3136,
+       3140,
+       3144,
+       3148,
+       3160,
+       3164,
+};
index bb1bbc4180091723db32f7fe986a3100ddc7ccb6..6ffcf72a3d90f8b634108c080ad6f0ba4ad61079 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.14 2007/01/09 00:28:00 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <stdio.h>
 #include <runetype.h>
 
 unsigned long
-___runetype(__ct_rune_t c)
+___runetype_l(__ct_rune_t c, locale_t loc)
 {
        size_t lim;
-       _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext;
+       _RuneRange *rr;
        _RuneEntry *base, *re;
 
        if (c < 0 || c == EOF)
                return(0L);
 
+       NORMALIZE_LOCALE(loc);
+       rr = &loc->__lc_ctype->_CurrentRuneLocale.__runetype_ext;
        /* Binary search -- see bsearch.c for explanation. */
        base = rr->__ranges;
        for (lim = rr->__nranges; lim != 0; lim >>= 1) {
@@ -64,3 +68,9 @@ ___runetype(__ct_rune_t c)
 
        return(0L);
 }
+
+unsigned long
+___runetype(__ct_rune_t c)
+{
+       return ___runetype_l(c, __current_locale());
+}
diff --git a/locale/FreeBSD/runetype.c.patch b/locale/FreeBSD/runetype.c.patch
deleted file mode 100644 (file)
index ef76217..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
---- runetype.c.bsdnew  2009-11-09 15:05:25.000000000 -0800
-+++ runetype.c 2009-11-09 16:54:21.000000000 -0800
-@@ -33,20 +33,24 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.14 2007/01/09 00:28:00 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <stdio.h>
- #include <runetype.h>
- unsigned long
--___runetype(__ct_rune_t c)
-+___runetype_l(__ct_rune_t c, locale_t loc)
- {
-       size_t lim;
--      _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext;
-+      _RuneRange *rr;
-       _RuneEntry *base, *re;
-       if (c < 0 || c == EOF)
-               return(0L);
-+      NORMALIZE_LOCALE(loc);
-+      rr = &loc->__lc_ctype->_CurrentRuneLocale.__runetype_ext;
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-@@ -64,3 +68,9 @@ ___runetype(__ct_rune_t c)
-       return(0L);
- }
-+
-+unsigned long
-+___runetype(__ct_rune_t c)
-+{
-+      return ___runetype_l(c, __current_locale());
-+}
index 1048ce915d500e56a6c8efed82a4a3b56ed43756..6d3be0354b924d59900528eb9bff31f061a8eec9 100644 (file)
 .Sh SYNOPSIS
 .In locale.h
 .Ft char *
-.Fn setlocale "int category" "const char *locale"
+.Fo setlocale
+.Fa "int category"
+.Fa "const char *locale"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn setlocale
@@ -101,14 +104,14 @@ Set a locale for formatting dates and times using the
 function.
 .El
 .Pp
-Only three locales are defined by default,
+Only three locales are defined by default:
 the empty string
 .Li "\&""\|""
-which denotes the native environment, and the
+(which denotes the native environment) and the
 .Li "\&""C""
 and
 .Li "\&""POSIX""
-locales, which denote the C language environment.
+locales (which denote the C-language environment).
 A
 .Fa locale
 argument of
diff --git a/locale/FreeBSD/setlocale.3.patch b/locale/FreeBSD/setlocale.3.patch
deleted file mode 100644 (file)
index 195cf81..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- setlocale.3.orig   2009-11-09 15:05:25.000000000 -0800
-+++ setlocale.3        2009-11-09 15:05:26.000000000 -0800
-@@ -42,7 +42,10 @@
- .Sh SYNOPSIS
- .In locale.h
- .Ft char *
--.Fn setlocale "int category" "const char *locale"
-+.Fo setlocale
-+.Fa "int category"
-+.Fa "const char *locale"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn setlocale
-@@ -101,14 +104,14 @@ Set a locale for formatting dates and ti
- function.
- .El
- .Pp
--Only three locales are defined by default,
-+Only three locales are defined by default:
- the empty string
- .Li "\&""\|""
--which denotes the native environment, and the
-+(which denotes the native environment) and the
- .Li "\&""C""
- and
- .Li "\&""POSIX""
--locales, which denote the C language environment.
-+locales (which denote the C-language environment).
- A
- .Fa locale
- argument of
index 98748493dcce7a51eff1d9251909c52bd6e473a6..9729e54426733f6ed3585645345e581afe9d73ce 100644 (file)
@@ -37,6 +37,8 @@ static char sccsid[] = "@(#)setlocale.c       8.1 (Berkeley) 7/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
@@ -52,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 i
 #include "lmessages.h" /* for __messages_load_locale() */
 #include "setlocale.h"
 #include "ldpart.h"
-#include "../stdtime/timelocal.h" /* for __time_load_locale() */
+#include "timelocal.h" /* for __time_load_locale() */
 
 /*
  * Category names for getenv()
@@ -95,15 +97,18 @@ static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)];
 
 static char    *currentlocale(void);
 static char    *loadlocale(int);
-static const char *__get_locale_env(int);
+__private_extern__ const char *__get_locale_env(int);
+
+#define        UNLOCK_AND_RETURN(x)    {XL_UNLOCK(&__global_locale); return (x);}
 
 char *
 setlocale(category, locale)
        int category;
        const char *locale;
 {
-       int i, j, len, saverr;
+       int i, j, len, saverr, save__numeric_fp_cvt;
         const char *env, *r;
+       locale_t save__lc_numeric_loc;
 
        if (category < LC_ALL || category >= _LC_LAST) {
                errno = EINVAL;
@@ -114,6 +119,7 @@ setlocale(category, locale)
                return (category != LC_ALL ?
                    current_categories[category] : currentlocale());
 
+       XL_LOCK(&__global_locale);
        /*
         * Default to the current locale for everything.
         */
@@ -129,7 +135,7 @@ setlocale(category, locale)
                                env = __get_locale_env(i);
                                if (strlen(env) > ENCODING_LEN) {
                                        errno = EINVAL;
-                                       return (NULL);
+                                       UNLOCK_AND_RETURN (NULL);
                                }
                                (void)strcpy(new_categories[i], env);
                        }
@@ -137,21 +143,21 @@ setlocale(category, locale)
                        env = __get_locale_env(category);
                        if (strlen(env) > ENCODING_LEN) {
                                errno = EINVAL;
-                               return (NULL);
+                               UNLOCK_AND_RETURN (NULL);
                        }
                        (void)strcpy(new_categories[category], env);
                }
        } else if (category != LC_ALL) {
                if (strlen(locale) > ENCODING_LEN) {
                        errno = EINVAL;
-                       return (NULL);
+                       UNLOCK_AND_RETURN (NULL);
                }
                (void)strcpy(new_categories[category], locale);
        } else {
                if ((r = strchr(locale, '/')) == NULL) {
                        if (strlen(locale) > ENCODING_LEN) {
                                errno = EINVAL;
-                               return (NULL);
+                               UNLOCK_AND_RETURN (NULL);
                        }
                        for (i = 1; i < _LC_LAST; ++i)
                                (void)strcpy(new_categories[i], locale);
@@ -160,14 +166,14 @@ setlocale(category, locale)
                                ;
                        if (!r[1]) {
                                errno = EINVAL;
-                               return (NULL);  /* Hmm, just slashes... */
+                               UNLOCK_AND_RETURN (NULL);       /* Hmm, just slashes... */
                        }
                        do {
                                if (i == _LC_LAST)
                                        break;  /* Too many slashes... */
                                if ((len = r - locale) > ENCODING_LEN) {
                                        errno = EINVAL;
-                                       return (NULL);
+                                       UNLOCK_AND_RETURN (NULL);
                                }
                                (void)strlcpy(new_categories[i], locale,
                                              len + 1);
@@ -187,8 +193,11 @@ setlocale(category, locale)
        }
 
        if (category != LC_ALL)
-               return (loadlocale(category));
+               UNLOCK_AND_RETURN (loadlocale(category));
 
+       save__numeric_fp_cvt = __global_locale.__numeric_fp_cvt;
+       save__lc_numeric_loc = __global_locale.__lc_numeric_loc;
+       XL_RETAIN(save__lc_numeric_loc);
        for (i = 1; i < _LC_LAST; ++i) {
                (void)strcpy(saved_categories[i], current_categories[i]);
                if (loadlocale(i) == NULL) {
@@ -201,11 +210,15 @@ setlocale(category, locale)
                                        (void)loadlocale(j);
                                }
                        }
+                       __global_locale.__numeric_fp_cvt = save__numeric_fp_cvt;
+                       __global_locale.__lc_numeric_loc = save__lc_numeric_loc;
+                       XL_RELEASE(save__lc_numeric_loc);
                        errno = saverr;
-                       return (NULL);
+                       UNLOCK_AND_RETURN (NULL);
                }
        }
-       return (currentlocale());
+       XL_RELEASE(save__lc_numeric_loc);
+       UNLOCK_AND_RETURN (currentlocale());
 }
 
 static char *
@@ -233,7 +246,7 @@ loadlocale(category)
 {
        char *new = new_categories[category];
        char *old = current_categories[category];
-       int (*func)(const char *);
+       int (*func)(const char *, locale_t);
        int saved_errno;
 
        if ((new[0] == '.' &&
@@ -276,15 +289,26 @@ loadlocale(category)
        if (strcmp(new, old) == 0)
                return (old);
 
-       if (func(new) != _LDP_ERROR) {
+       if (func(new, &__global_locale) != _LDP_ERROR) {
                (void)strcpy(old, new);
+               switch (category) {
+               case LC_CTYPE:
+                       if (__global_locale.__numeric_fp_cvt == LC_NUMERIC_FP_SAME_LOCALE)
+                               __global_locale.__numeric_fp_cvt = LC_NUMERIC_FP_UNINITIALIZED;
+                       break;
+               case LC_NUMERIC:
+                       __global_locale.__numeric_fp_cvt = LC_NUMERIC_FP_UNINITIALIZED;
+                       XL_RELEASE(__global_locale.__lc_numeric_loc);
+                       __global_locale.__lc_numeric_loc = NULL;
+                       break;
+               }
                return (old);
        }
 
        return (NULL);
 }
 
-static const char *
+__private_extern__ const char *
 __get_locale_env(category)
         int category;
 {
@@ -311,7 +335,7 @@ __get_locale_env(category)
 /*
  * Detect locale storage location and store its value to _PathLocale variable
  */
-int
+__private_extern__ int
 __detect_path_locale(void)
 {
        if (_PathLocale == NULL) {
diff --git a/locale/FreeBSD/setlocale.c.patch b/locale/FreeBSD/setlocale.c.patch
deleted file mode 100644 (file)
index b782cac..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
---- setlocale.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ setlocale.c        2009-11-09 15:05:26.000000000 -0800
-@@ -37,6 +37,8 @@ static char sccsid[] = "@(#)setlocale.c      
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <errno.h>
-@@ -52,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "lmessages.h"        /* for __messages_load_locale() */
- #include "setlocale.h"
- #include "ldpart.h"
--#include "../stdtime/timelocal.h" /* for __time_load_locale() */
-+#include "timelocal.h" /* for __time_load_locale() */
- /*
-  * Category names for getenv()
-@@ -95,15 +97,18 @@ static char current_locale_string[_LC_LA
- static char   *currentlocale(void);
- static char   *loadlocale(int);
--static const char *__get_locale_env(int);
-+__private_extern__ const char *__get_locale_env(int);
-+
-+#define       UNLOCK_AND_RETURN(x)    {XL_UNLOCK(&__global_locale); return (x);}
- char *
- setlocale(category, locale)
-       int category;
-       const char *locale;
- {
--      int i, j, len, saverr;
-+      int i, j, len, saverr, save__numeric_fp_cvt;
-         const char *env, *r;
-+      locale_t save__lc_numeric_loc;
-       if (category < LC_ALL || category >= _LC_LAST) {
-               errno = EINVAL;
-@@ -114,6 +119,7 @@ setlocale(category, locale)
-               return (category != LC_ALL ?
-                   current_categories[category] : currentlocale());
-+      XL_LOCK(&__global_locale);
-       /*
-        * Default to the current locale for everything.
-        */
-@@ -129,7 +135,7 @@ setlocale(category, locale)
-                               env = __get_locale_env(i);
-                               if (strlen(env) > ENCODING_LEN) {
-                                       errno = EINVAL;
--                                      return (NULL);
-+                                      UNLOCK_AND_RETURN (NULL);
-                               }
-                               (void)strcpy(new_categories[i], env);
-                       }
-@@ -137,21 +143,21 @@ setlocale(category, locale)
-                       env = __get_locale_env(category);
-                       if (strlen(env) > ENCODING_LEN) {
-                               errno = EINVAL;
--                              return (NULL);
-+                              UNLOCK_AND_RETURN (NULL);
-                       }
-                       (void)strcpy(new_categories[category], env);
-               }
-       } else if (category != LC_ALL) {
-               if (strlen(locale) > ENCODING_LEN) {
-                       errno = EINVAL;
--                      return (NULL);
-+                      UNLOCK_AND_RETURN (NULL);
-               }
-               (void)strcpy(new_categories[category], locale);
-       } else {
-               if ((r = strchr(locale, '/')) == NULL) {
-                       if (strlen(locale) > ENCODING_LEN) {
-                               errno = EINVAL;
--                              return (NULL);
-+                              UNLOCK_AND_RETURN (NULL);
-                       }
-                       for (i = 1; i < _LC_LAST; ++i)
-                               (void)strcpy(new_categories[i], locale);
-@@ -160,14 +166,14 @@ setlocale(category, locale)
-                               ;
-                       if (!r[1]) {
-                               errno = EINVAL;
--                              return (NULL);  /* Hmm, just slashes... */
-+                              UNLOCK_AND_RETURN (NULL);       /* Hmm, just slashes... */
-                       }
-                       do {
-                               if (i == _LC_LAST)
-                                       break;  /* Too many slashes... */
-                               if ((len = r - locale) > ENCODING_LEN) {
-                                       errno = EINVAL;
--                                      return (NULL);
-+                                      UNLOCK_AND_RETURN (NULL);
-                               }
-                               (void)strlcpy(new_categories[i], locale,
-                                             len + 1);
-@@ -187,8 +193,11 @@ setlocale(category, locale)
-       }
-       if (category != LC_ALL)
--              return (loadlocale(category));
-+              UNLOCK_AND_RETURN (loadlocale(category));
-+      save__numeric_fp_cvt = __global_locale.__numeric_fp_cvt;
-+      save__lc_numeric_loc = __global_locale.__lc_numeric_loc;
-+      XL_RETAIN(save__lc_numeric_loc);
-       for (i = 1; i < _LC_LAST; ++i) {
-               (void)strcpy(saved_categories[i], current_categories[i]);
-               if (loadlocale(i) == NULL) {
-@@ -201,11 +210,15 @@ setlocale(category, locale)
-                                       (void)loadlocale(j);
-                               }
-                       }
-+                      __global_locale.__numeric_fp_cvt = save__numeric_fp_cvt;
-+                      __global_locale.__lc_numeric_loc = save__lc_numeric_loc;
-+                      XL_RELEASE(save__lc_numeric_loc);
-                       errno = saverr;
--                      return (NULL);
-+                      UNLOCK_AND_RETURN (NULL);
-               }
-       }
--      return (currentlocale());
-+      XL_RELEASE(save__lc_numeric_loc);
-+      UNLOCK_AND_RETURN (currentlocale());
- }
- static char *
-@@ -233,7 +246,7 @@ loadlocale(category)
- {
-       char *new = new_categories[category];
-       char *old = current_categories[category];
--      int (*func)(const char *);
-+      int (*func)(const char *, locale_t);
-       int saved_errno;
-       if ((new[0] == '.' &&
-@@ -276,15 +289,26 @@ loadlocale(category)
-       if (strcmp(new, old) == 0)
-               return (old);
--      if (func(new) != _LDP_ERROR) {
-+      if (func(new, &__global_locale) != _LDP_ERROR) {
-               (void)strcpy(old, new);
-+              switch (category) {
-+              case LC_CTYPE:
-+                      if (__global_locale.__numeric_fp_cvt == LC_NUMERIC_FP_SAME_LOCALE)
-+                              __global_locale.__numeric_fp_cvt = LC_NUMERIC_FP_UNINITIALIZED;
-+                      break;
-+              case LC_NUMERIC:
-+                      __global_locale.__numeric_fp_cvt = LC_NUMERIC_FP_UNINITIALIZED;
-+                      XL_RELEASE(__global_locale.__lc_numeric_loc);
-+                      __global_locale.__lc_numeric_loc = NULL;
-+                      break;
-+              }
-               return (old);
-       }
-       return (NULL);
- }
--static const char *
-+__private_extern__ const char *
- __get_locale_env(category)
-         int category;
- {
-@@ -311,7 +335,7 @@ __get_locale_env(category)
- /*
-  * Detect locale storage location and store its value to _PathLocale variable
-  */
--int
-+__private_extern__ int
- __detect_path_locale(void)
- {
-       if (_PathLocale == NULL) {
index 82462ee8de6fc97e68c02bd7685476b03887ca0b..b21f6f71a3a3fd7c048c47bfa21bb56a5fbbaf57 100644 (file)
 #ifndef _SETLOCALE_H_
 #define        _SETLOCALE_H_
 
+#include <xlocale.h>
+
 #define ENCODING_LEN 31
 #define CATEGORY_LEN 11
 
 extern char *_PathLocale;
 
 int    __detect_path_locale(void);
-int    __wrap_setrunelocale(const char *);
+int    __wrap_setrunelocale(const char *, locale_t);
 
 #endif /* !_SETLOCALE_H_ */
diff --git a/locale/FreeBSD/setlocale.h.patch b/locale/FreeBSD/setlocale.h.patch
deleted file mode 100644 (file)
index 95bb91f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- setlocale.h.orig   2009-11-09 15:05:25.000000000 -0800
-+++ setlocale.h        2009-11-09 15:05:26.000000000 -0800
-@@ -29,12 +29,14 @@
- #ifndef _SETLOCALE_H_
- #define       _SETLOCALE_H_
-+#include <xlocale.h>
-+
- #define ENCODING_LEN 31
- #define CATEGORY_LEN 11
- extern char *_PathLocale;
- int   __detect_path_locale(void);
--int   __wrap_setrunelocale(const char *);
-+int   __wrap_setrunelocale(const char *, locale_t);
- #endif /* !_SETLOCALE_H_ */
index bf2b6d95b3139866791a421f92b4696dab64a2ff..fbb2275349c51696a8fe816746f5cc18bed80731 100644 (file)
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:35 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <runetype.h>
 #include <errno.h>
 #include <limits.h>
@@ -45,67 +47,60 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:
 #include "mblocal.h"
 #include "setlocale.h"
 
-extern int __mb_sb_limit;
-
-extern _RuneLocale     *_Read_RuneMagi(FILE *);
+extern struct __xlocale_st_runelocale  *_Read_RuneMagi(FILE *);
 
-static int             __setrunelocale(const char *);
+#ifdef UNIFDEF_LEGACY_RUNE_APIS
+/* depreciated interfaces */
+rune_t sgetrune(const char *, size_t, char const **);
+int    sputrune(rune_t, char *, size_t, char **);
+#endif /* UNIFDEF_LEGACY_RUNE_APIS */
 
-static int
-__setrunelocale(const char *encoding)
+__private_extern__ int
+__setrunelocale(const char *encoding, locale_t loc)
 {
        FILE *fp;
        char name[PATH_MAX];
+       struct __xlocale_st_runelocale *xrl;
        _RuneLocale *rl;
        int saverr, ret;
-       size_t (*old__mbrtowc)(wchar_t * __restrict,
-           const char * __restrict, size_t, mbstate_t * __restrict);
-       size_t (*old__wcrtomb)(char * __restrict, wchar_t,
-           mbstate_t * __restrict);
-       int (*old__mbsinit)(const mbstate_t *);
-       size_t (*old__mbsnrtowcs)(wchar_t * __restrict,
-           const char ** __restrict, size_t, size_t, mbstate_t * __restrict);
-       size_t (*old__wcsnrtombs)(char * __restrict,
-           const wchar_t ** __restrict, size_t, size_t,
-           mbstate_t * __restrict);
-       static char ctype_encoding[ENCODING_LEN + 1];
-       static _RuneLocale *CachedRuneLocale;
-       static int Cached__mb_cur_max;
-       static int Cached__mb_sb_limit;
-       static size_t (*Cached__mbrtowc)(wchar_t * __restrict,
-           const char * __restrict, size_t, mbstate_t * __restrict);
-       static size_t (*Cached__wcrtomb)(char * __restrict, wchar_t,
-           mbstate_t * __restrict);
-       static int (*Cached__mbsinit)(const mbstate_t *);
-       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);
+       static struct __xlocale_st_runelocale *CachedRuneLocale;
+       extern int __mb_cur_max;
+       extern int __mb_sb_limit;
+       static pthread_lock_t cache_lock = LOCK_INITIALIZER;
 
        /*
         * The "C" and "POSIX" locale are always here.
         */
        if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
-               (void) _none_init(&_DefaultRuneLocale);
+               XL_RELEASE(loc->__lc_ctype);
+               loc->__lc_ctype = &_DefaultRuneXLocale;
+               /* no need to retain _DefaultRuneXLocale */
+               if (loc == &__global_locale) {
+                       _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
+                       __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
+                       __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
+               }
                return (0);
        }
 
        /*
         * If the locale name is the same as our cache, use the cache.
         */
+       LOCK(cache_lock);
        if (CachedRuneLocale != NULL &&
-           strcmp(encoding, ctype_encoding) == 0) {
-               _CurrentRuneLocale = CachedRuneLocale;
-               __mb_cur_max = Cached__mb_cur_max;
-               __mb_sb_limit = Cached__mb_sb_limit;
-               __mbrtowc = Cached__mbrtowc;
-               __mbsinit = Cached__mbsinit;
-               __mbsnrtowcs = Cached__mbsnrtowcs;
-               __wcrtomb = Cached__wcrtomb;
-               __wcsnrtombs = Cached__wcsnrtombs;
+           strcmp(encoding, CachedRuneLocale->__ctype_encoding) == 0) {
+               XL_RELEASE(loc->__lc_ctype);
+               loc->__lc_ctype = CachedRuneLocale;
+               XL_RETAIN(loc->__lc_ctype);
+               if (loc == &__global_locale) {
+                       _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
+                       __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
+                       __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
+               }
+               UNLOCK(cache_lock);
                return (0);
        }
+       UNLOCK(cache_lock);
 
        /*
         * Slurp the locale file into the cache.
@@ -120,80 +115,90 @@ __setrunelocale(const char *encoding)
        if ((fp = fopen(name, "r")) == NULL)
                return (errno == 0 ? ENOENT : errno);
 
-       if ((rl = _Read_RuneMagi(fp)) == NULL) {
+       if ((xrl = _Read_RuneMagi(fp)) == NULL) {
                saverr = (errno == 0 ? EFTYPE : errno);
                (void)fclose(fp);
                return (saverr);
        }
        (void)fclose(fp);
 
-       old__mbrtowc = __mbrtowc;
-       old__mbsinit = __mbsinit;
-       old__mbsnrtowcs = __mbsnrtowcs;
-       old__wcrtomb = __wcrtomb;
-       old__wcsnrtombs = __wcsnrtombs;
+       xrl->__mbrtowc = NULL;
+       xrl->__mbsinit = NULL;
+       xrl->__mbsnrtowcs = __mbsnrtowcs_std;
+       xrl->__wcrtomb = NULL;
+       xrl->__wcsnrtombs = __wcsnrtombs_std;
 
-       __mbrtowc = NULL;
-       __mbsinit = NULL;
-       __mbsnrtowcs = __mbsnrtowcs_std;
-       __wcrtomb = NULL;
-       __wcsnrtombs = __wcsnrtombs_std;
+       rl = &xrl->_CurrentRuneLocale;
 
+#ifdef UNIFDEF_LEGACY_RUNE_APIS
+       /* provide backwards compatibility (depreciated interface) */
+       rl->__sputrune = sputrune;
+       rl->__sgetrune = sgetrune;
+#else /* UNIFDEF_LEGACY_RUNE_APIS */
        rl->__sputrune = NULL;
        rl->__sgetrune = NULL;
+#endif /* UNIFDEF_LEGACY_RUNE_APIS */
+
        if (strcmp(rl->__encoding, "NONE") == 0)
-               ret = _none_init(rl);
+               ret = _none_init(xrl);
        else if (strcmp(rl->__encoding, "ASCII") == 0)
-               ret = _ascii_init(rl);
+               ret = _ascii_init(xrl);
        else if (strcmp(rl->__encoding, "UTF-8") == 0)
-               ret = _UTF8_init(rl);
+               ret = _UTF8_init(xrl);
        else if (strcmp(rl->__encoding, "EUC") == 0)
-               ret = _EUC_init(rl);
+               ret = _EUC_init(xrl);
        else if (strcmp(rl->__encoding, "GB18030") == 0)
-               ret = _GB18030_init(rl);
+               ret = _GB18030_init(xrl);
        else if (strcmp(rl->__encoding, "GB2312") == 0)
-               ret = _GB2312_init(rl);
+               ret = _GB2312_init(xrl);
        else if (strcmp(rl->__encoding, "GBK") == 0)
-               ret = _GBK_init(rl);
+               ret = _GBK_init(xrl);
        else if (strcmp(rl->__encoding, "BIG5") == 0)
-               ret = _BIG5_init(rl);
+               ret = _BIG5_init(xrl);
        else if (strcmp(rl->__encoding, "MSKanji") == 0)
-               ret = _MSKanji_init(rl);
+               ret = _MSKanji_init(xrl);
+       else if (strcmp(rl->__encoding, "UTF2") == 0)
+               ret = _UTF2_init(xrl);
        else
                ret = EFTYPE;
 
        if (ret == 0) {
-               if (CachedRuneLocale != NULL) {
-                       /* See euc.c */
-                       if (strcmp(CachedRuneLocale->__encoding, "EUC") == 0)
-                               free(CachedRuneLocale->__variable);
-                       free(CachedRuneLocale);
+               (void)strcpy(xrl->__ctype_encoding, encoding);
+               XL_RELEASE(loc->__lc_ctype);
+               loc->__lc_ctype = xrl;
+               if (loc == &__global_locale) {
+                       _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
+                       __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
+                       __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
                }
-               CachedRuneLocale = _CurrentRuneLocale;
-               Cached__mb_cur_max = __mb_cur_max;
-               Cached__mb_sb_limit = __mb_sb_limit;
-               Cached__mbrtowc = __mbrtowc;
-               Cached__mbsinit = __mbsinit;
-               Cached__mbsnrtowcs = __mbsnrtowcs;
-               Cached__wcrtomb = __wcrtomb;
-               Cached__wcsnrtombs = __wcsnrtombs;
-               (void)strcpy(ctype_encoding, encoding);
-       } else {
-               __mbrtowc = old__mbrtowc;
-               __mbsinit = old__mbsinit;
-               __mbsnrtowcs = old__mbsnrtowcs;
-               __wcrtomb = old__wcrtomb;
-               __wcsnrtombs = old__wcsnrtombs;
-               free(rl);
-       }
+               LOCK(cache_lock);
+               XL_RELEASE(CachedRuneLocale);
+               CachedRuneLocale = xrl;
+               XL_RETAIN(CachedRuneLocale);
+               UNLOCK(cache_lock);
+       } else
+               XL_RELEASE(xrl);
 
        return (ret);
 }
 
+#ifdef UNIFDEF_LEGACY_RUNE_APIS
 int
-__wrap_setrunelocale(const char *locale)
+setrunelocale(const char *encoding)
+{
+       int ret;
+
+       XL_LOCK(&__global_locale);
+       ret = __setrunelocale(encoding, &__global_locale);
+       XL_UNLOCK(&__global_locale);
+       return ret;
+}
+#endif /* UNIFDEF_LEGACY_RUNE_APIS */
+
+__private_extern__ int
+__wrap_setrunelocale(const char *locale, locale_t loc)
 {
-       int ret = __setrunelocale(locale);
+       int ret = __setrunelocale(locale, loc);
 
        if (ret != 0) {
                errno = ret;
diff --git a/locale/FreeBSD/setrunelocale.c.patch b/locale/FreeBSD/setrunelocale.c.patch
deleted file mode 100644 (file)
index ed607d0..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
---- setrunelocale.c.bsdnew     2009-11-09 15:05:25.000000000 -0800
-+++ setrunelocale.c    2009-11-09 17:20:45.000000000 -0800
-@@ -33,6 +33,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:35 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <runetype.h>
- #include <errno.h>
- #include <limits.h>
-@@ -45,67 +47,60 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "mblocal.h"
- #include "setlocale.h"
--extern int __mb_sb_limit;
--
--extern _RuneLocale    *_Read_RuneMagi(FILE *);
-+extern struct __xlocale_st_runelocale *_Read_RuneMagi(FILE *);
--static int            __setrunelocale(const char *);
-+#ifdef UNIFDEF_LEGACY_RUNE_APIS
-+/* depreciated interfaces */
-+rune_t        sgetrune(const char *, size_t, char const **);
-+int   sputrune(rune_t, char *, size_t, char **);
-+#endif /* UNIFDEF_LEGACY_RUNE_APIS */
--static int
--__setrunelocale(const char *encoding)
-+__private_extern__ int
-+__setrunelocale(const char *encoding, locale_t loc)
- {
-       FILE *fp;
-       char name[PATH_MAX];
-+      struct __xlocale_st_runelocale *xrl;
-       _RuneLocale *rl;
-       int saverr, ret;
--      size_t (*old__mbrtowc)(wchar_t * __restrict,
--          const char * __restrict, size_t, mbstate_t * __restrict);
--      size_t (*old__wcrtomb)(char * __restrict, wchar_t,
--          mbstate_t * __restrict);
--      int (*old__mbsinit)(const mbstate_t *);
--      size_t (*old__mbsnrtowcs)(wchar_t * __restrict,
--          const char ** __restrict, size_t, size_t, mbstate_t * __restrict);
--      size_t (*old__wcsnrtombs)(char * __restrict,
--          const wchar_t ** __restrict, size_t, size_t,
--          mbstate_t * __restrict);
--      static char ctype_encoding[ENCODING_LEN + 1];
--      static _RuneLocale *CachedRuneLocale;
--      static int Cached__mb_cur_max;
--      static int Cached__mb_sb_limit;
--      static size_t (*Cached__mbrtowc)(wchar_t * __restrict,
--          const char * __restrict, size_t, mbstate_t * __restrict);
--      static size_t (*Cached__wcrtomb)(char * __restrict, wchar_t,
--          mbstate_t * __restrict);
--      static int (*Cached__mbsinit)(const mbstate_t *);
--      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);
-+      static struct __xlocale_st_runelocale *CachedRuneLocale;
-+      extern int __mb_cur_max;
-+      extern int __mb_sb_limit;
-+      static pthread_lock_t cache_lock = LOCK_INITIALIZER;
-       /*
-        * The "C" and "POSIX" locale are always here.
-        */
-       if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
--              (void) _none_init(&_DefaultRuneLocale);
-+              XL_RELEASE(loc->__lc_ctype);
-+              loc->__lc_ctype = &_DefaultRuneXLocale;
-+              /* no need to retain _DefaultRuneXLocale */
-+              if (loc == &__global_locale) {
-+                      _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
-+                      __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
-+                      __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
-+              }
-               return (0);
-       }
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-+      LOCK(cache_lock);
-       if (CachedRuneLocale != NULL &&
--          strcmp(encoding, ctype_encoding) == 0) {
--              _CurrentRuneLocale = CachedRuneLocale;
--              __mb_cur_max = Cached__mb_cur_max;
--              __mb_sb_limit = Cached__mb_sb_limit;
--              __mbrtowc = Cached__mbrtowc;
--              __mbsinit = Cached__mbsinit;
--              __mbsnrtowcs = Cached__mbsnrtowcs;
--              __wcrtomb = Cached__wcrtomb;
--              __wcsnrtombs = Cached__wcsnrtombs;
-+          strcmp(encoding, CachedRuneLocale->__ctype_encoding) == 0) {
-+              XL_RELEASE(loc->__lc_ctype);
-+              loc->__lc_ctype = CachedRuneLocale;
-+              XL_RETAIN(loc->__lc_ctype);
-+              if (loc == &__global_locale) {
-+                      _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
-+                      __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
-+                      __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
-+              }
-+              UNLOCK(cache_lock);
-               return (0);
-       }
-+      UNLOCK(cache_lock);
-       /*
-        * Slurp the locale file into the cache.
-@@ -120,80 +115,90 @@ __setrunelocale(const char *encoding)
-       if ((fp = fopen(name, "r")) == NULL)
-               return (errno == 0 ? ENOENT : errno);
--      if ((rl = _Read_RuneMagi(fp)) == NULL) {
-+      if ((xrl = _Read_RuneMagi(fp)) == NULL) {
-               saverr = (errno == 0 ? EFTYPE : errno);
-               (void)fclose(fp);
-               return (saverr);
-       }
-       (void)fclose(fp);
--      old__mbrtowc = __mbrtowc;
--      old__mbsinit = __mbsinit;
--      old__mbsnrtowcs = __mbsnrtowcs;
--      old__wcrtomb = __wcrtomb;
--      old__wcsnrtombs = __wcsnrtombs;
--
--      __mbrtowc = NULL;
--      __mbsinit = NULL;
--      __mbsnrtowcs = __mbsnrtowcs_std;
--      __wcrtomb = NULL;
--      __wcsnrtombs = __wcsnrtombs_std;
--
-+      xrl->__mbrtowc = NULL;
-+      xrl->__mbsinit = NULL;
-+      xrl->__mbsnrtowcs = __mbsnrtowcs_std;
-+      xrl->__wcrtomb = NULL;
-+      xrl->__wcsnrtombs = __wcsnrtombs_std;
-+
-+      rl = &xrl->_CurrentRuneLocale;
-+
-+#ifdef UNIFDEF_LEGACY_RUNE_APIS
-+      /* provide backwards compatibility (depreciated interface) */
-+      rl->__sputrune = sputrune;
-+      rl->__sgetrune = sgetrune;
-+#else /* UNIFDEF_LEGACY_RUNE_APIS */
-       rl->__sputrune = NULL;
-       rl->__sgetrune = NULL;
-+#endif /* UNIFDEF_LEGACY_RUNE_APIS */
-+
-       if (strcmp(rl->__encoding, "NONE") == 0)
--              ret = _none_init(rl);
-+              ret = _none_init(xrl);
-       else if (strcmp(rl->__encoding, "ASCII") == 0)
--              ret = _ascii_init(rl);
-+              ret = _ascii_init(xrl);
-       else if (strcmp(rl->__encoding, "UTF-8") == 0)
--              ret = _UTF8_init(rl);
-+              ret = _UTF8_init(xrl);
-       else if (strcmp(rl->__encoding, "EUC") == 0)
--              ret = _EUC_init(rl);
-+              ret = _EUC_init(xrl);
-       else if (strcmp(rl->__encoding, "GB18030") == 0)
--              ret = _GB18030_init(rl);
-+              ret = _GB18030_init(xrl);
-       else if (strcmp(rl->__encoding, "GB2312") == 0)
--              ret = _GB2312_init(rl);
-+              ret = _GB2312_init(xrl);
-       else if (strcmp(rl->__encoding, "GBK") == 0)
--              ret = _GBK_init(rl);
-+              ret = _GBK_init(xrl);
-       else if (strcmp(rl->__encoding, "BIG5") == 0)
--              ret = _BIG5_init(rl);
-+              ret = _BIG5_init(xrl);
-       else if (strcmp(rl->__encoding, "MSKanji") == 0)
--              ret = _MSKanji_init(rl);
-+              ret = _MSKanji_init(xrl);
-+      else if (strcmp(rl->__encoding, "UTF2") == 0)
-+              ret = _UTF2_init(xrl);
-       else
-               ret = EFTYPE;
-       if (ret == 0) {
--              if (CachedRuneLocale != NULL) {
--                      /* See euc.c */
--                      if (strcmp(CachedRuneLocale->__encoding, "EUC") == 0)
--                              free(CachedRuneLocale->__variable);
--                      free(CachedRuneLocale);
-+              (void)strcpy(xrl->__ctype_encoding, encoding);
-+              XL_RELEASE(loc->__lc_ctype);
-+              loc->__lc_ctype = xrl;
-+              if (loc == &__global_locale) {
-+                      _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
-+                      __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
-+                      __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
-               }
--              CachedRuneLocale = _CurrentRuneLocale;
--              Cached__mb_cur_max = __mb_cur_max;
--              Cached__mb_sb_limit = __mb_sb_limit;
--              Cached__mbrtowc = __mbrtowc;
--              Cached__mbsinit = __mbsinit;
--              Cached__mbsnrtowcs = __mbsnrtowcs;
--              Cached__wcrtomb = __wcrtomb;
--              Cached__wcsnrtombs = __wcsnrtombs;
--              (void)strcpy(ctype_encoding, encoding);
--      } else {
--              __mbrtowc = old__mbrtowc;
--              __mbsinit = old__mbsinit;
--              __mbsnrtowcs = old__mbsnrtowcs;
--              __wcrtomb = old__wcrtomb;
--              __wcsnrtombs = old__wcsnrtombs;
--              free(rl);
--      }
-+              LOCK(cache_lock);
-+              XL_RELEASE(CachedRuneLocale);
-+              CachedRuneLocale = xrl;
-+              XL_RETAIN(CachedRuneLocale);
-+              UNLOCK(cache_lock);
-+      } else
-+              XL_RELEASE(xrl);
-       return (ret);
- }
-+#ifdef UNIFDEF_LEGACY_RUNE_APIS
- int
--__wrap_setrunelocale(const char *locale)
-+setrunelocale(const char *encoding)
-+{
-+      int ret;
-+
-+      XL_LOCK(&__global_locale);
-+      ret = __setrunelocale(encoding, &__global_locale);
-+      XL_UNLOCK(&__global_locale);
-+      return ret;
-+}
-+#endif /* UNIFDEF_LEGACY_RUNE_APIS */
-+
-+__private_extern__ int
-+__wrap_setrunelocale(const char *locale, locale_t loc)
- {
--      int ret = __setrunelocale(locale);
-+      int ret = __setrunelocale(locale, loc);
-       if (ret != 0) {
-               errno = ret;
index 874f41562900d391d9b97fe57bce24a83f865e72..667b846282a520633b6e31f23d9a616a56b3a5d5 100644 (file)
@@ -36,13 +36,16 @@ static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/27/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.28 2007/01/09 00:28:00 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <runetype.h>
 #include <wchar.h>
 #include "mblocal.h"
 
-_RuneLocale _DefaultRuneLocale = {
-    _RUNE_MAGIC_1,
+/* _DefaultRuneLocale is depreciated; _DefaultRuneXLocale is used instead */
+_RuneLocale _DefaultRuneLocale __attribute__((section("__DATA,__constrw"))) = {
+    _RUNE_MAGIC_A,
     "NONE",
     NULL,
     NULL,
@@ -245,5 +248,221 @@ _RuneLocale _DefaultRuneLocale = {
     },
 };
 
-_RuneLocale *_CurrentRuneLocale = &_DefaultRuneLocale;
+__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale __attribute__((section("__DATA,__constrw"))) = {
+    0,
+    XPERMANENT,
+    "C",
+    1,
+    256,
+    _none_mbrtowc,
+    _none_mbsinit,
+    _none_mbsnrtowcs,
+    _none_wcrtomb,
+    _none_wcsnrtombs,
+    sizeof(struct __xlocale_st_runelocale),
+    {
+       _RUNE_MAGIC_A,
+       "NONE",
+       NULL,
+       NULL,
+       0xFFFD,
+
+       {       /*00*/  _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+           /*08*/      _CTYPE_C,
+                   _CTYPE_C|_CTYPE_S|_CTYPE_B,
+                   _CTYPE_C|_CTYPE_S,
+                   _CTYPE_C|_CTYPE_S,
+                   _CTYPE_C|_CTYPE_S,
+                   _CTYPE_C|_CTYPE_S,
+                   _CTYPE_C,
+                   _CTYPE_C,
+           /*10*/      _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+           /*18*/      _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+                   _CTYPE_C,
+           /*20*/      _CTYPE_S|_CTYPE_B|_CTYPE_R,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+           /*28*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+           /*30*/      _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|0,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|1,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|2,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|3,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|4,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|5,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|6,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|7,
+           /*38*/      _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|8,
+                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|9,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+           /*40*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
+                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
+                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
+                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
+                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
+                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+           /*48*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+           /*50*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+           /*58*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+           /*60*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
+                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
+                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
+                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
+                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
+                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+           /*68*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+           /*70*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+           /*78*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
+                   _CTYPE_C,
+       },
+       {       0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
+           0x08,       0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
+           0x10,       0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
+           0x18,       0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
+           0x20,       0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
+           0x28,       0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
+           0x30,       0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
+           0x38,       0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
+           0x40,       'a',    'b',    'c',    'd',    'e',    'f',    'g',
+           'h',        'i',    'j',    'k',    'l',    'm',    'n',    'o',
+           'p',        'q',    'r',    's',    't',    'u',    'v',    'w',
+           'x',        'y',    'z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
+           0x60,       'a',    'b',    'c',    'd',    'e',    'f',    'g',
+           'h',        'i',    'j',    'k',    'l',    'm',    'n',    'o',
+           'p',        'q',    'r',    's',    't',    'u',    'v',    'w',
+           'x',        'y',    'z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
+           0x80,       0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
+           0x88,       0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
+           0x90,       0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
+           0x98,       0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
+           0xa0,       0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
+           0xa8,       0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
+           0xb0,       0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
+           0xb8,       0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
+           0xc0,       0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
+           0xc8,       0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
+           0xd0,       0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
+           0xd8,       0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
+           0xe0,       0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
+           0xe8,       0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
+           0xf0,       0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
+           0xf8,       0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
+       },
+       {       0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
+           0x08,       0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
+           0x10,       0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
+           0x18,       0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
+           0x20,       0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
+           0x28,       0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
+           0x30,       0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
+           0x38,       0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
+           0x40,       'A',    'B',    'C',    'D',    'E',    'F',    'G',
+           'H',        'I',    'J',    'K',    'L',    'M',    'N',    'O',
+           'P',        'Q',    'R',    'S',    'T',    'U',    'V',    'W',
+           'X',        'Y',    'Z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
+           0x60,       'A',    'B',    'C',    'D',    'E',    'F',    'G',
+           'H',        'I',    'J',    'K',    'L',    'M',    'N',    'O',
+           'P',        'Q',    'R',    'S',    'T',    'U',    'V',    'W',
+           'X',        'Y',    'Z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
+           0x80,       0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
+           0x88,       0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
+           0x90,       0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
+           0x98,       0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
+           0xa0,       0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
+           0xa8,       0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
+           0xb0,       0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
+           0xb8,       0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
+           0xc0,       0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
+           0xc8,       0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
+           0xd0,       0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
+           0xd8,       0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
+           0xe0,       0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
+           0xe8,       0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
+           0xf0,       0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
+           0xf8,       0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
+       },
+    },
+};
 
+_RuneLocale *_CurrentRuneLocale = &_DefaultRuneXLocale._CurrentRuneLocale;
diff --git a/locale/FreeBSD/table.c.patch b/locale/FreeBSD/table.c.patch
deleted file mode 100644 (file)
index d7238e3..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
---- table.c.orig       2010-06-21 14:25:20.000000000 -0700
-+++ table.c    2010-06-21 14:25:34.000000000 -0700
-@@ -36,13 +36,16 @@ static char sccsid[] = "@(#)table.c        8.1 
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.28 2007/01/09 00:28:00 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <runetype.h>
- #include <wchar.h>
- #include "mblocal.h"
--_RuneLocale _DefaultRuneLocale = {
--    _RUNE_MAGIC_1,
-+/* _DefaultRuneLocale is depreciated; _DefaultRuneXLocale is used instead */
-+_RuneLocale _DefaultRuneLocale __attribute__((section("__DATA,__constrw"))) = {
-+    _RUNE_MAGIC_A,
-     "NONE",
-     NULL,
-     NULL,
-@@ -245,5 +248,221 @@ _RuneLocale _DefaultRuneLocale = {
-     },
- };
--_RuneLocale *_CurrentRuneLocale = &_DefaultRuneLocale;
-+__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale __attribute__((section("__DATA,__constrw"))) = {
-+    0,
-+    XPERMANENT,
-+    "C",
-+    1,
-+    256,
-+    _none_mbrtowc,
-+    _none_mbsinit,
-+    _none_mbsnrtowcs,
-+    _none_wcrtomb,
-+    _none_wcsnrtombs,
-+    sizeof(struct __xlocale_st_runelocale),
-+    {
-+      _RUNE_MAGIC_A,
-+      "NONE",
-+      NULL,
-+      NULL,
-+      0xFFFD,
-+
-+      {       /*00*/  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+          /*08*/      _CTYPE_C,
-+                  _CTYPE_C|_CTYPE_S|_CTYPE_B,
-+                  _CTYPE_C|_CTYPE_S,
-+                  _CTYPE_C|_CTYPE_S,
-+                  _CTYPE_C|_CTYPE_S,
-+                  _CTYPE_C|_CTYPE_S,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+          /*10*/      _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+          /*18*/      _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+                  _CTYPE_C,
-+          /*20*/      _CTYPE_S|_CTYPE_B|_CTYPE_R,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+          /*28*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+          /*30*/      _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|0,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|1,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|2,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|3,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|4,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|5,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|6,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|7,
-+          /*38*/      _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|8,
-+                  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|9,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+          /*40*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
-+                  _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
-+                  _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
-+                  _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
-+                  _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
-+                  _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+          /*48*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+          /*50*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+          /*58*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+          /*60*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
-+                  _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
-+                  _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
-+                  _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
-+                  _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
-+                  _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+          /*68*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+          /*70*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+          /*78*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-+                  _CTYPE_C,
-+      },
-+      {       0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
-+          0x08,       0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
-+          0x10,       0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
-+          0x18,       0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
-+          0x20,       0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
-+          0x28,       0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
-+          0x30,       0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
-+          0x38,       0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
-+          0x40,       'a',    'b',    'c',    'd',    'e',    'f',    'g',
-+          'h',        'i',    'j',    'k',    'l',    'm',    'n',    'o',
-+          'p',        'q',    'r',    's',    't',    'u',    'v',    'w',
-+          'x',        'y',    'z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
-+          0x60,       'a',    'b',    'c',    'd',    'e',    'f',    'g',
-+          'h',        'i',    'j',    'k',    'l',    'm',    'n',    'o',
-+          'p',        'q',    'r',    's',    't',    'u',    'v',    'w',
-+          'x',        'y',    'z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
-+          0x80,       0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
-+          0x88,       0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
-+          0x90,       0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
-+          0x98,       0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
-+          0xa0,       0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
-+          0xa8,       0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
-+          0xb0,       0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
-+          0xb8,       0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
-+          0xc0,       0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
-+          0xc8,       0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
-+          0xd0,       0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
-+          0xd8,       0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
-+          0xe0,       0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
-+          0xe8,       0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
-+          0xf0,       0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
-+          0xf8,       0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
-+      },
-+      {       0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
-+          0x08,       0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
-+          0x10,       0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
-+          0x18,       0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
-+          0x20,       0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
-+          0x28,       0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
-+          0x30,       0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
-+          0x38,       0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
-+          0x40,       'A',    'B',    'C',    'D',    'E',    'F',    'G',
-+          'H',        'I',    'J',    'K',    'L',    'M',    'N',    'O',
-+          'P',        'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-+          'X',        'Y',    'Z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
-+          0x60,       'A',    'B',    'C',    'D',    'E',    'F',    'G',
-+          'H',        'I',    'J',    'K',    'L',    'M',    'N',    'O',
-+          'P',        'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-+          'X',        'Y',    'Z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
-+          0x80,       0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
-+          0x88,       0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
-+          0x90,       0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
-+          0x98,       0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
-+          0xa0,       0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
-+          0xa8,       0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
-+          0xb0,       0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
-+          0xb8,       0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
-+          0xc0,       0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
-+          0xc8,       0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
-+          0xd0,       0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
-+          0xd8,       0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
-+          0xe0,       0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
-+          0xe8,       0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
-+          0xf0,       0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
-+          0xf8,       0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
-+      },
-+    },
-+};
-+_RuneLocale *_CurrentRuneLocale = &_DefaultRuneXLocale._CurrentRuneLocale;
index 29515bb0bfc74358f3dbdad101df9cea00c8bc2f..0ac4aba66e4999403550613ac585daa6308d2aad 100644 (file)
 .Dt TOLOWER 3
 .Os
 .Sh NAME
-.Nm tolower
+.Nm tolower ,
+.Nm tolower_l
 .Nd upper case to lower case letter conversion
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In ctype.h
 .Ft int
-.Fn tolower "int c"
+.Fo tolower
+.Fa "int c"
+.Fc
+.In ctype.h
+.In xlocale.h
+.Ft int
+.Fo tolower_l
+.Fa "int c"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn tolower
@@ -53,11 +63,19 @@ The argument must be representable as an
 .Vt "unsigned char"
 or the value of
 .Dv EOF .
+.Pp
+Although the
+.Fn tolower
+function uses the current locale, the
+.Fn tolower_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If the argument is an upper-case letter, the
 .Fn tolower
 function returns the corresponding lower-case letter if there is
-one; otherwise the argument is returned unchanged.
+one; otherwise, the argument is returned unchanged.
 .Sh COMPATIBILITY
 The
 .Bx 4.4
@@ -71,7 +89,8 @@ function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr islower 3 ,
-.Xr towlower 3
+.Xr towlower 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn tolower
diff --git a/locale/FreeBSD/tolower.3.patch b/locale/FreeBSD/tolower.3.patch
deleted file mode 100644 (file)
index b5cc733..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- tolower.3.bsdnew   2009-11-10 13:13:11.000000000 -0800
-+++ tolower.3  2009-11-10 13:51:11.000000000 -0800
-@@ -36,14 +36,24 @@
- .Dt TOLOWER 3
- .Os
- .Sh NAME
--.Nm tolower
-+.Nm tolower ,
-+.Nm tolower_l
- .Nd upper case to lower case letter conversion
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In ctype.h
- .Ft int
--.Fn tolower "int c"
-+.Fo tolower
-+.Fa "int c"
-+.Fc
-+.In ctype.h
-+.In xlocale.h
-+.Ft int
-+.Fo tolower_l
-+.Fa "int c"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn tolower
-@@ -53,11 +63,19 @@ The argument must be representable as an
- .Vt "unsigned char"
- or the value of
- .Dv EOF .
-+.Pp
-+Although the
-+.Fn tolower
-+function uses the current locale, the
-+.Fn tolower_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If the argument is an upper-case letter, the
- .Fn tolower
- function returns the corresponding lower-case letter if there is
--one; otherwise the argument is returned unchanged.
-+one; otherwise, the argument is returned unchanged.
- .Sh COMPATIBILITY
- The
- .Bx 4.4
-@@ -71,7 +89,8 @@ function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
- .Xr islower 3 ,
--.Xr towlower 3
-+.Xr towlower 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn tolower
index 968cb5a04ed0177fbe54cd3596f0502beaf83d82..298b321263339f00880cb50dd29589bc5a5d0a23 100644 (file)
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $");
+  
+#include "xlocale_private.h"
 
 #include <ctype.h>
 #include <stdio.h>
 #include <runetype.h>
 
 __ct_rune_t
-___tolower(c)
+___tolower_l(c, loc)
        __ct_rune_t c;
+       locale_t loc;
 {
        size_t lim;
-       _RuneRange *rr = &_CurrentRuneLocale->__maplower_ext;
+       _RuneRange *rr;
        _RuneEntry *base, *re;
 
        if (c < 0 || c == EOF)
                return(c);
 
+       NORMALIZE_LOCALE(loc);
+       /*
+        * the following is not used by tolower(), but can be used by
+        * tolower_l().  This provides the oppurtunity to optimize tolower()
+        * when compatibility for Panther and lower is no longer needed
+        */
+       if (c < _CACHED_RUNES)
+               return loc->__lc_ctype->_CurrentRuneLocale.__maplower[c];
+       rr = &loc->__lc_ctype->_CurrentRuneLocale.__maplower_ext;
        /* Binary search -- see bsearch.c for explanation. */
        base = rr->__ranges;
        for (lim = rr->__nranges; lim != 0; lim >>= 1) {
@@ -62,3 +74,10 @@ ___tolower(c)
 
        return(c);
 }
+
+__ct_rune_t
+___tolower(c)
+       __ct_rune_t c;
+{
+       return ___tolower_l(c, __current_locale());
+}
diff --git a/locale/FreeBSD/tolower.c.patch b/locale/FreeBSD/tolower.c.patch
deleted file mode 100644 (file)
index b40e942..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
---- tolower.c.bsdnew   2009-11-09 15:05:25.000000000 -0800
-+++ tolower.c  2009-11-09 17:31:29.000000000 -0800
-@@ -32,22 +32,34 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $");
-+  
-+#include "xlocale_private.h"
- #include <ctype.h>
- #include <stdio.h>
- #include <runetype.h>
- __ct_rune_t
--___tolower(c)
-+___tolower_l(c, loc)
-       __ct_rune_t c;
-+      locale_t loc;
- {
-       size_t lim;
--      _RuneRange *rr = &_CurrentRuneLocale->__maplower_ext;
-+      _RuneRange *rr;
-       _RuneEntry *base, *re;
-       if (c < 0 || c == EOF)
-               return(c);
-+      NORMALIZE_LOCALE(loc);
-+      /*
-+       * the following is not used by tolower(), but can be used by
-+       * tolower_l().  This provides the oppurtunity to optimize tolower()
-+       * when compatibility for Panther and lower is no longer needed
-+       */
-+      if (c < _CACHED_RUNES)
-+              return loc->__lc_ctype->_CurrentRuneLocale.__maplower[c];
-+      rr = &loc->__lc_ctype->_CurrentRuneLocale.__maplower_ext;
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-@@ -62,3 +74,10 @@ ___tolower(c)
-       return(c);
- }
-+
-+__ct_rune_t
-+___tolower(c)
-+      __ct_rune_t c;
-+{
-+      return ___tolower_l(c, __current_locale());
-+}
index cf23d1586d3bcc752ad85e907d1489c6ffb876ac..5b196a94d10f43528dd634442160b91dd2cba677 100644 (file)
 .Dt TOUPPER 3
 .Os
 .Sh NAME
-.Nm toupper
+.Nm toupper ,
+.Nm toupper_l
 .Nd lower case to upper case letter conversion
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In ctype.h
 .Ft int
-.Fn toupper "int c"
+.Fo toupper
+.Fa "int c"
+.Fc
+.In ctype.h
+.In xlocale.h
+.Ft int
+.Fo toupper_l
+.Fa "int c"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn toupper
@@ -53,11 +63,19 @@ The argument must be representable as an
 .Vt "unsigned char"
 or the value of
 .Dv EOF .
+.Pp
+Although the
+.Fn toupper
+function uses the current locale, the
+.Fn toupper_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If the argument is a lower-case letter, the
 .Fn toupper
 function returns the corresponding upper-case letter if there is
-one; otherwise the argument is returned unchanged.
+one; otherwise, the argument is returned unchanged.
 .Sh COMPATIBILITY
 The
 .Bx 4.4
@@ -71,7 +89,8 @@ function should be used instead.
 .Sh SEE ALSO
 .Xr ctype 3 ,
 .Xr isupper 3 ,
-.Xr towupper 3
+.Xr towupper 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn toupper
diff --git a/locale/FreeBSD/toupper.3.patch b/locale/FreeBSD/toupper.3.patch
deleted file mode 100644 (file)
index c469626..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- toupper.3.bsdnew   2009-11-10 13:13:11.000000000 -0800
-+++ toupper.3  2009-11-10 13:52:49.000000000 -0800
-@@ -36,14 +36,24 @@
- .Dt TOUPPER 3
- .Os
- .Sh NAME
--.Nm toupper
-+.Nm toupper ,
-+.Nm toupper_l
- .Nd lower case to upper case letter conversion
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In ctype.h
- .Ft int
--.Fn toupper "int c"
-+.Fo toupper
-+.Fa "int c"
-+.Fc
-+.In ctype.h
-+.In xlocale.h
-+.Ft int
-+.Fo toupper_l
-+.Fa "int c"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn toupper
-@@ -53,11 +63,19 @@ The argument must be representable as an
- .Vt "unsigned char"
- or the value of
- .Dv EOF .
-+.Pp
-+Although the
-+.Fn toupper
-+function uses the current locale, the
-+.Fn toupper_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If the argument is a lower-case letter, the
- .Fn toupper
- function returns the corresponding upper-case letter if there is
--one; otherwise the argument is returned unchanged.
-+one; otherwise, the argument is returned unchanged.
- .Sh COMPATIBILITY
- The
- .Bx 4.4
-@@ -71,7 +89,8 @@ function should be used instead.
- .Sh SEE ALSO
- .Xr ctype 3 ,
- .Xr isupper 3 ,
--.Xr towupper 3
-+.Xr towupper 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn toupper
index e160b39573c5d1d89470219691f49377c1b81dd8..d02ddd64196d3c27771bb7e2ed1544ef994377bd 100644 (file)
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $");
+  
+#include "xlocale_private.h"
 
 #include <ctype.h>
 #include <stdio.h>
 #include <runetype.h>
 
 __ct_rune_t
-___toupper(c)
+___toupper_l(c, loc)
        __ct_rune_t c;
+       locale_t loc;
 {
        size_t lim;
-       _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext;
+       _RuneRange *rr;
        _RuneEntry *base, *re;
 
        if (c < 0 || c == EOF)
                return(c);
 
+       NORMALIZE_LOCALE(loc);
+       /*
+        * the following is not used by toupper(), but can be used by
+        * toupper_l().  This provides the oppurtunity to optimize toupper()
+        * when compatibility for Panther and lower is no longer needed
+        */
+       if (c < _CACHED_RUNES)
+               return loc->__lc_ctype->_CurrentRuneLocale.__mapupper[c];
+       rr = &loc->__lc_ctype->_CurrentRuneLocale.__mapupper_ext;
        /* Binary search -- see bsearch.c for explanation. */
        base = rr->__ranges;
        for (lim = rr->__nranges; lim != 0; lim >>= 1) {
@@ -62,3 +74,10 @@ ___toupper(c)
 
        return(c);
 }
+
+__ct_rune_t
+___toupper(c)
+       __ct_rune_t c;
+{
+       return ___toupper_l(c, __current_locale());
+}
diff --git a/locale/FreeBSD/toupper.c.patch b/locale/FreeBSD/toupper.c.patch
deleted file mode 100644 (file)
index aea5ad9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
---- toupper.c.bsdnew   2009-11-09 15:05:25.000000000 -0800
-+++ toupper.c  2009-11-09 17:30:20.000000000 -0800
-@@ -32,22 +32,34 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $");
-+  
-+#include "xlocale_private.h"
- #include <ctype.h>
- #include <stdio.h>
- #include <runetype.h>
- __ct_rune_t
--___toupper(c)
-+___toupper_l(c, loc)
-       __ct_rune_t c;
-+      locale_t loc;
- {
-       size_t lim;
--      _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext;
-+      _RuneRange *rr;
-       _RuneEntry *base, *re;
-       if (c < 0 || c == EOF)
-               return(c);
-+      NORMALIZE_LOCALE(loc);
-+      /*
-+       * the following is not used by toupper(), but can be used by
-+       * toupper_l().  This provides the oppurtunity to optimize toupper()
-+       * when compatibility for Panther and lower is no longer needed
-+       */
-+      if (c < _CACHED_RUNES)
-+              return loc->__lc_ctype->_CurrentRuneLocale.__mapupper[c];
-+      rr = &loc->__lc_ctype->_CurrentRuneLocale.__mapupper_ext;
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-@@ -62,3 +74,10 @@ ___toupper(c)
-       return(c);
- }
-+
-+__ct_rune_t
-+___toupper(c)
-+      __ct_rune_t c;
-+{
-+      return ___toupper_l(c, __current_locale());
-+}
index b6968b7ffb46acb6b998f1b5afbce3fba84c96e5..248d5b14c5fcf32dff42911e567bc0ef83bc8f1b 100644 (file)
 .Dt TOWLOWER 3
 .Os
 .Sh NAME
-.Nm towlower
+.Nm towlower ,
+.Nm towlower_l
 .Nd "upper case to lower case letter conversion (wide character version)"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wctype.h
 .Ft wint_t
-.Fn towlower "wint_t wc"
+.Fo towlower
+.Fa "wint_t wc"
+.Fc
+.In wctype.h
+.In xlocale.h
+.Ft wint_t
+.Fo towlower_l
+.Fa "wint_t wc"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn towlower
 function converts an upper-case letter to the corresponding lower-case
 letter.
+.Pp
+Although the
+.Fn towlower
+function uses the current locale, the
+.Fn towlower_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If the argument is an upper-case letter, the
 .Fn towlower
 function returns the corresponding lower-case letter if there is
-one; otherwise the argument is returned unchanged.
+one; otherwise, the argument is returned unchanged.
 .Sh SEE ALSO
 .Xr iswlower 3 ,
 .Xr tolower 3 ,
 .Xr towupper 3 ,
-.Xr wctrans 3
+.Xr wctrans 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn towlower
diff --git a/locale/FreeBSD/towlower.3.patch b/locale/FreeBSD/towlower.3.patch
deleted file mode 100644 (file)
index ecd8b5e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
---- towlower.3.orig    2009-11-09 15:05:25.000000000 -0800
-+++ towlower.3 2009-11-09 15:05:26.000000000 -0800
-@@ -36,29 +36,48 @@
- .Dt TOWLOWER 3
- .Os
- .Sh NAME
--.Nm towlower
-+.Nm towlower ,
-+.Nm towlower_l
- .Nd "upper case to lower case letter conversion (wide character version)"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wctype.h
- .Ft wint_t
--.Fn towlower "wint_t wc"
-+.Fo towlower
-+.Fa "wint_t wc"
-+.Fc
-+.In wctype.h
-+.In xlocale.h
-+.Ft wint_t
-+.Fo towlower_l
-+.Fa "wint_t wc"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn towlower
- function converts an upper-case letter to the corresponding lower-case
- letter.
-+.Pp
-+Although the
-+.Fn towlower
-+function uses the current locale, the
-+.Fn towlower_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If the argument is an upper-case letter, the
- .Fn towlower
- function returns the corresponding lower-case letter if there is
--one; otherwise the argument is returned unchanged.
-+one; otherwise, the argument is returned unchanged.
- .Sh SEE ALSO
- .Xr iswlower 3 ,
- .Xr tolower 3 ,
- .Xr towupper 3 ,
--.Xr wctrans 3
-+.Xr wctrans 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn towlower
index 1d3763b632d91a5e488c943ac440bc5760d9d6ed..5df8bb0551b2669f0c49b970b35f5333d06dbb11 100644 (file)
 .Dt TOWUPPER 3
 .Os
 .Sh NAME
-.Nm towupper
+.Nm towupper ,
+.Nm towupper_l
 .Nd "lower case to upper case letter conversion (wide character version)"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wctype.h
 .Ft wint_t
-.Fn towupper "wint_t wc"
+.Fo towupper
+.Fa "wint_t wc"
+.Fc
+.In wctype.h
+.In xlocale.h
+.Ft wint_t
+.Fo towupper_l
+.Fa "wint_t wc"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn towupper
 function converts a lower-case letter to the corresponding
 upper-case letter.
+.Pp
+Although the
+.Fn towupper
+function uses the current locale, the
+.Fn towupper_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If the argument is a lower-case letter, the
 .Fn towupper
 function returns the corresponding upper-case letter if there is
-one; otherwise the argument is returned unchanged.
+one; otherwise, the argument is returned unchanged.
 .Sh SEE ALSO
 .Xr iswupper 3 ,
 .Xr toupper 3 ,
 .Xr towlower 3 ,
-.Xr wctrans 3
+.Xr wctrans 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn towupper
diff --git a/locale/FreeBSD/towupper.3.patch b/locale/FreeBSD/towupper.3.patch
deleted file mode 100644 (file)
index 77cbd8e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
---- towupper.3.orig    2009-11-09 15:05:25.000000000 -0800
-+++ towupper.3 2009-11-09 15:05:26.000000000 -0800
-@@ -36,29 +36,48 @@
- .Dt TOWUPPER 3
- .Os
- .Sh NAME
--.Nm towupper
-+.Nm towupper ,
-+.Nm towupper_l
- .Nd "lower case to upper case letter conversion (wide character version)"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wctype.h
- .Ft wint_t
--.Fn towupper "wint_t wc"
-+.Fo towupper
-+.Fa "wint_t wc"
-+.Fc
-+.In wctype.h
-+.In xlocale.h
-+.Ft wint_t
-+.Fo towupper_l
-+.Fa "wint_t wc"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn towupper
- function converts a lower-case letter to the corresponding
- upper-case letter.
-+.Pp
-+Although the
-+.Fn towupper
-+function uses the current locale, the
-+.Fn towupper_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If the argument is a lower-case letter, the
- .Fn towupper
- function returns the corresponding upper-case letter if there is
--one; otherwise the argument is returned unchanged.
-+one; otherwise, the argument is returned unchanged.
- .Sh SEE ALSO
- .Xr iswupper 3 ,
- .Xr toupper 3 ,
- .Xr towlower 3 ,
--.Xr wctrans 3
-+.Xr wctrans 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn towupper
diff --git a/locale/FreeBSD/utf2.c b/locale/FreeBSD/utf2.c
new file mode 100644 (file)
index 0000000..d611aa8
--- /dev/null
@@ -0,0 +1,411 @@
+/*-
+ * Copyright (c) 2002-2004 Tim J. Robbins
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+// MWW: Generated by applying utf2.c.patch to utf8.c in the FreeBSD patch sets.
+
+#include <sys/param.h>
+__FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $");
+
+#include "xlocale_private.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <runetype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include "mblocal.h"
+
+#define UTF2_MB_CUR_MAX                3
+
+static size_t  _UTF2_mbrtowc(wchar_t * __restrict, const char * __restrict,
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _UTF2_mbsinit(const mbstate_t *, locale_t);
+static size_t  _UTF2_mbsnrtowcs(wchar_t * __restrict,
+                   const char ** __restrict, size_t, size_t,
+                   mbstate_t * __restrict, locale_t);
+static size_t  _UTF2_wcrtomb(char * __restrict, wchar_t,
+                   mbstate_t * __restrict, locale_t);
+static size_t  _UTF2_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
+                   size_t, size_t, mbstate_t * __restrict, locale_t);
+
+typedef struct {
+       wchar_t ch;
+       int     want;
+       wchar_t lbound;
+} _UTF2State;
+
+__private_extern__ int
+_UTF2_init(struct __xlocale_st_runelocale *xrl)
+{
+
+       xrl->__mbrtowc = _UTF2_mbrtowc;
+       xrl->__wcrtomb = _UTF2_wcrtomb;
+       xrl->__mbsinit = _UTF2_mbsinit;
+       xrl->__mbsnrtowcs = _UTF2_mbsnrtowcs;
+       xrl->__wcsnrtombs = _UTF2_wcsnrtombs;
+       xrl->__mb_cur_max = UTF2_MB_CUR_MAX;
+       /*
+        * UCS-4 encoding used as the internal representation, so
+        * slots 0x0080-0x00FF are occuped and must be excluded
+        * from the single byte ctype by setting the limit.
+        */
+       xrl->__mb_sb_limit = 128;
+
+       return (0);
+}
+
+static int
+_UTF2_mbsinit(const mbstate_t *ps, locale_t loc)
+{
+
+       return (ps == NULL || ((const _UTF2State *)ps)->want == 0);
+}
+
+static size_t
+_UTF2_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
+    mbstate_t * __restrict ps, locale_t loc)
+{
+       _UTF2State *us;
+       int ch, i, mask, want;
+       wchar_t lbound, wch;
+
+       us = (_UTF2State *)ps;
+
+       if (us->want < 0 || us->want > 6) {
+               errno = EINVAL;
+               return ((size_t)-1);
+       }
+
+       if (s == NULL) {
+               s = "";
+               n = 1;
+               pwc = NULL;
+       }
+
+       if (n == 0)
+               /* Incomplete multibyte sequence */
+               return ((size_t)-2);
+
+       if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) {
+               /* Fast path for plain ASCII characters. */
+               if (pwc != NULL)
+                       *pwc = ch;
+               return (ch != '\0' ? 1 : 0);
+       }
+
+       if (us->want == 0) {
+               /*
+                * Determine the number of octets that make up this character
+                * from the first octet, and a mask that extracts the
+                * interesting bits of the first octet. We already know
+                * the character is at least two bytes long.
+                *
+                * We also specify a lower bound for the character code to
+                * detect redundant, non-"shortest form" encodings. For
+                * example, the sequence C0 80 is _not_ a legal representation
+                * of the null character. This enforces a 1-to-1 mapping
+                * between character codes and their multibyte representations.
+                */
+               ch = (unsigned char)*s;
+               if ((ch & 0x80) == 0) {
+                       mask = 0x7f;
+                       want = 1;
+                       lbound = 0;
+               } else if ((ch & 0xe0) == 0xc0) {
+                       mask = 0x1f;
+                       want = 2;
+                       lbound = 0x80;
+               } else if ((ch & 0xf0) == 0xe0) {
+                       mask = 0x0f;
+                       want = 3;
+                       lbound = 0x800;
+               } else {
+                       /*
+                        * Malformed input; input is not UTF2.
+                        */
+                       errno = EILSEQ;
+                       return ((size_t)-1);
+               }
+       } else {
+               want = us->want;
+               lbound = us->lbound;
+       }
+
+       /*
+        * Decode the octet sequence representing the character in chunks
+        * of 6 bits, most significant first.
+        */
+       if (us->want == 0)
+               wch = (unsigned char)*s++ & mask;
+       else
+               wch = us->ch;
+       for (i = (us->want == 0) ? 1 : 0; i < MIN(want, n); i++) {
+               if ((*s & 0xc0) != 0x80) {
+                       /*
+                        * Malformed input; bad characters in the middle
+                        * of a character.
+                        */
+                       errno = EILSEQ;
+                       return ((size_t)-1);
+               }
+               wch <<= 6;
+               wch |= *s++ & 0x3f;
+       }
+       if (i < want) {
+               /* Incomplete multibyte sequence. */
+               us->want = want - i;
+               us->lbound = lbound;
+               us->ch = wch;
+               return ((size_t)-2);
+       }
+       if (wch < lbound) {
+               /*
+                * Malformed input; redundant encoding.
+                */
+               errno = EILSEQ;
+               return ((size_t)-1);
+       }
+       if (pwc != NULL)
+               *pwc = wch;
+       us->want = 0;
+       return (wch == L'\0' ? 0 : want);
+}
+
+static size_t
+_UTF2_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
+{
+       _UTF2State *us;
+       const char *s;
+       size_t nchr;
+       wchar_t wc;
+       size_t nb;
+
+       us = (_UTF2State *)ps;
+
+       s = *src;
+       nchr = 0;
+
+       if (dst == NULL) {
+               /*
+                * The fast path in the loop below is not safe if an ASCII
+                * character appears as anything but the first byte of a
+                * multibyte sequence. Check now to avoid doing it in the loop.
+                */
+               if (nms > 0 && us->want > 0 && (signed char)*s > 0) {
+                       errno = EILSEQ;
+                       return ((size_t)-1);
+               }
+               for (;;) {
+                       if (nms > 0 && (signed char)*s > 0)
+                               /*
+                                * Fast path for plain ASCII characters
+                                * excluding NUL.
+                                */
+                               nb = 1;
+                       else if ((nb = _UTF2_mbrtowc(&wc, s, nms, ps, loc)) ==
+                           (size_t)-1)
+                               /* Invalid sequence - mbrtowc() sets errno. */
+                               return ((size_t)-1);
+                       else if (nb == 0 || nb == (size_t)-2)
+                               return (nchr);
+                       s += nb;
+                       nms -= nb;
+                       nchr++;
+               }
+               /*NOTREACHED*/
+       }
+
+       /*
+        * The fast path in the loop below is not safe if an ASCII
+        * character appears as anything but the first byte of a
+        * multibyte sequence. Check now to avoid doing it in the loop.
+        */
+       if (nms > 0 && len > 0 && us->want > 0 && (signed char)*s > 0) {
+               errno = EILSEQ;
+               return ((size_t)-1);
+       }
+       while (len-- > 0) {
+               if (nms > 0 && (signed char)*s > 0) {
+                       /*
+                        * Fast path for plain ASCII characters
+                        * excluding NUL.
+                        */
+                       *dst = (wchar_t)*s;
+                       nb = 1;
+               } else if ((nb = _UTF2_mbrtowc(dst, s, nms, ps, loc)) ==
+                   (size_t)-1) {
+                       *src = s;
+                       return ((size_t)-1);
+               } else if (nb == (size_t)-2) {
+                       *src = s + nms;
+                       return (nchr);
+               } else if (nb == 0) {
+                       *src = NULL;
+                       return (nchr);
+               }
+               s += nb;
+               nms -= nb;
+               nchr++;
+               dst++;
+       }
+       *src = s;
+       return (nchr);
+}
+
+static size_t
+_UTF2_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
+{
+       _UTF2State *us;
+       unsigned char lead;
+       int i, len;
+
+       us = (_UTF2State *)ps;
+
+       if (us->want != 0) {
+               errno = EINVAL;
+               return ((size_t)-1);
+       }
+
+       if (s == NULL)
+               /* Reset to initial shift state (no-op) */
+               return (1);
+
+       if ((wc & ~0x7f) == 0) {
+               /* Fast path for plain ASCII characters. */
+               *s = (char)wc;
+               return (1);
+       }
+
+       /*
+        * Determine the number of octets needed to represent this character.
+        * We always output the shortest sequence possible. Also specify the
+        * first few bits of the first octet, which contains the information
+        * about the sequence length.
+        */
+       if ((wc & ~0x7f) == 0) {
+               lead = 0;
+               len = 1;
+       } else if ((wc & ~0x7ff) == 0) {
+               lead = 0xc0;
+               len = 2;
+       } else if ((wc & ~0xffff) == 0) {
+               lead = 0xe0;
+               len = 3;
+       } else {
+               errno = EILSEQ;
+               return ((size_t)-1);
+       }
+
+       /*
+        * Output the octets representing the character in chunks
+        * of 6 bits, least significant last. The first octet is
+        * a special case because it contains the sequence length
+        * information.
+        */
+       for (i = len - 1; i > 0; i--) {
+               s[i] = (wc & 0x3f) | 0x80;
+               wc >>= 6;
+       }
+       *s = (wc & 0xff) | lead;
+
+       return (len);
+}
+
+static size_t
+_UTF2_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
+    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
+{
+       _UTF2State *us;
+       char buf[MB_LEN_MAX];
+       const wchar_t *s;
+       size_t nbytes;
+       size_t nb;
+
+       us = (_UTF2State *)ps;
+
+       if (us->want != 0) {
+               errno = EINVAL;
+               return ((size_t)-1);
+       }
+
+       s = *src;
+       nbytes = 0;
+
+       if (dst == NULL) {
+               while (nwc-- > 0) {
+                       if (0 <= *s && *s < 0x80)
+                               /* Fast path for plain ASCII characters. */
+                               nb = 1;
+                       else if ((nb = _UTF2_wcrtomb(buf, *s, ps, loc)) ==
+                           (size_t)-1)
+                               /* Invalid character - wcrtomb() sets errno. */
+                               return ((size_t)-1);
+                       if (*s == L'\0')
+                               return (nbytes + nb - 1);
+                       s++;
+                       nbytes += nb;
+               }
+               return (nbytes);
+       }
+
+       while (len > 0 && nwc-- > 0) {
+               if (0 <= *s && *s < 0x80) {
+                       /* Fast path for plain ASCII characters. */
+                       nb = 1;
+                       *dst = *s;
+               } else if (len > (size_t)UTF2_MB_CUR_MAX) {
+                       /* Enough space to translate in-place. */
+                       if ((nb = _UTF2_wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
+                               *src = s;
+                               return ((size_t)-1);
+                       }
+               } else {
+                       /*
+                        * May not be enough space; use temp. buffer.
+                        */
+                       if ((nb = _UTF2_wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
+                               *src = s;
+                               return ((size_t)-1);
+                       }
+                       if (nb > (int)len)
+                               /* MB sequence for character won't fit. */
+                               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);
+}
diff --git a/locale/FreeBSD/utf2.c.patch b/locale/FreeBSD/utf2.c.patch
deleted file mode 100644 (file)
index ab2535e..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
---- utf2.c.bsdnew      2009-11-09 17:38:09.000000000 -0800
-+++ utf2.c     2009-11-09 17:41:17.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/param.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <runetype.h>
-@@ -35,62 +37,61 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
-+#define UTF2_MB_CUR_MAX               3
--static size_t _UTF8_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _UTF8_mbsinit(const mbstate_t *);
--static size_t _UTF8_mbsnrtowcs(wchar_t * __restrict,
-+static size_t _UTF2_mbrtowc(wchar_t * __restrict, const char * __restrict,
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _UTF2_mbsinit(const mbstate_t *, locale_t);
-+static size_t _UTF2_mbsnrtowcs(wchar_t * __restrict,
-                   const char ** __restrict, size_t, size_t,
--                  mbstate_t * __restrict);
--static size_t _UTF8_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
--static size_t _UTF8_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
--                  size_t, size_t, mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
-+static size_t _UTF2_wcrtomb(char * __restrict, wchar_t,
-+                  mbstate_t * __restrict, locale_t);
-+static size_t _UTF2_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-+                  size_t, size_t, mbstate_t * __restrict, locale_t);
- typedef struct {
-       wchar_t ch;
-       int     want;
-       wchar_t lbound;
--} _UTF8State;
-+} _UTF2State;
--int
--_UTF8_init(_RuneLocale *rl)
-+__private_extern__ int
-+_UTF2_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _UTF8_mbrtowc;
--      __wcrtomb = _UTF8_wcrtomb;
--      __mbsinit = _UTF8_mbsinit;
--      __mbsnrtowcs = _UTF8_mbsnrtowcs;
--      __wcsnrtombs = _UTF8_wcsnrtombs;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 6;
-+      xrl->__mbrtowc = _UTF2_mbrtowc;
-+      xrl->__wcrtomb = _UTF2_wcrtomb;
-+      xrl->__mbsinit = _UTF2_mbsinit;
-+      xrl->__mbsnrtowcs = _UTF2_mbsnrtowcs;
-+      xrl->__wcsnrtombs = _UTF2_wcsnrtombs;
-+      xrl->__mb_cur_max = UTF2_MB_CUR_MAX;
-       /*
-        * UCS-4 encoding used as the internal representation, so
-        * slots 0x0080-0x00FF are occuped and must be excluded
-        * from the single byte ctype by setting the limit.
-        */
--      __mb_sb_limit = 128;
-+      xrl->__mb_sb_limit = 128;
-       return (0);
- }
- static int
--_UTF8_mbsinit(const mbstate_t *ps)
-+_UTF2_mbsinit(const mbstate_t *ps, locale_t loc)
- {
--      return (ps == NULL || ((const _UTF8State *)ps)->want == 0);
-+      return (ps == NULL || ((const _UTF2State *)ps)->want == 0);
- }
- static size_t
--_UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+_UTF2_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-+    mbstate_t * __restrict ps, locale_t loc)
- {
--      _UTF8State *us;
-+      _UTF2State *us;
-       int ch, i, mask, want;
-       wchar_t lbound, wch;
--      us = (_UTF8State *)ps;
-+      us = (_UTF2State *)ps;
-       if (us->want < 0 || us->want > 6) {
-               errno = EINVAL;
-@@ -140,21 +141,9 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
-                       mask = 0x0f;
-                       want = 3;
-                       lbound = 0x800;
--              } else if ((ch & 0xf8) == 0xf0) {
--                      mask = 0x07;
--                      want = 4;
--                      lbound = 0x10000;
--              } else if ((ch & 0xfc) == 0xf8) {
--                      mask = 0x03;
--                      want = 5;
--                      lbound = 0x200000;
--              } else if ((ch & 0xfe) == 0xfc) {
--                      mask = 0x01;
--                      want = 6;
--                      lbound = 0x4000000;
-               } else {
-                       /*
--                       * Malformed input; input is not UTF-8.
-+                       * Malformed input; input is not UTF2.
-                        */
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-@@ -205,16 +194,16 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
- }
- static size_t
--_UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
--    size_t nms, size_t len, mbstate_t * __restrict ps)
-+_UTF2_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
--      _UTF8State *us;
-+      _UTF2State *us;
-       const char *s;
-       size_t nchr;
-       wchar_t wc;
-       size_t nb;
--      us = (_UTF8State *)ps;
-+      us = (_UTF2State *)ps;
-       s = *src;
-       nchr = 0;
-@@ -236,7 +225,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict ds
-                                * excluding NUL.
-                                */
-                               nb = 1;
--                      else if ((nb = _UTF8_mbrtowc(&wc, s, nms, ps)) ==
-+                      else if ((nb = _UTF2_mbrtowc(&wc, s, nms, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid sequence - mbrtowc() sets errno. */
-                               return ((size_t)-1);
-@@ -266,7 +255,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict ds
-                        */
-                       *dst = (wchar_t)*s;
-                       nb = 1;
--              } else if ((nb = _UTF8_mbrtowc(dst, s, nms, ps)) ==
-+              } else if ((nb = _UTF2_mbrtowc(dst, s, nms, ps, loc)) ==
-                   (size_t)-1) {
-                       *src = s;
-                       return ((size_t)-1);
-@@ -287,13 +276,13 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict ds
- }
- static size_t
--_UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_UTF2_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
- {
--      _UTF8State *us;
-+      _UTF2State *us;
-       unsigned char lead;
-       int i, len;
--      us = (_UTF8State *)ps;
-+      us = (_UTF2State *)ps;
-       if (us->want != 0) {
-               errno = EINVAL;
-@@ -325,15 +314,6 @@ _UTF8_wcrtomb(char * __restrict s, wchar
-       } else if ((wc & ~0xffff) == 0) {
-               lead = 0xe0;
-               len = 3;
--      } else if ((wc & ~0x1fffff) == 0) {
--              lead = 0xf0;
--              len = 4;
--      } else if ((wc & ~0x3ffffff) == 0) {
--              lead = 0xf8;
--              len = 5;
--      } else if ((wc & ~0x7fffffff) == 0) {
--              lead = 0xfc;
--              len = 6;
-       } else {
-               errno = EILSEQ;
-               return ((size_t)-1);
-@@ -355,16 +335,16 @@ _UTF8_wcrtomb(char * __restrict s, wchar
- }
- static size_t
--_UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
--    size_t nwc, size_t len, mbstate_t * __restrict ps)
-+_UTF2_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-+    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
--      _UTF8State *us;
-+      _UTF2State *us;
-       char buf[MB_LEN_MAX];
-       const wchar_t *s;
-       size_t nbytes;
-       size_t nb;
--      us = (_UTF8State *)ps;
-+      us = (_UTF2State *)ps;
-       if (us->want != 0) {
-               errno = EINVAL;
-@@ -379,7 +359,7 @@ _UTF8_wcsnrtombs(char * __restrict dst, 
-                       if (0 <= *s && *s < 0x80)
-                               /* Fast path for plain ASCII characters. */
-                               nb = 1;
--                      else if ((nb = _UTF8_wcrtomb(buf, *s, ps)) ==
-+                      else if ((nb = _UTF2_wcrtomb(buf, *s, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid character - wcrtomb() sets errno. */
-                               return ((size_t)-1);
-@@ -396,9 +376,9 @@ _UTF8_wcsnrtombs(char * __restrict dst, 
-                       /* Fast path for plain ASCII characters. */
-                       nb = 1;
-                       *dst = *s;
--              } else if (len > (size_t)MB_CUR_MAX) {
-+              } else if (len > (size_t)UTF2_MB_CUR_MAX) {
-                       /* Enough space to translate in-place. */
--                      if ((nb = _UTF8_wcrtomb(dst, *s, ps)) == (size_t)-1) {
-+                      if ((nb = _UTF2_wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-@@ -406,7 +386,7 @@ _UTF8_wcsnrtombs(char * __restrict dst, 
-                       /*
-                        * May not be enough space; use temp. buffer.
-                        */
--                      if ((nb = _UTF8_wcrtomb(buf, *s, ps)) == (size_t)-1) {
-+                      if ((nb = _UTF2_wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
index 9a9ffa92ac6d80b85d1464f7761798a6ca927222..97515df8654a35ce7e55b6160fc9afcdfdefe270 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/param.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <runetype.h>
@@ -35,18 +37,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache E
 #include <wchar.h>
 #include "mblocal.h"
 
-extern int __mb_sb_limit;
+#define UTF8_MB_CUR_MAX                6
 
 static size_t  _UTF8_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict);
-static int     _UTF8_mbsinit(const mbstate_t *);
+                   size_t, mbstate_t * __restrict, locale_t);
+static int     _UTF8_mbsinit(const mbstate_t *, locale_t);
 static size_t  _UTF8_mbsnrtowcs(wchar_t * __restrict,
                    const char ** __restrict, size_t, size_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 static size_t  _UTF8_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict);
+                   mbstate_t * __restrict, locale_t);
 static size_t  _UTF8_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                   size_t, size_t, mbstate_t * __restrict);
+                   size_t, size_t, mbstate_t * __restrict, locale_t);
 
 typedef struct {
        wchar_t ch;
@@ -54,29 +56,28 @@ typedef struct {
        wchar_t lbound;
 } _UTF8State;
 
-int
-_UTF8_init(_RuneLocale *rl)
+__private_extern__ int
+_UTF8_init(struct __xlocale_st_runelocale *xrl)
 {
 
-       __mbrtowc = _UTF8_mbrtowc;
-       __wcrtomb = _UTF8_wcrtomb;
-       __mbsinit = _UTF8_mbsinit;
-       __mbsnrtowcs = _UTF8_mbsnrtowcs;
-       __wcsnrtombs = _UTF8_wcsnrtombs;
-       _CurrentRuneLocale = rl;
-       __mb_cur_max = 6;
+       xrl->__mbrtowc = _UTF8_mbrtowc;
+       xrl->__wcrtomb = _UTF8_wcrtomb;
+       xrl->__mbsinit = _UTF8_mbsinit;
+       xrl->__mbsnrtowcs = _UTF8_mbsnrtowcs;
+       xrl->__wcsnrtombs = _UTF8_wcsnrtombs;
+       xrl->__mb_cur_max = UTF8_MB_CUR_MAX;
        /*
         * UCS-4 encoding used as the internal representation, so
         * slots 0x0080-0x00FF are occuped and must be excluded
         * from the single byte ctype by setting the limit.
         */
-       __mb_sb_limit = 128;
+       xrl->__mb_sb_limit = 128;
 
        return (0);
 }
 
 static int
-_UTF8_mbsinit(const mbstate_t *ps)
+_UTF8_mbsinit(const mbstate_t *ps, locale_t loc)
 {
 
        return (ps == NULL || ((const _UTF8State *)ps)->want == 0);
@@ -84,7 +85,7 @@ _UTF8_mbsinit(const mbstate_t *ps)
 
 static size_t
 _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps)
+    mbstate_t * __restrict ps, locale_t loc)
 {
        _UTF8State *us;
        int ch, i, mask, want;
@@ -206,7 +207,7 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
 
 static size_t
 _UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps)
+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
 {
        _UTF8State *us;
        const char *s;
@@ -236,7 +237,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
                                 * excluding NUL.
                                 */
                                nb = 1;
-                       else if ((nb = _UTF8_mbrtowc(&wc, s, nms, ps)) ==
+                       else if ((nb = _UTF8_mbrtowc(&wc, s, nms, ps, loc)) ==
                            (size_t)-1)
                                /* Invalid sequence - mbrtowc() sets errno. */
                                return ((size_t)-1);
@@ -266,7 +267,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
                         */
                        *dst = (wchar_t)*s;
                        nb = 1;
-               } else if ((nb = _UTF8_mbrtowc(dst, s, nms, ps)) ==
+               } else if ((nb = _UTF8_mbrtowc(dst, s, nms, ps, loc)) ==
                    (size_t)-1) {
                        *src = s;
                        return ((size_t)-1);
@@ -287,7 +288,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
 }
 
 static size_t
-_UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+_UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
 {
        _UTF8State *us;
        unsigned char lead;
@@ -356,7 +357,7 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
 
 static size_t
 _UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps)
+    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
 {
        _UTF8State *us;
        char buf[MB_LEN_MAX];
@@ -379,7 +380,7 @@ _UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
                        if (0 <= *s && *s < 0x80)
                                /* Fast path for plain ASCII characters. */
                                nb = 1;
-                       else if ((nb = _UTF8_wcrtomb(buf, *s, ps)) ==
+                       else if ((nb = _UTF8_wcrtomb(buf, *s, ps, loc)) ==
                            (size_t)-1)
                                /* Invalid character - wcrtomb() sets errno. */
                                return ((size_t)-1);
@@ -396,9 +397,9 @@ _UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
                        /* Fast path for plain ASCII characters. */
                        nb = 1;
                        *dst = *s;
-               } else if (len > (size_t)MB_CUR_MAX) {
+               } else if (len > (size_t)UTF8_MB_CUR_MAX) {
                        /* Enough space to translate in-place. */
-                       if ((nb = _UTF8_wcrtomb(dst, *s, ps)) == (size_t)-1) {
+                       if ((nb = _UTF8_wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
                                *src = s;
                                return ((size_t)-1);
                        }
@@ -406,7 +407,7 @@ _UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
                        /*
                         * May not be enough space; use temp. buffer.
                         */
-                       if ((nb = _UTF8_wcrtomb(buf, *s, ps)) == (size_t)-1) {
+                       if ((nb = _UTF8_wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
                                *src = s;
                                return ((size_t)-1);
                        }
diff --git a/locale/FreeBSD/utf8.c.patch b/locale/FreeBSD/utf8.c.patch
deleted file mode 100644 (file)
index 9427108..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
---- utf8.c.bsdnew      2009-11-09 15:05:25.000000000 -0800
-+++ utf8.c     2009-11-09 17:35:23.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/param.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <runetype.h>
-@@ -35,18 +37,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include <wchar.h>
- #include "mblocal.h"
--extern int __mb_sb_limit;
-+#define UTF8_MB_CUR_MAX               6
- static size_t _UTF8_mbrtowc(wchar_t * __restrict, const char * __restrict,
--                  size_t, mbstate_t * __restrict);
--static int    _UTF8_mbsinit(const mbstate_t *);
-+                  size_t, mbstate_t * __restrict, locale_t);
-+static int    _UTF8_mbsinit(const mbstate_t *, locale_t);
- static size_t _UTF8_mbsnrtowcs(wchar_t * __restrict,
-                   const char ** __restrict, size_t, size_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- static size_t _UTF8_wcrtomb(char * __restrict, wchar_t,
--                  mbstate_t * __restrict);
-+                  mbstate_t * __restrict, locale_t);
- static size_t _UTF8_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
--                  size_t, size_t, mbstate_t * __restrict);
-+                  size_t, size_t, mbstate_t * __restrict, locale_t);
- typedef struct {
-       wchar_t ch;
-@@ -54,29 +56,28 @@ typedef struct {
-       wchar_t lbound;
- } _UTF8State;
--int
--_UTF8_init(_RuneLocale *rl)
-+__private_extern__ int
-+_UTF8_init(struct __xlocale_st_runelocale *xrl)
- {
--      __mbrtowc = _UTF8_mbrtowc;
--      __wcrtomb = _UTF8_wcrtomb;
--      __mbsinit = _UTF8_mbsinit;
--      __mbsnrtowcs = _UTF8_mbsnrtowcs;
--      __wcsnrtombs = _UTF8_wcsnrtombs;
--      _CurrentRuneLocale = rl;
--      __mb_cur_max = 6;
-+      xrl->__mbrtowc = _UTF8_mbrtowc;
-+      xrl->__wcrtomb = _UTF8_wcrtomb;
-+      xrl->__mbsinit = _UTF8_mbsinit;
-+      xrl->__mbsnrtowcs = _UTF8_mbsnrtowcs;
-+      xrl->__wcsnrtombs = _UTF8_wcsnrtombs;
-+      xrl->__mb_cur_max = UTF8_MB_CUR_MAX;
-       /*
-        * UCS-4 encoding used as the internal representation, so
-        * slots 0x0080-0x00FF are occuped and must be excluded
-        * from the single byte ctype by setting the limit.
-        */
--      __mb_sb_limit = 128;
-+      xrl->__mb_sb_limit = 128;
-       return (0);
- }
- static int
--_UTF8_mbsinit(const mbstate_t *ps)
-+_UTF8_mbsinit(const mbstate_t *ps, locale_t loc)
- {
-       return (ps == NULL || ((const _UTF8State *)ps)->want == 0);
-@@ -84,7 +85,7 @@ _UTF8_mbsinit(const mbstate_t *ps)
- static size_t
- _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
--    mbstate_t * __restrict ps)
-+    mbstate_t * __restrict ps, locale_t loc)
- {
-       _UTF8State *us;
-       int ch, i, mask, want;
-@@ -206,7 +207,7 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
- static size_t
- _UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
--    size_t nms, size_t len, mbstate_t * __restrict ps)
-+    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
-       _UTF8State *us;
-       const char *s;
-@@ -236,7 +237,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict ds
-                                * excluding NUL.
-                                */
-                               nb = 1;
--                      else if ((nb = _UTF8_mbrtowc(&wc, s, nms, ps)) ==
-+                      else if ((nb = _UTF8_mbrtowc(&wc, s, nms, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid sequence - mbrtowc() sets errno. */
-                               return ((size_t)-1);
-@@ -266,7 +267,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict ds
-                        */
-                       *dst = (wchar_t)*s;
-                       nb = 1;
--              } else if ((nb = _UTF8_mbrtowc(dst, s, nms, ps)) ==
-+              } else if ((nb = _UTF8_mbrtowc(dst, s, nms, ps, loc)) ==
-                   (size_t)-1) {
-                       *src = s;
-                       return ((size_t)-1);
-@@ -287,7 +288,7 @@ _UTF8_mbsnrtowcs(wchar_t * __restrict ds
- }
- static size_t
--_UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+_UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
- {
-       _UTF8State *us;
-       unsigned char lead;
-@@ -356,7 +357,7 @@ _UTF8_wcrtomb(char * __restrict s, wchar
- static size_t
- _UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
--    size_t nwc, size_t len, mbstate_t * __restrict ps)
-+    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
-       _UTF8State *us;
-       char buf[MB_LEN_MAX];
-@@ -379,7 +380,7 @@ _UTF8_wcsnrtombs(char * __restrict dst, 
-                       if (0 <= *s && *s < 0x80)
-                               /* Fast path for plain ASCII characters. */
-                               nb = 1;
--                      else if ((nb = _UTF8_wcrtomb(buf, *s, ps)) ==
-+                      else if ((nb = _UTF8_wcrtomb(buf, *s, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid character - wcrtomb() sets errno. */
-                               return ((size_t)-1);
-@@ -396,9 +397,9 @@ _UTF8_wcsnrtombs(char * __restrict dst, 
-                       /* Fast path for plain ASCII characters. */
-                       nb = 1;
-                       *dst = *s;
--              } else if (len > (size_t)MB_CUR_MAX) {
-+              } else if (len > (size_t)UTF8_MB_CUR_MAX) {
-                       /* Enough space to translate in-place. */
--                      if ((nb = _UTF8_wcrtomb(dst, *s, ps)) == (size_t)-1) {
-+                      if ((nb = _UTF8_wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-@@ -406,7 +407,7 @@ _UTF8_wcsnrtombs(char * __restrict dst, 
-                       /*
-                        * May not be enough space; use temp. buffer.
-                        */
--                      if ((nb = _UTF8_wcrtomb(buf, *s, ps)) == (size_t)-1) {
-+                      if ((nb = _UTF8_wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
index 432eddf34f81a116a0b4b12c12291127487375fa..2b320a2c13b6ba6e353c6de23dfc09b03ebc1b5d 100644 (file)
 .Dt WCRTOMB 3
 .Os
 .Sh NAME
-.Nm wcrtomb
+.Nm wcrtomb ,
+.Nm wcrtomb_l
 .Nd "convert a wide-character code to a character (restartable)"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft size_t
-.Fn wcrtomb "char * restrict s" "wchar_t wc" "mbstate_t * restrict ps"
+.Fo wcrtomb
+.Fa "char *restrict s"
+.Fa "wchar_t wc"
+.Fa "mbstate_t *restrict ps"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft size_t
+.Fo wcrtomb_l
+.Fa "char *restrict s"
+.Fa "wchar_t wc"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcrtomb
@@ -44,10 +58,10 @@ wide character
 .Fa wc ,
 including any necessary shift sequences, to the
 character array
-.Fa s ,
-storing a maximum of
+.Fa s .
+A maximum of
 .Dv MB_CUR_MAX
-bytes.
+bytes will be stored.
 .Pp
 If
 .Fa s
@@ -58,7 +72,7 @@ behaves as if
 .Fa s
 pointed to an internal buffer and
 .Fa wc
-was a null wide character (L'\e0').
+were a null wide character (L'\e0').
 .Pp
 The
 .Ft mbstate_t
@@ -72,6 +86,14 @@ uses an internal, static
 .Vt mbstate_t
 object, which is initialized to the initial conversion state
 at program startup.
+.Pp
+While the
+.Fn wcrtomb
+function uses the current locale, the
+.Fn wcrtomb_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn wcrtomb
@@ -97,7 +119,8 @@ The conversion state is invalid.
 .Xr mbrtowc 3 ,
 .Xr multibyte 3 ,
 .Xr setlocale 3 ,
-.Xr wctomb 3
+.Xr wctomb 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcrtomb
diff --git a/locale/FreeBSD/wcrtomb.3.patch b/locale/FreeBSD/wcrtomb.3.patch
deleted file mode 100644 (file)
index 9042c9e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
---- wcrtomb.3.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcrtomb.3  2009-11-09 15:05:26.000000000 -0800
-@@ -28,14 +28,28 @@
- .Dt WCRTOMB 3
- .Os
- .Sh NAME
--.Nm wcrtomb
-+.Nm wcrtomb ,
-+.Nm wcrtomb_l
- .Nd "convert a wide-character code to a character (restartable)"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft size_t
--.Fn wcrtomb "char * restrict s" "wchar_t wc" "mbstate_t * restrict ps"
-+.Fo wcrtomb
-+.Fa "char *restrict s"
-+.Fa "wchar_t wc"
-+.Fa "mbstate_t *restrict ps"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo wcrtomb_l
-+.Fa "char *restrict s"
-+.Fa "wchar_t wc"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcrtomb
-@@ -44,10 +58,10 @@ wide character
- .Fa wc ,
- including any necessary shift sequences, to the
- character array
--.Fa s ,
--storing a maximum of
-+.Fa s .
-+A maximum of
- .Dv MB_CUR_MAX
--bytes.
-+bytes will be stored.
- .Pp
- If
- .Fa s
-@@ -58,7 +72,7 @@ behaves as if
- .Fa s
- pointed to an internal buffer and
- .Fa wc
--was a null wide character (L'\e0').
-+were a null wide character (L'\e0').
- .Pp
- The
- .Ft mbstate_t
-@@ -72,6 +86,14 @@ uses an internal, static
- .Vt mbstate_t
- object, which is initialized to the initial conversion state
- at program startup.
-+.Pp
-+While the
-+.Fn wcrtomb
-+function uses the current locale, the
-+.Fn wcrtomb_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn wcrtomb
-@@ -97,7 +119,8 @@ The conversion state is invalid.
- .Xr mbrtowc 3 ,
- .Xr multibyte 3 ,
- .Xr setlocale 3 ,
--.Xr wctomb 3
-+.Xr wctomb 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcrtomb
index 4d7b115067222b178341972bbff6e15b1da47f5f..81b99d4f781a4a2303115f60750d471f5166cc03 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 #include "mblocal.h"
 
 size_t
-wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+wcrtomb_l(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps,
+    locale_t loc)
 {
-       static mbstate_t mbs;
-
+       NORMALIZE_LOCALE(loc);
        if (ps == NULL)
-               ps = &mbs;
-       return (__wcrtomb(s, wc, ps));
+               ps = &loc->__mbs_wcrtomb;
+       return (loc->__lc_ctype->__wcrtomb(s, wc, ps, loc));
+}
+
+size_t
+wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
+{
+       return wcrtomb_l(s, wc, ps, __current_locale());
 }
diff --git a/locale/FreeBSD/wcrtomb.c.patch b/locale/FreeBSD/wcrtomb.c.patch
deleted file mode 100644 (file)
index 0de3d6d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- wcrtomb.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcrtomb.c  2009-11-09 15:05:26.000000000 -0800
-@@ -27,15 +27,23 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #include "mblocal.h"
- size_t
--wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+wcrtomb_l(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps,
-+    locale_t loc)
- {
--      static mbstate_t mbs;
--
-+      NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
--              ps = &mbs;
--      return (__wcrtomb(s, wc, ps));
-+              ps = &loc->__mbs_wcrtomb;
-+      return (loc->__lc_ctype->__wcrtomb(s, wc, ps, loc));
-+}
-+
-+size_t
-+wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-+{
-+      return wcrtomb_l(s, wc, ps, __current_locale());
- }
index 5f29f39c7130ef3315a7bd73313ca945b03d147a..b11967a2f4d2ec9d28f9facd60b327315d3016ac 100644 (file)
@@ -28,7 +28,8 @@
 .Dt WCSFTIME 3
 .Os
 .Sh NAME
-.Nm wcsftime
+.Nm wcsftime ,
+.Nm wcsftime_l
 .Nd "convert date and time to a wide-character string"
 .Sh LIBRARY
 .Lb libc
 .In wchar.h
 .Ft size_t
 .Fo wcsftime
-.Fa "wchar_t * restrict wcs" "size_t maxsize"
-.Fa "const wchar_t * restrict format" "const struct tm * restrict timeptr"
+.Fa "wchar_t *restrict wcs"
+.Fa "size_t maxsize"
+.Fa "const wchar_t *restrict format"
+.Fa "const struct tm *restrict timeptr"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft size_t
+.Fo wcsftime_l
+.Fa "wchar_t *restrict wcs"
+.Fa "size_t maxsize"
+.Fa "const wchar_t *restrict format"
+.Fa "const struct tm *restrict timeptr"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn wcsftime
 function is equivalent to the
 .Fn strftime
-function except for the types of its arguments.
+function, except for the types of its arguments.
 Refer to
 .Xr strftime 3
 for a detailed description.
+.Pp
+While the
+.Fn wcsftime
+function uses the current locale, the
+.Fn wcsftime_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh COMPATIBILITY
 Some early implementations of
 .Fn wcsftime
 had a
 .Fa format
 argument with type
-.Vt "const char *"
+.Vt "const char *" ,
 instead of
 .Vt "const wchar_t *" .
 .Sh SEE ALSO
-.Xr strftime 3
+.Xr strftime 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcsftime
diff --git a/locale/FreeBSD/wcsftime.3.patch b/locale/FreeBSD/wcsftime.3.patch
deleted file mode 100644 (file)
index 7a7d808..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
---- wcsftime.3.orig    2009-11-09 15:05:25.000000000 -0800
-+++ wcsftime.3 2009-11-09 15:05:26.000000000 -0800
-@@ -28,7 +28,8 @@
- .Dt WCSFTIME 3
- .Os
- .Sh NAME
--.Nm wcsftime
-+.Nm wcsftime ,
-+.Nm wcsftime_l
- .Nd "convert date and time to a wide-character string"
- .Sh LIBRARY
- .Lb libc
-@@ -36,29 +37,50 @@
- .In wchar.h
- .Ft size_t
- .Fo wcsftime
--.Fa "wchar_t * restrict wcs" "size_t maxsize"
--.Fa "const wchar_t * restrict format" "const struct tm * restrict timeptr"
-+.Fa "wchar_t *restrict wcs"
-+.Fa "size_t maxsize"
-+.Fa "const wchar_t *restrict format"
-+.Fa "const struct tm *restrict timeptr"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo wcsftime_l
-+.Fa "wchar_t *restrict wcs"
-+.Fa "size_t maxsize"
-+.Fa "const wchar_t *restrict format"
-+.Fa "const struct tm *restrict timeptr"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn wcsftime
- function is equivalent to the
- .Fn strftime
--function except for the types of its arguments.
-+function, except for the types of its arguments.
- Refer to
- .Xr strftime 3
- for a detailed description.
-+.Pp
-+While the
-+.Fn wcsftime
-+function uses the current locale, the
-+.Fn wcsftime_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh COMPATIBILITY
- Some early implementations of
- .Fn wcsftime
- had a
- .Fa format
- argument with type
--.Vt "const char *"
-+.Vt "const char *" ,
- instead of
- .Vt "const wchar_t *" .
- .Sh SEE ALSO
--.Xr strftime 3
-+.Xr strftime 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcsftime
index 40f3c6cf61bbfb1c83d4f5041fa058f5992332f4..ddf989ac9009b7443f033078fa1b529a0a4c22a9 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdivacky Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -47,8 +49,9 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdi
  * format specifications in the format string.
  */
 size_t
-wcsftime(wchar_t * __restrict wcs, size_t maxsize,
-    const wchar_t * __restrict format, const struct tm * __restrict timeptr)
+wcsftime_l(wchar_t * __restrict wcs, size_t maxsize,
+    const wchar_t * __restrict format, const struct tm * __restrict timeptr,
+    locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
@@ -58,6 +61,7 @@ wcsftime(wchar_t * __restrict wcs, size_t maxsize,
        size_t n, sflen;
        int sverrno;
 
+       NORMALIZE_LOCALE(loc);
        sformat = dst = NULL;
 
        /*
@@ -66,13 +70,13 @@ wcsftime(wchar_t * __restrict wcs, size_t maxsize,
         */
        mbs = initial;
        formatp = format;
-       sflen = wcsrtombs(NULL, &formatp, 0, &mbs);
+       sflen = wcsrtombs_l(NULL, &formatp, 0, &mbs, loc);
        if (sflen == (size_t)-1)
                goto error;
        if ((sformat = malloc(sflen + 1)) == NULL)
                goto error;
        mbs = initial;
-       wcsrtombs(sformat, &formatp, sflen + 1, &mbs);
+       wcsrtombs_l(sformat, &formatp, sflen + 1, &mbs, loc);
 
        /*
         * Allocate memory for longest multibyte sequence that will fit
@@ -80,18 +84,18 @@ wcsftime(wchar_t * __restrict wcs, size_t maxsize,
         * Then, copy and convert the result back into wide characters in
         * the caller's buffer.
         */
-       if (SIZE_T_MAX / MB_CUR_MAX <= maxsize) {
+       if (SIZE_T_MAX / MB_CUR_MAX_L(loc) <= maxsize) {
                /* maxsize is prepostorously large - avoid int. overflow. */
                errno = EINVAL;
                goto error;
        }
-       if ((dst = malloc(maxsize * MB_CUR_MAX)) == NULL)
+       if ((dst = malloc(maxsize * MB_CUR_MAX_L(loc))) == NULL)
                goto error;
-       if (strftime(dst, maxsize, sformat, timeptr) == 0)
+       if (strftime_l(dst, maxsize, sformat, timeptr, loc) == 0)
                goto error;
        dstp = dst;
        mbs = initial;
-       n = mbsrtowcs(wcs, &dstp, maxsize, &mbs);
+       n = mbsrtowcs_l(wcs, &dstp, maxsize, &mbs, loc);
        if (n == (size_t)-2 || n == (size_t)-1 || dstp != NULL)
                goto error;
 
@@ -106,3 +110,10 @@ error:
        errno = sverrno;
        return (0);
 }
+
+size_t
+wcsftime(wchar_t * __restrict wcs, size_t maxsize,
+    const wchar_t * __restrict format, const struct tm * __restrict timeptr)
+{
+       return wcsftime_l(wcs, maxsize, format, timeptr, __current_locale());
+}
diff --git a/locale/FreeBSD/wcsftime.c.patch b/locale/FreeBSD/wcsftime.c.patch
deleted file mode 100644 (file)
index 02c81ea..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
---- wcsftime.c.bsdnew  2009-11-09 15:05:25.000000000 -0800
-+++ wcsftime.c 2009-11-09 17:45:28.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdivacky Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <stdlib.h>
-@@ -47,8 +49,9 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * format specifications in the format string.
-  */
- size_t
--wcsftime(wchar_t * __restrict wcs, size_t maxsize,
--    const wchar_t * __restrict format, const struct tm * __restrict timeptr)
-+wcsftime_l(wchar_t * __restrict wcs, size_t maxsize,
-+    const wchar_t * __restrict format, const struct tm * __restrict timeptr,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-@@ -58,6 +61,7 @@ wcsftime(wchar_t * __restrict wcs, size_
-       size_t n, sflen;
-       int sverrno;
-+      NORMALIZE_LOCALE(loc);
-       sformat = dst = NULL;
-       /*
-@@ -66,13 +70,13 @@ wcsftime(wchar_t * __restrict wcs, size_
-        */
-       mbs = initial;
-       formatp = format;
--      sflen = wcsrtombs(NULL, &formatp, 0, &mbs);
-+      sflen = wcsrtombs_l(NULL, &formatp, 0, &mbs, loc);
-       if (sflen == (size_t)-1)
-               goto error;
-       if ((sformat = malloc(sflen + 1)) == NULL)
-               goto error;
-       mbs = initial;
--      wcsrtombs(sformat, &formatp, sflen + 1, &mbs);
-+      wcsrtombs_l(sformat, &formatp, sflen + 1, &mbs, loc);
-       /*
-        * Allocate memory for longest multibyte sequence that will fit
-@@ -80,18 +84,18 @@ wcsftime(wchar_t * __restrict wcs, size_
-        * Then, copy and convert the result back into wide characters in
-        * the caller's buffer.
-        */
--      if (SIZE_T_MAX / MB_CUR_MAX <= maxsize) {
-+      if (SIZE_T_MAX / MB_CUR_MAX_L(loc) <= maxsize) {
-               /* maxsize is prepostorously large - avoid int. overflow. */
-               errno = EINVAL;
-               goto error;
-       }
--      if ((dst = malloc(maxsize * MB_CUR_MAX)) == NULL)
-+      if ((dst = malloc(maxsize * MB_CUR_MAX_L(loc))) == NULL)
-               goto error;
--      if (strftime(dst, maxsize, sformat, timeptr) == 0)
-+      if (strftime_l(dst, maxsize, sformat, timeptr, loc) == 0)
-               goto error;
-       dstp = dst;
-       mbs = initial;
--      n = mbsrtowcs(wcs, &dstp, maxsize, &mbs);
-+      n = mbsrtowcs_l(wcs, &dstp, maxsize, &mbs, loc);
-       if (n == (size_t)-2 || n == (size_t)-1 || dstp != NULL)
-               goto error;
-@@ -106,3 +110,10 @@ error:
-       errno = sverrno;
-       return (0);
- }
-+
-+size_t
-+wcsftime(wchar_t * __restrict wcs, size_t maxsize,
-+    const wchar_t * __restrict format, const struct tm * __restrict timeptr)
-+{
-+      return wcsftime_l(wcs, maxsize, format, timeptr, __current_locale());
-+}
index 89cd9b72b2b4839cbc47597546baf6ab3262c06f..adc29a18701113d3bb2220d8a3d8d64546dd9fd3 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 stefanf Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
@@ -34,32 +36,41 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 s
 #include "mblocal.h"
 
 size_t
-wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
-    size_t len, mbstate_t * __restrict ps)
+wcsnrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
+    size_t len, mbstate_t * __restrict ps, locale_t loc)
 {
-       static mbstate_t mbs;
-
+       NORMALIZE_LOCALE(loc);
        if (ps == NULL)
-               ps = &mbs;
-       return (__wcsnrtombs(dst, src, nwc, len, ps));
+               ps = &loc->__mbs_wcsnrtombs;
+       return (loc->__lc_ctype->__wcsnrtombs(dst, src, nwc, len, ps, loc));
 }
 
 size_t
+wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
+    size_t len, mbstate_t * __restrict ps)
+{
+       return wcsnrtombs_l(dst, src, nwc, len, ps, __current_locale());
+}
+
+__private_extern__ size_t
 __wcsnrtombs_std(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps)
+    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
 {
        mbstate_t mbsbak;
        char buf[MB_LEN_MAX];
        const wchar_t *s;
        size_t nbytes;
        size_t nb;
+       struct __xlocale_st_runelocale *runeLocale = loc->__lc_ctype;
+       size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t) = runeLocale->__wcrtomb;
+       int mb_cur_max = runeLocale->__mb_cur_max;
 
        s = *src;
        nbytes = 0;
 
        if (dst == NULL) {
                while (nwc-- > 0) {
-                       if ((nb = __wcrtomb(buf, *s, ps)) == (size_t)-1)
+                       if ((nb = __wcrtomb(buf, *s, ps, loc)) == (size_t)-1)
                                /* Invalid character - wcrtomb() sets errno. */
                                return ((size_t)-1);
                        else if (*s == L'\0')
@@ -71,9 +82,9 @@ __wcsnrtombs_std(char * __restrict dst, const wchar_t ** __restrict src,
        }
 
        while (len > 0 && nwc-- > 0) {
-               if (len > (size_t)MB_CUR_MAX) {
+               if (len > (size_t)mb_cur_max) {
                        /* Enough space to translate in-place. */
-                       if ((nb = __wcrtomb(dst, *s, ps)) == (size_t)-1) {
+                       if ((nb = __wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
                                *src = s;
                                return ((size_t)-1);
                        }
@@ -86,7 +97,7 @@ __wcsnrtombs_std(char * __restrict dst, const wchar_t ** __restrict src,
                         * character is too long for the buffer.
                         */
                        mbsbak = *ps;
-                       if ((nb = __wcrtomb(buf, *s, ps)) == (size_t)-1) {
+                       if ((nb = __wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
                                *src = s;
                                return ((size_t)-1);
                        }
diff --git a/locale/FreeBSD/wcsnrtombs.c.patch b/locale/FreeBSD/wcsnrtombs.c.patch
deleted file mode 100644 (file)
index e4ba34b..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
---- wcsnrtombs.c.bsdnew        2009-11-09 15:05:25.000000000 -0800
-+++ wcsnrtombs.c       2009-11-09 17:47:14.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 stefanf Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -34,32 +36,41 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "mblocal.h"
- size_t
--wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
--    size_t len, mbstate_t * __restrict ps)
-+wcsnrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
-+    size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
--      static mbstate_t mbs;
--
-+      NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
--              ps = &mbs;
--      return (__wcsnrtombs(dst, src, nwc, len, ps));
-+              ps = &loc->__mbs_wcsnrtombs;
-+      return (loc->__lc_ctype->__wcsnrtombs(dst, src, nwc, len, ps, loc));
- }
- size_t
-+wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
-+    size_t len, mbstate_t * __restrict ps)
-+{
-+      return wcsnrtombs_l(dst, src, nwc, len, ps, __current_locale());
-+}
-+
-+__private_extern__ size_t
- __wcsnrtombs_std(char * __restrict dst, const wchar_t ** __restrict src,
--    size_t nwc, size_t len, mbstate_t * __restrict ps)
-+    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
- {
-       mbstate_t mbsbak;
-       char buf[MB_LEN_MAX];
-       const wchar_t *s;
-       size_t nbytes;
-       size_t nb;
-+      struct __xlocale_st_runelocale *runeLocale = loc->__lc_ctype;
-+      size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t) = runeLocale->__wcrtomb;
-+      int mb_cur_max = runeLocale->__mb_cur_max;
-       s = *src;
-       nbytes = 0;
-       if (dst == NULL) {
-               while (nwc-- > 0) {
--                      if ((nb = __wcrtomb(buf, *s, ps)) == (size_t)-1)
-+                      if ((nb = __wcrtomb(buf, *s, ps, loc)) == (size_t)-1)
-                               /* Invalid character - wcrtomb() sets errno. */
-                               return ((size_t)-1);
-                       else if (*s == L'\0')
-@@ -71,9 +82,9 @@ __wcsnrtombs_std(char * __restrict dst, 
-       }
-       while (len > 0 && nwc-- > 0) {
--              if (len > (size_t)MB_CUR_MAX) {
-+              if (len > (size_t)mb_cur_max) {
-                       /* Enough space to translate in-place. */
--                      if ((nb = __wcrtomb(dst, *s, ps)) == (size_t)-1) {
-+                      if ((nb = __wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-@@ -86,7 +97,7 @@ __wcsnrtombs_std(char * __restrict dst, 
-                        * character is too long for the buffer.
-                        */
-                       mbsbak = *ps;
--                      if ((nb = __wcrtomb(buf, *s, ps)) == (size_t)-1) {
-+                      if ((nb = __wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
index b38f3a4527b70be88e72dcb8c9676132e5cb7cc1..0848655cfae3966ef8beed0480d922c212a96792 100644 (file)
 .Dt WCSRTOMBS 3
 .Os
 .Sh NAME
+.Nm wcsnrtombs ,
+.Nm wcsnrtombs_l ,
 .Nm wcsrtombs ,
-.Nm wcsnrtombs
+.Nm wcsrtombs_l
 .Nd "convert a wide-character string to a character string (restartable)"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft size_t
+.Fo wcsnrtombs
+.Fa "char *restrict dst"
+.Fa "const wchar_t **restrict src"
+.Fa "size_t nwc"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
+.Fc
+.Ft size_t
 .Fo wcsrtombs
-.Fa "char * restrict dst" "const wchar_t ** restrict src"
-.Fa "size_t len" "mbstate_t * restrict ps"
+.Fa "char *restrict dst"
+.Fa "const wchar_t **restrict src"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
 .Fc
+.In wchar.h
+.In xlocale.h
 .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"
+.Fo wcsnrtombs_l
+.Fa "char *restrict dst"
+.Fa "const wchar_t **restrict src"
+.Fa "size_t nwc"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
+.Fc
+.Ft size_t
+.Fo wcsrtombs_l
+.Fa "char *restrict dst"
+.Fa "const wchar_t **restrict src"
+.Fa "size_t len"
+.Fa "mbstate_t *restrict ps"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn wcsrtombs
-function converts a string of wide characters indirectly pointed to by
-.Fa src
-to a corresponding multibyte character string stored in the array
-pointed to by
+function converts a string of wide characters,
+indirectly pointed to by
+.Fa src ,
+to a corresponding multi-byte character string,
+stored in the array pointed to by
 .Fa dst .
 No more than
 .Fa len
@@ -97,15 +124,28 @@ except that conversion stops after reading at most
 .Fa nwc
 characters from the buffer pointed to by
 .Fa src .
+.Pp
+Although the
+.Fn wcsrtombs
+and
+.Fn wcsnrtombs
+functions use the current locale, the
+.Fn wcsrtombs_l
+and
+.Fn wcsnrtombs_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
-The
+If successful, the
 .Fn wcsrtombs
 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
+(not including any terminating null);
+otherwise, they return
 .Po Vt size_t Pc Ns \-1 .
 .Sh ERRORS
 The
@@ -122,7 +162,8 @@ The conversion state is invalid.
 .Sh SEE ALSO
 .Xr mbsrtowcs 3 ,
 .Xr wcrtomb 3 ,
-.Xr wcstombs 3
+.Xr wcstombs 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcsrtombs
diff --git a/locale/FreeBSD/wcsrtombs.3.patch b/locale/FreeBSD/wcsrtombs.3.patch
deleted file mode 100644 (file)
index 6cd7335..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
---- wcsrtombs.3.orig   2009-11-09 15:05:25.000000000 -0800
-+++ wcsrtombs.3        2009-11-09 15:05:26.000000000 -0800
-@@ -28,30 +28,57 @@
- .Dt WCSRTOMBS 3
- .Os
- .Sh NAME
-+.Nm wcsnrtombs ,
-+.Nm wcsnrtombs_l ,
- .Nm wcsrtombs ,
--.Nm wcsnrtombs
-+.Nm wcsrtombs_l
- .Nd "convert a wide-character string to a character string (restartable)"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft size_t
-+.Fo wcsnrtombs
-+.Fa "char *restrict dst"
-+.Fa "const wchar_t **restrict src"
-+.Fa "size_t nwc"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
-+.Fc
-+.Ft size_t
- .Fo wcsrtombs
--.Fa "char * restrict dst" "const wchar_t ** restrict src"
--.Fa "size_t len" "mbstate_t * restrict ps"
-+.Fa "char *restrict dst"
-+.Fa "const wchar_t **restrict src"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
- .Fc
-+.In wchar.h
-+.In xlocale.h
- .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"
-+.Fo wcsnrtombs_l
-+.Fa "char *restrict dst"
-+.Fa "const wchar_t **restrict src"
-+.Fa "size_t nwc"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
-+.Fc
-+.Ft size_t
-+.Fo wcsrtombs_l
-+.Fa "char *restrict dst"
-+.Fa "const wchar_t **restrict src"
-+.Fa "size_t len"
-+.Fa "mbstate_t *restrict ps"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn wcsrtombs
--function converts a string of wide characters indirectly pointed to by
--.Fa src
--to a corresponding multibyte character string stored in the array
--pointed to by
-+function converts a string of wide characters,
-+indirectly pointed to by
-+.Fa src ,
-+to a corresponding multi-byte character string,
-+stored in the array pointed to by
- .Fa dst .
- No more than
- .Fa len
-@@ -97,15 +124,28 @@ except that conversion stops after readi
- .Fa nwc
- characters from the buffer pointed to by
- .Fa src .
-+.Pp
-+Although the
-+.Fn wcsrtombs
-+and
-+.Fn wcsnrtombs
-+functions use the current locale, the
-+.Fn wcsrtombs_l
-+and
-+.Fn wcsnrtombs_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
--The
-+If successful, the
- .Fn wcsrtombs
- 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
-+(not including any terminating null);
-+otherwise, they return
- .Po Vt size_t Pc Ns \-1 .
- .Sh ERRORS
- The
-@@ -122,7 +162,8 @@ The conversion state is invalid.
- .Sh SEE ALSO
- .Xr mbsrtowcs 3 ,
- .Xr wcrtomb 3 ,
--.Xr wcstombs 3
-+.Xr wcstombs 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcsrtombs
index 61e5432de749b18eb09e55fdf53ce45224ca0044..483b862b7184c0f2aef2739877b770b6c559dcdc 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
 #include "mblocal.h"
 
+size_t
+wcsrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
+    mbstate_t * __restrict ps, locale_t loc)
+{
+       NORMALIZE_LOCALE(loc);
+       if (ps == NULL)
+               ps = &loc->__mbs_wcsrtombs;
+       return (loc->__lc_ctype->__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps, loc));
+}
+
 size_t
 wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
     mbstate_t * __restrict ps)
 {
-       static mbstate_t mbs;
-
-       if (ps == NULL)
-               ps = &mbs;
-       return (__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps));
+       return wcsrtombs_l(dst, src, len, ps, __current_locale());
 }
diff --git a/locale/FreeBSD/wcsrtombs.c.patch b/locale/FreeBSD/wcsrtombs.c.patch
deleted file mode 100644 (file)
index ff0e290..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- wcsrtombs.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ wcsrtombs.c        2009-11-09 15:05:26.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -34,12 +36,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
- #include "mblocal.h"
- size_t
-+wcsrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
-+    mbstate_t * __restrict ps, locale_t loc)
-+{
-+      NORMALIZE_LOCALE(loc);
-+      if (ps == NULL)
-+              ps = &loc->__mbs_wcsrtombs;
-+      return (loc->__lc_ctype->__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps, loc));
-+}
-+
-+size_t
- wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
-     mbstate_t * __restrict ps)
- {
--      static mbstate_t mbs;
--
--      if (ps == NULL)
--              ps = &mbs;
--      return (__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps));
-+      return wcsrtombs_l(dst, src, len, ps, __current_locale());
- }
index e63a2c8e688047aba087da816b77b4527919e28b..9595d072eabf1fa678f28b8645c140ebed59ffcf 100644 (file)
 .Dt WCSTOD 3
 .Os
 .Sh NAME
-.Nm wcstof ,
 .Nm wcstod ,
+.Nm wcstof ,
 .Nm wcstold
 .Nd convert string to
-.Vt float , double
+.Vt float ,
+.Vt double ,
 or
 .Vt "long double"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
+.Ft double
+.Fo wcstod
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fc
 .Ft float
-.Fn wcstof "const wchar_t * restrict nptr" "wchar_t ** restrict endptr"
+.Fo wcstof
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fc
 .Ft "long double"
-.Fn wcstold "const wchar_t * restrict nptr" "wchar_t ** restrict endptr"
-.Ft double
-.Fn wcstod "const wchar_t * restrict nptr" "wchar_t ** restrict endptr"
+.Fo wcstold
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcstof ,
-.Fn wcstod
+.Fn wcstod ,
 and
 .Fn wcstold
 functions are the wide-character versions of the
 .Fn strtof ,
-.Fn strtod
+.Fn strtod ,
 and
 .Fn strtold
 functions.
 Refer to
 .Xr strtod 3
 for details.
+.Pp
+Extended locale versions of these functions are documented in
+.Xr wcstod_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh SEE ALSO
 .Xr strtod 3 ,
+.Xr wcstod_l 3 ,
 .Xr wcstol 3
 .Sh STANDARDS
 The
diff --git a/locale/FreeBSD/wcstod.3.patch b/locale/FreeBSD/wcstod.3.patch
deleted file mode 100644 (file)
index 2b7bdca..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
---- wcstod.3.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wcstod.3   2009-11-09 15:05:26.000000000 -0800
-@@ -28,40 +28,57 @@
- .Dt WCSTOD 3
- .Os
- .Sh NAME
--.Nm wcstof ,
- .Nm wcstod ,
-+.Nm wcstof ,
- .Nm wcstold
- .Nd convert string to
--.Vt float , double
-+.Vt float ,
-+.Vt double ,
- or
- .Vt "long double"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
-+.Ft double
-+.Fo wcstod
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fc
- .Ft float
--.Fn wcstof "const wchar_t * restrict nptr" "wchar_t ** restrict endptr"
-+.Fo wcstof
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fc
- .Ft "long double"
--.Fn wcstold "const wchar_t * restrict nptr" "wchar_t ** restrict endptr"
--.Ft double
--.Fn wcstod "const wchar_t * restrict nptr" "wchar_t ** restrict endptr"
-+.Fo wcstold
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcstof ,
--.Fn wcstod
-+.Fn wcstod ,
- and
- .Fn wcstold
- functions are the wide-character versions of the
- .Fn strtof ,
--.Fn strtod
-+.Fn strtod ,
- and
- .Fn strtold
- functions.
- Refer to
- .Xr strtod 3
- for details.
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr wcstod_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh SEE ALSO
- .Xr strtod 3 ,
-+.Xr wcstod_l 3 ,
- .Xr wcstol 3
- .Sh STANDARDS
- The
index da90f16c28f47f439c65bc57bf1354c7a0ea09eb..3ecc75a0ca2a78982de59eb7c394b6bc51fbdac0 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <_simple.h>
+
+/*
+ * __wcs_end_offset calculates the offset to the end within the wide character
+ * string, assuming numbers and letters are single bytes in multibyte
+ * representation, get the actual decimal string for localeconv_l.  If the
+ * decimal point was within the string, compensate for the fact that the
+ * (possible more than one byte) decimal point one takes one wide character.
+ */
+__private_extern__ size_t
+__wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc)
+{
+       const char *decimalpoint = localeconv_l(loc)->decimal_point;
+       size_t n = end - buf;
+       char *p;
+
+       if ((p = strnstr(buf, decimalpoint, n)) != NULL)
+               n -= strlen(decimalpoint) - 1;
+       return n;
+}
 
 /*
  * Convert a string to a double-precision number.
@@ -38,45 +60,48 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr E
  * have to duplicate the code of strtod() here, we convert the supplied
  * wide character string to multibyte and call strtod() on the result.
  * This assumes that the multibyte encoding is compatible with ASCII
- * for at least the digits, radix character and letters.
+ * for at least the digits and letters.  The radix character can be more
+ * than one byte.
  */
+
 double
-wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
+wcstod_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
        double val;
        char *buf, *end;
-       const wchar_t *wcp;
        size_t len;
+       locale_t ctype;
+       _SIMPLE_STRING b;
+       char mb[MB_CUR_MAX + 1];
+       const wchar_t *nptr0 = nptr;
+       const wchar_t *first;
 
-       while (iswspace(*nptr))
+       NORMALIZE_LOCALE(loc);
+       ctype = __numeric_ctype(loc);
+
+       while (iswspace_l(*nptr, ctype))
                nptr++;
 
-       /*
-        * Convert the supplied numeric wide char. string to multibyte.
-        *
-        * We could attempt to find the end of the numeric portion of the
-        * wide char. string to avoid converting unneeded characters but
-        * choose not to bother; optimising the uncommon case where
-        * the input string contains a lot of text after the number
-        * duplicates a lot of strtod()'s functionality and slows down the
-        * most common cases.
-        */
-       wcp = nptr;
-       mbs = initial;
-       if ((len = wcsrtombs(NULL, &wcp, 0, &mbs)) == (size_t)-1) {
-               if (endptr != NULL)
-                       *endptr = (wchar_t *)nptr;
-               return (0.0);
-       }
-       if ((buf = malloc(len + 1)) == NULL)
+       if ((b = _simple_salloc()) == NULL)
                return (0.0);
+
+       first = nptr;
        mbs = initial;
-       wcsrtombs(buf, &wcp, len + 1, &mbs);
+       while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
+               mb[len] = 0;
+               if (_simple_sappend(b, mb) < 0) { /* no memory */
+                       _simple_sfree(b);
+                       return (0.0);
+               }
+               nptr++;
+       }
 
        /* Let strtod() do most of the work for us. */
-       val = strtod(buf, &end);
+       buf = _simple_string(b);
+       val = strtod_l(buf, &end, loc);
 
        /*
         * We only know where the number ended in the _multibyte_
@@ -86,9 +111,15 @@ wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
         */
        if (endptr != NULL)
                /* XXX Assume each wide char is one byte. */
-               *endptr = (wchar_t *)nptr + (end - buf);
+               *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
 
-       free(buf);
+       _simple_sfree(b);
 
        return (val);
 }
+
+double
+wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
+{
+       return wcstod_l(nptr, endptr, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstod.c.patch b/locale/FreeBSD/wcstod.c.patch
deleted file mode 100644 (file)
index 9cab53b..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
---- wcstod.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wcstod.c   2009-11-09 15:05:26.000000000 -0800
-@@ -27,9 +27,31 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <wchar.h>
- #include <wctype.h>
-+#include <_simple.h>
-+
-+/*
-+ * __wcs_end_offset calculates the offset to the end within the wide character
-+ * string, assuming numbers and letters are single bytes in multibyte
-+ * representation, get the actual decimal string for localeconv_l.  If the
-+ * decimal point was within the string, compensate for the fact that the
-+ * (possible more than one byte) decimal point one takes one wide character.
-+ */
-+__private_extern__ size_t
-+__wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc)
-+{
-+      const char *decimalpoint = localeconv_l(loc)->decimal_point;
-+      size_t n = end - buf;
-+      char *p;
-+
-+      if ((p = strnstr(buf, decimalpoint, n)) != NULL)
-+              n -= strlen(decimalpoint) - 1;
-+      return n;
-+}
- /*
-  * Convert a string to a double-precision number.
-@@ -38,45 +60,48 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * have to duplicate the code of strtod() here, we convert the supplied
-  * wide character string to multibyte and call strtod() on the result.
-  * This assumes that the multibyte encoding is compatible with ASCII
-- * for at least the digits, radix character and letters.
-+ * for at least the digits and letters.  The radix character can be more
-+ * than one byte.
-  */
-+
- double
--wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-+wcstod_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       double val;
-       char *buf, *end;
--      const wchar_t *wcp;
-       size_t len;
-+      locale_t ctype;
-+      _SIMPLE_STRING b;
-+      char mb[MB_CUR_MAX + 1];
-+      const wchar_t *nptr0 = nptr;
-+      const wchar_t *first;
-+
-+      NORMALIZE_LOCALE(loc);
-+      ctype = __numeric_ctype(loc);
--      while (iswspace(*nptr))
-+      while (iswspace_l(*nptr, ctype))
-               nptr++;
--      /*
--       * Convert the supplied numeric wide char. string to multibyte.
--       *
--       * We could attempt to find the end of the numeric portion of the
--       * wide char. string to avoid converting unneeded characters but
--       * choose not to bother; optimising the uncommon case where
--       * the input string contains a lot of text after the number
--       * duplicates a lot of strtod()'s functionality and slows down the
--       * most common cases.
--       */
--      wcp = nptr;
--      mbs = initial;
--      if ((len = wcsrtombs(NULL, &wcp, 0, &mbs)) == (size_t)-1) {
--              if (endptr != NULL)
--                      *endptr = (wchar_t *)nptr;
--              return (0.0);
--      }
--      if ((buf = malloc(len + 1)) == NULL)
-+      if ((b = _simple_salloc()) == NULL)
-               return (0.0);
-+
-+      first = nptr;
-       mbs = initial;
--      wcsrtombs(buf, &wcp, len + 1, &mbs);
-+      while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
-+              mb[len] = 0;
-+              if (_simple_sappend(b, mb) < 0) { /* no memory */
-+                      _simple_sfree(b);
-+                      return (0.0);
-+              }
-+              nptr++;
-+      }
-       /* Let strtod() do most of the work for us. */
--      val = strtod(buf, &end);
-+      buf = _simple_string(b);
-+      val = strtod_l(buf, &end, loc);
-       /*
-        * We only know where the number ended in the _multibyte_
-@@ -86,9 +111,15 @@ wcstod(const wchar_t * __restrict nptr, 
-        */
-       if (endptr != NULL)
-               /* XXX Assume each wide char is one byte. */
--              *endptr = (wchar_t *)nptr + (end - buf);
-+              *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
--      free(buf);
-+      _simple_sfree(b);
-       return (val);
- }
-+
-+double
-+wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-+{
-+      return wcstod_l(nptr, endptr, __current_locale());
-+}
index a68b382d989c21395d7b202ba781f6b49aaf2a8e..f2a6373d430c7725b7fed5736a5867c165718f14 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <_simple.h>
 
 /*
  * See wcstod() for comments as to the logic used.
  */
+
+extern size_t __wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc);
+
 float
-wcstof(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
+wcstof_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
        float val;
        char *buf, *end;
-       const wchar_t *wcp;
        size_t len;
+       locale_t ctype;
+       _SIMPLE_STRING b;
+       char mb[MB_CUR_MAX + 1];
+       const wchar_t *nptr0 = nptr;
+       const wchar_t *first;
 
-       while (iswspace(*nptr))
+       NORMALIZE_LOCALE(loc);
+       ctype = __numeric_ctype(loc);
+
+       while (iswspace_l(*nptr, ctype))
                nptr++;
 
-       wcp = nptr;
-       mbs = initial;
-       if ((len = wcsrtombs(NULL, &wcp, 0, &mbs)) == (size_t)-1) {
-               if (endptr != NULL)
-                       *endptr = (wchar_t *)nptr;
-               return (0.0);
-       }
-       if ((buf = malloc(len + 1)) == NULL)
+       if ((b = _simple_salloc()) == NULL)
                return (0.0);
+
+       first = nptr;
        mbs = initial;
-       wcsrtombs(buf, &wcp, len + 1, &mbs);
+       while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
+               mb[len] = 0;
+               if (_simple_sappend(b, mb) < 0) { /* no memory */
+                       _simple_sfree(b);
+                       return (0.0);
+               }
+               nptr++;
+       }
 
-       val = strtof(buf, &end);
+       buf = _simple_string(b);
+       val = strtof_l(buf, &end, loc);
 
        if (endptr != NULL)
-               *endptr = (wchar_t *)nptr + (end - buf);
+               *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
 
-       free(buf);
+       _simple_sfree(b);
 
        return (val);
 }
+
+float
+wcstof(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
+{
+       return wcstof_l(nptr, endptr, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstof.c.patch b/locale/FreeBSD/wcstof.c.patch
deleted file mode 100644 (file)
index 5ed6b1d..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
---- wcstof.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wcstof.c   2009-11-09 15:05:26.000000000 -0800
-@@ -27,44 +27,67 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <wchar.h>
- #include <wctype.h>
-+#include <_simple.h>
- /*
-  * See wcstod() for comments as to the logic used.
-  */
-+
-+extern size_t __wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc);
-+
- float
--wcstof(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-+wcstof_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       float val;
-       char *buf, *end;
--      const wchar_t *wcp;
-       size_t len;
-+      locale_t ctype;
-+      _SIMPLE_STRING b;
-+      char mb[MB_CUR_MAX + 1];
-+      const wchar_t *nptr0 = nptr;
-+      const wchar_t *first;
--      while (iswspace(*nptr))
-+      NORMALIZE_LOCALE(loc);
-+      ctype = __numeric_ctype(loc);
-+
-+      while (iswspace_l(*nptr, ctype))
-               nptr++;
--      wcp = nptr;
--      mbs = initial;
--      if ((len = wcsrtombs(NULL, &wcp, 0, &mbs)) == (size_t)-1) {
--              if (endptr != NULL)
--                      *endptr = (wchar_t *)nptr;
--              return (0.0);
--      }
--      if ((buf = malloc(len + 1)) == NULL)
-+      if ((b = _simple_salloc()) == NULL)
-               return (0.0);
-+
-+      first = nptr;
-       mbs = initial;
--      wcsrtombs(buf, &wcp, len + 1, &mbs);
-+      while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
-+              mb[len] = 0;
-+              if (_simple_sappend(b, mb) < 0) { /* no memory */
-+                      _simple_sfree(b);
-+                      return (0.0);
-+              }
-+              nptr++;
-+      }
--      val = strtof(buf, &end);
-+      buf = _simple_string(b);
-+      val = strtof_l(buf, &end, loc);
-       if (endptr != NULL)
--              *endptr = (wchar_t *)nptr + (end - buf);
-+              *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
--      free(buf);
-+      _simple_sfree(b);
-       return (val);
- }
-+
-+float
-+wcstof(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-+{
-+      return wcstof_l(nptr, endptr, __current_locale());
-+}
index 53d52a9040ca399c63ec428bf258b2017cdf1bcc..9c3dc3d648765c5ce562f0b8e9097c9625749d71 100644 (file)
@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.8 2002/09/06 11:23:59 tjr
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoimax.c,v 1.3 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <inttypes.h>
 #include <stdlib.h>
@@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoimax.c,v 1.3 2007/01/09 00:28:01 im
  * Convert a wide character string to an intmax_t integer.
  */
 intmax_t
-wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base)
+wcstoimax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base, locale_t loc)
 {
        const wchar_t *s;
        uintmax_t acc;
@@ -55,13 +57,14 @@ wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        uintmax_t cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtoimax for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (iswspace(c));
+       } while (iswspace_l(c, loc));
        if (c == L'-') {
                neg = 1;
                c = *s++;
@@ -88,8 +91,8 @@ wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        cutoff /= base;
        for ( ; ; c = *s++) {
 #ifdef notyet
-               if (iswdigit(c))
-                       c = digittoint(c);
+               if (iswdigit_l(c, loc))
+                       c = digittoint_l(c, loc);
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -122,3 +125,10 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+intmax_t
+wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base)
+{
+       return wcstoimax_l(nptr, endptr, base, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstoimax.c.patch b/locale/FreeBSD/wcstoimax.c.patch
deleted file mode 100644 (file)
index d904bca..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- wcstoimax.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ wcstoimax.c        2009-11-09 15:05:26.000000000 -0800
-@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/s
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoimax.c,v 1.3 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <inttypes.h>
- #include <stdlib.h>
-@@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * Convert a wide character string to an intmax_t integer.
-  */
- intmax_t
--wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
--    int base)
-+wcstoimax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base, locale_t loc)
- {
-       const wchar_t *s;
-       uintmax_t acc;
-@@ -55,13 +57,14 @@ wcstoimax(const wchar_t * __restrict npt
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoimax for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (iswspace(c));
-+      } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-@@ -88,8 +91,8 @@ wcstoimax(const wchar_t * __restrict npt
-       cutoff /= base;
-       for ( ; ; c = *s++) {
- #ifdef notyet
--              if (iswdigit(c))
--                      c = digittoint(c);
-+              if (iswdigit_l(c, loc))
-+                      c = digittoint_l(c, loc);
-               else
- #endif
-               if (c >= L'0' && c <= L'9')
-@@ -122,3 +125,10 @@ noconv:
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+intmax_t
-+wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base)
-+{
-+      return wcstoimax_l(nptr, endptr, base, __current_locale());
-+}
index 306f223022262ec43c5de8f8c302305179f57f78..89936c93e1d4b53508e4799ded16dcc207f65ccf 100644 (file)
 .Dt WCSTOL 3
 .Os
 .Sh NAME
-.Nm wcstol , wcstoul ,
-.Nm wcstoll , wcstoull ,
-.Nm wcstoimax , wcstoumax
+.Nm wcstoimax ,
+.Nm wcstol ,
+.Nm wcstoll ,
+.Nm wcstoul ,
+.Nm wcstoull ,
+.Nm wcstoumax
 .Nd "convert a wide character string value to a"
+.Vt intmax_t ,
 .Vt long ,
-.Vt "unsigned long" ,
 .Vt "long long" ,
+.Vt "unsigned long" ,
 .Vt "unsigned long long" ,
-.Vt intmax_t
 or
 .Vt uintmax_t
 integer
@@ -45,25 +48,50 @@ integer
 .Sh SYNOPSIS
 .In wchar.h
 .Ft long
-.Fn wcstol "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
-.Ft "unsigned long"
-.Fn wcstoul "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
+.Fo wcstol
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fa "int base"
+.Fc
 .Ft "long long"
-.Fn wcstoll "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
+.Fo wcstoll
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fa "int base"
+.Fc
+.Ft "unsigned long"
+.Fo wcstoul
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fa "int base"
+.Fc
 .Ft "unsigned long long"
-.Fn wcstoull "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
+.Fo wcstoull
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fa "int base"
+.Fc
+.In stddef.h
 .In inttypes.h
 .Ft intmax_t
-.Fn wcstoimax "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
+.Fo wcstoimax
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fa "int base"
+.Fc
 .Ft uintmax_t
-.Fn wcstoumax "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
+.Fo wcstoumax
+.Fa "const wchar_t *restrict nptr"
+.Fa "wchar_t **restrict endptr"
+.Fa "int base"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcstol ,
 .Fn wcstoul ,
 .Fn wcstoll ,
 .Fn wcstoull ,
-.Fn wcstoimax
+.Fn wcstoimax ,
 and
 .Fn wcstoumax
 functions are wide-character versions of the
@@ -71,23 +99,42 @@ functions are wide-character versions of the
 .Fn strtoul ,
 .Fn strtoll ,
 .Fn strtoull ,
-.Fn strtoimax
+.Fn strtoimax ,
 and
 .Fn strtoumax
 functions, respectively.
 Refer to their manual pages (for example
 .Xr strtol 3 )
 for details.
+.Pp
+Extended locale versions of these functions are documented in
+.Xr wcstol_l 3 .
+See
+.Xr xlocale 3
+for more information.
+.Sh LEGACY SYNOPSIS
+.Fd #include <stddef.h>
+.Fd #include <inttypes.h>
+.Pp
+The include file
+.In stddef.h
+is necessary for the
+.Fn wcstoimax
+and
+.Fn wcstoumax
+functions.
 .Sh SEE ALSO
 .Xr strtol 3 ,
-.Xr strtoul 3
+.Xr strtoul 3 ,
+.Xr wcstol_l 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn wcstol ,
 .Fn wcstoul ,
 .Fn wcstoll ,
 .Fn wcstoull ,
-.Fn wcstoimax
+.Fn wcstoimax ,
 and
 .Fn wcstoumax
 functions conform to
diff --git a/locale/FreeBSD/wcstol.3.patch b/locale/FreeBSD/wcstol.3.patch
deleted file mode 100644 (file)
index 2bd8b79..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
---- wcstol.3.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wcstol.3   2009-11-09 15:05:26.000000000 -0800
-@@ -28,15 +28,18 @@
- .Dt WCSTOL 3
- .Os
- .Sh NAME
--.Nm wcstol , wcstoul ,
--.Nm wcstoll , wcstoull ,
--.Nm wcstoimax , wcstoumax
-+.Nm wcstoimax ,
-+.Nm wcstol ,
-+.Nm wcstoll ,
-+.Nm wcstoul ,
-+.Nm wcstoull ,
-+.Nm wcstoumax
- .Nd "convert a wide character string value to a"
-+.Vt intmax_t ,
- .Vt long ,
--.Vt "unsigned long" ,
- .Vt "long long" ,
-+.Vt "unsigned long" ,
- .Vt "unsigned long long" ,
--.Vt intmax_t
- or
- .Vt uintmax_t
- integer
-@@ -45,25 +48,50 @@ integer
- .Sh SYNOPSIS
- .In wchar.h
- .Ft long
--.Fn wcstol "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
--.Ft "unsigned long"
--.Fn wcstoul "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
-+.Fo wcstol
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fa "int base"
-+.Fc
- .Ft "long long"
--.Fn wcstoll "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
-+.Fo wcstoll
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fa "int base"
-+.Fc
-+.Ft "unsigned long"
-+.Fo wcstoul
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fa "int base"
-+.Fc
- .Ft "unsigned long long"
--.Fn wcstoull "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
-+.Fo wcstoull
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fa "int base"
-+.Fc
-+.In stddef.h
- .In inttypes.h
- .Ft intmax_t
--.Fn wcstoimax "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
-+.Fo wcstoimax
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fa "int base"
-+.Fc
- .Ft uintmax_t
--.Fn wcstoumax "const wchar_t * restrict nptr" "wchar_t ** restrict endptr" "int base"
-+.Fo wcstoumax
-+.Fa "const wchar_t *restrict nptr"
-+.Fa "wchar_t **restrict endptr"
-+.Fa "int base"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcstol ,
- .Fn wcstoul ,
- .Fn wcstoll ,
- .Fn wcstoull ,
--.Fn wcstoimax
-+.Fn wcstoimax ,
- and
- .Fn wcstoumax
- functions are wide-character versions of the
-@@ -71,23 +99,42 @@ functions are wide-character versions of
- .Fn strtoul ,
- .Fn strtoll ,
- .Fn strtoull ,
--.Fn strtoimax
-+.Fn strtoimax ,
- and
- .Fn strtoumax
- functions, respectively.
- Refer to their manual pages (for example
- .Xr strtol 3 )
- for details.
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr wcstol_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <stddef.h>
-+.Fd #include <inttypes.h>
-+.Pp
-+The include file
-+.In stddef.h
-+is necessary for the
-+.Fn wcstoimax
-+and
-+.Fn wcstoumax
-+functions.
- .Sh SEE ALSO
- .Xr strtol 3 ,
--.Xr strtoul 3
-+.Xr strtoul 3 ,
-+.Xr wcstol_l 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn wcstol ,
- .Fn wcstoul ,
- .Fn wcstoll ,
- .Fn wcstoull ,
--.Fn wcstoimax
-+.Fn wcstoimax ,
- and
- .Fn wcstoumax
- functions conform to
index 7c2afbda732dcdc5b7c4e15c038f7cf6b73af07f..2509e559b31a9a01a5587dbeda90419501ec226e 100644 (file)
@@ -30,6 +30,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
@@ -40,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp E
  * Convert a string to a long integer.
  */
 long
-wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
+wcstol_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base, locale_t loc)
 {
        const wchar_t *s;
        unsigned long acc;
@@ -48,13 +51,14 @@ wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
        unsigned long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtol for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (iswspace(c));
+       } while (iswspace_l(c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -81,8 +85,8 @@ wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
        cutoff /= base;
        for ( ; ; c = *s++) {
 #ifdef notyet
-               if (iswdigit(c))
-                       c = digittoint(c);
+               if (iswdigit_l(c, loc))
+                       c = digittoint_l(c, loc);
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -115,3 +119,9 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+long
+wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
+{
+       return wcstol_l(nptr, endptr, base, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstol.c.patch b/locale/FreeBSD/wcstol.c.patch
deleted file mode 100644 (file)
index 57ca1e1..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
---- wcstol.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wcstol.c   2009-11-09 15:05:26.000000000 -0800
-@@ -30,6 +30,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <errno.h>
- #include <limits.h>
-@@ -40,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * Convert a string to a long integer.
-  */
- long
--wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-+wcstol_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base, locale_t loc)
- {
-       const wchar_t *s;
-       unsigned long acc;
-@@ -48,13 +51,14 @@ wcstol(const wchar_t * __restrict nptr, 
-       unsigned long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (iswspace(c));
-+      } while (iswspace_l(c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -81,8 +85,8 @@ wcstol(const wchar_t * __restrict nptr, 
-       cutoff /= base;
-       for ( ; ; c = *s++) {
- #ifdef notyet
--              if (iswdigit(c))
--                      c = digittoint(c);
-+              if (iswdigit_l(c, loc))
-+                      c = digittoint_l(c, loc);
-               else
- #endif
-               if (c >= L'0' && c <= L'9')
-@@ -115,3 +119,9 @@ noconv:
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+long
-+wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-+{
-+      return wcstol_l(nptr, endptr, base, __current_locale());
-+}
index c50ffbdf6bca3fb828837d9a0ea3ee73984ad50d..45222d8c5ba6deccfc5a814f1d687625f042295f 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <_simple.h>
 
 /*
  * See wcstod() for comments as to the logic used.
  */
+
+extern size_t __wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc);
+
 long double
-wcstold(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
+wcstold_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
        long double val;
        char *buf, *end;
-       const wchar_t *wcp;
        size_t len;
+       locale_t ctype;
+       _SIMPLE_STRING b;
+       char mb[MB_CUR_MAX + 1];
+       const wchar_t *nptr0 = nptr;
+       const wchar_t *first;
 
-       while (iswspace(*nptr))
+       NORMALIZE_LOCALE(loc);
+       ctype = __numeric_ctype(loc);
+
+       while (iswspace_l(*nptr, ctype))
                nptr++;
 
-       wcp = nptr;
-       mbs = initial;
-       if ((len = wcsrtombs(NULL, &wcp, 0, &mbs)) == (size_t)-1) {
-               if (endptr != NULL)
-                       *endptr = (wchar_t *)nptr;
-               return (0.0);
-       }
-       if ((buf = malloc(len + 1)) == NULL)
+       if ((b = _simple_salloc()) == NULL)
                return (0.0);
+
+       first = nptr;
        mbs = initial;
-       wcsrtombs(buf, &wcp, len + 1, &mbs);
+       while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
+               mb[len] = 0;
+               if (_simple_sappend(b, mb) < 0) { /* no memory */
+                       _simple_sfree(b);
+                       return (0.0);
+               }
+               nptr++;
+       }
 
-       val = strtold(buf, &end);
+       buf = _simple_string(b);
+       val = strtold_l(buf, &end, loc);
 
        if (endptr != NULL)
-               *endptr = (wchar_t *)nptr + (end - buf);
+               *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
 
-       free(buf);
+       _simple_sfree(b);
 
        return (val);
 }
+
+long double
+wcstold(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
+{
+       return wcstold_l(nptr, endptr, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstold.c.patch b/locale/FreeBSD/wcstold.c.patch
deleted file mode 100644 (file)
index 36fee1e..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
---- wcstold.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcstold.c  2009-11-09 15:05:26.000000000 -0800
-@@ -27,44 +27,67 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <wchar.h>
- #include <wctype.h>
-+#include <_simple.h>
- /*
-  * See wcstod() for comments as to the logic used.
-  */
-+
-+extern size_t __wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc);
-+
- long double
--wcstold(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-+wcstold_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       long double val;
-       char *buf, *end;
--      const wchar_t *wcp;
-       size_t len;
-+      locale_t ctype;
-+      _SIMPLE_STRING b;
-+      char mb[MB_CUR_MAX + 1];
-+      const wchar_t *nptr0 = nptr;
-+      const wchar_t *first;
--      while (iswspace(*nptr))
-+      NORMALIZE_LOCALE(loc);
-+      ctype = __numeric_ctype(loc);
-+
-+      while (iswspace_l(*nptr, ctype))
-               nptr++;
--      wcp = nptr;
--      mbs = initial;
--      if ((len = wcsrtombs(NULL, &wcp, 0, &mbs)) == (size_t)-1) {
--              if (endptr != NULL)
--                      *endptr = (wchar_t *)nptr;
--              return (0.0);
--      }
--      if ((buf = malloc(len + 1)) == NULL)
-+      if ((b = _simple_salloc()) == NULL)
-               return (0.0);
-+
-+      first = nptr;
-       mbs = initial;
--      wcsrtombs(buf, &wcp, len + 1, &mbs);
-+      while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
-+              mb[len] = 0;
-+              if (_simple_sappend(b, mb) < 0) { /* no memory */
-+                      _simple_sfree(b);
-+                      return (0.0);
-+              }
-+              nptr++;
-+      }
--      val = strtold(buf, &end);
-+      buf = _simple_string(b);
-+      val = strtold_l(buf, &end, loc);
-       if (endptr != NULL)
--              *endptr = (wchar_t *)nptr + (end - buf);
-+              *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
--      free(buf);
-+      _simple_sfree(b);
-       return (val);
- }
-+
-+long double
-+wcstold(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-+{
-+      return wcstold_l(nptr, endptr, __current_locale());
-+}
index 9a019ff85c3e6b7502b44f68c616b9e501957964..af50ca8a6f5b33498fff3a88d3b5c0a773de2d45 100644 (file)
@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.19 2002/09/06 11:23:59 tjr
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoll.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -46,7 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoll.c,v 1.2 2007/01/09 00:28:01 imp
  * Convert a wide character string to a long long integer.
  */
 long long
-wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
+wcstoll_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base, locale_t loc)
 {
        const wchar_t *s;
        unsigned long long acc;
@@ -54,13 +57,14 @@ wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
        unsigned long long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtoll for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (iswspace(c));
+       } while (iswspace_l(c, loc));
        if (c == L'-') {
                neg = 1;
                c = *s++;
@@ -87,8 +91,8 @@ wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
        cutoff /= base;
        for ( ; ; c = *s++) {
 #ifdef notyet
-               if (iswdigit(c))
-                       c = digittoint(c);
+               if (iswdigit_l(c, loc))
+                       c = digittoint_l(c, loc);
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -121,3 +125,9 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+long long
+wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
+{
+       return wcstoll_l(nptr, endptr, base, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstoll.c.patch b/locale/FreeBSD/wcstoll.c.patch
deleted file mode 100644 (file)
index 867219a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
---- wcstoll.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcstoll.c  2009-11-09 15:05:26.000000000 -0800
-@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/s
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoll.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <stdlib.h>
-@@ -46,7 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * Convert a wide character string to a long long integer.
-  */
- long long
--wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-+wcstoll_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base, locale_t loc)
- {
-       const wchar_t *s;
-       unsigned long long acc;
-@@ -54,13 +57,14 @@ wcstoll(const wchar_t * __restrict nptr,
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoll for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (iswspace(c));
-+      } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-@@ -87,8 +91,8 @@ wcstoll(const wchar_t * __restrict nptr,
-       cutoff /= base;
-       for ( ; ; c = *s++) {
- #ifdef notyet
--              if (iswdigit(c))
--                      c = digittoint(c);
-+              if (iswdigit_l(c, loc))
-+                      c = digittoint_l(c, loc);
-               else
- #endif
-               if (c >= L'0' && c <= L'9')
-@@ -121,3 +125,9 @@ noconv:
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+long long
-+wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-+{
-+      return wcstoll_l(nptr, endptr, base, __current_locale());
-+}
index 2ef8f279d5ff546984e10ec325d9d47a2e7def35..24c4b61f96f4f7ccfaedd415511591b6afecb622 100644 (file)
@@ -37,7 +37,8 @@
 .Dt WCSTOMBS 3
 .Os
 .Sh NAME
-.Nm wcstombs
+.Nm wcstombs ,
+.Nm wcstombs_l
 .Nd convert a wide-character string to a character string
 .Sh LIBRARY
 .Lb libc
 .In stdlib.h
 .Ft size_t
 .Fo wcstombs
-.Fa "char * restrict mbstring" "const wchar_t * restrict wcstring"
-.Fa "size_t nbytes"
+.Fa "char *restrict s"
+.Fa "const wchar_t *restrict pwcs"
+.Fa "size_t n"
+.Fc
+.In stdlib.h
+.In xlocale.h
+.Ft size_t
+.Fo wcstombs_l
+.Fa "char *restrict s"
+.Fa "const wchar_t *restrict pwcs"
+.Fa "size_t n"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn wcstombs
 function converts a wide character string
-.Fa wcstring
+.Fa pwcs
 into a multibyte character string,
-.Fa mbstring ,
+.Fa s ,
 beginning in the initial conversion state.
 Up to
-.Fa nbytes
+.Fa n
 bytes are stored in
-.Fa mbstring .
+.Fa s .
 Partial multibyte characters at the end of the string are not stored.
-The multibyte character string is null terminated if there is room.
+The multibyte character string is null terminated, if there is room.
+.Pp
+Although the
+.Fn wcstombs
+function uses the current locale, the
+.Fn wcstombs_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn wcstombs
 function returns the number of bytes converted
-(not including any terminating null), if successful, otherwise it returns
+(not including any terminating null), if successful;
+otherwise, it returns
 .Po Vt size_t Pc Ns \-1 .
 .Sh ERRORS
 The
@@ -82,7 +102,8 @@ The conversion state is invalid.
 .Xr mbstowcs 3 ,
 .Xr multibyte 3 ,
 .Xr wcsrtombs 3 ,
-.Xr wctomb 3
+.Xr wctomb 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcstombs
diff --git a/locale/FreeBSD/wcstombs.3.patch b/locale/FreeBSD/wcstombs.3.patch
deleted file mode 100644 (file)
index 3a606bb..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
---- wcstombs.3.orig    2009-11-09 15:05:25.000000000 -0800
-+++ wcstombs.3 2009-11-09 15:05:26.000000000 -0800
-@@ -37,7 +37,8 @@
- .Dt WCSTOMBS 3
- .Os
- .Sh NAME
--.Nm wcstombs
-+.Nm wcstombs ,
-+.Nm wcstombs_l
- .Nd convert a wide-character string to a character string
- .Sh LIBRARY
- .Lb libc
-@@ -45,28 +46,47 @@
- .In stdlib.h
- .Ft size_t
- .Fo wcstombs
--.Fa "char * restrict mbstring" "const wchar_t * restrict wcstring"
--.Fa "size_t nbytes"
-+.Fa "char *restrict s"
-+.Fa "const wchar_t *restrict pwcs"
-+.Fa "size_t n"
-+.Fc
-+.In stdlib.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo wcstombs_l
-+.Fa "char *restrict s"
-+.Fa "const wchar_t *restrict pwcs"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn wcstombs
- function converts a wide character string
--.Fa wcstring
-+.Fa pwcs
- into a multibyte character string,
--.Fa mbstring ,
-+.Fa s ,
- beginning in the initial conversion state.
- Up to
--.Fa nbytes
-+.Fa n
- bytes are stored in
--.Fa mbstring .
-+.Fa s .
- Partial multibyte characters at the end of the string are not stored.
--The multibyte character string is null terminated if there is room.
-+The multibyte character string is null terminated, if there is room.
-+.Pp
-+Although the
-+.Fn wcstombs
-+function uses the current locale, the
-+.Fn wcstombs_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn wcstombs
- function returns the number of bytes converted
--(not including any terminating null), if successful, otherwise it returns
-+(not including any terminating null), if successful;
-+otherwise, it returns
- .Po Vt size_t Pc Ns \-1 .
- .Sh ERRORS
- The
-@@ -82,7 +102,8 @@ The conversion state is invalid.
- .Xr mbstowcs 3 ,
- .Xr multibyte 3 ,
- .Xr wcsrtombs 3 ,
--.Xr wctomb 3
-+.Xr wctomb 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcstombs
index c7d5b67a739a2a85b409f7e62972210616b5e064..a6d9ae3828d8260f4379a8d3bedd43f532ba89bb 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.11 2009/01/15 18:53:52 rdivacky Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 size_t
-wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
+wcstombs_l(char * __restrict s, const wchar_t * __restrict pwcs, size_t n,
+    locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
        const wchar_t *pwcsp;
 
+       NORMALIZE_LOCALE(loc);
        mbs = initial;
        pwcsp = pwcs;
-       return (__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs));
+       return (loc->__lc_ctype->__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs, loc));
+}
+
+size_t
+wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
+{
+       return wcstombs_l(s, pwcs, n, __current_locale());
 }
diff --git a/locale/FreeBSD/wcstombs.c.patch b/locale/FreeBSD/wcstombs.c.patch
deleted file mode 100644 (file)
index 749f439..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- wcstombs.c.bsdnew  2009-11-09 15:05:25.000000000 -0800
-+++ wcstombs.c 2009-11-09 17:49:26.000000000 -0800
-@@ -27,19 +27,29 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.11 2009/01/15 18:53:52 rdivacky Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdlib.h>
- #include <wchar.h>
- #include "mblocal.h"
- size_t
--wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
-+wcstombs_l(char * __restrict s, const wchar_t * __restrict pwcs, size_t n,
-+    locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       const wchar_t *pwcsp;
-+      NORMALIZE_LOCALE(loc);
-       mbs = initial;
-       pwcsp = pwcs;
--      return (__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs));
-+      return (loc->__lc_ctype->__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs, loc));
-+}
-+
-+size_t
-+wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
-+{
-+      return wcstombs_l(s, pwcs, n, __current_locale());
- }
index 5a5d6430fbf5694612b5210a997c85df0402f84c..1cad0f6213ccc822c2878671cfcd5fc1be8e26c4 100644 (file)
@@ -30,6 +30,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
@@ -40,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp
  * Convert a wide character string to an unsigned long integer.
  */
 unsigned long
-wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
+wcstoul_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base, locale_t loc)
 {
        const wchar_t *s;
        unsigned long acc;
@@ -48,13 +51,14 @@ wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
        unsigned long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtol for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (iswspace(c));
+       } while (iswspace_l(c, loc));
        if (c == L'-') {
                neg = 1;
                c = *s++;
@@ -79,8 +83,8 @@ wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
        cutlim = ULONG_MAX % base;
        for ( ; ; c = *s++) {
 #ifdef notyet
-               if (iswdigit(c))
-                       c = digittoint(c);
+               if (iswdigit_l(c, loc))
+                       c = digittoint_l(c, loc);
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -113,3 +117,9 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+unsigned long
+wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
+{
+       return wcstoul_l(nptr, endptr, base, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstoul.c.patch b/locale/FreeBSD/wcstoul.c.patch
deleted file mode 100644 (file)
index 44bbe1d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
---- wcstoul.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcstoul.c  2009-11-09 15:05:26.000000000 -0800
-@@ -30,6 +30,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <errno.h>
- #include <limits.h>
-@@ -40,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * Convert a wide character string to an unsigned long integer.
-  */
- unsigned long
--wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-+wcstoul_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base, locale_t loc)
- {
-       const wchar_t *s;
-       unsigned long acc;
-@@ -48,13 +51,14 @@ wcstoul(const wchar_t * __restrict nptr,
-       unsigned long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (iswspace(c));
-+      } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-@@ -79,8 +83,8 @@ wcstoul(const wchar_t * __restrict nptr,
-       cutlim = ULONG_MAX % base;
-       for ( ; ; c = *s++) {
- #ifdef notyet
--              if (iswdigit(c))
--                      c = digittoint(c);
-+              if (iswdigit_l(c, loc))
-+                      c = digittoint_l(c, loc);
-               else
- #endif
-               if (c >= L'0' && c <= L'9')
-@@ -113,3 +117,9 @@ noconv:
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+unsigned long
-+wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-+{
-+      return wcstoul_l(nptr, endptr, base, __current_locale());
-+}
index 9700cde47d8b9fbca12f5b79ee118798c77071ec..474480e455ce88ebf5ff17c55c04026685fd5dc9 100644 (file)
@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.2 2007/01/09 00:28:01 imp
  * Convert a wide character string to an unsigned long long integer.
  */
 unsigned long long
-wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base)
+wcstoull_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base, locale_t loc)
 {
        const wchar_t *s;
        unsigned long long acc;
@@ -55,13 +57,14 @@ wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        unsigned long long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtoull for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (iswspace(c));
+       } while (iswspace_l(c, loc));
        if (c == L'-') {
                neg = 1;
                c = *s++;
@@ -86,8 +89,8 @@ wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        cutlim = ULLONG_MAX % base;
        for ( ; ; c = *s++) {
 #ifdef notyet
-               if (iswdigit(c))
-                       c = digittoint(c);
+               if (iswdigit_l(c, loc))
+                       c = digittoint_l(c, loc);
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -120,3 +123,10 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+unsigned long long
+wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base)
+{
+       return wcstoull_l(nptr, endptr, base, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstoull.c.patch b/locale/FreeBSD/wcstoull.c.patch
deleted file mode 100644 (file)
index 5ec05f8..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- wcstoull.c.orig    2009-11-09 15:05:25.000000000 -0800
-+++ wcstoull.c 2009-11-09 15:05:26.000000000 -0800
-@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/s
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <limits.h>
- #include <stdlib.h>
-@@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * Convert a wide character string to an unsigned long long integer.
-  */
- unsigned long long
--wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
--    int base)
-+wcstoull_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base, locale_t loc)
- {
-       const wchar_t *s;
-       unsigned long long acc;
-@@ -55,13 +57,14 @@ wcstoull(const wchar_t * __restrict nptr
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoull for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (iswspace(c));
-+      } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-@@ -86,8 +89,8 @@ wcstoull(const wchar_t * __restrict nptr
-       cutlim = ULLONG_MAX % base;
-       for ( ; ; c = *s++) {
- #ifdef notyet
--              if (iswdigit(c))
--                      c = digittoint(c);
-+              if (iswdigit_l(c, loc))
-+                      c = digittoint_l(c, loc);
-               else
- #endif
-               if (c >= L'0' && c <= L'9')
-@@ -120,3 +123,10 @@ noconv:
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+unsigned long long
-+wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base)
-+{
-+      return wcstoull_l(nptr, endptr, base, __current_locale());
-+}
index 765bbfb274d9d9c97cc702d6b2f8e31c77ca5778..1b447b8e7076779c3b0d080b91cc30240e370ca5 100644 (file)
@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <inttypes.h>
 #include <stdlib.h>
@@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.c,v 1.2 2007/01/09 00:28:01 im
  * Convert a wide character string to a uintmax_t integer.
  */
 uintmax_t
-wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base)
+wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base, locale_t loc)
 {
        const wchar_t *s;
        uintmax_t acc;
@@ -55,13 +57,14 @@ wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        uintmax_t cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtoimax for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (iswspace(c));
+       } while (iswspace_l(c, loc));
        if (c == L'-') {
                neg = 1;
                c = *s++;
@@ -86,8 +89,8 @@ wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
        cutlim = UINTMAX_MAX % base;
        for ( ; ; c = *s++) {
 #ifdef notyet
-               if (iswdigit(c))
-                       c = digittoint(c);
+               if (iswdigit_l(c, loc))
+                       c = digittoint_l(c, loc);
                else
 #endif
                if (c >= L'0' && c <= L'9')
@@ -120,3 +123,10 @@ noconv:
                *endptr = (wchar_t *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+uintmax_t
+wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
+    int base)
+{
+       return wcstoumax_l(nptr, endptr, base, __current_locale());
+}
diff --git a/locale/FreeBSD/wcstoumax.c.patch b/locale/FreeBSD/wcstoumax.c.patch
deleted file mode 100644 (file)
index d79d57c..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- wcstoumax.c.orig   2009-11-09 15:05:25.000000000 -0800
-+++ wcstoumax.c        2009-11-09 15:05:26.000000000 -0800
-@@ -36,6 +36,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdlib/s
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <inttypes.h>
- #include <stdlib.h>
-@@ -46,8 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
-  * Convert a wide character string to a uintmax_t integer.
-  */
- uintmax_t
--wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
--    int base)
-+wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base, locale_t loc)
- {
-       const wchar_t *s;
-       uintmax_t acc;
-@@ -55,13 +57,14 @@ wcstoumax(const wchar_t * __restrict npt
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoimax for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (iswspace(c));
-+      } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-@@ -86,8 +89,8 @@ wcstoumax(const wchar_t * __restrict npt
-       cutlim = UINTMAX_MAX % base;
-       for ( ; ; c = *s++) {
- #ifdef notyet
--              if (iswdigit(c))
--                      c = digittoint(c);
-+              if (iswdigit_l(c, loc))
-+                      c = digittoint_l(c, loc);
-               else
- #endif
-               if (c >= L'0' && c <= L'9')
-@@ -120,3 +123,10 @@ noconv:
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+uintmax_t
-+wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-+    int base)
-+{
-+      return wcstoumax_l(nptr, endptr, base, __current_locale());
-+}
index a8f00560b0d3d1ffa81c479e85a386a9e49d728a..130d00d636c505c38fc2046a3d3fe0609d994b5c 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdio.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 int
-wctob(wint_t c)
+wctob_l(wint_t c, locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs = initial;
        char buf[MB_LEN_MAX];
 
-       if (c == WEOF || __wcrtomb(buf, c, &mbs) != 1)
+       NORMALIZE_LOCALE(loc);
+       if (c == WEOF || loc->__lc_ctype->__wcrtomb(buf, c, &mbs, loc) != 1)
                return (EOF);
        return ((unsigned char)*buf);
 }
+
+int
+wctob(wint_t c)
+{
+       return wctob_l(c, __current_locale());
+}
diff --git a/locale/FreeBSD/wctob.c.patch b/locale/FreeBSD/wctob.c.patch
deleted file mode 100644 (file)
index 485409f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---- wctob.c.orig       2009-11-09 15:05:25.000000000 -0800
-+++ wctob.c    2009-11-09 15:05:26.000000000 -0800
-@@ -27,19 +27,28 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdio.h>
- #include <wchar.h>
- #include "mblocal.h"
- int
--wctob(wint_t c)
-+wctob_l(wint_t c, locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs = initial;
-       char buf[MB_LEN_MAX];
--      if (c == WEOF || __wcrtomb(buf, c, &mbs) != 1)
-+      NORMALIZE_LOCALE(loc);
-+      if (c == WEOF || loc->__lc_ctype->__wcrtomb(buf, c, &mbs, loc) != 1)
-               return (EOF);
-       return ((unsigned char)*buf);
- }
-+
-+int
-+wctob(wint_t c)
-+{
-+      return wctob_l(c, __current_locale());
-+}
index 1ecc8764cc2e300bba486544a881d99f6f850cf8..33f6e37798adf7963c3e96618d2bba7f7cfcd6d8 100644 (file)
 .Dt WCTOMB 3
 .Os
 .Sh NAME
-.Nm wctomb
+.Nm wctomb ,
+.Nm wctomb_l
 .Nd convert a wide-character code to a character
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn wctomb "char *mbchar" "wchar_t wchar"
+.Fo wctomb
+.Fa "char *s"
+.Fa "wchar_t wchar"
+.Fc
+.In stdlib.h
+.In xlocale.h
+.Ft int
+.Fo wctomb_l
+.Fa "char *s"
+.Fa "wchar_t wchar"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wctomb
-function converts a wide character
-.Fa wchar
-into a multibyte character and stores
-the result in
-.Fa mbchar .
+function converts a wide character,
+.Fa wchar ,
+into a multibyte character and stores the result in
+.Fa s .
 The object pointed to by
-.Fa mbchar
-must be large enough to accommodate the multibyte character, which
-may be up to
+.Fa s
+must be large enough to accommodate the multibyte character,
+which may be up to
 .Dv MB_LEN_MAX
 bytes.
 .Pp
 A call with a null
-.Fa mbchar
+.Fa s
 pointer returns nonzero if the current locale requires shift states,
 zero otherwise;
 if shift states are required, the shift state is reset to the initial state.
+.Pp
+Although the
+.Fn wctomb
+function uses the current locale, the
+.Fn wctomb_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If
-.Fa mbchar
+.Fa s
 is
 .Dv NULL ,
 the
@@ -75,12 +94,12 @@ the
 function returns nonzero if shift states are supported,
 zero otherwise.
 If
-.Fa mbchar
+.Fa s
 is valid,
 .Fn wctomb
 returns
 the number of bytes processed in
-.Fa mbchar ,
+.Fa s ,
 or \-1 if no multibyte character
 could be recognized or converted.
 In this case,
@@ -100,7 +119,8 @@ The internal conversion state is invalid.
 .Xr mbtowc 3 ,
 .Xr wcrtomb 3 ,
 .Xr wcstombs 3 ,
-.Xr wctob 3
+.Xr wctob 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wctomb
diff --git a/locale/FreeBSD/wctomb.3.patch b/locale/FreeBSD/wctomb.3.patch
deleted file mode 100644 (file)
index e35da9f..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
---- wctomb.3.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wctomb.3   2009-11-09 15:05:26.000000000 -0800
-@@ -37,37 +37,56 @@
- .Dt WCTOMB 3
- .Os
- .Sh NAME
--.Nm wctomb
-+.Nm wctomb ,
-+.Nm wctomb_l
- .Nd convert a wide-character code to a character
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft int
--.Fn wctomb "char *mbchar" "wchar_t wchar"
-+.Fo wctomb
-+.Fa "char *s"
-+.Fa "wchar_t wchar"
-+.Fc
-+.In stdlib.h
-+.In xlocale.h
-+.Ft int
-+.Fo wctomb_l
-+.Fa "char *s"
-+.Fa "wchar_t wchar"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wctomb
--function converts a wide character
--.Fa wchar
--into a multibyte character and stores
--the result in
--.Fa mbchar .
-+function converts a wide character,
-+.Fa wchar ,
-+into a multibyte character and stores the result in
-+.Fa s .
- The object pointed to by
--.Fa mbchar
--must be large enough to accommodate the multibyte character, which
--may be up to
-+.Fa s
-+must be large enough to accommodate the multibyte character,
-+which may be up to
- .Dv MB_LEN_MAX
- bytes.
- .Pp
- A call with a null
--.Fa mbchar
-+.Fa s
- pointer returns nonzero if the current locale requires shift states,
- zero otherwise;
- if shift states are required, the shift state is reset to the initial state.
-+.Pp
-+Although the
-+.Fn wctomb
-+function uses the current locale, the
-+.Fn wctomb_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If
--.Fa mbchar
-+.Fa s
- is
- .Dv NULL ,
- the
-@@ -75,12 +94,12 @@ the
- function returns nonzero if shift states are supported,
- zero otherwise.
- If
--.Fa mbchar
-+.Fa s
- is valid,
- .Fn wctomb
- returns
- the number of bytes processed in
--.Fa mbchar ,
-+.Fa s ,
- or \-1 if no multibyte character
- could be recognized or converted.
- In this case,
-@@ -100,7 +119,8 @@ The internal conversion state is invalid
- .Xr mbtowc 3 ,
- .Xr wcrtomb 3 ,
- .Xr wcstombs 3 ,
--.Xr wctob 3
-+.Xr wctob 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wctomb
index 701b3ca4cc61f1cb53fb43484c4fed98e26080b5..0df7799a18c5317992155319a06a23b36c1556e4 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <wchar.h>
 #include "mblocal.h"
 
 int
-wctomb(char *s, wchar_t wchar)
+wctomb_l(char *s, wchar_t wchar, locale_t loc)
 {
        static const mbstate_t initial;
-       static mbstate_t mbs;
        size_t rval;
 
+       NORMALIZE_LOCALE(loc);
        if (s == NULL) {
                /* No support for state dependent encodings. */
-               mbs = initial;
+               loc->__mbs_wctomb = initial;
                return (0);
        }
-       if ((rval = __wcrtomb(s, wchar, &mbs)) == (size_t)-1)
+       if ((rval = loc->__lc_ctype->__wcrtomb(s, wchar, &loc->__mbs_wctomb, loc)) == (size_t)-1)
                return (-1);
        return ((int)rval);
 }
+
+int
+wctomb(char *s, wchar_t wchar)
+{
+       return wctomb_l(s, wchar, __current_locale());
+}
diff --git a/locale/FreeBSD/wctomb.c.patch b/locale/FreeBSD/wctomb.c.patch
deleted file mode 100644 (file)
index 425812b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
---- wctomb.c.orig      2009-11-09 15:05:25.000000000 -0800
-+++ wctomb.c   2009-11-09 15:05:26.000000000 -0800
-@@ -27,23 +27,31 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <wchar.h>
- #include "mblocal.h"
- int
--wctomb(char *s, wchar_t wchar)
-+wctomb_l(char *s, wchar_t wchar, locale_t loc)
- {
-       static const mbstate_t initial;
--      static mbstate_t mbs;
-       size_t rval;
-+      NORMALIZE_LOCALE(loc);
-       if (s == NULL) {
-               /* No support for state dependent encodings. */
--              mbs = initial;
-+              loc->__mbs_wctomb = initial;
-               return (0);
-       }
--      if ((rval = __wcrtomb(s, wchar, &mbs)) == (size_t)-1)
-+      if ((rval = loc->__lc_ctype->__wcrtomb(s, wchar, &loc->__mbs_wctomb, loc)) == (size_t)-1)
-               return (-1);
-       return ((int)rval);
- }
-+
-+int
-+wctomb(char *s, wchar_t wchar)
-+{
-+      return wctomb_l(s, wchar, __current_locale());
-+}
index 0f2bc650b9c7fdcca55beb5a355feb2f846dfd36..7cb0da62a61c91d9bae8b6e1839831f84963246c 100644 (file)
 .Dt WCTRANS 3
 .Os
 .Sh NAME
-.Nm towctrans , wctrans
+.Nm towctrans ,
+.Nm towctrans_l ,
+.Nm wctrans ,
+.Nm wctrans_l
 .Nd "wide character mapping functions"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wctype.h
 .Ft wint_t
-.Fn towctrans "wint_t wc" "wctrans_t desc"
+.Fo towctrans
+.Fa "wint_t wc"
+.Fa "wctrans_t desc"
+.Fc
 .Ft wctrans_t
-.Fn wctrans "const char *charclass"
+.Fo wctrans
+.Fa "const char *charclass"
+.Fc
+.In wctype.h
+.In xlocale.h
+.Ft wint_t
+.Fo towctrans_l
+.Fa "wint_t wc"
+.Fa "wctrans_t desc"
+.Fa "locale_t loc"
+.Fc
+.Ft wctrans_t
+.Fo wctrans_l
+.Fa "const char *charclass"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wctrans
 function returns a value of type
-.Vt wctrans_t
+.Vt wctrans_t ,
 which represents the requested wide character mapping operation and
 may be used as the second argument for calls to
 .Fn towctrans .
@@ -55,9 +76,21 @@ The following character mapping names are recognised:
 The
 .Fn towctrans
 function transliterates the wide character
-.Fa wc
+.Fa wc ,
 according to the mapping described by
 .Fa desc .
+.Pp
+While the
+.Fn towctrans
+and
+.Fn wctrans
+functions use the current locale, the
+.Fn towctrans_l
+and
+.Fn wctrans_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn towctrans
@@ -105,7 +138,8 @@ The requested mapping name is invalid.
 .Sh SEE ALSO
 .Xr tolower 3 ,
 .Xr toupper 3 ,
-.Xr wctype 3
+.Xr wctype 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn towctrans
diff --git a/locale/FreeBSD/wctrans.3.patch b/locale/FreeBSD/wctrans.3.patch
deleted file mode 100644 (file)
index b294abb..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
---- wctrans.3.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wctrans.3  2009-11-09 15:05:26.000000000 -0800
-@@ -28,21 +28,42 @@
- .Dt WCTRANS 3
- .Os
- .Sh NAME
--.Nm towctrans , wctrans
-+.Nm towctrans ,
-+.Nm towctrans_l ,
-+.Nm wctrans ,
-+.Nm wctrans_l
- .Nd "wide character mapping functions"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wctype.h
- .Ft wint_t
--.Fn towctrans "wint_t wc" "wctrans_t desc"
-+.Fo towctrans
-+.Fa "wint_t wc"
-+.Fa "wctrans_t desc"
-+.Fc
- .Ft wctrans_t
--.Fn wctrans "const char *charclass"
-+.Fo wctrans
-+.Fa "const char *charclass"
-+.Fc
-+.In wctype.h
-+.In xlocale.h
-+.Ft wint_t
-+.Fo towctrans_l
-+.Fa "wint_t wc"
-+.Fa "wctrans_t desc"
-+.Fa "locale_t loc"
-+.Fc
-+.Ft wctrans_t
-+.Fo wctrans_l
-+.Fa "const char *charclass"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wctrans
- function returns a value of type
--.Vt wctrans_t
-+.Vt wctrans_t ,
- which represents the requested wide character mapping operation and
- may be used as the second argument for calls to
- .Fn towctrans .
-@@ -55,9 +76,21 @@ The following character mapping names ar
- The
- .Fn towctrans
- function transliterates the wide character
--.Fa wc
-+.Fa wc ,
- according to the mapping described by
- .Fa desc .
-+.Pp
-+While the
-+.Fn towctrans
-+and
-+.Fn wctrans
-+functions use the current locale, the
-+.Fn towctrans_l
-+and
-+.Fn wctrans_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn towctrans
-@@ -105,7 +138,8 @@ The requested mapping name is invalid.
- .Sh SEE ALSO
- .Xr tolower 3 ,
- .Xr toupper 3 ,
--.Xr wctype 3
-+.Xr wctype 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn towctrans
index a86e5c782987ee05352484f06d30ddfb9c9ed340..30ca5b9546f6dbf4f0f59f1d7edc4890e31fe9b0 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <string.h>
 #include <wctype.h>
@@ -38,15 +40,16 @@ enum {
 };
 
 wint_t
-towctrans(wint_t wc, wctrans_t desc)
+towctrans_l(wint_t wc, wctrans_t desc, locale_t loc)
 {
 
+       NORMALIZE_LOCALE(loc);
        switch (desc) {
        case _WCT_TOLOWER:
-               wc = towlower(wc);
+               wc = towlower_l(wc, loc);
                break;
        case _WCT_TOUPPER:
-               wc = towupper(wc);
+               wc = towupper_l(wc, loc);
                break;
        case _WCT_ERROR:
        default:
@@ -57,6 +60,12 @@ towctrans(wint_t wc, wctrans_t desc)
        return (wc);
 }
 
+wint_t
+towctrans(wint_t wc, wctrans_t desc)
+{
+       return towctrans_l(wc, desc, __current_locale());
+}
+
 wctrans_t
 wctrans(const char *charclass)
 {
@@ -78,3 +87,14 @@ wctrans(const char *charclass)
                errno = EINVAL;
        return (ccls[i].trans);
 }
+
+/*
+ * The extended locale version just calls the regular version.  If there
+ * is ever support for arbitrary per-locale translations, this need to
+ * be modified.
+ */
+wctrans_t
+wctrans_l(const char *charclass, locale_t loc)
+{
+       return wctrans(charclass);
+}
diff --git a/locale/FreeBSD/wctrans.c.patch b/locale/FreeBSD/wctrans.c.patch
deleted file mode 100644 (file)
index 90808c4..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
---- wctrans.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wctrans.c  2009-11-09 15:05:26.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <string.h>
- #include <wctype.h>
-@@ -38,15 +40,16 @@ enum {
- };
- wint_t
--towctrans(wint_t wc, wctrans_t desc)
-+towctrans_l(wint_t wc, wctrans_t desc, locale_t loc)
- {
-+      NORMALIZE_LOCALE(loc);
-       switch (desc) {
-       case _WCT_TOLOWER:
--              wc = towlower(wc);
-+              wc = towlower_l(wc, loc);
-               break;
-       case _WCT_TOUPPER:
--              wc = towupper(wc);
-+              wc = towupper_l(wc, loc);
-               break;
-       case _WCT_ERROR:
-       default:
-@@ -57,6 +60,12 @@ towctrans(wint_t wc, wctrans_t desc)
-       return (wc);
- }
-+wint_t
-+towctrans(wint_t wc, wctrans_t desc)
-+{
-+      return towctrans_l(wc, desc, __current_locale());
-+}
-+
- wctrans_t
- wctrans(const char *charclass)
- {
-@@ -78,3 +87,14 @@ wctrans(const char *charclass)
-               errno = EINVAL;
-       return (ccls[i].trans);
- }
-+
-+/*
-+ * The extended locale version just calls the regular version.  If there
-+ * is ever support for arbitrary per-locale translations, this need to
-+ * be modified.
-+ */
-+wctrans_t
-+wctrans_l(const char *charclass, locale_t loc)
-+{
-+      return wctrans(charclass);
-+}
index 16c3de938bf16048e2620b2708826381bc538250..517597291278a787850b8862ed965231dc212c0d 100644 (file)
 .Dt WCTYPE 3
 .Os
 .Sh NAME
-.Nm iswctype , wctype
+.Nm iswctype ,
+.Nm iswctype_l ,
+.Nm wctype ,
+.Nm wctype_l
 .Nd "wide character class functions"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wctype.h
 .Ft int
-.Fn iswctype "wint_t wc" "wctype_t charclass"
+.Fo iswctype
+.Fa "wint_t wc"
+.Fa "wctype_t charclass"
+.Fc
 .Ft wctype_t
-.Fn wctype "const char *property"
+.Fo wctype
+.Fa "const char *property"
+.Fc
+.In wctype.h
+.In xlocale.h
+.Ft int
+.Fo iswctype_l
+.Fa "wint_t wc"
+.Fa "wctype_t charclass"
+.Fa "locale_t loc"
+.Fc
+.Ft wctype_t
+.Fo wctype_l
+.Fa "const char *property"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wctype
 function returns a value of type
-.Vt wctype_t
+.Vt wctype_t ,
 which represents the requested wide character class and
 may be used as the second argument for calls to
 .Fn iswctype .
@@ -60,6 +81,18 @@ function checks whether the wide character
 .Fa wc
 is in the character class
 .Fa charclass .
+.Pp
+Although the
+.Fn iswctype
+and
+.Fn wctype
+functions use the current locale, the
+.Fn iswctype_l
+and
+.Fn wctype_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn iswctype
@@ -75,7 +108,7 @@ The
 .Fn wctype
 function returns 0 if
 .Fa property
-is invalid, otherwise it returns a value of type
+is invalid; otherwise, it returns a value of type
 .Vt wctype_t
 that can be used in subsequent calls to
 .Fn iswctype .
@@ -95,7 +128,8 @@ myiswalpha(wint_t wc)
 .Ed
 .Sh SEE ALSO
 .Xr ctype 3 ,
-.Xr nextwctype 3
+.Xr nextwctype 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn iswctype
diff --git a/locale/FreeBSD/wctype.3.patch b/locale/FreeBSD/wctype.3.patch
deleted file mode 100644 (file)
index 07e69d2..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
---- wctype.3.bsdnew    2009-11-10 13:13:11.000000000 -0800
-+++ wctype.3   2009-11-10 14:11:00.000000000 -0800
-@@ -28,21 +28,42 @@
- .Dt WCTYPE 3
- .Os
- .Sh NAME
--.Nm iswctype , wctype
-+.Nm iswctype ,
-+.Nm iswctype_l ,
-+.Nm wctype ,
-+.Nm wctype_l
- .Nd "wide character class functions"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wctype.h
- .Ft int
--.Fn iswctype "wint_t wc" "wctype_t charclass"
-+.Fo iswctype
-+.Fa "wint_t wc"
-+.Fa "wctype_t charclass"
-+.Fc
- .Ft wctype_t
--.Fn wctype "const char *property"
-+.Fo wctype
-+.Fa "const char *property"
-+.Fc
-+.In wctype.h
-+.In xlocale.h
-+.Ft int
-+.Fo iswctype_l
-+.Fa "wint_t wc"
-+.Fa "wctype_t charclass"
-+.Fa "locale_t loc"
-+.Fc
-+.Ft wctype_t
-+.Fo wctype_l
-+.Fa "const char *property"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wctype
- function returns a value of type
--.Vt wctype_t
-+.Vt wctype_t ,
- which represents the requested wide character class and
- may be used as the second argument for calls to
- .Fn iswctype .
-@@ -60,6 +81,18 @@ function checks whether the wide charact
- .Fa wc
- is in the character class
- .Fa charclass .
-+.Pp
-+Although the
-+.Fn iswctype
-+and
-+.Fn wctype
-+functions use the current locale, the
-+.Fn iswctype_l
-+and
-+.Fn wctype_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn iswctype
-@@ -75,7 +108,7 @@ The
- .Fn wctype
- function returns 0 if
- .Fa property
--is invalid, otherwise it returns a value of type
-+is invalid; otherwise, it returns a value of type
- .Vt wctype_t
- that can be used in subsequent calls to
- .Fn iswctype .
-@@ -95,7 +128,8 @@ myiswalpha(wint_t wc)
- .Ed
- .Sh SEE ALSO
- .Xr ctype 3 ,
--.Xr nextwctype 3
-+.Xr nextwctype 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn iswctype
index 2db1c9bda1ef0470af87c0057cbc7d6a63c6a339..f94c1334f6606f3ada6cd0cab5a1f1250491df8a 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <string.h>
 #include <wctype.h>
-
-#undef iswctype
-int
-iswctype(wint_t wc, wctype_t charclass)
-{
-
-       return (__istype(wc, charclass));
-}
+#include <limits.h>
 
 wctype_t
-wctype(const char *property)
+wctype_l(const char *property, locale_t loc)
 {
+       _RuneLocale *rl;
        static const struct {
                const char      *name;
                wctype_t         mask;
@@ -70,5 +66,23 @@ wctype(const char *property)
        while (props[i].name != NULL && strcmp(props[i].name, property) != 0)
                i++;
 
-       return (props[i].mask);
+       if (props[i].mask)
+               return (props[i].mask);
+
+       NORMALIZE_LOCALE(loc);
+       rl = &loc->__lc_ctype->_CurrentRuneLocale;
+       if ((i = rl->__ncharclasses) > 0) {
+               _RuneCharClass *rp;
+               for (rp = rl->__charclasses; i-- > 0; rp++) {
+                       if (strncmp(rp->__name, property, CHARCLASS_NAME_MAX) == 0)
+                               return (rp->__mask);
+               }
+       }
+       return 0;
+}
+
+wctype_t
+wctype(const char *property)
+{
+       return wctype_l(property, __current_locale());
 }
diff --git a/locale/FreeBSD/wctype.c.patch b/locale/FreeBSD/wctype.c.patch
deleted file mode 100644 (file)
index f9c75ab..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
---- wctype.c.bsdnew    2009-11-09 15:05:25.000000000 -0800
-+++ wctype.c   2009-11-09 17:53:01.000000000 -0800
-@@ -27,21 +27,17 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <string.h>
- #include <wctype.h>
--
--#undef iswctype
--int
--iswctype(wint_t wc, wctype_t charclass)
--{
--
--      return (__istype(wc, charclass));
--}
-+#include <limits.h>
- wctype_t
--wctype(const char *property)
-+wctype_l(const char *property, locale_t loc)
- {
-+      _RuneLocale *rl;
-       static const struct {
-               const char      *name;
-               wctype_t         mask;
-@@ -70,5 +66,23 @@ wctype(const char *property)
-       while (props[i].name != NULL && strcmp(props[i].name, property) != 0)
-               i++;
--      return (props[i].mask);
-+      if (props[i].mask)
-+              return (props[i].mask);
-+
-+      NORMALIZE_LOCALE(loc);
-+      rl = &loc->__lc_ctype->_CurrentRuneLocale;
-+      if ((i = rl->__ncharclasses) > 0) {
-+              _RuneCharClass *rp;
-+              for (rp = rl->__charclasses; i-- > 0; rp++) {
-+                      if (strncmp(rp->__name, property, CHARCLASS_NAME_MAX) == 0)
-+                              return (rp->__mask);
-+              }
-+      }
-+      return 0;
-+}
-+
-+wctype_t
-+wctype(const char *property)
-+{
-+      return wctype_l(property, __current_locale());
- }
index 026813f2013850207488e60ee11123168913d66e..4c014cec65e655741a27a158e16b1887e87742d1 100644 (file)
 .Dt WCWIDTH 3
 .Os
 .Sh NAME
-.Nm wcwidth
+.Nm wcwidth ,
+.Nm wcwidth_l
 .Nd "number of column positions of a wide-character code"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft int
-.Fn wcwidth "wchar_t wc"
+.Fo wcwidth
+.Fa "wchar_t wc"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft int
+.Fo wcwidth_l
+.Fa "wchar_t wc"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcwidth
 function determines the number of column positions required to
 display the wide character
 .Fa wc .
+.Pp
+Although the
+.Fn wcwidth
+function uses the current locale, the
+.Fn wcwidth_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn wcwidth
@@ -50,8 +68,8 @@ function returns 0 if the
 argument is a null wide character (L'\e0'),
 \-1 if
 .Fa wc
-is not printable,
-otherwise it returns the number of column positions the
+is not printable;
+otherwise, it returns the number of column positions the
 character occupies.
 .Sh EXAMPLES
 This code fragment reads text from standard input and
@@ -79,7 +97,8 @@ while ((ch = getwchar()) != WEOF) {
 .Ed
 .Sh SEE ALSO
 .Xr iswprint 3 ,
-.Xr wcswidth 3
+.Xr wcswidth 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcwidth
diff --git a/locale/FreeBSD/wcwidth.3.patch b/locale/FreeBSD/wcwidth.3.patch
deleted file mode 100644 (file)
index bc9dfc2..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
---- wcwidth.3.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcwidth.3  2009-11-09 15:05:26.000000000 -0800
-@@ -28,20 +28,38 @@
- .Dt WCWIDTH 3
- .Os
- .Sh NAME
--.Nm wcwidth
-+.Nm wcwidth ,
-+.Nm wcwidth_l
- .Nd "number of column positions of a wide-character code"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft int
--.Fn wcwidth "wchar_t wc"
-+.Fo wcwidth
-+.Fa "wchar_t wc"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft int
-+.Fo wcwidth_l
-+.Fa "wchar_t wc"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcwidth
- function determines the number of column positions required to
- display the wide character
- .Fa wc .
-+.Pp
-+Although the
-+.Fn wcwidth
-+function uses the current locale, the
-+.Fn wcwidth_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn wcwidth
-@@ -50,8 +68,8 @@ function returns 0 if the
- argument is a null wide character (L'\e0'),
- \-1 if
- .Fa wc
--is not printable,
--otherwise it returns the number of column positions the
-+is not printable;
-+otherwise, it returns the number of column positions the
- character occupies.
- .Sh EXAMPLES
- This code fragment reads text from standard input and
-@@ -79,7 +97,8 @@ while ((ch = getwchar()) != WEOF) {
- .Ed
- .Sh SEE ALSO
- .Xr iswprint 3 ,
--.Xr wcswidth 3
-+.Xr wcswidth 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcwidth
index 587862eff8153000ee433a49f23bd6e7eca63590..ae533e7f4cdf76ef0bbe2d6d2166d2c1cd09b4de 100644 (file)
@@ -38,6 +38,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.8 2007/01/09 00:28:01 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 
 #undef wcwidth
@@ -46,5 +48,13 @@ int
 wcwidth(wchar_t wc)
 {
 
-       return (__wcwidth(wc));
+       return (__wcwidth_l(wc, __current_locale()));
+}
+
+int
+wcwidth_l(wchar_t wc, locale_t loc)
+{
+
+       NORMALIZE_LOCALE(loc);
+       return (__wcwidth_l(wc, loc));
 }
diff --git a/locale/FreeBSD/wcwidth.c.patch b/locale/FreeBSD/wcwidth.c.patch
deleted file mode 100644 (file)
index 4f5e296..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- wcwidth.c.orig     2009-11-09 15:05:25.000000000 -0800
-+++ wcwidth.c  2009-11-09 15:05:26.000000000 -0800
-@@ -38,6 +38,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.8 2007/01/09 00:28:01 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #undef wcwidth
-@@ -46,5 +48,13 @@ int
- wcwidth(wchar_t wc)
- {
--      return (__wcwidth(wc));
-+      return (__wcwidth_l(wc, __current_locale()));
-+}
-+
-+int
-+wcwidth_l(wchar_t wc, locale_t loc)
-+{
-+
-+      NORMALIZE_LOCALE(loc);
-+      return (__wcwidth_l(wc, loc));
- }
diff --git a/locale/Makefile.inc b/locale/Makefile.inc
deleted file mode 100644 (file)
index 56fcfd4..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-#      from @(#)Makefile.inc   8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/locale/Makefile.inc,v 1.43 2003/03/13 06:29:53 tjr Exp $
-
-# locale sources
-.PATH: ${.CURDIR}/${MACHINE_ARCH}/locale ${.CURDIR}/locale
-CWD := ${.CURDIR}/locale
-
-.ifdef FEATURE_LEGACY_RUNE_APIS
-# depreciated interfaces
-MISRCS += frune.c mbrune.c runedepreciated.c setinvalidrune.c
-
-.for _src in frune.c mbrune.c setinvalidrune.c
-CFLAGS-${_src} += -D__FBSDID=__RCSID
-.endfor
-.endif
-
-# extended locale
-MISRCS += isctype.c iswctype.c xlocale.c
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \
-       gb18030.c gb2312.c gbk.c \
-       ldpart.c lmessages.c lmonetary.c lnumeric.c localeconv.c \
-       mblen.c mbrlen.c mbrtowc.c mbsinit.c mbsnrtowcs.c mbsrtowcs.c \
-       mbstowcs.c mbtowc.c mskanji.c \
-       nextwctype.c nl_langinfo.c nomacros.c none.c \
-       rune.c runetype.c setlocale.c setrunelocale.c \
-       table.c tolower.c toupper.c utf8.c \
-       wcrtomb.c wcsftime.c wcsnrtombs.c wcsrtombs.c wcstod.c \
-       wcstof.c wcstoimax.c wcstol.c wcstold.c wcstoll.c wcstombs.c \
-       wcstoul.c wcstoull.c wcstoumax.c wctob.c wctomb.c wctrans.c \
-       wctype.c wcwidth.c
-FBSDHDRS= collate.h ldpart.h lmessages.h lmonetary.h lnumeric.h \
-       mblocal.h setlocale.h
-.include "Makefile.fbsd_end"
-
-.ifmake autopatch
-# special case: utf2-fbsd.c is derived from utf8.c with utf2.c.patch
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-AUTOPATCHSRCS+= ${_cwd}/utf2-fbsd.c
-${_cwd}/utf2-fbsd.c: ${_cwd}/FreeBSD/utf8.c
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${.ALLSRC:S/utf8/utf2/}.patch
-.endfor # _cwd
-
-.else # !autopatch
-MISRCS+= utf2.c
-.endif # autopatch
-
-# also build a 64-bit long double version (ppc only)
-LDBLSRCS += wcstold.c
-
-.ifdef FEATURE_PATCH_3333969
-MISRCS += lconv.c
-.endif # FEATURE_PATCH_3333969
-
-LEGACYSRCS += wcsftime.c
-
-CFLAGS-collate-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-setrunelocale-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-wcsftime-fbsd.c += -DLIBC_ALIAS_WCSFTIME -DLIBC_ALIAS_WCSFTIME_L
-
-# For LP64, we need to create rune32.h
-# This happens at installsrc time, not build time, so the compiler we need
-# is HOSTCC.
-.ifmake autopatch
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-# The following is good enough for ppc, ppc64, i386 and x86_64
-_ARCH != ${ARCH}
-.if $(_ARCH) == x86_64
-ARCH32 = i386
-.else
-ARCH32 = $(_ARCH:C/64$//)
-.endif
-${_cwd}/rune32.h: ${_cwd}/rune-fbsd.c
-       ${CP} ${.CURDIR}/include/runetype.h ${_cwd}
-       ${HOSTCC} -arch ${ARCH32} -D_LIBC_NO_FEATURE_VERIFICATION -DRUNEOFF32 -o ${_cwd}/rune32 ${.ALLSRC}
-       ${_cwd}/rune32 > ${.TARGET}
-       ${RM} ${_cwd}/rune32 ${_cwd}/runetype.h
-AUTOPATCHHDRS+= ${_cwd}/rune32.h
-.endfor # _cwd
-
-.endif # autopatch
-
-.if ${LIB} == "c"
-MAN3+= ctype_l.3 isalnum_l.3 iswalnum_l.3 wcstod_l.3 wcstol_l.3
-MAN3+= duplocale.3 freelocale.3 newlocale.3 \
-       querylocale.3 uselocale.3 xlocale.3
-.ifdef FEATURE_LEGACY_RUNE_APIS
-# depreciated man pages
-MAN3+= mbrune.3 rune.3
-.endif
-MAN5+= utf2.5
-
-.include "Makefile.fbsd_begin"
-FBSDMAN3= btowc.3 ctype.3 digittoint.3 \
-       isalnum.3 isalpha.3 isascii.3 isblank.3 iscntrl.3 isdigit.3 \
-       isgraph.3 isideogram.3 islower.3 isphonogram.3 isprint.3 \
-       ispunct.3 isrune.3 isspace.3 isspecial.3 isupper.3 \
-       iswalnum.3 isxdigit.3 \
-       localeconv.3 \
-       mblen.3 mbrlen.3 mbrtowc.3 mbsinit.3 mbsrtowcs.3 mbstowcs.3 \
-       mbtowc.3 multibyte.3 \
-       nextwctype.3 nl_langinfo.3 \
-       setlocale.3 toascii.3 tolower.3 toupper.3 towlower.3 towupper.3 \
-       wcrtomb.3 wcsftime.3 wcsrtombs.3 wcstod.3 wcstol.3 wcstombs.3 \
-       wctomb.3 wctrans.3 wctype.3 wcwidth.3
-FBSDMAN5= big5.5 euc.5 gb18030.5 gb2312.5 gbk.5 mskanji.5 utf8.5
-.include "Makefile.fbsd_end"
-
-MLINKS+= btowc.3 wctob.3
-
-MLINKS+= btowc.3 btowc_l.3             \
-         btowc.3 wctob_l.3
-
-MLINKS+= digittoint.3 digittoint_l.3
-
-MLINKS+= isdigit.3 isnumber.3
-
-MLINKS+= isalnum_l.3 isalpha_l.3       \
-         isalnum_l.3 isblank_l.3       \
-         isalnum_l.3 iscntrl_l.3       \
-         isalnum_l.3 isdigit_l.3       \
-         isalnum_l.3 isgraph_l.3       \
-         isalnum_l.3 ishexnumber_l.3   \
-         isalnum_l.3 isideogram_l.3    \
-         isalnum_l.3 islower_l.3       \
-         isalnum_l.3 isnumber_l.3      \
-         isalnum_l.3 isphonogram_l.3   \
-         isalnum_l.3 isprint_l.3       \
-         isalnum_l.3 ispunct_l.3       \
-         isalnum_l.3 isrune_l.3                \
-         isalnum_l.3 isspace_l.3       \
-         isalnum_l.3 isspecial_l.3     \
-         isalnum_l.3 isupper_l.3       \
-         isalnum_l.3 isxdigit_l.3
-
-MLINKS+= iswalnum.3 iswalpha.3         \
-         iswalnum.3 iswascii.3         \
-         iswalnum.3 iswblank.3         \
-         iswalnum.3 iswcntrl.3         \
-         iswalnum.3 iswdigit.3         \
-         iswalnum.3 iswgraph.3         \
-         iswalnum.3 iswhexnumber.3     \
-         iswalnum.3 iswideogram.3      \
-         iswalnum.3 iswlower.3         \
-         iswalnum.3 iswnumber.3                \
-         iswalnum.3 iswphonogram.3     \
-         iswalnum.3 iswprint.3         \
-         iswalnum.3 iswpunct.3         \
-         iswalnum.3 iswrune.3          \
-         iswalnum.3 iswspace.3         \
-         iswalnum.3 iswspecial.3       \
-         iswalnum.3 iswupper.3         \
-         iswalnum.3 iswxdigit.3
-
-MLINKS+= iswalnum_l.3 iswalpha_l.3     \
-         iswalnum_l.3 iswblank_l.3     \
-         iswalnum_l.3 iswcntrl_l.3     \
-         iswalnum_l.3 iswdigit_l.3     \
-         iswalnum_l.3 iswgraph_l.3     \
-         iswalnum_l.3 iswhexnumber_l.3 \
-         iswalnum_l.3 iswideogram_l.3  \
-         iswalnum_l.3 iswlower_l.3     \
-         iswalnum_l.3 iswnumber_l.3    \
-         iswalnum_l.3 iswphonogram_l.3 \
-         iswalnum_l.3 iswprint_l.3     \
-         iswalnum_l.3 iswpunct_l.3     \
-         iswalnum_l.3 iswrune_l.3      \
-         iswalnum_l.3 iswspace_l.3     \
-         iswalnum_l.3 iswspecial_l.3   \
-         iswalnum_l.3 iswupper_l.3     \
-         iswalnum_l.3 iswxdigit_l.3
-
-MLINKS+= isxdigit.3 ishexnumber.3
-
-MLINKS+= localeconv.3 localeconv_l.3
-
-MLINKS+= mblen.3 mblen_l.3
-
-MLINKS+= mbrlen.3 mbrlen_l.3
-
-MLINKS+= mbrtowc.3 mbrtowc_l.3
-
-.ifdef FEATURE_LEGACY_RUNE_APIS
-MLINKS+= mbrune.3 mbmb.3               \
-         mbrune.3 mbrrune.3
-.endif
-
-MLINKS+= mbsinit.3 mbsinit_l.3
-
-MLINKS+= mbsrtowcs.3 mbsnrtowcs.3
-
-MLINKS+= mbsrtowcs.3 mbsrtowcs_l.3     \
-         mbsrtowcs.3 mbsnrtowcs_l.3
-
-MLINKS+= mbstowcs.3 mbstowcs_l.3
-
-MLINKS+= mbtowc.3 mbtowc_l.3
-
-MLINKS+= nextwctype.3 nextwctype_l.3
-
-MLINKS+= nl_langinfo.3 nl_langinfo_l.3
-
-.ifdef FEATURE_LEGACY_RUNE_APIS
-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
-.endif
-
-MLINKS+= tolower.3 tolower_l.3
-
-MLINKS+= toupper.3 toupper_l.3
-
-MLINKS+= towlower.3 towlower_l.3
-
-MLINKS+= towupper.3 towupper_l.3
-
-MLINKS+= wcrtomb.3 wcrtomb_l.3
-
-MLINKS+= wcsftime.3 wcsftime_l.3
-
-MLINKS+= wcsrtombs.3 wcsnrtombs.3      \
-         wcsrtombs.3 wcsrtombs_l.3     \
-         wcsrtombs.3 wcsnrtombs_l.3
-
-MLINKS+= wcstod.3 wcstof.3             \
-         wcstod.3 wcstold.3
-
-MLINKS+= wcstod_l.3 wcstof_l.3         \
-         wcstod_l.3 wcstold_l.3
-
-MLINKS+= wcstol.3 wcstoimax.3          \
-         wcstol.3 wcstoll.3            \
-         wcstol.3 wcstoul.3            \
-         wcstol.3 wcstoull.3           \
-         wcstol.3 wcstoumax.3
-
-MLINKS+= wcstol_l.3 wcstoimax_l.3      \
-         wcstol_l.3 wcstoll_l.3                \
-         wcstol_l.3 wcstoul_l.3                \
-         wcstol_l.3 wcstoull_l.3       \
-         wcstol_l.3 wcstoumax_l.3
-
-MLINKS+= wctomb.3 wctomb_l.3
-
-MLINKS+= wcstombs.3 wcstombs_l.3
-
-MLINKS+= wctrans.3 towctrans.3         \
-         wctrans.3 towctrans_l.3       \
-         wctrans.3 wctrans_l.3
-
-MLINKS+= wctype.3 iswctype.3           \
-         wctype.3 iswctype_l.3         \
-         wctype.3 wctype_l.3
-
-MLINKS+= wcwidth.3 wcwidth_l.3
-.endif
diff --git a/locale/ascii-fbsd.c b/locale/ascii-fbsd.c
deleted file mode 100644 (file)
index e2b2b83..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/ascii.c,v 1.1 2008/01/21 23:48:12 ache Exp $");
-
-#include <errno.h>
-#include <limits.h>
-#include <runetype.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-static size_t  _ascii_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _ascii_mbsinit(const mbstate_t *, locale_t);
-static size_t  _ascii_mbsnrtowcs(wchar_t * __restrict dst,
-                   const char ** __restrict src, size_t nms, size_t len,
-                   mbstate_t * __restrict ps __unused, locale_t);
-static size_t  _ascii_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-static size_t  _ascii_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                   size_t, size_t, mbstate_t * __restrict, locale_t);
-
-__private_extern__ int
-_ascii_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _ascii_mbrtowc;
-       xrl->__mbsinit = _ascii_mbsinit;
-       xrl->__mbsnrtowcs = _ascii_mbsnrtowcs;
-       xrl->__wcrtomb = _ascii_wcrtomb;
-       xrl->__wcsnrtombs = _ascii_wcsnrtombs;
-       xrl->__mb_cur_max = 1;
-       xrl->__mb_sb_limit = 128;
-       return(0);
-}
-
-static int
-_ascii_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused)
-{
-
-       /*
-        * Encoding is not state dependent - we are always in the
-        * initial state.
-        */
-       return (1);
-}
-
-static size_t
-_ascii_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (0);
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-       if (*s & 0x80) {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       if (pwc != NULL)
-               *pwc = (unsigned char)*s;
-       return (*s == '\0' ? 0 : 1);
-}
-
-static size_t
-_ascii_wcrtomb(char * __restrict s, wchar_t wc,
-    mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       if (wc < 0 || wc > 127) {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       *s = (unsigned char)wc;
-       return (1);
-}
-
-static size_t
-_ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-       const char *s;
-       size_t nchr;
-
-       if (dst == NULL) {
-               for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
-                       if (*s & 0x80) {
-                               errno = EILSEQ;
-                               return ((size_t)-1);
-                       }
-               }
-               return (s - *src);
-       }
-
-       s = *src;
-       nchr = 0;
-       while (len-- > 0 && nms-- > 0) {
-               if (*s & 0x80) {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               if ((*dst++ = (unsigned char)*s++) == L'\0') {
-                       *src = NULL;
-                       return (nchr);
-               }
-               nchr++;
-       }
-       *src = s;
-       return (nchr);
-}
-
-static size_t
-_ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-       const wchar_t *s;
-       size_t nchr;
-
-       if (dst == NULL) {
-               for (s = *src; nwc > 0 && *s != L'\0'; s++, nwc--) {
-                       if (*s < 0 || *s > 127) {
-                               errno = EILSEQ;
-                               return ((size_t)-1);
-                       }
-               }
-               return (s - *src);
-       }
-
-       s = *src;
-       nchr = 0;
-       while (len-- > 0 && nwc-- > 0) {
-               if (*s < 0 || *s > 127) {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               if ((*dst++ = *s++) == '\0') {
-                       *src = NULL;
-                       return (nchr);
-               }
-               nchr++;
-       }
-       *src = s;
-       return (nchr);
-}
-
diff --git a/locale/big5-fbsd.c b/locale/big5-fbsd.c
deleted file mode 100644 (file)
index 12c88ba..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)big5.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <errno.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-static size_t  _BIG5_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _BIG5_mbsinit(const mbstate_t *, locale_t);
-static size_t  _BIG5_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       wchar_t ch;
-} _BIG5State;
-
-__private_extern__ int
-_BIG5_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _BIG5_mbrtowc;
-       xrl->__wcrtomb = _BIG5_wcrtomb;
-       xrl->__mbsinit = _BIG5_mbsinit;
-       xrl->__mb_cur_max = 2;
-       xrl->__mb_sb_limit = 128;
-       return (0);
-}
-
-static int
-_BIG5_mbsinit(const mbstate_t *ps, locale_t loc __unused)
-{
-
-       return (ps == NULL || ((const _BIG5State *)ps)->ch == 0);
-}
-
-static __inline int
-_big5_check(u_int c)
-{
-
-       c &= 0xff;
-       return ((c >= 0xa1 && c <= 0xfe) ? 2 : 1);
-}
-
-static size_t
-_BIG5_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _BIG5State *bs;
-       wchar_t wc;
-       size_t len;
-
-       bs = (_BIG5State *)ps;
-
-       if ((bs->ch & ~0xFF) != 0) {
-               /* Bad conversion state. */
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       if (bs->ch != 0) {
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (bs->ch << 8) | (*s & 0xFF);
-               if (pwc != NULL)
-                       *pwc = wc;
-               bs->ch = 0;
-               return (1);
-       }
-
-       len = (size_t)_big5_check(*s);
-       wc = *s++ & 0xff;
-       if (len == 2) {
-               if (n < 2) {
-                       /* Incomplete multibyte sequence */
-                       bs->ch = wc;
-                       return ((size_t)-2);
-               }
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (wc << 8) | (*s++ & 0xff);
-               if (pwc != NULL)
-                       *pwc = wc;
-                return (2);
-       } else {
-               if (pwc != NULL)
-                       *pwc = wc;
-               return (wc == L'\0' ? 0 : 1);
-       }
-}
-
-static size_t
-_BIG5_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _BIG5State *bs;
-
-       bs = (_BIG5State *)ps;
-
-       if (bs->ch != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       if (wc & 0x8000) {
-               *s++ = (wc >> 8) & 0xff;
-               *s = wc & 0xff;
-               return (2);
-       }
-       *s = wc & 0xff;
-       return (1);
-}
diff --git a/locale/big5.5 b/locale/big5.5
deleted file mode 120000 (symlink)
index 50603f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./big5.5
\ No newline at end of file
diff --git a/locale/btowc-fbsd.c b/locale/btowc-fbsd.c
deleted file mode 100644 (file)
index 38122e7..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 2002, 2003 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-wint_t
-btowc_l(int c, locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs = initial;
-       char cc;
-       wchar_t wc;
-
-       NORMALIZE_LOCALE(loc);
-       if (c == EOF)
-               return (WEOF);
-       /*
-        * We expect mbrtowc() to return 0 or 1, hence the check for n > 1
-        * which detects error return values as well as "impossible" byte
-        * counts.
-        */
-       cc = (char)c;
-       if (loc->__lc_ctype->__mbrtowc(&wc, &cc, 1, &mbs, loc) > 1)
-               return (WEOF);
-       return (wc);
-}
-
-wint_t
-btowc(int c)
-{
-       return btowc_l(c, __current_locale());
-}
diff --git a/locale/btowc.3 b/locale/btowc.3
deleted file mode 100644 (file)
index 39447a2..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/btowc.3,v 1.2 2002/11/10 11:14:58 tjr Exp $
-.\"
-.Dd August 3, 2002
-.Dt BTOWC 3
-.Os
-.Sh NAME
-.Nm btowc ,
-.Nm btowc_l ,
-.Nm wctob ,
-.Nm wctob_l
-.Nd "convert between wide and single-byte characters"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft wint_t
-.Fo btowc
-.Fa "int c"
-.Fc
-.Ft int
-.Fo wctob
-.Fa "wint_t c"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft wint_t
-.Fo btowc_l
-.Fa "int c"
-.Fa "locale_t loc"
-.Fc
-.Ft int
-.Fo wctob_l
-.Fa "wint_t c"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn btowc
-function converts a single-byte character into a corresponding wide character.
-If the character is
-.Dv EOF
-or not valid in the initial shift state,
-.Fn btowc
-returns
-.Dv WEOF .
-.Pp
-The
-.Fn wctob
-function converts a wide character into a corresponding single-byte character.
-If the wide character is
-.Dv WEOF
-or not able to be represented as a single byte in the initial shift state,
-.Fn wctob
-returns
-.Dv WEOF .
-.Pp
-While the
-.Fn btowc
-and
-.Fn wctob
-functions use the current locale, the
-.Fn btowc_l
-and
-.Fn wctob_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh LEGACY SYNOPSIS
-.Pp
-The include file
-.In stdio.h
-is not necessary for these functions.
-.Sh SEE ALSO
-.Xr mbrtowc 3 ,
-.Xr multibyte 3 ,
-.Xr wcrtomb 3 ,
-.Xr xlocale 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn btowc
-and
-.Fn wctob
-functions conform to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn btowc
-and
-.Fn wctob
-functions first appeared in
-.Fx 5.0 .
diff --git a/locale/collate-fbsd.c b/locale/collate-fbsd.c
deleted file mode 100644 (file)
index e48d7ca..0000000
+++ /dev/null
@@ -1,954 +0,0 @@
-/*-
- * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
- *             at Electronni Visti IA, Kiev, Ukraine.
- *                     All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.35 2005/02/27 20:31:13 ru Exp $");
-
-#include "xlocale_private.h"
-/* assumes the locale_t variable is named loc */
-#define __collate_chain_equiv_table    (loc->__lc_collate->__chain_equiv_table)
-#define __collate_chain_pri_table      (loc->__lc_collate->__chain_pri_table)
-#define __collate_char_pri_table       (loc->__lc_collate->__char_pri_table)
-#define __collate_info                 (&loc->__lc_collate->__info)
-#define __collate_large_char_pri_table (loc->__lc_collate->__large_char_pri_table)
-#define __collate_substitute_table     (loc->__lc_collate->__substitute_table)
-
-#include "namespace.h"
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <wchar.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sysexits.h>
-#include <ctype.h>
-#include "un-namespace.h"
-
-#include "collate.h"
-#include "setlocale.h"
-#include "ldpart.h"
-
-#include "libc_private.h"
-
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-static void wntohl(wchar_t *, int);
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-void __collate_err(int ex, const char *f) __dead2;
-
-/*
- * Normally, the __collate_* routines should all be __private_extern__,
- * but grep is using them (3715846).  Until we can provide an alternative,
- * we leave them public, and provide a read-only __collate_load_error variable
- */
-#undef __collate_load_error
-int __collate_load_error = 1;
-
-__private_extern__ int
-__collate_load_tables(const char *encoding, locale_t loc)
-{
-       FILE *fp;
-       int i, saverr, chains, z;
-       char strbuf[STR_LEN], buf[PATH_MAX];
-       struct __xlocale_st_collate *TMP;
-       static struct __xlocale_st_collate *cache = NULL;
-       struct __collate_st_info info;
-       void *vp;
-
-       /* 'encoding' must be already checked. */
-       if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
-               loc->__collate_load_error = 1;
-               if (loc == &__global_locale)
-                       __collate_load_error = 1;
-               XL_RELEASE(loc->__lc_collate);
-               loc->__lc_collate = NULL;
-               return (_LDP_CACHE);
-       }
-
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-       if (cache && strcmp(encoding, cache->__encoding) == 0) {
-               loc->__collate_load_error = 0;
-               if (loc == &__global_locale)
-                       __collate_load_error = 0;
-               XL_RELEASE(loc->__lc_collate);
-               loc->__lc_collate = cache;
-               XL_RETAIN(loc->__lc_collate);
-               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)
-               return (_LDP_ERROR);
-
-       if (fread(strbuf, sizeof(strbuf), 1, fp) != 1) {
-               saverr = errno;
-               (void)fclose(fp);
-               errno = saverr;
-               return (_LDP_ERROR);
-       }
-       chains = -1;
-       if (strcmp(strbuf, COLLATE_VERSION1_1A) == 0)
-               chains = 1;
-       if (chains < 0) {
-               (void)fclose(fp);
-               errno = EFTYPE;
-               return (_LDP_ERROR);
-       }
-       if (chains) {
-               if (fread(&info, sizeof(info), 1, fp) != 1) {
-                       saverr = errno;
-                       (void)fclose(fp);
-                       errno = saverr;
-                       return (_LDP_ERROR);
-               }
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-               for(z = 0; z < info.directive_count; z++) {
-                       info.undef_pri[z] = ntohl(info.undef_pri[z]);
-                       info.subst_count[z] = ntohl(info.subst_count[z]);
-               }
-               info.chain_count = ntohl(info.chain_count);
-               info.large_pri_count = ntohl(info.large_pri_count);
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-               if ((chains = info.chain_count) < 0) {
-                       (void)fclose(fp);
-                       errno = EFTYPE;
-                       return (_LDP_ERROR);
-               }
-       } else
-               chains = TABLE_SIZE;
-
-       i = sizeof(struct __xlocale_st_collate)
-           + sizeof(struct __collate_st_chain_pri) * chains
-           + sizeof(struct __collate_st_large_char_pri) * info.large_pri_count;
-       for(z = 0; z < info.directive_count; z++)
-               i += sizeof(struct __collate_st_subst) * info.subst_count[z];
-       if ((TMP = (struct __xlocale_st_collate *)malloc(i)) == NULL) {
-               saverr = errno;
-               (void)fclose(fp);
-               errno = saverr;
-               return (_LDP_ERROR);
-       }
-       TMP->__refcount = 2; /* one for the locale, one for the cache */
-       TMP->__free_extra = NULL;
-
-#define FREAD(a, b, c, d) \
-{ \
-       if (fread(a, b, c, d) != c) { \
-               saverr = errno; \
-               free(TMP); \
-               (void)fclose(d); \
-               errno = saverr; \
-               return (_LDP_ERROR); \
-       } \
-}
-
-       /* adjust size to read the remaining in one chunk */
-       i -= offsetof(struct __xlocale_st_collate, __char_pri_table);
-       FREAD(TMP->__char_pri_table, i, 1, fp);
-       (void)fclose(fp);
-
-       vp = (void *)(TMP + 1);
-
-       /* the COLLATE_SUBST_DUP optimization relies on COLL_WEIGHTS_MAX == 2 */
-       if (info.subst_count[0] > 0) {
-               TMP->__substitute_table[0] = (struct __collate_st_subst *)vp;
-               vp += info.subst_count[0] * sizeof(struct __collate_st_subst);
-       } else
-               TMP->__substitute_table[0] = NULL;
-       if (info.flags & COLLATE_SUBST_DUP)
-               TMP->__substitute_table[1] = TMP->__substitute_table[0];
-       else if (info.subst_count[1] > 0) {
-               TMP->__substitute_table[1] = (struct __collate_st_subst *)vp;
-               vp += info.subst_count[1] * sizeof(struct __collate_st_subst);
-       } else
-               TMP->__substitute_table[1] = NULL;
-
-       if (chains > 0) {
-               TMP->__chain_pri_table = (struct __collate_st_chain_pri *)vp;
-               vp += chains * sizeof(struct __collate_st_chain_pri);
-       } else
-               TMP->__chain_pri_table = NULL;
-       if (info.large_pri_count > 0)
-               TMP->__large_char_pri_table = (struct __collate_st_large_char_pri *)vp;
-       else
-               TMP->__large_char_pri_table = NULL;
-
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-       {
-               struct __collate_st_char_pri *p = TMP->__char_pri_table;
-               for(i = UCHAR_MAX + 1; i-- > 0; p++) {
-                       for(z = 0; z < info.directive_count; z++)
-                               p->pri[z] = ntohl(p->pri[z]);
-               }
-       }
-       for(z = 0; z < info.directive_count; z++)
-               if (info.subst_count[z] > 0) {
-                       struct __collate_st_subst *p = TMP->__substitute_table[z];
-                       for(i = info.subst_count[z]; i-- > 0; p++) {
-                               p->val = ntohl(p->val);
-                               wntohl(p->str, STR_LEN);
-                       }
-               }
-       {
-               struct __collate_st_chain_pri *p = TMP->__chain_pri_table;
-               for(i = chains; i-- > 0; p++) {
-                       wntohl(p->str, STR_LEN);
-                       for(z = 0; z < info.directive_count; z++)
-                               p->pri[z] = ntohl(p->pri[z]);
-               }
-       }
-       if (info.large_pri_count > 0) {
-               struct __collate_st_large_char_pri *p = TMP->__large_char_pri_table;
-               for(i = info.large_pri_count; i-- > 0; p++) {
-                       p->val = ntohl(p->val);
-                       for(z = 0; z < info.directive_count; z++)
-                               p->pri.pri[z] = ntohl(p->pri.pri[z]);
-               }
-       }
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-       (void)strcpy(TMP->__encoding, encoding);
-       (void)memcpy(&TMP->__info, &info, sizeof(info));
-       XL_RELEASE(cache);
-       cache = TMP;
-       XL_RELEASE(loc->__lc_collate);
-       loc->__lc_collate = cache;
-       /* no need to retain, since we set __refcount to 2 above */
-       
-       loc->__collate_substitute_nontrivial = (info.subst_count[0] > 0 || info.subst_count[1] > 0);
-       loc->__collate_load_error = 0;
-       if (loc == &__global_locale)
-               __collate_load_error = 0;
-
-       return (_LDP_LOADED);
-}
-
-static int
-__collate_wcsnlen(const wchar_t *s, int len)
-{
-       int n = 0;
-       while (*s && n < len) {
-               s++;
-               n++;
-       }
-       return n;
-}
-
-static struct __collate_st_subst *
-substsearch(const wchar_t key, struct __collate_st_subst *tab, int n)
-{
-       int low = 0;
-       int high = n - 1;
-       int next, compar;
-       struct __collate_st_subst *p;
-
-       while (low <= high) {
-               next = (low + high) / 2;
-               p = tab + next;
-               compar = key - p->val;
-               if (compar == 0)
-                       return p;
-               if (compar > 0)
-                       low = next + 1;
-               else
-                       high = next - 1;
-       }
-       return NULL;
-}
-
-__private_extern__ wchar_t *
-__collate_substitute(const wchar_t *s, int which, locale_t loc)
-{
-       int dest_len, len, nlen;
-       int n, delta, nsubst;
-       wchar_t *dest_str = NULL;
-       const wchar_t *fp;
-       struct __collate_st_subst *subst, *match;
-
-       if (s == NULL || *s == '\0')
-               return (__collate_wcsdup(L""));
-       dest_len = wcslen(s);
-       nsubst = __collate_info->subst_count[which];
-       if (nsubst <= 0)
-               return __collate_wcsdup(s);
-       subst = __collate_substitute_table[which];
-       delta = dest_len / 4;
-       if (delta < 2)
-               delta = 2;
-       dest_str = (wchar_t *)malloc((dest_len += delta) * sizeof(wchar_t));
-       if (dest_str == NULL)
-               __collate_err(EX_OSERR, __func__);
-       len = 0;
-       while (*s) {
-               if ((match = substsearch(*s, subst, nsubst)) != NULL) {
-                       fp = match->str;
-                       n = __collate_wcsnlen(fp, STR_LEN);
-               } else {
-                       fp = s;
-                       n = 1;
-               }
-               nlen = len + n;
-               if (dest_len <= nlen) {
-                       dest_str = reallocf(dest_str, (dest_len = nlen + delta) * sizeof(wchar_t));
-                       if (dest_str == NULL)
-                               __collate_err(EX_OSERR, __func__);
-               }
-               wcsncpy(dest_str + len, fp, n);
-               len += n;
-               s++;
-       }
-       dest_str[len] = 0;
-       return (dest_str);
-}
-
-static struct __collate_st_chain_pri *
-chainsearch(const wchar_t *key, int *len, locale_t loc)
-{
-       int low = 0;
-       int high = __collate_info->chain_count - 1;
-       int next, compar, l;
-       struct __collate_st_chain_pri *p;
-       struct __collate_st_chain_pri *tab = __collate_chain_pri_table;
-
-       while (low <= high) {
-               next = (low + high) / 2;
-               p = tab + next;
-               compar = *key - *p->str;
-               if (compar == 0) {
-                       l = __collate_wcsnlen(p->str, STR_LEN);
-                       compar = wcsncmp(key, p->str, l);
-                       if (compar == 0) {
-                               *len = l;
-                               return p;
-                       }
-               }
-               if (compar > 0)
-                       low = next + 1;
-               else
-                       high = next - 1;
-       }
-       return NULL;
-}
-
-static struct __collate_st_large_char_pri *
-largesearch(const wchar_t key, locale_t loc)
-{
-       int low = 0;
-       int high = __collate_info->large_pri_count - 1;
-       int next, compar;
-       struct __collate_st_large_char_pri *p;
-       struct __collate_st_large_char_pri *tab = __collate_large_char_pri_table;
-
-       while (low <= high) {
-               next = (low + high) / 2;
-               p = tab + next;
-               compar = key - p->val;
-               if (compar == 0)
-                       return p;
-               if (compar > 0)
-                       low = next + 1;
-               else
-                       high = next - 1;
-       }
-       return NULL;
-}
-
-__private_extern__ void
-__collate_lookup_l(const wchar_t *t, int *len, int *prim, int *sec, locale_t loc)
-{
-       struct __collate_st_chain_pri *p2;
-       int l;
-
-       *len = 1;
-       *prim = *sec = 0;
-       p2 = chainsearch(t, &l, loc);
-       /* use the chain if prim >= 0 */
-       if (p2 && p2->pri[0] >= 0) {
-               *len = l;
-               *prim = p2->pri[0];
-               *sec = p2->pri[1];
-               return;
-       }
-       if (*t <= UCHAR_MAX) {
-               *prim = __collate_char_pri_table[*t].pri[0];
-               *sec = __collate_char_pri_table[*t].pri[1];
-               return;
-       }
-       if (__collate_info->large_pri_count > 0) {
-               struct __collate_st_large_char_pri *match;
-               match = largesearch(*t, loc);
-               if (match) {
-                       *prim = match->pri.pri[0];
-                       *sec = match->pri.pri[1];
-                       return;
-               }
-       }
-       *prim = (l = __collate_info->undef_pri[0]) >= 0 ? l : *t - l;
-       *sec = (l = __collate_info->undef_pri[1]) >= 0 ? l : *t - l;
-}
-
-/*
- * This is only provided for programs (like grep) that are calling this
- * private function.  This will go away eventually.
- */
-void
-__collate_lookup(const unsigned char *t, int *len, int *prim, int *sec)
-{
-       locale_t loc = __current_locale();
-       wchar_t *w = __collate_mbstowcs((const char *)t, loc);
-       int sverrno;
-
-       __collate_lookup_l(w, len, prim, sec, loc);
-       sverrno = errno;
-       free(w);
-       errno = sverrno;
-}
-__private_extern__ void
-__collate_lookup_which(const wchar_t *t, int *len, int *pri, int which, locale_t loc)
-{
-       struct __collate_st_chain_pri *p2;
-       int p, l;
-
-       *len = 1;
-       *pri = 0;
-       p2 = chainsearch(t, &l, loc);
-       if (p2) {
-               p = p2->pri[which];
-               /* use the chain if pri >= 0 */
-               if (p >= 0) {
-                       *len = l;
-                       *pri = p;
-                       return;
-               }
-       }
-       if (*t <= UCHAR_MAX) {
-               *pri = __collate_char_pri_table[*t].pri[which];
-               return;
-       }
-       if (__collate_info->large_pri_count > 0) {
-               struct __collate_st_large_char_pri *match;
-               match = largesearch(*t, loc);
-               if (match) {
-                       *pri = match->pri.pri[which];
-                       return;
-               }
-       }
-       *pri = (l = __collate_info->undef_pri[which]) >= 0 ? l : *t - l;
-}
-
-__private_extern__ wchar_t *
-__collate_mbstowcs(const char *s, locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t st;
-       size_t len;
-       const char *ss;
-       wchar_t *wcs;
-
-       ss = s;
-       st = initial;
-       if ((len = mbsrtowcs_l(NULL, &ss, 0, &st, loc)) == (size_t)-1)
-               return NULL;
-       if ((wcs = (wchar_t *)malloc((len + 1) * sizeof(wchar_t))) == NULL)
-               __collate_err(EX_OSERR, __func__);
-       st = initial;
-       mbsrtowcs_l(wcs, &s, len, &st, loc);
-       wcs[len] = 0;
-
-       return (wcs);
-}
-
-__private_extern__ wchar_t *
-__collate_wcsdup(const wchar_t *s)
-{
-       size_t len = wcslen(s) + 1;
-       wchar_t *wcs;
-
-       if ((wcs = (wchar_t *)malloc(len * sizeof(wchar_t))) == NULL)
-               __collate_err(EX_OSERR, __func__);
-       wcscpy(wcs, s);
-       return (wcs);
-}
-
-__private_extern__ void
-__collate_xfrm(const wchar_t *src, wchar_t **xf, locale_t loc)
-{
-       int pri, len;
-       size_t slen;
-       const wchar_t *t;
-       wchar_t *tt = NULL, *tr = NULL;
-       int direc, pass;
-       wchar_t *xfp;
-       struct __collate_st_info *info = __collate_info;
-       int sverrno;
-
-       for(pass = 0; pass < COLL_WEIGHTS_MAX; pass++)
-               xf[pass] = NULL;
-       for(pass = 0; pass < info->directive_count; pass++) {
-               direc = info->directive[pass];
-               if (pass == 0 || !(info->flags & COLLATE_SUBST_DUP)) {
-                       sverrno = errno;
-                       free(tt);
-                       errno = sverrno;
-                       tt = __collate_substitute(src, pass, loc);
-               }
-               if (direc & DIRECTIVE_BACKWARD) {
-                       wchar_t *bp, *fp, c;
-                       sverrno = errno;
-                       free(tr);
-                       errno = sverrno;
-                       tr = __collate_wcsdup(tt ? tt : src);
-                       bp = tr;
-                       fp = tr + wcslen(tr) - 1;
-                       while(bp < fp) {
-                               c = *bp;
-                               *bp++ = *fp;
-                               *fp-- = c;
-                       }
-                       t = (const wchar_t *)tr;
-               } else if (tt)
-                       t = (const wchar_t *)tt;
-               else
-                       t = (const wchar_t *)src;
-               sverrno = errno;
-               if ((xf[pass] = (wchar_t *)malloc(sizeof(wchar_t) * (wcslen(t) + 1))) == NULL) {
-                       errno = sverrno;
-                       slen = 0;
-                       goto end;
-               }
-               errno = sverrno;
-               xfp = xf[pass];
-               if (direc & DIRECTIVE_POSITION) {
-                       while(*t) {
-                               __collate_lookup_which(t, &len, &pri, pass, loc);
-                               t += len;
-                               if (pri <= 0) {
-                                       if (pri < 0) {
-                                               errno = EINVAL;
-                                               slen = 0;
-                                               goto end;
-                                       }
-                                       pri = COLLATE_MAX_PRIORITY;
-                               }
-                               *xfp++ = pri;
-                       }
-               } else {
-                       while(*t) {
-                               __collate_lookup_which(t, &len, &pri, pass, loc);
-                               t += len;
-                               if (pri <= 0) {
-                                       if (pri < 0) {
-                                               errno = EINVAL;
-                                               slen = 0;
-                                               goto end;
-                                       }
-                                       continue;
-                               }
-                               *xfp++ = pri;
-                       }
-               }
-               *xfp = 0;
-       }
-  end:
-       sverrno = errno;
-       free(tt);
-       free(tr);
-       errno = sverrno;
-}
-
-__private_extern__ void
-__collate_err(int ex, const char *f)
-{
-       const char *s;
-       int serrno = errno;
-
-       s = _getprogname();
-       _write(STDERR_FILENO, s, strlen(s));
-       _write(STDERR_FILENO, ": ", 2);
-       s = f;
-       _write(STDERR_FILENO, s, strlen(s));
-       _write(STDERR_FILENO, ": ", 2);
-       s = strerror(serrno);
-       _write(STDERR_FILENO, s, strlen(s));
-       _write(STDERR_FILENO, "\n", 1);
-       exit(ex);
-}
-
-/*
- * __collate_collating_symbol takes the multibyte string specified by
- * src and slen, and using ps, converts that to a wide character.  Then
- * it is checked to verify it is a collating symbol, and then copies
- * it to the wide character string specified by dst and dlen (the
- * results are not null terminated).  The length of the wide characters
- * copied to dst is returned if successful.  Zero is returned if no such
- * collating symbol exists.  (size_t)-1 is returned if there are wide-character
- * conversion errors, if the length of the converted string is greater that
- * STR_LEN or if dlen is too small.  It is up to the calling routine to
- * preserve the mbstate_t structure as needed.
- */
-__private_extern__ size_t
-__collate_collating_symbol(wchar_t *dst, size_t dlen, const char *src, size_t slen, mbstate_t *ps, locale_t loc)
-{
-       wchar_t wname[STR_LEN];
-       wchar_t w, *wp;
-       size_t len, l;
-
-       /* POSIX locale */
-       if (loc->__collate_load_error) {
-               if (dlen < 1)
-                       return (size_t)-1;
-               if (slen != 1 || !isascii(*src))
-                       return 0;
-               *dst = *src;
-               return 1;
-       }
-       for(wp = wname, len = 0; slen > 0; len++) {
-               l = mbrtowc_l(&w, src, slen, ps, loc);
-               if (l == (size_t)-1 || l == (size_t)-2)
-                       return (size_t)-1;
-               if (l == 0)
-                       break;
-               if (len >= STR_LEN)
-                       return -1;
-               *wp++ = w;
-               src += l;
-               slen = (long)slen - (long)l;
-       }
-       if (len == 0 || len > dlen)
-               return (size_t)-1;
-       if (len == 1) {
-               if (*wname <= UCHAR_MAX) {
-                       if (__collate_char_pri_table[*wname].pri[0] >= 0) {
-                               if (dlen > 0)
-                                       *dst = *wname;
-                               return 1;
-                       }
-                       return 0;
-               } else if (__collate_info->large_pri_count > 0) {
-                       struct __collate_st_large_char_pri *match;
-                       match = largesearch(*wname, loc);
-                       if (match && match->pri.pri[0] >= 0) {
-                               if (dlen > 0)
-                                       *dst = *wname;
-                               return 1;
-                       }
-               }
-               return 0;
-       }
-       *wp = 0;
-       if (__collate_info->chain_count > 0) {
-               struct __collate_st_chain_pri *match;
-               int ll;
-               match = chainsearch(wname, &ll, loc);
-               if (match) {
-                       if (ll < dlen)
-                               dlen = ll;
-                       wcsncpy(dst, wname, dlen);
-                       return ll;
-               }
-       }
-       return 0;
-}
-
-/*
- * __collate_equiv_class returns the equivalence class number for the symbol
- * specified by src and slen, using ps to convert from multi-byte to wide
- * character.  Zero is returned if the symbol is not in an equivalence
- * class.  -1 is returned if there are wide character conversion error,
- * if there are any greater-than-8-bit characters or if a multi-byte symbol
- * is greater or equal to STR_LEN in length.  It is up to the calling
- * routine to preserve the mbstate_t structure as needed.
- */
-__private_extern__ int
-__collate_equiv_class(const char *src, size_t slen, mbstate_t *ps, locale_t loc)
-{
-       wchar_t wname[STR_LEN];
-       wchar_t w, *wp;
-       size_t len, l;
-       int e;
-
-       /* POSIX locale */
-       if (loc->__collate_load_error)
-               return 0;
-       for(wp = wname, len = 0; slen > 0; len++) {
-               l = mbrtowc_l(&w, src, slen, ps, loc);
-               if (l == (size_t)-1 || l == (size_t)-2)
-                       return -1;
-               if (l == 0)
-                       break;
-               if (len >= STR_LEN)
-                       return -1;
-               *wp++ = w;
-               src += l;
-               slen = (long)slen - (long)l;
-       }
-       if (len == 0)
-               return -1;
-       if (len == 1) {
-               e = -1;
-               if (*wname <= UCHAR_MAX)
-                       e = __collate_char_pri_table[*wname].pri[0];
-               else if (__collate_info->large_pri_count > 0) {
-                       struct __collate_st_large_char_pri *match;
-                       match = largesearch(*wname, loc);
-                       if (match)
-                               e = match->pri.pri[0];
-               }
-               if (e == 0)
-                       return IGNORE_EQUIV_CLASS;
-               return e > 0 ? e : 0;
-       }
-       *wp = 0;
-       if (__collate_info->chain_count > 0) {
-               struct __collate_st_chain_pri *match;
-               int ll;
-               match = chainsearch(wname, &ll, loc);
-               if (match) {
-                       e = match->pri[0];
-                       if (e == 0)
-                               return IGNORE_EQUIV_CLASS;
-                       return e < 0 ? -e : e;
-               }
-       }
-       return 0;
-}
-
-/*
- * __collate_equiv_match tries to match any single or multi-character symbol
- * in equivalence class equiv_class in the multi-byte string specified by src
- * and slen.  If start is non-zero, it is taken to be the first (pre-converted)
- * wide character.  Subsequence wide characters, if needed, will use ps in
- * the conversion.  On a successful match, the length of the matched string
- * is returned (including the start character).  If dst is non-NULL, the
- * matched wide-character string is copied to dst, a wide character array of
- * length dlen (the results are not zero-terminated).  If rlen is non-NULL,
- * the number of character in src actually used is returned.  Zero is
- * returned by __collate_equiv_match if there is no match.  (size_t)-1 is
- * returned on error: if there were conversion errors or if dlen is too small
- * to accept the results.  On no match or error, ps is restored to its incoming
- * state.
- */
-size_t
-__collate_equiv_match(int equiv_class, wchar_t *dst, size_t dlen, wchar_t start, const char *src, size_t slen, mbstate_t *ps, size_t *rlen, locale_t loc)
-{
-       wchar_t w;
-       size_t len, l, clen;
-       int i;
-       wchar_t buf[STR_LEN], *wp;
-       mbstate_t save;
-       const char *s = src;
-       size_t sl = slen;
-       struct __collate_st_chain_pri *ch = NULL;
-
-       /* POSIX locale */
-       if (loc->__collate_load_error)
-               return (size_t)-1;
-       if (equiv_class == IGNORE_EQUIV_CLASS)
-               equiv_class = 0;
-       if (ps)
-               save = *ps;
-       wp = buf;
-       len = clen = 0;
-       if (start) {
-               *wp++ = start;
-               len = 1;
-       }
-       /* convert up to the max chain length */
-       while(sl > 0 && len < __collate_info->chain_max_len) {
-               l = mbrtowc_l(&w, s, sl, ps, loc);
-               if (l == (size_t)-1 || l == (size_t)-2 || l == 0)
-                       break;
-               *wp++ = w;
-               s += l;
-               clen += l;
-               sl -= l;
-               len++;
-       }
-       *wp = 0;
-       if (len > 1 && (ch = chainsearch(buf, &i, loc)) != NULL) {
-               int e = ch->pri[0];
-               if (e < 0)
-                       e = -e;
-               if (e == equiv_class)
-                       goto found;
-       }
-       /* try single character */
-       i = 1;
-       if (*buf <= UCHAR_MAX) {
-               if (equiv_class == __collate_char_pri_table[*buf].pri[0])
-                       goto found;
-       } else if (__collate_info->large_pri_count > 0) {
-               struct __collate_st_large_char_pri *match;
-               match = largesearch(*buf, loc);
-               if (match && equiv_class == match->pri.pri[0])
-                       goto found;
-       }
-       /* no match */
-       if (ps)
-               *ps = save;
-       return 0;
-found:
-       /* if we converted more than we used, restore to initial and reconvert
-        * up to what did match */
-       if (i < len) {
-               len = i;
-               if (ps)
-                       *ps = save;
-               if (start)
-                       i--;
-               clen = 0;
-               while(i-- > 0) {
-                       l = mbrtowc_l(&w, src, slen, ps, loc);
-                       src += l;
-                       clen += l;
-                       slen -= l;
-               }
-       }
-       if (dst) {
-               if (dlen < len) {
-                       if (ps)
-                               *ps = save;
-                       return (size_t)-1;
-               }
-               for(wp = buf; len > 0; len--)
-                   *dst++ = *wp++;
-       }
-       if (rlen)
-               *rlen = clen;
-       return len;
-}
-
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-static void
-wntohl(wchar_t *str, int len)
-{
-       for(; *str && len > 0; str++, len--)
-               *str = ntohl(*str);
-}
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-
-#ifdef COLLATE_DEBUG
-static char *
-show(int c)
-{
-       static char buf[5];
-
-       if (c >=32 && c <= 126)
-               sprintf(buf, "'%c' ", c);
-       else
-               sprintf(buf, "\\x{%02x}", c);
-       return buf;
-}
-
-static char *
-showwcs(const wchar_t *t, int len)
-{
-       static char buf[64];
-       char *cp = buf;
-
-       for(; *t && len > 0; len--, t++) {
-               if (*t >=32 && *t <= 126)
-                       *cp++ = *t;
-               else {
-                       sprintf(cp, "\\x{%02x}", *t);
-                       cp += strlen(cp);
-               }
-       }
-       *cp = 0;
-       return buf;
-}
-
-void
-__collate_print_tables()
-{
-       int i, z;
-       locale_t loc = __current_locale();
-
-       printf("Info: p=%d s=%d f=0x%02x m=%d dc=%d up=%d us=%d pc=%d sc=%d cc=%d lc=%d\n",
-           __collate_info->directive[0], __collate_info->directive[1],
-           __collate_info->flags, __collate_info->chain_max_len,
-           __collate_info->directive_count,
-           __collate_info->undef_pri[0], __collate_info->undef_pri[1],
-           __collate_info->subst_count[0], __collate_info->subst_count[1],
-           __collate_info->chain_count, __collate_info->large_pri_count);
-       for(z = 0; z < __collate_info->directive_count; z++) {
-               if (__collate_info->subst_count[z] > 0) {
-                       struct __collate_st_subst *p2 = __collate_substitute_table[z];
-                       if (z == 0 && (__collate_info->flags & COLLATE_SUBST_DUP))
-                               printf("Both substitute tables:\n");
-                       else
-                               printf("Substitute table %d:\n", z);
-                       for (i = __collate_info->subst_count[z]; i-- > 0; p2++)
-                               printf("\t%s --> \"%s\"\n",
-                                       show(p2->val),
-                                       showwcs(p2->str, STR_LEN));
-               }
-       }
-       if (__collate_info->chain_count > 0) {
-               printf("Chain priority table:\n");
-               struct __collate_st_chain_pri *p2 = __collate_chain_pri_table;
-               for (i = __collate_info->chain_count; i-- > 0; p2++) {
-                       printf("\t\"%s\" :", showwcs(p2->str, STR_LEN));
-                       for(z = 0; z < __collate_info->directive_count; z++)
-                               printf(" %d", p2->pri[z]);
-                       putchar('\n');
-               }
-       }
-       printf("Char priority table:\n");
-       {
-               struct __collate_st_char_pri *p2 = __collate_char_pri_table;
-               for (i = 0; i < UCHAR_MAX + 1; i++, p2++) {
-                       printf("\t%s :", show(i));
-                       for(z = 0; z < __collate_info->directive_count; z++)
-                               printf(" %d", p2->pri[z]);
-                       putchar('\n');
-               }
-       }
-       if (__collate_info->large_pri_count > 0) {
-               struct __collate_st_large_char_pri *p2 = __collate_large_char_pri_table;
-               printf("Large priority table:\n");
-               for (i = __collate_info->large_pri_count; i-- > 0; p2++) {
-                       printf("\t%s :", show(p2->val));
-                       for(z = 0; z < __collate_info->directive_count; z++)
-                               printf(" %d", p2->pri.pri[z]);
-                       putchar('\n');
-               }
-       }
-}
-#endif
diff --git a/locale/collate.h b/locale/collate.h
deleted file mode 100644 (file)
index f50baba..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*-
- * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
- *             at Electronni Visti IA, Kiev, Ukraine.
- *                     All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * 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.15 2005/02/27 20:31:13 ru Exp $
- */
-
-#ifndef _COLLATE_H_
-#define        _COLLATE_H_
-
-#include <sys/cdefs.h>
-#ifndef __LIBC__
-#include <sys/types.h>
-#endif /* !__LIBC__ */
-#include <limits.h>
-
-#define STR_LEN 10
-#define TABLE_SIZE 100
-#define COLLATE_VERSION    "1.0\n"
-#define COLLATE_VERSION1_1 "1.1\n"
-#define COLLATE_VERSION1_1A "1.1A\n"
-#define COLLATE_VERSION1_2 "1.2\n"
-
-/* see discussion in string/FreeBSD/strxfrm for this value */
-#define COLLATE_MAX_PRIORITY ((1 << 24) - 1)
-
-#define DIRECTIVE_UNDEF 0x00
-#define DIRECTIVE_FORWARD 0x01
-#define DIRECTIVE_BACKWARD 0x02
-#define DIRECTIVE_POSITION 0x04
-
-#define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
-
-#define COLLATE_SUBST_DUP 0x0001
-
-#define IGNORE_EQUIV_CLASS 1
-
-struct __collate_st_info {
-       __uint8_t directive[COLL_WEIGHTS_MAX];
-       __uint8_t flags;
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-       __uint8_t directive_count:4;
-       __uint8_t chain_max_len:4;
-#else
-       __uint8_t chain_max_len:4;
-       __uint8_t directive_count:4;
-#endif
-       __int32_t undef_pri[COLL_WEIGHTS_MAX];
-       __int32_t subst_count[COLL_WEIGHTS_MAX];
-       __int32_t chain_count;
-       __int32_t large_pri_count;
-};
-
-struct __collate_st_char_pri {
-       __int32_t pri[COLL_WEIGHTS_MAX];
-};
-struct __collate_st_chain_pri {
-       __darwin_wchar_t str[STR_LEN];
-       __int32_t pri[COLL_WEIGHTS_MAX];
-};
-struct __collate_st_large_char_pri {
-       __int32_t val;
-       struct __collate_st_char_pri pri;
-};
-struct __collate_st_subst {
-       __int32_t val;
-       __darwin_wchar_t str[STR_LEN];
-};
-
-#ifndef __LIBC__
-extern int __collate_load_error;
-extern int __collate_substitute_nontrivial;
-#define __collate_char_pri_table (*__collate_char_pri_table_ptr)
-extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
-extern struct __collate_st_chain_pri *__collate_chain_pri_table;
-extern __int32_t *__collate_chain_equiv_table;
-extern struct __collate_st_info __collate_info;
-#endif /* !__LIBC__ */
-
-__BEGIN_DECLS
-#ifdef __LIBC__
-__darwin_wchar_t       *__collate_mbstowcs(const char *, locale_t);
-__darwin_wchar_t       *__collate_wcsdup(const __darwin_wchar_t *);
-__darwin_wchar_t       *__collate_substitute(const __darwin_wchar_t *, int, locale_t);
-int    __collate_load_tables(const char *, locale_t);
-void   __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t);
-void   __collate_lookup_which(const __darwin_wchar_t *, int *, int *, int, locale_t);
-void   __collate_xfrm(const __darwin_wchar_t *, __darwin_wchar_t **, locale_t);
-int    __collate_range_cmp(__darwin_wchar_t, __darwin_wchar_t, locale_t);
-size_t __collate_collating_symbol(__darwin_wchar_t *, size_t, const char *, size_t, __darwin_mbstate_t *, locale_t);
-int    __collate_equiv_class(const char *, size_t, __darwin_mbstate_t *, locale_t);
-size_t __collate_equiv_match(int, __darwin_wchar_t *, size_t, __darwin_wchar_t, const char *, size_t, __darwin_mbstate_t *, size_t *, locale_t);
-#else /* !__LIBC__ */
-void   __collate_lookup(const unsigned char *, int *, int *, int *);
-#endif /* __LIBC__ */
-#ifdef COLLATE_DEBUG
-void   __collate_print_tables(void);
-#endif
-__END_DECLS
-
-#endif /* !_COLLATE_H_ */
diff --git a/locale/collcmp-fbsd.c b/locale/collcmp-fbsd.c
deleted file mode 100644 (file)
index 7f135bc..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/collcmp.c,v 1.18 2005/02/27 14:54:23 phantom Exp $");
-
-#include <xlocale.h>
-#include <wchar.h>
-#include "collate.h"
-
-/*
- * Compare two characters using collate
- */
-
-__private_extern__ int
-__collate_range_cmp(wchar_t c1, wchar_t c2, locale_t loc)
-{
-       static wchar_t s1[2], s2[2];
-
-       s1[0] = c1;
-       s2[0] = c2;
-       return (wcscoll_l(s1, s2, loc));
-}
diff --git a/locale/ctype.3 b/locale/ctype.3
deleted file mode 100644 (file)
index aa91313..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ctype.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/ctype.3,v 1.18 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd March 30, 2004
-.Dt CTYPE 3
-.Os
-.Sh NAME
-.Nm digittoint ,
-.Nm isalnum ,
-.Nm isalpha ,
-.Nm isascii ,
-.Nm isblank ,
-.Nm iscntrl ,
-.Nm isdigit ,
-.Nm isgraph ,
-.Nm ishexnumber ,
-.Nm isideogram ,
-.Nm islower ,
-.Nm isnumber ,
-.Nm isphonogram ,
-.Nm isprint ,
-.Nm ispunct ,
-.Nm isrune ,
-.Nm isspace ,
-.Nm isspecial ,
-.Nm isupper ,
-.Nm isxdigit ,
-.Nm toascii ,
-.Nm tolower ,
-.Nm toupper
-.Nd character classification macros
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn digittoint "int c"
-.Ft int
-.Fn isalnum "int c"
-.Ft int
-.Fn isalpha "int c"
-.Ft int
-.Fn isascii "int c"
-.Ft int
-.Fn iscntrl "int c"
-.Ft int
-.Fn isdigit "int c"
-.Ft int
-.Fn isgraph "int c"
-.Ft int
-.Fn ishexnumber "int c"
-.Ft int
-.Fn isideogram "int c"
-.Ft int
-.Fn islower "int c"
-.Ft int
-.Fn isnumber "int c"
-.Ft int
-.Fn isphonogram "int c"
-.Ft int
-.Fn isspecial "int c"
-.Ft int
-.Fn isprint "int c"
-.Ft int
-.Fn ispunct "int c"
-.Ft int
-.Fn isrune "int c"
-.Ft int
-.Fn isspace "int c"
-.Ft int
-.Fn isupper "int c"
-.Ft int
-.Fn isxdigit "int c"
-.Ft int
-.Fn toascii "int c"
-.Ft int
-.Fn tolower "int c"
-.Ft int
-.Fn toupper "int c"
-.Sh DESCRIPTION
-The above functions perform character tests and conversions on the integer
-.Fa c .
-They are available as macros, defined in the include file
-.In ctype.h ,
-or as true functions in the C library.
-See the specific manual pages for more information.
-.Pp
-Extended locale versions of these functions are documented in
-.Xr ctype_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh SEE ALSO
-.Xr digittoint 3 ,
-.Xr isalnum 3 ,
-.Xr isalpha 3 ,
-.Xr isascii 3 ,
-.Xr isblank 3 ,
-.Xr iscntrl 3 ,
-.Xr isdigit 3 ,
-.Xr isgraph 3 ,
-.Xr isideogram 3 ,
-.Xr islower 3 ,
-.Xr isphonogram 3 ,
-.Xr isprint 3 ,
-.Xr ispunct 3 ,
-.Xr isrune 3 ,
-.Xr isspace 3 ,
-.Xr isspecial 3 ,
-.Xr isupper 3 ,
-.Xr isxdigit 3 ,
-.Xr toascii 3 ,
-.Xr tolower 3 ,
-.Xr toupper 3 ,
-.Xr wctype 3 ,
-.Xr ascii 7 ,
-.Xr ctype_l 3
-.Sh STANDARDS
-These functions, except for
-.Fn digittoint ,
-.Fn isascii ,
-.Fn ishexnumber ,
-.Fn isideogram ,
-.Fn isnumber ,
-.Fn isphonogram ,
-.Fn isrune ,
-.Fn isspecial
-and
-.Fn toascii ,
-conform to
-.St -isoC .
diff --git a/locale/digittoint.3 b/locale/digittoint.3
deleted file mode 100644 (file)
index 3e86f72..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)digittoint.3        8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/digittoint.3,v 1.6 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd April 6, 2001
-.Dt DIGITTOINT 3
-.Os
-.Sh NAME
-.Nm digittoint ,
-.Nm digittoint_l
-.Nd convert a numeric character to its integer value
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fo digittoint
-.Fa "int c"
-.Fc
-.In xlocale.h
-.In ctype.h
-.Ft int
-.Fo digittoint_l
-.Fa "int c"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn digittoint
-function converts a numeric character to its corresponding integer value.
-The character can be any decimal digit or hexadecimal digit.
-With hexadecimal characters, the case of the values does not matter.
-.Pp
-While the
-.Fn digittoint
-function uses the current locale, the
-.Fn digittoint_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn digittoint
-function always returns an integer from the range of 0 to 15.
-If the given character was not a digit as defined by
-.Xr isxdigit 3 ,
-the function will return 0.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isdigit 3 ,
-.Xr isxdigit 3 ,
-.Xr xlocale 3
diff --git a/locale/euc-fbsd.c b/locale/euc-fbsd.c
deleted file mode 100644 (file)
index 1b60aa3..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)euc.c      8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/param.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-static size_t  _EUC_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _EUC_mbsinit(const mbstate_t *, locale_t);
-static size_t  _EUC_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       int     count[4];
-       wchar_t bits[4];
-       wchar_t mask;
-} _EucInfo;
-
-typedef struct {
-       wchar_t ch;
-       int     set;
-       int     want;
-} _EucState;
-
-/* This will be called by the XL_RELEASE() macro to free the extra storage */
-static void
-_EUC_free_extra(struct __xlocale_st_runelocale *xrl)
-{
-       free(xrl->_CurrentRuneLocale.__variable);
-}
-
-__private_extern__ int
-_EUC_init(struct __xlocale_st_runelocale *xrl)
-{
-       _EucInfo *ei;
-       int x, new__mb_cur_max;
-       char *v, *e;
-       _RuneLocale *rl = &xrl->_CurrentRuneLocale;
-
-       if (rl->__variable == NULL)
-               return (EFTYPE);
-
-       v = (char *)rl->__variable;
-
-       while (*v == ' ' || *v == '\t')
-               ++v;
-
-       if ((ei = malloc(sizeof(_EucInfo))) == NULL)
-               return (errno == 0 ? ENOMEM : errno);
-
-       new__mb_cur_max = 0;
-       for (x = 0; x < 4; ++x) {
-               ei->count[x] = (int)strtol(v, &e, 0);
-               if (v == e || !(v = e)) {
-                       free(ei);
-                       return (EFTYPE);
-               }
-               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);
-               if (v == e || !(v = e)) {
-                       free(ei);
-                       return (EFTYPE);
-               }
-               while (*v == ' ' || *v == '\t')
-                       ++v;
-       }
-       ei->mask = (int)strtol(v, &e, 0);
-       if (v == e || !(v = e)) {
-               free(ei);
-               return (EFTYPE);
-       }
-       rl->__variable = ei;
-       rl->__variable_len = sizeof(_EucInfo);
-       xrl->__mb_cur_max = new__mb_cur_max;
-       xrl->__mbrtowc = _EUC_mbrtowc;
-       xrl->__wcrtomb = _EUC_wcrtomb;
-       xrl->__mbsinit = _EUC_mbsinit;
-       xrl->__mb_sb_limit = 256;
-       xrl->__free_extra = (__free_extra_t)_EUC_free_extra;
-       return (0);
-}
-
-static int
-_EUC_mbsinit(const mbstate_t *ps, locale_t loc __unused)
-{
-
-       return (ps == NULL || ((const _EucState *)ps)->want == 0);
-}
-
-#define        _SS2    0x008e
-#define        _SS3    0x008f
-
-#define        GR_BITS 0x80808080 /* XXX: to be fixed */
-
-static __inline int
-_euc_set(u_int c)
-{
-
-       c &= 0xff;
-       return ((c & 0x80) ? c == _SS3 ? 3 : c == _SS2 ? 2 : 1 : 0);
-}
-
-static size_t
-_EUC_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc)
-{
-       _EucState *es;
-       int i, set, want;
-       wchar_t wc;
-       const char *os;
-       struct __xlocale_st_runelocale *rl = loc->__lc_ctype;
-       _EucInfo *CEI = (_EucInfo *)rl->_CurrentRuneLocale.__variable;
-
-       es = (_EucState *)ps;
-
-       if (es->want < 0 || es->want > rl->__mb_cur_max || es->set < 0 ||
-           es->set > 3) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       os = s;
-
-       if (es->want == 0) {
-               want = CEI->count[set = _euc_set(*s)];
-               if (set == 2 || set == 3) {
-                       --want;
-                       if (--n == 0) {
-                               /* Incomplete multibyte sequence */
-                               es->set = set;
-                               es->want = want;
-                               es->ch = 0;
-                               return ((size_t)-2);
-                       }
-                       ++s;
-                       if (*s == '\0') {
-                               errno = EILSEQ;
-                               return ((size_t)-1);
-                       }
-               }
-               wc = (unsigned char)*s++;
-       } else {
-               set = es->set;
-               want = es->want;
-               wc = es->ch;
-       }
-       for (i = (es->want == 0) ? 1 : 0; i < MIN(want, n); i++) {
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (wc << 8) | (unsigned char)*s++;
-       }
-       if (i < want) {
-               /* Incomplete multibyte sequence */
-               es->set = set;
-               es->want = want - i;
-               es->ch = wc;
-               return ((size_t)-2);
-       }
-       wc = (wc & ~CEI->mask) | CEI->bits[set];
-       if (pwc != NULL)
-               *pwc = wc;
-       es->want = 0;
-       return (wc == L'\0' ? 0 : s - os);
-}
-
-static size_t
-_EUC_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
-{
-       _EucState *es;
-       wchar_t m, nm;
-       int i, len;
-       _EucInfo *CEI = (_EucInfo *)loc->__lc_ctype->_CurrentRuneLocale.__variable;
-
-       es = (_EucState *)ps;
-
-       if (es->want != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-
-       m = wc & CEI->mask;
-       nm = wc & ~m;
-
-       if (m == CEI->bits[1]) {
-CodeSet1:
-               /* Codeset 1: The first byte must have 0x80 in it. */
-               i = len = CEI->count[1];
-               while (i-- > 0)
-                       *s++ = (nm >> (i << 3)) | 0x80;
-       } else {
-               if (m == CEI->bits[0])
-                       i = len = CEI->count[0];
-               else if (m == CEI->bits[2]) {
-                       i = len = CEI->count[2];
-                       *s++ = _SS2;
-                       --i;
-                       /* SS2 designates G2 into GR */
-                       nm |= GR_BITS;
-               } else if (m == CEI->bits[3]) {
-                       i = len = CEI->count[3];
-                       *s++ = _SS3;
-                       --i;
-                       /* SS3 designates G3 into GR */
-                       nm |= GR_BITS;
-               } else
-                       goto CodeSet1;  /* Bletch */
-               while (i-- > 0)
-                       *s++ = (nm >> (i << 3)) & 0xff;
-       }
-       return (len);
-}
diff --git a/locale/euc.5 b/locale/euc.5
deleted file mode 120000 (symlink)
index 9e5aafd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./euc.5
\ No newline at end of file
diff --git a/locale/fix_grouping-fbsd.c b/locale/fix_grouping-fbsd.c
deleted file mode 100644 (file)
index 180c800..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/fix_grouping.c,v 1.8 2003/06/26 10:46:16 phantom Exp $");
-
-#include <ctype.h>
-#include <limits.h>
-#include <stddef.h>
-
-static const char nogrouping[] = { '\0' };
-static const char __nogrouping[] = { CHAR_MAX, '\0' };
-
-/*
- * Internal helper used to convert grouping sequences from string
- * representation into POSIX specified form, i.e.
- *
- * "3;3;-1" -> "\003\003\177\000"
- */
-
-const char *
-__fix_locale_grouping_str(const char *str)
-{
-       char *src, *dst;
-       char n;
-
-       if (str == NULL || *str == '\0') {
-               return nogrouping;
-       }
-
-       for (src = (char*)str, dst = (char*)str; *src != '\0'; src++) {
-
-               /* input string examples: "3;3", "3;2;-1" */
-               if (*src == ';')
-                       continue;
-       
-               if (*src == '-' && *(src+1) == '1') {
-                       *dst++ = CHAR_MAX;
-                       src++;
-                       continue;
-               }
-
-               if (!isdigit((unsigned char)*src)) {
-                       /* broken grouping string */
-                       return nogrouping;
-               }
-
-               /* assume all numbers <= 99 */
-               n = *src - '0';
-               if (isdigit((unsigned char)*(src+1))) {
-                       src++;
-                       n *= 10;
-                       n += *src - '0';
-               }
-
-               *dst = n;
-               /* NOTE: assume all input started with "0" as 'no grouping' */
-               if (*dst == '\0')
-                       return (dst == (char*)str) ? nogrouping : str;
-               dst++;
-       }
-       *dst = '\0';
-       return str;
-}
-
-/*
- * internal helpers for SUSv3 compatibility.  Since "nogrouping" needs to
- * be just an empty string, we provide a routine to substitute __nogrouping
- * so we don't have to modify code that expects CHAR_MAX.
- */
-__private_extern__ const char *
-__fix_nogrouping(const char *str)
-{
-       return ((str == NULL || *str == '\0') ? __nogrouping : str);
-}
diff --git a/locale/gb18030-fbsd.c b/locale/gb18030-fbsd.c
deleted file mode 100644 (file)
index c63d050..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-/*
- * PRC National Standard GB 18030-2000 encoding of Chinese text.
- *
- * See gb18030(5) for details.
- */
-
-#include <sys/param.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-#define GB18030_MB_CUR_MAX     4
-
-static size_t  _GB18030_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _GB18030_mbsinit(const mbstate_t *, locale_t);
-static size_t  _GB18030_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       int     count;
-       u_char  bytes[4];
-} _GB18030State;
-
-__private_extern__ int
-_GB18030_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _GB18030_mbrtowc;
-       xrl->__wcrtomb = _GB18030_wcrtomb;
-       xrl->__mbsinit = _GB18030_mbsinit;
-       xrl->__mb_cur_max = GB18030_MB_CUR_MAX;
-       xrl->__mb_sb_limit = 128;
-
-       return (0);
-}
-
-static int
-_GB18030_mbsinit(const mbstate_t *ps, locale_t loc __unused)
-{
-
-       return (ps == NULL || ((const _GB18030State *)ps)->count == 0);
-}
-
-static size_t
-_GB18030_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
-    size_t n, mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _GB18030State *gs;
-       wchar_t wch;
-       int ch, len, ocount;
-       size_t ncopy;
-
-       gs = (_GB18030State *)ps;
-
-       if (gs->count < 0 || gs->count > sizeof(gs->bytes)) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       ncopy = MIN(MIN(n, GB18030_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
-       memcpy(gs->bytes + gs->count, s, ncopy);
-       ocount = gs->count;
-       gs->count += ncopy;
-       s = (char *)gs->bytes;
-       n = gs->count;
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       /*
-        * Single byte:         [00-7f]
-        * Two byte:            [81-fe][40-7e,80-fe]
-        * Four byte:           [81-fe][30-39][81-fe][30-39]
-        */
-       ch = (unsigned char)*s++;
-       if (ch <= 0x7f) {
-               len = 1;
-               wch = ch;
-       } else if (ch >= 0x81 && ch <= 0xfe) {
-               wch = ch;
-               if (n < 2)
-                       return ((size_t)-2);
-               ch = (unsigned char)*s++;
-               if ((ch >= 0x40 && ch <= 0x7e) || (ch >= 0x80 && ch <= 0xfe)) {
-                       wch = (wch << 8) | ch;
-                       len = 2;
-               } else if (ch >= 0x30 && ch <= 0x39) {
-                       /*
-                        * Strip high bit off the wide character we will
-                        * eventually output so that it is positive when
-                        * cast to wint_t on 32-bit twos-complement machines.
-                        */
-                       wch = ((wch & 0x7f) << 8) | ch;
-                       if (n < 3)
-                               return ((size_t)-2);
-                       ch = (unsigned char)*s++;
-                       if (ch < 0x81 || ch > 0xfe)
-                               goto ilseq;
-                       wch = (wch << 8) | ch;
-                       if (n < 4)
-                               return ((size_t)-2);
-                       ch = (unsigned char)*s++;
-                       if (ch < 0x30 || ch > 0x39)
-                               goto ilseq;
-                       wch = (wch << 8) | ch;
-                       len = 4;
-               } else
-                       goto ilseq;
-       } else
-               goto ilseq;
-
-       if (pwc != NULL)
-               *pwc = wch;
-       gs->count = 0;
-       return (wch == L'\0' ? 0 : len - ocount);
-ilseq:
-       errno = EILSEQ;
-       return ((size_t)-1);
-}
-
-static size_t
-_GB18030_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _GB18030State *gs;
-       size_t len;
-       int c;
-
-       gs = (_GB18030State *)ps;
-
-       if (gs->count != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       if ((wc & ~0x7fffffff) != 0)
-               goto ilseq;
-       if (wc & 0x7f000000) {
-               /* Replace high bit that mbrtowc() removed. */
-               wc |= 0x80000000;
-               c = (wc >> 24) & 0xff;
-               if (c < 0x81 || c > 0xfe)
-                       goto ilseq;
-               *s++ = c;
-               c = (wc >> 16) & 0xff;
-               if (c < 0x30 || c > 0x39)
-                       goto ilseq;
-               *s++ = c;
-               c = (wc >> 8) & 0xff;
-               if (c < 0x81 || c > 0xfe)
-                       goto ilseq;
-               *s++ = c;
-               c = wc & 0xff;
-               if (c < 0x30 || c > 0x39)
-                       goto ilseq;
-               *s++ = c;
-               len = 4;
-       } else if (wc & 0x00ff0000)
-               goto ilseq;
-       else if (wc & 0x0000ff00) {
-               c = (wc >> 8) & 0xff;
-               if (c < 0x81 || c > 0xfe)
-                       goto ilseq;
-               *s++ = c;
-               c = wc & 0xff;
-               if (c < 0x40 || c == 0x7f || c == 0xff)
-                       goto ilseq;
-               *s++ = c;
-               len = 2;
-       } else if (wc <= 0x7f) {
-               *s++ = wc;
-               len = 1;
-       } else
-               goto ilseq;
-
-       return (len);
-ilseq:
-       errno = EILSEQ;
-       return ((size_t)-1);
-}
diff --git a/locale/gb18030.5 b/locale/gb18030.5
deleted file mode 120000 (symlink)
index f277ba1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gb18030.5
\ No newline at end of file
diff --git a/locale/gb2312-fbsd.c b/locale/gb2312-fbsd.c
deleted file mode 100644 (file)
index a84b1cf..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * Copyright (c) 2004 Tim J. Robbins. All rights reserved.
- * Copyright (c) 2003 David Xu <davidxu@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-#define GB2312_MB_CUR_MAX      2
-
-static size_t  _GB2312_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _GB2312_mbsinit(const mbstate_t *, locale_t);
-static size_t  _GB2312_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-typedef struct {
-       int     count;
-       u_char  bytes[2];
-} _GB2312State;
-
-__private_extern__ int
-_GB2312_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _GB2312_mbrtowc;
-       xrl->__wcrtomb = _GB2312_wcrtomb;
-       xrl->__mbsinit = _GB2312_mbsinit;
-       xrl->__mb_cur_max = GB2312_MB_CUR_MAX;
-       xrl->__mb_sb_limit = 128;
-       return (0);
-}
-
-static int
-_GB2312_mbsinit(const mbstate_t *ps, locale_t loc __unused)
-{
-
-       return (ps == NULL || ((const _GB2312State *)ps)->count == 0);
-}
-
-static __inline int
-_GB2312_check(const char *str, size_t n)
-{
-       const u_char *s = (const u_char *)str;
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return (-2);
-       if (s[0] >= 0xa1 && s[0] <= 0xfe) {
-               if (n < 2)
-                       /* Incomplete multibyte sequence */
-                       return (-2);
-               if (s[1] < 0xa1 || s[1] > 0xfe)
-                       /* Invalid multibyte sequence */
-                       return (-1);
-               return (2);
-       } else if (s[0] & 0x80) {
-               /* Invalid multibyte sequence */
-               return (-1);
-       } 
-       return (1);
-}
-
-static size_t
-_GB2312_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _GB2312State *gs;
-       wchar_t wc;
-       int i, len, ocount;
-       size_t ncopy;
-
-       gs = (_GB2312State *)ps;
-
-       if (gs->count < 0 || gs->count > sizeof(gs->bytes)) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       ncopy = MIN(MIN(n, GB2312_MB_CUR_MAX), sizeof(gs->bytes) - gs->count);
-       memcpy(gs->bytes + gs->count, s, ncopy);
-       ocount = gs->count;
-       gs->count += ncopy;
-       s = (char *)gs->bytes;
-       n = gs->count;
-
-       if ((len = _GB2312_check(s, n)) < 0)
-               return ((size_t)len);
-       wc = 0;
-       i = len;
-       while (i-- > 0)
-               wc = (wc << 8) | (unsigned char)*s++;
-       if (pwc != NULL)
-               *pwc = wc;
-       gs->count = 0;
-       return (wc == L'\0' ? 0 : len - ocount);
-}
-
-static size_t
-_GB2312_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _GB2312State *gs;
-
-       gs = (_GB2312State *)ps;
-
-       if (gs->count != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       if (wc & 0x8000) {
-               *s++ = (wc >> 8) & 0xff;
-               *s = wc & 0xff;
-               return (2);
-       }
-       *s = wc & 0xff;
-       return (1);
-}
diff --git a/locale/gb2312.5 b/locale/gb2312.5
deleted file mode 120000 (symlink)
index bfc08ae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gb2312.5
\ No newline at end of file
diff --git a/locale/gbk-fbsd.c b/locale/gbk-fbsd.c
deleted file mode 100644 (file)
index c38338b..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <errno.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-static size_t  _GBK_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _GBK_mbsinit(const mbstate_t *, locale_t);
-static size_t  _GBK_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       wchar_t ch;
-} _GBKState;
-
-__private_extern__ int
-_GBK_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _GBK_mbrtowc;
-       xrl->__wcrtomb = _GBK_wcrtomb;
-       xrl->__mbsinit = _GBK_mbsinit;
-       xrl->__mb_cur_max = 2;
-       xrl->__mb_sb_limit = 128;
-       return (0);
-}
-
-static int
-_GBK_mbsinit(const mbstate_t *ps, locale_t loc __unused)
-{
-
-       return (ps == NULL || ((const _GBKState *)ps)->ch == 0);
-}
-
-static __inline int
-_gbk_check(u_int c)
-{
-
-       c &= 0xff;
-       return ((c >= 0x81 && c <= 0xfe) ? 2 : 1);
-}
-
-static size_t
-_GBK_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _GBKState *gs;
-       wchar_t wc;
-       size_t len;
-
-       gs = (_GBKState *)ps;
-
-       if ((gs->ch & ~0xFF) != 0) {
-               /* Bad conversion state. */
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       if (gs->ch != 0) {
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (gs->ch << 8) | (*s & 0xFF);
-               if (pwc != NULL)
-                       *pwc = wc;
-               gs->ch = 0;
-               return (1);
-       }
-
-       len = (size_t)_gbk_check(*s);
-       wc = *s++ & 0xff;
-       if (len == 2) {
-               if (n < 2) {
-                       /* Incomplete multibyte sequence */
-                       gs->ch = wc;
-                       return ((size_t)-2);
-               }
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (wc << 8) | (*s++ & 0xff);
-               if (pwc != NULL)
-                       *pwc = wc;
-                return (2);
-       } else {
-               if (pwc != NULL)
-                       *pwc = wc;
-               return (wc == L'\0' ? 0 : 1);
-       }
-}
-
-static size_t
-_GBK_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _GBKState *gs;
-
-       gs = (_GBKState *)ps;
-
-       if (gs->ch != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       if (wc & 0x8000) {
-               *s++ = (wc >> 8) & 0xff;
-               *s = wc & 0xff;
-               return (2);
-       }
-       *s = wc & 0xff;
-       return (1);
-}
diff --git a/locale/gbk.5 b/locale/gbk.5
deleted file mode 120000 (symlink)
index 8cd7f55..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gbk.5
\ No newline at end of file
diff --git a/locale/isalnum.3 b/locale/isalnum.3
deleted file mode 100644 (file)
index 961b9b3..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isalnum.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isalnum.3,v 1.24 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISALNUM 3
-.Os
-.Sh NAME
-.Nm isalnum
-.Nd alphanumeric character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isalnum "int c"
-.Sh DESCRIPTION
-The
-.Fn isalnum
-function tests for any character for which
-.Xr isalpha 3
-or
-.Xr isdigit 3
-is true.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''"
-.It "\&065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8'' \t071\ ``9''"
-.It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
-.It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''"
-.It "\&113\ ``K'' \t114\ ``L'' \t115\ ``M'' \t116\ ``N'' \t117\ ``O''"
-.It "\&120\ ``P'' \t121\ ``Q'' \t122\ ``R'' \t123\ ``S'' \t124\ ``T''"
-.It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''"
-.It "\&132\ ``Z'' \t141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d''"
-.It "\&145\ ``e'' \t146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i''"
-.It "\&152\ ``j'' \t153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n''"
-.It "\&157\ ``o'' \t160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s''"
-.It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''"
-.It "\&171\ ``y'' \t172\ ``z''"
-.El
-.Sh RETURN VALUES
-The
-.Fn isalnum
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswalnum
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr isalpha 3 ,
-.Xr isdigit 3 ,
-.Xr iswalnum 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isalnum
-function conforms to
-.St -isoC .
diff --git a/locale/isalpha.3 b/locale/isalpha.3
deleted file mode 100644 (file)
index 3d9ad13..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isalpha.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isalpha.3,v 1.23 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISALPHA 3
-.Os
-.Sh NAME
-.Nm isalpha
-.Nd alphabetic character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isalpha "int c"
-.Sh DESCRIPTION
-The
-.Fn isalpha
-function tests for any character for which
-.Xr isupper 3
-or
-.Xr islower 3
-is true.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
-.It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''"
-.It "\&113\ ``K'' \t114\ ``L'' \t115\ ``M'' \t116\ ``N'' \t117\ ``O''"
-.It "\&120\ ``P'' \t121\ ``Q'' \t122\ ``R'' \t123\ ``S'' \t124\ ``T''"
-.It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''"
-.It "\&132\ ``Z'' \t141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d''"
-.It "\&145\ ``e'' \t146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i''"
-.It "\&152\ ``j'' \t153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n''"
-.It "\&157\ ``o'' \t160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s''"
-.It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''"
-.It "\&171\ ``y'' \t172\ ``z''"
-.El
-.Sh RETURN VALUES
-The
-.Fn isalpha
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswalpha
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr islower 3 ,
-.Xr isupper 3 ,
-.Xr iswalpha 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isalpha
-function conforms to
-.St -isoC .
diff --git a/locale/isascii.3 b/locale/isascii.3
deleted file mode 120000 (symlink)
index 5e23aeb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./isascii.3
\ No newline at end of file
diff --git a/locale/isblank.3 b/locale/isblank.3
deleted file mode 100644 (file)
index 5a4aef2..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isblank.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isblank.3,v 1.26 2009/11/11 11:31:02 roam Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISBLANK 3
-.Os
-.Sh NAME
-.Nm isblank
-.Nd space or tab character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isblank "int c"
-.Sh DESCRIPTION
-The
-.Fn isblank
-function tests for a space or tab character.
-For any locale, this includes the following standard characters:
-.Pp
-.Bl -column \&`\et''___ \&``\et''___
-.It "\&``\et''\t`` ''"
-.El
-.Pp
-In the "C" locale, a successful
-.Fn isblank
-test is limited to these characters only.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Sh RETURN VALUES
-The
-.Fn isblank
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswblank
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswblank 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isblank
-function
-conforms to
-.St -isoC-99 .
diff --git a/locale/iscntrl.3 b/locale/iscntrl.3
deleted file mode 100644 (file)
index bb7045d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)iscntrl.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/iscntrl.3,v 1.22 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISCNTRL 3
-.Os
-.Sh NAME
-.Nm iscntrl
-.Nd control character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn iscntrl "int c"
-.Sh DESCRIPTION
-The
-.Fn iscntrl
-function tests for any control character.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&000\ NUL \t001\ SOH \t002\ STX \t003\ ETX \t004\ EOT"
-.It "\&005\ ENQ \t006\ ACK \t007\ BEL \t010\ BS \t011\ HT"
-.It "\&012\ NL \t013\ VT \t014\ NP \t015\ CR \t016\ SO"
-.It "\&017\ SI \t020\ DLE \t021\ DC1 \t022\ DC2 \t023\ DC3"
-.It "\&024\ DC4 \t025\ NAK \t026\ SYN \t027\ ETB \t030\ CAN"
-.It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS"
-.It "\&036\ RS \t037\ US \t177\ DEL"
-.El
-.Sh RETURN VALUES
-The
-.Fn iscntrl
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswcntrl
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswcntrl 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn iscntrl
-function conforms to
-.St -isoC .
diff --git a/locale/isdigit.3 b/locale/isdigit.3
deleted file mode 100644 (file)
index 0fffb88..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isdigit.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isdigit.3,v 1.25 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd May 4, 2007
-.Dt ISDIGIT 3
-.Os
-.Sh NAME
-.Nm isdigit, isnumber
-.Nd decimal-digit character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isdigit "int c"
-.Ft int
-.Fn isnumber "int c"
-.Sh DESCRIPTION
-The
-.Fn isdigit
-function tests for a decimal digit character.
-Regardless of locale, this includes the following characters only:
-.Pp
-.Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
-.It "\&``0''\t``1''\t``2''\t``3''\t``4''"
-.It "\&``5''\t``6''\t``7''\t``8''\t``9''"
-.El
-.Pp
-The
-.Fn isnumber
-function behaves similarly to
-.Fn isdigit ,
-but may recognize additional characters, depending on the current locale
-setting.
-.Pp
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Sh RETURN VALUES
-The
-.Fn isdigit
-and
-.Fn isnumber
-functions return zero if the character tests false and
-return non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswdigit
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswdigit 3 ,
-.Xr multibyte 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isdigit
-function conforms to
-.St -isoC .
-.Sh HISTORY
-The
-.Fn isnumber
-function appeared in
-.Bx 4.4 .
diff --git a/locale/isgraph.3 b/locale/isgraph.3
deleted file mode 100644 (file)
index f20973f..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isgraph.3  8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/locale/isgraph.3,v 1.25 2009/11/13 09:03:50 roam Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISGRAPH 3
-.Os
-.Sh NAME
-.Nm isgraph
-.Nd printing character test (space character exclusive)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isgraph "int c"
-.Sh DESCRIPTION
-The
-.Fn isgraph
-function tests for any printing character except space
-.Pq Ql "\ "
-and other
-locale-specific space-like characters.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
-.It "\&046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)'' \t052\ ``*''"
-.It "\&053\ ``+'' \t054\ ``,'' \t055\ ``-'' \t056\ ``.'' \t057\ ``/''"
-.It "\&060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3'' \t064\ ``4''"
-.It "\&065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8'' \t071\ ``9''"
-.It "\&072\ ``:'' \t073\ ``;'' \t074\ ``<'' \t075\ ``='' \t076\ ``>''"
-.It "\&077\ ``?'' \t100\ ``@'' \t101\ ``A'' \t102\ ``B'' \t103\ ``C''"
-.It "\&104\ ``D'' \t105\ ``E'' \t106\ ``F'' \t107\ ``G'' \t110\ ``H''"
-.It "\&111\ ``I'' \t112\ ``J'' \t113\ ``K'' \t114\ ``L'' \t115\ ``M''"
-.It "\&116\ ``N'' \t117\ ``O'' \t120\ ``P'' \t121\ ``Q'' \t122\ ``R''"
-.It "\&123\ ``S'' \t124\ ``T'' \t125\ ``U'' \t126\ ``V'' \t127\ ``W''"
-.It "\&130\ ``X'' \t131\ ``Y'' \t132\ ``Z'' \t133\ ``['' \t134\ ``\e\|''"
-.It "\&135\ ``]'' \t136\ ``^'' \t137\ ``_'' \t140\ ```'' \t141\ ``a''"
-.It "\&142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e'' \t146\ ``f''"
-.It "\&147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j'' \t153\ ``k''"
-.It "\&154\ ``l'' \t155\ ``m'' \t156\ ``n'' \t157\ ``o'' \t160\ ``p''"
-.It "\&161\ ``q'' \t162\ ``r'' \t163\ ``s'' \t164\ ``t'' \t165\ ``u''"
-.It "\&166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y'' \t172\ ``z''"
-.It "\&173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''"
-.El
-.Sh RETURN VALUES
-The
-.Fn isgraph
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswgraph
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswgraph 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isgraph
-function conforms to
-.St -isoC .
diff --git a/locale/isideogram.3 b/locale/isideogram.3
deleted file mode 100644 (file)
index 9ee26b5..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-.\"
-.\" Copyright (c) 2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/isideogram.3,v 1.4 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd March 30, 2004
-.Dt ISIDEOGRAM 3
-.Os
-.Sh NAME
-.Nm isideogram
-.Nd ideographic character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isideogram "int c"
-.Sh DESCRIPTION
-The
-.Fn isideogram
-function tests for an ideographic character.
-.Sh RETURN VALUES
-The
-.Fn isideogram
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isphonogram 3 ,
-.Xr iswideogram 3 ,
-.Xr isalnum_l
-.Sh HISTORY
-The
-.Fn isideogram
-function appeared in
-.Bx 4.4 .
diff --git a/locale/islower.3 b/locale/islower.3
deleted file mode 100644 (file)
index 066d7d6..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)islower.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/islower.3,v 1.22 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISLOWER 3
-.Os
-.Sh NAME
-.Nm islower
-.Nd lower-case character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn islower "int c"
-.Sh DESCRIPTION
-The
-.Fn islower
-function tests for any lower-case letters.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(with their numeric values shown in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e''"
-.It "\&146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j''"
-.It "\&153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n'' \t157\ ``o''"
-.It "\&160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s'' \t164\ ``t''"
-.It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''"
-.It "\&172\ ``z''"
-.El
-.Sh RETURN VALUES
-The
-.Fn islower
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswlower
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswlower 3 ,
-.Xr tolower 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn islower
-function conforms to
-.St -isoC .
diff --git a/locale/isphonogram.3 b/locale/isphonogram.3
deleted file mode 100644 (file)
index 39db048..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-.\"
-.\" Copyright (c) 2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/isphonogram.3,v 1.3 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd March 30, 2004
-.Dt ISPHONOGRAM 3
-.Os
-.Sh NAME
-.Nm isphonogram
-.Nd phonographic character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isphonogram "int c"
-.Sh DESCRIPTION
-The
-.Fn isphonogram
-function tests for a phonographic character.
-.Sh RETURN VALUES
-The
-.Fn isphonogram
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isideogram 3 ,
-.Xr iswphonogram 3 ,
-.Xr isalnum_l
-.Sh HISTORY
-The
-.Fn isphonogram
-function appeared in
-.Bx 4.4 .
diff --git a/locale/isprint.3 b/locale/isprint.3
deleted file mode 100644 (file)
index 25ae0b5..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isprint.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isprint.3,v 1.26 2009/11/13 09:07:33 roam Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISPRINT 3
-.Os
-.Sh NAME
-.Nm isprint
-.Nd printing character test (space character inclusive)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isprint "int c"
-.Sh DESCRIPTION
-The
-.Fn isprint
-function tests for any printing character, including space
-.Pq Ql "\ " .
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&040\ sp \t041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$''"
-.It "\&045\ ``%'' \t046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)''"
-.It "\&052\ ``*'' \t053\ ``+'' \t054\ ``,'' \t055\ ``-'' \t056\ ``.''"
-.It "\&057\ ``/'' \t060\ ``0'' \t061\ ``1'' \t062\ ``2'' \t063\ ``3''"
-.It "\&064\ ``4'' \t065\ ``5'' \t066\ ``6'' \t067\ ``7'' \t070\ ``8''"
-.It "\&071\ ``9'' \t072\ ``:'' \t073\ ``;'' \t074\ ``<'' \t075\ ``=''"
-.It "\&076\ ``>'' \t077\ ``?'' \t100\ ``@'' \t101\ ``A'' \t102\ ``B''"
-.It "\&103\ ``C'' \t104\ ``D'' \t105\ ``E'' \t106\ ``F'' \t107\ ``G''"
-.It "\&110\ ``H'' \t111\ ``I'' \t112\ ``J'' \t113\ ``K'' \t114\ ``L''"
-.It "\&115\ ``M'' \t116\ ``N'' \t117\ ``O'' \t120\ ``P'' \t121\ ``Q''"
-.It "\&122\ ``R'' \t123\ ``S'' \t124\ ``T'' \t125\ ``U'' \t126\ ``V''"
-.It "\&127\ ``W'' \t130\ ``X'' \t131\ ``Y'' \t132\ ``Z'' \t133\ ``[''"
-.It "\&134\ ``\e\|'' \t135\ ``]'' \t136\ ``^'' \t137\ ``_'' \t140\ ```''"
-.It "\&141\ ``a'' \t142\ ``b'' \t143\ ``c'' \t144\ ``d'' \t145\ ``e''"
-.It "\&146\ ``f'' \t147\ ``g'' \t150\ ``h'' \t151\ ``i'' \t152\ ``j''"
-.It "\&153\ ``k'' \t154\ ``l'' \t155\ ``m'' \t156\ ``n'' \t157\ ``o''"
-.It "\&160\ ``p'' \t161\ ``q'' \t162\ ``r'' \t163\ ``s'' \t164\ ``t''"
-.It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''"
-.It "\&172\ ``z'' \t173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''"
-.El
-.Sh RETURN VALUES
-The
-.Fn isprint
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswprint
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswprint 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isprint
-function conforms to
-.St -isoC .
diff --git a/locale/ispunct.3 b/locale/ispunct.3
deleted file mode 100644 (file)
index b4fcfa3..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)ispunct.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/ispunct.3,v 1.23 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISPUNCT 3
-.Os
-.Sh NAME
-.Nm ispunct
-.Nd punctuation character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn ispunct "int c"
-.Sh DESCRIPTION
-The
-.Fn ispunct
-function tests for any printing character, except for space
-.Pq Ql "\ "
-or a
-character for which
-.Xr isalnum 3
-is true.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&041\ ``!'' \t042\ ``""'' \t043\ ``#'' \t044\ ``$'' \t045\ ``%''"
-.It "\&046\ ``&'' \t047\ ``''' \t050\ ``('' \t051\ ``)'' \t052\ ``*''"
-.It "\&053\ ``+'' \t054\ ``,'' \t055\ ``-'' \t056\ ``.'' \t057\ ``/''"
-.It "\&072\ ``:'' \t073\ ``;'' \t074\ ``<'' \t075\ ``='' \t076\ ``>''"
-.It "\&077\ ``?'' \t100\ ``@'' \t133\ ``['' \t134\ ``\e\|'' \t135\ ``]''"
-.It "\&136\ ``^'' \t137\ ``_'' \t140\ ```'' \t173\ ``{'' \t174\ ``|''"
-.It "\&175\ ``}'' \t176\ ``~''"
-.El
-.Sh RETURN VALUES
-The
-.Fn ispunct
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswpunct
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswpunct 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn ispunct
-function conforms to
-.St -isoC .
diff --git a/locale/isrune.3 b/locale/isrune.3
deleted file mode 100644 (file)
index a98a159..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-.\"
-.\" Copyright (c) 2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/isrune.3,v 1.3 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd March 30, 2004
-.Dt ISRUNE 3
-.Os
-.Sh NAME
-.Nm isrune
-.Nd valid character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isrune "int c"
-.Sh DESCRIPTION
-The
-.Fn isrune
-function tests for any character that is valid in the current
-character set.
-In the
-.Tn ASCII
-character set, this is equivalent to
-.Fn isascii .
-.Sh RETURN VALUES
-The
-.Fn isrune
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isascii 3 ,
-.Xr iswrune 3 ,
-.Xr ascii 7 ,
-.Xr isalnum_l
-.Sh HISTORY
-The
-.Fn isrune
-function appeared in
-.Bx 4.4 .
diff --git a/locale/isspace.3 b/locale/isspace.3
deleted file mode 100644 (file)
index f6fa79a..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isspace.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isspace.3,v 1.22 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISSPACE 3
-.Os
-.Sh NAME
-.Nm isspace
-.Nd white-space character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isspace "int c"
-.Sh DESCRIPTION
-The
-.Fn isspace
-function tests for the white-space characters.
-For any locale, this includes the following standard characters:
-.Pp
-.Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___
-.It "\&``\et''\t``\en''\t``\ev''\t``\ef''\t``\er''\t`` ''"
-.El
-.Pp
-In the "C" locale,
-.Fn isspace
-successful test is limited to these characters only.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Sh RETURN VALUES
-The
-.Fn isspace
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswspace
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswspace 3 ,
-.Xr multibyte 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isspace
-function conforms to
-.St -isoC .
diff --git a/locale/isspecial.3 b/locale/isspecial.3
deleted file mode 100644 (file)
index 0a0ab37..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-.\"
-.\" Copyright (c) 2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/isspecial.3,v 1.3 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd March 30, 2004
-.Dt ISSPECIAL 3
-.Os
-.Sh NAME
-.Nm isspecial
-.Nd special character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isspecial "int c"
-.Sh DESCRIPTION
-The
-.Fn isspecial
-function tests for a special character.
-.Sh RETURN VALUES
-The
-.Fn isspecial
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr iswspecial 3 ,
-.Xr isalnum_l
-.Sh HISTORY
-The
-.Fn isspecial
-function appeared in
-.Bx 4.4 .
diff --git a/locale/isupper.3 b/locale/isupper.3
deleted file mode 100644 (file)
index c3274c6..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isupper.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isupper.3,v 1.23 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISUPPER 3
-.Os
-.Sh NAME
-.Nm isupper
-.Nd upper-case character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isupper "int c"
-.Sh DESCRIPTION
-The
-.Fn isupper
-function tests for any upper-case letter.
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-In the ASCII character set, this includes the following characters
-(preceded by their numeric values, in octal):
-.Pp
-.Bl -column \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__ \&000_``0''__
-.It "\&101\ ``A'' \t102\ ``B'' \t103\ ``C'' \t104\ ``D'' \t105\ ``E''"
-.It "\&106\ ``F'' \t107\ ``G'' \t110\ ``H'' \t111\ ``I'' \t112\ ``J''"
-.It "\&113\ ``K'' \t114\ ``L'' \t115\ ``M'' \t116\ ``N'' \t117\ ``O''"
-.It "\&120\ ``P'' \t121\ ``Q'' \t122\ ``R'' \t123\ ``S'' \t124\ ``T''"
-.It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''"
-.It "\&132\ ``Z''"
-.El
-.Sh RETURN VALUES
-The
-.Fn isupper
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswupper
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswupper 3 ,
-.Xr toupper 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isupper
-function conforms to
-.St -isoC .
diff --git a/locale/iswalnum.3 b/locale/iswalnum.3
deleted file mode 100644 (file)
index d501ea9..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-.\"    $NetBSD: iswalnum.3,v 1.5 2002/07/10 14:46:10 yamt Exp $
-.\"
-.\" Copyright (c) 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isalnum.3  5.2 (Berkeley) 6/29/91
-.\" $FreeBSD: src/lib/libc/locale/iswalnum.3,v 1.6 2007/01/09 00:28:00 imp Exp $
-.\"
-.Dd October 3, 2002
-.Dt ISWALNUM 3
-.Os
-.Sh NAME
-.Nm iswalnum ,
-.Nm iswalpha ,
-.Nm iswascii ,
-.Nm iswblank ,
-.Nm iswcntrl ,
-.Nm iswdigit ,
-.Nm iswgraph ,
-.Nm iswhexnumber ,
-.Nm iswideogram ,
-.Nm iswlower ,
-.Nm iswnumber ,
-.Nm iswphonogram ,
-.Nm iswprint ,
-.Nm iswpunct ,
-.Nm iswrune ,
-.Nm iswspace ,
-.Nm iswspecial ,
-.Nm iswupper ,
-.Nm iswxdigit
-.Nd wide character classification utilities
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wctype.h
-.Ft int
-.Fn iswalnum "wint_t wc"
-.Ft int
-.Fn iswalpha "wint_t wc"
-.Ft int
-.Fn iswascii "wint_t wc"
-.Ft int
-.Fn iswblank "wint_t wc"
-.Ft int
-.Fn iswcntrl "wint_t wc"
-.Ft int
-.Fn iswdigit "wint_t wc"
-.Ft int
-.Fn iswgraph "wint_t wc"
-.Ft int
-.Fn iswhexnumber "wint_t wc"
-.Ft int
-.Fn iswideogram "wint_t wc"
-.Ft int
-.Fn iswlower "wint_t wc"
-.Ft int
-.Fn iswnumber "wint_t wc"
-.Ft int
-.Fn iswphonogram "wint_t wc"
-.Ft int
-.Fn iswprint "wint_t wc"
-.Ft int
-.Fn iswpunct "wint_t wc"
-.Ft int
-.Fn iswrune "wint_t wc"
-.Ft int
-.Fn iswspace "wint_t wc"
-.Ft int
-.Fn iswspecial "wint_t wc"
-.Ft int
-.Fn iswupper "wint_t wc"
-.Ft int
-.Fn iswxdigit "wint_t wc"
-.Sh DESCRIPTION
-The above functions are character classification utility functions,
-for use with wide characters
-.Vt ( wchar_t
-or
-.Vt wint_t ) .
-See the description for the similarly-named single byte classification
-functions (such as
-.Xr isalnum 3 ) ,
-for details.
-.Pp
-Extended locale versions of these functions are documented in
-.Xr iswalnum_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The functions return zero if the character tests false and
-return non-zero if the character tests true.
-.Sh SEE ALSO
-.Xr isalnum 3 ,
-.Xr isalpha 3 ,
-.Xr isascii 3 ,
-.Xr isblank 3 ,
-.Xr iscntrl 3 ,
-.Xr isdigit 3 ,
-.Xr isgraph 3 ,
-.Xr ishexnumber 3 ,
-.Xr isideogram 3 ,
-.Xr islower 3 ,
-.Xr isnumber 3 ,
-.Xr isphonogram 3 ,
-.Xr isprint 3 ,
-.Xr ispunct 3 ,
-.Xr isrune 3 ,
-.Xr isspace 3 ,
-.Xr isspecial 3 ,
-.Xr isupper 3 ,
-.Xr iswalnum_l 3 ,
-.Xr isxdigit 3 ,
-.Xr wctype 3
-.Sh STANDARDS
-These functions conform to
-.St -p1003.1-2001 ,
-except
-.Fn iswascii ,
-.Fn iswhexnumber ,
-.Fn iswideogram ,
-.Fn iswnumber ,
-.Fn iswphonogram ,
-.Fn iswrune ,
-and
-.Fn iswspecial ,
-which are
-.Fx
-extensions.
-.Sh CAVEATS
-The result of these functions is undefined unless
-the argument is
-.Dv WEOF
-or a valid
-.Vt wchar_t
-value for the current locale.
diff --git a/locale/isxdigit.3 b/locale/isxdigit.3
deleted file mode 100644 (file)
index b1c2faa..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)isxdigit.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/isxdigit.3,v 1.25 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt ISXDIGIT 3
-.Os
-.Sh NAME
-.Nm isxdigit, ishexnumber
-.Nd hexadecimal-digit character test
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fn isxdigit "int c"
-.Ft int
-.Fn ishexnumber "int c"
-.Sh DESCRIPTION
-The
-.Fn isxdigit
-function tests for any hexadecimal-digit character.
-Regardless of locale, this includes the following characters only:
-.Pp
-.Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
-.It "\&``0''\t``1''\t``2''\t``3''\t``4''"
-.It "\&``5''\t``6''\t``7''\t``8''\t``9''"
-.It "\&``A''\t``B''\t``C''\t``D''\t``E''"
-.It "\&``F''\t``a''\t``b''\t``c''\t``d''"
-.It "\&``e''\t``f''"
-.El
-.Pp
-The
-.Fn ishexnumber
-function behaves similarly to
-.Fn isxdigit ,
-but may recognize additional characters,
-depending on the current locale setting.
-.Pp
-The value of the argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Sh RETURN VALUES
-The
-.Fn isxdigit
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn iswxdigit
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isalnum_l 3 ,
-.Xr iswxdigit 3 ,
-.Xr ascii 7
-.Sh STANDARDS
-The
-.Fn isxdigit
-function conforms to
-.St -isoC .
-.Sh HISTORY
-The
-.Fn ishexnumber
-function appeared in
-.Bx 4.4 .
diff --git a/locale/ldpart-fbsd.c b/locale/ldpart-fbsd.c
deleted file mode 100644 (file)
index 6a08e15..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.15 2004/04/25 19:56:50 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "ldpart.h"
-#include "setlocale.h"
-
-static int split_lines(char *, const char *);
-
-__private_extern__ int
-__part_load_locale(const char *name,
-               unsigned char *using_locale,
-               char **locale_buf,
-               const char *category_filename,
-               int locale_buf_size_max,
-               int locale_buf_size_min,
-               const char **dst_localebuf)
-{
-       int             saverr, fd, i, num_lines;
-       char            *lbuf, *p;
-       const char      *plim;
-       char            filename[PATH_MAX];
-       struct stat     st;
-       size_t          namesize, bufsize;
-
-       /*
-        * Slurp the locale file into the cache.
-        */
-       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);
-       if ((fd = _open(filename, O_RDONLY)) < 0)
-               return (_LDP_ERROR);
-       if (_fstat(fd, &st) != 0)
-               goto bad_locale;
-       if (st.st_size <= 0) {
-               errno = EFTYPE;
-               goto bad_locale;
-       }
-       bufsize = namesize + st.st_size;
-       if ((lbuf = malloc(bufsize)) == NULL) {
-               errno = ENOMEM;
-               goto bad_locale;
-       }
-       (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;
-       /*
-        * Parse the locale file into localebuf.
-        */
-       if (plim[-1] != '\n') {
-               errno = EFTYPE;
-               goto bad_lbuf;
-       }
-       num_lines = split_lines(p, plim);
-       if (num_lines >= locale_buf_size_max)
-               num_lines = locale_buf_size_max;
-       else if (num_lines < locale_buf_size_min) {
-               errno = EFTYPE;
-               goto bad_lbuf;
-       }
-       (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;
-
-       return (_LDP_LOADED);
-
-bad_lbuf:
-       saverr = errno;
-       free(lbuf);
-       errno = saverr;
-bad_locale:
-       saverr = errno;
-       (void)_close(fd);
-       errno = saverr;
-
-       return (_LDP_ERROR);
-}
-
-static int
-split_lines(char *p, const char *plim)
-{
-       int i;
-
-       i = 0;
-       while (p < plim) {
-               if (*p == '\n') {
-                       *p = '\0';
-                       i++;
-               }
-               p++;
-       }
-       return (i);
-}
-
-__private_extern__ void
-__ldpart_free_extra(struct __xlocale_st_ldpart *lp)
-{
-       if (lp)
-               free(lp->_locale_buf);
-}
diff --git a/locale/ldpart.h b/locale/ldpart.h
deleted file mode 100644 (file)
index 938f735..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * 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.6 2003/06/13 00:14:07 jkh 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 *, unsigned char *, char **, const char *,
-                   int, int, const char **);
-
-#endif /* !_LDPART_H_ */
diff --git a/locale/lmessages-fbsd.c b/locale/lmessages-fbsd.c
deleted file mode 100644 (file)
index 2874ca6..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.14 2003/06/26 10:46:16 phantom Exp $");
-
-#include "xlocale_private.h"
-
-#include <stddef.h>
-#include <string.h>
-
-#include "ldpart.h"
-#include "lmessages.h"
-
-#define LCMESSAGES_SIZE_FULL (sizeof(struct lc_messages_T) / sizeof(char *))
-#define LCMESSAGES_SIZE_MIN \
-               (offsetof(struct lc_messages_T, yesstr) / sizeof(char *))
-
-static char empty[] = "";
-
-static const struct lc_messages_T _C_messages_locale = {
-       "^[yY]" ,       /* yesexpr */
-       "^[nN]" ,       /* noexpr */
-       "yes" ,         /* yesstr */
-       "no"            /* nostr */
-};
-
-__private_extern__ int
-__messages_load_locale(const char *name, locale_t loc)
-{
-       int ret;
-       struct __xlocale_st_messages *xp;
-       static struct __xlocale_st_messages *cache = NULL;
-
-       /* 'name' must be already checked. */
-       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-               loc->_messages_using_locale = 0;
-               XL_RELEASE(loc->__lc_messages);
-               loc->__lc_messages = NULL;
-               return (_LDP_CACHE);
-       }
-
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-       if (cache && cache->_messages_locale_buf && strcmp(name, cache->_messages_locale_buf) == 0) {
-               loc->_messages_using_locale = 1;
-               XL_RELEASE(loc->__lc_messages);
-               loc->__lc_messages = cache;
-               XL_RETAIN(loc->__lc_messages);
-               return (_LDP_CACHE);
-       }
-       if ((xp = (struct __xlocale_st_messages *)malloc(sizeof(*xp))) == NULL)
-               return _LDP_ERROR;
-       xp->__refcount = 1;
-       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-       xp->_messages_locale_buf = NULL;
-
-       ret = __part_load_locale(name, &loc->_messages_using_locale,
-                 &xp->_messages_locale_buf, "LC_MESSAGES/LC_MESSAGES",
-                 LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
-                 (const char **)&xp->_messages_locale);
-       if (ret == _LDP_LOADED) {
-               if (xp->_messages_locale.yesstr == NULL)
-                       xp->_messages_locale.yesstr = empty;
-               if (xp->_messages_locale.nostr == NULL)
-                       xp->_messages_locale.nostr = empty;
-               XL_RELEASE(loc->__lc_messages);
-               loc->__lc_messages = xp;
-               XL_RELEASE(cache);
-               cache = xp;
-               XL_RETAIN(cache);
-       } else if (ret == _LDP_ERROR)
-               free(xp);
-       return (ret);
-}
-
-__private_extern__ struct lc_messages_T *
-__get_current_messages_locale(locale_t loc)
-{
-       return (loc->_messages_using_locale
-               ? &loc->__lc_messages->_messages_locale
-               : (struct lc_messages_T *)&_C_messages_locale);
-}
-
-#ifdef LOCALE_DEBUG
-void
-msgdebug() {
-locale_t loc = __current_locale();
-printf(        "yesexpr = %s\n"
-       "noexpr = %s\n"
-       "yesstr = %s\n"
-       "nostr = %s\n",
-       loc->__lc_messages->_messages_locale.yesexpr,
-       loc->__lc_messages->_messages_locale.noexpr,
-       loc->__lc_messages->_messages_locale.yesstr,
-       loc->__lc_messages->_messages_locale.nostr
-);
-}
-#endif /* LOCALE_DEBUG */
diff --git a/locale/lmessages.h b/locale/lmessages.h
deleted file mode 100644 (file)
index 47f08a9..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/locale/lmessages.h,v 1.3 2001/12/20 18:28:52 phantom Exp $
- */
-
-#ifndef _LMESSAGES_H_
-#define        _LMESSAGES_H_
-
-#include <xlocale.h>
-
-struct lc_messages_T {
-       const char      *yesexpr;
-       const char      *noexpr;
-       const char      *yesstr;
-       const char      *nostr;
-};
-
-struct lc_messages_T *__get_current_messages_locale(locale_t);
-int    __messages_load_locale(const char *, locale_t);
-
-#endif /* !_LMESSAGES_H_ */
diff --git a/locale/lmonetary-fbsd.c b/locale/lmonetary-fbsd.c
deleted file mode 100644 (file)
index 24091ea..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.19 2003/06/26 10:46:16 phantom Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "ldpart.h"
-#include "lmonetary.h"
-
-extern const char * __fix_locale_grouping_str(const char *);
-
-#define LCMONETARY_SIZE_FULL (sizeof(struct lc_monetary_T) / sizeof(char *))
-#define LCMONETARY_SIZE_MIN \
-               (offsetof(struct lc_monetary_T, int_p_cs_precedes) / \
-                   sizeof(char *))
-
-static char    empty[] = "";
-static char    numempty[] = { CHAR_MAX, '\0'};
-
-static const struct lc_monetary_T _C_monetary_locale = {
-       empty,          /* int_curr_symbol */
-       empty,          /* currency_symbol */
-       empty,          /* mon_decimal_point */
-       empty,          /* mon_thousands_sep */
-       empty,          /* mon_grouping [C99 7.11.2.1]*/
-       empty,          /* positive_sign */
-       empty,          /* negative_sign */
-       numempty,       /* int_frac_digits */
-       numempty,       /* frac_digits */
-       numempty,       /* p_cs_precedes */
-       numempty,       /* p_sep_by_space */
-       numempty,       /* n_cs_precedes */
-       numempty,       /* n_sep_by_space */
-       numempty,       /* p_sign_posn */
-       numempty,       /* n_sign_posn */
-       numempty,       /* int_p_cs_precedes */
-       numempty,       /* int_n_cs_precedes */
-       numempty,       /* int_p_sep_by_space */
-       numempty,       /* int_n_sep_by_space */
-       numempty,       /* int_p_sign_posn */
-       numempty        /* int_n_sign_posn */
-};
-
-static char
-cnv(const char *str)
-{
-       int i = strtol(str, NULL, 10);
-
-       if (i == -1)
-               i = CHAR_MAX;
-       return ((char)i);
-}
-
-__private_extern__ int
-__monetary_load_locale(const char *name, locale_t loc)
-{
-       int ret;
-       struct __xlocale_st_monetary *xp;
-       static struct __xlocale_st_monetary *cache = NULL;
-
-       /* 'name' must be already checked. */
-       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-               if (!loc->_monetary_using_locale)
-                       return (_LDP_CACHE);
-               loc->_monetary_using_locale = 0;
-               XL_RELEASE(loc->__lc_monetary);
-               loc->__lc_monetary = NULL;
-               loc->__mlocale_changed = 1;
-               return (_LDP_CACHE);
-       }
-
-       if (loc->_monetary_using_locale && strcmp(name, loc->__lc_monetary->_monetary_locale_buf) == 0)
-               return (_LDP_CACHE);
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-       if (cache && cache->_monetary_locale_buf && strcmp(name, cache->_monetary_locale_buf) == 0) {
-               loc->_monetary_using_locale = 1;
-               XL_RELEASE(loc->__lc_monetary);
-               loc->__lc_monetary = cache;
-               XL_RETAIN(loc->__lc_monetary);
-               loc->__mlocale_changed = 1;
-               return (_LDP_CACHE);
-       }
-       if ((xp = (struct __xlocale_st_monetary *)malloc(sizeof(*xp))) == NULL)
-               return _LDP_ERROR;
-       xp->__refcount = 1;
-       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-       xp->_monetary_locale_buf = NULL;
-
-       ret = __part_load_locale(name, &loc->_monetary_using_locale,
-               &xp->_monetary_locale_buf, "LC_MONETARY",
-               LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN,
-               (const char **)&xp->_monetary_locale);
-       if (ret != _LDP_ERROR)
-               loc->__mlocale_changed = 1;
-       else
-               free(xp);
-       if (ret == _LDP_LOADED) {
-               xp->_monetary_locale.mon_grouping =
-                    __fix_locale_grouping_str(xp->_monetary_locale.mon_grouping);
-
-#define M_ASSIGN_CHAR(NAME) (((char *)xp->_monetary_locale.NAME)[0] = \
-                            cnv(xp->_monetary_locale.NAME))
-
-               M_ASSIGN_CHAR(int_frac_digits);
-               M_ASSIGN_CHAR(frac_digits);
-               M_ASSIGN_CHAR(p_cs_precedes);
-               M_ASSIGN_CHAR(p_sep_by_space);
-               M_ASSIGN_CHAR(n_cs_precedes);
-               M_ASSIGN_CHAR(n_sep_by_space);
-               M_ASSIGN_CHAR(p_sign_posn);
-               M_ASSIGN_CHAR(n_sign_posn);
-
-               /*
-                * The six additional C99 international monetary formatting
-                * parameters default to the national parameters when
-                * reading FreeBSD LC_MONETARY data files.
-                */
-#define        M_ASSIGN_ICHAR(NAME)                                            \
-               do {                                                    \
-                       if (xp->_monetary_locale.int_##NAME == NULL)    \
-                               xp->_monetary_locale.int_##NAME =       \
-                                   xp->_monetary_locale.NAME;          \
-                       else                                            \
-                               M_ASSIGN_CHAR(int_##NAME);              \
-               } while (0)
-
-               M_ASSIGN_ICHAR(p_cs_precedes);
-               M_ASSIGN_ICHAR(n_cs_precedes);
-               M_ASSIGN_ICHAR(p_sep_by_space);
-               M_ASSIGN_ICHAR(n_sep_by_space);
-               M_ASSIGN_ICHAR(p_sign_posn);
-               M_ASSIGN_ICHAR(n_sign_posn);
-               XL_RELEASE(loc->__lc_monetary);
-               loc->__lc_monetary = xp;
-               XL_RELEASE(cache);
-               cache = xp;
-               XL_RETAIN(cache);
-       }
-       return (ret);
-}
-
-__private_extern__ struct lc_monetary_T *
-__get_current_monetary_locale(locale_t loc)
-{
-       return (loc->_monetary_using_locale
-               ? &loc->__lc_monetary->_monetary_locale
-               : (struct lc_monetary_T *)&_C_monetary_locale);
-}
-
-#ifdef LOCALE_DEBUG
-void
-monetdebug() {
-locale_t loc = __current_locale();
-printf(        "int_curr_symbol = %s\n"
-       "currency_symbol = %s\n"
-       "mon_decimal_point = %s\n"
-       "mon_thousands_sep = %s\n"
-       "mon_grouping = %s\n"
-       "positive_sign = %s\n"
-       "negative_sign = %s\n"
-       "int_frac_digits = %d\n"
-       "frac_digits = %d\n"
-       "p_cs_precedes = %d\n"
-       "p_sep_by_space = %d\n"
-       "n_cs_precedes = %d\n"
-       "n_sep_by_space = %d\n"
-       "p_sign_posn = %d\n"
-       "n_sign_posn = %d\n",
-       "int_p_cs_precedes = %d\n"
-       "int_p_sep_by_space = %d\n"
-       "int_n_cs_precedes = %d\n"
-       "int_n_sep_by_space = %d\n"
-       "int_p_sign_posn = %d\n"
-       "int_n_sign_posn = %d\n",
-       loc->__lc_monetary->_monetary_locale.int_curr_symbol,
-       loc->__lc_monetary->_monetary_locale.currency_symbol,
-       loc->__lc_monetary->_monetary_locale.mon_decimal_point,
-       loc->__lc_monetary->_monetary_locale.mon_thousands_sep,
-       loc->__lc_monetary->_monetary_locale.mon_grouping,
-       loc->__lc_monetary->_monetary_locale.positive_sign,
-       loc->__lc_monetary->_monetary_locale.negative_sign,
-       loc->__lc_monetary->_monetary_locale.int_frac_digits[0],
-       loc->__lc_monetary->_monetary_locale.frac_digits[0],
-       loc->__lc_monetary->_monetary_locale.p_cs_precedes[0],
-       loc->__lc_monetary->_monetary_locale.p_sep_by_space[0],
-       loc->__lc_monetary->_monetary_locale.n_cs_precedes[0],
-       loc->__lc_monetary->_monetary_locale.n_sep_by_space[0],
-       loc->__lc_monetary->_monetary_locale.p_sign_posn[0],
-       loc->__lc_monetary->_monetary_locale.n_sign_posn[0],
-       loc->__lc_monetary->_monetary_locale.int_p_cs_precedes[0],
-       loc->__lc_monetary->_monetary_locale.int_p_sep_by_space[0],
-       loc->__lc_monetary->_monetary_locale.int_n_cs_precedes[0],
-       loc->__lc_monetary->_monetary_locale.int_n_sep_by_space[0],
-       loc->__lc_monetary->_monetary_locale.int_p_sign_posn[0],
-       loc->__lc_monetary->_monetary_locale.int_n_sign_posn[0]
-);
-}
-#endif /* LOCALE_DEBUG */
diff --git a/locale/lmonetary.h b/locale/lmonetary.h
deleted file mode 100644 (file)
index b7c3d0f..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/locale/lmonetary.h,v 1.4 2002/10/09 09:19:28 tjr Exp $
- */
-
-#ifndef _LMONETARY_H_
-#define        _LMONETARY_H_
-
-#include <xlocale.h>
-
-struct lc_monetary_T {
-       const char      *int_curr_symbol;
-       const char      *currency_symbol;
-       const char      *mon_decimal_point;
-       const char      *mon_thousands_sep;
-       const char      *mon_grouping;
-       const char      *positive_sign;
-       const char      *negative_sign;
-       const char      *int_frac_digits;
-       const char      *frac_digits;
-       const char      *p_cs_precedes;
-       const char      *p_sep_by_space;
-       const char      *n_cs_precedes;
-       const char      *n_sep_by_space;
-       const char      *p_sign_posn;
-       const char      *n_sign_posn;
-       const char      *int_p_cs_precedes;
-       const char      *int_n_cs_precedes;
-       const char      *int_p_sep_by_space;
-       const char      *int_n_sep_by_space;
-       const char      *int_p_sign_posn;
-       const char      *int_n_sign_posn;
-};
-
-struct lc_monetary_T *__get_current_monetary_locale(locale_t);
-int    __monetary_load_locale(const char *, locale_t);
-
-#endif /* !_LMONETARY_H_ */
diff --git a/locale/lnumeric-fbsd.c b/locale/lnumeric-fbsd.c
deleted file mode 100644 (file)
index adfa25b..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.16 2003/06/26 10:46:16 phantom Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <string.h>
-
-#include "ldpart.h"
-#include "lnumeric.h"
-
-extern const char *__fix_locale_grouping_str(const char *);
-
-#define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *))
-
-static const struct lc_numeric_T _C_numeric_locale = {
-       ".",            /* decimal_point */
-       "",             /* thousands_sep */
-       ""              /* grouping [C99 7.11.2.1]*/
-};
-
-__private_extern__ int
-__numeric_load_locale(const char *name, locale_t loc)
-{
-       int ret;
-       struct __xlocale_st_numeric *xp;
-       static struct __xlocale_st_numeric *cache = NULL;
-
-       /* 'name' must be already checked. */
-       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-               if (!loc->_numeric_using_locale)
-                       return (_LDP_CACHE);
-               loc->_numeric_using_locale = 0;
-               XL_RELEASE(loc->__lc_numeric);
-               loc->__lc_numeric = NULL;
-               loc->__nlocale_changed = 1;
-               return (_LDP_CACHE);
-       }
-
-       if (loc->_numeric_using_locale && strcmp(name, loc->__lc_numeric->_numeric_locale_buf) == 0)
-               return (_LDP_CACHE);
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-       if (cache && cache->_numeric_locale_buf && strcmp(name, cache->_numeric_locale_buf) == 0) {
-               loc->_numeric_using_locale = 1;
-               XL_RELEASE(loc->__lc_numeric);
-               loc->__lc_numeric = cache;
-               XL_RETAIN(loc->__lc_numeric);
-               loc->__nlocale_changed = 1;
-               return (_LDP_CACHE);
-       }
-       if ((xp = (struct __xlocale_st_numeric *)malloc(sizeof(*xp))) == NULL)
-               return _LDP_ERROR;
-       xp->__refcount = 1;
-       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-       xp->_numeric_locale_buf = NULL;
-
-       ret = __part_load_locale(name, &loc->_numeric_using_locale,
-               &xp->_numeric_locale_buf, "LC_NUMERIC",
-               LCNUMERIC_SIZE, LCNUMERIC_SIZE,
-               (const char **)&xp->_numeric_locale);
-       if (ret != _LDP_ERROR)
-               loc->__nlocale_changed = 1;
-       else
-               free(xp);
-       if (ret == _LDP_LOADED) {
-               /* Can't be empty according to C99 */
-               if (*xp->_numeric_locale.decimal_point == '\0')
-                       xp->_numeric_locale.decimal_point =
-                           _C_numeric_locale.decimal_point;
-               xp->_numeric_locale.grouping =
-                   __fix_locale_grouping_str(xp->_numeric_locale.grouping);
-               XL_RELEASE(loc->__lc_numeric);
-               loc->__lc_numeric = xp;
-               XL_RELEASE(cache);
-               cache = xp;
-               XL_RETAIN(cache);
-       }
-       return (ret);
-}
-
-__private_extern__ struct lc_numeric_T *
-__get_current_numeric_locale(locale_t loc)
-{
-       return (loc->_numeric_using_locale
-               ? &loc->__lc_numeric->_numeric_locale
-               : (struct lc_numeric_T *)&_C_numeric_locale);
-}
-
-#ifdef LOCALE_DEBUG
-void
-numericdebug(void) {
-locale_t loc = __current_locale();
-printf(        "decimal_point = %s\n"
-       "thousands_sep = %s\n"
-       "grouping = %s\n",
-       loc->__lc_numeric->_numeric_locale.decimal_point,
-       loc->__lc_numeric->_numeric_locale.thousands_sep,
-       loc->__lc_numeric->_numeric_locale.grouping
-);
-}
-#endif /* LOCALE_DEBUG */
diff --git a/locale/lnumeric.h b/locale/lnumeric.h
deleted file mode 100644 (file)
index e91835c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/locale/lnumeric.h,v 1.3 2001/12/20 18:28:52 phantom Exp $
- */
-
-#ifndef _LNUMERIC_H_
-#define        _LNUMERIC_H_
-
-#include <xlocale.h>
-
-struct lc_numeric_T {
-       const char      *decimal_point;
-       const char      *thousands_sep;
-       const char      *grouping;
-};
-
-struct lc_numeric_T *__get_current_numeric_locale(locale_t);
-int    __numeric_load_locale(const char *, locale_t);
-
-#endif /* !_LNUMERIC_H_ */
diff --git a/locale/localeconv-fbsd.c b/locale/localeconv-fbsd.c
deleted file mode 100644 (file)
index 11afdb5..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)localeconv.c       8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23 phantom Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <locale.h>
-
-#include "lmonetary.h"
-#include "lnumeric.h"
-
-#ifdef __APPLE_PR3417676_HACK__
-/*------------------------------------------------------------------------
- * PR-3417676: We need to provide a way to force "C" locale style number
- * formatting independent of the locale setting.  We provide private
- * routines to get and set a flag that tells localeconv() to either return
- * a "C" struct lconv, or the one dependent on the actual locale.
- *------------------------------------------------------------------------*/
-static char empty[] = "";
-static char numempty[] = { CHAR_MAX, '\0' };
-
-/*
- * Default (C) locale conversion.
- */
-static struct lconv _C_lconv = {
-       ".",                    /* decimal_point */
-       empty,                  /* thousands_sep */
-       numempty,               /* grouping */
-       empty,                  /* int_curr_symbol */
-       empty,                  /* currency_symbol */
-       empty,                  /* mon_decimal_point */
-       empty,                  /* mon_thousands_sep */
-       numempty,               /* mon_grouping */
-       empty,                  /* positive_sign */
-       empty,                  /* negative_sign */
-       CHAR_MAX,               /* int_frac_digits */
-       CHAR_MAX,               /* frac_digits */
-       CHAR_MAX,               /* p_cs_precedes */
-       CHAR_MAX,               /* p_sep_by_space */
-       CHAR_MAX,               /* n_cs_precedes */
-       CHAR_MAX,               /* n_sep_by_space */
-       CHAR_MAX,               /* p_sign_posn */
-       CHAR_MAX,               /* n_sign_posn */
-       CHAR_MAX,               /* int_p_cs_precedes */
-       CHAR_MAX,               /* int_n_cs_precedes */
-       CHAR_MAX,               /* int_p_sep_by_space */
-       CHAR_MAX,               /* int_n_sep_by_space */
-       CHAR_MAX,               /* int_p_sign_posn */
-       CHAR_MAX,               /* int_n_sign_posn */
-};
-static int _onlyClocaleconv = 0;
-
-int
-__getonlyClocaleconv(void)
-{
-    return _onlyClocaleconv;
-}
-
-int
-__setonlyClocaleconv(int val)
-{
-    int prev = _onlyClocaleconv;
-
-    _onlyClocaleconv = val;
-    return prev;
-}
-#endif /* __APPLE_PR3417676_HACK__ */
-
-/* 
- * The localeconv() function constructs a struct lconv from the current
- * monetary and numeric locales.
- *
- * Because localeconv() may be called many times (especially by library
- * routines like printf() & strtod()), the approprate members of the 
- * lconv structure are computed only when the monetary or numeric 
- * locale has been changed.
- */
-
-/*
- * Return the current locale conversion.
- */
-struct lconv *
-localeconv_l(locale_t loc)
-{
-    struct lconv *lc;
-
-    NORMALIZE_LOCALE(loc);
-
-    if (loc->__mlocale_changed) {
-      XL_LOCK(loc);
-      if (loc->__mlocale_changed) {
-       /* LC_MONETARY part */
-        struct lc_monetary_T * mptr; 
-       struct lconv *lc = &loc->__lc_localeconv;
-
-#define M_ASSIGN_STR(NAME) (lc->NAME = (char*)mptr->NAME)
-#define M_ASSIGN_CHAR(NAME) (lc->NAME = mptr->NAME[0])
-
-       mptr = __get_current_monetary_locale(loc);
-       M_ASSIGN_STR(int_curr_symbol);
-       M_ASSIGN_STR(currency_symbol);
-       M_ASSIGN_STR(mon_decimal_point);
-       M_ASSIGN_STR(mon_thousands_sep);
-       M_ASSIGN_STR(mon_grouping);
-       M_ASSIGN_STR(positive_sign);
-       M_ASSIGN_STR(negative_sign);
-       M_ASSIGN_CHAR(int_frac_digits);
-       M_ASSIGN_CHAR(frac_digits);
-       M_ASSIGN_CHAR(p_cs_precedes);
-       M_ASSIGN_CHAR(p_sep_by_space);
-       M_ASSIGN_CHAR(n_cs_precedes);
-       M_ASSIGN_CHAR(n_sep_by_space);
-       M_ASSIGN_CHAR(p_sign_posn);
-       M_ASSIGN_CHAR(n_sign_posn);
-       M_ASSIGN_CHAR(int_p_cs_precedes);
-       M_ASSIGN_CHAR(int_n_cs_precedes);
-       M_ASSIGN_CHAR(int_p_sep_by_space);
-       M_ASSIGN_CHAR(int_n_sep_by_space);
-       M_ASSIGN_CHAR(int_p_sign_posn);
-       M_ASSIGN_CHAR(int_n_sign_posn);
-       loc->__mlocale_changed = 0;
-      }
-      XL_UNLOCK(loc);
-    }
-
-    if (loc->__nlocale_changed) {
-      XL_LOCK(loc);
-      if (loc->__nlocale_changed) {
-       /* LC_NUMERIC part */
-        struct lc_numeric_T * nptr; 
-       struct lconv *lc = &loc->__lc_localeconv;
-
-#define N_ASSIGN_STR(NAME) (lc->NAME = (char*)nptr->NAME)
-
-       nptr = __get_current_numeric_locale(loc);
-       N_ASSIGN_STR(decimal_point);
-       N_ASSIGN_STR(thousands_sep);
-       N_ASSIGN_STR(grouping);
-       loc->__nlocale_changed = 0;
-      }
-      XL_UNLOCK(loc);
-    }
-
-    return &loc->__lc_localeconv;
-}
-
-/*
- * Return the current locale conversion.
- */
-struct lconv *
-localeconv()
-{
-#ifdef __APPLE_PR3417676_HACK__
-    /*--------------------------------------------------------------------
-     * If _onlyClocaleconv is non-zero, just return __lconv, which is a "C"
-     * struct lconv *.  Otherwise, do the normal thing.
-     *--------------------------------------------------------------------*/
-    if (_onlyClocaleconv)
-       return &_C_lconv;
-#endif /* __APPLE_PR3417676_HACK__ */
-    return localeconv_l(__current_locale());
-}
diff --git a/locale/localeconv.3 b/locale/localeconv.3
deleted file mode 100644 (file)
index 01df550..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley at BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" From @(#)setlocale.3       8.1 (Berkeley) 6/9/93
-.\" From FreeBSD: src/lib/libc/locale/setlocale.3,v 1.28 2003/11/15 02:26:04 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/localeconv.3,v 1.3 2007/01/09 00:28:00 imp Exp $
-.\"
-.Dd November 21, 2003
-.Dt LOCALECONV 3
-.Os
-.Sh NAME
-.Nm localeconv ,
-.Nm localeconv_l
-.Nd natural language formatting for C
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In locale.h
-.Ft struct lconv *
-.Fo localeconv
-.Fa "void"
-.Fc
-.In xlocale.h
-.Ft struct lconv *
-.Fo localeconv_l
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn localeconv
-function returns a pointer to a structure
-which provides parameters for formatting numbers,
-especially currency values:
-.Bd -literal -offset indent
-struct lconv {
-       char    *decimal_point;
-       char    *thousands_sep;
-       char    *grouping;
-       char    *int_curr_symbol;
-       char    *currency_symbol;
-       char    *mon_decimal_point;
-       char    *mon_thousands_sep;
-       char    *mon_grouping;
-       char    *positive_sign;
-       char    *negative_sign;
-       char    int_frac_digits;
-       char    frac_digits;
-       char    p_cs_precedes;
-       char    p_sep_by_space;
-       char    n_cs_precedes;
-       char    n_sep_by_space;
-       char    p_sign_posn;
-       char    n_sign_posn;
-       char    int_p_cs_precedes;
-       char    int_n_cs_precedes;
-       char    int_p_sep_by_space;
-       char    int_n_sep_by_space;
-       char    int_p_sign_posn;
-       char    int_n_sign_posn;
-};
-.Ed
-.Pp
-The individual fields have the following meanings:
-.Pp
-.Bl -tag -width mon_decimal_point
-.It Va decimal_point
-The decimal point character, except for currency values,
-cannot be an empty string.
-.It Va thousands_sep
-The separator between groups of digits
-before the decimal point, except for currency values.
-.It Va grouping
-The sizes of the groups of digits, except for currency values.
-This is a pointer to a vector of integers, each of size
-.Vt char ,
-representing group size from low order digit groups
-to high order (right to left).
-The list may be terminated with 0 or
-.Dv CHAR_MAX .
-If the list is terminated with 0,
-the last group size before the 0 is repeated to account for all the digits.
-If the list is terminated with
-.Dv CHAR_MAX ,
-no more grouping is performed.
-.It Va int_curr_symbol
-The standardized international currency symbol.
-.It Va currency_symbol
-The local currency symbol.
-.It Va mon_decimal_point
-The decimal point character for currency values.
-.It Va mon_thousands_sep
-The separator for digit groups in currency values.
-.It Va mon_grouping
-Like
-.Va grouping
-but for currency values.
-.It Va positive_sign
-The character used to denote nonnegative currency values,
-usually the empty string.
-.It Va negative_sign
-The character used to denote negative currency values,
-usually a minus sign.
-.It Va int_frac_digits
-The number of digits after the decimal point
-in an international-style currency value.
-.It Va frac_digits
-The number of digits after the decimal point
-in the local style for currency values.
-.It Va p_cs_precedes
-1 if the currency symbol precedes the currency value
-for nonnegative values, 0 if it follows.
-.It Va p_sep_by_space
-1 if a space is inserted between the currency symbol
-and the currency value for nonnegative values, 0 otherwise.
-.It Va n_cs_precedes
-Like
-.Va p_cs_precedes
-but for negative values.
-.It Va n_sep_by_space
-Like
-.Va p_sep_by_space
-but for negative values.
-.It Va p_sign_posn
-The location of the
-.Va positive_sign
-with respect to a nonnegative quantity and the
-.Va currency_symbol ,
-coded as follows:
-.Pp
-.Bl -tag -width 3n -compact
-.It Li 0
-Parentheses around the entire string.
-.It Li 1
-Before the string.
-.It Li 2
-After the string.
-.It Li 3
-Just before
-.Va currency_symbol .
-.It Li 4
-Just after
-.Va currency_symbol .
-.El
-.It Va n_sign_posn
-Like
-.Va p_sign_posn
-but for negative currency values.
-.It Va int_p_cs_precedes
-Same as
-.Va p_cs_precedes ,
-but for internationally formatted monetary quantities.
-.It Va int_n_cs_precedes
-Same as
-.Va n_cs_precedes ,
-but for internationally formatted monetary quantities.
-.It Va int_p_sep_by_space
-Same as
-.Va p_sep_by_space ,
-but for internationally formatted monetary quantities.
-.It Va int_n_sep_by_space
-Same as
-.Va n_sep_by_space ,
-but for internationally formatted monetary quantities.
-.It Va int_p_sign_posn
-Same as
-.Va p_sign_posn ,
-but for internationally formatted monetary quantities.
-.It Va int_n_sign_posn
-Same as
-.Va n_sign_posn ,
-but for internationally formatted monetary quantities.
-.El
-.Pp
-Unless mentioned above,
-an empty string as a value for a field
-indicates a zero length result or
-a value that is not in the current locale.
-A
-.Dv CHAR_MAX
-result similarly denotes an unavailable value.
-.Pp
-While the
-.Fn localeconv
-function uses the current locale, the
-.Fn localeconv_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn localeconv
-function returns a pointer to a static object
-which may be altered by later calls to
-.Xr setlocale 3
-or
-.Fn localeconv .
-.Sh ERRORS
-No errors are defined.
-.Sh SEE ALSO
-.Xr setlocale 3 ,
-.Xr strfmon 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn localeconv
-function conforms to
-.St -isoC-99 .
-.Sh HISTORY
-The
-.Fn localeconv
-function first appeared in
-.Bx 4.4 .
diff --git a/locale/mblen-fbsd.c b/locale/mblen-fbsd.c
deleted file mode 100644 (file)
index f6bfa52..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-int
-mblen_l(const char *s, size_t n, locale_t loc)
-{
-       static const mbstate_t initial;
-       size_t rval;
-
-       NORMALIZE_LOCALE(loc);
-       if (s == NULL) {
-               /* No support for state dependent encodings. */
-               loc->__mbs_mblen = initial;
-               return (0);
-       }
-       rval = loc->__lc_ctype->__mbrtowc(NULL, s, n, &loc->__mbs_mblen, loc);
-       if (rval == (size_t)-1 || rval == (size_t)-2)
-               return (-1);
-       return ((int)rval);
-}
-
-int
-mblen(const char *s, size_t n)
-{
-       return mblen_l(s, n, __current_locale());
-}
diff --git a/locale/mblen.3 b/locale/mblen.3
deleted file mode 100644 (file)
index c3530e1..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley of BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" From @(#)multibyte.3       8.1 (Berkeley) 6/4/93
-.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/mblen.3,v 1.6 2007/01/09 00:28:00 imp Exp $
-.\"
-.Dd April 11, 2004
-.Dt MBLEN 3
-.Os
-.Sh NAME
-.Nm mblen ,
-.Nm mblen_l
-.Nd get number of bytes in a character
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fo mblen
-.Fa "const char *s"
-.Fa "size_t n"
-.Fc
-.In stdlib.h
-.In xlocale.h
-.Ft int
-.Fo mblen_l
-.Fa "const char *s"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mblen
-function computes the length, in bytes,
-of a multibyte character
-.Fa s ,
-according to the current conversion state.
-Up to
-.Fa n
-bytes are examined.
-.Pp
-A call with a null
-.Fa s
-pointer returns nonzero if the current locale requires shift states,
-zero otherwise.
-If shift states are required, the shift state is reset to the initial state.
-.Pp
-Although the
-.Fn mblen
-function uses the current locale, the
-.Fn mblen_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If
-.Fa s
-is
-.Dv NULL ,
-the
-.Fn mblen
-function returns nonzero if shift states are supported,
-zero otherwise.
-.Pp
-Otherwise, if
-.Fa s
-is not a null pointer,
-.Fn mblen
-either returns 0 if
-.Fa s
-represents the null wide character, or returns
-the number of bytes processed in
-.Fa s ,
-or returns \-1 if no multibyte character
-could be recognized or converted.
-In this case,
-.Fn mblen Ns 's
-internal conversion state is undefined.
-.Sh ERRORS
-The
-.Fn mblen
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte sequence was detected.
-.It Bq Er EINVAL
-The internal conversion state is not valid.
-.El
-.Sh SEE ALSO
-.Xr mbrlen 3 ,
-.Xr mbtowc 3 ,
-.Xr multibyte 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mblen
-function conforms to
-.St -isoC-99 .
diff --git a/locale/mblocal.h b/locale/mblocal.h
deleted file mode 100644 (file)
index f5d3fc1..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * Copyright (c) 2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * 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.7 2008/01/21 23:48:12 ache Exp $
- */
-
-#ifndef _MBLOCAL_H_
-#define        _MBLOCAL_H_
-
-#include <runetype.h>
-
-/*
- * Rune initialization function prototypes.
- */
-__private_extern__ int _none_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _ascii_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _UTF2_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _UTF8_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _EUC_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _GB18030_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _GB2312_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _GBK_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _BIG5_init(struct __xlocale_st_runelocale *);
-__private_extern__ int _MSKanji_init(struct __xlocale_st_runelocale *);
-
-__private_extern__ size_t       _none_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                    size_t, mbstate_t * __restrict, locale_t);
-__private_extern__ int  _none_mbsinit(const mbstate_t *, locale_t);
-__private_extern__ size_t       _none_mbsnrtowcs(wchar_t * __restrict dst,
-                    const char ** __restrict src, size_t nms, size_t len,
-                    mbstate_t * __restrict ps __unused, locale_t);
-__private_extern__ size_t       _none_wcrtomb(char * __restrict, wchar_t,
-                    mbstate_t * __restrict, locale_t);
-__private_extern__ size_t       _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                    size_t, size_t, mbstate_t * __restrict, locale_t);
-
-extern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict,
-    size_t, size_t, mbstate_t * __restrict, locale_t);
-extern size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict,
-    size_t, size_t, mbstate_t * __restrict, locale_t);
-
-#endif /* _MBLOCAL_H_ */
diff --git a/locale/mbrlen-fbsd.c b/locale/mbrlen-fbsd.c
deleted file mode 100644 (file)
index 2f0227a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-mbrlen_l(const char * __restrict s, size_t n, mbstate_t * __restrict ps,
-    locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_mbrlen;
-       return (loc->__lc_ctype->__mbrtowc(NULL, s, n, ps, loc));
-}
-
-size_t
-mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
-{
-       return mbrlen_l(s, n, ps, __current_locale());
-}
diff --git a/locale/mbrlen.3 b/locale/mbrlen.3
deleted file mode 100644 (file)
index ca7be65..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/mbrlen.3,v 1.8 2004/06/30 19:32:41 ru Exp $
-.\"
-.Dd April 7, 2004
-.Dt MBRLEN 3
-.Os
-.Sh NAME
-.Nm mbrlen ,
-.Nm mbrlen_l
-.Nd "get number of bytes in a character (restartable)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo mbrlen
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo mbrlen_l
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mbrlen
-function inspects at most
-.Fa n
-bytes, pointed to by
-.Fa s ,
-to determine the number of bytes needed to complete the next
-multibyte character.
-.Pp
-The
-.Vt mbstate_t
-argument,
-.Fa ps ,
-is used to keep track of the shift state.
-If it is
-.Dv NULL ,
-.Fn mbrlen
-uses an internal, static
-.Vt mbstate_t
-object, which is initialized to the initial conversion state
-at program startup.
-.Pp
-It is equivalent to:
-.Pp
-.Dl "mbrtowc(NULL, s, n, ps);"
-.Pp
-Except that, when
-.Fa ps
-is a
-.Dv NULL
-pointer,
-.Fn mbrlen
-uses its own static, internal
-.Vt mbstate_t
-object to keep track of the shift state.
-.Pp
-Although the
-.Fn mbrlen
-function uses the current locale, the
-.Fn mbrlen_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn mbrlen
-functions returns:
-.Bl -tag -width indent
-.It 0
-The next
-.Fa n
-or fewer bytes
-represent the null wide character
-.Pq Li "L'\e0'" .
-.It >0
-The next
-.Fa n
-or fewer bytes
-represent a valid character,
-.Fn mbrlen
-returns the number of bytes used to complete the multibyte character.
-.It Po Vt size_t Pc Ns \-2
-The next
-.Fa n
-contribute to, but do not complete, a valid multibyte character sequence,
-and all
-.Fa n
-bytes have been processed.
-.It Po Vt size_t Pc Ns \-1
-An encoding error has occurred.
-The next
-.Fa n
-or fewer bytes do not contribute to a valid multibyte character.
-.El
-.Sh EXAMPLES
-A function that calculates the number of characters in a multibyte
-character string:
-.Bd -literal -offset indent
-size_t
-nchars(const char *s)
-{
-       size_t charlen, chars;
-       mbstate_t mbs;
-
-       chars = 0;
-       memset(&mbs, 0, sizeof(mbs));
-       while ((charlen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 &&
-           charlen != (size_t)-1 && charlen != (size_t)-2) {
-               s += charlen;
-               chars++;
-       }
-
-       return (chars);
-}
-.Ed
-.Sh ERRORS
-The
-.Fn mbrlen
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte sequence was detected.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mblen 3 ,
-.Xr mbrtowc 3 ,
-.Xr multibyte 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mbrlen
-function conforms to
-.St -isoC-99 .
diff --git a/locale/mbrtowc-fbsd.c b/locale/mbrtowc-fbsd.c
deleted file mode 100644 (file)
index 023c8b2..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-mbrtowc_l(wchar_t * __restrict pwc, const char * __restrict s,
-    size_t n, mbstate_t * __restrict ps, locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_mbrtowc;
-       return (loc->__lc_ctype->__mbrtowc(pwc, s, n, ps, loc));
-}
-
-size_t
-mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
-    size_t n, mbstate_t * __restrict ps)
-{
-       return mbrtowc_l(pwc, s, n, ps, __current_locale());
-}
diff --git a/locale/mbrtowc.3 b/locale/mbrtowc.3
deleted file mode 100644 (file)
index 4066184..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/mbrtowc.3,v 1.5 2004/06/30 19:32:41 ru Exp $
-.\"
-.Dd April 8, 2004
-.Dt MBRTOWC 3
-.Os
-.Sh NAME
-.Nm mbrtowc ,
-.Nm mbrtowc_l
-.Nd "convert a character to a wide-character code (restartable)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo mbrtowc
-.Fa "wchar_t *restrict pwc"
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo mbrtowc_l
-.Fa "wchar_t *restrict pwc"
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mbrtowc
-function inspects at most
-.Fa n
-bytes, pointed to by
-.Fa s ,
-to determine the number of bytes needed to complete the next multibyte
-character.
-If a character can be completed, and
-.Fa pwc
-is not
-.Dv NULL ,
-the wide character which is represented by
-.Fa s
-is stored in the
-.Vt wchar_t
-it points to.
-.Pp
-If
-.Fa s
-is
-.Dv NULL ,
-.Fn mbrtowc
-behaves as if
-.Fa pwc
-were
-.Dv NULL ,
-.Fa s
-were an empty string
-.Pq Qq ,
-and
-.Fa n
-were 1.
-.Pp
-The
-.Vt mbstate_t
-argument,
-.Fa ps ,
-is used to keep track of the shift state.
-If it is
-.Dv NULL ,
-.Fn mbrtowc
-uses an internal, static
-.Vt mbstate_t
-object, which is initialized to the initial conversion state
-at program startup.
-.Pp
-While the
-.Fn mbrtowc
-function uses the current locale, the
-.Fn mbrtowc_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn mbrtowc
-functions returns:
-.Bl -tag -width indent
-.It 0
-The next
-.Fa n
-or fewer bytes
-represent the null wide character
-.Pq Li "L'\e0'" .
-.It >0
-The next
-.Fa n
-or fewer bytes
-represent a valid character,
-.Fn mbrtowc
-returns the number of bytes used to complete the multibyte character.
-.It Po Vt size_t Pc Ns \-2
-The next
-.Fa n
-contribute to, but do not complete, a valid multibyte character sequence,
-and all
-.Fa n
-bytes have been processed.
-.It Po Vt size_t Pc Ns \-1
-An encoding error has occurred.
-The next
-.Fa n
-or fewer bytes do not contribute to a valid multibyte character.
-.El
-.Sh ERRORS
-The
-.Fn mbrtowc
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte sequence was detected.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbtowc 3 ,
-.Xr multibyte 3 ,
-.Xr setlocale 3 ,
-.Xr wcrtomb 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mbrtowc
-function conforms to
-.St -isoC-99 .
diff --git a/locale/mbsinit-fbsd.c b/locale/mbsinit-fbsd.c
deleted file mode 100644 (file)
index bbc2266..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-#include "mblocal.h"
-
-int
-mbsinit_l(const mbstate_t *ps, locale_t loc)
-{
-
-       NORMALIZE_LOCALE(loc);
-       return (loc->__lc_ctype->__mbsinit(ps, loc));
-}
-
-int
-mbsinit(const mbstate_t *ps)
-{
-       return mbsinit_l(ps, __current_locale());
-}
diff --git a/locale/mbsinit.3 b/locale/mbsinit.3
deleted file mode 100644 (file)
index 8dfa1bf..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/mbsinit.3,v 1.3 2004/04/08 09:59:02 tjr Exp $
-.\"
-.Dd April 8, 2004
-.Dt MBSINIT 3
-.Os
-.Sh NAME
-.Nm mbsinit ,
-.Nm mbsinit_l
-.Nd "determine conversion object status"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft int
-.Fn mbsinit "const mbstate_t *ps"
-.In wchar.h
-.In xlocale.h
-.Ft int
-.Fn mbsinit_l "const mbstate_t *ps" "locale_t loc"
-.Sh DESCRIPTION
-The
-.Fn mbsinit
-function determines whether the
-.Vt mbstate_t
-object pointed to by
-.Fa ps
-describes an initial conversion state.
-.Pp
-While the
-.Fn mbsinit
-function uses the current locale, the
-.Fn mbsinit_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn mbsinit
-function returns non-zero if
-.Fa ps
-is
-.Dv NULL
-or describes an initial conversion state;
-otherwise, it returns zero.
-.Sh SEE ALSO
-.Xr mbrlen 3 ,
-.Xr mbrtowc 3 ,
-.Xr mbsrtowcs 3 ,
-.Xr multibyte 3 ,
-.Xr wcrtomb 3 ,
-.Xr wcsrtombs 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mbsinit
-function conforms to
-.St -isoC-99 .
diff --git a/locale/mbsnrtowcs-fbsd.c b/locale/mbsnrtowcs-fbsd.c
deleted file mode 100644 (file)
index 41cdd86..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_mbsnrtowcs;
-       return (loc->__lc_ctype->__mbsnrtowcs(dst, src, nms, len, ps, loc));
-}
-
-size_t
-mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps)
-{
-       return mbsnrtowcs_l(dst, src, nms, len, ps, __current_locale());
-}
-
-__private_extern__ size_t
-__mbsnrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       const char *s;
-       size_t nchr;
-       wchar_t wc;
-       size_t nb;
-       size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
-           size_t, mbstate_t * __restrict, locale_t)
-           = loc->__lc_ctype->__mbrtowc;
-
-       s = *src;
-       nchr = 0;
-
-       if (dst == NULL) {
-               for (;;) {
-                       if ((nb = __mbrtowc(&wc, s, nms, ps, loc)) == (size_t)-1)
-                               /* Invalid sequence - mbrtowc() sets errno. */
-                               return ((size_t)-1);
-                       else if (nb == 0 || nb == (size_t)-2)
-                               return (nchr);
-                       s += nb;
-                       nms -= nb;
-                       nchr++;
-               }
-               /*NOTREACHED*/
-       }
-
-       while (len-- > 0) {
-               if ((nb = __mbrtowc(dst, s, nms, ps, loc)) == (size_t)-1) {
-                       *src = s;
-                       return ((size_t)-1);
-               } else if (nb == (size_t)-2) {
-                       *src = s + nms;
-                       return (nchr);
-               } else if (nb == 0) {
-                       *src = NULL;
-                       return (nchr);
-               }
-               s += nb;
-               nms -= nb;
-               nchr++;
-               dst++;
-       }
-       *src = s;
-       return (nchr);
-}
diff --git a/locale/mbsrtowcs-fbsd.c b/locale/mbsrtowcs-fbsd.c
deleted file mode 100644 (file)
index da8b1e4..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-mbsrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
-    mbstate_t * __restrict ps, locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_mbsrtowcs;
-       return (loc->__lc_ctype->__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps, loc));
-}
-
-size_t
-mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
-    mbstate_t * __restrict ps)
-{
-       return mbsrtowcs_l(dst, src, len, ps, __current_locale());
-}
diff --git a/locale/mbsrtowcs.3 b/locale/mbsrtowcs.3
deleted file mode 100644 (file)
index ff6e699..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" 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.6 2005/01/11 20:50:49 ru Exp $
-.Dd July 21, 2004
-.Dt MBSRTOWCS 3
-.Os
-.Sh NAME
-.Nm mbsnrtowcs ,
-.Nm mbsnrtowcs_l ,
-.Nm mbsrtowcs ,
-.Nm mbsrtowcs_l
-.Nd "convert a character string to a wide-character string (restartable)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo mbsnrtowcs
-.Fa "wchar_t *restrict dst"
-.Fa "const char **restrict src"
-.Fa "size_t nms"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.Ft size_t
-.Fo mbsrtowcs
-.Fa "wchar_t *restrict dst"
-.Fa "const char **restrict src"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo mbsrtowcs_l
-.Fa "wchar_t *restrict dst"
-.Fa "const char **restrict src"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Ft size_t
-.Fo mbsnrtowcs_l
-.Fa "wchar_t *restrict dst"
-.Fa "const char **restrict src"
-.Fa "size_t nms"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mbsrtowcs
-function converts a sequence of multibyte characters, pointed to indirectly by
-.Fa src ,
-into a sequence of corresponding wide characters. It stores at most
-.Fa len
-of them in the
-.Vt wchar_t
-array pointed to by
-.Fa dst ,
-until it encounters a terminating null character
-.Pq Li '\e0' .
-.Pp
-If
-.Fa dst
-is
-.Dv NULL ,
-no characters are stored.
-.Pp
-If
-.Fa dst
-is not
-.Dv NULL ,
-the pointer pointed to by
-.Fa src
-is updated to point to the character after the one that conversion stopped at.
-If conversion stops because a null character is encountered,
-.Fa *src
-is set to
-.Dv NULL .
-.Pp
-The
-.Vt mbstate_t
-argument,
-.Fa ps ,
-is used to keep track of the shift state.
-If it is
-.Dv NULL ,
-.Fn mbsrtowcs
-uses an internal, static
-.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 .
-.Pp
-While the
-.Fn mbsrtowcs
-and
-.Fn mbsnrtowcs
-functions use the current locale, the
-.Fn mbsrtowcs_l
-and
-.Fn mbsnrtowcs_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn mbsrtowcs
-and
-.Fn mbsnrtowcs
-functions return the number of wide characters stored in
-the array pointed to by
-.Fa dst
-if successful, otherwise it returns
-.Po Vt size_t Pc Ns \-1 .
-.Sh ERRORS
-The
-.Fn mbsrtowcs
-and
-.Fn mbsnrtowcs
-functions will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte character sequence was encountered.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbrtowc 3 ,
-.Xr mbstowcs 3 ,
-.Xr multibyte 3 ,
-.Xr wcsrtombs 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mbsrtowcs
-function conforms to
-.St -isoC-99 .
-.Pp
-The
-.Fn mbsnrtowcs
-function is an extension to the standard.
diff --git a/locale/mbstowcs-fbsd.c b/locale/mbstowcs-fbsd.c
deleted file mode 100644 (file)
index 80bc4fe..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-mbstowcs_l(wchar_t * __restrict pwcs, const char * __restrict s, size_t n,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       const char *sp;
-
-       NORMALIZE_LOCALE(loc);
-       mbs = initial;
-       sp = s;
-       return (loc->__lc_ctype->__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs, loc));
-}
-
-size_t
-mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
-{
-       return mbstowcs_l(pwcs, s, n, __current_locale());
-}
diff --git a/locale/mbstowcs.3 b/locale/mbstowcs.3
deleted file mode 100644 (file)
index 9e52e79..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley of BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" From @(#)multibyte.3       8.1 (Berkeley) 6/4/93
-.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/mbstowcs.3,v 1.5 2007/01/09 00:28:00 imp Exp $
-.\"
-.Dd April 8, 2004
-.Dt MBSTOWCS 3
-.Os
-.Sh NAME
-.Nm mbstowcs ,
-.Nm mbstowcs_l
-.Nd convert a character string to a wide-character string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft size_t
-.Fo mbstowcs
-.Fa "wchar_t *restrict pwcs"
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fc
-.In stdlib.h
-.In xlocale.h
-.Ft size_t
-.Fo mbstowcs_l
-.Fa "wchar_t *restrict pwcs"
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mbstowcs
-function converts a multibyte character string
-.Fa s ,
-beginning in the initial conversion state,
-into a wide character string
-.Fa pwcs .
-No more than
-.Fa n
-wide characters are stored.
-A terminating null wide character is appended, if there is room.
-.Pp
-Although the
-.Fn mbstowcs
-function uses the current locale, the
-.Fn mbstowcs_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn mbstowcs
-function returns the number of wide characters converted,
-not counting any terminating null wide character, or \-1
-if an invalid multibyte character was encountered.
-.Sh ERRORS
-The
-.Fn mbstowcs
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte sequence was detected.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbsrtowcs 3 ,
-.Xr mbtowc 3 ,
-.Xr multibyte 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mbstowcs
-function conforms to
-.St -isoC-99 .
diff --git a/locale/mbtowc-fbsd.c b/locale/mbtowc-fbsd.c
deleted file mode 100644 (file)
index aeb75b7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-int
-mbtowc_l(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       size_t rval;
-
-       NORMALIZE_LOCALE(loc);
-       if (s == NULL) {
-               /* No support for state dependent encodings. */
-               loc->__mbs_mbtowc = initial;
-               return (0);
-       }
-       rval = loc->__lc_ctype->__mbrtowc(pwc, s, n, &loc->__mbs_mbtowc, loc);
-       if (rval == (size_t)-1 || rval == (size_t)-2)
-               return (-1);
-       return ((int)rval);
-}
-
-int
-mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
-{
-       return mbtowc_l(pwc, s, n, __current_locale());
-}
diff --git a/locale/mbtowc.3 b/locale/mbtowc.3
deleted file mode 100644 (file)
index b4ec676..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley of BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" From @(#)multibyte.3       8.1 (Berkeley) 6/4/93
-.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/mbtowc.3,v 1.5 2007/01/09 00:28:00 imp Exp $
-.\"
-.Dd April 11, 2004
-.Dt MBTOWC 3
-.Os
-.Sh NAME
-.Nm mbtowc ,
-.Nm mbtowc_l
-.Nd convert a character to a wide-character code
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fo mbtowc
-.Fa "wchar_t *restrict pwc"
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fc
-.In stdlib.h
-.In xlocale.h
-.Ft int
-.Fo mbtowc_l
-.Fa "wchar_t *restrict pwc"
-.Fa "const char *restrict s"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mbtowc
-function converts a multibyte character
-.Fa s
-into a wide character, according to the current conversion state,
-and stores the result
-in the object pointed to by
-.Fa pwc .
-Up to
-.Fa n
-bytes are examined.
-.Pp
-A call with a null
-.Fa s
-pointer returns nonzero if the current encoding requires shift states,
-zero otherwise;
-if shift states are required, the shift state is reset to the initial state.
-.Pp
-While the
-.Fn mbtowc
-function uses the current locale, the
-.Fn mbtowc_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If
-.Fa s
-is
-.Dv NULL ,
-the
-.Fn mbtowc
-function returns nonzero if shift states are supported,
-zero otherwise.
-.Pp
-Otherwise, if
-.Fa s
-is not a null pointer,
-.Fn mbtowc
-either returns 0 if
-.Fa s
-represents the null wide character, or returns
-the number of bytes processed in
-.Fa s ,
-or returns \-1 if no multibyte character
-could be recognized or converted.
-In this case,
-.Fn mbtowc Ns 's
-internal conversion state is undefined.
-.Sh ERRORS
-The
-.Fn mbtowc
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte sequence was detected.
-.It Bq Er EINVAL
-The internal conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr btowc 3 ,
-.Xr mblen 3 ,
-.Xr mbrtowc 3 ,
-.Xr mbstowcs 3 ,
-.Xr multibyte 3 ,
-.Xr wctomb 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn mbtowc
-function conforms to
-.St -isoC-99 .
diff --git a/locale/mskanji-fbsd.c b/locale/mskanji-fbsd.c
deleted file mode 100644 (file)
index 3bf9a4d..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
- *
- *    ja_JP.SJIS locale table for BSD4.4/rune
- *    version 1.0
- *    (C) Sin'ichiro MIYATANI / Phase One, Inc
- *    May 12, 1995
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Phase One, Inc.
- * 4. The name of Phase One, Inc. may be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE  
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS  
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT  
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  
- * SUCH DAMAGE.  
- */  
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mskanji.c  1.0 (Phase One) 5/5/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <errno.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-static size_t  _MSKanji_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _MSKanji_mbsinit(const mbstate_t *, locale_t);
-static size_t  _MSKanji_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       wchar_t ch;
-} _MSKanjiState;
-
-__private_extern__ int
-_MSKanji_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _MSKanji_mbrtowc;
-       xrl->__wcrtomb = _MSKanji_wcrtomb;
-       xrl->__mbsinit = _MSKanji_mbsinit;
-       xrl->__mb_cur_max = 2;
-       xrl->__mb_sb_limit = 256;
-       return (0);
-}
-
-static int
-_MSKanji_mbsinit(const mbstate_t *ps, locale_t loc __unused)
-{
-
-       return (ps == NULL || ((const _MSKanjiState *)ps)->ch == 0);
-}
-
-static size_t
-_MSKanji_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _MSKanjiState *ms;
-       wchar_t wc;
-
-       ms = (_MSKanjiState *)ps;
-
-       if ((ms->ch & ~0xFF) != 0) {
-               /* Bad conversion state. */
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       if (ms->ch != 0) {
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (ms->ch << 8) | (*s & 0xFF);
-               if (pwc != NULL)
-                       *pwc = wc;
-               ms->ch = 0;
-               return (1);
-       }
-       wc = *s++ & 0xff;
-       if ((wc > 0x80 && wc < 0xa0) || (wc >= 0xe0 && wc < 0xfd)) {
-               if (n < 2) {
-                       /* Incomplete multibyte sequence */
-                       ms->ch = wc;
-                       return ((size_t)-2);
-               }
-               if (*s == '\0') {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wc = (wc << 8) | (*s++ & 0xff);
-               if (pwc != NULL)
-                       *pwc = wc;
-               return (2);
-       } else {
-               if (pwc != NULL)
-                       *pwc = wc;
-               return (wc == L'\0' ? 0 : 1);
-       }
-}
-
-static size_t
-_MSKanji_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc __unused)
-{
-       _MSKanjiState *ms;
-       int len, i;
-
-       ms = (_MSKanjiState *)ps;
-
-       if (ms->ch != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       len = (wc > 0x100) ? 2 : 1;
-       for (i = len; i-- > 0; )
-               *s++ = wc >> (i << 3);
-       return (len);
-}
diff --git a/locale/mskanji.5 b/locale/mskanji.5
deleted file mode 120000 (symlink)
index a6df939..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mskanji.5
\ No newline at end of file
diff --git a/locale/multibyte.3 b/locale/multibyte.3
deleted file mode 120000 (symlink)
index 28c63d2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./multibyte.3
\ No newline at end of file
diff --git a/locale/nextwctype-fbsd.c b/locale/nextwctype-fbsd.c
deleted file mode 100644 (file)
index 75e5056..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * Copyright (c) 2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <runetype.h>
-#include <wchar.h>
-#include <wctype.h>
-
-wint_t
-nextwctype_l(wint_t wc, wctype_t wct, locale_t loc)
-{
-       size_t lim;
-       _RuneRange *rr;
-       _RuneEntry *base, *re;
-       int noinc;
-       _RuneLocale *rl = &loc->__lc_ctype->_CurrentRuneLocale;
-
-       noinc = 0;
-       if (wc < _CACHED_RUNES) {
-               wc++;
-               while (wc < _CACHED_RUNES) {
-                       if (rl->__runetype[wc] & wct)
-                               return (wc);
-                       wc++;
-               }
-               wc--;
-       }
-       rr = &rl->__runetype_ext;
-       if (rr->__ranges != NULL && wc < rr->__ranges[0].__min) {
-               wc = rr->__ranges[0].__min;
-               noinc = 1;
-       }
-
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-               re = base + (lim >> 1);
-               if (re->__min <= wc && wc <= re->__max)
-                       goto found;
-               else if (wc > re->__max) {
-                       base = re + 1;
-                       lim--;
-               }
-       }
-       return (-1);
-found:
-       if (!noinc)
-               wc++;
-       if (re->__min <= wc && wc <= re->__max) {
-               if (re->__types != NULL) {
-                       for (; wc <= re->__max; wc++)
-                               if (re->__types[wc - re->__min] & wct)
-                                       return (wc);
-               } else if (re->__map & wct)
-                       return (wc);
-       }
-       while (++re < rr->__ranges + rr->__nranges) {
-               wc = re->__min;
-               if (re->__types != NULL) {
-                       for (; wc <= re->__max; wc++)
-                               if (re->__types[wc - re->__min] & wct)
-                                       return (wc);
-               } else if (re->__map & wct)
-                       return (wc);
-       }
-       return (-1);
-}
-
-wint_t
-nextwctype(wint_t wc, wctype_t wct)
-{
-       return nextwctype_l(wc, wct, __current_locale());
-}
diff --git a/locale/nextwctype.3 b/locale/nextwctype.3
deleted file mode 100644 (file)
index d2b959f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-.\"
-.\" Copyright (c) 2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/nextwctype.3,v 1.3 2005/07/21 10:27:45 tjr Exp $
-.\"
-.Dd July 21, 2005
-.Dt NEXTWCTYPE 3
-.Os
-.Sh NAME
-.Nm nextwctype ,
-.Nm nextwctype_l
-.Nd "iterate through character classes"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wctype.h
-.Ft wint_t
-.Fn nextwctype "wint_t ch" "wctype_t wct"
-.In xlocale.h
-.Ft wint_t
-.Fn nextwctype_l "wint_t ch" "wctype_t wct" "locale_t loc"
-.Sh DESCRIPTION
-The
-.Fn nextwctype
-function determines the next character after
-.Fa ch
-that is a member of character class
-.Fa wct .
-If
-.Fa ch
-is \-1, the search begins at the first member of
-.Fa wct .
-.Pp
-While the
-.Fn nextwctype
-function uses the current locale, the
- .Fn nextwctype_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn nextwctype
-function returns the next character, or \-1 if there are no more.
-.Sh COMPATIBILITY
-This function is a non-standard
-.Fx
-extension and should not be used where the standard
-.Fn iswctype
-function would suffice.
-.Sh SEE ALSO
-.Xr wctype 3 ,
-.Xr xlocale 3
-.Sh HISTORY
-The
-.Fn nextwctype
-function appeared in
-.Fx 5.4 .
diff --git a/locale/nl_langinfo-fbsd.c b/locale/nl_langinfo-fbsd.c
deleted file mode 100644 (file)
index 8a69f90..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*-
- * Copyright (c) 2001, 2003 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/nl_langinfo.c,v 1.17 2003/06/26 10:46:16 phantom Exp $");
-
-#include "xlocale_private.h"
-
-#include <langinfo.h>
-#include <limits.h>
-#include <locale.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "lnumeric.h"
-#include "lmessages.h"
-#include "lmonetary.h"
-#include "timelocal.h"
-
-#define _REL(BASE) ((int)item-BASE)
-
-char *
-nl_langinfo_l(nl_item item, locale_t loc)
-{
-   char *ret, *cs;
-   const char *s;
-   static char *csym = NULL;
-
-   NORMALIZE_LOCALE(loc);
-   switch (item) {
-       case CODESET:
-               ret = "";
-               if ((s = querylocale(LC_CTYPE_MASK, loc)) != NULL) {
-                       if ((cs = strchr(s, '.')) != NULL)
-                               ret = cs + 1;
-                       else if (strcmp(s, "C") == 0 ||
-                                strcmp(s, "POSIX") == 0)
-                               ret = "US-ASCII";
-                       else if (strcmp(s, "UTF-8") == 0)
-                               ret = "UTF-8";
-               }
-               break;
-       case D_T_FMT:
-               ret = (char *) __get_current_time_locale(loc)->c_fmt;
-               break;
-       case D_FMT:
-               ret = (char *) __get_current_time_locale(loc)->x_fmt;
-               break;
-       case T_FMT:
-               ret = (char *) __get_current_time_locale(loc)->X_fmt;
-               break;
-       case T_FMT_AMPM:
-               ret = (char *) __get_current_time_locale(loc)->ampm_fmt;
-               break;
-       case AM_STR:
-               ret = (char *) __get_current_time_locale(loc)->am;
-               break;
-       case PM_STR:
-               ret = (char *) __get_current_time_locale(loc)->pm;
-               break;
-       case DAY_1: case DAY_2: case DAY_3:
-       case DAY_4: case DAY_5: case DAY_6: case DAY_7:
-               ret = (char*) __get_current_time_locale(loc)->weekday[_REL(DAY_1)];
-               break;
-       case ABDAY_1: case ABDAY_2: case ABDAY_3:
-       case ABDAY_4: case ABDAY_5: case ABDAY_6: case ABDAY_7:
-               ret = (char*) __get_current_time_locale(loc)->wday[_REL(ABDAY_1)];
-               break;
-       case MON_1: case MON_2: case MON_3: case MON_4:
-       case MON_5: case MON_6: case MON_7: case MON_8:
-       case MON_9: case MON_10: case MON_11: case MON_12:
-               ret = (char*) __get_current_time_locale(loc)->month[_REL(MON_1)];
-               break;
-       case ABMON_1: case ABMON_2: case ABMON_3: case ABMON_4:
-       case ABMON_5: case ABMON_6: case ABMON_7: case ABMON_8:
-       case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12:
-               ret = (char*) __get_current_time_locale(loc)->mon[_REL(ABMON_1)];
-               break;
-       case ERA:
-               /* XXX: need to be implemented  */
-               ret = "";
-               break;
-       case ERA_D_FMT:
-               /* XXX: need to be implemented  */
-               ret = "";
-               break;
-       case ERA_D_T_FMT:
-               /* XXX: need to be implemented  */
-               ret = "";
-               break;
-       case ERA_T_FMT:
-               /* XXX: need to be implemented  */
-               ret = "";
-               break;
-       case ALT_DIGITS:
-               /* XXX: need to be implemented  */
-               ret = "";
-               break;
-       case RADIXCHAR:
-               ret = (char*) __get_current_numeric_locale(loc)->decimal_point;
-               break;
-       case THOUSEP:
-               ret = (char*) __get_current_numeric_locale(loc)->thousands_sep;
-               break;
-       case YESEXPR:
-               ret = (char*) __get_current_messages_locale(loc)->yesexpr;
-               break;
-       case NOEXPR:
-               ret = (char*) __get_current_messages_locale(loc)->noexpr;
-               break;
-       /*
-        * YESSTR and NOSTR items marked with LEGACY are available, but not
-        * recomended by SUSv2 to be used in portable applications since
-        * they're subject to remove in future specification editions.
-        */
-       case YESSTR:            /* LEGACY  */
-               ret = (char*) __get_current_messages_locale(loc)->yesstr;
-               break;
-       case NOSTR:             /* LEGACY  */
-               ret = (char*) __get_current_messages_locale(loc)->nostr;
-               break;
-       /*
-        * SUSv2 special formatted currency string 
-        */
-       case CRNCYSTR:
-               ret = "";
-               cs = (char*) __get_current_monetary_locale(loc)->currency_symbol;
-               if (*cs != '\0') {
-                       char pos = localeconv_l(loc)->p_cs_precedes;
-
-                       if (pos == localeconv_l(loc)->n_cs_precedes) {
-                               char psn = '\0';
-
-                               if (pos == CHAR_MAX) {
-                                       if (strcmp(cs, __get_current_monetary_locale(loc)->mon_decimal_point) == 0)
-                                               psn = '.';
-                               } else
-                                       psn = pos ? '-' : '+';
-                               if (psn != '\0') {
-                                       int clen = strlen(cs);
-
-                                       if ((csym = reallocf(csym, clen + 2)) != NULL) {
-                                               *csym = psn;
-                                               strcpy(csym + 1, cs);
-                                               ret = csym;
-                                       }
-                               }
-                       }
-               }
-               break;
-       case D_MD_ORDER:        /* FreeBSD local extension */
-               ret = (char *) __get_current_time_locale(loc)->md_order;
-               break;
-       default:
-               return "";      /* do not consult POSIX */
-   }
-   if (ret && !ret[0] && item != D_MD_ORDER && item != CODESET && loc != _c_locale) {
-       ret = nl_langinfo_l(item, _c_locale);
-   }
-   return (ret);
-}
-
-char *
-nl_langinfo(nl_item item)
-{
-       return (nl_langinfo_l(item, __current_locale()));
-}
diff --git a/locale/nl_langinfo.3 b/locale/nl_langinfo.3
deleted file mode 100644 (file)
index 3d846de..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-.\" Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/nl_langinfo.3,v 1.7 2009/11/16 14:33:31 brueffer Exp $
-.\"
-.Dd May 3, 2001
-.Dt NL_LANGINFO 3
-.Os
-.Sh NAME
-.Nm nl_langinfo ,
-.Nm nl_langinfo_l
-.Nd language information
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In langinfo.h
-.Ft char *
-.Fo nl_langinfo
-.Fa "nl_item item"
-.Fc
-.In langinfo.h
-.In xlocale.h
-.Ft char *
-.Fo nl_langinfo_l
-.Fa "nl_item item"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn nl_langinfo
-function returns a pointer to a string containing information relevant to
-the particular language or cultural area defined in the program's locale.
-The manifest constant names and values of
-.Fa item
-are defined in
-.In langinfo.h .
-.Pp
-Calls to
-.Fn setlocale
-with a category corresponding to the category of
-.Fa item ,
-or to the
-category
-.Dv LC_ALL ,
-may overwrite the buffer pointed to by the return value.
-.Sh RETURN VALUES
-In a locale where langinfo data is not defined,
-.Fn nl_langinfo
-returns a pointer to the corresponding string in the
-.Tn POSIX
-locale.
-In all locales,
-.Fn nl_langinfo
-returns a pointer to an empty string if
-.Fa item
-contains an invalid setting.
-.Sh EXAMPLES
-For example:
-.Pp
-.Dl nl_langinfo(ABDAY_1)
-.Pp
-would return a pointer to the string
-.Qq Li Dom
-if the identified language was
-Portuguese, and
-.Qq Li Sun
-if the identified language was English.
-.Pp
-While the
-.Fn nl_langinfo
-function uses the current locale, the
-.Fn nl_langinfo_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh SEE ALSO
-.Xr setlocale 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn nl_langinfo
-function conforms to
-.St -susv2 .
-.Sh HISTORY
-The
-.Fn nl_langinfo
-function first appeared in
-.Fx 4.6 .
diff --git a/locale/nomacros-fbsd.c b/locale/nomacros-fbsd.c
deleted file mode 120000 (symlink)
index d193afd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./nomacros.c
\ No newline at end of file
diff --git a/locale/none-fbsd.c b/locale/none-fbsd.c
deleted file mode 100644 (file)
index c3c75cf..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)none.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <runetype.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-/* setup defaults */
-
-int __mb_cur_max = 1;
-int __mb_sb_limit = 256; /* Expected to be <= _CACHED_RUNES */
-
-__private_extern__ int
-_none_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _none_mbrtowc;
-       xrl->__mbsinit = _none_mbsinit;
-       xrl->__mbsnrtowcs = _none_mbsnrtowcs;
-       xrl->__wcrtomb = _none_wcrtomb;
-       xrl->__wcsnrtombs = _none_wcsnrtombs;
-       xrl->__mb_cur_max = 1;
-       xrl->__mb_sb_limit = 256;
-       return(0);
-}
-
-__private_extern__ int
-_none_mbsinit(const mbstate_t *ps __unused, locale_t loc __unused)
-{
-
-       /*
-        * Encoding is not state dependent - we are always in the
-        * initial state.
-        */
-       return (1);
-}
-
-__private_extern__ size_t
-_none_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (0);
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-       if (pwc != NULL)
-               *pwc = (unsigned char)*s;
-       return (*s == '\0' ? 0 : 1);
-}
-
-__private_extern__ size_t
-_none_wcrtomb(char * __restrict s, wchar_t wc,
-    mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-       if (wc < 0 || wc > UCHAR_MAX) {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       *s = (unsigned char)wc;
-       return (1);
-}
-
-__private_extern__ size_t
-_none_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-       const char *s;
-       size_t nchr;
-
-       if (dst == NULL) {
-               s = memchr(*src, '\0', nms);
-               return (s != NULL ? s - *src : nms);
-       }
-
-       s = *src;
-       nchr = 0;
-       while (len-- > 0 && nms-- > 0) {
-               if ((*dst++ = (unsigned char)*s++) == L'\0') {
-                       *src = NULL;
-                       return (nchr);
-               }
-               nchr++;
-       }
-       *src = s;
-       return (nchr);
-}
-
-__private_extern__ size_t
-_none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps __unused, locale_t loc __unused)
-{
-       const wchar_t *s;
-       size_t nchr;
-
-       if (dst == NULL) {
-               for (s = *src; nwc > 0 && *s != L'\0'; s++, nwc--) {
-                       if (*s < 0 || *s > UCHAR_MAX) {
-                               errno = EILSEQ;
-                               return ((size_t)-1);
-                       }
-               }
-               return (s - *src);
-       }
-
-       s = *src;
-       nchr = 0;
-       while (len-- > 0 && nwc-- > 0) {
-               if (*s < 0 || *s > UCHAR_MAX) {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               if ((*dst++ = *s++) == '\0') {
-                       *src = NULL;
-                       return (nchr);
-               }
-               nchr++;
-       }
-       *src = s;
-       return (nchr);
-}
diff --git a/locale/rune-fbsd.c b/locale/rune-fbsd.c
deleted file mode 100644 (file)
index 5963761..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef RUNEOFF32
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rune.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/rune.c,v 1.12 2004/07/29 06:16:19 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <arpa/inet.h>
-#include <errno.h>
-#include <runetype.h>
-#else
-#include "runetype.h"
-#endif /* !RUNEOFF32 */
-#include <stdio.h>
-#ifndef RUNEOFF32
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "un-namespace.h"
-#endif /* !RUNEOFF32 */
-
-#if defined(__LP64__) || defined(RUNEOFF32)
-/*
- * Because the LC_CTYPE files were created with a 32-bit program, we need
- * to adjust for the larger pointers in LP64 (the longs have already been
- * replaced by 32-bit equivalents).  Also, natural alignment will pad
- * 64-bit types to 8-byte boundaries, and make structures containing
- * 64-bit types sized to 8-byte boundaries.
- */
-#include <stddef.h>
-#ifndef RUNEOFF32
-#include "rune32.h"
-#define BYTES32BITS            4
-#define BYTES64BITS            8
-/* whether to skip over a pointer or not (one-to-one with off64) */
-int skip[] = {
-       1,
-       1,
-       0,
-       1,
-       0,
-       1,
-       0,
-       1,
-       1,
-       1,
-       0
-};
-#endif /* !RUNEOFF32 */
-int off64[] = {
-       offsetof(_RuneLocale, __sgetrune),
-       offsetof(_RuneLocale, __sputrune),
-       offsetof(_RuneLocale, __runetype_ext),
-       offsetof(_RuneLocale, __runetype_ext) + offsetof(_RuneRange, __ranges),
-       offsetof(_RuneLocale, __maplower_ext),
-       offsetof(_RuneLocale, __maplower_ext) + offsetof(_RuneRange, __ranges),
-       offsetof(_RuneLocale, __mapupper_ext),
-       offsetof(_RuneLocale, __mapupper_ext) + offsetof(_RuneRange, __ranges),
-       offsetof(_RuneLocale, __variable),
-       offsetof(_RuneLocale, __charclasses),
-       sizeof(_RuneLocale)
-};
-#define        NOFF                    (sizeof(off64) / sizeof(int))
-#ifdef RUNEOFF32
-/*
- * This program generates a header file (on stdout) that containes the 32-bit
- * offsets, plus some 32-bit sizes
- */
-main()
-{
-       int i;
-       printf("#define SIZEOF32_RUNEENTRY %d\n", sizeof(_RuneEntry));
-       printf("#define SIZEOF32_RUNELOCALE %d\n", sizeof(_RuneLocale));
-       printf("int off32[] = {\n");
-       for(i = 0; i < NOFF; i++)
-               printf("\t%d,\n", off64[i]);
-       printf("};\n");
-       return 0;
-}
-#endif /* RUNEOFF32 */
-#else /* !__LP64__ && !RUNEOFF32 */
-#define        SIZEOF32_RUNELOCALE     sizeof(_RuneLocale)
-#endif /* __LP64__ || RUNEOFF32 */
-
-#ifndef RUNEOFF32
-struct __xlocale_st_runelocale *
-_Read_RuneMagi(fp)
-       FILE *fp;
-{
-       struct __xlocale_st_runelocale *data;
-       void *lastp;
-       _RuneLocale *rl;
-       _RuneEntry *rr;
-       struct stat sb;
-       int x, saverr;
-
-       if (_fstat(fileno(fp), &sb) < 0)
-               return (NULL);
-
-       if (sb.st_size < SIZEOF32_RUNELOCALE) {
-               errno = EFTYPE;
-               return (NULL);
-       }
-
-#ifdef __LP64__
-       /* will adjust later */
-       if ((data = (struct __xlocale_st_runelocale *)malloc(sizeof(struct __xlocale_st_runelocale))) == NULL)
-#else /* !__LP64__ */
-       if ((data = (struct __xlocale_st_runelocale *)malloc(sizeof(struct __xlocale_st_runelocale) - sizeof(_RuneLocale) + sb.st_size)) == NULL)
-#endif /* __LP64__ */
-               return (NULL);
-       data->__refcount = 1;
-       data->__free_extra = NULL;
-
-       errno = 0;
-       rewind(fp); /* Someone might have read the magic number once already */
-       if (errno) {
-               saverr = errno;
-               free(data);
-               errno = saverr;
-               return (NULL);
-       }
-
-       rl = &data->_CurrentRuneLocale;
-
-#ifdef __LP64__
-       if (fread(rl, SIZEOF32_RUNELOCALE, 1, fp) != 1)
-#else /* !__LP64__ */
-       if (fread(rl, sb.st_size, 1, fp) != 1)
-#endif /* __LP64__ */
-       {
-               saverr = errno;
-               free(data);
-               errno = saverr;
-               return (NULL);
-       }
-
-#ifndef __LP64__
-       lastp = (char *)rl + sb.st_size;
-
-       rl->__variable = rl + 1;
-#endif /* __LP64__ */
-
-       if (memcmp(rl->__magic, _RUNE_MAGIC_A, sizeof(rl->__magic))) {
-               free(data);
-               errno = EFTYPE;
-               return (NULL);
-       }
-
-#ifdef __LP64__
-       /* shift things into the right position */
-       for (x = NOFF - 2; x >= 0; x--)
-               memmove((char *)rl + off64[x] + (skip[x] ? BYTES64BITS : 0),
-                       (char *)rl + off32[x] + (skip[x] ? BYTES32BITS : 0),
-                       off32[x + 1] - off32[x] - (skip[x] ? BYTES32BITS : 0));
-#endif /* __LP64__ */
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-       rl->__invalid_rune = ntohl(rl->__invalid_rune);
-       rl->__variable_len = ntohl(rl->__variable_len);
-       rl->__ncharclasses = ntohl(rl->__ncharclasses);
-       rl->__runetype_ext.__nranges = ntohl(rl->__runetype_ext.__nranges);
-       rl->__maplower_ext.__nranges = ntohl(rl->__maplower_ext.__nranges);
-       rl->__mapupper_ext.__nranges = ntohl(rl->__mapupper_ext.__nranges);
-
-       for (x = 0; x < _CACHED_RUNES; ++x) {
-               rl->__runetype[x] = ntohl(rl->__runetype[x]);
-               rl->__maplower[x] = ntohl(rl->__maplower[x]);
-               rl->__mapupper[x] = ntohl(rl->__mapupper[x]);
-       }
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-
-#ifdef __LP64__
-       {
-       int count = rl->__runetype_ext.__nranges + rl->__maplower_ext.__nranges
-           + rl->__mapupper_ext.__nranges;
-       int extra = sb.st_size - SIZEOF32_RUNELOCALE - count * SIZEOF32_RUNEENTRY - rl->__ncharclasses * sizeof(_RuneCharClass);
-       _RuneEntry *rp;
-
-       if (extra < 0) {
-               saverr = errno;
-               free(data);
-               errno = saverr;
-               return (NULL);
-       }
-       if ((data = (struct __xlocale_st_runelocale *)reallocf(data, sizeof(struct __xlocale_st_runelocale)
-           + count * sizeof(_RuneEntry)
-           + rl->__ncharclasses * sizeof(_RuneCharClass)
-           + extra)) == NULL)
-               return (NULL);
-       rl = &data->_CurrentRuneLocale;
-       rl->__variable = rl + 1;
-       rp = (_RuneEntry *)rl->__variable;
-       for (x = 0; x < count; x++, rp++)
-               if (fread(rp, SIZEOF32_RUNEENTRY, 1, fp) != 1) {
-                       saverr = errno;
-                       free(data);
-                       errno = saverr;
-                       return (NULL);
-               }
-       if (rl->__ncharclasses > 0) {
-               if (fread(rp, sizeof(_RuneCharClass), rl->__ncharclasses, fp) != rl->__ncharclasses) {
-                       saverr = errno;
-                       free(data);
-                       errno = saverr;
-                       return (NULL);
-               }
-               rp = (_RuneEntry *)((char *)rp + rl->__ncharclasses * sizeof(_RuneCharClass));
-       }
-       if (extra > 0 && fread(rp, extra, 1, fp) != 1) {
-               saverr = errno;
-               free(data);
-               errno = saverr;
-               return (NULL);
-       }
-       lastp = (char *)rp + extra;
-       }
-#endif /* __LP64__ */
-       rl->__runetype_ext.__ranges = (_RuneEntry *)rl->__variable;
-       rl->__variable = rl->__runetype_ext.__ranges +
-           rl->__runetype_ext.__nranges;
-       if (rl->__variable > lastp) {
-               free(data);
-               errno = EFTYPE;
-               return (NULL);
-       }
-
-       rl->__maplower_ext.__ranges = (_RuneEntry *)rl->__variable;
-       rl->__variable = rl->__maplower_ext.__ranges +
-           rl->__maplower_ext.__nranges;
-       if (rl->__variable > lastp) {
-               free(data);
-               errno = EFTYPE;
-               return (NULL);
-       }
-
-       rl->__mapupper_ext.__ranges = (_RuneEntry *)rl->__variable;
-       rl->__variable = rl->__mapupper_ext.__ranges +
-           rl->__mapupper_ext.__nranges;
-       if (rl->__variable > lastp) {
-               free(data);
-               errno = EFTYPE;
-               return (NULL);
-       }
-
-       for (x = 0; x < rl->__runetype_ext.__nranges; ++x) {
-               rr = rl->__runetype_ext.__ranges;
-
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-               rr[x].__min = ntohl(rr[x].__min);
-               rr[x].__max = ntohl(rr[x].__max);
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-               if ((rr[x].__map = ntohl(rr[x].__map)) == 0) {
-                       int len = rr[x].__max - rr[x].__min + 1;
-                       rr[x].__types = rl->__variable;
-                       rl->__variable = rr[x].__types + len;
-                       if (rl->__variable > lastp) {
-                               free(data);
-                               errno = EFTYPE;
-                               return (NULL);
-                       }
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-                       while (len-- > 0)
-                               rr[x].__types[len] = ntohl(rr[x].__types[len]);
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-               } else
-                       rr[x].__types = 0;
-       }
-
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-       for (x = 0; x < rl->__maplower_ext.__nranges; ++x) {
-               rr = rl->__maplower_ext.__ranges;
-
-               rr[x].__min = ntohl(rr[x].__min);
-               rr[x].__max = ntohl(rr[x].__max);
-               rr[x].__map = ntohl(rr[x].__map);
-       }
-
-       for (x = 0; x < rl->__mapupper_ext.__nranges; ++x) {
-               rr = rl->__mapupper_ext.__ranges;
-
-               rr[x].__min = ntohl(rr[x].__min);
-               rr[x].__max = ntohl(rr[x].__max);
-               rr[x].__map = ntohl(rr[x].__map);
-       }
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-
-       if (rl->__ncharclasses > 0) {
-               rl->__charclasses = (_RuneCharClass *)rl->__variable;
-               rl->__variable = (void *)(rl->__charclasses + rl->__ncharclasses);
-               if (rl->__variable > lastp) {
-                       free(data);
-                       errno = EFTYPE;
-                       return (NULL);
-               }
-#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
-               for (x = 0; x < rl->__ncharclasses; ++x)
-                       rl->__charclasses[x].__mask = ntohl(rl->__charclasses[x].__mask);
-#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */
-       }
-
-       if (((char *)rl->__variable) + rl->__variable_len > (char *)lastp) {
-               free(data);
-               errno = EFTYPE;
-               return (NULL);
-       }
-
-       /*
-        * Go out and zero pointers that should be zero.
-        */
-       if (!rl->__variable_len)
-               rl->__variable = 0;
-
-       if (!rl->__runetype_ext.__nranges)
-               rl->__runetype_ext.__ranges = 0;
-
-       if (!rl->__maplower_ext.__nranges)
-               rl->__maplower_ext.__ranges = 0;
-
-       if (!rl->__mapupper_ext.__nranges)
-               rl->__mapupper_ext.__ranges = 0;
-
-       data->__datasize = lastp - (void *)data;
-       return (data);
-}
-#endif /* !RUNEOFF32 */
diff --git a/locale/rune32.h b/locale/rune32.h
deleted file mode 100644 (file)
index 0a0661b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#define SIZEOF32_RUNEENTRY 16
-#define SIZEOF32_RUNELOCALE 3164
-int off32[] = {
-       40,
-       44,
-       3124,
-       3128,
-       3132,
-       3136,
-       3140,
-       3144,
-       3148,
-       3160,
-       3164,
-};
diff --git a/locale/runetype-fbsd.c b/locale/runetype-fbsd.c
deleted file mode 100644 (file)
index 6ffcf72..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.14 2007/01/09 00:28:00 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <runetype.h>
-
-unsigned long
-___runetype_l(__ct_rune_t c, locale_t loc)
-{
-       size_t lim;
-       _RuneRange *rr;
-       _RuneEntry *base, *re;
-
-       if (c < 0 || c == EOF)
-               return(0L);
-
-       NORMALIZE_LOCALE(loc);
-       rr = &loc->__lc_ctype->_CurrentRuneLocale.__runetype_ext;
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-               re = base + (lim >> 1);
-               if (re->__min <= c && c <= re->__max) {
-                       if (re->__types)
-                           return(re->__types[c - re->__min]);
-                       else
-                           return(re->__map);
-               } else if (c > re->__max) {
-                       base = re + 1;
-                       lim--;
-               }
-       }
-
-       return(0L);
-}
-
-unsigned long
-___runetype(__ct_rune_t c)
-{
-       return ___runetype_l(c, __current_locale());
-}
diff --git a/locale/setlocale-fbsd.c b/locale/setlocale-fbsd.c
deleted file mode 100644 (file)
index 9729e54..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright (c) 1996 - 2002 FreeBSD Project
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setlocale.c        8.1 (Berkeley) 7/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <limits.h>
-#include <locale.h>
-#include <paths.h>     /* for _PATH_LOCALE */
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "collate.h"
-#include "lmonetary.h" /* for __monetary_load_locale() */
-#include "lnumeric.h"  /* for __numeric_load_locale() */
-#include "lmessages.h" /* for __messages_load_locale() */
-#include "setlocale.h"
-#include "ldpart.h"
-#include "timelocal.h" /* for __time_load_locale() */
-
-/*
- * Category names for getenv()
- */
-static char *categories[_LC_LAST] = {
-    "LC_ALL",
-    "LC_COLLATE",
-    "LC_CTYPE",
-    "LC_MONETARY",
-    "LC_NUMERIC",
-    "LC_TIME",
-    "LC_MESSAGES",
-};
-
-/*
- * Current locales for each category
- */
-static char current_categories[_LC_LAST][ENCODING_LEN + 1] = {
-    "C",
-    "C",
-    "C",
-    "C",
-    "C",
-    "C",
-    "C",
-};
-
-/*
- * Path to locale storage directory
- */
-char   *_PathLocale;
-
-/*
- * The locales we are going to try and load
- */
-static char new_categories[_LC_LAST][ENCODING_LEN + 1];
-static char saved_categories[_LC_LAST][ENCODING_LEN + 1];
-
-static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)];
-
-static char    *currentlocale(void);
-static char    *loadlocale(int);
-__private_extern__ const char *__get_locale_env(int);
-
-#define        UNLOCK_AND_RETURN(x)    {XL_UNLOCK(&__global_locale); return (x);}
-
-char *
-setlocale(category, locale)
-       int category;
-       const char *locale;
-{
-       int i, j, len, saverr, save__numeric_fp_cvt;
-        const char *env, *r;
-       locale_t save__lc_numeric_loc;
-
-       if (category < LC_ALL || category >= _LC_LAST) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       if (locale == NULL)
-               return (category != LC_ALL ?
-                   current_categories[category] : currentlocale());
-
-       XL_LOCK(&__global_locale);
-       /*
-        * Default to the current locale for everything.
-        */
-       for (i = 1; i < _LC_LAST; ++i)
-               (void)strcpy(new_categories[i], current_categories[i]);
-
-       /*
-        * Now go fill up new_categories from the locale argument
-        */
-       if (!*locale) {
-               if (category == LC_ALL) {
-                       for (i = 1; i < _LC_LAST; ++i) {
-                               env = __get_locale_env(i);
-                               if (strlen(env) > ENCODING_LEN) {
-                                       errno = EINVAL;
-                                       UNLOCK_AND_RETURN (NULL);
-                               }
-                               (void)strcpy(new_categories[i], env);
-                       }
-               } else {
-                       env = __get_locale_env(category);
-                       if (strlen(env) > ENCODING_LEN) {
-                               errno = EINVAL;
-                               UNLOCK_AND_RETURN (NULL);
-                       }
-                       (void)strcpy(new_categories[category], env);
-               }
-       } else if (category != LC_ALL) {
-               if (strlen(locale) > ENCODING_LEN) {
-                       errno = EINVAL;
-                       UNLOCK_AND_RETURN (NULL);
-               }
-               (void)strcpy(new_categories[category], locale);
-       } else {
-               if ((r = strchr(locale, '/')) == NULL) {
-                       if (strlen(locale) > ENCODING_LEN) {
-                               errno = EINVAL;
-                               UNLOCK_AND_RETURN (NULL);
-                       }
-                       for (i = 1; i < _LC_LAST; ++i)
-                               (void)strcpy(new_categories[i], locale);
-               } else {
-                       for (i = 1; r[1] == '/'; ++r)
-                               ;
-                       if (!r[1]) {
-                               errno = EINVAL;
-                               UNLOCK_AND_RETURN (NULL);       /* Hmm, just slashes... */
-                       }
-                       do {
-                               if (i == _LC_LAST)
-                                       break;  /* Too many slashes... */
-                               if ((len = r - locale) > ENCODING_LEN) {
-                                       errno = EINVAL;
-                                       UNLOCK_AND_RETURN (NULL);
-                               }
-                               (void)strlcpy(new_categories[i], locale,
-                                             len + 1);
-                               i++;
-                               while (*r == '/')
-                                       r++;
-                               locale = r;
-                               while (*r && *r != '/')
-                                       r++;
-                       } while (*locale);
-                       while (i < _LC_LAST) {
-                               (void)strcpy(new_categories[i],
-                                            new_categories[i-1]);
-                               i++;
-                       }
-               }
-       }
-
-       if (category != LC_ALL)
-               UNLOCK_AND_RETURN (loadlocale(category));
-
-       save__numeric_fp_cvt = __global_locale.__numeric_fp_cvt;
-       save__lc_numeric_loc = __global_locale.__lc_numeric_loc;
-       XL_RETAIN(save__lc_numeric_loc);
-       for (i = 1; i < _LC_LAST; ++i) {
-               (void)strcpy(saved_categories[i], current_categories[i]);
-               if (loadlocale(i) == NULL) {
-                       saverr = errno;
-                       for (j = 1; j < i; j++) {
-                               (void)strcpy(new_categories[j],
-                                            saved_categories[j]);
-                               if (loadlocale(j) == NULL) {
-                                       (void)strcpy(new_categories[j], "C");
-                                       (void)loadlocale(j);
-                               }
-                       }
-                       __global_locale.__numeric_fp_cvt = save__numeric_fp_cvt;
-                       __global_locale.__lc_numeric_loc = save__lc_numeric_loc;
-                       XL_RELEASE(save__lc_numeric_loc);
-                       errno = saverr;
-                       UNLOCK_AND_RETURN (NULL);
-               }
-       }
-       XL_RELEASE(save__lc_numeric_loc);
-       UNLOCK_AND_RETURN (currentlocale());
-}
-
-static char *
-currentlocale()
-{
-       int i;
-
-       (void)strcpy(current_locale_string, current_categories[1]);
-
-       for (i = 2; i < _LC_LAST; ++i)
-               if (strcmp(current_categories[1], current_categories[i])) {
-                       for (i = 2; i < _LC_LAST; ++i) {
-                               (void)strcat(current_locale_string, "/");
-                               (void)strcat(current_locale_string,
-                                            current_categories[i]);
-                       }
-                       break;
-               }
-       return (current_locale_string);
-}
-
-static char *
-loadlocale(category)
-       int category;
-{
-       char *new = new_categories[category];
-       char *old = current_categories[category];
-       int (*func)(const char *, locale_t);
-       int saved_errno;
-
-       if ((new[0] == '.' &&
-            (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) ||
-           strchr(new, '/') != NULL) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       saved_errno = errno;
-       errno = __detect_path_locale();
-       if (errno != 0)
-               return (NULL);
-       errno = saved_errno;
-
-       switch (category) {
-       case LC_CTYPE:
-               func = __wrap_setrunelocale;
-               break;
-       case LC_COLLATE:
-               func = __collate_load_tables;
-               break;
-       case LC_TIME:
-               func = __time_load_locale;
-               break;
-       case LC_NUMERIC:
-               func = __numeric_load_locale;
-               break;
-       case LC_MONETARY:
-               func = __monetary_load_locale;
-               break;
-       case LC_MESSAGES:
-               func = __messages_load_locale;
-               break;
-       default:
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       if (strcmp(new, old) == 0)
-               return (old);
-
-       if (func(new, &__global_locale) != _LDP_ERROR) {
-               (void)strcpy(old, new);
-               switch (category) {
-               case LC_CTYPE:
-                       if (__global_locale.__numeric_fp_cvt == LC_NUMERIC_FP_SAME_LOCALE)
-                               __global_locale.__numeric_fp_cvt = LC_NUMERIC_FP_UNINITIALIZED;
-                       break;
-               case LC_NUMERIC:
-                       __global_locale.__numeric_fp_cvt = LC_NUMERIC_FP_UNINITIALIZED;
-                       XL_RELEASE(__global_locale.__lc_numeric_loc);
-                       __global_locale.__lc_numeric_loc = NULL;
-                       break;
-               }
-               return (old);
-       }
-
-       return (NULL);
-}
-
-__private_extern__ const char *
-__get_locale_env(category)
-        int category;
-{
-        const char *env;
-
-        /* 1. check LC_ALL. */
-        env = getenv(categories[0]);
-
-        /* 2. check LC_* */
-       if (env == NULL || !*env)
-                env = getenv(categories[category]);
-
-        /* 3. check LANG */
-       if (env == NULL || !*env)
-                env = getenv("LANG");
-
-        /* 4. if none is set, fall to "C" */
-       if (env == NULL || !*env)
-                env = "C";
-
-       return (env);
-}
-
-/*
- * Detect locale storage location and store its value to _PathLocale variable
- */
-__private_extern__ int
-__detect_path_locale(void)
-{
-       if (_PathLocale == NULL) {
-               char *p = getenv("PATH_LOCALE");
-
-               if (p != NULL && !issetugid()) {
-                       if (strlen(p) + 1/*"/"*/ + ENCODING_LEN +
-                           1/*"/"*/ + CATEGORY_LEN >= PATH_MAX)
-                               return (ENAMETOOLONG);
-                       _PathLocale = strdup(p);
-                       if (_PathLocale == NULL)
-                               return (errno == 0 ? ENOMEM : errno);
-               } else
-                       _PathLocale = _PATH_LOCALE;
-       }
-       return (0);
-}
-
diff --git a/locale/setlocale.3 b/locale/setlocale.3
deleted file mode 100644 (file)
index 6d3be03..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley at BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)setlocale.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/locale/setlocale.3,v 1.35 2007/01/09 00:28:00 imp Exp $
-.\"
-.Dd November 21, 2003
-.Dt SETLOCALE 3
-.Os
-.Sh NAME
-.Nm setlocale
-.Nd natural language formatting for C
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In locale.h
-.Ft char *
-.Fo setlocale
-.Fa "int category"
-.Fa "const char *locale"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn setlocale
-function sets the C library's notion
-of natural language formatting style
-for particular sets of routines.
-Each such style is called a
-.Sq locale
-and is invoked using an appropriate name passed as a C string.
-.Pp
-The
-.Fn setlocale
-function recognizes several categories of routines.
-These are the categories and the sets of routines they select:
-.Pp
-.Bl -tag -width LC_MONETARY
-.It Dv LC_ALL
-Set the entire locale generically.
-.It Dv LC_COLLATE
-Set a locale for string collation routines.
-This controls alphabetic ordering in
-.Fn strcoll
-and
-.Fn strxfrm .
-.It Dv LC_CTYPE
-Set a locale for the
-.Xr ctype 3
-and
-.Xr multibyte 3
-functions.
-This controls recognition of upper and lower case,
-alphabetic or non-alphabetic characters,
-and so on.
-.It Dv LC_MESSAGES
-Set a locale for message catalogs, see
-.Xr catopen 3
-function.
-.It Dv LC_MONETARY
-Set a locale for formatting monetary values;
-this affects the
-.Fn localeconv
-function.
-.It Dv LC_NUMERIC
-Set a locale for formatting numbers.
-This controls the formatting of decimal points
-in input and output of floating point numbers
-in functions such as
-.Fn printf
-and
-.Fn scanf ,
-as well as values returned by
-.Fn localeconv .
-.It Dv LC_TIME
-Set a locale for formatting dates and times using the
-.Fn strftime
-function.
-.El
-.Pp
-Only three locales are defined by default:
-the empty string
-.Li "\&""\|""
-(which denotes the native environment) and the
-.Li "\&""C""
-and
-.Li "\&""POSIX""
-locales (which denote the C-language environment).
-A
-.Fa locale
-argument of
-.Dv NULL
-causes
-.Fn setlocale
-to return the current locale.
-By default, C programs start in the
-.Li "\&""C""
-locale.
-The only function in the library that sets the locale is
-.Fn setlocale ;
-the locale is never changed as a side effect of some other routine.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn setlocale
-returns the string associated with the specified
-.Fa category
-for the requested
-.Fa locale .
-The
-.Fn setlocale
-function returns
-.Dv NULL
-and fails to change the locale
-if the given combination of
-.Fa category
-and
-.Fa locale
-makes no sense.
-.Sh FILES
-.Bl -tag -width /usr/share/locale/locale/category -compact
-.It Pa $PATH_LOCALE/ Ns Em locale/category
-.It Pa /usr/share/locale/ Ns Em locale/category
-locale file for the locale
-.Em locale
-and the category
-.Em category .
-.El
-.Sh ERRORS
-No errors are defined.
-.Sh SEE ALSO
-.Xr colldef 1 ,
-.Xr mklocale 1 ,
-.Xr catopen 3 ,
-.Xr ctype 3 ,
-.Xr localeconv 3 ,
-.Xr multibyte 3 ,
-.Xr strcoll 3 ,
-.Xr strxfrm 3 ,
-.Xr euc 5 ,
-.Xr utf8 5 ,
-.Xr environ 7
-.Sh STANDARDS
-The
-.Fn setlocale
-function conforms to
-.St -isoC-99 .
-.Sh HISTORY
-The
-.Fn setlocale
-function first appeared in
-.Bx 4.4 .
diff --git a/locale/setlocale.h b/locale/setlocale.h
deleted file mode 100644 (file)
index b21f6f7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/locale/setlocale.h,v 1.6 2003/07/06 02:03:37 ache Exp $
- */
-
-#ifndef _SETLOCALE_H_
-#define        _SETLOCALE_H_
-
-#include <xlocale.h>
-
-#define ENCODING_LEN 31
-#define CATEGORY_LEN 11
-
-extern char *_PathLocale;
-
-int    __detect_path_locale(void);
-int    __wrap_setrunelocale(const char *, locale_t);
-
-#endif /* !_SETLOCALE_H_ */
diff --git a/locale/setrunelocale-fbsd.c b/locale/setrunelocale-fbsd.c
deleted file mode 100644 (file)
index fbb2275..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:35 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <runetype.h>
-#include <errno.h>
-#include <limits.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <wchar.h>
-#include "ldpart.h"
-#include "mblocal.h"
-#include "setlocale.h"
-
-extern struct __xlocale_st_runelocale  *_Read_RuneMagi(FILE *);
-
-#ifdef UNIFDEF_LEGACY_RUNE_APIS
-/* depreciated interfaces */
-rune_t sgetrune(const char *, size_t, char const **);
-int    sputrune(rune_t, char *, size_t, char **);
-#endif /* UNIFDEF_LEGACY_RUNE_APIS */
-
-__private_extern__ int
-__setrunelocale(const char *encoding, locale_t loc)
-{
-       FILE *fp;
-       char name[PATH_MAX];
-       struct __xlocale_st_runelocale *xrl;
-       _RuneLocale *rl;
-       int saverr, ret;
-       static struct __xlocale_st_runelocale *CachedRuneLocale;
-       extern int __mb_cur_max;
-       extern int __mb_sb_limit;
-       static pthread_lock_t cache_lock = LOCK_INITIALIZER;
-
-       /*
-        * The "C" and "POSIX" locale are always here.
-        */
-       if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
-               XL_RELEASE(loc->__lc_ctype);
-               loc->__lc_ctype = &_DefaultRuneXLocale;
-               /* no need to retain _DefaultRuneXLocale */
-               if (loc == &__global_locale) {
-                       _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
-                       __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
-                       __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
-               }
-               return (0);
-       }
-
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-       LOCK(cache_lock);
-       if (CachedRuneLocale != NULL &&
-           strcmp(encoding, CachedRuneLocale->__ctype_encoding) == 0) {
-               XL_RELEASE(loc->__lc_ctype);
-               loc->__lc_ctype = CachedRuneLocale;
-               XL_RETAIN(loc->__lc_ctype);
-               if (loc == &__global_locale) {
-                       _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
-                       __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
-                       __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
-               }
-               UNLOCK(cache_lock);
-               return (0);
-       }
-       UNLOCK(cache_lock);
-
-       /*
-        * Slurp the locale file into the cache.
-        */
-
-       /* Range checking not needed, encoding length already checked before */
-       (void) strcpy(name, _PathLocale);
-       (void) strcat(name, "/");
-       (void) strcat(name, encoding);
-       (void) strcat(name, "/LC_CTYPE");
-
-       if ((fp = fopen(name, "r")) == NULL)
-               return (errno == 0 ? ENOENT : errno);
-
-       if ((xrl = _Read_RuneMagi(fp)) == NULL) {
-               saverr = (errno == 0 ? EFTYPE : errno);
-               (void)fclose(fp);
-               return (saverr);
-       }
-       (void)fclose(fp);
-
-       xrl->__mbrtowc = NULL;
-       xrl->__mbsinit = NULL;
-       xrl->__mbsnrtowcs = __mbsnrtowcs_std;
-       xrl->__wcrtomb = NULL;
-       xrl->__wcsnrtombs = __wcsnrtombs_std;
-
-       rl = &xrl->_CurrentRuneLocale;
-
-#ifdef UNIFDEF_LEGACY_RUNE_APIS
-       /* provide backwards compatibility (depreciated interface) */
-       rl->__sputrune = sputrune;
-       rl->__sgetrune = sgetrune;
-#else /* UNIFDEF_LEGACY_RUNE_APIS */
-       rl->__sputrune = NULL;
-       rl->__sgetrune = NULL;
-#endif /* UNIFDEF_LEGACY_RUNE_APIS */
-
-       if (strcmp(rl->__encoding, "NONE") == 0)
-               ret = _none_init(xrl);
-       else if (strcmp(rl->__encoding, "ASCII") == 0)
-               ret = _ascii_init(xrl);
-       else if (strcmp(rl->__encoding, "UTF-8") == 0)
-               ret = _UTF8_init(xrl);
-       else if (strcmp(rl->__encoding, "EUC") == 0)
-               ret = _EUC_init(xrl);
-       else if (strcmp(rl->__encoding, "GB18030") == 0)
-               ret = _GB18030_init(xrl);
-       else if (strcmp(rl->__encoding, "GB2312") == 0)
-               ret = _GB2312_init(xrl);
-       else if (strcmp(rl->__encoding, "GBK") == 0)
-               ret = _GBK_init(xrl);
-       else if (strcmp(rl->__encoding, "BIG5") == 0)
-               ret = _BIG5_init(xrl);
-       else if (strcmp(rl->__encoding, "MSKanji") == 0)
-               ret = _MSKanji_init(xrl);
-       else if (strcmp(rl->__encoding, "UTF2") == 0)
-               ret = _UTF2_init(xrl);
-       else
-               ret = EFTYPE;
-
-       if (ret == 0) {
-               (void)strcpy(xrl->__ctype_encoding, encoding);
-               XL_RELEASE(loc->__lc_ctype);
-               loc->__lc_ctype = xrl;
-               if (loc == &__global_locale) {
-                       _CurrentRuneLocale = &loc->__lc_ctype->_CurrentRuneLocale;
-                       __mb_cur_max = loc->__lc_ctype->__mb_cur_max;
-                       __mb_sb_limit = loc->__lc_ctype->__mb_sb_limit;
-               }
-               LOCK(cache_lock);
-               XL_RELEASE(CachedRuneLocale);
-               CachedRuneLocale = xrl;
-               XL_RETAIN(CachedRuneLocale);
-               UNLOCK(cache_lock);
-       } else
-               XL_RELEASE(xrl);
-
-       return (ret);
-}
-
-#ifdef UNIFDEF_LEGACY_RUNE_APIS
-int
-setrunelocale(const char *encoding)
-{
-       int ret;
-
-       XL_LOCK(&__global_locale);
-       ret = __setrunelocale(encoding, &__global_locale);
-       XL_UNLOCK(&__global_locale);
-       return ret;
-}
-#endif /* UNIFDEF_LEGACY_RUNE_APIS */
-
-__private_extern__ int
-__wrap_setrunelocale(const char *locale, locale_t loc)
-{
-       int ret = __setrunelocale(locale, loc);
-
-       if (ret != 0) {
-               errno = ret;
-               return (_LDP_ERROR);
-       }
-       return (_LDP_LOADED);
-}
-
diff --git a/locale/table-fbsd.c b/locale/table-fbsd.c
deleted file mode 100644 (file)
index 667b846..0000000
+++ /dev/null
@@ -1,468 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)table.c    8.1 (Berkeley) 6/27/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.28 2007/01/09 00:28:00 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <runetype.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-/* _DefaultRuneLocale is depreciated; _DefaultRuneXLocale is used instead */
-_RuneLocale _DefaultRuneLocale __attribute__((section("__DATA,__constrw"))) = {
-    _RUNE_MAGIC_A,
-    "NONE",
-    NULL,
-    NULL,
-    0xFFFD,
-
-    {  /*00*/  _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-       /*08*/  _CTYPE_C,
-               _CTYPE_C|_CTYPE_S|_CTYPE_B,
-               _CTYPE_C|_CTYPE_S,
-               _CTYPE_C|_CTYPE_S,
-               _CTYPE_C|_CTYPE_S,
-               _CTYPE_C|_CTYPE_S,
-               _CTYPE_C,
-               _CTYPE_C,
-       /*10*/  _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-       /*18*/  _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-               _CTYPE_C,
-       /*20*/  _CTYPE_S|_CTYPE_B|_CTYPE_R,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-       /*28*/  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-       /*30*/  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|0,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|1,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|2,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|3,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|4,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|5,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|6,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|7,
-       /*38*/  _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|8,
-               _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|9,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-       /*40*/  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
-               _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
-               _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
-               _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
-               _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
-               _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-       /*48*/  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-       /*50*/  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-       /*58*/  _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-       /*60*/  _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
-               _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
-               _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
-               _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
-               _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
-               _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-       /*68*/  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-       /*70*/  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-       /*78*/  _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_P|_CTYPE_R|_CTYPE_G,
-               _CTYPE_C,
-    },
-    {  0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
-       0x08,   0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
-       0x10,   0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
-       0x18,   0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
-       0x20,   0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
-       0x28,   0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
-       0x30,   0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
-       0x38,   0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
-       0x40,   'a',    'b',    'c',    'd',    'e',    'f',    'g',
-       'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
-       'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
-       'x',    'y',    'z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
-       0x60,   'a',    'b',    'c',    'd',    'e',    'f',    'g',
-       'h',    'i',    'j',    'k',    'l',    'm',    'n',    'o',
-       'p',    'q',    'r',    's',    't',    'u',    'v',    'w',
-       'x',    'y',    'z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
-       0x80,   0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
-       0x88,   0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
-       0x90,   0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
-       0x98,   0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
-       0xa0,   0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
-       0xa8,   0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
-       0xb0,   0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
-       0xb8,   0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
-       0xc0,   0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
-       0xc8,   0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
-       0xd0,   0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
-       0xd8,   0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
-       0xe0,   0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
-       0xe8,   0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
-       0xf0,   0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
-       0xf8,   0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
-    },
-    {  0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
-       0x08,   0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
-       0x10,   0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
-       0x18,   0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
-       0x20,   0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
-       0x28,   0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
-       0x30,   0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
-       0x38,   0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
-       0x40,   'A',    'B',    'C',    'D',    'E',    'F',    'G',
-       'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
-       'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-       'X',    'Y',    'Z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
-       0x60,   'A',    'B',    'C',    'D',    'E',    'F',    'G',
-       'H',    'I',    'J',    'K',    'L',    'M',    'N',    'O',
-       'P',    'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-       'X',    'Y',    'Z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
-       0x80,   0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
-       0x88,   0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
-       0x90,   0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
-       0x98,   0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
-       0xa0,   0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
-       0xa8,   0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
-       0xb0,   0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
-       0xb8,   0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
-       0xc0,   0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
-       0xc8,   0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
-       0xd0,   0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
-       0xd8,   0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
-       0xe0,   0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
-       0xe8,   0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
-       0xf0,   0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
-       0xf8,   0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
-    },
-};
-
-__private_extern__ struct __xlocale_st_runelocale _DefaultRuneXLocale __attribute__((section("__DATA,__constrw"))) = {
-    0,
-    XPERMANENT,
-    "C",
-    1,
-    256,
-    _none_mbrtowc,
-    _none_mbsinit,
-    _none_mbsnrtowcs,
-    _none_wcrtomb,
-    _none_wcsnrtombs,
-    sizeof(struct __xlocale_st_runelocale),
-    {
-       _RUNE_MAGIC_A,
-       "NONE",
-       NULL,
-       NULL,
-       0xFFFD,
-
-       {       /*00*/  _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-           /*08*/      _CTYPE_C,
-                   _CTYPE_C|_CTYPE_S|_CTYPE_B,
-                   _CTYPE_C|_CTYPE_S,
-                   _CTYPE_C|_CTYPE_S,
-                   _CTYPE_C|_CTYPE_S,
-                   _CTYPE_C|_CTYPE_S,
-                   _CTYPE_C,
-                   _CTYPE_C,
-           /*10*/      _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-           /*18*/      _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-                   _CTYPE_C,
-           /*20*/      _CTYPE_S|_CTYPE_B|_CTYPE_R,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-           /*28*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-           /*30*/      _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|0,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|1,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|2,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|3,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|4,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|5,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|6,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|7,
-           /*38*/      _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|8,
-                   _CTYPE_D|_CTYPE_R|_CTYPE_G|_CTYPE_X|9,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-           /*40*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
-                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
-                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
-                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
-                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
-                   _CTYPE_U|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-           /*48*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-           /*50*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-           /*58*/      _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_U|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-           /*60*/      _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|10,
-                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|11,
-                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|12,
-                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|13,
-                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|14,
-                   _CTYPE_L|_CTYPE_X|_CTYPE_R|_CTYPE_G|_CTYPE_A|15,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-           /*68*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-           /*70*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-           /*78*/      _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_P|_CTYPE_R|_CTYPE_G,
-                   _CTYPE_C,
-       },
-       {       0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
-           0x08,       0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
-           0x10,       0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
-           0x18,       0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
-           0x20,       0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
-           0x28,       0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
-           0x30,       0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
-           0x38,       0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
-           0x40,       'a',    'b',    'c',    'd',    'e',    'f',    'g',
-           'h',        'i',    'j',    'k',    'l',    'm',    'n',    'o',
-           'p',        'q',    'r',    's',    't',    'u',    'v',    'w',
-           'x',        'y',    'z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
-           0x60,       'a',    'b',    'c',    'd',    'e',    'f',    'g',
-           'h',        'i',    'j',    'k',    'l',    'm',    'n',    'o',
-           'p',        'q',    'r',    's',    't',    'u',    'v',    'w',
-           'x',        'y',    'z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
-           0x80,       0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
-           0x88,       0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
-           0x90,       0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
-           0x98,       0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
-           0xa0,       0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
-           0xa8,       0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
-           0xb0,       0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
-           0xb8,       0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
-           0xc0,       0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
-           0xc8,       0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
-           0xd0,       0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
-           0xd8,       0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
-           0xe0,       0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
-           0xe8,       0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
-           0xf0,       0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
-           0xf8,       0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
-       },
-       {       0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
-           0x08,       0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,
-           0x10,       0x11,   0x12,   0x13,   0x14,   0x15,   0x16,   0x17,
-           0x18,       0x19,   0x1a,   0x1b,   0x1c,   0x1d,   0x1e,   0x1f,
-           0x20,       0x21,   0x22,   0x23,   0x24,   0x25,   0x26,   0x27,
-           0x28,       0x29,   0x2a,   0x2b,   0x2c,   0x2d,   0x2e,   0x2f,
-           0x30,       0x31,   0x32,   0x33,   0x34,   0x35,   0x36,   0x37,
-           0x38,       0x39,   0x3a,   0x3b,   0x3c,   0x3d,   0x3e,   0x3f,
-           0x40,       'A',    'B',    'C',    'D',    'E',    'F',    'G',
-           'H',        'I',    'J',    'K',    'L',    'M',    'N',    'O',
-           'P',        'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-           'X',        'Y',    'Z',    0x5b,   0x5c,   0x5d,   0x5e,   0x5f,
-           0x60,       'A',    'B',    'C',    'D',    'E',    'F',    'G',
-           'H',        'I',    'J',    'K',    'L',    'M',    'N',    'O',
-           'P',        'Q',    'R',    'S',    'T',    'U',    'V',    'W',
-           'X',        'Y',    'Z',    0x7b,   0x7c,   0x7d,   0x7e,   0x7f,
-           0x80,       0x81,   0x82,   0x83,   0x84,   0x85,   0x86,   0x87,
-           0x88,       0x89,   0x8a,   0x8b,   0x8c,   0x8d,   0x8e,   0x8f,
-           0x90,       0x91,   0x92,   0x93,   0x94,   0x95,   0x96,   0x97,
-           0x98,       0x99,   0x9a,   0x9b,   0x9c,   0x9d,   0x9e,   0x9f,
-           0xa0,       0xa1,   0xa2,   0xa3,   0xa4,   0xa5,   0xa6,   0xa7,
-           0xa8,       0xa9,   0xaa,   0xab,   0xac,   0xad,   0xae,   0xaf,
-           0xb0,       0xb1,   0xb2,   0xb3,   0xb4,   0xb5,   0xb6,   0xb7,
-           0xb8,       0xb9,   0xba,   0xbb,   0xbc,   0xbd,   0xbe,   0xbf,
-           0xc0,       0xc1,   0xc2,   0xc3,   0xc4,   0xc5,   0xc6,   0xc7,
-           0xc8,       0xc9,   0xca,   0xcb,   0xcc,   0xcd,   0xce,   0xcf,
-           0xd0,       0xd1,   0xd2,   0xd3,   0xd4,   0xd5,   0xd6,   0xd7,
-           0xd8,       0xd9,   0xda,   0xdb,   0xdc,   0xdd,   0xde,   0xdf,
-           0xe0,       0xe1,   0xe2,   0xe3,   0xe4,   0xe5,   0xe6,   0xe7,
-           0xe8,       0xe9,   0xea,   0xeb,   0xec,   0xed,   0xee,   0xef,
-           0xf0,       0xf1,   0xf2,   0xf3,   0xf4,   0xf5,   0xf6,   0xf7,
-           0xf8,       0xf9,   0xfa,   0xfb,   0xfc,   0xfd,   0xfe,   0xff,
-       },
-    },
-};
-
-_RuneLocale *_CurrentRuneLocale = &_DefaultRuneXLocale._CurrentRuneLocale;
diff --git a/locale/toascii.3 b/locale/toascii.3
deleted file mode 120000 (symlink)
index 4df4474..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toascii.3
\ No newline at end of file
diff --git a/locale/tolower-fbsd.c b/locale/tolower-fbsd.c
deleted file mode 100644 (file)
index 298b321..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $");
-  
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <runetype.h>
-
-__ct_rune_t
-___tolower_l(c, loc)
-       __ct_rune_t c;
-       locale_t loc;
-{
-       size_t lim;
-       _RuneRange *rr;
-       _RuneEntry *base, *re;
-
-       if (c < 0 || c == EOF)
-               return(c);
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * the following is not used by tolower(), but can be used by
-        * tolower_l().  This provides the oppurtunity to optimize tolower()
-        * when compatibility for Panther and lower is no longer needed
-        */
-       if (c < _CACHED_RUNES)
-               return loc->__lc_ctype->_CurrentRuneLocale.__maplower[c];
-       rr = &loc->__lc_ctype->_CurrentRuneLocale.__maplower_ext;
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-               re = base + (lim >> 1);
-               if (re->__min <= c && c <= re->__max)
-                       return (re->__map + c - re->__min);
-               else if (c > re->__max) {
-                       base = re + 1;
-                       lim--;
-               }
-       }
-
-       return(c);
-}
-
-__ct_rune_t
-___tolower(c)
-       __ct_rune_t c;
-{
-       return ___tolower_l(c, __current_locale());
-}
diff --git a/locale/tolower.3 b/locale/tolower.3
deleted file mode 100644 (file)
index 0ac4aba..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)tolower.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/tolower.3,v 1.21 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt TOLOWER 3
-.Os
-.Sh NAME
-.Nm tolower ,
-.Nm tolower_l
-.Nd upper case to lower case letter conversion
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fo tolower
-.Fa "int c"
-.Fc
-.In ctype.h
-.In xlocale.h
-.Ft int
-.Fo tolower_l
-.Fa "int c"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn tolower
-function converts an upper-case letter to the corresponding lower-case
-letter.
-The argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-Although the
-.Fn tolower
-function uses the current locale, the
-.Fn tolower_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If the argument is an upper-case letter, the
-.Fn tolower
-function returns the corresponding lower-case letter if there is
-one; otherwise, the argument is returned unchanged.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn towlower
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr islower 3 ,
-.Xr towlower 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn tolower
-function conforms to
-.St -isoC .
diff --git a/locale/toupper-fbsd.c b/locale/toupper-fbsd.c
deleted file mode 100644 (file)
index d02ddd6..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * Copyright (c) 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $");
-  
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <runetype.h>
-
-__ct_rune_t
-___toupper_l(c, loc)
-       __ct_rune_t c;
-       locale_t loc;
-{
-       size_t lim;
-       _RuneRange *rr;
-       _RuneEntry *base, *re;
-
-       if (c < 0 || c == EOF)
-               return(c);
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * the following is not used by toupper(), but can be used by
-        * toupper_l().  This provides the oppurtunity to optimize toupper()
-        * when compatibility for Panther and lower is no longer needed
-        */
-       if (c < _CACHED_RUNES)
-               return loc->__lc_ctype->_CurrentRuneLocale.__mapupper[c];
-       rr = &loc->__lc_ctype->_CurrentRuneLocale.__mapupper_ext;
-       /* Binary search -- see bsearch.c for explanation. */
-       base = rr->__ranges;
-       for (lim = rr->__nranges; lim != 0; lim >>= 1) {
-               re = base + (lim >> 1);
-               if (re->__min <= c && c <= re->__max)
-                       return (re->__map + c - re->__min);
-               else if (c > re->__max) {
-                       base = re + 1;
-                       lim--;
-               }
-       }
-
-       return(c);
-}
-
-__ct_rune_t
-___toupper(c)
-       __ct_rune_t c;
-{
-       return ___toupper_l(c, __current_locale());
-}
diff --git a/locale/toupper.3 b/locale/toupper.3
deleted file mode 100644 (file)
index 5b196a9..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)toupper.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/toupper.3,v 1.21 2009/09/04 07:44:58 des Exp $
-.\"
-.Dd July 17, 2005
-.Dt TOUPPER 3
-.Os
-.Sh NAME
-.Nm toupper ,
-.Nm toupper_l
-.Nd lower case to upper case letter conversion
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ctype.h
-.Ft int
-.Fo toupper
-.Fa "int c"
-.Fc
-.In ctype.h
-.In xlocale.h
-.Ft int
-.Fo toupper_l
-.Fa "int c"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn toupper
-function converts a lower-case letter to the corresponding
-upper-case letter.
-The argument must be representable as an
-.Vt "unsigned char"
-or the value of
-.Dv EOF .
-.Pp
-Although the
-.Fn toupper
-function uses the current locale, the
-.Fn toupper_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If the argument is a lower-case letter, the
-.Fn toupper
-function returns the corresponding upper-case letter if there is
-one; otherwise, the argument is returned unchanged.
-.Sh COMPATIBILITY
-The
-.Bx 4.4
-extension of accepting arguments outside of the range of the
-.Vt "unsigned char"
-type in locales with large character sets is considered obsolete
-and may not be supported in future releases.
-The
-.Fn towupper
-function should be used instead.
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr isupper 3 ,
-.Xr towupper 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn toupper
-function conforms to
-.St -isoC .
diff --git a/locale/towlower.3 b/locale/towlower.3
deleted file mode 100644 (file)
index 248d5b1..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)tolower.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/towlower.3,v 1.6 2007/01/09 00:28:01 imp Exp $
-.\"
-.Dd October 3, 2002
-.Dt TOWLOWER 3
-.Os
-.Sh NAME
-.Nm towlower ,
-.Nm towlower_l
-.Nd "upper case to lower case letter conversion (wide character version)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wctype.h
-.Ft wint_t
-.Fo towlower
-.Fa "wint_t wc"
-.Fc
-.In wctype.h
-.In xlocale.h
-.Ft wint_t
-.Fo towlower_l
-.Fa "wint_t wc"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn towlower
-function converts an upper-case letter to the corresponding lower-case
-letter.
-.Pp
-Although the
-.Fn towlower
-function uses the current locale, the
-.Fn towlower_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If the argument is an upper-case letter, the
-.Fn towlower
-function returns the corresponding lower-case letter if there is
-one; otherwise, the argument is returned unchanged.
-.Sh SEE ALSO
-.Xr iswlower 3 ,
-.Xr tolower 3 ,
-.Xr towupper 3 ,
-.Xr wctrans 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn towlower
-function conforms to
-.St -isoC-99 .
diff --git a/locale/towupper.3 b/locale/towupper.3
deleted file mode 100644 (file)
index 5df8bb0..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)toupper.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/locale/towupper.3,v 1.3 2007/01/09 00:28:01 imp Exp $
-.\"
-.Dd October 3, 2002
-.Dt TOWUPPER 3
-.Os
-.Sh NAME
-.Nm towupper ,
-.Nm towupper_l
-.Nd "lower case to upper case letter conversion (wide character version)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wctype.h
-.Ft wint_t
-.Fo towupper
-.Fa "wint_t wc"
-.Fc
-.In wctype.h
-.In xlocale.h
-.Ft wint_t
-.Fo towupper_l
-.Fa "wint_t wc"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn towupper
-function converts a lower-case letter to the corresponding
-upper-case letter.
-.Pp
-Although the
-.Fn towupper
-function uses the current locale, the
-.Fn towupper_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If the argument is a lower-case letter, the
-.Fn towupper
-function returns the corresponding upper-case letter if there is
-one; otherwise, the argument is returned unchanged.
-.Sh SEE ALSO
-.Xr iswupper 3 ,
-.Xr toupper 3 ,
-.Xr towlower 3 ,
-.Xr wctrans 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn towupper
-function conforms to
-.St -isoC-99 .
diff --git a/locale/utf2-fbsd.c b/locale/utf2-fbsd.c
deleted file mode 100644 (file)
index 0e00131..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-#define UTF2_MB_CUR_MAX                3
-
-static size_t  _UTF2_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _UTF2_mbsinit(const mbstate_t *, locale_t);
-static size_t  _UTF2_mbsnrtowcs(wchar_t * __restrict,
-                   const char ** __restrict, size_t, size_t,
-                   mbstate_t * __restrict, locale_t);
-static size_t  _UTF2_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-static size_t  _UTF2_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                   size_t, size_t, mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       wchar_t ch;
-       int     want;
-       wchar_t lbound;
-} _UTF2State;
-
-__private_extern__ int
-_UTF2_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _UTF2_mbrtowc;
-       xrl->__wcrtomb = _UTF2_wcrtomb;
-       xrl->__mbsinit = _UTF2_mbsinit;
-       xrl->__mbsnrtowcs = _UTF2_mbsnrtowcs;
-       xrl->__wcsnrtombs = _UTF2_wcsnrtombs;
-       xrl->__mb_cur_max = UTF2_MB_CUR_MAX;
-       /*
-        * UCS-4 encoding used as the internal representation, so
-        * slots 0x0080-0x00FF are occuped and must be excluded
-        * from the single byte ctype by setting the limit.
-        */
-       xrl->__mb_sb_limit = 128;
-
-       return (0);
-}
-
-static int
-_UTF2_mbsinit(const mbstate_t *ps, locale_t loc)
-{
-
-       return (ps == NULL || ((const _UTF2State *)ps)->want == 0);
-}
-
-static size_t
-_UTF2_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF2State *us;
-       int ch, i, mask, want;
-       wchar_t lbound, wch;
-
-       us = (_UTF2State *)ps;
-
-       if (us->want < 0 || us->want > 6) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) {
-               /* Fast path for plain ASCII characters. */
-               if (pwc != NULL)
-                       *pwc = ch;
-               return (ch != '\0' ? 1 : 0);
-       }
-
-       if (us->want == 0) {
-               /*
-                * Determine the number of octets that make up this character
-                * from the first octet, and a mask that extracts the
-                * interesting bits of the first octet. We already know
-                * the character is at least two bytes long.
-                *
-                * We also specify a lower bound for the character code to
-                * detect redundant, non-"shortest form" encodings. For
-                * example, the sequence C0 80 is _not_ a legal representation
-                * of the null character. This enforces a 1-to-1 mapping
-                * between character codes and their multibyte representations.
-                */
-               ch = (unsigned char)*s;
-               if ((ch & 0x80) == 0) {
-                       mask = 0x7f;
-                       want = 1;
-                       lbound = 0;
-               } else if ((ch & 0xe0) == 0xc0) {
-                       mask = 0x1f;
-                       want = 2;
-                       lbound = 0x80;
-               } else if ((ch & 0xf0) == 0xe0) {
-                       mask = 0x0f;
-                       want = 3;
-                       lbound = 0x800;
-               } else {
-                       /*
-                        * Malformed input; input is not UTF2.
-                        */
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-       } else {
-               want = us->want;
-               lbound = us->lbound;
-       }
-
-       /*
-        * Decode the octet sequence representing the character in chunks
-        * of 6 bits, most significant first.
-        */
-       if (us->want == 0)
-               wch = (unsigned char)*s++ & mask;
-       else
-               wch = us->ch;
-       for (i = (us->want == 0) ? 1 : 0; i < MIN(want, n); i++) {
-               if ((*s & 0xc0) != 0x80) {
-                       /*
-                        * Malformed input; bad characters in the middle
-                        * of a character.
-                        */
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wch <<= 6;
-               wch |= *s++ & 0x3f;
-       }
-       if (i < want) {
-               /* Incomplete multibyte sequence. */
-               us->want = want - i;
-               us->lbound = lbound;
-               us->ch = wch;
-               return ((size_t)-2);
-       }
-       if (wch < lbound) {
-               /*
-                * Malformed input; redundant encoding.
-                */
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       if (pwc != NULL)
-               *pwc = wch;
-       us->want = 0;
-       return (wch == L'\0' ? 0 : want);
-}
-
-static size_t
-_UTF2_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF2State *us;
-       const char *s;
-       size_t nchr;
-       wchar_t wc;
-       size_t nb;
-
-       us = (_UTF2State *)ps;
-
-       s = *src;
-       nchr = 0;
-
-       if (dst == NULL) {
-               /*
-                * The fast path in the loop below is not safe if an ASCII
-                * character appears as anything but the first byte of a
-                * multibyte sequence. Check now to avoid doing it in the loop.
-                */
-               if (nms > 0 && us->want > 0 && (signed char)*s > 0) {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               for (;;) {
-                       if (nms > 0 && (signed char)*s > 0)
-                               /*
-                                * Fast path for plain ASCII characters
-                                * excluding NUL.
-                                */
-                               nb = 1;
-                       else if ((nb = _UTF2_mbrtowc(&wc, s, nms, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid sequence - mbrtowc() sets errno. */
-                               return ((size_t)-1);
-                       else if (nb == 0 || nb == (size_t)-2)
-                               return (nchr);
-                       s += nb;
-                       nms -= nb;
-                       nchr++;
-               }
-               /*NOTREACHED*/
-       }
-
-       /*
-        * The fast path in the loop below is not safe if an ASCII
-        * character appears as anything but the first byte of a
-        * multibyte sequence. Check now to avoid doing it in the loop.
-        */
-       if (nms > 0 && len > 0 && us->want > 0 && (signed char)*s > 0) {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       while (len-- > 0) {
-               if (nms > 0 && (signed char)*s > 0) {
-                       /*
-                        * Fast path for plain ASCII characters
-                        * excluding NUL.
-                        */
-                       *dst = (wchar_t)*s;
-                       nb = 1;
-               } else if ((nb = _UTF2_mbrtowc(dst, s, nms, ps, loc)) ==
-                   (size_t)-1) {
-                       *src = s;
-                       return ((size_t)-1);
-               } else if (nb == (size_t)-2) {
-                       *src = s + nms;
-                       return (nchr);
-               } else if (nb == 0) {
-                       *src = NULL;
-                       return (nchr);
-               }
-               s += nb;
-               nms -= nb;
-               nchr++;
-               dst++;
-       }
-       *src = s;
-       return (nchr);
-}
-
-static size_t
-_UTF2_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF2State *us;
-       unsigned char lead;
-       int i, len;
-
-       us = (_UTF2State *)ps;
-
-       if (us->want != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-
-       if ((wc & ~0x7f) == 0) {
-               /* Fast path for plain ASCII characters. */
-               *s = (char)wc;
-               return (1);
-       }
-
-       /*
-        * Determine the number of octets needed to represent this character.
-        * We always output the shortest sequence possible. Also specify the
-        * first few bits of the first octet, which contains the information
-        * about the sequence length.
-        */
-       if ((wc & ~0x7f) == 0) {
-               lead = 0;
-               len = 1;
-       } else if ((wc & ~0x7ff) == 0) {
-               lead = 0xc0;
-               len = 2;
-       } else if ((wc & ~0xffff) == 0) {
-               lead = 0xe0;
-               len = 3;
-       } else {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-
-       /*
-        * Output the octets representing the character in chunks
-        * of 6 bits, least significant last. The first octet is
-        * a special case because it contains the sequence length
-        * information.
-        */
-       for (i = len - 1; i > 0; i--) {
-               s[i] = (wc & 0x3f) | 0x80;
-               wc >>= 6;
-       }
-       *s = (wc & 0xff) | lead;
-
-       return (len);
-}
-
-static size_t
-_UTF2_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF2State *us;
-       char buf[MB_LEN_MAX];
-       const wchar_t *s;
-       size_t nbytes;
-       size_t nb;
-
-       us = (_UTF2State *)ps;
-
-       if (us->want != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       s = *src;
-       nbytes = 0;
-
-       if (dst == NULL) {
-               while (nwc-- > 0) {
-                       if (0 <= *s && *s < 0x80)
-                               /* Fast path for plain ASCII characters. */
-                               nb = 1;
-                       else if ((nb = _UTF2_wcrtomb(buf, *s, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid character - wcrtomb() sets errno. */
-                               return ((size_t)-1);
-                       if (*s == L'\0')
-                               return (nbytes + nb - 1);
-                       s++;
-                       nbytes += nb;
-               }
-               return (nbytes);
-       }
-
-       while (len > 0 && nwc-- > 0) {
-               if (0 <= *s && *s < 0x80) {
-                       /* Fast path for plain ASCII characters. */
-                       nb = 1;
-                       *dst = *s;
-               } else if (len > (size_t)UTF2_MB_CUR_MAX) {
-                       /* Enough space to translate in-place. */
-                       if ((nb = _UTF2_wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-               } else {
-                       /*
-                        * May not be enough space; use temp. buffer.
-                        */
-                       if ((nb = _UTF2_wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-                       if (nb > (int)len)
-                               /* MB sequence for character won't fit. */
-                               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);
-}
diff --git a/locale/utf8-fbsd.c b/locale/utf8-fbsd.c
deleted file mode 100644 (file)
index 97515df..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <runetype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-#define UTF8_MB_CUR_MAX                6
-
-static size_t  _UTF8_mbrtowc(wchar_t * __restrict, const char * __restrict,
-                   size_t, mbstate_t * __restrict, locale_t);
-static int     _UTF8_mbsinit(const mbstate_t *, locale_t);
-static size_t  _UTF8_mbsnrtowcs(wchar_t * __restrict,
-                   const char ** __restrict, size_t, size_t,
-                   mbstate_t * __restrict, locale_t);
-static size_t  _UTF8_wcrtomb(char * __restrict, wchar_t,
-                   mbstate_t * __restrict, locale_t);
-static size_t  _UTF8_wcsnrtombs(char * __restrict, const wchar_t ** __restrict,
-                   size_t, size_t, mbstate_t * __restrict, locale_t);
-
-typedef struct {
-       wchar_t ch;
-       int     want;
-       wchar_t lbound;
-} _UTF8State;
-
-__private_extern__ int
-_UTF8_init(struct __xlocale_st_runelocale *xrl)
-{
-
-       xrl->__mbrtowc = _UTF8_mbrtowc;
-       xrl->__wcrtomb = _UTF8_wcrtomb;
-       xrl->__mbsinit = _UTF8_mbsinit;
-       xrl->__mbsnrtowcs = _UTF8_mbsnrtowcs;
-       xrl->__wcsnrtombs = _UTF8_wcsnrtombs;
-       xrl->__mb_cur_max = UTF8_MB_CUR_MAX;
-       /*
-        * UCS-4 encoding used as the internal representation, so
-        * slots 0x0080-0x00FF are occuped and must be excluded
-        * from the single byte ctype by setting the limit.
-        */
-       xrl->__mb_sb_limit = 128;
-
-       return (0);
-}
-
-static int
-_UTF8_mbsinit(const mbstate_t *ps, locale_t loc)
-{
-
-       return (ps == NULL || ((const _UTF8State *)ps)->want == 0);
-}
-
-static size_t
-_UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
-    mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF8State *us;
-       int ch, i, mask, want;
-       wchar_t lbound, wch;
-
-       us = (_UTF8State *)ps;
-
-       if (us->want < 0 || us->want > 6) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL) {
-               s = "";
-               n = 1;
-               pwc = NULL;
-       }
-
-       if (n == 0)
-               /* Incomplete multibyte sequence */
-               return ((size_t)-2);
-
-       if (us->want == 0 && ((ch = (unsigned char)*s) & ~0x7f) == 0) {
-               /* Fast path for plain ASCII characters. */
-               if (pwc != NULL)
-                       *pwc = ch;
-               return (ch != '\0' ? 1 : 0);
-       }
-
-       if (us->want == 0) {
-               /*
-                * Determine the number of octets that make up this character
-                * from the first octet, and a mask that extracts the
-                * interesting bits of the first octet. We already know
-                * the character is at least two bytes long.
-                *
-                * We also specify a lower bound for the character code to
-                * detect redundant, non-"shortest form" encodings. For
-                * example, the sequence C0 80 is _not_ a legal representation
-                * of the null character. This enforces a 1-to-1 mapping
-                * between character codes and their multibyte representations.
-                */
-               ch = (unsigned char)*s;
-               if ((ch & 0x80) == 0) {
-                       mask = 0x7f;
-                       want = 1;
-                       lbound = 0;
-               } else if ((ch & 0xe0) == 0xc0) {
-                       mask = 0x1f;
-                       want = 2;
-                       lbound = 0x80;
-               } else if ((ch & 0xf0) == 0xe0) {
-                       mask = 0x0f;
-                       want = 3;
-                       lbound = 0x800;
-               } else if ((ch & 0xf8) == 0xf0) {
-                       mask = 0x07;
-                       want = 4;
-                       lbound = 0x10000;
-               } else if ((ch & 0xfc) == 0xf8) {
-                       mask = 0x03;
-                       want = 5;
-                       lbound = 0x200000;
-               } else if ((ch & 0xfe) == 0xfc) {
-                       mask = 0x01;
-                       want = 6;
-                       lbound = 0x4000000;
-               } else {
-                       /*
-                        * Malformed input; input is not UTF-8.
-                        */
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-       } else {
-               want = us->want;
-               lbound = us->lbound;
-       }
-
-       /*
-        * Decode the octet sequence representing the character in chunks
-        * of 6 bits, most significant first.
-        */
-       if (us->want == 0)
-               wch = (unsigned char)*s++ & mask;
-       else
-               wch = us->ch;
-       for (i = (us->want == 0) ? 1 : 0; i < MIN(want, n); i++) {
-               if ((*s & 0xc0) != 0x80) {
-                       /*
-                        * Malformed input; bad characters in the middle
-                        * of a character.
-                        */
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               wch <<= 6;
-               wch |= *s++ & 0x3f;
-       }
-       if (i < want) {
-               /* Incomplete multibyte sequence. */
-               us->want = want - i;
-               us->lbound = lbound;
-               us->ch = wch;
-               return ((size_t)-2);
-       }
-       if (wch < lbound) {
-               /*
-                * Malformed input; redundant encoding.
-                */
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       if (pwc != NULL)
-               *pwc = wch;
-       us->want = 0;
-       return (wch == L'\0' ? 0 : want);
-}
-
-static size_t
-_UTF8_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
-    size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF8State *us;
-       const char *s;
-       size_t nchr;
-       wchar_t wc;
-       size_t nb;
-
-       us = (_UTF8State *)ps;
-
-       s = *src;
-       nchr = 0;
-
-       if (dst == NULL) {
-               /*
-                * The fast path in the loop below is not safe if an ASCII
-                * character appears as anything but the first byte of a
-                * multibyte sequence. Check now to avoid doing it in the loop.
-                */
-               if (nms > 0 && us->want > 0 && (signed char)*s > 0) {
-                       errno = EILSEQ;
-                       return ((size_t)-1);
-               }
-               for (;;) {
-                       if (nms > 0 && (signed char)*s > 0)
-                               /*
-                                * Fast path for plain ASCII characters
-                                * excluding NUL.
-                                */
-                               nb = 1;
-                       else if ((nb = _UTF8_mbrtowc(&wc, s, nms, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid sequence - mbrtowc() sets errno. */
-                               return ((size_t)-1);
-                       else if (nb == 0 || nb == (size_t)-2)
-                               return (nchr);
-                       s += nb;
-                       nms -= nb;
-                       nchr++;
-               }
-               /*NOTREACHED*/
-       }
-
-       /*
-        * The fast path in the loop below is not safe if an ASCII
-        * character appears as anything but the first byte of a
-        * multibyte sequence. Check now to avoid doing it in the loop.
-        */
-       if (nms > 0 && len > 0 && us->want > 0 && (signed char)*s > 0) {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-       while (len-- > 0) {
-               if (nms > 0 && (signed char)*s > 0) {
-                       /*
-                        * Fast path for plain ASCII characters
-                        * excluding NUL.
-                        */
-                       *dst = (wchar_t)*s;
-                       nb = 1;
-               } else if ((nb = _UTF8_mbrtowc(dst, s, nms, ps, loc)) ==
-                   (size_t)-1) {
-                       *src = s;
-                       return ((size_t)-1);
-               } else if (nb == (size_t)-2) {
-                       *src = s + nms;
-                       return (nchr);
-               } else if (nb == 0) {
-                       *src = NULL;
-                       return (nchr);
-               }
-               s += nb;
-               nms -= nb;
-               nchr++;
-               dst++;
-       }
-       *src = s;
-       return (nchr);
-}
-
-static size_t
-_UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF8State *us;
-       unsigned char lead;
-       int i, len;
-
-       us = (_UTF8State *)ps;
-
-       if (us->want != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       if (s == NULL)
-               /* Reset to initial shift state (no-op) */
-               return (1);
-
-       if ((wc & ~0x7f) == 0) {
-               /* Fast path for plain ASCII characters. */
-               *s = (char)wc;
-               return (1);
-       }
-
-       /*
-        * Determine the number of octets needed to represent this character.
-        * We always output the shortest sequence possible. Also specify the
-        * first few bits of the first octet, which contains the information
-        * about the sequence length.
-        */
-       if ((wc & ~0x7f) == 0) {
-               lead = 0;
-               len = 1;
-       } else if ((wc & ~0x7ff) == 0) {
-               lead = 0xc0;
-               len = 2;
-       } else if ((wc & ~0xffff) == 0) {
-               lead = 0xe0;
-               len = 3;
-       } else if ((wc & ~0x1fffff) == 0) {
-               lead = 0xf0;
-               len = 4;
-       } else if ((wc & ~0x3ffffff) == 0) {
-               lead = 0xf8;
-               len = 5;
-       } else if ((wc & ~0x7fffffff) == 0) {
-               lead = 0xfc;
-               len = 6;
-       } else {
-               errno = EILSEQ;
-               return ((size_t)-1);
-       }
-
-       /*
-        * Output the octets representing the character in chunks
-        * of 6 bits, least significant last. The first octet is
-        * a special case because it contains the sequence length
-        * information.
-        */
-       for (i = len - 1; i > 0; i--) {
-               s[i] = (wc & 0x3f) | 0x80;
-               wc >>= 6;
-       }
-       *s = (wc & 0xff) | lead;
-
-       return (len);
-}
-
-static size_t
-_UTF8_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       _UTF8State *us;
-       char buf[MB_LEN_MAX];
-       const wchar_t *s;
-       size_t nbytes;
-       size_t nb;
-
-       us = (_UTF8State *)ps;
-
-       if (us->want != 0) {
-               errno = EINVAL;
-               return ((size_t)-1);
-       }
-
-       s = *src;
-       nbytes = 0;
-
-       if (dst == NULL) {
-               while (nwc-- > 0) {
-                       if (0 <= *s && *s < 0x80)
-                               /* Fast path for plain ASCII characters. */
-                               nb = 1;
-                       else if ((nb = _UTF8_wcrtomb(buf, *s, ps, loc)) ==
-                           (size_t)-1)
-                               /* Invalid character - wcrtomb() sets errno. */
-                               return ((size_t)-1);
-                       if (*s == L'\0')
-                               return (nbytes + nb - 1);
-                       s++;
-                       nbytes += nb;
-               }
-               return (nbytes);
-       }
-
-       while (len > 0 && nwc-- > 0) {
-               if (0 <= *s && *s < 0x80) {
-                       /* Fast path for plain ASCII characters. */
-                       nb = 1;
-                       *dst = *s;
-               } else if (len > (size_t)UTF8_MB_CUR_MAX) {
-                       /* Enough space to translate in-place. */
-                       if ((nb = _UTF8_wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-               } else {
-                       /*
-                        * May not be enough space; use temp. buffer.
-                        */
-                       if ((nb = _UTF8_wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
-                               *src = s;
-                               return ((size_t)-1);
-                       }
-                       if (nb > (int)len)
-                               /* MB sequence for character won't fit. */
-                               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);
-}
diff --git a/locale/utf8.5 b/locale/utf8.5
deleted file mode 120000 (symlink)
index 6992565..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./utf8.5
\ No newline at end of file
diff --git a/locale/wcrtomb-fbsd.c b/locale/wcrtomb-fbsd.c
deleted file mode 100644 (file)
index 81b99d4..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-wcrtomb_l(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps,
-    locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_wcrtomb;
-       return (loc->__lc_ctype->__wcrtomb(s, wc, ps, loc));
-}
-
-size_t
-wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
-{
-       return wcrtomb_l(s, wc, ps, __current_locale());
-}
diff --git a/locale/wcrtomb.3 b/locale/wcrtomb.3
deleted file mode 100644 (file)
index 2b320a2..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wcrtomb.3,v 1.4 2004/04/08 09:59:02 tjr Exp $
-.\"
-.Dd April 8, 2004
-.Dt WCRTOMB 3
-.Os
-.Sh NAME
-.Nm wcrtomb ,
-.Nm wcrtomb_l
-.Nd "convert a wide-character code to a character (restartable)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo wcrtomb
-.Fa "char *restrict s"
-.Fa "wchar_t wc"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo wcrtomb_l
-.Fa "char *restrict s"
-.Fa "wchar_t wc"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcrtomb
-function stores a multibyte sequence representing the
-wide character
-.Fa wc ,
-including any necessary shift sequences, to the
-character array
-.Fa s .
-A maximum of
-.Dv MB_CUR_MAX
-bytes will be stored.
-.Pp
-If
-.Fa s
-is
-.Dv NULL ,
-.Fn wcrtomb
-behaves as if
-.Fa s
-pointed to an internal buffer and
-.Fa wc
-were a null wide character (L'\e0').
-.Pp
-The
-.Ft mbstate_t
-argument,
-.Fa ps ,
-is used to keep track of the shift state.
-If it is
-.Dv NULL ,
-.Fn wcrtomb
-uses an internal, static
-.Vt mbstate_t
-object, which is initialized to the initial conversion state
-at program startup.
-.Pp
-While the
-.Fn wcrtomb
-function uses the current locale, the
-.Fn wcrtomb_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn wcrtomb
-functions returns the length (in bytes) of the multibyte sequence
-needed to represent
-.Fa wc ,
-or
-.Po Vt size_t Pc Ns \-1
-if
-.Fa wc
-is not a valid wide character code.
-.Sh ERRORS
-The
-.Fn wcrtomb
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid wide character code was specified.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbrtowc 3 ,
-.Xr multibyte 3 ,
-.Xr setlocale 3 ,
-.Xr wctomb 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcrtomb
-function conforms to
-.St -isoC-99 .
diff --git a/locale/wcsftime-fbsd.c b/locale/wcsftime-fbsd.c
deleted file mode 100644 (file)
index ddf989a..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdivacky Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <time.h>
-#include <wchar.h>
-
-/*
- * Convert date and time to a wide-character string.
- *
- * This is the wide-character counterpart of strftime(). So that we do not
- * have to duplicate the code of strftime(), we convert the format string to
- * multibyte, call strftime(), then convert the result back into wide
- * characters.
- *
- * This technique loses in the presence of stateful multibyte encoding if any
- * of the conversions in the format string change conversion state. When
- * stateful encoding is implemented, we will need to reset the state between
- * format specifications in the format string.
- */
-size_t
-wcsftime_l(wchar_t * __restrict wcs, size_t maxsize,
-    const wchar_t * __restrict format, const struct tm * __restrict timeptr,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       char *dst, *sformat;
-       const char *dstp;
-       const wchar_t *formatp;
-       size_t n, sflen;
-       int sverrno;
-
-       NORMALIZE_LOCALE(loc);
-       sformat = dst = NULL;
-
-       /*
-        * Convert the supplied format string to a multibyte representation
-        * for strftime(), which only handles single-byte characters.
-        */
-       mbs = initial;
-       formatp = format;
-       sflen = wcsrtombs_l(NULL, &formatp, 0, &mbs, loc);
-       if (sflen == (size_t)-1)
-               goto error;
-       if ((sformat = malloc(sflen + 1)) == NULL)
-               goto error;
-       mbs = initial;
-       wcsrtombs_l(sformat, &formatp, sflen + 1, &mbs, loc);
-
-       /*
-        * Allocate memory for longest multibyte sequence that will fit
-        * into the caller's buffer and call strftime() to fill it.
-        * Then, copy and convert the result back into wide characters in
-        * the caller's buffer.
-        */
-       if (SIZE_T_MAX / MB_CUR_MAX_L(loc) <= maxsize) {
-               /* maxsize is prepostorously large - avoid int. overflow. */
-               errno = EINVAL;
-               goto error;
-       }
-       if ((dst = malloc(maxsize * MB_CUR_MAX_L(loc))) == NULL)
-               goto error;
-       if (strftime_l(dst, maxsize, sformat, timeptr, loc) == 0)
-               goto error;
-       dstp = dst;
-       mbs = initial;
-       n = mbsrtowcs_l(wcs, &dstp, maxsize, &mbs, loc);
-       if (n == (size_t)-2 || n == (size_t)-1 || dstp != NULL)
-               goto error;
-
-       free(sformat);
-       free(dst);
-       return (n);
-
-error:
-       sverrno = errno;
-       free(sformat);
-       free(dst);
-       errno = sverrno;
-       return (0);
-}
-
-size_t
-wcsftime(wchar_t * __restrict wcs, size_t maxsize,
-    const wchar_t * __restrict format, const struct tm * __restrict timeptr)
-{
-       return wcsftime_l(wcs, maxsize, format, timeptr, __current_locale());
-}
diff --git a/locale/wcsftime.3 b/locale/wcsftime.3
deleted file mode 100644 (file)
index b11967a..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wcsftime.3,v 1.2 2002/11/29 17:35:09 ru Exp $
-.\"
-.Dd September 8, 2002
-.Dt WCSFTIME 3
-.Os
-.Sh NAME
-.Nm wcsftime ,
-.Nm wcsftime_l
-.Nd "convert date and time to a wide-character string"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo wcsftime
-.Fa "wchar_t *restrict wcs"
-.Fa "size_t maxsize"
-.Fa "const wchar_t *restrict format"
-.Fa "const struct tm *restrict timeptr"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo wcsftime_l
-.Fa "wchar_t *restrict wcs"
-.Fa "size_t maxsize"
-.Fa "const wchar_t *restrict format"
-.Fa "const struct tm *restrict timeptr"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcsftime
-function is equivalent to the
-.Fn strftime
-function, except for the types of its arguments.
-Refer to
-.Xr strftime 3
-for a detailed description.
-.Pp
-While the
-.Fn wcsftime
-function uses the current locale, the
-.Fn wcsftime_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh COMPATIBILITY
-Some early implementations of
-.Fn wcsftime
-had a
-.Fa format
-argument with type
-.Vt "const char *" ,
-instead of
-.Vt "const wchar_t *" .
-.Sh SEE ALSO
-.Xr strftime 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcsftime
-function conforms to
-.St -isoC-99 .
diff --git a/locale/wcsnrtombs-fbsd.c b/locale/wcsnrtombs-fbsd.c
deleted file mode 100644 (file)
index adc29a1..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 stefanf Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-wcsnrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
-    size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_wcsnrtombs;
-       return (loc->__lc_ctype->__wcsnrtombs(dst, src, nwc, len, ps, loc));
-}
-
-size_t
-wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
-    size_t len, mbstate_t * __restrict ps)
-{
-       return wcsnrtombs_l(dst, src, nwc, len, ps, __current_locale());
-}
-
-__private_extern__ size_t
-__wcsnrtombs_std(char * __restrict dst, const wchar_t ** __restrict src,
-    size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc)
-{
-       mbstate_t mbsbak;
-       char buf[MB_LEN_MAX];
-       const wchar_t *s;
-       size_t nbytes;
-       size_t nb;
-       struct __xlocale_st_runelocale *runeLocale = loc->__lc_ctype;
-       size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t) = runeLocale->__wcrtomb;
-       int mb_cur_max = runeLocale->__mb_cur_max;
-
-       s = *src;
-       nbytes = 0;
-
-       if (dst == NULL) {
-               while (nwc-- > 0) {
-                       if ((nb = __wcrtomb(buf, *s, ps, loc)) == (size_t)-1)
-                               /* Invalid character - wcrtomb() sets errno. */
-                               return ((size_t)-1);
-                       else if (*s == L'\0')
-                               return (nbytes + nb - 1);
-                       s++;
-                       nbytes += nb;
-               }
-               return (nbytes);
-       }
-
-       while (len > 0 && nwc-- > 0) {
-               if (len > (size_t)mb_cur_max) {
-                       /* Enough space to translate in-place. */
-                       if ((nb = __wcrtomb(dst, *s, ps, loc)) == (size_t)-1) {
-                               *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 = __wcrtomb(buf, *s, ps, loc)) == (size_t)-1) {
-                               *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);
-}
diff --git a/locale/wcsrtombs-fbsd.c b/locale/wcsrtombs-fbsd.c
deleted file mode 100644 (file)
index 483b862..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-wcsrtombs_l(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
-    mbstate_t * __restrict ps, locale_t loc)
-{
-       NORMALIZE_LOCALE(loc);
-       if (ps == NULL)
-               ps = &loc->__mbs_wcsrtombs;
-       return (loc->__lc_ctype->__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps, loc));
-}
-
-size_t
-wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
-    mbstate_t * __restrict ps)
-{
-       return wcsrtombs_l(dst, src, len, ps, __current_locale());
-}
diff --git a/locale/wcsrtombs.3 b/locale/wcsrtombs.3
deleted file mode 100644 (file)
index 0848655..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" 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.5 2004/07/21 10:54:57 tjr Exp $
-.\"
-.Dd July 21, 2004
-.Dt WCSRTOMBS 3
-.Os
-.Sh NAME
-.Nm wcsnrtombs ,
-.Nm wcsnrtombs_l ,
-.Nm wcsrtombs ,
-.Nm wcsrtombs_l
-.Nd "convert a wide-character string to a character string (restartable)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo wcsnrtombs
-.Fa "char *restrict dst"
-.Fa "const wchar_t **restrict src"
-.Fa "size_t nwc"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.Ft size_t
-.Fo wcsrtombs
-.Fa "char *restrict dst"
-.Fa "const wchar_t **restrict src"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo wcsnrtombs_l
-.Fa "char *restrict dst"
-.Fa "const wchar_t **restrict src"
-.Fa "size_t nwc"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Ft size_t
-.Fo wcsrtombs_l
-.Fa "char *restrict dst"
-.Fa "const wchar_t **restrict src"
-.Fa "size_t len"
-.Fa "mbstate_t *restrict ps"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcsrtombs
-function converts a string of wide characters,
-indirectly pointed to by
-.Fa src ,
-to a corresponding multi-byte character string,
-stored in the array pointed to by
-.Fa dst .
-No more than
-.Fa len
-bytes are written to
-.Fa dst .
-.Pp
-If
-.Fa dst
-is
-.Dv NULL ,
-no characters are stored.
-.Pp
-If
-.Fa dst
-is not
-.Dv NULL ,
-the pointer pointed to by
-.Fa src
-is updated to point to the character after the one that conversion stopped at.
-If conversion stops because a null character is encountered,
-.Fa *src
-is set to
-.Dv NULL .
-.Pp
-The
-.Vt mbstate_t
-argument,
-.Fa ps ,
-is used to keep track of the shift state.
-If it is
-.Dv NULL ,
-.Fn wcsrtombs
-uses an internal, static
-.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 .
-.Pp
-Although the
-.Fn wcsrtombs
-and
-.Fn wcsnrtombs
-functions use the current locale, the
-.Fn wcsrtombs_l
-and
-.Fn wcsnrtombs_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If successful, the
-.Fn wcsrtombs
-and
-.Fn wcsnrtombs
-functions return the number of bytes stored in
-the array pointed to by
-.Fa dst
-(not including any terminating null);
-otherwise, they return
-.Po Vt size_t Pc Ns \-1 .
-.Sh ERRORS
-The
-.Fn wcsrtombs
-and
-.Fn wcsnrtombs
-functions will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid wide character was encountered.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbsrtowcs 3 ,
-.Xr wcrtomb 3 ,
-.Xr wcstombs 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcsrtombs
-function conforms to
-.St -isoC-99 .
-.Pp
-The
-.Fn wcsnrtombs
-function is an extension to the standard.
diff --git a/locale/wcstod-fbsd.c b/locale/wcstod-fbsd.c
deleted file mode 100644 (file)
index 3ecc75a..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <_simple.h>
-
-/*
- * __wcs_end_offset calculates the offset to the end within the wide character
- * string, assuming numbers and letters are single bytes in multibyte
- * representation, get the actual decimal string for localeconv_l.  If the
- * decimal point was within the string, compensate for the fact that the
- * (possible more than one byte) decimal point one takes one wide character.
- */
-__private_extern__ size_t
-__wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc)
-{
-       const char *decimalpoint = localeconv_l(loc)->decimal_point;
-       size_t n = end - buf;
-       char *p;
-
-       if ((p = strnstr(buf, decimalpoint, n)) != NULL)
-               n -= strlen(decimalpoint) - 1;
-       return n;
-}
-
-/*
- * Convert a string to a double-precision number.
- *
- * This is the wide-character counterpart of strtod(). So that we do not
- * have to duplicate the code of strtod() here, we convert the supplied
- * wide character string to multibyte and call strtod() on the result.
- * This assumes that the multibyte encoding is compatible with ASCII
- * for at least the digits and letters.  The radix character can be more
- * than one byte.
- */
-
-double
-wcstod_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       double val;
-       char *buf, *end;
-       size_t len;
-       locale_t ctype;
-       _SIMPLE_STRING b;
-       char mb[MB_CUR_MAX + 1];
-       const wchar_t *nptr0 = nptr;
-       const wchar_t *first;
-
-       NORMALIZE_LOCALE(loc);
-       ctype = __numeric_ctype(loc);
-
-       while (iswspace_l(*nptr, ctype))
-               nptr++;
-
-       if ((b = _simple_salloc()) == NULL)
-               return (0.0);
-
-       first = nptr;
-       mbs = initial;
-       while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
-               mb[len] = 0;
-               if (_simple_sappend(b, mb) < 0) { /* no memory */
-                       _simple_sfree(b);
-                       return (0.0);
-               }
-               nptr++;
-       }
-
-       /* Let strtod() do most of the work for us. */
-       buf = _simple_string(b);
-       val = strtod_l(buf, &end, loc);
-
-       /*
-        * We only know where the number ended in the _multibyte_
-        * representation of the string. If the caller wants to know
-        * where it ended, count multibyte characters to find the
-        * corresponding position in the wide char string.
-        */
-       if (endptr != NULL)
-               /* XXX Assume each wide char is one byte. */
-               *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
-
-       _simple_sfree(b);
-
-       return (val);
-}
-
-double
-wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-{
-       return wcstod_l(nptr, endptr, __current_locale());
-}
diff --git a/locale/wcstod.3 b/locale/wcstod.3
deleted file mode 100644 (file)
index 9595d07..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-.\" Copyright (c) 2002, 2003 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wcstod.3,v 1.4 2003/05/22 13:02:27 ru Exp $
-.\"
-.Dd February 22, 2003
-.Dt WCSTOD 3
-.Os
-.Sh NAME
-.Nm wcstod ,
-.Nm wcstof ,
-.Nm wcstold
-.Nd convert string to
-.Vt float ,
-.Vt double ,
-or
-.Vt "long double"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft double
-.Fo wcstod
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fc
-.Ft float
-.Fo wcstof
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fc
-.Ft "long double"
-.Fo wcstold
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcstof ,
-.Fn wcstod ,
-and
-.Fn wcstold
-functions are the wide-character versions of the
-.Fn strtof ,
-.Fn strtod ,
-and
-.Fn strtold
-functions.
-Refer to
-.Xr strtod 3
-for details.
-.Pp
-Extended locale versions of these functions are documented in
-.Xr wcstod_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh SEE ALSO
-.Xr strtod 3 ,
-.Xr wcstod_l 3 ,
-.Xr wcstol 3
-.Sh STANDARDS
-The
-.Fn wcstof ,
-.Fn wcstod
-and
-.Fn wcstold
-functions conform to
-.St -isoC-99 .
diff --git a/locale/wcstof-fbsd.c b/locale/wcstof-fbsd.c
deleted file mode 100644 (file)
index f2a6373..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * Copyright (c) 2002, 2003 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <_simple.h>
-
-/*
- * See wcstod() for comments as to the logic used.
- */
-
-extern size_t __wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc);
-
-float
-wcstof_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       float val;
-       char *buf, *end;
-       size_t len;
-       locale_t ctype;
-       _SIMPLE_STRING b;
-       char mb[MB_CUR_MAX + 1];
-       const wchar_t *nptr0 = nptr;
-       const wchar_t *first;
-
-       NORMALIZE_LOCALE(loc);
-       ctype = __numeric_ctype(loc);
-
-       while (iswspace_l(*nptr, ctype))
-               nptr++;
-
-       if ((b = _simple_salloc()) == NULL)
-               return (0.0);
-
-       first = nptr;
-       mbs = initial;
-       while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
-               mb[len] = 0;
-               if (_simple_sappend(b, mb) < 0) { /* no memory */
-                       _simple_sfree(b);
-                       return (0.0);
-               }
-               nptr++;
-       }
-
-       buf = _simple_string(b);
-       val = strtof_l(buf, &end, loc);
-
-       if (endptr != NULL)
-               *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
-
-       _simple_sfree(b);
-
-       return (val);
-}
-
-float
-wcstof(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-{
-       return wcstof_l(nptr, endptr, __current_locale());
-}
diff --git a/locale/wcstoimax-fbsd.c b/locale/wcstoimax-fbsd.c
deleted file mode 100644 (file)
index 9c3dc3d..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtol.c      8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoimax.c,v 1.3 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-/*
- * Convert a wide character string to an intmax_t integer.
- */
-intmax_t
-wcstoimax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base, locale_t loc)
-{
-       const wchar_t *s;
-       uintmax_t acc;
-       wchar_t c;
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoimax for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == L'+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == L'0' && (*s == L'x' || *s == L'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == L'0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = neg ? (uintmax_t)-(INTMAX_MIN + INTMAX_MAX) + INTMAX_MAX
-           : INTMAX_MAX;
-       cutlim = cutoff % base;
-       cutoff /= base;
-       for ( ; ; c = *s++) {
-#ifdef notyet
-               if (iswdigit_l(c, loc))
-                       c = digittoint_l(c, loc);
-               else
-#endif
-               if (c >= L'0' && c <= L'9')
-                       c -= L'0';
-               else if (c >= L'A' && c <= L'Z')
-                       c -= L'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= L'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = neg ? INTMAX_MIN : INTMAX_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-intmax_t
-wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base)
-{
-       return wcstoimax_l(nptr, endptr, base, __current_locale());
-}
diff --git a/locale/wcstol-fbsd.c b/locale/wcstol-fbsd.c
deleted file mode 100644 (file)
index 2509e55..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <wchar.h>
-#include <wctype.h>
-
-/*
- * Convert a string to a long integer.
- */
-long
-wcstol_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base, locale_t loc)
-{
-       const wchar_t *s;
-       unsigned long acc;
-       wchar_t c;
-       unsigned long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (iswspace_l(c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == L'+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == L'0' && (*s == L'x' || *s == L'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == L'0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX
-           : LONG_MAX;
-       cutlim = cutoff % base;
-       cutoff /= base;
-       for ( ; ; c = *s++) {
-#ifdef notyet
-               if (iswdigit_l(c, loc))
-                       c = digittoint_l(c, loc);
-               else
-#endif
-               if (c >= L'0' && c <= L'9')
-                       c -= L'0';
-               else if (c >= L'A' && c <= L'Z')
-                       c -= L'A' - 10;
-               else if (c >= L'a' && c <= L'z')
-                       c -= L'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = neg ? LONG_MIN : LONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-long
-wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-{
-       return wcstol_l(nptr, endptr, base, __current_locale());
-}
diff --git a/locale/wcstol.3 b/locale/wcstol.3
deleted file mode 100644 (file)
index 89936c9..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wcstol.3,v 1.4 2002/11/29 17:35:09 ru Exp $
-.\"
-.Dd September 7, 2002
-.Dt WCSTOL 3
-.Os
-.Sh NAME
-.Nm wcstoimax ,
-.Nm wcstol ,
-.Nm wcstoll ,
-.Nm wcstoul ,
-.Nm wcstoull ,
-.Nm wcstoumax
-.Nd "convert a wide character string value to a"
-.Vt intmax_t ,
-.Vt long ,
-.Vt "long long" ,
-.Vt "unsigned long" ,
-.Vt "unsigned long long" ,
-or
-.Vt uintmax_t
-integer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft long
-.Fo wcstol
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fa "int base"
-.Fc
-.Ft "long long"
-.Fo wcstoll
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fa "int base"
-.Fc
-.Ft "unsigned long"
-.Fo wcstoul
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fa "int base"
-.Fc
-.Ft "unsigned long long"
-.Fo wcstoull
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fa "int base"
-.Fc
-.In stddef.h
-.In inttypes.h
-.Ft intmax_t
-.Fo wcstoimax
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fa "int base"
-.Fc
-.Ft uintmax_t
-.Fo wcstoumax
-.Fa "const wchar_t *restrict nptr"
-.Fa "wchar_t **restrict endptr"
-.Fa "int base"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcstol ,
-.Fn wcstoul ,
-.Fn wcstoll ,
-.Fn wcstoull ,
-.Fn wcstoimax ,
-and
-.Fn wcstoumax
-functions are wide-character versions of the
-.Fn strtol ,
-.Fn strtoul ,
-.Fn strtoll ,
-.Fn strtoull ,
-.Fn strtoimax ,
-and
-.Fn strtoumax
-functions, respectively.
-Refer to their manual pages (for example
-.Xr strtol 3 )
-for details.
-.Pp
-Extended locale versions of these functions are documented in
-.Xr wcstol_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh LEGACY SYNOPSIS
-.Fd #include <stddef.h>
-.Fd #include <inttypes.h>
-.Pp
-The include file
-.In stddef.h
-is necessary for the
-.Fn wcstoimax
-and
-.Fn wcstoumax
-functions.
-.Sh SEE ALSO
-.Xr strtol 3 ,
-.Xr strtoul 3 ,
-.Xr wcstol_l 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn wcstol ,
-.Fn wcstoul ,
-.Fn wcstoll ,
-.Fn wcstoull ,
-.Fn wcstoimax ,
-and
-.Fn wcstoumax
-functions conform to
-.St -isoC-99 .
diff --git a/locale/wcstold-fbsd.c b/locale/wcstold-fbsd.c
deleted file mode 100644 (file)
index 45222d8..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * Copyright (c) 2002, 2003 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <_simple.h>
-
-/*
- * See wcstod() for comments as to the logic used.
- */
-
-extern size_t __wcs_end_offset(const char * __restrict buf, const char * __restrict end, locale_t loc);
-
-long double
-wcstold_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       long double val;
-       char *buf, *end;
-       size_t len;
-       locale_t ctype;
-       _SIMPLE_STRING b;
-       char mb[MB_CUR_MAX + 1];
-       const wchar_t *nptr0 = nptr;
-       const wchar_t *first;
-
-       NORMALIZE_LOCALE(loc);
-       ctype = __numeric_ctype(loc);
-
-       while (iswspace_l(*nptr, ctype))
-               nptr++;
-
-       if ((b = _simple_salloc()) == NULL)
-               return (0.0);
-
-       first = nptr;
-       mbs = initial;
-       while (*nptr && (len = wcrtomb_l(mb, *nptr, &mbs, ctype)) != (size_t)-1) {
-               mb[len] = 0;
-               if (_simple_sappend(b, mb) < 0) { /* no memory */
-                       _simple_sfree(b);
-                       return (0.0);
-               }
-               nptr++;
-       }
-
-       buf = _simple_string(b);
-       val = strtold_l(buf, &end, loc);
-
-       if (endptr != NULL)
-               *endptr = (end == buf) ? (wchar_t *)nptr0 : ((wchar_t *)first + __wcs_end_offset(buf, end, loc));
-
-       _simple_sfree(b);
-
-       return (val);
-}
-
-long double
-wcstold(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
-{
-       return wcstold_l(nptr, endptr, __current_locale());
-}
diff --git a/locale/wcstoll-fbsd.c b/locale/wcstoll-fbsd.c
deleted file mode 100644 (file)
index af50ca8..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.19 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoll.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-/*
- * Convert a wide character string to a long long integer.
- */
-long long
-wcstoll_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base, locale_t loc)
-{
-       const wchar_t *s;
-       unsigned long long acc;
-       wchar_t c;
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoll for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == L'+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == L'0' && (*s == L'x' || *s == L'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == L'0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX
-           : LLONG_MAX;
-       cutlim = cutoff % base;
-       cutoff /= base;
-       for ( ; ; c = *s++) {
-#ifdef notyet
-               if (iswdigit_l(c, loc))
-                       c = digittoint_l(c, loc);
-               else
-#endif
-               if (c >= L'0' && c <= L'9')
-                       c -= L'0';
-               else if (c >= L'A' && c <= L'Z')
-                       c -= L'A' - 10;
-               else if (c >= L'a' && c <= L'z')
-                       c -= L'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = neg ? LLONG_MIN : LLONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-long long
-wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-{
-       return wcstoll_l(nptr, endptr, base, __current_locale());
-}
diff --git a/locale/wcstombs-fbsd.c b/locale/wcstombs-fbsd.c
deleted file mode 100644 (file)
index a6d9ae3..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.11 2009/01/15 18:53:52 rdivacky Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-size_t
-wcstombs_l(char * __restrict s, const wchar_t * __restrict pwcs, size_t n,
-    locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       const wchar_t *pwcsp;
-
-       NORMALIZE_LOCALE(loc);
-       mbs = initial;
-       pwcsp = pwcs;
-       return (loc->__lc_ctype->__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs, loc));
-}
-
-size_t
-wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
-{
-       return wcstombs_l(s, pwcs, n, __current_locale());
-}
diff --git a/locale/wcstombs.3 b/locale/wcstombs.3
deleted file mode 100644 (file)
index 24c4b61..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley of BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" From @(#)multibyte.3       8.1 (Berkeley) 6/4/93
-.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/wcstombs.3,v 1.5 2007/01/09 00:28:01 imp Exp $
-.\"
-.Dd April 8, 2004
-.Dt WCSTOMBS 3
-.Os
-.Sh NAME
-.Nm wcstombs ,
-.Nm wcstombs_l
-.Nd convert a wide-character string to a character string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft size_t
-.Fo wcstombs
-.Fa "char *restrict s"
-.Fa "const wchar_t *restrict pwcs"
-.Fa "size_t n"
-.Fc
-.In stdlib.h
-.In xlocale.h
-.Ft size_t
-.Fo wcstombs_l
-.Fa "char *restrict s"
-.Fa "const wchar_t *restrict pwcs"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcstombs
-function converts a wide character string
-.Fa pwcs
-into a multibyte character string,
-.Fa s ,
-beginning in the initial conversion state.
-Up to
-.Fa n
-bytes are stored in
-.Fa s .
-Partial multibyte characters at the end of the string are not stored.
-The multibyte character string is null terminated, if there is room.
-.Pp
-Although the
-.Fn wcstombs
-function uses the current locale, the
-.Fn wcstombs_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn wcstombs
-function returns the number of bytes converted
-(not including any terminating null), if successful;
-otherwise, it returns
-.Po Vt size_t Pc Ns \-1 .
-.Sh ERRORS
-The
-.Fn wcstombs
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid wide character was encountered.
-.It Bq Er EINVAL
-The conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbstowcs 3 ,
-.Xr multibyte 3 ,
-.Xr wcsrtombs 3 ,
-.Xr wctomb 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcstombs
-function conforms to
-.St -isoC-99 .
diff --git a/locale/wcstoul-fbsd.c b/locale/wcstoul-fbsd.c
deleted file mode 100644 (file)
index 1cad0f6..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <wchar.h>
-#include <wctype.h>
-
-/*
- * Convert a wide character string to an unsigned long integer.
- */
-unsigned long
-wcstoul_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base, locale_t loc)
-{
-       const wchar_t *s;
-       unsigned long acc;
-       wchar_t c;
-       unsigned long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == L'+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == L'0' && (*s == L'x' || *s == L'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == L'0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = ULONG_MAX / base;
-       cutlim = ULONG_MAX % base;
-       for ( ; ; c = *s++) {
-#ifdef notyet
-               if (iswdigit_l(c, loc))
-                       c = digittoint_l(c, loc);
-               else
-#endif
-               if (c >= L'0' && c <= L'9')
-                       c -= L'0';
-               else if (c >= L'A' && c <= L'Z')
-                       c -= L'A' - 10;
-               else if (c >= L'a' && c <= L'z')
-                       c -= L'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = ULONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-unsigned long
-wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
-{
-       return wcstoul_l(nptr, endptr, base, __current_locale());
-}
diff --git a/locale/wcstoull-fbsd.c b/locale/wcstoull-fbsd.c
deleted file mode 100644 (file)
index 474480e..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoull.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-/*
- * Convert a wide character string to an unsigned long long integer.
- */
-unsigned long long
-wcstoull_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base, locale_t loc)
-{
-       const wchar_t *s;
-       unsigned long long acc;
-       wchar_t c;
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoull for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == L'+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == L'0' && (*s == L'x' || *s == L'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == L'0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = ULLONG_MAX / base;
-       cutlim = ULLONG_MAX % base;
-       for ( ; ; c = *s++) {
-#ifdef notyet
-               if (iswdigit_l(c, loc))
-                       c = digittoint_l(c, loc);
-               else
-#endif
-               if (c >= L'0' && c <= L'9')
-                       c -= L'0';
-               else if (c >= L'A' && c <= L'Z')
-                       c -= L'A' - 10;
-               else if (c >= L'a' && c <= L'z')
-                       c -= L'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = ULLONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-unsigned long long
-wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base)
-{
-       return wcstoull_l(nptr, endptr, base, __current_locale());
-}
diff --git a/locale/wcstoumax-fbsd.c b/locale/wcstoumax-fbsd.c
deleted file mode 100644 (file)
index 1b447b8..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtoul.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoumax.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-
-/*
- * Convert a wide character string to a uintmax_t integer.
- */
-uintmax_t
-wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base, locale_t loc)
-{
-       const wchar_t *s;
-       uintmax_t acc;
-       wchar_t c;
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoimax for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (iswspace_l(c, loc));
-       if (c == L'-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == L'+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == L'0' && (*s == L'x' || *s == L'X')) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == L'0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = UINTMAX_MAX / base;
-       cutlim = UINTMAX_MAX % base;
-       for ( ; ; c = *s++) {
-#ifdef notyet
-               if (iswdigit_l(c, loc))
-                       c = digittoint_l(c, loc);
-               else
-#endif
-               if (c >= L'0' && c <= L'9')
-                       c -= L'0';
-               else if (c >= L'A' && c <= L'Z')
-                       c -= L'A' - 10;
-               else if (c >= L'a' && c <= L'z')
-                       c -= L'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = UINTMAX_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (wchar_t *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-uintmax_t
-wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
-    int base)
-{
-       return wcstoumax_l(nptr, endptr, base, __current_locale());
-}
diff --git a/locale/wctob-fbsd.c b/locale/wctob-fbsd.c
deleted file mode 100644 (file)
index 130d00d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdio.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-int
-wctob_l(wint_t c, locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs = initial;
-       char buf[MB_LEN_MAX];
-
-       NORMALIZE_LOCALE(loc);
-       if (c == WEOF || loc->__lc_ctype->__wcrtomb(buf, c, &mbs, loc) != 1)
-               return (EOF);
-       return ((unsigned char)*buf);
-}
-
-int
-wctob(wint_t c)
-{
-       return wctob_l(c, __current_locale());
-}
diff --git a/locale/wctomb-fbsd.c b/locale/wctomb-fbsd.c
deleted file mode 100644 (file)
index 0df7799..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-int
-wctomb_l(char *s, wchar_t wchar, locale_t loc)
-{
-       static const mbstate_t initial;
-       size_t rval;
-
-       NORMALIZE_LOCALE(loc);
-       if (s == NULL) {
-               /* No support for state dependent encodings. */
-               loc->__mbs_wctomb = initial;
-               return (0);
-       }
-       if ((rval = loc->__lc_ctype->__wcrtomb(s, wchar, &loc->__mbs_wctomb, loc)) == (size_t)-1)
-               return (-1);
-       return ((int)rval);
-}
-
-int
-wctomb(char *s, wchar_t wchar)
-{
-       return wctomb_l(s, wchar, __current_locale());
-}
diff --git a/locale/wctomb.3 b/locale/wctomb.3
deleted file mode 100644 (file)
index 33f6e37..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
-.\" Copyright (c) 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley of BSDI.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" From @(#)multibyte.3       8.1 (Berkeley) 6/4/93
-.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD: src/lib/libc/locale/wctomb.3,v 1.4 2007/01/09 00:28:01 imp Exp $
-.\"
-.Dd April 8, 2004
-.Dt WCTOMB 3
-.Os
-.Sh NAME
-.Nm wctomb ,
-.Nm wctomb_l
-.Nd convert a wide-character code to a character
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fo wctomb
-.Fa "char *s"
-.Fa "wchar_t wchar"
-.Fc
-.In stdlib.h
-.In xlocale.h
-.Ft int
-.Fo wctomb_l
-.Fa "char *s"
-.Fa "wchar_t wchar"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wctomb
-function converts a wide character,
-.Fa wchar ,
-into a multibyte character and stores the result in
-.Fa s .
-The object pointed to by
-.Fa s
-must be large enough to accommodate the multibyte character,
-which may be up to
-.Dv MB_LEN_MAX
-bytes.
-.Pp
-A call with a null
-.Fa s
-pointer returns nonzero if the current locale requires shift states,
-zero otherwise;
-if shift states are required, the shift state is reset to the initial state.
-.Pp
-Although the
-.Fn wctomb
-function uses the current locale, the
-.Fn wctomb_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If
-.Fa s
-is
-.Dv NULL ,
-the
-.Fn wctomb
-function returns nonzero if shift states are supported,
-zero otherwise.
-If
-.Fa s
-is valid,
-.Fn wctomb
-returns
-the number of bytes processed in
-.Fa s ,
-or \-1 if no multibyte character
-could be recognized or converted.
-In this case,
-.Fn wctomb Ns 's
-internal conversion state is undefined.
-.Sh ERRORS
-The
-.Fn wctomb
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid multibyte sequence was detected.
-.It Bq Er EINVAL
-The internal conversion state is invalid.
-.El
-.Sh SEE ALSO
-.Xr mbtowc 3 ,
-.Xr wcrtomb 3 ,
-.Xr wcstombs 3 ,
-.Xr wctob 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wctomb
-function conforms to
-.St -isoC-99 .
diff --git a/locale/wctrans-fbsd.c b/locale/wctrans-fbsd.c
deleted file mode 100644 (file)
index 30ca5b9..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <string.h>
-#include <wctype.h>
-
-enum {
-       _WCT_ERROR      = 0,
-       _WCT_TOLOWER    = 1,
-       _WCT_TOUPPER    = 2
-};
-
-wint_t
-towctrans_l(wint_t wc, wctrans_t desc, locale_t loc)
-{
-
-       NORMALIZE_LOCALE(loc);
-       switch (desc) {
-       case _WCT_TOLOWER:
-               wc = towlower_l(wc, loc);
-               break;
-       case _WCT_TOUPPER:
-               wc = towupper_l(wc, loc);
-               break;
-       case _WCT_ERROR:
-       default:
-               errno = EINVAL;
-               break;
-       }
-
-       return (wc);
-}
-
-wint_t
-towctrans(wint_t wc, wctrans_t desc)
-{
-       return towctrans_l(wc, desc, __current_locale());
-}
-
-wctrans_t
-wctrans(const char *charclass)
-{
-       struct {
-               const char      *name;
-               wctrans_t        trans;
-       } ccls[] = {
-               { "tolower",    _WCT_TOLOWER },
-               { "toupper",    _WCT_TOUPPER },
-               { NULL,         _WCT_ERROR },           /* Default */
-       };
-       int i;
-
-       i = 0;
-       while (ccls[i].name != NULL && strcmp(ccls[i].name, charclass) != 0)
-               i++;
-
-       if (ccls[i].trans == _WCT_ERROR)
-               errno = EINVAL;
-       return (ccls[i].trans);
-}
-
-/*
- * The extended locale version just calls the regular version.  If there
- * is ever support for arbitrary per-locale translations, this need to
- * be modified.
- */
-wctrans_t
-wctrans_l(const char *charclass, locale_t loc)
-{
-       return wctrans(charclass);
-}
diff --git a/locale/wctrans.3 b/locale/wctrans.3
deleted file mode 100644 (file)
index 7cb0da6..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wctrans.3,v 1.3 2002/11/29 17:35:09 ru Exp $
-.\"
-.Dd October 3, 2002
-.Dt WCTRANS 3
-.Os
-.Sh NAME
-.Nm towctrans ,
-.Nm towctrans_l ,
-.Nm wctrans ,
-.Nm wctrans_l
-.Nd "wide character mapping functions"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wctype.h
-.Ft wint_t
-.Fo towctrans
-.Fa "wint_t wc"
-.Fa "wctrans_t desc"
-.Fc
-.Ft wctrans_t
-.Fo wctrans
-.Fa "const char *charclass"
-.Fc
-.In wctype.h
-.In xlocale.h
-.Ft wint_t
-.Fo towctrans_l
-.Fa "wint_t wc"
-.Fa "wctrans_t desc"
-.Fa "locale_t loc"
-.Fc
-.Ft wctrans_t
-.Fo wctrans_l
-.Fa "const char *charclass"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wctrans
-function returns a value of type
-.Vt wctrans_t ,
-which represents the requested wide character mapping operation and
-may be used as the second argument for calls to
-.Fn towctrans .
-.Pp
-The following character mapping names are recognised:
-.Bl -column -offset indent ".Li tolower" ".Li toupper"
-.It Li "tolower        toupper"
-.El
-.Pp
-The
-.Fn towctrans
-function transliterates the wide character
-.Fa wc ,
-according to the mapping described by
-.Fa desc .
-.Pp
-While the
-.Fn towctrans
-and
-.Fn wctrans
-functions use the current locale, the
-.Fn towctrans_l
-and
-.Fn wctrans_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn towctrans
-function returns the transliterated character if successful, otherwise
-it returns the character unchanged and sets
-.Va errno .
-.Pp
-The
-.Fn wctrans
-function returns non-zero if successful, otherwise it returns zero
-and sets
-.Va errno .
-.Sh EXAMPLES
-Reimplement
-.Fn towupper
-in terms of
-.Fn towctrans
-and
-.Fn wctrans :
-.Bd -literal -offset indent
-wint_t
-mytowupper(wint_t wc)
-{
-       return (towctrans(wc, wctrans("toupper")));
-}
-.Ed
-.Sh ERRORS
-The
-.Fn towctrans
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The supplied
-.Fa desc
-argument is invalid.
-.El
-.Pp
-The
-.Fn wctrans
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The requested mapping name is invalid.
-.El
-.Sh SEE ALSO
-.Xr tolower 3 ,
-.Xr toupper 3 ,
-.Xr wctype 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn towctrans
-and
-.Fn wctrans
-functions conform to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn towctrans
-and
-.Fn wctrans
-functions first appeared in
-.Fx 5.0 .
diff --git a/locale/wctype-fbsd.c b/locale/wctype-fbsd.c
deleted file mode 100644 (file)
index f94c133..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <string.h>
-#include <wctype.h>
-#include <limits.h>
-
-wctype_t
-wctype_l(const char *property, locale_t loc)
-{
-       _RuneLocale *rl;
-       static const struct {
-               const char      *name;
-               wctype_t         mask;
-       } props[] = {
-               { "alnum",      _CTYPE_A|_CTYPE_D },
-               { "alpha",      _CTYPE_A },
-               { "blank",      _CTYPE_B },
-               { "cntrl",      _CTYPE_C },
-               { "digit",      _CTYPE_D },
-               { "graph",      _CTYPE_G },
-               { "lower",      _CTYPE_L },
-               { "print",      _CTYPE_R },
-               { "punct",      _CTYPE_P },
-               { "space",      _CTYPE_S },
-               { "upper",      _CTYPE_U },
-               { "xdigit",     _CTYPE_X },
-               { "ideogram",   _CTYPE_I },     /* BSD extension */
-               { "special",    _CTYPE_T },     /* BSD extension */
-               { "phonogram",  _CTYPE_Q },     /* BSD extension */
-               { "rune",       0xFFFFFF00L },  /* BSD extension */
-               { NULL,         0UL },          /* Default */
-       };
-       int i;
-
-       i = 0;
-       while (props[i].name != NULL && strcmp(props[i].name, property) != 0)
-               i++;
-
-       if (props[i].mask)
-               return (props[i].mask);
-
-       NORMALIZE_LOCALE(loc);
-       rl = &loc->__lc_ctype->_CurrentRuneLocale;
-       if ((i = rl->__ncharclasses) > 0) {
-               _RuneCharClass *rp;
-               for (rp = rl->__charclasses; i-- > 0; rp++) {
-                       if (strncmp(rp->__name, property, CHARCLASS_NAME_MAX) == 0)
-                               return (rp->__mask);
-               }
-       }
-       return 0;
-}
-
-wctype_t
-wctype(const char *property)
-{
-       return wctype_l(property, __current_locale());
-}
diff --git a/locale/wctype.3 b/locale/wctype.3
deleted file mode 100644 (file)
index 5175972..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wctype.3,v 1.7 2006/10/13 16:11:12 ru Exp $
-.\"
-.Dd March 27, 2004
-.Dt WCTYPE 3
-.Os
-.Sh NAME
-.Nm iswctype ,
-.Nm iswctype_l ,
-.Nm wctype ,
-.Nm wctype_l
-.Nd "wide character class functions"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wctype.h
-.Ft int
-.Fo iswctype
-.Fa "wint_t wc"
-.Fa "wctype_t charclass"
-.Fc
-.Ft wctype_t
-.Fo wctype
-.Fa "const char *property"
-.Fc
-.In wctype.h
-.In xlocale.h
-.Ft int
-.Fo iswctype_l
-.Fa "wint_t wc"
-.Fa "wctype_t charclass"
-.Fa "locale_t loc"
-.Fc
-.Ft wctype_t
-.Fo wctype_l
-.Fa "const char *property"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wctype
-function returns a value of type
-.Vt wctype_t ,
-which represents the requested wide character class and
-may be used as the second argument for calls to
-.Fn iswctype .
-.Pp
-The following character class names are recognised:
-.Bl -column -offset indent ".Li alnum" ".Li cntrl" ".Li ideogram" ".Li print" ".Li space"
-.It Li "alnum  cntrl   ideogram        print   space   xdigit"
-.It Li "alpha  digit   lower   punct   special"
-.It Li "blank  graph   phonogram       rune    upper"
-.El
-.Pp
-The
-.Fn iswctype
-function checks whether the wide character
-.Fa wc
-is in the character class
-.Fa charclass .
-.Pp
-Although the
-.Fn iswctype
-and
-.Fn wctype
-functions use the current locale, the
-.Fn iswctype_l
-and
-.Fn wctype_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn iswctype
-function returns non-zero if and only if
-.Fa wc
-has the property described by
-.Fa charclass ,
-or
-.Fa charclass
-is zero.
-.Pp
-The
-.Fn wctype
-function returns 0 if
-.Fa property
-is invalid; otherwise, it returns a value of type
-.Vt wctype_t
-that can be used in subsequent calls to
-.Fn iswctype .
-.Sh EXAMPLES
-Reimplement
-.Xr iswalpha 3
-in terms of
-.Fn iswctype
-and
-.Fn wctype :
-.Bd -literal -offset indent
-int
-myiswalpha(wint_t wc)
-{
-       return (iswctype(wc, wctype("alpha")));
-}
-.Ed
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr nextwctype 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn iswctype
-and
-.Fn wctype
-functions conform to
-.St -p1003.1-2001 .
-The
-.Dq Li ideogram ,
-.Dq Li phonogram ,
-.Dq Li special ,
-and
-.Dq Li rune
-character classes are extensions.
-.Sh HISTORY
-The
-.Fn iswctype
-and
-.Fn wctype
-functions first appeared in
-.Fx 5.0 .
diff --git a/locale/wcwidth-fbsd.c b/locale/wcwidth-fbsd.c
deleted file mode 100644 (file)
index ae533e7..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.8 2007/01/09 00:28:01 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-
-#undef wcwidth
-
-int
-wcwidth(wchar_t wc)
-{
-
-       return (__wcwidth_l(wc, __current_locale()));
-}
-
-int
-wcwidth_l(wchar_t wc, locale_t loc)
-{
-
-       NORMALIZE_LOCALE(loc);
-       return (__wcwidth_l(wc, loc));
-}
diff --git a/locale/wcwidth.3 b/locale/wcwidth.3
deleted file mode 100644 (file)
index 4c014ce..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/locale/wcwidth.3,v 1.6 2004/08/17 04:56:03 trhodes Exp $
-.\"
-.Dd August 17, 2004
-.Dt WCWIDTH 3
-.Os
-.Sh NAME
-.Nm wcwidth ,
-.Nm wcwidth_l
-.Nd "number of column positions of a wide-character code"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft int
-.Fo wcwidth
-.Fa "wchar_t wc"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft int
-.Fo wcwidth_l
-.Fa "wchar_t wc"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcwidth
-function determines the number of column positions required to
-display the wide character
-.Fa wc .
-.Pp
-Although the
-.Fn wcwidth
-function uses the current locale, the
-.Fn wcwidth_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn wcwidth
-function returns 0 if the
-.Fa wc
-argument is a null wide character (L'\e0'),
-\-1 if
-.Fa wc
-is not printable;
-otherwise, it returns the number of column positions the
-character occupies.
-.Sh EXAMPLES
-This code fragment reads text from standard input and
-breaks lines that are more than 20 column positions wide,
-similar to the
-.Xr fold 1
-utility:
-.Bd -literal -offset indent
-wint_t ch;
-int column, w;
-
-column = 0;
-while ((ch = getwchar()) != WEOF) {
-       w = wcwidth(ch);
-       if (w > 0 && column + w >= 20) {
-               putwchar(L'\en');
-               column = 0;
-       }
-       putwchar(ch);
-       if (ch == L'\en')
-               column = 0;
-       else if (w > 0)
-               column += w;
-}
-.Ed
-.Sh SEE ALSO
-.Xr iswprint 3 ,
-.Xr wcswidth 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcwidth
-function conforms to
-.St -p1003.1-2001 .
index c0fa5af27cb805cf811089c83ef6dab10547ec56..e5db93fe0bfdd228c780ae415ef0db5c533dcbab 100644 (file)
@@ -29,7 +29,7 @@
 
 #define NMBSTATET      10
 #define C_LOCALE_INITIALIZER   {       \
-       0, NULL,                        \
+       0, XPERMANENT,                  \
        {}, {}, {}, {}, {},             \
        {}, {}, {}, {}, {},             \
        LOCK_INITIALIZER,               \
diff --git a/makeCombos b/makeCombos
deleted file mode 100755 (executable)
index 70570d2..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
-#
-# @APPLE_LICENSE_HEADER_START@
-# 
-# This file contains Original Code and/or Modifications of Original Code
-# as defined in and that are subject to the Apple Public Source License
-# Version 2.0 (the 'License'). You may not use this file except in
-# compliance with the License. Please obtain a copy of the License at
-# http://www.opensource.apple.com/apsl/ and read it before using this
-# file.
-# 
-# The Original Code and all software distributed under the License are
-# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
-# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
-# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
-# Please see the License for the specific language governing rights and
-# limitations under the License.
-# 
-# @APPLE_LICENSE_HEADER_END@
-
-use strict;
-
-# combine arguments without a slash, with the preceding argument with a slash
-# use @ instead of space for separator
-my @args;
-my $prev;
-for(@ARGV) {
-    if(m,/,) {
-       push(@args, $prev) if $prev;
-       $prev = $_;
-    } else {
-       $prev .= "\@$_";
-    }
-}
-push(@args, $prev) if $prev;
-
-# now make all unique combinations
-my %combos;
-foreach my $variant (sort(@args)) {
-    my($v, $defines) = split('/', $variant, 2);
-    my %new;
-    @new{$v, map("$_-$v", sort(keys %combos))} = ($defines, map("$_\@$defines", sort(values %combos)));
-    %combos = (%combos, %new);
-}
-for(sort keys(%combos)) {
-    printf "%s/%s\n", $_, $combos{$_};
-}
index 775d18641b11f1ce7dbd41513fee63baa1de9c42..f83aeb739ee9ae339ffb5fe22ed9ff0c616abc84 100644 (file)
@@ -74,13 +74,21 @@ and
 .Pp
 The
 .Fn va_start
-macro initializes
-.Fa ap
-for subsequent use by
+macro must be called first, and it initializes
+.Fa ap ,
+which can be passed to
 .Fn va_arg
-and
+for each argument to be processed.
+Calling
+.Fn va_end
+signals that there are no further arguments, and causes
+.Fa ap
+to be invalidated.
+Note that each call to
+.Fn va_start
+must be matched by a call to
 .Fn va_end ,
-and must be called first.
+from within the same function.
 .Pp
 The parameter
 .Fa last
@@ -93,10 +101,6 @@ macro, it should not be declared as a register variable, or as a
 function or an array type.
 .Pp
 The
-.Fn va_start
-macro returns no value.
-.Pp
-The
 .Fn va_arg
 macro expands to an expression that has the type and value of the next
 argument in the call.
@@ -136,34 +140,38 @@ arguments.
 .Pp
 The
 .Fn va_copy
-macro copies a variable argument list, previously initialized by
+macro copies the state of the variable argument list, 
+.Fa src ,
+previously initialized by
 .Fn va_start ,
-from
-.Fa src
-to
-.Fa dest .
-The state is preserved such that it is equivalent to calling
+to the variable argument list,
+.Fa dest ,
+which must not have been previously initialized by
+.Fn va_start ,
+without an intervening call to
+.Fn va_end .
+The state preserved in
+.Fa dest
+is equivalent to calling
 .Fn va_start
-with the same second argument used with
-.Fa src ,
-and calling
+and
 .Fn va_arg
-the same number of times as called with
+on
+.Fa dest
+in the same way as was used on
 .Fa src .
-.Pp
-The
-.Fn va_copy
-macro returns no value.
-.Pp
-The
+The copied variable argument list can subsequently be passed to
+.Fn va_arg ,
+and must finally be passed to
 .Fn va_end
-macro handles a normal return from the function whose variable argument
-list was initialized by
-.Fn va_start .
+when through with it.
 .Pp
-The
-.Fn va_end
-macro returns no value.
+After a variable argument list is invalidated by
+.Fn va_end ,
+it can be reinitialized with
+.Fn va_start
+or made a copy of another variable argument list with
+.Fn va_copy .
 .Sh EXAMPLES
 The function
 .Em foo
@@ -172,11 +180,12 @@ associated with each format character based on the type.
 .Bd -literal -offset indent
 void foo(char *fmt, ...)
 {
-       va_list ap;
+       va_list ap, ap2;
        int d;
        char c, *s;
 
        va_start(ap, fmt);
+       va_copy(ap2, ap);
        while (*fmt)
                switch(*fmt++) {
                case 's':                       /* string */
@@ -194,6 +203,10 @@ void foo(char *fmt, ...)
                        break;
                }
        va_end(ap);
+       ...
+       /* use ap2 to iterate over the arguments again */
+       ...
+       va_end(ap2);
 }
 .Ed
 .Sh COMPATIBILITY
diff --git a/man/FreeBSD/stdarg.3.patch b/man/FreeBSD/stdarg.3.patch
deleted file mode 100644 (file)
index 882936f..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
---- stdarg.3.orig      2008-07-30 02:46:51.000000000 -0700
-+++ stdarg.3   2008-07-30 04:06:35.000000000 -0700
-@@ -74,13 +74,21 @@
- .Pp
- The
- .Fn va_start
--macro initializes
--.Fa ap
--for subsequent use by
-+macro must be called first, and it initializes
-+.Fa ap ,
-+which can be passed to
- .Fn va_arg
--and
-+for each argument to be processed.
-+Calling
-+.Fn va_end
-+signals that there are no further arguments, and causes
-+.Fa ap
-+to be invalidated.
-+Note that each call to
-+.Fn va_start
-+must be matched by a call to
- .Fn va_end ,
--and must be called first.
-+from within the same function.
- .Pp
- The parameter
- .Fa last
-@@ -93,10 +101,6 @@
- function or an array type.
- .Pp
- The
--.Fn va_start
--macro returns no value.
--.Pp
--The
- .Fn va_arg
- macro expands to an expression that has the type and value of the next
- argument in the call.
-@@ -136,34 +140,38 @@
- .Pp
- The
- .Fn va_copy
--macro copies a variable argument list, previously initialized by
-+macro copies the state of the variable argument list, 
-+.Fa src ,
-+previously initialized by
- .Fn va_start ,
--from
--.Fa src
--to
--.Fa dest .
--The state is preserved such that it is equivalent to calling
-+to the variable argument list,
-+.Fa dest ,
-+which must not have been previously initialized by
-+.Fn va_start ,
-+without an intervening call to
-+.Fn va_end .
-+The state preserved in
-+.Fa dest
-+is equivalent to calling
- .Fn va_start
--with the same second argument used with
--.Fa src ,
--and calling
-+and
- .Fn va_arg
--the same number of times as called with
-+on
-+.Fa dest
-+in the same way as was used on
- .Fa src .
--.Pp
--The
--.Fn va_copy
--macro returns no value.
--.Pp
--The
-+The copied variable argument list can subsequently be passed to
-+.Fn va_arg ,
-+and must finally be passed to
- .Fn va_end
--macro handles a normal return from the function whose variable argument
--list was initialized by
--.Fn va_start .
-+when through with it.
- .Pp
--The
--.Fn va_end
--macro returns no value.
-+After a variable argument list is invalidated by
-+.Fn va_end ,
-+it can be reinitialized with
-+.Fn va_start
-+or made a copy of another variable argument list with
-+.Fn va_copy .
- .Sh EXAMPLES
- The function
- .Em foo
-@@ -172,11 +180,12 @@
- .Bd -literal -offset indent
- void foo(char *fmt, ...)
- {
--      va_list ap;
-+      va_list ap, ap2;
-       int d;
-       char c, *s;
-       va_start(ap, fmt);
-+      va_copy(ap2, ap);
-       while (*fmt)
-               switch(*fmt++) {
-               case 's':                       /* string */
-@@ -194,6 +203,10 @@
-                       break;
-               }
-       va_end(ap);
-+      ...
-+      /* use ap2 to iterate over the arguments again */
-+      ...
-+      va_end(ap2);
- }
- .Ed
- .Sh COMPATIBILITY
diff --git a/man/Makefile.inc b/man/Makefile.inc
deleted file mode 100644 (file)
index a084c75..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# miscellaneous man pages
-
-.PATH: ${.CURDIR}/man
-CWD := ${.CURDIR}/man
-
-.if ${LIB} == "c"
-
-MAN2 += gethostuuid.2
-MAN3 += assert.3 bitstring.3
-.ifdef FEATURE_LEGACY_UTMP_APIS
-MAN5 += utmp.5
-.endif
-MAN7 += environ.7
-
-.include "Makefile.fbsd_begin"
-FBSDMAN3 = stdarg.3
-.include "Makefile.fbsd_end"
-
-
-MLINKS += bitstring.3 bit_alloc.3
-MLINKS += bitstring.3 bit_clear.3
-MLINKS += bitstring.3 bit_decl.3
-MLINKS += bitstring.3 bit_ffs.3
-MLINKS += bitstring.3 bit_nclear.3
-MLINKS += bitstring.3 bit_nset.3
-MLINKS += bitstring.3 bit_set.3
-MLINKS += bitstring.3 bit_test.3
-MLINKS += bitstring.3 bitstr_size.3
-.ifdef FEATURE_LEGACY_UTMP_APIS
-MLINKS += utmp.5 lastlog.5
-MLINKS += utmp.5 wtmp.5
-.endif
-
-MLINKS += stdarg.3 va_arg.3
-MLINKS += stdarg.3 va_copy.3
-MLINKS += stdarg.3 va_end.3
-MLINKS += stdarg.3 va_start.3
-
-.endif
diff --git a/man/manpages.lst b/man/manpages.lst
new file mode 100644 (file)
index 0000000..c009e78
--- /dev/null
@@ -0,0 +1,423 @@
+# manpage tables
+# <source> <dest> [<link> <link> ...]
+
+# man2
+brk.2 brk.2 sbrk.2
+creat.2 creat.2
+gethostuuid.2 gethostuuid.2
+killpg.2 killpg.2
+nanosleep.2 nanosleep.2
+pthread_kill.2 pthread_kill.2
+pthread_sigmask.2 pthread_sigmask.2
+sigblock.2 sigblock.2
+sigpause.2 sigpause.2
+sigsetmask.2 sigsetmask.2 sigmask.2
+sigvec.2 sigvec.2
+sigwait.2 sigwait.2
+
+# man3
+a64l.3 a64l.3 l64a.3
+abort.3 abort.3
+abs.3 abs.3
+acl.3 acl.3 posix1e.3
+acl_add_flag_np.3 acl_add_flag_np.3
+acl_add_perm.3 acl_add_perm.3
+acl_clear_flags_np.3 acl_clear_flags_np.3
+acl_clear_perms.3 acl_clear_perms.3
+acl_copy_entry.3 acl_copy_entry.3
+acl_copy_ext.3 acl_copy_ext.3 acl_copy_ext_native.3 acl_copy_int.3 acl_copy_int_native.3 acl_size.3
+acl_create_entry.3 acl_create_entry.3 acl_create_entry_np.3
+acl_delete_entry.3 acl_delete_entry.3
+acl_delete_flag_np.3 acl_delete_flag_np.3
+acl_delete_perm.3 acl_delete_perm.3
+acl_dup.3 acl_dup.3
+acl_free.3 acl_free.3
+acl_from_text.3 acl_from_text.3
+acl_get.3 acl_get.3 acl_get_fd.3 acl_get_fd_np.3 acl_get_file.3 acl_get_link_np.3
+acl_get_entry.3 acl_get_entry.3
+acl_get_flagset_np.3 acl_get_flagset_np.3
+acl_get_perm_np.3 acl_get_perm_np.3
+acl_get_permset.3 acl_get_permset.3
+acl_get_permset_mask_np.3 acl_get_permset_mask_np.3 acl_set_permset_mask_np.3 acl_maximal_permset_mask_np.3
+acl_get_qualifier.3 acl_get_qualifier.3
+acl_get_tag_type.3 acl_get_tag_type.3
+acl_init.3 acl_init.3
+acl_set.3 acl_set.3 acl_set_fd.3 acl_set_fd_np.3 acl_set_file.3 acl_set_link_np.3
+acl_set_flagset_np.3 acl_set_flagset_np.3
+acl_set_permset.3 acl_set_permset.3
+acl_set_qualifier.3 acl_set_qualifier.3
+acl_set_tag_type.3 acl_set_tag_type.3
+acl_to_text.3 acl_to_text.3
+acl_valid.3 acl_valid.3 acl_valid_fd_np.3 acl_valid_file_np.3 acl_valid_link_np.3
+addr2ascii.3 addr2ascii.3 ascii2addr.3
+alarm.3 alarm.3
+alloca.3 alloca.3
+arc4random.3 arc4random.3 arc4random_addrandom.3 arc4random_buf.3 arc4random_stir.3 arc4random_uniform.3
+asl.3 asl.3 asl_add_log_file.3 asl_close.3 asl_free.3 asl_get.3 asl_key.3 asl_log.3 asl_new.3 asl_open.3 asl_remove_log_file.3 asl_search.3 asl_send.3 asl_set.3 asl_set_filter.3 asl_set_query.3 asl_unset.3 asl_vlog.3 aslresponse_free.3 aslresponse_next.3
+assert.3 assert.3
+atexit.3 atexit.3 atexit_b.3
+atof.3 atof.3 atof_l.3
+atoi.3 atoi.3 atoi_l.3
+atol.3 atol.3 atol_l.3 atoll.3 atoll_l.3
+atomic.3 atomic.3 OSAtomicAdd32.3 OSAtomicAdd32Barrier.3 OSAtomicAdd64.3 OSAtomicAdd64Barrier.3 OSAtomicAnd32.3 OSAtomicAnd32Barrier.3 OSAtomicAnd32Orig.3 OSAtomicAnd32OrigBarrier.3 OSAtomicCompareAndSwap32.3 OSAtomicCompareAndSwap32Barrier.3 OSAtomicCompareAndSwap64.3 OSAtomicCompareAndSwap64Barrier.3 OSAtomicCompareAndSwapInt.3 OSAtomicCompareAndSwapIntBarrier.3 OSAtomicCompareAndSwapLong.3 OSAtomicCompareAndSwapLongBarrier.3 OSAtomicCompareAndSwapPtr.3 OSAtomicCompareAndSwapPtrBarrier.3 OSAtomicDecrement32.3 OSAtomicDecrement32Barrier.3 OSAtomicDecrement64.3 OSAtomicDecrement64Barrier.3 OSAtomicDequeue.3 OSAtomicEnqueue.3 OSAtomicIncrement32.3 OSAtomicIncrement32Barrier.3 OSAtomicIncrement64.3 OSAtomicIncrement64Barrier.3 OSAtomicOr32.3 OSAtomicOr32Barrier.3 OSAtomicOr32Orig.3 OSAtomicOr32OrigBarrier.3 OSAtomicTestAndClear.3 OSAtomicTestAndClearBarrier.3 OSAtomicTestAndSet.3 OSAtomicTestAndSetBarrier.3 OSAtomicXor32.3 OSAtomicXor32Barrier.3 OSAtomicXor32Orig.3 OSAtomicXor32OrigBarrier.3
+backtrace.3 backtrace.3 backtrace_symbols.3 backtrace_symbols_fd.3
+barrier.3 barrier.3 OSMemoryBarrier.3
+basename.3 basename.3
+bcmp.3 bcmp.3
+bcopy.3 bcopy.3
+bitstring.3 bitstring.3 bit_alloc.3 bit_clear.3 bit_decl.3 bit_ffs.3 bit_nclear.3 bit_nset.3 bit_set.3 bit_test.3 bitstr_size.3
+bsd_signal.3 bsd_signal.3
+bsearch.3 bsearch.3 bsearch_b.3
+bstring.3 bstring.3
+btowc.3 btowc.3 wctob.3 btowc_l.3 wctob_l.3
+btree.3 btree.3
+byteorder.3 byteorder.3 htonl.3 htons.3 ntohl.3 ntohs.3
+bzero.3 bzero.3
+cache.3 cache.3 sys_cache_control.3 sys_icache_invalidate.3 sys_dcache_flush.3
+catclose.3 catclose.3
+catgets.3 catgets.3
+catopen.3 catopen.3
+clock.3 clock.3
+confstr.3 confstr.3
+crypt.3 crypt.3 encrypt.3 setkey.3
+ctermid.3 ctermid.3 ctermid_r.3
+ctime.3 ctime.3 asctime.3 asctime_r.3 asctime_r.3 ctime_r.3 difftime.3 gmtime.3 gmtime.3 gmtime_r.3 gmtime_r.3 localtime.3 localtime_r.3 mktime.3 mktime.3
+ctype.3 ctype.3
+ctype_l.3 ctype_l.3
+daemon.3 daemon.3
+dbm.3 dbm.3 dbm_clearerr.3 dbm_close.3 dbm_delete.3 dbm_dirfno.3 dbm_error.3 dbm_fetch.3 dbm_firstkey.3 dbm_nextkey.3 dbm_open.3 dbm_store.3
+dbopen.3 dbopen.3 db.3
+devname.3 devname.3 devname_r.3
+digittoint.3 digittoint.3 digittoint_l.3
+directory.3 directory.3 closedir.3 dirfd.3 opendir.3 readdir.3 readdir_r.3 rewinddir.3 seekdir.3 telldir.3
+dirname.3 dirname.3
+div.3 div.3
+duplocale.3 duplocale.3
+ecvt.3 ecvt.3 fcvt.3 gcvt.3
+endutxent.3 endutxent.3 getutxent.3 getutxid.3 getutxline.3 pututxline.3 setutxent.3
+err.3 err.3 err_set_exit.3 err_set_file.3 errc.3 errx.3 verr.3 verrc.3 verrx.3 vwarn.3 vwarnc.3 vwarnx.3 warn.3 warnc.3 warnx.3 err_set_exit_b.3
+ethers.3 ethers.3 ether_aton.3 ether_hostton.3 ether_line.3 ether_ntoa.3 ether_ntohost.3
+exec.3 exec.3 execl.3 execle.3 execlp.3 execv.3 execvp.3
+exit.3 exit.3 _Exit.3
+fclose.3 fclose.3
+ferror.3 ferror.3 clearerr.3 clearerr_unlocked.3 feof.3 feof_unlocked.3 ferror_unlocked.3 fileno.3 fileno_unlocked.3
+fflush.3 fflush.3 fpurge.3
+ffs.3 ffs.3 ffsl.3 fls.3 flsl.3
+fgetln.3 fgetln.3
+fgets.3 fgets.3 gets.3
+fgetwln.3 fgetwln.3 fgetwln_l.3
+fgetws.3 fgetws.3 fgetws_l.3
+flockfile.3 flockfile.3 ftrylockfile.3 funlockfile.3
+fmtcheck.3 fmtcheck.3
+fmtmsg.3 fmtmsg.3
+fnmatch.3 fnmatch.3
+fopen.3 fopen.3 fdopen.3 freopen.3
+fparseln.3 fparseln.3
+fputs.3 fputs.3 puts.3
+fputws.3 fputws.3 fputws_l.3
+fread.3 fread.3 fwrite.3
+freelocale.3 freelocale.3
+fseek.3 fseek.3 fgetpos.3 fseeko.3 fsetpos.3 ftell.3 ftello.3 rewind.3
+ftime.3 ftime.3
+ftok.3 ftok.3
+fts.3 fts.3 fts_children.3 fts_close.3 fts_open.3 fts_read.3 fts_set.3 fts_open_b.3
+ftw.3 ftw.3 nftw.3
+funopen.3 funopen.3 fropen.3 fwopen.3
+fwide.3 fwide.3
+getbsize.3 getbsize.3
+getc.3 getc.3 fgetc.3 getc_unlocked.3 getchar.3 getchar_unlocked.3 getw.3
+getcap.3 getcap.3 cgetcap.3 cgetclose.3 cgetent.3 cgetfirst.3 cgetmatch.3 cgetnext.3 cgetnum.3 cgetset.3 cgetstr.3 cgetustr.3
+getcontext.3 getcontext.3 setcontext.3
+getcwd.3 getcwd.3 getwd.3
+getdate.3 getdate.3
+getdomainname.3 getdomainname.3 setdomainname.3
+getenv.3 getenv.3 putenv.3 setenv.3 unsetenv.3
+gethostid.3 gethostid.3 sethostid.3
+gethostname.3 gethostname.3 sethostname.3
+getiopolicy_np.3 getiopolicy_np.3 setiopolicy_np.3
+getlastlogx.3 getlastlogx.3 getlastlogxbyname.3 getutmp.3 getutmpx.3 utmpxname.3
+getline.3 getline.3 getdelim.3
+getloadavg.3 getloadavg.3
+getmntinfo.3 getmntinfo.3
+getopt.3 getopt.3
+getopt_long.3 getopt_long.3 getopt_long_only.3
+getpagesize.3 getpagesize.3
+getpass.3 getpass.3
+getpeereid.3 getpeereid.3
+getprogname.3 getprogname.3 setprogname.3
+getsubopt.3 getsubopt.3
+getttyent.3 getttyent.3 endttyent.3 getttynam.3 setttyent.3
+getusershell.3 getusershell.3 endusershell.3 setusershell.3
+getvfsbyname.3 getvfsbyname.3
+getwc.3 getwc.3 fgetwc.3 getwchar.3
+getwc_l.3 getwc_l.3 fgetwc_l.3 getwchar_l.3
+glob.3 glob.3 globfree.3
+grantpt.3 grantpt.3 posix_openpt.3 ptsname.3 unlockpt.3
+hash.3 hash.3
+hcreate.3 hcreate.3 hdestroy.3 hsearch.3
+imaxabs.3 imaxabs.3
+imaxdiv.3 imaxdiv.3
+index.3 index.3
+inet.3 inet.3 addr.3 inet_addr.3 inet_aton.3 inet_lnaof.3 inet_makeaddr.3 inet_netof.3 inet_network.3 inet_ntoa.3 inet_ntop.3 inet_pton.3 network.3 ntoa.3
+inet_net.3 inet_net.3 inet_net_ntop.3 inet_net_pton.3
+insque.3 insque.3 remque.3
+intro.3 intro.3
+isalnum.3 isalnum.3
+isalnum_l.3 isalnum_l.3 isalpha_l.3 isblank_l.3 iscntrl_l.3 isdigit_l.3 isgraph_l.3 ishexnumber_l.3 isideogram_l.3 islower_l.3 isnumber_l.3 isphonogram_l.3 isprint_l.3 ispunct_l.3 isrune_l.3 isspace_l.3 isspecial_l.3 isupper_l.3 isxdigit_l.3
+isalpha.3 isalpha.3
+isascii.3 isascii.3
+isblank.3 isblank.3
+iscntrl.3 iscntrl.3
+isdigit.3 isdigit.3 isnumber.3
+isgraph.3 isgraph.3
+isideogram.3 isideogram.3
+islower.3 islower.3
+isphonogram.3 isphonogram.3
+isprint.3 isprint.3
+ispunct.3 ispunct.3
+isrune.3 isrune.3
+isspace.3 isspace.3
+isspecial.3 isspecial.3
+isupper.3 isupper.3
+iswalnum.3 iswalnum.3 iswalpha.3 iswascii.3 iswblank.3 iswcntrl.3 iswdigit.3 iswgraph.3 iswhexnumber.3 iswideogram.3 iswlower.3 iswnumber.3 iswphonogram.3 iswprint.3 iswpunct.3 iswrune.3 iswspace.3 iswspecial.3 iswupper.3 iswxdigit.3
+iswalnum_l.3 iswalnum_l.3 iswalpha_l.3 iswblank_l.3 iswcntrl_l.3 iswdigit_l.3 iswgraph_l.3 iswhexnumber_l.3 iswideogram_l.3 iswlower_l.3 iswnumber_l.3 iswphonogram_l.3 iswprint_l.3 iswpunct_l.3 iswrune_l.3 iswspace_l.3 iswspecial_l.3 iswupper_l.3 iswxdigit_l.3
+isxdigit.3 isxdigit.3 ishexnumber.3
+labs.3 labs.3
+lchflags.3 lchflags.3
+lchmod.3 lchmod.3
+ldiv.3 ldiv.3
+linkaddr.3 linkaddr.3 link_addr.3 link_ntoa.3
+llabs.3 llabs.3
+lldiv.3 lldiv.3
+localeconv.3 localeconv.3 localeconv_l.3
+lockf.3 lockf.3
+login.3 login.3 logwtmp.3 logout.3
+lsearch.3 lsearch.3 lfind.3
+lutimes.3 lutimes.3
+makecontext.3 makecontext.3 swapcontext.3
+malloc.3 malloc.3 calloc.3 free.3 realloc.3 reallocf.3 valloc.3
+malloc_size.3 malloc_size.3 malloc_good_size.3
+malloc_zone_malloc.3 malloc_zone_malloc.3 malloc_create_zone.3 malloc_destroy_zone.3 malloc_default_zone.3 malloc_zone_from_ptr.3 malloc_zone_calloc.3 malloc_zone_valloc.3 malloc_zone_realloc.3 malloc_zone_memalign.3 malloc_zone_free.3
+mblen.3 mblen.3 mblen_l.3
+mbrlen.3 mbrlen.3 mbrlen_l.3
+mbrtowc.3 mbrtowc.3 mbrtowc_l.3
+mbrune.3 mbrune.3 mbmb.3 mbrrune.3
+mbsinit.3 mbsinit.3 mbsinit_l.3
+mbsrtowcs.3 mbsrtowcs.3 mbsnrtowcs.3 mbsrtowcs_l.3 mbsnrtowcs_l.3
+mbstowcs.3 mbstowcs.3 mbstowcs_l.3
+mbtowc.3 mbtowc.3 mbtowc_l.3
+memccpy.3 memccpy.3
+memchr.3 memchr.3
+memcmp.3 memcmp.3
+memcpy.3 memcpy.3
+memmem.3 memmem.3
+memmove.3 memmove.3
+memory.3 memory.3
+memset.3 memset.3
+memset_pattern.3 memset_pattern.3 memset_pattern4.3 memset_pattern8.3 memset_pattern16.3
+mkpath_np.3 mkpath_np.3
+mktemp.3 mktemp.3 mkdtemp.3 mkstemp.3 mkstemps.3
+moncontrol.3 moncontrol.3 monstartup.3
+mpool.3 mpool.3 mpool_close.3 mpool_filter.3 mpool_get.3 mpool_new.3 mpool_open.3 mpool_put.3 mpool_sync.3
+multibyte.3 multibyte.3
+newlocale.3 newlocale.3
+nextwctype.3 nextwctype.3 nextwctype_l.3
+nice.3 nice.3
+nl_langinfo.3 nl_langinfo.3 nl_langinfo_l.3
+nlist.3 nlist.3
+opendev.3 opendev.3
+openpty.3 openpty.3 forkpty.3 login_tty.3
+pause.3 pause.3
+popen.3 popen.3 pclose.3
+posix_memalign.3 posix_memalign.3
+printf.3 printf.3 asprintf.3 dprintf.3 fprintf.3 snprintf.3 sprintf.3 vasprintf.3 vdprintf.3 vfprintf.3 vprintf.3 vsnprintf.3 vsprintf.3
+printf_l.3 printf_l.3 asprintf_l.3 fprintf_l.3 snprintf_l.3 sprintf_l.3 vasprintf_l.3 vfprintf_l.3 vprintf_l.3 vsnprintf_l.3 vsprintf_l.3
+pselect.3 pselect.3
+psignal.3 psignal.3 sys_siglist.3 sys_signame.3 strsignal.3 sys_siglist.3 sys_signame.3
+psort.3 psort.3 psort_b.3 psort_r.3
+pthread.3 pthread.3
+pthread_atfork.3 pthread_atfork.3
+pthread_attr.3 pthread_attr.3 pthread_attr_destroy.3 pthread_attr_getdetachstate.3 pthread_attr_getinheritsched.3 pthread_attr_getschedparam.3 pthread_attr_getschedpolicy.3 pthread_attr_getscope.3 pthread_attr_getstackaddr.3 pthread_attr_getstacksize.3 pthread_attr_init.3 pthread_attr_setdetachstate.3 pthread_attr_setinheritsched.3 pthread_attr_setschedparam.3 pthread_attr_setschedpolicy.3 pthread_attr_setscope.3 pthread_attr_setstackaddr.3 pthread_attr_setstacksize.3
+pthread_cancel.3 pthread_cancel.3
+pthread_cleanup_pop.3 pthread_cleanup_pop.3
+pthread_cleanup_push.3 pthread_cleanup_push.3
+pthread_cond_broadcast.3 pthread_cond_broadcast.3
+pthread_cond_destroy.3 pthread_cond_destroy.3
+pthread_cond_init.3 pthread_cond_init.3
+pthread_cond_signal.3 pthread_cond_signal.3
+pthread_cond_timedwait.3 pthread_cond_timedwait.3
+pthread_cond_wait.3 pthread_cond_wait.3
+pthread_condattr.3 pthread_condattr.3 pthread_condattr_destroy.3 pthread_condattr_init.3
+pthread_create.3 pthread_create.3
+pthread_detach.3 pthread_detach.3
+pthread_equal.3 pthread_equal.3
+pthread_exit.3 pthread_exit.3
+pthread_getschedparam.3 pthread_getschedparam.3 pthread_setschedparam.3
+pthread_getspecific.3 pthread_getspecific.3
+pthread_join.3 pthread_join.3
+pthread_key_create.3 pthread_key_create.3
+pthread_key_delete.3 pthread_key_delete.3
+pthread_mutex_destroy.3 pthread_mutex_destroy.3
+pthread_mutex_init.3 pthread_mutex_init.3
+pthread_mutex_lock.3 pthread_mutex_lock.3
+pthread_mutex_trylock.3 pthread_mutex_trylock.3
+pthread_mutex_unlock.3 pthread_mutex_unlock.3
+pthread_mutexattr.3 pthread_mutexattr.3 pthread_mutexattr_destroy.3 pthread_mutexattr_getprioceiling.3 pthread_mutexattr_getprotocol.3 pthread_mutexattr_gettype.3 pthread_mutexattr_init.3 pthread_mutexattr_setprioceiling.3 pthread_mutexattr_setprotocol.3 pthread_mutexattr_settype.3
+pthread_once.3 pthread_once.3
+pthread_rwlock_destroy.3 pthread_rwlock_destroy.3
+pthread_rwlock_init.3 pthread_rwlock_init.3
+pthread_rwlock_rdlock.3 pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
+pthread_rwlock_unlock.3 pthread_rwlock_unlock.3
+pthread_rwlock_wrlock.3 pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
+pthread_rwlockattr_destroy.3 pthread_rwlockattr_destroy.3
+pthread_rwlockattr_getpshared.3 pthread_rwlockattr_getpshared.3
+pthread_rwlockattr_init.3 pthread_rwlockattr_init.3
+pthread_rwlockattr_setpshared.3 pthread_rwlockattr_setpshared.3
+pthread_self.3 pthread_self.3
+pthread_setcancelstate.3 pthread_setcancelstate.3 pthread_setcanceltype.3 pthread_testcancel.3
+pthread_setspecific.3 pthread_setspecific.3
+putc.3 putc.3 fputc.3 putc_unlocked.3 putchar.3 putchar_unlocked.3 putw.3
+putwc.3 putwc.3 fputwc.3 putwchar.3
+putwc_l.3 putwc_l.3 fputwc_l.3 putwchar_l.3
+pwcache.3 pwcache.3 group_from_gid.3 user_from_uid.3
+qsort.3 qsort.3 heapsort.3 mergesort.3 qsort_r.3 heapsort_b.3 mergesort_b.3 qsort_b.3
+querylocale.3 querylocale.3
+radixsort.3 radixsort.3 sradixsort.3
+raise.3 raise.3
+rand.3 rand.3 rand_r.3 srand.3 sranddev.3
+rand48.3 rand48.3 _rand48.3 drand48.3 erand48.3 jrand48.3 lcong48.3 lrand48.3 mrand48.3 nrand48.3 seed48.3 srand48.3
+random.3 random.3 initstate.3 setstate.3 srandom.3 srandomdev.3
+rcmdsh.3 rcmdsh.3
+readpassphrase.3 readpassphrase.3
+realpath.3 realpath.3
+recno.3 recno.3
+regex.3 regex.3 regcomp.3 regexec.3 regerror.3 regfree.3 regncomp.3 regnexec.3 regwcomp.3 regwexec.3 regwncomp.3 regwnexec.3 regcomp_l.3 regncomp_l.3 regwcomp_l.3 regwncomp_l.3
+remove.3 remove.3
+rindex.3 rindex.3
+rune.3 rune.3 fgetrune.3 fputrune.3 fungetrune.3 setinvalidrune.3 setrunelocale.3 sgetrune.3 sputrune.3
+scandir.3 scandir.3 alphasort.3 scandir_b.3
+scanf.3 scanf.3 fscanf.3 sscanf.3 vfscanf.3 vscanf.3 vsscanf.3
+scanf_l.3 scanf_l.3 fscanf_l.3 sscanf_l.3 vfscanf_l.3 vscanf_l.3 vsscanf_l.3
+setbuf.3 setbuf.3 setbuffer.3 setlinebuf.3 setvbuf.3
+setjmp.3 setjmp.3 _longjmp.3 _setjmp.3 longjmp.3 longjmperr.3 longjmperror.3 siglongjmp.3 sigsetjmp.3
+setlocale.3 setlocale.3
+setmode.3 setmode.3 getmode.3
+setruid.3 setruid.3 setrgid.3
+siginterrupt.3 siginterrupt.3
+signal.3 signal.3
+signbit.3 signbit.3
+sigsetops.3 sigsetops.3 sigaddset.3 sigdelset.3 sigemptyset.3 sigfillset.3 sigismember.3
+sleep.3 sleep.3
+sockatmark.3 sockatmark.3
+sourcefilter.3 sourcefilter.3 getsourcefilter.3 getipv4sourcefilter.3 setsourcefilter.3 setipv4sourcefilter.3
+spinlock.3 spinlock.3 OSSpinLockLock.3 OSSpinLockTry.3 OSSpinLockUnlock.3
+statvfs.3 statvfs.3 fstatvfs.3
+stdarg.3 stdarg.3 va_arg.3 va_copy.3 va_end.3 va_start.3
+stdio.3 stdio.3
+strcasecmp.3 strcasecmp.3 strcasecmp_l.3 strncasecmp.3 strncasecmp_l.3
+strcat.3 strcat.3 strncat.3
+strchr.3 strchr.3 strrchr.3
+strcmp.3 strcmp.3 strncmp.3
+strcoll.3 strcoll.3 strcoll_l.3
+strcpy.3 strcpy.3 stpcpy.3 stpncpy.3 strncpy.3
+strcspn.3 strcspn.3
+strdup.3 strdup.3 strndup.3
+strerror.3 strerror.3 perror.3 strerror_r.3 sys_errlist.3 sys_nerr.3
+strfmon.3 strfmon.3 strfmon_l.3
+strftime.3 strftime.3 strftime_l.3
+string.3 string.3
+stringlist.3 stringlist.3 sl_add.3 sl_find.3 sl_free.3 sl_init.3
+strlcpy.3 strlcpy.3 strlcat.3
+strlen.3 strlen.3 strnlen.3
+strmode.3 strmode.3
+strpbrk.3 strpbrk.3
+strptime.3 strptime.3 strptime_l.3
+strsep.3 strsep.3
+strspn.3 strspn.3
+strstr.3 strstr.3 strcasestr.3 strcasestr_l.3 strnstr.3
+strtod.3 strtod.3 strtof.3 strtold.3
+strtod_l.3 strtod_l.3 strtof_l.3 strtold_l.3
+strtofflags.3 strtofflags.3 fflagstostr.3
+strtok.3 strtok.3 strtok_r.3
+strtol.3 strtol.3 strtoll.3 strtoq.3 strtoimax.3
+strtol_l.3 strtol_l.3 strtoimax_l.3 strtoll_l.3 strtoq_l.3 strtoul_l.3 strtoull_l.3 strtoumax_l.3 strtouq_l.3
+strtoul.3 strtoul.3 strtoull.3 strtoumax.3 strtouq.3
+strxfrm.3 strxfrm.3 strxfrm_l.3
+swab.3 swab.3
+sync_volume_np.3 sync_volume_np.3 fsync_volume_np.3
+sysconf.3 sysconf.3
+sysctl.3 sysctl.3 sysctlbyname.3 sysctlnametomib.3
+sysexits.3 sysexits.3
+syslog.3 syslog.3 closelog.3 openlog.3 setlogmask.3 vsyslog.3
+system.3 system.3
+tcgetpgrp.3 tcgetpgrp.3
+tcgetsid.3 tcgetsid.3
+tcsendbreak.3 tcsendbreak.3 tcdrain.3 tcflow.3 tcflush.3
+tcsetattr.3 tcsetattr.3 cfgetispeed.3 cfgetospeed.3 cfmakeraw.3 cfsetispeed.3 cfsetospeed.3 cfsetspeed.3 tcgetattr.3
+tcsetpgrp.3 tcsetpgrp.3
+time.3 time.3
+time2posix.3 time2posix.3 posix2time.3
+timegm.3 timegm.3 timelocal.3
+times.3 times.3
+timezone.3 timezone.3
+tmpnam.3 tmpnam.3 tempnam.3 tmpfile.3
+toascii.3 toascii.3
+tolower.3 tolower.3 tolower_l.3
+toupper.3 toupper.3 toupper_l.3
+towlower.3 towlower.3 towlower_l.3
+towupper.3 towupper.3 towupper_l.3
+tsearch.3 tsearch.3 tdelete.3 tfind.3 twalk.3
+ttyname.3 ttyname.3 isatty.3 ttyslot.3
+tzset.3 tzset.3 tzsetwall.3
+ualarm.3 ualarm.3
+ucontext.3 ucontext.3
+ulimit.3 ulimit.3
+uname.3 uname.3
+ungetc.3 ungetc.3
+ungetwc.3 ungetwc.3 ungetwc_l.3
+unvis.3 unvis.3 strunvis.3 strunvisx.3
+uselocale.3 uselocale.3
+usleep.3 usleep.3
+utime.3 utime.3
+vis.3 vis.3 strvis.3 strvisx.3
+wcrtomb.3 wcrtomb.3 wcrtomb_l.3
+wcscoll.3 wcscoll.3 wcscoll_l.3
+wcsftime.3 wcsftime.3 wcsftime_l.3
+wcsrtombs.3 wcsrtombs.3 wcsnrtombs.3 wcsrtombs_l.3 wcsnrtombs_l.3
+wcstod.3 wcstod.3 wcstof.3 wcstold.3
+wcstod_l.3 wcstod_l.3 wcstof_l.3 wcstold_l.3
+wcstok.3 wcstok.3
+wcstol.3 wcstol.3 wcstoimax.3 wcstoll.3 wcstoul.3 wcstoull.3 wcstoumax.3
+wcstol_l.3 wcstol_l.3 wcstoimax_l.3 wcstoll_l.3 wcstoul_l.3 wcstoull_l.3 wcstoumax_l.3
+wcstombs.3 wcstombs.3 wcstombs_l.3
+wcswidth.3 wcswidth.3 wcswidth_l.3
+wcsxfrm.3 wcsxfrm.3 wcsxfrm_l.3
+wctomb.3 wctomb.3 wctomb_l.3
+wctrans.3 wctrans.3 towctrans.3 towctrans_l.3 wctrans_l.3
+wctype.3 wctype.3 iswctype.3 iswctype_l.3 wctype_l.3
+wcwidth.3 wcwidth.3 wcwidth_l.3
+wmemchr.3 wmemchr.3 wmemcmp.3 wmemcpy.3 wmemmove.3 wmemset.3 wcpcpy.3 wcpncpy.3 wcsdup.3 wcscasecmp.3 wcscasecmp_l.3 wcscat.3 wcschr.3 wcscmp.3 wcscpy.3 wcscspn.3 wcslcat.3 wcslcpy.3 wcslen.3 wcsncasecmp.3 wcsncasecmp_l.3 wcsncat.3 wcsncmp.3 wcsncpy.3 wcsnlen.3 wcspbrk.3 wcsrchr.3 wcsspn.3 wcsstr.3
+wordexp.3 wordexp.3 wordfree.3
+wprintf.3 wprintf.3 fwprintf.3 swprintf.3 vwprintf.3 vfwprintf.3 vswprintf.3
+wprintf_l.3 wprintf_l.3 fwprintf_l.3 swprintf_l.3 vwprintf_l.3 vfwprintf_l.3 vswprintf_l.3
+wscanf.3 wscanf.3 fwscanf.3 swscanf.3 vfwscanf.3 vswscanf.3 vwscanf.3
+wscanf_l.3 wscanf_l.3 fwscanf_l.3 swscanf_l.3 vfwscanf_l.3 vswscanf_l.3 vwscanf_l.3
+xlocale.3 xlocale.3
+
+# man5
+big5.5 big5.5
+compat.5 compat.5
+euc.5 euc.5
+gb18030.5 gb18030.5
+gb2312.5 gb2312.5
+gbk.5 gbk.5
+mskanji.5 mskanji.5
+tzfile.5 tzfile.5
+utf2.5 utf2.5
+utf8.5 utf8.5
+utmp.5 utmp.5 lastlog.5 wtmp.5
+utmpx.5 utmpx.5
+
+# man7
+environ.7 environ.7
+re_format.7 re_format.7
diff --git a/man/stdarg.3 b/man/stdarg.3
deleted file mode 100644 (file)
index f83aeb7..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)stdarg.3    8.1 (Berkeley) 6/5/93
-.\" $FreeBSD: src/share/man/man3/stdarg.3,v 1.15 2005/01/21 08:36:36 ru Exp $
-.\"
-.Dd October 25, 2002
-.Dt STDARG 3
-.Os
-.Sh NAME
-.Nm stdarg
-.Nd variable argument lists
-.Sh SYNOPSIS
-.In stdarg.h
-.Ft void
-.Fn va_start "va_list ap" last
-.Ft type
-.Fn va_arg "va_list ap" type
-.Ft void
-.Fn va_copy "va_list dest" "va_list src"
-.Ft void
-.Fn va_end "va_list ap"
-.Sh DESCRIPTION
-A function may be called with a varying number of arguments of varying
-types.
-The include file
-.In stdarg.h
-declares a type
-.Pq Em va_list
-and defines three macros for stepping
-through a list of arguments whose number and types are not known to
-the called function.
-.Pp
-The called function must declare an object of type
-.Em va_list
-which is used by the macros
-.Fn va_start ,
-.Fn va_arg ,
-.Fn va_copy ,
-and
-.Fn va_end .
-.Pp
-The
-.Fn va_start
-macro must be called first, and it initializes
-.Fa ap ,
-which can be passed to
-.Fn va_arg
-for each argument to be processed.
-Calling
-.Fn va_end
-signals that there are no further arguments, and causes
-.Fa ap
-to be invalidated.
-Note that each call to
-.Fn va_start
-must be matched by a call to
-.Fn va_end ,
-from within the same function.
-.Pp
-The parameter
-.Fa last
-is the name of the last parameter before the variable argument list,
-i.e., the last parameter of which the calling function knows the type.
-.Pp
-Because the address of this parameter is used in the
-.Fn va_start
-macro, it should not be declared as a register variable, or as a
-function or an array type.
-.Pp
-The
-.Fn va_arg
-macro expands to an expression that has the type and value of the next
-argument in the call.
-The parameter
-.Fa ap
-is the
-.Em va_list Fa ap
-initialized by
-.Fn va_start .
-Each call to
-.Fn va_arg
-modifies
-.Fa ap
-so that the next call returns the next argument.
-The parameter
-.Fa type
-is a type name specified so that the type of a pointer to an
-object that has the specified type can be obtained simply by
-adding a *
-to
-.Fa type .
-.Pp
-If there is no next argument, or if
-.Fa type
-is not compatible with the type of the actual next argument
-(as promoted according to the default argument promotions),
-random errors will occur.
-.Pp
-The first use of the
-.Fn va_arg
-macro after that of the
-.Fn va_start
-macro returns the argument after
-.Fa last .
-Successive invocations return the values of the remaining
-arguments.
-.Pp
-The
-.Fn va_copy
-macro copies the state of the variable argument list, 
-.Fa src ,
-previously initialized by
-.Fn va_start ,
-to the variable argument list,
-.Fa dest ,
-which must not have been previously initialized by
-.Fn va_start ,
-without an intervening call to
-.Fn va_end .
-The state preserved in
-.Fa dest
-is equivalent to calling
-.Fn va_start
-and
-.Fn va_arg
-on
-.Fa dest
-in the same way as was used on
-.Fa src .
-The copied variable argument list can subsequently be passed to
-.Fn va_arg ,
-and must finally be passed to
-.Fn va_end
-when through with it.
-.Pp
-After a variable argument list is invalidated by
-.Fn va_end ,
-it can be reinitialized with
-.Fn va_start
-or made a copy of another variable argument list with
-.Fn va_copy .
-.Sh EXAMPLES
-The function
-.Em foo
-takes a string of format characters and prints out the argument
-associated with each format character based on the type.
-.Bd -literal -offset indent
-void foo(char *fmt, ...)
-{
-       va_list ap, ap2;
-       int d;
-       char c, *s;
-
-       va_start(ap, fmt);
-       va_copy(ap2, ap);
-       while (*fmt)
-               switch(*fmt++) {
-               case 's':                       /* string */
-                       s = va_arg(ap, char *);
-                       printf("string %s\en", s);
-                       break;
-               case 'd':                       /* int */
-                       d = va_arg(ap, int);
-                       printf("int %d\en", d);
-                       break;
-               case 'c':                       /* char */
-                       /* Note: char is promoted to int. */
-                       c = va_arg(ap, int);
-                       printf("char %c\en", c);
-                       break;
-               }
-       va_end(ap);
-       ...
-       /* use ap2 to iterate over the arguments again */
-       ...
-       va_end(ap2);
-}
-.Ed
-.Sh COMPATIBILITY
-These macros are
-.Em not
-compatible with the historic macros they replace.
-A backward compatible version can be found in the include
-file
-.In varargs.h .
-.Sh STANDARDS
-The
-.Fn va_start ,
-.Fn va_arg ,
-.Fn va_copy ,
-and
-.Fn va_end
-macros conform to
-.St -isoC-99 .
-.Sh BUGS
-Unlike the
-.Em varargs
-macros, the
-.Nm
-macros do not permit programmers to
-code a function with no fixed arguments.
-This problem generates work mainly when converting
-.Em varargs
-code to
-.Nm
-code,
-but it also creates difficulties for variadic functions that
-wish to pass all of their arguments on to a function
-that takes a
-.Em va_list
-argument, such as
-.Xr vfprintf 3 .
index 1211e5332e736d6419a7dfa69c6aedcb0d33d194..a679b745c862c44e4b887f040ee7822732289a37 100644 (file)
 .Dt INET 3
 .Os
 .Sh NAME
-.Nm inet_aton ,
 .Nm inet_addr ,
+.Nm inet_aton ,
+.Nm inet_lnaof ,
+.Nm inet_makeaddr ,
+.Nm inet_netof ,
 .Nm inet_network ,
 .Nm inet_ntoa ,
 .Nm inet_ntoa_r ,
 .Nm inet_ntop ,
-.Nm inet_pton ,
-.Nm inet_makeaddr ,
-.Nm inet_lnaof ,
-.Nm inet_netof
+.Nm inet_pton
 .Nd Internet address manipulation routines
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.In netinet/in.h
 .In arpa/inet.h
+.Ft in_addr_t
+.Fo inet_addr
+.Fa "const char *cp"
+.Fc
 .Ft int
-.Fn inet_aton "const char *cp" "struct in_addr *pin"
+.Fo inet_aton
+.Fa "const char *cp"
+.Fa "struct in_addr *pin"
+.Fc
+.Ft in_addr_t
+.Fo inet_lnaof
+.Fa "struct in_addr in"
+.Fc
+.Ft struct in_addr
+.Fo inet_makeaddr
+.Fa "in_addr_t net"
+.Fa "in_addr_t lna"
+.Fc
 .Ft in_addr_t
-.Fn inet_addr "const char *cp"
+.Fo inet_netof
+.Fa "struct in_addr in"
+.Fc
 .Ft in_addr_t
-.Fn inet_network "const char *cp"
+.Fo inet_network
+.Fa "const char *cp"
+.Fc
 .Ft char *
-.Fn inet_ntoa "struct in_addr in"
+.Fo inet_ntoa
+.Fa "struct in_addr in"
+.Fc
 .Ft char *
 .Fo inet_ntoa_r
 .Fa "struct in_addr in"
 .Fa "socklen_t size"
 .Fc
 .Ft int
-.Fn inet_pton "int af" "const char * restrict src" "void * restrict dst"
-.Ft struct in_addr
-.Fn inet_makeaddr "in_addr_t net" "in_addr_t lna"
-.Ft in_addr_t
-.Fn inet_lnaof "struct in_addr in"
-.Ft in_addr_t
-.Fn inet_netof "struct in_addr in"
+.Fo inet_pton
+.Fa "int af"
+.Fa "const char * restrict src"
+.Fa "void * restrict dst"
+.Fc
 .Sh DESCRIPTION
 The routines
 .Fn inet_aton ,
@@ -241,9 +258,6 @@ The
 .Fn inet_ntop
 call fails if:
 .Bl -tag -width Er
-.It Bq Er ENOSPC
-.Fa size
-was not large enough to store the presentation form of the address.
 .It Bq Er EAFNOSUPPORT
 .Fa *src
 was not an
@@ -251,7 +265,17 @@ was not an
 or
 .Dv AF_INET6
 family address.
+.It Bq Er ENOSPC
+.Fa size
+was not large enough to store the presentation form of the address.
 .El
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/socket.h>
+.Fd #include <netinet/in.h>
+.Fd #include <arpa/inet.h>
+.Pp
+These include files are necessary for all functions.
 .Sh SEE ALSO
 .Xr byteorder 3 ,
 .Xr getaddrinfo 3 ,
diff --git a/net/FreeBSD/inet.3.patch b/net/FreeBSD/inet.3.patch
deleted file mode 100644 (file)
index 8f84aa0..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
---- inet.3.bsdnew      2009-11-10 16:23:10.000000000 -0800
-+++ inet.3     2009-11-10 16:35:18.000000000 -0800
-@@ -32,32 +32,51 @@
- .Dt INET 3
- .Os
- .Sh NAME
--.Nm inet_aton ,
- .Nm inet_addr ,
-+.Nm inet_aton ,
-+.Nm inet_lnaof ,
-+.Nm inet_makeaddr ,
-+.Nm inet_netof ,
- .Nm inet_network ,
- .Nm inet_ntoa ,
- .Nm inet_ntoa_r ,
- .Nm inet_ntop ,
--.Nm inet_pton ,
--.Nm inet_makeaddr ,
--.Nm inet_lnaof ,
--.Nm inet_netof
-+.Nm inet_pton
- .Nd Internet address manipulation routines
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In sys/types.h
--.In sys/socket.h
--.In netinet/in.h
- .In arpa/inet.h
-+.Ft in_addr_t
-+.Fo inet_addr
-+.Fa "const char *cp"
-+.Fc
- .Ft int
--.Fn inet_aton "const char *cp" "struct in_addr *pin"
-+.Fo inet_aton
-+.Fa "const char *cp"
-+.Fa "struct in_addr *pin"
-+.Fc
-+.Ft in_addr_t
-+.Fo inet_lnaof
-+.Fa "struct in_addr in"
-+.Fc
-+.Ft struct in_addr
-+.Fo inet_makeaddr
-+.Fa "in_addr_t net"
-+.Fa "in_addr_t lna"
-+.Fc
- .Ft in_addr_t
--.Fn inet_addr "const char *cp"
-+.Fo inet_netof
-+.Fa "struct in_addr in"
-+.Fc
- .Ft in_addr_t
--.Fn inet_network "const char *cp"
-+.Fo inet_network
-+.Fa "const char *cp"
-+.Fc
- .Ft char *
--.Fn inet_ntoa "struct in_addr in"
-+.Fo inet_ntoa
-+.Fa "struct in_addr in"
-+.Fc
- .Ft char *
- .Fo inet_ntoa_r
- .Fa "struct in_addr in"
-@@ -72,13 +91,11 @@
- .Fa "socklen_t size"
- .Fc
- .Ft int
--.Fn inet_pton "int af" "const char * restrict src" "void * restrict dst"
--.Ft struct in_addr
--.Fn inet_makeaddr "in_addr_t net" "in_addr_t lna"
--.Ft in_addr_t
--.Fn inet_lnaof "struct in_addr in"
--.Ft in_addr_t
--.Fn inet_netof "struct in_addr in"
-+.Fo inet_pton
-+.Fa "int af"
-+.Fa "const char * restrict src"
-+.Fa "void * restrict dst"
-+.Fc
- .Sh DESCRIPTION
- The routines
- .Fn inet_aton ,
-@@ -241,9 +258,6 @@ The
- .Fn inet_ntop
- call fails if:
- .Bl -tag -width Er
--.It Bq Er ENOSPC
--.Fa size
--was not large enough to store the presentation form of the address.
- .It Bq Er EAFNOSUPPORT
- .Fa *src
- was not an
-@@ -251,7 +265,17 @@ was not an
- or
- .Dv AF_INET6
- family address.
-+.It Bq Er ENOSPC
-+.Fa size
-+was not large enough to store the presentation form of the address.
- .El
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/types.h>
-+.Fd #include <sys/socket.h>
-+.Fd #include <netinet/in.h>
-+.Fd #include <arpa/inet.h>
-+.Pp
-+These include files are necessary for all functions.
- .Sh SEE ALSO
- .Xr byteorder 3 ,
- .Xr getaddrinfo 3 ,
index a4daa3a156d19b1a7bb2bb7787482dfdf58f263b..e9654171b4c38efbdadaedd47de4dd5c9fb6d345 100644 (file)
 static const char sccsid[] = "@(#)inet_addr.c  8.1 (Berkeley) 6/17/93";
 static const char rcsid[] = "$Id: inet_addr.c,v 1.4.18.1 2005/04/27 05:00:52 sra Exp $";
 #endif /* LIBC_SCCS and not lint */
+
+/* the algorithms only can deal with ASCII, so we optimize for it */
+#define USE_ASCII
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/inet/inet_addr.c,v 1.4 2007/06/03 17:20:26 ume Exp $");
 
@@ -102,9 +106,11 @@ inet_addr(const char *cp) {
  * Returns 1 if the address is valid, 0 if not.
  * This replaces inet_addr, the return value from which
  * cannot distinguish between failure and a local broadcast address.
+ * strict == 1 disallows trailing characters.
  */
 int
-inet_aton(const char *cp, struct in_addr *addr) {
+_inet_aton_check(const char *cp, struct in_addr *addr, int strict)
+{
        u_long val;
        int base, n;
        char c;
@@ -164,8 +170,10 @@ inet_aton(const char *cp, struct in_addr *addr) {
        /*
         * Check for trailing characters.
         */
-       if (c != '\0' && (!isascii(c) || !isspace((unsigned char)c)))
-               return (0);
+       if (c != '\0') {
+               if (strict) return (0);
+               if (!isascii(c) || !isspace(c)) return (0);
+       }
        /*
         * Did we get a valid digit?
         */
@@ -203,6 +211,12 @@ inet_aton(const char *cp, struct in_addr *addr) {
        return (1);
 }
 
+int
+inet_aton(const char *cp, struct in_addr *addr)
+{
+       return _inet_aton_check(cp, addr, 0);
+}
+
 /*
  * Weak aliases for applications that use certain private entry points,
  * and fail to include <arpa/inet.h>.
diff --git a/net/FreeBSD/inet_addr.c.patch b/net/FreeBSD/inet_addr.c.patch
deleted file mode 100644 (file)
index 79d1c20..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- inet_addr.c.orig   2008-09-01 20:32:46.000000000 -0700
-+++ inet_addr.c        2008-09-01 20:45:46.000000000 -0700
-@@ -68,6 +68,10 @@
- static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
- static const char rcsid[] = "$Id: inet_addr.c,v 1.4.18.1 2005/04/27 05:00:52 sra Exp $";
- #endif /* LIBC_SCCS and not lint */
-+
-+/* the algorithms only can deal with ASCII, so we optimize for it */
-+#define USE_ASCII
-+
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/inet/inet_addr.c,v 1.4 2007/06/03 17:20:26 ume Exp $");
index 201100c31d04ae620e15e6bbd196f3383eddd40c..469ebad088707b0fb41f4274db3e472373f49acd 100644 (file)
@@ -42,9 +42,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.In netinet/in.h
 .In arpa/inet.h
 .Ft char *
 .Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
@@ -151,6 +148,13 @@ otherwise, the number is interpreted as decimal).
 .\" .Sh NETWORK NUMBERS (IP VERSION 6)
 .\" XXX - document this!
 .\"
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/socket.h>
+.Fd #include <netinet/in.h>
+.Fd #include <arpa/inet.h>
+.Pp
+These include files were necessary for all functions.
 .Sh SEE ALSO
 .Xr byteorder 3 ,
 .Xr inet 3 ,
diff --git a/net/FreeBSD/inet_net.3.patch b/net/FreeBSD/inet_net.3.patch
deleted file mode 100644 (file)
index 775bbc3..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- inet_net.3.orig    2008-09-01 23:06:53.000000000 -0700
-+++ inet_net.3 2008-09-01 23:14:39.000000000 -0700
-@@ -42,9 +42,6 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In sys/types.h
--.In sys/socket.h
--.In netinet/in.h
- .In arpa/inet.h
- .Ft char *
- .Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
-@@ -151,6 +148,13 @@
- .\" .Sh NETWORK NUMBERS (IP VERSION 6)
- .\" XXX - document this!
- .\"
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/types.h>
-+.Fd #include <sys/socket.h>
-+.Fd #include <netinet/in.h>
-+.Fd #include <arpa/inet.h>
-+.Pp
-+These include files were necessary for all functions.
- .Sh SEE ALSO
- .Xr byteorder 3 ,
- .Xr inet 3 ,
index 1169e1e65421056d88d7cfa2a077034bae04d832..4493011143e4aae298532976c7689cd67a3960ba 100644 (file)
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $";
 #endif
+
+/* the algorithms only can deal with ASCII, so we optimize for it */
+#define USE_ASCII
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/inet/inet_net_pton.c,v 1.4 2008/12/14 19:39:53 ume Exp $");
 
diff --git a/net/FreeBSD/inet_net_pton.c.patch b/net/FreeBSD/inet_net_pton.c.patch
deleted file mode 100644 (file)
index 3e4dfbb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- inet_net_pton.c.bsdnew     2009-11-10 16:23:10.000000000 -0800
-+++ inet_net_pton.c    2009-11-10 16:23:10.000000000 -0800
-@@ -18,6 +18,10 @@
- #if defined(LIBC_SCCS) && !defined(lint)
- static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $";
- #endif
-+
-+/* the algorithms only can deal with ASCII, so we optimize for it */
-+#define USE_ASCII
-+
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/inet/inet_net_pton.c,v 1.4 2008/12/14 19:39:53 ume Exp $");
index ec8b83548bc3fb7daa6394aab82bb5075f3284f8..081a1cf2c8d94439a3bccc503752cba6c6bfb76f 100644 (file)
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)inet_network.c       8.1 (Berkeley) 6/4/93";
+
+/* the algorithms only can deal with ASCII, so we optimize for it */
+#define USE_ASCII
+
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/inet/inet_network.c,v 1.5 2008/01/14 22:55:20 cperciva Exp $");
diff --git a/net/FreeBSD/inet_network.c.patch b/net/FreeBSD/inet_network.c.patch
deleted file mode 100644 (file)
index 26bac02..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- inet_network.c.orig        2008-09-01 20:56:15.000000000 -0700
-+++ inet_network.c     2008-09-01 20:57:20.000000000 -0700
-@@ -29,6 +29,10 @@
- #if defined(LIBC_SCCS) && !defined(lint)
- static const char sccsid[] = "@(#)inet_network.c      8.1 (Berkeley) 6/4/93";
-+
-+/* the algorithms only can deal with ASCII, so we optimize for it */
-+#define USE_ASCII
-+
- #endif /* LIBC_SCCS and not lint */
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/inet/inet_network.c,v 1.5 2008/01/14 22:55:20 cperciva Exp $");
index 0c189e507d37adad617aa64ad4cc77e509a71bc9..00ee7e126f56c0004312250acaf51099d67805bd 100644 (file)
@@ -59,6 +59,7 @@ inet_ntoa(struct in_addr in) {
        return (ret);
 }
 
+#if 0
 char *
 inet_ntoa_r(struct in_addr in, char *buf, socklen_t size)
 {
@@ -66,6 +67,7 @@ inet_ntoa_r(struct in_addr in, char *buf, socklen_t size)
        (void) inet_ntop(AF_INET, &in, buf, size);
        return (buf);
 }
+#endif
 
 /*
  * Weak aliases for applications that use certain private entry points,
diff --git a/net/FreeBSD/inet_ntoa.c.patch b/net/FreeBSD/inet_ntoa.c.patch
deleted file mode 100644 (file)
index 6fa50b4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- inet_ntoa.c.orig   2008-09-01 21:00:28.000000000 -0700
-+++ inet_ntoa.c        2008-09-01 21:00:53.000000000 -0700
-@@ -59,6 +59,7 @@ inet_ntoa(struct in_addr in) {
-       return (ret);
- }
-+#if 0
- char *
- inet_ntoa_r(struct in_addr in, char *buf, socklen_t size)
- {
-@@ -66,6 +67,7 @@ inet_ntoa_r(struct in_addr in, char *buf
-       (void) inet_ntop(AF_INET, &in, buf, size);
-       return (buf);
- }
-+#endif
- /*
-  * Weak aliases for applications that use certain private entry points,
index fd34e0ef17f9d862d66ed60f648befd8247d175c..5bf73e59c5e782d076be48fb90a5bab8e4b61c07 100644 (file)
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char rcsid[] = "$Id: nsap_addr.c,v 1.3.18.2 2005/07/28 07:38:08 marka Exp $";
+
+/* the algorithms only can deal with ASCII, so we optimize for it */
+#define USE_ASCII
+
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/inet/nsap_addr.c,v 1.3 2007/06/03 17:20:26 ume Exp $");
@@ -33,10 +37,12 @@ __FBSDID("$FreeBSD: src/lib/libc/inet/nsap_addr.c,v 1.3 2007/06/03 17:20:26 ume
 
 #include <ctype.h>
 #include <resolv.h>
-#include <resolv_mt.h>
+//#include <resolv_mt.h>
 
 #include "port_after.h"
 
+#include <stdlib.h>
+
 static char
 xtob(int c) {
        return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
@@ -82,9 +88,13 @@ char *
 inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
        int nib;
        int i;
-       char *tmpbuf = inet_nsap_ntoa_tmpbuf;
+       char *tmpbuf = NULL;
        char *start;
 
+       if (tmpbuf == NULL) {
+               tmpbuf = malloc(255*3);
+               if (tmpbuf == NULL) return NULL;
+       }
        if (ascii)
                start = ascii;
        else {
diff --git a/net/FreeBSD/nsap_addr.c.patch b/net/FreeBSD/nsap_addr.c.patch
deleted file mode 100644 (file)
index de8ca81..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
---- nsap_addr.c.orig   2008-09-01 21:04:36.000000000 -0700
-+++ nsap_addr.c        2008-09-01 21:11:10.000000000 -0700
-@@ -17,6 +17,10 @@
- #if defined(LIBC_SCCS) && !defined(lint)
- static const char rcsid[] = "$Id: nsap_addr.c,v 1.3.18.2 2005/07/28 07:38:08 marka Exp $";
-+
-+/* the algorithms only can deal with ASCII, so we optimize for it */
-+#define USE_ASCII
-+
- #endif /* LIBC_SCCS and not lint */
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/inet/nsap_addr.c,v 1.3 2007/06/03 17:20:26 ume Exp $");
-@@ -33,10 +37,12 @@ __FBSDID("$FreeBSD: src/lib/libc/inet/ns
- #include <ctype.h>
- #include <resolv.h>
--#include <resolv_mt.h>
-+//#include <resolv_mt.h>
- #include "port_after.h"
-+#include <stdlib.h>
-+
- static char
- xtob(int c) {
-       return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
-@@ -82,9 +88,13 @@ char *
- inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
-       int nib;
-       int i;
--      char *tmpbuf = inet_nsap_ntoa_tmpbuf;
-+      char *tmpbuf = NULL;
-       char *start;
-+      if (tmpbuf == NULL) {
-+              tmpbuf = malloc(255*3);
-+              if (tmpbuf == NULL) return NULL;
-+      }
-       if (ascii)
-               start = ascii;
-       else {
index 8e3945c28b1b6ee01f8692e1f669becce529c85c..a8c5fca9802f6d1ab752749c9fc1c252c9ed9370 100644 (file)
@@ -40,11 +40,21 @@ __FBSDID("$FreeBSD: src/lib/libc/net/recv.c,v 1.4 2007/01/09 00:28:02 imp Exp $"
 #include <stddef.h>
 #include "un-namespace.h"
 
+#ifdef VARIANT_CANCELABLE
+ssize_t __recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
+#else /* !VARIANT_CANCELABLE */
+ssize_t __recvfrom_nocancel(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
+#endif /* VARIANT_CANCELABLE */
+
 ssize_t
 recv(s, buf, len, flags)
        int s, flags;
        size_t len;
        void *buf;
 {
-       return (_recvfrom(s, buf, len, flags, NULL, 0));
+#ifdef VARIANT_CANCELABLE
+       return (__recvfrom(s, buf, len, flags, NULL, 0));
+#else /* !VARIANT_CANCELABLE */
+       return (__recvfrom_nocancel(s, buf, len, flags, NULL, 0));
+#endif /* VARIANT_CANCELABLE */
 }
diff --git a/net/FreeBSD/recv.c.patch b/net/FreeBSD/recv.c.patch
deleted file mode 100644 (file)
index 9a771dd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- recv.c.orig        2008-09-01 21:12:58.000000000 -0700
-+++ recv.c     2008-09-01 21:13:04.000000000 -0700
-@@ -40,11 +40,21 @@ __FBSDID("$FreeBSD: src/lib/libc/net/rec
- #include <stddef.h>
- #include "un-namespace.h"
-+#ifdef VARIANT_CANCELABLE
-+ssize_t __recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
-+#else /* !VARIANT_CANCELABLE */
-+ssize_t __recvfrom_nocancel(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
-+#endif /* VARIANT_CANCELABLE */
-+
- ssize_t
- recv(s, buf, len, flags)
-       int s, flags;
-       size_t len;
-       void *buf;
- {
--      return (_recvfrom(s, buf, len, flags, NULL, 0));
-+#ifdef VARIANT_CANCELABLE
-+      return (__recvfrom(s, buf, len, flags, NULL, 0));
-+#else /* !VARIANT_CANCELABLE */
-+      return (__recvfrom_nocancel(s, buf, len, flags, NULL, 0));
-+#endif /* VARIANT_CANCELABLE */
- }
index f6ed904a5a80c0042d8340c7f8029156f878df77..eeb3fa99bd7e7749b3b88435d447f9cdf6ec1d18 100644 (file)
@@ -40,11 +40,21 @@ __FBSDID("$FreeBSD: src/lib/libc/net/send.c,v 1.4 2007/01/09 00:28:02 imp Exp $"
 #include <stddef.h>
 #include "un-namespace.h"
 
+#ifdef VARIANT_CANCELABLE
+ssize_t __sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+#else /* !VARIANT_CANCELABLE */
+ssize_t __sendto_nocancel(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+#endif /* VARIANT_CANCELABLE */
+
 ssize_t
 send(s, msg, len, flags)
        int s, flags;
        size_t len;
        const void *msg;
 {
-       return (_sendto(s, msg, len, flags, NULL, 0));
+#ifdef VARIANT_CANCELABLE
+       return (__sendto(s, msg, len, flags, NULL, 0));
+#else /* !VARIANT_CANCELABLE */
+       return (__sendto_nocancel(s, msg, len, flags, NULL, 0));
+#endif /* VARIANT_CANCELABLE */
 }
diff --git a/net/FreeBSD/send.c.patch b/net/FreeBSD/send.c.patch
deleted file mode 100644 (file)
index cf534bf..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- send.c.orig        2008-09-01 21:13:33.000000000 -0700
-+++ send.c     2008-09-01 21:13:41.000000000 -0700
-@@ -40,11 +40,21 @@ __FBSDID("$FreeBSD: src/lib/libc/net/sen
- #include <stddef.h>
- #include "un-namespace.h"
-+#ifdef VARIANT_CANCELABLE
-+ssize_t __sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
-+#else /* !VARIANT_CANCELABLE */
-+ssize_t __sendto_nocancel(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
-+#endif /* VARIANT_CANCELABLE */
-+
- ssize_t
- send(s, msg, len, flags)
-       int s, flags;
-       size_t len;
-       const void *msg;
- {
--      return (_sendto(s, msg, len, flags, NULL, 0));
-+#ifdef VARIANT_CANCELABLE
-+      return (__sendto(s, msg, len, flags, NULL, 0));
-+#else /* !VARIANT_CANCELABLE */
-+      return (__sendto_nocancel(s, msg, len, flags, NULL, 0));
-+#endif /* VARIANT_CANCELABLE */
- }
index 0bb87456794947e4aa393333e6d30e483ea1384d..0c091894526ddf0ed7501b67ebfcb8f907068fff 100644 (file)
@@ -83,7 +83,7 @@ Upon successful completion, the
 .Fn sockatmark
 function returns the value 1 if the read pointer is pointing at
 the OOB mark, 0 if it is not.
-Otherwise the value \-1 is returned
+Otherwise, the value \-1 is returned
 and the global variable
 .Va errno
 is set to
diff --git a/net/FreeBSD/sockatmark.3.patch b/net/FreeBSD/sockatmark.3.patch
deleted file mode 100644 (file)
index 30d36cf..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- _SB/Libc/net/FreeBSD/sockatmark.3  2005-12-16 00:23:58.000000000 -0800
-+++ _SB/Libc/net/FreeBSD/sockatmark.3.edit     2006-06-28 16:55:51.000000000 -0700
-@@ -83,7 +83,7 @@
- .Fn sockatmark
- function returns the value 1 if the read pointer is pointing at
- the OOB mark, 0 if it is not.
--Otherwise the value \-1 is returned
-+Otherwise, the value \-1 is returned
- and the global variable
- .Va errno
- is set to
index 1739db5cd1c2556a45d17abd7cbdcf67bb83f0c7..081dfa30d1550b90fe94f16ac801f9d43ea425e6 100644 (file)
@@ -219,9 +219,7 @@ operation.
 .El
 .Sh SEE ALSO
 .Xr ip 4 ,
-.Xr ip6 4 ,
-.Xr multicast 4, 
-.Xr ifmcstat 8
+.Xr ip6 4
 .Rs
 .%A D. Thaler
 .%A B. Fenner
diff --git a/net/FreeBSD/sourcefilter.3.patch b/net/FreeBSD/sourcefilter.3.patch
deleted file mode 100644 (file)
index 9afa891..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- sourcefilter.3.orig        2010-05-19 12:42:53.000000000 -0700
-+++ sourcefilter.3     2010-05-19 12:43:19.000000000 -0700
-@@ -219,9 +219,7 @@ operation.
- .El
- .Sh SEE ALSO
- .Xr ip 4 ,
--.Xr ip6 4 ,
--.Xr multicast 4, 
--.Xr ifmcstat 8
-+.Xr ip6 4
- .Rs
- .%A D. Thaler
- .%A B. Fenner
index c3d07c6d995e9d67499537870aa2c7a26645dc58..a5a3cca16b4edda8e65823c17454f8013cee707b 100644 (file)
@@ -27,6 +27,9 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/net/sourcefilter.c,v 1.5 2009/04/29 09:58:31 bms Exp $");
 
+/* 8120237: enable INET6 */
+#define __APPLE_USE_RFC_3542
+
 #include "namespace.h"
 
 #include <sys/types.h>
@@ -56,6 +59,10 @@ __FBSDID("$FreeBSD: src/lib/libc/net/sourcefilter.c,v 1.5 2009/04/29 09:58:31 bm
 #ifndef INET
 #define INET
 #endif
+/* 8120237: enable INET6 */
+#ifndef INET6
+#define INET6
+#endif
 
 union sockunion {
        struct sockaddr_storage ss;
diff --git a/net/FreeBSD/sourcefilter.c.patch b/net/FreeBSD/sourcefilter.c.patch
deleted file mode 100644 (file)
index 0eeba36..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
---- sourcefilter.c.orig        2010-06-29 16:12:54.000000000 -0700
-+++ sourcefilter.c     2010-06-29 17:55:54.000000000 -0700
-@@ -27,6 +27,9 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/net/sourcefilter.c,v 1.5 2009/04/29 09:58:31 bms Exp $");
-+/* 8120237: enable INET6 */
-+#define __APPLE_USE_RFC_3542
-+
- #include "namespace.h"
- #include <sys/types.h>
-@@ -56,6 +59,10 @@ __FBSDID("$FreeBSD: src/lib/libc/net/sou
- #ifndef INET
- #define INET
- #endif
-+/* 8120237: enable INET6 */
-+#ifndef INET6
-+#define INET6
-+#endif
- union sockunion {
-       struct sockaddr_storage ss;
diff --git a/net/Makefile.inc b/net/Makefile.inc
deleted file mode 100644 (file)
index 021f62c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#      from @(#)Makefile.inc   8.2 (Berkeley) 9/5/93
-# $FreeBSD: src/lib/libc/net/Makefile.inc,v 1.43 2001/10/23 06:22:14 imp Exp $
-
-# machine-dependent net sources
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/net/Makefile.inc"
-
-# machine-independent net sources
-.PATH: ${.CURDIR}/${MACHINE_ARCH}/net ${.CURDIR}/net
-CWD := ${.CURDIR}/net
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= addr2ascii.c ascii2addr.c inet_addr.c inet_lnaof.c \
-       inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c \
-       inet_netof.c inet_network.c inet_ntoa.c linkaddr.c nsap_addr.c \
-       recv.c send.c sockatmark.c sourcefilter.c
-.include "Makefile.fbsd_end"
-
-LEGACYSRCS+= recv.c send.c
-CANCELABLESRCS+= recv.c send.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-recv-fbsd.c += -DLIBC_ALIAS_RECV
-CFLAGS-send-fbsd.c += -DLIBC_ALIAS_SEND
-
-.if ${LIB} == "c"
-MAN3+= byteorder.3 ethers.3 rcmdsh.3
-.include "Makefile.fbsd_begin"
-FBSDMAN3= addr2ascii.3 inet.3 inet_net.3 linkaddr.3 sockatmark.3 sourcefilter.3
-.include "Makefile.fbsd_end"
-
-MLINKS+= addr2ascii.3 ascii2addr.3
-
-MLINKS+= byteorder.3 htonl.3           \
-         byteorder.3 htons.3           \
-         byteorder.3 ntohl.3           \
-         byteorder.3 ntohs.3
-
-MLINKS+= ethers.3 ether_aton.3         \
-         ethers.3 ether_hostton.3      \
-         ethers.3 ether_line.3         \
-         ethers.3 ether_ntoa.3         \
-         ethers.3 ether_ntohost.3
-
-MLINKS+= inet.3 addr.3                 \
-         inet.3 inet_addr.3            \
-         inet.3 inet_aton.3            \
-         inet.3 inet_lnaof.3           \
-         inet.3 inet_makeaddr.3                \
-         inet.3 inet_netof.3           \
-         inet.3 inet_network.3         \
-         inet.3 inet_ntoa.3            \
-         inet.3 inet_ntop.3            \
-         inet.3 inet_pton.3            \
-         inet.3 network.3              \
-         inet.3 ntoa.3
-
-MLINKS+= inet_net.3 inet_net_ntop.3    \
-         inet_net.3 inet_net_pton.3
-
-MLINKS+= linkaddr.3 link_addr.3                \
-         linkaddr.3 link_ntoa.3
-
-MLINKS+= sourcefilter.3 getsourcefilter.3      \
-         sourcefilter.3 getipv4sourcefilter.3  \
-         sourcefilter.3 setsourcefilter.3      \
-         sourcefilter.3 setipv4sourcefilter.3
-
-.endif
diff --git a/net/addr2ascii-fbsd.c b/net/addr2ascii-fbsd.c
deleted file mode 120000 (symlink)
index 346d48e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./addr2ascii.c
\ No newline at end of file
diff --git a/net/addr2ascii.3 b/net/addr2ascii.3
deleted file mode 120000 (symlink)
index 1a9716a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./addr2ascii.3
\ No newline at end of file
diff --git a/net/ascii2addr-fbsd.c b/net/ascii2addr-fbsd.c
deleted file mode 120000 (symlink)
index bbe3e8a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ascii2addr.c
\ No newline at end of file
diff --git a/net/inet.3 b/net/inet.3
deleted file mode 100644 (file)
index a679b74..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-.\" Copyright (c) 1983, 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     From: @(#)inet.3       8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/net/inet.3,v 1.36 2007/06/14 07:13:28 delphij Exp $
-.\"
-.Dd June 14, 2007
-.Dt INET 3
-.Os
-.Sh NAME
-.Nm inet_addr ,
-.Nm inet_aton ,
-.Nm inet_lnaof ,
-.Nm inet_makeaddr ,
-.Nm inet_netof ,
-.Nm inet_network ,
-.Nm inet_ntoa ,
-.Nm inet_ntoa_r ,
-.Nm inet_ntop ,
-.Nm inet_pton
-.Nd Internet address manipulation routines
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In arpa/inet.h
-.Ft in_addr_t
-.Fo inet_addr
-.Fa "const char *cp"
-.Fc
-.Ft int
-.Fo inet_aton
-.Fa "const char *cp"
-.Fa "struct in_addr *pin"
-.Fc
-.Ft in_addr_t
-.Fo inet_lnaof
-.Fa "struct in_addr in"
-.Fc
-.Ft struct in_addr
-.Fo inet_makeaddr
-.Fa "in_addr_t net"
-.Fa "in_addr_t lna"
-.Fc
-.Ft in_addr_t
-.Fo inet_netof
-.Fa "struct in_addr in"
-.Fc
-.Ft in_addr_t
-.Fo inet_network
-.Fa "const char *cp"
-.Fc
-.Ft char *
-.Fo inet_ntoa
-.Fa "struct in_addr in"
-.Fc
-.Ft char *
-.Fo inet_ntoa_r
-.Fa "struct in_addr in"
-.Fa "char *buf"
-.Fa "socklen_t size"
-.Fc
-.Ft const char *
-.Fo inet_ntop
-.Fa "int af"
-.Fa "const void * restrict src"
-.Fa "char * restrict dst"
-.Fa "socklen_t size"
-.Fc
-.Ft int
-.Fo inet_pton
-.Fa "int af"
-.Fa "const char * restrict src"
-.Fa "void * restrict dst"
-.Fc
-.Sh DESCRIPTION
-The routines
-.Fn inet_aton ,
-.Fn inet_addr
-and
-.Fn inet_network
-interpret character strings representing
-numbers expressed in the Internet standard
-.Ql .\&
-notation.
-.Pp
-The
-.Fn inet_pton
-function converts a presentation format address (that is, printable form
-as held in a character string) to network format (usually a
-.Ft struct in_addr
-or some other internal binary representation, in network byte order).
-It returns 1 if the address was valid for the specified address family, or
-0 if the address was not parseable in the specified address family, or -1
-if some system error occurred (in which case
-.Va errno
-will have been set).
-This function is presently valid for
-.Dv AF_INET
-and
-.Dv AF_INET6 .
-.Pp
-The
-.Fn inet_aton
-routine interprets the specified character string as an Internet address,
-placing the address into the structure provided.
-It returns 1 if the string was successfully interpreted,
-or 0 if the string is invalid.
-The
-.Fn inet_addr
-and
-.Fn inet_network
-functions return numbers suitable for use
-as Internet addresses and Internet network
-numbers, respectively.
-.Pp
-The function
-.Fn inet_ntop
-converts an address
-.Fa *src
-from network format
-(usually a
-.Ft struct in_addr
-or some other binary form, in network byte order) to presentation format
-(suitable for external display purposes).
-The
-.Fa size
-argument specifies the size, in bytes, of the buffer
-.Fa *dst .
-.Dv INET_ADDRSTRLEN
-and
-.Dv INET6_ADDRSTRLEN
-define the maximum size required to convert an address of the respective
-type.
-It returns NULL if a system error occurs (in which case,
-.Va errno
-will have been set), or it returns a pointer to the destination string.
-This function is presently valid for
-.Dv AF_INET
-and
-.Dv AF_INET6 .
-.Pp
-The routine
-.Fn inet_ntoa
-takes an Internet address and returns an
-.Tn ASCII
-string representing the address in
-.Ql .\&
-notation.
-The routine
-.Fn inet_ntoa_r
-is the reentrant version of
-.Fn inet_ntoa .
-The routine
-.Fn inet_makeaddr
-takes an Internet network number and a local
-network address and constructs an Internet address
-from it.
-The routines
-.Fn inet_netof
-and
-.Fn inet_lnaof
-break apart Internet host addresses, returning
-the network number and local network address part,
-respectively.
-.Pp
-All Internet addresses are returned in network
-order (bytes ordered from left to right).
-All network numbers and local address parts are
-returned as machine byte order integer values.
-.Sh INTERNET ADDRESSES
-Values specified using the
-.Ql .\&
-notation take one
-of the following forms:
-.Bd -literal -offset indent
-a.b.c.d
-a.b.c
-a.b
-a
-.Ed
-.Pp
-When four parts are specified, each is interpreted
-as a byte of data and assigned, from left to right,
-to the four bytes of an Internet address.
-Note
-that when an Internet address is viewed as a 32-bit
-integer quantity on the
-.Tn VAX
-the bytes referred to
-above appear as
-.Dq Li d.c.b.a .
-That is,
-.Tn VAX
-bytes are
-ordered from right to left.
-.Pp
-When a three part address is specified, the last
-part is interpreted as a 16-bit quantity and placed
-in the right-most two bytes of the network address.
-This makes the three part address format convenient
-for specifying Class B network addresses as
-.Dq Li 128.net.host .
-.Pp
-When a two part address is supplied, the last part
-is interpreted as a 24-bit quantity and placed in
-the right most three bytes of the network address.
-This makes the two part address format convenient
-for specifying Class A network addresses as
-.Dq Li net.host .
-.Pp
-When only one part is given, the value is stored
-directly in the network address without any byte
-rearrangement.
-.Pp
-All numbers supplied as
-.Dq parts
-in a
-.Ql .\&
-notation
-may be decimal, octal, or hexadecimal, as specified
-in the C language (i.e., a leading 0x or 0X implies
-hexadecimal; otherwise, a leading 0 implies octal;
-otherwise, the number is interpreted as decimal).
-.Sh DIAGNOSTICS
-The constant
-.Dv INADDR_NONE
-is returned by
-.Fn inet_addr
-and
-.Fn inet_network
-for malformed requests.
-.Sh ERRORS
-The
-.Fn inet_ntop
-call fails if:
-.Bl -tag -width Er
-.It Bq Er EAFNOSUPPORT
-.Fa *src
-was not an
-.Dv AF_INET
-or
-.Dv AF_INET6
-family address.
-.It Bq Er ENOSPC
-.Fa size
-was not large enough to store the presentation form of the address.
-.El
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/socket.h>
-.Fd #include <netinet/in.h>
-.Fd #include <arpa/inet.h>
-.Pp
-These include files are necessary for all functions.
-.Sh SEE ALSO
-.Xr byteorder 3 ,
-.Xr getaddrinfo 3 ,
-.Xr gethostbyname 3 ,
-.Xr getnameinfo 3 ,
-.Xr getnetent 3 ,
-.Xr inet_net 3 ,
-.Xr hosts 5 ,
-.Xr networks 5
-.Rs
-.%R RFC
-.%N 2373
-.%D July 1998
-.%T "IP Version 6 Addressing Architecture"
-.Re
-.Sh STANDARDS
-The
-.Fn inet_ntop
-and
-.Fn inet_pton
-functions conform to
-.St -xns5.2 .
-Note that
-.Fn inet_pton
-does not accept 1-, 2-, or 3-part dotted addresses; all four parts
-must be specified and are interpreted only as decimal values.
-This is a narrower input set than that accepted by
-.Fn inet_aton .
-.Sh HISTORY
-These
-functions appeared in
-.Bx 4.2 .
-.Sh BUGS
-The value
-.Dv INADDR_NONE
-(0xffffffff) is a valid broadcast address, but
-.Fn inet_addr
-cannot return that value without indicating failure.
-The newer
-.Fn inet_aton
-function does not share this problem.
-The problem of host byte ordering versus network byte ordering is
-confusing.
-The string returned by
-.Fn inet_ntoa
-resides in a static memory area.
-.Pp
-The
-.Fn inet_addr
-function should return a
-.Fa struct in_addr .
diff --git a/net/inet_addr-fbsd.c b/net/inet_addr-fbsd.c
deleted file mode 100644 (file)
index 6ad6f96..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 1983, 1990, 1993
- *    The Regents of the University of California.  All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- * 
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_addr.c  8.1 (Berkeley) 6/17/93";
-static const char rcsid[] = "$Id: inet_addr.c,v 1.4.18.1 2005/04/27 05:00:52 sra Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-/* the algorithms only can deal with ASCII, so we optimize for it */
-#define USE_ASCII
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/inet/inet_addr.c,v 1.4 2007/06/03 17:20:26 ume Exp $");
-
-#include "port_before.h"
-
-#include <sys/types.h>
-#include <sys/param.h>
-
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <ctype.h>
-
-#include "port_after.h"
-
-/*%
- * Ascii internet address interpretation routine.
- * The value returned is in network order.
- */
-in_addr_t              /* XXX should be struct in_addr :( */
-inet_addr(const char *cp) {
-       struct in_addr val;
-
-       if (inet_aton(cp, &val))
-               return (val.s_addr);
-       return (INADDR_NONE);
-}
-
-/*%
- * Check whether "cp" is a valid ascii representation
- * of an Internet address and convert to a binary address.
- * Returns 1 if the address is valid, 0 if not.
- * This replaces inet_addr, the return value from which
- * cannot distinguish between failure and a local broadcast address.
- */
-int
-inet_aton(const char *cp, struct in_addr *addr) {
-       u_long val;
-       int base, n;
-       char c;
-       u_int8_t parts[4];
-       u_int8_t *pp = parts;
-       int digit;
-
-       c = *cp;
-       for (;;) {
-               /*
-                * Collect number up to ``.''.
-                * Values are specified as for C:
-                * 0x=hex, 0=octal, isdigit=decimal.
-                */
-               if (!isdigit((unsigned char)c))
-                       return (0);
-               val = 0; base = 10; digit = 0;
-               if (c == '0') {
-                       c = *++cp;
-                       if (c == 'x' || c == 'X')
-                               base = 16, c = *++cp;
-                       else {
-                               base = 8;
-                               digit = 1 ;
-                       }
-               }
-               for (;;) {
-                       if (isascii(c) && isdigit((unsigned char)c)) {
-                               if (base == 8 && (c == '8' || c == '9'))
-                                       return (0);
-                               val = (val * base) + (c - '0');
-                               c = *++cp;
-                               digit = 1;
-                       } else if (base == 16 && isascii(c) && 
-                                  isxdigit((unsigned char)c)) {
-                               val = (val << 4) |
-                                       (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
-                               c = *++cp;
-                               digit = 1;
-                       } else
-                               break;
-               }
-               if (c == '.') {
-                       /*
-                        * Internet format:
-                        *      a.b.c.d
-                        *      a.b.c   (with c treated as 16 bits)
-                        *      a.b     (with b treated as 24 bits)
-                        */
-                       if (pp >= parts + 3 || val > 0xffU)
-                               return (0);
-                       *pp++ = val;
-                       c = *++cp;
-               } else
-                       break;
-       }
-       /*
-        * Check for trailing characters.
-        */
-       if (c != '\0' && (!isascii(c) || !isspace((unsigned char)c)))
-               return (0);
-       /*
-        * Did we get a valid digit?
-        */
-       if (!digit)
-               return (0);
-       /*
-        * Concoct the address according to
-        * the number of parts specified.
-        */
-       n = pp - parts + 1;
-       switch (n) {
-       case 1:                         /*%< a -- 32 bits */
-               break;
-
-       case 2:                         /*%< a.b -- 8.24 bits */
-               if (val > 0xffffffU)
-                       return (0);
-               val |= parts[0] << 24;
-               break;
-
-       case 3:                         /*%< a.b.c -- 8.8.16 bits */
-               if (val > 0xffffU)
-                       return (0);
-               val |= (parts[0] << 24) | (parts[1] << 16);
-               break;
-
-       case 4:                         /*%< a.b.c.d -- 8.8.8.8 bits */
-               if (val > 0xffU)
-                       return (0);
-               val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-               break;
-       }
-       if (addr != NULL)
-               addr->s_addr = htonl(val);
-       return (1);
-}
-
-/*
- * Weak aliases for applications that use certain private entry points,
- * and fail to include <arpa/inet.h>.
- */
-#undef inet_addr
-__weak_reference(__inet_addr, inet_addr);
-#undef inet_aton
-__weak_reference(__inet_aton, inet_aton);
-
-/*! \file */
diff --git a/net/inet_lnaof-fbsd.c b/net/inet_lnaof-fbsd.c
deleted file mode 120000 (symlink)
index 63a9274..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./inet_lnaof.c
\ No newline at end of file
diff --git a/net/inet_makeaddr-fbsd.c b/net/inet_makeaddr-fbsd.c
deleted file mode 120000 (symlink)
index d695f22..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./inet_makeaddr.c
\ No newline at end of file
diff --git a/net/inet_net.3 b/net/inet_net.3
deleted file mode 100644 (file)
index 469ebad..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-.\"    $NetBSD: inet_net.3,v 1.4 1999/03/22 19:44:52 garbled Exp $
-.\"
-.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Luke Mewburn.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of The NetBSD Foundation nor the names of its
-.\"    contributors may be used to endorse or promote products derived
-.\"    from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/net/inet_net.3,v 1.4 2007/01/09 00:28:02 imp Exp $
-.\"
-.Dd February 26, 2006
-.Dt INET_NET 3
-.Os
-.Sh NAME
-.Nm inet_net_ntop ,
-.Nm inet_net_pton
-.Nd Internet network number manipulation routines
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In arpa/inet.h
-.Ft char *
-.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
-.Ft int
-.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size"
-.Sh DESCRIPTION
-The
-.Fn inet_net_ntop
-function converts an Internet network number from network format (usually a
-.Vt "struct in_addr"
-or some other binary form, in network byte order) to CIDR presentation format
-(suitable for external display purposes).
-The
-.Fa bits
-argument
-is the number of bits in
-.Fa src
-that are the network number.
-It returns
-.Dv NULL
-if a system error occurs (in which case,
-.Va errno
-will have been set), or it returns a pointer to the destination string.
-.Pp
-The
-.Fn inet_net_pton
-function converts a presentation format Internet network number (that is,
-printable form as held in a character string) to network format (usually a
-.Vt "struct in_addr"
-or some other internal binary representation, in network byte order).
-It returns the number of bits (either computed based on the class, or
-specified with /CIDR), or \-1 if a failure occurred
-(in which case
-.Va errno
-will have been set.
-It will be set to
-.Er ENOENT
-if the Internet network number was not valid).
-.Pp
-The currently supported values for
-.Fa af
-are
-.Dv AF_INET
-and
-.Dv AF_INET6 .
-The
-.Fa size
-argument
-is the size of the result buffer
-.Fa dst .
-.Pp
-.Sh NETWORK NUMBERS (IP VERSION 4)
-Internet network numbers may be specified in one of the following forms:
-.Bd -literal -offset indent
-a.b.c.d/bits
-a.b.c.d
-a.b.c
-a.b
-a
-.Ed
-.Pp
-When four parts are specified, each is interpreted
-as a byte of data and assigned, from left to right,
-to the four bytes of an Internet network number.
-Note
-that when an Internet network number is viewed as a 32-bit
-integer quantity on a system that uses little-endian
-byte order (such as the
-.Tn Intel 386 , 486 ,
-and
-.Tn Pentium
-processors) the bytes referred to above appear as
-.Dq Li d.c.b.a .
-That is, little-endian bytes are ordered from right to left.
-.Pp
-When a three part number is specified, the last
-part is interpreted as a 16-bit quantity and placed
-in the rightmost two bytes of the Internet network number.
-This makes the three part number format convenient
-for specifying Class B network numbers as
-.Dq Li 128.net.host .
-.Pp
-When a two part number is supplied, the last part
-is interpreted as a 24-bit quantity and placed in
-the rightmost three bytes of the Internet network number.
-This makes the two part number format convenient
-for specifying Class A network numbers as
-.Dq Li net.host .
-.Pp
-When only one part is given, the value is stored
-directly in the Internet network number without any byte
-rearrangement.
-.Pp
-All numbers supplied as
-.Dq parts
-in a
-.Ql \&.
-notation
-may be decimal, octal, or hexadecimal, as specified
-in the C language (i.e., a leading 0x or 0X implies
-hexadecimal; otherwise, a leading 0 implies octal;
-otherwise, the number is interpreted as decimal).
-.\"
-.\" .Sh NETWORK NUMBERS (IP VERSION 6)
-.\" XXX - document this!
-.\"
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/socket.h>
-.Fd #include <netinet/in.h>
-.Fd #include <arpa/inet.h>
-.Pp
-These include files were necessary for all functions.
-.Sh SEE ALSO
-.Xr byteorder 3 ,
-.Xr inet 3 ,
-.Xr networks 5
-.Sh HISTORY
-The
-.Fn inet_net_ntop
-and
-.Fn inet_net_pton
-functions appeared in BIND 4.9.4.
diff --git a/net/inet_net_ntop-fbsd.c b/net/inet_net_ntop-fbsd.c
deleted file mode 120000 (symlink)
index 2d504f3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./inet_net_ntop.c
\ No newline at end of file
diff --git a/net/inet_net_pton-fbsd.c b/net/inet_net_pton-fbsd.c
deleted file mode 100644 (file)
index 4493011..0000000
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1996,1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $";
-#endif
-
-/* the algorithms only can deal with ASCII, so we optimize for it */
-#define USE_ASCII
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/inet/inet_net_pton.c,v 1.4 2008/12/14 19:39:53 ume Exp $");
-
-#include "port_before.h"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <arpa/inet.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "port_after.h"
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-/*%
- * static int
- * inet_net_pton_ipv4(src, dst, size)
- *     convert IPv4 network number from presentation to network format.
- *     accepts hex octets, hex strings, decimal octets, and /CIDR.
- *     "size" is in bytes and describes "dst".
- * return:
- *     number of bits, either imputed classfully or specified with /CIDR,
- *     or -1 if some failure occurred (check errno).  ENOENT means it was
- *     not an IPv4 network specification.
- * note:
- *     network byte order assumed.  this means 192.5.5.240/28 has
- *     0b11110000 in its fourth octet.
- * author:
- *     Paul Vixie (ISC), June 1996
- */
-static int
-inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
-       static const char xdigits[] = "0123456789abcdef";
-       static const char digits[] = "0123456789";
-       int n, ch, tmp = 0, dirty, bits;
-       const u_char *odst = dst;
-
-       ch = *src++;
-       if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
-           && isascii((unsigned char)(src[1]))
-           && isxdigit((unsigned char)(src[1]))) {
-               /* Hexadecimal: Eat nybble string. */
-               if (size <= 0U)
-                       goto emsgsize;
-               dirty = 0;
-               src++;  /*%< skip x or X. */
-               while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
-                       if (isupper(ch))
-                               ch = tolower(ch);
-                       n = strchr(xdigits, ch) - xdigits;
-                       assert(n >= 0 && n <= 15);
-                       if (dirty == 0)
-                               tmp = n;
-                       else
-                               tmp = (tmp << 4) | n;
-                       if (++dirty == 2) {
-                               if (size-- <= 0U)
-                                       goto emsgsize;
-                               *dst++ = (u_char) tmp;
-                               dirty = 0;
-                       }
-               }
-               if (dirty) {  /*%< Odd trailing nybble? */
-                       if (size-- <= 0U)
-                               goto emsgsize;
-                       *dst++ = (u_char) (tmp << 4);
-               }
-       } else if (isascii(ch) && isdigit(ch)) {
-               /* Decimal: eat dotted digit string. */
-               for (;;) {
-                       tmp = 0;
-                       do {
-                               n = strchr(digits, ch) - digits;
-                               assert(n >= 0 && n <= 9);
-                               tmp *= 10;
-                               tmp += n;
-                               if (tmp > 255)
-                                       goto enoent;
-                       } while ((ch = *src++) != '\0' &&
-                                isascii(ch) && isdigit(ch));
-                       if (size-- <= 0U)
-                               goto emsgsize;
-                       *dst++ = (u_char) tmp;
-                       if (ch == '\0' || ch == '/')
-                               break;
-                       if (ch != '.')
-                               goto enoent;
-                       ch = *src++;
-                       if (!isascii(ch) || !isdigit(ch))
-                               goto enoent;
-               }
-       } else
-               goto enoent;
-
-       bits = -1;
-       if (ch == '/' && isascii((unsigned char)(src[0])) &&
-           isdigit((unsigned char)(src[0])) && dst > odst) {
-               /* CIDR width specifier.  Nothing can follow it. */
-               ch = *src++;    /*%< Skip over the /. */
-               bits = 0;
-               do {
-                       n = strchr(digits, ch) - digits;
-                       assert(n >= 0 && n <= 9);
-                       bits *= 10;
-                       bits += n;
-                       if (bits > 32)
-                               goto enoent;
-               } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
-               if (ch != '\0')
-                       goto enoent;
-       }
-
-       /* Firey death and destruction unless we prefetched EOS. */
-       if (ch != '\0')
-               goto enoent;
-
-       /* If nothing was written to the destination, we found no address. */
-       if (dst == odst)
-               goto enoent;
-       /* If no CIDR spec was given, infer width from net class. */
-       if (bits == -1) {
-               if (*odst >= 240)       /*%< Class E */
-                       bits = 32;
-               else if (*odst >= 224)  /*%< Class D */
-                       bits = 8;
-               else if (*odst >= 192)  /*%< Class C */
-                       bits = 24;
-               else if (*odst >= 128)  /*%< Class B */
-                       bits = 16;
-               else                    /*%< Class A */
-                       bits = 8;
-               /* If imputed mask is narrower than specified octets, widen. */
-               if (bits < ((dst - odst) * 8))
-                       bits = (dst - odst) * 8;
-               /*
-                * If there are no additional bits specified for a class D
-                * address adjust bits to 4.
-                */
-               if (bits == 8 && *odst == 224)
-                       bits = 4;
-       }
-       /* Extend network to cover the actual mask. */
-       while (bits > ((dst - odst) * 8)) {
-               if (size-- <= 0U)
-                       goto emsgsize;
-               *dst++ = '\0';
-       }
-       return (bits);
-
- enoent:
-       errno = ENOENT;
-       return (-1);
-
- emsgsize:
-       errno = EMSGSIZE;
-       return (-1);
-}
-
-static int
-getbits(const char *src, int *bitsp) {
-       static const char digits[] = "0123456789";
-       int n;
-       int val;
-       char ch;
-
-       val = 0;
-       n = 0;
-       while ((ch = *src++) != '\0') {
-               const char *pch;
-
-               pch = strchr(digits, ch);
-               if (pch != NULL) {
-                       if (n++ != 0 && val == 0)       /*%< no leading zeros */
-                               return (0);
-                       val *= 10;
-                       val += (pch - digits);
-                       if (val > 128)                  /*%< range */
-                               return (0);
-                       continue;
-               }
-               return (0);
-       }
-       if (n == 0)
-               return (0);
-       *bitsp = val;
-       return (1);
-}
-
-static int
-getv4(const char *src, u_char *dst, int *bitsp) {
-       static const char digits[] = "0123456789";
-       u_char *odst = dst;
-       int n;
-       u_int val;
-       char ch;
-
-       val = 0;
-       n = 0;
-       while ((ch = *src++) != '\0') {
-               const char *pch;
-
-               pch = strchr(digits, ch);
-               if (pch != NULL) {
-                       if (n++ != 0 && val == 0)       /*%< no leading zeros */
-                               return (0);
-                       val *= 10;
-                       val += (pch - digits);
-                       if (val > 255)                  /*%< range */
-                               return (0);
-                       continue;
-               }
-               if (ch == '.' || ch == '/') {
-                       if (dst - odst > 3)             /*%< too many octets? */
-                               return (0);
-                       *dst++ = val;
-                       if (ch == '/')
-                               return (getbits(src, bitsp));
-                       val = 0;
-                       n = 0;
-                       continue;
-               }
-               return (0);
-       }
-       if (n == 0)
-               return (0);
-       if (dst - odst > 3)             /*%< too many octets? */
-               return (0);
-       *dst++ = val;
-       return (1);
-}
-
-static int
-inet_net_pton_ipv6(const char *src, u_char *dst, size_t size) {
-       static const char xdigits_l[] = "0123456789abcdef",
-                         xdigits_u[] = "0123456789ABCDEF";
-       u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
-       const char *xdigits, *curtok;
-       int ch, saw_xdigit;
-       u_int val;
-       int digits;
-       int bits;
-       size_t bytes;
-       int words;
-       int ipv4;
-
-       memset((tp = tmp), '\0', NS_IN6ADDRSZ);
-       endp = tp + NS_IN6ADDRSZ;
-       colonp = NULL;
-       /* Leading :: requires some special handling. */
-       if (*src == ':')
-               if (*++src != ':')
-                       goto enoent;
-       curtok = src;
-       saw_xdigit = 0;
-       val = 0;
-       digits = 0;
-       bits = -1;
-       ipv4 = 0;
-       while ((ch = *src++) != '\0') {
-               const char *pch;
-
-               if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
-                       pch = strchr((xdigits = xdigits_u), ch);
-               if (pch != NULL) {
-                       val <<= 4;
-                       val |= (pch - xdigits);
-                       if (++digits > 4)
-                               goto enoent;
-                       saw_xdigit = 1;
-                       continue;
-               }
-               if (ch == ':') {
-                       curtok = src;
-                       if (!saw_xdigit) {
-                               if (colonp)
-                                       goto enoent;
-                               colonp = tp;
-                               continue;
-                       } else if (*src == '\0')
-                               goto enoent;
-                       if (tp + NS_INT16SZ > endp)
-                               return (0);
-                       *tp++ = (u_char) (val >> 8) & 0xff;
-                       *tp++ = (u_char) val & 0xff;
-                       saw_xdigit = 0;
-                       digits = 0;
-                       val = 0;
-                       continue;
-               }
-               if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
-                    getv4(curtok, tp, &bits) > 0) {
-                       tp += NS_INADDRSZ;
-                       saw_xdigit = 0;
-                       ipv4 = 1;
-                       break;  /*%< '\\0' was seen by inet_pton4(). */
-               }
-               if (ch == '/' && getbits(src, &bits) > 0)
-                       break;
-               goto enoent;
-       }
-       if (saw_xdigit) {
-               if (tp + NS_INT16SZ > endp)
-                       goto enoent;
-               *tp++ = (u_char) (val >> 8) & 0xff;
-               *tp++ = (u_char) val & 0xff;
-       }
-       if (bits == -1)
-               bits = 128;
-
-       words = (bits + 15) / 16;
-       if (words < 2)
-               words = 2;
-       if (ipv4)
-               words = 8;
-       endp =  tmp + 2 * words;
-
-       if (colonp != NULL) {
-               /*
-                * Since some memmove()'s erroneously fail to handle
-                * overlapping regions, we'll do the shift by hand.
-                */
-               const int n = tp - colonp;
-               int i;
-
-               if (tp == endp)
-                       goto enoent;
-               for (i = 1; i <= n; i++) {
-                       endp[- i] = colonp[n - i];
-                       colonp[n - i] = 0;
-               }
-               tp = endp;
-       }
-       if (tp != endp)
-               goto enoent;
-
-       bytes = (bits + 7) / 8;
-       if (bytes > size)
-               goto emsgsize;
-       memcpy(dst, tmp, bytes);
-       return (bits);
-
- enoent:
-       errno = ENOENT;
-       return (-1);
-
- emsgsize:
-       errno = EMSGSIZE;
-       return (-1);
-}
-
-/*%
- * int
- * inet_net_pton(af, src, dst, size)
- *     convert network number from presentation to network format.
- *     accepts hex octets, hex strings, decimal octets, and /CIDR.
- *     "size" is in bytes and describes "dst".
- * return:
- *     number of bits, either imputed classfully or specified with /CIDR,
- *     or -1 if some failure occurred (check errno).  ENOENT means it was
- *     not a valid network specification.
- * author:
- *     Paul Vixie (ISC), June 1996
- */
-int
-inet_net_pton(int af, const char *src, void *dst, size_t size) {
-       switch (af) {
-       case AF_INET:
-               return (inet_net_pton_ipv4(src, dst, size));
-       case AF_INET6:
-               return (inet_net_pton_ipv6(src, dst, size));
-       default:
-               errno = EAFNOSUPPORT;
-               return (-1);
-       }
-}
-
-/*
- * Weak aliases for applications that use certain private entry points,
- * and fail to include <arpa/inet.h>.
- */
-#undef inet_net_pton
-__weak_reference(__inet_net_pton, inet_net_pton);
-
-/*! \file */
diff --git a/net/inet_neta-fbsd.c b/net/inet_neta-fbsd.c
deleted file mode 120000 (symlink)
index e6bea35..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./inet_neta.c
\ No newline at end of file
diff --git a/net/inet_netof-fbsd.c b/net/inet_netof-fbsd.c
deleted file mode 120000 (symlink)
index c926efc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./inet_netof.c
\ No newline at end of file
diff --git a/net/inet_network-fbsd.c b/net/inet_network-fbsd.c
deleted file mode 100644 (file)
index 081a1cf..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_network.c       8.1 (Berkeley) 6/4/93";
-
-/* the algorithms only can deal with ASCII, so we optimize for it */
-#define USE_ASCII
-
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/inet/inet_network.c,v 1.5 2008/01/14 22:55:20 cperciva Exp $");
-
-#include "port_before.h"
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <ctype.h>
-
-#include "port_after.h"
-
-/*%
- * Internet network address interpretation routine.
- * The library routines call this routine to interpret
- * network numbers.
- */
-in_addr_t
-inet_network(cp)
-       const char *cp;
-{
-       in_addr_t val, base, n;
-       char c;
-       in_addr_t parts[4], *pp = parts;
-       int i, digit;
-
-again:
-       val = 0; base = 10; digit = 0;
-       if (*cp == '0')
-               digit = 1, base = 8, cp++;
-       if (*cp == 'x' || *cp == 'X')
-               base = 16, cp++;
-       while ((c = *cp) != 0) {
-               if (isdigit((unsigned char)c)) {
-                       if (base == 8U && (c == '8' || c == '9'))
-                               return (INADDR_NONE);
-                       val = (val * base) + (c - '0');
-                       cp++;
-                       digit = 1;
-                       continue;
-               }
-               if (base == 16U && isxdigit((unsigned char)c)) {
-                       val = (val << 4) +
-                             (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
-                       cp++;
-                       digit = 1;
-                       continue;
-               }
-               break;
-       }
-       if (!digit)
-               return (INADDR_NONE);
-       if (pp >= parts + 4 || val > 0xffU)
-               return (INADDR_NONE);
-       if (*cp == '.') {
-               *pp++ = val, cp++;
-               goto again;
-       }
-       if (*cp && !isspace(*cp&0xff))
-               return (INADDR_NONE);
-       *pp++ = val;
-       n = pp - parts;
-       if (n > 4U)
-               return (INADDR_NONE);
-       for (val = 0, i = 0; i < n; i++) {
-               val <<= 8;
-               val |= parts[i] & 0xff;
-       }
-       return (val);
-}
-
-/*
- * Weak aliases for applications that use certain private entry points,
- * and fail to include <arpa/inet.h>.
- */
-#undef inet_network
-__weak_reference(__inet_network, inet_network);
-
-/*! \file */
diff --git a/net/inet_ntoa-fbsd.c b/net/inet_ntoa-fbsd.c
deleted file mode 100644 (file)
index 00ee7e1..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_ntoa.c  8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: inet_ntoa.c,v 1.1.352.1 2005/04/27 05:00:54 sra Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/inet/inet_ntoa.c,v 1.6 2007/06/14 07:13:28 delphij Exp $");
-
-#include "port_before.h"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#include "port_after.h"
-
-/*%
- * Convert network-format internet address
- * to base 256 d.d.d.d representation.
- */
-/*const*/ char *
-inet_ntoa(struct in_addr in) {
-       static char ret[18];
-
-       strcpy(ret, "[inet_ntoa error]");
-       (void) inet_ntop(AF_INET, &in, ret, sizeof ret);
-       return (ret);
-}
-
-#if 0
-char *
-inet_ntoa_r(struct in_addr in, char *buf, socklen_t size)
-{
-
-       (void) inet_ntop(AF_INET, &in, buf, size);
-       return (buf);
-}
-#endif
-
-/*
- * Weak aliases for applications that use certain private entry points,
- * and fail to include <arpa/inet.h>.
- */
-#undef inet_ntoa
-__weak_reference(__inet_ntoa, inet_ntoa);
-__weak_reference(__inet_ntoa_r, inet_ntoa_r);
-
-/*! \file */
diff --git a/net/linkaddr-fbsd.c b/net/linkaddr-fbsd.c
deleted file mode 120000 (symlink)
index 47b6dd0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./linkaddr.c
\ No newline at end of file
diff --git a/net/linkaddr.3 b/net/linkaddr.3
deleted file mode 120000 (symlink)
index f4e564f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./linkaddr.3
\ No newline at end of file
diff --git a/net/nsap_addr-fbsd.c b/net/nsap_addr-fbsd.c
deleted file mode 100644 (file)
index 5bf73e5..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1996-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: nsap_addr.c,v 1.3.18.2 2005/07/28 07:38:08 marka Exp $";
-
-/* the algorithms only can deal with ASCII, so we optimize for it */
-#define USE_ASCII
-
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/inet/nsap_addr.c,v 1.3 2007/06/03 17:20:26 ume Exp $");
-
-#include "port_before.h"
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <ctype.h>
-#include <resolv.h>
-//#include <resolv_mt.h>
-
-#include "port_after.h"
-
-#include <stdlib.h>
-
-static char
-xtob(int c) {
-       return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
-}
-
-u_int
-inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
-       u_char c, nib;
-       u_int len = 0;
-
-       if (ascii[0] != '0' || (ascii[1] != 'x' && ascii[1] != 'X'))
-               return (0);
-       ascii += 2;
-
-       while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
-               if (c == '.' || c == '+' || c == '/')
-                       continue;
-               if (!isascii(c))
-                       return (0);
-               if (islower(c))
-                       c = toupper(c);
-               if (isxdigit(c)) {
-                       nib = xtob(c);
-                       c = *ascii++;
-                       if (c != '\0') {
-                               c = toupper(c);
-                               if (isxdigit(c)) {
-                                       *binary++ = (nib << 4) | xtob(c);
-                                       len++;
-                               } else
-                                       return (0);
-                       }
-                       else
-                               return (0);
-               }
-               else
-                       return (0);
-       }
-       return (len);
-}
-
-char *
-inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
-       int nib;
-       int i;
-       char *tmpbuf = NULL;
-       char *start;
-
-       if (tmpbuf == NULL) {
-               tmpbuf = malloc(255*3);
-               if (tmpbuf == NULL) return NULL;
-       }
-       if (ascii)
-               start = ascii;
-       else {
-               ascii = tmpbuf;
-               start = tmpbuf;
-       }
-
-       *ascii++ = '0';
-       *ascii++ = 'x';
-
-       if (binlen > 255)
-               binlen = 255;
-
-       for (i = 0; i < binlen; i++) {
-               nib = *binary >> 4;
-               *ascii++ = nib + (nib < 10 ? '0' : '7');
-               nib = *binary++ & 0x0f;
-               *ascii++ = nib + (nib < 10 ? '0' : '7');
-               if (((i % 2) == 0 && (i + 1) < binlen))
-                       *ascii++ = '.';
-       }
-       *ascii = '\0';
-       return (start);
-}
-
-/*
- * Weak aliases for applications that use certain private entry points,
- * and fail to include <arpa/inet.h>.
- */
-#undef inet_nsap_addr
-__weak_reference(__inet_nsap_addr, inet_nsap_addr);
-#undef inet_nsap_ntoa
-__weak_reference(__inet_nsap_ntoa, inet_nsap_ntoa);
-
-/*! \file */
diff --git a/net/recv-fbsd.c b/net/recv-fbsd.c
deleted file mode 100644 (file)
index a8c5fca..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)recv.c     8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/recv.c,v 1.4 2007/01/09 00:28:02 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <stddef.h>
-#include "un-namespace.h"
-
-#ifdef VARIANT_CANCELABLE
-ssize_t __recvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
-#else /* !VARIANT_CANCELABLE */
-ssize_t __recvfrom_nocancel(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);
-#endif /* VARIANT_CANCELABLE */
-
-ssize_t
-recv(s, buf, len, flags)
-       int s, flags;
-       size_t len;
-       void *buf;
-{
-#ifdef VARIANT_CANCELABLE
-       return (__recvfrom(s, buf, len, flags, NULL, 0));
-#else /* !VARIANT_CANCELABLE */
-       return (__recvfrom_nocancel(s, buf, len, flags, NULL, 0));
-#endif /* VARIANT_CANCELABLE */
-}
diff --git a/net/send-fbsd.c b/net/send-fbsd.c
deleted file mode 100644 (file)
index eeb3fa9..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)send.c     8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/send.c,v 1.4 2007/01/09 00:28:02 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <stddef.h>
-#include "un-namespace.h"
-
-#ifdef VARIANT_CANCELABLE
-ssize_t __sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
-#else /* !VARIANT_CANCELABLE */
-ssize_t __sendto_nocancel(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
-#endif /* VARIANT_CANCELABLE */
-
-ssize_t
-send(s, msg, len, flags)
-       int s, flags;
-       size_t len;
-       const void *msg;
-{
-#ifdef VARIANT_CANCELABLE
-       return (__sendto(s, msg, len, flags, NULL, 0));
-#else /* !VARIANT_CANCELABLE */
-       return (__sendto_nocancel(s, msg, len, flags, NULL, 0));
-#endif /* VARIANT_CANCELABLE */
-}
diff --git a/net/sockatmark-fbsd.c b/net/sockatmark-fbsd.c
deleted file mode 120000 (symlink)
index bcccd5c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./sockatmark.c
\ No newline at end of file
diff --git a/net/sockatmark.3 b/net/sockatmark.3
deleted file mode 100644 (file)
index 0c09189..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-.\" Copyright (c) 2002 William C. Fenner.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/net/sockatmark.3,v 1.4 2002/12/19 09:40:22 ru Exp $
-.\"
-.Dd October 13, 2002
-.Dt SOCKATMARK 3
-.Os
-.Sh NAME
-.Nm sockatmark
-.Nd determine whether the read pointer is at the OOB mark
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft int
-.Fn sockatmark "int s"
-.Sh DESCRIPTION
-To find out if the read pointer is currently pointing at
-the mark in the data stream, the
-.Fn sockatmark
-function is provided.
-If
-.Fn sockatmark
-returns 1, the next read will return data
-after the mark.
-Otherwise (assuming out of band data has arrived),
-the next read will provide data sent by the client prior
-to transmission of the out of band signal.
-The routine used
-in the remote login process to flush output on receipt of an
-interrupt or quit signal is shown below.
-It reads the normal data up to the mark (to discard it),
-then reads the out-of-band byte.
-.Bd -literal -offset indent
-#include <sys/socket.h>
-\&...
-oob()
-{
-       int out = FWRITE, mark;
-       char waste[BUFSIZ];
-
-       /* flush local terminal output */
-       ioctl(1, TIOCFLUSH, (char *)&out);
-       for (;;) {
-               if ((mark = sockatmark(rem)) < 0) {
-                       perror("sockatmark");
-                       break;
-               }
-               if (mark)
-                       break;
-               (void) read(rem, waste, sizeof (waste));
-       }
-       if (recv(rem, &mark, 1, MSG_OOB) < 0) {
-               perror("recv");
-               ...
-       }
-       ...
-}
-.Ed
-.Sh RETURN VALUES
-Upon successful completion, the
-.Fn sockatmark
-function returns the value 1 if the read pointer is pointing at
-the OOB mark, 0 if it is not.
-Otherwise, the value \-1 is returned
-and the global variable
-.Va errno
-is set to
-indicate the error.
-.Sh ERRORS
-The
-.Fn sockatmark
-call fails if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa s
-argument
-is not a valid descriptor.
-.It Bq Er ENOTTY
-The
-.Fa s
-argument
-is a descriptor for a file, not a socket.
-.El
-.Sh SEE ALSO
-.Xr recv 2 ,
-.Xr send 2
-.Sh HISTORY
-The
-.Fn sockatmark
-function was introduced by
-.St -p1003.1-2001 ,
-to standardize the historical
-.Dv SIOCATMARK
-.Xr ioctl 2 .
-The
-.Er ENOTTY
-error instead of the usual
-.Er ENOTSOCK
-is to match the historical behavior of
-.Dv SIOCATMARK .
diff --git a/net/sourcefilter-fbsd.c b/net/sourcefilter-fbsd.c
deleted file mode 100644 (file)
index a5a3cca..0000000
+++ /dev/null
@@ -1,409 +0,0 @@
-/*-
- * Copyright (c) 2007-2009 Bruce Simpson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/sourcefilter.c,v 1.5 2009/04/29 09:58:31 bms Exp $");
-
-/* 8120237: enable INET6 */
-#define __APPLE_USE_RFC_3542
-
-#include "namespace.h"
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-
-#include <net/if_dl.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_var.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <ifaddrs.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "un-namespace.h"
-
-/*
- * Advanced (Full-state) multicast group membership APIs [RFC3678]
- * Currently this module assumes IPv4 support (INET) in the base system.
- */
-#ifndef INET
-#define INET
-#endif
-/* 8120237: enable INET6 */
-#ifndef INET6
-#define INET6
-#endif
-
-union sockunion {
-       struct sockaddr_storage ss;
-       struct sockaddr         sa;
-       struct sockaddr_dl      sdl;
-#ifdef INET
-       struct sockaddr_in      sin;
-#endif
-#ifdef INET6
-       struct sockaddr_in6     sin6;
-#endif
-};
-typedef union sockunion sockunion_t;
-
-#ifndef MIN
-#define        MIN(a, b)       ((a) < (b) ? (a) : (b))
-#endif
-
-/*
- * Internal: Map an IPv4 unicast address to an interface index.
- * This is quite inefficient so it is recommended applications use
- * the newer, more portable, protocol independent API.
- */
-static uint32_t
-__inaddr_to_index(in_addr_t ifaddr)
-{
-       struct ifaddrs  *ifa;
-       struct ifaddrs  *ifaddrs;
-       char            *ifname;
-       int              ifindex;
-       sockunion_t     *psu;
-
-       if (getifaddrs(&ifaddrs) < 0)
-               return (0);
-
-       ifindex = 0;
-       ifname = NULL;
-
-       /*
-        * Pass #1: Find the ifaddr entry corresponding to the
-        * supplied IPv4 address. We should really use the ifindex
-        * consistently for matches, however it is not available to
-        * us on this pass.
-        */
-       for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-               psu = (sockunion_t *)ifa->ifa_addr;
-               if (psu && psu->ss.ss_family == AF_INET &&
-                   psu->sin.sin_addr.s_addr == ifaddr) {
-                       ifname = ifa->ifa_name;
-                       break;
-               }
-       }
-       if (ifname == NULL)
-               goto out;
-
-       /*
-        * Pass #2: Find the index of the interface matching the name
-        * we obtained from looking up the IPv4 ifaddr in pass #1.
-        * There must be a better way of doing this.
-        */
-       for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
-               psu = (sockunion_t *)ifa->ifa_addr;
-               if (psu && psu->ss.ss_family == AF_LINK &&
-                   strcmp(ifa->ifa_name, ifname) == 0) {
-                       ifindex = psu->sdl.sdl_index;
-                       break;
-               }
-       }
-       assert(ifindex != 0);
-
-out:
-       freeifaddrs(ifaddrs);
-       return (ifindex);
-}
-
-/*
- * Set IPv4 source filter list in use on socket.
- *
- * Stubbed to setsourcefilter(). Performs conversion of structures which
- * may be inefficient; applications are encouraged to use the
- * protocol-independent API.
- */
-int
-setipv4sourcefilter(int s, struct in_addr interface, struct in_addr group,
-    uint32_t fmode, uint32_t numsrc, struct in_addr *slist)
-{
-#ifdef INET
-       sockunion_t      tmpgroup;
-       struct in_addr  *pina;
-       sockunion_t     *psu, *tmpslist;
-       int              err;
-       size_t           i;
-       uint32_t         ifindex;
-
-       assert(s != -1);
-
-       tmpslist = NULL;
-
-       if (!IN_MULTICAST(ntohl(group.s_addr)) ||
-           (fmode != MCAST_INCLUDE && fmode != MCAST_EXCLUDE)) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       ifindex = __inaddr_to_index(interface.s_addr);
-       if (ifindex == 0) {
-               errno = EADDRNOTAVAIL;
-               return (-1);
-       }
-
-       memset(&tmpgroup, 0, sizeof(sockunion_t));
-       tmpgroup.sin.sin_family = AF_INET;
-       tmpgroup.sin.sin_len = sizeof(struct sockaddr_in);
-       tmpgroup.sin.sin_addr = group;
-
-       if (numsrc != 0 || slist != NULL) {
-               tmpslist = calloc(numsrc, sizeof(sockunion_t));
-               if (tmpslist == NULL) {
-                       errno = ENOMEM;
-                       return (-1);
-               }
-
-               pina = slist;
-               psu = tmpslist;
-               for (i = 0; i < numsrc; i++, pina++, psu++) {
-                       psu->sin.sin_family = AF_INET;
-                       psu->sin.sin_len = sizeof(struct sockaddr_in);
-                       psu->sin.sin_addr = *pina;
-               }
-       }
-
-       err = setsourcefilter(s, ifindex, (struct sockaddr *)&tmpgroup,
-           sizeof(struct sockaddr_in), fmode, numsrc,
-           (struct sockaddr_storage *)tmpslist);
-
-       if (tmpslist != NULL)
-               free(tmpslist);
-
-       return (err);
-#else /* !INET */
-       return (EAFNOSUPPORT);
-#endif /* INET */
-}
-
-/*
- * Get IPv4 source filter list in use on socket.
- *
- * Stubbed to getsourcefilter(). Performs conversion of structures which
- * may be inefficient; applications are encouraged to use the
- * protocol-independent API.
- * An slist of NULL may be used for guessing the required buffer size.
- */
-int
-getipv4sourcefilter(int s, struct in_addr interface, struct in_addr group,
-    uint32_t *fmode, uint32_t *numsrc, struct in_addr *slist)
-{
-       sockunion_t     *psu, *tmpslist;
-       sockunion_t      tmpgroup;
-       struct in_addr  *pina;
-       int              err;
-       size_t           i;
-       uint32_t         ifindex, onumsrc;
-
-       assert(s != -1);
-       assert(fmode != NULL);
-       assert(numsrc != NULL);
-
-       onumsrc = *numsrc;
-       *numsrc = 0;
-       tmpslist = NULL;
-
-       if (!IN_MULTICAST(ntohl(group.s_addr)) ||
-           (onumsrc != 0 && slist == NULL)) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       ifindex = __inaddr_to_index(interface.s_addr);
-       if (ifindex == 0) {
-               errno = EADDRNOTAVAIL;
-               return (-1);
-       }
-
-       memset(&tmpgroup, 0, sizeof(sockunion_t));
-       tmpgroup.sin.sin_family = AF_INET;
-       tmpgroup.sin.sin_len = sizeof(struct sockaddr_in);
-       tmpgroup.sin.sin_addr = group;
-
-       if (onumsrc != 0 || slist != NULL) {
-               tmpslist = calloc(onumsrc, sizeof(sockunion_t));
-               if (tmpslist == NULL) {
-                       errno = ENOMEM;
-                       return (-1);
-               }
-       }
-
-       err = getsourcefilter(s, ifindex, (struct sockaddr *)&tmpgroup,
-           sizeof(struct sockaddr_in), fmode, numsrc,
-           (struct sockaddr_storage *)tmpslist);
-
-       if (tmpslist != NULL && *numsrc != 0) {
-               pina = slist;
-               psu = tmpslist;
-               for (i = 0; i < MIN(onumsrc, *numsrc); i++, psu++) {
-                       if (psu->ss.ss_family != AF_INET)
-                               continue;
-                       *pina++ = psu->sin.sin_addr;
-               }
-               free(tmpslist);
-       }
-
-       return (err);
-}
-
-/*
- * Set protocol-independent source filter list in use on socket.
- */
-int
-setsourcefilter(int s, uint32_t interface, struct sockaddr *group,
-    socklen_t grouplen, uint32_t fmode, uint32_t numsrc,
-    struct sockaddr_storage *slist)
-{
-       struct __msfilterreq     msfr;
-       sockunion_t             *psu;
-       int                      level, optname;
-
-       if (fmode != MCAST_INCLUDE && fmode != MCAST_EXCLUDE) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       psu = (sockunion_t *)group;
-       switch (psu->ss.ss_family) {
-#ifdef INET
-       case AF_INET:
-               if ((grouplen != sizeof(struct sockaddr_in) ||
-                   !IN_MULTICAST(ntohl(psu->sin.sin_addr.s_addr)))) {
-                       errno = EINVAL;
-                       return (-1);
-               }
-               level = IPPROTO_IP;
-               optname = IP_MSFILTER;
-               break;
-#endif
-#ifdef INET6
-       case AF_INET6:
-               if (grouplen != sizeof(struct sockaddr_in6) ||
-                   !IN6_IS_ADDR_MULTICAST(&psu->sin6.sin6_addr)) {
-                       errno = EINVAL;
-                       return (-1);
-               }
-               level = IPPROTO_IPV6;
-               optname = IPV6_MSFILTER;
-               break;
-#endif
-       default:
-               errno = EAFNOSUPPORT;
-               return (-1);
-       }
-
-       memset(&msfr, 0, sizeof(msfr));
-       msfr.msfr_ifindex = interface;
-       msfr.msfr_fmode = fmode;
-       msfr.msfr_nsrcs = numsrc;
-       memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len);
-       msfr.msfr_srcs = slist;         /* pointer */
-
-       return (_setsockopt(s, level, optname, &msfr, sizeof(msfr)));
-}
-
-/*
- * Get protocol-independent source filter list in use on socket.
- * An slist of NULL may be used for guessing the required buffer size.
- */
-int
-getsourcefilter(int s, uint32_t interface, struct sockaddr *group,
-    socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
-    struct sockaddr_storage *slist)
-{
-       struct __msfilterreq     msfr;
-       sockunion_t             *psu;
-       int                      err, level, nsrcs, optlen, optname;
-
-       if (interface == 0 || group == NULL || numsrc == NULL ||
-           fmode == NULL) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       nsrcs = *numsrc;
-       *numsrc = 0;
-       *fmode = 0;
-
-       psu = (sockunion_t *)group;
-       switch (psu->ss.ss_family) {
-#ifdef INET
-       case AF_INET:
-               if ((grouplen != sizeof(struct sockaddr_in) ||
-                   !IN_MULTICAST(ntohl(psu->sin.sin_addr.s_addr)))) {
-                       errno = EINVAL;
-                       return (-1);
-               }
-               level = IPPROTO_IP;
-               optname = IP_MSFILTER;
-               break;
-#endif
-#ifdef INET6
-       case AF_INET6:
-               if (grouplen != sizeof(struct sockaddr_in6) ||
-                   !IN6_IS_ADDR_MULTICAST(&psu->sin6.sin6_addr)) {
-                       errno = EINVAL;
-                       return (-1);
-               }
-               level = IPPROTO_IPV6;
-               optname = IPV6_MSFILTER;
-               break;
-#endif
-       default:
-               errno = EAFNOSUPPORT;
-               return (-1);
-               break;
-       }
-
-       optlen = sizeof(struct __msfilterreq);
-       memset(&msfr, 0, optlen);
-       msfr.msfr_ifindex = interface;
-       msfr.msfr_fmode = 0;
-       msfr.msfr_nsrcs = nsrcs;
-       memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len);
-
-       /*
-        * msfr_srcs is a pointer to a vector of sockaddr_storage. It
-        * may be NULL. The kernel will always return the total number
-        * of filter entries for the group in msfr.msfr_nsrcs.
-        */
-       msfr.msfr_srcs = slist;
-       err = _getsockopt(s, level, optname, &msfr, &optlen);
-       if (err == 0) {
-               *numsrc = msfr.msfr_nsrcs;
-               *fmode = msfr.msfr_fmode;
-       }
-
-       return (err);
-}
diff --git a/net/sourcefilter.3 b/net/sourcefilter.3
deleted file mode 100644 (file)
index 081dfa3..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-.\" Copyright (c) 2007-2009 Bruce Simpson.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/net/sourcefilter.3,v 1.2 2009/03/04 01:59:14 bms Exp $
-.\"
-.Dd February 13, 2009
-.Dt SOURCEFILTER 3
-.Os
-.Sh NAME
-.Nm sourcefilter
-.Nd advanced multicast group membership API
-.Sh SYNOPSIS
-.In sys/socket.h
-.In netinet/in.h
-.Ft int
-.Fo getipv4sourcefilter
-.Fa "int s"
-.Fa "struct in_addr interface"
-.Fa "struct in_addr group"
-.Fa "uint32_t *fmode"
-.Fa "uint32_t *numsrc"
-.Fa "struct in_addr *slist"
-.Fc
-.Ft int
-.Fo getsourcefilter
-.Fa "int s"
-.Fa "uint32_t interface"
-.Fa "struct sockaddr *group"
-.Fa "socklen_t grouplen"
-.Fa "uint32_t *fmode"
-.Fa "uint32_t *numsrc"
-.Fa "struct sockaddr_storage *slist"
-.Fc
-.Ft int
-.Fo setipv4sourcefilter
-.Fa "int s"
-.Fa "struct in_addr interface"
-.Fa "struct in_addr group"
-.Fa "uint32_t fmode"
-.Fa "uint32_t numsrc"
-.Fa "struct in_addr *slist"
-.Fc
-.Ft int
-.Fo setsourcefilter
-.Fa "int s"
-.Fa "uint32_t interface"
-.Fa "struct sockaddr *group"
-.Fa "socklen_t grouplen"
-.Fa "uint32_t fmode"
-.Fa "uint32_t numsrc"
-.Fa "struct sockaddr_storage *slist"
-.Fc
-.Sh DESCRIPTION
-The
-.Nm
-functions implement the advanced, full-state multicast API
-defined in RFC 3678.
-An application may use these functions to atomically set and
-retrieve the multicast source address filters associated with a socket
-.Fa s
-and a multicast
-.Fa group .
-.Pp
-The functions
-.Fn getipv4sourcefilter
-and
-.Fn getsourcefilter
-allow an application to discover the filter mode, and
-source filter entries,
-for an existing group membership.
-.Pp
-The kernel will always return the number of source filter
-entries on the socket for that group in
-.Fa *numsrc .
-If the
-.Fa *numsrc
-argument is non-zero, the kernel will attempt to return up to
-.Fa *numsrc
-filter entries in the array pointed to by
-.Fa slist .
-The
-.Fa *numsrc
-argument may be set to 0, in which case the
-.Fa slist
-argument will be ignored.
-.Pp
-For the
-.Fn setipv4sourcefilter
-and
-.Fn setsourcefilter
-functions,
-the
-.Fa fmode
-argument may be used to place the socket into inclusive or exclusive
-group membership modes, by using the
-.Dv MCAST_INCLUDE
-or
-.Dv MCAST_EXCLUDE
-constants respectively.
-The
-.Fa numsrc
-argument specifies the number of source entries in the
-.Fa slist
-array.
-If the
-.Fa numsrc
-argument has a value of 0,
-all source filters will be removed from the socket.
-Removing all source filters from a membership which is in the
-.Dv MCAST_INCLUDE
-filter mode will cause the group to be left on that socket.
-.Pp
-The protocol-independent function
-.Fn setsourcefilter
-allows an application to join a multicast group on an interface
-which may not have an assigned protocol address,
-by passing its index for the
-.Fa interface
-argument.
-.Pp
-Any changes made by these functions
-will be communicated to IGMPv3 and/or MLDv2 routers
-on the local network as appropriate.
-If no IGMPv3 or MLDv2 routers are present, changes in the source filter
-lists made by these functions will not cause
-state changes to be transmitted, with the exception of any
-change which causes a group to be joined or left.
-The kernel will continue to maintain the source filter state
-regardless of the IGMP or MLD version in use on the link.
-.Sh IMPLEMENTATION NOTES
-The IPv4 specific versions of these functions are implemented in terms
-of the protocol-independent functions.
-Application writers are encouraged to use the protocol-independent functions
-for efficiency, and forwards compatibility with IPv6 networks.
-.Pp
-For the protocol-independent functions
-.Fn getsourcefilter
-and
-.Fn setsourcefilter ,
-the argument
-.Fa grouplen
-argument specifies the size of the structure pointed to by
-.Fa group .
-This is required in order to differentiate between different
-address families.
-.Pp
-Currently
-.Fx
-does not support source address selection for the IPv4
-protocol family, therefore the use of multicast APIs with
-an unnumbered IPv4 interface is
-.Em not recommended.
-In all cases, the first assigned IPv4 address on the interface
-will be used as the source address of IGMP control traffic.
-If this address is removed or changed, the results are undefined.
-.Sh RETURN VALUES
-.Rv -std getsourcefilter getipv4sourcefilter setsourcefilter setipv4sourcefilter
-.Sh ERRORS
-The
-.Nm
-functions may fail because of:
-.Bl -tag -width Er
-.It Bq Er EADDRNOTAVAIL
-The network interface which the
-.Dv interface
-argument refers to was not configured in the system,
-or the system is not a member of the
-.Dv group .
-.It Bq Er EAFNOSUPPORT
-The
-.Dv group
-and/or one or more of the
-.Dv slist
-arguments were of an address family unsupported by the system,
-or the address family of the
-.Dv group
-and
-.Dv slist
-arguments were not identical.
-.It Bq Er EINVAL
-The
-.Dv group
-argument does not contain a multicast address.
-The
-.Dv fmode
-argument is invalid; it must be set to either
-.Dv MCAST_INCLUDE
-or
-.Dv MCAST_EXCLUDE .
-The
-.Dv numsrc
-or
-.Dv slist
-arguments do not specify a source list.
-.It Bq Er ENOMEM
-Insufficient memory was available to carry out the requested
-operation.
-.El
-.Sh SEE ALSO
-.Xr ip 4 ,
-.Xr ip6 4
-.Rs
-.%A D. Thaler
-.%A B. Fenner
-.%A B. Quinn
-.%T "Socket Interface Extensions for Multicast Source Filters"
-.%N RFC 3678
-.%D Jan 2004
-.Re
-.Sh HISTORY
-The
-.Nm
-functions first appeared in
-.Fx 7.0 .
-.Sh AUTHORS
-Bruce M. Simpson
-.Aq bms@FreeBSD.org
index 0ce69e0079af29c4252fa93b9cd9445c8937d482..542368e6573ed4c0ff477e54059d3a26733a465c 100644 (file)
@@ -45,16 +45,22 @@ __FBSDID("$FreeBSD: src/lib/libc/nls/msgcat.c,v 1.49 2005/02/01 16:04:55 phantom
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
-#include <locale.h>
+#include <xlocale.h>
 #include <nl_types.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <machine/endian.h>
+#include <libkern/OSByteOrder.h>
 #include "un-namespace.h"
 
 #include "msgcat.h"
-#include "../locale/setlocale.h"        /* for ENCODING_LEN */
+#include "setlocale.h"        /* for ENCODING_LEN */
+
+#ifndef ntohll
+#define ntohll(x) OSSwapBigToHostInt64(x)
+#endif
 
 #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L"
 
@@ -85,7 +91,7 @@ catopen(__const char *name, int type)
                return (loadCat(name));
 
        if (type == NL_CAT_LOCALE)
-               lang = setlocale(LC_MESSAGES, NULL);
+               lang = (char *)querylocale(LC_MESSAGES_MASK, NULL);
        else
                lang = getenv("LANG");
 
@@ -208,21 +214,21 @@ catopen(__const char *name, int type)
 
 #define LOOKUP(PARENT, CHILD, ID, NUM, SET) {                    \
        lo = 0;                                                  \
-       if (ID - 1 < PARENT->NUM) {                              \
+       if (ID - 1 < NUM) {                              \
                cur = ID - 1;                                    \
                hi = ID;                                         \
        } else {                                                 \
-               hi = PARENT->NUM;                                \
+               hi = NUM;                                \
                cur = (hi - lo) / 2;                             \
        }                                                        \
        while (TRUE) {                                           \
                CHILD = PARENT->SET + cur;                       \
-               if (CHILD->ID == ID)                             \
+               if (ntohl(CHILD->ID) == ID)                             \
                        break;                                   \
-               if (CHILD->ID < ID) {                            \
+               if (ntohl(CHILD->ID) < ID) {                            \
                        lo = cur + 1;                            \
-                       if (hi > cur + (ID - CHILD->ID) + 1)     \
-                               hi = cur + (ID - CHILD->ID) + 1; \
+                       if (hi > cur + (ID - ntohl(CHILD->ID)) + 1)     \
+                               hi = cur + (ID - ntohl(CHILD->ID)) + 1; \
                        dir = 1;                                 \
                } else {                                         \
                        hi = cur;                                \
@@ -241,11 +247,11 @@ static MCSetT *
 MCGetSet(MCCatT *cat, int setId)
 {
        MCSetT  *set;
-       long    lo, hi, cur, dir;
+       int32_t    lo, hi, cur, dir;
 
        if (cat == NULL || setId <= 0)
                return (NULL);
-       LOOKUP(cat, set, setId, numSets, sets);
+       LOOKUP(cat, set, setId, cat->numSets, sets);
        if (set->invalid && loadSet(cat, set) <= 0)
                return (NULL);
        return (set);
@@ -255,11 +261,11 @@ static MCMsgT *
 MCGetMsg(MCSetT *set, int msgId)
 {
        MCMsgT  *msg;
-       long    lo, hi, cur, dir;
+       int32_t    lo, hi, cur, dir;
 
        if (set == NULL || set->invalid || msgId <= 0)
                return (NULL);
-       LOOKUP(set, msg, msgId, numMsgs, u.msgs);
+       LOOKUP(set, msg, msgId, ntohl(set->numMsgs), u.msgs);
        return (msg);
 }
 
@@ -341,46 +347,57 @@ loadCat(__const char *catpath)
        MCHeaderT       header;
        MCCatT          *cat;
        MCSetT          *set;
-       long            i;
+       int32_t         i;
        off_t           nextSet;
        int             saverr;
+       int             fd;
 
        if ((cat = (MCCatT *)malloc(sizeof(MCCatT))) == NULL)
                return (NLERR);
 
-       if ((cat->fp = fopen(catpath, "r")) == NULL) {
+       if ((fd = open(catpath, O_RDONLY | O_CLOEXEC)) == -1) {
                saverr = errno;
                free(cat);
                errno = saverr;
                return (NLERR);
        }
-       (void)_fcntl(fileno(cat->fp), F_SETFD, FD_CLOEXEC);
+
+       if ((cat->fp = fdopen(fd, "r")) == NULL) {
+               saverr = errno;
+               close(fd);
+               free(cat);
+               errno = saverr;
+               return (NLERR);
+       }
 
        if (fread(&header, sizeof(header), 1, cat->fp) != 1 ||
            strncmp(header.magic, MCMagic, MCMagicLen) != 0)
                CORRUPT();
 
-       if (header.majorVer != MCMajorVer) {
+       if (ntohl(header.majorVer) != MCMajorVer) {
                (void)fclose(cat->fp);
                free(cat);
-               (void)fprintf(stderr, "%s: %s is version %ld, we need %ld.\n",
-                   _errowner, catpath, header.majorVer, MCMajorVer);
+               if (OSSwapInt32(ntohl(header.majorVer)) == MCMajorVer) {
+                   (void)fprintf(stderr, "%s: %s is the wrong byte ordering.\n", _errowner, catpath);
+               } else {
+                   (void)fprintf(stderr, "%s: %s is version %d, we need %d.\n", _errowner, catpath, (int)ntohl(header.majorVer), MCMajorVer);
+               }
                NLRETERR(EFTYPE);
        }
-       if (header.numSets <= 0) {
+       if (ntohl(header.numSets) <= 0) {
                (void)fclose(cat->fp);
                free(cat);
-               (void)fprintf(stderr, "%s: %s has %ld sets!\n",
-                   _errowner, catpath, header.numSets);
+               (void)fprintf(stderr, "%s: %s has %d sets!\n",
+                   _errowner, catpath, (int)ntohl(header.numSets));
                NLRETERR(EFTYPE);
        }
 
-       cat->numSets = header.numSets;
-       if ((cat->sets = (MCSetT *)malloc(sizeof(MCSetT) * header.numSets)) ==
+       cat->numSets = ntohl(header.numSets);
+       if ((cat->sets = (MCSetT *)malloc(sizeof(MCSetT) * cat->numSets)) ==
            NULL)
                NOSPACE();
 
-       nextSet = header.firstSet;
+       nextSet = ntohll(header.firstSet);
        for (i = 0; i < cat->numSets; ++i) {
                if (fseeko(cat->fp, nextSet, SEEK_SET) == -1) {
                        __nls_free_resources(cat, i);
@@ -397,11 +414,11 @@ loadCat(__const char *catpath)
                /* if it's invalid, skip over it (and backup 'i') */
                if (set->invalid) {
                        --i;
-                       nextSet = set->nextSet;
+                       nextSet = ntohll(set->nextSet);
                        continue;
                }
                set->invalid = TRUE;
-               nextSet = set->nextSet;
+               nextSet = ntohll(set->nextSet);
        }
 
        return ((nl_catd) cat);
@@ -415,11 +432,11 @@ loadSet(MCCatT *cat, MCSetT *set)
        int     saverr;
 
        /* Get the data */
-       if (fseeko(cat->fp, set->data.off, SEEK_SET) == -1)
+       if (fseeko(cat->fp, ntohll(set->data.off), SEEK_SET) == -1)
                return (0);
-       if ((set->data.str = malloc(set->dataLen)) == NULL)
+       if ((set->data.str = malloc(ntohl(set->dataLen))) == NULL)
                return (-1);
-       if (fread(set->data.str, set->dataLen, 1, cat->fp) != 1) {
+       if (fread(set->data.str, ntohl(set->dataLen), 1, cat->fp) != 1) {
                saverr = errno;
                free(set->data.str);
                errno = saverr;
@@ -427,13 +444,13 @@ loadSet(MCCatT *cat, MCSetT *set)
        }
 
        /* Get the messages */
-       if (fseeko(cat->fp, set->u.firstMsg, SEEK_SET) == -1) {
+       if (fseeko(cat->fp, ntohll(set->u.firstMsg), SEEK_SET) == -1) {
                saverr = errno;
                free(set->data.str);
                errno = saverr;
                return (0);
        }
-       if ((set->u.msgs = (MCMsgT *)malloc(sizeof(MCMsgT) * set->numMsgs)) ==
+       if ((set->u.msgs = (MCMsgT *)malloc(sizeof(MCMsgT) * ntohl(set->numMsgs))) ==
            NULL) {
                saverr = errno;
                free(set->data.str);
@@ -441,7 +458,7 @@ loadSet(MCCatT *cat, MCSetT *set)
                return (-1);
        }
 
-       for (i = 0; i < set->numMsgs; ++i) {
+       for (i = 0; i < ntohl(set->numMsgs); ++i) {
                msg = set->u.msgs + i;
                if (fread(msg, sizeof(*msg), 1, cat->fp) != 1) {
                        saverr = errno;
@@ -454,7 +471,7 @@ loadSet(MCCatT *cat, MCSetT *set)
                        --i;
                        continue;
                }
-               msg->msg.str = (char *)(set->data.str + msg->msg.off);
+               msg->msg.str = (char *)(set->data.str + ntohll(msg->msg.off));
        }
        set->invalid = FALSE;
        return (1);
diff --git a/nls/FreeBSD/msgcat.c.patch b/nls/FreeBSD/msgcat.c.patch
deleted file mode 100644 (file)
index f62f2d7..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
---- msgcat.c.orig      2009-12-05 13:47:14.000000000 -0800
-+++ msgcat.c   2009-12-05 13:49:56.000000000 -0800
-@@ -45,16 +45,22 @@ __FBSDID("$FreeBSD: src/lib/libc/nls/msg
- #include <errno.h>
- #include <fcntl.h>
- #include <limits.h>
--#include <locale.h>
-+#include <xlocale.h>
- #include <nl_types.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
-+#include <machine/endian.h>
-+#include <libkern/OSByteOrder.h>
- #include "un-namespace.h"
- #include "msgcat.h"
--#include "../locale/setlocale.h"        /* for ENCODING_LEN */
-+#include "setlocale.h"        /* for ENCODING_LEN */
-+
-+#ifndef ntohll
-+#define ntohll(x) OSSwapBigToHostInt64(x)
-+#endif
- #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L"
-@@ -85,7 +91,7 @@ catopen(__const char *name, int type)
-               return (loadCat(name));
-       if (type == NL_CAT_LOCALE)
--              lang = setlocale(LC_MESSAGES, NULL);
-+              lang = (char *)querylocale(LC_MESSAGES_MASK, NULL);
-       else
-               lang = getenv("LANG");
-@@ -208,21 +214,21 @@ catopen(__const char *name, int type)
- #define LOOKUP(PARENT, CHILD, ID, NUM, SET) {                    \
-       lo = 0;                                                  \
--      if (ID - 1 < PARENT->NUM) {                              \
-+      if (ID - 1 < NUM) {                              \
-               cur = ID - 1;                                    \
-               hi = ID;                                         \
-       } else {                                                 \
--              hi = PARENT->NUM;                                \
-+              hi = NUM;                                \
-               cur = (hi - lo) / 2;                             \
-       }                                                        \
-       while (TRUE) {                                           \
-               CHILD = PARENT->SET + cur;                       \
--              if (CHILD->ID == ID)                             \
-+              if (ntohl(CHILD->ID) == ID)                             \
-                       break;                                   \
--              if (CHILD->ID < ID) {                            \
-+              if (ntohl(CHILD->ID) < ID) {                            \
-                       lo = cur + 1;                            \
--                      if (hi > cur + (ID - CHILD->ID) + 1)     \
--                              hi = cur + (ID - CHILD->ID) + 1; \
-+                      if (hi > cur + (ID - ntohl(CHILD->ID)) + 1)     \
-+                              hi = cur + (ID - ntohl(CHILD->ID)) + 1; \
-                       dir = 1;                                 \
-               } else {                                         \
-                       hi = cur;                                \
-@@ -241,11 +247,11 @@ static MCSetT *
- MCGetSet(MCCatT *cat, int setId)
- {
-       MCSetT  *set;
--      long    lo, hi, cur, dir;
-+      int32_t    lo, hi, cur, dir;
-       if (cat == NULL || setId <= 0)
-               return (NULL);
--      LOOKUP(cat, set, setId, numSets, sets);
-+      LOOKUP(cat, set, setId, cat->numSets, sets);
-       if (set->invalid && loadSet(cat, set) <= 0)
-               return (NULL);
-       return (set);
-@@ -255,11 +261,11 @@ static MCMsgT *
- MCGetMsg(MCSetT *set, int msgId)
- {
-       MCMsgT  *msg;
--      long    lo, hi, cur, dir;
-+      int32_t    lo, hi, cur, dir;
-       if (set == NULL || set->invalid || msgId <= 0)
-               return (NULL);
--      LOOKUP(set, msg, msgId, numMsgs, u.msgs);
-+      LOOKUP(set, msg, msgId, ntohl(set->numMsgs), u.msgs);
-       return (msg);
- }
-@@ -341,7 +347,7 @@ loadCat(__const char *catpath)
-       MCHeaderT       header;
-       MCCatT          *cat;
-       MCSetT          *set;
--      long            i;
-+      int32_t         i;
-       off_t           nextSet;
-       int             saverr;
-@@ -360,27 +366,30 @@ loadCat(__const char *catpath)
-           strncmp(header.magic, MCMagic, MCMagicLen) != 0)
-               CORRUPT();
--      if (header.majorVer != MCMajorVer) {
-+      if (ntohl(header.majorVer) != MCMajorVer) {
-               (void)fclose(cat->fp);
-               free(cat);
--              (void)fprintf(stderr, "%s: %s is version %ld, we need %ld.\n",
--                  _errowner, catpath, header.majorVer, MCMajorVer);
-+              if (OSSwapInt32(ntohl(header.majorVer)) == MCMajorVer) {
-+                  (void)fprintf(stderr, "%s: %s is the wrong byte ordering.\n", _errowner, catpath);
-+              } else {
-+                  (void)fprintf(stderr, "%s: %s is version %d, we need %d.\n", _errowner, catpath, (int)ntohl(header.majorVer), MCMajorVer);
-+              }
-               NLRETERR(EFTYPE);
-       }
--      if (header.numSets <= 0) {
-+      if (ntohl(header.numSets) <= 0) {
-               (void)fclose(cat->fp);
-               free(cat);
--              (void)fprintf(stderr, "%s: %s has %ld sets!\n",
--                  _errowner, catpath, header.numSets);
-+              (void)fprintf(stderr, "%s: %s has %d sets!\n",
-+                  _errowner, catpath, (int)ntohl(header.numSets));
-               NLRETERR(EFTYPE);
-       }
--      cat->numSets = header.numSets;
--      if ((cat->sets = (MCSetT *)malloc(sizeof(MCSetT) * header.numSets)) ==
-+      cat->numSets = ntohl(header.numSets);
-+      if ((cat->sets = (MCSetT *)malloc(sizeof(MCSetT) * cat->numSets)) ==
-           NULL)
-               NOSPACE();
--      nextSet = header.firstSet;
-+      nextSet = ntohll(header.firstSet);
-       for (i = 0; i < cat->numSets; ++i) {
-               if (fseeko(cat->fp, nextSet, SEEK_SET) == -1) {
-                       __nls_free_resources(cat, i);
-@@ -397,11 +406,11 @@ loadCat(__const char *catpath)
-               /* if it's invalid, skip over it (and backup 'i') */
-               if (set->invalid) {
-                       --i;
--                      nextSet = set->nextSet;
-+                      nextSet = ntohll(set->nextSet);
-                       continue;
-               }
-               set->invalid = TRUE;
--              nextSet = set->nextSet;
-+              nextSet = ntohll(set->nextSet);
-       }
-       return ((nl_catd) cat);
-@@ -415,11 +424,11 @@ loadSet(MCCatT *cat, MCSetT *set)
-       int     saverr;
-       /* Get the data */
--      if (fseeko(cat->fp, set->data.off, SEEK_SET) == -1)
-+      if (fseeko(cat->fp, ntohll(set->data.off), SEEK_SET) == -1)
-               return (0);
--      if ((set->data.str = malloc(set->dataLen)) == NULL)
-+      if ((set->data.str = malloc(ntohl(set->dataLen))) == NULL)
-               return (-1);
--      if (fread(set->data.str, set->dataLen, 1, cat->fp) != 1) {
-+      if (fread(set->data.str, ntohl(set->dataLen), 1, cat->fp) != 1) {
-               saverr = errno;
-               free(set->data.str);
-               errno = saverr;
-@@ -427,13 +436,13 @@ loadSet(MCCatT *cat, MCSetT *set)
-       }
-       /* Get the messages */
--      if (fseeko(cat->fp, set->u.firstMsg, SEEK_SET) == -1) {
-+      if (fseeko(cat->fp, ntohll(set->u.firstMsg), SEEK_SET) == -1) {
-               saverr = errno;
-               free(set->data.str);
-               errno = saverr;
-               return (0);
-       }
--      if ((set->u.msgs = (MCMsgT *)malloc(sizeof(MCMsgT) * set->numMsgs)) ==
-+      if ((set->u.msgs = (MCMsgT *)malloc(sizeof(MCMsgT) * ntohl(set->numMsgs))) ==
-           NULL) {
-               saverr = errno;
-               free(set->data.str);
-@@ -441,7 +450,7 @@ loadSet(MCCatT *cat, MCSetT *set)
-               return (-1);
-       }
--      for (i = 0; i < set->numMsgs; ++i) {
-+      for (i = 0; i < ntohl(set->numMsgs); ++i) {
-               msg = set->u.msgs + i;
-               if (fread(msg, sizeof(*msg), 1, cat->fp) != 1) {
-                       saverr = errno;
-@@ -454,7 +463,7 @@ loadSet(MCCatT *cat, MCSetT *set)
-                       --i;
-                       continue;
-               }
--              msg->msg.str = (char *)(set->data.str + msg->msg.off);
-+              msg->msg.str = (char *)(set->data.str + ntohll(msg->msg.off));
-       }
-       set->invalid = FALSE;
-       return (1);
index 0a8b7883d49a0b287452022f47e12bc30fb1ecbf..1e9f1a0dddbf615a02cb1b1ac5841de3623782c8 100644 (file)
@@ -43,13 +43,14 @@ up-to-date.  Many thanks.
 #define MCMagicLen     8
 #define MCMagic                "*nazgul*"
 
-#define MCMajorVer     1L
+#define MCMajorVer     1
 #define MCMinorVer     0
 
 /* For or'd constants */
-#define MCMakeId(s,m)          (unsigned long) ( ((unsigned short)s << (sizeof(short)*8)) \
+#define MCMakeId(s,m)          (u_int32_t) ( ((unsigned short)s << (sizeof(short)*8)) \
                                                 | (unsigned short)m )
 
+
 /*
  * Critical note here.  Sets and Messages *MUST* be stored in ascending
  * order.  There are stored that way (by specification) in the original
@@ -88,37 +89,43 @@ typedef union {
     struct _MCSetT     *set;
 } MCOffsetT;
 
+#ifdef __LP64__
+#pragma pack(4)
+#endif /* __LP64__ */
 /*
  * MCMsgT - Message structure (disk and runtime)
  */
 typedef struct _MCMsgT {
-    long       msgId;          /* Id of this message */
+    int32_t    msgId;          /* Id of this message */
     MCOffsetT  msg;            /* Relative offset on disk or pointer in memory */
-    long       invalid;        /* Valid on disk, loaded in memory */
+    int32_t    invalid;        /* Valid on disk, loaded in memory */
 } MCMsgT;
 
 /*
  * MCSetT - Set structure (disk and runtime)
  */
 typedef struct _MCSetT {
-    long       setId;          /* Id of this set */
+    int32_t    setId;          /* Id of this set */
     off_t      nextSet;        /* Offset of next set on disk */
     union {
        off_t   firstMsg;       /* Offset to first Msg (while on disk) */
        MCMsgT  *msgs;          /* Pointer to array of msgs (in mem, loaded) */
     } u;
     MCOffsetT  data;           /* Offset to data, or pointer to data */
-    long       dataLen;        /* Length of data area on disk */
-    long       numMsgs;        /* Number of messages */
-    long       invalid;        /* Valid on disk, loaded in memory */
+    int32_t    dataLen;        /* Length of data area on disk */
+    int32_t    numMsgs;        /* Number of messages */
+    int32_t    invalid;        /* Valid on disk, loaded in memory */
 } MCSetT;
+#ifdef __LP64__
+#pragma pack()
+#endif /* __LP64__ */
 
 /*
  * MCCatT - Runtime catalog pointer
  */
 typedef struct {
     FILE        *fp;            /* File descriptor of catalog (if load-on-demand) */
-    long       numSets;        /* Number of sets */
+    int32_t    numSets;        /* Number of sets */
     MCSetT     *sets;          /* Pointer to the sets */
     off_t      firstSet;       /* Offset of first set on disk */
 } MCCatT;
@@ -128,10 +135,10 @@ typedef struct {
  */
 typedef struct {
     char       magic[MCMagicLen];      /* Magic cookie "*nazgul*" */
-    long       majorVer;               /* ++ on incompatible changes */
-    long       minorVer;               /* ++ on compatible changes */
-    long       flags;                  /* Informational flags */
-    long       numSets;                /* Number of valid Sets */
+    int32_t    majorVer;               /* ++ on incompatible changes */
+    int32_t    minorVer;               /* ++ on compatible changes */
+    int32_t    flags;                  /* Informational flags */
+    int32_t    numSets;                /* Number of valid Sets */
     off_t      firstSet;               /* Offset of first set on disk */
 } MCHeaderT;
 
diff --git a/nls/FreeBSD/msgcat.h.patch b/nls/FreeBSD/msgcat.h.patch
deleted file mode 100644 (file)
index 31303e4..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
---- msgcat.h.orig      2009-11-23 18:16:18.000000000 -0800
-+++ msgcat.h   2009-12-05 13:58:11.000000000 -0800
-@@ -43,13 +43,14 @@ up-to-date.  Many thanks.
- #define MCMagicLen    8
- #define MCMagic               "*nazgul*"
--#define MCMajorVer    1L
-+#define MCMajorVer    1
- #define MCMinorVer    0
- /* For or'd constants */
--#define MCMakeId(s,m)         (unsigned long) ( ((unsigned short)s << (sizeof(short)*8)) \
-+#define MCMakeId(s,m)         (u_int32_t) ( ((unsigned short)s << (sizeof(short)*8)) \
-                                                | (unsigned short)m )
-+
- /*
-  * Critical note here.  Sets and Messages *MUST* be stored in ascending
-  * order.  There are stored that way (by specification) in the original
-@@ -88,37 +89,43 @@ typedef union {
-     struct _MCSetT    *set;
- } MCOffsetT;
-+#ifdef __LP64__
-+#pragma pack(4)
-+#endif /* __LP64__ */
- /*
-  * MCMsgT - Message structure (disk and runtime)
-  */
- typedef struct _MCMsgT {
--    long      msgId;          /* Id of this message */
-+    int32_t   msgId;          /* Id of this message */
-     MCOffsetT msg;            /* Relative offset on disk or pointer in memory */
--    long      invalid;        /* Valid on disk, loaded in memory */
-+    int32_t   invalid;        /* Valid on disk, loaded in memory */
- } MCMsgT;
- /*
-  * MCSetT - Set structure (disk and runtime)
-  */
- typedef struct _MCSetT {
--    long      setId;          /* Id of this set */
-+    int32_t   setId;          /* Id of this set */
-     off_t     nextSet;        /* Offset of next set on disk */
-     union {
-       off_t   firstMsg;       /* Offset to first Msg (while on disk) */
-       MCMsgT  *msgs;          /* Pointer to array of msgs (in mem, loaded) */
-     } u;
-     MCOffsetT data;           /* Offset to data, or pointer to data */
--    long      dataLen;        /* Length of data area on disk */
--    long      numMsgs;        /* Number of messages */
--    long      invalid;        /* Valid on disk, loaded in memory */
-+    int32_t   dataLen;        /* Length of data area on disk */
-+    int32_t   numMsgs;        /* Number of messages */
-+    int32_t   invalid;        /* Valid on disk, loaded in memory */
- } MCSetT;
-+#ifdef __LP64__
-+#pragma pack()
-+#endif /* __LP64__ */
- /*
-  * MCCatT - Runtime catalog pointer
-  */
- typedef struct {
-     FILE        *fp;            /* File descriptor of catalog (if load-on-demand) */
--    long      numSets;        /* Number of sets */
-+    int32_t   numSets;        /* Number of sets */
-     MCSetT    *sets;          /* Pointer to the sets */
-     off_t     firstSet;       /* Offset of first set on disk */
- } MCCatT;
-@@ -128,10 +135,10 @@ typedef struct {
-  */
- typedef struct {
-     char      magic[MCMagicLen];      /* Magic cookie "*nazgul*" */
--    long      majorVer;               /* ++ on incompatible changes */
--    long      minorVer;               /* ++ on compatible changes */
--    long      flags;                  /* Informational flags */
--    long      numSets;                /* Number of valid Sets */
-+    int32_t   majorVer;               /* ++ on incompatible changes */
-+    int32_t   minorVer;               /* ++ on compatible changes */
-+    int32_t   flags;                  /* Informational flags */
-+    int32_t   numSets;                /* Number of valid Sets */
-     off_t     firstSet;               /* Offset of first set on disk */
- } MCHeaderT;
diff --git a/nls/Makefile.inc b/nls/Makefile.inc
deleted file mode 100644 (file)
index 076ebc2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#      from $NetBSD: Makefile.inc,v 1.7 1995/02/27 13:06:20 cgd Exp $
-# $FreeBSD: src/lib/libc/nls/Makefile.inc,v 1.5.2.2 2001/04/25 10:04:07 ru Exp $
-
-.PATH: ${.CURDIR}/nls
-CWD := ${.CURDIR}/nls
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= msgcat.c
-FBSDHDRS= msgcat.h
-.include "Makefile.fbsd_end"
-
-CFLAGS-msgcat-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-
-# Install msgcat.h for usage by gencat (in adv_cmds)
-LOCALHDRS+=    ${.CURDIR}/nls/msgcat.h
-
-.if ${LIB} == "c"
-.include "Makefile.fbsd_begin"
-FBSDMAN3= catclose.3 catgets.3 catopen.3
-.include "Makefile.fbsd_end"
-.endif
diff --git a/nls/catclose.3 b/nls/catclose.3
deleted file mode 120000 (symlink)
index 5f1c02f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./catclose.3
\ No newline at end of file
diff --git a/nls/catgets.3 b/nls/catgets.3
deleted file mode 120000 (symlink)
index 06d6838..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./catgets.3
\ No newline at end of file
diff --git a/nls/catopen.3 b/nls/catopen.3
deleted file mode 120000 (symlink)
index 9c44bf2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./catopen.3
\ No newline at end of file
diff --git a/nls/msgcat-fbsd.c b/nls/msgcat-fbsd.c
deleted file mode 100644 (file)
index f65dd93..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-/***********************************************************
-Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that Alfalfa's name not be used in
-advertising or publicity pertaining to distribution of the software
-without specific, written prior permission.
-
-ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-If you make any modifications, bugfixes or other changes to this software
-we'd appreciate it if you could send a copy to us so we can keep things
-up-to-date.  Many thanks.
-                               Kee Hinckley
-                               Alfalfa Software, Inc.
-                               267 Allston St., #3
-                               Cambridge, MA 02139  USA
-                               nazgul@alfalfa.com
-
-******************************************************************/
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/nls/msgcat.c,v 1.49 2005/02/01 16:04:55 phantom Exp $");
-
-/*
- * We need a better way of handling errors than printing text.  I need
- * to add an error handling routine.
- */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <xlocale.h>
-#include <nl_types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <machine/endian.h>
-#include <libkern/OSByteOrder.h>
-#include "un-namespace.h"
-
-#include "msgcat.h"
-#include "setlocale.h"        /* for ENCODING_LEN */
-
-#ifndef ntohll
-#define ntohll(x) OSSwapBigToHostInt64(x)
-#endif
-
-#define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L"
-
-#define        TRUE    1
-#define        FALSE   0
-
-#define        NLERR           ((nl_catd) -1)
-#define NLRETERR(errc)  { errno = errc; return (NLERR); }
-
-static nl_catd  loadCat(__const char *);
-static int      loadSet(MCCatT *, MCSetT *);
-static void     __nls_free_resources(MCCatT *, int);
-
-nl_catd
-catopen(__const char *name, int type)
-{
-       int             spcleft, saverr;
-       char            path[PATH_MAX];
-       char            *nlspath, *lang, *base, *cptr, *pathP, *tmpptr;
-       char            *cptr1, *plang, *pter, *pcode;
-       struct stat     sbuf;
-
-       if (name == NULL || *name == '\0')
-               NLRETERR(EINVAL);
-
-       /* is it absolute path ? if yes, load immediately */
-       if (strchr(name, '/') != NULL)
-               return (loadCat(name));
-
-       if (type == NL_CAT_LOCALE)
-               lang = (char *)querylocale(LC_MESSAGES_MASK, NULL);
-       else
-               lang = getenv("LANG");
-
-       if (lang == NULL || *lang == '\0' || strlen(lang) > ENCODING_LEN ||
-           (lang[0] == '.' &&
-            (lang[1] == '\0' || (lang[1] == '.' && lang[2] == '\0'))) ||
-           strchr(lang, '/') != NULL)
-               lang = "C";
-
-       if ((plang = cptr1 = strdup(lang)) == NULL)
-               return (NLERR);
-       if ((cptr = strchr(cptr1, '@')) != NULL)
-               *cptr = '\0';
-       pter = pcode = "";
-       if ((cptr = strchr(cptr1, '_')) != NULL) {
-               *cptr++ = '\0';
-               pter = cptr1 = cptr;
-       }
-       if ((cptr = strchr(cptr1, '.')) != NULL) {
-               *cptr++ = '\0';
-               pcode = cptr;
-       }
-
-       if ((nlspath = getenv("NLSPATH")) == NULL || issetugid())
-               nlspath = _DEFAULT_NLS_PATH;
-
-       if ((base = cptr = strdup(nlspath)) == NULL) {
-               saverr = errno;
-               free(plang);
-               errno = saverr;
-               return (NLERR);
-       }
-
-       while ((nlspath = strsep(&cptr, ":")) != NULL) {
-               pathP = path;
-               if (*nlspath) {
-                       for (; *nlspath; ++nlspath) {
-                               if (*nlspath == '%') {
-                                       switch (*(nlspath + 1)) {
-                                       case 'l':
-                                               tmpptr = plang;
-                                               break;
-                                       case 't':
-                                               tmpptr = pter;
-                                               break;
-                                       case 'c':
-                                               tmpptr = pcode;
-                                               break;
-                                       case 'L':
-                                               tmpptr = lang;
-                                               break;
-                                       case 'N':
-                                               tmpptr = (char *)name;
-                                               break;
-                                       case '%':
-                                               ++nlspath;
-                                               /* fallthrough */
-                                       default:
-                                               if (pathP - path >=
-                                                   sizeof(path) - 1)
-                                                       goto too_long;
-                                               *(pathP++) = *nlspath;
-                                               continue;
-                                       }
-                                       ++nlspath;
-                       put_tmpptr:
-                                       spcleft = sizeof(path) -
-                                                 (pathP - path) - 1;
-                                       if (strlcpy(pathP, tmpptr, spcleft) >=
-                                           spcleft) {
-                       too_long:
-                                               free(plang);
-                                               free(base);
-                                               NLRETERR(ENAMETOOLONG);
-                                       }
-                                       pathP += strlen(tmpptr);
-                               } else {
-                                       if (pathP - path >= sizeof(path) - 1)
-                                               goto too_long;
-                                       *(pathP++) = *nlspath;
-                               }
-                       }
-                       *pathP = '\0';
-                       if (stat(path, &sbuf) == 0) {
-                               free(plang);
-                               free(base);
-                               return (loadCat(path));
-                       }
-               } else {
-                       tmpptr = (char *)name;
-                       --nlspath;
-                       goto put_tmpptr;
-               }
-       }
-       free(plang);
-       free(base);
-       NLRETERR(ENOENT);
-}
-
-/*
- * We've got an odd situation here.  The odds are real good that the
- * number we are looking for is almost the same as the index.  We could
- * use the index, check the difference and do something intelligent, but
- * I haven't quite figured out what's intelligent.
- *
- * Here's a start.
- *     Take an id N.  If there are > N items in the list, then N cannot
- *     be more than N items from the start, since otherwise there would
- *     have to be duplicate items.  So we can safely set the top to N+1
- *     (after taking into account that ids start at 1, and arrays at 0)
- *
- *     Let's say we are at position P, and we are looking for N, but have
- *     V.  If N > V, then the furthest away that N could be is
- *     P + (N-V).  So we can safely set hi to P+(N-V)+1.  For example:
- *             We are looking for 10, but have 8
- *             8       ?       ?       ?       ?
- *                     >=9     >=10    >=11
- *
- */
-
-#define LOOKUP(PARENT, CHILD, ID, NUM, SET) {                    \
-       lo = 0;                                                  \
-       if (ID - 1 < NUM) {                              \
-               cur = ID - 1;                                    \
-               hi = ID;                                         \
-       } else {                                                 \
-               hi = NUM;                                \
-               cur = (hi - lo) / 2;                             \
-       }                                                        \
-       while (TRUE) {                                           \
-               CHILD = PARENT->SET + cur;                       \
-               if (ntohl(CHILD->ID) == ID)                             \
-                       break;                                   \
-               if (ntohl(CHILD->ID) < ID) {                            \
-                       lo = cur + 1;                            \
-                       if (hi > cur + (ID - ntohl(CHILD->ID)) + 1)     \
-                               hi = cur + (ID - ntohl(CHILD->ID)) + 1; \
-                       dir = 1;                                 \
-               } else {                                         \
-                       hi = cur;                                \
-                       dir = -1;                                \
-               }                                                \
-               if (lo >= hi)                                    \
-                       return (NULL);                           \
-               if (hi - lo == 1)                                \
-                       cur += dir;                              \
-               else                                             \
-                       cur += ((hi - lo) / 2) * dir;            \
-       }                                                        \
-}
-
-static MCSetT *
-MCGetSet(MCCatT *cat, int setId)
-{
-       MCSetT  *set;
-       int32_t    lo, hi, cur, dir;
-
-       if (cat == NULL || setId <= 0)
-               return (NULL);
-       LOOKUP(cat, set, setId, cat->numSets, sets);
-       if (set->invalid && loadSet(cat, set) <= 0)
-               return (NULL);
-       return (set);
-}
-
-static MCMsgT *
-MCGetMsg(MCSetT *set, int msgId)
-{
-       MCMsgT  *msg;
-       int32_t    lo, hi, cur, dir;
-
-       if (set == NULL || set->invalid || msgId <= 0)
-               return (NULL);
-       LOOKUP(set, msg, msgId, ntohl(set->numMsgs), u.msgs);
-       return (msg);
-}
-
-char *
-catgets(nl_catd catd, int setId, int msgId, __const char *dflt)
-{
-       MCMsgT          *msg;
-       MCCatT          *cat = (MCCatT *)catd;
-       __const char    *cptr;
-
-       if (catd == NULL || catd == NLERR)
-               return ((char *)dflt);
-       msg = MCGetMsg(MCGetSet(cat, setId), msgId);
-       if (msg != NULL)
-               cptr = msg->msg.str;
-       else
-               cptr = dflt;
-       return ((char *)cptr);
-}
-
-int
-catclose(nl_catd catd)
-{
-       MCCatT  *cat = (MCCatT *)catd;
-
-       if (catd == NULL || catd == NLERR) {
-               errno = EBADF;
-               return (-1);
-       }
-
-       (void)fclose(cat->fp);
-       __nls_free_resources(cat, cat->numSets);
-       free(cat);
-       return (0);
-}
-
-/*
- * Internal routines
- */
-
-/* Note that only malloc failures are allowed to return an error */
-static char     *_errowner = "Message Catalog System";
-
-#define CORRUPT() {                                            \
-       (void)fclose(cat->fp);                                 \
-       (void)fprintf(stderr, "%s: corrupt file.", _errowner); \
-       free(cat);                                             \
-       NLRETERR(EFTYPE);                                      \
-}
-
-#define NOSPACE() {                                              \
-       saverr = errno;                                          \
-       (void)fclose(cat->fp);                                   \
-       (void)fprintf(stderr, "%s: no more memory.", _errowner); \
-       free(cat);                                               \
-       errno = saverr;                                          \
-       return (NLERR);                                          \
-}
-
-static void
-__nls_free_resources(MCCatT *cat, int i)
-{
-       MCSetT  *set;
-       int     j;
-
-       for (j = 0; j < i; j++) {
-               set = cat->sets + j;
-               if (!set->invalid) {
-                       free(set->data.str);
-                       free(set->u.msgs);
-               }
-       }
-       free(cat->sets);
-}
-
-static nl_catd
-loadCat(__const char *catpath)
-{
-       MCHeaderT       header;
-       MCCatT          *cat;
-       MCSetT          *set;
-       int32_t         i;
-       off_t           nextSet;
-       int             saverr;
-
-       if ((cat = (MCCatT *)malloc(sizeof(MCCatT))) == NULL)
-               return (NLERR);
-
-       if ((cat->fp = fopen(catpath, "r")) == NULL) {
-               saverr = errno;
-               free(cat);
-               errno = saverr;
-               return (NLERR);
-       }
-       (void)_fcntl(fileno(cat->fp), F_SETFD, FD_CLOEXEC);
-
-       if (fread(&header, sizeof(header), 1, cat->fp) != 1 ||
-           strncmp(header.magic, MCMagic, MCMagicLen) != 0)
-               CORRUPT();
-
-       if (ntohl(header.majorVer) != MCMajorVer) {
-               (void)fclose(cat->fp);
-               free(cat);
-               if (OSSwapInt32(ntohl(header.majorVer)) == MCMajorVer) {
-                   (void)fprintf(stderr, "%s: %s is the wrong byte ordering.\n", _errowner, catpath);
-               } else {
-                   (void)fprintf(stderr, "%s: %s is version %d, we need %d.\n", _errowner, catpath, (int)ntohl(header.majorVer), MCMajorVer);
-               }
-               NLRETERR(EFTYPE);
-       }
-       if (ntohl(header.numSets) <= 0) {
-               (void)fclose(cat->fp);
-               free(cat);
-               (void)fprintf(stderr, "%s: %s has %d sets!\n",
-                   _errowner, catpath, (int)ntohl(header.numSets));
-               NLRETERR(EFTYPE);
-       }
-
-       cat->numSets = ntohl(header.numSets);
-       if ((cat->sets = (MCSetT *)malloc(sizeof(MCSetT) * cat->numSets)) ==
-           NULL)
-               NOSPACE();
-
-       nextSet = ntohll(header.firstSet);
-       for (i = 0; i < cat->numSets; ++i) {
-               if (fseeko(cat->fp, nextSet, SEEK_SET) == -1) {
-                       __nls_free_resources(cat, i);
-                       CORRUPT();
-               }
-
-               /* read in the set header */
-               set = cat->sets + i;
-               if (fread(set, sizeof(*set), 1, cat->fp) != 1) {
-                       __nls_free_resources(cat, i);
-                       CORRUPT();
-               }
-
-               /* if it's invalid, skip over it (and backup 'i') */
-               if (set->invalid) {
-                       --i;
-                       nextSet = ntohll(set->nextSet);
-                       continue;
-               }
-               set->invalid = TRUE;
-               nextSet = ntohll(set->nextSet);
-       }
-
-       return ((nl_catd) cat);
-}
-
-static int
-loadSet(MCCatT *cat, MCSetT *set)
-{
-       MCMsgT  *msg;
-       int     i;
-       int     saverr;
-
-       /* Get the data */
-       if (fseeko(cat->fp, ntohll(set->data.off), SEEK_SET) == -1)
-               return (0);
-       if ((set->data.str = malloc(ntohl(set->dataLen))) == NULL)
-               return (-1);
-       if (fread(set->data.str, ntohl(set->dataLen), 1, cat->fp) != 1) {
-               saverr = errno;
-               free(set->data.str);
-               errno = saverr;
-               return (0);
-       }
-
-       /* Get the messages */
-       if (fseeko(cat->fp, ntohll(set->u.firstMsg), SEEK_SET) == -1) {
-               saverr = errno;
-               free(set->data.str);
-               errno = saverr;
-               return (0);
-       }
-       if ((set->u.msgs = (MCMsgT *)malloc(sizeof(MCMsgT) * ntohl(set->numMsgs))) ==
-           NULL) {
-               saverr = errno;
-               free(set->data.str);
-               errno = saverr;
-               return (-1);
-       }
-
-       for (i = 0; i < ntohl(set->numMsgs); ++i) {
-               msg = set->u.msgs + i;
-               if (fread(msg, sizeof(*msg), 1, cat->fp) != 1) {
-                       saverr = errno;
-                       free(set->u.msgs);
-                       free(set->data.str);
-                       errno = saverr;
-                       return (0);
-               }
-               if (msg->invalid) {
-                       --i;
-                       continue;
-               }
-               msg->msg.str = (char *)(set->data.str + ntohll(msg->msg.off));
-       }
-       set->invalid = FALSE;
-       return (1);
-}
diff --git a/nls/msgcat.h b/nls/msgcat.h
deleted file mode 100644 (file)
index 1e9f1a0..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $FreeBSD: src/lib/libc/nls/msgcat.h,v 1.9 2005/02/01 16:04:55 phantom Exp $ */
-
-#ifndef _MSGCAT_H_
-#define _MSGCAT_H_
-
-
-/***********************************************************
-Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that Alfalfa's name not be used in
-advertising or publicity pertaining to distribution of the software
-without specific, written prior permission.
-
-ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-If you make any modifications, bugfixes or other changes to this software
-we'd appreciate it if you could send a copy to us so we can keep things
-up-to-date.  Many thanks.
-                               Kee Hinckley
-                               Alfalfa Software, Inc.
-                               267 Allston St., #3
-                               Cambridge, MA 02139  USA
-                               nazgul@alfalfa.com
-
-******************************************************************/
-
-/*
- * Magic definitions
- */
-
-#define MCMagicLen     8
-#define MCMagic                "*nazgul*"
-
-#define MCMajorVer     1
-#define MCMinorVer     0
-
-/* For or'd constants */
-#define MCMakeId(s,m)          (u_int32_t) ( ((unsigned short)s << (sizeof(short)*8)) \
-                                                | (unsigned short)m )
-
-
-/*
- * Critical note here.  Sets and Messages *MUST* be stored in ascending
- * order.  There are stored that way (by specification) in the original
- * data file, however in the process of merging in new stuff you might
- * mix that up.  Don't!  The catget stuff does a binary search and will
- * totally lose it if these aren't in order (not contiguous mind you, just
- * in order.  If this turns out to be a major problem this could be enhanced
- * by adding a 'sorted' flag to the db, and sorting msgs and sets at load
- * time if things aren't sorted, but I'd like not to have to do that.
- */
-
-/*
- * I have tried here to define data structures which can be used
- * while the catalog is on disk, and at runtime.
- * This is rather dangerous of course, but I think it can be done without
- * overly increasing the memory usage, and it makes loading and storing
- * somewhat simpler and less prone to accidents.  I have also tried to
- * define on disk data structures which can be updated in place, so that
- * with a very large catalog (e.g. all system errors) you don't have to
- * load everything in memory in order to add or update one set.  With
- * this in mind there are "invalid" flags which allow items to be
- * invalidated and thus not loaded at runtime.  Note however that although
- * I pay attention to these when I load the DB, I do not currently use
- * them in gencat (it just reads everything into memory), so there is
- * no guarantee that this will all work.
- */
-
-/*
- * MCOffsetT - Union to handle both disk and runtime pointers
- */
-typedef union {
-    off_t      off;
-    char       *str;
-    void       *ptr;
-    struct _MCMsgT     *msg;
-    struct _MCSetT     *set;
-} MCOffsetT;
-
-#ifdef __LP64__
-#pragma pack(4)
-#endif /* __LP64__ */
-/*
- * MCMsgT - Message structure (disk and runtime)
- */
-typedef struct _MCMsgT {
-    int32_t    msgId;          /* Id of this message */
-    MCOffsetT  msg;            /* Relative offset on disk or pointer in memory */
-    int32_t    invalid;        /* Valid on disk, loaded in memory */
-} MCMsgT;
-
-/*
- * MCSetT - Set structure (disk and runtime)
- */
-typedef struct _MCSetT {
-    int32_t    setId;          /* Id of this set */
-    off_t      nextSet;        /* Offset of next set on disk */
-    union {
-       off_t   firstMsg;       /* Offset to first Msg (while on disk) */
-       MCMsgT  *msgs;          /* Pointer to array of msgs (in mem, loaded) */
-    } u;
-    MCOffsetT  data;           /* Offset to data, or pointer to data */
-    int32_t    dataLen;        /* Length of data area on disk */
-    int32_t    numMsgs;        /* Number of messages */
-    int32_t    invalid;        /* Valid on disk, loaded in memory */
-} MCSetT;
-#ifdef __LP64__
-#pragma pack()
-#endif /* __LP64__ */
-
-/*
- * MCCatT - Runtime catalog pointer
- */
-typedef struct {
-    FILE        *fp;            /* File descriptor of catalog (if load-on-demand) */
-    int32_t    numSets;        /* Number of sets */
-    MCSetT     *sets;          /* Pointer to the sets */
-    off_t      firstSet;       /* Offset of first set on disk */
-} MCCatT;
-
-/*
- * MCHeaderT - Disk file header
- */
-typedef struct {
-    char       magic[MCMagicLen];      /* Magic cookie "*nazgul*" */
-    int32_t    majorVer;               /* ++ on incompatible changes */
-    int32_t    minorVer;               /* ++ on compatible changes */
-    int32_t    flags;                  /* Informational flags */
-    int32_t    numSets;                /* Number of valid Sets */
-    off_t      firstSet;               /* Offset of first set on disk */
-} MCHeaderT;
-
-/* Some flags */
-#define MC68KByteOrder 0x01
-#define MCn86ByteOrder 0x02
-
-#endif /* !_MSGCAT_H_ */
diff --git a/patchHeaders b/patchHeaders
deleted file mode 100755 (executable)
index 603693d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
-#
-# @APPLE_LICENSE_HEADER_START@
-# 
-# This file contains Original Code and/or Modifications of Original Code
-# as defined in and that are subject to the Apple Public Source License
-# Version 2.0 (the 'License'). You may not use this file except in
-# compliance with the License. Please obtain a copy of the License at
-# http://www.opensource.apple.com/apsl/ and read it before using this
-# file.
-# 
-# The Original Code and all software distributed under the License are
-# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
-# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
-# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
-# Please see the License for the specific language governing rights and
-# limitations under the License.
-# 
-# @APPLE_LICENSE_HEADER_END@
-#
-# patchheaders srcdir destdir
-#
-# The last path component of srcdir is replicated in destdir, with the
-# __DARWIN_ALIAS* and __DARWIN_EXTSN macro wrapped so that Libc can set
-# the symbol decoration independently:
-#
-#   #ifndef LIBC_ALIAS_FOO
-#   int foo(int) __DARWIN_ALIAS(foo);
-#   #else /* LIBC_ALIAS_FOO */
-#   int foo(int) LIBC_ALIAS(foo);
-#   #endif /* !LIBC_ALIAS_FOO */
-
-use strict;
-use IO::File;
-use File::Basename ();
-use File::Find ();
-use File::Path ();
-use File::Spec;
-
-my $MyName = File::Basename::basename($0);
-my $dest;
-
-sub process {
-    my($path, $file) = @_;
-    local $_;
-    my $p = IO::File->new($path, 'r');
-    die "$MyName: Can't open $path: $!\n" unless defined($p);
-    my $f = IO::File->new($file, 'w');
-    die "$MyName: Can't open $file: $!\n" unless defined($f);
-    my @save;
-    while(<$p>) {
-       if(/^\S/ or /^\s*$/) {
-           my $n = scalar(@save);
-           my $sym;
-           if($n > 0) {
-               my($sym) = ($save[$n - 1] =~ /__DARWIN_(?:10\d+|ALIAS|EXTSN|INODE64)[^(]*\(([^)]*)\)/);
-               if(defined($sym)) {
-                   if(defined($path)) {
-                       print "  $path\n";
-                       undef($path);
-                   }
-                   $sym =~ s/^\s+//;
-                   $sym =~ s/\s+$//;
-                   $sym =~ tr/a-z/A-Z/;
-                   $f->print("#ifndef LIBC_ALIAS_$sym\n");
-               }
-               $f->print(@save);
-               if(defined($sym)) {
-                   $save[$n - 1] =~ s/__DARWIN_(10\d+|ALIAS|EXTSN|INODE64)/LIBC_$1/;
-                   $f->print("#else /* LIBC_ALIAS_$sym */\n");
-                   $f->print(@save);
-                   $f->print("#endif /* !LIBC_ALIAS_$sym */\n");
-               }
-           }
-           if(/^#/) {
-               $f->print($_);
-               @save = ();
-           } else {
-               @save = ($_);
-           }
-       } else {
-           push(@save, $_);
-       }
-    }
-    $f->print(@save);
-}
-
-sub usage {
-    die "Usage: $MyName srcdir dstdir\n";
-}
-
-sub wanted {
-    if(-d $File::Find::name) {
-       #print "DIR: $File::Find::name\n";
-       my $dir = File::Spec->join($dest, $File::Find::name);
-       File::Path::mkpath($dir, 0, 0755);
-    } else {
-       #print "FIL: $File::Find::name\n";
-       my $file = File::Spec->join($dest, $File::Find::name);
-       process($File::Find::name, $file);
-    }
-}
-
-usage() unless scalar(@ARGV) == 2;
-my $start = File::Basename::dirname($ARGV[0]);
-chdir($start) || die "$MyName: chdir($start): $!\n";
-$dest = $ARGV[1];
-File::Path::mkpath($dest, 0, 0755);
-File::Find::find({wanted => \&wanted, no_chdir => 1}, File::Basename::basename($ARGV[0]));
diff --git a/posix1e/Makefile.inc b/posix1e/Makefile.inc
deleted file mode 100644 (file)
index da2d99a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-.PATH: ${.CURDIR}/posix1e
-
-MISRCS+= acl.c                         \
-        acl_entry.c                    \
-        acl_file.c                     \
-        acl_flag.c                     \
-        acl_perm.c                     \
-        acl_translate.c                
-
-.if ${LIB} == "c"
-
-MAN3 +=        acl.3                           \
-       acl_add_flag_np.3               \
-       acl_add_perm.3                  \
-       acl_clear_flags_np.3            \
-       acl_clear_perms.3               \
-       acl_copy_entry.3                \
-       acl_copy_ext.3                  \
-       acl_create_entry.3              \
-       acl_delete_entry.3              \
-       acl_delete_flag_np.3            \
-       acl_delete_perm.3               \
-       acl_dup.3                       \
-       acl_free.3                      \
-       acl_from_text.3                 \
-       acl_get.3                       \
-       acl_get_entry.3                 \
-       acl_get_flagset_np.3            \
-       acl_get_permset.3               \
-       acl_get_permset_mask_np.3       \
-       acl_get_perm_np.3               \
-       acl_get_qualifier.3             \
-       acl_get_tag_type.3              \
-       acl_init.3                      \
-       acl_set.3                       \
-       acl_set_flagset_np.3            \
-       acl_set_permset.3               \
-       acl_set_qualifier.3             \
-       acl_set_tag_type.3              \
-       acl_to_text.3                   \
-       acl_valid.3
-
-MLINKS+= acl.3 posix1e.3
-
-MLINKS+= acl_copy_ext.3 acl_copy_ext_native.3 \
-         acl_copy_ext.3 acl_copy_int.3 \
-         acl_copy_ext.3 acl_copy_int_native.3 \
-         acl_copy_ext.3 acl_size.3
-
-MLINKS+= acl_create_entry.3 acl_create_entry_np.3
-
-#MLINKS+= acl_delete.3 acl_delete_fd_np.3              \
-#         acl_delete.3 acl_delete_file_np.3            \
-#         acl_delete.3 acl_delete_link_np.3
-
-MLINKS+= acl_get.3 acl_get_fd.3                                \
-         acl_get.3 acl_get_fd_np.3                     \
-         acl_get.3 acl_get_file.3                      \
-         acl_get.3 acl_get_link_np.3
-
-MLINKS+= acl_get_permset_mask_np.3 acl_set_permset_mask_np.3 \
-         acl_get_permset_mask_np.3 acl_maximal_permset_mask_np.3
-
-MLINKS+= acl_set.3 acl_set_fd.3                                \
-         acl_set.3 acl_set_fd_np.3                     \
-         acl_set.3 acl_set_file.3                      \
-         acl_set.3 acl_set_link_np.3
-        
-
-MLINKS+= acl_valid.3 acl_valid_fd_np.3                 \
-         acl_valid.3 acl_valid_file_np.3               \
-         acl_valid.3 acl_valid_link_np.3
-
-.endif
index 41bbe21b168e410660a7e06d70a154a245b77c07..527f686b3d03297bca77731d02820c2f713c32b7 100644 (file)
@@ -443,7 +443,7 @@ acl_from_text(const char *buf_p)
        /* field 2: <uuid> */
        if ((field = strsep(&entry, ":")) != NULL && *field)
        {
-           mbr_string_to_uuid(field, *uu);
+           uuid_parse(field, *uu);
            need_tag = 0;
        }
 
diff --git a/ppc/gen/Makefile.inc b/ppc/gen/Makefile.inc
deleted file mode 100644 (file)
index 4c17c1c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-.PATH: ${.CURDIR}/ppc/gen
-
-MDSRCS +=      \
-     abs.s     \
-     fp.h      \
-     icacheinval.s \
-     mcount.s  \
-     setjmperr.c \
-     _ctx_start.S \
-     getcontext.S \
-     getmcontext.c \
-     makecontext.c \
-     _setcontext.S \
-     setcontext.c \
-     swapcontext.c
-
-SUPPRESSSRCS += memcpy.c memmove.c memset.c
-
-# makecontext.c can only compile with __DARWIN_UNIX03=0 because the structure
-# field names are renamed with __ prefix when __DARWIN_UNIX03=1.  If
-# makecontext.c ever needs to build variant, this will have to be fix properly
-CFLAGS-makecontext.c = -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0
diff --git a/ppc/gen/_ctx_start.S b/ppc/gen/_ctx_start.S
deleted file mode 100644 (file)
index 76e6a0a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/*
- * Copyright (c) 2004 Suleiman Souhlal
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(__ppc__)
-
-#include <architecture/ppc/asm_help.h>
-
-TEXT
-LABEL(__ctx_start)
-       mtlr  r14
-       blrl                    /* branch to start function */
-       mr     r3, r15          /* pass pointer to ucontext as argument */
-       BRANCH_EXTERN(__ctx_done) /* branch to ctxt completion func */
-       trap                    /* should never get here */
-
-#endif /* __ppc__ */
diff --git a/ppc/gen/_setcontext.S b/ppc/gen/_setcontext.S
deleted file mode 100644 (file)
index ca06fb5..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#if defined(__ppc__)
-
-#include <architecture/ppc/asm_help.h>
-
-TEXT
-LABEL(__setcontext)
-       mr  r31, r3                     /* save ucontext across call */
-       lwz  r3, 4(r3)                  /* load up signal mask */
-       CALL_EXTERN(_sigsetmask)        /* set signal mask */
-       mr   r3, r31                    /* restore ucontext */
-       lwz  r3,  28(r3)                /* load up mcontext */
-       lwz  r1,  44(r3)                /* start restoring regs */
-       lwz  r2,  48(r3) 
-       lwz  r4,  56(r3) 
-       lwz  r5,  60(r3) 
-       lwz  r6,  64(r3) 
-       lwz  r7,  68(r3) 
-       lwz  r8,  72(r3) 
-       lwz  r9,  76(r3) 
-       lwz r10,  80(r3) 
-       lwz r11,  84(r3) 
-       lwz r12,  88(r3) 
-       lwz r13,  92(r3)
-       lwz r14,  96(r3)
-       lwz r15, 100(r3)
-       lwz r16, 104(r3)
-       lwz r17, 108(r3)
-       lwz r18, 112(r3)
-       lwz r19, 116(r3)
-       lwz r20, 120(r3)
-       lwz r21, 124(r3)
-       lwz r22, 128(r3)
-       lwz r23, 132(r3)
-       lwz r24, 136(r3)
-       lwz r25, 140(r3)
-       lwz r26, 144(r3)
-       lwz r27, 148(r3)
-       lwz r28, 152(r3)
-       lwz r29, 156(r3)
-       lwz r30, 160(r3)
-       lwz r31, 164(r3)
-       lwz  r0, 168(r3)                /* only restore non-vol CR's */
-       mtcrf 0x20, r0
-       mtcrf 0x10, r0
-       mtcrf 0x08, r0
-       lwz  r0, 176(r3)
-       mtlr r0
-       lwz  r0, 32(r3)
-       mtctr r0
-       lwz  r3, 52(r3)                 /* restore r3 last */
-       bctrl
-
-#endif /* __ppc__ */
diff --git a/ppc/gen/abs.s b/ppc/gen/abs.s
deleted file mode 100644 (file)
index d9c94e1..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright (c) 1992,1997 NeXT Software, Inc.  All rights reserved.
- *
- *     File:   libc/gen/ppc/abs.s
- *     Author: Derek B Clegg, NeXT Software, Inc.
- *
- * HISTORY
- *  24-Jan-1997 Umesh Vaishampayan (umeshv@NeXT.com)
- *     Ported to PPC.
- *  10-Nov-92  Derek B Clegg (dclegg@next.com)
- *     Created.
- *  13-Jan-93  Derek B Clegg (dclegg@next.com)
- *      Optimized.
- *
- * ANSI X3.159-1989:
- *   int abs(int j);
- *
- * Description:
- *   The `abs' function computes the absolute value of an integer `j'.
- *   If the result cannot be represented, the behavior is undefined.
- * Returns:
- *   The `abs' function returns the absolute value.
- */
-#include <architecture/ppc/asm_help.h>
-#include <architecture/ppc/pseudo_inst.h>
-
-/* We calculate abs(x) as
- *   s = x >> 31;
- *   y = x + s;
- *   return y ^ s;
- *
- * If x >= 0, then s = 0, so clearly we return x.  On the other hand, if
- * x < 0, then we may write x as ~z + 1, where z = -x.  In this case,
- * s = -1, so y = x - 1 = ~z, and hence we return -1 ^ (x - 1) = -1 ^ ~z
- * = z = -x.
- */
-LEAF(_abs)
-       srawi   a1,a0,31
-       add     a2,a1,a0
-       xor     a0,a2,a1
-       blr
-END(_abs)
diff --git a/ppc/gen/assymdefs.c b/ppc/gen/assymdefs.c
deleted file mode 100644 (file)
index 52e75f2..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * assymdefs.c -- list of symbols to #define in assym.h
- */
-#import        <bsd/ppc/setjmp.h>
-#define        __TARGET_ARCHITECTURE__ "ppc"
-#import <signal.h>
-#import <assert.h>
-#import <bsd/stddef.h>
-#import        "genassym.h"
-
-void
-assymdefs(void)
-{
-    /* This is required for `setjmp' to work. */
-    assert(offsetof(struct _jmp_buf, csr[18])
-          == offsetof(struct _jmp_buf, fp));
-
-    comment(MAJOR, "Structure Offsets");
-    comment(MINOR, "jmpbuf_t offsets and constants");
-
-    PRINT_OFFSET(struct _jmp_buf *, magic);
-    PRINT_OFFSET(struct _jmp_buf *, sp);
-    PRINT_OFFSET(struct _jmp_buf *, csr[0]);
-    PRINT_OFFSET(struct _jmp_buf *, csr[17]);
-    PRINT_OFFSET(struct _jmp_buf *, fp);
-    PRINT_OFFSET(struct _jmp_buf *, toc);
-    PRINT_OFFSET(struct _jmp_buf *, cr);
-    PRINT_OFFSET(struct _jmp_buf *, lr);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[0]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[1]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[2]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[3]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[4]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[5]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[6]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[7]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[8]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[9]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[10]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[11]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[12]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[13]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[14]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[15]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[16]);
-    PRINT_OFFSET(struct _jmp_buf *, fpr[17]);
-    PRINT_OFFSET(struct _jmp_buf *, fpscr);
-    PRINT_OFFSET(struct _jmp_buf *, sig_onstack);
-    PRINT_OFFSET(struct _jmp_buf *, sig_mask);
-    PRINT_CONSTANT(_JMP_BUF_MAGICNUM);
-    
-    comment(MINOR, "sigcontext offsets, sizes, and constants");
-    PRINT_SIZEOF(struct sigcontext);
-    PRINT_OFFSET(struct sigcontext *, sc_onstack);
-    PRINT_OFFSET(struct sigcontext *, sc_mask);
-    PRINT_OFFSET(struct sigcontext *, sc_sp);
-    PRINT_OFFSET(struct sigcontext *, sc_cia);
-    PRINT_OFFSET(struct sigcontext *, sc_regs_saved);
-    PRINT_OFFSET(struct sigcontext *, sc_a0);
-    PRINT_ENUM(REGS_SAVED_NONE);
-    
-    comment(MINOR, "struct sigstack offsets and sizes");
-    PRINT_SIZEOF(struct sigstack);
-    PRINT_OFFSET(struct sigstack *, ss_sp);
-    PRINT_OFFSET(struct sigstack *, ss_onstack);
-}
diff --git a/ppc/gen/fp.h b/ppc/gen/fp.h
deleted file mode 100644 (file)
index 8464507..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright (c) 1992, NeXT Computer, Inc.  All rights reserved.
- *
- *     File:   libc/m98k/gen/fp.h
- *     Author: Derek B Clegg, NeXT Computer, Inc.
- *
- * HISTORY
- *  11-Nov-92  Derek B Clegg (dclegg@next.com)
- *     Created.
- *
- * Common definitions for floating-point numbers.
- */
-
-/* The following definitions for for double precision IEEE format numbers. */
-
-#define EXPONENT_BIAS 1023
-
-#define SIGN_BITS 1
-#define EXPONENT_BITS 11
-#define FRACTION_BITS 52
-#define HI_FRACTION_BITS 20
-#define LO_FRACTION_BITS 32
-
-struct double_format {
-    unsigned sign: SIGN_BITS;
-    unsigned exponent: EXPONENT_BITS;
-    unsigned hi_fraction: HI_FRACTION_BITS;
-    unsigned lo_fraction: LO_FRACTION_BITS;
-};
-
-union dbl {
-    struct double_format s;
-    unsigned int u[2];
-    double value;
-};
-
-#define PlusInfinity   (1.0/0.0)
-#define MinusInfinity  (-1.0/0.0)
-
-#define not_a_number(x)                ((x) != (x))
-#define positive_infinity(x)   ((x) == PlusInfinity)
-#define negative_infinity(x)   ((x) == MinusInfinity)
diff --git a/ppc/gen/genassym.c b/ppc/gen/genassym.c
deleted file mode 100644 (file)
index ac6afca..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#import <stdio.h>
-#import <ctype.h>
-#import        <libc.h>
-#import <ansi/string.h>
-
-#import        "genassym.h"
-
-#define        NAME_LEN        30
-
-char *progname;
-
-unsigned bit_num(char *reg_type, char *field, unsigned bits)
-{
-       unsigned bit;
-       unsigned mask;
-       
-       for (bit = 0, mask = 0x1;
-         (mask & bits) == 0 && mask;
-         mask <<= 1, bit += 1)
-               continue;
-       if (mask)
-               return bit;
-       fprintf(stderr, "%s: Bad BIT_POS for %s.%s\n", progname,
-         reg_type, field);
-       exit(1);
-}
-
-unsigned field_width(char *reg_type, char *field, unsigned bits)
-{
-       unsigned width;
-
-       while (bits && (bits & 0x1) == 0)
-               bits >>= 1;
-       for (width = 0; (bits & 0x1) == 1; bits >>= 1, width += 1)
-               continue;
-       if (bits == 0 && width)
-               return width;
-       fprintf(stderr, "%s: Bad BIT_FIELD for %s.%s\n", progname,
-         reg_type, field);
-       exit(1);
-}
-
-unsigned log2(unsigned val, char *type)
-{
-       unsigned l2 = 0;
-
-       if (val == 0) {
-               fprintf(stderr, "log2: sizeof(%s) is zero!\n", type);
-               exit(1);
-       }
-       while ((val & 0x1) == 0) {
-               l2 += 1;
-               val >>= 1;
-       }
-       if (val != 0x1) {
-               fprintf(stderr, "log2: sizeof(%s) is not power of two!\n",
-                 type);
-               exit(1);
-       }
-       return l2;
-}
-
-const char *skip_white(const char *cp)
-{
-       while (*cp && isspace(*cp))
-               cp += 1;
-       return cp;
-}
-
-const char *strip_prefix(const char *cp, const char *prefix)
-{
-       int len;
-
-       cp = skip_white(cp);
-       len = strlen(prefix);
-       if (strncmp(cp, prefix, len) == 0 && isspace(*(cp+len)))
-               cp += len;
-       return cp;
-}
-
-void
-print_define(const char *prefix, const char *type_name, const char *field)
-{
-    const char *cp;
-    int col = 0;
-    
-    printf("#define\t");
-    if (prefix != NULL && *prefix != '\0') {
-       printf("%s", prefix);
-       col += strlen(prefix);
-    }
-    if (type_name != NULL && *type_name != '\0') {
-       cp = strip_prefix(type_name, "struct");
-       cp = strip_prefix(cp, "enum");
-       cp = skip_white(cp);
-       if (*cp != '\0' && col != 0) {
-           putchar('_');
-           col += 1;
-       }
-       for (; *cp != '\0'; cp++) {
-           if (isspace(*cp))
-               break;
-           if (*cp == '*')
-               break;
-           if (strncmp(cp, "_t", 2) == 0 && !isalnum(cp[2]))
-               break;
-           putchar(isalpha(*cp) ? toupper(*cp) : *cp);
-           col += 1;
-           
-       }
-    }
-    if (field != NULL && *field != '\0') {
-       if (col != 0) {
-           putchar('_');
-           col++;
-       }
-       for (cp = field; *cp != 0; cp++) {
-           if (*cp == '.')
-               putchar('_');
-           else if (*cp == '[')
-               putchar('_');
-           else if (*cp == ']')
-               continue;
-           else if (!isspace(*cp))
-               putchar(isalpha(*cp) ? toupper(*cp) : *cp);
-           col++;
-       }
-    }
-    if (col == 0) {
-       fprintf(stderr, "%s: Bad call to print_define\n", progname);
-       exit(1);
-    }
-    do {
-       putchar(' ');
-       col += 1;
-    } while (col < NAME_LEN);
-}
-
-void print_dec(int val)
-{
-       printf("%d\n", val);
-}
-
-void print_hex(unsigned val)
-{
-       printf("%#010x\n", val);
-}
-
-void print_str(const char *str)
-{
-       printf("%s\n", str);
-}
-
-void comment(cmt_level_t level, const char *cmt)
-{
-       switch (level) {
-       case MAJOR:
-               printf("\n\n");
-               printf("/*\n");
-               printf(" * %s\n", cmt);
-               printf(" */\n");
-               break;
-       case MINOR:
-               printf("\n");
-               printf("/* %s */\n", cmt);
-               printf("\n");
-               break;
-       default:
-               fprintf(stderr, "%s: Bad comment level\n", progname);
-               exit(1);
-       }
-}
-
-void main(int argc, char **argv)
-{
-       progname = argv[0];
-       
-       printf("/* assym.h -- generated by genassym */\n");
-       printf("/* DON'T EDIT THIS -- change assymdefs.c */\n");
-       
-       assymdefs();
-       
-       exit(0);
-}
diff --git a/ppc/gen/genassym.h b/ppc/gen/genassym.h
deleted file mode 100644 (file)
index 4097703..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * genassym.h -- macros of use with genassym.c and assymdefs.c
- */
-
-#import        <architecture/ppc/reg_help.h>
-#import        <architecture/ppc/macro_help.h>
-
-#define        PRINT_OFFSET(ptr_type, field)                                   \
-MACRO_BEGIN                                                            \
-       print_define("", #ptr_type, #field);                            \
-       print_hex((unsigned) &(((ptr_type)0)->field));                  \
-MACRO_END
-
-#define        PRINT_BIT_FIELD(reg_type, field)                                \
-MACRO_BEGIN                                                            \
-       reg_type __reg;                                                 \
-       CONTENTS(__reg) = 0;                                            \
-       __reg.field = (typeof (__reg.field)) -1;                        \
-       print_define("", #reg_type, #field);                            \
-       print_hex(CONTENTS(__reg));                                     \
-MACRO_END
-
-#define        PRINT_ENUM(item)                                                \
-MACRO_BEGIN                                                            \
-       print_define("", "", #item);                                    \
-       print_hex((unsigned)item);                                      \
-MACRO_END
-
-#define        PRINT_DEFINE(macro)                                             \
-MACRO_BEGIN                                                            \
-       print_define("", "", #macro);                                   \
-       print_str(STRINGIFY(macro));                                    \
-MACRO_END
-
-#define        PRINT_CONSTANT(macro)                                           \
-MACRO_BEGIN                                                            \
-       print_define("", "", #macro);                                   \
-       print_hex((unsigned)macro);                                     \
-MACRO_END
-
-#define        PRINT_REGADDR(macro)                                            \
-MACRO_BEGIN                                                            \
-       print_define("", "", #macro);                                   \
-       print_hex((unsigned) &macro);                                   \
-MACRO_END
-
-#define        PRINT_REG_PAIR(struct_ptr, name0, name1)                        \
-MACRO_BEGIN                                                            \
-       print_define("", #struct_ptr, #name0 "_" #name1);               \
-       print_hex((unsigned) &(((struct_ptr)0)->U_##name0##_##name1));  \
-MACRO_END
-
-#define        PRINT_BIT_POS(reg_type, field)                                  \
-MACRO_BEGIN                                                            \
-       reg_type __reg;                                                 \
-       CONTENTS(__reg) = 0;                                            \
-       __reg.field = 1;                                                \
-       print_define("", #reg_type, #field "_BIT");                     \
-       print_dec((int) bit_num(#reg_type, #field, CONTENTS(__reg)));   \
-MACRO_END
-
-#define        PRINT_FIELD_INFO(reg_type, field)                               \
-MACRO_BEGIN                                                            \
-       reg_type __reg;                                                 \
-       CONTENTS(__reg) = 0;                                            \
-       __reg.field = -1;                                               \
-       print_define("", #reg_type, #field "_OFF");                     \
-       print_dec((int) bit_num(#reg_type, #field, CONTENTS(__reg)));   \
-       print_define("", #reg_type, #field "_WIDTH");                   \
-       print_dec((int) field_width(#reg_type, #field, CONTENTS(__reg)));\
-MACRO_END
-
-#define        PRINT_L2_SIZE(type)                                             \
-MACRO_BEGIN                                                            \
-       print_define("L2_SIZEOF", #type, "");                           \
-       print_dec((int) log2(sizeof(type), #type));                     \
-MACRO_END
-
-#define        PRINT_SIZEOF(type)                                              \
-MACRO_BEGIN                                                            \
-       print_define("SIZEOF", #type, "");                              \
-       print_dec((int) sizeof(type));                                  \
-MACRO_END
-
-#define        PRINT_L2_CONSTANT(macro)                                        \
-MACRO_BEGIN                                                            \
-       print_define("L2", "", #macro);                                 \
-       print_dec((int) log2(macro, #macro));                           \
-MACRO_END
-
-typedef enum {
-       MAJOR, MINOR
-} cmt_level_t;
-
-extern void comment(cmt_level_t level, const char *cmt);
-extern void print_define(const char *prefix, const char *type_name,
- const char *field);
-extern void print_dec(int val);
-extern void print_hex(unsigned val);
-extern void print_str(const char *str);
-extern unsigned bit_num(char *reg_type, char *field, unsigned bits);
-extern unsigned field_width(char *reg_type, char *field, unsigned bits);
-extern unsigned log2(unsigned val, char *type);
-extern void assymdefs(void);
-
diff --git a/ppc/gen/getcontext.S b/ppc/gen/getcontext.S
deleted file mode 100644 (file)
index 81a76a9..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#if defined(__ppc__)
-
-#include <architecture/ppc/asm_help.h>
-
-TEXT
-LABEL(_getcontext)
-       mr   r4, r1
-        CALL_EXTERN(_getmcontext)
-       stw  r1,  44(r3)
-       stw  r2,  48(r3) 
-       stw r13,  92(r3)
-       stw r14,  96(r3)
-       stw r15, 100(r3)
-       stw r16, 104(r3)
-       stw r17, 108(r3)
-       stw r18, 112(r3)
-       stw r19, 116(r3)
-       stw r21, 124(r3)
-       stw r22, 128(r3)
-       stw r23, 132(r3)
-       stw r24, 136(r3)
-       stw r25, 140(r3)
-       stw r26, 144(r3)
-       stw r27, 148(r3)
-       stw r28, 152(r3)
-       stw r29, 156(r3)
-       stw r30, 160(r3)
-       stw r31, 164(r3)
-       mfcr r0
-       stw  r0, 168(r3)
-       mflr r4
-       stw  r4, 176(r3)
-       stw  r4,  32(r3)
-       li   r5, 0
-       stw  r5,  52(r3)
-        li   r3, 0
-        blr
-
-#endif /* __ppc__ */
diff --git a/ppc/gen/getmcontext.c b/ppc/gen/getmcontext.c
deleted file mode 100644 (file)
index ee90fe3..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2004, 2008 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#if defined(__ppc__)
-
-#define _XOPEN_SOURCE 600L
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-#include <signal.h>
-#include <ucontext.h>
-
-extern size_t pthread_get_stacksize_np(pthread_t);
-extern void *pthread_get_stackaddr_np(pthread_t);
-#ifdef __DYNAMIC__
-extern int __in_sigtramp;
-#endif /* __DYNAMIC_ */
-
-__private_extern__ mcontext_t
-getmcontext(ucontext_t *uctx, void *sp)
-{
-       pthread_t self = pthread_self();
-       mcontext_t mctx = (mcontext_t)&uctx->__mcontext_data;
-       size_t stacksize = pthread_get_stacksize_np(self);
-       stack_t stack;
-
-       uctx->uc_stack.ss_sp = sp;
-       uctx->uc_stack.ss_flags = 0;
-
-       if (0 == sigaltstack(NULL, &stack)) {
-               if (stack.ss_flags & SS_ONSTACK) {
-                       uctx->uc_stack = stack;
-                       stacksize = stack.ss_size;
-               }
-       }
-
-       if (stacksize == 0) {   /* main thread doesn't have pthread stack size */
-               struct rlimit rlim;
-               if (0 == getrlimit(RLIMIT_STACK, &rlim))
-                       stacksize = rlim.rlim_cur;
-       }
-
-       uctx->uc_stack.ss_size = stacksize;
-
-       if (uctx->uc_mcontext != mctx) {
-               uctx->uc_mcontext = mctx;
-
-#ifdef __DYNAMIC__
-               uctx->uc_link = (ucontext_t*)__in_sigtramp; /* non-zero if in signal handler */
-#else  /* !__DYNAMIC__ */
-               uctx->uc_link = 0;
-#endif /* __DYNAMIC__ */
-
-       }
-
-       sigprocmask(0, NULL, &uctx->uc_sigmask);
-       return mctx;
-}
-
-#endif /* __ppc__ */
diff --git a/ppc/gen/icacheinval.s b/ppc/gen/icacheinval.s
deleted file mode 100644 (file)
index d584a85..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2003-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <machine/cpu_capabilities.h>
-
-/* void sys_icache_invalidate(char *start, long len) */
-        
-        .text
-        .globl  _sys_icache_invalidate
-        .align 2
-_sys_icache_invalidate:
-        ba     _COMM_PAGE_FLUSH_ICACHE
-
-
-
-/* void sys_dcache_flush(char *start, long len) */
-        
-        .text
-        .globl  _sys_dcache_flush
-        .align 2
-_sys_dcache_flush:
-        ba     _COMM_PAGE_FLUSH_DCACHE
diff --git a/ppc/gen/makecontext.c b/ppc/gen/makecontext.c
deleted file mode 100644 (file)
index 32abbb2..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2004, 2009 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/*
- * Copyright (c) 2004 Suleiman Souhlal
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(__ppc__)
-
-#include <sys/cdefs.h>
-#include <sys/param.h>
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <ucontext.h>
-#include <unistd.h>
-
-void _ctx_done(ucontext_t *ucp);
-void _ctx_start(void);
-
-void
-_ctx_done(ucontext_t *ucp)
-{
-       if (ucp->uc_link == NULL)
-               exit(0);
-       else {
-               /* invalidate context */
-               ucp->uc_mcsize = 0;
-
-               setcontext((const ucontext_t *)ucp->uc_link);
-
-               LIBC_ABORT("setcontext failed"); /* should never return from above call */
-       }
-}
-
-void
-makecontext(ucontext_t *ucp, void (*start)(), int argc, ...)
-{
-       mcontext_t mc;
-       char *sp;
-       va_list ap;
-       int i, regargs, stackargs;
-       uint32_t args[8];
-
-       /* Sanity checks */
-       if ((ucp == NULL) || (argc < 0) || (argc > NCARGS)
-           || (ucp->uc_stack.ss_sp == NULL)
-           || (ucp->uc_stack.ss_size < 8192)) {
-               /* invalidate context */
-               ucp->uc_mcsize = 0;
-               return;
-       }
-
-       /*
-        * The stack must have space for the frame pointer, saved
-        * link register, overflow arguments, and be 16-byte
-        * aligned.
-        */
-       stackargs = (argc > 8) ? argc - 8 : 0;
-       sp = (char *) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size
-               - sizeof(uint32_t)*(stackargs + 2);
-       sp = (char *)((uint32_t)sp & ~0x1f);
-
-       mc = ucp->uc_mcontext;
-
-       /*
-        * Up to 8 register args. Assumes all args are 32-bit and
-        * integer only. Not sure how to cater for floating point,
-        * although 64-bit args will work if aligned correctly
-        * in the arg list.
-        */
-       regargs = (argc > 8) ? 8 : argc;
-       va_start(ap, argc);
-       for (i = 0; i < regargs; i++)
-               args[i] = va_arg(ap, uint32_t);
-
-       switch (regargs) {
-               /*
-                * Hi Tom!
-                */
-               case 8 : mc->ss.r10 = args[7];
-               case 7 : mc->ss.r9  = args[6];
-               case 6 : mc->ss.r8  = args[5];
-               case 5 : mc->ss.r7  = args[4];
-               case 4 : mc->ss.r6  = args[3];
-               case 3 : mc->ss.r5  = args[2];
-               case 2 : mc->ss.r4  = args[1];
-               case 1 : mc->ss.r3  = args[0];
-               default: break;
-       }
-
-       /*
-        * Overflow args go onto the stack
-        */
-       if (argc > 8) {
-               uint32_t *argp;
-
-               /* Skip past frame pointer and saved LR */
-               argp = (uint32_t *)sp + 2;
-
-               for (i = 0; i < stackargs; i++)
-                       *argp++ = va_arg(ap, uint32_t);
-       }
-       va_end(ap);
-
-       /*
-        * Use caller-saved regs 14/15 to hold params that _ctx_start
-        * will use to invoke the user-supplied func
-        */
-       mc->ss.srr0 = (uint32_t) _ctx_start;
-       mc->ss.r1   = (uint32_t) sp;    /* new stack pointer */
-       mc->ss.r14  = (uint32_t) start; /* r14 <- start */
-       mc->ss.r15  = (uint32_t) ucp;   /* r15 <- ucp */
-}
-
-#endif /* __ppc__ */
diff --git a/ppc/gen/mcount.s b/ppc/gen/mcount.s
deleted file mode 100644 (file)
index 3b0daaa..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright 1997 Apple Computer, Inc.
-**
-** 10 June 1997 - Created by mwatson@apple.com
-**
-*/
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-MI_ENTRY_POINT(mcount)
-        mflr    r0
-        stg     r0,SF_RETURN(r1)
-        stgu    r1,-SF_MINSIZE(r1)
-        mr      r4,r0               /* pass our return address as 2nd argument */
-        MI_CALL_EXTERNAL(_moncount)
-        addi    r1,r1,SF_MINSIZE
-        lg      r0,SF_RETURN(r1)
-        mtlr    r0
-        blr
-
diff --git a/ppc/gen/setcontext.c b/ppc/gen/setcontext.c
deleted file mode 100644 (file)
index 6b9db08..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#if defined(__ppc__)
-
-#define _XOPEN_SOURCE 600L
-
-#include <ucontext.h>
-
-extern int _setcontext(const ucontext_t *);
-
-int
-setcontext(const ucontext_t *uctx)
-{
-       mcontext_t mctx = (mcontext_t)&uctx->__mcontext_data;
-       ucontext_t *_uctx = (ucontext_t *)uctx;
-       if (mctx != _uctx->uc_mcontext)
-               _uctx->uc_mcontext = mctx;
-       return _setcontext(uctx);
-}
-
-#endif /* __ppc__ */
diff --git a/ppc/gen/setjmperr.c b/ppc/gen/setjmperr.c
deleted file mode 100644 (file)
index 24403f2..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- */
-
-#include <sys/types.h>
-#include <unistd.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setjmperr.c        5.2 (Berkeley) 3/9/86";
-#endif LIBC_SCCS and not lint
-
-#define ERRMSG "longjmp botch\n"
-
-/*
- * This routine is called from longjmp() when an error occurs.
- * Programs that wish to exit gracefully from this error may
- * write their own versions.
- * If this routine returns, the program is aborted.
- */
-void
-longjmperror(void)
-{
-    write(2, ERRMSG, sizeof(ERRMSG));
-}
diff --git a/ppc/gen/swapcontext.c b/ppc/gen/swapcontext.c
deleted file mode 100644 (file)
index 047bef1..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/*
- * Copyright (c) 2001 Daniel M. Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(__ppc__)
-
-#include <sys/cdefs.h>
-#include <sys/param.h>
-#include <sys/signal.h>
-#include <ucontext.h>
-
-#include <errno.h>
-#include <stddef.h>
-
-#define uc_flags uc_onstack
-#define UCF_SWAPPED 0x80000000
-
-int
-swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
-{
-       int ret;
-
-       if ((oucp == NULL) || (ucp == NULL)) {
-               errno = EINVAL;
-               return (-1);
-       }
-       oucp->uc_flags &= ~UCF_SWAPPED;
-       ret = getcontext(oucp);
-       if ((ret == 0) && !(oucp->uc_flags & UCF_SWAPPED)) {
-               oucp->uc_flags |= UCF_SWAPPED;
-               ret = setcontext(ucp);
-       }
-       return (ret);
-}
-
-#endif /* __ppc__ */
diff --git a/ppc/pthreads/Makefile.inc b/ppc/pthreads/Makefile.inc
deleted file mode 100644 (file)
index 0b7a3fc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.PATH: ${.CURDIR}/ppc/pthreads
-MDSRCS += \
-       init_cpu_capabilities.c \
-       get_cpu_capabilities.s \
-       pthread_set_self.s \
-       pthread_self.s \
-       pthread_getspecific.s
diff --git a/ppc/pthreads/get_cpu_capabilities.s b/ppc/pthreads/get_cpu_capabilities.s
deleted file mode 100644 (file)
index 2152993..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/* Get the cpu_capabilities bit vector out of the comm page */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-.text
-.align 2
-.private_extern __get_cpu_capabilities
-__get_cpu_capabilities:
-    lwz        r3, _COMM_PAGE_CPU_CAPABILITIES(0)
-       blr
diff --git a/ppc/pthreads/init_cpu_capabilities.c b/ppc/pthreads/init_cpu_capabilities.c
deleted file mode 100644 (file)
index d94a6da..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2003, 2008 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/* Initialize the "_cpu_capabilities" vector on PowerPC processors. */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-int _cpu_capabilities = 0;
-int _cpu_has_altivec = 0;              // DEPRECATED: use _cpu_capabilities instead
-
-extern int _get_cpu_capabilities(void);
-
-__private_extern__ void
-_init_cpu_capabilities( void )
-{
-       int temp = _get_cpu_capabilities();
-       _cpu_capabilities = temp;
-    
-       _cpu_has_altivec = (temp & kHasAltivec) ? 1 : 0;
-}
diff --git a/ppc/pthreads/pthread_getspecific.s b/ppc/pthreads/pthread_getspecific.s
deleted file mode 100644 (file)
index 41bb4f1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#include "pthread_machdep.h"
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-        .text
-        .align 4
-        .globl _pthread_getspecific
-_pthread_getspecific:
-        li     r4,_PTHREAD_TSD_OFFSET
-        ba     _COMM_PAGE_PTHREAD_GETSPECIFIC
diff --git a/ppc/pthreads/pthread_self.s b/ppc/pthreads/pthread_self.s
deleted file mode 100644 (file)
index a0c3748..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-        .text
-        .align 2
-        .globl _pthread_self
-_pthread_self:
-        ba     _COMM_PAGE_PTHREAD_SELF
diff --git a/ppc/pthreads/pthread_set_self.s b/ppc/pthreads/pthread_set_self.s
deleted file mode 100644 (file)
index 1396201..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-        .text
-        .align 2
-        .globl ___pthread_set_self
-___pthread_set_self:
-        li r0, 0x7FF1
-        sc
-        blr
diff --git a/ppc/stdlib/gdtoa.mk b/ppc/stdlib/gdtoa.mk
deleted file mode 100644 (file)
index 076c4cc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# Long double is head-tail pair of doubles
-GDTOA_FBSDSRCS+= gdtoa-strtopdd.c machdep_ldisdd.c
-MISRCS+= _ldbl_util.c
-
-CFLAGS-_ldbl_util.c += -I${.CURDIR}/fbsdcompat
-
-# also build a 64-bit long double version (ppc only)
-LDBLSRCS += machdep_ldisdd.c
diff --git a/ppc/string/Makefile.inc b/ppc/string/Makefile.inc
deleted file mode 100644 (file)
index 3b336bf..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# $Version$
-#
-# PPC-optimised string functions.
-#
-.PATH: ${.CURDIR}/ppc/string
-
-MDSRCS +=      \
-     bcopy.s   \
-     bzero.s   \
-     ffs.s     \
-     ffsl.s    \
-     fls.s     \
-     flsl.s    \
-     memset.s   \
-     memcmp.s  \
-     strcat.s  \
-     strcmp.s  \
-     strcpy.s  \
-     strlcat.s \
-     strlcpy.s \
-     strlen.s  \
-     strncat.s \
-     strncmp.s \
-     strncpy.s
-
-SUPPRESSSRCS += bcmp.c
-
diff --git a/ppc/string/bcopy.s b/ppc/string/bcopy.s
deleted file mode 100644 (file)
index df9de1a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
- // These functions have migrated to the comm page.
-        .text
-        .globl _bcopy
-        .globl _memcpy
-        .globl _memmove
-
-        .align         5
-_bcopy:                                                                // void bcopy(const void *src, void *dst, size_t len)
-        ba             _COMM_PAGE_BCOPY
-        
-        .align         5
-_memcpy:                                                       // void* memcpy(void *dst, void *src, size_t len)
-_memmove:                                                      // void* memmove(void *dst, const void *src, size_t len)
-        ba             _COMM_PAGE_MEMCPY
diff --git a/ppc/string/bzero.s b/ppc/string/bzero.s
deleted file mode 100644 (file)
index b8c2aba..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-        .text
-        .align 5
-        .globl _bzero
-        .globl ___bzero
-
-// *************
-// * B Z E R O *
-// *************
-//
-// This function has migrated to the commpage.
-
-_bzero:                                                // void bzero(void *b, size_t len);
-___bzero:
-        ba     _COMM_PAGE_BZERO
diff --git a/ppc/string/ffs.s b/ppc/string/ffs.s
deleted file mode 100644 (file)
index ece1d15..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright (c) 1992, 1997 NeXT Software, Inc.  All rights reserved.
- *
- *      File:  libc/gen/ppc/ffs.s
- *
- *      Find the first bit set (starting with the least significant bit).
- *
- * HISTORY
- *
- *  24-Jan-1997 Umesh Vaishampayan (umeshv@NeXT.com)
- *      Ported to PPC. 
- *
- *  19-Jan-1998 Matt Watson (mwatson@apple.com)
- *      Simplified
- *
- *  10-Mar-1998 Matt Watson (mwatson@apple.com)
- *      Correctified
- *
- */
-
-.text
-.align 2
-.globl _ffs
-_ffs:
-       neg    r0,r3
-       and    r3,r0,r3
-       cntlzw r3,r3
-       subfic r3,r3,32
-       blr
diff --git a/ppc/string/ffsl.s b/ppc/string/ffsl.s
deleted file mode 100644 (file)
index 7a6eae4..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright (c) 1992, 1997 NeXT Software, Inc.  All rights reserved.
- *
- *      File:  libc/gen/ppc/ffs.s
- *
- *      Find the first bit set (starting with the least significant bit).
- *
- * HISTORY
- *
- *  24-Jan-1997 Umesh Vaishampayan (umeshv@NeXT.com)
- *      Ported to PPC. 
- *
- *  19-Jan-1998 Matt Watson (mwatson@apple.com)
- *      Simplified
- *
- *  10-Mar-1998 Matt Watson (mwatson@apple.com)
- *      Correctified
- *
- *  14-Nov-2005 Edward Moy
- *      Convert ffs to ffsl
- *
- */
-
-#include <architecture/ppc/mode_independent_asm.h>
-
-.text
-.align 2
-.globl _ffsl
-_ffsl:
-       neg    r0,r3
-       and    r3,r0,r3
-       cntlzg r3,r3
-#ifdef __LP64__
-       subfic r3,r3,64
-#else /* !__LP64__ */
-       subfic r3,r3,32
-#endif /* __LP64__ */
-       blr
diff --git a/ppc/string/fls.s b/ppc/string/fls.s
deleted file mode 100644 (file)
index e37c085..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-.text
-.align 2
-.globl _fls
-_fls:
-       cntlzw r3,r3
-       subfic r3,r3,32
-       blr
diff --git a/ppc/string/flsl.s b/ppc/string/flsl.s
deleted file mode 100644 (file)
index 709a868..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <architecture/ppc/mode_independent_asm.h>
-
-.text
-.align 2
-.globl _flsl
-_flsl:
-       cntlzg r3,r3
-#ifdef __LP64__
-       subfic r3,r3,64
-#else /* !__LP64__ */
-       subfic r3,r3,32
-#endif /* __LP64__ */
-       blr
diff --git a/ppc/string/memcmp.s b/ppc/string/memcmp.s
deleted file mode 100644 (file)
index b98cbf2..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER               // we need the defs for cr7_eq etc
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// ***************     ***********
-// * M E M C M P * and * B C M P *
-// ***************     ***********
-//
-// int memcmp(const char *s1, const char *s2, size_t len);
-// int   bcmp(const char *s1, const char *s2, size_t len);
-//
-// Bcmp returns (+,0,-), whereas memcmp returns the true difference
-// between the first differing bytes, but we treat them identically.
-//
-// We optimize the compare by doing it word parallel.  This introduces
-// a complication: if we blindly did word loads from both sides until
-// finding a difference, we might get a spurious page fault by
-// reading bytes past the difference.  To avoid this, we never do a "lwz"
-// that crosses a page boundary.
-//
-// In 64-bit mode, this routine is doubleword parallel.
-
-        .text
-        .globl EXT(memcmp)
-        .globl EXT(bcmp)
-
-        .align         5
-LEXT(memcmp)                        // int memcmp(const char *s1,const char *s2,size_t len);
-LEXT(bcmp)                                                     // int   bcmp(const char *s1,const char *s2,size_t len);
-        cmplgi cr1,r5,2*GPR_BYTES  // is buffer too short to bother with parallel compares?
-        andi.  r0,r3,GPR_BYTES-1   // is LHS aligned?
-        blt            cr1,Lshort                      // short buffer, so just compare byte-by-byte
-        beq            Laligned                        // skip if aligned
-        subfic r0,r0,GPR_BYTES     // r0 <- #bytes to align LHS
-        mtctr  r0                                      // set up for byte loop
-        b              Lbyteloop
-        
-// Handle short buffer or end-of-buffer.
-//             r3 = LHS ptr (unaligned)
-//             r4 = RHS ptr (unaligned)
-//             r5 = length remaining in buffer (0..2*GPR_BYTES-1)
-
-Lshort:
-        cmpgi  r5,0                            // null buffer?
-        mtctr  r5                                      // assume not null, and set up for loop
-        bne     Lshortloop                     // buffer not null
-        li             r3,0                            // say "equal"
-        blr
-        
-        .align 5
-Lshortloop:
-        lbz            r7,0(r3)                        // next LHS byte
-        addi   r3,r3,1
-        lbz            r8,0(r4)                        // next RHS byte
-        addi   r4,r4,1
-        cmpw   r7,r8                           // compare the bytes
-        bdnzt  eq,Lshortloop           // loop if more to go and bytes are equal
-
-        sub            r3,r7,r8                        // generate return value
-        blr 
-
-// We're at a RHS page boundary.  Compare GPR_BYTES bytes in order to cross the
-// page but still keep the LHS ptr aligned.
-
-Lcrosspage:
-        cmplgi r5,2*GPR_BYTES      // enough bytes left to use parallel compares?
-        li             r0,GPR_BYTES        // get #bytes to cross RHS page
-        blt            Lshort                          // buffer is about to end
-        mtctr  r0
-        b              Lbyteloop
-        
-// Compare byte-by-byte.
-//             r3 = LHS ptr (unaligned)
-//             r4 = RHS ptr (unaligned)
-//             r5 = length remaining in buffer (must be >0)
-//        ctr = bytes to compare
-
-        .align 5
-Lbyteloop:
-        lbz            r7,0(r3)                        // next LHS byte
-        addi   r3,r3,1
-        lbz            r8,0(r4)                        // next RHS byte
-        addi   r4,r4,1
-        subi   r5,r5,1                         // decrement bytes remaining in buffer
-        cmpw   r7,r8                           // compare the bytes
-        bdnzt  eq,Lbyteloop            // loop if more to go and bytes are equal
-        
-        bne     Ldifferent                     // done if we found differing bytes
-                
-// LHS is now aligned.  Loop over words/doublewords until end of RHS page or buffer.
-// When we get to the end of the page, we compare 4/8 bytes, so that we keep
-// the LHS aligned.
-//             r3 = LHS ptr (aligned)
-//             r4 = RHS ptr (unaligned)
-//             r5 = length remaining in buffer (>= GPR_BYTES bytes)
-
-Laligned:
-        rlwinm r9,r4,0,0xFFF           // get RHS offset in page
-        subfic r0,r9,4096                      // get #bytes left in RHS page
-        subfc  r7,r0,r5                        // ***
-        subfe  r8,r5,r5                        // * r9 <- min(r0,r5),
-        and            r7,r7,r8                        // * using algorithm in Compiler Writer's Guide
-        add            r9,r0,r7                        // ***
-        srgi.  r8,r9,LOG2_GPR_BYTES// get #words/doublewords we can compare
-        clrrgi  r9,r9,LOG2_GPR_BYTES// get #bytes we will compare word-parallel
-        beq--  Lcrosspage                      // we're at a RHS page boundary
-        mtctr  r8                                      // set up loop count
-        sub            r5,r5,r9                        // decrement length remaining
-        b              Lwordloop
-        
-// Compare a word or doubleword at a time, until one of two conditions:
-//             - a difference is found
-//             - end of count (ie, end of buffer or RHS page, whichever is first)
-// At this point, registers are as follows:
-//             r3 = LHS ptr (aligned)
-//             r4 = RHS ptr (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//     ctr = count of word/doublewords until end of buffer or RHS page
-
-        .align 5                                       // align inner loop
-Lwordloop:
-        lg             r7,0(r3)                        // r7 <- next aligned LHS word or doubleword
-        addi   r3,r3,GPR_BYTES
-        lg             r8,0(r4)                        // r8 <- next unaligned RHS word or doubleword
-        addi   r4,r4,GPR_BYTES
-        xor.   r11,r7,r8                       // compare them
-        bdnzt  eq,Lwordloop            // loop if ctr!=0 and cr0_eq
-        
-        beq     Lcrosspage                     // skip if buffer or page end reached wo difference
-        
-// Found differing bytes.
-
-        cntlzg r0,r11                          // find 1st difference (r0 = 0..31 or 63)
-        rlwinm r9,r0,0,0x38            // byte align bit offset (r9 = 0,8,16, or 24 etc)
-        addi   r0,r9,8                         // now, r0 = 8, 16, 24, or 32 etc
-#if defined(__ppc__)
-        rlwnm  r7,r7,r0,24,31          // right justify differing bytes and mask off rest
-        rlwnm  r8,r8,r0,24,31
-#else
-        rldcl   r7,r7,r0,56         // right justify differing bytes and mask off rest
-        rldcl   r8,r8,r0,56
-#endif
-
-Ldifferent:                                                    // bytes in r7 and r8 differ
-        sub            r3,r7,r8                        // compute return value
-        blr
-                
diff --git a/ppc/string/memset.s b/ppc/string/memset.s
deleted file mode 100644 (file)
index 706167c..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <machine/cpu_capabilities.h>
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-        .text
-#define kShort  128             // threshold for calling commpage
-
-
-/* ***************
- * * M E M S E T *
- * ***************
- *
- * Registers we use:
- *      r3  = original ptr, not changed since memset returns it
- *      r4  = count of bytes to set
- *      r7  = value to set
- *      r8  = working operand ptr
- */
-        .globl _memset
-        .align 5
-_memset:                        // void *   memset(void *b, int c, size_t len);
-        andi.  r7,r4,0xFF      // copy value to working register, test for 0
-        mr     r4,r5           // move length to working register
-        cmplgi cr1,r5,kShort   // long enough to bother with _COMM_PAGE_MEMSET_PATTERN?
-        beqa++ _COMM_PAGE_BZERO    // if (c==0), map to bzero()
-        rlwimi r7,r7,8,16,23   // replicate nonzero value to low 2 bytes
-        neg    r5,r3           // start to compute #bytes to align
-        mr     r8,r3           // make working copy of operand ptr
-        rlwimi r7,r7,16,0,15   // value now in all 4 bytes
-        blt    cr1,Lmemset3    // too short to use commpage
-        andi.  r0,r5,0xF       // r0 <- #bytes to align on quadword
-        
-        // Align ptr and store enough so that we have an aligned 16-byte pattern.
-
-        stw     r7,0(r8)
-        stw     r7,4(r8)
-        stw     r7,8(r8)
-        stw     r7,12(r8)
-        beq     Lmemset1        // skip if (r0==0), ie if r8 is 16-byte aligned
-        add     r8,r8,r0        // 16-byte align ptr
-        sub     r4,r4,r0        // adjust length
-        stw     r7,0(r8)        // now we can store an aligned 16-byte pattern
-        stw     r7,4(r8)
-        stw     r7,8(r8)
-        stw     r7,12(r8)
-
-        // Call machine-specific commpage routine, which expects:
-        //      r4 = count (>=32)
-        //      r8 = ptr (16-byte aligned) to memory to store
-        //      r9 = ptr (16-byte aligned) to 16-byte pattern to store
-        // When it returns:
-        //      r3, r7, and r12 are preserved
-        //      r4 and r8 are updated to reflect a residual count of from 0..31 bytes
-        
-Lmemset1:
-        mflr    r12             // save return address
-        mr      r9,r8           // point to 16-byte-aligned 16-byte pattern
-        addi    r8,r8,16        // point to first unstored byte
-        subi    r4,r4,16        // account for the aligned bytes we have stored
-        bla    _COMM_PAGE_MEMSET_PATTERN
-        mtlr    r12
-
-        // Here for short nonzero memset.
-        //  r4 = count (<= kShort bytes)
-        //  r7 = pattern in all four bytes
-        //  r8 = ptr
-Lmemset3:
-        srgi.   r0,r4,4         // any 16-byte chunks?
-        mtcrf   0x01,r4         // move length remaining to cr7 so we can test bits
-        beq     Lmemset5        // fewer than 16 bytes
-        mtctr   r0
-        b       Lmemset4        // enter loop
-        
-        .align  5
-Lmemset4:                       // loop over 16-byte chunks
-        stw     r7,0(r8)
-        stw     r7,4(r8)
-        stw     r7,8(r8)
-        stw     r7,12(r8)
-        addi    r8,r8,16
-        bdnz++  Lmemset4
-        
-        // Handle last 0..15 bytes.
-Lmemset5:
-        bf      28,2f
-        stw     r7,0(r8)
-        stw     r7,4(r8)
-        addi    r8,r8,8
-2:
-        bf      29,3f
-        stw     r7,0(r8)
-        addi    r8,r8,4
-3:
-        bf      30,4f
-        sth     r7,0(r8)
-        addi    r8,r8,2
-4:
-        bflr    31
-        stb     r7,0(r8)
-        blr
-        
-
-/* ***********************************
- * * M E M S E T _ P A T T E R N 1 6 *
- * ***********************************
- *
- * Used to store a 16-byte pattern in memory:
- *
- *  void    memset_pattern16(void *b, const void *c16, size_t len);
- *
- * Where c16 points to the 16-byte pattern.  None of the parameters need be aligned.
- */
-
-        .globl _memset_pattern16
-        .align 5
-_memset_pattern16:
-        cmplgi  cr1,r5,kShort   // check length
-        lwz     r7,0(r4)        // load pattern into (these remain lwz in 64-bit mode)
-        lwz     r9,4(r4)
-        neg     r6,r3           // start to compute ptr alignment
-        lwz     r10,8(r4)
-        lwz     r11,12(r4)
-        b       __memset_pattern_common
-        
-
-/* *********************************
- * * M E M S E T _ P A T T E R N 8 *
- * *********************************
- *
- * Used to store an 8-byte pattern in memory:
- *
- *  void    memset_pattern8(void *b, const void *c8, size_t len);
- *
- * Where c8 points to the 8-byte pattern.  None of the parameters need be aligned.
- */
-
-        .globl _memset_pattern8
-        .align 5
-_memset_pattern8:
-        lwz     r7,0(r4)        // load pattern (these remain lwz in 64-bit mode)
-        lwz     r9,4(r4)
-        cmplgi  cr1,r5,kShort   // check length
-        neg     r6,r3           // start to compute ptr alignment
-        mr      r10,r7          // replicate into 16-byte pattern
-        mr      r11,r9
-        b       __memset_pattern_common
-        
-
-/* *********************************
- * * M E M S E T _ P A T T E R N 4 *
- * *********************************
- *
- * Used to store a 4-byte pattern in memory:
- *
- *  void    memset_pattern4(void *b, const void *c4, size_t len);
- *
- * Where c4 points to the 4-byte pattern.  None of the parameters need be aligned.
- */
-
-        .globl _memset_pattern4
-        .align 5
-_memset_pattern4:
-        lwz     r7,0(r4)        // load pattern
-        cmplgi  cr1,r5,kShort   // check length
-        neg     r6,r3           // start to compute ptr alignment
-        mr      r9,r7           // replicate into 16-byte pattern
-        mr      r10,r7
-        mr      r11,r7
-        b       __memset_pattern_common // don't fall through because of scatter-loading
-        
-        
-/* ***********************************************
- * * _ M E M S E T _ P A T T E R N _ C O M M O N *
- * ***********************************************
- *
- * This is the common code used by _memset_pattern16, 8, and 4.  They all get here via
- * long branch (ie, "b") in case the routines are re-ordered, with:
- *      r3 = ptr to memory to store pattern into (unaligned)
- *      r5 = length in bytes
- *      r6 = neg(r3), used to compute #bytes to align
- *      r7, r9, r10, r11 = 16-byte pattern to store
- *      cr1= ble if (r5 <= kShort)
- */
-
-        .globl __memset_pattern_common
-        .private_extern __memset_pattern_common // avoid dyld stub, which trashes r11
-        .align 5
-__memset_pattern_common:
-        andi.   r0,r6,0xF       // get #bytes to 16-byte align ptr
-        ble--   cr1,LShort      // if short operand skip out
-
-        // Align ptr and store enough of pattern so we have an aligned
-        // 16-byte chunk of it (this effectively rotates incoming pattern
-        // if the original ptr was not aligned.)
-        
-        stw     r7,0(r3)
-        stw     r9,4(r3)
-        stw     r10,8(r3)
-        stw     r11,12(r3)
-        beq     Laligned        // skip if (r0==0), ie if r3 is 16-byte aligned
-        stw     r7,16(r3)
-        stw     r9,20(r3)
-        stw     r10,24(r3)
-        stw     r11,28(r3)
-        add     r3,r3,r0        // 16-byte align ptr
-        sub     r5,r5,r0        // adjust length
-        
-        // We're ready to call the machine-specific commpage routine
-        // to do the heavy lifting.  When called, _COMM_PAGE_MEMSET_PATTERN expects:
-        //      r4 = length (>= 32)
-        //      r8 = ptr (16-byte aligned)
-        //      r9 = ptr to 16-byte pattern (16-byte aligned)
-        // When it returns:
-        //      r3, r7, and r12 are preserved
-        //      r4 and r8 are updated to reflect a residual count of from 0..31 bytes
-
-Laligned:
-        mflr    r12             // save return across commpage call
-        mr      r9,r3           // point to 16-byte aligned 16-byte pattern
-        addi    r8,r3,16        // point to first unstored byte (r8 is 16-byte aligned)
-        subi    r4,r5,16        // account for the aligned bytes we have stored
-        bla     _COMM_PAGE_MEMSET_PATTERN
-        mr.     r5,r4           // move length (0..31) back to original reg and test for 0
-        mtlr    r12
-        beqlr                   // done if residual length == 0
-        lwz     r7,-16(r8)      // load aligned pattern into r7,r9,r10, and r11
-        lwz     r9,-12(r8)
-        mr      r3,r8           // move destination ptr back
-        lwz     r10,-8(r8)
-        lwz     r11,-4(r8)
-        
-        // Handle short operands and leftovers.
-        //      r3 = dest
-        //      r5 = length
-        //      r7,r9,r10,r11 = pattern
-LShort:
-        srgi.   r0,r5,4         // at least 16 bytes?
-        mtcrf   0x01,r5         // move leftover count to cr7
-        beq     Lleftovers
-        mtctr   r0
-LShortLoop:
-        stw     r7,0(r3)        // replicate the pattern
-        stw     r9,4(r3)
-        stw     r10,8(r3)
-        stw     r11,12(r3)
-        addi    r3,r3,16
-        bdnz    LShortLoop      // store 16 more bytes
-        
-        // Fewer than 16 bytes remaining.
-Lleftovers:        
-        bf      28,1f
-        stw     r7,0(r3)        // store next 8 bytes
-        stw     r9,4(r3)
-        addi    r3,r3,8
-        mr      r7,r10          // shift pattern over
-        mr      r9,r11
-1:
-        bf      29,2f
-        stw     r7,0(r3)
-        addi    r3,r3,4
-        mr      r7,r9
-2:
-        bf      30,3f
-        rlwinm  r7,r7,16,0,31   // position leftmost 2 bytes for store
-        sth     r7,0(r3)
-        addi    r3,r3,2
-3:
-        bflr    31
-        srwi    r7,r7,24        // position leftmost byte for store
-        stb     r7,0(r3)
-        blr
diff --git a/ppc/string/strcat.s b/ppc/string/strcat.s
deleted file mode 100644 (file)
index ef7c94e..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// ***************
-// * S T R C A T *
-// ***************
-//
-// char*       strcat(const char *dst, const char *src);
-//
-// We optimize the move by doing it word parallel.  This introduces
-// a complication: if we blindly did word load/stores until finding
-// a 0, we might get a spurious page fault by touching bytes past it.
-// To avoid this, we never do a load that crosses a page boundary,
-// and never store a byte we don't have to.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// In 64-bit mode, this algorithm is doubleword parallel.
-
-        .text
-        .globl EXT(strcat)
-        
-        .align         5
-LEXT(strcat)                        // char*   strcat(const char *s, const char *append);
-        clrrgi  r9,r3,LOG2_GPR_BYTES// align pointer by zeroing right LOG2_GPR_BYTES bits
-        li             r10,-1                          // get 0xFFs
-        lg             r8,0(r9)                        // get word or doubleword with 1st operand byte
-        rlwinm  r11,r3,3,(GPR_BYTES-1)*8 // get starting bit position of operand
-#if defined(__ppc__)
-        lis            r6,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r7,hi16(0x80808080)
-        srw            r10,r10,r11                     // create a mask of 0xFF bytes for operand in r8
-        ori            r6,r6,lo16(0xFEFEFEFF)
-        ori            r7,r7,lo16(0x80808080)
-#else
-        ld             r6,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r7,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-        srd            r10,r10,r11                     // create a mask of 0xFF bytes for operand in r8
-#endif
-        orc     r8,r8,r10           // make sure bytes preceeding operand are nonzero
-        b       Lword0loopEnter
-                
-// Loop over words or doublewords looking for 0-byte marking end of dest.
-//             r4 = source ptr (unaligned)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (aligned)
-
-        .align 5                                       // align inner loops for speed
-Lword0loop:
-        lgu            r8,GPR_BYTES(r9)    // r8 <- next dest word or doubleword
-Lword0loopEnter:                    // initial entry
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        beq            Lword0loop                      // loop until 0 found
-
-// Now we know one of the bytes in r8 is zero, we just have to figure out which one. 
-// We have mapped 0 bytes to 0x80, and nonzero bytes to 0x00, with one exception:
-// 0x01 bytes preceeding the first zero are also mapped to 0x80.   So we have to mask
-// out the 0x80s caused by 0x01s before searching for the 0x80 byte.  Once the 0 is
-// found, we can start appending source.  We align the source, which allows us to
-// avoid worrying about spurious page faults.
-//             r4 = source ptr (unaligned)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//      r8 = word or doubleword with a 0-byte
-//             r9 = ptr to the word or doubleword in r8 (aligned)
-//     r11 = mapped word or doubleword
-
-        slgi   r10,r8,7            // move 0x01 bits (false hits) into 0x80 position
-        andi.  r0,r4,GPR_BYTES-1   // is source aligned?
-        andc   r11,r11,r10                     // mask out false hits
-        cntlzg r10,r11                         // find 0 byte (r0 = 0, 8, 16, or 24)
-        subfic r0,r0,GPR_BYTES     // get #bytes to align r4
-        srwi   r10,r10,3           // now r0 = 0, 1, 2, or 3
-        add            r9,r9,r10                       // now r9 points to the 0-byte in dest
-        beq            LwordloopEnter          // skip if source is already aligned
-        
-        mtctr  r0                                      // set up loop
-        
-// Loop over bytes.
-//             r4 = source ptr (unaligned)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//        ctr = byte count
-
-Lbyteloop:
-        lbz            r8,0(r4)                        // r8 <- next source byte
-        addi   r4,r4,1
-        cmpwi  r8,0                            // 0 ?
-        stb            r8,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bdnzf  eq,Lbyteloop            // loop until (ctr==0) | (r8==0)
-        
-        bne            LwordloopEnter          // 0-byte not found, so enter word loop
-        blr                                                    // 0-byte found, done
-        
-// Word loop: move a word or doubleword at a time until 0-byte found.
-//             r4 = source ptr (aligned)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-        .align 5                                       // align inner loop, which is 8 words ling
-Lwordloop:
-        stg            r8,0(r9)                        // pack word or doubleword into destination
-        addi   r9,r9,GPR_BYTES
-LwordloopEnter:
-        lg             r8,0(r4)                        // r8 <- next 4 or 8 source bytes
-        addi   r4,r4,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r0,r10,r12                      // r0 <- nonzero iff word has a 0-byte
-        beq            Lwordloop                       // loop if no 0-byte
-        
-// Found a 0-byte.  Store last word up to and including the 0, a byte at a time.
-//             r8 = last word or doubleword, known to have a 0-byte
-//             r9 = dest ptr
-
-Lstorelastbytes:
-        srgi.   r0,r8,GPR_BYTES*8-8 // shift leftmost byte into bottom so we can "stb"
-        slgi    r8,r8,8             // move on to next
-        stb            r0,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bne            Lstorelastbytes         // loop until 0 stored
-        
-        blr
-                
diff --git a/ppc/string/strcmp.s b/ppc/string/strcmp.s
deleted file mode 100644 (file)
index 2cfddfa..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// ***************
-// * S T R C M P *
-// ***************
-//
-// int strcmp(const char *s1, const char *s2);
-//
-// We optimize the compare by doing it word parallel.  This introduces
-// a complication: if we blindly did word loads from both sides until
-// finding a difference (or 0), we might get a spurious page fault by
-// reading bytes past the difference.  To avoid this, we never do a "lwz"
-// that crosses a page boundary.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// In 64-bit mode, the algorithm is doubleword parallel.
-       
-        .text
-        .globl EXT(strcmp)
-
-        .align         5
-LEXT(strcmp)                        // int     strcmp(const char *s1, const char *s2);
-        andi.  r0,r3,GPR_BYTES-1   // is LHS aligned?
-#if defined(__ppc__)
-        lis            r5,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r6,hi16(0x80808080)
-        ori            r5,r5,lo16(0xFEFEFEFF)
-        ori            r6,r6,lo16(0x80808080)
-#else
-        ld             r5,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r6,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-#endif
-        subi   r3,r3,GPR_BYTES     // we use "lgu" in the inner loops
-        subi   r4,r4,GPR_BYTES
-        beq            Laligned                        // LHS is aligned
-        subfic r0,r0,GPR_BYTES     // r0 <- #bytes to align LHS
-        mtctr  r0
-        
-// Loop over bytes.
-
-Lbyteloop:
-        lbz            r7,GPR_BYTES(r3)    // r7 <- next LHS byte
-        addi   r3,r3,1
-        lbz            r8,GPR_BYTES(r4)    // r8 <- next RHS byte
-        addi   r4,r4,1
-        cntlzw r9,r7                           // is r7 zero?
-        sub            r0,r7,r8                        // different?
-        srwi   r9,r9,5                         // r9 <- (r7==0) ? 1 : 0
-        or.            r9,r9,r0                        // r9 is nonzero if either different or 0
-        bdnzt  eq,Lbyteloop            // loop until different, 0, or buf end
-        
-        bne            Ldone                           // done if different or 0
-        
-// LHS is aligned.  If RHS also is, we need not worry about page
-// crossing.  Otherwise, we must stop the loop before page is crossed.
-
-Laligned:
-        andi.  r0,r4,GPR_BYTES-1   // is RHS now aligned too?
-        addi   r9,r4,GPR_BYTES     // restore true address of next RHS byte
-        rlwinm r9,r9,0,0xFFF           // get RHS offset in page
-        beq            Lalignedloop            // RHS also aligned, use simple loop
-        subfic r9,r9,4096                      // get #bytes left in RHS page
-        srwi.  r0,r9,LOG2_GPR_BYTES// get #words or doublewords left in RHS page
-        mtctr  r0                                      // set up loop count
-        bne++  Lunalignedloop          // at least one word left in RHS page
-        li             r0,GPR_BYTES        // must check GPR_BYTES, a byte at a time...
-        mtctr  r0                                      // ...in order to keep LHS aligned
-        b              Lbyteloop                       // go cross RHS page
-        
-// Unaligned inner loop: compare a word or doubleword at a time, until one of
-// three conditions:
-//             - a difference is found
-//             - a zero byte is found
-//             - end of RHS page (we dare not touch next page until we must)
-// At this point, registers are as follows:
-//             r3 = LHS ptr - GPR_BYTES (aligned)
-//             r4 = RHS ptr - GPR_BYTES (not aligned)
-//             r5 = 0xFEFEFEFF
-//             r6 = 0x80808080
-//     ctr = words or doublewords left in RHS page
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lunalignedloop:
-        lgu     r7,GPR_BYTES(r3)    // r7 <- next LHS bytes
-        lgu     r8,GPR_BYTES(r4)    // r8 <- next RHS bytes
-        add            r10,r7,r5                       // r10 <- LHS + 0xFEFEFEFF
-        andc   r12,r6,r7                       // r12 <- ~LHS & 0x80808080
-        xor            r11,r7,r8                       // r11 <- compare the words
-        and            r0,r10,r12                      // r0 <- nonzero iff LHS has a 0-byte
-        or.            r12,r0,r11                      // combine difference and 0-test vectors
-        bdnzt  eq,Lunalignedloop       // loop if ctr!=0 and cr0_eq
-        
-        bne++  Ldifferent                      // done if we found a 0 or difference
-        li             r0,GPR_BYTES        // must check GPR_BYTES, a byte at a time...
-        mtctr  r0                                      // ...in order to keep LHS word aligned
-        b              Lbyteloop                       // cross RHS page, then resume word loop
-        
-// Aligned inner loop: compare a word at a time, until one of two conditions:
-//             - a difference is found
-//             - a zero byte is found
-// At this point, registers are as follows:
-//             r3 = LHS ptr - 4 (word aligned)
-//             r4 = RHS ptr - 4 (word aligned)
-//             r5 = 0xFEFEFEFF
-//             r6 = 0x80808080
-
-        .align 5                                       // align inner loop, which is 8 words ling
-Lalignedloop:
-        lgu     r7,GPR_BYTES(r3)    // r7 <- next LHS bytes
-        lgu     r8,GPR_BYTES(r4)    // r8 <- next RHS bytes
-        add            r10,r7,r5                       // r10 <- LHS + 0xFEFEFEFF
-        andc   r12,r6,r7                       // r12 <- ~LHS & 0x80808080
-        xor            r11,r7,r8                       // r11 <- compare the words
-        and            r0,r10,r12                      // r0 <- nonzero iff LHS has a 0-byte
-        or.            r12,r0,r11                      // combine difference and 0-test vectors
-        beq            Lalignedloop            // loop if neither found
-        
-// Found differing bytes and/or a 0-byte.  Determine which comes first, and
-// subtract the bytes to compute the return value.  We also need to mask out the
-// false hits in the 0-byte test, which consist of 0x01 bytes that preceed
-// the 0-byte.
-
-Ldifferent:                                                    // r0 == 0-test vector (with 0x01 false hits)
-        slgi   r9,r7,7                         // move 0x01 bits in LHS into position 0x80
-        andc   r0,r0,r9                        // mask out the false 0-hits from 0x01 bytes
-        or             r11,r11,r0                      // recompute difference vector
-        cntlzg r9,r11                          // find 1st difference (r9 = 0..31 or 63)
-        rlwinm r9,r9,0,0x38            // byte align bit offset (now, r9 = 0,8,16, or 24 etc)
-        addi   r0,r9,8                         // now, r0 = 8, 16, 24, or 32
-#if defined(__ppc__)
-        rlwnm  r7,r7,r0,24,31          // right justify differing bytes and mask off rest
-        rlwnm  r8,r8,r0,24,31
-#else
-        rldcl   r7,r7,r0,56         // right justify differing bytes and mask off rest
-        rldcl   r8,r8,r0,56
-#endif
-
-Ldone:                              // differing bytes are in r7 and r8
-        sub            r3,r7,r8                        // compute difference (0, +, or -)
-        blr
-        
diff --git a/ppc/string/strcpy.s b/ppc/string/strcpy.s
deleted file mode 100644 (file)
index 0f73ebf..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// ***************
-// * S T R C P Y *
-// ***************
-//
-// char*       strcpy(const char *dst, const char *src);
-//
-// We optimize the move by doing it word parallel.  This introduces
-// a complication: if we blindly did word load/stores until finding
-// a 0, we might get a spurious page fault by touching bytes past it.
-// To avoid this, we never do a "lwz" that crosses a page boundary,
-// and never store a byte we don't have to.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// We align the _source_, which allows us to avoid all worries about
-// spurious page faults.  Doing so is faster than aligning the dest.
-//
-// In 64-bit mode, the algorithm is doubleword parallel.
-
-        .text
-        .globl EXT(strcpy)
-
-        .align         5
-LEXT(strcpy)                        // char* strcpy(const char *dst, const char *src);
-        andi.  r0,r4,GPR_BYTES-1   // is source aligned?
-#if defined(__ppc__)
-        lis            r6,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r7,hi16(0x80808080)
-        ori            r6,r6,lo16(0xFEFEFEFF)
-        ori            r7,r7,lo16(0x80808080)
-#else
-        ld             r6,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r7,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-#endif
-        mr             r9,r3                           // use r9 for dest ptr (must return r3 intact)
-        beq            LwordloopEnter          // source is aligned
-        subfic r0,r0,GPR_BYTES     // r0 <- #bytes to align source
-        mtctr  r0
-        
-// Loop over bytes.
-//             r4 = source ptr (unaligned)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//        ctr = byte count
-
-Lbyteloop:
-        lbz            r8,0(r4)                        // r8 <- next source byte
-        addi   r4,r4,1
-        cmpwi  r8,0                            // 0 ?
-        stb            r8,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bdnzf  eq,Lbyteloop            // loop until (ctr==0) | (r8==0)
-        
-        bne            LwordloopEnter          // 0-byte not found, so enter word loop
-        blr                                                    // 0-byte found, done
-        
-// Word loop: move a word or doubleword at a time until 0-byte found.
-//             r4 = source ptr (aligned)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-        .align 5                                       // align inner loop, which is 8 words ling
-Lwordloop:
-        stg            r8,0(r9)                        // pack word or doubleword into destination
-        addi   r9,r9,GPR_BYTES
-LwordloopEnter:
-        lg             r8,0(r4)                        // r8 <- next source word or doubleword
-        addi   r4,r4,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r0,r10,r12                      // r0 <- nonzero iff word has a 0-byte
-        beq            Lwordloop                       // loop if no 0-byte
-        
-// Found a 0-byte.  Store last word up to and including the 0, a byte at a time.
-//             r8 = last word or doubleword, known to have a 0-byte
-//             r9 = dest ptr
-
-Lstorelastbytes:
-        srgi.   r0,r8,GPR_BYTES*8-8 // shift leftmost byte into bottom so we can "stb"
-        slgi    r8,r8,8             // move on to next
-        stb            r0,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bne            Lstorelastbytes         // loop until 0 stored
-        
-        blr
-                
diff --git a/ppc/string/strlcat.s b/ppc/string/strlcat.s
deleted file mode 100644 (file)
index 7f56026..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// *****************
-// * S T R L C A T *
-// *****************
-//
-// size_t      strlcat(char *dst, const char *src, size_t count);
-//
-// We optimize the move by doing it word parallel.  This introduces
-// a complication: if we blindly did word load/stores until finding
-// a 0, we might get a spurious page fault by touching bytes past it.
-// We are allowed to touch the "count" bytes starting at "dst", but
-// when appending the "src", we must not do a "lwz" that crosses a page
-// boundary, or store past "count".
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// Note that "count" is the total buffer length, including the length
-// of the "dst" string.  This is different than strncat().
-//
-// In 64-bit mode, this algorithm is doubleword parallel.
-
-        .text
-        .globl EXT(strlcat)
-
-        .align         5
-LEXT(strlcat)                       // size_t strlcat(char *dst, const char *src, size_t count);
-        srgi.  r0,r5,LOG2_GPR_BYTES// get #words or doublewords to scan
-#if defined(__ppc__)
-        lis            r6,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r7,hi16(0x80808080)
-        ori            r6,r6,lo16(0xFEFEFEFF)
-        ori            r7,r7,lo16(0x80808080)
-#else
-        ld             r6,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r7,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-#endif
-        mr             r9,r3                           // use r9 for dest ptr (r3 remembers dst start)
-        beq--  L0bytes                         // buffer length <4
-        mtctr  r0                                      // set up loop
-        b              L0words                         // enter word loop
-        
-// Loop over words looking for 0.
-//             r3 = original start of buffer
-//             r4 = source ptr (unaligned)
-//             r5 = original buffer size
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//     ctr = #words or doublewords remaining in buffer
-
-        .align 5                                       // align inner loops for speed
-L0words:
-        lg             r8,0(r9)                        // r8 <- next dest word or doubleword
-        addi   r9,r9,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        bdnzt  eq,L0words                      // loop until 0 found or buffer end
-       
-        beq--  L0bytes                         // skip if 0 not found
-        
-        slgi   r0,r8,7                         // move 0x01 bits (false hits) into 0x80 position
-        subi   r9,r9,GPR_BYTES     // back up r9 to the start of the word
-        andc   r11,r11,r0                      // mask out false hits
-        cntlzg r0,r11                          // find 0 byte (r0 = 0, 8, 16, or 24)
-        srwi   r0,r0,3                         // now r0 = 0, 1, 2, or 3
-        add            r9,r9,r0                        // now r9 points to the 0-byte in dest
-        b              L0found                         // start to append source
-        
-// Loop over bytes looking for 0.
-//             r3 = original start of buffer
-//             r4 = source ptr (unaligned)
-//             r5 = original buffer size
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-L0bytes:
-        andi.  r0,r5,GPR_BYTES-1   // get #bytes remaining in buffer
-        mtctr  r0                                      // set up byte loop
-        beq--  L0notfound                      // skip if 0 not found in buffer (error)
-L0byteloop:
-        lbz            r8,0(r9)                        // r8 <- next dest byte
-        addi   r9,r9,1
-        cmpwi  r8,0                            // 0 ?
-        bdnzf  eq,L0byteloop           // loop until 0 found or buffer end
-        
-        bne--  L0notfound                      // skip if 0 not found (error)
-        subi   r9,r9,1                         // back up, so r9 points to the 0
-        
-// End of dest found, so we can start appending source.  First, align the source,
-// in order to avoid spurious page faults.
-//             r3 = original start of buffer
-//             r4 = original source ptr (unaligned)
-//             r5 = original buffer size
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = ptr to 0-byte in dest (unaligned)
-
-L0found:
-        andi.  r0,r4,GPR_BYTES-1   // is source aligned?
-        add            r5,r5,r3                        // get ptr to end of buffer
-        sub            r5,r5,r9                        // get #bytes remaining in buffer, counting the 0 (r5>0)
-        beq            Laligned                        // skip if source already word aligned
-        subfic r0,r0,GPR_BYTES     // not aligned, get #bytes to align r4
-        b              Lbyteloop1                      // r5!=0, so skip check
-        
-// Copy min(r0,r5) bytes, until 0-byte.
-//             r0 = #bytes we propose to copy (NOTE: must be >0)
-//             r4 = source ptr (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Lbyteloop:
-        cmpgi  r5,0                            // buffer empty? (note: length is unsigned)
-        beq--  Loverrun                        // buffer filled before end of source reached
-Lbyteloop1:                                                    // entry when we know r5!=0
-        lbz            r8,0(r4)                        // r8 <- next source byte
-        subic. r0,r0,1                         // decrement count of bytes to move
-        addi   r4,r4,1
-        subi   r5,r5,1                         // decrement buffer length remaining
-        stb            r8,0(r9)                        // pack into dest
-        cmpwi  cr1,r8,0                        // 0-byte?
-        addi   r9,r9,1
-        beq            cr1,L0stored            // byte was 0, so done
-        bne            Lbyteloop                       // r0!=0, source not yet aligned
-        
-// Source is aligned.  Loop over words or doublewords until 0-byte found or end
-// of buffer.
-//             r3 = original start of buffer
-//             r4 = source ptr (aligned)
-//             r5 = length remaining in buffer
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Laligned:
-        srgi.  r8,r5,LOG2_GPR_BYTES// get #words or doublewords in buffer
-        addi   r0,r5,1                         // if no words...
-        beq--  Lbyteloop                       // ...copy to end of buffer
-        mtctr  r8                                      // set up loop count
-        rlwinm r5,r5,0,GPR_BYTES-1 // mask buffer length down to leftover bytes
-        b              LwordloopEnter
-        
-// Inner loop: move a word or doubleword at a time, until one of two conditions:
-//             - a zero byte is found
-//             - end of buffer
-// At this point, registers are as follows:
-//             r3 = original start of buffer
-//             r4 = source ptr (aligned)
-//             r5 = bytes leftover in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//     ctr = loop count
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lwordloop:
-        stg            r8,0(r9)                        // pack word into destination
-        addi   r9,r9,GPR_BYTES
-LwordloopEnter:
-        lg             r8,0(r4)                        // r8 <- next 4 or 8 source bytes
-        addi   r4,r4,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        bdnzt  eq,Lwordloop            // loop if ctr!=0 and cr0_eq
-        
-        beq--  Lleftovers                      // skip if no 0-byte found, copy leftovers
-
-// Found a 0-byte.  Store last word up to and including the 0, a byte at a time.
-//             r3 = original start of buffer
-//             r8 = last word, known to have a 0-byte
-//             r9 = dest ptr (one past 0)
-
-Lstorelastbytes:
-        srgi.  r0,r8,GPR_BYTES*8-8 // right justify next byte and test for 0
-        slgi   r8,r8,8                         // shift next byte into position
-        stb            r0,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bne            Lstorelastbytes         // loop until 0 stored
-
-// Append op successful, O stored into buffer.  Return total length.
-//             r3 = original start of buffer
-//             r9 = dest ptr (one past 0)
-        
-L0stored:
-        sub            r3,r9,r3                        // get (length+1) of string in buffer
-        subi   r3,r3,1                         // return length
-        blr
-        
-// 0-byte not found in aligned source words.  There are up to GPR_BYTES-1 leftover 
-// source bytes, hopefully the 0-byte is among them.
-//             r4 = source ptr (aligned)
-//             r5 = leftover bytes in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r8 = last full word or doubleword of source
-//             r9 = dest ptr (unaligned)
-
-Lleftovers:
-        stg            r8,0(r9)                        // store last word
-        addi   r9,r9,GPR_BYTES
-        addi   r0,r5,1                         // make sure r5 terminates byte loop (not r0)
-        b              Lbyteloop
-        
-// Buffer filled during append without finding the end of source.  Overwrite the
-// last byte in buffer with a 0, and compute how long the concatenated string would
-// have been, if the buffer had been large enough.  
-//             r3 = original start of buffer
-//             r4 = source ptr (1st byte not copied into buffer)
-//             r9 = dest ptr (one past end of buffer)
-
-Loverrun:
-        sub.   r3,r9,r3                        // compute #bytes stored in buffer
-        li             r0,0                            // get a 0
-        beq--  Lskip                           // buffer was 0-length
-        stb            r0,-1(r9)                       // jam in delimiting 0
-        
-// Buffer full, check to see how much longer source is.  We don't optimize this,
-// since overruns are an error.
-
-Lskip:
-        lbz            r8,0(r4)                        // get next source byte
-        addi   r4,r4,1
-        addi   r3,r3,1                         // increment length of "ideal" string
-        cmpwi  r8,0                            // 0?
-        bne            Lskip
-        
-        subi   r3,r3,1                         // don't count 0 in length
-        blr                                                    // return length of string we "wanted" to create
-        
-// 0 not found in buffer (append not yet begun.)  We don't store a delimiting 0,
-// but do compute how long the concatenated string would have been, assuming the length
-// of "dst" is the length of the buffer.
-//             r3 = original start of buffer
-//             r4 = original source ptr
-//             r9 = dest ptr (one past end of buffer)
-
-L0notfound:
-        sub            r3,r9,r3                        // compute #bytes in buffer
-        b              Lskip                           // add strlen(source) to r3
-        
diff --git a/ppc/string/strlcpy.s b/ppc/string/strlcpy.s
deleted file mode 100644 (file)
index 081a629..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// *****************
-// * S T R L C P Y *
-// *****************
-//
-// size_t strlcpy(char *dst, const char *src, size_t size);
-//
-// We optimize the move by doing it word parallel.  This introduces
-// a complication: if we blindly did word load/stores until finding
-// a 0, we might get a spurious page fault by touching bytes past it.
-// To avoid this, we never do a "lwz" that crosses a page boundary,
-// or store unnecessary bytes.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// This algorithm is doubleword parallel in 64-bit mode.
-
-        .text
-        .globl EXT(strlcpy)
-
-        .align         5
-LEXT(strlcpy)                       // size_t strlcpy(char *dst, const char *src, size_t size);
-        andi.  r0,r4,GPR_BYTES-1   // is source aligned?
-#if defined(__ppc__)
-        lis            r6,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r7,hi16(0x80808080)
-        ori            r6,r6,lo16(0xFEFEFEFF)
-        ori            r7,r7,lo16(0x80808080)
-#else
-        ld             r6,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r7,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-#endif
-        mr             r9,r3                           // use r9 for dest ptr (must return r3 intact)
-        beq            Laligned                        // source is aligned
-        subfic r0,r0,GPR_BYTES     // r0 <- #bytes to align source
-        
-// Copy min(r0,r5) bytes, until 0-byte found.
-//             r0 = #bytes we propose to copy (NOTE: must be >0)
-//             r4 = source ptr (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Lbyteloop:
-        cmpwi  r5,0                            // buffer empty?
-        beq--  L0notfound                      // buffer full but 0 not found
-        lbz            r8,0(r4)                        // r8 <- next source byte
-        subic. r0,r0,1                         // decrement count of bytes to move
-        addi   r4,r4,1
-        subi   r5,r5,1                         // decrement buffer length remaining
-        stb            r8,0(r9)                        // pack into dest
-        cmpwi  cr1,r8,0                        // 0-byte?
-        addi   r9,r9,1
-        beq            cr1,L0found                     // byte was 0
-        bne            Lbyteloop                       // r0!=0, source not yet aligned
-        
-// Source is aligned.  Loop over words or doublewords until end of buffer.  We
-// align the source, rather than the dest, to avoid getting spurious page faults.
-//             r4 = source ptr (aligned)
-//             r5 = length remaining in buffer
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Laligned:
-        srgi.  r8,r5,LOG2_GPR_BYTES// get #words or doublewords in buffer
-        addi   r0,r5,1                         // if no words, compare rest of buffer
-        beq--  Lbyteloop                       // r8==0, no words
-        mtctr  r8                                      // set up word loop count
-        rlwinm r5,r5,0,GPR_BYTES-1 // mask buffer length down to leftover bytes
-        b              LwordloopEnter
-        
-// Move a word or doubleword at a time, until one of two conditions:
-//             - a zero byte is found
-//             - end of buffer
-// At this point, registers are as follows:
-//             r4 = source ptr (aligned)
-//             r5 = leftover bytes in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//     ctr = whole words or doublewords left in buffer
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lwordloop:
-        stg            r8,0(r9)                        // pack word or doubleword into destination
-        addi   r9,r9,GPR_BYTES
-LwordloopEnter:
-        lg             r8,0(r4)                        // r8 <- next 4 or 8 source bytes
-        addi   r4,r4,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        bdnzt  eq,Lwordloop            // loop if ctr!=0 and cr0_eq
-        
-        beq            Lleftovers                      // 0-byte not found in aligned words
-
-// Found a 0-byte.  Store last word up to and including the 0, a byte at a time.
-//             r8 = last word or doubleword, known to have a 0-byte
-//             r9 = dest ptr
-
-Lstorelastbytes:
-        srgi.  r0,r8,GPR_BYTES*8-8 // right justify next byte and test for 0
-        slgi   r8,r8,8                         // shift next byte into position
-        stb            r0,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bne            Lstorelastbytes         // loop until 0 stored
-        
-L0found:
-        sub            r3,r9,r3                        // get #bytes stored, including 0
-        subi   r3,r3,1                         // don't count the 0
-        blr                                                    // return strlen(src)
-        
-// 0-byte not found in aligned source words.  There are up to GPR_BYTES-1 leftover 
-// source bytes, hopefully the 0-byte is among them.
-//             r4 = source ptr (aligned)
-//             r5 = leftover bytes in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r8 = last full word or doubleword of source
-//             r9 = dest ptr (unaligned)
-
-Lleftovers:
-        stg            r8,0(r9)                        // store last word or doubleword
-        addi   r9,r9,GPR_BYTES
-        addi   r0,r5,1                         // make sure r5 terminates byte loop (not r0)
-        b              Lbyteloop
-
-// Buffer full but 0-byte not found.  Stuff a 0 into last byte of buffer.
-//             r3 = start of buffer
-//             r4 = ptr to next byte in source
-//             r9 = ptr to first byte past end of buffer
-
-L0notfound:
-        sub.   r3,r9,r3                        // get #bytes stored, ie original buffer length
-        beq            Lfind0                          // skip if buffer 0-length
-        li             r0,0                            // get a 0
-        stb            r0,-1(r9)                       // always store 0-byte unless buffer was 0-length
-        
-// Keep searching for 0-byte ending source, so we can return strlen(source).
-// Not optimized, since this is an error condition.
-//             r3 = number of bytes already copied
-//             r4 = ptr to next byte in source
-
-Lfind0:
-        lbz            r0,0(r4)                        // get next byte
-        addi   r4,r4,1
-        addi   r3,r3,1                         // increment strlen
-        cmpwi  r0,0
-        bne            Lfind0                          // loop if not 0
-        
-        subi   r3,r3,1                         // don't count the 0-byte
-        blr                                                    // return strlen(source)
diff --git a/ppc/string/strlen.s b/ppc/string/strlen.s
deleted file mode 100644 (file)
index e967925..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
- * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-#include <mach/ppc/asm.h>
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-
-// Strlen, optimized for PPC.  We use an inobvious but very efficient
-// word-parallel test for 0-bytes: 
-// 
-//     y =  dataWord + 0xFEFEFEFF
-//     z = ~dataWord & 0x80808080
-//     if ( y & z ) = 0 then all bytes in dataWord are non-zero
-//
-// The test maps any non-zero byte to zeros and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.  Using altivec is another possibility, but it turns
-// out that the overhead of maintaining VRSAVE and dealing with edge
-// cases pushes the crossover point out to around 30 bytes... longer
-// the the "typical" operand length.
-//
-// In 64-bit mode, the algorithm is doubleword parallel.
-
-        .text
-        .align 5
-        .globl EXT(strlen)
-LEXT(strlen)                        // int     strlen(ptr)
-        clrrgi  r9,r3,LOG2_GPR_BYTES// align pointer by zeroing right LOG2_GPR_BYTES bits
-        li             r7,-1                           // get 0xFFs
-        lg             r8,0(r9)                        // get word or doubleword with 1st operand byte
-        rlwinm  r4,r3,3,(GPR_BYTES-1)*8 // get starting bit position of operand
-#if defined(__ppc__)
-        lis            r5,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r6,hi16(0x80808080)
-        srw            r7,r7,r4                        // create a mask of 0xFF bytes for operand in r8
-        ori            r5,r5,lo16(0xFEFEFEFF)
-        ori            r6,r6,lo16(0x80808080)
-#else
-        ld             r5,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r6,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-        srd            r7,r7,r4                        // create a mask of 0xFF bytes for operand in r8
-#endif
-        orc            r8,r8,r7                        // make sure bytes preceeding operand are 0xFF
-        b              Lloop1                          // enter loop
-        
-// Loop over words or doublewords.
-//             r3 = original address
-//             r5 = 0xFEFEFEFE FEFEFEFF
-//             r6 = 0x80808080 80808080
-//             r9 = address (aligned)
-
-        .align 5
-Lloop:
-        lgu            r8,GPR_BYTES(r9)    // get next word or doubleword
-Lloop1:                                                                // initial entry
-        add            r4,r5,r8                        // r4 =  data + 0xFEFEFEFF
-        andc   r7,r6,r8                        // r7 = ~data & 0x80808080
-        and.   r4,r4,r7                        // r4 = r4 & r7
-        beq            Lloop                           // if r4 is zero, then all bytes are non-zero
-
-// Now we know one of the bytes in r8 is zero, we just have to figure out which one. 
-// We have mapped 0 bytes to 0x80, and nonzero bytes to 0x00, with one exception:
-// 0x01 bytes preceeding the first zero are also mapped to 0x80.   So we have to mask
-// out the 0x80s caused by 0x01s before searching for the 0x80 byte.
-
-        slgi   r5,r8,7                         // move 0x01 bits to 0x80 position
-        sub            r3,r9,r3                        // start to compute string length
-        andc   r4,r4,r5                        // turn off false hits from 0x0100 worst case
-        cntlzg r7,r4                           // now we can count leading 0s
-        srwi   r7,r7,3                         // convert 0,8,16,24 to 0,1,2,3, etc
-        add            r3,r3,r7                        // add in nonzero bytes in last word
-        blr
diff --git a/ppc/string/strncat.s b/ppc/string/strncat.s
deleted file mode 100644 (file)
index 04690b2..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-
-// *****************
-// * S T R N C A T *
-// *****************
-//
-// char*       strncat(char *dst, const char *src, size_t count);
-//
-// We optimize the move by doing it word parallel.  This introduces
-// a complication: if we blindly did word load/stores until finding
-// a 0, we might get a spurious page fault by touching bytes past it.
-// To avoid this, we never do a "lwz" that crosses a page boundary,
-// or store extra bytes.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// Note that "count" refers to the max number of bytes to _append_.
-// There is no limit to the number of bytes we will scan looking for
-// the end of the "dst" string.
-//
-// In 64-bit mode, this algorithm is doubleword parallel.
-
-        .text
-        .globl EXT(strncat)
-
-        .align         5
-LEXT(strncat)                       // char* strncat(char *dst, const char *src, size_t count);
-        clrrgi  r9,r3,LOG2_GPR_BYTES// align pointer by zeroing right LOG2_GPR_BYTES bits
-        li             r10,-1                          // get 0xFFs
-        lg             r8,0(r9)                        // get word or doubleword with 1st operand byte
-        rlwinm  r11,r3,3,(GPR_BYTES-1)*8 // get starting bit position of operand
-#if defined(__ppc__)
-        lis            r6,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r7,hi16(0x80808080)
-        srw            r10,r10,r11                     // create a mask of 0xFF bytes for operand in r8
-        ori            r6,r6,lo16(0xFEFEFEFF)
-        ori            r7,r7,lo16(0x80808080)
-#else
-        ld             r6,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r7,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-        srd            r10,r10,r11                     // create a mask of 0xFF bytes for operand in r8
-#endif
-        orc     r8,r8,r10           // make sure bytes preceeding operand are nonzero
-        b       Lword0loopEnter
-        
-// Loop over words or doublewords looking for 0-byte marking end of dest.
-//             r4 = source ptr (unaligned)
-//             r5 = count (unchanged so far)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (aligned)
-
-        .align 5                                       // align inner loops for speed
-Lword0loop:
-        lgu            r8,GPR_BYTES(r9)    // r8 <- next dest word or doubleword
-Lword0loopEnter:
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        beq            Lword0loop                      // loop until 0 found
-
-// Now we know one of the bytes in r8 is zero, we just have to figure out which one. 
-// We have mapped 0 bytes to 0x80, and nonzero bytes to 0x00, with one exception:
-// 0x01 bytes preceeding the first zero are also mapped to 0x80.   So we have to mask
-// out the 0x80s caused by 0x01s before searching for the 0x80 byte.  Once the 0 is
-// found, we can start appending source.  We align the source, which allows us to
-// avoid worrying about spurious page faults.
-//             r4 = source ptr (unaligned)
-//             r5 = count (unchanged so far)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//      r8 = word or doubleword with a 0-byte
-//             r9 = ptr to the word or doubleword in r8 (aligned)
-//     r11 = mapped word or doubleword
-       
-        slgi   r10,r8,7                        // move 0x01 bits (false hits) into 0x80 position
-        andi.  r0,r4,GPR_BYTES-1   // is source aligned?
-        andc   r11,r11,r10                     // mask out false hits
-        cntlzg r10,r11                         // find 0 byte (r0 = 0, 8, 16, or 24)
-        subfic r0,r0,GPR_BYTES     // get #bytes to align r4
-        srwi   r10,r10,3                       // now r10 = 0, 1, 2, or 3
-        add            r9,r9,r10                       // now r9 points to the 0-byte in dest
-        beq            Laligned                        // skip if source already aligned
-        
-// Copy min(r0,r5) bytes, until 0-byte.
-//             r0 = #bytes we propose to copy (NOTE: must be >0)
-//             r4 = source ptr (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Lbyteloop:
-        cmpgi  r5,0                            // buffer empty? (note: count is unsigned)
-        beq--  L0notfound                      // buffer full but 0 not found
-        lbz            r8,0(r4)                        // r8 <- next source byte
-        subic. r0,r0,1                         // decrement count of bytes to move
-        addi   r4,r4,1
-        subi   r5,r5,1                         // decrement buffer length remaining
-        stb            r8,0(r9)                        // pack into dest
-        cmpwi  cr1,r8,0                        // 0-byte?
-        addi   r9,r9,1
-        beqlr  cr1                                     // byte was 0, so done
-        bne            Lbyteloop                       // r0!=0, source not yet aligned
-        
-// Source is aligned.  Loop over words or doublewords until 0-byte found
-// or end of buffer.
-//             r4 = source ptr (aligned)
-//             r5 = length remaining in buffer
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Laligned:
-        srgi.  r8,r5,LOG2_GPR_BYTES// get #words or doublewords in buffer
-        addi   r0,r5,1                         // if no words, copy rest of buffer
-        beq--  Lbyteloop                       // fewer than 4 bytes in buffer
-        mtctr  r8                                      // set up word loop count
-        rlwinm r5,r5,0,GPR_BYTES-1 // mask buffer length down to leftover bytes
-        b              LwordloopEnter
-        
-// Inner loop: move a word or doubleword at a time, until one of two conditions:
-//             - a zero byte is found
-//             - end of buffer
-// At this point, registers are as follows:
-//             r4 = source ptr (aligned)
-//             r5 = bytes leftover in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//     ctr = whole words or doublewords left in buffer
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lwordloop:
-        stg            r8,0(r9)                        // pack word or doubleword into destination
-        addi   r9,r9,GPR_BYTES
-LwordloopEnter:
-        lg             r8,0(r4)                        // r8 <- next GPR_BYTES source bytes
-        addi   r4,r4,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        bdnzt  eq,Lwordloop            // loop if ctr!=0 and cr0_eq
-        
-        beq--  LcheckLeftovers         // skip if 0-byte not found
-
-// Found a 0-byte.  Store last word up to and including the 0, a byte at a time.
-//             r8 = last word or doubleword, known to have a 0-byte
-//             r9 = dest ptr
-
-Lstorelastbytes:
-        srgi.  r0,r8,GPR_BYTES*8-8 // right justify next byte and test for 0
-        slgi   r8,r8,8                         // shift next byte into position
-        stb            r0,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        bne            Lstorelastbytes         // loop until 0 stored
-        
-        blr
-        
-// 0-byte not found while appending words to source.  There might be up to
-// GPR_BYTES-1 "leftover" bytes to append, hopefully the 0-byte is in there.
-//             r4 = source ptr (past word in r8)
-//             r5 = bytes leftover in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r8 = last word or doubleword of source, with no 0-byte
-//             r9 = dest ptr (unaligned)
-
-LcheckLeftovers:
-        stg            r8,0(r9)                        // store last whole word or doubleword of source
-        addi   r9,r9,GPR_BYTES
-        addi   r0,r5,1                         // let r5 (not r0) terminate byte loop
-        b              Lbyteloop                       // append last few bytes
-
-// 0-byte not found in source.  We append a 0 anyway, even though it will
-// be past the end of the buffer.  That's the way it's defined.
-//             r9 = dest ptr
-
-L0notfound:
-        li             r0,0
-        stb            r0,0(r9)                        // add a 0, past end of buffer
-        blr
-
diff --git a/ppc/string/strncmp.s b/ppc/string/strncmp.s
deleted file mode 100644 (file)
index 7ada490..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER               // we need the defs for cr7_eq etc
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// *****************
-// * S T R N C M P *
-// *****************
-//
-// int strncmp(const char *s1, const char *s2, size_t len);
-//
-// We optimize the compare by doing it word parallel.  This introduces
-// a complication: if we blindly did word loads from both sides until
-// finding a difference (or 0), we might get a spurious page fault by
-// reading bytes past the difference.  To avoid this, we never do a "lwz"
-// that crosses a page boundary.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// This routine is doubleword parallel in 64-bit mode.
-
-        .text
-        .globl EXT(strncmp)
-
-        .align         5
-LEXT(strncmp)                       // int strncmp(const char *s1,const char *s2,size_t len);
-        cmplgi cr1,r5,GPR_BYTES*2  // buffer too short to bother? (WARNING: cr1 is used later)
-        andi.  r0,r3,GPR_BYTES-1   // is LHS aligned?
-        subi   r3,r3,GPR_BYTES     // we use "lgu" in the inner loops
-        subi   r4,r4,GPR_BYTES
-        blt            cr1,Lshort                      // short buffer, just compare a byte at a time
-#if defined(__ppc__)
-        lis            r2,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r6,hi16(0x80808080)
-        ori            r2,r2,lo16(0xFEFEFEFF)
-        ori            r6,r6,lo16(0x80808080)
-#else
-        ld             r2,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r6,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-#endif
-        beq            Laligned                        // LHS is aligned
-        subfic r0,r0,GPR_BYTES     // r0 <- #bytes to align LHS
-        mtctr  r0
-        sub     r5,r5,r0            // adjust length
-        b              Lbyteloop
-        
-// Handle short operands or end-of-buffer.
-//             r3 = LHS ptr - GPR_BYTES (unaligned)
-//             r4 = RHS ptr - GPR_BYTES (unaligned)
-//             r5 = length remaining in buffer (0..GPR_BYTES*2-1)
-//        cr1 = blt set
-
-Lshort:
-        cmpgi  r5,0                            // buffer null?
-        mtctr  r5                                      // assume not null, set up for loop
-        bne            Lbyteloop                       // buffer not null
-        li             r3,0                            // if buffer null, say "equal"
-        blr
-
-// We're at a RHS page boundary.  Compare GPR_BYTES bytes in order to cross the page
-// but still keep the LHS ptr word-aligned.
-//             r2 = 0xFEFEFEFF
-//             r3 = LHS ptr - GPR_BYTES (aligned)
-//             r4 = RHS ptr - GPR_BYTES (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0x80808080
-
-Lcrosspage:
-        cmplgi cr1,r5,GPR_BYTES*2  // not enough left in buffer for word compares?
-        li             r0,GPR_BYTES        // get #bytes to cross RHS page
-        blt            cr1,Lshort                      // buffer is about to end
-        mtctr  r0                                      // set up to compare GPR_BYTES bytes
-        sub            r5,r5,r0                        // adjust length
-        b              Lbyteloop
-        
-// Compare bytes, until 0-byte or difference found.
-//             r2 = 0xFEFEFEFF (if cr1 bge)
-//             r3 = LHS ptr - GPR_BYTES (unaligned)
-//             r4 = RHS ptr - GPR_BYTES (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0x80808080 (if cr1 bge)
-//        cr1 = blt if this is end of buffer
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lbyteloop:
-        lbz            r7,GPR_BYTES(r3)    // next LHS byte
-        addi   r3,r3,1
-        lbz            r8,GPR_BYTES(r4)    // next RHS byte
-        addi   r4,r4,1
-        cmpwi  cr0,r7,0                        // zero?
-        cmpw   cr7,r7,r8                       // equal?
-        crandc cr0_eq,cr7_eq,cr0_eq// set cr0_eq if equal and not 0
-        bdnzt  eq,Lbyteloop            // loop until different, 0, or (ctr==0)
-                
-        bne            Ldifferent                      // done if bytes differ or are 0
-        blt            cr1,Ldifferent          // done if buffer end (ie, if r5==0)
-        
-// LHS is now aligned.  Loop over words or doublewords until end of RHS page
-// or buffer.  When we get to the end of the page, we compare GPR_BYTES bytes,
-// so that we keep the LHS aligned.
-//             r2 = 0xFEFEFEFF
-//             r3 = LHS ptr - GPR_BYTES (aligned)
-//             r4 = RHS ptr - GPR_BYTES (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0x80808080
-
-Laligned:
-        addi   r9,r4,GPR_BYTES     // restore true address of next RHS byte
-        rlwinm r9,r9,0,0xFFF           // get RHS offset in page
-        subfic r0,r9,4096                      // get #bytes left in RHS page
-        subfc  r7,r0,r5                        // ***
-        subfe  r8,r5,r5                        // * r9 <- min(r0,r5),
-        and            r7,r7,r8                        // * using algorithm in Compiler Writer's Guide
-        add            r9,r0,r7                        // ***
-        srgi.  r8,r9,LOG2_GPR_BYTES// get #words or doublewords we can compare
-        beq--  Lcrosspage                      // none so advance to next RHS page
-        slgi   r9,r8,LOG2_GPR_BYTES// get #bytes we will be comparing in parallel loop
-        mtctr  r8                                      // set up loop count
-        sub            r5,r5,r9                        // decrement length remaining
-        b              Lwordloop
-        
-// Inner loop: compare a word or doubleword at a time, until one of three conditions:
-//             - a difference is found
-//             - a zero byte is found
-//             - end of count (ie, end of buffer or RHS page, whichever is first)
-// At this point, registers are as follows:
-//             r2 = 0xFEFEFEFF
-//             r3 = LHS ptr - GPR_BYTES (aligned)
-//             r4 = RHS ptr - GPR_BYTES (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0x80808080
-//     ctr = count of words or doublewords until end of buffer or RHS page
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lwordloop:
-        lgu     r7,GPR_BYTES(r3)    // r7 <- next 4 or 8 LHS bytes
-        lgu     r8,GPR_BYTES(r4)    // r8 <- next 4 or 8 RHS bytes
-        add            r10,r7,r2                       // r10 <- LHS + 0xFEFEFEFF
-        andc   r12,r6,r7                       // r12 <- ~LHS & 0x80808080
-        xor            r11,r7,r8                       // r11 <- compare the words
-        and            r9,r10,r12                      // r9 <- nonzero iff LHS has a 0-byte
-        or.            r12,r9,r11                      // combine difference and 0-test vectors
-        bdnzt  eq,Lwordloop            // loop if ctr!=0 and cr0_eq
-        
-        beq--  Lcrosspage                      // skip if buffer or page end reached
-        
-// Found differing bytes and/or a 0-byte.  Determine which comes first, and
-// subtract the bytes to compute the return value.  We also need to mask out the
-// false hits in the 0-byte test, which consist of 0x01 bytes that preceed
-// the 0-byte.
-
-        slgi   r0,r7,7                         // move 0x01 bits in LHS into position 0x80
-        andc   r9,r9,r0                        // mask out the false 0-hits from 0x01 bytes
-        or             r11,r11,r9                      // recompute difference vector
-        cntlzg r0,r11                          // find 1st difference (r0 = 0..31 or 63)
-        rlwinm r9,r0,0,0x38            // byte align bit offset (r9 = 0,8,16, or 24)
-        addi   r0,r9,8                         // now, r0 = 8, 16, 24, or 32
-#if defined(__ppc__)
-        rlwnm  r7,r7,r0,24,31          // right justify differing bytes and mask off rest
-        rlwnm  r8,r8,r0,24,31
-#else
-        rldcl   r7,r7,r0,56         // right justify differing bytes and mask off rest
-        rldcl   r8,r8,r0,56
-#endif
-
-Ldifferent:                                                    // bytes in r7 and r8 differ or are 0
-        sub            r3,r7,r8                        // compute return value
-        blr
-        
diff --git a/ppc/string/strncpy.s b/ppc/string/strncpy.s
deleted file mode 100644 (file)
index eac7a6b..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        ASSEMBLER
-#include <mach/ppc/asm.h>
-#undef ASSEMBLER
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-/* We use mode-independent "g" opcodes such as "srgi".  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-// *****************
-// * S T R N C P Y *
-// *****************
-//
-// char*       strncpy(const char *dst, const char *src, size_t len);
-//
-// We optimize the move by doing it word parallel.  This introduces
-// a complication: if we blindly did word load/stores until finding
-// a 0, we might get a spurious page fault by touching bytes past it.
-// To avoid this, we never do a "lwz" that crosses a page boundary,
-// or store unnecessary bytes.
-//
-// The test for 0s relies on the following inobvious but very efficient
-// word-parallel test:
-//             x =  dataWord + 0xFEFEFEFF
-//             y = ~dataWord & 0x80808080
-//             if (x & y) == 0 then no zero found
-// The test maps any non-zero byte to zero, and any zero byte to 0x80,
-// with one exception: 0x01 bytes preceeding the first zero are also
-// mapped to 0x80.
-//
-// This algorithm is doubleword parallel in 64-bit mode.
-
-        .text
-        .globl EXT(strncpy)
-
-        .align         5
-LEXT(strncpy)                       // char* strncpy(const char *dst, const char *src, size_t len));
-        andi.  r0,r4,GPR_BYTES-1   // is source aligned?
-#if defined(__ppc__)
-        lis            r6,hi16(0xFEFEFEFF)     // start to generate 32-bit magic constants
-        lis            r7,hi16(0x80808080)
-        ori            r6,r6,lo16(0xFEFEFEFF)
-        ori            r7,r7,lo16(0x80808080)
-#else
-        ld             r6,_COMM_PAGE_MAGIC_FE(0)       // get 0xFEFEFEFE FEFEFEFF from commpage
-        ld             r7,_COMM_PAGE_MAGIC_80(0)       // get 0x80808080 80808080 from commpage
-#endif
-        mr             r9,r3                           // use r9 for dest ptr (must return r3 intact)
-        add            r2,r3,r5                        // remember where end of buffer is
-        beq            Laligned                        // source is aligned
-        subfic r0,r0,GPR_BYTES     // r0 <- #bytes to align source
-        
-// Copy min(r0,r5) bytes, until 0-byte.
-//             r0 = #bytes we propose to copy (NOTE: must be >0)
-//             r2 = ptr to 1st byte not in buffer
-//             r4 = source ptr (unaligned)
-//             r5 = length remaining in buffer (may be 0)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Lbyteloop:
-        cmpgi  r5,0                            // buffer empty? (note: length is unsigned)
-        beqlr--                                                // buffer full but 0 not found
-        lbz            r8,0(r4)                        // r8 <- next source byte
-        subic. r0,r0,1                         // decrement count of bytes to move
-        addi   r4,r4,1
-        subi   r5,r5,1                         // decrement buffer length remaining
-        cmpwi  cr1,r8,0                        // 0-byte?
-        stb            r8,0(r9)                        // pack into dest
-        addi   r9,r9,1
-        beq            cr1,L0found                     // byte was 0
-        bne            Lbyteloop                       // r0!=0, source not yet aligned
-        
-// Source is aligned.  Loop over words or doublewords until end of buffer.  Note that
-// we have aligned the source, rather than the dest, in order to avoid spurious
-// page faults.
-//             r2 = ptr to 1st byte not in buffer
-//             r4 = source ptr (aligned)
-//             r5 = length remaining in buffer
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-
-Laligned:
-        srgi.  r8,r5,LOG2_GPR_BYTES// get #words or doublewords in buffer
-        addi   r0,r5,1                         // if none, compare rest of buffer
-        beq--  Lbyteloop                       // r8==0, no words
-        mtctr  r8                                      // set up word loop count
-        rlwinm r5,r5,0,GPR_BYTES-1 // mask buffer length down to leftover bytes
-        b              Lwordloop
-        
-// Move a word or a doubleword at a time, until one of two conditions:
-//             - a zero byte is found
-//             - end of buffer
-// At this point, registers are as follows:
-//             r2 = ptr to 1st byte not in buffer
-//             r4 = source ptr (aligned)
-//             r5 = leftover bytes in buffer (0..GPR_BYTES-1)
-//             r6 = 0xFEFEFEFF
-//             r7 = 0x80808080
-//             r9 = dest ptr (unaligned)
-//     ctr = whole words or doublewords left in buffer
-
-        .align 5                                       // align inner loop, which is 8 words long
-Lwordloop:
-        lg             r8,0(r4)                        // r8 <- next 4 or 8 source bytes
-        addi   r9,r9,GPR_BYTES     // bump dest addr while we wait for data
-        addi   r4,r4,GPR_BYTES
-        add            r10,r8,r6                       // r10 <-  word + 0xFEFEFEFF
-        andc   r12,r7,r8                       // r12 <- ~word & 0x80808080
-        stg            r8,-GPR_BYTES(r9)   // pack word or doubleword into destination
-        and.   r11,r10,r12                     // r11 <- nonzero iff word has a 0-byte
-        bdnzt  eq,Lwordloop            // loop if ctr!=0 and cr0_eq
-        
-        addi   r0,r5,1                         // if no 0-byte found...
-        beq--  Lbyteloop                       // ...fill rest of buffer a byte at a time
-
-// Found a 0-byte, point to following byte with r9.
-        
-        slgi   r0,r8,7                         // move 0x01 false hit bits to 0x80 position
-        andc   r11,r11,r0                      // mask out false hits
-        cntlzg r0,r11                          // find the 0-byte (r0 = 0,8,16, or 24)
-        srwi   r0,r0,3                         // now r0 = 0, 1, 2, or 3 (0..7 if 64-bit)
-        subfic r0,r0,GPR_BYTES-1   // now r0 = 3, 2, 1, or 0
-        sub            r9,r9,r0                        // now r9 points one past the 0-byte
-        
-// Zero rest of buffer, if any.  We use the commpage bzero() routine.
-//             r2 = ptr to 1st byte not in buffer
-//             r9 = ptr to 1st byte to zero
-//
-// NB: commpage bzero() preserves r10-r12 by contract.
-
-L0found:
-        mflr    r12                 // save return
-        mr      r11,r3              // save original dest ptr
-        sub            r4,r2,r9                        // #bytes to zero (ie, rest of buffer)
-        mr      r3,r9               // point to 1st byte to zero
-        bla     _COMM_PAGE_BZERO
-        mtlr    r12                 // restore our return
-        mr      r3,r11              // restore ptr to original dest
-        blr
diff --git a/ppc/sys/Makefile.inc b/ppc/sys/Makefile.inc
deleted file mode 100644 (file)
index 48349ed..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.PATH: ${.CURDIR}/ppc/sys
-
-MDSRCS+= OSAtomic.s \
-       ldbl64.s \
-       _longjmp.s \
-       longjmp.s \
-       ppc_gettimeofday.s \
-       _setjmp.s \
-       setjmp.s \
-       _sigtramp.s
diff --git a/ppc/sys/OSAtomic.s b/ppc/sys/OSAtomic.s
deleted file mode 100644 (file)
index 24858e9..0000000
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright (c) 2007 Apple Inc. All rights reserved.
- * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-#include <architecture/ppc/mode_independent_asm.h>
-
-
-/* These are the functions in <libkern/OSAtomic.h>.
- * The actual primitives are implemented on the commpage.
- */
-
-/* int32_t     OSAtomicAdd32( int32_t theAmount, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicAdd32)
-    ba      _COMM_PAGE_ATOMIC_ADD32
-
-
-/* int32_t     OSAtomicOr32( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicOr32)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    or      r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicAnd32( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicAnd32)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    and     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicXor32( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicXor32)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    xor     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicOr32Orig( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicOr32Orig)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    mr      r10,r3             // save old value
-    or      r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r10              // return old value
-    blr
-
-
-/* int32_t     OSAtomicAnd32Orig( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicAnd32Orig)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    mr      r10,r3             // save old value
-    and     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r10              // return old value
-    blr
-
-
-/* int32_t     OSAtomicXor32Orig( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicXor32Orig)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    mr      r10,r3             // save old value
-    xor     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r10              // return old value
-    blr
-
-
-/* int64_t     OSAtomicAdd64( int64_t theAmount, int64_t *theValue ); */
-
-#if defined(__ppc64__)
-MI_ENTRY_POINT(_OSAtomicAdd64)
-    ba      _COMM_PAGE_ATOMIC_ADD64
-#endif  /* defined(__ppc64__) */
-
-
-/* bool OSAtomicCompareAndSwap32( int32_t oldValue, int32_t newValue, int32_t *theValue ); */
-/* bool OSAtomicCompareAndSwap64( int64_t oldValue, int64_t newValue, int64_t *theValue ); */
-/* bool OSAtomicCompareAndSwapPtr( void* oldValue, void* newValue, void* *theValue ); */
-/* bool OSAtomicCompareAndSwapInt( int oldValue, int newValue, int *theValue ); */
-/* bool OSAtomicCompareAndSwapLong( long oldValue, long newValue, long *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicCompareAndSwap32)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapInt)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32
-
-#if defined(__ppc64__)
-MI_ENTRY_POINT(_OSAtomicCompareAndSwap64)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP64
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapPtr)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP64
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapLong)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP64
-#else  /* !defined(__ppc64__) */
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapPtr)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapLong)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32
-#endif  /* defined(__ppc64__) */
-
-
-/* bool OSAtomicTestAndSet( uint32_t n, void *theAddress ); */
-
-MI_ENTRY_POINT(_OSAtomicTestAndSet)
-    mflr    r12                 // save return
-    srwi    r5,r3,3             // get byte offset of n
-    rlwinm  r6,r3,0,0x7         // get bit position within byte
-    add     r4,r4,r5            // r4 points to byte containing the bit
-    lis     r10,0x8000          // light bit 0
-    rlwimi  r6,r4,3,0x18        // r6 is bit position within word
-    clrrgi  r5,r4,2             // point to word containing the bit
-    srw     r10,r10,r6          // get mask for bit
-    addi    r9,r6,1             // save bit position + 1
-1:
-    lwz     r3,0(r5)            // get old word
-    rlwnm   r11,r3,r9,0x1       // right justify old value of bit
-    or      r4,r3,r10           // set it in new word
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r11              // return original value of bit
-    blr
-
-
-/* bool OSAtomicTestAndClear( uint32_t n, void *theAddress ); */
-
-MI_ENTRY_POINT(_OSAtomicTestAndClear)
-    mflr    r12                 // save return
-    srwi    r5,r3,3             // get byte offset of n
-    rlwinm  r6,r3,0,0x7         // get bit position within byte
-    add     r4,r4,r5            // r4 points to byte containing the bit
-    lis     r10,0x8000          // light bit 0
-    rlwimi  r6,r4,3,0x18        // r6 is bit position within word
-    clrrgi  r5,r4,2             // point to word containing the bit
-    srw     r10,r10,r6          // get mask for bit
-    addi    r9,r6,1             // save bit position + 1
-1:
-    lwz     r3,0(r5)            // get old word
-    rlwnm   r11,r3,r9,0x1       // right justify old value of bit
-    andc    r4,r3,r10           // clear it in new word
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r11              // return original value of bit
-    blr
-
-/* int32_t     OSAtomicAdd32Barrier( int32_t theAmount, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicAdd32Barrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy theAmount
-1:
-    lwz     r3,0(r5)            // get old value
-    add     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicOr32Barrier( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicOr32Barrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    or      r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicAnd32Barrier( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicAnd32Barrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    and     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicXor32Barrier( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicXor32Barrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    xor     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-
-
-/* int32_t     OSAtomicOr32OrigBarrier( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicOr32OrigBarrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    mr      r10,r3             // save old value
-    or      r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r10             // return old value
-    blr
-
-
-/* int32_t     OSAtomicAnd32OrigBarrier( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicAnd32OrigBarrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    mr      r10,r3             // save old value
-    and     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r10             // return old value
-    blr
-
-
-/* int32_t     OSAtomicXor32OrigBarrier( int32_t theMask, int32_t *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicXor32OrigBarrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy mask
-1:
-    lwz     r3,0(r5)            // get old value
-    mr      r10,r3             // save old value
-    xor     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r10             // return old value
-    blr
-
-
-/* int64_t     OSAtomicAdd64Barrier( int64_t theAmount, int64_t *theValue ); */
-
-#if defined(__ppc64__)
-MI_ENTRY_POINT(_OSAtomicAdd64Barrier)
-    mflr    r12                 // save return address
-    mr      r5,r4               // move ptr to where compare-and-swap wants it
-    mr      r11,r3              // copy theAmount
-1:
-    ld      r3,0(r5)            // get old value
-    add     r4,r3,r11           // make new value
-    bla     _COMM_PAGE_COMPARE_AND_SWAP64B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r4               // return new value
-    blr
-#endif  /* defined(__ppc64__) */
-
-
-/* bool OSAtomicCompareAndSwap32Barrier( int32_t oldValue, int32_t newValue, int32_t *theValue ); */
-/* bool OSAtomicCompareAndSwap64Barrier( int64_t oldValue, int64_t newValue, int64_t *theValue ); */
-/* bool OSAtomicCompareAndSwapPtrBarrier( void* oldValue, void* newValue, void* *theValue ); */
-/* bool OSAtomicCompareAndSwapIntBarrier( int oldValue, int newValue, int *theValue ); */
-/* bool OSAtomicCompareAndSwapLongBarrier( long oldValue, long newValue, long *theValue ); */
-
-MI_ENTRY_POINT(_OSAtomicCompareAndSwap32Barrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32B
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapIntBarrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32B
-
-#if defined(__ppc64__)
-MI_ENTRY_POINT(_OSAtomicCompareAndSwap64Barrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP64B
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapPtrBarrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP64B
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapLongBarrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP64B
-#else  /* !defined(__ppc64__) */
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapPtrBarrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32B
-MI_ENTRY_POINT(_OSAtomicCompareAndSwapLongBarrier)
-    ba      _COMM_PAGE_COMPARE_AND_SWAP32B
-#endif  /* defined(__ppc64__) */
-
-
-/* bool OSAtomicTestAndSetBarrier( uint32_t n, void *theAddress ); */
-
-MI_ENTRY_POINT(_OSAtomicTestAndSetBarrier)
-    mflr    r12                 // save return
-    srwi    r5,r3,3             // get byte offset of n
-    rlwinm  r6,r3,0,0x7         // get bit position within byte
-    add     r4,r4,r5            // r4 points to byte containing the bit
-    lis     r10,0x8000          // light bit 0
-    rlwimi  r6,r4,3,0x18        // r6 is bit position within word
-    clrrgi  r5,r4,2             // point to word containing the bit
-    srw     r10,r10,r6          // get mask for bit
-    addi    r9,r6,1             // save bit position + 1
-1:
-    lwz     r3,0(r5)            // get old word
-    rlwnm   r11,r3,r9,0x1       // right justify old value of bit
-    or      r4,r3,r10           // set it in new word
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r11              // return original value of bit
-    blr
-
-
-/* bool OSAtomicTestAndClearBarrier( uint32_t n, void *theAddress ); */
-
-MI_ENTRY_POINT(_OSAtomicTestAndClearBarrier)
-    mflr    r12                 // save return
-    srwi    r5,r3,3             // get byte offset of n
-    rlwinm  r6,r3,0,0x7         // get bit position within byte
-    add     r4,r4,r5            // r4 points to byte containing the bit
-    lis     r10,0x8000          // light bit 0
-    rlwimi  r6,r4,3,0x18        // r6 is bit position within word
-    clrrgi  r5,r4,2             // point to word containing the bit
-    srw     r10,r10,r6          // get mask for bit
-    addi    r9,r6,1             // save bit position + 1
-1:
-    lwz     r3,0(r5)            // get old word
-    rlwnm   r11,r3,r9,0x1       // right justify old value of bit
-    andc    r4,r3,r10           // clear it in new word
-    bla     _COMM_PAGE_COMPARE_AND_SWAP32B   // preserves r4,r5,r9-r12
-    cmpwi   r3,0                // did swap occur?
-    beq--   1b                  // compare-and-swap failed, try again
-    mtlr    r12                 // restore return adddress
-    mr      r3,r11              // return original value of bit
-    blr
-    
-/* bool    OSSpinLockTry( OSSpinLock *lock ); */
-
-MI_ENTRY_POINT(_OSSpinLockTry)
-    .globl  __spin_lock_try
-__spin_lock_try:
-    ba      _COMM_PAGE_SPINLOCK_TRY
-    
-
-/* void    OSSpinLockLock( OSSpinLock *lock ); */
-
-MI_ENTRY_POINT(_OSSpinLockLock)
-    .globl  _spin_lock
-    .globl  __spin_lock
-_spin_lock:
-__spin_lock:
-    ba      _COMM_PAGE_SPINLOCK_LOCK
-    
-
-/* void    OSSpinLockUnlock( OSSpinLock *lock ); */
-
-MI_ENTRY_POINT(_OSSpinLockUnlock)
-    .globl  _spin_unlock
-    .globl  __spin_unlock
-_spin_unlock:
-__spin_unlock:
-    ba      _COMM_PAGE_SPINLOCK_UNLOCK
-    
-
-/* void    OSMemoryBarrier( void ); */
-
-MI_ENTRY_POINT(_OSMemoryBarrier)
-    ba     _COMM_PAGE_MEMORY_BARRIER
-
-
-/* void  OSAtomicEnqueue( OSQueueHead *list, void *new, size_t offset); */
-
-MI_ENTRY_POINT(_OSAtomicEnqueue)
-    ba      _COMM_PAGE_ENQUEUE
-    
-    
-/* void* OSAtomicDequeue( OSQueueHead *list, size_t offset); */
-
-MI_ENTRY_POINT(_OSAtomicDequeue)
-    ba      _COMM_PAGE_DEQUEUE
diff --git a/ppc/sys/_longjmp.s b/ppc/sys/_longjmp.s
deleted file mode 100644 (file)
index e82f09f..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/*
- * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
- *
- *     File: sys/ppc/_longjmp.s
- *
- *     Implements _longjmp()
- *
- *     History:
- *     8 September 1998        Matt Watson (mwatson@apple.com)
- *             Created. Derived from longjmp.s
- */
-
-/* We use mode-independent "g" opcodes such as "lg", and/or
- * mode-independent macros such as MI_CALL_EXTERNAL.  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-#include "_setjmp.h"
-
-#define __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef  __APPLE_API_PRIVATE
-
-#define        VRSave  256
-
-
-/*     int _longjmp(jmp_buf env, int val); */
-            
-MI_ENTRY_POINT(__longjmp)
-        lg      r6,JMP_addr_at_setjmp(r3)
-        lbz     r7, _COMM_PAGE_ALTIVEC(0)
-        cmpg   cr1,r3,r6           ; jmpbuf still at same address?
-        cmpwi   cr2,r7,0            ; Altivec available? (using non-volatile cr)
-        beq++   cr1,LRestoreVRs     ; jmpbuf has not moved
-        
-        ; jmp_buf was moved since setjmp (or is uninitialized.)
-        ; We must move VRs and FPRs to be quadword aligned at present address.
-        
-        stg     r3,JMP_addr_at_setjmp(r3) ; update, in case we longjmp to this again
-        mr      r31,r4              ; save "val" arg across memmove
-        mr      r30,r3              ; and jmp_buf ptr
-        addi   r3,r3,JMP_vr_base_addr
-        addi   r4,r6,JMP_vr_base_addr
-        clrrgi  r3,r3,4             ; r3 <- QW aligned addr where they should be
-        clrrgi  r4,r4,4             ; r4 <- QW aligned addr where they originally were
-        sub     r7,r4,r6            ; r7 <- offset of VRs/FPRs within jmp_buf
-        add     r4,r30,r7           ; r4 <- where they are now
-        li     r5,(JMP_buf_end - JMP_vr_base_addr)
-        
-        MI_CALL_EXTERNAL(_memmove)
-
-        mr      r3,r30              ; restore parameters
-        mr      r4,r31
-        
-        ; Restore VRs iff any
-        ;      cr2 - beq if AltiVec not available
-        
-LRestoreVRs:
-        lg      r0,JMP_vrsave(r3)   ; get VRSAVE at setjmp()
-        addi   r6,r3,JMP_vr_base_addr
-        beq--   cr2,LRestoreFPRs    ; AltiVec not available so skip
-        cmpwi  r0,0                ; any live VRs?
-        mtspr  VRSave,r0           ; update VRSAVE whether 0 or not
-        beq++  LRestoreFPRs        ; VRSAVE is 0 so no VRs to reload
-        lvx     v20,0,r6
-        li      r7,16*1
-        lvx     v21,r7,r6
-        li      r7,16*2
-        lvx     v22,r7,r6
-        li      r7,16*3
-        lvx     v23,r7,r6
-        li      r7,16*4
-        lvx     v24,r7,r6
-        li      r7,16*5
-        lvx     v25,r7,r6
-        li      r7,16*6
-        lvx     v26,r7,r6
-        li      r7,16*7
-        lvx     v27,r7,r6
-        li      r7,16*8
-        lvx     v28,r7,r6
-        li      r7,16*9
-        lvx     v29,r7,r6
-        li      r7,16*10
-        lvx     v30,r7,r6
-        li      r7,16*11
-        lvx     v31,r7,r6
-        
-        ; Restore FPRs
-        
-LRestoreFPRs:
-        addi   r6,r3,JMP_fp_base_addr
-        lfd     f0,JMP_fpscr(r3)    ; get FPSCR from non-sliding section of jmpbuf
-        clrrgi r6,r6,4             ; mask off low 4 bits to qw align
-        lfd     f14,0*8(r6)
-        lfd     f15,1*8(r6)
-        lfd     f16,2*8(r6)
-        lfd     f17,3*8(r6)
-        lfd     f18,4*8(r6)
-        lfd     f19,5*8(r6)
-        lfd     f20,6*8(r6)
-        lfd     f21,7*8(r6)
-        lfd     f22,8*8(r6)
-        lfd     f23,9*8(r6)
-        lfd     f24,10*8(r6)
-        lfd     f25,11*8(r6)
-        lfd     f26,12*8(r6)
-        lfd     f27,13*8(r6)
-        lfd     f28,14*8(r6)
-        lfd     f29,15*8(r6)
-        lfd     f30,16*8(r6)
-        lfd     f31,17*8(r6)
-        mtfsf   0xFF,f0             ; restore entire FPSCR
-        
-        ; Restore GPRs
-        
-        lg      r5,  JMP_cr(r3)     ; r5 <- CR
-        lg      r6,  JMP_lr(r3)     ; r6 <- LR (ie, return addres)
-        cmplgi  r4,0                ; is return value 0? (not permitted)
-        lg      r1,  JMP_r1 (r3)
-        lg      r2,  JMP_r2 (r3)
-        lg      r13, JMP_r13(r3)
-        lg      r14, JMP_r14(r3)
-        lg      r15, JMP_r15(r3)
-        lg      r16, JMP_r16(r3)
-        lg      r17, JMP_r17(r3)
-        mtcrf   0x20,r5             ; restore cr2 (we only restore non-volatile CRs)
-        lg      r18, JMP_r18(r3)
-        lg      r19, JMP_r19(r3)
-        lg      r20, JMP_r20(r3)
-        lg      r21, JMP_r21(r3)
-        mtctr   r6                  ; set up return address, avoiding LR since it will mispredict
-        lg      r22, JMP_r22(r3)
-        lg      r23, JMP_r23(r3)
-        lg      r24, JMP_r24(r3)
-        lg      r25, JMP_r25(r3)
-        mtcrf   0x10,r5             ; restore cr3
-        lg      r26, JMP_r26(r3)
-        lg      r27, JMP_r27(r3)
-        lg      r28, JMP_r28(r3)
-        lg      r29, JMP_r29(r3)
-        mtcrf   0x08,r5             ; restore cr4
-        lg      r30, JMP_r30(r3)
-        lg      r31, JMP_r31(r3)
-        mr      r3,r4               ; move return code into position (cr0 is set on r4)
-        bnectr++                    ; return code was not 0
-        li      r3, 1               ; cannot return zero from longjmp(), so return 1 instead
-        bctr
-
diff --git a/ppc/sys/_setjmp.h b/ppc/sys/_setjmp.h
deleted file mode 100644 (file)
index 68fb686..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- *     Copyright (c) 1998, Apple Computer Inc. All rights reserved.
- *
- *     File: _setjmp.h
- *
- *     Defines for register offsets in the save area.
- *
- */
-
-/* NOTE: jmp_bufs are only 4-byte aligned.  This means we
- * need to pad before the VR and FPR save areas, so that they
- * can be naturally aligned in the buffer.  In case a jmp_buf
- * is bcopy'd to a different alignment between the setjmp
- * and longjmp, we need to save the jmp_buf address in the
- * jmp_buf at setjmp time, so we can realign before reloading.
- *
- * ALSO NOTE: the typedef for jmpbufs in <ppc/setjmp.h> is
- * 192 ints (0x300 bytes) long, due to incorrectly assuming
- * that we need to save all 32 VRs in a jmpbuf.  This is
- * fortuitous, because when it came time to add additional
- * fields and expand GPRs for 64-bit mode, there was plenty
- * of unused space!
- */
- /* 32-bit-mode layout */
-#if defined(__ppc__)
-#define JMP_r1 0x00
-#define JMP_r2 0x04
-#define JMP_r13        0x08
-#define JMP_r14        0x0c
-#define JMP_r15        0x10
-#define JMP_r16        0x14
-#define JMP_r17        0x18
-#define JMP_r18        0x1c
-#define JMP_r19        0x20
-#define JMP_r20        0x24
-#define JMP_r21        0x28
-#define JMP_r22        0x2c
-#define JMP_r23        0x30
-#define JMP_r24        0x34
-#define JMP_r25        0x38
-#define JMP_r26        0x3c
-#define JMP_r27        0x40
-#define JMP_r28        0x44
-#define JMP_r29        0x48
-#define JMP_r30        0x4c
-#define JMP_r31        0x50
-#define JMP_lr  0x54
-#define JMP_cr  0x58
-#define JMP_SIGFLAG 0x5c
-#define JMP_sig        0x60    /* reserve 8 bytes for sigmask */
-#define JMP_fpscr  0x68 /* reserve 8 bytes for FPSCR too */
-#define JMP_vrsave 0x70
-#define JMP_addr_at_setjmp 0x74
-/* 12 bytes padding here */
-#define JMP_vr_base_addr 0x84
-/* save room for 12 VRs (v20-v31), or 0xC0 bytes */
-#define JMP_fp_base_addr 0x144
-/* save room for 18 FPRs (f14-f31), or 0x90 bytes */
-#define        JMP_ss_flags     0x1d4
-#define JMP_buf_end 0x1d8
-
- /* 64-bit-mode layout */
-
-#elif defined(__ppc64__)
-
-#define JMP_r1 0x00
-#define JMP_r2 0x08
-#define JMP_r13        0x10
-#define JMP_r14        0x18
-#define JMP_r15        0x20
-#define JMP_r16        0x28
-#define JMP_r17        0x30
-#define JMP_r18        0x38
-#define JMP_r19        0x40
-#define JMP_r20        0x48
-#define JMP_r21        0x50
-#define JMP_r22        0x58
-#define JMP_r23        0x60
-#define JMP_r24        0x68
-#define JMP_r25        0x70
-#define JMP_r26        0x78
-#define JMP_r27        0x80
-#define JMP_r28        0x88
-#define JMP_r29        0x90
-#define JMP_r30        0x98
-#define JMP_r31        0xa0
-#define JMP_lr  0xa8
-#define JMP_cr  0xb0
-#define JMP_sig        0xb8
-#define JMP_SIGFLAG 0xc0
-#define JMP_fpscr  0xc8
-#define JMP_vrsave 0xd0
-#define JMP_addr_at_setjmp 0xd8
-/* 12 bytes padding here */
-#define JMP_vr_base_addr 0x0ec
-/* save room for 12 VRs (v20-v31), or 0xC0 bytes */
-#define JMP_fp_base_addr 0x1ac
-/* save room for 18 FPRs (f14-f31), or 0x90 bytes */
-#define        JMP_ss_flags     0x23c
-#define JMP_buf_end 0x240
-
-#else
-#error architecture not supported
-#endif
\ No newline at end of file
diff --git a/ppc/sys/_setjmp.s b/ppc/sys/_setjmp.s
deleted file mode 100644 (file)
index 66d6b0b..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/*     int _setjmp(jmp_buf env); */
-/*
- * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
- *
- *     File: sys/ppc/_setjmp.s
- *
- *     Implements _setjmp()
- *
- *     History:
- *     8 September 1998        Matt Watson (mwatson@apple.com)
- *             Created. Derived from setjmp.s
- */
-
-/* We use mode-independent "g" opcodes such as "stg", and/or
- * mode-independent macros such as MI_GET_ADDRESS.  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-#define __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef  __APPLE_API_PRIVATE
-
-#include "_setjmp.h"
-
-#define        VRSave  256
-
-
-MI_ENTRY_POINT(__setjmp)
-        lbz     r7, _COMM_PAGE_ALTIVEC(0)   ; get "AltiVec available" flag
-
-        stg     r1, JMP_r1(r3)
-        stg     r2, JMP_r2(r3)
-        stg     r13, JMP_r13(r3)
-        stg     r14, JMP_r14(r3)
-        stg     r15, JMP_r15(r3)
-        stg     r16, JMP_r16(r3)
-        stg     r17, JMP_r17(r3)
-        stg     r18, JMP_r18(r3)
-        stg     r19, JMP_r19(r3)
-        mfcr    r0                      ; we only need to save cr2-cr4
-        stg     r20, JMP_r20(r3)
-        stg     r21, JMP_r21(r3)
-        stg     r22, JMP_r22(r3)
-        stg     r23, JMP_r23(r3)
-        stg     r24, JMP_r24(r3)
-        mflr    r5
-        stg     r25, JMP_r25(r3)
-        stg     r26, JMP_r26(r3)
-        stg     r27, JMP_r27(r3)
-        stg     r28, JMP_r28(r3)
-        stg     r29, JMP_r29(r3)
-        stg     r30, JMP_r30(r3)
-        stg     r31, JMP_r31(r3)
-        stg     r0, JMP_cr(r3)
-        stg     r5, JMP_lr(r3)
-
-        addi   r6,r3,JMP_fp_base_addr  ; point to base of FPR save area
-        stg     r3,JMP_addr_at_setjmp(r3)   ; remember original address of jmpbuf
-        clrrgi r6,r6,4                 ; mask off low 4 bits to qw align
-        mffs    f0                      ; get FPSCR
-        stfd   f14,0*8(r6)
-        stfd   f15,1*8(r6)
-        stfd   f16,2*8(r6)
-        stfd   f17,3*8(r6)
-        stfd   f18,4*8(r6)
-        stfd   f19,5*8(r6)
-        stfd   f20,6*8(r6)
-        stfd   f21,7*8(r6)
-        stfd   f22,8*8(r6)
-        stfd   f23,9*8(r6)
-        stfd   f24,10*8(r6)
-        stfd   f25,11*8(r6)
-        stfd   f26,12*8(r6)
-        stfd   f27,13*8(r6)
-        stfd   f28,14*8(r6)
-        stfd   f29,15*8(r6)
-        stfd   f30,16*8(r6)
-        stfd   f31,17*8(r6)
-        stfd    f0,JMP_fpscr(r3)        ; save fpscr in non-sliding region of jmpbuf
-        
-        cmpwi   r7,0                    ; is AltiVec available? (test _COMM_PAGE_ALTIVEC)
-        addi   r6,r3,JMP_vr_base_addr  ; get base address of VR save area
-        addi    r8,r3,JMP_vrsave        ; we'll need this address below
-        li      r3,0                    ; set return value (always 0 on setjmp)
-        beqlr--                         ; exit if no Altivec
-        
-        mfspr  r4,VRSave               ; AltiVec available, so get VRSAVE mask
-        andi.  r0,r4,0xFFF             ; we only care about v20-v31
-        stg     r0,0(r8)                ; save effective VRSAVE in JMP_vrsave
-        beqlr++                         ; if no live non-volatile VRs, we're done
-
-        stvx   v20,0,r6
-        li      r4,16*1
-        stvx   v21,r4,r6
-        li      r4,16*2
-        stvx   v22,r4,r6
-        li      r4,16*3
-        stvx   v23,r4,r6
-        li      r4,16*4
-        stvx   v24,r4,r6
-        li      r4,16*5
-        stvx   v25,r4,r6
-        li      r4,16*6
-        stvx   v26,r4,r6
-        li      r4,16*7
-        stvx   v27,r4,r6
-        li      r4,16*8
-        stvx   v28,r4,r6
-        li      r4,16*9
-        stvx   v29,r4,r6
-        li      r4,16*10
-        stvx   v30,r4,r6
-        li      r4,16*11
-        stvx   v31,r4,r6
-
-        blr
-
diff --git a/ppc/sys/_sigtramp.s b/ppc/sys/_sigtramp.s
deleted file mode 100644 (file)
index 92be538..0000000
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * Copyright (c) 2007, 2011 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <architecture/ppc/mode_independent_asm.h>
-#include <sys/syscall.h>
-
-#define UC_TRAD                        1
-#define UC_TRAD64              20
-#define UC_TRAD64_VEC          25
-#define UC_FLAVOR              30
-#define UC_FLAVOR_VEC          35
-#define UC_FLAVOR64            40
-#define UC_FLAVOR64_VEC                45
-#define UC_DUAL                        50
-#define UC_DUAL_VEC            55
-
-/* Structure fields and sizes for ucontext and mcontext.  */
-#define UCONTEXT_UC_MCSIZE     MODE_CHOICE (24, 40)
-#define UCONTEXT_UC_MCONTEXT   MODE_CHOICE (28, 48)
-#define MCONTEXT_SIZE          1032
-#define MCONTEXT64_SIZE                1176
-#define UC_FLAVOR64_SIZE       600
-#define UC_FLAVOR64_VEC_SIZE   MCONTEXT64_SIZE
-
-#define MCONTEXT_ES_EXCEPTION  8
-#define MCONTEXT_SS_SRR0       32
-#define MCONTEXT_SS_SRR1       36
-#define MCONTEXT_SS_R0         40
-#define MCONTEXT_SS_CR         168
-#define MCONTEXT_SS_XER                172
-#define MCONTEXT_SS_LR         176
-#define MCONTEXT_SS_CTR                180
-#define MCONTEXT_SS_MQ         184
-#define MCONTEXT_SS_VRSAVE     188
-#define MCONTEXT_FS_FPREGS     192
-#define MCONTEXT_FS_FPSCR      448
-#define MCONTEXT_VS_SAVE_VR    456
-#define MCONTEXT_VS_VSCR       968
-
-#define MCONTEXT64_ES_EXCEPTION        12
-#define MCONTEXT64_SS_SRR0     32
-#define MCONTEXT64_SS_SRR1     40
-#define MCONTEXT64_SS_R0       48
-#define MCONTEXT64_SS_CR       304
-#define MCONTEXT64_SS_XER      308
-#define MCONTEXT64_SS_LR       316
-#define MCONTEXT64_SS_CTR      324
-#define MCONTEXT64_SS_VRSAVE   332
-#define MCONTEXT64_FS_FPREGS   336
-#define MCONTEXT64_FS_FPSCR    592
-#define MCONTEXT64_VS_SAVE_VR  600
-#define MCONTEXT64_VS_VSCR     1112
-
-/* Exception types.  I believe the MCONTEXT_ES_EXCEPTION field is set from
-   the address called to handle the exception, for example a
-   Program Exception jumps to address 0x00700 and so the field has
-   value 7.  */
-#define EXCEPTION_DSI 3
-#define EXCEPTION_ISI 4
-#define EXCEPTION_INTERRUPT 5
-#define EXCEPTION_ALIGN 6
-#define EXCEPTION_PROGRAM 7
-#define EXCEPTION_FPUNAVAIL 8
-#define EXCEPTION_DEC 9
-#define EXCEPTION_SC 0xC
-#define EXCEPTION_TRACE 0xD
-#define EXCEPTION_FPASSIST 0xE
-
-/* register allocation:
-       r0 : scratch, also used by MI_* macros
-       r3 : parameter union __sigaction_u __sigaction_u
-       r4 : parameter int sigstyle
-       r5 : parameter int sig
-       r6 : parameter siginfo_t *sinfo
-       r7 : parameter ucontext_t *uctx
-       r8 : value of __in_sigtramp
-       r9 : &__in_sigtramp
-       r12: scratch used by MI_* macros
-
-       r29 : sigstyle
-       r28 : uctx
-       r27 : uctx->uc_mcontext
-       
-*/
-
-MI_ENTRY_POINT(__sigtramp)
-       /* Save away sigstyle and uctx.  This code doesn't need to
-          restore the callee-saved registers, since sigreturn
-          will do it.  */
-       mr r28,r7
-       mr r29,r4
-#if defined(__DYNAMIC__)
-       /* ++__in_sigtramp; */
-       MI_GET_ADDRESS (r9, ___in_sigtramp)
-       lwz r8,0(r9)
-       addi r8,r8,1
-       stw r8,0(r9)
-#endif
-       /* Having this here shortens the unwind tables significantly.  */
-       lg r27,UCONTEXT_UC_MCONTEXT(r7)
-
-       /* Call the signal handler.
-          Some variants are not supposed to get the last two parameters,
-          but the test to prevent this is more expensive than just passing
-          them.  */
-       mtctr r3
-       mr r3,r5
-       mr r4,r6
-       mr r5,r7
-Lcall_start:
-       bctrl
-Lcall_end:
-
-       /* Call __finish_sigtramp in sigtramp.c to complete processing
-          for ppc, or just return to the kernel using sigtramp for ppc64.  */
-       mr r3,r28
-       mr r4,r29
-       b MODE_CHOICE (___finish_sigtramp, ___sigreturn)
-       /* Does not return.  */
-
-/* DWARF unwind table #defines.  */
-#define DW_CFA_advance_loc_4 0x44
-#define DW_CFA_def_cfa 0x0c
-#define DW_CFA_def_cfa_expression 0x0F
-#define DW_CFA_expression 0x10
-#define DW_CFA_val_expression 0x16
-#define DW_CFA_offset(column) 0x80+(column)
-
-/* DWARF expression #defines.  */
-#define DW_OP_deref 0x06
-#define DW_OP_const1u 0x08
-#define DW_OP_dup 0x12
-#define DW_OP_drop 0x13
-#define DW_OP_over 0x14
-#define DW_OP_pick 0x15
-#define DW_OP_swap 0x16
-#define DW_OP_rot 0x17
-#define DW_OP_abs 0x19
-#define DW_OP_and 0x1a
-#define DW_OP_div 0x1b
-#define DW_OP_minus 0x1c
-#define DW_OP_mod 0x1d
-#define DW_OP_mul 0x1e
-#define DW_OP_neg 0x1f
-#define DW_OP_not 0x20
-#define DW_OP_or 0x21
-#define DW_OP_plus 0x22
-#define DW_OP_plus_uconst 0x23
-#define DW_OP_shl 0x24
-#define DW_OP_shr 0x25
-#define DW_OP_shra 0x26
-#define DW_OP_xor 0x27
-#define DW_OP_skip 0x2f
-#define DW_OP_bra 0x28
-#define DW_OP_eq 0x29
-#define DW_OP_ge 0x2A
-#define DW_OP_gt 0x2B
-#define DW_OP_le 0x2C
-#define DW_OP_lt 0x2D
-#define DW_OP_ne 0x2E
-#define DW_OP_lit(n) 0x30+(n)
-#define DW_OP_breg(n) 0x70+(n)
-#define DW_OP_deref_size 0x94
-
-/* The location expressions we'll use.  */
-
-#ifdef __ppc__
-/* The ppc versions test register 29 for UC_TRAD64, UC_TRAD64_VEC,
-   UC_FLAVOR64, UC_FLAVOR64_VEC, and then use the appropriate offset
-   off r27 (either the offset for a mcontext or a mcontext64).  
-
-   The expression computed has been somewhat optimised to reduce the size
-   of the unwind entries, and is of the form
-
-   (r27 + offs
-    + ((r29/10)==UC_TRAD64/10 || (r29/10)==UC_FLAVOR64/10)*(offs64-offs))
-*/
-
-/* For when REGNO < 128 and OFFS < 64.  */
-#define loc_expr_for_reg_sml(regno, offs, offs64)                      \
-       .byte DW_CFA_expression, regno, 17 /* block length */,          \
-        DW_OP_breg(27), offs,                                          \
-         DW_OP_breg(29), 0, DW_OP_lit(10), DW_OP_div,                  \
-          DW_OP_dup, DW_OP_lit(UC_TRAD64/10), DW_OP_eq,                \
-           DW_OP_swap, DW_OP_lit(UC_FLAVOR64/10), DW_OP_eq, DW_OP_or,  \
-          DW_OP_const1u, offs64-(offs), DW_OP_mul, DW_OP_plus
-
-/* For when REGNO < 128 and OFFS >= 64.  */
-#define loc_expr_for_reg(regno, offs, offs64)                          \
-       .byte DW_CFA_expression, regno, 18 /* block length */,          \
-        DW_OP_breg(27), (offs & 0x7F) | 0x80, (offs >> 7),             \
-         DW_OP_breg(29), 0, DW_OP_lit(10), DW_OP_div,                  \
-          DW_OP_dup, DW_OP_lit(UC_TRAD64/10), DW_OP_eq,                \
-           DW_OP_swap, DW_OP_lit(UC_FLAVOR64/10), DW_OP_eq, DW_OP_or,  \
-          DW_OP_const1u, offs64-(offs), DW_OP_mul, DW_OP_plus
-
-#else
-
-/* The kernel always gives a ppc64 process a mcontext64, so just use
-   that offset.  */
-#define loc_expr_for_reg(regno, offs, offs64)                  \
-       .byte DW_CFA_expression, regno, 3 /* block length */,   \
-        DW_OP_breg(27), (offs64 & 0x7F) | 0x80, (offs64 >> 7)
-
-#define loc_expr_for_reg_sml(regno, offs, offs64)      \
-  loc_expr_for_reg(regno, offs, offs64)
-
-#endif /* __ppc__ */
-
-#define loc_expr_varying(regno, offs, offs64)                  \
-  loc_expr_for_reg (regno, offs, (offs64+MODE_CHOICE(4,0)))
-
-/* For REGNO < 22 */
-#define loc_expr_gpr_sml(regno)                                                \
- loc_expr_for_reg_sml (regno, MCONTEXT_SS_R0+(4*regno),                        \
-                      MCONTEXT64_SS_R0+(8*regno)+MODE_CHOICE (4,0))
-
-/* For REGNO >= 22 */
-#define loc_expr_gpr(regno)                            \
- loc_expr_varying (regno, MCONTEXT_SS_R0+(4*regno),    \
-                  MCONTEXT64_SS_R0+(8*regno))
-
-#define loc_expr_fpr(regno)                                    \
- loc_expr_for_reg (regno+32, MCONTEXT_FS_FPREGS+(8*regno),     \
-                  MCONTEXT64_FS_FPREGS+(8*regno))
-#define loc_expr_vr(regno)                                     \
- loc_expr_for_reg (regno+77, MCONTEXT_VS_SAVE_VR+(16*regno),   \
-                  MCONTEXT64_VS_SAVE_VR+(16*regno))
-
-       /* Unwind tables.  */
-       .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
-EH_frame1:
-       .set L$set$0,LECIE1-LSCIE1
-       .long L$set$0   ; Length of Common Information Entry
-LSCIE1:
-       .long   0       ; CIE Identifier Tag
-       .byte   0x3     ; CIE Version
-       .ascii "zRS\0"  ; CIE Augmentation
-       ;;  Both these alignment values are unused.
-       .byte   0x1     ; uleb128 0x1; CIE Code Alignment Factor
-       .byte   0x7c    ; sleb128 -4; CIE Data Alignment Factor
-       /* The choice of column for the return address is somewhat tricky.
-          Fortunately, the actual choice is private to this file, and
-          the space it's reserved from is the GCC register space, not the
-          DWARF2 numbering.  So any free element of the right size is an OK
-          choice.  Thus: */
-       .byte   67      ; CIE RA Column
-       .byte   0x1     ; uleb128 0x1; Augmentation size
-       .byte   0x10    ; FDE Encoding (pcrel)
-       .byte   0xc     ; DW_CFA_def_cfa
-       .byte   0x1     ; uleb128 0x1
-       .byte   0x0     ; uleb128 0x0
-       .align LOG2_GPR_BYTES
-LECIE1:
-       .globl _sigtramp.eh
-_sigtramp.eh:
-LSFDE1:
-       .set L$set$1,LEFDE1-LASFDE1
-       .long L$set$1   ; FDE Length
-LASFDE1:
-       .long   LASFDE1-EH_frame1       ; FDE CIE offset
-       .g_long Lcall_start-.   ; FDE initial location
-       .set L$set$2,Lcall_end-Lcall_start
-       .g_long L$set$2 ; FDE address range
-       .byte   0x0     ; uleb128 0x0; Augmentation size
-
-       /* Now for the expressions, which all compute
-          uctx->uc_mcontext->register
-          for each register.
-          uctx->uc_mcontext is already in r27, so
-          the tricky part is that this might be a 64-bit context,
-          in which case the offset would be different.
-
-          In the case of a dual context, only the low half of a
-          GPR is restored.
-          
-          Restore even the registers that are not call-saved because they
-          might be being used in the prologue to save other registers,
-          for instance GPR0 is sometimes used to save LR.    */
-
-       loc_expr_gpr_sml (0)
-       loc_expr_gpr_sml (1)
-       loc_expr_gpr_sml (2)
-       loc_expr_gpr_sml (3)
-       loc_expr_gpr_sml (4)
-       loc_expr_gpr_sml (5)
-       loc_expr_gpr (6)
-       loc_expr_gpr (7)
-       loc_expr_gpr (8)
-       loc_expr_gpr (9)
-       loc_expr_gpr (10)
-       loc_expr_gpr (11)
-       loc_expr_gpr (12)
-       loc_expr_gpr (13)
-       loc_expr_gpr (14)
-       loc_expr_gpr (15)
-       loc_expr_gpr (16)
-       loc_expr_gpr (17)
-       loc_expr_gpr (18)
-       loc_expr_gpr (19)
-       loc_expr_gpr (20)
-       loc_expr_gpr (21)
-       loc_expr_gpr (22)
-       loc_expr_gpr (23)
-       loc_expr_gpr (24)
-       loc_expr_gpr (25)
-       loc_expr_gpr (26)
-       loc_expr_gpr (27)
-       loc_expr_gpr (28)
-       loc_expr_gpr (29)
-       loc_expr_gpr (30)
-       loc_expr_gpr (31)
-
-       loc_expr_for_reg (64, MCONTEXT_SS_CR, MCONTEXT64_SS_CR)
-       loc_expr_varying (76, MCONTEXT_SS_XER, MCONTEXT64_SS_XER)
-       loc_expr_varying (65, MCONTEXT_SS_LR, MCONTEXT64_SS_LR)
-       loc_expr_varying (66, MCONTEXT_SS_CTR, MCONTEXT64_SS_CTR)
-       loc_expr_for_reg (109, MCONTEXT_SS_VRSAVE, MCONTEXT64_SS_VRSAVE)
-
-       loc_expr_fpr (0)
-       loc_expr_fpr (1)
-       loc_expr_fpr (2)
-       loc_expr_fpr (3)
-       loc_expr_fpr (4)
-       loc_expr_fpr (5)
-       loc_expr_fpr (6)
-       loc_expr_fpr (7)
-       loc_expr_fpr (8)
-       loc_expr_fpr (9)
-       loc_expr_fpr (10)
-       loc_expr_fpr (11)
-       loc_expr_fpr (12)
-       loc_expr_fpr (13)
-       loc_expr_fpr (14)
-       loc_expr_fpr (15)
-       loc_expr_fpr (16)
-       loc_expr_fpr (17)
-       loc_expr_fpr (18)
-       loc_expr_fpr (19)
-       loc_expr_fpr (20)
-       loc_expr_fpr (21)
-       loc_expr_fpr (22)
-       loc_expr_fpr (23)
-       loc_expr_fpr (24)
-       loc_expr_fpr (25)
-       loc_expr_fpr (26)
-       loc_expr_fpr (27)
-       loc_expr_fpr (28)
-       loc_expr_fpr (29)
-       loc_expr_fpr (30)
-       loc_expr_fpr (31)
-
-       loc_expr_for_reg (112, MCONTEXT_FS_FPSCR, MCONTEXT64_FS_FPSCR)
-
-       loc_expr_vr (0)
-       loc_expr_vr (1)
-       loc_expr_vr (2)
-       loc_expr_vr (3)
-       loc_expr_vr (4)
-       loc_expr_vr (5)
-       loc_expr_vr (6)
-       loc_expr_vr (7)
-       loc_expr_vr (8)
-       loc_expr_vr (9)
-       loc_expr_vr (10)
-       loc_expr_vr (11)
-       loc_expr_vr (12)
-       loc_expr_vr (13)
-       loc_expr_vr (14)
-       loc_expr_vr (15)
-       loc_expr_vr (16)
-       loc_expr_vr (17)
-       loc_expr_vr (18)
-       loc_expr_vr (19)
-       loc_expr_vr (20)
-       loc_expr_vr (21)
-       loc_expr_vr (22)
-       loc_expr_vr (23)
-       loc_expr_vr (24)
-       loc_expr_vr (25)
-       loc_expr_vr (26)
-       loc_expr_vr (27)
-       loc_expr_vr (28)
-       loc_expr_vr (29)
-       loc_expr_vr (30)
-       loc_expr_vr (31)
-
-       loc_expr_for_reg (110, MCONTEXT_VS_VSCR, MCONTEXT64_VS_VSCR)
-
-       /* The return address is even more complicated, because it needs
-          to be the actual address to which to return, and so
-          depends on the signal thrown, because some signals have SRR0
-          as the address of the faulting instruction, and others
-          have it as the next address to execute.
-
-          Although MCONTEXT_SS_SRR0 is the same as MCONTEXT64_SS_SRR0,
-          that doesn't really simplify things much, since if
-          the context is a 64-bit context for a 32-bit process,
-          we'll need to add 4 to get to the low word.  */
-     
-       /* The exception types that point to the faulting instruction are:
-          EXCEPTION_DSI, EXCEPTION_ALIGN, EXCEPTION_FPUNAVAIL,
-          and 
-          EXCEPTION_PROGRAM when SRR1[47] is clear.
-          The others point to the next instruction to execute.
-
-          EXCEPTION_ISI is a special case.  There are these possibilies:
-          - program calls a subroutine which is NULL, in which case
-            SRR0 holds NULL and LR-4 is the faulting instruction.
-          - program executes a computed goto to NULL, in which case
-            there is no way to know the faulting instruction.
-          - program runs off end of its text, in which case
-            SRR0-4 is the faulting instruction
-          - program executes a wild branch.
-          I think this code most needs to handle the first case, as
-          the other cases are rare or can't be handled.  */
-
-       .byte DW_CFA_val_expression, 67
-       .set L$set$3,Lpc_end-Lpc_start
-       .byte L$set$3
-Lpc_start:
-#ifdef __ppc__
-       /* On ppc, compute whether or not a 64-bit exception frame is in
-          use.  */
-       .byte  DW_OP_breg(29), 0, DW_OP_lit(10), DW_OP_div
-       .byte   DW_OP_dup, DW_OP_lit(UC_TRAD64/10), DW_OP_eq
-       .byte    DW_OP_swap, DW_OP_lit(UC_FLAVOR64/10), DW_OP_eq, DW_OP_or
-
-       /* Find the value of SRR0.  */
-       .byte   DW_OP_dup
-       .byte    DW_OP_lit(MCONTEXT64_SS_SRR0+4-MCONTEXT_SS_SRR0), DW_OP_mul
-       .byte    DW_OP_breg(27), MCONTEXT_SS_SRR0
-       .byte     DW_OP_plus, DW_OP_deref
-       /* Determine the exception type.  */
-       .byte    DW_OP_swap, DW_OP_dup
-       .byte     DW_OP_lit(MCONTEXT64_ES_EXCEPTION-MCONTEXT_ES_EXCEPTION)
-       .byte      DW_OP_mul
-       .byte     DW_OP_breg(27), MCONTEXT_ES_EXCEPTION
-       .byte      DW_OP_plus, DW_OP_deref
-       /* Find the value of SRR1.  */
-       .byte     DW_OP_swap, DW_OP_dup
-       .byte      DW_OP_lit(MCONTEXT64_SS_SRR1+4-MCONTEXT_SS_SRR1), DW_OP_mul
-       .byte      DW_OP_breg(27), MCONTEXT_SS_SRR1
-       .byte       DW_OP_plus, DW_OP_deref
-       /* Find the value of LR.  */
-       .byte      DW_OP_swap
-       .byte      DW_OP_const1u, MCONTEXT64_SS_LR+4-MCONTEXT_SS_LR, DW_OP_mul
-       .byte      DW_OP_breg(27), MCONTEXT_SS_LR, MCONTEXT_SS_LR >> 7
-       .byte       DW_OP_plus, DW_OP_deref
-#else
-       /* Find the value of SRR0.  */
-       .byte  DW_OP_breg(27), MCONTEXT64_SS_SRR0, DW_OP_deref
-       /* Determine the exception type.  */
-       .byte   DW_OP_breg(27), MCONTEXT64_ES_EXCEPTION, DW_OP_deref_size, 4
-       /* Find the value of SRR1.  */
-       .byte    DW_OP_breg(27), MCONTEXT64_SS_SRR1, DW_OP_deref
-       /* Find the value of LR.  */
-       .byte     DW_OP_breg(27), MCONTEXT64_SS_LR & 0x7f | 0x80
-       .byte       MCONTEXT64_SS_LR >> 7
-       .byte      DW_OP_deref
-#endif
-       /* At this point, the stack contains LR, SRR1, the exception type,
-          SRR0, and the base CFA address (which this doesn't use).  */
-
-       /* If the exception type is EXCEPTION_ISI, the result is LR.  */
-       .byte      DW_OP_pick, 2
-       .byte       DW_OP_lit(EXCEPTION_ISI), DW_OP_eq
-       .byte       DW_OP_bra   ; 'bra' is a conditional branch.
-       .set L$set$5,Lpc_end-0f
-       .short       L$set$5
-0:     
-       .byte      DW_OP_drop
-
-       /* Otherwise, start by determining if SRR1[47] is clear...  */
-       .byte     DW_OP_not, DW_OP_lit(16), DW_OP_shr, DW_OP_lit(1), DW_OP_and
-       /* ...and the exception type is EXCEPTION_PROGRAM.  */
-       .byte     DW_OP_over, DW_OP_lit(EXCEPTION_PROGRAM), DW_OP_eq, DW_OP_and
-       /* Check if any of the other exception cases are present.  */
-       .byte     DW_OP_over, DW_OP_lit(EXCEPTION_DSI), DW_OP_eq, DW_OP_or
-       .byte     DW_OP_over, DW_OP_lit(EXCEPTION_ALIGN), DW_OP_eq, DW_OP_or
-       .byte     DW_OP_swap, DW_OP_lit(EXCEPTION_FPUNAVAIL)
-       .byte      DW_OP_eq, DW_OP_or
-       /* If the exception points to the faulting instruction, add
-          4 to point past the faulting instruction.  */
-       .byte    DW_OP_lit(4), DW_OP_mul, DW_OP_plus
-Lpc_end:       
-
-       /* The CFA will have been saved as the value of R1.  */
-       .byte DW_CFA_def_cfa_expression
-       .set L$set$4,Lcfa_end-Lcfa_start
-       .byte L$set$4
-Lcfa_start:    
-#ifdef __ppc__
-       .byte DW_OP_breg(27), MCONTEXT_SS_R0+4
-       .byte  DW_OP_breg(29), 0, DW_OP_lit(10), DW_OP_div
-       .byte   DW_OP_dup, DW_OP_lit(UC_TRAD64/10), DW_OP_eq
-       .byte    DW_OP_swap, DW_OP_lit(UC_FLAVOR64/10), DW_OP_eq, DW_OP_or
-       .byte  DW_OP_lit(MCONTEXT64_SS_R0+12-MCONTEXT_SS_R0-4)
-       .byte   DW_OP_mul, DW_OP_plus
-       .byte DW_OP_deref
-#else
-       .byte DW_OP_breg(27), MCONTEXT64_SS_R0+8, DW_OP_deref
-#endif
-Lcfa_end:
-
-       .align LOG2_GPR_BYTES
-LEFDE1:
-               
-       .subsections_via_symbols
diff --git a/ppc/sys/ldbl64.s b/ppc/sys/ldbl64.s
deleted file mode 100644 (file)
index b775137..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#include <architecture/ppc/asm_help.h>
-
-#define BRANCH(X, Y)   \
-TEXT @ \
-LABEL(X) @ \
-BRANCH_EXTERN(Y)
-
-BRANCH(_asl_log$LDBL64, _asl_log)
-BRANCH(_asl_vlog$LDBL64, _asl_vlog)
-BRANCH(_asprintf$LDBL64, _asprintf)
-BRANCH(_err$LDBL64, _err)
-BRANCH(_errc$LDBL64, _errc)
-BRANCH(_errx$LDBL64, _errx)
-BRANCH(_fprintf$LDBL64, _fprintf)
-BRANCH(_fscanf$LDBL64, _fscanf)
-BRANCH(_fwprintf$LDBL64, _fwprintf)
-BRANCH(_fwscanf$LDBL64, _fwscanf)
-BRANCH(_printf$LDBL64, _printf)
-BRANCH(_scanf$LDBL64, _scanf)
-BRANCH(_snprintf$LDBL64, _snprintf)
-BRANCH(_sprintf$LDBL64, _sprintf)
-BRANCH(_sscanf$LDBL64, _sscanf)
-BRANCH(_strtold$LDBL64, _strtold)
-BRANCH(_swprintf$LDBL64, _swprintf)
-BRANCH(_swscanf$LDBL64, _swscanf)
-BRANCH(_syslog$LDBL64, _syslog)
-BRANCH(_vasprintf$LDBL64, _vasprintf)
-BRANCH(_verr$LDBL64, _verr)
-BRANCH(_verrc$LDBL64, _verrc)
-BRANCH(_verrx$LDBL64, _verrx)
-BRANCH(_vfprintf$LDBL64, _vfprintf)
-BRANCH(_vfscanf$LDBL64, _vfscanf)
-BRANCH(_vfwprintf$LDBL64, _vfwprintf)
-BRANCH(_vfwscanf$LDBL64, _vfwscanf)
-BRANCH(_vprintf$LDBL64, _vprintf)
-BRANCH(_vscanf$LDBL64, _vscanf)
-BRANCH(_vsnprintf$LDBL64, _vsnprintf)
-BRANCH(_vsprintf$LDBL64, _vsprintf)
-BRANCH(_vsscanf$LDBL64, _vsscanf)
-BRANCH(_vswprintf$LDBL64, _vswprintf)
-BRANCH(_vswscanf$LDBL64, _vswscanf)
-BRANCH(_vsyslog$LDBL64, _vsyslog)
-BRANCH(_vwarn$LDBL64, _vwarn)
-BRANCH(_vwarnc$LDBL64, _vwarnc)
-BRANCH(_vwarnx$LDBL64, _vwarnx)
-BRANCH(_vwprintf$LDBL64, _vwprintf)
-BRANCH(_vwscanf$LDBL64, _vwscanf)
-BRANCH(_warn$LDBL64, _warn)
-BRANCH(_warnc$LDBL64, _warnc)
-BRANCH(_warnx$LDBL64, _warnx)
-BRANCH(_wcstold$LDBL64, _wcstold)
-BRANCH(_wprintf$LDBL64, _wprintf)
-BRANCH(_wscanf$LDBL64, _wscanf)
diff --git a/ppc/sys/longjmp.s b/ppc/sys/longjmp.s
deleted file mode 100644 (file)
index 44ef495..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
- *
- *     File: sys/ppc/longjmp.s
- *
- *     Implements siglongjmp(), longjmp(), _longjmp() 
- *
- *     NOTE:   Scatterloading this file will BREAK the functions.
- *
- *     History:
- *     30-Aug-1998     Umesh Vaishampayan      (umeshv@apple.com)
- *             Created. Derived from _setjmp.s, setjmp.c and setjmp.s
- */
-
-/* We use mode-independent "g" opcodes such as "stg", and/or
- * mode-independent macros such as MI_GET_ADDRESS.  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-#include "_setjmp.h"
-
-/*
- *     longjmp routines
- */
-
-/*     void siglongjmp(sigjmp_buf env, int val); */
-
-MI_ENTRY_POINT(_siglongjmp)
-       lg      r0, JMP_SIGFLAG(r3)     ; load sigflag saved by siglongjmp()
-       cmpgi   cr1,r0,0                        ; this changes cr1 which is volatile
-       mr      r30, r3             ; preserve args across _sigsetmask
-       mr      r31, r4
-       beq--   cr1, L__exit        ; if r0 == 0 do _longjmp()
-       ; else *** fall through *** to longjmp()
-
-/*     void longjmp(jmp_buf env, int val); */
-
-MI_ENTRY_POINT(_longjmp)
-       mr      r30, r3             ; preserve args across _sigsetmask
-       mr      r31, r4
-
-    /* NB: this code assumes the signal mask is an int.  Change the "lwz" below
-     * if not. The JMP_sig field is already 8 bytes in the jmpbuf.
-     */
-       lwz     r3, JMP_sig(r3)         ; restore the signal mask
-       MI_CALL_EXTERNAL(_sigsetmask)   // make a (deprecated!) syscall to set the mask
-L__exit:       
-       lwz             r3,JMP_ss_flags(r30)
-       MI_CALL_EXTERNAL(__sigunaltstack)
-L__exit2:
-       mr      r3, r30
-       mr      r4, r31
-       MI_BRANCH_EXTERNAL(__longjmp)
-
-
-
-
-
-
diff --git a/ppc/sys/ppc_gettimeofday.s b/ppc/sys/ppc_gettimeofday.s
deleted file mode 100644 (file)
index 2cd0ea9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 1999-2006 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/* Copyright 1998 Apple Computer, Inc. */
-
-#include <architecture/ppc/mode_independent_asm.h>
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-MI_ENTRY_POINT(___commpage_gettimeofday)
-    ba _COMM_PAGE_GETTIMEOFDAY
diff --git a/ppc/sys/setjmp.s b/ppc/sys/setjmp.s
deleted file mode 100644 (file)
index ef338db..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
- *
- *     File: sys/ppc/setjmp.s
- *
- *     Implements sigsetjmp(), setjmp(), _setjmp()
- *
- *     NOTE:   Scatterloading this file will BREAK the functions.
- *
- *     History:
- *     30-Aug-1998     Umesh Vaishampayan      (umeshv@apple.com)
- *             Created. Derived from _setjmp.s, setjmp.c and setjmp.s
- */
-
-/* We use mode-independent "g" opcodes such as "stg", and/or
- * mode-independent macros such as MI_GET_ADDRESS.  These expand
- * into word operations when targeting __ppc__, and into doubleword
- * operations when targeting __ppc64__.
- */
-#include <architecture/ppc/mode_independent_asm.h>
-
-#include "_setjmp.h"
-
-/*
- * setjmp  routines
- */
-
-/*     int sigsetjmp(sigjmp_buf env, int savemask); */
-
-MI_ENTRY_POINT(_sigsetjmp)
-       cmpgi   cr1,r4,0                ; this changes cr1 which is volatile
-       stg     r4, JMP_SIGFLAG(r3)     ; save the sigflag for use by siglongjmp()
-       beq--   cr1, L__exit            ; if r4 == 0 do _setjmp()
-       ; else *** fall through ***  to setjmp()
-
-/*     int setjmp(jmp_buf env); */
-
-MI_ENTRY_POINT(_setjmp)
-       mflr    r0
-       stg     r31, JMP_r31(r3)
-       stg     r0, JMP_lr(r3)
-       mr      r31, r3                 ; save ptr to jmpbuf across calls
-       
-       /* call sigprocmask() to get signal mask */
-       
-       li      r3, 1                   ; get the previous signal mask
-       li      r4, 0
-       la      r5, JMP_sig(r31)        ; get address where previous mask needs to be
-       MI_CALL_EXTERNAL(_sigprocmask)  ; make a syscall to get mask
-       
-       /* call sigaltstack() to get SS_ONSTACK flag */
-       
-       li      r3,0                    ; ss is NULL
-       la      r4,JMP_vr_base_addr(r31); oss is a temp buffer in jmp_buf
-       MI_CALL_EXTERNAL(_sigaltstack)  ; make a syscall to get current stack state
-       la      r4,JMP_vr_base_addr(r31); recreate temp buffer ptr
-       lwz     r5,2*GPR_BYTES(r4)      ; get ss_flags (an int) from stack_t
-       stw     r5,JMP_ss_flags(r31)    ; save ss_flags in jmp_buf
-       
-       mr      r3, r31                 ; restore jmp_buf ptr
-       lg      r0, JMP_lr(r31)
-       lg      r31, JMP_r31(r31)
-       mtlr    r0
-L__exit:
-       MI_BRANCH_EXTERNAL(__setjmp)
diff --git a/ppc64/gen/Makefile.inc b/ppc64/gen/Makefile.inc
deleted file mode 100644 (file)
index e2d2966..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# searching ppc directory as a fallback to avoid unnecessary code duplication
-.PATH: ${.CURDIR}/ppc/gen
-
-MDSRCS +=      \
-     abs.s     \
-     fp.h      \
-     icacheinval.s \
-     mcount.s  \
-     setjmperr.c
-
-SUPPRESSSRCS += memcpy.c memmove.c memset.c
diff --git a/ppc64/pthreads/Makefile.inc b/ppc64/pthreads/Makefile.inc
deleted file mode 100644 (file)
index 4fafcf6..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# searching ppc directory as a fallback to avoid unnecessary code duplication
-.PATH: ${.CURDIR}/ppc64/pthreads ${.CURDIR}/ppc/pthreads
-
-MDSRCS += \
-       init_cpu_capabilities.c \
-       get_cpu_capabilities.s \
-       pthread_set_self_64.s \
-       pthread_self_64.s \
-       pthread_getspecific_64.s
diff --git a/ppc64/pthreads/pthread_getspecific_64.s b/ppc64/pthreads/pthread_getspecific_64.s
deleted file mode 100644 (file)
index 45d833c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#include "pthread_machdep.h"
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-        .text
-        .align 4
-        .globl _pthread_getspecific
-_pthread_getspecific:
-       sldi    r4, r3, 3                       // multiply index by 8 to get byte offset
-       addi    r5, r13, _PTHREAD_TSD_OFFSET    // add offset of TSD array in pthread struct
-       ldx     r3, r4, r5 
-       blr
diff --git a/ppc64/pthreads/pthread_self_64.s b/ppc64/pthreads/pthread_self_64.s
deleted file mode 100644 (file)
index a493e3f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-        .text
-        .align 2
-        .globl _pthread_self
-_pthread_self:
-       mr r3, r13
-       blr
diff --git a/ppc64/pthreads/pthread_set_self_64.s b/ppc64/pthreads/pthread_set_self_64.s
deleted file mode 100644 (file)
index a93cec0..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-        .text
-        .align 2
-        .globl ___pthread_set_self
-___pthread_set_self:
-       mr r13, r3
-        blr
diff --git a/ppc64/stdlib/gdtoa.mk b/ppc64/stdlib/gdtoa.mk
deleted file mode 100644 (file)
index 242a70f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# Long double is head-tail pair of doubles
-GDTOA_FBSDSRCS+= gdtoa-strtopdd.c machdep_ldisdd.c
-MISRCS+= _ldbl_util.c
-
-CFLAGS-_ldbl_util.c += -I${.CURDIR}/fbsdcompat
diff --git a/ppc64/string/Makefile.inc b/ppc64/string/Makefile.inc
deleted file mode 100644 (file)
index 8b8fa87..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# searching ppc directory as a fallback to avoid unnecessary code duplication
-#
-.PATH: ${.CURDIR}/ppc/string
-
-MDSRCS +=      \
-     bcopy.s   \
-     bzero.s   \
-     ffs.s     \
-     ffsl.s    \
-     fls.s     \
-     flsl.s    \
-     memset.s   \
-     memcmp.s  \
-     strcat.s  \
-     strcmp.s  \
-     strcpy.s  \
-     strlcat.s \
-     strlcpy.s \
-     strlen.s  \
-     strncat.s \
-     strncmp.s \
-     strncpy.s
-
-SUPPRESSSRCS += bcmp.c
-
diff --git a/ppc64/sys/Makefile.inc b/ppc64/sys/Makefile.inc
deleted file mode 100644 (file)
index c5574a4..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# searching ppc directory as a fallback to avoid unnecessary code duplication
-.PATH: ${.CURDIR}/ppc/sys ${.CURDIR}/ppc64/sys
-
-MDSRCS+= OSAtomic.s \
-       _longjmp.s \
-       longjmp.s \
-       ppc_gettimeofday.s \
-       _setjmp.s \
-       setjmp.s \
-       _sigtramp.s
diff --git a/pthreads/Makefile.inc b/pthreads/Makefile.inc
deleted file mode 100644 (file)
index 5ba231c..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/pthreads/Makefile.inc"
-
-.PATH: ${.CURDIR}/pthreads
-
-CFLAGS += -I${.CURDIR}/pthreads
-
-MISRCS += pthread_cancelable.c pthread_cond.c pthread_tsd.c pthread.c \
-        pthread_mutex.c    thread_setup.c   stack.s pthread_rwlock.c
-
-DYLDSRCS += pthread.c pthread_mutex.c pthread_tsd.c
-
-.ifdef FEATURE_PLOCKSTAT
-${SYMROOTINC}/plockstat.h: ${.CURDIR}/pthreads/plockstat.d
-       ${MKDIR} ${SYMROOTINC}
-       ${DTRACE} -o ${.TARGET} -C -h -s ${.ALLSRC}
-
-.for _src in pthread_cond.c pthread_mutex.c pthread_rwlock.c
-${_src:R}.${OBJSUFFIX}: ${SYMROOTINC}/plockstat.h
-.endfor
-.endif # FEATURE_PLOCKSTAT
-
-PTHREADS_INSTHDRS += pthread.h pthread_spis.h pthread_impl.h sched.h
-PTHREADS_INSTHDRS := ${PTHREADS_INSTHDRS:S/^/${.CURDIR}\/pthreads\//}
-INSTHDRS += ${PTHREADS_INSTHDRS}
-
-PRIV_INSTHDRS += ${.CURDIR}/pthreads/pthread_machdep.h
-LOCALHDRS += ${.CURDIR}/pthreads/pthread_workqueue.h
-
-LEGACYSRCS += pthread.c pthread_cancelable.c pthread_cond.c pthread_mutex.c pthread_rwlock.c
-CANCELABLESRCS += pthread_cancelable.c
-
-# thread_setup.c can only compile with __DARWIN_UNIX03=0 (for ppc64) because
-# the structure field names are renamed with __ prefix when __DARWIN_UNIX03=1.
-# If thread_setup.c ever needs to build variant, this will have to be fix
-# properly
-CFLAGS-thread_setup.c = -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-pthread.c += -DLIBC_ALIAS_PTHREAD_CANCEL -DLIBC_ALIAS_PTHREAD_SETCANCELSTATE -DLIBC_ALIAS_PTHREAD_SETCANCELTYPE -DLIBC_ALIAS_PTHREAD_SIGMASK -DLIBC_ALIAS_PTHREAD_TESTCANCEL
-CFLAGS-pthread_cancelable.c += -DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT
-CFLAGS-pthread_cond.c += -DLIBC_ALIAS_PTHREAD_COND_INIT
-CFLAGS-pthread_mutex.c += -DLIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY
-CFLAGS-pthread_rwlock.c += -DLIBC_ALIAS_PTHREAD_RWLOCK_DESTROY -DLIBC_ALIAS_PTHREAD_RWLOCK_INIT -DLIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK
-
-.if defined(CCARCH) && ${CCARCH} == armv6
-CFLAGS-pthread.c += -mno-thumb
-CFLAGS-pthread_cancelable.c += -mno-thumb
-CFLAGS-pthread_cond.c += -mno-thumb
-CFLAGS-pthread_mutex.c += -mno-thumb
-CFLAGS-pthread_rwlock.c += -mno-thumb
-CFLAGS-pthread_tsd.c += -mno-thumb
-.endif
-
-STRIP_HDRS += pthread.h
-
-.if ${LIB} == "c"
-MAN3+= pthread.3 pthread_atfork.3 pthread_attr.3  pthread_cancel.3 \
-       pthread_cleanup_pop.3 pthread_cleanup_push.3 \
-       pthread_cond_broadcast.3 pthread_cond_destroy.3 \
-       pthread_cond_init.3 pthread_cond_signal.3 \
-       pthread_cond_timedwait.3 pthread_cond_wait.3 \
-       pthread_create.3 pthread_detach.3 \
-       pthread_equal.3 pthread_exit.3 \
-       pthread_getschedparam.3 pthread_getspecific.3 \
-       pthread_join.3 pthread_key_create.3 \
-       pthread_key_delete.3 pthread_mutex_destroy.3 \
-       pthread_mutex_init.3 pthread_mutex_lock.3 \
-       pthread_mutex_trylock.3 pthread_mutex_unlock.3 \
-       pthread_mutexattr.3 pthread_once.3 \
-       pthread_self.3 pthread_setcancelstate.3 \
-       pthread_setspecific.3 pthread_condattr.3 \
-       pthread_rwlock_destroy.3 pthread_rwlock_init.3 \
-       pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \
-       pthread_rwlock_wrlock.3 pthread_rwlockattr_destroy.3 \
-       pthread_rwlockattr_getpshared.3 pthread_rwlockattr_init.3 \
-       pthread_rwlockattr_setpshared.3
-
-MLINKS+= pthread_attr.3 pthread_attr_destroy.3                         \
-         pthread_attr.3 pthread_attr_getdetachstate.3                  \
-         pthread_attr.3 pthread_attr_getinheritsched.3                 \
-         pthread_attr.3 pthread_attr_getschedparam.3                   \
-         pthread_attr.3 pthread_attr_getschedpolicy.3                  \
-         pthread_attr.3 pthread_attr_getscope.3                                \
-         pthread_attr.3 pthread_attr_getstackaddr.3                    \
-         pthread_attr.3 pthread_attr_getstacksize.3                    \
-         pthread_attr.3 pthread_attr_init.3                            \
-         pthread_attr.3 pthread_attr_setdetachstate.3                  \
-         pthread_attr.3 pthread_attr_setinheritsched.3                 \
-         pthread_attr.3 pthread_attr_setschedparam.3                   \
-         pthread_attr.3 pthread_attr_setschedpolicy.3                  \
-         pthread_attr.3 pthread_attr_setscope.3                                \
-         pthread_attr.3 pthread_attr_setstackaddr.3                    \
-         pthread_attr.3 pthread_attr_setstacksize.3
-
-MLINKS+= pthread_getschedparam.3 pthread_setschedparam.3
-
-MLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3               \
-         pthread_mutexattr.3 pthread_mutexattr_getprioceiling.3                \
-         pthread_mutexattr.3 pthread_mutexattr_getprotocol.3           \
-         pthread_mutexattr.3 pthread_mutexattr_gettype.3               \
-         pthread_mutexattr.3 pthread_mutexattr_init.3                  \
-         pthread_mutexattr.3 pthread_mutexattr_setprioceiling.3                \
-         pthread_mutexattr.3 pthread_mutexattr_setprotocol.3           \
-         pthread_mutexattr.3 pthread_mutexattr_settype.3
-
-MLINKS+= pthread_setcancelstate.3 pthread_setcanceltype.3              \
-         pthread_setcancelstate.3 pthread_testcancel.3
-
-MLINKS+= pthread_condattr.3 pthread_condattr_destroy.3                 \
-         pthread_condattr.3 pthread_condattr_init.3
-
-MLINKS+= pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3 
-
-MLINKS+= pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 
-
-.endif
-
-
index a0fdc8428095bd17cfadb597f5e789d446c67c79..0b6a5ccbf007d3bd6b2a6458158305c951ae1a36 100644 (file)
@@ -1,4 +1,5 @@
-#include <pthread.h>
+typedef struct _opaque_pthread_mutex_t pthread_mutex_t;
+typedef struct _opaque_pthread_rwlock_t pthread_rwlock_t;
 
 provider plockstat {
   probe mutex__acquire(pthread_mutex_t *mutex, int recursive, int spin_count);
index ef4527e349b264de1238f39b55b1f4f2ee449412..d6d116c3ed23eee22d642b39e424d16b6ce3da1e 100644 (file)
@@ -71,6 +71,7 @@
 #if defined(__ppc__)
 #include <libkern/OSCrossEndian.h>
 #endif
+#include <dispatch/private.h> /* for at_fork handlers */
 
 
 extern int _pthread_setcancelstate_internal(int state, int *oldstate, int conforming);
@@ -96,6 +97,9 @@ static int  _new_pthread_create_suspended(pthread_t *thread,
               void *arg,
                int create_susp);
 
+/* the registered libdispatch worker function */
+static void (*__libdispatch_workerfunction)(int, int, void *) = NULL;
+
 /* Get CPU capabilities from the kernel */
 __private_extern__ void _init_cpu_capabilities(void);
 
@@ -114,6 +118,47 @@ typedef struct _pthread_reap_msg_t {
        mach_msg_trailer_t trailer;
 } pthread_reap_msg_t;
 
+/* Utilitie */
+
+__private_extern__ uintptr_t commpage_pfz_base=0;
+
+void __pthread_pfz_setup(const char *apple[]) __attribute__ ((visibility ("hidden")));
+
+static uintptr_t __pfz_from_kernel(const char *str)
+{
+       unsigned long tmpval;
+       /* Skip over key to the first value */
+       str = strchr(str, '=');
+       if (str == NULL)
+               return 0;
+       str++;
+       tmpval = strtoul(str, NULL, 0); /* may err by 0 or ULONG_MAX */
+       if (tmpval == ULONG_MAX)
+               tmpval = 0;
+
+       return (uintptr_t) tmpval;
+}
+
+void
+__pthread_pfz_setup(const char *apple[])
+{
+       const char **p;
+       for (p = apple; p && *p; p++) {
+               /* checking if matching apple variable is at begining */
+               if (strstr(*p, "pfz=") == *p) {
+                       commpage_pfz_base = __pfz_from_kernel(*p);
+                       bzero(*p,strlen(*p));
+                       break;
+               }
+       }
+
+       if (commpage_pfz_base == 0)
+               commpage_pfz_base = _COMM_PAGE_TEXT_START;
+
+       return;
+}
+
+
 /* We'll implement this when the main thread is a pthread */
 /* Use the local _pthread struct to avoid malloc before our MiG reply port is set */
 static struct _pthread _thread = {0};
@@ -125,6 +170,8 @@ int __is_threaded = 0;
 /* _pthread_count is protected by _pthread_list_lock */
 static int _pthread_count = 1;
 int __unix_conforming = 0;
+static int __workqueue_newspis = 0;
+static int __workqueue_oldspis = 0;
 __private_extern__ size_t pthreadsize = 0;
 
 /* under rosetta we will use old style creation of threads */
@@ -219,6 +266,17 @@ extern void dispatch_atfork_child(void);
 #define WQOPS_QUEUE_REMOVE 2
 #define WQOPS_THREAD_RETURN 4
 #define WQOPS_THREAD_SETCONC  8
+#define WQOPS_QUEUE_NEWSPISUPP  0x10    /* this is to check for newer SPI support */
+#define WQOPS_QUEUE_REQTHREADS  0x20   /* request number of threads of a prio */
+
+/* flag values for reuse field in the libc side _pthread_wqthread */
+#define WQ_FLAG_THREAD_PRIOMASK                0x0000ffff
+#define WQ_FLAG_THREAD_OVERCOMMIT      0x00010000      /* thread is with overcommit prio */
+#define WQ_FLAG_THREAD_REUSE           0x00020000      /* thread is being reused */
+#define WQ_FLAG_THREAD_NEWSPI          0x00040000      /* the call is with new SPIs */
+
+
+#define WORKQUEUE_OVERCOMMIT 0x10000   /* the work_kernreturn() for overcommit in prio field */
 
 /*
  * Flags filed passed to bsdthread_create and back in pthread_start 
@@ -251,7 +309,6 @@ extern int __pthread_kill(mach_port_t, int);
 extern int __pthread_markcancel(int);
 extern int __workq_open(void);
 
-#define WORKQUEUE_OVERCOMMIT 0x10000
 
 extern int __workq_kernreturn(int, pthread_workitem_t, int, int);
 
@@ -259,7 +316,7 @@ extern int __workq_kernreturn(int, pthread_workitem_t, int, int);
 static const vm_address_t PTHREAD_STACK_HINT = 0xF0000000;
 #elif defined(__i386__) || defined(__x86_64__)
 static const vm_address_t PTHREAD_STACK_HINT = 0xB0000000;
-#elif defined(__arm__)
+#elif defined(__arm__)  
 static const vm_address_t PTHREAD_STACK_HINT = 0x30000000;
 #else
 #error Need to define a stack address hint for this architecture
@@ -827,7 +884,7 @@ static void
 _pthread_body(pthread_t self)
 {
     _pthread_set_self(self);
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
        if( (self->thread_id = __thread_selfid()) == (__uint64_t)-1)
                printf("Failed to set thread_id in _pthread_body\n");
 #endif
@@ -846,7 +903,7 @@ _pthread_start(pthread_t self, mach_port_t kport, void *(*fun)(void *), void * f
        if ((pflags & PTHREAD_START_CUSTOM) == 0) {
                stackaddr = (char *)self;
                _pthread_struct_init(self, attrs, stackaddr,  stacksize, 1, 1);
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
                _pthread_set_self(self);
 #endif
                LOCK(_pthread_list_lock);
@@ -860,7 +917,7 @@ _pthread_start(pthread_t self, mach_port_t kport, void *(*fun)(void *), void * f
                        self->detached |= PTHREAD_CREATE_DETACHED;
                }
        }  else { 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
                _pthread_set_self(self);
 #endif
                LOCK(_pthread_list_lock);
@@ -880,7 +937,7 @@ _pthread_start(pthread_t self, mach_port_t kport, void *(*fun)(void *), void * f
        self->childrun = 1;
        UNLOCK(_pthread_list_lock);
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
        if( (self->thread_id = __thread_selfid()) == (__uint64_t)-1)
                printf("Failed to set thread_id in pthread_start\n");
 #endif
@@ -1117,7 +1174,7 @@ pthread_main_np(void)
 }
 
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
 /* if we are passed in a pthread_t that is NULL, then we return
    the current thread's thread_id. So folks don't have to call
    pthread_self, in addition to us doing it, if they just want 
@@ -1169,17 +1226,22 @@ pthread_getname_np(pthread_t thread, char *threadname, size_t len)
 int
 pthread_setname_np(const char *threadname)
 {
-       int rval;
-       int len;
+       int rval = 0;
+       int len = 0;
+       pthread_t current_thread = pthread_self();
 
-       rval = 0;
-       len = strlen(threadname);
+       if (threadname != NULL)
+               len = strlen(threadname);
 
        /* protytype is in pthread_internals.h */
        rval = proc_setthreadname((void *)threadname, len);
-       if(rval == 0)
-       {
-               strlcpy((pthread_self())->pthread_name, threadname, MAXTHREADNAMESIZE);
+       if (rval == 0) {
+               if (threadname != NULL) {
+                       strlcpy(current_thread->pthread_name, threadname, MAXTHREADNAMESIZE);
+               } else {
+                       memset(current_thread->pthread_name, 0 , MAXTHREADNAMESIZE);
+               }
+
        }
        return rval;
 
@@ -1468,9 +1530,10 @@ pthread_detach(pthread_t thread)
        int newstyle = 0;
        int ret;
 
-       if ((ret = _pthread_lookup_thread(thread, NULL, 1)) != 0)
+       if ((ret = _pthread_lookup_thread(thread, NULL, 1)) != 0) {
                return (ret); /* Not a valid thread */
-               
+       }
+
        LOCK(thread->lock);
        newstyle = thread->newstyle;
        if (thread->detached & PTHREAD_CREATE_JOINABLE)
@@ -1508,7 +1571,7 @@ pthread_detach(pthread_t thread)
 }
 
 
-/* 
+/*
  * pthread_kill call to system call
  */
 int   
@@ -2115,14 +2178,14 @@ pthread_init(void)
        _pthread_fork_child_postinit();
        mig_init(1);            /* enable multi-threaded mig interfaces */
        if (__oldstyle == 0) {
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
                __bsdthread_register(thread_start, start_wqthread, round_page(sizeof(struct _pthread)), _pthread_start, &workq_targetconc[0], (uintptr_t)(&thread->tsd[__PTK_LIBDISPATCH_KEY0]) - (uintptr_t)(&thread->tsd[0]));
 #else
                __bsdthread_register(_pthread_start, _pthread_wqthread, round_page(sizeof(struct _pthread)), NULL, &workq_targetconc[0], (uintptr_t)&thread->tsd[__PTK_LIBDISPATCH_KEY0] - (uintptr_t)thread);
 #endif
        }
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
        if( (thread->thread_id = __thread_selfid()) == (__uint64_t)-1)
                printf("Failed to set thread_id in pthread_init\n");
 #endif
@@ -2192,7 +2255,7 @@ __private_extern__ void _pthread_fork_child(pthread_t p) {
        __kdebug_trace(0x900000c, p, 0, 0, 10, 0);
 #endif
        _pthread_count = 1;
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
        if( (p->thread_id = __thread_selfid()) == (__uint64_t)-1)
                printf("Failed to set thread_id in pthread_fork_child\n");
 #endif
@@ -2467,6 +2530,10 @@ pthread_workqueue_init_np()
 {
        int ret;
 
+       if (__workqueue_newspis != 0)
+               return(EPERM);
+       __workqueue_oldspis = 1;        
+
        workqueue_list_lock();
        ret =_pthread_work_internal_init();
        workqueue_list_unlock();
@@ -2479,6 +2546,9 @@ pthread_workqueue_requestconcurrency_np(int queue, int request_concurrency)
 {
        int error = 0;
 
+       if (__workqueue_newspis != 0)
+               return(EPERM);
+
        if (queue < 0 || queue > WORKQ_NUM_PRIOQUEUE)
                return(EINVAL);
 
@@ -2512,13 +2582,33 @@ pthread_workqueue_atfork_parent(void)
 void
 pthread_workqueue_atfork_child(void)
 {
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
+       pthread_t self = pthread_self();
+
+       __workqueue_list_lock = OS_SPINLOCK_INIT;
+
+       /* already using new spis? */
+       if (__workqueue_newspis != 0) {
+               /* prepare the kernel for workq action */
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
+               __bsdthread_register(thread_start, start_wqthread, round_page(sizeof(struct _pthread)), _pthread_start, &workq_targetconc[0], (uintptr_t)(&self->tsd[__PTK_LIBDISPATCH_KEY0]) - (uintptr_t)(&self->tsd[0]));
+#else
+               __bsdthread_register(_pthread_start, _pthread_wqthread, round_page(sizeof(struct _pthread)),NULL,NULL,0);
+#endif
+               (void)__workq_open();
+               kernel_workq_setup = 1;
+               return;
+       }
+
+       /* not using old spis either? */
+       if (__workqueue_oldspis == 0)
+               return;
+
        /* 
         * NOTE:  workq additions here  
         * are for i386,x86_64 only as
         * ppc and arm do not support it
         */
-       __workqueue_list_lock = OS_SPINLOCK_INIT;
        if (kernel_workq_setup != 0){
           kernel_workq_setup = 0;
           _pthread_work_internal_init();
@@ -2533,12 +2623,12 @@ _pthread_work_internal_init(void)
        int i, error;
        pthread_workqueue_head_t headp;
        pthread_workqueue_t wq;
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
        pthread_t self = pthread_self();
 #endif
 
        if (kernel_workq_setup == 0) {
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
                __bsdthread_register(thread_start, start_wqthread, round_page(sizeof(struct _pthread)), _pthread_start, &workq_targetconc[0], (uintptr_t)(&self->tsd[__PTK_LIBDISPATCH_KEY0]) - (uintptr_t)(&self->tsd[0]));
 #else
                __bsdthread_register(_pthread_start, _pthread_wqthread, round_page(sizeof(struct _pthread)),NULL,NULL,0);
@@ -2920,7 +3010,7 @@ post_nextworkitem(pthread_workqueue_t workq)
                                workq->kq_count++;
                                witem->flags |= PTH_WQITEM_KERN_COUNT;
                        }
-                       OSAtomicIncrement32(&kernel_workq_count);
+                       OSAtomicIncrement32Barrier(&kernel_workq_count);
                        workqueue_list_unlock();
                        
                        prio = workq->queueprio;
@@ -2929,7 +3019,7 @@ post_nextworkitem(pthread_workqueue_t workq)
                        }
 
                        if (( error =__workq_kernreturn(WQOPS_QUEUE_ADD, witem, workq->affinity, prio)) == -1) {
-                               OSAtomicDecrement32(&kernel_workq_count);
+                               OSAtomicDecrement32Barrier(&kernel_workq_count);
                                workqueue_list_lock();
 #if WQ_TRACE
                        __kdebug_trace(0x900007c, witem, workq, witem->func_arg, workq->kq_count, 0);
@@ -2965,10 +3055,25 @@ _pthread_wqthread(pthread_t self, mach_port_t kport, void * stackaddr, pthread_w
 #if WQ_DEBUG
        pthread_t pself;
 #endif
+       int thread_reuse = 0;
+       int thread_priority = 0;
+       int thread_newspi = 0;
+       int thread_options = 0;
+
+       if (reuse & WQ_FLAG_THREAD_NEWSPI) {
+               thread_reuse = reuse & WQ_FLAG_THREAD_REUSE;
+               if ((reuse & WQ_FLAG_THREAD_OVERCOMMIT) != 0)
+                       thread_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT;
+               thread_priority = reuse & WQ_FLAG_THREAD_PRIOMASK;
+               thread_newspi = 1;
+               workq = NULL;
+       } else {
+               thread_reuse = (reuse == 0)? 0: WQ_FLAG_THREAD_REUSE;
+               workq = item->workq;
+       }
 
-
-       workq = item->workq;
-       if (reuse == 0) {
+       
+       if (thread_reuse == 0) {
                /* reuse is set to 0, when a thread is newly created to run a workitem */
                _pthread_struct_init(self, attrs, stackaddr,  DEFAULT_STACK_SIZE, 1, 1);
                self->wqthread = 1;
@@ -2985,8 +3090,13 @@ _pthread_wqthread(pthread_t self, mach_port_t kport, void * stackaddr, pthread_w
                __kdebug_trace(0x9000050, self, item, item->func_arg, 0, 0);
 #endif
                self->kernel_thread = kport;
-               self->fun = (void *(*)(void *))item->func;
-               self->arg = item->func_arg;
+               if (thread_newspi != 0) {
+                       self->fun = (void *(*)(void *))__libdispatch_workerfunction;
+                       self->arg = thread_priority;
+               } else {
+                       self->fun = (void *(*)(void *))item->func;
+                       self->arg = item->func_arg;
+               }
                /* Add to the pthread list */
                LOCK(_pthread_list_lock);
                TAILQ_INSERT_TAIL(&__pthread_head, self, plist);
@@ -2996,7 +3106,7 @@ _pthread_wqthread(pthread_t self, mach_port_t kport, void * stackaddr, pthread_w
                _pthread_count++;
                UNLOCK(_pthread_list_lock);
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) 
                if( (self->thread_id = __thread_selfid()) == (__uint64_t)-1)
                        printf("Failed to set thread_id in pthread_wqthread\n");
 #endif
@@ -3010,8 +3120,13 @@ _pthread_wqthread(pthread_t self, mach_port_t kport, void * stackaddr, pthread_w
                if (self == NULL)
                        LIBC_ABORT("_pthread_wqthread: pthread %p setup to be NULL", self);
 
-               self->fun = (void *(*)(void *))item->func;
-               self->arg = item->func_arg;
+               if (thread_newspi != 0) {
+                       self->fun = (void *(*)(void *))__libdispatch_workerfunction;
+                       self->arg = NULL;
+               } else {
+                       self->fun = (void *(*)(void *))item->func;
+                       self->arg = item->func_arg;
+               }
        }
 
 #if WQ_DEBUG
@@ -3037,21 +3152,24 @@ _pthread_wqthread(pthread_t self, mach_port_t kport, void * stackaddr, pthread_w
        }
 #endif /* WQ_DEBUG */
 
-       self->cur_workq = workq;
-       self->cur_workitem = item;
-       OSAtomicDecrement32(&kernel_workq_count);
-
-       ret = (int)(intptr_t)(*self->fun)(self->arg);
+       if (thread_newspi != 0) {
+               (*__libdispatch_workerfunction)(thread_priority, thread_options, NULL);
+               _pthread_workq_return(self);
+        } else {
+               self->cur_workq = workq;
+               self->cur_workitem = item;
+               OSAtomicDecrement32Barrier(&kernel_workq_count);
+
+               ret = (int)(intptr_t)(*self->fun)(self->arg);
+               /* If we reach here without going through the above initialization path then don't go through
+               * with the teardown code path ( e.g. setjmp/longjmp ). Instead just exit this thread.
+               */
+               if (self != pthread_self()) {
+                       pthread_exit(PTHREAD_CANCELED);
+               }
 
-       /* If we reach here without going through the above initialization path then don't go through
-        * with the teardown code path ( e.g. setjmp/longjmp ). Instead just exit this thread.
-        */
-       if(self != pthread_self()) {
-               pthread_exit(PTHREAD_CANCELED);
+               workqueue_exit(self, workq, item);
        }
-       
-       workqueue_exit(self, workq, item);
-
 }
 
 static void
@@ -3150,6 +3268,61 @@ _pthread_workq_return(pthread_t self)
 
 /* XXXXXXXXXXXXX Pthread Workqueue functions XXXXXXXXXXXXXXXXXX */
 
+int
+pthread_workqueue_setdispatch_np(void (*worker_func)(int, int, void *))
+{
+       int error = 0;
+
+       if (__workqueue_oldspis != 0)
+               return(EPERM);
+
+       __workqueue_newspis = 1;        
+
+       if (__libdispatch_workerfunction == NULL) {
+               __libdispatch_workerfunction = worker_func;
+               /* check whether the kernel supports new SPIs */
+               error = __workq_kernreturn(WQOPS_QUEUE_NEWSPISUPP, NULL, 0, 0);
+               if (error == -1){
+                       __libdispatch_workerfunction = NULL;
+                       error = ENOTSUP;
+                       __workqueue_newspis = 0;
+               } else  {
+                       /* prepare the kernel for workq action */
+                       (void)__workq_open();
+                       kernel_workq_setup = 1;
+                       if (__is_threaded == 0)
+                               __is_threaded = 1;
+                       __workqueue_newspis = 1;        
+               }
+       } else {
+               error = EBUSY;
+       }
+
+       return(error);
+}
+
+int
+pthread_workqueue_addthreads_np(int queue_priority, int options, int numthreads)
+{
+       int priority = queue_priority & WQ_FLAG_THREAD_PRIOMASK;
+       int error = 0;
+
+       /* new spi not inited yet?? */
+       if (__workqueue_newspis == 0)
+               return(EPERM);
+
+
+       if ((options & WORKQ_ADDTHREADS_OPTION_OVERCOMMIT) != 0)
+               priority |= WORKQUEUE_OVERCOMMIT;
+               
+               error = __workq_kernreturn(WQOPS_QUEUE_REQTHREADS, NULL, numthreads, priority);
+
+               if (error == -1)
+                       return(errno);
+               else
+                       return(0);
+}
+
 int 
 pthread_workqueue_create_np(pthread_workqueue_t * workqp, const pthread_workqueue_attr_t * attr)
 {
@@ -3161,6 +3334,12 @@ pthread_workqueue_create_np(pthread_workqueue_t * workqp, const pthread_workqueu
                return(ENOTSUP);
        }
 #endif
+       if (__workqueue_newspis != 0)
+               return(EPERM);
+
+       if (__workqueue_oldspis == 0)
+               __workqueue_oldspis = 1;        
+
        if ((attr != NULL) && (attr->sig != PTHREAD_WORKQUEUE_ATTR_SIG)) {
                return(EINVAL);
        }
@@ -3199,6 +3378,9 @@ pthread_workqueue_additem_np(pthread_workqueue_t workq, void ( *workitem_func)(v
 {
        pthread_workitem_t witem;
 
+       if (__workqueue_newspis != 0)
+               return(EPERM);
+
        if (valid_workq(workq) == 0) {
                return(EINVAL);
        }
@@ -3245,6 +3427,9 @@ pthread_workqueue_additem_np(pthread_workqueue_t workq, void ( *workitem_func)(v
 int
 pthread_workqueue_getovercommit_np(pthread_workqueue_t workq,  unsigned int *ocommp)
 {
+       if (__workqueue_newspis != 0)
+               return(EPERM);
+
         if (valid_workq(workq) == 0) {
                 return(EINVAL);
         }
@@ -3258,6 +3443,9 @@ pthread_workqueue_getovercommit_np(pthread_workqueue_t workq,  unsigned int *oco
 #else /* !BUILDING_VARIANT ] [ */
 extern int __unix_conforming;
 extern int _pthread_count;
+extern int __workqueue_newspis;
+extern int __workqueue_oldspis;
+
 extern pthread_lock_t _pthread_list_lock;
 extern void _pthread_testcancel(pthread_t thread, int isconforming);
 extern int _pthread_reap_thread(pthread_t th, mach_port_t kernel_thread, void **value_ptr, int conforming);
index 06d1bd154b6aff1e05f61bf396fb8cb0a343120f..809eb0049a8a1ccd602c37005a1bcba7092a9519 100644 (file)
@@ -73,9 +73,14 @@ extern int _pthread_cond_wait(pthread_cond_t *cond,
                        const struct timespec *abstime,
                        int isRelative,
                        int isconforming);
-extern int __semwait_signal(int cond_sem, int mutex_sem, int timeout, int relative, __int64_t tv_sec, __int32_t tv_nsec);
 extern int __sigwait(const sigset_t *set, int *sig);
 
+#ifdef VARIANT_CANCELABLE
+extern int __semwait_signal(int cond_sem, int mutex_sem, int timeout, int relative, __int64_t tv_sec, __int32_t tv_nsec);
+#else
+extern int __semwait_signal(int cond_sem, int mutex_sem, int timeout, int relative, __int64_t tv_sec, __int32_t tv_nsec)  __asm__("___semwait_signal_nocancel");
+#endif
+
 /*
  * Wait for a thread to terminate and obtain its exit value.
  */
@@ -284,6 +289,10 @@ sigwait(const sigset_t * set, int * sig)
 
        if (__sigwait(set, sig) == -1) {
                err = errno;
+
+#ifdef VARIANT_CANCELABLE
+               _pthread_testcancel(pthread_self(), 1);
+#endif /* VARIANT_CANCELABLE */
                
                /* 
                 * EINTR that isn't a result of pthread_cancel()
index b0e881f81687f18f42de90bcc828fd612d8dd880..055956f1a7898f5f00e49e96d5f2a4ce9cb66107 100644 (file)
@@ -58,7 +58,6 @@
 #define PLOCKSTAT_MUTEX_RELEASE(x, y)
 #endif /* PLOCKSTAT */
 
-extern int __semwait_signal(int, int, int, int, int64_t, int32_t);
 extern int _pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *, int);
 extern int __unix_conforming;
 extern int usenew_mtximpl;
@@ -266,7 +265,7 @@ retry:
                        oldval64 |= lcntval;
                        newval64 = oldval64;
 
-                       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+                       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                                goto retry;
                        cond->sig = _PTHREAD_NO_SIG;
                        ret = 0;
@@ -295,7 +294,8 @@ pthread_cond_broadcast(pthread_cond_t *ocond)
        volatile uint32_t * c_lseqcnt, *c_useqcnt, *c_sseqcnt;
        uint32_t * pmtx = NULL;
        uint32_t nlval, ulval;
-       int needclearpre = 0, retry_count = 0;
+       int needclearpre = 0, retry_count = 0, uretry_count = 0;
+       int ucountreset = 0;
 
        /* to provide backwards compat for apps using united condtn vars */
        if((sig != _PTHREAD_COND_SIG) && (sig != _PTHREAD_COND_SIG_init))
@@ -339,7 +339,7 @@ retry:
                oldval64 |= lcntval;
                newval64 = oldval64;
 
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                        goto retry;
 #if _KSYN_TRACE_
        (void)__kdebug_trace(_KSYN_TRACE_UM_CVBRD | DBG_FUNC_NONE, (uint32_t)cond, lcntval, ucntval, 0xf1f1f1f1, 0);
@@ -348,7 +348,8 @@ retry:
                return(0);
        }
 
-       if (is_seqhigher((ucntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK)) || is_seqhigher((scntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK))) {
+       /* validate to eliminate spurious values, race snapshots */
+       if (is_seqhigher((scntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK))) {
                /* since ucntval may be newer, just redo */
                retry_count++;
                if (retry_count > 8192) {
@@ -357,7 +358,26 @@ retry:
                        sched_yield();
                        goto retry;
                }
-        }
+       } else if (is_seqhigher((ucntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK))) {
+               /* since ucntval may be newer, just redo */
+               uretry_count++;
+               if (uretry_count > 8192) {
+                       /*
+                        * U value if not used for a while can go out of sync
+                        * set this to S value and try one more time.
+                        */
+                       if (ucountreset != 0)
+                               return(EAGAIN);
+                       else
+                       if (OSAtomicCompareAndSwap32Barrier(ucntval, (scntval & PTHRW_COUNT_MASK), (volatile int32_t *)c_useqcnt) == TRUE) {
+                               /* now the U is reset to S value */
+                               ucountreset = 1;        
+                               uretry_count = 0;
+                       } 
+               }
+               sched_yield();
+               goto retry;
+       }
 
        if (is_seqlower(ucntval & PTHRW_COUNT_MASK, scntval & PTHRW_COUNT_MASK) != 0) {
                /* If U < S, set U = S+diff due to intr's TO, etc */
@@ -374,7 +394,7 @@ retry:
 
        /* set U = L */
        ulval = (lcntval & PTHRW_COUNT_MASK);
-       if (OSAtomicCompareAndSwap32(ucntval, ulval, (volatile int32_t *)c_useqcnt) != TRUE) {
+       if (OSAtomicCompareAndSwap32Barrier(ucntval, ulval, (volatile int32_t *)c_useqcnt) != TRUE) {
                goto retry;
        }
 
@@ -430,7 +450,7 @@ retry2:
        (void)__kdebug_trace(_KSYN_TRACE_UM_CVBRD | DBG_FUNC_NONE, 0x25, nlval, scntval, updateval, 0);
 #endif
 
-                       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+                       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                                goto retry2;
 
                        /* if L == S, then reset associated mutex */
@@ -467,8 +487,8 @@ pthread_cond_signal_thread_np(pthread_cond_t *ocond, pthread_t thread)
        uint32_t nlval, ulval=0;
        volatile uint32_t * c_lseqcnt, *c_useqcnt, *c_sseqcnt;
        uint64_t oldval64, newval64, mugen, cvlsgen, mtid = 0;
-       int needclearpre = 0, retry_count = 0;
-       int error;
+       int needclearpre = 0, retry_count = 0, uretry_count = 0;
+       int error, ucountreset = 0;
 
        /* to provide backwards compat for apps using united condtn vars */
 
@@ -511,7 +531,7 @@ retry:
                oldval64 |= lcntval;
                newval64 = oldval64;
 
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                        goto retry;
 #if _KSYN_TRACE_
        (void)__kdebug_trace(_KSYN_TRACE_UM_CVSIG | DBG_FUNC_NONE, (uint32_t)cond, lcntval, ucntval, 0xf1f1f1f1, 0);
@@ -520,16 +540,38 @@ retry:
                return(0);
        }
 
-       if (((thread == 0) && (is_seqhigher((ucntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK)))) || is_seqhigher((scntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK))) {
-               /* since ucntval may be newer, just redo */
-               retry_count++;
-               if (retry_count > 8192) {
-                       return(EAGAIN);
-               } else {
+       if (thread == 0) {
+               /* validate to eliminate spurious values, race snapshots */
+               if (is_seqhigher((scntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK))) {
+                       /* since ucntval may be newer, just redo */
+                       retry_count++;
+                       if (retry_count > 8192) {
+                               return(EAGAIN);
+                       } else {
+                               sched_yield();
+                               goto retry;
+                       }
+               } else if (is_seqhigher((ucntval & PTHRW_COUNT_MASK), (lcntval & PTHRW_COUNT_MASK))) {
+                       /* since ucntval may be newer, just redo */
+                       uretry_count++;
+                       if (uretry_count > 8192) {
+                               /*
+                                * U value if not used for a while can go out of sync
+                                * set this to S value and try one more time.
+                                */
+                               if (ucountreset != 0)
+                                       return(EAGAIN);
+                               else
+                               if (OSAtomicCompareAndSwap32Barrier(ucntval, (scntval & PTHRW_COUNT_MASK), (volatile int32_t *)c_useqcnt) == TRUE) {
+                                       /* now the U is reset to S value */
+                                       ucountreset = 1;        
+                                       uretry_count = 0;
+                               } 
+                       }
                        sched_yield();
                        goto retry;
                }
-        }
+       } /* thread == 0 ) */
 
        if (thread == 0) {
                /* 
@@ -547,7 +589,7 @@ retry:
                        ulval = (ucntval & PTHRW_COUNT_MASK) + PTHRW_INC;
                }
 
-               if (OSAtomicCompareAndSwap32(ucntval, ulval, (volatile int32_t *)c_useqcnt) != TRUE) {
+               if (OSAtomicCompareAndSwap32Barrier(ucntval, ulval, (volatile int32_t *)c_useqcnt) != TRUE) {
                        goto retry;
                }
        } 
@@ -602,7 +644,7 @@ retry2:
 (void)__kdebug_trace(_KSYN_TRACE_UM_CVSIG | DBG_FUNC_NONE, 0x25, nlval, ulval, updateval, 0);
 #endif
 
-                       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+                       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                                goto retry2;
 
                        /* if L == S, then reset associated mutex */
@@ -768,7 +810,7 @@ retry:
        newval64 = (((uint64_t)ulval) << 32);
        newval64 |= nlval;
 
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                goto retry;
 
        cond->busy = mutex;
@@ -798,6 +840,7 @@ retry:
        if (isconforming) {
                pthread_cleanup_push(cond_cleanup, (void *)cond);
                updateval = __psynch_cvwait(ocond, cvlsgen, ucntval, (pthread_mutex_t *)npmtx, mugen, flags, (int64_t)then.tv_sec, (int32_t)then.tv_nsec);
+               _pthread_testcancel(pthread_self(), isconforming);
                pthread_cleanup_pop(0);
        } else {
                updateval = __psynch_cvwait(ocond, cvlsgen, ucntval, (pthread_mutex_t *)npmtx, mugen, flags, (int64_t)then.tv_sec, (int32_t)then.tv_nsec);
@@ -937,7 +980,7 @@ retry:
                oldval64 = (((uint64_t)scntval) << 32);
                oldval64 |= lcntval;
                newval64 = oldval64;
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                        goto retry;
 #if _KSYN_TRACE_
        (void)__kdebug_trace(_KSYN_TRACE_UM_CDROPWT | DBG_FUNC_END, (uint32_t)cond, 0, 0, 0, 0);
@@ -973,7 +1016,7 @@ retry:
 #if _KSYN_TRACE_
        (void)__kdebug_trace(_KSYN_TRACE_UM_CDROPWT | DBG_FUNC_NONE, (uint32_t)cond, 0xffff, nlval, ulval, 0);
 #endif
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)c_lseqcnt) != TRUE)
                goto retry;
 
 #if _KSYN_TRACE_
index a74a94c5145763d4fb766bca806920f98dceb706..3a8b772f320dad5ede1e33d738df8d63ec373f1b 100644 (file)
@@ -63,6 +63,7 @@ typedef struct _pthread_attr_t pthread_attr_t;
 #include <stdlib.h>
 #include <limits.h>
 #include <errno.h>
+#include <TargetConditionals.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <libkern/OSAtomic.h>
@@ -88,9 +89,15 @@ extern  size_t pthreadsize;
 /*
  * Compiled-in limits
  */
+#if TARGET_OS_EMBEDDED
+#define _EXTERNAL_POSIX_THREAD_KEYS_MAX 256
+#define _INTERNAL_POSIX_THREAD_KEYS_MAX 256
+#define _INTERNAL_POSIX_THREAD_KEYS_END 512
+#else
 #define _EXTERNAL_POSIX_THREAD_KEYS_MAX 512
 #define _INTERNAL_POSIX_THREAD_KEYS_MAX 256
 #define _INTERNAL_POSIX_THREAD_KEYS_END 768
+#endif
 
 /*
  * Threads
@@ -580,7 +587,7 @@ extern struct __pthread_workqueue_pool __pthread_workqueue_pool_head;        /*
 
 #include "pthread_spis.h"
 
-#if defined(__i386__) || defined(__ppc64__) || defined(__x86_64__) || (defined(__arm__) && (defined(_ARM_ARCH_7) || !defined(_ARM_ARCH_6) || !defined(__thumb__)))
+#if defined(__i386__) || defined(__ppc64__) || defined(__x86_64__) || (defined(__arm__) && (defined(_ARM_ARCH_7) || !defined(_ARM_ARCH_6) || !defined(__thumb__))) 
 /*
  * Inside libSystem, we can use r13 or %gs directly to get access to the
  * thread-specific data area. The current thread is in the first slot.
index 4e4d71bfb43a5d8b548de2f49a5f4fe0abce44f0..001a8ae242009e38885fa3ea8a78d2b6c5577a43 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2004, 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2003-2004, 2008, 2011 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -56,6 +56,7 @@
 #include <arm/arch.h>
 #endif
 #include <TargetConditionals.h>
+#include <stdint.h>
 
 /*
 ** Define macros for inline pthread_getspecific() usage.
 /* Keys 30-39 for Graphic frameworks usage */
 #define _PTHREAD_TSD_SLOT_OPENGL       30      /* backwards compat sake */
 #define __PTK_FRAMEWORK_OPENGL_KEY     30
-#define __PTK_FRAMEWORK_GRAPHICS_KEY1  31  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY2  32  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY3  33  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY4  34  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY5  35  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY6  36  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY7  37  
-#define __PTK_FRAMEWORK_GRAPHICS_KEY8  38  
+#define __PTK_FRAMEWORK_GRAPHICS_KEY1  31
+#define __PTK_FRAMEWORK_GRAPHICS_KEY2  32
+#define __PTK_FRAMEWORK_GRAPHICS_KEY3  33
+#define __PTK_FRAMEWORK_GRAPHICS_KEY4  34
+#define __PTK_FRAMEWORK_GRAPHICS_KEY5  35
+#define __PTK_FRAMEWORK_GRAPHICS_KEY6  36
+#define __PTK_FRAMEWORK_GRAPHICS_KEY7  37
+#define __PTK_FRAMEWORK_GRAPHICS_KEY8  38
 #define __PTK_FRAMEWORK_GRAPHICS_KEY9  39
 
 /* Keys 40-49 for Objective-C runtime usage */
-#define __PTK_FRAMEWORK_OBJC_KEY0      40  
+#define __PTK_FRAMEWORK_OBJC_KEY0      40
 #define __PTK_FRAMEWORK_OBJC_KEY1      41
-#define __PTK_FRAMEWORK_OBJC_KEY2      42
-#define __PTK_FRAMEWORK_OBJC_KEY3      43
-#define __PTK_FRAMEWORK_OBJC_KEY4      44
-#define __PTK_FRAMEWORK_OBJC_KEY5      45
-#define __PTK_FRAMEWORK_OBJC_KEY6      46
-#define __PTK_FRAMEWORK_OBJC_KEY7      47
+#define __PTK_FRAMEWORK_OBJC_KEY2      42
+#define __PTK_FRAMEWORK_OBJC_KEY3      43
+#define __PTK_FRAMEWORK_OBJC_KEY4      44
+#define __PTK_FRAMEWORK_OBJC_KEY5      45
+#define __PTK_FRAMEWORK_OBJC_KEY6      46
+#define __PTK_FRAMEWORK_OBJC_KEY7      47
 #define __PTK_FRAMEWORK_OBJC_KEY8      48
-#define __PTK_FRAMEWORK_OBJC_KEY9      49
+#define __PTK_FRAMEWORK_OBJC_KEY9      49
 
 /* Keys 50-59 for Core Foundation usage */
 #define __PTK_FRAMEWORK_COREFOUNDATION_KEY0    50
 #define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY2            92
 #define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY3            93
 #define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY4            94
+/* Keys 95 for CoreText */
+#define __PTK_FRAMEWORK_CORETEXT_KEY0                  95
 
 /* Keys 110-119 for Garbage Collection */
 #define __PTK_FRAMEWORK_GC_KEY0                110
@@ -200,6 +203,7 @@ extern "C" {
 #endif
 
 extern void *pthread_getspecific(unsigned long);
+extern int pthread_setspecific(unsigned long, const void *);
 /* setup destructor function for static key as it is not created with pthread_key_create() */
 int       pthread_key_init_np(int, void (*)(void *));
 
@@ -209,25 +213,13 @@ int       pthread_key_init_np(int, void (*)(void *));
 
 typedef int pthread_lock_t;
 
-#if TARGET_IPHONE_SIMULATOR
-
-/* Similator will use the host implementation, so bypass the macro that is in the target code */
-
-inline static int
+__inline__ static int
 _pthread_has_direct_tsd(void)
 {
+#if TARGET_IPHONE_SIMULATOR
+       /* Simulator will use the host implementation, so bypass the macro that is in the target code */
        return 0;
-}
-       
-#define _pthread_getspecific_direct(key) pthread_getspecific(key)
-#define _pthread_setspecific_direct(key, val) pthread_setspecific(key, val)
-
-#else /* TARGET_IPHONE_SIMULATOR */
-
-inline static int
-_pthread_has_direct_tsd(void)
-{
-#if defined(__ppc__)
+#elif defined(__ppc__)
        int *caps = (int *)_COMM_PAGE_CPU_CAPABILITIES;
        if (*caps & kFastThreadLocalStorage) {
                return 1;
@@ -238,71 +230,70 @@ _pthread_has_direct_tsd(void)
        return 1;
 #endif
 }
-       
+
+#if TARGET_IPHONE_SIMULATOR || defined(__ppc__) || defined(__ppc64__) || \
+       (defined(__arm__) && !defined(_ARM_ARCH_7) && defined(_ARM_ARCH_6) && defined(__thumb__))
+
+#define _pthread_getspecific_direct(key) pthread_getspecific((key))
+#define _pthread_setspecific_direct(key, val) pthread_setspecific((key), (val))
+
+#else
+
 /* To be used with static constant keys only */
-inline static void *
-_pthread_getspecific_direct(unsigned long slot) 
+__inline__ static void *
+_pthread_getspecific_direct(unsigned long slot)
 {
-        void *ret;
-
+       void *ret;
 #if defined(__i386__) || defined(__x86_64__)
-       asm("mov %%gs:%1, %0" : "=r" (ret) : "m" (*(void **)(slot * sizeof(void *))));
-#elif defined(__ppc64__) || defined(__ppc__)
-       ret = pthread_getspecific(slot);
-#elif defined(__arm__) && defined(_ARM_ARCH_6) && !defined(_ARM_ARCH_7) && defined(__thumb__) && !defined(__OPTIMIZE__)
-        ret = pthread_getspecific(slot);
-#elif defined(__arm__) && defined(_ARM_ARCH_6)
-        void **__pthread_tsd;
-        __asm__ (
-               "mrc p15, 0, %0, c13, c0, 3\n"
-               "bic %0, %0, #3\n"
-               : "=r"(__pthread_tsd));
-        ret = __pthread_tsd[slot];
-#elif defined(__arm__) && !defined(_ARM_ARCH_6)
-        register void **__pthread_tsd asm ("r9");
-        ret = __pthread_tsd[slot];
-#else     
-#error no pthread_getspecific_direct implementation for this arch
+       __asm__("mov %%gs:%1, %0" : "=r" (ret) : "m" (*(void **)(slot * sizeof(void *))));
+#elif (defined(__arm__) && (defined(_ARM_ARCH_6) || defined(_ARM_ARCH_5))) 
+       void **__pthread_tsd;
+#if defined(__arm__) && defined(_ARM_ARCH_6)
+       uintptr_t __pthread_tpid;
+       __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r" (__pthread_tpid));
+       __pthread_tsd = (void**)(__pthread_tpid & ~0x3ul);
+#elif defined(__arm__) && defined(_ARM_ARCH_5)
+       register uintptr_t __pthread_tpid asm ("r9");
+       __pthread_tsd = (void**)__pthread_tpid;
+#endif
+       ret = __pthread_tsd[slot];
+#else
+#error no _pthread_getspecific_direct implementation for this arch
 #endif
-        return ret;
+       return ret;
 }
 
-#if  defined(__i386__) || defined(__x86_64__) || defined(__arm__)
 /* To be used with static constant keys only */
-inline static int
-_pthread_setspecific_direct(unsigned long slot, void * val) 
+__inline__ static int
+_pthread_setspecific_direct(unsigned long slot, void * val)
 {
-
 #if defined(__i386__)
 #if defined(__PIC__)
-       asm("movl %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val));
+       __asm__("movl %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val));
 #else
-       asm("movl %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "ri" (val));
+       __asm__("movl %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "ri" (val));
 #endif
 #elif defined(__x86_64__)
        /* PIC is free and cannot be disabled, even with: gcc -mdynamic-no-pic ... */
-       asm("movq %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val));
-#elif defined(__arm__) && defined(_ARM_ARCH_6)
-        void **__pthread_tsd;
-        __asm__ (
-               "mrc p15, 0, %0, c13, c0, 3\n"
-               "bic %0, %0, #3\n"
-               : "=r"(__pthread_tsd));
-        __pthread_tsd[slot] = val;
-#elif defined(__arm__) && !defined(_ARM_ARCH_6)
-       register void **__pthread_tsd asm ("r9");
-       __pthread_tsd[slot] = val;
+       __asm__("movq %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val));
+#elif (defined(__arm__) && (defined(_ARM_ARCH_6) || defined(_ARM_ARCH_5))) 
+       void **__pthread_tsd;
+#if defined(__arm__) && defined(_ARM_ARCH_6)
+       uintptr_t __pthread_tpid;
+       __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r" (__pthread_tpid));
+       __pthread_tsd = (void**)(__pthread_tpid & ~0x3ul);
+#elif defined(__arm__) && defined(_ARM_ARCH_5)
+       register uintptr_t __pthread_tpid asm ("r9");
+       __pthread_tsd = (void**)__pthread_tpid;
 #endif
-       return(0);
-}
-#elif defined(__ppc__)  || defined(__ppc64__)
-/* To be used with static constant keys only */
-#define _pthread_setspecific_direct(key, val) pthread_setspecific(key, val)
+       __pthread_tsd[slot] = val;
 #else
-#error no pthread_setspecific_direct implementation for this arch
+#error no _pthread_setspecific_direct implementation for this arch
 #endif
+       return 0;
+}
 
-#endif /* TARGET_IPHONE_SIMULATOR */
+#endif
 
 #define LOCK_INIT(l)   ((l) = 0)
 #define LOCK_INITIALIZER 0
index 53465b5752c11a7582b52c4c419904cbc09bed2b..51e46059d9ff4326ed3cc5290b6def4684ef7b9d 100644 (file)
@@ -143,7 +143,8 @@ extern int PR_5243343_flag;
 /* This function is never called and exists to provide never-fired dtrace
  * probes so that user d scripts don't get errors.
  */
-__private_extern__ void _plockstat_never_fired(void) 
+__private_extern__ __attribute__((used)) void
+_plockstat_never_fired(void) 
 {
        PLOCKSTAT_MUTEX_SPIN(NULL);
        PLOCKSTAT_MUTEX_SPUN(NULL, 0, 0);
@@ -513,6 +514,8 @@ retry:
        lgenval = *lseqaddr;
        ugenval = *useqaddr;
 
+       clearprepost = 0;
+
        numwaiters = diff_genseq((lgenval & PTHRW_COUNT_MASK),(ugenval & PTHRW_COUNT_MASK));    /* pendig waiters */
 
        if (numwaiters == 0) {
@@ -526,7 +529,7 @@ retry:
                        newval64 |= lgenval;
                } else
                        newval64 = oldval64;
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lseqaddr) != TRUE) 
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lseqaddr) != TRUE) 
                        goto retry;
                /* validated L & U to be same, this is spurious unlock */
                flags &= ~_PTHREAD_MTX_OPT_NOTIFY;
@@ -577,7 +580,7 @@ retry:
        else if (firstfit == 0)
                mutex->m_tid = PTHREAD_MTX_TID_SWITCHING;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lseqaddr) != TRUE) {
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lseqaddr) != TRUE) {
                mutex->m_tid = resettid;
                goto retry;
        }
@@ -673,7 +676,7 @@ retry:
        newval64 |= nval;
 
        /* set s and b bit */
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
 #if _KSYN_TRACE_
                (void)__kdebug_trace(_KSYN_TRACE_UM_MUBITS | DBG_FUNC_NONE, (uint32_t)mutex, 2, nval, uval, 0);
 #endif
@@ -748,7 +751,7 @@ __mtx_markprepost(npthread_mutex_t *mutex, uint32_t oupdateval, int firstfit)
 
 retry:
 
-
+       clearprepost = 0;
 
        if ((firstfit != 0) && ((updateval & PTH_RWL_PBIT) != 0)) {
                flags = mutex->mtxopts.value;
@@ -773,7 +776,7 @@ retry:
                newval64 = (((uint64_t)ugenval) << 32);
                newval64 |= lgenval;
 
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
 #if _KSYN_TRACE_
                        (void)__kdebug_trace(_KSYN_TRACE_UM_MARKPP | DBG_FUNC_NONE, (uint32_t)mutex, 2, lgenval, ugenval, 0);
 #endif
@@ -936,7 +939,7 @@ retry:
        newval64 = (((uint64_t)uval) << 32);
        newval64 |= nval;
 
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
 #if _KSYN_TRACE_
                (void)__kdebug_trace(_KSYN_TRACE_UM_LOCK | DBG_FUNC_NONE, (uint32_t)mutex, 2, nval, uval, 0);
 #endif
@@ -1010,9 +1013,9 @@ pthread_mutex_trylock(pthread_mutex_t *omutex)
                return(EINVAL);
        }
        
-       if ((mutex->sig & _PTHREAD_MUTEX_SIG_init_MASK) == _PTHREAD_MUTEX_SIG_CMP) {
+       if (mutex->sig != _PTHREAD_MUTEX_SIG) {
                LOCK(mutex->lock);
-               if (mutex->sig == _PTHREAD_MUTEX_SIG_init) {
+               if ((mutex->sig & _PTHREAD_MUTEX_SIG_init_MASK) == _PTHREAD_MUTEX_SIG_CMP) {
                        /* static initializer, init the mutex */
                        if((error = _pthread_mutex_init(omutex, NULL, (mutex->sig & 0xf))) != 0){
                                 UNLOCK(mutex->lock);
@@ -1078,7 +1081,7 @@ retry:
        newval64 |= nval;
 
        /* set s and b bit */
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lseqaddr) == TRUE) {
 #if _KSYN_TRACE_
                (void)__kdebug_trace(_KSYN_TRACE_UM_LOCK | DBG_FUNC_NONE, (uint32_t)mutex, 2, nval, uval, 0);
 #endif
@@ -1136,7 +1139,7 @@ pthread_mutex_unlock(pthread_mutex_t *omutex)
                                PLOCKSTAT_MUTEX_ERROR(omutex, retval);
                                 return(retval);
                         }              
-       } else if (mutex->sig != _PTHREAD_MUTEX_SIG) {
+               } else if (mutex->sig != _PTHREAD_MUTEX_SIG) {
                        UNLOCK(mutex->lock);
                        PLOCKSTAT_MUTEX_ERROR(omutex, EINVAL);
                        return(EINVAL);
index 39209697a7d6168c8cb39e9e72b3917e6f5fee0e..75c6a39dba41c1b82cfdad3d31dc569f2811be3d 100644 (file)
@@ -402,7 +402,7 @@ loop:
                newval64 = (((uint64_t)newsval) << 32);
                newval64 |= newval;
        
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                        goto loop;
                /* Check for consistency */
                lval = lcntval & PTHRW_BIT_MASK;
@@ -505,7 +505,7 @@ loop:
        newval64 = (((uint64_t)(newsval)) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
 kblock:
        updateval = __psynch_rw_longrdlock(orwlock, newval, ucntval, newsval, rwlock->rw_flags);
@@ -564,7 +564,7 @@ gotlock:
        newval64 = (((uint64_t)newsval) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
 
 successout:
@@ -638,7 +638,7 @@ loop:
                newval64 = (((uint64_t)newsval) << 32);
                newval64 |= newval;
        
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) == TRUE) {
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) == TRUE) {
                        goto gotit;
                } else
                        goto loop;
@@ -658,7 +658,7 @@ loop:
        newval64 = (((uint64_t)(newsval)) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
 
        PLOCKSTAT_RW_BLOCK(orwlock, WRITE_LOCK_PLOCKSTAT);
@@ -774,7 +774,7 @@ loop:
                newval64 = (((uint64_t)newsval) << 32);
                newval64 |= newval;
        
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) == TRUE) {
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) == TRUE) {
 #if __DARWIN_UNIX03
                        rwlock->rw_owner = (pthread_t)0;
 #endif /* __DARWIN_UNIX03 */
@@ -804,7 +804,7 @@ loop:
                newval64 = (((uint64_t)newsval) << 32);
                newval64 |= newval;
        
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                        goto loop;
 
 #if __DARWIN_UNIX03
@@ -911,7 +911,7 @@ loop:
        newval64 = (((uint64_t)(newsval)) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
        flags = rwlock->rw_flags;
        if (trylock != 0) {
@@ -1238,7 +1238,7 @@ loop:
        newval64 = (((uint64_t)newsval) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
 
        /* give writers priority over readers */
@@ -1303,7 +1303,7 @@ gotlock:
        newval64 = (((uint64_t)newsval) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
 
 #if _KSYN_TRACE_
@@ -1402,7 +1402,7 @@ gotlock:
        newval64 = (((uint64_t)newsval) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
 
 #if _KSYN_TRACE_
@@ -1484,7 +1484,7 @@ loop:
        } else 
                newval64 = oldval64;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE) {
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE) {
                goto loop;
        }
        if (gotlock == 1) {
@@ -1601,7 +1601,7 @@ loop:
        if (__pthread_lock_debug != 0)
        (void)__kdebug_trace(_KSYN_TRACE_RW_WRLOCK | DBG_FUNC_NONE, (uint32_t)rwlock, 0x55555555, lcntval, newval, 0);
 #endif
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto loop;
                
        /* lock acquired in userland itself? */
@@ -1722,7 +1722,7 @@ loop:
                newval64 = (((uint64_t)newsval) << 32);
                newval64 |= newval;
        
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) == TRUE) {
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) == TRUE) {
                        /* spurious unlock, return */
                        error = EINVAL;
 #if _KSYN_TRACE_
@@ -1745,7 +1745,7 @@ loop:
        
        ulval = (ucntval + PTHRW_INC);
 
-       if (OSAtomicCompareAndSwap32(ucntval, ulval, (volatile int32_t *)ucntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap32Barrier(ucntval, ulval, (volatile int32_t *)ucntaddr) != TRUE)
                goto loop;
        
 lp11:
@@ -1755,7 +1755,7 @@ lp11:
 
        newval64 = oldval64;
 
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)  {
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)  {
                lcntval = *lcntaddr;
                rw_seq = *seqaddr;
                goto lp11;
@@ -1784,7 +1784,7 @@ lp11:
                newval64 = (((uint64_t)newsval) << 32);
                newval64 |= newval;
 
-               if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)  {
+               if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)  {
 #if _KSYN_TRACE_
        if (__pthread_lock_debug != 0)
        (void)__kdebug_trace(_KSYN_TRACE_RW_UNLOCK | DBG_FUNC_NONE, (uint32_t)rwlock, 0xcccccccc, 0, 0, 0);
@@ -1837,7 +1837,7 @@ lp11:
        newval64 = (((uint64_t)newsval) << 32);
        newval64 |= newval;
        
-       if (OSAtomicCompareAndSwap64(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
+       if (OSAtomicCompareAndSwap64Barrier(oldval64, newval64, (volatile int64_t *)lcntaddr) != TRUE)
                goto lp11;
 
 #if _KSYN_TRACE_
index f8c3158fecd6076ccd55cbeae2dd54664c0a1ced..20edf50b8f888b73fde5f36994172710b0273eba 100644 (file)
@@ -72,6 +72,18 @@ int pthread_workqueue_getovercommit_np(pthread_workqueue_t workq,  unsigned int
  * If the arg of zero, it disables kill on current thread.
  */
 int __pthread_workqueue_setkill(int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
+
+/* ===================================================================================================
+ * NEW SPIs for 10.8 onwards
+ *
+ * ===================================================================================================
+ */
+
+typedef void (*pthread_workqueue_function_t)(int queue_priority, int options, void *ctxt);
+int pthread_workqueue_setdispatch_np(pthread_workqueue_function_t worker_func) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
+
+#define WORKQ_ADDTHREADS_OPTION_OVERCOMMIT 0x00000001
+int pthread_workqueue_addthreads_np(int queue_priority, int options, int numthreads) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
 __END_DECLS
 
 #endif /* _POSIX_PTHREAD_WORKQUEUE_H */
index 2f6c9d5ad1f9315e10b46a8371594453dcdd90f9..d2985df4391dc0d374d5eb42d29a9470e3968a32 100644 (file)
@@ -51,7 +51,7 @@
 
 #if defined(__ppc__) || defined(__ppc64__)
 #include <architecture/ppc/cframe.h>
-#elif defined(__arm__)
+#elif defined(__arm__) 
 #include <architecture/arm/cframe.h>
 #endif
 
diff --git a/regex/FreeBSD/cclass.h b/regex/FreeBSD/cclass.h
deleted file mode 100644 (file)
index 956a655..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)cclass.h    8.3 (Berkeley) 3/20/94
- * $FreeBSD: src/lib/libc/regex/cclass.h,v 1.4 2002/03/22 23:41:56 obrien Exp $
- */
-
-
-typedef enum {CALNUM, CALPHA, CBLANK, CCNTRL, CDIGIT, CGRAPH,
-             CLOWER, CPRINT, CPUNCT, CSPACE, CUPPER, CXDIGIT} citype;
-
-/* character-class table */
-static struct cclass {
-       char *name;
-       citype fidx;
-} cclasses[] = {
-       {"alnum",       CALNUM},
-       {"alpha",       CALPHA},
-       {"blank",       CBLANK},
-       {"cntrl",       CCNTRL},
-       {"digit",       CDIGIT},
-       {"graph",       CGRAPH},
-       {"lower",       CLOWER},
-       {"print",       CPRINT},
-       {"punct",       CPUNCT},
-       {"space",       CSPACE},
-       {"upper",       CUPPER},
-       {"xdigit",      CXDIGIT},
-       {NULL,          }
-};
index 19b4ddb4bbee3c70a68b1d53dbdfc9541a215da8..26355e8dd2f618b57ce1fb3b5cca8d37417a3f81 100644 (file)
  */
 
 /* character-name table */
-static struct cname {
-       char *name;
-       char code;
+static const struct cname {
+       const wchar_t *name;
+       wchar_t code;
 } cnames[] = {
-       {"NUL",                 '\0'},
-       {"SOH",                 '\001'},
-       {"STX",                 '\002'},
-       {"ETX",                 '\003'},
-       {"EOT",                 '\004'},
-       {"ENQ",                 '\005'},
-       {"ACK",                 '\006'},
-       {"BEL",                 '\007'},
-       {"alert",               '\007'},
-       {"BS",                  '\010'},
-       {"backspace",           '\b'},
-       {"HT",                  '\011'},
-       {"tab",                 '\t'},
-       {"LF",                  '\012'},
-       {"newline",             '\n'},
-       {"VT",                  '\013'},
-       {"vertical-tab",        '\v'},
-       {"FF",                  '\014'},
-       {"form-feed",           '\f'},
-       {"CR",                  '\015'},
-       {"carriage-return",     '\r'},
-       {"SO",                  '\016'},
-       {"SI",                  '\017'},
-       {"DLE",                 '\020'},
-       {"DC1",                 '\021'},
-       {"DC2",                 '\022'},
-       {"DC3",                 '\023'},
-       {"DC4",                 '\024'},
-       {"NAK",                 '\025'},
-       {"SYN",                 '\026'},
-       {"ETB",                 '\027'},
-       {"CAN",                 '\030'},
-       {"EM",                  '\031'},
-       {"SUB",                 '\032'},
-       {"ESC",                 '\033'},
-       {"IS4",                 '\034'},
-       {"FS",                  '\034'},
-       {"IS3",                 '\035'},
-       {"GS",                  '\035'},
-       {"IS2",                 '\036'},
-       {"RS",                  '\036'},
-       {"IS1",                 '\037'},
-       {"US",                  '\037'},
-       {"space",               ' '},
-       {"exclamation-mark",    '!'},
-       {"quotation-mark",      '"'},
-       {"number-sign",         '#'},
-       {"dollar-sign",         '$'},
-       {"percent-sign",        '%'},
-       {"ampersand",           '&'},
-       {"apostrophe",          '\''},
-       {"left-parenthesis",    '('},
-       {"right-parenthesis",   ')'},
-       {"asterisk",            '*'},
-       {"plus-sign",           '+'},
-       {"comma",               ','},
-       {"hyphen",              '-'},
-       {"hyphen-minus",        '-'},
-       {"period",              '.'},
-       {"full-stop",           '.'},
-       {"slash",               '/'},
-       {"solidus",             '/'},
-       {"zero",                '0'},
-       {"one",                 '1'},
-       {"two",                 '2'},
-       {"three",               '3'},
-       {"four",                '4'},
-       {"five",                '5'},
-       {"six",                 '6'},
-       {"seven",               '7'},
-       {"eight",               '8'},
-       {"nine",                '9'},
-       {"colon",               ':'},
-       {"semicolon",           ';'},
-       {"less-than-sign",      '<'},
-       {"equals-sign",         '='},
-       {"greater-than-sign",   '>'},
-       {"question-mark",       '?'},
-       {"commercial-at",       '@'},
-       {"left-square-bracket", '['},
-       {"backslash",           '\\'},
-       {"reverse-solidus",     '\\'},
-       {"right-square-bracket",']'},
-       {"circumflex",          '^'},
-       {"circumflex-accent",   '^'},
-       {"underscore",          '_'},
-       {"low-line",            '_'},
-       {"grave-accent",        '`'},
-       {"left-brace",          '{'},
-       {"left-curly-bracket",  '{'},
-       {"vertical-line",       '|'},
-       {"right-brace",         '}'},
-       {"right-curly-bracket", '}'},
-       {"tilde",               '~'},
-       {"DEL", '\177'},
-       {NULL,  0}
+       {L"",                           (wchar_t)-1}, /* sentinel */
+       {L"ACK",                        L'\006'},
+       {L"BEL",                        L'\007'},
+       {L"BS",                         L'\010'},
+       {L"CAN",                        L'\030'},
+       {L"CR",                         L'\015'},
+       {L"DC1",                        L'\021'},
+       {L"DC2",                        L'\022'},
+       {L"DC3",                        L'\023'},
+       {L"DC4",                        L'\024'},
+       {L"DEL",                        L'\177'},
+       {L"DLE",                        L'\020'},
+       {L"EM",                         L'\031'},
+       {L"ENQ",                        L'\005'},
+       {L"EOT",                        L'\004'},
+       {L"ESC",                        L'\033'},
+       {L"ETB",                        L'\027'},
+       {L"ETX",                        L'\003'},
+       {L"FF",                         L'\014'},
+       {L"FS",                         L'\034'},
+       {L"GS",                         L'\035'},
+       {L"HT",                         L'\011'},
+       {L"IS1",                        L'\037'},
+       {L"IS2",                        L'\036'},
+       {L"IS3",                        L'\035'},
+       {L"IS4",                        L'\034'},
+       {L"LF",                         L'\012'},
+       {L"NAK",                        L'\025'},
+       {L"NUL",                        L'\0'},
+       {L"RS",                         L'\036'},
+       {L"SI",                         L'\017'},
+       {L"SO",                         L'\016'},
+       {L"SOH",                        L'\001'},
+       {L"STX",                        L'\002'},
+       {L"SUB",                        L'\032'},
+       {L"SYN",                        L'\026'},
+       {L"US",                         L'\037'},
+       {L"VT",                         L'\013'},
+       {L"alert",                      L'\007'},
+       {L"ampersand",                  L'&'},
+       {L"apostrophe",                 L'\''},
+       {L"asterisk",                   L'*'},
+       {L"backslash",                  L'\\'},
+       {L"backspace",                  L'\b'},
+       {L"carriage-return",            L'\r'},
+       {L"circumflex",                 L'^'},
+       {L"circumflex-accent",          L'^'},
+       {L"colon",                      L':'},
+       {L"comma",                      L','},
+       {L"commercial-at",              L'@'},
+       {L"dollar-sign",                L'$'},
+       {L"eight",                      L'8'},
+       {L"equals-sign",                L'='},
+       {L"exclamation-mark",           L'!'},
+       {L"five",                       L'5'},
+       {L"form-feed",                  L'\f'},
+       {L"four",                       L'4'},
+       {L"full-stop",                  L'.'},
+       {L"grave-accent",               L'`'},
+       {L"greater-than-sign",          L'>'},
+       {L"hyphen",                     L'-'},
+       {L"hyphen-minus",               L'-'},
+       {L"left-brace",                 L'{'},
+       {L"left-curly-bracket",         L'{'},
+       {L"left-parenthesis",           L'('},
+       {L"left-square-bracket",        L'['},
+       {L"less-than-sign",             L'<'},
+       {L"low-line",                   L'_'},
+       {L"newline",                    L'\n'},
+       {L"nine",                       L'9'},
+       {L"number-sign",                L'#'},
+       {L"one",                        L'1'},
+       {L"percent-sign",               L'%'},
+       {L"period",                     L'.'},
+       {L"plus-sign",                  L'+'},
+       {L"question-mark",              L'?'},
+       {L"quotation-mark",             L'"'},
+       {L"reverse-solidus",            L'\\'},
+       {L"right-brace",                L'}'},
+       {L"right-curly-bracket",        L'}'},
+       {L"right-parenthesis",          L')'},
+       {L"right-square-bracket",       L']'},
+       {L"semicolon",                  L';'},
+       {L"seven",                      L'7'},
+       {L"six",                        L'6'},
+       {L"slash",                      L'/'},
+       {L"solidus",                    L'/'},
+       {L"space",                      L' '},
+       {L"tab",                        L'\t'},
+       {L"three",                      L'3'},
+       {L"tilde",                      L'~'},
+       {L"two",                        L'2'},
+       {L"underscore",                 L'_'},
+       {L"vertical-line",              L'|'},
+       {L"vertical-tab",               L'\v'},
+       {L"zero",                       L'0'},
 };
+
+#define NCNAMES                (sizeof(cnames) / sizeof(*cnames))
diff --git a/regex/FreeBSD/cname.h.patch b/regex/FreeBSD/cname.h.patch
deleted file mode 100644 (file)
index 2e6b31f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- cname.h.orig       2010-05-05 14:45:26.000000000 -0700
-+++ cname.h    2010-05-05 14:45:56.000000000 -0700
-@@ -39,8 +39,8 @@
-  */
- /* character-name table */
--static struct cname {
--      char *name;
-+static const struct cname {
-+      const char *name;
-       char code;
- } cnames[] = {
-       {"NUL",                 '\0'},
diff --git a/regex/FreeBSD/engine.c b/regex/FreeBSD/engine.c
deleted file mode 100644 (file)
index feae5c5..0000000
+++ /dev/null
@@ -1,1191 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)engine.c    8.5 (Berkeley) 3/20/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/engine.c,v 1.23 2009/09/16 06:32:23 dds Exp $");
-
-/*
- * The matching engine and friends.  This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define        matcher smatcher
-#define        fast    sfast
-#define        slow    sslow
-#define        dissect sdissect
-#define        backref sbackref
-#define        step    sstep
-#define        print   sprint
-#define        at      sat
-#define        match   smat
-#endif
-#ifdef LNAMES
-#define        matcher lmatcher
-#define        fast    lfast
-#define        slow    lslow
-#define        dissect ldissect
-#define        backref lbackref
-#define        step    lstep
-#define        print   lprint
-#define        at      lat
-#define        match   lmat
-#endif
-#ifdef MNAMES
-#define        matcher mmatcher
-#define        fast    mfast
-#define        slow    mslow
-#define        dissect mdissect
-#define        backref mbackref
-#define        step    mstep
-#define        print   mprint
-#define        at      mat
-#define        match   mmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
-       struct re_guts *g;
-       int eflags;
-       regmatch_t *pmatch;     /* [nsub+1] (0 element unused) */
-       const char *offp;       /* offsets work from here */
-       const char *beginp;     /* start of string -- virtual NUL precedes */
-       const char *endp;       /* end of string -- virtual NUL here */
-       const char *coldp;      /* can be no match starting before here */
-       const char **lastpos;   /* [nplus+1] */
-       STATEVARS;
-       states st;              /* current states */
-       states fresh;           /* states for a fresh start */
-       states tmp;             /* temporary */
-       states empty;           /* empty set of states */
-       mbstate_t mbs;          /* multibyte conversion state */
-};
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int);
-static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft);
-#define MAX_RECURSION  100
-#define        BOL     (OUT-1)
-#define        EOL     (BOL-1)
-#define        BOLEOL  (BOL-2)
-#define        NOTHING (BOL-3)
-#define        BOW     (BOL-4)
-#define        EOW     (BOL-5)
-#define        BADCHAR (BOL-6)
-#define        NONCHAR(c)      ((c) <= OUT)
-#ifdef REDEBUG
-static void print(struct match *m, const char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, const char *title, const char *start, const char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static const char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-
-#ifdef REDEBUG
-#define        SP(t, s, c)     print(m, t, s, c, stdout)
-#define        AT(t, p1, p2, s1, s2)   at(m, t, p1, p2, s1, s2)
-#define        NOTE(str)       { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define        SP(t, s, c)     /* nothing */
-#define        AT(t, p1, p2, s1, s2)   /* nothing */
-#define        NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(struct re_guts *g, const char *string, \
- ==    size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int                     /* 0 success, REG_NOMATCH failure */
-matcher(struct re_guts *g,
-       const char *string,
-       size_t nmatch,
-       regmatch_t pmatch[],
-       int eflags)
-{
-       const char *endp;
-       int i;
-       struct match mv;
-       struct match *m = &mv;
-       const char *dp;
-       const sopno gf = g->firststate+1;       /* +1 for OEND */
-       const sopno gl = g->laststate;
-       const char *start;
-       const char *stop;
-       /* Boyer-Moore algorithms variables */
-       const char *pp;
-       int cj, mj;
-       const char *mustfirst;
-       const char *mustlast;
-       int *matchjump;
-       int *charjump;
-
-       /* simplify the situation where possible */
-       if (g->cflags&REG_NOSUB)
-               nmatch = 0;
-       if (eflags&REG_STARTEND) {
-               start = string + pmatch[0].rm_so;
-               stop = string + pmatch[0].rm_eo;
-       } else {
-               start = string;
-               stop = start + strlen(start);
-       }
-       if (stop < start)
-               return(REG_INVARG);
-
-       /* prescreening; this does wonders for this rather slow code */
-       if (g->must != NULL) {
-               if (g->charjump != NULL && g->matchjump != NULL) {
-                       mustfirst = g->must;
-                       mustlast = g->must + g->mlen - 1;
-                       charjump = g->charjump;
-                       matchjump = g->matchjump;
-                       pp = mustlast;
-                       for (dp = start+g->mlen-1; dp < stop;) {
-                               /* Fast skip non-matches */
-                               while (dp < stop && charjump[(int)*dp])
-                                       dp += charjump[(int)*dp];
-
-                               if (dp >= stop)
-                                       break;
-
-                               /* Greedy matcher */
-                               /* We depend on not being used for
-                                * for strings of length 1
-                                */
-                               while (*--dp == *--pp && pp != mustfirst);
-
-                               if (*dp == *pp)
-                                       break;
-
-                               /* Jump to next possible match */
-                               mj = matchjump[pp - mustfirst];
-                               cj = charjump[(int)*dp];
-                               dp += (cj < mj ? mj : cj);
-                               pp = mustlast;
-                       }
-                       if (pp != mustfirst)
-                               return(REG_NOMATCH);
-               } else {
-                       for (dp = start; dp < stop; dp++)
-                               if (*dp == g->must[0] &&
-                                   stop - dp >= g->mlen &&
-                                   memcmp(dp, g->must, (size_t)g->mlen) == 0)
-                                       break;
-                       if (dp == stop)         /* we didn't find g->must */
-                               return(REG_NOMATCH);
-               }
-       }
-
-       /* match struct setup */
-       m->g = g;
-       m->eflags = eflags;
-       m->pmatch = NULL;
-       m->lastpos = NULL;
-       m->offp = string;
-       m->beginp = start;
-       m->endp = stop;
-       STATESETUP(m, 4);
-       SETUP(m->st);
-       SETUP(m->fresh);
-       SETUP(m->tmp);
-       SETUP(m->empty);
-       CLEAR(m->empty);
-       ZAPSTATE(&m->mbs);
-
-       /* Adjust start according to moffset, to speed things up */
-       if (g->moffset > -1)
-               start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
-
-       SP("mloop", m->st, *start);
-
-       /* this loop does only one repetition except for backrefs */
-       for (;;) {
-               endp = fast(m, start, stop, gf, gl);
-               if (endp == NULL) {             /* a miss */
-                       if (m->pmatch != NULL)
-                               free((char *)m->pmatch);
-                       if (m->lastpos != NULL)
-                               free((char *)m->lastpos);
-                       STATETEARDOWN(m);
-                       return(REG_NOMATCH);
-               }
-               if (nmatch == 0 && !g->backrefs)
-                       break;          /* no further info needed */
-
-               /* where? */
-               assert(m->coldp != NULL);
-               for (;;) {
-                       NOTE("finding start");
-                       endp = slow(m, m->coldp, stop, gf, gl);
-                       if (endp != NULL)
-                               break;
-                       assert(m->coldp < m->endp);
-                       m->coldp += XMBRTOWC(NULL, m->coldp,
-                           m->endp - m->coldp, &m->mbs, 0);
-               }
-               if (nmatch == 1 && !g->backrefs)
-                       break;          /* no further info needed */
-
-               /* oh my, he wants the subexpressions... */
-               if (m->pmatch == NULL)
-                       m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
-                                                       sizeof(regmatch_t));
-               if (m->pmatch == NULL) {
-                       STATETEARDOWN(m);
-                       return(REG_ESPACE);
-               }
-               for (i = 1; i <= m->g->nsub; i++)
-                       m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
-               if (!g->backrefs && !(m->eflags&REG_BACKR)) {
-                       NOTE("dissecting");
-                       dp = dissect(m, m->coldp, endp, gf, gl);
-               } else {
-                       if (g->nplus > 0 && m->lastpos == NULL)
-                               m->lastpos = malloc((g->nplus+1) *
-                                               sizeof(const char *));
-                       if (g->nplus > 0 && m->lastpos == NULL) {
-                               free(m->pmatch);
-                               STATETEARDOWN(m);
-                               return(REG_ESPACE);
-                       }
-                       NOTE("backref dissect");
-                       dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0);
-               }
-               if (dp != NULL)
-                       break;
-
-               /* uh-oh... we couldn't find a subexpression-level match */
-               assert(g->backrefs);    /* must be back references doing it */
-               assert(g->nplus == 0 || m->lastpos != NULL);
-               for (;;) {
-                       if (dp != NULL || endp <= m->coldp)
-                               break;          /* defeat */
-                       NOTE("backoff");
-                       endp = slow(m, m->coldp, endp-1, gf, gl);
-                       if (endp == NULL)
-                               break;          /* defeat */
-                       /* try it on a shorter possibility */
-#ifndef NDEBUG
-                       for (i = 1; i <= m->g->nsub; i++) {
-                               assert(m->pmatch[i].rm_so == -1);
-                               assert(m->pmatch[i].rm_eo == -1);
-                       }
-#endif
-                       NOTE("backoff dissect");
-                       dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0);
-               }
-               assert(dp == NULL || dp == endp);
-               if (dp != NULL)         /* found a shorter one */
-                       break;
-
-               /* despite initial appearances, there is no match here */
-               NOTE("false alarm");
-               /* recycle starting later */
-               start = m->coldp + XMBRTOWC(NULL, m->coldp,
-                   stop - m->coldp, &m->mbs, 0);
-               assert(start <= stop);
-       }
-
-       /* fill in the details if requested */
-       if (nmatch > 0) {
-               pmatch[0].rm_so = m->coldp - m->offp;
-               pmatch[0].rm_eo = endp - m->offp;
-       }
-       if (nmatch > 1) {
-               assert(m->pmatch != NULL);
-               for (i = 1; i < nmatch; i++)
-                       if (i <= m->g->nsub)
-                               pmatch[i] = m->pmatch[i];
-                       else {
-                               pmatch[i].rm_so = -1;
-                               pmatch[i].rm_eo = -1;
-                       }
-       }
-
-       if (m->pmatch != NULL)
-               free((char *)m->pmatch);
-       if (m->lastpos != NULL)
-               free((char *)m->lastpos);
-       STATETEARDOWN(m);
-       return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static const char *dissect(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* == stop (success) always */
-dissect(struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       int i;
-       sopno ss;               /* start sop of current subRE */
-       sopno es;               /* end sop of current subRE */
-       const char *sp;         /* start of string matched by it */
-       const char *stp;        /* string matched by it cannot pass here */
-       const char *rest;       /* start of rest of string */
-       const char *tail;       /* string unmatched by rest of RE */
-       sopno ssub;             /* start sop of subsubRE */
-       sopno esub;             /* end sop of subsubRE */
-       const char *ssp;        /* start of string matched by subsubRE */
-       const char *sep;        /* end of string matched by subsubRE */
-       const char *oldssp;     /* previous ssp */
-       const char *dp;
-
-       AT("diss", start, stop, startst, stopst);
-       sp = start;
-       for (ss = startst; ss < stopst; ss = es) {
-               /* identify end of subRE */
-               es = ss;
-               switch (OP(m->g->strip[es])) {
-               case OPLUS_:
-               case OQUEST_:
-                       es += OPND(m->g->strip[es]);
-                       break;
-               case OCH_:
-                       while (OP(m->g->strip[es]) != O_CH)
-                               es += OPND(m->g->strip[es]);
-                       break;
-               }
-               es++;
-
-               /* figure out what it matched */
-               switch (OP(m->g->strip[ss])) {
-               case OEND:
-                       assert(nope);
-                       break;
-               case OCHAR:
-                       sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0);
-                       break;
-               case OBOL:
-               case OEOL:
-               case OBOW:
-               case OEOW:
-                       break;
-               case OANY:
-               case OANYOF:
-                       sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0);
-                       break;
-               case OBACK_:
-               case O_BACK:
-                       assert(nope);
-                       break;
-               /* cases where length of match is hard to find */
-               case OQUEST_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = es - 1;
-                       /* did innards match? */
-                       if (slow(m, sp, rest, ssub, esub) != NULL) {
-                               dp = dissect(m, sp, rest, ssub, esub);
-                               assert(dp == rest);
-                       } else          /* no */
-                               assert(sp == rest);
-                       sp = rest;
-                       break;
-               case OPLUS_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = es - 1;
-                       ssp = sp;
-                       oldssp = ssp;
-                       for (;;) {      /* find last match of innards */
-                               sep = slow(m, ssp, rest, ssub, esub);
-                               if (sep == NULL || sep == ssp)
-                                       break;  /* failed or matched null */
-                               oldssp = ssp;   /* on to next try */
-                               ssp = sep;
-                       }
-                       if (sep == NULL) {
-                               /* last successful match */
-                               sep = ssp;
-                               ssp = oldssp;
-                       }
-                       assert(sep == rest);    /* must exhaust substring */
-                       assert(slow(m, ssp, sep, ssub, esub) == rest);
-                       dp = dissect(m, ssp, sep, ssub, esub);
-                       assert(dp == sep);
-                       sp = rest;
-                       break;
-               case OCH_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = ss + OPND(m->g->strip[ss]) - 1;
-                       assert(OP(m->g->strip[esub]) == OOR1);
-                       for (;;) {      /* find first matching branch */
-                               if (slow(m, sp, rest, ssub, esub) == rest)
-                                       break;  /* it matched all of it */
-                               /* that one missed, try next one */
-                               assert(OP(m->g->strip[esub]) == OOR1);
-                               esub++;
-                               assert(OP(m->g->strip[esub]) == OOR2);
-                               ssub = esub + 1;
-                               esub += OPND(m->g->strip[esub]);
-                               if (OP(m->g->strip[esub]) == OOR2)
-                                       esub--;
-                               else
-                                       assert(OP(m->g->strip[esub]) == O_CH);
-                       }
-                       dp = dissect(m, sp, rest, ssub, esub);
-                       assert(dp == rest);
-                       sp = rest;
-                       break;
-               case O_PLUS:
-               case O_QUEST:
-               case OOR1:
-               case OOR2:
-               case O_CH:
-                       assert(nope);
-                       break;
-               case OLPAREN:
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_so = sp - m->offp;
-                       break;
-               case ORPAREN:
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_eo = sp - m->offp;
-                       break;
-               default:                /* uh oh */
-                       assert(nope);
-                       break;
-               }
-       }
-
-       assert(sp == stop);
-       return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static const char *backref(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static const char *            /* == stop (success) or NULL (failure) */
-backref(struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst,
-       sopno lev,              /* PLUS nesting level */
-       int rec)
-{
-       int i;
-       sopno ss;               /* start sop of current subRE */
-       const char *sp;         /* start of string matched by it */
-       sopno ssub;             /* start sop of subsubRE */
-       sopno esub;             /* end sop of subsubRE */
-       const char *ssp;        /* start of string matched by subsubRE */
-       const char *dp;
-       size_t len;
-       int hard;
-       sop s;
-       regoff_t offsave;
-       cset *cs;
-       wint_t wc;
-
-       AT("back", start, stop, startst, stopst);
-       sp = start;
-
-       /* get as far as we can with easy stuff */
-       hard = 0;
-       for (ss = startst; !hard && ss < stopst; ss++)
-               switch (OP(s = m->g->strip[ss])) {
-               case OCHAR:
-                       if (sp == stop)
-                               return(NULL);
-                       sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
-                       if (wc != OPND(s))
-                               return(NULL);
-                       break;
-               case OANY:
-                       if (sp == stop)
-                               return(NULL);
-                       sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
-                       if (wc == BADCHAR)
-                               return (NULL);
-                       break;
-               case OANYOF:
-                       if (sp == stop)
-                               return (NULL);
-                       cs = &m->g->sets[OPND(s)];
-                       sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
-                       if (wc == BADCHAR || !CHIN(cs, wc))
-                               return(NULL);
-                       break;
-               case OBOL:
-                       if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OEOL:
-                       if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OBOW:
-                       if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp > m->beginp &&
-                                                       !ISWORD(*(sp-1))) ) &&
-                                       (sp < m->endp && ISWORD(*sp)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OEOW:
-                       if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp < m->endp && !ISWORD(*sp)) ) &&
-                                       (sp > m->beginp && ISWORD(*(sp-1))) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case O_QUEST:
-                       break;
-               case OOR1:      /* matches null but needs to skip */
-                       ss++;
-                       s = m->g->strip[ss];
-                       do {
-                               assert(OP(s) == OOR2);
-                               ss += OPND(s);
-                       } while (OP(s = m->g->strip[ss]) != O_CH);
-                       /* note that the ss++ gets us past the O_CH */
-                       break;
-               default:        /* have to make a choice */
-                       hard = 1;
-                       break;
-               }
-       if (!hard) {            /* that was it! */
-               if (sp != stop)
-                       return(NULL);
-               return(sp);
-       }
-       ss--;                   /* adjust for the for's final increment */
-
-       /* the hard stuff */
-       AT("hard", sp, stop, ss, stopst);
-       s = m->g->strip[ss];
-       switch (OP(s)) {
-       case OBACK_:            /* the vilest depths */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               if (m->pmatch[i].rm_eo == -1)
-                       return(NULL);
-               assert(m->pmatch[i].rm_so != -1);
-               len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
-               if (len == 0 && rec++ > MAX_RECURSION)
-                       return(NULL);
-               assert(stop - m->beginp >= len);
-               if (sp > stop - len)
-                       return(NULL);   /* not enough left to match */
-               ssp = m->offp + m->pmatch[i].rm_so;
-               if (memcmp(sp, ssp, len) != 0)
-                       return(NULL);
-               while (m->g->strip[ss] != SOP(O_BACK, i))
-                       ss++;
-               return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
-               break;
-       case OQUEST_:           /* to null or not */
-               dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
-               if (dp != NULL)
-                       return(dp);     /* not */
-               return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
-               break;
-       case OPLUS_:
-               assert(m->lastpos != NULL);
-               assert(lev+1 <= m->g->nplus);
-               m->lastpos[lev+1] = sp;
-               return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
-               break;
-       case O_PLUS:
-               if (sp == m->lastpos[lev])      /* last pass matched null */
-                       return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
-               /* try another pass */
-               m->lastpos[lev] = sp;
-               dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev, rec);
-               if (dp == NULL)
-                       return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
-               else
-                       return(dp);
-               break;
-       case OCH_:              /* find the right one, if any */
-               ssub = ss + 1;
-               esub = ss + OPND(s) - 1;
-               assert(OP(m->g->strip[esub]) == OOR1);
-               for (;;) {      /* find first matching branch */
-                       dp = backref(m, sp, stop, ssub, esub, lev, rec);
-                       if (dp != NULL)
-                               return(dp);
-                       /* that one missed, try next one */
-                       if (OP(m->g->strip[esub]) == O_CH)
-                               return(NULL);   /* there is none */
-                       esub++;
-                       assert(OP(m->g->strip[esub]) == OOR2);
-                       ssub = esub + 1;
-                       esub += OPND(m->g->strip[esub]);
-                       if (OP(m->g->strip[esub]) == OOR2)
-                               esub--;
-                       else
-                               assert(OP(m->g->strip[esub]) == O_CH);
-               }
-               break;
-       case OLPAREN:           /* must undo assignment if rest fails */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               offsave = m->pmatch[i].rm_so;
-               m->pmatch[i].rm_so = sp - m->offp;
-               dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
-               if (dp != NULL)
-                       return(dp);
-               m->pmatch[i].rm_so = offsave;
-               return(NULL);
-               break;
-       case ORPAREN:           /* must undo assignment if rest fails */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               offsave = m->pmatch[i].rm_eo;
-               m->pmatch[i].rm_eo = sp - m->offp;
-               dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
-               if (dp != NULL)
-                       return(dp);
-               m->pmatch[i].rm_eo = offsave;
-               return(NULL);
-               break;
-       default:                /* uh oh */
-               assert(nope);
-               break;
-       }
-
-       /* "can't happen" */
-       assert(nope);
-       /* NOTREACHED */
-       return "shut up gcc";
-}
-
-/*
- - fast - step through the string at top speed
- == static const char *fast(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* where tentative match ended, or NULL */
-fast(  struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       states st = m->st;
-       states fresh = m->fresh;
-       states tmp = m->tmp;
-       const char *p = start;
-       wint_t c;
-       wint_t lastc;           /* previous c */
-       wint_t flagch;
-       int i;
-       const char *coldp;      /* last p after which no match was underway */
-       size_t clen;
-
-       CLEAR(st);
-       SET1(st, startst);
-       SP("fast", st, *p);
-       st = step(m->g, startst, stopst, st, NOTHING, st);
-       ASSIGN(fresh, st);
-       SP("start", st, *p);
-       coldp = NULL;
-       if (start == m->beginp)
-               c = OUT;
-       else {
-               /*
-                * XXX Wrong if the previous character was multi-byte.
-                * Newline never is (in encodings supported by FreeBSD),
-                * so this only breaks the ISWORD tests below.
-                */
-               c = (uch)*(start - 1);
-       }
-       for (;;) {
-               /* next character */
-               lastc = c;
-               if (p == m->endp) {
-                       clen = 0;
-                       c = OUT;
-               } else
-                       clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR);
-               if (EQ(st, fresh))
-                       coldp = p;
-
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-               i = 0;
-               if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
-                       flagch = BOL;
-                       i = m->g->nbol;
-               }
-               if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
-                       flagch = (flagch == BOL) ? BOLEOL : EOL;
-                       i += m->g->neol;
-               }
-               if (i != 0) {
-                       for (; i > 0; i--)
-                               st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("boleol", st, c);
-               }
-
-               /* how about a word boundary? */
-               if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
-                                       (c != OUT && ISWORD(c)) ) {
-                       flagch = BOW;
-               }
-               if ( (lastc != OUT && ISWORD(lastc)) &&
-                               (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-                       st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("boweow", st, c);
-               }
-
-               /* are we done? */
-               if (ISSET(st, stopst) || p == stop || clen > stop - p)
-                       break;          /* NOTE BREAK OUT */
-
-               /* no, we must deal with this character */
-               ASSIGN(tmp, st);
-               ASSIGN(st, fresh);
-               assert(c != OUT);
-               st = step(m->g, startst, stopst, tmp, c, st);
-               SP("aft", st, c);
-               assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
-               p += clen;
-       }
-
-       assert(coldp != NULL);
-       m->coldp = coldp;
-       if (ISSET(st, stopst))
-               return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0));
-       else
-               return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static const char *slow(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* where it ended */
-slow(  struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       states st = m->st;
-       states empty = m->empty;
-       states tmp = m->tmp;
-       const char *p = start;
-       wint_t c;
-       wint_t lastc;           /* previous c */
-       wint_t flagch;
-       int i;
-       const char *matchp;     /* last p at which a match ended */
-       size_t clen;
-
-       AT("slow", start, stop, startst, stopst);
-       CLEAR(st);
-       SET1(st, startst);
-       SP("sstart", st, *p);
-       st = step(m->g, startst, stopst, st, NOTHING, st);
-       matchp = NULL;
-       if (start == m->beginp)
-               c = OUT;
-       else {
-               /*
-                * XXX Wrong if the previous character was multi-byte.
-                * Newline never is (in encodings supported by FreeBSD),
-                * so this only breaks the ISWORD tests below.
-                */
-               c = (uch)*(start - 1);
-       }
-       for (;;) {
-               /* next character */
-               lastc = c;
-               if (p == m->endp) {
-                       c = OUT;
-                       clen = 0;
-               } else
-                       clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR);
-
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-               i = 0;
-               if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
-                       flagch = BOL;
-                       i = m->g->nbol;
-               }
-               if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
-                       flagch = (flagch == BOL) ? BOLEOL : EOL;
-                       i += m->g->neol;
-               }
-               if (i != 0) {
-                       for (; i > 0; i--)
-                               st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("sboleol", st, c);
-               }
-
-               /* how about a word boundary? */
-               if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
-                                       (c != OUT && ISWORD(c)) ) {
-                       flagch = BOW;
-               }
-               if ( (lastc != OUT && ISWORD(lastc)) &&
-                               (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-                       st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("sboweow", st, c);
-               }
-
-               /* are we done? */
-               if (ISSET(st, stopst))
-                       matchp = p;
-               if (EQ(st, empty) || p == stop || clen > stop - p)
-                       break;          /* NOTE BREAK OUT */
-
-               /* no, we must deal with this character */
-               ASSIGN(tmp, st);
-               ASSIGN(st, empty);
-               assert(c != OUT);
-               st = step(m->g, startst, stopst, tmp, c, st);
-               SP("saft", st, c);
-               assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
-               p += clen;
-       }
-
-       return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(struct re_guts *g, sopno start, sopno stop, \
- ==    states bef, int ch, states aft);
- == #define    BOL     (OUT-1)
- == #define    EOL     (BOL-1)
- == #define    BOLEOL  (BOL-2)
- == #define    NOTHING (BOL-3)
- == #define    BOW     (BOL-4)
- == #define    EOW     (BOL-5)
- == #define    BADCHAR (BOL-6)
- == #define    NONCHAR(c)      ((c) <= OUT)
- */
-static states
-step(struct re_guts *g,
-       sopno start,            /* start state within strip */
-       sopno stop,             /* state after stop state within strip */
-       states bef,             /* states reachable before */
-       wint_t ch,              /* character or NONCHAR code */
-       states aft)             /* states already known reachable after */
-{
-       cset *cs;
-       sop s;
-       sopno pc;
-       onestate here;          /* note, macros know this name */
-       sopno look;
-       int i;
-
-       for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
-               s = g->strip[pc];
-               switch (OP(s)) {
-               case OEND:
-                       assert(pc == stop-1);
-                       break;
-               case OCHAR:
-                       /* only characters can match */
-                       assert(!NONCHAR(ch) || ch != OPND(s));
-                       if (ch == OPND(s))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBOL:
-                       if (ch == BOL || ch == BOLEOL)
-                               FWD(aft, bef, 1);
-                       break;
-               case OEOL:
-                       if (ch == EOL || ch == BOLEOL)
-                               FWD(aft, bef, 1);
-                       break;
-               case OBOW:
-                       if (ch == BOW)
-                               FWD(aft, bef, 1);
-                       break;
-               case OEOW:
-                       if (ch == EOW)
-                               FWD(aft, bef, 1);
-                       break;
-               case OANY:
-                       if (!NONCHAR(ch))
-                               FWD(aft, bef, 1);
-                       break;
-               case OANYOF:
-                       cs = &g->sets[OPND(s)];
-                       if (!NONCHAR(ch) && CHIN(cs, ch))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBACK_:            /* ignored here */
-               case O_BACK:
-                       FWD(aft, aft, 1);
-                       break;
-               case OPLUS_:            /* forward, this is just an empty */
-                       FWD(aft, aft, 1);
-                       break;
-               case O_PLUS:            /* both forward and back */
-                       FWD(aft, aft, 1);
-                       i = ISSETBACK(aft, OPND(s));
-                       BACK(aft, aft, OPND(s));
-                       if (!i && ISSETBACK(aft, OPND(s))) {
-                               /* oho, must reconsider loop body */
-                               pc -= OPND(s) + 1;
-                               INIT(here, pc);
-                       }
-                       break;
-               case OQUEST_:           /* two branches, both forward */
-                       FWD(aft, aft, 1);
-                       FWD(aft, aft, OPND(s));
-                       break;
-               case O_QUEST:           /* just an empty */
-                       FWD(aft, aft, 1);
-                       break;
-               case OLPAREN:           /* not significant here */
-               case ORPAREN:
-                       FWD(aft, aft, 1);
-                       break;
-               case OCH_:              /* mark the first two branches */
-                       FWD(aft, aft, 1);
-                       assert(OP(g->strip[pc+OPND(s)]) == OOR2);
-                       FWD(aft, aft, OPND(s));
-                       break;
-               case OOR1:              /* done a branch, find the O_CH */
-                       if (ISSTATEIN(aft, here)) {
-                               for (look = 1;
-                                               OP(s = g->strip[pc+look]) != O_CH;
-                                               look += OPND(s))
-                                       assert(OP(s) == OOR2);
-                               FWD(aft, aft, look + 1);
-                       }
-                       break;
-               case OOR2:              /* propagate OCH_'s marking */
-                       FWD(aft, aft, 1);
-                       if (OP(g->strip[pc+OPND(s)]) != O_CH) {
-                               assert(OP(g->strip[pc+OPND(s)]) == OOR2);
-                               FWD(aft, aft, OPND(s));
-                       }
-                       break;
-               case O_CH:              /* just empty */
-                       FWD(aft, aft, 1);
-                       break;
-               default:                /* ooooops... */
-                       assert(nope);
-                       break;
-               }
-       }
-
-       return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, const char *caption, states st, \
- ==    int ch, FILE *d);
- == #endif
- */
-static void
-print(struct match *m,
-       const char *caption,
-       states st,
-       int ch,
-       FILE *d)
-{
-       struct re_guts *g = m->g;
-       int i;
-       int first = 1;
-
-       if (!(m->eflags&REG_TRACE))
-               return;
-
-       fprintf(d, "%s", caption);
-       if (ch != '\0')
-               fprintf(d, " %s", pchar(ch));
-       for (i = 0; i < g->nstates; i++)
-               if (ISSET(st, i)) {
-                       fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
-                       first = 0;
-               }
-       fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, const char *title, const char *start, \
- ==                     const char *stop, sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(    struct match *m,
-       const char *title,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       if (!(m->eflags&REG_TRACE))
-               return;
-
-       printf("%s %s-", title, pchar(*start));
-       printf("%s ", pchar(*stop));
-       printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define        PCHARDONE       /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static const char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c?  Well, yes.  But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient.  It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static const char *            /* -> representation */
-pchar(int ch)
-{
-       static char pbuf[10];
-
-       if (isprint((uch)ch) || ch == ' ')
-               sprintf(pbuf, "%c", ch);
-       else
-               sprintf(pbuf, "\\%o", ch);
-       return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/regex/FreeBSD/engine.c.patch b/regex/FreeBSD/engine.c.patch
deleted file mode 100644 (file)
index ebf6da2..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
---- engine.c.bsdnew    2009-11-11 11:29:04.000000000 -0800
-+++ engine.c   2009-11-11 11:30:28.000000000 -0800
-@@ -272,7 +272,7 @@ matcher(struct re_guts *g,
-                               break;
-                       assert(m->coldp < m->endp);
-                       m->coldp += XMBRTOWC(NULL, m->coldp,
--                          m->endp - m->coldp, &m->mbs, 0);
-+                          m->endp - m->coldp, &m->mbs, 0, g->loc);
-               }
-               if (nmatch == 1 && !g->backrefs)
-                       break;          /* no further info needed */
-@@ -333,7 +333,7 @@ matcher(struct re_guts *g,
-               NOTE("false alarm");
-               /* recycle starting later */
-               start = m->coldp + XMBRTOWC(NULL, m->coldp,
--                  stop - m->coldp, &m->mbs, 0);
-+                  stop - m->coldp, &m->mbs, 0, g->loc);
-               assert(start <= stop);
-       }
-@@ -410,7 +410,7 @@ dissect(struct match *m,
-                       assert(nope);
-                       break;
-               case OCHAR:
--                      sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0);
-+                      sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0, m->g->loc);
-                       break;
-               case OBOL:
-               case OEOL:
-@@ -419,7 +419,7 @@ dissect(struct match *m,
-                       break;
-               case OANY:
-               case OANYOF:
--                      sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0);
-+                      sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0, m->g->loc);
-                       break;
-               case OBACK_:
-               case O_BACK:
-@@ -480,6 +480,10 @@ dissect(struct match *m,
-                               sep = ssp;
-                               ssp = oldssp;
-                       }
-+                      else if (tail==rest) {
-+                              /* Fix for test expr 105 */
-+                              ssp = oldssp;
-+                      }
-                       assert(sep == rest);    /* must exhaust substring */
-                       assert(slow(m, ssp, sep, ssub, esub) == rest);
-                       dp = dissect(m, ssp, sep, ssub, esub);
-@@ -532,6 +536,14 @@ dissect(struct match *m,
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_so = sp - m->offp;
-+                      /* fix for T.regcomp 43: don't remember previous
-+                         subexpression matches beyond the current one (i) */
-+                      i++;
-+                      while (i<= m->g->nsub) {
-+                              m->pmatch[i].rm_so = -1;
-+                              m->pmatch[i].rm_eo = -1;
-+                              i++;
-+                      }
-                       break;
-               case ORPAREN:
-                       i = OPND(m->g->strip[ss]);
-@@ -586,14 +598,14 @@ backref(struct match *m,
-               case OCHAR:
-                       if (sp == stop)
-                               return(NULL);
--                      sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
-+                      sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
-                       if (wc != OPND(s))
-                               return(NULL);
-                       break;
-               case OANY:
-                       if (sp == stop)
-                               return(NULL);
--                      sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
-+                      sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
-                       if (wc == BADCHAR)
-                               return (NULL);
-                       break;
-@@ -601,8 +613,8 @@ backref(struct match *m,
-                       if (sp == stop)
-                               return (NULL);
-                       cs = &m->g->sets[OPND(s)];
--                      sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR);
--                      if (wc == BADCHAR || !CHIN(cs, wc))
-+                      sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
-+                      if (wc == BADCHAR || !CHIN(cs, wc, m->g->loc))
-                               return(NULL);
-                       break;
-               case OBOL:
-@@ -626,8 +638,8 @@ backref(struct match *m,
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp > m->beginp &&
--                                                      !ISWORD(*(sp-1))) ) &&
--                                      (sp < m->endp && ISWORD(*sp)) )
-+                                                      !ISWORD(*(sp-1), m->g->loc)) ) &&
-+                                      (sp < m->endp && ISWORD(*sp, m->g->loc)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-@@ -636,8 +648,8 @@ backref(struct match *m,
-                       if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
--                                      (sp < m->endp && !ISWORD(*sp)) ) &&
--                                      (sp > m->beginp && ISWORD(*(sp-1))) )
-+                                      (sp < m->endp && !ISWORD(*sp, m->g->loc)) ) &&
-+                                      (sp > m->beginp && ISWORD(*(sp-1), m->g->loc)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-@@ -811,7 +823,7 @@ fast(      struct match *m,
-                       clen = 0;
-                       c = OUT;
-               } else
--                      clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR);
-+                      clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR, m->g->loc);
-               if (EQ(st, fresh))
-                       coldp = p;
-@@ -835,12 +847,12 @@ fast(    struct match *m,
-               }
-               /* how about a word boundary? */
--              if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
--                                      (c != OUT && ISWORD(c)) ) {
-+              if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc, m->g->loc))) &&
-+                                      (c != OUT && ISWORD(c, m->g->loc)) ) {
-                       flagch = BOW;
-               }
--              if ( (lastc != OUT && ISWORD(lastc)) &&
--                              (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
-+              if ( (lastc != OUT && ISWORD(lastc, m->g->loc)) &&
-+                              (flagch == EOL || (c != OUT && !ISWORD(c, m->g->loc))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-@@ -865,7 +877,7 @@ fast(      struct match *m,
-       assert(coldp != NULL);
-       m->coldp = coldp;
-       if (ISSET(st, stopst))
--              return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0));
-+              return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0, m->g->loc));
-       else
-               return(NULL);
- }
-@@ -916,7 +928,7 @@ slow(      struct match *m,
-                       c = OUT;
-                       clen = 0;
-               } else
--                      clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR);
-+                      clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR, m->g->loc);
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-@@ -938,12 +950,12 @@ slow(    struct match *m,
-               }
-               /* how about a word boundary? */
--              if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
--                                      (c != OUT && ISWORD(c)) ) {
-+              if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc, m->g->loc))) &&
-+                                      (c != OUT && ISWORD(c, m->g->loc)) ) {
-                       flagch = BOW;
-               }
--              if ( (lastc != OUT && ISWORD(lastc)) &&
--                              (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
-+              if ( (lastc != OUT && ISWORD(lastc, m->g->loc)) &&
-+                              (flagch == EOL || (c != OUT && !ISWORD(c, m->g->loc))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-@@ -1033,7 +1045,7 @@ step(struct re_guts *g,
-                       break;
-               case OANYOF:
-                       cs = &g->sets[OPND(s)];
--                      if (!NONCHAR(ch) && CHIN(cs, ch))
-+                      if (!NONCHAR(ch) && CHIN(cs, ch, g->loc))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBACK_:            /* ignored here */
index 5109e93d355a268953dfa82f0bf4ba3d4e5b88b6..cf3cbc08069101b14e91ddac91ef144525cbea93 100644 (file)
@@ -36,7 +36,7 @@
 .\"    @(#)re_format.7 8.3 (Berkeley) 3/20/94
 .\" $FreeBSD: src/lib/libc/regex/re_format.7,v 1.12 2008/09/05 17:41:20 keramida Exp $
 .\"
-.Dd March 20, 1994
+.Dd Sept 29, 2011
 .Dt RE_FORMAT 7
 .Os
 .Sh NAME
@@ -443,6 +443,348 @@ or
 .Ql cc
 but not
 .Ql bc .
+.Sh ENHANCED FEATURES
+When the
+.Dv REG_ENHANCED
+flag is passed to one of the
+.Fn regcomp
+variants, additional features are activated.
+Like the enhanced
+.Nm regex
+implementations in scripting languages such as
+.Xr perl 1
+and
+.Xr python 1 ,
+these additional features may conflict with the
+.St -p1003.2
+standards in some ways.
+Use this with care in situations which require portability
+(including to past versions of the Mac OS X using the previous
+.Nm regex
+implementation).
+.Pp
+For enhanced basic REs,
+.Ql \&+ ,
+.Ql \&?
+and
+.Ql \&|
+remain regular characters, but
+.Ql \e+ ,
+.Ql \e?
+and
+.Ql \e|
+have the same special meaning as the unescaped characters do for
+extended REs, i.e., one or more matches, zero or one matches and alteration,
+respectively.
+For enhanced extended REs,
+back references are available.
+Additional enhanced features are listed below.
+.Pp
+Within a bracket expression, most characters lose their magic.
+This also applies to the additional enhanced features, which don't operate
+inside a bracket expression.
+.Ss Assertions (available for both enhanced basic and enhanced extended REs)
+In addition to
+.Ql \&^
+and
+.Ql \&$
+(the assertions that match the null string at the beginning and end of line,
+respectively), the following assertions become available:
+.Bl -tag -width ".Sy \eB" -offset indent
+.It Sy \e<
+Matches the null string at the beginning of a word.
+This is equivalent to
+.Ql [[:<:]] .
+.It Sy \e>
+Matches the null string at the end of a word.
+This is equivalent to
+.Ql [[:>:]] .
+.It Sy \eb
+Matches the null string at a word boundary (either the beginning or end of
+a word).
+.It Sy \eB
+Matches the null string where there is no word boundary.
+This is the opposite of
+.Ql \eb .
+.El
+.Ss Shortcuts (available for both enhanced basic and enhanced extended REs)
+The following shortcuts can be used to replace more complicated
+bracket expressions.
+.Bl -tag -width ".Sy \eD" -offset indent
+.It Sy \ed
+Matches a digit character.
+This is equivalent to
+.Ql [[:digit:]] .
+.It Sy \eD
+Matches a non-digit character.
+This is equivalent to
+.Ql [^[:digit:]] .
+.It Sy \es
+Matches a space character.
+This is equivalent to
+.Ql [[:space:]] .
+.It Sy \eS
+Matches a non-space character.
+This is equivalent to
+.Ql [^[:space:]] .
+.It Sy \ew
+Matches a word character.
+This is equivalent to
+.Ql [[:alnum:]_] .
+.It Sy \eW
+Matches a non-word character.
+This is equivalent to
+.Ql [^[:alnum:]_] .
+.El
+.Ss Literal Sequences (available for both enhanced basic and enhanced extended REs)
+.Pp
+Literals are normally just ordinary characters that are matched directly.
+Under enhanced mode, certain character sequences are
+converted to specific literals.
+.Bl -tag -width ".Sy \ea" -offset indent
+.It Sy \ea
+The
+.Dq bell
+character (ASCII code 7).
+.It Sy \ee
+The
+.Dq escape
+character (ASCII code 27).
+.It Sy \ef
+The
+.Dq form-feed
+character (ASCII code 12).
+.It Sy \en
+The
+.Dq new-line/line-feed
+character (ASCII code 10).
+.It Sy \er
+The
+.Dq carriage-return
+character (ASCII code 13).
+.It Sy \et
+The
+.Dq horizontal-tab
+character (ASCII code 9).
+.El
+.Pp
+Literals can also be specified directly, using their wide character values.
+Note that when matching a multibyte character string, the string's bytes
+are converted to wide character before comparing.
+This means that a single literal wide character value may match more than
+one string byte, depending on the locale's wide character encoding.
+.Bl -tag -width ".Sy \ex{ Ns Em x.. Ns Sy \&}" -offset indent
+.It Sy \ex Ns Em x..
+An arbitray eight-bit value.
+The
+.Em x..
+sequence represents zero, one or two hexadecimal digits.
+(Note: if
+.Em x..
+is less than two hexadecimal digits, and the character following this sequence 
+happens to be a hexadecimal digit, use the (following) brace form to avoid
+confusion.)
+.It Sy \ex{ Ns Em x.. Ns Sy \&}
+An arbitrary, up to 32-bit value.
+The
+.Em x..
+sequence is an arbitrary sequence of hexadecimal digits that is long enough
+to represent the necessary value.
+.El
+.Ss Inline Literal Mode (available for both enhanced basic and enhanced extended REs)
+A
+.Ql \eQ
+sequence causes literal
+.Pq Dq quote
+mode to be entered,
+while
+.Ql \eE
+ends literal mode, and returns to normal regular expression processing.
+This is similar to specifying the
+.Dv REG_NOSPEC
+(or
+.Dv REG_LITERAL )
+option to
+.Fn regcomp ,
+except that rather than applying to the whole RE string, it only applies to
+the part between the
+.Ql \eQ
+and
+.Ql \eE .
+Note that it is not possible to have a
+.Ql \eE
+in the middle of an inline literal range, as that would terminate literal mode
+prematurely.
+.Ss Minimal Repetitions (available for enhanced extended REs only)
+By default, the repetition operators,
+.Ql \&* ,
+.Em bound ,
+.Ql \&?
+and
+.Ql \&+
+are
+.Em greedy ;
+they try to match as many times as possible.
+In enhanced mode, appending a
+.Ql \&?
+to a repetition operator makes it minimal (or
+.Em ungreedy ) ;
+it tries to match the fewest number of times (including zero times, as
+appropriate).
+.Pp
+For example, against the string
+.Ql aaa ,
+the RE
+.Ql a*
+would match the entire string,
+while
+.Ql a*?
+would match the null string at the beginning of the line
+(matches zero times).
+Likewise, against the string
+.Ql ababab ,
+the RE
+.Ql .*b ,
+would also match the entire string,
+while
+.Ql .*?b
+would only match the first two characters.
+.Pp
+The
+.Fn regcomp
+flag
+.Dv REG_UNGREEDY
+will make the regular
+.Pq greedy
+repetition operators ungreedy by default.
+Appending
+.Ql \&?
+makes them greedy again.
+.Pp
+Note that minimal repetitions are not specified by an official
+standard, so there may be differences between different implementations.
+In the current implementation, minimal repetitions have a high precedence,
+and can cause other standards requirements to be violated.
+For instance, on the string
+.Ql aaaaa ,
+the RE
+.Ql (aaa??)*
+will only match the first four characters, violating the rules that the longest
+possible match is made and the longest subexpressions are matched.
+Using
+.Ql (aaa??)*$
+forces the entire string to be matched.
+.Ss Non-capturing Parenthesized Subexpressions (available for enhanced extended REs only)
+Normally, the match offsets to parenthesized subexpressions are
+recorded in the
+.Fa pmatch
+array (that is, when
+.Dv REG_NOSUB
+is not specified, and
+.Fa nmatch
+is large enough to encompass the parenthesized subexpression in question).
+In enhanced mode, if the first two characters following the left parenthesis
+are
+.Ql ?: ,
+grouping of the remaining contents is done, but the corresponding offsets are
+not recorded in the
+.Fa pmatch
+array.
+For example, against the string
+.Ql fubar ,
+the RE
+.Ql (fu)(bar)
+would have two subexpression matches in
+.Fa pmatch ;
+the first for
+.Ql fu
+and the second for
+.Ql bar .
+But with the RE
+.Ql (?:fu)(bar) ,
+there would only be one subexpression match, that of
+.Ql bar .
+Furthermore,
+against the string
+.Ql fufubar ,
+the RE
+.Ql (?fu)*(bar)
+would again match the entire string, but only
+.Ql bar
+would be recorded in
+.Fa pmatch .
+.Ss Inline Options (available for enhanced extended REs only)
+Like the inline literal mode mentioned above, other options can be switched
+on and off for part of a RE.
+.Ql (? Ns Em o.. Ns \&)
+will turn on the options specified in
+.Em o..
+(one or more options characters; see below), while
+.Ql (?- Ns Em o.. Ns \&)
+will turn off the specified options, and
+.Ql (? Ns Em o1.. Ns \&- Ns Em o2.. Ns \&)
+will turn on the first set of options, and turn off the second set.
+.Pp
+The available options are:
+.Bl -tag -width ".Sy \&U" -offset indent
+.It Sy \&i
+Turning on this option will ignore case during matching, while turning off
+will restore case-sensitive matching.
+If
+.Dv REG_ICASE
+was specified to
+.Fn regcomp ,
+this option can be use to turn that off.
+.It Sy \&n
+Turn on or off special handling of the newline character.
+If
+.Dv REG_NEWLINE
+was specified to
+.Fn regcomp ,
+this option can be use to turn that off.
+.It Sy \&U
+Turning on this option will make ungreedy repetitions the default, while
+turning off will make greedy repetitions the default.
+If
+.Dv REG_UNGREEDY
+was specified to
+.Fn regcomp ,
+this option can be use to turn that off.
+.El
+.Pp
+The scope of the option change begins immediately following the right
+parenthesis,
+but up to the end of the enclosing subexpression (if any).
+Thus, for example, given the RE
+.Ql (fu(?i)bar)baz ,
+the
+.Ql fu
+portion matches case sensitively,
+.Ql bar
+matches case insensitively, and
+.Ql baz
+matches case sensitively again (since is it outside the scope of the
+subexpression in which the inline option was specified).
+.Pp
+The inline options syntax can be combined with the non-capturing parenthesized
+subexpression to limit the option scope to just that of the subexpression.
+Then, for example,
+.Ql fu(?i:bar)baz
+is similar to the previous example, except for the parenthesize subexpression
+around
+.Ql fu(?i)bar
+in the previous example.
+.Ss Inline Comments (available for enhanced extended REs only)
+The syntax
+.Ql (?# Ns Em comment Ns \&)
+can be used to embed comments within a RE.
+Note that
+.Em comment
+can not contain a right parenthesis.
+Also note that while syntactically, option characters can be added before
+the
+.Ql \&#
+character, they will be ignored.
 .Sh SEE ALSO
 .Xr regex 3
 .Rs
@@ -481,4 +823,4 @@ The
 definition given above
 is current consensus among implementors as to the right interpretation.
 .Pp
-The syntax for word boundaries is incredibly ugly.
+The bracket syntax for word boundaries is incredibly ugly.
diff --git a/regex/FreeBSD/regcomp.c b/regex/FreeBSD/regcomp.c
deleted file mode 100644 (file)
index 6691eec..0000000
+++ /dev/null
@@ -1,1776 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regcomp.c   8.5 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regcomp.c  8.5 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regcomp.c,v 1.36 2007/06/11 03:05:54 delphij Exp $");
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-#include <runetype.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "collate.h"
-
-#include "utils.h"
-#include "regex2.h"
-
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
-       char *next;             /* next character in RE */
-       char *end;              /* end of string (-> NUL normally) */
-       int error;              /* has an error been seen? */
-       sop *strip;             /* malloced strip */
-       sopno ssize;            /* malloced strip size (allocated) */
-       sopno slen;             /* malloced strip length (used) */
-       int ncsalloc;           /* number of csets allocated */
-       struct re_guts *g;
-#      define  NPAREN  10      /* we need to remember () 1-9 for back refs */
-       sopno pbegin[NPAREN];   /* -> ( ([0] unused) */
-       sopno pend[NPAREN];     /* -> ) ([0] unused) */
-};
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(struct parse *p, wint_t stop);
-static void p_ere_exp(struct parse *p);
-static void p_str(struct parse *p);
-static void p_bre(struct parse *p, wint_t end1, wint_t end2);
-static int p_simp_re(struct parse *p, int starordinary);
-static int p_count(struct parse *p);
-static void p_bracket(struct parse *p);
-static void p_b_term(struct parse *p, cset *cs);
-static void p_b_cclass(struct parse *p, cset *cs);
-static void p_b_eclass(struct parse *p, cset *cs);
-static wint_t p_b_symbol(struct parse *p);
-static wint_t p_b_coll_elem(struct parse *p, wint_t endc);
-static wint_t othercase(wint_t ch);
-static void bothcases(struct parse *p, wint_t ch);
-static void ordinary(struct parse *p, wint_t ch);
-static void nonnewline(struct parse *p);
-static void repeat(struct parse *p, sopno start, int from, int to);
-static int seterr(struct parse *p, int e);
-static cset *allocset(struct parse *p);
-static void freeset(struct parse *p, cset *cs);
-static void CHadd(struct parse *p, cset *cs, wint_t ch);
-static void CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max);
-static void CHaddtype(struct parse *p, cset *cs, wctype_t wct);
-static wint_t singleton(cset *cs);
-static sopno dupl(struct parse *p, sopno start, sopno finish);
-static void doemit(struct parse *p, sop op, size_t opnd);
-static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(struct parse *p, sopno pos, sop value);
-static void enlarge(struct parse *p, sopno size);
-static void stripsnug(struct parse *p, struct re_guts *g);
-static void findmust(struct parse *p, struct re_guts *g);
-static int altoffset(sop *scan, int offset);
-static void computejumps(struct parse *p, struct re_guts *g);
-static void computematchjumps(struct parse *p, struct re_guts *g);
-static sopno pluscount(struct parse *p, struct re_guts *g);
-static wint_t wgetnext(struct parse *p);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-
-static char nuls[10];          /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE:  these know that the parse structure is named `p' !!!
- */
-#define        PEEK()  (*p->next)
-#define        PEEK2() (*(p->next+1))
-#define        MORE()  (p->next < p->end)
-#define        MORE2() (p->next+1 < p->end)
-#define        SEE(c)  (MORE() && PEEK() == (c))
-#define        SEETWO(a, b)    (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define        EAT(c)  ((SEE(c)) ? (NEXT(), 1) : 0)
-#define        EATTWO(a, b)    ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define        NEXT()  (p->next++)
-#define        NEXT2() (p->next += 2)
-#define        NEXTn(n)        (p->next += (n))
-#define        GETNEXT()       (*p->next++)
-#define        WGETNEXT()      wgetnext(p)
-#define        SETERROR(e)     seterr(p, (e))
-#define        REQUIRE(co, e)  ((co) || SETERROR(e))
-#define        MUSTSEE(c, e)   (REQUIRE(MORE() && PEEK() == (c), e))
-#define        MUSTEAT(c, e)   (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define        MUSTNOTSEE(c, e)        (REQUIRE(!MORE() || PEEK() != (c), e))
-#define        EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define        INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define        AHEAD(pos)              dofwd(p, pos, HERE()-(pos))
-#define        ASTERN(sop, pos)        EMIT(sop, HERE()-pos)
-#define        HERE()          (p->slen)
-#define        THERE()         (p->slen - 1)
-#define        THERETHERE()    (p->slen - 2)
-#define        DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0;          /* for use in asserts; shuts lint up */
-#else
-#define        never   0               /* some <assert.h>s have bugs too */
-#endif
-
-/* Macro used by computejump()/computematchjump() */
-#define MIN(a,b)       ((a)<(b)?(a):(b))
-
-/*
- - regcomp - interface for parser and compilation
- = extern int regcomp(regex_t *, const char *, int);
- = #define     REG_BASIC       0000
- = #define     REG_EXTENDED    0001
- = #define     REG_ICASE       0002
- = #define     REG_NOSUB       0004
- = #define     REG_NEWLINE     0010
- = #define     REG_NOSPEC      0020
- = #define     REG_PEND        0040
- = #define     REG_DUMP        0200
- */
-int                            /* 0 success, otherwise REG_something */
-regcomp(regex_t * __restrict preg,
-       const char * __restrict pattern,
-       int cflags)
-{
-       struct parse pa;
-       struct re_guts *g;
-       struct parse *p = &pa;
-       int i;
-       size_t len;
-#ifdef REDEBUG
-#      define  GOODFLAGS(f)    (f)
-#else
-#      define  GOODFLAGS(f)    ((f)&~REG_DUMP)
-#endif
-
-       cflags = GOODFLAGS(cflags);
-       if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
-               return(REG_INVARG);
-
-       if (cflags&REG_PEND) {
-               if (preg->re_endp < pattern)
-                       return(REG_INVARG);
-               len = preg->re_endp - pattern;
-       } else
-               len = strlen((char *)pattern);
-
-       /* do the mallocs early so failure handling is easy */
-       g = (struct re_guts *)malloc(sizeof(struct re_guts));
-       if (g == NULL)
-               return(REG_ESPACE);
-       p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
-       p->strip = (sop *)malloc(p->ssize * sizeof(sop));
-       p->slen = 0;
-       if (p->strip == NULL) {
-               free((char *)g);
-               return(REG_ESPACE);
-       }
-
-       /* set things up */
-       p->g = g;
-       p->next = (char *)pattern;      /* convenience; we do not modify it */
-       p->end = p->next + len;
-       p->error = 0;
-       p->ncsalloc = 0;
-       for (i = 0; i < NPAREN; i++) {
-               p->pbegin[i] = 0;
-               p->pend[i] = 0;
-       }
-       g->sets = NULL;
-       g->ncsets = 0;
-       g->cflags = cflags;
-       g->iflags = 0;
-       g->nbol = 0;
-       g->neol = 0;
-       g->must = NULL;
-       g->moffset = -1;
-       g->charjump = NULL;
-       g->matchjump = NULL;
-       g->mlen = 0;
-       g->nsub = 0;
-       g->backrefs = 0;
-
-       /* do it */
-       EMIT(OEND, 0);
-       g->firststate = THERE();
-       if (cflags&REG_EXTENDED)
-               p_ere(p, OUT);
-       else if (cflags&REG_NOSPEC)
-               p_str(p);
-       else
-               p_bre(p, OUT, OUT);
-       EMIT(OEND, 0);
-       g->laststate = THERE();
-
-       /* tidy up loose ends and fill things in */
-       stripsnug(p, g);
-       findmust(p, g);
-       /* only use Boyer-Moore algorithm if the pattern is bigger
-        * than three characters
-        */
-       if(g->mlen > 3) {
-               computejumps(p, g);
-               computematchjumps(p, g);
-               if(g->matchjump == NULL && g->charjump != NULL) {
-                       free(g->charjump);
-                       g->charjump = NULL;
-               }
-       }
-       g->nplus = pluscount(p, g);
-       g->magic = MAGIC2;
-       preg->re_nsub = g->nsub;
-       preg->re_g = g;
-       preg->re_magic = MAGIC1;
-#ifndef REDEBUG
-       /* not debugging, so can't rely on the assert() in regexec() */
-       if (g->iflags&BAD)
-               SETERROR(REG_ASSERT);
-#endif
-
-       /* win or lose, we're done */
-       if (p->error != 0)      /* lose */
-               regfree(preg);
-       return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(struct parse *p, int stop);
- */
-static void
-p_ere(struct parse *p,
-       int stop)               /* character this ERE should end at */
-{
-       char c;
-       sopno prevback;
-       sopno prevfwd;
-       sopno conc;
-       int first = 1;          /* is this the first alternative? */
-
-       for (;;) {
-               /* do a bunch of concatenated expressions */
-               conc = HERE();
-               while (MORE() && (c = PEEK()) != '|' && c != stop)
-                       p_ere_exp(p);
-               (void)REQUIRE(HERE() != conc, REG_EMPTY);       /* require nonempty */
-
-               if (!EAT('|'))
-                       break;          /* NOTE BREAK OUT */
-
-               if (first) {
-                       INSERT(OCH_, conc);     /* offset is wrong */
-                       prevfwd = conc;
-                       prevback = conc;
-                       first = 0;
-               }
-               ASTERN(OOR1, prevback);
-               prevback = THERE();
-               AHEAD(prevfwd);                 /* fix previous offset */
-               prevfwd = HERE();
-               EMIT(OOR2, 0);                  /* offset is very wrong */
-       }
-
-       if (!first) {           /* tail-end fixups */
-               AHEAD(prevfwd);
-               ASTERN(O_CH, prevback);
-       }
-
-       assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(struct parse *p);
- */
-static void
-p_ere_exp(struct parse *p)
-{
-       char c;
-       wint_t wc;
-       sopno pos;
-       int count;
-       int count2;
-       sopno subno;
-       int wascaret = 0;
-
-       assert(MORE());         /* caller should have ensured this */
-       c = GETNEXT();
-
-       pos = HERE();
-       switch (c) {
-       case '(':
-               (void)REQUIRE(MORE(), REG_EPAREN);
-               p->g->nsub++;
-               subno = p->g->nsub;
-               if (subno < NPAREN)
-                       p->pbegin[subno] = HERE();
-               EMIT(OLPAREN, subno);
-               if (!SEE(')'))
-                       p_ere(p, ')');
-               if (subno < NPAREN) {
-                       p->pend[subno] = HERE();
-                       assert(p->pend[subno] != 0);
-               }
-               EMIT(ORPAREN, subno);
-               (void)MUSTEAT(')', REG_EPAREN);
-               break;
-#ifndef POSIX_MISTAKE
-       case ')':               /* happens only if no current unmatched ( */
-               /*
-                * You may ask, why the ifndef?  Because I didn't notice
-                * this until slightly too late for 1003.2, and none of the
-                * other 1003.2 regular-expression reviewers noticed it at
-                * all.  So an unmatched ) is legal POSIX, at least until
-                * we can get it fixed.
-                */
-               SETERROR(REG_EPAREN);
-               break;
-#endif
-       case '^':
-               EMIT(OBOL, 0);
-               p->g->iflags |= USEBOL;
-               p->g->nbol++;
-               wascaret = 1;
-               break;
-       case '$':
-               EMIT(OEOL, 0);
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-               break;
-       case '|':
-               SETERROR(REG_EMPTY);
-               break;
-       case '*':
-       case '+':
-       case '?':
-               SETERROR(REG_BADRPT);
-               break;
-       case '.':
-               if (p->g->cflags&REG_NEWLINE)
-                       nonnewline(p);
-               else
-                       EMIT(OANY, 0);
-               break;
-       case '[':
-               p_bracket(p);
-               break;
-       case '\\':
-               (void)REQUIRE(MORE(), REG_EESCAPE);
-               wc = WGETNEXT();
-               ordinary(p, wc);
-               break;
-       case '{':               /* okay as ordinary except if digit follows */
-               (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               p->next--;
-               wc = WGETNEXT();
-               ordinary(p, wc);
-               break;
-       }
-
-       if (!MORE())
-               return;
-       c = PEEK();
-       /* we call { a repetition if followed by a digit */
-       if (!( c == '*' || c == '+' || c == '?' ||
-                               (c == '{' && MORE2() && isdigit((uch)PEEK2())) ))
-               return;         /* no repetition, we're done */
-       NEXT();
-
-       (void)REQUIRE(!wascaret, REG_BADRPT);
-       switch (c) {
-       case '*':       /* implemented as +? */
-               /* this case does not require the (y|) trick, noKLUDGE */
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-               break;
-       case '+':
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               break;
-       case '?':
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, pos);              /* offset slightly wrong */
-               ASTERN(OOR1, pos);              /* this one's right */
-               AHEAD(pos);                     /* fix the OCH_ */
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-               break;
-       case '{':
-               count = p_count(p);
-               if (EAT(',')) {
-                       if (isdigit((uch)PEEK())) {
-                               count2 = p_count(p);
-                               (void)REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-                               count2 = INFINITY;
-               } else          /* just a single number */
-                       count2 = count;
-               repeat(p, pos, count, count2);
-               if (!EAT('}')) {        /* error heuristics */
-                       while (MORE() && PEEK() != '}')
-                               NEXT();
-                       (void)REQUIRE(MORE(), REG_EBRACE);
-                       SETERROR(REG_BADBR);
-               }
-               break;
-       }
-
-       if (!MORE())
-               return;
-       c = PEEK();
-       if (!( c == '*' || c == '+' || c == '?' ||
-                               (c == '{' && MORE2() && isdigit((uch)PEEK2())) ) )
-               return;
-       SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(struct parse *p);
- */
-static void
-p_str(struct parse *p)
-{
-       (void)REQUIRE(MORE(), REG_EMPTY);
-       while (MORE())
-               ordinary(p, WGETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(struct parse *p, int end1, \
- ==    int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(struct parse *p,
-       int end1,               /* first terminating character */
-       int end2)               /* second terminating character */
-{
-       sopno start = HERE();
-       int first = 1;                  /* first subexpression? */
-       int wasdollar = 0;
-
-       if (EAT('^')) {
-               EMIT(OBOL, 0);
-               p->g->iflags |= USEBOL;
-               p->g->nbol++;
-       }
-       while (MORE() && !SEETWO(end1, end2)) {
-               wasdollar = p_simp_re(p, first);
-               first = 0;
-       }
-       if (wasdollar) {        /* oops, that was a trailing anchor */
-               DROP(1);
-               EMIT(OEOL, 0);
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-       }
-
-       (void)REQUIRE(HERE() != start, REG_EMPTY);      /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(struct parse *p, int starordinary);
- */
-static int                     /* was the simple RE an unbackslashed $? */
-p_simp_re(struct parse *p,
-       int starordinary)       /* is a leading * an ordinary character? */
-{
-       int c;
-       int count;
-       int count2;
-       sopno pos;
-       int i;
-       wint_t wc;
-       sopno subno;
-#      define  BACKSL  (1<<CHAR_BIT)
-
-       pos = HERE();           /* repetion op, if any, covers from here */
-
-       assert(MORE());         /* caller should have ensured this */
-       c = GETNEXT();
-       if (c == '\\') {
-               (void)REQUIRE(MORE(), REG_EESCAPE);
-               c = BACKSL | GETNEXT();
-       }
-       switch (c) {
-       case '.':
-               if (p->g->cflags&REG_NEWLINE)
-                       nonnewline(p);
-               else
-                       EMIT(OANY, 0);
-               break;
-       case '[':
-               p_bracket(p);
-               break;
-       case BACKSL|'{':
-               SETERROR(REG_BADRPT);
-               break;
-       case BACKSL|'(':
-               p->g->nsub++;
-               subno = p->g->nsub;
-               if (subno < NPAREN)
-                       p->pbegin[subno] = HERE();
-               EMIT(OLPAREN, subno);
-               /* the MORE here is an error heuristic */
-               if (MORE() && !SEETWO('\\', ')'))
-                       p_bre(p, '\\', ')');
-               if (subno < NPAREN) {
-                       p->pend[subno] = HERE();
-                       assert(p->pend[subno] != 0);
-               }
-               EMIT(ORPAREN, subno);
-               (void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
-               break;
-       case BACKSL|')':        /* should not get here -- must be user */
-       case BACKSL|'}':
-               SETERROR(REG_EPAREN);
-               break;
-       case BACKSL|'1':
-       case BACKSL|'2':
-       case BACKSL|'3':
-       case BACKSL|'4':
-       case BACKSL|'5':
-       case BACKSL|'6':
-       case BACKSL|'7':
-       case BACKSL|'8':
-       case BACKSL|'9':
-               i = (c&~BACKSL) - '0';
-               assert(i < NPAREN);
-               if (p->pend[i] != 0) {
-                       assert(i <= p->g->nsub);
-                       EMIT(OBACK_, i);
-                       assert(p->pbegin[i] != 0);
-                       assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
-                       assert(OP(p->strip[p->pend[i]]) == ORPAREN);
-                       (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
-                       EMIT(O_BACK, i);
-               } else
-                       SETERROR(REG_ESUBREG);
-               p->g->backrefs = 1;
-               break;
-       case '*':
-               (void)REQUIRE(starordinary, REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               p->next--;
-               wc = WGETNEXT();
-               ordinary(p, wc);
-               break;
-       }
-
-       if (EAT('*')) {         /* implemented as +? */
-               /* this case does not require the (y|) trick, noKLUDGE */
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-       } else if (EATTWO('\\', '{')) {
-               count = p_count(p);
-               if (EAT(',')) {
-                       if (MORE() && isdigit((uch)PEEK())) {
-                               count2 = p_count(p);
-                               (void)REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-                               count2 = INFINITY;
-               } else          /* just a single number */
-                       count2 = count;
-               repeat(p, pos, count, count2);
-               if (!EATTWO('\\', '}')) {       /* error heuristics */
-                       while (MORE() && !SEETWO('\\', '}'))
-                               NEXT();
-                       (void)REQUIRE(MORE(), REG_EBRACE);
-                       SETERROR(REG_BADBR);
-               }
-       } else if (c == '$')     /* $ (but not \$) ends it */
-               return(1);
-
-       return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(struct parse *p);
- */
-static int                     /* the value */
-p_count(struct parse *p)
-{
-       int count = 0;
-       int ndigits = 0;
-
-       while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
-               count = count*10 + (GETNEXT() - '0');
-               ndigits++;
-       }
-
-       (void)REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
-       return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(struct parse *p);
- */
-static void
-p_bracket(struct parse *p)
-{
-       cset *cs;
-       wint_t ch;
-
-       /* Dept of Truly Sickening Special-Case Kludges */
-       if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
-               EMIT(OBOW, 0);
-               NEXTn(6);
-               return;
-       }
-       if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
-               EMIT(OEOW, 0);
-               NEXTn(6);
-               return;
-       }
-
-       if ((cs = allocset(p)) == NULL)
-               return;
-
-       if (p->g->cflags&REG_ICASE)
-               cs->icase = 1;
-       if (EAT('^'))
-               cs->invert = 1;
-       if (EAT(']'))
-               CHadd(p, cs, ']');
-       else if (EAT('-'))
-               CHadd(p, cs, '-');
-       while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
-               p_b_term(p, cs);
-       if (EAT('-'))
-               CHadd(p, cs, '-');
-       (void)MUSTEAT(']', REG_EBRACK);
-
-       if (p->error != 0)      /* don't mess things up further */
-               return;
-
-       if (cs->invert && p->g->cflags&REG_NEWLINE)
-               cs->bmp['\n' >> 3] |= 1 << ('\n' & 7);
-
-       if ((ch = singleton(cs)) != OUT) {      /* optimize singleton sets */
-               ordinary(p, ch);
-               freeset(p, cs);
-       } else
-               EMIT(OANYOF, (int)(cs - p->g->sets));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(struct parse *p, cset *cs);
- */
-static void
-p_b_term(struct parse *p, cset *cs)
-{
-       char c;
-       wint_t start, finish;
-       wint_t i;
-
-       /* classify what we've got */
-       switch ((MORE()) ? PEEK() : '\0') {
-       case '[':
-               c = (MORE2()) ? PEEK2() : '\0';
-               break;
-       case '-':
-               SETERROR(REG_ERANGE);
-               return;                 /* NOTE RETURN */
-               break;
-       default:
-               c = '\0';
-               break;
-       }
-
-       switch (c) {
-       case ':':               /* character class */
-               NEXT2();
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-               (void)REQUIRE(c != '-' && c != ']', REG_ECTYPE);
-               p_b_cclass(p, cs);
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               (void)REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
-               break;
-       case '=':               /* equivalence class */
-               NEXT2();
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-               (void)REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
-               p_b_eclass(p, cs);
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               (void)REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
-               break;
-       default:                /* symbol, ordinary character, or range */
-               start = p_b_symbol(p);
-               if (SEE('-') && MORE2() && PEEK2() != ']') {
-                       /* range */
-                       NEXT();
-                       if (EAT('-'))
-                               finish = '-';
-                       else
-                               finish = p_b_symbol(p);
-               } else
-                       finish = start;
-               if (start == finish)
-                       CHadd(p, cs, start);
-               else {
-                       if (__collate_load_error) {
-                               (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE);
-                               CHaddrange(p, cs, start, finish);
-                       } else {
-                               (void)REQUIRE(__collate_range_cmp(start, finish) <= 0, REG_ERANGE);
-                               for (i = 0; i <= UCHAR_MAX; i++) {
-                                       if (   __collate_range_cmp(start, i) <= 0
-                                           && __collate_range_cmp(i, finish) <= 0
-                                          )
-                                               CHadd(p, cs, i);
-                               }
-                       }
-               }
-               break;
-       }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(struct parse *p, cset *cs);
- */
-static void
-p_b_cclass(struct parse *p, cset *cs)
-{
-       char *sp = p->next;
-       size_t len;
-       wctype_t wct;
-       char clname[16];
-
-       while (MORE() && isalpha((uch)PEEK()))
-               NEXT();
-       len = p->next - sp;
-       if (len >= sizeof(clname) - 1) {
-               SETERROR(REG_ECTYPE);
-               return;
-       }
-       memcpy(clname, sp, len);
-       clname[len] = '\0';
-       if ((wct = wctype(clname)) == 0) {
-               SETERROR(REG_ECTYPE);
-               return;
-       }
-       CHaddtype(p, cs, wct);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(struct parse *p, cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(struct parse *p, cset *cs)
-{
-       wint_t c;
-
-       c = p_b_coll_elem(p, '=');
-       CHadd(p, cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(struct parse *p);
- */
-static wint_t                  /* value of symbol */
-p_b_symbol(struct parse *p)
-{
-       wint_t value;
-
-       (void)REQUIRE(MORE(), REG_EBRACK);
-       if (!EATTWO('[', '.'))
-               return(WGETNEXT());
-
-       /* collating symbol */
-       value = p_b_coll_elem(p, '.');
-       (void)REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
-       return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(struct parse *p, int endc);
- */
-static wint_t                  /* value of collating element */
-p_b_coll_elem(struct parse *p,
-       wint_t endc)            /* name ended by endc,']' */
-{
-       char *sp = p->next;
-       struct cname *cp;
-       int len;
-       mbstate_t mbs;
-       wchar_t wc;
-       size_t clen;
-
-       while (MORE() && !SEETWO(endc, ']'))
-               NEXT();
-       if (!MORE()) {
-               SETERROR(REG_EBRACK);
-               return(0);
-       }
-       len = p->next - sp;
-       for (cp = cnames; cp->name != NULL; cp++)
-               if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-                       return(cp->code);       /* known name */
-       memset(&mbs, 0, sizeof(mbs));
-       if ((clen = mbrtowc(&wc, sp, len, &mbs)) == len)
-               return (wc);                    /* single character */
-       else if (clen == (size_t)-1 || clen == (size_t)-2)
-               SETERROR(REG_ILLSEQ);
-       else
-               SETERROR(REG_ECOLLATE);         /* neither */
-       return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static wint_t                  /* if no counterpart, return ch */
-othercase(wint_t ch)
-{
-       assert(iswalpha(ch));
-       if (iswupper(ch))
-               return(towlower(ch));
-       else if (iswlower(ch))
-               return(towupper(ch));
-       else                    /* peculiar, but could happen */
-               return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(struct parse *p, wint_t ch)
-{
-       char *oldnext = p->next;
-       char *oldend = p->end;
-       char bracket[3 + MB_LEN_MAX];
-       size_t n;
-       mbstate_t mbs;
-
-       assert(othercase(ch) != ch);    /* p_bracket() would recurse */
-       p->next = bracket;
-       memset(&mbs, 0, sizeof(mbs));
-       n = wcrtomb(bracket, ch, &mbs);
-       assert(n != (size_t)-1);
-       bracket[n] = ']';
-       bracket[n + 1] = '\0';
-       p->end = bracket+n+1;
-       p_bracket(p);
-       assert(p->next == p->end);
-       p->next = oldnext;
-       p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(struct parse *p, int ch);
- */
-static void
-ordinary(struct parse *p, wint_t ch)
-{
-       cset *cs;
-
-       if ((p->g->cflags&REG_ICASE) && iswalpha(ch) && othercase(ch) != ch)
-               bothcases(p, ch);
-       else if ((ch & OPDMASK) == ch)
-               EMIT(OCHAR, ch);
-       else {
-               /*
-                * Kludge: character is too big to fit into an OCHAR operand.
-                * Emit a singleton set.
-                */
-               if ((cs = allocset(p)) == NULL)
-                       return;
-               CHadd(p, cs, ch);
-               EMIT(OANYOF, (int)(cs - p->g->sets));
-       }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(struct parse *p)
-{
-       char *oldnext = p->next;
-       char *oldend = p->end;
-       char bracket[4];
-
-       p->next = bracket;
-       p->end = bracket+3;
-       bracket[0] = '^';
-       bracket[1] = '\n';
-       bracket[2] = ']';
-       bracket[3] = '\0';
-       p_bracket(p);
-       assert(p->next == bracket+3);
-       p->next = oldnext;
-       p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(struct parse *p,
-       sopno start,            /* operand from here to end of strip */
-       int from,               /* repeated from this number */
-       int to)                 /* to this number of times (maybe INFINITY) */
-{
-       sopno finish = HERE();
-#      define  N       2
-#      define  INF     3
-#      define  REP(f, t)       ((f)*8 + (t))
-#      define  MAP(n)  (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
-       sopno copy;
-
-       if (p->error != 0)      /* head off possible runaway recursion */
-               return;
-
-       assert(from <= to);
-
-       switch (REP(MAP(from), MAP(to))) {
-       case REP(0, 0):                 /* must be user doing this */
-               DROP(finish-start);     /* drop the operand */
-               break;
-       case REP(0, 1):                 /* as x{1,1}? */
-       case REP(0, N):                 /* as x{1,n}? */
-       case REP(0, INF):               /* as x{1,}? */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);            /* offset is wrong... */
-               repeat(p, start+1, 1, to);
-               ASTERN(OOR1, start);
-               AHEAD(start);                   /* ... fix it */
-               EMIT(OOR2, 0);
-               AHEAD(THERE());
-               ASTERN(O_CH, THERETHERE());
-               break;
-       case REP(1, 1):                 /* trivial case */
-               /* done */
-               break;
-       case REP(1, N):                 /* as x?x{1,n-1} */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);
-               ASTERN(OOR1, start);
-               AHEAD(start);
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-               copy = dupl(p, start+1, finish+1);
-               assert(copy == finish+4);
-               repeat(p, copy, 1, to-1);
-               break;
-       case REP(1, INF):               /* as x+ */
-               INSERT(OPLUS_, start);
-               ASTERN(O_PLUS, start);
-               break;
-       case REP(N, N):                 /* as xx{m-1,n-1} */
-               copy = dupl(p, start, finish);
-               repeat(p, copy, from-1, to-1);
-               break;
-       case REP(N, INF):               /* as xx{n-1,INF} */
-               copy = dupl(p, start, finish);
-               repeat(p, copy, from-1, to);
-               break;
-       default:                        /* "can't happen" */
-               SETERROR(REG_ASSERT);   /* just in case */
-               break;
-       }
-}
-
-/*
- - wgetnext - helper function for WGETNEXT() macro. Gets the next wide
- - character from the parse struct, signals a REG_ILLSEQ error if the
- - character can't be converted. Returns the number of bytes consumed.
- */
-static wint_t
-wgetnext(struct parse *p)
-{
-       mbstate_t mbs;
-       wchar_t wc;
-       size_t n;
-
-       memset(&mbs, 0, sizeof(mbs));
-       n = mbrtowc(&wc, p->next, p->end - p->next, &mbs);
-       if (n == (size_t)-1 || n == (size_t)-2) {
-               SETERROR(REG_ILLSEQ);
-               return (0);
-       }
-       if (n == 0)
-               n = 1;
-       p->next += n;
-       return (wc);
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(struct parse *p, int e);
- */
-static int                     /* useless but makes type checking happy */
-seterr(struct parse *p, int e)
-{
-       if (p->error == 0)      /* keep earliest error condition */
-               p->error = e;
-       p->next = nuls;         /* try to bring things to a halt */
-       p->end = nuls;
-       return(0);              /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(struct parse *p);
- */
-static cset *
-allocset(struct parse *p)
-{
-       cset *cs, *ncs;
-
-       ncs = realloc(p->g->sets, (p->g->ncsets + 1) * sizeof(*ncs));
-       if (ncs == NULL) {
-               SETERROR(REG_ESPACE);
-               return (NULL);
-       }
-       p->g->sets = ncs;
-       cs = &p->g->sets[p->g->ncsets++];
-       memset(cs, 0, sizeof(*cs));
-
-       return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(struct parse *p, cset *cs);
- */
-static void
-freeset(struct parse *p, cset *cs)
-{
-       cset *top = &p->g->sets[p->g->ncsets];
-
-       free(cs->wides);
-       free(cs->ranges);
-       free(cs->types);
-       memset(cs, 0, sizeof(*cs));
-       if (cs == top-1)        /* recover only the easy case */
-               p->g->ncsets--;
-}
-
-/*
- - singleton - Determine whether a set contains only one character,
- - returning it if so, otherwise returning OUT.
- */
-static wint_t
-singleton(cset *cs)
-{
-       wint_t i, s, n;
-
-       for (i = n = 0; i < NC; i++)
-               if (CHIN(cs, i)) {
-                       n++;
-                       s = i;
-               }
-       if (n == 1)
-               return (s);
-       if (cs->nwides == 1 && cs->nranges == 0 && cs->ntypes == 0 &&
-           cs->icase == 0)
-               return (cs->wides[0]);
-       /* Don't bother handling the other cases. */
-       return (OUT);
-}
-
-/*
- - CHadd - add character to character set.
- */
-static void
-CHadd(struct parse *p, cset *cs, wint_t ch)
-{
-       wint_t nch, *newwides;
-       assert(ch >= 0);
-       if (ch < NC)
-               cs->bmp[ch >> 3] |= 1 << (ch & 7);
-       else {
-               newwides = realloc(cs->wides, (cs->nwides + 1) *
-                   sizeof(*cs->wides));
-               if (newwides == NULL) {
-                       SETERROR(REG_ESPACE);
-                       return;
-               }
-               cs->wides = newwides;
-               cs->wides[cs->nwides++] = ch;
-       }
-       if (cs->icase) {
-               if ((nch = towlower(ch)) < NC)
-                       cs->bmp[nch >> 3] |= 1 << (nch & 7);
-               if ((nch = towupper(ch)) < NC)
-                       cs->bmp[nch >> 3] |= 1 << (nch & 7);
-       }
-}
-
-/*
- - CHaddrange - add all characters in the range [min,max] to a character set.
- */
-static void
-CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max)
-{
-       crange *newranges;
-
-       for (; min < NC && min <= max; min++)
-               CHadd(p, cs, min);
-       if (min >= max)
-               return;
-       newranges = realloc(cs->ranges, (cs->nranges + 1) *
-           sizeof(*cs->ranges));
-       if (newranges == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       cs->ranges = newranges;
-       cs->ranges[cs->nranges].min = min;
-       cs->ranges[cs->nranges].min = max;
-       cs->nranges++;
-}
-
-/*
- - CHaddtype - add all characters of a certain type to a character set.
- */
-static void
-CHaddtype(struct parse *p, cset *cs, wctype_t wct)
-{
-       wint_t i;
-       wctype_t *newtypes;
-
-       for (i = 0; i < NC; i++)
-               if (iswctype(i, wct))
-                       CHadd(p, cs, i);
-       newtypes = realloc(cs->types, (cs->ntypes + 1) *
-           sizeof(*cs->types));
-       if (newtypes == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       cs->types = newtypes;
-       cs->types[cs->ntypes++] = wct;
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(struct parse *p, sopno start, sopno finish);
- */
-static sopno                   /* start of duplicate */
-dupl(struct parse *p,
-       sopno start,            /* from here */
-       sopno finish)           /* to this less one */
-{
-       sopno ret = HERE();
-       sopno len = finish - start;
-
-       assert(finish >= start);
-       if (len == 0)
-               return(ret);
-       enlarge(p, p->ssize + len);     /* this many unexpected additions */
-       assert(p->ssize >= p->slen + len);
-       (void) memcpy((char *)(p->strip + p->slen),
-               (char *)(p->strip + start), (size_t)len*sizeof(sop));
-       p->slen += len;
-       return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures.  Maybe later.
- */
-static void
-doemit(struct parse *p, sop op, size_t opnd)
-{
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       /* deal with oversize operands ("can't happen", more or less) */
-       assert(opnd < 1<<OPSHIFT);
-
-       /* deal with undersized strip */
-       if (p->slen >= p->ssize)
-               enlarge(p, (p->ssize+1) / 2 * 3);       /* +50% */
-       assert(p->slen < p->ssize);
-
-       /* finally, it's all reduced to the easy case */
-       p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(struct parse *p, sop op, size_t opnd, sopno pos)
-{
-       sopno sn;
-       sop s;
-       int i;
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       sn = HERE();
-       EMIT(op, opnd);         /* do checks, ensure space */
-       assert(HERE() == sn+1);
-       s = p->strip[sn];
-
-       /* adjust paren pointers */
-       assert(pos > 0);
-       for (i = 1; i < NPAREN; i++) {
-               if (p->pbegin[i] >= pos) {
-                       p->pbegin[i]++;
-               }
-               if (p->pend[i] >= pos) {
-                       p->pend[i]++;
-               }
-       }
-
-       memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
-                                               (HERE()-pos-1)*sizeof(sop));
-       p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(struct parse *p, sopno pos, sop value)
-{
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       assert(value < 1<<OPSHIFT);
-       p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(struct parse *p, sopno size);
- */
-static void
-enlarge(struct parse *p, sopno size)
-{
-       sop *sp;
-
-       if (p->ssize >= size)
-               return;
-
-       sp = (sop *)realloc(p->strip, size*sizeof(sop));
-       if (sp == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       p->strip = sp;
-       p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(struct parse *p, struct re_guts *g);
- */
-static void
-stripsnug(struct parse *p, struct re_guts *g)
-{
-       g->nstates = p->slen;
-       g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
-       if (g->strip == NULL) {
-               SETERROR(REG_ESPACE);
-               g->strip = p->strip;
-       }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(struct parse *p, struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences.  Someday.  This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(struct parse *p, struct re_guts *g)
-{
-       sop *scan;
-       sop *start;
-       sop *newstart;
-       sopno newlen;
-       sop s;
-       char *cp;
-       int offset;
-       char buf[MB_LEN_MAX];
-       size_t clen;
-       mbstate_t mbs;
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       /*
-        * It's not generally safe to do a ``char'' substring search on
-        * multibyte character strings, but it's safe for at least
-        * UTF-8 (see RFC 3629).
-        */
-       if (MB_CUR_MAX > 1 &&
-           strcmp(_CurrentRuneLocale->__encoding, "UTF-8") != 0)
-               return;
-
-       /* find the longest OCHAR sequence in strip */
-       newlen = 0;
-       offset = 0;
-       g->moffset = 0;
-       scan = g->strip + 1;
-       do {
-               s = *scan++;
-               switch (OP(s)) {
-               case OCHAR:             /* sequence member */
-                       if (newlen == 0) {              /* new sequence */
-                               memset(&mbs, 0, sizeof(mbs));
-                               newstart = scan - 1;
-                       }
-                       clen = wcrtomb(buf, OPND(s), &mbs);
-                       if (clen == (size_t)-1)
-                               goto toohard;
-                       newlen += clen;
-                       break;
-               case OPLUS_:            /* things that don't break one */
-               case OLPAREN:
-               case ORPAREN:
-                       break;
-               case OQUEST_:           /* things that must be skipped */
-               case OCH_:
-                       offset = altoffset(scan, offset);
-                       scan--;
-                       do {
-                               scan += OPND(s);
-                               s = *scan;
-                               /* assert() interferes w debug printouts */
-                               if (OP(s) != O_QUEST && OP(s) != O_CH &&
-                                                       OP(s) != OOR2) {
-                                       g->iflags |= BAD;
-                                       return;
-                               }
-                       } while (OP(s) != O_QUEST && OP(s) != O_CH);
-                       /* FALLTHROUGH */
-               case OBOW:              /* things that break a sequence */
-               case OEOW:
-               case OBOL:
-               case OEOL:
-               case O_QUEST:
-               case O_CH:
-               case OEND:
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1) {
-                                       g->moffset += offset;
-                                       offset = newlen;
-                               } else
-                                       g->moffset = offset;
-                       } else {
-                               if (offset > -1)
-                                       offset += newlen;
-                       }
-                       newlen = 0;
-                       break;
-               case OANY:
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1) {
-                                       g->moffset += offset;
-                                       offset = newlen;
-                               } else
-                                       g->moffset = offset;
-                       } else {
-                               if (offset > -1)
-                                       offset += newlen;
-                       }
-                       if (offset > -1)
-                               offset++;
-                       newlen = 0;
-                       break;
-               case OANYOF:            /* may or may not invalidate offset */
-                       /* First, everything as OANY */
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1) {
-                                       g->moffset += offset;
-                                       offset = newlen;
-                               } else
-                                       g->moffset = offset;
-                       } else {
-                               if (offset > -1)
-                                       offset += newlen;
-                       }
-                       if (offset > -1)
-                               offset++;
-                       newlen = 0;
-                       break;
-               toohard:
-               default:
-                       /* Anything here makes it impossible or too hard
-                        * to calculate the offset -- so we give up;
-                        * save the last known good offset, in case the
-                        * must sequence doesn't occur later.
-                        */
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1)
-                                       g->moffset += offset;
-                               else
-                                       g->moffset = offset;
-                       }
-                       offset = -1;
-                       newlen = 0;
-                       break;
-               }
-       } while (OP(s) != OEND);
-
-       if (g->mlen == 0) {             /* there isn't one */
-               g->moffset = -1;
-               return;
-       }
-
-       /* turn it into a character string */
-       g->must = malloc((size_t)g->mlen + 1);
-       if (g->must == NULL) {          /* argh; just forget it */
-               g->mlen = 0;
-               g->moffset = -1;
-               return;
-       }
-       cp = g->must;
-       scan = start;
-       memset(&mbs, 0, sizeof(mbs));
-       while (cp < g->must + g->mlen) {
-               while (OP(s = *scan++) != OCHAR)
-                       continue;
-               clen = wcrtomb(cp, OPND(s), &mbs);
-               assert(clen != (size_t)-1);
-               cp += clen;
-       }
-       assert(cp == g->must + g->mlen);
-       *cp++ = '\0';           /* just on general principles */
-}
-
-/*
- - altoffset - choose biggest offset among multiple choices
- == static int altoffset(sop *scan, int offset);
- *
- * Compute, recursively if necessary, the largest offset among multiple
- * re paths.
- */
-static int
-altoffset(sop *scan, int offset)
-{
-       int largest;
-       int try;
-       sop s;
-
-       /* If we gave up already on offsets, return */
-       if (offset == -1)
-               return -1;
-
-       largest = 0;
-       try = 0;
-       s = *scan++;
-       while (OP(s) != O_QUEST && OP(s) != O_CH) {
-               switch (OP(s)) {
-               case OOR1:
-                       if (try > largest)
-                               largest = try;
-                       try = 0;
-                       break;
-               case OQUEST_:
-               case OCH_:
-                       try = altoffset(scan, try);
-                       if (try == -1)
-                               return -1;
-                       scan--;
-                       do {
-                               scan += OPND(s);
-                               s = *scan;
-                               if (OP(s) != O_QUEST && OP(s) != O_CH &&
-                                                       OP(s) != OOR2)
-                                       return -1;
-                       } while (OP(s) != O_QUEST && OP(s) != O_CH);
-                       /* We must skip to the next position, or we'll
-                        * leave altoffset() too early.
-                        */
-                       scan++;
-                       break;
-               case OANYOF:
-               case OCHAR:
-               case OANY:
-                       try++;
-               case OBOW:
-               case OEOW:
-               case OLPAREN:
-               case ORPAREN:
-               case OOR2:
-                       break;
-               default:
-                       try = -1;
-                       break;
-               }
-               if (try == -1)
-                       return -1;
-               s = *scan++;
-       }
-
-       if (try > largest)
-               largest = try;
-
-       return largest+offset;
-}
-
-/*
- - computejumps - compute char jumps for BM scan
- == static void computejumps(struct parse *p, struct re_guts *g);
- *
- * This algorithm assumes g->must exists and is has size greater than
- * zero. It's based on the algorithm found on Computer Algorithms by
- * Sara Baase.
- *
- * A char jump is the number of characters one needs to jump based on
- * the value of the character from the text that was mismatched.
- */
-static void
-computejumps(struct parse *p, struct re_guts *g)
-{
-       int ch;
-       int mindex;
-
-       /* Avoid making errors worse */
-       if (p->error != 0)
-               return;
-
-       g->charjump = (int*) malloc((NC + 1) * sizeof(int));
-       if (g->charjump == NULL)        /* Not a fatal error */
-               return;
-       /* Adjust for signed chars, if necessary */
-       g->charjump = &g->charjump[-(CHAR_MIN)];
-
-       /* If the character does not exist in the pattern, the jump
-        * is equal to the number of characters in the pattern.
-        */
-       for (ch = CHAR_MIN; ch < (CHAR_MAX + 1); ch++)
-               g->charjump[ch] = g->mlen;
-
-       /* If the character does exist, compute the jump that would
-        * take us to the last character in the pattern equal to it
-        * (notice that we match right to left, so that last character
-        * is the first one that would be matched).
-        */
-       for (mindex = 0; mindex < g->mlen; mindex++)
-               g->charjump[(int)g->must[mindex]] = g->mlen - mindex - 1;
-}
-
-/*
- - computematchjumps - compute match jumps for BM scan
- == static void computematchjumps(struct parse *p, struct re_guts *g);
- *
- * This algorithm assumes g->must exists and is has size greater than
- * zero. It's based on the algorithm found on Computer Algorithms by
- * Sara Baase.
- *
- * A match jump is the number of characters one needs to advance based
- * on the already-matched suffix.
- * Notice that all values here are minus (g->mlen-1), because of the way
- * the search algorithm works.
- */
-static void
-computematchjumps(struct parse *p, struct re_guts *g)
-{
-       int mindex;             /* General "must" iterator */
-       int suffix;             /* Keeps track of matching suffix */
-       int ssuffix;            /* Keeps track of suffixes' suffix */
-       int* pmatches;          /* pmatches[k] points to the next i
-                                * such that i+1...mlen is a substring
-                                * of k+1...k+mlen-i-1
-                                */
-
-       /* Avoid making errors worse */
-       if (p->error != 0)
-               return;
-
-       pmatches = (int*) malloc(g->mlen * sizeof(unsigned int));
-       if (pmatches == NULL) {
-               g->matchjump = NULL;
-               return;
-       }
-
-       g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int));
-       if (g->matchjump == NULL)       /* Not a fatal error */
-               return;
-
-       /* Set maximum possible jump for each character in the pattern */
-       for (mindex = 0; mindex < g->mlen; mindex++)
-               g->matchjump[mindex] = 2*g->mlen - mindex - 1;
-
-       /* Compute pmatches[] */
-       for (mindex = g->mlen - 1, suffix = g->mlen; mindex >= 0;
-           mindex--, suffix--) {
-               pmatches[mindex] = suffix;
-
-               /* If a mismatch is found, interrupting the substring,
-                * compute the matchjump for that position. If no
-                * mismatch is found, then a text substring mismatched
-                * against the suffix will also mismatch against the
-                * substring.
-                */
-               while (suffix < g->mlen
-                   && g->must[mindex] != g->must[suffix]) {
-                       g->matchjump[suffix] = MIN(g->matchjump[suffix],
-                           g->mlen - mindex - 1);
-                       suffix = pmatches[suffix];
-               }
-       }
-
-       /* Compute the matchjump up to the last substring found to jump
-        * to the beginning of the largest must pattern prefix matching
-        * it's own suffix.
-        */
-       for (mindex = 0; mindex <= suffix; mindex++)
-               g->matchjump[mindex] = MIN(g->matchjump[mindex],
-                   g->mlen + suffix - mindex);
-
-        ssuffix = pmatches[suffix];
-        while (suffix < g->mlen) {
-                while (suffix <= ssuffix && suffix < g->mlen) {
-                        g->matchjump[suffix] = MIN(g->matchjump[suffix],
-                           g->mlen + ssuffix - suffix);
-                        suffix++;
-                }
-               if (suffix < g->mlen)
-                       ssuffix = pmatches[ssuffix];
-        }
-
-       free(pmatches);
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(struct parse *p, struct re_guts *g);
- */
-static sopno                   /* nesting depth */
-pluscount(struct parse *p, struct re_guts *g)
-{
-       sop *scan;
-       sop s;
-       sopno plusnest = 0;
-       sopno maxnest = 0;
-
-       if (p->error != 0)
-               return(0);      /* there may not be an OEND */
-
-       scan = g->strip + 1;
-       do {
-               s = *scan++;
-               switch (OP(s)) {
-               case OPLUS_:
-                       plusnest++;
-                       break;
-               case O_PLUS:
-                       if (plusnest > maxnest)
-                               maxnest = plusnest;
-                       plusnest--;
-                       break;
-               }
-       } while (OP(s) != OEND);
-       if (plusnest != 0)
-               g->iflags |= BAD;
-       return(maxnest);
-}
diff --git a/regex/FreeBSD/regcomp.c.patch b/regex/FreeBSD/regcomp.c.patch
deleted file mode 100644 (file)
index 4dcf2cd..0000000
+++ /dev/null
@@ -1,514 +0,0 @@
---- regcomp.c.orig     2010-06-21 14:05:04.000000000 -0700
-+++ regcomp.c  2010-06-21 14:23:51.000000000 -0700
-@@ -39,6 +39,8 @@ static char sccsid[] = "@(#)regcomp.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/regex/regcomp.c,v 1.36 2007/06/11 03:05:54 delphij Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <stdio.h>
- #include <string.h>
-@@ -69,6 +71,9 @@ struct parse {
-       sopno ssize;            /* malloced strip size (allocated) */
-       sopno slen;             /* malloced strip length (used) */
-       int ncsalloc;           /* number of csets allocated */
-+#if __DARWIN_UNIX03
-+      int zerorepeats;
-+#endif /* __DARWIN_UNIX03 */
-       struct re_guts *g;
- #     define  NPAREN  10      /* we need to remember () 1-9 for back refs */
-       sopno pbegin[NPAREN];   /* -> ( ([0] unused) */
-@@ -93,7 +98,7 @@ static void p_b_cclass(struct parse *p, 
- static void p_b_eclass(struct parse *p, cset *cs);
- static wint_t p_b_symbol(struct parse *p);
- static wint_t p_b_coll_elem(struct parse *p, wint_t endc);
--static wint_t othercase(wint_t ch);
-+static wint_t othercase(wint_t ch, locale_t loc);
- static void bothcases(struct parse *p, wint_t ch);
- static void ordinary(struct parse *p, wint_t ch);
- static void nonnewline(struct parse *p);
-@@ -104,7 +109,7 @@ static void freeset(struct parse *p, cse
- static void CHadd(struct parse *p, cset *cs, wint_t ch);
- static void CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max);
- static void CHaddtype(struct parse *p, cset *cs, wctype_t wct);
--static wint_t singleton(cset *cs);
-+static wint_t singleton(cset *cs, locale_t loc);
- static sopno dupl(struct parse *p, sopno start, sopno finish);
- static void doemit(struct parse *p, sop op, size_t opnd);
- static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
-@@ -222,10 +227,14 @@ regcomp(regex_t * __restrict preg,
-       p->end = p->next + len;
-       p->error = 0;
-       p->ncsalloc = 0;
-+#if __DARWIN_UNIX03
-+      p->zerorepeats = 0;
-+#endif /* __DARWIN_UNIX03 */
-       for (i = 0; i < NPAREN; i++) {
-               p->pbegin[i] = 0;
-               p->pend[i] = 0;
-       }
-+      g->loc = __current_locale();
-       g->sets = NULL;
-       g->ncsets = 0;
-       g->cflags = cflags;
-@@ -302,8 +311,12 @@ p_ere(struct parse *p,
-               conc = HERE();
-               while (MORE() && (c = PEEK()) != '|' && c != stop)
-                       p_ere_exp(p);
-+#if __DARWIN_UNIX03
-+              if (!p->zerorepeats) REQUIRE(HERE() != conc, REG_EMPTY);        /* require nonempty */
-+              else p->zerorepeats--;
-+#else
-               (void)REQUIRE(HERE() != conc, REG_EMPTY);       /* require nonempty */
--
-+#endif
-               if (!EAT('|'))
-                       break;          /* NOTE BREAK OUT */
-@@ -410,7 +423,7 @@ p_ere_exp(struct parse *p)
-               ordinary(p, wc);
-               break;
-       case '{':               /* okay as ordinary except if digit follows */
--              (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
-+              (void)REQUIRE(!MORE() || !isdigit_l((uch)PEEK(), p->g->loc), REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               p->next--;
-@@ -424,7 +437,7 @@ p_ere_exp(struct parse *p)
-       c = PEEK();
-       /* we call { a repetition if followed by a digit */
-       if (!( c == '*' || c == '+' || c == '?' ||
--                              (c == '{' && MORE2() && isdigit((uch)PEEK2())) ))
-+                              (c == '{' && MORE2() && isdigit_l((uch)PEEK2(), p->g->loc)) ))
-               return;         /* no repetition, we're done */
-       NEXT();
-@@ -453,7 +466,7 @@ p_ere_exp(struct parse *p)
-       case '{':
-               count = p_count(p);
-               if (EAT(',')) {
--                      if (isdigit((uch)PEEK())) {
-+                      if (isdigit_l((uch)PEEK(), p->g->loc)) {
-                               count2 = p_count(p);
-                               (void)REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-@@ -474,7 +487,7 @@ p_ere_exp(struct parse *p)
-               return;
-       c = PEEK();
-       if (!( c == '*' || c == '+' || c == '?' ||
--                              (c == '{' && MORE2() && isdigit((uch)PEEK2())) ) )
-+                              (c == '{' && MORE2() && isdigit_l((uch)PEEK2(), p->g->loc)) ) )
-               return;
-       SETERROR(REG_BADRPT);
- }
-@@ -486,7 +499,12 @@ p_ere_exp(struct parse *p)
- static void
- p_str(struct parse *p)
- {
-+#if __DARWIN_UNIX03
-+      if (!p->zerorepeats) REQUIRE(MORE(), REG_EMPTY);
-+      else p->zerorepeats--;
-+#else  /* !__DARWIN_UNIX03 */
-       (void)REQUIRE(MORE(), REG_EMPTY);
-+#endif /* __DARWIN_UNIX03 */
-       while (MORE())
-               ordinary(p, WGETNEXT());
- }
-@@ -525,8 +543,12 @@ p_bre(struct parse *p,
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-       }
--
-+#if __DARWIN_UNIX03
-+      if (!p->zerorepeats) REQUIRE(HERE() != start, REG_EMPTY);       /* require nonempty */
-+      else p->zerorepeats--;
-+#else  /* !__DARWIN_UNIX03 */
-       (void)REQUIRE(HERE() != start, REG_EMPTY);      /* require nonempty */
-+#endif /* __DARWIN_UNIX03 */
- }
- /*
-@@ -599,12 +621,22 @@ p_simp_re(struct parse *p,
-               i = (c&~BACKSL) - '0';
-               assert(i < NPAREN);
-               if (p->pend[i] != 0) {
-+#if __DARWIN_UNIX03
-+                      int skip = 1;
-+#endif /* __DARWIN_UNIX03 */
-                       assert(i <= p->g->nsub);
-                       EMIT(OBACK_, i);
-                       assert(p->pbegin[i] != 0);
-                       assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
-                       assert(OP(p->strip[p->pend[i]]) == ORPAREN);
-+#if __DARWIN_UNIX03
-+                      if (OP(p->strip[p->pbegin[i]+skip]) == OBOL) {
-+                              skip++;         /* don't dup anchor in subexp */
-+                      }
-+                      (void) dupl(p, p->pbegin[i]+skip, p->pend[i]);
-+#else  /* !__DARWIN_UNIX03 */
-                       (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
-+#endif /* __DARWIN_UNIX03 */
-                       EMIT(O_BACK, i);
-               } else
-                       SETERROR(REG_ESUBREG);
-@@ -627,9 +659,10 @@ p_simp_re(struct parse *p,
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-       } else if (EATTWO('\\', '{')) {
-+              (void)REQUIRE(MORE(), REG_EBRACE);
-               count = p_count(p);
-               if (EAT(',')) {
--                      if (MORE() && isdigit((uch)PEEK())) {
-+                      if (MORE() && isdigit_l((uch)PEEK(), p->g->loc)) {
-                               count2 = p_count(p);
-                               (void)REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-@@ -659,7 +692,7 @@ p_count(struct parse *p)
-       int count = 0;
-       int ndigits = 0;
--      while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
-+      while (MORE() && isdigit_l((uch)PEEK(), p->g->loc) && count <= DUPMAX) {
-               count = count*10 + (GETNEXT() - '0');
-               ndigits++;
-       }
-@@ -697,10 +730,22 @@ p_bracket(struct parse *p)
-               cs->icase = 1;
-       if (EAT('^'))
-               cs->invert = 1;
-+#if __DARWIN_UNIX03
-+      if (PEEK2() != '-' && PEEK2() != ']') { /* Don't eat '-' or ']' if they're part of ranges
-+                                               * but do process [^-] */
-       if (EAT(']'))
-               CHadd(p, cs, ']');
-       else if (EAT('-'))
-               CHadd(p, cs, '-');
-+      }
-+      if (MORE() && !SEETWO('-',']')) /* Parse RE []-'] */
-+              p_b_term(p, cs);
-+#else /* !__DARWIN_UNIX03 */
-+      if (EAT(']'))
-+              CHadd(p, cs, ']');
-+      else if (EAT('-'))
-+              CHadd(p, cs, '-');
-+#endif /* __DARWIN_UNIX03 */
-       while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
-               p_b_term(p, cs);
-       if (EAT('-'))
-@@ -713,7 +758,7 @@ p_bracket(struct parse *p)
-       if (cs->invert && p->g->cflags&REG_NEWLINE)
-               cs->bmp['\n' >> 3] |= 1 << ('\n' & 7);
--      if ((ch = singleton(cs)) != OUT) {      /* optimize singleton sets */
-+      if ((ch = singleton(cs, p->g->loc)) != OUT) {   /* optimize singleton sets */
-               ordinary(p, ch);
-               freeset(p, cs);
-       } else
-@@ -737,8 +782,16 @@ p_b_term(struct parse *p, cset *cs)
-               c = (MORE2()) ? PEEK2() : '\0';
-               break;
-       case '-':
-+#if __DARWIN_UNIX03
-+              if (PEEK2() != '-') { /* Allow [---] */
-+              SETERROR(REG_ERANGE);
-+              return;                 /* NOTE RETURN */
-+              } else
-+                      c = '-';
-+#else  /* !__DARWIN_UNIX03 */
-               SETERROR(REG_ERANGE);
-               return;                 /* NOTE RETURN */
-+#endif /* __DARWIN_UNIX03 */
-               break;
-       default:
-               c = '\0';
-@@ -759,7 +812,11 @@ p_b_term(struct parse *p, cset *cs)
-               NEXT2();
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-+#if __DARWIN_UNIX03
-+              REQUIRE(c != '-', REG_ECOLLATE); /* allow [=]=] */
-+#else  /* !__DARWIN_UNIX03 */
-               (void)REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
-+#endif /* __DARWIN_UNIX03 */
-               p_b_eclass(p, cs);
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               (void)REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
-@@ -778,14 +835,14 @@ p_b_term(struct parse *p, cset *cs)
-               if (start == finish)
-                       CHadd(p, cs, start);
-               else {
--                      if (__collate_load_error) {
-+                      if (p->g->loc->__collate_load_error) {
-                               (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE);
-                               CHaddrange(p, cs, start, finish);
-                       } else {
--                              (void)REQUIRE(__collate_range_cmp(start, finish) <= 0, REG_ERANGE);
-+                              (void)REQUIRE(__collate_range_cmp(start, finish, p->g->loc) <= 0, REG_ERANGE);
-                               for (i = 0; i <= UCHAR_MAX; i++) {
--                                      if (   __collate_range_cmp(start, i) <= 0
--                                          && __collate_range_cmp(i, finish) <= 0
-+                                      if (   __collate_range_cmp(start, i, p->g->loc) <= 0
-+                                          && __collate_range_cmp(i, finish, p->g->loc) <= 0
-                                          )
-                                               CHadd(p, cs, i);
-                               }
-@@ -807,7 +864,7 @@ p_b_cclass(struct parse *p, cset *cs)
-       wctype_t wct;
-       char clname[16];
--      while (MORE() && isalpha((uch)PEEK()))
-+      while (MORE() && isalpha_l((uch)PEEK(), p->g->loc))
-               NEXT();
-       len = p->next - sp;
-       if (len >= sizeof(clname) - 1) {
-@@ -816,7 +873,7 @@ p_b_cclass(struct parse *p, cset *cs)
-       }
-       memcpy(clname, sp, len);
-       clname[len] = '\0';
--      if ((wct = wctype(clname)) == 0) {
-+      if ((wct = wctype_l(clname, p->g->loc)) == 0) {
-               SETERROR(REG_ECTYPE);
-               return;
-       }
-@@ -826,14 +883,38 @@ p_b_cclass(struct parse *p, cset *cs)
- /*
-  - p_b_eclass - parse an equivalence-class name and deal with it
-  == static void p_b_eclass(struct parse *p, cset *cs);
-- *
-- * This implementation is incomplete. xxx
-  */
- static void
- p_b_eclass(struct parse *p, cset *cs)
- {
--      wint_t c;
--
-+      char *sp = p->next;
-+      int len, ec;
-+      mbstate_t mbs;
-+      int *newequiv_classes;
-+      wint_t c;
-+ 
-+      while (MORE() && !SEETWO('=', ']'))
-+              NEXT();
-+      if (!MORE()) {
-+              SETERROR(REG_EBRACK);
-+              return;
-+      }
-+      len = p->next - sp;
-+      memset(&mbs, 0, sizeof(mbs));
-+      ec = __collate_equiv_class(sp, len, &mbs, p->g->loc);
-+      if (ec > 0) {
-+              newequiv_classes = realloc(cs->equiv_classes,
-+                  (cs->nequiv_classes + 1) * sizeof(*cs->equiv_classes));
-+              if (newequiv_classes == NULL) {
-+                      SETERROR(REG_ESPACE);
-+                      return;
-+              }
-+              cs->equiv_classes = newequiv_classes;
-+              cs->equiv_classes[cs->nequiv_classes++] = ec;
-+              return;
-+      }
-+      /* not an equivalence class, so fallback to a collating element */
-+      p->next = sp;
-       c = p_b_coll_elem(p, '=');
-       CHadd(p, cs, c);
- }
-@@ -866,10 +947,10 @@ p_b_coll_elem(struct parse *p,
-       wint_t endc)            /* name ended by endc,']' */
- {
-       char *sp = p->next;
--      struct cname *cp;
-+      const struct cname *cp;
-       int len;
-       mbstate_t mbs;
--      wchar_t wc;
-+      wchar_t wbuf[16];
-       size_t clen;
-       while (MORE() && !SEETWO(endc, ']'))
-@@ -883,9 +964,10 @@ p_b_coll_elem(struct parse *p,
-               if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-                       return(cp->code);       /* known name */
-       memset(&mbs, 0, sizeof(mbs));
--      if ((clen = mbrtowc(&wc, sp, len, &mbs)) == len)
--              return (wc);                    /* single character */
--      else if (clen == (size_t)-1 || clen == (size_t)-2)
-+      clen = __collate_collating_symbol(wbuf, 16, sp, len, &mbs, p->g->loc);
-+      if (clen == 1)
-+              return (*wbuf);                 /* single character */
-+      else if (clen == (size_t)-1)
-               SETERROR(REG_ILLSEQ);
-       else
-               SETERROR(REG_ECOLLATE);         /* neither */
-@@ -894,16 +976,16 @@ p_b_coll_elem(struct parse *p,
- /*
-  - othercase - return the case counterpart of an alphabetic
-- == static char othercase(int ch);
-+ == static char othercase(wint_t ch, locale_t loc);
-  */
- static wint_t                 /* if no counterpart, return ch */
--othercase(wint_t ch)
-+othercase(wint_t ch, locale_t loc)
- {
--      assert(iswalpha(ch));
--      if (iswupper(ch))
--              return(towlower(ch));
--      else if (iswlower(ch))
--              return(towupper(ch));
-+      assert(iswalpha_l(ch, loc));
-+      if (iswupper_l(ch, loc))
-+              return(towlower_l(ch, loc));
-+      else if (iswlower_l(ch, loc))
-+              return(towupper_l(ch, loc));
-       else                    /* peculiar, but could happen */
-               return(ch);
- }
-@@ -923,10 +1005,10 @@ bothcases(struct parse *p, wint_t ch)
-       size_t n;
-       mbstate_t mbs;
--      assert(othercase(ch) != ch);    /* p_bracket() would recurse */
-+      assert(othercase(ch, p->g->loc) != ch); /* p_bracket() would recurse */
-       p->next = bracket;
-       memset(&mbs, 0, sizeof(mbs));
--      n = wcrtomb(bracket, ch, &mbs);
-+      n = wcrtomb_l(bracket, ch, &mbs, p->g->loc);
-       assert(n != (size_t)-1);
-       bracket[n] = ']';
-       bracket[n + 1] = '\0';
-@@ -946,7 +1028,7 @@ ordinary(struct parse *p, wint_t ch)
- {
-       cset *cs;
--      if ((p->g->cflags&REG_ICASE) && iswalpha(ch) && othercase(ch) != ch)
-+      if ((p->g->cflags&REG_ICASE) && iswalpha_l(ch, p->g->loc) && othercase(ch, p->g->loc) != ch)
-               bothcases(p, ch);
-       else if ((ch & OPDMASK) == ch)
-               EMIT(OCHAR, ch);
-@@ -1012,10 +1094,22 @@ repeat(struct parse *p,
-       switch (REP(MAP(from), MAP(to))) {
-       case REP(0, 0):                 /* must be user doing this */
-               DROP(finish-start);     /* drop the operand */
-+#if __DARWIN_UNIX03
-+              p->zerorepeats++;
-+#endif /* __DARWIN_UNIX03 */
-               break;
-+      case REP(0, INF):               /* as x{1,}? */
-+#if __DARWIN_UNIX03
-+              /* this case does not require the (y|) trick, noKLUDGE */
-+              /* Just like * =+?  */
-+              INSERT(OPLUS_, start);
-+              ASTERN(O_PLUS, start);
-+              INSERT(OQUEST_, start);
-+              ASTERN(O_QUEST, start);
-+              break;
-+#endif /* __DARWIN_UNIX03 */
-       case REP(0, 1):                 /* as x{1,1}? */
-       case REP(0, N):                 /* as x{1,n}? */
--      case REP(0, INF):               /* as x{1,}? */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);            /* offset is wrong... */
-               repeat(p, start+1, 1, to);
-@@ -1029,6 +1123,10 @@ repeat(struct parse *p,
-               /* done */
-               break;
-       case REP(1, N):                 /* as x?x{1,n-1} */
-+#if __DARWIN_UNIX03
-+              INSERT(OQUEST_, start);
-+              ASTERN(O_QUEST, start);
-+#else /* !__DARWIN_UNIX03 */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);
-               ASTERN(OOR1, start);
-@@ -1036,6 +1134,7 @@ repeat(struct parse *p,
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-+#endif /* __DARWIN_UNIX03 */
-               copy = dupl(p, start+1, finish+1);
-               assert(copy == finish+4);
-               repeat(p, copy, 1, to-1);
-@@ -1071,7 +1170,7 @@ wgetnext(struct parse *p)
-       size_t n;
-       memset(&mbs, 0, sizeof(mbs));
--      n = mbrtowc(&wc, p->next, p->end - p->next, &mbs);
-+      n = mbrtowc_l(&wc, p->next, p->end - p->next, &mbs, p->g->loc);
-       if (n == (size_t)-1 || n == (size_t)-2) {
-               SETERROR(REG_ILLSEQ);
-               return (0);
-@@ -1139,12 +1238,12 @@ freeset(struct parse *p, cset *cs)
-  - returning it if so, otherwise returning OUT.
-  */
- static wint_t
--singleton(cset *cs)
-+singleton(cset *cs, locale_t loc)
- {
-       wint_t i, s, n;
-       for (i = n = 0; i < NC; i++)
--              if (CHIN(cs, i)) {
-+              if (CHIN(cs, i, loc)) {
-                       n++;
-                       s = i;
-               }
-@@ -1178,9 +1277,9 @@ CHadd(struct parse *p, cset *cs, wint_t 
-               cs->wides[cs->nwides++] = ch;
-       }
-       if (cs->icase) {
--              if ((nch = towlower(ch)) < NC)
-+              if ((nch = towlower_l(ch, p->g->loc)) < NC)
-                       cs->bmp[nch >> 3] |= 1 << (nch & 7);
--              if ((nch = towupper(ch)) < NC)
-+              if ((nch = towupper_l(ch, p->g->loc)) < NC)
-                       cs->bmp[nch >> 3] |= 1 << (nch & 7);
-       }
- }
-@@ -1219,7 +1318,7 @@ CHaddtype(struct parse *p, cset *cs, wct
-       wctype_t *newtypes;
-       for (i = 0; i < NC; i++)
--              if (iswctype(i, wct))
-+              if (iswctype_l(i, wct, p->g->loc))
-                       CHadd(p, cs, i);
-       newtypes = realloc(cs->types, (cs->ntypes + 1) *
-           sizeof(*cs->types));
-@@ -1391,6 +1490,7 @@ findmust(struct parse *p, struct re_guts
-       char buf[MB_LEN_MAX];
-       size_t clen;
-       mbstate_t mbs;
-+      struct __xlocale_st_runelocale *rl = p->g->loc->__lc_ctype;
-       /* avoid making error situations worse */
-       if (p->error != 0)
-@@ -1401,8 +1501,8 @@ findmust(struct parse *p, struct re_guts
-        * multibyte character strings, but it's safe for at least
-        * UTF-8 (see RFC 3629).
-        */
--      if (MB_CUR_MAX > 1 &&
--          strcmp(_CurrentRuneLocale->__encoding, "UTF-8") != 0)
-+      if (rl->__mb_cur_max > 1 &&
-+          strcmp(rl->_CurrentRuneLocale.__encoding, "UTF-8") != 0)
-               return;
-       /* find the longest OCHAR sequence in strip */
-@@ -1418,7 +1518,7 @@ findmust(struct parse *p, struct re_guts
-                               memset(&mbs, 0, sizeof(mbs));
-                               newstart = scan - 1;
-                       }
--                      clen = wcrtomb(buf, OPND(s), &mbs);
-+                      clen = wcrtomb_l(buf, OPND(s), &mbs, p->g->loc);
-                       if (clen == (size_t)-1)
-                               goto toohard;
-                       newlen += clen;
-@@ -1537,7 +1637,7 @@ findmust(struct parse *p, struct re_guts
-       while (cp < g->must + g->mlen) {
-               while (OP(s = *scan++) != OCHAR)
-                       continue;
--              clen = wcrtomb(cp, OPND(s), &mbs);
-+              clen = wcrtomb_l(cp, OPND(s), &mbs, p->g->loc);
-               assert(clen != (size_t)-1);
-               cp += clen;
-       }
index 9364bd43296169e34fde599491993f0c6f35a2f4..a22066c6e4c4102f129e6a165a561dc5663f9370 100644 (file)
@@ -81,10 +81,10 @@ static char *regatoi(const regex_t *preg, char *localbuf);
  = #define     REG_ATOI        255     // convert name to number (!)
  = #define     REG_ITOA        0400    // convert number to name (!)
  */
-static struct rerr {
+static const struct rerr {
        int code;
-       char *name;
-       char *explain;
+       const char *name;
+       const char *explain;
 } rerrs[] = {
        {REG_NOMATCH,   "REG_NOMATCH",  "regexec() failed to match"},
        {REG_BADPAT,    "REG_BADPAT",   "invalid regular expression"},
@@ -117,10 +117,10 @@ regerror(int errcode,
         char * __restrict errbuf,
         size_t errbuf_size)
 {
-       struct rerr *r;
+       const struct rerr *r;
        size_t len;
        int target = errcode &~ REG_ITOA;
-       char *s;
+       const char *s;
        char convbuf[50];
 
        if (errcode == REG_ATOI)
@@ -161,7 +161,7 @@ regerror(int errcode,
 static char *
 regatoi(const regex_t *preg, char *localbuf)
 {
-       struct rerr *r;
+       const struct rerr *r;
 
        for (r = rerrs; r->code != 0; r++)
                if (strcmp(r->name, preg->re_endp) == 0)
diff --git a/regex/FreeBSD/regerror.c.patch b/regex/FreeBSD/regerror.c.patch
deleted file mode 100644 (file)
index 0b7c53b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
---- regerror.c.orig    2010-05-05 14:42:17.000000000 -0700
-+++ regerror.c 2010-05-05 14:42:24.000000000 -0700
-@@ -85,10 +85,10 @@ static char *regatoi(const regex_t *preg
-  = #define    REG_ATOI        255     // convert name to number (!)
-  = #define    REG_ITOA        0400    // convert number to name (!)
-  */
--static struct rerr {
-+static const struct rerr {
-       int code;
--      char *name;
--      char *explain;
-+      const char *name;
-+      const char *explain;
- } rerrs[] = {
-       {REG_NOMATCH,   "REG_NOMATCH",  "regexec() failed to match"},
-       {REG_BADPAT,    "REG_BADPAT",   "invalid regular expression"},
-@@ -122,10 +122,10 @@ const regex_t * __restrict preg;
- char * __restrict errbuf;
- size_t errbuf_size;
- {
--      struct rerr *r;
-+      const struct rerr *r;
-       size_t len;
-       int target = errcode &~ REG_ITOA;
--      char *s;
-+      const char *s;
-       char convbuf[50];
-       if (errcode == REG_ATOI)
-@@ -168,7 +168,7 @@ regatoi(preg, localbuf)
- const regex_t *preg;
- char *localbuf;
- {
--      struct rerr *r;
-+      const struct rerr *r;
-       for (r = rerrs; r->code != 0; r++)
-               if (strcmp(r->name, preg->re_endp) == 0)
index f848d66c3a3c52cd3c6ff8298d2e14eb177867bf..e0a03215d662bded9ac36435a70d6f87376dfc55 100644 (file)
 .\"    @(#)regex.3     8.4 (Berkeley) 3/20/94
 .\" $FreeBSD: src/lib/libc/regex/regex.3,v 1.21 2007/01/09 00:28:04 imp Exp $
 .\"
-.Dd August 17, 2005
+.Dd Sept 29, 2011
 .Dt REGEX 3
 .Os
 .Sh NAME
 .Nm regcomp ,
-.Nm regexec ,
+.Nm regcomp_l ,
 .Nm regerror ,
-.Nm regfree
+.Nm regexec ,
+.Nm regfree ,
+.Nm regncomp ,
+.Nm regncomp_l ,
+.Nm regnexec ,
+.Nm regnwcomp ,
+.Nm regnwcomp_l ,
+.Nm regnwexec ,
+.Nm regwcomp ,
+.Nm regwcomp_l ,
+.Nm regwexec
 .Nd regular-expression library
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
+.Sy (Standards-compliant APIs)
+.Pp
 .In regex.h
 .Ft int
 .Fo regcomp
-.Fa "regex_t * restrict preg" "const char * restrict pattern" "int cflags"
-.Fc
-.Ft int
-.Fo regexec
-.Fa "const regex_t * restrict preg" "const char * restrict string"
-.Fa "size_t nmatch" "regmatch_t pmatch[restrict]" "int eflags"
+.Fa "regex_t *restrict preg"
+.Fa "const char *restrict pattern"
+.Fa "int cflags"
 .Fc
 .Ft size_t
 .Fo regerror
-.Fa "int errcode" "const regex_t * restrict preg"
-.Fa "char * restrict errbuf" "size_t errbuf_size"
+.Fa "int errcode"
+.Fa "const regex_t *restrict preg"
+.Fa "char *restrict errbuf"
+.Fa "size_t errbuf_size"
+.Fc
+.Ft int
+.Fo regexec
+.Fa "const regex_t *restrict preg"
+.Fa "const char *restrict string"
+.Fa "size_t nmatch"
+.Fa "regmatch_t pmatch[restrict]"
+.Fa "int eflags"
 .Fc
 .Ft void
-.Fn regfree "regex_t *preg"
+.Fo regfree
+.Fa "regex_t *preg"
+.Fc
+.Pp
+.Sy (Non-portable extensions)
+.Ft int
+.Fo regncomp
+.Fa "regex_t *restrict preg"
+.Fa "const char *restrict pattern"
+.Fa "size_t len"
+.Fa "int cflags"
+.Fc
+.Ft int
+.Fo regnexec
+.Fa "const regex_t *restrict preg"
+.Fa "const char *restrict string"
+.Fa "size_t len"
+.Fa "size_t nmatch"
+.Fa "regmatch_t pmatch[restrict]"
+.Fa "int eflags"
+.Fc
+.Ft int
+.Fo regwcomp
+.Fa "regex_t *restrict preg"
+.Fa "const wchar_t *restrict widepat"
+.Fa "int cflags"
+.Fc
+.Ft int
+.Fo regwexec
+.Fa "const regex_t *restrict preg"
+.Fa "const wchar_t *restrict widestr"
+.Fa "size_t nmatch"
+.Fa "regmatch_t pmatch[restrict]"
+.Fa "int eflags"
+.Fc
+.Ft int
+.Fo regwncomp
+.Fa "regex_t *restrict preg"
+.Fa "const wchar_t *restrict widepat"
+.Fa "size_t len"
+.Fa "int cflags"
+.Fc
+.Ft int
+.Fo regwnexec
+.Fa "const regex_t *restrict preg"
+.Fa "const wchar_t *restrict widestr"
+.Fa "size_t len"
+.Fa "size_t nmatch"
+.Fa "regmatch_t pmatch[restrict]"
+.Fa "int eflags"
+.Fc
+.In regex.h
+.In xlocale.h
+.Ft int
+.Fo regcomp_l
+.Fa "regex_t *restrict preg"
+.Fa "const char *restrict pattern"
+.Fa "int cflags"
+.Fa "locale_t restrict"
+.Fc
+.Ft int
+.Fo regncomp_l
+.Fa "regex_t *restrict preg"
+.Fa "const char *restrict pattern"
+.Fa "size_t len"
+.Fa "int cflags"
+.Fa "locale_t restrict"
+.Fc
+.Ft int
+.Fo regwcomp_l
+.Fa "regex_t *restrict preg"
+.Fa "const wchar_t *restrict widepat"
+.Fa "int cflags"
+.Fa "locale_t restrict"
+.Fc
+.Ft int
+.Fo regwncomp_l
+.Fa "regex_t *restrict preg"
+.Fa "const wchar_t *restrict widepat"
+.Fa "size_t len"
+.Fa "int cflags"
+.Fa "locale_t restrict"
+.Fc
 .Sh DESCRIPTION
 These routines implement
 .St -p1003.2
@@ -71,12 +170,11 @@ see
 The
 .Fn regcomp
 function
-compiles an RE written as a string into an internal form,
+compiles an RE, written as a string, into an internal form.
 .Fn regexec
-matches that internal form against a string and reports results,
+matches that internal form against a string and reports results.
 .Fn regerror
-transforms error codes from either into human-readable messages,
-and
+transforms error codes from either into human-readable messages.
 .Fn regfree
 frees any dynamically-allocated storage used by the internal form
 of an RE.
@@ -141,6 +239,9 @@ and
 may not be used
 in the same call to
 .Fn regcomp .
+.It Dv REG_LITERAL
+An alias of
+.Dv REG_NOSPEC .
 .It Dv REG_ICASE
 Compile for matching that ignores upper/lower case distinctions.
 See
@@ -166,6 +267,16 @@ and the
 anchor matches the null string before any newline in the
 string in addition to its normal function.
 .It Dv REG_PEND
+(Note that
+.Dv REG_PEND
+is not recognized by any of the wide character or
+.Dq Nm n
+variants.
+Besides, the
+.Dq Nm n
+variants can be used instead of
+.Dv REG_PEND ;
+see EXTENDED APIS below.)
 The regular expression ends,
 not at the first NUL,
 but just before the character pointed to by the
@@ -183,6 +294,30 @@ compatible with but not specified by
 .St -p1003.2 ,
 and should be used with
 caution in software intended to be portable to other systems.
+.It Dv REG_ENHANCED
+Recognized enhanced regular expression features; see
+.Xr re_format 7
+for details.
+This is an extension not specified by
+.St -p1003.2 ,
+and should be used with
+caution in software intended to be portable to other systems.
+.It Dv REG_MINIMAL
+Use minimal (non-greedy) repetitions instead of the normal greedy ones; see
+.Xr re_format 7
+for details.
+(This only applies when both
+.Dv REG_ENHANCED
+and
+.Dv REG_EXTENDED
+are also set.)
+This is an extension not specified by
+.St -p1003.2 ,
+and should be used with
+caution in software intended to be portable to other systems.
+.It Dv REG_UNGREEDY
+Alias of
+.Dv REG_MINIMAL .
 .El
 .Pp
 When successful,
@@ -501,7 +636,95 @@ is undefined.
 None of these functions references global variables except for tables
 of constants;
 all are safe for use from multiple threads if the arguments are safe.
+.Sh EXTENDED APIS
+These extended APIs are available in Mac OS X 10.8 and beyond, when the
+deployment target is 10.8 or later.
+It should also be noted that any of the
+.Fn regcomp
+variants may be used to initialize a
+.Ft regex_t
+structure, that can then be passed to any of the
+.Fn regexec
+variants.
+So it is quite legal to compile a wide character RE and use it to match a
+multibyte character string, or vice versa.
+.Pp
+The
+.Fn regncomp
+routine compiles regular expressions like
+.Fn regcomp ,
+but the length of the regular expression string is specified, allowing a string
+that is not NUL terminated and/or contains NUL characters.
+This is a modern replacement for using
+.Fn regcomp
+with the
+.Dv REG_PEND
+option.
+.Pp
+Similarly, the
+.Fn regnexec
+routine is like
+.Fn regexec ,
+but the length of the string to match is specified, allowing a string
+that is not NUL terminated and/or contains NUL characters.
+.Pp
+The
+.Fn regwcomp
+and
+.Fn regwexec
+variants take a wide-character
+.Vt ( wchar_t )
+string for the regular expression and string to match.
+And
+.Fn regwncomp
+and
+.Fn regwnexec
+are variants that allow specifying the wide character string length, and
+so allows wide character strings that are not NUL terminated and/or
+contains NUL characters.
+.Sh INTERACTION WITH THE LOCALE
+When
+.Fn regcomp
+or one of its variants is run, the regular expression is compiled into an
+internal form, which may include specific information about the locale currently
+in effect, such as equivalence classes or multi-character collation symbols.
+So a reference to the current locale is also stored with the internal form,
+so that when
+.Fn regexec
+is run, it can use the same locale (even if the locale is changed in-between
+the calls to
+.Fn regcomp
+and
+.Fn regexec ) .
+.Pp
+To provide more direct control over which locale is used,
+routines with
+.Dq Nm _l
+appended to their names are provided that work just like the variants
+without the
+.Dq Nm _l ,
+except that a locale (via a
+.Vt locale_t
+variable type) is specified directly.
+Note that only variants of
+.Fn regcomp
+have
+.Dq Nm _l
+variants, since the
+.Fn regexec
+variants just use the reference to the locale stored in the internal form.
 .Sh IMPLEMENTATION CHOICES
+The
+.Nm regex
+implementation in Mac OS X 10.8 and later is based on a heavily modified subset
+of TRE (http://laurikari.net/tre/).
+This provides improved performance, better conformance and additional features.
+However, both API and binary compatibility have been maintained with previous
+releases, so binaries
+built on previous releases should work on 10.8 and later, and binaries built on
+10.8 and later should be able to run on previous releases (as long as none of
+the new variants or new features are used.
+.Pp
 There are a number of decisions that
 .St -p1003.2
 leaves up to the implementor,
@@ -550,7 +773,11 @@ A repetition operator
 .Ql +\& ,
 or bounds)
 cannot follow another
-repetition operator.
+repetition operator, except for the use of
+.Ql ?\&
+for minimal repetition (for enhanced extended REs; see
+.Xr re_format 7
+for details).
 A repetition operator cannot begin an expression or subexpression
 or follow
 .Ql ^\&
@@ -652,43 +879,43 @@ sections 2.8 (Regular Expression Notation)
 and
 B.5 (C Binding for Regular Expression Matching).
 .Sh HISTORY
-Originally written by
-.An Henry Spencer .
-Altered for inclusion in the
+The
+.Nm regex
+implementation is based on a heavily modified subset of TRE
+(http://laurikari.net/tre/), originally written by Ville Laurikari.
+Previous releases used an implementation originally written by
+.An Henry Spencer ,
+and altered for inclusion in the
 .Bx 4.4
 distribution.
 .Sh BUGS
-This is an alpha release with known defects.
-Please report problems.
+The beginning-of-line and end-of-line anchors (
+.Dq ^\&
+and
+.Dq $\& )
+are currently implemented so that repetitions can not be applied to them.
+The standards are unclear about whether this is legal, but other
+.Nm regex
+packages do support this case.
+It is best to avoid this non-portable (and not really very useful) case.
 .Pp
 The back-reference code is subtle and doubts linger about its correctness
 in complex cases.
 .Pp
 The
 .Fn regexec
-function
-performance is poor.
-This will improve with later releases.
-The
-.Fa nmatch
-argument
-exceeding 0 is expensive;
-.Fa nmatch
-exceeding 1 is worse.
-The
-.Fn regexec
-function
-is largely insensitive to RE complexity
-.Em except
-that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
+variants use one of two internal matching engines.
+The normal one is linear worst-case time in the length of the text being
+searched, and quadratic worst-case time in the length of the used regular
+expression.
+When back-references are used, a slower, backtracking engine is used.
+While all backtracking matching engines suffer from extreme slowness for certain
+pathological cases, the normal engines doesn't suffer from these cases.
+It is advised to avoid back-references whenever possible.
 .Pp
 The
 .Fn regcomp
-function
+variants
 implements bounded repetitions by macro expansion,
 which is costly in time and space if counts are large
 or bounded repetitions are nested.
@@ -696,12 +923,6 @@ An RE like, say,
 .Ql "((((a{1,100}){1,100}){1,100}){1,100}){1,100}"
 will (eventually) run almost any existing machine out of swap space.
 .Pp
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.Pp
 Due to a mistake in
 .St -p1003.2 ,
 things like
@@ -720,8 +941,3 @@ match
 .Ql "abbbd" ?
 Until the standard is clarified,
 behavior in such cases should not be relied on.
-.Pp
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
-.Pp
-Word-boundary matching does not work properly in multibyte locales.
diff --git a/regex/FreeBSD/regex.3.patch b/regex/FreeBSD/regex.3.patch
deleted file mode 100644 (file)
index ec526a2..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
---- regex.3.bsdnew     2009-11-11 11:29:04.000000000 -0800
-+++ regex.3    2009-11-11 11:29:04.000000000 -0800
-@@ -37,8 +37,8 @@
- .Os
- .Sh NAME
- .Nm regcomp ,
--.Nm regexec ,
- .Nm regerror ,
-+.Nm regexec ,
- .Nm regfree
- .Nd regular-expression library
- .Sh LIBRARY
-@@ -47,20 +47,29 @@
- .In regex.h
- .Ft int
- .Fo regcomp
--.Fa "regex_t * restrict preg" "const char * restrict pattern" "int cflags"
--.Fc
--.Ft int
--.Fo regexec
--.Fa "const regex_t * restrict preg" "const char * restrict string"
--.Fa "size_t nmatch" "regmatch_t pmatch[restrict]" "int eflags"
-+.Fa "regex_t *restrict preg"
-+.Fa "const char *restrict pattern"
-+.Fa "int cflags"
- .Fc
- .Ft size_t
- .Fo regerror
--.Fa "int errcode" "const regex_t * restrict preg"
--.Fa "char * restrict errbuf" "size_t errbuf_size"
-+.Fa "int errcode"
-+.Fa "const regex_t *restrict preg"
-+.Fa "char *restrict errbuf"
-+.Fa "size_t errbuf_size"
-+.Fc
-+.Ft int
-+.Fo regexec
-+.Fa "const regex_t *restrict preg"
-+.Fa "const char *restrict string"
-+.Fa "size_t nmatch"
-+.Fa "regmatch_t pmatch[restrict]"
-+.Fa "int eflags"
- .Fc
- .Ft void
--.Fn regfree "regex_t *preg"
-+.Fo regfree
-+.Fa "regex_t *preg"
-+.Fc
- .Sh DESCRIPTION
- These routines implement
- .St -p1003.2
-@@ -71,12 +80,11 @@ see
- The
- .Fn regcomp
- function
--compiles an RE written as a string into an internal form,
-+compiles an RE, written as a string, into an internal form.
- .Fn regexec
--matches that internal form against a string and reports results,
-+matches that internal form against a string and reports results.
- .Fn regerror
--transforms error codes from either into human-readable messages,
--and
-+transforms error codes from either into human-readable messages.
- .Fn regfree
- frees any dynamically-allocated storage used by the internal form
- of an RE.
diff --git a/regex/FreeBSD/regex2.h b/regex/FreeBSD/regex2.h
deleted file mode 100644 (file)
index 13bbf64..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regex2.h    8.4 (Berkeley) 3/20/94
- * $FreeBSD: src/lib/libc/regex/regex2.h,v 1.11 2007/01/09 00:28:04 imp Exp $
- */
-
-/*
- * First, the stuff that ends up in the outside-world include file
- = typedef off_t regoff_t;
- = typedef struct {
- =     int re_magic;
- =     size_t re_nsub;         // number of parenthesized subexpressions
- =     const char *re_endp;    // end pointer for REG_PEND
- =     struct re_guts *re_g;   // none of your business :-)
- = } regex_t;
- = typedef struct {
- =     regoff_t rm_so;         // start of match
- =     regoff_t rm_eo;         // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define        MAGIC1  ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker.  (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination.  Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- *   OOR1 and OOR2 are respectively the end and the beginning of one of
- *   the branches.  Note that there is an implicit OOR2 following OCH_
- *   and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef unsigned long sop;     /* strip operator */
-typedef long sopno;
-#define        OPRMASK 0xf8000000L
-#define        OPDMASK 0x07ffffffL
-#define        OPSHIFT ((unsigned)27)
-#define        OP(n)   ((n)&OPRMASK)
-#define        OPND(n) ((n)&OPDMASK)
-#define        SOP(op, opnd)   ((op)|(opnd))
-/* operators                      meaning      operand                 */
-/*                                             (back, fwd are offsets) */
-#define        OEND    (1L<<OPSHIFT)   /* endmarker    -                       */
-#define        OCHAR   (2L<<OPSHIFT)   /* character    wide character          */
-#define        OBOL    (3L<<OPSHIFT)   /* left anchor  -                       */
-#define        OEOL    (4L<<OPSHIFT)   /* right anchor -                       */
-#define        OANY    (5L<<OPSHIFT)   /* .            -                       */
-#define        OANYOF  (6L<<OPSHIFT)   /* [...]        set number              */
-#define        OBACK_  (7L<<OPSHIFT)   /* begin \d     paren number            */
-#define        O_BACK  (8L<<OPSHIFT)   /* end \d       paren number            */
-#define        OPLUS_  (9L<<OPSHIFT)   /* + prefix     fwd to suffix           */
-#define        O_PLUS  (10L<<OPSHIFT)  /* + suffix     back to prefix          */
-#define        OQUEST_ (11L<<OPSHIFT)  /* ? prefix     fwd to suffix           */
-#define        O_QUEST (12L<<OPSHIFT)  /* ? suffix     back to prefix          */
-#define        OLPAREN (13L<<OPSHIFT)  /* (            fwd to )                */
-#define        ORPAREN (14L<<OPSHIFT)  /* )            back to (               */
-#define        OCH_    (15L<<OPSHIFT)  /* begin choice fwd to OOR2             */
-#define        OOR1    (16L<<OPSHIFT)  /* | pt. 1      back to OOR1 or OCH_    */
-#define        OOR2    (17L<<OPSHIFT)  /* | pt. 2      fwd to OOR2 or O_CH     */
-#define        O_CH    (18L<<OPSHIFT)  /* end choice   back to OOR1            */
-#define        OBOW    (19L<<OPSHIFT)  /* begin word   -                       */
-#define        OEOW    (20L<<OPSHIFT)  /* end word     -                       */
-
-/*
- * Structures for [] character-set representation.
- */
-typedef struct {
-       wint_t          min;
-       wint_t          max;
-} crange;
-typedef struct {
-       unsigned char   bmp[NC / 8];
-       wctype_t        *types;
-       int             ntypes;
-       wint_t          *wides;
-       int             nwides;
-       crange          *ranges;
-       int             nranges;
-       int             invert;
-       int             icase;
-} cset;
-
-static int
-CHIN1(cset *cs, wint_t ch)
-{
-       int i;
-
-       assert(ch >= 0);
-       if (ch < NC)
-               return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
-                   cs->invert);
-       for (i = 0; i < cs->nwides; i++)
-               if (ch == cs->wides[i])
-                       return (!cs->invert);
-       for (i = 0; i < cs->nranges; i++)
-               if (cs->ranges[i].min <= ch && ch <= cs->ranges[i].max)
-                       return (!cs->invert);
-       for (i = 0; i < cs->ntypes; i++)
-               if (iswctype(ch, cs->types[i]))
-                       return (!cs->invert);
-       return (cs->invert);
-}
-
-static __inline int
-CHIN(cset *cs, wint_t ch)
-{
-
-       assert(ch >= 0);
-       if (ch < NC)
-               return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
-                   cs->invert);
-       else if (cs->icase)
-               return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) ||
-                   CHIN1(cs, towupper(ch)));
-       else
-               return (CHIN1(cs, ch));
-}
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
-       int magic;
-#              define  MAGIC2  ((('R'^0200)<<8)|'E')
-       sop *strip;             /* malloced area for strip */
-       int ncsets;             /* number of csets in use */
-       cset *sets;             /* -> cset [ncsets] */
-       int cflags;             /* copy of regcomp() cflags argument */
-       sopno nstates;          /* = number of sops */
-       sopno firststate;       /* the initial OEND (normally 0) */
-       sopno laststate;        /* the final OEND */
-       int iflags;             /* internal flags */
-#              define  USEBOL  01      /* used ^ */
-#              define  USEEOL  02      /* used $ */
-#              define  BAD     04      /* something wrong */
-       int nbol;               /* number of ^ used */
-       int neol;               /* number of $ used */
-       char *must;             /* match must contain this string */
-       int moffset;            /* latest point at which must may be located */
-       int *charjump;          /* Boyer-Moore char jump table */
-       int *matchjump;         /* Boyer-Moore match jump table */
-       int mlen;               /* length of must */
-       size_t nsub;            /* copy of re_nsub */
-       int backrefs;           /* does it use back references? */
-       sopno nplus;            /* how deep does it nest +s? */
-};
-
-/* misc utilities */
-#define        OUT     (CHAR_MIN - 1)  /* a non-character value */
-#define ISWORD(c)       (iswalnum((uch)(c)) || (c) == '_')
diff --git a/regex/FreeBSD/regex2.h.patch b/regex/FreeBSD/regex2.h.patch
deleted file mode 100644 (file)
index ec20caa..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
---- regex2.h.bsdnew    2009-11-11 11:29:04.000000000 -0800
-+++ regex2.h   2009-11-11 12:18:35.000000000 -0800
-@@ -120,14 +120,23 @@ typedef struct {
-       int             nranges;
-       int             invert;
-       int             icase;
-+      int             *equiv_classes;
-+      int             nequiv_classes;
- } cset;
-+#include "collate.h"
-+
- static int
--CHIN1(cset *cs, wint_t ch)
-+CHIN1(cset *cs, wint_t ch, locale_t loc)
- {
-       int i;
-       assert(ch >= 0);
-+      for (i = 0; i < cs->nequiv_classes; i++)
-+              /* sadly, we can only deal with single characters from an
-+               * equivalence class */
-+              if (__collate_equiv_match(cs->equiv_classes[i], NULL, 0, ch, NULL, 0, NULL, NULL, loc) > 0)
-+                      return (!cs->invert);
-       if (ch < NC)
-               return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
-                   cs->invert);
-@@ -138,24 +147,24 @@ CHIN1(cset *cs, wint_t ch)
-               if (cs->ranges[i].min <= ch && ch <= cs->ranges[i].max)
-                       return (!cs->invert);
-       for (i = 0; i < cs->ntypes; i++)
--              if (iswctype(ch, cs->types[i]))
-+              if (iswctype_l(ch, cs->types[i], loc))
-                       return (!cs->invert);
-       return (cs->invert);
- }
- static __inline int
--CHIN(cset *cs, wint_t ch)
-+CHIN(cset *cs, wint_t ch, locale_t loc)
- {
-       assert(ch >= 0);
--      if (ch < NC)
-+      if (ch < NC && cs->nequiv_classes == 0)
-               return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
-                   cs->invert);
-       else if (cs->icase)
--              return (CHIN1(cs, ch) || CHIN1(cs, towlower(ch)) ||
--                  CHIN1(cs, towupper(ch)));
-+              return (CHIN1(cs, ch, loc) || CHIN1(cs, towlower_l(ch, loc), loc) ||
-+                  CHIN1(cs, towupper_l(ch, loc), loc));
-       else
--              return (CHIN1(cs, ch));
-+              return (CHIN1(cs, ch, loc));
- }
- /*
-@@ -185,8 +194,9 @@ struct re_guts {
-       size_t nsub;            /* copy of re_nsub */
-       int backrefs;           /* does it use back references? */
-       sopno nplus;            /* how deep does it nest +s? */
-+      locale_t loc;           /* current locale */
- };
- /* misc utilities */
--#define       OUT     (CHAR_MIN - 1)  /* a non-character value */
--#define ISWORD(c)       (iswalnum((uch)(c)) || (c) == '_')
-+#define       OUT     (CHAR_MIN - 2)  /* a non-character value */
-+#define ISWORD(c,l)     (iswalnum_l((uch)(c), l) || (c) == '_')
diff --git a/regex/FreeBSD/regexec.c b/regex/FreeBSD/regexec.c
deleted file mode 100644 (file)
index 4bc04ae..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regexec.c   8.3 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regexec.c  8.3 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regexec.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
-
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c three times, after muchos fiddling with the
- * macros that code uses.  This lets the same code operate on two different
- * representations for state sets and characters.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-static int nope __unused = 0;  /* for use in asserts; shuts lint up */
-
-static __inline size_t
-xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy)
-{
-       size_t nr;
-       wchar_t wc;
-
-       nr = mbrtowc(&wc, s, n, mbs);
-       if (wi != NULL)
-               *wi = wc;
-       if (nr == 0)
-               return (1);
-       else if (nr == (size_t)-1 || nr == (size_t)-2) {
-               memset(mbs, 0, sizeof(*mbs));
-               if (wi != NULL)
-                       *wi = dummy;
-               return (1);
-       } else
-                return (nr);
-}
-
-static __inline size_t
-xmbrtowc_dummy(wint_t *wi,
-               const char *s,
-               size_t n __unused,
-               mbstate_t *mbs __unused,
-               wint_t dummy __unused)
-{
-
-       if (wi != NULL)
-               *wi = (unsigned char)*s;
-       return (1);
-}
-
-/* macros for manipulating states, small version */
-#define        states  long
-#define        states1 states          /* for later use in regexec() decision */
-#define        CLEAR(v)        ((v) = 0)
-#define        SET0(v, n)      ((v) &= ~((unsigned long)1 << (n)))
-#define        SET1(v, n)      ((v) |= (unsigned long)1 << (n))
-#define        ISSET(v, n)     (((v) & ((unsigned long)1 << (n))) != 0)
-#define        ASSIGN(d, s)    ((d) = (s))
-#define        EQ(a, b)        ((a) == (b))
-#define        STATEVARS       long dummy      /* dummy version */
-#define        STATESETUP(m, n)        /* nothing */
-#define        STATETEARDOWN(m)        /* nothing */
-#define        SETUP(v)        ((v) = 0)
-#define        onestate        long
-#define        INIT(o, n)      ((o) = (unsigned long)1 << (n))
-#define        INC(o)  ((o) <<= 1)
-#define        ISSTATEIN(v, o) (((v) & (o)) != 0)
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst) |= ((unsigned long)(src)&(here)) << (n))
-#define        BACK(dst, src, n)       ((dst) |= ((unsigned long)(src)&(here)) >> (n))
-#define        ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
-/* no multibyte support */
-#define        XMBRTOWC        xmbrtowc_dummy
-#define        ZAPSTATE(mbs)   ((void)(mbs))
-/* function names */
-#define SNAMES                 /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-#undef XMBRTOWC
-#undef ZAPSTATE
-
-/* macros for manipulating states, large version */
-#define        states  char *
-#define        CLEAR(v)        memset(v, 0, m->g->nstates)
-#define        SET0(v, n)      ((v)[n] = 0)
-#define        SET1(v, n)      ((v)[n] = 1)
-#define        ISSET(v, n)     ((v)[n])
-#define        ASSIGN(d, s)    memcpy(d, s, m->g->nstates)
-#define        EQ(a, b)        (memcmp(a, b, m->g->nstates) == 0)
-#define        STATEVARS       long vn; char *space
-#define        STATESETUP(m, nv)       { (m)->space = malloc((nv)*(m)->g->nstates); \
-                               if ((m)->space == NULL) return(REG_ESPACE); \
-                               (m)->vn = 0; }
-#define        STATETEARDOWN(m)        { free((m)->space); }
-#define        SETUP(v)        ((v) = &m->space[m->vn++ * m->g->nstates])
-#define        onestate        long
-#define        INIT(o, n)      ((o) = (n))
-#define        INC(o)  ((o)++)
-#define        ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst)[here+(n)] |= (src)[here])
-#define        BACK(dst, src, n)       ((dst)[here-(n)] |= (src)[here])
-#define        ISSETBACK(v, n) ((v)[here - (n)])
-/* no multibyte support */
-#define        XMBRTOWC        xmbrtowc_dummy
-#define        ZAPSTATE(mbs)   ((void)(mbs))
-/* function names */
-#define        LNAMES                  /* flag */
-
-#include "engine.c"
-
-/* multibyte character & large states version */
-#undef LNAMES
-#undef XMBRTOWC
-#undef ZAPSTATE
-#define        XMBRTOWC        xmbrtowc
-#define        ZAPSTATE(mbs)   memset((mbs), 0, sizeof(*(mbs)))
-#define        MNAMES
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = extern int regexec(const regex_t *, const char *, size_t, \
- =                                     regmatch_t [], int);
- = #define     REG_NOTBOL      00001
- = #define     REG_NOTEOL      00002
- = #define     REG_STARTEND    00004
- = #define     REG_TRACE       00400   // tracing of execution
- = #define     REG_LARGE       01000   // force large representation
- = #define     REG_BACKR       02000   // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call.  Also, by this point the matchers
- * have been prototyped.
- */
-int                            /* 0 success, REG_NOMATCH failure */
-regexec(const regex_t * __restrict preg,
-       const char * __restrict string,
-       size_t nmatch,
-       regmatch_t pmatch[__restrict],
-       int eflags)
-{
-       struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-#      define  GOODFLAGS(f)    (f)
-#else
-#      define  GOODFLAGS(f)    ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
-       if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
-               return(REG_BADPAT);
-       assert(!(g->iflags&BAD));
-       if (g->iflags&BAD)              /* backstop for no-debug case */
-               return(REG_BADPAT);
-       eflags = GOODFLAGS(eflags);
-
-       if (MB_CUR_MAX > 1)
-               return(mmatcher(g, (char *)string, nmatch, pmatch, eflags));
-       else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
-               return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
-       else
-               return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/regex/FreeBSD/regexec.c.patch b/regex/FreeBSD/regexec.c.patch
deleted file mode 100644 (file)
index 409ee17..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
---- regexec.c.bsdnew   2009-11-11 11:29:04.000000000 -0800
-+++ regexec.c  2009-11-11 12:21:46.000000000 -0800
-@@ -39,6 +39,8 @@ static char sccsid[] = "@(#)regexec.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/regex/regexec.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
-+#include "xlocale_private.h"
-+
- /*
-  * the outer shell of regexec()
-  *
-@@ -62,12 +64,12 @@ __FBSDID("$FreeBSD: src/lib/libc/regex/r
- static int nope __unused = 0; /* for use in asserts; shuts lint up */
- static __inline size_t
--xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy)
-+xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy, locale_t loc)
- {
-       size_t nr;
-       wchar_t wc;
--      nr = mbrtowc(&wc, s, n, mbs);
-+      nr = mbrtowc_l(&wc, s, n, mbs, loc);
-       if (wi != NULL)
-               *wi = wc;
-       if (nr == 0)
-@@ -86,7 +88,8 @@ xmbrtowc_dummy(wint_t *wi,
-               const char *s,
-               size_t n __unused,
-               mbstate_t *mbs __unused,
--              wint_t dummy __unused)
-+              wint_t dummy __unused,
-+              locale_t loc __unused)
- {
-       if (wi != NULL)
-@@ -176,6 +179,8 @@ xmbrtowc_dummy(wint_t *wi,
- /* function names */
- #define       LNAMES                  /* flag */
-+#undef __FBSDID
-+#define __FBSDID(x)
- #include "engine.c"
- /* multibyte character & large states version */
-@@ -224,7 +229,8 @@ regexec(const regex_t * __restrict preg,
-               return(REG_BADPAT);
-       eflags = GOODFLAGS(eflags);
--      if (MB_CUR_MAX > 1)
-+      g->loc = __current_locale();
-+      if (MB_CUR_MAX_L(g->loc) > 1)
-               return(mmatcher(g, (char *)string, nmatch, pmatch, eflags));
-       else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
-               return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
diff --git a/regex/FreeBSD/regfree.c b/regex/FreeBSD/regfree.c
deleted file mode 100644 (file)
index aa795fa..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regfree.c   8.3 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regfree.c  8.3 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regfree.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <regex.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = extern void regfree(regex_t *);
- */
-void
-regfree(regex_t *preg)
-{
-       struct re_guts *g;
-       int i;
-
-       if (preg->re_magic != MAGIC1)   /* oops */
-               return;                 /* nice to complain, but hard */
-
-       g = preg->re_g;
-       if (g == NULL || g->magic != MAGIC2)    /* oops again */
-               return;
-       preg->re_magic = 0;             /* mark it invalid */
-       g->magic = 0;                   /* mark it invalid */
-
-       if (g->strip != NULL)
-               free((char *)g->strip);
-       if (g->sets != NULL) {
-               for (i = 0; i < g->ncsets; i++) {
-                       free(g->sets[i].ranges);
-                       free(g->sets[i].wides);
-                       free(g->sets[i].types);
-               }
-               free((char *)g->sets);
-       }
-       if (g->must != NULL)
-               free(g->must);
-       if (g->charjump != NULL)
-               free(&g->charjump[CHAR_MIN]);
-       if (g->matchjump != NULL)
-               free(g->matchjump);
-       free((char *)g);
-}
diff --git a/regex/FreeBSD/regfree.c.patch b/regex/FreeBSD/regfree.c.patch
deleted file mode 100644 (file)
index f4744e0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- regfree.c.bsdnew   2009-11-11 11:29:04.000000000 -0800
-+++ regfree.c  2009-11-11 11:29:04.000000000 -0800
-@@ -76,6 +76,7 @@ regfree(regex_t *preg)
-                       free(g->sets[i].ranges);
-                       free(g->sets[i].wides);
-                       free(g->sets[i].types);
-+                      free(g->sets[i].equiv_classes);
-               }
-               free((char *)g->sets);
-       }
diff --git a/regex/Makefile.inc b/regex/Makefile.inc
deleted file mode 100644 (file)
index 2c5523a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#      from @(#)Makefile.inc   8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/regex/Makefile.inc,v 1.6 2001/03/27 17:26:51 ru Exp $
-
-# regex sources
-.PATH: ${.CURDIR}/regex
-CWD := ${.CURDIR}/regex
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= regcomp.c regerror.c regexec.c regfree.c
-CFLAGS-regcomp-fbsd.c+= -DPOSIX_MISTAKE
-FBSDHDRS= cclass.h cname.h engine.c regex2.h utils.h
-.include "Makefile.fbsd_end"
-
-LEGACYSRCS += regcomp.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-regcomp-fbsd.c += -DLIBC_ALIAS_REGCOMP
-
-.if ${LIB} == "c"
-.include "Makefile.fbsd_begin"
-FBSDMAN3= regex.3
-FBSDMAN7= re_format.7
-.include "Makefile.fbsd_end"
-
-MLINKS+= regex.3 regcomp.3             \
-         regex.3 regexec.3             \
-         regex.3 regerror.3
-
-MLINKS+= regexec.3 regfree.3
-.endif
diff --git a/regex/TRE/config.h b/regex/TRE/config.h
new file mode 100644 (file)
index 0000000..6ea54fe
--- /dev/null
@@ -0,0 +1,262 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#define HAVE_ALLOCA_H 1
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+#define HAVE_CFLOCALECOPYCURRENT 1
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#define HAVE_GETOPT_LONG 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have the iconv() function and it works. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define to 1 if you have the `isblank' function. */
+#define HAVE_ISBLANK 1
+
+/* Define to 1 if you have the `iswascii' function or macro. */
+#define HAVE_ISWASCII 1
+
+/* Define to 1 if you have the `iswblank' function or macro. */
+#define HAVE_ISWBLANK 1
+
+/* Define to 1 if you have the `iswctype' function or macro. */
+#define HAVE_ISWCTYPE 1
+
+/* Define to 1 if you have the `iswlower' function or macro. */
+#define HAVE_ISWLOWER 1
+
+/* Define to 1 if you have the `iswupper' function or macro. */
+#define HAVE_ISWUPPER 1
+
+/* Define to 1 if you have the <libutf8.h> header file. */
+/* #undef HAVE_LIBUTF8_H */
+
+/* Define to 1 if you have the `mbrtowc' function or macro. */
+#define HAVE_MBRTOWC 1
+
+/* Define to 1 if the system has the type `mbstate_t'. */
+#define HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the `mbtowc' function or macro. */
+/* #undef HAVE_MBTOWC */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <regex.h> header file. */
+/* #undef HAVE_REGEX_H */
+
+/* Define to 1 if the system has the type `reg_errcode_t'. */
+/* #undef HAVE_REG_ERRCODE_T */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `towlower' function or macro. */
+#define HAVE_TOWLOWER 1
+
+/* Define to 1 if you have the `towupper' function or macro. */
+#define HAVE_TOWUPPER 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#define HAVE_WCHAR_T 1
+
+/* Define to 1 if you have the `wcschr' function or macro. */
+#define HAVE_WCSCHR 1
+
+/* Define to 1 if you have the `wcscpy' function or macro. */
+#define HAVE_WCSCPY 1
+
+/* Define to 1 if you have the `wcslen' function or macro. */
+#define HAVE_WCSLEN 1
+
+/* Define to 1 if you have the `wcsncpy' function or macro. */
+#define HAVE_WCSNCPY 1
+
+/* Define to 1 if you have the `wcsrtombs' function or macro. */
+#define HAVE_WCSRTOMBS 1
+
+/* Define to 1 if you have the `wcstombs' function or macro. */
+/* #undef HAVE_WCSTOMBS */
+
+/* Define to 1 if you have the `wctype' function or macro. */
+#define HAVE_WCTYPE 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if the system has the type `wint_t'. */
+#define HAVE_WINT_T 1
+
+/* Define if you want to disable debug assertions. */
+#define NDEBUG 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "tre"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "tre-general@lists.laurikari.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "TRE"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "TRE 0.8.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "tre"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.8.0"
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+       STACK_DIRECTION > 0 => grows toward higher addresses
+       STACK_DIRECTION < 0 => grows toward lower addresses
+       STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you want to enable approximate matching functionality. */
+/* #undef TRE_APPROX */
+
+/* Define if you want TRE to print debug messages to stdout. */
+/* #undef TRE_DEBUG */
+
+/* Define to enable multibyte character set support. */
+#define TRE_MULTIBYTE 1
+
+/* Define to a field in the regex_t struct where TRE should store a pointer to
+   the internal tre_tnfa_t structure */
+#define TRE_REGEX_T_FIELD re_g
+
+/* Define to the absolute path to the system regex.h */
+#define TRE_SYSTEM_REGEX_H_PATH <regex.h>
+
+/* Define if you want TRE to use alloca() instead of malloc() when allocating
+   memory needed for regexec operations. */
+#define TRE_USE_ALLOCA 1
+
+/* Define if you want user-defined string support */
+/* #undef TRE_STR_USER */
+
+/* Define to include the system regex.h from TRE regex.h */
+#define TRE_USE_SYSTEM_REGEX_H 1
+
+/* TRE version string. */
+#define TRE_VERSION "0.8.0"
+
+/* TRE version level 1. */
+#define TRE_VERSION_1 0
+
+/* TRE version level 2. */
+#define TRE_VERSION_2 8
+
+/* TRE version level 3. */
+#define TRE_VERSION_3 0
+
+/* Define to enable wide character (wchar_t) support. */
+#define TRE_WCHAR 1
+
+/* Version number of package */
+#define VERSION "0.8.0"
+
+/* Define to the maximum value of wchar_t if not already defined elsewhere */
+/* #undef WCHAR_MAX */
+
+/* Define if wchar_t is signed */
+/* #undef WCHAR_T_SIGNED */
+
+/* Define if wchar_t is unsigned */
+/* #undef WCHAR_T_UNSIGNED */
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to enable GNU extensions in glibc */
+#define _GNU_SOURCE 1
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define on IRIX */
+/* #undef _REGCOMP_INTERNAL */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
diff --git a/regex/TRE/lib/regcomp.c b/regex/TRE/lib/regcomp.c
new file mode 100644 (file)
index 0000000..7860277
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+  tre_regcomp.c - TRE POSIX compatible regex compilation functions.
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include "tre.h"
+#include "tre-internal.h"
+#include "xmalloc.h"
+
+#ifndef BUILDING_VARIANT
+int
+tre_regncomp_l(regex_t *preg, const char *regex, size_t n, int cflags, locale_t loc)
+{
+  int ret;
+#if TRE_WCHAR
+  tre_char_t *wregex;
+  size_t wlen;
+
+  wregex = xmalloc(sizeof(tre_char_t) * (n + 1));
+  if (wregex == NULL)
+    return REG_ESPACE;
+#ifdef __LIBC__
+  NORMALIZE_LOCALE(loc);
+#endif /* __LIBC__ */
+
+  /* If the current locale uses the standard single byte encoding of
+     characters, we don't do a multibyte string conversion.  If we did,
+     many applications which use the default locale would break since
+     the default "C" locale uses the 7-bit ASCII character set, and
+     all characters with the eighth bit set would be considered invalid. */
+#if TRE_MULTIBYTE
+  if (TRE_MB_CUR_MAX_L(loc) == 1)
+#endif /* TRE_MULTIBYTE */
+    {
+      unsigned int i;
+      const unsigned char *str = (const unsigned char *)regex;
+      tre_char_t *wstr = wregex;
+
+      for (i = 0; i < n; i++)
+       *(wstr++) = *(str++);
+      wlen = n;
+    }
+#if TRE_MULTIBYTE
+  else
+    {
+      size_t consumed;
+      tre_char_t *wcptr = wregex;
+#ifdef HAVE_MBSTATE_T
+      mbstate_t state;
+      memset(&state, '\0', sizeof(state));
+#endif /* HAVE_MBSTATE_T */
+      while (n > 0)
+       {
+         consumed = tre_mbrtowc_l(wcptr, regex, n, &state, loc);
+
+         switch (consumed)
+           {
+           case 0:
+             if (*regex == '\0')
+               consumed = 1;
+             else
+               {
+                 xfree(wregex);
+                 return REG_BADPAT;
+               }
+             break;
+           case (size_t)-1:
+           case (size_t)-2:
+             DPRINT(("mbrtowc: error %d: %s.\n", errno, strerror(errno)));
+             xfree(wregex);
+             return REG_ILLSEQ;
+           }
+         regex += consumed;
+         n -= consumed;
+         wcptr++;
+       }
+      wlen = wcptr - wregex;
+    }
+#endif /* TRE_MULTIBYTE */
+
+  wregex[wlen] = L'\0';
+  ret = tre_compile(preg, wregex, wlen, cflags, loc);
+  xfree(wregex);
+#else /* !TRE_WCHAR */
+#ifdef __LIBC__
+  NORMALIZE_LOCALE(loc);
+#endif /* __LIBC__ */
+
+  ret = tre_compile(preg, (const tre_char_t *)regex, n, cflags, loc);
+#endif /* !TRE_WCHAR */
+
+  return ret;
+}
+
+int
+tre_regncomp(regex_t *preg, const char *regex, size_t n, int cflags)
+{
+  locale_t loc;
+
+#ifdef __LIBC__
+  loc = __current_locale();
+#else /* !__LIBC__ */
+  loc = duplocale(NULL);
+  if (!loc) return REG_ESPACE;
+#endif /* !__LIBC__ */
+
+  return tre_regncomp_l(preg, regex, n, cflags, loc);
+}
+
+int
+tre_regcomp_l(regex_t *preg, const char *regex, int cflags, locale_t loc)
+{
+  size_t len;
+
+  if (cflags & REG_PEND)
+    {
+      if ((const char *)(preg->re_endp) < regex)
+       return REG_INVARG;
+      len = (const char *)(preg->re_endp) - regex;
+    }
+  else
+    len = strlen(regex);
+  return tre_regncomp_l(preg, regex, len, cflags, loc);
+}
+#endif /* !BUILDING_VARIANT */
+
+int
+tre_regcomp(regex_t *preg, const char *regex, int cflags)
+{
+  locale_t loc;
+
+#ifdef __LIBC__
+  loc = __current_locale();
+#else /* !__LIBC__ */
+  loc = duplocale(NULL);
+  if (!loc) return REG_ESPACE;
+#endif /* !__LIBC__ */
+
+  return tre_regcomp_l(preg, regex, cflags, loc);
+}
+
+
+#ifndef BUILDING_VARIANT
+#ifdef TRE_WCHAR
+int
+tre_regwncomp_l(regex_t *preg, const wchar_t *regex, size_t n, int cflags, locale_t loc)
+{
+#ifdef __LIBC__
+  NORMALIZE_LOCALE(loc);
+#endif /* __LIBC__ */
+  return tre_compile(preg, regex, n, cflags, loc);
+}
+
+int
+tre_regwncomp(regex_t *preg, const wchar_t *regex, size_t n, int cflags)
+{
+  locale_t loc;
+
+#ifdef __LIBC__
+  loc = __current_locale();
+#else /* !__LIBC__ */
+  loc = duplocale(NULL);
+  if (!loc) return REG_ESPACE;
+#endif /* !__LIBC__ */
+
+  return tre_compile(preg, regex, n, cflags, loc);
+}
+
+int
+tre_regwcomp_l(regex_t *preg, const wchar_t *regex, int cflags, locale_t loc)
+{
+#ifdef __LIBC__
+  NORMALIZE_LOCALE(loc);
+#endif /* __LIBC__ */
+  return tre_compile(preg, regex, wcslen(regex), cflags, loc);
+}
+
+int
+tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags)
+{
+  return tre_regwncomp(preg, regex, wcslen(regex), cflags);
+}
+#endif /* TRE_WCHAR */
+
+void
+tre_regfree(regex_t *preg)
+{
+  tre_free(preg);
+}
+#endif /* !BUILDING_VARIANT */
+
+/* EOF */
diff --git a/regex/TRE/lib/regexec.c b/regex/TRE/lib/regexec.c
new file mode 100644 (file)
index 0000000..89229fe
--- /dev/null
@@ -0,0 +1,558 @@
+/*
+  tre_regexec.c - TRE POSIX compatible matching functions (and more).
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#ifdef TRE_USE_ALLOCA
+/* AIX requires this to be the first thing in the file.         */
+#ifndef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+#endif /* TRE_USE_ALLOCA */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif /* HAVE_WCHAR_H */
+#ifdef HAVE_WCTYPE_H
+#include <wctype.h>
+#endif /* HAVE_WCTYPE_H */
+#ifndef TRE_WCHAR
+#include <ctype.h>
+#endif /* !TRE_WCHAR */
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif /* HAVE_MALLOC_H */
+#include <limits.h>
+
+#include "tre-internal.h"
+#include "tre-match-utils.h"
+#include "tre.h"
+#include "xmalloc.h"
+
+
+/* For each tre_last_matched_t in the lm array, find the last matched branch by
+   comparing the touch value of the cmp_tag's.  For all other branches, reset
+   the corresponding tags.  If reset_all is non-zero, reset all tags in all
+   branches.  Recurse into the nested last matched structures, clearing tags as
+   apprpriate. */
+static void
+tre_reset_last_matched_branches(tre_tag_t *tags, const tre_last_matched_t *lm,
+                               int n, int start_tag, int reset_all)
+{
+  int max, i, reset;
+  tre_last_matched_branch_t *b;
+
+  DPRINT(("tre_reset_last_matched_branches: n=%d start_tag=%d reset_all=%d\n",
+         n, start_tag, reset_all));
+  for (; n-- > 0; lm++)
+    {
+      if (lm->n_branches == 1)
+       {
+         b = lm->branches;
+         if (start_tag > 0)
+           {
+             DPRINT(("  b->cmp_tag=%d %d <? %d\n", b->cmp_tag,
+                     tre_tag_touch_get(tags, b->cmp_tag),
+                     tre_tag_touch_get(tags, start_tag)));
+             reset = (reset_all || tre_tag_touch_get(tags, b->cmp_tag) <
+                      tre_tag_touch_get(tags, start_tag));
+           }
+         else
+           reset = 0;
+
+         if (reset)
+           {
+             int *t;
+
+             for (i = b->n_tags, t = b->tags; i > 0; i--, t++)
+               {
+                 DPRINT(("  Resetting t%d\n", *t));
+                 tre_tag_reset(tags, *t);
+               }
+           }
+         if (b->n_last_matched > 0)
+           tre_reset_last_matched_branches(tags, b->last_matched,
+                                               b->n_last_matched, 
+                                               lm->start_tag, reset);
+       }
+      else
+       {
+         if (!reset_all)
+           {
+#ifdef TRE_DEBUG
+             int last;
+#endif /* TRE_DEBUG */
+             max = 0;
+             for (i = lm->n_branches, b = lm->branches; i > 0; i--, b++)
+               {
+                 int t = b->cmp_tag;
+                 int touch = tre_tag_touch_get(tags, t);
+                 if (touch > max)
+                   {
+                     max = touch;
+#ifdef TRE_DEBUG
+                     last = t;
+#endif /* TRE_DEBUG */
+                   }
+               }
+             DPRINT(("  Last touched end tag t%d=%d\n", last, max));
+           }
+
+         for (i = lm->n_branches, b = lm->branches; i > 0; i--, b++)
+           {
+             reset = (reset_all || tre_tag_touch_get(tags, b->cmp_tag) < max);
+             if (reset)
+               {
+                 int j;
+                 int *t;
+
+                 for (j = b->n_tags, t = b->tags; j > 0; j--, t++)
+                   {
+                     DPRINT(("  Resetting t%d\n", *t));
+                     tre_tag_reset(tags, *t);
+                   }
+               }
+             if (b->n_last_matched > 0)
+               tre_reset_last_matched_branches(tags, b->last_matched,
+                                               b->n_last_matched,
+                                               lm->start_tag, reset);
+           }
+       }
+    }
+}
+
+
+/* Fills the POSIX.2 regmatch_t array according to the TNFA tag and match
+   endpoint values. */
+reg_errcode_t
+tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags,
+               const tre_tnfa_t *tnfa, const tre_tag_t *intags, int match_eo)
+{
+  unsigned int i;
+
+  if (cflags & REG_NOSUB) return REG_OK;
+
+  i = 0;
+  if (match_eo >= 0 && intags)
+    {
+      const tre_tag_t *tags = intags;
+      tre_submatch_data_t *submatch_data;
+
+      if (tnfa->last_matched_branch &&
+         tnfa->last_matched_branch->n_last_matched > 0)
+       {
+         tre_tag_t *t;
+#ifdef TRE_USE_ALLOCA
+         t = alloca(sizeof(*t) * tnfa->num_tags);
+#else /* !TRE_USE_ALLOCA */
+         t = xmalloc(sizeof(*t) * tnfa->num_tags);
+#endif /* !TRE_USE_ALLOCA */
+         if (!t) return REG_ESPACE;
+         memcpy(t, intags, tnfa->num_tags * sizeof(tre_tag_t));
+         tre_reset_last_matched_branches(t,
+                                   tnfa->last_matched_branch->last_matched,
+                                   tnfa->last_matched_branch->n_last_matched,
+                                   0, 0);
+         tags = t;
+       }
+      /* Construct submatch offsets from the tags. */
+      DPRINT(("end tag = t%d = %d\n", tnfa->end_tag, match_eo));
+      submatch_data = tnfa->submatch_data;
+      while (i < tnfa->num_submatches && i < nmatch)
+       {
+         if (submatch_data[i].so_tag == tnfa->end_tag)
+           pmatch[i].rm_so = match_eo;
+         else
+           pmatch[i].rm_so = tre_tag_get(tags, submatch_data[i].so_tag);
+
+         if (submatch_data[i].eo_tag == tnfa->end_tag)
+           pmatch[i].rm_eo = match_eo;
+         else
+           pmatch[i].rm_eo = tre_tag_get(tags, submatch_data[i].eo_tag);
+
+         /* If either of the endpoints were not used, this submatch
+            was not part of the match. */
+         if (pmatch[i].rm_so == -1 || pmatch[i].rm_eo == -1)
+           pmatch[i].rm_so = pmatch[i].rm_eo = -1;
+
+         DPRINT(("pmatch[%d] = {t%d = %qd, t%d = %qd}\n", i,
+                 submatch_data[i].so_tag, pmatch[i].rm_so,
+                 submatch_data[i].eo_tag, pmatch[i].rm_eo));
+         i++;
+       }
+#ifndef TRE_USE_ALLOCA
+       if (tags != intags) xfree(tags);
+#endif /* !TRE_USE_ALLOCA */
+    }
+
+  while (i < nmatch)
+    {
+      pmatch[i].rm_so = -1;
+      pmatch[i].rm_eo = -1;
+      i++;
+    }
+
+  return REG_OK;
+}
+
+
+/*
+  Wrapper functions for POSIX compatible regexp matching.
+*/
+
+#ifndef __LIBC__
+int
+tre_have_backrefs(const regex_t *preg)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+  return tnfa->have_backrefs;
+}
+
+#ifdef TRE_APPROX
+int
+tre_have_approx(const regex_t *preg)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+  return tnfa->have_approx;
+}
+#endif /* TRE_APPROX */
+#endif /* !__LIBC__ */
+
+static int
+tre_match(const tre_tnfa_t *tnfa, const void *string, size_t len,
+         tre_str_type_t type, size_t nmatch, regmatch_t pmatch[],
+         int eflags)
+{
+  reg_errcode_t status;
+  tre_tag_t *tags = NULL;
+  int eo;
+  size_t offset = 0, count = 0;
+  if (tnfa->num_tags > 0 && nmatch > 0)
+    {
+#ifdef TRE_USE_ALLOCA
+      tags = alloca(sizeof(*tags) * tnfa->num_tags);
+#else /* !TRE_USE_ALLOCA */
+      tags = xmalloc(sizeof(*tags) * tnfa->num_tags);
+#endif /* !TRE_USE_ALLOCA */
+      if (tags == NULL)
+       return REG_ESPACE;
+    }
+
+  if (
+#ifdef TRE_STR_USER
+      type != STR_USER &&
+#endif /* TRE_STR_USER */
+      (eflags & REG_STARTEND) && pmatch)
+    {
+      if (pmatch->rm_so < 0)
+       return REG_INVARG;
+      if (len == (size_t)-1)
+       {
+         if (pmatch->rm_eo < 0 || pmatch->rm_so > pmatch->rm_eo)
+           return REG_INVARG;
+         len = pmatch->rm_eo - pmatch->rm_so;
+       }
+      count = offset = pmatch->rm_so;
+      if (type == STR_WIDE) offset *= sizeof(wchar_t);
+    }
+
+  /* Dispatch to the appropriate matcher. */
+  if (tnfa->have_backrefs || eflags & REG_BACKTRACKING_MATCHER)
+    {
+      /* The regex has back references, use the backtracking matcher. */
+#ifdef TRE_STR_USER
+      if (type == STR_USER)
+       {
+         const tre_str_source *source = string;
+         if (source->rewind == NULL || source->compare == NULL)
+           /* The backtracking matcher requires rewind and compare
+              capabilities from the input stream. */
+           return REG_BADPAT;
+       }
+#endif /* TRE_STR_USER */
+      status = tre_tnfa_run_backtrack(tnfa, string + offset, (int)len, type,
+                                     tags, eflags, &eo);
+    }
+#ifdef TRE_APPROX
+  else if (tnfa->have_approx || eflags & REG_APPROX_MATCHER)
+    {
+      /* The regex uses approximate matching, use the approximate matcher. */
+      regamatch_t match;
+      regaparams_t params;
+      tre_regaparams_default(&params);
+      params.max_err = 0;
+      params.max_cost = 0;
+      status = tre_tnfa_run_approx(tnfa, string + offset, (int)len, type, tags,
+                                  &match, params, eflags, &eo);
+    }
+#endif /* TRE_APPROX */
+  else
+    {
+      /* Exact matching, no back references, use the parallel matcher. */
+      status = tre_tnfa_run_parallel(tnfa, string + offset, (int)len, type,
+                                    tags, eflags, &eo);
+    }
+
+  if (status == REG_OK)
+    {
+      /* A match was found, so fill the submatch registers. */
+      status = tre_fill_pmatch(nmatch, pmatch, tnfa->cflags, tnfa, tags, eo);
+      /* If doing REG_STARTEND, adjust the pmatch array (we can't build
+         this into tre_fill_pmatch, because tre_tnfa_run_backtrack calls
+        tre_fill_pmatch itself). */
+      if (status == REG_OK && !(tnfa->cflags & REG_NOSUB) &&
+#ifdef TRE_STR_USER
+         type != STR_USER &&
+#endif /* TRE_STR_USER */
+         (eflags & REG_STARTEND) && pmatch && nmatch > 0)
+       {
+         size_t i;
+         regmatch_t *p;
+         for (i = nmatch, p = pmatch; i > 0; p++, i--)
+           {
+             if (p->rm_so >= 0) p->rm_so += count;
+             if (p->rm_eo >= 0) p->rm_eo += count;
+           }
+       }
+    }
+#ifndef TRE_USE_ALLOCA
+  if (tags)
+    xfree(tags);
+#endif /* !TRE_USE_ALLOCA */
+  return status;
+}
+
+int
+tre_regnexec(const regex_t *preg, const char *str, size_t len,
+        size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+  tre_str_type_t type = (TRE_MB_CUR_MAX_L(tnfa->loc) == 1) ? STR_BYTE : STR_MBS;
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  if (preg->re_magic != RE_MAGIC) return REG_BADPAT;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+
+  return tre_match(tnfa, str, len, type, nmatch, pmatch, eflags);
+}
+
+int
+tre_regexec(const regex_t *preg, const char *str,
+       size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+  return tre_regnexec(preg, str, (size_t)-1, nmatch, pmatch, eflags);
+}
+
+
+#ifdef TRE_WCHAR
+
+int
+tre_regwnexec(const regex_t *preg, const wchar_t *str, size_t len,
+         size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  if (preg->re_magic != RE_MAGIC) return REG_BADPAT;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+
+  return tre_match(tnfa, str, len, STR_WIDE, nmatch, pmatch, eflags);
+}
+
+int
+tre_regwexec(const regex_t *preg, const wchar_t *str,
+        size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+  return tre_regwnexec(preg, str, (size_t)-1, nmatch, pmatch, eflags);
+}
+
+#endif /* TRE_WCHAR */
+
+#ifdef TRE_STR_USER
+int
+tre_reguexec(const regex_t *preg, const tre_str_source *str,
+        size_t nmatch, regmatch_t pmatch[], int eflags)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  if (preg->re_magic != RE_MAGIC) return REG_BADPAT;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+
+  return tre_match(tnfa, str, (size_t)-1, STR_USER, nmatch, pmatch, eflags);
+}
+#endif /* TRE_STR_USER */
+
+
+#ifdef TRE_APPROX
+
+/*
+  Wrapper functions for approximate regexp matching.
+*/
+
+static int
+tre_match_approx(const tre_tnfa_t *tnfa, const void *string, size_t len,
+                tre_str_type_t type, regamatch_t *match, regaparams_t params,
+                int eflags)
+{
+  reg_errcode_t status;
+  tre_tag_t *tags = NULL;
+  int eo;
+  size_t offset = 0, count = 0;
+
+  /* If the regexp does not use approximate matching features, the
+     maximum cost is zero, and the approximate matcher isn't forced,
+     use the exact matcher instead. */
+  if (params.max_cost == 0 && !tnfa->have_approx
+      && !(eflags & REG_APPROX_MATCHER))
+    return tre_match(tnfa, string, len, type, match->nmatch, match->pmatch,
+                    eflags);
+
+  /* Back references are not supported by the approximate matcher. */
+  if (tnfa->have_backrefs)
+    return REG_BADPAT;
+
+  if (tnfa->num_tags > 0 && match->nmatch > 0)
+    {
+#if TRE_USE_ALLOCA
+      tags = alloca(sizeof(*tags) * tnfa->num_tags);
+#else /* !TRE_USE_ALLOCA */
+      tags = xmalloc(sizeof(*tags) * tnfa->num_tags);
+#endif /* !TRE_USE_ALLOCA */
+      if (tags == NULL)
+       return REG_ESPACE;
+    }
+
+  if (
+#ifdef TRE_STR_USER
+      type != STR_USER &&
+#endif /* TRE_STR_USER */
+      (eflags & REG_STARTEND) && match->pmatch)
+    {
+      if (match->pmatch->rm_so < 0)
+       return REG_INVARG;
+      if (len == (size_t)-1)
+       {
+         if (match->pmatch->rm_eo < 0 || match->pmatch->rm_so >
+             match->pmatch->rm_eo)
+           return REG_INVARG;
+         len = match->pmatch->rm_eo - match->pmatch->rm_so;
+       }
+      count = offset = match->pmatch->rm_so;
+      if (type == STR_WIDE) offset *= sizeof(wchar_t);
+    }
+
+  status = tre_tnfa_run_approx(tnfa, string, (int)len, type, tags,
+                              match, params, eflags, &eo);
+  if (status == REG_OK)
+    {
+      status = tre_fill_pmatch(match->nmatch, match->pmatch, tnfa->cflags,
+                              tnfa, tags, eo);
+      /* If doing REG_STARTEND, adjust the pmatch array (we can't build
+         this into tre_fill_pmatch, because tre_tnfa_run_backtrack call
+        tre_fill_pmatch itself). */
+      if (status == REG_OK && !(tnfa->cflags & REG_NOSUB) &&
+#ifdef TRE_STR_USER
+         type != STR_USER &&
+#endif /* TRE_STR_USER */
+         (eflags & REG_STARTEND) && match->pmatch && match->nmatch > 0)
+       {
+         size_t i;
+         regmatch_t *p;
+         for (i = match->nmatch, p = match->pmatch; i > 0; p++, i--)
+           {
+             if (p->rm_so >= 0) p->rm_so += count;
+             if (p->rm_eo >= 0) p->rm_eo += count;
+           }
+       }
+    }
+#ifndef TRE_USE_ALLOCA
+  if (tags)
+    xfree(tags);
+#endif /* !TRE_USE_ALLOCA */
+  return status;
+}
+
+int
+tre_reganexec(const regex_t *preg, const char *str, size_t len,
+         regamatch_t *match, regaparams_t params, int eflags)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+  tre_str_type_t type = (TRE_MB_CUR_MAX_L(tnfa->loc) == 1) ? STR_BYTE : STR_MBS;
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  if (preg->re_magic != RE_MAGIC) return REG_BADPAT;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+
+  return tre_match_approx(tnfa, str, len, type, match, params, eflags);
+}
+
+int
+tre_regaexec(const regex_t *preg, const char *str,
+        regamatch_t *match, regaparams_t params, int eflags)
+{
+  return tre_reganexec(preg, str, (size_t)-1, match, params, eflags);
+}
+
+#ifdef TRE_WCHAR
+
+int
+tre_regawnexec(const regex_t *preg, const wchar_t *str, size_t len,
+          regamatch_t *match, regaparams_t params, int eflags)
+{
+  tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  if (preg->re_magic != RE_MAGIC) return REG_BADPAT;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+
+  return tre_match_approx(tnfa, str, len, STR_WIDE,
+                         match, params, eflags);
+}
+
+int
+tre_regawexec(const regex_t *preg, const wchar_t *str,
+         regamatch_t *match, regaparams_t params, int eflags)
+{
+  return tre_regawnexec(preg, str, (size_t)-1, match, params, eflags);
+}
+
+#endif /* TRE_WCHAR */
+
+void
+tre_regaparams_default(regaparams_t *params)
+{
+  memset(params, 0, sizeof(*params));
+  params->cost_ins = 1;
+  params->cost_del = 1;
+  params->cost_subst = 1;
+  params->max_cost = INT_MAX;
+  params->max_ins = INT_MAX;
+  params->max_del = INT_MAX;
+  params->max_subst = INT_MAX;
+  params->max_err = INT_MAX;
+}
+
+#endif /* TRE_APPROX */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-ast.c b/regex/TRE/lib/tre-ast.c
new file mode 100644 (file)
index 0000000..12f8cdc
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+  tre-ast.c - Abstract syntax tree (AST) routines
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <assert.h>
+
+#include "tre-ast.h"
+#include "tre-mem.h"
+
+tre_ast_node_t *
+tre_ast_new_node(tre_mem_t mem, tre_ast_type_t type, size_t size)
+{
+  tre_ast_node_t *node;
+
+  node = tre_mem_calloc(mem, sizeof(*node));
+  if (!node)
+    return NULL;
+  node->obj = tre_mem_calloc(mem, size);
+  if (!node->obj)
+    return NULL;
+  node->type = type;
+  node->nullable = -1;
+  node->submatch_id = -1;
+
+  return node;
+}
+
+tre_ast_node_t *
+tre_ast_new_literal(tre_mem_t mem, int code_min, int code_max, int position)
+{
+  tre_ast_node_t *node;
+  tre_literal_t *lit;
+
+  node = tre_ast_new_node(mem, LITERAL, sizeof(tre_literal_t));
+  if (!node)
+    return NULL;
+  lit = node->obj;
+  lit->code_min = code_min;
+  lit->code_max = code_max;
+  lit->position = position;
+
+  return node;
+}
+
+tre_ast_node_t *
+tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg, int min, int max,
+                int minimal)
+{
+  tre_ast_node_t *node;
+  tre_iteration_t *iter;
+
+  node = tre_ast_new_node(mem, ITERATION, sizeof(tre_iteration_t));
+  if (!node)
+    return NULL;
+  iter = node->obj;
+  iter->arg = arg;
+  iter->min = min;
+  iter->max = max;
+  iter->minimal = minimal;
+  node->num_submatches = arg->num_submatches;
+
+  return node;
+}
+
+tre_ast_node_t *
+tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right)
+{
+  tre_ast_node_t *node;
+
+  node = tre_ast_new_node(mem, UNION, sizeof(tre_union_t));
+  if (node == NULL)
+    return NULL;
+  ((tre_union_t *)node->obj)->left = left;
+  ((tre_union_t *)node->obj)->right = right;
+  node->num_submatches = left->num_submatches + right->num_submatches;
+
+  return node;
+}
+
+tre_ast_node_t *
+tre_ast_new_catenation(tre_mem_t mem, tre_ast_node_t *left,
+                      tre_ast_node_t *right)
+{
+  tre_ast_node_t *node;
+
+  node = tre_ast_new_node(mem, CATENATION, sizeof(tre_catenation_t));
+  if (node == NULL)
+    return NULL;
+  ((tre_catenation_t *)node->obj)->left = left;
+  ((tre_catenation_t *)node->obj)->right = right;
+  node->num_submatches = left->num_submatches + right->num_submatches;
+
+  return node;
+}
+
+#ifdef TRE_DEBUG
+
+static void
+tre_findent(FILE *stream, int i)
+{
+  while (i-- > 0)
+    fputc(' ', stream);
+}
+
+void
+tre_print_params(int *params)
+{
+  int i;
+  if (params)
+    {
+      DPRINT(("params ["));
+      for (i = 0; i < TRE_PARAM_LAST; i++)
+       {
+         if (params[i] == TRE_PARAM_UNSET)
+           DPRINT(("unset"));
+         else if (params[i] == TRE_PARAM_DEFAULT)
+           DPRINT(("default"));
+         else
+           DPRINT(("%d", params[i]));
+         if (i < TRE_PARAM_LAST - 1)
+           DPRINT((", "));
+       }
+      DPRINT(("]"));
+    }
+}
+
+static void
+tre_do_print(FILE *stream, tre_ast_node_t *ast, int indent)
+{
+  int code_min, code_max, pos;
+  int num_tags = ast->num_tags;
+  tre_literal_t *lit;
+  tre_iteration_t *iter;
+
+  tre_findent(stream, indent);
+  switch (ast->type)
+    {
+    case LITERAL:
+      lit = ast->obj;
+      code_min = lit->code_min;
+      code_max = lit->code_max;
+      pos = lit->position;
+      if (IS_EMPTY(lit))
+       {
+         fprintf(stream, "literal empty\n");
+       }
+      else if (IS_ASSERTION(lit))
+       {
+         int i;
+         char *assertions[] = { "bol", "eol", "bracket",
+                                "bow", "eow", "wb", "!wb", "backref" };
+         if (code_max >= ASSERT_LAST << 1)
+           assert(0);
+         fprintf(stream, "assertions: ");
+         for (i = 0; (1 << i) <= ASSERT_LAST; i++)
+           if (code_max & (1 << i))
+             fprintf(stream, "%s ", assertions[i]);
+         fprintf(stream, "\n");
+       }
+      else if (IS_TAG(lit))
+       {
+         fprintf(stream, "tag %d\n", code_max);
+       }
+      else if (IS_BACKREF(lit))
+       {
+         fprintf(stream, "backref %d, pos %d\n", code_max, pos);
+       }
+      else if (IS_PARAMETER(lit))
+       {
+         tre_print_params(lit->u.params);
+         fprintf(stream, "\n");
+       }
+      else
+       {
+         fprintf(stream, "literal (%c, %c) (%d, %d), pos %d, sub %d, "
+                 "%d tags\n", code_min, code_max, code_min, code_max, pos,
+                 ast->submatch_id, num_tags);
+       }
+      break;
+    case ITERATION:
+      iter = ast->obj;
+      fprintf(stream, "iteration {%d, %d}, sub %d, %d tags, %s\n",
+             iter->min, iter->max, ast->submatch_id, num_tags,
+             iter->minimal ? "minimal" : "greedy");
+      tre_do_print(stream, iter->arg, indent + 2);
+      break;
+    case UNION:
+      fprintf(stream, "union, sub %d, %d tags\n", ast->submatch_id, num_tags);
+      tre_do_print(stream, ((tre_union_t *)ast->obj)->left, indent + 2);
+      tre_do_print(stream, ((tre_union_t *)ast->obj)->right, indent + 2);
+      break;
+    case CATENATION:
+      fprintf(stream, "catenation, sub %d, %d tags\n", ast->submatch_id,
+             num_tags);
+      tre_do_print(stream, ((tre_catenation_t *)ast->obj)->left, indent + 2);
+      tre_do_print(stream, ((tre_catenation_t *)ast->obj)->right, indent + 2);
+      break;
+    default:
+      assert(0);
+      break;
+    }
+}
+
+static void
+tre_ast_fprint(FILE *stream, tre_ast_node_t *ast)
+{
+  tre_do_print(stream, ast, 0);
+}
+
+void
+tre_ast_print(tre_ast_node_t *tree)
+{
+  printf("AST:\n");
+  tre_ast_fprint(stdout, tree);
+}
+
+#endif /* TRE_DEBUG */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-ast.h b/regex/TRE/lib/tre-ast.h
new file mode 100644 (file)
index 0000000..3c10b0b
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+  tre-ast.h - Abstract syntax tree (AST) definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+
+#ifndef TRE_AST_H
+#define TRE_AST_H 1
+
+#include <limits.h>
+
+#include "tre-mem.h"
+#include "tre-internal.h"
+#include "tre-compile.h"
+#include "tre-last-matched.h"
+
+/* The different AST node types. */
+typedef enum {
+  LITERAL,
+  CATENATION,
+  ITERATION,
+  UNION
+} tre_ast_type_t;
+
+/* Special subtypes of TRE_LITERAL. */
+#define EMPTY    -1   /* Empty leaf (denotes empty string). */
+#define ASSERTION -2   /* Assertion leaf. */
+#define TAG      -3   /* Tag leaf. */
+#define BACKREF          -4   /* Back reference leaf. */
+#define PARAMETER -5   /* Parameter. */
+
+#define IS_SPECIAL(x)  ((x)->code_min < 0)
+#define IS_EMPTY(x)    ((x)->code_min == EMPTY)
+#define IS_ASSERTION(x) ((x)->code_min == ASSERTION)
+#define IS_TAG(x)      ((x)->code_min == TAG)
+#define IS_BACKREF(x)  ((x)->code_min == BACKREF)
+#define IS_PARAMETER(x) ((x)->code_min == PARAMETER)
+
+#define SUBMATCH_ID_INVISIBLE_START    (INT_MAX / 2 + 1)
+
+
+/* A generic AST node.  All AST nodes consist of this node on the top
+   level with `obj' pointing to the actual content. */
+typedef struct _tre_ast_node {
+  void *obj;             /* Pointer to actual node. */
+  tre_last_matched_branch_pre_t *last_matched_branch;
+  tre_last_matched_pre_t *last_matched_in_progress;
+  tre_pos_and_tags_t *firstpos;
+  tre_pos_and_tags_t *lastpos;
+  /* The original pointer is used to point to the original node, when a
+   * CATENATION and tag are added.  If NULL, this is node is the original */
+  struct _tre_ast_node *original;
+  tre_ast_type_t type;   /* Type of the node. */
+  int submatch_id;
+  int num_submatches;
+  int num_tags;
+  short nullable;
+  short make_branches;
+} tre_ast_node_t;
+
+
+/* A "literal" node.  These are created for assertions, back references,
+   tags, matching parameter settings, and all expressions that match one
+   character. */
+typedef struct {
+  tre_cint_t code_min;
+  tre_cint_t code_max;
+  int position;
+  union {
+    tre_bracket_match_list_t *bracket_match_list;
+    int *params;
+  } u;
+} tre_literal_t;
+
+/* A "catenation" node.         These are created when two regexps are concatenated.
+   If there are more than one subexpressions in sequence, the `left' part
+   holds all but the last, and `right' part holds the last subexpression
+   (catenation is left associative). */
+typedef struct {
+  tre_ast_node_t *left;
+  tre_ast_node_t *right;
+} tre_catenation_t;
+
+/* An "iteration" node.         These are created for the "*", "+", "?", and "{m,n}"
+   operators. */
+typedef struct {
+  /* Subexpression to match. */
+  tre_ast_node_t *arg;
+  /* Minimum number of consecutive matches. */
+  int min;
+  /* Maximum number of consecutive matches. */
+  int max;
+  /* If 0, match as many characters as possible, if 1 match as few as
+     possible. Note that this does not always mean the same thing as
+     matching as many/few repetitions as possible. */
+  unsigned int minimal:1;
+  /* Approximate matching parameters (or NULL). */
+  int *params;
+} tre_iteration_t;
+
+/* An "union" node.  These are created for the "|" operator. */
+typedef struct {
+  tre_ast_node_t *left;
+  tre_ast_node_t *right;
+  /* The left end right end tags if non-zero */
+  int left_tag;
+  int right_tag;
+} tre_union_t;
+
+__private_extern__ tre_ast_node_t *
+tre_ast_new_node(tre_mem_t mem, tre_ast_type_t type, size_t size);
+
+__private_extern__ tre_ast_node_t *
+tre_ast_new_literal(tre_mem_t mem, int code_min, int code_max, int position);
+
+__private_extern__ tre_ast_node_t *
+tre_ast_new_iter(tre_mem_t mem, tre_ast_node_t *arg, int min, int max,
+                int minimal);
+
+__private_extern__ tre_ast_node_t *
+tre_ast_new_union(tre_mem_t mem, tre_ast_node_t *left, tre_ast_node_t *right);
+
+__private_extern__ tre_ast_node_t *
+tre_ast_new_catenation(tre_mem_t mem, tre_ast_node_t *left,
+                      tre_ast_node_t *right);
+
+#ifdef TRE_DEBUG
+void
+tre_ast_print(tre_ast_node_t *tree);
+
+/* XXX - rethink AST printing API */
+void
+tre_print_params(int *params);
+#endif /* TRE_DEBUG */
+
+#endif /* TRE_AST_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-compile.c b/regex/TRE/lib/tre-compile.c
new file mode 100644 (file)
index 0000000..f9ee7d9
--- /dev/null
@@ -0,0 +1,3445 @@
+/*
+  tre-compile.c - TRE regex compiler
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+/*
+  TODO:
+   - Fix tre_ast_to_tnfa() to recurse using a stack instead of recursive
+     function calls.
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <limits.h>
+
+#include "tre-internal.h"
+#include "tre-mem.h"
+#include "tre-stack.h"
+#include "tre-ast.h"
+#include "tre-parse.h"
+#include "tre-compile.h"
+#include "tre.h"
+#include "tre-last-matched.h"
+#include "xmalloc.h"
+
+/*
+  The bit_ffs() macro in bitstring.h is flawed.  Replace it with a working one.
+*/
+#undef bit_ffs
+#define        bit_ffs(name, nbits, value) { \
+       register bitstr_t *_name = name; \
+       register int _byte, _nbits = nbits; \
+       register int _stopbyte = _bit_byte(_nbits), _value = -1; \
+       for (_byte = 0; _byte <= _stopbyte; ++_byte) \
+               if (_name[_byte]) { \
+                       _value = _byte << 3; \
+                       for (_stopbyte = _name[_byte]; !(_stopbyte&0x1); \
+                           ++_value, _stopbyte >>= 1); \
+                       break; \
+               } \
+       *(value) = _value; \
+}
+
+/*
+  Algorithms to setup tags so that submatch addressing can be done.
+*/
+
+
+#ifdef TRE_DEBUG
+static const char *tag_dir_str[] = {
+  "minimize",
+  "maximize",
+  "left-maximize"
+};
+
+static const char _indent[] = "  ";
+
+static void
+print_indent(int indent)
+{
+  while (indent-- > 0)
+    DPRINT((_indent));
+}
+
+static void print_last_matched_pre(tre_last_matched_pre_t *lm, int indent,
+                                  int num_tags);
+static void
+print_last_match_branch_pre(tre_last_matched_branch_pre_t *branch, int indent,
+                           int num_tags)
+{
+  tre_last_matched_pre_t *u = branch->last_matched;
+  int n_last_matched = 0;
+
+  while (u)
+    {
+      n_last_matched++;
+      u = u->next;
+    }
+
+  print_indent(indent);
+  DPRINT(("BRANCH: tot_branches=%d tot_last_matched=%d tot_tags=%d\n",
+         branch->tot_branches, branch->tot_last_matched, branch->tot_tags));
+  print_indent(indent);
+  DPRINT(("..n_last_matched=%d last_matched=%d\n", branch->n_last_matched,
+         n_last_matched));
+  if (branch->n_last_matched != n_last_matched)
+    DPRINT(("*** mismatch between n_last_matched and unions ***\n"));
+  if (branch->cmp_tag > 0)
+    {
+      int i;
+      const char *sep = " tags=";
+      print_indent(indent);
+      DPRINT(("..cmp_tag=%d n_tags=%d", branch->cmp_tag, branch->n_tags));
+      for (i = 0; i < num_tags; i++)
+       if (bit_test(branch->tags, i))
+         {
+           DPRINT(("%s%d", sep, i));
+           sep = ",";
+         }
+      DPRINT(("\n"));
+    }
+
+  u = branch->last_matched;
+  indent++;
+  while (u)
+    {
+      print_last_matched_pre(u, indent, num_tags);
+      u = u->next;
+    }
+}
+
+static void
+print_last_matched_pre(tre_last_matched_pre_t *lm, int indent, int num_tags)
+{
+  tre_last_matched_branch_pre_t *b = lm->branches;
+  int n_branches = 0;
+
+  while (b)
+    {
+      n_branches++;
+      b = b->next;
+    }
+
+  print_indent(indent);
+  DPRINT(("LAST_MATCHED: tot_branches=%d tot_last_matched=%d tot_tags=%d\n",
+         lm->tot_branches, lm->tot_last_matched, lm->tot_tags));
+  print_indent(indent);
+  DPRINT(("..start_tag=%d n_branches=%d branches=%d\n", lm->start_tag,
+         lm->n_branches, n_branches));
+  if (lm->n_branches != n_branches)
+    DPRINT(("*** mismatch between n and branches ***\n"));
+
+  b = lm->branches;
+  indent++;
+  while (b)
+    {
+      print_last_match_branch_pre(b, indent, num_tags);
+      b = b->next;
+    }
+}
+
+static void print_last_matched(tre_last_matched_t *lm, int indent);
+static void
+print_last_match_branch(tre_last_matched_branch_t *branch, int indent)
+{
+  tre_last_matched_t *u;
+  int i;
+
+  print_indent(indent);
+  DPRINT(("BRANCH: n_last_matched=%d\n", branch->n_last_matched));
+  if (branch->cmp_tag > 0)
+    {
+      print_indent(indent);
+      DPRINT(("..cmp_tag=%d n_tags=%d", branch->cmp_tag, branch->n_tags));
+      if (branch->n_tags > 0)
+       {
+         const char *sep = " tags=";
+         for (i = 0; i < branch->n_tags; i++)
+           {
+             DPRINT(("%s%d", sep, branch->tags[i]));
+             sep = ",";
+           }
+       }
+      DPRINT(("\n"));
+    }
+
+  u = branch->last_matched;
+  indent++;
+  for (i = branch->n_last_matched; i > 0; i--, u++)
+    print_last_matched(u, indent);
+}
+
+static void
+print_last_matched(tre_last_matched_t *lm, int indent)
+{
+  int i;
+  tre_last_matched_branch_t *b;
+
+  print_indent(indent);
+  DPRINT(("LAST_MATCHED: n_branches=%d start_tag=%d\n", lm->n_branches,
+         lm->start_tag));
+
+  b = lm->branches;
+  indent++;
+  for (i = lm->n_branches; i > 0; i--, b++)
+    print_last_match_branch(b, indent);
+}
+#endif /* TRE_DEBUG */
+
+
+/* Merge the tre_last_matched_branch_pre_t of src into dst, creating a new
+   one if needed.  If tag_id > 0, add that tag as well (a negative tag_id will
+   create an unset tre_last_matched_branch_pre_t. */
+static reg_errcode_t
+tre_merge_branches(tre_mem_t mem, tre_ast_node_t *dst, tre_ast_node_t *src,
+                  int tag_id, int num_tags)
+{
+  tre_last_matched_branch_pre_t *db = dst->last_matched_branch;
+  tre_last_matched_branch_pre_t *sb = (src ? src->last_matched_branch : NULL);
+
+  if (db)
+    {
+      if (sb)
+       {
+         bitstr_t *l = db->tags;
+         bitstr_t *r = sb->tags;
+         int i = bitstr_size(num_tags);
+
+         while(i-- > 0)
+           *l++ |= *r++;
+         /* db and sb are the info from two parallel sub-trees, so the tags
+            must be mutually exclusive, and we can just add their numbers */
+         db->n_tags += sb->n_tags;
+         db->tot_tags += sb->tot_tags;
+         if (db->last_matched)
+           {
+             if (sb->last_matched)
+               {
+                 tre_last_matched_pre_t *u = db->last_matched;
+
+                 while(u->next)
+                   u = u->next;
+                 u->next = sb->last_matched;
+                 db->n_last_matched += sb->n_last_matched;
+                 db->tot_branches += sb->tot_branches;
+                 db->tot_last_matched += sb->tot_last_matched;
+               }
+           }
+           else if (sb->last_matched)
+             {
+               db->last_matched = sb->last_matched;
+               db->n_last_matched = sb->n_last_matched;
+               db->tot_branches = sb->tot_branches;
+               db->tot_last_matched = sb->tot_last_matched;
+             }
+       }
+    }
+  else
+    db = sb;
+
+  if (tag_id != 0)
+    {
+      if (!db)
+       {
+         db = tre_mem_calloc(mem, sizeof(tre_last_matched_branch_pre_t)
+                             + bitstr_size(num_tags));
+         if (db == NULL)
+           return REG_ESPACE;
+         db->tot_branches = 1;
+       }
+      if (tag_id > 0)
+       {
+         /* tag_id is a new tag, and shouldn't exist in db's tags,
+            so we can always increment n_tags */
+         bit_set(db->tags, tag_id);
+         db->n_tags++;
+         db->tot_tags++;
+       }
+    }
+  dst->last_matched_branch = db;
+  return REG_OK;
+}
+
+
+/* Inserts a catenation node to the root of the tree given in `node'.
+   As the left child a new tag with number `tag_id' to `node' is added,
+   and the right child is the old root. */
+static reg_errcode_t
+tre_add_tag_left(tre_mem_t mem, tre_ast_node_t *node, int tag_id)
+{
+  tre_catenation_t *c;
+
+  DPRINT(("add_tag_left: tag %d\n", tag_id));
+
+  c = tre_mem_alloc(mem, sizeof(*c));
+  if (c == NULL)
+    return REG_ESPACE;
+  c->left = tre_ast_new_literal(mem, TAG, tag_id, -1);
+  if (c->left == NULL)
+    return REG_ESPACE;
+  c->right = tre_mem_calloc(mem, sizeof(tre_ast_node_t));
+  if (c->right == NULL)
+    return REG_ESPACE;
+
+  c->right->obj = node->obj;
+  c->right->type = node->type;
+  c->right->last_matched_branch = node->last_matched_branch;
+  c->right->nullable = -1;
+  c->right->submatch_id = -1;
+  node->obj = c;
+  node->type = CATENATION;
+  node->original = c->right;
+  return REG_OK;
+}
+
+/* Inserts a catenation node to the root of the tree given in `node'.
+   As the right child a new tag with number `tag_id' to `node' is added,
+   and the left child is the old root. */
+static reg_errcode_t
+tre_add_tag_right(tre_mem_t mem, tre_ast_node_t *node, int tag_id)
+{
+  tre_catenation_t *c;
+
+  DPRINT(("tre_add_tag_right: tag %d\n", tag_id));
+
+  c = tre_mem_alloc(mem, sizeof(*c));
+  if (c == NULL)
+    return REG_ESPACE;
+  c->right = tre_ast_new_literal(mem, TAG, tag_id, -1);
+  if (c->right == NULL)
+    return REG_ESPACE;
+  c->left = tre_mem_calloc(mem, sizeof(tre_ast_node_t));
+  if (c->left == NULL)
+    return REG_ESPACE;
+
+  c->left->obj = node->obj;
+  c->left->type = node->type;
+  c->left->last_matched_branch = node->last_matched_branch;
+  c->left->nullable = -1;
+  c->left->submatch_id = -1;
+  node->obj = c;
+  node->type = CATENATION;
+  node->original = c->left;
+  return REG_OK;
+}
+
+typedef enum {
+  ADDTAGS_RECURSE,
+  ADDTAGS_RECURSE_NOT_TOP_UNION,
+  ADDTAGS_AFTER_ITERATION,
+  ADDTAGS_AFTER_UNION_LEFT,
+  ADDTAGS_AFTER_UNION_RIGHT,
+  ADDTAGS_AFTER_CAT_LEFT,
+  ADDTAGS_AFTER_CAT_RIGHT,
+  ADDTAGS_SET_SUBMATCH_END,
+  ADDTAGS_UNION_RECURSE,
+  ADDTAGS_UNION_RIGHT_RECURSE,
+  ADDTAGS_AFTER_UNION_TOP,
+} tre_addtags_symbol_t;
+
+enum {
+  COPY_LAST_MATCHED_BRANCH,
+  COPY_LAST_MATCHED_BRANCH_NEXT,
+  COPY_LAST_MATCHED,
+  COPY_LAST_MATCHED_NEXT,
+};
+
+
+#define REGSET_UNSET           ((unsigned)-1)
+
+/* Go through `regset' and set submatch data for submatches that are
+   using this tag. */
+static void
+tre_purge_regset(unsigned *regset, tre_tnfa_t *tnfa, int tag)
+{
+  int i;
+
+  for (i = 0; regset[i] != REGSET_UNSET; i++)
+    {
+      int id = regset[i] / 2;
+      int start = !(regset[i] % 2);
+      if (id >= SUBMATCH_ID_INVISIBLE_START)
+       continue;
+      DPRINT(("  Using tag %d for %s offset of "
+             "submatch %d\n", tag,
+             start ? "start" : "end", id));
+      if (start)
+       tnfa->submatch_data[id].so_tag = tag;
+      else
+       tnfa->submatch_data[id].eo_tag = tag;
+    }
+  regset[0] = -1;
+}
+
+
+#define REGSET_HAS_STARTS      0x1
+#define REGSET_HAS_ENDS                0x2
+
+
+/* Adds tags to appropriate locations in the parse tree in `tree', so that
+   subexpressions marked for submatch addressing can be traced. */
+static reg_errcode_t
+tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree,
+            tre_tnfa_t *tnfa)
+{
+  reg_errcode_t status = REG_OK;
+  tre_addtags_symbol_t symbol;
+  tre_ast_node_t *node = tree; /* Tree node we are currently looking at. */
+  int bottom = tre_stack_num_objects(stack);
+  /* True for first pass (counting number of needed tags) */
+  int first_pass = (mem == NULL || tnfa == NULL);
+  unsigned *regset, *orig_regset;
+  int regset_contains = 0;
+  int num_tags = 0; /* Total number of tags. */
+  int num_minimals = 0;         /* Number of special minimal tags. */
+  int tag = 0;     /* The tag that is to be added next. */
+  int next_tag = 1; /* Next tag to use after this one. */
+  int minimal_tag = -1; /* Tag that marks the beginning of a minimal match. */
+  int *reorder_tags = NULL; /* Tag reorder array: a pair for each reorder,
+                            * the first is the tag to reorder, the second
+                            * is the tag after which the first is reordered */
+  int *rtp;                /* Pointer used to fill in reorder_tags and
+                            * tag_order */
+  int *to_reorder;          /* Transform array converting sequential order to
+                            * that specified by reorder_tags */
+  int id;
+
+  tre_tag_direction_t direction = TRE_TAG_LEFT_MAXIMIZE;
+  if (!first_pass)
+    {
+      DPRINT(("Initializing direction to %s\n", tag_dir_str[direction]));
+      tnfa->end_tag = 0;
+      tnfa->minimal_tags[0] = -1;
+    }
+
+  regset = xmalloc(sizeof(*regset) * ((tnfa->num_submatches
+                  + tnfa->num_submatches_invisible + 1) * 2));
+  if (regset == NULL)
+    {
+      status = REG_ESPACE;
+      goto error_regset;
+    }
+  regset[0] = REGSET_UNSET;
+  orig_regset = regset;
+
+  if (!first_pass)
+    {
+      /* Allocate all memory for reorder_tags, tag_order, to_seq_order and
+       * to_reorder in one batch (assuming all are the same type) */
+      rtp = reorder_tags = xmalloc(sizeof(*reorder_tags) *
+                                  ((2 * tnfa->num_reorder_tags + 1) +
+                                  tnfa->num_tags));
+      if (reorder_tags == NULL)
+       {
+         status = REG_ESPACE;
+         goto error_reorder_tags;
+       }
+      to_reorder = reorder_tags + (2 * tnfa->num_reorder_tags + 1);
+    }
+
+  STACK_PUSH(stack, voidptr, node);
+  STACK_PUSH(stack, int, ADDTAGS_RECURSE);
+
+  while (tre_stack_num_objects(stack) > bottom)
+    {
+      if (status != REG_OK)
+       break;
+
+      symbol = (tre_addtags_symbol_t)tre_stack_pop_int(stack);
+      switch (symbol)
+       {
+         int top_union;
+
+       case ADDTAGS_SET_SUBMATCH_END:
+         {
+           int i;
+
+           id = tre_stack_pop_int(stack);
+           node = tre_stack_pop_voidptr(stack);
+           /* Add end of this submatch to regset. */
+           for (i = 0; regset[i] != REGSET_UNSET; i++);
+           regset[i] = id * 2 + 1;
+           regset[i + 1] = -1;
+           regset_contains |= REGSET_HAS_ENDS;
+
+           /* Always put a tag after a minimal iterator. */
+           if (minimal_tag >= 0)
+             {
+               if (first_pass)
+                 {
+                   node->num_tags++;
+                   DPRINT(("  ADDTAGS_SET_SUBMATCH_END: node->num_tags = %d\n",
+                           node->num_tags));
+                 }
+               else
+                 {
+                   int i;
+                   status = tre_merge_branches(mem, node, NULL, tag,
+                                               tnfa->num_tags);
+                   if (status != REG_OK)
+                     break;
+                   status = tre_add_tag_right(mem, node, tag);
+                   if (status != REG_OK)
+                     break;
+                   tnfa->tag_directions[tag] = TRE_TAG_MINIMIZE;
+                   DPRINT(("Setting t%d direction to %s\n", tag,
+                           tag_dir_str[tnfa->tag_directions[tag]]));
+                   DPRINT(("Minimal %d, %d\n", minimal_tag, tag));
+                   for (i = 0; tnfa->minimal_tags[i] >= 0; i++);
+                   tnfa->minimal_tags[i] = tag;
+                   tnfa->minimal_tags[i + 1] = minimal_tag;
+                   tnfa->minimal_tags[i + 2] = -1;
+
+                   DPRINT(("  Minimal end: t%d reordered to "
+                           "after t%d\n", tag, minimal_tag));
+                   /* Append to tag_order, move "tag" after
+                    * "minimal_tag" */
+                   *rtp++ = tag;
+                   *rtp++ = minimal_tag;
+
+                   num_minimals++;
+                   tre_purge_regset(regset, tnfa, tag);
+                 }
+
+               minimal_tag = -1;
+               DPRINT(("  ADDTAGS_SET_SUBMATCH_END num_tags++ tag=%d\n", tag));
+               regset[0] = REGSET_UNSET;
+               regset_contains = 0;
+               tag = next_tag;
+               num_tags++;
+               next_tag++;
+             }
+           break;
+         }
+
+       case ADDTAGS_RECURSE_NOT_TOP_UNION:
+         /* Like ADDTAGS_RECURSE, except that top_union is set to zero,
+          * indicating that if a union is being processed, it is not the
+          * top-most of a series */
+         top_union = 0;
+         goto do_addtags_recurse;
+
+       case ADDTAGS_RECURSE:
+         /* Setting top_union to 1 means that if a union is begin processed,
+          * it is the top-most of a series, and should recurse through the
+          * series to set the left_tag and right_tag values */
+         top_union = 1;
+
+do_addtags_recurse:
+         node = tre_stack_pop_voidptr(stack);
+
+         id = node->submatch_id;
+         if (id >= 0)
+           {
+             int i;
+
+
+             /* Add start of this submatch to regset. */
+             for (i = 0; regset[i] != REGSET_UNSET; i++);
+             regset[i] = id * 2;
+             regset[i + 1] = -1;
+             regset_contains |= REGSET_HAS_STARTS;
+
+             /* Add end of this submatch to regset after processing this
+                node. */
+             STACK_PUSH(stack, voidptr, node);
+             STACK_PUSHX(stack, int, id);
+             STACK_PUSHX(stack, int, ADDTAGS_SET_SUBMATCH_END);
+           }
+
+         switch (node->type)
+           {
+           case LITERAL:
+             {
+               tre_literal_t *lit = node->obj;
+
+               if (!IS_SPECIAL(lit) || IS_BACKREF(lit) || IS_EMPTY(lit) || IS_ASSERTION(lit))
+                 {
+                   DPRINT(("Literal %d-%d\n",
+                           (int)lit->code_min, (int)lit->code_max));
+                   if (regset_contains)
+                     {
+                       /* Regset is not empty, so add a tag before the
+                          literal or backref. */
+                       if (first_pass)
+                         {
+                           DPRINT(("  ADDTAGS_RECURSE:LITERAL node->num_tags = 1\n"));
+                           node->num_tags = 1;
+                         }
+                       else
+                         {
+                           status = tre_merge_branches(mem, node, NULL, tag,
+                                                       tnfa->num_tags);
+                           if (status != REG_OK)
+                             break;
+                           status = tre_add_tag_left(mem, node, tag);
+                           if (status != REG_OK)
+                             break;
+                           if (regset_contains == REGSET_HAS_STARTS)
+                             tnfa->tag_directions[tag] = TRE_TAG_LEFT_MAXIMIZE;
+                           else
+                             tnfa->tag_directions[tag] = direction;
+                           DPRINT(("Setting t%d direction to %s\n", tag,
+                                   tag_dir_str[tnfa->tag_directions[tag]]));
+                           tre_purge_regset(regset, tnfa, tag);
+
+                           if (IS_BACKREF(lit))
+                             {
+                               int b = lit->code_max;
+                               int t = tnfa->submatch_data[b].so_tag;
+                               /* Fail if the referenced submatch hasn't been
+                                * completed yet */
+                               if (tnfa->submatch_data[b].eo_tag < 0)
+                                 {
+                                   status = REG_ESUBREG;
+                                   break;
+                                 }
+                               if (t < tag)
+                                 {
+                                   DPRINT(("  Backref %d start: "
+                                           "t%d reordered to before t%d\n",
+                                           b, tag, t));
+                                   if(t > 0)
+                                     t--;
+                                   /* Append to tag_order, move "tag" after
+                                    * "t" */
+                                   *rtp++ = tag;
+                                   *rtp++ = t;
+                                 }
+#if TRE_DEBUG
+                               else
+                                 DPRINT(("  Backref %d start: "
+                                         "(t%d already before t%d)\n",
+                                           b, tag, t));
+#endif /* TRE_DEBUG */
+                             }
+                         }
+
+                       DPRINT(("  ADDTAGS_RECURSE:LITERAL num_tags++ tag=%d\n",
+                               tag));
+                       regset[0] = REGSET_UNSET;
+                       regset_contains = 0;
+                       tag = next_tag;
+                       num_tags++;
+                       next_tag++;
+                     }
+                 }
+               else
+                 {
+                   assert(!IS_TAG(lit));
+                 }
+               break;
+             }
+           case CATENATION:
+             {
+               tre_catenation_t *cat = node->obj;
+               tre_ast_node_t *left = cat->left;
+               tre_ast_node_t *right = cat->right;
+               int reserved_tag = -1;
+               DPRINT(("Catenation, next_tag = %d\n", next_tag));
+
+
+               /* After processing right child. */
+               STACK_PUSHX(stack, voidptr, node);
+               STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_RIGHT);
+
+               /* Process right child. */
+               STACK_PUSHX(stack, voidptr, right);
+               STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+
+               /* After processing left child. */
+               STACK_PUSHX(stack, int, next_tag + left->num_tags);
+               DPRINT(("  Pushing %d for after left\n",
+                       next_tag + left->num_tags));
+               if (left->num_tags > 0 && right->num_tags > 0)
+                 {
+                   /* Reserve the next tag to the right child. */
+                   DPRINT(("  ADDTAGS_RECURSE:CATENATION num_tags++ "
+                           "Reserving next_tag %d to right child\n",
+                           next_tag));
+                   reserved_tag = next_tag;
+                   next_tag++;
+                 }
+               STACK_PUSHX(stack, int, reserved_tag);
+               STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_LEFT);
+
+               /* Process left child. */
+               STACK_PUSHX(stack, voidptr, left);
+               STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+
+               }
+             break;
+           case ITERATION:
+             {
+               tre_iteration_t *iter = node->obj;
+               DPRINT(("Iteration\n"));
+
+               if (first_pass)
+                 STACK_PUSHX(stack, int, regset_contains != 0);
+               STACK_PUSHX(stack, int, tag);
+               STACK_PUSHX(stack, voidptr, node);
+               STACK_PUSHX(stack, int, ADDTAGS_AFTER_ITERATION);
+
+               STACK_PUSHX(stack, voidptr, iter->arg);
+               STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+
+               /* Regset is not empty, so add a tag here (this always happens
+                  because iterators always get submatch id, even if in the
+                  invisible range) */
+               if (regset_contains)
+                 {
+                   if (!first_pass)
+                     {
+                       status = tre_merge_branches(mem, node, NULL, tag,
+                                                   tnfa->num_tags);
+                       if (status != REG_OK)
+                         break;
+                       status = tre_add_tag_left(mem, node, tag);
+                       if (status != REG_OK)
+                         break;
+                       if (regset_contains == REGSET_HAS_STARTS && tag != 0)
+                         tnfa->tag_directions[tag] = iter->minimal ?
+                                                     TRE_TAG_MINIMIZE :
+                                                     TRE_TAG_LEFT_MAXIMIZE;
+                       else
+                         tnfa->tag_directions[tag] = direction;
+                       DPRINT(("Setting t%d direction to %s\n", tag,
+                               tag_dir_str[tnfa->tag_directions[tag]]));
+                       tre_purge_regset(regset, tnfa, tag);
+                     }
+
+                   DPRINT(("  ADDTAGS_RECURSE:ITERATION num_tags++ tag=%d\n",
+                           tag));
+                   regset[0] = REGSET_UNSET;
+                   regset_contains = 0;
+                   tag = next_tag;
+                   num_tags++;
+                   next_tag++;
+                 }
+               direction = TRE_TAG_LEFT_MAXIMIZE;
+               DPRINT(("  Setting direction to %s\n", tag_dir_str[direction]));
+             }
+             break;
+           case UNION:
+             {
+               tre_union_t *uni;
+               tre_ast_node_t *left;
+               tre_ast_node_t *right;
+               int front_tag = -1;
+
+               DPRINT(("Union\n"));
+
+               if (regset_contains)
+                 {
+                   DPRINT(("  UNION num_tags++ tag=%d\n", tag));
+                   front_tag = tag;
+                   tag = next_tag;
+                   num_tags++;
+                   next_tag++;
+                 }
+
+               /* For the top union, walk the tree of consecutive unions,
+                * setting the left_tag and right_tag values in increasing
+                * order (left to right priority) */
+               if (top_union &&
+                   (node->num_submatches -
+                   (node->submatch_id >= 0 &&
+                   node->submatch_id < SUBMATCH_ID_INVISIBLE_START)) > 0)
+                 {
+                   tre_ast_node_t *n;
+                   int last = tre_stack_num_objects(stack);
+
+                   STACK_PUSH(stack, voidptr, node);
+                   STACK_PUSH(stack, int, ADDTAGS_UNION_RECURSE);
+
+                   while (tre_stack_num_objects(stack) > last)
+                     {
+                       symbol = (tre_addtags_symbol_t)tre_stack_pop_int(stack);
+                       switch (symbol)
+                         {
+                         case ADDTAGS_UNION_RECURSE:
+                           n = tre_stack_pop_voidptr(stack);
+                           uni = n->obj;
+                           left = uni->left;
+
+                           /* Since the top union has num_submatches > 0,
+                            * we set all the consecutive union's
+                            * make_branches to 1 to force the generation
+                            * of end tags for each union branch. */
+                           n->make_branches = 1;
+
+                           STACK_PUSH(stack, voidptr, n);
+                           STACK_PUSH(stack, int,
+                                      ADDTAGS_UNION_RIGHT_RECURSE);
+
+                           if (left->type == UNION)
+                             {
+                               STACK_PUSH(stack, voidptr, left);
+                               STACK_PUSH(stack, int,
+                                          ADDTAGS_UNION_RECURSE);
+                             }
+                           else
+                             {
+                               DPRINT(("  ADDTAGS_UNION_RECURSE "
+                                       "num_tags++ tag=%d\n", tag));
+                               uni->left_tag = tag;
+                               tag = next_tag;
+                               num_tags++;
+                               next_tag++;
+                             }
+                           break;
+
+                         case ADDTAGS_UNION_RIGHT_RECURSE:
+                           n = tre_stack_pop_voidptr(stack);
+                           uni = n->obj;
+                           right = uni->right;
+
+                           if (right->type == UNION)
+                             {
+                               STACK_PUSH(stack, voidptr, right);
+                               STACK_PUSH(stack, int,
+                                          ADDTAGS_UNION_RECURSE);
+                             }
+                           else
+                             {
+                               DPRINT(("  ADDTAGS_UNION_RIGHT_RECURSE "
+                                       "num_tags++ tag=%d\n", tag));
+                               uni->right_tag = tag;
+                               tag = next_tag;
+                               num_tags++;
+                               next_tag++;
+                             }
+
+                           break;
+
+                         default:
+                           assert(0);
+                           break;
+
+                         } /* end switch(symbol) */
+                     } /* end while(tre_stack_num_objects(stack) > last */
+                   if (!first_pass)
+                     {
+                       STACK_PUSHX(stack, int, front_tag);
+                       STACK_PUSHX(stack, voidptr, node);
+                       STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_TOP);
+                     }
+                 } /* end if (top_union && ...) */
+
+               uni = node->obj;
+               left = uni->left;
+               right = uni->right;
+
+               /* After processing right child. */
+               STACK_PUSHX(stack, voidptr, regset);
+               STACK_PUSHX(stack, int, regset_contains != 0);
+               STACK_PUSHX(stack, voidptr, node);
+               STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_RIGHT);
+
+               /* Process right child. */
+               STACK_PUSHX(stack, voidptr, right);
+               STACK_PUSHX(stack, int, ADDTAGS_RECURSE_NOT_TOP_UNION);
+
+               /* After processing left child. */
+               STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_LEFT);
+
+               /* Process left child. */
+               STACK_PUSHX(stack, voidptr, left);
+               STACK_PUSHX(stack, int, ADDTAGS_RECURSE_NOT_TOP_UNION);
+
+               /* Regset is not empty, so add a tag here. */
+               if (regset_contains)
+                 {
+                   if (!first_pass)
+                     {
+                       status = tre_merge_branches(mem, node, NULL, front_tag,
+                                                   tnfa->num_tags);
+                       if (status != REG_OK)
+                         break;
+                       status = tre_add_tag_left(mem, node, front_tag);
+                       if (status != REG_OK)
+                         break;
+                       if (regset_contains == REGSET_HAS_STARTS)
+                         tnfa->tag_directions[front_tag] = TRE_TAG_LEFT_MAXIMIZE;
+                       else
+                         tnfa->tag_directions[front_tag] = direction;
+                       DPRINT(("Setting t%d direction to %s\n", front_tag,
+                               tag_dir_str[tnfa->tag_directions[front_tag]]));
+                       tre_purge_regset(regset, tnfa, front_tag);
+                     }
+
+                   regset[0] = REGSET_UNSET;
+                   regset_contains = 0;
+                 }
+
+               break;
+             }
+           } /* end switch (node->type) */
+
+         break; /* end case: ADDTAGS_RECURSE */
+
+       case ADDTAGS_AFTER_ITERATION:
+         {
+           tre_iteration_t *iter;
+           tre_ast_node_t *orig;
+           int enter_tag;
+
+           node = tre_stack_pop_voidptr(stack);
+           orig = node->original ? node->original : node;
+           iter = (tre_iteration_t *)orig->obj;
+           enter_tag = tre_stack_pop_int(stack);
+           if (iter->minimal)
+             minimal_tag = enter_tag;
+
+           DPRINT(("After iteration\n"));
+           if (first_pass)
+             {
+               node->num_tags = iter->arg->num_tags + tre_stack_pop_int(stack);
+               DPRINT(("  ADDTAGS_AFTER_ITERATION: node->num_tags = %d\n",
+                       node->num_tags));
+             }
+           else
+             {
+               /* node->last_matched_branch will have the start tag (the tag
+                  just *before* the iteration).  iter->arg->last_matched_branch
+                  will have the tag(s) inside the iteration, the ones that
+                  may need to be reset if the iteration doesn't match.  So
+                  before we merge iter->arg into node, we need to set up
+                  a new tre_last_matched_t and tre_last_matched_branch_t,
+                  using any of the inside tags as cmp_tag (we choose the first
+                  tag found by bit_ffs).  If there are no inside tags, we
+                  don't bother creating the extra structures. */
+               tre_last_matched_branch_pre_t *b =
+                                               iter->arg->last_matched_branch;
+
+               if (b && b->n_tags > 0)
+                 {
+                   tre_last_matched_pre_t *u;
+
+                   bit_ffs(b->tags, num_tags, &b->cmp_tag);
+                   DPRINT(("  ADDTAGS_AFTER_ITERATION: n_tags=%d "
+                           "cmp_tag = %d\n", b->n_tags, b->cmp_tag));
+
+                   u = tre_mem_calloc(mem, sizeof(tre_last_matched_pre_t) +
+                                      sizeof(tre_last_matched_branch_pre_t)
+                                      + bitstr_size(num_tags));
+                   if (!u)
+                     {
+                       status = REG_ESPACE;
+                       break;
+                     }
+                   u->branches = b;
+                   u->n_branches = 1;
+                   u->start_tag = b->cmp_tag;
+                   u->tot_branches = b->tot_branches;
+                   u->tot_last_matched = 1 + b->tot_last_matched;
+                   u->tot_tags = b->tot_tags;
+
+                   b = (tre_last_matched_branch_pre_t *)(u + 1);
+                   b->last_matched = u;
+                   b->n_last_matched = 1;
+                   b->tot_branches = 1 + u->tot_branches;
+                   b->tot_last_matched = u->tot_last_matched;
+                   b->tot_tags = u->tot_tags;
+
+                   iter->arg->last_matched_branch = b;
+                 }
+               status = tre_merge_branches(mem, node, iter->arg, 0,
+                                           tnfa->num_tags);
+               if (status != REG_OK)
+                 break;
+
+               if (iter->minimal)
+                 {
+                   /* Add a union with a left EMPTY literal and the right
+                      being iter->arg.  This should force the tags inside
+                      the minimal iteration to prefer being unset */
+                   if (iter->min == 0 && iter->max <= 1)
+                     {
+                       tre_ast_node_t *u, *e;
+
+                       e = tre_ast_new_literal(mem, EMPTY, -1, -1);
+                       if (e == NULL)
+                         {
+                           status = REG_ESPACE;
+                           break;
+                         }
+                       u = tre_ast_new_union(mem, e, iter->arg);
+                       if (u == NULL)
+                         {
+                           status = REG_ESPACE;
+                           break;
+                         }
+                       iter->arg = u;
+                     }
+
+                   direction = TRE_TAG_MINIMIZE;
+                 }
+               else
+                 direction = TRE_TAG_MAXIMIZE;
+               DPRINT(("  Setting direction to %s\n", tag_dir_str[direction]));
+             }
+           break;
+         }
+
+       case ADDTAGS_AFTER_CAT_LEFT:
+         {
+           int new_tag = tre_stack_pop_int(stack);
+           next_tag = tre_stack_pop_int(stack);
+           DPRINT(("After cat left, tag = %d, next_tag = %d\n",
+                   tag, next_tag));
+           if (new_tag >= 0)
+             {
+               DPRINT(("  Setting tag to %d\n", new_tag));
+               tag = new_tag;
+             }
+           break;
+         }
+
+       case ADDTAGS_AFTER_CAT_RIGHT:
+         {
+           tre_catenation_t *cat;
+
+           DPRINT(("After cat right\n"));
+           node = tre_stack_pop_voidptr(stack);
+           cat = node->obj;
+           if (first_pass)
+             {
+               node->num_tags = cat->left->num_tags + cat->right->num_tags;
+               DPRINT(("  ADDTAGS_AFTER_CAT_RIGHT: node->num_tags = %d\n",
+                       node->num_tags));
+             }
+           else
+             {
+               status = tre_merge_branches(mem, cat->left, cat->right, 0,
+                                           tnfa->num_tags);
+               if (status != REG_OK)
+                 break;
+               status = tre_merge_branches(mem, node, cat->left, 0,
+                                           tnfa->num_tags);
+             }
+           break;
+         }
+
+       case ADDTAGS_AFTER_UNION_LEFT:
+         DPRINT(("After union left\n"));
+         /* Lift the bottom of the `regset' array so that when processing
+            the right operand the items currently in the array are
+            invisible.  The original bottom was saved at ADDTAGS_UNION and
+            will be restored at ADDTAGS_AFTER_UNION_RIGHT below. */
+         while (*regset != REGSET_UNSET)
+           regset++;
+         regset_contains = 0;
+         break;
+
+       case ADDTAGS_AFTER_UNION_RIGHT:
+         {
+           int added_tags;
+           tre_ast_node_t *orig;
+           tre_union_t *uni;
+           /* Note: node may not be a UNION, but a CATENATION with a left
+            * tag.  So that is why we pass the original node->obj on the
+            * stack, to get the union's true values. */
+
+           DPRINT(("After union right\n"));
+           node = tre_stack_pop_voidptr(stack);
+           orig = node->original ? node->original : node;
+           uni = (tre_union_t *)orig->obj;
+           added_tags = tre_stack_pop_int(stack);
+           if (first_pass)
+             {
+               node->num_tags = uni->left->num_tags + uni->right->num_tags
+                                + added_tags;
+               if (uni->left_tag > 0)
+                 node->num_tags++;
+               if (uni->right_tag > 0)
+                 node->num_tags++;
+               DPRINT(("  ADDTAGS_AFTER_UNION_RIGHT: node->num_tags = %d\n",
+                       node->num_tags));
+             }
+           regset = tre_stack_pop_voidptr(stack);
+
+           /* Add tags after both children, the left child gets a smaller
+              tag than the right child.  This guarantees that we prefer
+              the left child over the right child. */
+           /* XXX - This is not always necessary (if the children have
+              tags which must be seen for every match of that child). */
+           if (!first_pass && node->make_branches)
+             {
+               tre_last_matched_branch_pre_t *lb =
+                 uni->left->last_matched_branch;
+               tre_last_matched_branch_pre_t *rb =
+                 uni->right->last_matched_branch;
+               tre_last_matched_pre_t *lu =
+                 uni->left->last_matched_in_progress;
+               tre_last_matched_pre_t *ru =
+                 uni->right->last_matched_in_progress;
+               tre_last_matched_pre_t *u;
+               /* We don't need to call tre_merge_branches because these
+                * tags don't participate in submatch ranges, so don't need
+                * to be recorded.  But we do set the cmp_tag entry of the
+                * tre_last_matched_branch_pre_t, so we might call
+                * tre_merge_branches if we need to create an empty
+                * tre_last_matched_branch_pre_t. */
+               if (uni->left_tag > 0)
+                 {
+                   DPRINT(("Setting t%d direction to maximize\n",
+                           uni->left_tag));
+                   status = tre_add_tag_right(mem, uni->left, uni->left_tag);
+                   if (status != REG_OK)
+                     break;
+                   tnfa->tag_directions[uni->left_tag] = TRE_TAG_MAXIMIZE;
+                   if (!lb)
+                     {
+                       status = tre_merge_branches(mem, uni->left, NULL, -1,
+                                                   tnfa->num_tags);
+                       if (status != REG_OK)
+                         break;
+                       lb = uni->left->last_matched_branch;
+                     }
+                   lb->cmp_tag = uni->left_tag;
+                 }
+               if (uni->right_tag > 0)
+                 {
+                   DPRINT(("Setting t%d direction to maximize\n",
+                           uni->right_tag));
+                   status = tre_add_tag_right(mem, uni->right, uni->right_tag);
+                   if (status != REG_OK)
+                     break;
+                   tnfa->tag_directions[uni->right_tag] = TRE_TAG_MAXIMIZE;
+                   if (!rb)
+                     {
+                       status = tre_merge_branches(mem, uni->right, NULL, -1,
+                                                   tnfa->num_tags);
+                       if (status != REG_OK)
+                         break;
+                       rb = uni->right->last_matched_branch;
+                     }
+                   rb->cmp_tag = uni->right_tag;
+                 }
+               /* Now merge the tre_last_matched_branch_pre_t into a
+                  tre_last_matched_pre_t */
+               if (lu == NULL)
+                 {
+                   if (ru == NULL)
+                     {
+                       /* Create a new tre_last_matched_pre_t */
+                       u = tre_mem_calloc(mem, sizeof(tre_last_matched_pre_t));
+                       if (!u)
+                         {
+                           status = REG_ESPACE;
+                           break;
+                         }
+                       u->tot_last_matched = 1;
+
+                       if (lb)
+                         {
+                           u->branches = lb;
+                           u->n_branches = 1;
+                           u->tot_branches += lb->tot_branches;
+                           u->tot_last_matched += lb->tot_last_matched;
+                           u->tot_tags += lb->tot_tags;
+                           if (rb)
+                             {
+                               lb->next = rb;
+                               u->n_branches++;
+                               u->tot_branches += rb->tot_branches;
+                               u->tot_last_matched += rb->tot_last_matched;
+                               u->tot_tags += rb->tot_tags;
+                             }
+                         }
+                       else if (rb)
+                         {
+                           u->branches = rb;
+                           u->n_branches = 1;
+                           u->tot_branches += rb->tot_branches;
+                           u->tot_last_matched += rb->tot_last_matched;
+                           u->tot_tags += rb->tot_tags;
+                         }
+                     }
+                   else
+                     {
+                       /* Use ru, and add lb */
+                       u = ru;
+                       if (lb)
+                         {
+                           lb->next = u->branches;
+                           u->branches = lb;
+                           u->n_branches++;
+                           u->tot_branches += lb->tot_branches;
+                           u->tot_last_matched += lb->tot_last_matched;
+                           u->tot_tags += lb->tot_tags;
+                         }
+                     }
+                 }
+               else if (ru == NULL)
+                 {
+                   /* Use lu, and add rb */
+                   u = lu;
+                   if (rb)
+                     {
+                       rb->next = u->branches;
+                       u->branches = rb;
+                       u->n_branches++;
+                       u->tot_branches += rb->tot_branches;
+                       u->tot_last_matched += rb->tot_last_matched;
+                       u->tot_tags += rb->tot_tags;
+                     }
+                 }
+               else
+                 {
+                   /* Merge lu and ru into lu */
+                   if (lu->branches)
+                     {
+                       if (ru->branches)
+                         {
+                           tre_last_matched_branch_pre_t *b = lu->branches;
+                           while (b->next) b = b->next;
+                           b->next = ru->branches;
+                           lu->n_branches += ru->n_branches;
+                         }
+                     }
+                   else if (ru->branches)
+                     {
+                       lu->branches = ru->branches;
+                       lu->n_branches = ru->n_branches;
+                     }
+                   lu->tot_branches += ru->tot_branches;
+                   lu->tot_last_matched += ru->tot_last_matched - 1;
+                   lu->tot_tags += ru->tot_tags;
+                   u = lu;
+                 }
+               node->last_matched_in_progress = u;
+             }
+           direction = TRE_TAG_MAXIMIZE;
+           break;
+         }
+
+       case ADDTAGS_AFTER_UNION_TOP: /* only called when not first_pass */
+         {
+           tre_last_matched_branch_pre_t *b;
+           tre_last_matched_pre_t *u;
+           int start_tag;
+
+           DPRINT(("After union top\n"));
+           node = tre_stack_pop_voidptr(stack);
+           start_tag = tre_stack_pop_int(stack);
+           b = tre_mem_calloc(mem, sizeof(tre_last_matched_branch_pre_t)
+                              + bitstr_size(num_tags));
+           if (!b)
+             {
+               status = REG_ESPACE;
+               break;
+             }
+
+           u = node->last_matched_in_progress;
+           u->start_tag = start_tag;
+           b->tot_branches = 1 + u->tot_branches;
+           b->tot_last_matched = u->tot_last_matched;
+           b->tot_tags = u->tot_tags;
+           b->last_matched = u;
+           b->n_last_matched = 1;
+           node->last_matched_branch = b;
+           node->last_matched_in_progress = NULL;
+           break;
+         }
+
+       default:
+         assert(0);
+         break;
+
+       } /* end switch(symbol) */
+    } /* end while(tre_stack_num_objects(stack) > bottom) */
+
+  if (status != REG_OK)
+    {
+      DPRINT(("Error during %s pass\n", first_pass ? "first" : "second"));
+      goto error_post_compile;
+    }
+
+  if (!first_pass)
+    {
+      int i;
+      if (num_tags != tnfa->num_tags)
+       {
+         DPRINT(("num_tags(%d) != tnfa->num_tags(%d)\n", num_tags,
+                 tnfa->num_tags));
+         status = REG_BADPAT;
+         goto error_post_compile;
+       }
+
+      tre_purge_regset(regset, tnfa, tag);
+      DPRINT(("Setting t%d to %s\n", num_tags,
+             tag_dir_str[direction]));
+      tnfa->tag_directions[num_tags] = direction;
+
+      if (rtp > reorder_tags + 2 * tnfa->num_reorder_tags)
+       {
+         DPRINT(("Processed %d reorder tags instead of %d\n",
+                 (int)(rtp - reorder_tags) / 2, tnfa->num_reorder_tags));
+         status = REG_BADPAT;
+         goto error_post_compile;
+       }
+    *rtp = -1;
+#if TRE_DEBUG
+      if (reorder_tags[0] >= 0)
+       {
+         DPRINT(("reorder_tags:\n"));
+         for (rtp = reorder_tags; *rtp >= 0;)
+           {
+             DPRINT(("%d after ", *rtp++));
+             DPRINT(("%d\n", *rtp++));
+           }
+       }
+       else
+         DPRINT(("No reorder_tags\n"));
+#endif /* TRE_DEBUG */
+
+      /* Initialize to_reorder */
+      for (i = 0; i < num_tags; i++)
+       to_reorder[i] = i;
+      /* Use to_seq_order to convert reorder_tags values, and use those to
+       * reorder to_reorder */
+      for (rtp = reorder_tags; *rtp >= 0;)
+       {
+         int j, high, low;
+         int ti = *rtp++;
+
+         /* Skip reordering the final tag */
+         if (ti >= num_tags)
+           {
+             DPRINT(("Skipping reorder of %d\n", ti));
+             rtp++;
+             continue;
+           }
+         /* The number of the tag to reorder */
+         high = to_reorder[ti];
+         /* Reorder after this tag */
+         low = to_reorder[*rtp++];
+
+         DPRINT(("ti=%d high=%d low=%d\n", ti, high, low));
+         if (low > high)
+           {
+             DPRINT(("Tag %d already before %d\n", high, low));
+             continue;
+           }
+         for (j = 0; j < num_tags; j++)
+           if (to_reorder[j] > low && to_reorder[j] < high)
+             to_reorder[j]++;
+         to_reorder[ti] = low + 1;
+#ifdef TRE_DEBUG
+         DPRINT(("to_reorder=("));
+         for (j = 0; j < num_tags; j++)
+           {
+             DPRINT(("%d", to_reorder[j]));
+             if (j < num_tags - 1)
+               DPRINT((","));
+           }
+         DPRINT((")\n"));
+#endif /* TRE_DEBUG */
+       }
+      /* Determine if reordering in really necessary */
+      {
+       int need_reorder = 0;
+       for (i = 0; i < num_tags; i++)
+         if(to_reorder[i] != i)
+           {
+             need_reorder = 1;
+             break;
+           }
+       /* If need_reorder is not set, free reorder_tags, and set to NULL,
+        * indicating no reordering is needed */
+       if (!need_reorder)
+         {
+           DPRINT(("Don't need to reorder\n"));
+           xfree(reorder_tags);
+           reorder_tags = NULL;
+         }
+      }
+    }
+
+  if (reorder_tags)
+    {
+      int i;
+      tre_tag_direction_t *new_tag_directions;
+#if TRE_DEBUG
+      DPRINT(("to_reorder:"));
+      for (i = 0; i < num_tags; i++)
+       DPRINT((" %d->%d", i, to_reorder[i]));
+      DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+
+      DPRINT(("Reordering submatch_data\n"));
+      for (i = 0; i < tnfa->num_submatches; i++)
+       {
+#if TRE_DEBUG
+         int so = tnfa->submatch_data[i].so_tag;
+         int eo = tnfa->submatch_data[i].eo_tag;
+#endif /* TRE_DEBUG */
+         tnfa->submatch_data[i].so_tag =
+           to_reorder[tnfa->submatch_data[i].so_tag];
+         tnfa->submatch_data[i].eo_tag =
+           tnfa->submatch_data[i].eo_tag < num_tags ?
+           to_reorder[tnfa->submatch_data[i].eo_tag] :
+           tnfa->submatch_data[i].eo_tag;
+         DPRINT(("pmatch[%d]: {%d, %d}->{%d, %d}\n", i, so, eo,
+                 tnfa->submatch_data[i].so_tag,
+                 tnfa->submatch_data[i].eo_tag));
+       }
+
+      DPRINT(("Reordering tag_directions\n"));
+      /* We only allocate num_tags directions and reorder them.  The
+       * num_tags-th direction (end tag) is left unchanged. */
+      new_tag_directions = xmalloc(sizeof(*new_tag_directions) * num_tags);
+      if (new_tag_directions == NULL)
+       {
+         status = REG_ESPACE;
+         goto error_post_compile;
+       }
+      for (i = 0; i < num_tags; i++)
+       {
+         new_tag_directions[to_reorder[i]] = tnfa->tag_directions[i];
+       }
+#if TRE_DEBUG
+      for (i = 0; i < num_tags; i++)
+       {
+         DPRINT(("t%d %s->%s\n", i,
+                 tag_dir_str[tnfa->tag_directions[i]],
+                 tag_dir_str[new_tag_directions[i]]));
+       }
+       DPRINT(("t%d %s->%s\n", num_tags,
+               tag_dir_str[tnfa->tag_directions[num_tags]],
+               tag_dir_str[tnfa->tag_directions[num_tags]]));
+#endif /* TRE_DEBUG */
+      memcpy(tnfa->tag_directions, new_tag_directions, sizeof(*new_tag_directions) * num_tags);
+      xfree(new_tag_directions);
+
+      DPRINT(("Reordering minimal_tags\n"));
+      for (i = 0; tnfa->minimal_tags[i] >= 0; i++)
+       tnfa->minimal_tags[i] = tnfa->minimal_tags[i] < num_tags ?
+                               to_reorder[tnfa->minimal_tags[i]] :
+                               tnfa->minimal_tags[i];
+
+      DPRINT(("Reordering AST tags\n"));
+      STACK_PUSH(stack, voidptr, tree);
+      while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
+       {
+         node = tre_stack_pop_voidptr(stack);
+
+         switch (node->type)
+           {
+           case LITERAL:
+             {
+               tre_literal_t *lit = (tre_literal_t *)node->obj;
+               if (IS_TAG(lit))
+                 lit->code_max = to_reorder[lit->code_max];
+               break;
+             }
+
+           case UNION:
+             {
+               tre_union_t *uni = (tre_union_t *)node->obj;
+               STACK_PUSHX(stack, voidptr, uni->right);
+               STACK_PUSHX(stack, voidptr, uni->left);
+               break;
+             }
+
+           case CATENATION:
+             {
+               tre_catenation_t *cat = (tre_catenation_t *)node->obj;
+               STACK_PUSHX(stack, voidptr, cat->right);
+               STACK_PUSHX(stack, voidptr, cat->left);
+               break;
+             }
+
+           case ITERATION:
+             {
+               tre_iteration_t *iter = (tre_iteration_t *)node->obj;
+               STACK_PUSHX(stack, voidptr, iter->arg);
+               break;
+             }
+
+           default:
+             assert(0);
+             break;
+           }
+       }
+       if (status != REG_OK)
+         {
+           DPRINT(("Error while reordering tags\n"));
+           goto error_post_compile;
+         }
+    }
+
+
+  if (!first_pass)
+    {
+      if (tree->last_matched_branch)
+       {
+         tre_last_matched_branch_t *buf, *b, *bb;
+         tre_last_matched_branch_pre_t *bp;
+         tre_last_matched_t *u, *uu;
+         tre_last_matched_pre_t *up;
+         int *t;
+         int i;
+#ifdef TRE_DEBUG
+         tre_last_matched_branch_t *_b;
+         tre_last_matched_t *_u;
+         int *_t;
+
+         DPRINT(("last_match_branch_pre:\n"));
+         print_last_match_branch_pre(tree->last_matched_branch, 0, num_tags);
+#endif /* TRE_DEBUG */
+         buf = (tre_last_matched_branch_t *)xcalloc(1,
+                                    tree->last_matched_branch->tot_branches
+                                    * sizeof(tre_last_matched_branch_t) +
+                                    tree->last_matched_branch->tot_last_matched
+                                    * sizeof(tre_last_matched_t) +
+                                    tree->last_matched_branch->tot_tags *
+                                    sizeof(int));
+         if (!buf)
+           {
+             status = REG_ESPACE;
+             goto error_post_compile;
+           }
+
+         b = buf;
+         u = (tre_last_matched_t *)(b +
+             tree->last_matched_branch->tot_branches);
+         t = (int *)(u + tree->last_matched_branch->tot_last_matched);
+#ifdef TRE_DEBUG
+         _b = b;
+         _u = u;
+         _t = t;
+#endif /* TRE_DEBUG */
+         DPRINT(("Copying info_pre to info\n"));
+         STACK_PUSH(stack, voidptr, tree->last_matched_branch);
+         STACK_PUSH(stack, int, 1);
+         STACK_PUSH(stack, int, COPY_LAST_MATCHED_BRANCH);
+
+         while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
+           {
+             switch (tre_stack_pop_int(stack))
+               {
+               case COPY_LAST_MATCHED_BRANCH:
+                 i = tre_stack_pop_int(stack);
+                 /* The tre_last_matched_branch_pre_t * is still on the
+                    stack */
+                 STACK_PUSHX(stack, voidptr, b);
+                 STACK_PUSHX(stack, int, COPY_LAST_MATCHED_BRANCH_NEXT);
+                 b += i;
+                 break;
+
+               case COPY_LAST_MATCHED_BRANCH_NEXT:
+                 bb = tre_stack_pop_voidptr(stack);
+                 bp = tre_stack_pop_voidptr(stack);
+                 bb->n_last_matched = bp->n_last_matched;
+                 bb->cmp_tag = bp->cmp_tag;
+                 if (bp->n_tags > 0)
+                   {
+                     int n;
+                     n = bb->n_tags = bp->n_tags;
+                     bb->tags = t;
+                     for (i = 0; i < num_tags; i++)
+                       if (bit_test(bp->tags, i))
+                         {
+                           *t++ = i;
+                           if (--n <= 0)
+                             break;
+                         }
+                   }
+                 if (bp->next)
+                   {
+                     STACK_PUSHX(stack, voidptr, bp->next);
+                     STACK_PUSHX(stack, voidptr, bb + 1);
+                     STACK_PUSHX(stack, int, COPY_LAST_MATCHED_BRANCH_NEXT);
+                   }
+                 if (bp->n_last_matched > 0)
+                   {
+                     bb->last_matched = u;
+                     STACK_PUSHX(stack, voidptr, bp->last_matched);
+                     STACK_PUSHX(stack, int, bp->n_last_matched);
+                     STACK_PUSHX(stack, int, COPY_LAST_MATCHED);
+                   }
+                 break;
+
+               case COPY_LAST_MATCHED:
+                 i = tre_stack_pop_int(stack);
+                 /* The tre_last_matched_pre_t * is still on the stack */
+                 STACK_PUSHX(stack, voidptr, u);
+                 STACK_PUSHX(stack, int, COPY_LAST_MATCHED_NEXT);
+                 u += i;
+                 break;
+
+               case COPY_LAST_MATCHED_NEXT:
+                 uu = tre_stack_pop_voidptr(stack);
+                 up = tre_stack_pop_voidptr(stack);
+                 uu->n_branches = up->n_branches;
+                 uu->branches = b;
+                 uu->start_tag = up->start_tag;
+                 if (up->next)
+                   {
+                     STACK_PUSHX(stack, voidptr, up->next);
+                     STACK_PUSHX(stack, voidptr, uu + 1);
+                     STACK_PUSHX(stack, int, COPY_LAST_MATCHED_NEXT);
+                   }
+                 STACK_PUSHX(stack, voidptr, up->branches);
+                 STACK_PUSHX(stack, int, up->n_branches);
+                 STACK_PUSHX(stack, int, COPY_LAST_MATCHED_BRANCH);
+                 break;
+               }
+           }
+         if (status != REG_OK)
+           goto error_post_compile;
+#ifdef TRE_DEBUG
+         DPRINT(("last_matched_branch:\n"));
+         print_last_match_branch(buf, 0);
+         if (b != _b + tree->last_matched_branch->tot_branches)
+           DPRINT(("b/%p != _b + tree->last_matched_branch->tot_branches/%p\n",
+                   b, _b + tree->last_matched_branch->tot_branches));
+         if (u != _u + tree->last_matched_branch->tot_last_matched)
+           DPRINT(("u/%p != _u + "
+                   "tree->last_matched_branch->tot_last_matched/%p\n",
+                   u, _u + tree->last_matched_branch->tot_last_matched));
+         if (t != _t + tree->last_matched_branch->tot_tags)
+           DPRINT(("t/%p != _t + tree->last_matched_branch->tot_tags/%p\n",
+                   t, _t + tree->last_matched_branch->tot_tags));
+#endif /* TRE_DEBUG */
+         tnfa->last_matched_branch = buf;
+       }
+#ifdef TRE_DEBUG
+      else
+       DPRINT(("No last_match_branch_pre\n"));
+#endif /* TRE_DEBUG */
+    }
+
+  DPRINT(("tre_add_tags: %s complete.  Number of tags %d.\n",
+         first_pass? "First pass" : "Second pass", num_tags));
+#ifdef TRE_DEBUG
+  tre_ast_print(tree);
+#endif /* TRE_DEBUG */
+  DPRINT(("tre_add_tags: tree->num_tags=%d num_tags=%d\n", tree->num_tags,
+         num_tags));
+  assert(tree->num_tags == num_tags);
+  tnfa->end_tag = num_tags;
+  tnfa->num_tags = num_tags;
+  tnfa->num_minimals = num_minimals;
+error_post_compile:
+  xfree(reorder_tags);
+error_reorder_tags:
+  xfree(orig_regset);
+error_regset:
+  return status;
+}
+
+
+
+/*
+  AST to TNFA compilation routines.
+*/
+
+typedef enum {
+  COPY_RECURSE,
+  COPY_SET_RESULT_PTR
+} tre_copyast_symbol_t;
+
+/* Flags for tre_copy_ast(). */
+#define COPY_REMOVE_TAGS        1
+#define COPY_MAXIMIZE_FIRST_TAG         2
+
+static reg_errcode_t
+tre_copy_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast,
+            int flags, int *pos_add, tre_tag_direction_t *tag_directions,
+            tre_ast_node_t **copy, int *max_pos)
+{
+  reg_errcode_t status = REG_OK;
+  int bottom = tre_stack_num_objects(stack);
+  int num_copied = 0;
+  int first_tag = 1;
+  tre_ast_node_t **result = copy;
+  tre_copyast_symbol_t symbol;
+
+  STACK_PUSH(stack, voidptr, ast);
+  STACK_PUSH(stack, int, COPY_RECURSE);
+
+  while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
+    {
+      tre_ast_node_t *node;
+      if (status != REG_OK)
+       break;
+
+      symbol = (tre_copyast_symbol_t)tre_stack_pop_int(stack);
+      switch (symbol)
+       {
+       case COPY_SET_RESULT_PTR:
+         result = tre_stack_pop_voidptr(stack);
+         break;
+       case COPY_RECURSE:
+         node = tre_stack_pop_voidptr(stack);
+         switch (node->type)
+           {
+           case LITERAL:
+             {
+               tre_literal_t *lit = node->obj;
+               int pos = lit->position;
+               int min = lit->code_min;
+               int max = lit->code_max;
+               tre_bracket_match_list_t *list = !IS_SPECIAL(lit) ?
+                                                 lit->u.bracket_match_list :
+                                                 NULL;
+               if (!IS_SPECIAL(lit) || IS_BACKREF(lit))
+                 {
+                   /* XXX - e.g. [ab] has only one position but two
+                      nodes, so we are creating holes in the state space
+                      here.  Not fatal, just wastes memory. */
+                   pos += *pos_add;
+                   num_copied++;
+                 }
+               else if (IS_TAG(lit) && (flags & COPY_REMOVE_TAGS))
+                 {
+                   /* Change this tag to empty. */
+                   min = EMPTY;
+                   max = pos = -1;
+                 }
+               else if (IS_TAG(lit) && (flags & COPY_MAXIMIZE_FIRST_TAG)
+                        && first_tag)
+                 {
+                   /* Maximize the first tag. */
+                   if (tag_directions[max] == TRE_TAG_LEFT_MAXIMIZE)
+                     tag_directions[max] = TRE_TAG_MAXIMIZE;
+                   first_tag = 0;
+                 }
+               *result = tre_ast_new_literal(mem, min, max, pos);
+               if (*result == NULL)
+                 status = REG_ESPACE;
+
+               if (pos > *max_pos)
+                 *max_pos = pos;
+
+               if (!IS_SPECIAL(lit))
+                 ((tre_literal_t *)(*result)->obj)->u.bracket_match_list
+                     = list;
+               break;
+             }
+           case UNION:
+             {
+               tre_union_t *uni = node->obj;
+               tre_union_t *tmp;
+               *result = tre_ast_new_union(mem, uni->left, uni->right);
+               if (*result == NULL)
+                 {
+                   status = REG_ESPACE;
+                   break;
+                 }
+               tmp = (*result)->obj;
+               result = &tmp->left;
+               STACK_PUSHX(stack, voidptr, uni->right);
+               STACK_PUSHX(stack, int, COPY_RECURSE);
+               STACK_PUSHX(stack, voidptr, &tmp->right);
+               STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
+               STACK_PUSHX(stack, voidptr, uni->left);
+               STACK_PUSHX(stack, int, COPY_RECURSE);
+               break;
+             }
+           case CATENATION:
+             {
+               tre_catenation_t *cat = node->obj;
+               tre_catenation_t *tmp;
+               *result = tre_ast_new_catenation(mem, cat->left, cat->right);
+               if (*result == NULL)
+                 {
+                   status = REG_ESPACE;
+                   break;
+                 }
+               tmp = (*result)->obj;
+               tmp->left = NULL;
+               tmp->right = NULL;
+               result = &tmp->left;
+
+               STACK_PUSHX(stack, voidptr, cat->right);
+               STACK_PUSHX(stack, int, COPY_RECURSE);
+               STACK_PUSHX(stack, voidptr, &tmp->right);
+               STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
+               STACK_PUSHX(stack, voidptr, cat->left);
+               STACK_PUSHX(stack, int, COPY_RECURSE);
+               break;
+             }
+           case ITERATION:
+             {
+               tre_iteration_t *iter = node->obj;
+               STACK_PUSHX(stack, voidptr, iter->arg);
+               STACK_PUSHX(stack, int, COPY_RECURSE);
+               *result = tre_ast_new_iter(mem, iter->arg, iter->min,
+                                          iter->max, iter->minimal);
+               if (*result == NULL)
+                 {
+                   status = REG_ESPACE;
+                   break;
+                 }
+               iter = (*result)->obj;
+               result = &iter->arg;
+               break;
+             }
+           default:
+             assert(0);
+             break;
+           }
+         break;
+       }
+    }
+  *pos_add += num_copied;
+  return status;
+}
+
+typedef enum {
+  EXPAND_RECURSE,
+  EXPAND_AFTER_ITER
+} tre_expand_ast_symbol_t;
+
+/* Expands each iteration node that has a finite nonzero minimum or maximum
+   iteration count to a catenated sequence of copies of the node. */
+static reg_errcode_t
+tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast,
+              int *position, tre_tag_direction_t *tag_directions,
+              int *max_depth)
+{
+  reg_errcode_t status = REG_OK;
+  int bottom = tre_stack_num_objects(stack);
+  int pos_add = 0;
+  int pos_add_total = 0;
+  int max_pos = 0;
+#ifdef TRE_APPROX
+  /* Current approximate matching parameters. */
+  int params[TRE_PARAM_LAST];
+  /* Approximate parameter nesting level. */
+  int params_depth = 0;
+#endif /* TRE_APPROX */
+  int iter_depth = 0;
+#ifdef TRE_APPROX
+  int i;
+#endif /* TRE_APPROX */
+
+#ifdef TRE_APPROX
+  for (i = 0; i < TRE_PARAM_LAST; i++)
+    params[i] = TRE_PARAM_DEFAULT;
+#endif /* TRE_APPROX */
+
+  STACK_PUSHR(stack, voidptr, ast);
+  STACK_PUSHR(stack, int, EXPAND_RECURSE);
+  while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
+    {
+      tre_ast_node_t *node;
+      tre_expand_ast_symbol_t symbol;
+
+      if (status != REG_OK)
+       break;
+
+      DPRINT(("pos_add %d\n", pos_add));
+
+      symbol = (tre_expand_ast_symbol_t)tre_stack_pop_int(stack);
+      node = tre_stack_pop_voidptr(stack);
+      switch (symbol)
+       {
+       case EXPAND_RECURSE:
+         switch (node->type)
+           {
+           case LITERAL:
+             {
+               tre_literal_t *lit= node->obj;
+               if (!IS_SPECIAL(lit) || IS_BACKREF(lit))
+                 {
+                   lit->position += pos_add;
+                   if (lit->position > max_pos)
+                     max_pos = lit->position;
+                 }
+               break;
+             }
+           case UNION:
+             {
+               tre_union_t *uni = node->obj;
+               STACK_PUSHX(stack, voidptr, uni->right);
+               STACK_PUSHX(stack, int, EXPAND_RECURSE);
+               STACK_PUSHX(stack, voidptr, uni->left);
+               STACK_PUSHX(stack, int, EXPAND_RECURSE);
+               break;
+             }
+           case CATENATION:
+             {
+               tre_catenation_t *cat = node->obj;
+               STACK_PUSHX(stack, voidptr, cat->right);
+               STACK_PUSHX(stack, int, EXPAND_RECURSE);
+               STACK_PUSHX(stack, voidptr, cat->left);
+               STACK_PUSHX(stack, int, EXPAND_RECURSE);
+               break;
+             }
+           case ITERATION:
+             {
+               tre_iteration_t *iter = node->obj;
+               STACK_PUSHX(stack, int, pos_add);
+               STACK_PUSHX(stack, voidptr, node);
+               STACK_PUSHX(stack, int, EXPAND_AFTER_ITER);
+               STACK_PUSHX(stack, voidptr, iter->arg);
+               STACK_PUSHX(stack, int, EXPAND_RECURSE);
+               /* If we are going to expand this node at EXPAND_AFTER_ITER
+                  then don't increase the `pos' fields of the nodes now, it
+                  will get done when expanding. */
+               if (iter->min > 1 || iter->max > 1)
+                 pos_add = 0;
+               iter_depth++;
+               DPRINT(("iter\n"));
+               break;
+             }
+           default:
+             assert(0);
+             break;
+           }
+         break;
+       case EXPAND_AFTER_ITER:
+         {
+           tre_iteration_t *iter = node->obj;
+           int pos_add_last;
+           pos_add = tre_stack_pop_int(stack);
+           pos_add_last = pos_add;
+           /* Originally (in tre_parse_bound), if min == 0 && max == 0, we
+              immediate replace the whole iteration with EMPTY.  This
+              unfortunately drops any submatches, and messes up setting the
+              pmatch values (we can get tags of -1, and tag values in the
+              billions).  So we left it there and replace with EMPTY here. */
+           if (iter->min == 0 && iter->max == 0)
+             {
+               tre_ast_node_t *empty = tre_ast_new_literal(mem, EMPTY, -1, -1);
+               if (empty == NULL)
+                 return REG_ESPACE;
+               node->obj = empty->obj;
+               node->type = empty->type;
+             }
+           else if (iter->min > 1 || iter->max > 1)
+             {
+               tre_ast_node_t *seq1 = NULL, *seq2 = NULL;
+               int j;
+               int pos_add_save = pos_add;
+
+               /* Create a catenated sequence of copies of the node. */
+               for (j = 0; j < iter->min; j++)
+                 {
+                   tre_ast_node_t *copy;
+                   /* Remove tags from all but the last copy. */
+                   int flags = ((j + 1 < iter->min)
+                                ? COPY_REMOVE_TAGS
+                                : COPY_MAXIMIZE_FIRST_TAG);
+                   DPRINT(("  pos_add %d\n", pos_add));
+                   pos_add_save = pos_add;
+                   status = tre_copy_ast(mem, stack, iter->arg, flags,
+                                         &pos_add, tag_directions, &copy,
+                                         &max_pos);
+                   if (status != REG_OK)
+                     return status;
+                   if (seq1 != NULL)
+                     seq1 = tre_ast_new_catenation(mem, seq1, copy);
+                   else
+                     seq1 = copy;
+                   if (seq1 == NULL)
+                     return REG_ESPACE;
+                 }
+
+               if (iter->max == -1)
+                 {
+                   /* No upper limit. */
+                   pos_add_save = pos_add;
+                   status = tre_copy_ast(mem, stack, iter->arg, 0,
+                                         &pos_add, NULL, &seq2, &max_pos);
+                   if (status != REG_OK)
+                     return status;
+                   seq2 = tre_ast_new_iter(mem, seq2, 0, -1, 0);
+                   if (seq2 == NULL)
+                     return REG_ESPACE;
+                 }
+               else
+                 {
+                   for (j = iter->min; j < iter->max; j++)
+                     {
+                       tre_ast_node_t *tmp, *copy;
+                       pos_add_save = pos_add;
+                       status = tre_copy_ast(mem, stack, iter->arg, 0,
+                                             &pos_add, NULL, &copy, &max_pos);
+                       if (status != REG_OK)
+                         return status;
+                       if (seq2 != NULL)
+                         seq2 = tre_ast_new_catenation(mem, copy, seq2);
+                       else
+                         seq2 = copy;
+                       if (seq2 == NULL)
+                         return REG_ESPACE;
+                       tmp = tre_ast_new_literal(mem, EMPTY, -1, -1);
+                       if (tmp == NULL)
+                         return REG_ESPACE;
+                       seq2 = tre_ast_new_union(mem, tmp, seq2);
+                       if (seq2 == NULL)
+                         return REG_ESPACE;
+                     }
+                 }
+
+               pos_add = pos_add_save;
+               if (seq1 == NULL)
+                 seq1 = seq2;
+               else if (seq2 != NULL)
+                 seq1 = tre_ast_new_catenation(mem, seq1, seq2);
+               if (seq1 == NULL)
+                 return REG_ESPACE;
+               node->obj = seq1->obj;
+               node->type = seq1->type;
+             }
+
+           iter_depth--;
+           pos_add_total += pos_add - pos_add_last;
+           if (iter_depth == 0)
+             pos_add = pos_add_total;
+
+#ifdef TRE_APPROX
+           /* If approximate parameters are specified, surround the result
+              with two parameter setting nodes.  The one on the left sets
+              the specified parameters, and the one on the right restores
+              the old parameters. */
+           if (iter->params)
+             {
+               tre_ast_node_t *tmp_l, *tmp_r, *tmp_node, *node_copy;
+               int *old_params;
+
+               tmp_l = tre_ast_new_literal(mem, PARAMETER, 0, -1);
+               if (!tmp_l)
+                 return REG_ESPACE;
+               ((tre_literal_t *)tmp_l->obj)->u.params = iter->params;
+               iter->params[TRE_PARAM_DEPTH] = params_depth + 1;
+               tmp_r = tre_ast_new_literal(mem, PARAMETER, 0, -1);
+               if (!tmp_r)
+                 return REG_ESPACE;
+               old_params = tre_mem_alloc(mem, sizeof(*old_params)
+                                          * TRE_PARAM_LAST);
+               if (!old_params)
+                 return REG_ESPACE;
+               for (i = 0; i < TRE_PARAM_LAST; i++)
+                 old_params[i] = params[i];
+               ((tre_literal_t *)tmp_r->obj)->u.params = old_params;
+               old_params[TRE_PARAM_DEPTH] = params_depth;
+               /* XXX - this is the only place where ast_new_node is
+                  needed -- should be moved inside AST module. */
+               node_copy = tre_ast_new_node(mem, ITERATION,
+                                            sizeof(tre_iteration_t));
+               if (!node_copy)
+                 return REG_ESPACE;
+               node_copy->obj = node->obj;
+               tmp_node = tre_ast_new_catenation(mem, tmp_l, node_copy);
+               if (!tmp_node)
+                 return REG_ESPACE;
+               tmp_node = tre_ast_new_catenation(mem, tmp_node, tmp_r);
+               if (!tmp_node)
+                 return REG_ESPACE;
+               /* Replace the contents of `node' with `tmp_node'. */
+               memcpy(node, tmp_node, sizeof(*node));
+               node->obj = tmp_node->obj;
+               node->type = tmp_node->type;
+               params_depth++;
+               if (params_depth > *max_depth)
+                 *max_depth = params_depth;
+             }
+#endif /* TRE_APPROX */
+           break;
+         }
+       default:
+         assert(0);
+         break;
+       }
+    }
+
+  *position += pos_add_total;
+
+  /* `max_pos' should never be larger than `*position' if the above
+     code works, but just an extra safeguard let's make sure
+     `*position' is set large enough so enough memory will be
+     allocated for the transition table. */
+  if (max_pos > *position)
+    *position = max_pos;
+
+#ifdef TRE_DEBUG
+  DPRINT(("Expanded AST:\n"));
+  tre_ast_print(ast);
+  DPRINT(("*position %d, max_pos %d\n", *position, max_pos));
+#endif
+
+  return status;
+}
+
+static tre_pos_and_tags_t *
+tre_set_empty(tre_mem_t mem)
+{
+  tre_pos_and_tags_t *new_set;
+
+  new_set = tre_mem_calloc(mem, sizeof(*new_set));
+  if (new_set == NULL)
+    return NULL;
+
+  new_set[0].position = -1;
+  new_set[0].code_min = -1;
+  new_set[0].code_max = -1;
+
+  return new_set;
+}
+
+static tre_pos_and_tags_t *
+tre_set_one(tre_mem_t mem, int position, int code_min, int code_max,
+           tre_bracket_match_list_t *bracket_match_list, int backref)
+{
+  tre_pos_and_tags_t *new_set;
+
+  new_set = tre_mem_calloc(mem, sizeof(*new_set) * 2);
+  if (new_set == NULL)
+    return NULL;
+
+  new_set[0].position = position;
+  new_set[0].code_min = code_min;
+  new_set[0].code_max = code_max;
+  new_set[0].bracket_match_list = bracket_match_list;
+  new_set[0].backref = backref;
+  new_set[1].position = -1;
+  new_set[1].code_min = -1;
+  new_set[1].code_max = -1;
+
+  return new_set;
+}
+
+static tre_pos_and_tags_t *
+tre_set_union(tre_mem_t mem, tre_pos_and_tags_t *set1, tre_pos_and_tags_t *set2,
+             int *tags, int assertions, int *params)
+{
+  int s1, s2, i, j;
+  tre_pos_and_tags_t *new_set;
+  int *new_tags;
+  int num_tags;
+
+  for (num_tags = 0; tags != NULL && tags[num_tags] >= 0; num_tags++);
+  for (s1 = 0; set1[s1].position >= 0; s1++);
+  for (s2 = 0; set2[s2].position >= 0; s2++);
+  new_set = tre_mem_calloc(mem, sizeof(*new_set) * (s1 + s2 + 1));
+  if (!new_set )
+    return NULL;
+
+  for (s1 = 0; set1[s1].position >= 0; s1++)
+    {
+      new_set[s1].position = set1[s1].position;
+      new_set[s1].code_min = set1[s1].code_min;
+      new_set[s1].code_max = set1[s1].code_max;
+      new_set[s1].assertions = set1[s1].assertions | assertions;
+      new_set[s1].bracket_match_list = set1[s1].bracket_match_list;
+      new_set[s1].backref = set1[s1].backref;
+      if (set1[s1].tags == NULL && tags == NULL)
+       new_set[s1].tags = NULL;
+      else
+       {
+         for (i = 0; set1[s1].tags != NULL && set1[s1].tags[i] >= 0; i++);
+         new_tags = tre_mem_alloc(mem, (sizeof(*new_tags)
+                                        * (i + num_tags + 1)));
+         if (new_tags == NULL)
+           return NULL;
+         for (j = 0; j < i; j++)
+           new_tags[j] = set1[s1].tags[j];
+         for (i = 0; i < num_tags; i++)
+           new_tags[j + i] = tags[i];
+         new_tags[j + i] = -1;
+         new_set[s1].tags = new_tags;
+       }
+      if (set1[s1].params)
+       new_set[s1].params = set1[s1].params;
+      if (params)
+       {
+         if (!new_set[s1].params)
+           new_set[s1].params = params;
+         else
+           {
+             new_set[s1].params = tre_mem_alloc(mem, sizeof(*params) *
+                                                TRE_PARAM_LAST);
+             if (!new_set[s1].params)
+               return NULL;
+             for (i = 0; i < TRE_PARAM_LAST; i++)
+               if (params[i] != TRE_PARAM_UNSET)
+                 new_set[s1].params[i] = params[i];
+           }
+       }
+    }
+
+  for (s2 = 0; set2[s2].position >= 0; s2++)
+    {
+      new_set[s1 + s2].position = set2[s2].position;
+      new_set[s1 + s2].code_min = set2[s2].code_min;
+      new_set[s1 + s2].code_max = set2[s2].code_max;
+      /* XXX - why not | assertions here as well? */
+      new_set[s1 + s2].assertions = set2[s2].assertions;
+      new_set[s1 + s2].bracket_match_list = set2[s2].bracket_match_list;
+      new_set[s1 + s2].backref = set2[s2].backref;
+      if (set2[s2].tags == NULL)
+       new_set[s1 + s2].tags = NULL;
+      else
+       {
+         for (i = 0; set2[s2].tags[i] >= 0; i++);
+         new_tags = tre_mem_alloc(mem, sizeof(*new_tags) * (i + 1));
+         if (new_tags == NULL)
+           return NULL;
+         for (j = 0; j < i; j++)
+           new_tags[j] = set2[s2].tags[j];
+         new_tags[j] = -1;
+         new_set[s1 + s2].tags = new_tags;
+       }
+      if (set2[s2].params)
+       new_set[s1 + s2].params = set2[s2].params;
+      if (params)
+       {
+         if (!new_set[s1 + s2].params)
+           new_set[s1 + s2].params = params;
+         else
+           {
+             new_set[s1 + s2].params = tre_mem_alloc(mem, sizeof(*params) *
+                                                     TRE_PARAM_LAST);
+             if (!new_set[s1 + s2].params)
+               return NULL;
+             for (i = 0; i < TRE_PARAM_LAST; i++)
+               if (params[i] != TRE_PARAM_UNSET)
+                 new_set[s1 + s2].params[i] = params[i];
+           }
+       }
+    }
+  new_set[s1 + s2].position = -1;
+  return new_set;
+}
+
+/* Finds the empty path through `node' which is the one that should be
+   taken according to POSIX.2 rules, and adds the tags on that path to
+   `tags'.   `tags' may be NULL.  If `num_tags_seen' is not NULL, it is
+   set to the number of tags seen on the path. */
+static reg_errcode_t
+tre_match_empty(tre_stack_t *stack, tre_ast_node_t *node, int *tags,
+               int *assertions, int *params, int *num_tags_seen,
+               int *params_seen)
+{
+  tre_literal_t *lit;
+  tre_union_t *uni;
+  tre_catenation_t *cat;
+  tre_iteration_t *iter;
+  int i;
+  int bottom = tre_stack_num_objects(stack);
+  reg_errcode_t status = REG_OK;
+  if (num_tags_seen)
+    *num_tags_seen = 0;
+  if (params_seen)
+    *params_seen = 0;
+
+  status = tre_stack_push_voidptr(stack, node);
+
+  /* Walk through the tree recursively. */
+  while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
+    {
+      node = tre_stack_pop_voidptr(stack);
+
+      switch (node->type)
+       {
+       case LITERAL:
+         lit = (tre_literal_t *)node->obj;
+         switch (lit->code_min)
+           {
+           case TAG:
+             if (lit->code_max >= 0)
+               {
+                 if (tags != NULL)
+                   {
+                     /* Add the tag to `tags'. */
+                     for (i = 0; tags[i] >= 0; i++)
+                       if (tags[i] == lit->code_max)
+                         break;
+                     if (tags[i] < 0)
+                       {
+                         tags[i] = lit->code_max;
+                         tags[i + 1] = -1;
+                       }
+                   }
+                 if (num_tags_seen)
+                   (*num_tags_seen)++;
+               }
+             break;
+           case ASSERTION:
+             assert(lit->code_max >= 1
+                    || lit->code_max <= ASSERT_LAST);
+             if (assertions != NULL)
+               *assertions |= lit->code_max;
+             break;
+           case PARAMETER:
+             if (params != NULL)
+               for (i = 0; i < TRE_PARAM_LAST; i++)
+                 params[i] = lit->u.params[i];
+             if (params_seen != NULL)
+               *params_seen = 1;
+             break;
+           case EMPTY:
+             break;
+           default:
+             assert(0);
+             break;
+           }
+         break;
+
+       case UNION:
+         /* Subexpressions starting earlier take priority over ones
+            starting later, so we prefer the left subexpression over the
+            right subexpression. */
+         uni = (tre_union_t *)node->obj;
+         if (uni->left->nullable)
+           STACK_PUSHX(stack, voidptr, uni->left)
+         else if (uni->right->nullable)
+           STACK_PUSHX(stack, voidptr, uni->right)
+         else
+           assert(0);
+         break;
+
+       case CATENATION:
+         /* The path must go through both children. */
+         cat = (tre_catenation_t *)node->obj;
+         assert(cat->left->nullable);
+         assert(cat->right->nullable);
+         STACK_PUSHX(stack, voidptr, cat->left);
+         STACK_PUSHX(stack, voidptr, cat->right);
+         break;
+
+       case ITERATION:
+         /* A match with an empty string is preferred over no match at
+            all, so we go through the argument if possible. */
+         iter = (tre_iteration_t *)node->obj;
+         if (iter->arg->nullable)
+           STACK_PUSHX(stack, voidptr, iter->arg);
+         break;
+
+       default:
+         assert(0);
+         break;
+       }
+    }
+
+  return status;
+}
+
+
+typedef enum {
+  NFL_RECURSE,
+  NFL_POST_UNION,
+  NFL_POST_CATENATION,
+  NFL_POST_ITERATION
+} tre_nfl_stack_symbol_t;
+
+
+/* Computes and fills in the fields `nullable', `firstpos', and `lastpos' for
+   the nodes of the AST `tree'. */
+static reg_errcode_t
+tre_compute_nfl(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree)
+{
+  int bottom = tre_stack_num_objects(stack);
+
+  STACK_PUSHR(stack, voidptr, tree);
+  STACK_PUSHR(stack, int, NFL_RECURSE);
+
+  while (tre_stack_num_objects(stack) > bottom)
+    {
+      tre_nfl_stack_symbol_t symbol;
+      tre_ast_node_t *node;
+
+      symbol = (tre_nfl_stack_symbol_t)tre_stack_pop_int(stack);
+      node = tre_stack_pop_voidptr(stack);
+      switch (symbol)
+       {
+       case NFL_RECURSE:
+         switch (node->type)
+           {
+           case LITERAL:
+             {
+               tre_literal_t *lit = (tre_literal_t *)node->obj;
+               if (IS_BACKREF(lit))
+                 {
+                   /* Back references: nullable = false, firstpos = {i},
+                      lastpos = {i}. */
+                   node->nullable = 0;
+                   node->firstpos = tre_set_one(mem, lit->position, 0,
+                                            TRE_CHAR_MAX, NULL, -1);
+                   if (!node->firstpos)
+                     return REG_ESPACE;
+                   node->lastpos = tre_set_one(mem, lit->position, 0,
+                                               TRE_CHAR_MAX, NULL,
+                                               (int)lit->code_max);
+                   if (!node->lastpos)
+                     return REG_ESPACE;
+                 }
+               else if (lit->code_min < 0)
+                 {
+                   /* Tags, empty strings, params, and zero width assertions:
+                      nullable = true, firstpos = {}, and lastpos = {}. */
+                   node->nullable = 1;
+                   node->firstpos = tre_set_empty(mem);
+                   if (!node->firstpos)
+                     return REG_ESPACE;
+                   node->lastpos = tre_set_empty(mem);
+                   if (!node->lastpos)
+                     return REG_ESPACE;
+                 }
+               else
+                 {
+                   /* Literal at position i: nullable = false, firstpos = {i},
+                      lastpos = {i}. */
+                   node->nullable = 0;
+                   node->firstpos =
+                     tre_set_one(mem, lit->position, (int)lit->code_min,
+                                 (int)lit->code_max, NULL, -1);
+                   if (!node->firstpos)
+                     return REG_ESPACE;
+                   node->lastpos = tre_set_one(mem, lit->position,
+                                               (int)lit->code_min,
+                                               (int)lit->code_max,
+                                               lit->u.bracket_match_list,
+                                               -1);
+                   if (!node->lastpos)
+                     return REG_ESPACE;
+                 }
+               break;
+             }
+
+           case UNION:
+             /* Compute the attributes for the two subtrees, and after that
+                for this node. */
+             STACK_PUSHR(stack, voidptr, node);
+             STACK_PUSHR(stack, int, NFL_POST_UNION);
+             STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->right);
+             STACK_PUSHR(stack, int, NFL_RECURSE);
+             STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->left);
+             STACK_PUSHR(stack, int, NFL_RECURSE);
+             break;
+
+           case CATENATION:
+             /* Compute the attributes for the two subtrees, and after that
+                for this node. */
+             STACK_PUSHR(stack, voidptr, node);
+             STACK_PUSHR(stack, int, NFL_POST_CATENATION);
+             STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->right);
+             STACK_PUSHR(stack, int, NFL_RECURSE);
+             STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->left);
+             STACK_PUSHR(stack, int, NFL_RECURSE);
+             break;
+
+           case ITERATION:
+             /* Compute the attributes for the subtree, and after that for
+                this node. */
+             STACK_PUSHR(stack, voidptr, node);
+             STACK_PUSHR(stack, int, NFL_POST_ITERATION);
+             STACK_PUSHR(stack, voidptr, ((tre_iteration_t *)node->obj)->arg);
+             STACK_PUSHR(stack, int, NFL_RECURSE);
+             break;
+           }
+         break; /* end case: NFL_RECURSE */
+
+       case NFL_POST_UNION:
+         {
+           tre_union_t *uni = (tre_union_t *)node->obj;
+           node->nullable = uni->left->nullable || uni->right->nullable;
+           node->firstpos = tre_set_union(mem, uni->left->firstpos,
+                                          uni->right->firstpos, NULL, 0, NULL);
+           if (!node->firstpos)
+             return REG_ESPACE;
+           node->lastpos = tre_set_union(mem, uni->left->lastpos,
+                                         uni->right->lastpos, NULL, 0, NULL);
+           if (!node->lastpos)
+             return REG_ESPACE;
+           break;
+         }
+
+       case NFL_POST_ITERATION:
+         {
+           int num_tags, *tags, assertions, params_seen;
+           int *params;
+           reg_errcode_t status;
+           tre_iteration_t *iter = (tre_iteration_t *)node->obj;
+
+           /* From Ville Laurikari's original 2001 Master's thesis, the
+              firstpos(n) and lastpos(n) of an iteration is just the
+              corresponding values of the iteration's argument.  Unfortunately,
+              this isn't sufficient for the following BRE:
+
+                  \(a*\)*b\(\1\)    matched against    ab
+
+              The backreference wants to force the first subexpression to
+              be the empty string, but there is no transition for this.  So
+              we need to modify the lastpos(n) of an iteration to be the
+              equivalent of that of catentation.  Using the same notation as
+              in the thesis, lastpos(n) is redefined as:
+
+                  if nullable(c1) then
+                      lastpos(c1) U
+                      addtags(lastpos(c1),
+                              emptymatch(c1))
+                  else
+                      lastpos(c1)
+
+              where c1 is the argument node.  firstpos(n) remains the same. */
+
+           /* Compute lastpos. */
+           if (iter->min == 0 || iter->arg->nullable)
+             {
+               node->nullable = 1;
+               if (iter->arg->nullable)
+                 {
+                   /* The arg matches the empty string.  Make a first pass
+                      with tre_match_empty() to get the number of tags and
+                      parameters. */
+                   status = tre_match_empty(stack, iter->arg,
+                                            NULL, NULL, NULL, &num_tags,
+                                            &params_seen);
+                   if (status != REG_OK)
+                     return status;
+                   /* Allocate arrays for the tags and parameters. */
+                   tags = xmalloc(sizeof(int) * (num_tags + 1));
+                   if (!tags)
+                     return REG_ESPACE;
+                   tags[0] = -1;
+                   assertions = 0;
+                   params = NULL;
+                   if (params_seen)
+                     {
+                       params = tre_mem_alloc(mem, sizeof(*params)
+                                              * TRE_PARAM_LAST);
+                       if (!params)
+                         {
+                           xfree(tags);
+                           return REG_ESPACE;
+                         }
+                     }
+                   /* Second pass with tre_mach_empty() to get the list of
+                      tags and parameters. */
+                   status = tre_match_empty(stack, iter->arg, tags,
+                                            &assertions, params, NULL, NULL);
+                   if (status != REG_OK)
+                     {
+                       xfree(tags);
+                       return status;
+                     }
+                   node->lastpos =
+                     tre_set_union(mem, iter->arg->lastpos, iter->arg->lastpos,
+                                   tags, assertions, params);
+                   xfree(tags);
+                   if (!node->lastpos)
+                     return REG_ESPACE;
+                 }
+               else
+                 node->lastpos = iter->arg->lastpos;
+             }
+           else
+             {
+               node->nullable = 0;
+               node->lastpos = iter->arg->lastpos;
+             }
+           node->firstpos = iter->arg->firstpos;
+           break;
+         }
+
+       case NFL_POST_CATENATION:
+         {
+           int num_tags, *tags, assertions, params_seen;
+           int *params;
+           reg_errcode_t status;
+           tre_catenation_t *cat = node->obj;
+           node->nullable = cat->left->nullable && cat->right->nullable;
+
+           /* Compute firstpos. */
+           if (cat->left->nullable)
+             {
+               /* The left side matches the empty string.  Make a first pass
+                  with tre_match_empty() to get the number of tags and
+                  parameters. */
+               status = tre_match_empty(stack, cat->left,
+                                        NULL, NULL, NULL, &num_tags,
+                                        &params_seen);
+               if (status != REG_OK)
+                 return status;
+               /* Allocate arrays for the tags and parameters. */
+               tags = xmalloc(sizeof(*tags) * (num_tags + 1));
+               if (!tags)
+                 return REG_ESPACE;
+               tags[0] = -1;
+               assertions = 0;
+               params = NULL;
+               if (params_seen)
+                 {
+                   params = tre_mem_alloc(mem, sizeof(*params)
+                                          * TRE_PARAM_LAST);
+                   if (!params)
+                     {
+                       xfree(tags);
+                       return REG_ESPACE;
+                     }
+                 }
+               /* Second pass with tre_mach_empty() to get the list of
+                  tags and parameters. */
+               status = tre_match_empty(stack, cat->left, tags,
+                                        &assertions, params, NULL, NULL);
+               if (status != REG_OK)
+                 {
+                   xfree(tags);
+                   return status;
+                 }
+               node->firstpos =
+                 tre_set_union(mem, cat->right->firstpos, cat->left->firstpos,
+                               tags, assertions, params);
+               xfree(tags);
+               if (!node->firstpos)
+                 return REG_ESPACE;
+             }
+           else
+             {
+               node->firstpos = cat->left->firstpos;
+             }
+
+           /* Compute lastpos. */
+           if (cat->right->nullable)
+             {
+               /* The right side matches the empty string.  Make a first pass
+                  with tre_match_empty() to get the number of tags and
+                  parameters. */
+               status = tre_match_empty(stack, cat->right,
+                                        NULL, NULL, NULL, &num_tags,
+                                        &params_seen);
+               if (status != REG_OK)
+                 return status;
+               /* Allocate arrays for the tags and parameters. */
+               tags = xmalloc(sizeof(int) * (num_tags + 1));
+               if (!tags)
+                 return REG_ESPACE;
+               tags[0] = -1;
+               assertions = 0;
+               params = NULL;
+               if (params_seen)
+                 {
+                   params = tre_mem_alloc(mem, sizeof(*params)
+                                          * TRE_PARAM_LAST);
+                   if (!params)
+                     {
+                       xfree(tags);
+                       return REG_ESPACE;
+                     }
+                 }
+               /* Second pass with tre_mach_empty() to get the list of
+                  tags and parameters. */
+               status = tre_match_empty(stack, cat->right, tags,
+                                        &assertions, params, NULL, NULL);
+               if (status != REG_OK)
+                 {
+                   xfree(tags);
+                   return status;
+                 }
+               node->lastpos =
+                 tre_set_union(mem, cat->left->lastpos, cat->right->lastpos,
+                               tags, assertions, params);
+               xfree(tags);
+               if (!node->lastpos)
+                 return REG_ESPACE;
+             }
+           else
+             {
+               node->lastpos = cat->right->lastpos;
+             }
+           break;
+         }
+
+       default:
+         assert(0);
+         break;
+       }
+    }
+
+  return REG_OK;
+}
+
+
+/* Adds a transition from each position in `p1' to each position in `p2'. */
+static reg_errcode_t
+tre_make_trans(tre_pos_and_tags_t *p1, tre_pos_and_tags_t *p2,
+              tre_tnfa_transition_t *transitions,
+              int *counts, int *offs)
+{
+  tre_pos_and_tags_t *orig_p2 = p2;
+  tre_tnfa_transition_t *trans;
+  int i, j, k, l, dup, prev_p2_pos;
+
+  if (transitions != NULL)
+    while (p1->position >= 0)
+      {
+       p2 = orig_p2;
+       prev_p2_pos = -1;
+       while (p2->position >= 0)
+         {
+           /* Optimization: if this position was already handled, skip it. */
+           if (p2->position == prev_p2_pos)
+             {
+               p2++;
+               continue;
+             }
+           prev_p2_pos = p2->position;
+           /* Set `trans' to point to the next unused transition from
+              position `p1->position'. */
+           trans = transitions + offs[p1->position];
+           while (trans->state != NULL)
+             {
+#if 0
+               /* If we find a previous transition from `p1->position' to
+                  `p2->position', it is overwritten.  This can happen only
+                  if there are nested loops in the regexp, like in "((a)*)*".
+                  In POSIX.2 repetition using the outer loop is always
+                  preferred over using the inner loop.  Therefore the
+                  transition for the inner loop is useless and can be thrown
+                  away. */
+               /* XXX - The same position is used for all nodes in a bracket
+                  expression, so this optimization cannot be used (it will
+                  break bracket expressions) unless I figure out a way to
+                  detect it here. */
+               if (trans->state_id == p2->position)
+                 {
+                   DPRINT(("*"));
+                   break;
+                 }
+#endif
+               trans++;
+             }
+
+           if (trans->state == NULL)
+             (trans + 1)->state = NULL;
+           /* Use the character ranges, assertions, etc. from `p1' for
+              the transition from `p1' to `p2'. */
+           trans->code_min = p1->code_min;
+           trans->code_max = p1->code_max;
+           trans->state = transitions + offs[p2->position];
+           trans->state_id = p2->position;
+           trans->assertions = p1->assertions | p2->assertions
+             | (p1->bracket_match_list != NULL ? ASSERT_BRACKET_MATCH : 0);
+           if (p1->backref >= 0)
+             {
+               assert((trans->assertions & ASSERT_BRACKET_MATCH) == 0);
+               assert(p2->backref < 0);
+               trans->u.backref = p1->backref;
+               trans->assertions |= ASSERT_BACKREF;
+             }
+           if (p1->bracket_match_list != NULL)
+             {
+               trans->u.bracket_match_list =
+                 xmalloc(SIZEOF_BRACKET_MATCH_LIST(p1->bracket_match_list));
+               if (trans->u.bracket_match_list == NULL)
+                 return REG_ESPACE;
+               memcpy(trans->u.bracket_match_list, p1->bracket_match_list,
+                      SIZEOF_BRACKET_MATCH_LIST(p1->bracket_match_list));
+             }
+
+           /* Find out how many tags this transition has. */
+           i = 0;
+           if (p1->tags != NULL)
+             while(p1->tags[i] >= 0)
+               i++;
+           j = 0;
+           if (p2->tags != NULL)
+             while(p2->tags[j] >= 0)
+               j++;
+
+           /* If we are overwriting a transition, free the old tag array. */
+           if (trans->tags != NULL)
+             xfree(trans->tags);
+           trans->tags = NULL;
+
+           /* If there were any tags, allocate an array and fill it. */
+           if (i + j > 0)
+             {
+               trans->tags = xmalloc(sizeof(*trans->tags) * (i + j + 1));
+               if (!trans->tags)
+                 return REG_ESPACE;
+               i = 0;
+               if (p1->tags != NULL)
+                 while(p1->tags[i] >= 0)
+                   {
+                     trans->tags[i] = p1->tags[i];
+                     i++;
+                   }
+               l = i;
+               j = 0;
+               if (p2->tags != NULL)
+                 while (p2->tags[j] >= 0)
+                   {
+                     /* Don't add duplicates. */
+                     dup = 0;
+                     for (k = 0; k < i; k++)
+                       if (trans->tags[k] == p2->tags[j])
+                         {
+                           dup = 1;
+                           break;
+                         }
+                     if (!dup)
+                       trans->tags[l++] = p2->tags[j];
+                     j++;
+                   }
+               trans->tags[l] = -1;
+             }
+
+           /* Set the parameter array.  If both `p2' and `p1' have same
+              parameters, the values in `p2' override those in `p1'. */
+           if (p1->params || p2->params)
+             {
+               if (!trans->params)
+                 trans->params = xmalloc(sizeof(*trans->params)
+                                         * TRE_PARAM_LAST);
+               if (!trans->params)
+                 return REG_ESPACE;
+               for (i = 0; i < TRE_PARAM_LAST; i++)
+                 {
+                   trans->params[i] = TRE_PARAM_UNSET;
+                   if (p1->params && p1->params[i] != TRE_PARAM_UNSET)
+                     trans->params[i] = p1->params[i];
+                   if (p2->params && p2->params[i] != TRE_PARAM_UNSET)
+                     trans->params[i] = p2->params[i];
+                 }
+             }
+           else
+             {
+               if (trans->params)
+                 xfree(trans->params);
+               trans->params = NULL;
+             }
+
+
+#ifdef TRE_DEBUG
+           {
+             int *tags;
+
+             DPRINT(("  %2d -> %2d on %3d", p1->position, p2->position,
+                     p1->code_min));
+             if (p1->code_max != p1->code_min)
+               DPRINT(("-%3d", p1->code_max));
+             tags = trans->tags;
+             if (tags)
+               {
+                 DPRINT((", tags ["));
+                 while (*tags >= 0)
+                   {
+                     DPRINT(("%d", *tags));
+                     tags++;
+                     if (*tags >= 0)
+                       DPRINT((","));
+                   }
+                 DPRINT(("]"));
+               }
+             if (trans->assertions)
+               DPRINT((", assert %d", trans->assertions));
+             if (trans->assertions & ASSERT_BACKREF)
+               DPRINT((", backref %d", trans->u.backref));
+             else if (trans->assertions & ASSERT_BRACKET_MATCH)
+               DPRINT((", bracket_match_list %p",
+                       trans->u.bracket_match_list));
+             if (trans->params)
+               {
+                 DPRINT((", "));
+                 tre_print_params(trans->params);
+               }
+             DPRINT(("\n"));
+           }
+#endif /* TRE_DEBUG */
+           p2++;
+         }
+       p1++;
+      }
+  else
+    /* Compute a maximum limit for the number of transitions leaving
+       from each state. */
+    while (p1->position >= 0)
+      {
+       p2 = orig_p2;
+       while (p2->position >= 0)
+         {
+           counts[p1->position]++;
+           p2++;
+         }
+       p1++;
+      }
+  return REG_OK;
+}
+
+/* Converts the syntax tree to a TNFA. All the transitions in the TNFA are
+   labelled with one character range (there are no transitions on empty
+   strings).  The TNFA takes O(n^2) space in the worst case, `n' is size of
+   the regexp. */
+static reg_errcode_t
+tre_ast_to_tnfa(tre_ast_node_t *node, tre_tnfa_transition_t *transitions,
+               int *counts, int *offs)
+{
+  tre_union_t *uni;
+  tre_catenation_t *cat;
+  tre_iteration_t *iter;
+  reg_errcode_t errcode = REG_OK;
+
+  /* XXX - recurse using a stack!. */
+  switch (node->type)
+    {
+    case LITERAL:
+      break;
+    case UNION:
+      uni = (tre_union_t *)node->obj;
+      errcode = tre_ast_to_tnfa(uni->left, transitions, counts, offs);
+      if (errcode != REG_OK)
+       return errcode;
+      errcode = tre_ast_to_tnfa(uni->right, transitions, counts, offs);
+      break;
+
+    case CATENATION:
+      cat = (tre_catenation_t *)node->obj;
+      /* Add a transition from each position in cat->left->lastpos
+        to each position in cat->right->firstpos. */
+      errcode = tre_make_trans(cat->left->lastpos, cat->right->firstpos,
+                              transitions, counts, offs);
+      if (errcode != REG_OK)
+       return errcode;
+      errcode = tre_ast_to_tnfa(cat->left, transitions, counts, offs);
+      if (errcode != REG_OK)
+       return errcode;
+      errcode = tre_ast_to_tnfa(cat->right, transitions, counts, offs);
+      break;
+
+    case ITERATION:
+      iter = (tre_iteration_t *)node->obj;
+      assert(iter->max == -1 || iter->max == 1);
+
+      if (iter->max == -1)
+       {
+         assert(iter->min == 0 || iter->min == 1);
+         /* Add a transition from each last position in the iterated
+            expression to each first position. */
+         errcode = tre_make_trans(iter->arg->lastpos, iter->arg->firstpos,
+                                  transitions, counts, offs);
+         if (errcode != REG_OK)
+           return errcode;
+       }
+      errcode = tre_ast_to_tnfa(iter->arg, transitions, counts, offs);
+      break;
+    }
+  return errcode;
+}
+
+
+#define ERROR_EXIT(err)                  \
+  do                             \
+    {                            \
+      errcode = err;             \
+      if (/*CONSTCOND*/1)        \
+       goto error_exit;          \
+    }                            \
+ while (/*CONSTCOND*/0)
+
+
+int
+tre_compile(regex_t *preg, const tre_char_t *regex, size_t n, int cflags,
+           locale_t loc)
+{
+  tre_stack_t *stack;
+  tre_ast_node_t *tree, *tmp_ast_l, *tmp_ast_r;
+  tre_pos_and_tags_t *p;
+  int *counts = NULL, *offs = NULL;
+  int i, add = 0;
+  tre_tnfa_transition_t *transitions, *initial;
+  tre_tnfa_t *tnfa = NULL;
+  tre_submatch_data_t *submatch_data = NULL;
+  tre_tag_direction_t *tag_directions = NULL;
+  reg_errcode_t errcode;
+  tre_mem_t mem;
+
+  /* Parse context. */
+  tre_parse_ctx_t parse_ctx;
+
+  /* Allocate a stack used throughout the compilation process for various
+     purposes. */
+  stack = tre_stack_new(512, 10240, 128);
+  if (!stack)
+    return REG_ESPACE;
+  /* Allocate a fast memory allocator. */
+  mem = tre_mem_new();
+  if (!mem)
+    {
+      tre_stack_destroy(stack);
+      return REG_ESPACE;
+    }
+
+  /* Parse the regexp. */
+  memset(&parse_ctx, 0, sizeof(parse_ctx));
+  parse_ctx.mem = mem;
+  parse_ctx.stack = stack;
+  parse_ctx.re = regex;
+  parse_ctx.len = n;
+  /* Only allow REG_UNGREEDY to be set if both REG_ENHANCED and REG_EXTENDED
+     are also set */
+  if ((cflags & (REG_ENHANCED | REG_EXTENDED)) != (REG_ENHANCED | REG_EXTENDED))
+    cflags &= ~REG_UNGREEDY;
+  parse_ctx.cflags = cflags;
+  parse_ctx.max_backref = -1;
+  parse_ctx.loc = loc;
+  parse_ctx.submatch_id_invisible = SUBMATCH_ID_INVISIBLE_START;
+
+  DPRINT(("tre_compile: parsing '%.*" STRF "'\n", (int)n, regex));
+  errcode = tre_parse(&parse_ctx);
+  if (errcode != REG_OK)
+    ERROR_EXIT(errcode);
+  preg->re_nsub = parse_ctx.submatch_id - 1;
+  tree = parse_ctx.result;
+
+  /* Back references and approximate matching cannot currently be used
+     in the same regexp. */
+  if (parse_ctx.max_backref >= 0 && parse_ctx.have_approx)
+    ERROR_EXIT(REG_BADPAT);
+
+#ifdef TRE_DEBUG
+  tre_ast_print(tree);
+#endif /* TRE_DEBUG */
+
+  /* Referring to nonexistent subexpressions is illegal. */
+  if (parse_ctx.max_backref > (int)preg->re_nsub)
+    ERROR_EXIT(REG_ESUBREG);
+
+  /* Allocate the TNFA struct. */
+  tnfa = xcalloc(1, sizeof(tre_tnfa_t));
+  if (tnfa == NULL)
+    ERROR_EXIT(REG_ESPACE);
+  tnfa->have_backrefs = parse_ctx.max_backref >= 0;
+  tnfa->have_approx = parse_ctx.have_approx;
+  tnfa->num_submatches = parse_ctx.submatch_id;
+  tnfa->num_submatches_invisible = parse_ctx.submatch_id_invisible
+                                  - SUBMATCH_ID_INVISIBLE_START;
+  tnfa->num_reorder_tags = parse_ctx.num_reorder_tags;
+  tnfa->loc = parse_ctx.loc;
+
+  /* Set up tags for submatch addressing.  If REG_NOSUB is set and the
+     regexp does not have back references, this can be skipped. */
+  if (tnfa->num_reorder_tags > 0 || !(cflags & REG_NOSUB))
+    {
+      DPRINT(("tre_compile: setting up tags\n"));
+
+      /* Figure out how many tags we will need. */
+      errcode = tre_add_tags(NULL, stack, tree, tnfa);
+      if (errcode != REG_OK)
+       ERROR_EXIT(errcode);
+#ifdef TRE_DEBUG
+      tre_ast_print(tree);
+#endif /* TRE_DEBUG */
+
+      if (tnfa->num_tags > 0)
+       {
+         tag_directions = xmalloc(sizeof(*tag_directions)
+                                  * (tnfa->num_tags + 1));
+         if (tag_directions == NULL)
+           ERROR_EXIT(REG_ESPACE);
+         tnfa->tag_directions = tag_directions;
+         memset(tag_directions, -1,
+                sizeof(*tag_directions) * (tnfa->num_tags + 1));
+       }
+      tnfa->minimal_tags = xcalloc((unsigned)tnfa->num_tags * 2 + 3,
+                                  sizeof(tnfa->minimal_tags));
+      if (tnfa->minimal_tags == NULL)
+       ERROR_EXIT(REG_ESPACE);
+
+      submatch_data = xcalloc((unsigned)parse_ctx.submatch_id,
+                             sizeof(*submatch_data));
+      if (submatch_data == NULL)
+       ERROR_EXIT(REG_ESPACE);
+      /* Set the eo_tag value to -1 to indicate that that corresponding
+       * submatch has not be completed yet */
+      for (i = 0; i < parse_ctx.submatch_id; i++)
+       {
+         submatch_data[i].eo_tag = -1;
+       }
+      tnfa->submatch_data = submatch_data;
+
+      errcode = tre_add_tags(mem, stack, tree, tnfa);
+      if (errcode != REG_OK)
+       ERROR_EXIT(errcode);
+
+#ifdef TRE_DEBUG
+      for (i = 0; i < parse_ctx.submatch_id; i++)
+       DPRINT(("pmatch[%d] = {t%d, t%d}\n",
+               i, submatch_data[i].so_tag, submatch_data[i].eo_tag));
+      for (i = 0; i <= tnfa->num_tags; i++)
+       DPRINT(("t%d is %s\n", i, tag_dir_str[tag_directions[i]]));
+#endif /* TRE_DEBUG */
+    }
+
+  /* Expand iteration nodes. */
+  errcode = tre_expand_ast(mem, stack, tree, &parse_ctx.position,
+                          tag_directions, &tnfa->params_depth);
+  if (errcode != REG_OK)
+    ERROR_EXIT(errcode);
+
+  /* Add a dummy node for the final state.
+     XXX - For certain patterns this dummy node can be optimized away,
+          for example "a*" or "ab*".   Figure out a simple way to detect
+          this possibility. */
+  tmp_ast_l = tree;
+  tmp_ast_r = tre_ast_new_literal(mem, 0, 0, parse_ctx.position++);
+  if (tmp_ast_r == NULL)
+    ERROR_EXIT(REG_ESPACE);
+
+  tree = tre_ast_new_catenation(mem, tmp_ast_l, tmp_ast_r);
+  if (tree == NULL)
+    ERROR_EXIT(REG_ESPACE);
+
+#ifdef TRE_DEBUG
+  tre_ast_print(tree);
+  DPRINT(("Number of states: %d\n", parse_ctx.position));
+  if (submatch_data)
+    for (i = 0; i < parse_ctx.submatch_id; i++)
+      DPRINT(("pmatch[%d] = {t%d, t%d}\n",
+             i, submatch_data[i].so_tag, submatch_data[i].eo_tag));
+  if (tag_directions)
+    for (i = 0; i <= tnfa->num_tags; i++)
+      DPRINT(("t%d is %s\n", i, tag_dir_str[tag_directions[i]]));
+#endif /* TRE_DEBUG */
+
+  errcode = tre_compute_nfl(mem, stack, tree);
+  if (errcode != REG_OK)
+    ERROR_EXIT(errcode);
+
+  counts = xmalloc(sizeof(int) * parse_ctx.position);
+  if (counts == NULL)
+    ERROR_EXIT(REG_ESPACE);
+
+  offs = xmalloc(sizeof(int) * parse_ctx.position);
+  if (offs == NULL)
+    ERROR_EXIT(REG_ESPACE);
+
+  for (i = 0; i < parse_ctx.position; i++)
+    counts[i] = 0;
+  tre_ast_to_tnfa(tree, NULL, counts, NULL);
+
+  add = 0;
+  for (i = 0; i < parse_ctx.position; i++)
+    {
+      offs[i] = add;
+      add += counts[i] + 1;
+      counts[i] = 0;
+    }
+  transitions = xcalloc((unsigned)add + 1, sizeof(*transitions));
+  if (transitions == NULL)
+    ERROR_EXIT(REG_ESPACE);
+  tnfa->transitions = transitions;
+  tnfa->num_transitions = add;
+
+  DPRINT(("Converting to TNFA:\n"));
+  errcode = tre_ast_to_tnfa(tree, transitions, counts, offs);
+  if (errcode != REG_OK)
+    ERROR_EXIT(errcode);
+
+  /* If in eight bit mode, compute a table of characters that can be the
+     first character of a match. */
+  tnfa->first_char = -1;
+  if (TRE_MB_CUR_MAX_L(tnfa->loc) == 1 && !tmp_ast_l->nullable)
+    {
+      int count = 0;
+      tre_cint_t k;
+      DPRINT(("Characters that can start a match:"));
+      tnfa->firstpos_chars = xcalloc(256, sizeof(char));
+      if (tnfa->firstpos_chars == NULL)
+       ERROR_EXIT(REG_ESPACE);
+      for (p = tree->firstpos; p->position >= 0; p++)
+       {
+         tre_tnfa_transition_t *j = transitions + offs[p->position];
+         while (j->state != NULL)
+           {
+             for (k = j->code_min; k <= j->code_max && k < 256; k++)
+               {
+                 DPRINT((" %d", k));
+                 tnfa->firstpos_chars[k] = 1;
+                 count++;
+               }
+             j++;
+           }
+       }
+      DPRINT(("\n"));
+#define TRE_OPTIMIZE_FIRST_CHAR 1
+#if TRE_OPTIMIZE_FIRST_CHAR
+      if (count == 1)
+       {
+         for (k = 0; k < 256; k++)
+           if (tnfa->firstpos_chars[k])
+             {
+               DPRINT(("first char must be %d\n", k));
+               tnfa->first_char = k;
+               xfree(tnfa->firstpos_chars);
+               tnfa->firstpos_chars = NULL;
+               break;
+             }
+       }
+#endif
+
+    }
+  else
+    tnfa->firstpos_chars = NULL;
+
+
+  p = tree->firstpos;
+  i = 0;
+  while (p->position >= 0)
+    {
+      i++;
+
+#ifdef TRE_DEBUG
+      {
+       int *tags;
+       DPRINT(("initial: %d", p->position));
+       tags = p->tags;
+       if (tags != NULL)
+         {
+           if (*tags >= 0)
+             DPRINT(("/"));
+           while (*tags >= 0)
+             {
+               DPRINT(("%d", *tags));
+               tags++;
+               if (*tags >= 0)
+                 DPRINT((","));
+             }
+         }
+       DPRINT((", assert %d", p->assertions));
+       if (p->params)
+         {
+           DPRINT((", "));
+           tre_print_params(p->params);
+         }
+       DPRINT(("\n"));
+      }
+#endif /* TRE_DEBUG */
+
+      p++;
+    }
+
+  initial = xcalloc((unsigned)i + 1, sizeof(tre_tnfa_transition_t));
+  if (initial == NULL)
+    ERROR_EXIT(REG_ESPACE);
+  tnfa->initial = initial;
+
+  i = 0;
+  for (p = tree->firstpos; p->position >= 0; p++)
+    {
+      initial[i].state = transitions + offs[p->position];
+      initial[i].state_id = p->position;
+      initial[i].tags = NULL;
+      /* Copy the arrays p->tags, and p->params, they are allocated
+        from a tre_mem object. */
+      if (p->tags)
+       {
+         int j;
+         for (j = 0; p->tags[j] >= 0; j++);
+         initial[i].tags = xmalloc(sizeof(*p->tags) * (j + 1));
+         if (!initial[i].tags)
+           ERROR_EXIT(REG_ESPACE);
+         memcpy(initial[i].tags, p->tags, sizeof(*p->tags) * (j + 1));
+       }
+      initial[i].params = NULL;
+      if (p->params)
+       {
+         initial[i].params = xmalloc(sizeof(*p->params) * TRE_PARAM_LAST);
+         if (!initial[i].params)
+           ERROR_EXIT(REG_ESPACE);
+         memcpy(initial[i].params, p->params,
+                sizeof(*p->params) * TRE_PARAM_LAST);
+       }
+      initial[i].assertions = p->assertions;
+      i++;
+    }
+  initial[i].state = NULL;
+
+  tnfa->num_transitions = add;
+  tnfa->final = transitions + offs[tree->lastpos[0].position];
+  tnfa->num_states = parse_ctx.position;
+  tnfa->cflags = cflags;
+
+  DPRINT(("final state %d (%p)\n", tree->lastpos[0].position,
+         (void *)tnfa->final));
+
+  tre_mem_destroy(mem);
+  tre_stack_destroy(stack);
+  xfree(counts);
+  xfree(offs);
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  preg->re_magic = RE_MAGIC;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+  preg->TRE_REGEX_T_FIELD = (void *)tnfa;
+#ifdef __LIBC__
+  /* In Libc, we need to retain the locale.  Outside Libc, we already called
+     duplocale() which does the retaining. */
+  XL_RETAIN(tnfa->loc);
+#endif /* __LIBC__ */
+  return REG_OK;
+
+ error_exit:
+  /* Free everything that was allocated and return the error code. */
+  tre_mem_destroy(mem);
+  if (stack != NULL)
+    tre_stack_destroy(stack);
+  if (counts != NULL)
+    xfree(counts);
+  if (offs != NULL)
+    xfree(offs);
+
+  /* Set tnfa into preg, so that calling tre_free() will free the contents
+     of tnfa.  But in Libc, NULL out the loc field since we never retained
+     the locale.  Outside Libc, we let tre_free() call freelocale(). */
+  preg->TRE_REGEX_T_FIELD = (void *)tnfa;
+#ifdef __LIBC__
+  if(tnfa) tnfa->loc = NULL;
+#endif /* __LIBC__ */
+
+  tre_free(preg);
+  return errcode;
+}
+
+
+
+
+void
+tre_free(regex_t *preg)
+{
+  tre_tnfa_t *tnfa;
+  unsigned int i;
+  tre_tnfa_transition_t *trans;
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+  preg->re_magic = 0;
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+  tnfa = (void *)preg->TRE_REGEX_T_FIELD;
+  if (!tnfa)
+    return;
+  preg->TRE_REGEX_T_FIELD = NULL;
+
+  for (i = 0; i < tnfa->num_transitions; i++)
+    if (tnfa->transitions[i].state)
+      {
+       if (tnfa->transitions[i].tags)
+         xfree(tnfa->transitions[i].tags);
+       if (tnfa->transitions[i].assertions & ASSERT_BRACKET_MATCH)
+         xfree(tnfa->transitions[i].u.bracket_match_list);
+       if (tnfa->transitions[i].params)
+         xfree(tnfa->transitions[i].params);
+      }
+  if (tnfa->transitions)
+    xfree(tnfa->transitions);
+
+  if (tnfa->initial)
+    {
+      for (trans = tnfa->initial; trans->state; trans++)
+       {
+         if (trans->tags)
+           xfree(trans->tags);
+         if (trans->params)
+           xfree(trans->params);
+       }
+      xfree(tnfa->initial);
+    }
+
+  if (tnfa->submatch_data)
+    {
+      xfree(tnfa->submatch_data);
+    }
+
+  if (tnfa->tag_directions)
+    xfree(tnfa->tag_directions);
+  if (tnfa->firstpos_chars)
+    xfree(tnfa->firstpos_chars);
+  if (tnfa->minimal_tags)
+    xfree(tnfa->minimal_tags);
+
+  if (tnfa->loc)
+#ifdef __LIBC__
+    XL_RELEASE(tnfa->loc);
+#else /* !__LIBC__ */
+    freelocale(tnfa->loc);
+#endif /* !__LIBC__ */
+
+  if (tnfa->last_matched_branch)
+    xfree(tnfa->last_matched_branch);
+
+  xfree(tnfa);
+}
+
+#ifndef __LIBC__
+char *
+tre_version(void)
+{
+  static char str[256];
+  char *version;
+
+  if (str[0] == 0)
+    {
+      (void) tre_config(TRE_CONFIG_VERSION, &version);
+      (void) snprintf(str, sizeof(str), "TRE %s (BSD)", version);
+    }
+  return str;
+}
+
+int
+tre_config(int query, void *result)
+{
+  int *int_result = result;
+  const char **string_result = result;
+
+  switch (query)
+    {
+    case TRE_CONFIG_APPROX:
+#ifdef TRE_APPROX
+      *int_result = 1;
+#else /* !TRE_APPROX */
+      *int_result = 0;
+#endif /* !TRE_APPROX */
+      return REG_OK;
+
+    case TRE_CONFIG_WCHAR:
+#ifdef TRE_WCHAR
+      *int_result = 1;
+#else /* !TRE_WCHAR */
+      *int_result = 0;
+#endif /* !TRE_WCHAR */
+      return REG_OK;
+
+    case TRE_CONFIG_MULTIBYTE:
+#ifdef TRE_MULTIBYTE
+      *int_result = 1;
+#else /* !TRE_MULTIBYTE */
+      *int_result = 0;
+#endif /* !TRE_MULTIBYTE */
+      return REG_OK;
+
+    case TRE_CONFIG_SYSTEM_ABI:
+#ifdef TRE_CONFIG_SYSTEM_ABI
+      *int_result = 1;
+#else /* !TRE_CONFIG_SYSTEM_ABI */
+      *int_result = 0;
+#endif /* !TRE_CONFIG_SYSTEM_ABI */
+      return REG_OK;
+
+    case TRE_CONFIG_VERSION:
+      *string_result = TRE_VERSION;
+      return REG_OK;
+    }
+
+  return REG_NOMATCH;
+}
+#endif /* !__LIBC__ */
+
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-compile.h b/regex/TRE/lib/tre-compile.h
new file mode 100644 (file)
index 0000000..355ec4d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+  tre-compile.h: Regex compilation definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+
+#ifndef TRE_COMPILE_H
+#define TRE_COMPILE_H 1
+
+typedef struct {
+  int position;
+  int code_min;
+  int code_max;
+  int *tags;
+  int assertions;
+  tre_bracket_match_list_t *bracket_match_list;
+  int backref;
+  int *params;
+  locale_t loc;
+} tre_pos_and_tags_t;
+
+#endif /* TRE_COMPILE_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-internal.h b/regex/TRE/lib/tre-internal.h
new file mode 100644 (file)
index 0000000..86e93d2
--- /dev/null
@@ -0,0 +1,354 @@
+/*
+  tre-internal.h - TRE internal definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifndef TRE_INTERNAL_H
+#define TRE_INTERNAL_H 1
+
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif /* HAVE_WCHAR_H */
+
+#ifdef HAVE_WCTYPE_H
+#include <wctype.h>
+#endif /* !HAVE_WCTYPE_H */
+
+#include <ctype.h>
+
+#ifdef __LIBC__
+#include <xlocale_private.h>
+#else /* !__LIBC__ */
+#include <xlocale.h>
+#endif /* !__LIBC__ */
+
+#include "tre.h"
+#include "tre-last-matched.h"
+
+#ifdef TRE_DEBUG
+#include <stdio.h>
+#define DPRINT(msg) do {printf msg; fflush(stdout);} while(/*CONSTCOND*/0)
+#else /* !TRE_DEBUG */
+#define DPRINT(msg) do { } while(/*CONSTCOND*/0)
+#endif /* !TRE_DEBUG */
+
+#define elementsof(x)  ( sizeof(x) / sizeof(x[0]) )
+
+#ifdef HAVE_MBRTOWC
+#define tre_mbrtowc(pwc, s, n, ps) (mbrtowc((pwc), (s), (n), (ps)))
+/* xlocale */
+#define tre_mbrtowc_l(pwc, s, n, ps, l) (mbrtowc_l((pwc), (s), (n), (ps), (l)))
+#else /* !HAVE_MBRTOWC */
+#ifdef HAVE_MBTOWC
+#define tre_mbrtowc(pwc, s, n, ps) (mbtowc((pwc), (s), (n)))
+#endif /* HAVE_MBTOWC */
+#endif /* !HAVE_MBRTOWC */
+
+#ifdef TRE_MULTIBYTE
+#ifdef HAVE_MBSTATE_T
+#define TRE_MBSTATE
+#endif /* TRE_MULTIBYTE */
+#endif /* HAVE_MBSTATE_T */
+
+/* Define the character types and functions. */
+#ifdef TRE_WCHAR
+
+/* Wide characters. */
+typedef wint_t tre_cint_t;
+#define TRE_CHAR_MAX WCHAR_MAX
+
+#ifdef TRE_MULTIBYTE
+#define TRE_MB_CUR_MAX MB_CUR_MAX
+/* xlocale */
+#define TRE_MB_CUR_MAX_L MB_CUR_MAX_L
+#else /* !TRE_MULTIBYTE */
+#define TRE_MB_CUR_MAX 1
+#endif /* !TRE_MULTIBYTE */
+
+#define tre_isalnum iswalnum
+#define tre_isalpha iswalpha
+#ifdef HAVE_ISWBLANK
+#define tre_isblank iswblank
+#endif /* HAVE_ISWBLANK */
+#define tre_iscntrl iswcntrl
+#define tre_isdigit iswdigit
+#define tre_isgraph iswgraph
+#define tre_islower iswlower
+#define tre_isprint iswprint
+#define tre_ispunct iswpunct
+#define tre_isspace iswspace
+#define tre_isupper iswupper
+#define tre_isxdigit iswxdigit
+
+#define tre_tolower towlower
+#define tre_toupper towupper
+#define tre_strlen  wcslen
+
+/* xlocale */
+#define tre_isalnum_l iswalnum_l
+#define tre_isdigit_l iswdigit_l
+#define tre_islower_l iswlower_l
+#define tre_isupper_l iswupper_l
+#define tre_isxdigit_l iswxdigit_l
+#define tre_tolower_l towlower_l
+#define tre_toupper_l towupper_l
+
+#else /* !TRE_WCHAR */
+
+/* 8 bit characters. */
+typedef short tre_cint_t;
+#define TRE_CHAR_MAX 255
+#define TRE_MB_CUR_MAX 1
+
+#define tre_isalnum isalnum
+#define tre_isalpha isalpha
+#ifdef HAVE_ISASCII
+#define tre_isascii isascii
+#endif /* HAVE_ISASCII */
+#ifdef HAVE_ISBLANK
+#define tre_isblank isblank
+#endif /* HAVE_ISBLANK */
+#define tre_iscntrl iscntrl
+#define tre_isdigit isdigit
+#define tre_isgraph isgraph
+#define tre_islower islower
+#define tre_isprint isprint
+#define tre_ispunct ispunct
+#define tre_isspace isspace
+#define tre_isupper isupper
+#define tre_isxdigit isxdigit
+
+#define tre_tolower(c) (tre_cint_t)(tolower(c))
+#define tre_toupper(c) (tre_cint_t)(toupper(c))
+#define tre_strlen(s)  (strlen((const char*)s))
+
+#endif /* !TRE_WCHAR */
+
+#if defined(TRE_WCHAR) && defined(HAVE_ISWCTYPE) && defined(HAVE_WCTYPE)
+#define TRE_USE_SYSTEM_WCTYPE 1
+#endif
+
+#ifdef TRE_USE_SYSTEM_WCTYPE
+/* Use system provided iswctype() and wctype(). */
+typedef wctype_t tre_ctype_t;
+#define tre_isctype iswctype
+#define tre_ctype   wctype
+
+/* xlocale */
+#define tre_isctype_l iswctype_l
+#define tre_ctype_l   wctype_l
+
+#else /* !TRE_USE_SYSTEM_WCTYPE */
+/* Define our own versions of iswctype() and wctype(). */
+typedef int (*tre_ctype_t)(tre_cint_t);
+#define tre_isctype(c, type) ( (type)(c) )
+tre_ctype_t tre_ctype(const char *name);
+#endif /* !TRE_USE_SYSTEM_WCTYPE */
+
+typedef enum { STR_WIDE, STR_BYTE, STR_MBS,
+#ifdef TRE_STR_USER
+              STR_USER
+#endif /* TRE_STR_USER */
+            } tre_str_type_t;
+
+/* Returns number of bytes to add to (char *)ptr to make it
+   properly aligned for the type. */
+#define ALIGN(ptr, type) \
+  ((((long)ptr) % sizeof(type)) \
+   ? (sizeof(type) - (((long)ptr) % sizeof(type))) \
+   : 0)
+
+#undef MAX
+#undef MIN
+#define MAX(a, b) (((a) >= (b)) ? (a) : (b))
+#define MIN(a, b) (((a) <= (b)) ? (a) : (b))
+
+/* Define STRF to the correct printf formatter for strings. */
+#ifdef TRE_WCHAR
+#define STRF "ls"
+#else /* !TRE_WCHAR */
+#define STRF "s"
+#endif /* !TRE_WCHAR */
+
+/* Types to handle bracket expressions. */
+typedef enum {
+  TRE_BRACKET_MATCH_TYPE_UNUSED = 0,
+  TRE_BRACKET_MATCH_TYPE_CHAR,         /* Single character value */
+  TRE_BRACKET_MATCH_TYPE_RANGE_BEGIN,  /* Collation range begin */
+  TRE_BRACKET_MATCH_TYPE_RANGE_END,    /* Collation range end */
+  TRE_BRACKET_MATCH_TYPE_CLASS,                /* Character class */
+  TRE_BRACKET_MATCH_TYPE_EQUIVALENCE,  /* Collation equivalence value */
+} tre_bracket_match_type_t;
+
+typedef struct {
+  tre_bracket_match_type_t type;
+  tre_cint_t value;
+} tre_bracket_match_t;
+
+#define TRE_BRACKET_MATCH_FLAG_NEGATE  1
+
+typedef struct {
+  int num_bracket_matches;
+  int flags;
+  tre_bracket_match_t bracket_matches[0];
+} tre_bracket_match_list_t;
+
+#define SIZEOF_BRACKET_MATCH_LIST_N(n) (sizeof(tre_bracket_match_list_t) + \
+                                        sizeof(tre_bracket_match_t) * (n))
+#define SIZEOF_BRACKET_MATCH_LIST(l)   SIZEOF_BRACKET_MATCH_LIST_N( \
+                                        (l)->num_bracket_matches)
+
+/* The "count" field is the number of time the tag was set, initially zero.
+   The "first" field contains the first set value (when "count" equals 1).
+   The "value" field contains the current value of the tag, if "count" is
+   greater than zero (the tag's current value is -1 if "count" is zero).
+   The "touch" field is the touch value, a montonically increasing value
+   (maintained by the caller) set each time the tag itself is set. */
+typedef struct {
+  int count;
+  int first;
+  int value;
+  int touch;
+} tre_tag_t;
+
+/* TNFA transition type. A TNFA state is an array of transitions,
+   the terminator is a transition with NULL `state'. */
+typedef struct tnfa_transition tre_tnfa_transition_t;
+
+struct tnfa_transition {
+  /* Range of accepted characters. */
+  tre_cint_t code_min;
+  tre_cint_t code_max;
+  /* Pointer to the destination state. */
+  tre_tnfa_transition_t *state;
+  /* ID number of the destination state. */
+  int state_id;
+  /* -1 terminated array of tags (or NULL). */
+  int *tags;
+  /* Matching parameters settings (or NULL). */
+  int *params;
+  /* Assertion bitmap. */
+  int assertions;
+  /* Assertion parameters. */
+  union {
+    /* Bracket matches. */
+    tre_bracket_match_list_t *bracket_match_list;
+    /* Back reference assertion. */
+    int backref;
+  } u;
+};
+
+
+/* Assertions. */
+#define ASSERT_AT_BOL            1   /* Beginning of line. */
+#define ASSERT_AT_EOL            2   /* End of line. */
+#define ASSERT_BRACKET_MATCH     4   /* Matches in `bracket_match_list'. */
+#define ASSERT_AT_BOW            8   /* Beginning of word. */
+#define ASSERT_AT_EOW           16   /* End of word. */
+#define ASSERT_AT_WB            32   /* Word boundary. */
+#define ASSERT_AT_WB_NEG        64   /* Not a word boundary. */
+#define ASSERT_BACKREF         128   /* A back reference in `backref'. */
+#define ASSERT_LAST            128
+
+/* Tag directions. */
+typedef enum {
+  TRE_TAG_MINIMIZE = 0,
+  TRE_TAG_MAXIMIZE,
+  TRE_TAG_LEFT_MAXIMIZE,
+} tre_tag_direction_t;
+
+/* Parameters that can be changed dynamically while matching. */
+typedef enum {
+  TRE_PARAM_COST_INS       = 0,
+  TRE_PARAM_COST_DEL       = 1,
+  TRE_PARAM_COST_SUBST     = 2,
+  TRE_PARAM_COST_MAX       = 3,
+  TRE_PARAM_MAX_INS        = 4,
+  TRE_PARAM_MAX_DEL        = 5,
+  TRE_PARAM_MAX_SUBST      = 6,
+  TRE_PARAM_MAX_ERR        = 7,
+  TRE_PARAM_DEPTH          = 8,
+  TRE_PARAM_LAST           = 9
+} tre_param_t;
+
+/* Unset matching parameter */
+#define TRE_PARAM_UNSET -1
+
+/* Signifies the default matching parameter value. */
+#define TRE_PARAM_DEFAULT -2
+
+/* Instructions to compute submatch register values from tag values
+   after a successful match.  */
+struct tre_submatch_data {
+  /* Tag that gives the value for rm_so (submatch start offset). */
+  int so_tag;
+  /* Tag that gives the value for rm_eo (submatch end offset). */
+  int eo_tag;
+};
+
+typedef struct tre_submatch_data tre_submatch_data_t;
+
+
+/* TNFA definition. */
+typedef struct tnfa tre_tnfa_t;
+
+struct tnfa {
+  tre_tnfa_transition_t *transitions;
+  tre_tnfa_transition_t *initial;
+  tre_tnfa_transition_t *final;
+  tre_submatch_data_t *submatch_data;
+  char *firstpos_chars;
+  tre_tag_direction_t *tag_directions;
+  int *minimal_tags;
+  tre_last_matched_branch_t *last_matched_branch;
+  locale_t loc;
+  unsigned int num_transitions;
+  int first_char;
+  unsigned int num_submatches;
+  unsigned int num_submatches_invisible;
+  int num_tags;
+  int num_minimals;
+  int end_tag;
+  int num_states;
+  int cflags;
+  int have_backrefs;
+  int num_reorder_tags;
+  int have_approx;
+  int params_depth;
+};
+
+__private_extern__ int
+tre_compile(regex_t * __restrict preg, const tre_char_t * __restrict regex, size_t n, int cflags,
+           locale_t __restrict loc);
+
+__private_extern__ void
+tre_free(regex_t *preg);
+
+__private_extern__ reg_errcode_t
+tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[ __restrict ], int cflags,
+               const tre_tnfa_t * __restrict tnfa, const tre_tag_t * __restrict tags, int match_eo);
+
+__private_extern__ reg_errcode_t
+tre_tnfa_run_parallel(const tre_tnfa_t * __restrict tnfa, const void * __restrict string, int len,
+                     tre_str_type_t type, tre_tag_t * __restrict match_tags, int eflags,
+                     int * __restrict match_end_ofs);
+
+__private_extern__ reg_errcode_t
+tre_tnfa_run_backtrack(const tre_tnfa_t * __restrict tnfa, const void * __restrict string,
+                      int len, tre_str_type_t type, tre_tag_t * __restrict match_tags,
+                      int eflags, int * __restrict match_end_ofs);
+
+#ifdef TRE_APPROX
+__private_extern__ reg_errcode_t
+tre_tnfa_run_approx(const tre_tnfa_t * __restrict tnfa, const void * __restrict string, int len,
+                   tre_str_type_t type, tre_tag_t * __restrict match_tags,
+                   regamatch_t * __restrict match, regaparams_t params,
+                   int eflags, int * __restrict match_end_ofs);
+#endif /* TRE_APPROX */
+
+#endif /* TRE_INTERNAL_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-match-backtrack.c b/regex/TRE/lib/tre-match-backtrack.c
new file mode 100644 (file)
index 0000000..734f088
--- /dev/null
@@ -0,0 +1,789 @@
+/*
+  tre-match-backtrack.c - TRE backtracking regex matching engine
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+/*
+  This matcher is for regexps that use back referencing.  Regexp matching
+  with back referencing is an NP-complete problem on the number of back
+  references.  The easiest way to match them is to use a backtracking
+  routine which basically goes through all possible paths in the TNFA
+  and chooses the one which results in the best (leftmost and longest)
+  match.  This can be spectacularly expensive and may run out of stack
+  space, but there really is no better known generic algorithm.         Quoting
+  Henry Spencer from comp.compilers:
+  <URL: http://compilers.iecc.com/comparch/article/93-03-102>
+
+    POSIX.2 REs require longest match, which is really exciting to
+    implement since the obsolete ("basic") variant also includes
+    \<digit>.  I haven't found a better way of tackling this than doing
+    a preliminary match using a DFA (or simulation) on a modified RE
+    that just replicates subREs for \<digit>, and then doing a
+    backtracking match to determine whether the subRE matches were
+    right.  This can be rather slow, but I console myself with the
+    thought that people who use \<digit> deserve very slow execution.
+    (Pun unintentional but very appropriate.)
+
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+/* Unset TRE_USE_ALLOCA to avoid using the stack to hold all the state
+   info while running */
+#undef TRE_USE_ALLOCA
+
+#ifdef TRE_USE_ALLOCA
+/* AIX requires this to be the first thing in the file.         */
+#ifndef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+#endif /* TRE_USE_ALLOCA */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif /* HAVE_WCHAR_H */
+#ifdef HAVE_WCTYPE_H
+#include <wctype.h>
+#endif /* HAVE_WCTYPE_H */
+#ifndef TRE_WCHAR
+#include <ctype.h>
+#endif /* !TRE_WCHAR */
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif /* HAVE_MALLOC_H */
+
+#include "tre-internal.h"
+#include "tre-mem.h"
+#include "tre-match-utils.h"
+#include "tre.h"
+#include "xmalloc.h"
+
+typedef struct {
+  int pos;
+  unsigned int pos_add_next;
+  const char *str_byte;
+#ifdef TRE_WCHAR
+  const wchar_t *str_wide;
+#endif /* TRE_WCHAR */
+  tre_tnfa_transition_t *state;
+  int state_id;
+  int next_c;
+  tre_tag_t *tags;
+#ifdef TRE_MBSTATE
+  mbstate_t mbstate;
+#endif /* TRE_MBSTATE */
+} tre_backtrack_item_t;
+
+typedef struct tre_backtrack_struct {
+  tre_backtrack_item_t item;
+  struct tre_backtrack_struct *prev;
+  struct tre_backtrack_struct *next;
+} *tre_backtrack_t;
+
+#ifdef TRE_WCHAR
+#define BT_STACK_WIDE_IN(_str_wide)    stack->item.str_wide = (_str_wide)
+#define BT_STACK_WIDE_OUT              (str_wide) = stack->item.str_wide
+#else /* !TRE_WCHAR */
+#define BT_STACK_WIDE_IN(_str_wide)
+#define BT_STACK_WIDE_OUT
+#endif /* !TRE_WCHAR */
+
+#ifdef TRE_MBSTATE
+#define BT_STACK_MBSTATE_IN  stack->item.mbstate = (mbstate)
+#define BT_STACK_MBSTATE_OUT (mbstate) = stack->item.mbstate
+#else /* !TRE_MBSTATE */
+#define BT_STACK_MBSTATE_IN
+#define BT_STACK_MBSTATE_OUT
+#endif /* !TRE_MBSTATE */
+
+
+#ifdef TRE_USE_ALLOCA
+#define tre_bt_mem_new           tre_mem_newa
+#define tre_bt_mem_alloc         tre_mem_alloca
+#define tre_bt_mem_destroy(obj)          do { } while (0)
+#else /* !TRE_USE_ALLOCA */
+#define tre_bt_mem_new           tre_mem_new
+#define tre_bt_mem_alloc         tre_mem_alloc
+#define tre_bt_mem_destroy       tre_mem_destroy
+#endif /* !TRE_USE_ALLOCA */
+
+
+#define BT_STACK_PUSH(_pos, _pos_add_next, _str_byte, _str_wide, _state, _state_id, _next_c, _tags, _mbstate) \
+  do                                                                         \
+    {                                                                        \
+      if (!stack->next)                                                              \
+       {                                                                     \
+         tre_backtrack_t s;                                                  \
+         s = tre_bt_mem_alloc(mem, sizeof(*s));                              \
+         if (!s)                                                             \
+           {                                                                 \
+             tre_bt_mem_destroy(mem);                                        \
+             if (tags)                                                       \
+               xfree(tags);                                                  \
+             if (pmatch)                                                     \
+               xfree(pmatch);                                                \
+             if (states_seen)                                                \
+               xfree(states_seen);                                           \
+             return REG_ESPACE;                                              \
+           }                                                                 \
+         s->prev = stack;                                                    \
+         s->next = NULL;                                                     \
+         s->item.tags = tre_bt_mem_alloc(mem,                                \
+                                         num_tags * sizeof(*tags));          \
+         if (!s->item.tags)                                                  \
+           {                                                                 \
+             tre_bt_mem_destroy(mem);                                        \
+             if (tags)                                                       \
+               xfree(tags);                                                  \
+             if (pmatch)                                                     \
+               xfree(pmatch);                                                \
+             if (states_seen)                                                \
+               xfree(states_seen);                                           \
+             return REG_ESPACE;                                              \
+           }                                                                 \
+         stack->next = s;                                                    \
+         stack = s;                                                          \
+       }                                                                     \
+      else                                                                   \
+       stack = stack->next;                                                  \
+      stack->item.pos = (_pos);                                                      \
+      stack->item.pos_add_next = (_pos_add_next);                            \
+      stack->item.str_byte = (_str_byte);                                    \
+      BT_STACK_WIDE_IN(_str_wide);                                           \
+      stack->item.state = (_state);                                          \
+      stack->item.state_id = (_state_id);                                    \
+      stack->item.next_c = (_next_c);                                        \
+      memcpy(stack->item.tags, (_tags), num_tags * sizeof(*(_tags)));         \
+      BT_STACK_MBSTATE_IN;                                                   \
+    }                                                                        \
+  while (/*CONSTCOND*/0)
+
+#ifdef TRE_STR_USER
+#define BT_STACK_POP()                                                       \
+  do                                                                         \
+    {                                                                        \
+      assert(stack->prev);                                                   \
+      pos = stack->item.pos;                                                 \
+      pos_add_next = stack->item.pos_add_next;                               \
+      if (type == STR_USER)                                                   \
+        str_source->rewind(pos + pos_add_next, str_source->context);          \
+      str_byte = stack->item.str_byte;                                       \
+      BT_STACK_WIDE_OUT;                                                     \
+      state = stack->item.state;                                             \
+      next_c = stack->item.next_c;                                           \
+      memcpy(tags, stack->item.tags, num_tags * sizeof(*tags));               \
+      BT_STACK_MBSTATE_OUT;                                                  \
+      stack = stack->prev;                                                   \
+    }                                                                        \
+  while (/*CONSTCOND*/0)
+#else /* !TRE_STR_USER */
+#define BT_STACK_POP()                                                       \
+  do                                                                         \
+    {                                                                        \
+      assert(stack->prev);                                                   \
+      pos = stack->item.pos;                                                 \
+      pos_add_next = stack->item.pos_add_next;                               \
+      str_byte = stack->item.str_byte;                                       \
+      BT_STACK_WIDE_OUT;                                                     \
+      state = stack->item.state;                                             \
+      next_c = stack->item.next_c;                                           \
+      memcpy(tags, stack->item.tags, num_tags * sizeof(*tags));               \
+      BT_STACK_MBSTATE_OUT;                                                  \
+      stack = stack->prev;                                                   \
+    }                                                                        \
+  while (/*CONSTCOND*/0)
+#endif /* !TRE_STR_USER */
+
+#undef MIN
+#define MIN(a, b) ((a) <= (b) ? (a) : (b))
+
+reg_errcode_t
+tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string,
+                      int len, tre_str_type_t type, tre_tag_t *match_tags,
+                      int eflags, int *match_end_ofs)
+{
+  /* State variables required by GET_NEXT_WCHAR. */
+  tre_char_t prev_c = 0, next_c = 0;
+  const char *str_byte = string;
+  int pos = 0;
+  unsigned int pos_add_next = 1;
+#ifdef TRE_WCHAR
+  const wchar_t *str_wide = string;
+#ifdef TRE_MBSTATE
+  mbstate_t mbstate;
+#endif /* TRE_MBSTATE */
+#endif /* TRE_WCHAR */
+  int reg_notbol = eflags & REG_NOTBOL;
+  int reg_noteol = eflags & REG_NOTEOL;
+  int reg_newline = tnfa->cflags & REG_NEWLINE;
+#ifdef TRE_STR_USER
+  int str_user_end = 0;
+#endif /* TRE_STR_USER */
+  int i;
+
+  /* These are used to remember the necessary values of the above
+     variables to return to the position where the current search
+     started from. */
+  int next_c_start;
+  const char *str_byte_start;
+  int pos_start = -1;
+#ifdef TRE_WCHAR
+  const wchar_t *str_wide_start;
+#endif /* TRE_WCHAR */
+#ifdef TRE_MBSTATE
+  mbstate_t mbstate_start;
+#endif /* TRE_MBSTATE */
+
+  /* End offset of best match so far, or -1 if no match found yet. */
+  int match_eo = -1;
+  /* Tag arrays. */
+  int *next_tags;
+  tre_tag_t *tags = NULL;
+  /* Current TNFA state. */
+  tre_tnfa_transition_t *state;
+  int *states_seen = NULL;
+
+  /* Memory allocator to for allocating the backtracking stack. */
+  tre_mem_t mem = tre_bt_mem_new();
+
+  /* The backtracking stack. */
+  tre_backtrack_t stack;
+
+  tre_tnfa_transition_t *trans_i;
+  regmatch_t *pmatch = NULL;
+  reg_errcode_t ret;
+
+  int num_tags = tnfa->num_tags;
+  int touch = 1;
+  char *buf;
+  int tbytes;
+
+#ifdef TRE_MBSTATE
+  memset(&mbstate, '\0', sizeof(mbstate));
+#endif /* TRE_MBSTATE */
+
+  if (!mem)
+    return REG_ESPACE;
+  stack = tre_bt_mem_alloc(mem, sizeof(*stack));
+  if (!stack)
+    {
+      ret = REG_ESPACE;
+      goto error_exit;
+    }
+  stack->prev = NULL;
+  stack->next = NULL;
+
+  DPRINT(("tnfa_execute_backtrack, input type %d\n", type));
+  DPRINT(("len = %d\n", len));
+
+  {
+    int pbytes, sbytes, total_bytes;
+    char *tmp_buf;
+    /* Compute the length of the block we need. */
+    tbytes = sizeof(*tags) * num_tags;
+    pbytes = sizeof(*pmatch) * tnfa->num_submatches;
+    sbytes = sizeof(*states_seen) * tnfa->num_states;
+    total_bytes =
+      (sizeof(long) - 1) * 2 /* for alignment paddings */
+      + tbytes + pbytes + sbytes;
+
+    DPRINT(("tre_tnfa_run_backtrack, allocate %d bytes\n", total_bytes));
+    /* Allocate the memory. */
+#ifdef TRE_USE_ALLOCA
+    buf = alloca(total_bytes);
+#else /* !TRE_USE_ALLOCA */
+    buf = xmalloc((unsigned)total_bytes);
+#endif /* !TRE_USE_ALLOCA */
+    if (buf == NULL)
+      return REG_ESPACE;
+
+    /* Get the various pointers within tmp_buf (properly aligned). */
+    tags = (void *)buf;
+    tmp_buf = buf + tbytes;
+    tmp_buf += ALIGN(tmp_buf, long);
+    pmatch = (void *)tmp_buf;
+    tmp_buf += pbytes;
+    tmp_buf += ALIGN(tmp_buf, long);
+    states_seen = (void *)tmp_buf;
+  }
+
+ retry:
+  {
+    memset(tags, 0, num_tags * sizeof(*tags));
+    if (match_tags)
+      memset(match_tags, 0, num_tags * sizeof(*match_tags));
+    for (i = 0; i < tnfa->num_states; i++)
+      states_seen[i] = 0;
+  }
+
+  state = NULL;
+  pos = pos_start;
+#ifdef TRE_STR_USER
+  if (type == STR_USER)
+    str_source->rewind(pos + pos_add_next, str_source->context);
+#endif /* TRE_STR_USER */
+  GET_NEXT_WCHAR();
+  pos_start = pos;
+  next_c_start = next_c;
+  str_byte_start = str_byte;
+#ifdef TRE_WCHAR
+  str_wide_start = str_wide;
+#endif /* TRE_WCHAR */
+#ifdef TRE_MBSTATE
+  mbstate_start = mbstate;
+#endif /* TRE_MBSTATE */
+
+  /* Handle initial states. */
+  next_tags = NULL;
+  for (trans_i = tnfa->initial; trans_i->state; trans_i++)
+    {
+      DPRINT(("> init %p, prev_c %lc\n", trans_i->state, (tre_cint_t)prev_c));
+      if (trans_i->assertions && CHECK_ASSERTIONS(trans_i->assertions))
+       {
+         DPRINT(("assert failed\n"));
+         continue;
+       }
+      if (state == NULL)
+       {
+         /* Start from this state. */
+         state = trans_i->state;
+         next_tags = trans_i->tags;
+       }
+      else
+       {
+         /* Backtrack to this state. */
+         DPRINT(("saving state %d for backtracking\n", trans_i->state_id));
+         BT_STACK_PUSH(pos, pos_add_next, str_byte, str_wide, trans_i->state,
+                       trans_i->state_id, next_c, tags, mbstate);
+         {
+           int *tmp = trans_i->tags;
+           if (tmp)
+             {
+               while (*tmp >= 0)
+                 tre_tag_set(stack->item.tags, *tmp++, pos, touch);
+               touch++;
+             }
+         }
+       }
+    }
+
+  if (next_tags)
+    {
+      for (; *next_tags >= 0; next_tags++)
+       tre_tag_set(tags, *next_tags, pos, touch);
+      touch++;
+    }
+
+
+  DPRINT(("entering match loop, pos %d, str_byte %p\n", pos, str_byte));
+  DPRINT(("pos:chr/code | state and tags\n"));
+  DPRINT(("-------------+------------------------------------------------\n"));
+
+  if (state == NULL)
+    goto backtrack;
+
+  while (/*CONSTCOND*/1)
+    {
+      tre_tnfa_transition_t *next_state;
+      int empty_br_match;
+
+      DPRINT(("start loop\n"));
+
+      if (match_eo >= 0 && tnfa->num_minimals)
+       {
+         int skip = 0;
+#ifdef TRE_DEBUG
+         DPRINT(("Checking minimal conditions: match_eo=%d match_tags=",
+                 match_eo));
+         tre_print_tags(match_tags, tnfa->num_tags);
+         DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+         for (i = 0; tnfa->minimal_tags[i] >= 0; i += 2)
+           {
+             int end = tnfa->minimal_tags[i];
+             int start = tnfa->minimal_tags[i + 1];
+             DPRINT(("  Minimal start %d, end %d\n", start, end));
+             if (tre_minimal_tag_order(start, end, match_tags, tags) > 0)
+               {
+                 skip = 1;
+                 break;
+               }
+           }
+         if (!skip)
+           {
+#ifdef TRE_DEBUG
+             DPRINT(("  Keeping tags="));
+             tre_print_tags(tags, tnfa->num_tags);
+             DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+           }
+         else
+           {
+#ifdef TRE_DEBUG
+             DPRINT(("  Throwing out tags="));
+             tre_print_tags(tags, tnfa->num_tags);
+             DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+             goto backtrack;
+           }
+       }
+
+      if (state == tnfa->final)
+       {
+         DPRINT(("  match found, match_eo=%d pos=%d\n", match_eo, pos));
+
+         if (match_eo >= 0 && tnfa->num_minimals)
+           {
+             int compare = 0;
+#ifdef TRE_DEBUG
+             DPRINT(("Checking minimal conditions: match_eo=%d "
+                     "match_tags=", match_eo));
+             tre_print_tags(match_tags, tnfa->num_tags);
+             DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+             for (i = 0; tnfa->minimal_tags[i] >= 0; i += 2)
+               {
+                 int end = tnfa->minimal_tags[i];
+                 int start = tnfa->minimal_tags[i + 1];
+                 DPRINT(("  Minimal start %d, end %d\n", start, end));
+                 if ((compare = tre_minimal_tag_order(start, end,
+                                          match_tags, tags)) != 0)
+                   break;
+               }
+             if (compare > 0)
+               {
+#ifdef TRE_DEBUG
+                 DPRINT(("      Throwing out new match, tags="));
+                 tre_print_tags(tags, tnfa->num_tags);
+                 DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+                 goto backtrack;
+               }
+             else if (compare < 0)
+               {
+#ifdef TRE_DEBUG
+                 DPRINT(("      Throwing out old match, tags="));
+                 tre_print_tags(match_tags, tnfa->num_tags);
+                 DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+                 match_eo = -1;
+               }
+           }
+
+         if (match_eo < pos
+             || (match_eo == pos
+                 && match_tags
+                 && tre_tag_order(tnfa->num_tags, tnfa->tag_directions,
+                                  tags, match_tags)))
+           {
+             /* This match wins the previous match. */
+#ifdef TRE_DEBUG
+             DPRINT(("  win previous tags="));
+             tre_print_tags(tags, tnfa->num_tags);
+             DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+             match_eo = pos;
+             if (match_tags)
+               memcpy(match_tags, tags, num_tags * sizeof(*tags));
+           }
+         /* Our TNFAs never have transitions leaving from the final state,
+            so we jump right to backtracking. */
+         goto backtrack;
+       }
+
+#ifdef TRE_DEBUG
+      DPRINT(("%3d:%2lc/%05d | %p ", pos, (tre_cint_t)next_c, (int)next_c,
+             state));
+      tre_print_tags(tags, tnfa->num_tags);
+      DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+
+      /* Go to the next character in the input string. */
+      empty_br_match = 0;
+      trans_i = state;
+      if (trans_i->state && trans_i->assertions & ASSERT_BACKREF)
+       {
+         /* This is a back reference state.  All transitions leaving from
+            this state have the same back reference "assertion".  Instead
+            of reading the next character, we match the back reference. */
+         int so, eo, bt = trans_i->u.backref;
+         int bt_len;
+         int result;
+
+         DPRINT(("  should match back reference %d\n", bt));
+         /* Get the substring we need to match against.  Remember to
+            turn off REG_NOSUB temporarily. */
+         ret = tre_fill_pmatch(bt + 1, pmatch, tnfa->cflags & ~REG_NOSUB,
+                         tnfa, tags, pos);
+         if (ret != REG_OK) goto error_exit;
+         so = pmatch[bt].rm_so;
+         eo = pmatch[bt].rm_eo;
+         bt_len = eo - so;
+
+#ifdef TRE_DEBUG
+         {
+           int slen;
+           if (len < 0)
+             slen = bt_len;
+           else
+             slen = MIN(bt_len, len - pos);
+
+           if (type == STR_BYTE)
+             {
+               DPRINT(("  substring (len %d) is [%d, %d]: '%.*s'\n",
+                       bt_len, so, eo, bt_len, (char*)string + so));
+               DPRINT(("  current string is '%.*s'\n", slen, str_byte - 1));
+             }
+#ifdef TRE_WCHAR
+           else if (type == STR_WIDE)
+             {
+               DPRINT(("  substring (len %d) is [%d, %d]: '%.*" STRF "'\n",
+                       bt_len, so, eo, bt_len, (wchar_t*)string + so));
+               DPRINT(("  current string is '%.*" STRF "'\n",
+                       slen, str_wide - 1));
+             }
+#endif /* TRE_WCHAR */
+         }
+#endif
+
+         if (so < 0)
+           {
+             result = 1; /* Back reference of nomatch doesn't match */
+           }
+         else if (len < 0)
+           {
+#ifdef TRE_STR_USER
+             if (type == STR_USER)
+               result = str_source->compare((unsigned)so, (unsigned)pos,
+                                            (unsigned)bt_len,
+                                            str_source->context);
+             else
+#endif /* TRE_STR_USER */
+#ifdef TRE_WCHAR
+             if (type == STR_WIDE)
+               result = wcsncmp((const wchar_t*)string + so, str_wide - 1,
+                                (size_t)bt_len);
+             else
+#endif /* TRE_WCHAR */
+             result = strncmp((const char*)string + so, str_byte - 1,
+                                (size_t)bt_len);
+           }
+         else if (len - pos < bt_len)
+           result = 1;
+#ifdef TRE_WCHAR
+         else if (type == STR_WIDE)
+           result = wmemcmp((const wchar_t*)string + so, str_wide - 1,
+                            (size_t)bt_len);
+#endif /* TRE_WCHAR */
+         else
+           result = memcmp((const char*)string + so, str_byte - 1,
+                           (size_t)bt_len);
+
+         if (result == 0)
+           {
+             /* Back reference matched.  Check for infinite loop. */
+             if (bt_len == 0)
+               empty_br_match = 1;
+             if (empty_br_match && states_seen[trans_i->state_id])
+               {
+                 DPRINT(("  avoid loop\n"));
+                 goto backtrack;
+               }
+
+             states_seen[trans_i->state_id] = empty_br_match;
+
+             /* Advance in input string and resync `prev_c', `next_c'
+                and pos. */
+             DPRINT(("  back reference matched\n"));
+             str_byte += bt_len - 1;
+#ifdef TRE_WCHAR
+             str_wide += bt_len - 1;
+#endif /* TRE_WCHAR */
+             pos += bt_len - 1;
+             GET_NEXT_WCHAR();
+             DPRINT(("  pos now %d\n", pos));
+           }
+         else
+           {
+             DPRINT(("  back reference did not match\n"));
+             goto backtrack;
+           }
+       }
+      else
+       {
+         /* Check for end of string. */
+         if (len < 0)
+           {
+#ifdef TRE_STR_USER
+             if (type == STR_USER)
+               {
+                 if (str_user_end)
+                   goto backtrack;
+               }
+             else
+#endif /* TRE_STR_USER */
+             if (next_c == L'\0')
+               goto backtrack;
+           }
+         else
+           {
+             if (pos >= len)
+               goto backtrack;
+           }
+
+         /* Read the next character. */
+         GET_NEXT_WCHAR();
+       }
+
+      next_state = NULL;
+      for (trans_i = state; trans_i->state; trans_i++)
+       {
+         DPRINT(("  transition %d-%d (%c-%c) %d to %d\n",
+                 trans_i->code_min, trans_i->code_max,
+                 trans_i->code_min, trans_i->code_max,
+                 trans_i->assertions, trans_i->state_id));
+         if (trans_i->code_min <= (tre_cint_t)prev_c
+             && trans_i->code_max >= (tre_cint_t)prev_c)
+           {
+             if (trans_i->assertions
+                 && (CHECK_ASSERTIONS(trans_i->assertions)
+                     || CHECK_CHAR_CLASSES(trans_i, tnfa, eflags)))
+               {
+                 DPRINT(("  assertion failed\n"));
+                 continue;
+               }
+
+             if (next_state == NULL)
+               {
+                 /* First matching transition. */
+                 DPRINT(("  Next state is %d\n", trans_i->state_id));
+                 next_state = trans_i->state;
+                 next_tags = trans_i->tags;
+               }
+             else
+               {
+                 /* Second matching transition.  We may need to backtrack here
+                    to take this transition instead of the first one, so we
+                    push this transition in the backtracking stack so we can
+                    jump back here if needed. */
+                 DPRINT(("  saving state %d for backtracking\n",
+                         trans_i->state_id));
+                 BT_STACK_PUSH(pos, pos_add_next, str_byte, str_wide,
+                               trans_i->state, trans_i->state_id, next_c,
+                               tags, mbstate);
+                 {
+                   int *tmp;
+                   for (tmp = trans_i->tags; tmp && *tmp >= 0; tmp++)
+                     tre_tag_set(stack->item.tags, *tmp, pos, touch);
+                   touch++;
+                 }
+#if 0 /* XXX - it's important not to look at all transitions here to keep
+        the stack small! */
+                 break;
+#endif
+               }
+           }
+       }
+
+      if (next_state != NULL)
+       {
+         /* Matching transitions were found.  Take the first one. */
+         state = next_state;
+
+         /* Update the tag values. */
+         if (next_tags)
+           {
+             while (*next_tags >= 0)
+               tre_tag_set(tags, *next_tags++, pos, touch);
+             touch++;
+           }
+       }
+      else
+       {
+       backtrack:
+         /* A matching transition was not found.  Try to backtrack. */
+         if (stack->prev)
+           {
+             DPRINT(("  backtracking\n"));
+             if (stack->item.state->assertions & ASSERT_BACKREF)
+               {
+                 DPRINT(("  states_seen[%d] = 0\n",
+                         stack->item.state_id));
+                 states_seen[stack->item.state_id] = 0;
+               }
+
+             BT_STACK_POP();
+           }
+         else if (match_eo < 0)
+           {
+             /* Try starting from a later position in the input string. */
+             /* Check for end of string. */
+             if (pos == pos_start)
+               {
+                 if (len < 0)
+                   {
+                     if (next_c == L'\0')
+                       {
+                         DPRINT(("end of string.\n"));
+                         break;
+                       }
+                   }
+                 else
+                   {
+                     if (pos >= len)
+                       {
+                         DPRINT(("end of string.\n"));
+                         break;
+                       }
+                   }
+               }
+             DPRINT(("restarting from next start position\n"));
+             next_c = next_c_start;
+#ifdef TRE_MBSTATE
+             mbstate = mbstate_start;
+#endif /* TRE_MBSTATE */
+             str_byte = str_byte_start;
+#ifdef TRE_WCHAR
+             str_wide = str_wide_start;
+#endif /* TRE_WCHAR */
+             goto retry;
+           }
+         else
+           {
+             DPRINT(("finished\n"));
+             break;
+           }
+       }
+    }
+
+  ret = match_eo >= 0 ? REG_OK : REG_NOMATCH;
+  *match_end_ofs = match_eo;
+
+ error_exit:
+  tre_bt_mem_destroy(mem);
+#ifndef TRE_USE_ALLOCA
+  if (buf)
+    xfree(buf);
+#endif /* !TRE_USE_ALLOCA */
+
+  return ret;
+}
diff --git a/regex/TRE/lib/tre-match-parallel.c b/regex/TRE/lib/tre-match-parallel.c
new file mode 100644 (file)
index 0000000..c6ce364
--- /dev/null
@@ -0,0 +1,526 @@
+/*
+  tre-match-parallel.c - TRE parallel regex matching engine
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+/*
+  This algorithm searches for matches basically by reading characters
+  in the searched string one by one, starting at the beginning.         All
+  matching paths in the TNFA are traversed in parallel.         When two or
+  more paths reach the same state, exactly one is chosen according to
+  tag ordering rules; if returning submatches is not required it does
+  not matter which path is chosen.
+
+  The worst case time required for finding the leftmost and longest
+  match, or determining that there is no match, is always linearly
+  dependent on the length of the text being searched.
+
+  This algorithm cannot handle TNFAs with back referencing nodes.
+  See `tre-match-backtrack.c'.
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+/* Unset TRE_USE_ALLOCA to avoid using the stack to hold all the state
+   info while running */
+#undef TRE_USE_ALLOCA
+
+#ifdef TRE_USE_ALLOCA
+/* AIX requires this to be the first thing in the file.         */
+#ifndef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+#endif /* TRE_USE_ALLOCA */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif /* HAVE_WCHAR_H */
+#ifdef HAVE_WCTYPE_H
+#include <wctype.h>
+#endif /* HAVE_WCTYPE_H */
+#ifndef TRE_WCHAR
+#include <ctype.h>
+#endif /* !TRE_WCHAR */
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif /* HAVE_MALLOC_H */
+
+#include "tre-internal.h"
+#include "tre-match-utils.h"
+#include "tre.h"
+#include "xmalloc.h"
+
+
+
+typedef struct {
+  tre_tnfa_transition_t *state;
+  tre_tag_t *tags;
+} tre_tnfa_reach_t;
+
+typedef struct {
+  int pos;
+  tre_tag_t **tags;
+} tre_reach_pos_t;
+
+
+#ifdef TRE_DEBUG
+static void
+tre_print_reach1(tre_tnfa_transition_t *state, tre_tag_t *tags, int num_tags)
+{
+  DPRINT((" %p", (void *)state));
+  if (num_tags > 0)
+    {
+      DPRINT(("/"));
+      tre_print_tags(tags, num_tags);
+    }
+}
+
+static void
+tre_print_reach(const tre_tnfa_t *tnfa, tre_tnfa_reach_t *reach, int num_tags)
+{
+  while (reach->state != NULL)
+    {
+      tre_print_reach1(reach->state, reach->tags, num_tags);
+      reach++;
+    }
+  DPRINT(("\n"));
+
+}
+#endif /* TRE_DEBUG */
+
+reg_errcode_t
+tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, int len,
+                     tre_str_type_t type, tre_tag_t *match_tags, int eflags,
+                     int *match_end_ofs)
+{
+  /* State variables required by GET_NEXT_WCHAR. */
+  tre_char_t prev_c = 0, next_c = 0;
+  const char *str_byte = string;
+  int pos = -1;
+  unsigned int pos_add_next = 1;
+#ifdef TRE_WCHAR
+  const wchar_t *str_wide = string;
+#ifdef TRE_MBSTATE
+  mbstate_t mbstate;
+#endif /* TRE_MBSTATE */
+#endif /* TRE_WCHAR */
+  int reg_notbol = eflags & REG_NOTBOL;
+  int reg_noteol = eflags & REG_NOTEOL;
+  int reg_newline = tnfa->cflags & REG_NEWLINE;
+#ifdef TRE_STR_USER
+  int str_user_end = 0;
+#endif /* TRE_STR_USER */
+
+  char *buf;
+  tre_tnfa_transition_t *trans_i;
+  tre_tnfa_reach_t *reach, *reach_next, *reach_i, *reach_next_i;
+  tre_reach_pos_t *reach_pos;
+  int *tag_i;
+  int num_tags, i;
+
+  int match_eo = -1;      /* end offset of match (-1 if no match found yet) */
+#ifdef TRE_DEBUG
+  int once;
+#endif /* TRE_DEBUG */
+  tre_tag_t *tmp_tags = NULL;
+  tre_tag_t *tmp_iptr;
+  int tbytes;
+  int touch = 1;
+
+#ifdef TRE_MBSTATE
+  memset(&mbstate, '\0', sizeof(mbstate));
+#endif /* TRE_MBSTATE */
+
+  DPRINT(("tre_tnfa_run_parallel, input type %d\n", type));
+
+  if (!match_tags)
+    num_tags = 0;
+  else
+    num_tags = tnfa->num_tags;
+
+  /* Allocate memory for temporary data required for matching. This needs to
+     be done for every matching operation to be thread safe.  This allocates
+     everything in a single large block from the stack frame using alloca()
+     or with malloc() if alloca is unavailable. */
+  {
+    int rbytes, pbytes, total_bytes;
+    char *tmp_buf;
+    /* Compute the length of the block we need. */
+    tbytes = sizeof(*tmp_tags) * num_tags;
+    rbytes = sizeof(*reach_next) * (tnfa->num_states + 1);
+    pbytes = sizeof(*reach_pos) * tnfa->num_states;
+    total_bytes =
+      (sizeof(long) - 1) * 4 /* for alignment paddings */
+      + (rbytes + tbytes * tnfa->num_states) * 2 + tbytes + pbytes;
+
+    DPRINT(("tre_tnfa_run_parallel, allocate %d bytes\n", total_bytes));
+    /* Allocate the memory. */
+#ifdef TRE_USE_ALLOCA
+    buf = alloca(total_bytes);
+#else /* !TRE_USE_ALLOCA */
+    buf = xmalloc((unsigned)total_bytes);
+#endif /* !TRE_USE_ALLOCA */
+    if (buf == NULL)
+      return REG_ESPACE;
+    memset(buf, 0, (size_t)total_bytes);
+
+    /* Get the various pointers within tmp_buf (properly aligned). */
+    tmp_tags = (void *)buf;
+    tmp_buf = buf + tbytes;
+    tmp_buf += ALIGN(tmp_buf, long);
+    reach_next = (void *)tmp_buf;
+    tmp_buf += rbytes;
+    tmp_buf += ALIGN(tmp_buf, long);
+    reach = (void *)tmp_buf;
+    tmp_buf += rbytes;
+    tmp_buf += ALIGN(tmp_buf, long);
+    reach_pos = (void *)tmp_buf;
+    tmp_buf += pbytes;
+    tmp_buf += ALIGN(tmp_buf, long);
+    for (i = 0; i < tnfa->num_states; i++)
+      {
+       reach[i].tags = (void *)tmp_buf;
+       tmp_buf += tbytes;
+       reach_next[i].tags = (void *)tmp_buf;
+       tmp_buf += tbytes;
+      }
+  }
+
+  for (i = 0; i < tnfa->num_states; i++)
+    reach_pos[i].pos = -1;
+
+  /* If only one character can start a match, find it first. */
+  if (tnfa->first_char >= 0 && type == STR_BYTE && str_byte)
+    {
+      const char *orig_str = str_byte;
+      int first = tnfa->first_char;
+
+      if (len >= 0)
+       str_byte = memchr(orig_str, first, (size_t)len);
+      else
+       str_byte = strchr(orig_str, first);
+      if (str_byte == NULL)
+       {
+#ifndef TRE_USE_ALLOCA
+         if (buf)
+           xfree(buf);
+#endif /* !TRE_USE_ALLOCA */
+         return REG_NOMATCH;
+       }
+      DPRINT(("skipped %lu chars\n", (unsigned long)(str_byte - orig_str)));
+      if (str_byte >= orig_str + 1)
+       prev_c = (unsigned char)*(str_byte - 1);
+      next_c = (unsigned char)*str_byte;
+      pos = str_byte - orig_str;
+      if (len < 0 || pos < len)
+       str_byte++;
+    }
+  else
+    {
+      GET_NEXT_WCHAR();
+      pos = 0;
+    }
+
+#if 0
+  /* Skip over characters that cannot possibly be the first character
+     of a match. */
+  if (tnfa->firstpos_chars != NULL)
+    {
+      char *chars = tnfa->firstpos_chars;
+
+      if (len < 0)
+       {
+         const char *orig_str = str_byte;
+         /* XXX - use strpbrk() and wcspbrk() because they might be
+            optimized for the target architecture.  Try also strcspn()
+            and wcscspn() and compare the speeds. */
+         while (next_c != L'\0' && !chars[next_c])
+           {
+             next_c = *str_byte++;
+           }
+         prev_c = *(str_byte - 2);
+         pos += str_byte - orig_str;
+         DPRINT(("skipped %d chars\n", str_byte - orig_str));
+       }
+      else
+       {
+         while (pos <= len && !chars[next_c])
+           {
+             prev_c = next_c;
+             next_c = (unsigned char)(*str_byte++);
+             pos++;
+           }
+       }
+    }
+#endif
+
+  DPRINT(("length: %d\n", len));
+  DPRINT(("pos:chr/code | states and tags\n"));
+  DPRINT(("-------------+------------------------------------------------\n"));
+
+  reach_next_i = reach_next;
+  while (/*CONSTCOND*/1)
+    {
+      /* If no match found yet, add the initial states to `reach_next'. */
+      if (match_eo < 0)
+       {
+         DPRINT((" init >"));
+         trans_i = tnfa->initial;
+         while (trans_i->state != NULL)
+           {
+             if (reach_pos[trans_i->state_id].pos < pos)
+               {
+                 if (trans_i->assertions
+                     && CHECK_ASSERTIONS(trans_i->assertions))
+                   {
+                     DPRINT(("assertion failed\n"));
+                     trans_i++;
+                     continue;
+                   }
+
+                 DPRINT((" %p", (void *)trans_i->state));
+                 reach_next_i->state = trans_i->state;
+                 memset(reach_next_i->tags, 0, tbytes);
+                 tag_i = trans_i->tags;
+                 if (tag_i)
+                   {
+                     while (*tag_i >= 0)
+                       {
+                         if (*tag_i < num_tags)
+                           tre_tag_set(reach_next_i->tags, *tag_i, pos, touch);
+                         tag_i++;
+                       }
+                       touch++;
+                   }
+                 if (reach_next_i->state == tnfa->final)
+                   {
+                     DPRINT(("  found empty match\n"));
+                     match_eo = pos;
+                     memcpy(match_tags, reach_next_i->tags, tbytes);
+                   }
+                 reach_pos[trans_i->state_id].pos = pos;
+                 reach_pos[trans_i->state_id].tags = &reach_next_i->tags;
+                 reach_next_i++;
+               }
+             trans_i++;
+           }
+         DPRINT(("\n"));
+         reach_next_i->state = NULL;
+       }
+      else
+       {
+         if (num_tags == 0 || reach_next_i == reach_next)
+           /* We have found a match. */
+           break;
+       }
+
+      /* Check for end of string. */
+      if (len < 0)
+       {
+#ifdef TRE_STR_USER
+         if (type == STR_USER)
+           {
+             if (str_user_end)
+               break;
+           }
+         else
+#endif /* TRE_STR_USER */
+         if (next_c == L'\0')
+           break;
+       }
+      else
+       {
+         if (pos >= len)
+           break;
+       }
+
+      GET_NEXT_WCHAR();
+
+#ifdef TRE_DEBUG
+      DPRINT(("%3d:%2lc/%05d |", pos - 1, (tre_cint_t)prev_c, (int)prev_c));
+      tre_print_reach(tnfa, reach_next, num_tags);
+      //DPRINT(("%3d:%2lc/%05d |", pos, (tre_cint_t)next_c, (int)next_c));
+      //tre_print_reach(tnfa, reach_next, num_tags);
+#endif /* TRE_DEBUG */
+
+      /* Swap `reach' and `reach_next'. */
+      reach_i = reach;
+      reach = reach_next;
+      reach_next = reach_i;
+
+#ifdef TRE_DEBUG
+      once = 0;
+#endif /* TRE_DEBUG */
+
+      /* For each state in `reach' see if there is a transition leaving with
+        the current input symbol to a state not yet in `reach_next', and
+        add the destination states to `reach_next'. */
+      reach_next_i = reach_next;
+      for (reach_i = reach; reach_i->state; reach_i++)
+       {
+         for (trans_i = reach_i->state; trans_i->state; trans_i++)
+           {
+             /* Does this transition match the input symbol? */
+             if (trans_i->code_min <= (tre_cint_t)prev_c &&
+                 trans_i->code_max >= (tre_cint_t)prev_c)
+               {
+                 if (trans_i->assertions
+                     && (CHECK_ASSERTIONS(trans_i->assertions)
+                         || CHECK_CHAR_CLASSES(trans_i, tnfa, eflags)))
+                   {
+                     DPRINT(("assertion failed\n"));
+                     continue;
+                   }
+
+                 /* Compute the tags after this transition. */
+                 memcpy(tmp_tags, reach_i->tags, tbytes);
+                 tag_i = trans_i->tags;
+                 if (tag_i != NULL)
+                   {
+                     while (*tag_i >= 0)
+                       {
+                         if (*tag_i < num_tags)
+                           tre_tag_set(tmp_tags, *tag_i, pos, touch);
+                         tag_i++;
+                       }
+                       touch++;
+                   }
+
+                 /* For each new transition, weed out those that don't
+                    fulfill the minimal matching conditions. */
+                 if (tnfa->num_minimals && match_eo >= 0)
+                   {
+                     int skip = 0;
+#ifdef TRE_DEBUG
+                     if (!once)
+                       {
+                         DPRINT(("Checking minimal conditions: match_eo=%d "
+                                 "match_tags=", match_eo));
+                         tre_print_tags(match_tags, num_tags);
+                         DPRINT(("\n"));
+                         once++;
+                       }
+#endif /* TRE_DEBUG */
+                     for (i = 0; tnfa->minimal_tags[i] >= 0; i += 2)
+                       {
+                          int end = tnfa->minimal_tags[i];
+                          int start = tnfa->minimal_tags[i + 1];
+                          DPRINT(("  Minimal start %d, end %d\n", start, end));
+                          if (tre_minimal_tag_order(start, end, match_tags,
+                                                    tmp_tags) > 0)
+                            {
+                               skip = 1;
+                               break;
+                            }
+                       }
+                     if (skip)
+                       {
+#ifdef TRE_DEBUG
+                          DPRINT(("     Throwing out"));
+                          tre_print_reach1(reach_i->state, tmp_tags,
+                                            num_tags);
+                          DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+                          continue;
+                       }
+                   }
+
+                 if (reach_pos[trans_i->state_id].pos < pos)
+                   {
+                     /* Found an unvisited node. */
+                     reach_next_i->state = trans_i->state;
+                     tmp_iptr = reach_next_i->tags;
+                     reach_next_i->tags = tmp_tags;
+                     tmp_tags = tmp_iptr;
+                     reach_pos[trans_i->state_id].pos = pos;
+                     reach_pos[trans_i->state_id].tags = &reach_next_i->tags;
+
+                     if (reach_next_i->state == tnfa->final
+                         && (match_eo == -1
+                             || (num_tags > 0
+                                 && tre_tag_get(reach_next_i->tags, 0) <=
+                                 tre_tag_get(match_tags, 0))))
+                       {
+#ifdef TRE_DEBUG
+                         DPRINT(("  found match"));
+                         tre_print_reach1(trans_i->state, reach_next_i->tags, num_tags);
+                         DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+                         match_eo = pos;
+                         memcpy(match_tags, reach_next_i->tags, tbytes);
+                       }
+                     reach_next_i++;
+
+                   }
+                 else
+                   {
+                     assert(reach_pos[trans_i->state_id].pos == pos);
+                     /* Another path has also reached this state.  We choose
+                        the winner by examining the tag values for both
+                        paths. */
+                     if (tre_tag_order(num_tags, tnfa->tag_directions,
+                                       tmp_tags,
+                                       *reach_pos[trans_i->state_id].tags))
+                       {
+                         /* The new path wins. */
+                         tmp_iptr = *reach_pos[trans_i->state_id].tags;
+                         *reach_pos[trans_i->state_id].tags = tmp_tags;
+                         if (trans_i->state == tnfa->final)
+                           {
+#ifdef TRE_DEBUG
+                             DPRINT(("  found better match"));
+                             tre_print_reach1(trans_i->state, tmp_tags, num_tags);
+                             DPRINT(("\n"));
+#endif /* TRE_DEBUG */
+                             match_eo = pos;
+                             memcpy(match_tags, tmp_tags, tbytes);
+                           }
+                         tmp_tags = tmp_iptr;
+                       }
+                   }
+               }
+           }
+       }
+      reach_next_i->state = NULL;
+    }
+
+  DPRINT(("match end offset = %d\n", match_eo));
+
+  *match_end_ofs = match_eo;
+#ifdef TRE_DEBUG
+  if (match_tags)
+    {
+      DPRINT(("Winning tags="));
+      tre_print_tags_all(match_tags, num_tags);
+      DPRINT((" touch=%d\n", touch));
+    }
+#endif /* TRE_DEBUG */
+
+#ifndef TRE_USE_ALLOCA
+  if (buf)
+    xfree(buf);
+#endif /* !TRE_USE_ALLOCA */
+
+  return match_eo >= 0 ? REG_OK : REG_NOMATCH;
+}
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-match-utils.h b/regex/TRE/lib/tre-match-utils.h
new file mode 100644 (file)
index 0000000..83258e8
--- /dev/null
@@ -0,0 +1,620 @@
+/*
+  tre-match-utils.h - TRE matcher helper definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#include "tre-internal.h"
+
+#define str_source ((const tre_str_source*)string)
+
+#ifdef TRE_WCHAR
+
+#ifdef TRE_MULTIBYTE
+
+/* Wide character and multibyte support. */
+
+#ifdef TRE_STR_USER
+#define GET_NEXT_WCHAR()                                                     \
+  do {                                                                       \
+    prev_c = next_c;                                                         \
+    if (type == STR_BYTE)                                                    \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = '\0';                                                      \
+       else                                                                  \
+         next_c = (unsigned char)(*str_byte++);                              \
+      }                                                                              \
+    else if (type == STR_WIDE)                                               \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = L'\0';                                                     \
+       else                                                                  \
+         next_c = *str_wide++;                                               \
+      }                                                                              \
+    else if (type == STR_MBS)                                                \
+      {                                                                              \
+        pos += pos_add_next;                                                 \
+       if (str_byte == NULL)                                                 \
+         next_c = L'\0';                                                     \
+       else                                                                  \
+         {                                                                   \
+           size_t w;                                                         \
+           int max;                                                          \
+           if (len >= 0)                                                     \
+             max = len - pos;                                                \
+           else                                                              \
+             max = 32;                                                       \
+           if (max <= 0)                                                     \
+             {                                                               \
+               next_c = L'\0';                                               \
+               pos_add_next = 1;                                             \
+             }                                                               \
+           else                                                              \
+             {                                                               \
+               w = tre_mbrtowc_l(&next_c, str_byte, (size_t)max, &mbstate,   \
+                                 tnfa->loc);                                 \
+               if (w == (size_t)-1 || w == (size_t)-2)                       \
+                 return REG_ILLSEQ;                                          \
+               if (w == 0 && len >= 0)                                       \
+                 {                                                           \
+                   pos_add_next = 1;                                         \
+                   next_c = 0;                                               \
+                   str_byte++;                                               \
+                 }                                                           \
+               else                                                          \
+                 {                                                           \
+                   pos_add_next = w;                                         \
+                   str_byte += w;                                            \
+                 }                                                           \
+             }                                                               \
+         }                                                                   \
+      }                                                                              \
+    else if (type == STR_USER)                                               \
+      {                                                                              \
+        pos += pos_add_next;                                                 \
+       str_user_end = str_source->get_next_char(&next_c, &pos_add_next,      \
+                                                 str_source->context);       \
+      }                                                                              \
+  } while(/*CONSTCOND*/0)
+#else /* !TRE_STR_USER */
+#define GET_NEXT_WCHAR()                                                     \
+  do {                                                                       \
+    prev_c = next_c;                                                         \
+    if (type == STR_BYTE)                                                    \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = '\0';                                                      \
+       else                                                                  \
+         next_c = (unsigned char)(*str_byte++);                              \
+      }                                                                              \
+    else if (type == STR_WIDE)                                               \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = L'\0';                                                     \
+       else                                                                  \
+         next_c = *str_wide++;                                               \
+      }                                                                              \
+    else if (type == STR_MBS)                                                \
+      {                                                                              \
+        pos += pos_add_next;                                                 \
+       if (str_byte == NULL)                                                 \
+         next_c = L'\0';                                                     \
+       else                                                                  \
+         {                                                                   \
+           size_t w;                                                         \
+           int max;                                                          \
+           if (len >= 0)                                                     \
+             max = len - pos;                                                \
+           else                                                              \
+             max = 32;                                                       \
+           if (max <= 0)                                                     \
+             {                                                               \
+               next_c = L'\0';                                               \
+               pos_add_next = 1;                                             \
+             }                                                               \
+           else                                                              \
+             {                                                               \
+               w = tre_mbrtowc_l(&next_c, str_byte, (size_t)max, &mbstate,   \
+                                 tnfa->loc);                                 \
+               if (w == (size_t)-1 || w == (size_t)-2)                       \
+                 return REG_ILLSEQ;                                          \
+               if (w == 0 && len >= 0)                                       \
+                 {                                                           \
+                   pos_add_next = 1;                                         \
+                   next_c = 0;                                               \
+                   str_byte++;                                               \
+                 }                                                           \
+               else                                                          \
+                 {                                                           \
+                   pos_add_next = w;                                         \
+                   str_byte += w;                                            \
+                 }                                                           \
+             }                                                               \
+         }                                                                   \
+      }                                                                              \
+  } while(/*CONSTCOND*/0)
+#endif /* !TRE_STR_USER */
+
+#else /* !TRE_MULTIBYTE */
+
+/* Wide character support, no multibyte support. */
+
+#ifdef TRE_STR_USER
+#define GET_NEXT_WCHAR()                                                     \
+  do {                                                                       \
+    prev_c = next_c;                                                         \
+    if (type == STR_BYTE)                                                    \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = '\0';                                                      \
+       else                                                                  \
+         next_c = (unsigned char)(*str_byte++);                              \
+      }                                                                              \
+    else if (type == STR_WIDE)                                               \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = L'\0';                                                     \
+       else                                                                  \
+         next_c = *str_wide++;                                               \
+      }                                                                              \
+    else if (type == STR_USER)                                               \
+      {                                                                              \
+        pos += pos_add_next;                                                 \
+       str_user_end = str_source->get_next_char(&next_c, &pos_add_next,      \
+                                                 str_source->context);       \
+      }                                                                              \
+  } while(/*CONSTCOND*/0)
+#else /* !TRE_STR_USER */
+#define GET_NEXT_WCHAR()                                                     \
+  do {                                                                       \
+    prev_c = next_c;                                                         \
+    if (type == STR_BYTE)                                                    \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = '\0';                                                      \
+       else                                                                  \
+         next_c = (unsigned char)(*str_byte++);                              \
+      }                                                                              \
+    else if (type == STR_WIDE)                                               \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = L'\0';                                                     \
+       else                                                                  \
+         next_c = *str_wide++;                                               \
+      }                                                                              \
+  } while(/*CONSTCOND*/0)
+#endif /* !TRE_STR_USER */
+
+#endif /* !TRE_MULTIBYTE */
+
+#else /* !TRE_WCHAR */
+
+/* No wide character or multibyte support. */
+
+#ifdef TRE_STR_USER
+#define GET_NEXT_WCHAR()                                                     \
+  do {                                                                       \
+    prev_c = next_c;                                                         \
+    if (type == STR_BYTE)                                                    \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = '\0';                                                      \
+       else                                                                  \
+         next_c = (unsigned char)(*str_byte++);                              \
+      }                                                                              \
+    else if (type == STR_USER)                                               \
+      {                                                                              \
+       pos += pos_add_next;                                                  \
+       str_user_end = str_source->get_next_char(&next_c, &pos_add_next,      \
+                                                str_source->context);        \
+      }                                                                              \
+  } while(/*CONSTCOND*/0)
+#else /* !TRE_STR_USER */
+#define GET_NEXT_WCHAR()                                                     \
+  do {                                                                       \
+    prev_c = next_c;                                                         \
+    if (type == STR_BYTE)                                                    \
+      {                                                                              \
+       pos++;                                                                \
+       if (len >= 0 && pos >= len)                                           \
+         next_c = '\0';                                                      \
+       else                                                                  \
+         next_c = (unsigned char)(*str_byte++);                              \
+      }                                                                              \
+  } while(/*CONSTCOND*/0)
+#endif /* !TRE_STR_USER */
+
+#endif /* !TRE_WCHAR */
+
+
+
+/* Assumes tre_tnfa_t *tnfa in scope */
+#define IS_WORD_CHAR(c)         ((c) == L'_' || tre_isalnum_l(c, tnfa->loc))
+
+#define CHECK_ASSERTIONS(assertions)                                         \
+  (((assertions & ASSERT_AT_BOL)                                             \
+    && (pos > 0 || reg_notbol)                                               \
+    && (prev_c != L'\n' || !reg_newline))                                    \
+   || ((assertions & ASSERT_AT_EOL)                                          \
+       && (next_c != L'\0' || reg_noteol)                                    \
+       && (next_c != L'\n' || !reg_newline))                                 \
+   || ((assertions & ASSERT_AT_BOW)                                          \
+       && (IS_WORD_CHAR(prev_c) || !IS_WORD_CHAR(next_c)))                   \
+   || ((assertions & ASSERT_AT_EOW)                                          \
+       && (!IS_WORD_CHAR(prev_c) || IS_WORD_CHAR(next_c)))                   \
+   || ((assertions & ASSERT_AT_WB)                                           \
+       && (pos != 0 && next_c != L'\0'                                       \
+          && IS_WORD_CHAR(prev_c) == IS_WORD_CHAR(next_c)))                  \
+   || ((assertions & ASSERT_AT_WB_NEG)                                       \
+       && (pos == 0 || next_c == L'\0'                                       \
+          || IS_WORD_CHAR(prev_c) != IS_WORD_CHAR(next_c))))
+
+#define CHECK_CHAR_CLASSES(trans_i, tnfa, eflags)                             \
+  ((trans_i->assertions & ASSERT_BRACKET_MATCH)                               \
+    && !tre_bracket_match(trans_i->u.bracket_match_list,(tre_cint_t)prev_c,    \
+                                      tnfa))
+
+
+
+
+inline static int
+tre_tag_get(const tre_tag_t *tags, int i)
+{
+  tags += i;
+  return tags->count > 0 ? tags->value : -1;
+}
+
+inline static void
+tre_tag_set(tre_tag_t *tags, int i, int val, int touch)
+{
+  tags += i;
+  if (tags->count++ == 0)
+    tags->first = val;
+  tags->value = val;
+  tags->touch = touch;
+}
+
+inline static void
+tre_tag_reset(tre_tag_t *tags, int i)
+{
+  tags[i].count = 0;
+}
+
+inline static int
+tre_tag_touch_get(const tre_tag_t *tags, int i)
+{
+  return tags[i].touch;
+}
+
+#ifdef TRE_DEBUG
+inline static void
+tre_print_tags(const tre_tag_t *tags, int num_tags)
+{
+  int i;
+  for (i = 0; i < num_tags; i++, tags++)
+    {
+      switch(tags->count)
+       {
+       case 0:
+         DPRINT(("%d:(0,-1)", i));
+         break;
+       case 1:
+         DPRINT(("%d:(1,%d)", i, tags->first));
+         break;
+       default:
+         DPRINT(("%d:(%d,%d,%d)", i, tags->count, tags->first,
+                 tags->value));
+         break;
+       }
+      if (i < (num_tags - 1))
+       DPRINT((" "));
+    }
+}
+
+inline static void
+tre_print_tags_all(const tre_tag_t *tags, int num_tags)
+{
+  int i;
+  for (i = 0; i < num_tags; i++, tags++)
+    {
+      switch(tags->count)
+       {
+       case 0:
+         DPRINT(("%d:(0,-1)/%d", i, tags->touch));
+         break;
+       case 1:
+         DPRINT(("%d:(1,%d)/%d", i, tags->first, tags->touch));
+         break;
+       default:
+         DPRINT(("%d:(%d,%d,%d)/%d", i, tags->count, tags->first,
+                 tags->value, tags->touch));
+         break;
+       }
+      if (i < (num_tags - 1))
+       DPRINT((" "));
+    }
+}
+#endif /* TRE_DEBUG */
+
+/* Return < 0, = 0 or > 0 depending on how the start/end pairs of a minimal
+ * group between t1 and t2 compare (t1 loses if < 0, t1 wins if > 0) */
+inline static int
+tre_minimal_tag_order(int start, int end, const tre_tag_t *tags1,
+                     const tre_tag_t *tags2)
+{
+  const tre_tag_t *t1, *t2;
+
+  t1 = tags1 + start;
+  t2 = tags2 + start;
+  /* We need both start tags to be set */
+  if (t1->count == 0 || t2->count == 0)
+    return 0;
+
+  /* The start tags must be equal */
+  if (t1->value != t2->value)
+    return 0;
+
+  t1 = tags1 + end;
+  t2 = tags2 + end;
+  /* For the end tags, we prefer set over unset, because unset means that
+   * the end tag is still growing */
+  if (t1->count == 0)
+    {
+      /* if t2 is set, t1 loses since it is unset */
+      if (t2->count != 0)
+       return -1;
+    }
+  /* if t2 not set, t1 wins since it is set */
+  else if (t2->count == 0)
+    return 1;
+
+  /* least current value wins */
+  return t2->value - t1->value;
+}
+
+/* Return < 0, = 0 or > 0 depending on how the i-th item of t1 and t2 compare
+ * (t1 loses if < 0, t1 wins if > 0) */
+inline static int
+tre_tag_order_1(int i, tre_tag_direction_t dir, const tre_tag_t *t1,
+               const tre_tag_t *t2)
+{
+  int diff;
+
+  t1 += i;
+  t2 += i;
+  switch (dir)
+    {
+    case TRE_TAG_MINIMIZE:
+      /* least current value wins (because tags are initialized to all zeros,
+       * unset wins over set; also, tre_minimal_tag_order() will have already
+       * been run, which checks for being unset) */
+      return t2->value - t1->value;
+
+    case TRE_TAG_MAXIMIZE:
+      /* prefer set */
+      if (t1->count == 0)
+       {
+         /* if neither t1 and t2 are set, try next tag */
+         if (t2->count == 0)
+           return 0;
+         /* t2 is set, t1 loses since it is unset */
+         return -1;
+       }
+      /* if t2 not set, t1 wins since it is set */
+      else if (t2->count == 0)
+       return 1;
+      /* greatest initial value wins */
+      if ((diff = t1->first - t2->first) != 0)
+       return diff;
+      /* least number of times the tag was set, wins */
+      if ((diff = t2->count - t1->count) != 0)
+       return diff;
+      /* if the tags were only set once, they only have initial values */
+      if (t1->count == 1)
+       return 0;
+      /* greatest current value wins */
+      return t1->value - t2->value;
+
+    case TRE_TAG_LEFT_MAXIMIZE:
+      /* prefer set */
+      if (t1->count == 0)
+       {
+         /* if neither t1 and t2 are set, try next tag */
+         if (t2->count == 0)
+           return 0;
+         /* t2 is set, t1 loses since it is unset */
+         return -1;
+       }
+      /* if t2 not set, t1 wins since it is set */
+      else if (t2->count == 0)
+       return 1;
+      /* least initial value wins */
+      if ((diff = t2->first - t1->first) != 0)
+       return diff;
+      /* least number of times the tag was set, wins */
+      if ((diff = t2->count - t1->count) != 0)
+       return diff;
+      /* if the tags were only set once, they only have initial values */
+      if (t1->count == 1)
+       return 0;
+      /* greatest current value wins */
+      return t1->value - t2->value;
+
+    default:
+      /* Shouldn't happen: only assert if TRE_DEBUG defined */
+      assert(0);
+      break;
+    }
+  return 0;
+}
+
+#ifdef TRE_DEBUG
+#define _MORE_DEBUGGING
+#endif /* TRE_DEBUG */
+
+/* Returns 1 if `t1' wins `t2', 0 otherwise. */
+inline static int
+#ifdef _MORE_DEBUGGING
+_tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions,
+             const tre_tag_t *t1, const tre_tag_t *t2)
+#else /* !_MORE_DEBUGGING */
+tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions,
+             const tre_tag_t *t1, const tre_tag_t *t2)
+#endif /* !_MORE_DEBUGGING */
+{
+  int i, ret;
+
+  for (i = 0; i < num_tags; i++)
+    {
+      if ((ret = tre_tag_order_1(i, tag_directions[i], t1, t2)) != 0)
+       return (ret > 0);
+    }
+  /*  assert(0);*/
+  return 0;
+}
+
+#ifdef _MORE_DEBUGGING
+inline static int
+tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions,
+             const tre_tag_t *t1, const tre_tag_t *t2)
+{
+  int ret = _tre_tag_order(num_tags, tag_directions, t1, t2);
+  DPRINT(("tre_tag_order: "));
+  tre_print_tags(t1, num_tags);
+  DPRINT((" %s ", ret ? "wins" : "doesn't win"));
+  tre_print_tags(t2, num_tags);
+  DPRINT(("\n"));
+  return ret;
+}
+#endif /* _MORE_DEBUGGING */
+
+#ifdef __LIBC__
+#include <xlocale_private.h>
+#else /* !__LIBC__ */
+#include <xlocale.h>
+#endif /* !__LIBC__ */
+
+int __collate_equiv_value(locale_t loc, const wchar_t *str, size_t len);
+
+inline static int
+tre_bracket_match(tre_bracket_match_list_t * __restrict list, tre_cint_t wc,
+                 const tre_tnfa_t * __restrict tnfa)
+{
+  int match = 0;
+  int i;
+  tre_bracket_match_t *b;
+  tre_cint_t uc, lc;
+  int we, ue, le, got_equiv = 0;
+  int icase = ((tnfa->cflags & REG_ICASE) != 0);
+
+  DPRINT(("tre_bracket_match: %p, %d, %d\n", list, wc, icase));
+  if (icase)
+    {
+      if (tre_islower_l(wc, tnfa->loc))
+       {
+         lc = wc;
+         uc = tre_toupper_l(wc, tnfa->loc);
+       }
+      else if (tre_isupper_l(wc, tnfa->loc))
+       {
+         uc = wc;
+         lc = tre_tolower_l(wc, tnfa->loc);
+       }
+      else
+       {
+         icase = 0;
+       }
+    }
+  for (i = 0, b = list->bracket_matches; i < list->num_bracket_matches;
+       i++, b++)
+    {
+      switch (b->type)
+       {
+       case TRE_BRACKET_MATCH_TYPE_CHAR:
+         if (icase)
+           match = (b->value == uc || b->value == lc);
+         else
+           match = (b->value == wc);
+         break;
+       case TRE_BRACKET_MATCH_TYPE_RANGE_BEGIN:
+         {
+           tre_cint_t start = b->value, end;
+           if (++i >= list->num_bracket_matches ||
+               (++b)->type != TRE_BRACKET_MATCH_TYPE_RANGE_END)
+             {
+               DPRINT(("tre_bracket_match: no following range end\n"));
+               assert(0);
+               goto error;
+             }
+           end = b->value;
+           if (!got_equiv)
+             {
+               if (icase)
+                 {
+                   ue = __collate_equiv_value(tnfa->loc, &uc, 1);
+                   le = __collate_equiv_value(tnfa->loc, &lc, 1);
+                 }
+               else
+                   we = __collate_equiv_value(tnfa->loc, &wc, 1);
+               got_equiv = 1;
+             }
+           if (icase)
+             match = ((start <= ue && ue <= end) ||
+                     (start <= le && le <= end));
+           else
+             match = (start <= we && we <= end);
+           break;
+         }
+       case TRE_BRACKET_MATCH_TYPE_RANGE_END:
+         DPRINT(("tre_bracket_match: range end without preceeding start\n"));
+         assert(0);
+         break;
+       case TRE_BRACKET_MATCH_TYPE_CLASS:
+         if (icase)
+           match = (tre_isctype_l(uc, b->value, tnfa->loc) ||
+                    tre_isctype_l(lc, b->value, tnfa->loc));
+         else
+           match = (tre_isctype_l(wc, b->value, tnfa->loc));
+         break;
+       case TRE_BRACKET_MATCH_TYPE_EQUIVALENCE:
+         if (!got_equiv)
+           {
+             if (icase)
+               {
+                 ue = __collate_equiv_value(tnfa->loc, &uc, 1);
+                 le = __collate_equiv_value(tnfa->loc, &lc, 1);
+               }
+             else
+                 we = __collate_equiv_value(tnfa->loc, &wc, 1);
+             got_equiv = 1;
+           }
+         if (icase)
+           match = (b->value == ue || b->value == le);
+         else
+           match = (b->value == we);
+         break;
+       default:
+         DPRINT(("tre_bracket_match: unknown type %d\n", b->type));
+         assert(0);
+         break;
+       }
+       if (match)
+         break;
+    }
+error:
+  if (list->flags & TRE_BRACKET_MATCH_FLAG_NEGATE)
+    match = !match;
+  return match;
+}
diff --git a/regex/TRE/lib/tre-mem.c b/regex/TRE/lib/tre-mem.c
new file mode 100644 (file)
index 0000000..b5fb276
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+  tre-mem.c - TRE memory allocator
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+/*
+  This memory allocator is for allocating small memory blocks efficiently
+  in terms of memory overhead and execution speed.  The allocated blocks
+  cannot be freed individually, only all at once.  There can be multiple
+  allocators, though.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
+#include <string.h>
+
+#include "tre-internal.h"
+#include "tre-mem.h"
+#include "xmalloc.h"
+
+
+/* Returns a new memory allocator or NULL if out of memory. */
+tre_mem_t
+tre_mem_new_impl(int provided, void *provided_block)
+{
+  tre_mem_t mem;
+  if (provided)
+    {
+      mem = provided_block;
+      memset(mem, 0, sizeof(*mem));
+    }
+  else
+    mem = xcalloc(1, sizeof(*mem));
+  if (mem == NULL)
+    return NULL;
+  return mem;
+}
+
+
+/* Frees the memory allocator and all memory allocated with it. */
+void
+tre_mem_destroy(tre_mem_t mem)
+{
+  tre_list_t *tmp, *l = mem->blocks;
+
+  while (l != NULL)
+    {
+      xfree(l->data);
+      tmp = l->next;
+      xfree(l);
+      l = tmp;
+    }
+  xfree(mem);
+}
+
+
+/* Allocates a block of `size' bytes from `mem'.  Returns a pointer to the
+   allocated block or NULL if an underlying malloc() failed. */
+void *
+tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block,
+                  int zero, size_t size)
+{
+  void *ptr;
+
+  if (mem->failed)
+    {
+      DPRINT(("tre_mem_alloc: oops, called after failure?!\n"));
+      return NULL;
+    }
+
+#ifdef MALLOC_DEBUGGING
+  if (!provided)
+    {
+      ptr = xmalloc(1);
+      if (ptr == NULL)
+       {
+         DPRINT(("tre_mem_alloc: xmalloc forced failure\n"));
+         mem->failed = 1;
+         return NULL;
+       }
+      xfree(ptr);
+    }
+#endif /* MALLOC_DEBUGGING */
+
+  if (mem->n < size)
+    {
+      /* We need more memory than is available in the current block.
+        Allocate a new block. */
+      tre_list_t *l;
+      if (provided)
+       {
+         DPRINT(("tre_mem_alloc: using provided block\n"));
+         if (provided_block == NULL)
+           {
+             DPRINT(("tre_mem_alloc: provided block was NULL\n"));
+             mem->failed = 1;
+             return NULL;
+           }
+         mem->ptr = provided_block;
+         mem->n = TRE_MEM_BLOCK_SIZE;
+       }
+      else
+       {
+         int block_size;
+         if (size * 8 > TRE_MEM_BLOCK_SIZE)
+           block_size = size * 8;
+         else
+           block_size = TRE_MEM_BLOCK_SIZE;
+         DPRINT(("tre_mem_alloc: allocating new %d byte block\n",
+                 block_size));
+         l = xmalloc(sizeof(*l));
+         if (l == NULL)
+           {
+             mem->failed = 1;
+             return NULL;
+           }
+         l->data = xmalloc(block_size);
+         if (l->data == NULL)
+           {
+             xfree(l);
+             mem->failed = 1;
+             return NULL;
+           }
+         l->next = NULL;
+         if (mem->current != NULL)
+           mem->current->next = l;
+         if (mem->blocks == NULL)
+           mem->blocks = l;
+         mem->current = l;
+         mem->ptr = l->data;
+         mem->n = block_size;
+       }
+    }
+
+  /* Make sure the next pointer will be aligned. */
+  size += ALIGN(mem->ptr + size, long);
+
+  /* Allocate from current block. */
+  ptr = mem->ptr;
+  mem->ptr += size;
+  mem->n -= size;
+
+  /* Set to zero if needed. */
+  if (zero)
+    memset(ptr, 0, size);
+
+  return ptr;
+}
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-mem.h b/regex/TRE/lib/tre-mem.h
new file mode 100644 (file)
index 0000000..b760394
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+  tre-mem.h - TRE memory allocator interface
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifndef TRE_MEM_H
+#define TRE_MEM_H 1
+
+#include <stdlib.h>
+
+#define TRE_MEM_BLOCK_SIZE 1024
+
+typedef struct tre_list {
+  void *data;
+  struct tre_list *next;
+} tre_list_t;
+
+typedef struct tre_mem_struct {
+  tre_list_t *blocks;
+  tre_list_t *current;
+  char *ptr;
+  size_t n;
+  int failed;
+  void **provided;
+} *tre_mem_t;
+
+
+__private_extern__ tre_mem_t tre_mem_new_impl(int provided,
+                                             void *provided_block);
+__private_extern__ void *tre_mem_alloc_impl(tre_mem_t mem, int provided,
+                                           void *provided_block,
+                                           int zero, size_t size);
+
+/* Returns a new memory allocator or NULL if out of memory. */
+#define tre_mem_new()  tre_mem_new_impl(0, NULL)
+
+/* Allocates a block of `size' bytes from `mem'.  Returns a pointer to the
+   allocated block or NULL if an underlying malloc() failed. */
+#define tre_mem_alloc(mem, size) tre_mem_alloc_impl(mem, 0, NULL, 0, size)
+
+/* Allocates a block of `size' bytes from `mem'.  Returns a pointer to the
+   allocated block or NULL if an underlying malloc() failed.  The memory
+   is set to zero. */
+#define tre_mem_calloc(mem, size) tre_mem_alloc_impl(mem, 0, NULL, 1, size)
+
+#ifdef TRE_USE_ALLOCA
+/* alloca() versions.  Like above, but memory is allocated with alloca()
+   instead of malloc(). */
+
+#define tre_mem_newa() \
+  tre_mem_new_impl(1, alloca(sizeof(struct tre_mem_struct)))
+
+#define tre_mem_alloca(mem, size)                                            \
+  ((mem)->n >= (size)                                                        \
+   ? tre_mem_alloc_impl((mem), 1, NULL, 0, (size))                           \
+   : tre_mem_alloc_impl((mem), 1, alloca(TRE_MEM_BLOCK_SIZE), 0, (size)))
+#endif /* TRE_USE_ALLOCA */
+
+
+/* Frees the memory allocator and all memory allocated with it. */
+__private_extern__ void tre_mem_destroy(tre_mem_t mem);
+
+#endif /* TRE_MEM_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-parse.c b/regex/TRE/lib/tre-parse.c
new file mode 100644 (file)
index 0000000..ad09c26
--- /dev/null
@@ -0,0 +1,2334 @@
+/*
+  tre-parse.c - Regexp parser
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+/*
+  This parser is just a simple recursive descent parser for POSIX.2
+  regexps.  The parser supports both the obsolete default syntax and
+  the "extended" syntax, and some nonstandard extensions.
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <stddef.h>
+
+#include "xmalloc.h"
+#include "tre-mem.h"
+#include "tre-ast.h"
+#include "tre-stack.h"
+#include "tre-parse.h"
+
+/* BSD compatibility:
+     Before looking up a collating symbol, check if the name matches in
+     the character names (cnames) array; if so, use the corresponding
+     character.
+
+     Also set ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND, which will preserve
+     the implementation choice that for ERE, a non-numeric character following
+     a left brace that would normally be a bound, causes the left brace to be
+     literal. */
+#define BSD_COMPATIBILITY
+#ifdef BSD_COMPATIBILITY
+#include "cname.h"
+#define ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+#endif /* BSD_COMPATIBILITY */
+
+/* Characters with special meanings in regexp syntax. */
+#define CHAR_PIPE         L'|'
+#define CHAR_LPAREN       L'('
+#define CHAR_RPAREN       L')'
+#define CHAR_LBRACE       L'{'
+#define CHAR_RBRACE       L'}'
+#define CHAR_LBRACKET     L'['
+#define CHAR_RBRACKET     L']'
+#define CHAR_MINUS        L'-'
+#define CHAR_STAR         L'*'
+#define CHAR_QUESTIONMARK  L'?'
+#define CHAR_PLUS         L'+'
+#define CHAR_PERIOD       L'.'
+#define CHAR_COLON        L':'
+#define CHAR_EQUAL        L'='
+#define CHAR_COMMA        L','
+#define CHAR_CARET        L'^'
+#define CHAR_DOLLAR       L'$'
+#define CHAR_BACKSLASH    L'\\'
+#define CHAR_HASH         L'#'
+#define CHAR_TILDE        L'~'
+
+
+/* Some macros for expanding \w, \s, etc. */
+static const struct tre_macro_struct {
+  const char c;
+  const char *expansion;
+} tre_macros[] =
+  { {'t', "\t"},          {'n', "\n"},            {'r', "\r"},
+    {'f', "\f"},          {'a', "\a"},            {'e', "\033"},
+    {'w', "[[:alnum:]_]"}, {'W', "[^[:alnum:]_]"}, {'s', "[[:space:]]"},
+    {'S', "[^[:space:]]"}, {'d', "[[:digit:]]"},   {'D', "[^[:digit:]]"},
+    { 0, NULL }
+  };
+
+
+/* Expands a macro delimited by `regex' and `regex_end' to `buf', which
+   must have at least `len' items.  Sets buf[0] to zero if the there
+   is no match in `tre_macros'. */
+static void
+tre_expand_macro(const tre_char_t *regex, const tre_char_t *regex_end,
+                tre_char_t *buf, size_t buf_len)
+{
+  int i;
+
+  buf[0] = 0;
+  if (regex >= regex_end)
+    return;
+
+  for (i = 0; tre_macros[i].expansion; i++)
+    {
+      if (tre_macros[i].c == *regex)
+       {
+         unsigned int j;
+         DPRINT(("Expanding macro '%c' => '%s'\n",
+                 tre_macros[i].c, tre_macros[i].expansion));
+         for (j = 0; tre_macros[i].expansion[j] && j < buf_len; j++)
+           buf[j] = tre_macros[i].expansion[j];
+         buf[j] = 0;
+         break;
+       }
+    }
+}
+
+static reg_errcode_t
+tre_new_item(tre_mem_t mem, int type, int val, int *max_i,
+        tre_bracket_match_list_t **items)
+{
+  reg_errcode_t status = REG_OK;
+  tre_bracket_match_list_t *array = *items;
+  int i = array->num_bracket_matches;
+  /* Allocate more space if necessary. */
+  if (i >= *max_i)
+    {
+      tre_bracket_match_list_t *new_items;
+      DPRINT(("out of tre_bracket_match_list_t array space (%d)\n", i));
+      /* If the array is already 1024 items large, give up -- there's
+        probably an error in the regexp (e.g. not a '\0' terminated
+        string and missing ']') */
+      if (*max_i >= 1024)
+       return REG_ESPACE;
+      *max_i *= 2;
+      new_items = xrealloc(array, SIZEOF_BRACKET_MATCH_LIST_N(*max_i));
+      if (new_items == NULL)
+       return REG_ESPACE;
+      *items = array = new_items;
+    }
+  array->bracket_matches[i].type = type;
+  array->bracket_matches[i].value = val;
+  array->num_bracket_matches++;
+  return status;
+}
+
+#ifndef TRE_USE_SYSTEM_WCTYPE
+
+/* isalnum() and the rest may be macros, so wrap them to functions. */
+int tre_isalnum_func(tre_cint_t c) { return tre_isalnum(c); }
+int tre_isalpha_func(tre_cint_t c) { return tre_isalpha(c); }
+
+#ifdef tre_isascii
+int tre_isascii_func(tre_cint_t c) { return tre_isascii(c); }
+#else /* !tre_isascii */
+int tre_isascii_func(tre_cint_t c) { return !(c >> 7); }
+#endif /* !tre_isascii */
+
+#ifdef tre_isblank
+int tre_isblank_func(tre_cint_t c) { return tre_isblank(c); }
+#else /* !tre_isblank */
+int tre_isblank_func(tre_cint_t c) { return ((c == ' ') || (c == '\t')); }
+#endif /* !tre_isblank */
+
+int tre_iscntrl_func(tre_cint_t c) { return tre_iscntrl(c); }
+int tre_isdigit_func(tre_cint_t c) { return tre_isdigit(c); }
+int tre_isgraph_func(tre_cint_t c) { return tre_isgraph(c); }
+int tre_islower_func(tre_cint_t c) { return tre_islower(c); }
+int tre_isprint_func(tre_cint_t c) { return tre_isprint(c); }
+int tre_ispunct_func(tre_cint_t c) { return tre_ispunct(c); }
+int tre_isspace_func(tre_cint_t c) { return tre_isspace(c); }
+int tre_isupper_func(tre_cint_t c) { return tre_isupper(c); }
+int tre_isxdigit_func(tre_cint_t c) { return tre_isxdigit(c); }
+
+struct {
+  char *name;
+  int (*func)(tre_cint_t);
+} tre_ctype_map[] = {
+  { "alnum", &tre_isalnum_func },
+  { "alpha", &tre_isalpha_func },
+#ifdef tre_isascii
+  { "ascii", &tre_isascii_func },
+#endif /* tre_isascii */
+#ifdef tre_isblank
+  { "blank", &tre_isblank_func },
+#endif /* tre_isblank */
+  { "cntrl", &tre_iscntrl_func },
+  { "digit", &tre_isdigit_func },
+  { "graph", &tre_isgraph_func },
+  { "lower", &tre_islower_func },
+  { "print", &tre_isprint_func },
+  { "punct", &tre_ispunct_func },
+  { "space", &tre_isspace_func },
+  { "upper", &tre_isupper_func },
+  { "xdigit", &tre_isxdigit_func },
+  { NULL, NULL}
+};
+
+tre_ctype_t tre_ctype(const char *name)
+{
+  int i;
+  for (i = 0; tre_ctype_map[i].name != NULL; i++)
+    {
+      if (strcmp(name, tre_ctype_map[i].name) == 0)
+       return tre_ctype_map[i].func;
+    }
+  return (tre_ctype_t)0;
+}
+#endif /* !TRE_USE_SYSTEM_WCTYPE */
+
+#define REST(re) (int)(ctx->re_end - (re)), (re)
+
+#define START_COLLATING_SYMBOLS                16
+#define MAX_COLLATING_SYMBOL_LEN       4
+
+typedef struct {
+  const tre_char_t *start;
+  int len;
+} tre_collating_symbol;
+
+#include <xlocale.h>
+
+int __collate_equiv_value(locale_t loc, const wchar_t *str, size_t len);
+
+#ifdef BSD_COMPATIBILITY
+static wchar_t
+tre_search_cnames(const wchar_t *name, size_t len)
+{
+  size_t low = 0;
+  size_t high = NCNAMES - 1;
+  size_t cur;
+  int cmp;
+
+  while(low <= high)
+    {
+      cur = (low + high) / 2;
+      cmp = wcsncmp(name, cnames[cur].name, len);
+      if (cmp == 0 && cnames[cur].name[len] == 0) return cnames[cur].code;
+      if (cmp > 0) low = cur + 1;
+      else high = cur - 1;
+    }
+  return (wchar_t)-1;
+}
+#endif /* BSD_COMPATIBILITY */
+
+/* Scan the contents of a bracket expression, and create a
+ * tre_bracket_match_list_t encoding the bracket expression.  If during
+ * the scan, multi-character collating symbols are detected, switch
+ * into a mode to collect those MCCSs into a tre_collating_symbol
+ * list and pass them back.  tre_parse_bracket will use that to
+ * create a new string composed of a union of the bracket expression
+ * without the MCCSs and the MCCSs (e.g., [x[.ch.]] => [x]|ch), and
+ * call tre_parse (recursive) to parse that new string (which will
+ * call tre_parse_bracket and tre_parse_bracket_items again. */
+static reg_errcode_t
+tre_parse_bracket_items(tre_parse_ctx_t *ctx, tre_bracket_match_list_t **items,
+                       int *items_size, tre_collating_symbol **result)
+{
+  const tre_char_t *re = ctx->re;
+  const tre_char_t *re_end = ctx->re_end;
+  tre_collating_symbol *col_syms = NULL;
+  tre_collating_symbol *cp = NULL;
+  int n_col_syms = 0;
+  reg_errcode_t status;
+  int max_i = *items_size;
+  int other = 0;  /* contains content other than multi-character collating
+                  * symbols */
+  int range = -1; /* -1 unset, 0 begin range set, +1 end range expected */
+  tre_cint_t min, c;
+  int invert = ((*items)->flags & TRE_BRACKET_MATCH_FLAG_NEGATE);
+  int collect_MCCS = 0;
+  const tre_char_t *start;
+
+  for ( ;re < re_end; re++)
+    {
+      switch (*re)
+       {
+       case CHAR_MINUS:
+         /* A first hyphen */
+         if (re == ctx->re)
+           {
+             DPRINT(("tre_parse_bracket:   char: '%.*" STRF "'\n", REST(re)));
+             min = CHAR_MINUS;
+             other++;
+             range = 0;
+             break;
+           }
+         /* The hyphen is the end range */
+         if (range > 0)
+           {
+             DPRINT(("tre_parse_bracket:   char: '%.*" STRF "'\n", REST(re)));
+             c = CHAR_MINUS;
+             goto process_end_range;
+           }
+         if (re + 1 >= re_end)
+           {
+             status = REG_EBRACK;
+             goto error;
+           }
+         /* The hyphen is at the end */
+         if (re[1] == CHAR_RBRACKET)
+           {
+             DPRINT(("tre_parse_bracket:   char: '%.*" STRF "'\n", REST(re)));
+             c = CHAR_MINUS;
+             goto process_begin_range;
+           }
+         /* Two ranges are not allowed to share an endpoint, or begin
+          * range is illegal. */
+         if (range < 0)
+           {
+             status = REG_ERANGE;
+             goto error;
+           }
+         range = 1; /* Expect end range */
+         DPRINT(("tre_parse_bracket:   range: '%.*" STRF "'\n", REST(re)));
+         break;
+
+       case CHAR_LBRACKET:
+         if (re + 1 >= re_end)
+           {
+             status = REG_EBRACK;
+             goto error;
+           }
+         switch (re[1])
+           {
+           case CHAR_PERIOD:
+             {
+               re += 2;
+               start = re;
+               for (;; re++)
+                 {
+                   if (re >= re_end)
+                     {
+                       status = REG_ECOLLATE;
+                       goto error;
+                     }
+                   if (*re == CHAR_PERIOD)
+                     {
+                       if (re + 1 >= re_end)
+                         {
+                           status = REG_ECOLLATE;
+                           goto error;
+                         }
+                       /* Found end */
+                       if (re[1] == CHAR_RBRACKET)
+                         {
+                           DPRINT(("tre_parse_bracket:   collating "
+                                   "symbol: '%.*" STRF "'\n",
+                                   REST(start - 2)));
+                           /* Empty name */
+                           if (re == start)
+                             {
+                               status = REG_ECOLLATE;
+                               goto error;
+                             }
+#ifdef BSD_COMPATIBILITY
+                           /* Check if the name is in cnames; if so, use
+                              the corresponding code */
+                           c = tre_search_cnames(start, re - start);
+                           if (c != (wchar_t)-1)
+                             {
+                               re++;
+                               goto process_single_character;
+                             }
+#endif /* BSD_COMPATIBILITY */
+                           /* Verify this is a known sequence */
+                           if (__collate_equiv_value(ctx->loc, start,
+                                                         re - start) <= 0)
+                             {
+                               status = REG_ECOLLATE;
+                               goto error;
+                             }
+                           /* Process single character collating symbols */
+                           if (re - start == 1)
+                             {
+                               c = *start;
+                               re++;
+                               goto process_single_character;
+                             }
+                           /* Inverted MCCSs are undefined */
+                           if (invert)
+                             {
+                               status = REG_ECOLLATE;
+                               goto error;
+                             }
+                           /* Can't have MCCSs as an endpoint to a range */
+                           if (range > 0)
+                             {
+                               status = REG_ERANGE;
+                               goto error;
+                             }
+                           range = -1;
+                           /* Switch into MCCS collection mode (if not
+                            * already there */
+#if TRE_DEBUG
+                           if (!collect_MCCS)
+                             {
+                               collect_MCCS = 1;
+                               DPRINT(("tre_parse_bracket: Detected MCCS\n"));
+                             }
+#else /* !TRE_DEBUG */
+                           collect_MCCS = 1;
+#endif /* !TRE_DEBUG */
+                           /* Allocate a memory block the first time */
+                           if (!cp)
+                             {
+                               if ((col_syms = xmalloc(sizeof(*col_syms) *
+                                           (START_COLLATING_SYMBOLS + 2)))
+                                           == NULL)
+                                 return REG_ESPACE;
+                               cp = col_syms + 1;
+                               n_col_syms = START_COLLATING_SYMBOLS;
+                             }
+                           /* Enlarge the memory block is more is needed */
+                           if ((cp - col_syms) - 1 >= n_col_syms)
+                             {
+                               int i = n_col_syms;
+                               tre_collating_symbol *tmp =
+                                   xrealloc(col_syms, sizeof(*col_syms) *
+                                            ((n_col_syms *= 2) + 2));
+                               if (tmp == NULL)
+                                 {
+                                   xfree(col_syms);
+                                   return REG_ESPACE;
+                                 }
+                               DPRINT(("tre_list_collating_symbols: "
+                                       "Enlarging col_syms to %d\n",
+                                       n_col_syms));
+                               col_syms = tmp;
+                               cp = col_syms + i + 1;
+                             }
+                           cp->start = start;
+                           cp->len = re - start;
+                           cp++;
+                           re++;
+                           break;
+                         }
+                     }
+                 }
+               break;
+             }
+
+           case CHAR_EQUAL:
+           case CHAR_COLON:
+             {
+               /* Process equivalence and character classes */
+               tre_char_t kind = re[1];
+
+               /* Can't have a class as an endpoint to a range */
+               if (range > 0)
+                 {
+                   status = REG_ERANGE;
+                   goto error;
+                 }
+               if (!collect_MCCS && range == 0)
+                 {
+                   status = tre_new_item(ctx->mem, TRE_BRACKET_MATCH_TYPE_CHAR,
+                                         min, &max_i, items);
+                   if (status != REG_OK)
+                     goto error;
+                 }
+               range = -1;
+               re += 2;
+               start = re;
+               for (;; re++)
+                 {
+                   if (re >= re_end)
+                     {
+                       status = kind == CHAR_EQUAL ? REG_ECOLLATE : REG_ECTYPE;
+                       goto error;
+                     }
+                   if (*re == kind)
+                     {
+                       if (re + 1 >= re_end)
+                         {
+                           status = kind == CHAR_EQUAL ? REG_ECOLLATE :
+                                                         REG_ECTYPE;
+                           goto error;
+                         }
+                       /* Found end */
+                       if (re[1] == CHAR_RBRACKET)
+                         {
+                           if (re == start)
+                             {
+                               /* Empty class name */
+                               status = kind == CHAR_EQUAL ? REG_ECOLLATE :
+                                                             REG_ECTYPE;
+                               goto error;
+                             }
+                           /* Process equivalence class */
+                           if (kind == CHAR_EQUAL)
+                             {
+                               int equiv;
+
+                               DPRINT(("tre_parse_bracket:   equivalence: '%.*"
+                                       STRF "'\n", REST(start - 2)));
+
+                               /* While we find the collation value even for
+                                  multi-character collating elements , we
+                                  don't (yet) match any collation values
+                                  against multi-character sequences.  We'd have
+                                  to enumerate those multi-character sequences
+                                  and like multi-character collating symbols,
+                                  create a union of those sequences with the
+                                  rest of the bracket expression.  While
+                                  doable, a bracket expression matching
+                                  multiple characters, that doesn't explicitly
+                                  contain multi-character sequences, might
+                                  be unexpected, so we punt for now. */
+                               if ((equiv = __collate_equiv_value(ctx->loc,
+                                            start, re - start)) <= 0)
+                                 {
+                                   /* The standard says that if no collating
+                                      element if found, we use the collating
+                                      symbol itself.  But __collate_equiv_value
+                                      doesn't make a distinction between
+                                      an element that is in a equvalence
+                                      class with others, or is the only member,
+                                      so we already know there is no collating
+                                      symbol.  (Note that in the case of a
+                                      collating element whose collation value
+                                      is unique, matching against the
+                                      collating element itself, or against
+                                      its collation value, is equivalent.) */
+#ifdef BSD_COMPATIBILITY
+                                   /* Check if the name is in cnames; if so,
+                                      use the corresponding code */
+                                   c = tre_search_cnames(start, re - start);
+                                   if (c != (wchar_t)-1)
+                                     {
+                                       re++;
+                                       goto process_single_character;
+                                     }
+#endif /* BSD_COMPATIBILITY */
+                                   status = REG_ECOLLATE;
+                                   goto error;
+                                 }
+                               if (!collect_MCCS)
+                                 {
+                                   status = tre_new_item(ctx->mem,
+                                            TRE_BRACKET_MATCH_TYPE_EQUIVALENCE,
+                                            equiv, &max_i, items);
+                                   if (status != REG_OK)
+                                     goto error;
+                                 }
+                             }
+                           else
+                             {
+                               /* Process character class */
+                               DPRINT(("tre_parse_bracket:  class: '%.*" STRF
+                                       "'\n", REST(start - 2)));
+                               if (!collect_MCCS)
+                                 {
+                                   char tmp_str[64];
+                                   tre_ctype_t class;
+                                   int len = MIN(re - start, 63);
+#ifdef TRE_WCHAR
+                                   {
+                                     tre_char_t tmp_wcs[64];
+                                     wcsncpy(tmp_wcs, start, (size_t)len);
+                                     tmp_wcs[len] = L'\0';
+#if defined HAVE_WCSRTOMBS
+                                     {
+                                       mbstate_t state;
+                                       const tre_char_t *src = tmp_wcs;
+                                       memset(&state, '\0', sizeof(state));
+                                       len = wcsrtombs_l(tmp_str, &src,
+                                                     sizeof(tmp_str), &state,
+                                                     ctx->loc);
+                                     }
+#elif defined HAVE_WCSTOMBS
+                                     len = wcstombs(tmp_str, tmp_wcs, 63);
+#endif /* defined HAVE_WCSTOMBS */
+                                   }
+#else /* !TRE_WCHAR */
+                                   strncpy(tmp_str, (const char*)start, len);
+#endif /* !TRE_WCHAR */
+                                   tmp_str[len] = '\0';
+                                   DPRINT(("  class name: %s\n", tmp_str));
+                                   class = tre_ctype_l(tmp_str, ctx->loc);
+                                   if (!class)
+                                     {
+                                       status = REG_ECTYPE;
+                                       goto error;
+                                     }
+                                   status = tre_new_item(ctx->mem,
+                                            TRE_BRACKET_MATCH_TYPE_CLASS,
+                                            class, &max_i, items);
+                                   if (status != REG_OK)
+                                     goto error;
+                                 }
+                             }
+                           re++;
+                           break;
+                         }
+                     }
+                 }
+               other++;
+               break;
+             }
+
+           default:
+             DPRINT(("tre_parse_bracket:   char: '%.*" STRF "'\n", REST(re)));
+             c = CHAR_LBRACKET;
+             goto process_single_character;
+             break;
+           }
+         break;
+
+       case CHAR_RBRACKET:
+         /* A first right bracket */
+         if (re == ctx->re)
+           {
+             DPRINT(("tre_parse_bracket:   char: '%.*" STRF "'\n", REST(re)));
+             min = CHAR_RBRACKET;
+             range = 0;
+             other++;
+             break;
+           }
+         /* Done */
+         if (collect_MCCS)
+           {
+             DPRINT(("tre_parse_bracket:       done: '%.*" STRF "'\n",
+                     REST(re)));
+             if (col_syms)
+               {
+                 /* Mark the character following the right bracket.  Set len
+                  * to whether there are other things besides the
+                  * multi-character collating symbols */
+                 col_syms->start = re + 1;
+                 col_syms->len = other;
+                 /* Mark the end of the list */
+                 cp->start = NULL;
+               }
+             *result = col_syms;
+             return REG_OK;
+           }
+         /* range > 0 is not possible, since we did a lookahead after the
+          * hyphen */
+         if (range == 0)
+           {
+             status = tre_new_item(ctx->mem, TRE_BRACKET_MATCH_TYPE_CHAR,
+                                   min, &max_i, items);
+             if (status != REG_OK)
+               goto error;
+           }
+         DPRINT(("tre_parse_bracket:   done: '%.*" STRF "'\n", REST(re)));
+         *items_size = max_i;
+         ctx->re = re + 1;
+         return REG_OK;
+
+       default:
+         DPRINT(("tre_parse_bracket:   char: '%.*" STRF "'\n", REST(re)));
+         c = *re;
+process_single_character:
+         /* Process single character */
+         if (range > 0)
+           {
+             int mine, maxe;
+
+process_end_range:
+             /* Get collation equivalence values */
+             mine = __collate_equiv_value(ctx->loc, &min, 1);
+             maxe = __collate_equiv_value(ctx->loc, &c, 1);
+             if (maxe < mine)
+               {
+                 status = REG_ERANGE;
+                 goto error;
+               }
+             if (!collect_MCCS)
+               {
+                 status = tre_new_item(ctx->mem,
+                                       TRE_BRACKET_MATCH_TYPE_RANGE_BEGIN,
+                                       mine, &max_i, items);
+                 if (status != REG_OK)
+                   goto error;
+                 status = tre_new_item(ctx->mem,
+                                       TRE_BRACKET_MATCH_TYPE_RANGE_END,
+                                       maxe, &max_i, items);
+                 if (status != REG_OK)
+                   goto error;
+               }
+             range = -1;
+           }
+         else
+           {
+process_begin_range:
+             if (!collect_MCCS)
+               {
+                 if (range == 0)
+                   {
+                     status = tre_new_item(ctx->mem,
+                                           TRE_BRACKET_MATCH_TYPE_CHAR,
+                                           min, &max_i, items);
+                     if (status != REG_OK)
+                       goto error;
+                   }
+                 min = c;
+               }
+             range = 0;
+           }
+         other++;
+         break;
+       }
+    }
+  status = REG_EBRACK;
+error:
+  DPRINT(("tre_parse_bracket:  error: '%.*" STRF "', status=%d\n",
+         REST(re), status));
+  if (col_syms)
+    xfree(col_syms);
+  return status;
+}
+
+#ifdef TRE_DEBUG
+static const char *bracket_match_type_str[] = {
+  "unused",
+  "char",
+  "range begin",
+  "range end",
+  "class",
+  "equivalence value",
+};
+#endif /* TRE_DEBUG */
+
+static reg_errcode_t
+tre_parse_bracket(tre_parse_ctx_t *ctx, tre_ast_node_t **result)
+{
+  tre_ast_node_t *node;
+  reg_errcode_t status = REG_OK;
+  tre_bracket_match_list_t *items;
+  int max_i = 32;
+  tre_collating_symbol *col_syms = NULL;
+
+  /* Handle special cases [[:<:]] and [[:>:]] */
+  if (ctx->re_end - ctx->re >= 6 && ctx->re[0] == CHAR_LBRACKET
+      && ctx->re[1] == CHAR_COLON && (ctx->re[2] == L'<' || ctx->re[2] == L'>')
+      && ctx->re[3] == CHAR_COLON && ctx->re[4] == CHAR_RBRACKET
+      && ctx->re[5] == CHAR_RBRACKET)
+    {
+      *result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                     (ctx->re[2] == L'<') ? ASSERT_AT_BOW : ASSERT_AT_EOW,
+                     -1);
+      DPRINT(("tre_parse_bracket: special case %s\n", (ctx->re[2] == L'<') ?
+             "[[:<:]]" : "[[:>:]]"));
+      ctx->re += 6;
+      return *result ? REG_OK : REG_ESPACE;
+    }
+
+  /* Start off with an array of `max_i' elements. */
+  items = xcalloc(1, SIZEOF_BRACKET_MATCH_LIST_N(max_i));
+  if (items == NULL)
+    return REG_ESPACE;
+
+  if (*ctx->re == CHAR_CARET)
+    {
+      DPRINT(("tre_parse_bracket: negate: '%.*" STRF "'\n", REST(ctx->re)));
+      items->flags |= TRE_BRACKET_MATCH_FLAG_NEGATE;
+      ctx->re++;
+    }
+
+  status = tre_parse_bracket_items(ctx, &items, &max_i, &col_syms);
+
+  if (status != REG_OK)
+    goto parse_bracket_done;
+
+  /* If there are collating symbols, split off the multi-character ones
+   * into a union of the bracket expression (without the collating symbols)
+   * and the multiple-character sequences.  We create an equivalent input
+   * string and run tre_parse() recursively */
+  if (col_syms)
+    {
+      tre_char_t *str, *sp;
+      tre_collating_symbol *cp;
+      tre_parse_ctx_t subctx;
+
+      /* Allocate a new string.  We start with the size of the original
+       * bracket expression (minus 1) and add 2 (for a leading "[" and
+       * a trailing nil; don't need a "^", since it is illegal to have
+       * inverted MCCSs).  Since a multi-character collating symbols
+       * will be converted from "[.xx.]" to "|xx" (n+4 to n+1), we don't
+       * need to worry about the new string getting too long. */
+      xfree(items);
+      str = xmalloc(sizeof(*str) * ((col_syms->start - ctx->re) + 2));
+      if (str == NULL)
+       {
+         xfree(col_syms);
+         return REG_ESPACE;
+       }
+      sp = str;
+      if (col_syms->len > 0)
+       {
+         /* There are other items in the bracket expression besides the
+          * multi-character collating symbols, so create a new bracket
+          * expression with only those other itmes. */
+         const tre_char_t *re;
+         ptrdiff_t i;
+
+         *sp++ = '[';
+         re = ctx->re;
+         for (cp = col_syms + 1; cp->start; cp++)
+           {
+             /* The "- 2" is to account for the "[." */
+             if ((i = ((cp->start - re) - 2)) > 0)
+               {
+                 memcpy(sp, re, sizeof(*sp) * i);
+                 sp += i;
+               }
+             /* The "+ 2" is to account for the ".]" */
+             re = cp->start + cp->len + 2;
+           }
+           i = col_syms->start - re; /* Includes the trailing right bracket */
+           memcpy(sp, re, sizeof(*sp) * i);
+           sp += i;
+           *sp++ = '|';
+       }
+      for (cp = col_syms + 1; cp->start; cp++)
+       {
+         memcpy(sp, cp->start, sizeof(*sp) * cp->len);
+         sp += cp->len;
+         if (cp[1].start)
+           *sp++ = '|';
+       }
+      *sp = 0;
+      DPRINT(("tre_parse_bracket: Reparsing bracket expression with '%ls'\n",
+             str));
+
+      memcpy(&subctx, ctx, sizeof(subctx));
+      subctx.re = str;
+      subctx.len = sp - str;
+      subctx.nofirstsub = 1;
+      subctx.cflags |= REG_EXTENDED; /* Force extended mode for parsing */
+      status = tre_parse(&subctx);
+      xfree(str);
+      if (status != REG_OK)
+       {
+         xfree(col_syms);
+         return status;
+       }
+      ctx->re = col_syms->start;
+      ctx->position = subctx.position;
+      xfree(col_syms);
+      *result = subctx.result;
+      DPRINT(("tre_parse_bracket: Returning to original string\n"));
+      return REG_OK;
+    }
+
+  DPRINT(("tre_parse_bracket: creating bracket expression literal\n"));
+  node = tre_ast_new_literal(ctx->mem, 0, TRE_CHAR_MAX, ctx->position);
+  if (node == NULL)
+    {
+      status = REG_ESPACE;
+      goto parse_bracket_done;
+    }
+  else
+    {
+      tre_literal_t *l = node->obj;
+      l->u.bracket_match_list = tre_mem_alloc(ctx->mem,
+                                        SIZEOF_BRACKET_MATCH_LIST(items));
+      if (l->u.bracket_match_list == NULL)
+       {
+         status = REG_ESPACE;
+         goto parse_bracket_done;
+       }
+      memcpy(l->u.bracket_match_list, items, SIZEOF_BRACKET_MATCH_LIST(items));
+    }
+
+#ifdef TRE_DEBUG
+  {
+    int i;
+    tre_bracket_match_t *b;
+    DPRINT(("tre_parse_bracket: %d bracket match items, flags 0x%x\n",
+           items->num_bracket_matches, items->flags));
+    for (i = 0, b = items->bracket_matches;
+        i < items->num_bracket_matches; i++, b++)
+      {
+       DPRINT(("   %d: %s %d\n", i, bracket_match_type_str[b->type],
+               b->value));
+      }
+  }
+#endif /* TRE_DEBUG */
+
+ parse_bracket_done:
+  xfree(items);
+  ctx->position++;
+  *result = node;
+  return status;
+}
+
+
+/* Parses a positive decimal integer.  Returns -1 if the string does not
+   contain a valid number. */
+static int
+tre_parse_int(const tre_char_t **regex, const tre_char_t *regex_end)
+{
+  int num = -1;
+  const tre_char_t *r = *regex;
+  while (r < regex_end && *r >= L'0' && *r <= L'9')
+    {
+      if (num < 0)
+       num = 0;
+      num = num * 10 + *r - L'0';
+      r++;
+    }
+  *regex = r;
+  return num;
+}
+
+
+static reg_errcode_t
+tre_parse_bound(tre_parse_ctx_t *ctx, tre_ast_node_t **result)
+{
+  int min, max;
+#ifdef TRE_APPROX
+  int i;
+  int cost_ins, cost_del, cost_subst, cost_max;
+  int limit_ins, limit_del, limit_subst, limit_err;
+  const tre_char_t *start;
+#endif /* TRE_APPROX */
+  const tre_char_t *r = ctx->re;
+  int minimal = (ctx->cflags & REG_UNGREEDY) ? 1 : 0;
+#ifdef TRE_APPROX
+  int approx = 0;
+  int costs_set = 0;
+  int counts_set = 0;
+
+  cost_ins = cost_del = cost_subst = cost_max = TRE_PARAM_UNSET;
+  limit_ins = limit_del = limit_subst = limit_err = TRE_PARAM_UNSET;
+#endif /* TRE_APPROX */
+
+  /* Parse number (minimum repetition count). */
+  min = -1;
+  if (r >= ctx->re_end)
+#ifdef ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+    return (ctx->cflags & REG_EXTENDED) ? REG_NOMATCH : REG_EBRACE;
+#else /* !ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+    return REG_EBRACE;
+#endif /* !ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+  if (*r >= L'0' && *r <= L'9') {
+    DPRINT(("tre_parse:          min count: '%.*" STRF "'\n", REST(r)));
+    min = tre_parse_int(&r, ctx->re_end);
+  }
+#ifndef TRE_APPROX
+  else
+#ifdef ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+      /* For ERE, return REG_NOMATCH to signal that the lbrace should
+         be treated as a literal */
+      return (ctx->cflags & REG_EXTENDED) ? REG_NOMATCH : REG_BADBR;
+#else /* !ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+      return REG_BADBR;
+#endif /* !ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+#endif /* !TRE_APPROX */
+
+  /* Parse comma and second number (maximum repetition count). */
+  max = min;
+  if (r < ctx->re_end && *r == CHAR_COMMA)
+    {
+      r++;
+      DPRINT(("tre_parse:   max count: '%.*" STRF "'\n", REST(r)));
+      max = tre_parse_int(&r, ctx->re_end);
+    }
+
+  /* Check that the repeat counts are sane. */
+  if ((max >= 0 && min > max) || min > RE_DUP_MAX || max > RE_DUP_MAX)
+    return REG_BADBR;
+
+
+#ifdef TRE_APPROX
+  /*
+   '{'
+     optionally followed immediately by a number == minimum repcount
+     optionally followed by , then a number == maximum repcount
+      + then a number == maximum insertion count
+      - then a number == maximum deletion count
+      # then a number == maximum substitution count
+      ~ then a number == maximum number of errors
+      Any of +, -, # or ~ without followed by a number means that
+      the maximum count/number of errors is infinite.
+
+      An equation of the form
+       Xi + Yd + Zs < C
+      can be specified to set costs and the cost limit to a value
+      different from the default value:
+       - X is the cost of an insertion
+       - Y is the cost of a deletion
+       - Z is the cost of a substitution
+       - C is the maximum cost
+
+      If no count limit or cost is set for an operation, the operation
+      is not allowed at all.
+  */
+
+
+  do {
+    int done;
+    start = r;
+
+    /* Parse count limit settings */
+    done = 0;
+    if (!counts_set)
+      while (r + 1 < ctx->re_end && !done)
+       {
+         switch (*r)
+           {
+           case CHAR_PLUS:  /* Insert limit */
+             DPRINT(("tre_parse:   ins limit: '%.*" STRF "'\n", REST(r)));
+             r++;
+             limit_ins = tre_parse_int(&r, ctx->re_end);
+             if (limit_ins < 0)
+               limit_ins = INT_MAX;
+             counts_set = 1;
+             break;
+           case CHAR_MINUS: /* Delete limit */
+             DPRINT(("tre_parse:   del limit: '%.*" STRF "'\n", REST(r)));
+             r++;
+             limit_del = tre_parse_int(&r, ctx->re_end);
+             if (limit_del < 0)
+               limit_del = INT_MAX;
+             counts_set = 1;
+             break;
+           case CHAR_HASH:  /* Substitute limit */
+             DPRINT(("tre_parse: subst limit: '%.*" STRF "'\n", REST(r)));
+             r++;
+             limit_subst = tre_parse_int(&r, ctx->re_end);
+             if (limit_subst < 0)
+               limit_subst = INT_MAX;
+             counts_set = 1;
+             break;
+           case CHAR_TILDE: /* Maximum number of changes */
+             DPRINT(("tre_parse: count limit: '%.*" STRF "'\n", REST(r)));
+             r++;
+             limit_err = tre_parse_int(&r, ctx->re_end);
+             if (limit_err < 0)
+               limit_err = INT_MAX;
+             approx = 1;
+             break;
+           case CHAR_COMMA:
+             r++;
+             break;
+           case L' ':
+             r++;
+             break;
+           case L'}':
+             done = 1;
+             break;
+           default:
+             done = 1;
+             break;
+           }
+       }
+
+    /* Parse cost restriction equation. */
+    done = 0;
+    if (!costs_set)
+      while (r + 1 < ctx->re_end && !done)
+       {
+         switch (*r)
+           {
+           case CHAR_PLUS:
+           case L' ':
+             r++;
+             break;
+           case L'<':
+             DPRINT(("tre_parse:    max cost: '%.*" STRF "'\n", REST(r)));
+             r++;
+             while (*r == L' ')
+               r++;
+             cost_max = tre_parse_int(&r, ctx->re_end);
+             if (cost_max < 0)
+               cost_max = INT_MAX;
+             else
+               cost_max--;
+             approx = 1;
+             break;
+           case CHAR_COMMA:
+             r++;
+             done = 1;
+             break;
+           default:
+             if (*r >= L'0' && *r <= L'9')
+               {
+#ifdef TRE_DEBUG
+                 const tre_char_t *sr = r;
+#endif /* TRE_DEBUG */
+                 int cost = tre_parse_int(&r, ctx->re_end);
+                 /* XXX - make sure r is not past end. */
+                 switch (*r)
+                   {
+                   case L'i':  /* Insert cost */
+                     DPRINT(("tre_parse:    ins cost: '%.*" STRF "'\n",
+                             REST(sr)));
+                     r++;
+                     cost_ins = cost;
+                     costs_set = 1;
+                     break;
+                   case L'd':  /* Delete cost */
+                     DPRINT(("tre_parse:    del cost: '%.*" STRF "'\n",
+                             REST(sr)));
+                     r++;
+                     cost_del = cost;
+                     costs_set = 1;
+                     break;
+                   case L's':  /* Substitute cost */
+                     DPRINT(("tre_parse:  subst cost: '%.*" STRF "'\n",
+                             REST(sr)));
+                     r++;
+                     cost_subst = cost;
+                     costs_set = 1;
+                     break;
+                   default:
+                     return REG_BADBR;
+                   }
+               }
+             else
+               {
+                 done = 1;
+                 break;
+               }
+           }
+       }
+  } while (start != r);
+#endif /* TRE_APPROX */
+
+  /*{*//* Missing }. */
+  if (r >= ctx->re_end)
+    return REG_EBRACE;
+
+  /* Empty contents of {}. */
+  if (r == ctx->re)
+    return REG_BADBR;
+
+  /* Parse the ending '}' or '\}'.*/
+  if (ctx->cflags & REG_EXTENDED)
+    {
+      if (r >= ctx->re_end || *r != CHAR_RBRACE)
+       return REG_BADBR;
+      r++;
+      /* Parse trailing '?' marking minimal repetition. */
+      if (r < ctx->re_end)
+       {
+         if (*r == CHAR_QUESTIONMARK)
+           {
+             /* Process the question mark only in enhanced mode.
+                Otherwise, the question mark is an error in ERE
+                or a literal in BRE */
+             if (ctx->cflags & REG_ENHANCED)
+               {
+                 minimal = !(ctx->cflags & REG_UNGREEDY);
+                 r++;
+               }
+             else return REG_BADRPT;
+           }
+         else if (*r == CHAR_STAR || *r == CHAR_PLUS)
+           {
+             /* These are reserved for future extensions. */
+             return REG_BADRPT;
+           }
+       }
+    }
+  else
+    {
+      if (r + 1 >= ctx->re_end
+         || *r != CHAR_BACKSLASH
+         || *(r + 1) != CHAR_RBRACE)
+       return REG_BADBR;
+      r += 2;
+      if (r < ctx->re_end && *r == CHAR_STAR)
+       {
+         /* This is reserved for future extensions. */
+         return REG_BADRPT;
+       }
+    }
+
+  if (minimal)
+    ctx->num_reorder_tags++;
+
+  if (!result) goto parse_bound_exit;
+  /* Create the AST node(s). */
+  /* Originally, if min == 0 && max == 0, we immediately replace the whole
+     iteration with EMPTY.  This unfortunately drops any submatches, and
+     messes up setting the pmatch values (we can get tags of -1, and
+     tag values in the billions).  So we leave it and process this case as
+     usual, and wait until tre_expand_ast() to replace with EMPTY */
+#ifdef TRE_APPROX
+  if (min < 0 && max < 0)
+    /* Only approximate parameters set, no repetitions. */
+    min = max = 1;
+#endif /* TRE_APPROX */
+
+  *result = tre_ast_new_iter(ctx->mem, *result, min, max, minimal);
+  if (!*result)
+    return REG_ESPACE;
+
+#ifdef TRE_APPROX
+  /* If approximate matching parameters are set, add them to the
+     iteration node. */
+  if (approx || costs_set || counts_set)
+    {
+      int *params;
+      tre_iteration_t *iter = (*result)->obj;
+
+      if (costs_set || counts_set)
+       {
+         if (limit_ins == TRE_PARAM_UNSET)
+           {
+             if (cost_ins == TRE_PARAM_UNSET)
+               limit_ins = 0;
+             else
+               limit_ins = INT_MAX;
+           }
+
+         if (limit_del == TRE_PARAM_UNSET)
+           {
+             if (cost_del == TRE_PARAM_UNSET)
+               limit_del = 0;
+             else
+               limit_del = INT_MAX;
+           }
+
+         if (limit_subst == TRE_PARAM_UNSET)
+           {
+             if (cost_subst == TRE_PARAM_UNSET)
+               limit_subst = 0;
+             else
+               limit_subst = INT_MAX;
+           }
+       }
+
+      if (cost_max == TRE_PARAM_UNSET)
+       cost_max = INT_MAX;
+      if (limit_err == TRE_PARAM_UNSET)
+       limit_err = INT_MAX;
+
+      ctx->have_approx = 1;
+      params = tre_mem_alloc(ctx->mem, sizeof(*params) * TRE_PARAM_LAST);
+      if (!params)
+       return REG_ESPACE;
+      for (i = 0; i < TRE_PARAM_LAST; i++)
+       params[i] = TRE_PARAM_UNSET;
+      params[TRE_PARAM_COST_INS] = cost_ins;
+      params[TRE_PARAM_COST_DEL] = cost_del;
+      params[TRE_PARAM_COST_SUBST] = cost_subst;
+      params[TRE_PARAM_COST_MAX] = cost_max;
+      params[TRE_PARAM_MAX_INS] = limit_ins;
+      params[TRE_PARAM_MAX_DEL] = limit_del;
+      params[TRE_PARAM_MAX_SUBST] = limit_subst;
+      params[TRE_PARAM_MAX_ERR] = limit_err;
+      iter->params = params;
+    }
+#endif /* TRE_APPROX */
+
+parse_bound_exit:
+#ifdef TRE_APPROX
+  DPRINT(("tre_parse_bound: min %d, max %d, costs [%d,%d,%d, total %d], "
+         "limits [%d,%d,%d, total %d]\n",
+         min, max, cost_ins, cost_del, cost_subst, cost_max,
+         limit_ins, limit_del, limit_subst, limit_err));
+#else /* !TRE_APPROX */
+  DPRINT(("tre_parse_bound: min %d, max %d\n", min, max));
+#endif /* !TRE_APPROX */
+
+
+  ctx->re = r;
+  return REG_OK;
+}
+
+/* Previously, we had PARSE_RESTORE_CFLAGS restore the cflags, but for
+   non-self-contained options, like (?i), this causes ((?i)fu)bar to be
+   treated more like ((?i)fu(?-i)bar), so the pmatch value is incorrect.
+   Because we now set up tags for even non-capturing parenthesized
+   subexpressions, we always call PARSE_MARK_FOR_SUBMATCH.  So if we
+   pass the unmodified version of cflags to PARSE_MARK_FOR_SUBMATCH and
+   have it restore cflags after the subexpression, we don't need to have
+   a separate PARSE_RESTORE_CFLAGS, and then after processing the
+   non-self-contained option, we can call PARSE_ATOM instead of PARSE_RE.
+   This has the side-benefit of now matching the perl behavior: the RE
+   foo(?i)bar|zap is foo(?i)bar OR (?i)zap instead of TRE previous behavior
+   of foo AND (?i) (bar OR zap). */
+typedef enum {
+  PARSE_RE = 0,
+  PARSE_ATOM,
+  PARSE_MARK_FOR_SUBMATCH,
+  PARSE_BRANCH,
+  PARSE_PIECE,
+  PARSE_CATENATION,
+  PARSE_POST_CATENATION,
+  PARSE_UNION,
+  PARSE_POST_UNION,
+  PARSE_POSTFIX,
+} tre_parse_re_stack_symbol_t;
+
+
+reg_errcode_t
+tre_parse(tre_parse_ctx_t *ctx)
+{
+  tre_ast_node_t *result = NULL;
+  tre_parse_re_stack_symbol_t symbol;
+  reg_errcode_t status = REG_OK;
+  tre_stack_t *stack = ctx->stack;
+  int bottom = tre_stack_num_objects(stack);
+  int depth = 0;
+  int temporary_cflags = 0;
+  int bre_branch_begin;
+#ifdef TRE_DEBUG
+  const tre_char_t *tmp_re;
+#endif
+
+  DPRINT(("tre_parse: parsing '%.*" STRF "', len = %d cflags = 0%o\n",
+         ctx->len, ctx->re, ctx->len, ctx->cflags));
+
+  if (ctx->len <= 0) return REG_EMPTY;
+  if (!ctx->nofirstsub)
+    {
+      STACK_PUSH(stack, int, ctx->cflags);
+      STACK_PUSH(stack, int, ctx->submatch_id);
+      STACK_PUSH(stack, int, PARSE_MARK_FOR_SUBMATCH);
+      ctx->submatch_id++;
+    }
+  STACK_PUSH(stack, int, 0); // bre_branch_begin
+  STACK_PUSH(stack, int, PARSE_RE);
+  ctx->re_start = ctx->re;
+  ctx->re_end = ctx->re + ctx->len;
+
+
+  /* The following is basically just a recursive descent parser.  I use
+     an explicit stack instead of recursive functions mostly because of
+     two reasons: compatibility with systems which have an overflowable
+     call stack, and efficiency (both in lines of code and speed).  */
+  while (tre_stack_num_objects(stack) > bottom)
+    {
+      symbol = tre_stack_pop_int(stack);
+      switch (symbol)
+       {
+       case PARSE_RE:
+         /* Parse a full regexp.  A regexp is one or more branches,
+            separated by the union operator `|'. */
+         bre_branch_begin = tre_stack_pop_int(stack);
+         if (
+#ifdef REG_LITERAL
+             !(ctx->cflags & REG_LITERAL) &&
+#endif /* REG_LITERAL */
+             ctx->cflags & (REG_EXTENDED | REG_ENHANCED))
+           STACK_PUSHX(stack, int, PARSE_UNION);
+         STACK_PUSHX(stack, int, bre_branch_begin);
+         STACK_PUSHX(stack, int, PARSE_BRANCH);
+         break;
+
+       case PARSE_BRANCH:
+         /* Parse a branch.  A branch is one or more pieces, concatenated.
+            A piece is an atom possibly followed by a postfix operator. */
+         bre_branch_begin = tre_stack_pop_int(stack);
+         STACK_PUSHX(stack, int, PARSE_CATENATION);
+         STACK_PUSHX(stack, int, bre_branch_begin);
+         STACK_PUSHX(stack, int, PARSE_PIECE);
+         break;
+
+       case PARSE_PIECE:
+         /* Parse a piece.  A piece is an atom possibly followed by one
+            or more postfix operators. */
+         bre_branch_begin = tre_stack_pop_int(stack);
+         STACK_PUSHX(stack, int, PARSE_POSTFIX);
+         STACK_PUSHX(stack, int, bre_branch_begin);
+         STACK_PUSHX(stack, int, PARSE_ATOM);
+         break;
+
+       case PARSE_CATENATION:
+         /* If the expression has not ended, parse another piece. */
+         {
+           tre_char_t c;
+           if (ctx->re >= ctx->re_end)
+             break;
+           c = *ctx->re;
+#ifdef REG_LITERAL
+           if (!(ctx->cflags & REG_LITERAL))
+             {
+#endif /* REG_LITERAL */
+               if ((ctx->cflags & REG_EXTENDED && c == CHAR_PIPE) ||
+                   ((ctx->cflags & (REG_EXTENDED | REG_ENHANCED)) == REG_ENHANCED
+                   && ctx->re + 1 < ctx->re_end && c == CHAR_BACKSLASH &&
+                   *(ctx->re + 1) == CHAR_PIPE))
+                 break;
+               if ((ctx->cflags & REG_EXTENDED
+                    && c == CHAR_RPAREN && depth > 0)
+                   || (!(ctx->cflags & REG_EXTENDED)
+                       && ctx->re + 1 < ctx->re_end && c == CHAR_BACKSLASH
+                           && *(ctx->re + 1) == CHAR_RPAREN))
+                 {
+                   if (!(ctx->cflags & REG_EXTENDED) && depth == 0)
+                     return REG_EPAREN;
+                   DPRINT(("tre_parse:   group end: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   depth--;
+                   if (!(ctx->cflags & (REG_EXTENDED | REG_ENHANCED)))
+                     ctx->re += 2;
+                   break;
+                 }
+#ifdef REG_LITERAL
+             }
+#endif /* REG_LITERAL */
+
+#ifdef REG_LEFT_ASSOC
+           if (ctx->cflags & REG_LEFT_ASSOC)
+             {
+               /* Left associative concatenation. */
+               STACK_PUSHX(stack, int, PARSE_CATENATION);
+               STACK_PUSHX(stack, voidptr, result);
+               STACK_PUSHX(stack, int, PARSE_POST_CATENATION);
+               STACK_PUSHX(stack, int, 0); // bre_branch_begin
+               STACK_PUSHX(stack, int, PARSE_PIECE);
+             }
+           else
+#endif /* REG_LEFT_ASSOC */
+             {
+               /* Default case, right associative concatenation. */
+               STACK_PUSHX(stack, voidptr, result);
+               STACK_PUSHX(stack, int, PARSE_POST_CATENATION);
+               STACK_PUSHX(stack, int, PARSE_CATENATION);
+               STACK_PUSHX(stack, int, 0); // bre_branch_begin
+               STACK_PUSHX(stack, int, PARSE_PIECE);
+             }
+           break;
+         }
+
+       case PARSE_POST_CATENATION:
+         {
+           tre_ast_node_t *tree = tre_stack_pop_voidptr(stack);
+           tre_ast_node_t *tmp_node;
+           tmp_node = tre_ast_new_catenation(ctx->mem, tree, result);
+           if (!tmp_node)
+             return REG_ESPACE;
+           result = tmp_node;
+           break;
+         }
+
+       case PARSE_UNION:
+         if (ctx->re >= ctx->re_end)
+           break;
+#ifdef REG_LITERAL
+         if (ctx->cflags & REG_LITERAL)
+           break;
+#endif /* REG_LITERAL */
+         if (!(ctx->cflags & REG_EXTENDED))
+           {
+             if (*ctx->re != CHAR_BACKSLASH || ctx->re + 1 >= ctx->re_end)
+               break;
+             ctx->re++;
+           }
+         switch (*ctx->re)
+           {
+           case CHAR_PIPE:
+             DPRINT(("tre_parse:       union: '%.*" STRF "'\n",
+                     REST(ctx->re)));
+             STACK_PUSHX(stack, int, PARSE_UNION);
+             STACK_PUSHX(stack, voidptr, (void *)ctx->re);
+             STACK_PUSHX(stack, voidptr, result);
+             STACK_PUSHX(stack, int, PARSE_POST_UNION);
+             /* We need to pass a boolean (eventually) to PARSE_ATOM to
+                indicate if this is the beginning of a BRE extended branch. */
+             STACK_PUSHX(stack, int, (ctx->cflags & (REG_EXTENDED | REG_ENHANCED)) == REG_ENHANCED); // bre_branch_begin
+             STACK_PUSHX(stack, int, PARSE_BRANCH);
+             ctx->re++;
+             break;
+
+           case CHAR_RPAREN:
+             ctx->re++;
+             break;
+
+           default:
+             if (!(ctx->cflags & REG_EXTENDED))
+               ctx->re--;
+             break;
+           }
+         break;
+
+       case PARSE_POST_UNION:
+         {
+           tre_ast_node_t *tmp_node;
+           tre_ast_node_t *tree = tre_stack_pop_voidptr(stack);
+           const tre_char_t *pipechar = tre_stack_pop_voidptr(stack);
+           /* error on empty expression at end of union */
+           if (pipechar == ctx->re - 1)
+             {
+               return REG_EMPTY;
+             }
+           tmp_node = tre_ast_new_union(ctx->mem, tree, result);
+           if (!tmp_node)
+             return REG_ESPACE;
+           result = tmp_node;
+           break;
+         }
+
+       case PARSE_POSTFIX:
+         /* Parse postfix operators. */
+         if (ctx->re >= ctx->re_end)
+           break;
+#ifdef REG_LITERAL
+         if (ctx->cflags & REG_LITERAL)
+           break;
+#endif /* REG_LITERAL */
+         int minimal = (ctx->cflags & REG_UNGREEDY) ? 1 : 0;
+         int rep_min = 0;
+         int rep_max = -1;
+#ifdef TRE_DEBUG
+         int lbrace_off;
+#endif
+         switch (*ctx->re)
+           {
+           case CHAR_PLUS:
+           case CHAR_QUESTIONMARK:
+             if (!(ctx->cflags & REG_EXTENDED))
+               break;
+               /*FALLTHROUGH*/
+           case CHAR_STAR:
+             {
+               tre_ast_node_t *tmp_node;
+#ifdef TRE_DEBUG
+               const char *tstr = "star";
+               tmp_re = ctx->re;
+#endif
+
+       handle_plus_or_question:
+               /* error on iteration of raw assertion (not in subexpression) */
+               if (result->type == LITERAL && result->submatch_id < 0 &&
+                   IS_ASSERTION((tre_literal_t *)result->obj))
+                 {
+                   if (!(ctx->cflags & REG_EXTENDED)) break;
+                   return REG_BADRPT;
+                 }
+               if (*ctx->re == CHAR_PLUS)
+                 {
+                   rep_min = 1;
+#ifdef TRE_DEBUG
+                   tstr = "plus";
+#endif
+                 }
+               if (*ctx->re == CHAR_QUESTIONMARK)
+                 {
+                   rep_max = 1;
+#ifdef TRE_DEBUG
+                   tstr = "questionmark";
+#endif
+                 }
+
+               if (ctx->cflags & REG_EXTENDED)
+                 {
+                   if (ctx->re + 1 < ctx->re_end)
+                     {
+                       if (*(ctx->re + 1) == CHAR_QUESTIONMARK)
+                         {
+                           /* Process the question mark only in enhanced mode.
+                              Otherwise, the question mark is an error in ERE */
+                           if (ctx->cflags & REG_ENHANCED)
+                             {
+                               minimal = !(ctx->cflags & REG_UNGREEDY);
+                               ctx->re++;
+                             }
+                           else return REG_BADRPT;
+                         }
+                       else if (*(ctx->re + 1) == CHAR_STAR
+                                || *(ctx->re + 1) == CHAR_PLUS)
+                         {
+                           /* These are reserved for future extensions. */
+                           return REG_BADRPT;
+                         }
+                     }
+                 }
+               else
+                 {
+                   if (ctx->re + 1 < ctx->re_end && *(ctx->re + 1) == CHAR_STAR)
+                     {
+                       /* This is reserved for future extensions. */
+                       return REG_BADRPT;
+                     }
+                   if (ctx->re + 2 < ctx->re_end)
+                     {
+                       if (*(ctx->re + 1) == CHAR_BACKSLASH && *(ctx->re + 1) == CHAR_QUESTIONMARK)
+                         {
+                           /* Process the question mark only in enhanced mode.
+                              Otherwise, the question mark is a literal in BRE */
+                           if (ctx->cflags & REG_ENHANCED)
+                             {
+                               minimal = !(ctx->cflags & REG_UNGREEDY);
+                               ctx->re += 2;
+                             }
+                         }
+                       else if (*(ctx->re + 1) == CHAR_BACKSLASH && *(ctx->re + 2) == CHAR_PLUS)
+                         {
+                           /* This is reserved for future extensions. */
+                           return REG_BADRPT;
+                         }
+                     }
+                 }
+
+               if (minimal)
+                 ctx->num_reorder_tags++;
+
+               DPRINT(("tre_parse: %s %s: '%.*" STRF "'\n",
+                       minimal ? "  minimal" : "greedy", tstr, REST(tmp_re)));
+               if (result == NULL)
+                 {
+                   if (ctx->cflags & REG_EXTENDED) return REG_BADRPT;
+                   else goto parse_literal;
+                 }
+               ctx->re++;
+               tmp_node = tre_ast_new_iter(ctx->mem, result, rep_min, rep_max,
+                                           minimal);
+               if (tmp_node == NULL)
+                 return REG_ESPACE;
+               result = tmp_node;
+
+               /* Set the iterator with a submatch id in the invisible range
+                * (which will be overridden if a real submatch is needed) */
+               result->submatch_id = ctx->submatch_id_invisible++;
+
+#if 0
+               /* We don't allow multiple postfixes, but this might be needed
+                  to support approximate matching */
+               STACK_PUSHX(stack, int, PARSE_POSTFIX);
+#endif
+             }
+             break;
+
+           case CHAR_BACKSLASH:
+             /* "\{" is special without REG_EXTENDED */
+             /* "\+" and "\?" are special with REG_ENHANCED for BRE */
+             if (!(ctx->cflags & REG_EXTENDED)
+                 && ctx->re + 1 < ctx->re_end)
+               {
+                 switch (*(ctx->re + 1))
+                   {
+                   case CHAR_LBRACE:
+                     ctx->re++;
+#ifdef TRE_DEBUG
+                     lbrace_off = 2;
+#endif
+                     goto parse_brace;
+                   case CHAR_PLUS:
+                   case CHAR_QUESTIONMARK:
+                     if (ctx->cflags & REG_ENHANCED)
+                       {
+#ifdef TRE_DEBUG
+                         tmp_re = ctx->re;
+#endif
+                         ctx->re++;
+                         goto handle_plus_or_question;
+                       }
+                     break;
+                   }
+                 break;
+               }
+             else
+               break;
+
+           case CHAR_LBRACE:
+             {
+               int raw_assertion;
+
+               /* "{" is literal without REG_EXTENDED */
+               if (!(ctx->cflags & REG_EXTENDED))
+                 break;
+#ifdef TRE_DEBUG
+               lbrace_off = 1;
+#endif
+
+           parse_brace:
+               /* error on iteration of raw assertion (not in subexpression),
+                  but wait until after parsing bounds */
+               raw_assertion = (result->type == LITERAL
+                                && result->submatch_id < 0
+                                && IS_ASSERTION((tre_literal_t *)result->obj));
+               ctx->re++;
+
+               status = tre_parse_bound(ctx, &result);
+#ifdef ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+               /* For ERE, if status is REG_NOMATCH, this mean the lbrace
+                  is to be treated as a literal. */
+               if (status == REG_NOMATCH)
+                 {
+                   ctx->re--;
+                   break;
+                 }
+#endif /* ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+               DPRINT(("tre_parse:     bound: '%.*" STRF "'\n",
+                       REST(ctx->re - lbrace_off)));
+               if (status != REG_OK)
+                 return status;
+               if (raw_assertion) return REG_BADRPT;
+
+               /* Set the iterator with a submatch id in the invisible range
+                * (which will be overridden if a real submatch is needed) */
+               if (result->type == ITERATION)
+                 result->submatch_id = ctx->submatch_id_invisible++;
+
+#if 0
+               /* We don't allow multiple postfixes, but this might be needed
+                  to support approximate matching */
+               STACK_PUSHX(stack, int, PARSE_POSTFIX);
+#endif
+               break;
+             }
+           }
+         break;
+
+       case PARSE_ATOM:
+         {
+           /* Parse an atom.  An atom is a regular expression enclosed in `()',
+              an empty set of `()', a bracket expression, `.', `^', `$',
+              a `\' followed by a character, or a single character. */
+
+           /* The stack contains a boolean value, whether PARSE_ATOM is
+              being called just after the start of a group (left paren)
+              in a BRE */
+           bre_branch_begin = tre_stack_pop_int(stack);
+
+           /* End of regexp? (empty string). */
+           if (ctx->re >= ctx->re_end)
+             goto parse_literal;
+
+#ifdef REG_LITERAL
+           if (ctx->cflags & REG_LITERAL)
+             goto parse_literal;
+#endif /* REG_LITERAL */
+
+           switch (*ctx->re)
+             {
+             case CHAR_LPAREN:  /* parenthesized subexpression */
+
+               /* Handle "(?...)" extensions.  They work in a way similar
+                  to Perls corresponding extensions. */
+               if ((ctx->cflags & (REG_EXTENDED|REG_ENHANCED)) ==
+                   (REG_EXTENDED|REG_ENHANCED)
+                   && *(ctx->re + 1) == CHAR_QUESTIONMARK)
+                 {
+                   int new_cflags = ctx->cflags;
+                   int bit = 1;
+                   int invisible_submatch = 0;
+                   DPRINT(("tre_parse: extension: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   ctx->re += 2;
+                   while (/*CONSTCOND*/1)
+                     {
+                       if (*ctx->re == L'i')
+                         {
+                           DPRINT(("tre_parse:     icase: '%.*" STRF "'\n",
+                                   REST(ctx->re)));
+                           if (bit)
+                             new_cflags |= REG_ICASE;
+                           else
+                             new_cflags &= ~REG_ICASE;
+                           ctx->re++;
+                         }
+                       else if (*ctx->re == L'n')
+                         {
+                           DPRINT(("tre_parse:   newline: '%.*" STRF "'\n",
+                                   REST(ctx->re)));
+                           if (bit)
+                             new_cflags |= REG_NEWLINE;
+                           else
+                             new_cflags &= ~REG_NEWLINE;
+                           ctx->re++;
+                         }
+#ifdef REG_LEFT_ASSOC
+                       else if (*ctx->re == L'l')
+                         {
+                           DPRINT(("tre_parse: left assoc: '%.*" STRF "'\n",
+                                   REST(ctx->re)));
+                           if (bit)
+                             new_cflags |= REG_LEFT_ASSOC;
+                           else
+                             new_cflags &= ~REG_LEFT_ASSOC;
+                           ctx->re++;
+                         }
+#endif /* REG_LEFT_ASSOC */
+#ifdef REG_UNGREEDY
+                       else if (*ctx->re == L'U')
+                         {
+                           DPRINT(("tre_parse:    ungreedy: '%.*" STRF "'\n",
+                                   REST(ctx->re)));
+                           if (bit)
+                             new_cflags |= REG_UNGREEDY;
+                           else
+                             new_cflags &= ~REG_UNGREEDY;
+                           ctx->re++;
+                         }
+#endif /* REG_UNGREEDY */
+                       else if (*ctx->re == CHAR_MINUS)
+                         {
+                           DPRINT(("tre_parse:  turn off: '%.*" STRF "'\n",
+                                   REST(ctx->re)));
+                           ctx->re++;
+                           bit = 0;
+                         }
+                       else if (*ctx->re == CHAR_COLON)
+                         {
+                           DPRINT(("tre_parse:  no group: '%.*" STRF
+                                   "', (invisible submatch %d)\n",
+                                   REST(ctx->re), ctx->submatch_id_invisible));
+                           ctx->re++;
+                           depth++;
+                           invisible_submatch = 1;
+                           break;
+                         }
+                       else if (*ctx->re == CHAR_HASH)
+                         {
+                           DPRINT(("tre_parse:    comment: '%.*" STRF "'\n",
+                                   REST(ctx->re)));
+                           /* A comment can contain any character except a
+                              right parenthesis */
+                           while (*ctx->re != CHAR_RPAREN
+                                  && ctx->re < ctx->re_end)
+                             ctx->re++;
+                           if (*ctx->re == CHAR_RPAREN && ctx->re < ctx->re_end)
+                             {
+                               ctx->re++;
+                               break;
+                             }
+                           else
+                             return REG_BADPAT;
+                         }
+                       else if (*ctx->re == CHAR_RPAREN)
+                         {
+                           ctx->re++;
+                           break;
+                         }
+                       else
+                         return REG_BADRPT;
+                     }
+
+                   /* Turn on the cflags changes for the rest of the
+                      enclosing group. */
+                   if (invisible_submatch)
+                     {
+                       STACK_PUSHX(stack, int, ctx->cflags);
+                       STACK_PUSHX(stack, int, ctx->submatch_id_invisible);
+                       STACK_PUSHX(stack, int, PARSE_MARK_FOR_SUBMATCH);
+                       ctx->submatch_id_invisible++;
+                       STACK_PUSHX(stack, int, 0); // bre_branch_begin
+                       STACK_PUSHX(stack, int, PARSE_RE);
+                     }
+                   else {
+                       STACK_PUSHX(stack, int, 0); // bre_branch_begin
+                       STACK_PUSHX(stack, int, PARSE_ATOM);
+                   }
+                   ctx->cflags = new_cflags;
+                   break;
+                 }
+
+               if (ctx->cflags & REG_EXTENDED)
+                 {
+               parse_bre_lparen:
+                   DPRINT(("tre_parse: group begin: '%.*" STRF
+                           "', submatch %d\n", REST(ctx->re),
+                           ctx->submatch_id));
+                   ctx->re++;
+                   /* First parse a whole RE, then mark the resulting tree
+                      for submatching. */
+                   STACK_PUSHX(stack, int, ctx->cflags);
+                   STACK_PUSHX(stack, int, ctx->submatch_id);
+                   STACK_PUSHX(stack, int, PARSE_MARK_FOR_SUBMATCH);
+                   /* We need to pass a boolean (eventually) to PARSE_ATOM to
+                      indicate if this is the beginning of a BRE group. */
+                   STACK_PUSHX(stack, int, !(ctx->cflags & REG_EXTENDED));
+                   STACK_PUSHX(stack, int, PARSE_RE);
+                   ctx->submatch_id++;
+                   depth++;
+                 }
+               else
+                 goto parse_literal;
+               break;
+
+             case CHAR_RPAREN:  /* end of current subexpression */
+               if (ctx->cflags & REG_EXTENDED && depth > 0)
+                 {
+             parse_bre_rparen_empty:
+                   if (!(ctx->cflags & REG_EXTENDED) && depth == 0)
+                     return REG_EPAREN;
+                   DPRINT(("tre_parse:     empty: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   /* We were expecting an atom, but instead the current
+                      subexpression was closed.  POSIX leaves the meaning of
+                      this to be implementation-defined.  We interpret this as
+                      an empty expression (which matches an empty string).  */
+                   result = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
+                   if (result == NULL)
+                     return REG_ESPACE;
+                   if (!(ctx->cflags & REG_EXTENDED))
+                     ctx->re--;
+                 }
+               else
+                 goto parse_literal;
+               break;
+
+             case CHAR_LBRACKET: /* bracket expression */
+               DPRINT(("tre_parse:     bracket: '%.*" STRF "'\n",
+                       REST(ctx->re)));
+               ctx->re++;
+               status = tre_parse_bracket(ctx, &result);
+               if (status != REG_OK)
+                 return status;
+               break;
+
+             case CHAR_BACKSLASH:
+               /* Deal with "\(", "\)" or "\{" for BREs */
+               if (!(ctx->cflags & REG_EXTENDED)
+                   && ctx->re + 1 < ctx->re_end)
+                 {
+                   if (*(ctx->re + 1) == CHAR_LPAREN)
+                     {
+                       ctx->re++;
+                       goto parse_bre_lparen;
+                     }
+                   else if (*(ctx->re + 1) == CHAR_RPAREN)
+                     {
+                       ctx->re++;
+                       goto parse_bre_rparen_empty;
+                     }
+                   if (*(ctx->re + 1) == CHAR_LBRACE) goto parse_literal;
+                 }
+
+               if (ctx->re + 1 >= ctx->re_end)
+                 /* Trailing backslash. */
+                 return REG_EESCAPE;
+
+               if (!(ctx->cflags & REG_ENHANCED))
+                 {
+                   DPRINT(("tre_parse:  unenhanced bleep: '%.*" STRF "'\n", REST(ctx->re)));
+                   ctx->re++;
+                   goto unenhanced_backslash;
+                 }
+
+               /* If a macro is used, parse the expanded macro recursively. */
+               {
+                 tre_char_t buf[64];
+                 tre_expand_macro(ctx->re + 1, ctx->re_end,
+                                  buf, elementsof(buf));
+                 if (buf[0] != 0)
+                   {
+                     tre_parse_ctx_t subctx;
+                     memcpy(&subctx, ctx, sizeof(subctx));
+                     subctx.re = buf;
+                     subctx.len = tre_strlen(buf);
+                     subctx.nofirstsub = 1;
+                     status = tre_parse(&subctx);
+                     if (status != REG_OK)
+                       return status;
+                     ctx->re += 2;
+                     ctx->position = subctx.position;
+                     result = subctx.result;
+                     break;
+                   }
+               }
+
+#ifdef REG_LITERAL
+               if (*(ctx->re + 1) == L'Q')
+                 {
+                   DPRINT(("tre_parse: tmp literal: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   ctx->cflags |= REG_LITERAL;
+                   temporary_cflags |= REG_LITERAL;
+                   ctx->re += 2;
+                   STACK_PUSHX(stack, int, 0);
+                   STACK_PUSHX(stack, int, PARSE_ATOM);
+                   break;
+                 }
+#endif /* REG_LITERAL */
+
+               DPRINT(("tre_parse:  bleep: '%.*" STRF "'\n", REST(ctx->re)));
+               ctx->re++;
+               switch (*ctx->re)
+                 {
+                 case L'b':
+                   result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                                                ASSERT_AT_WB, -1);
+                   ctx->re++;
+                   break;
+                 case L'B':
+                   result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                                                ASSERT_AT_WB_NEG, -1);
+                   ctx->re++;
+                   break;
+                 case L'<':
+                   result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                                                ASSERT_AT_BOW, -1);
+                   ctx->re++;
+                   break;
+                 case L'>':
+                   result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                                                ASSERT_AT_EOW, -1);
+                   ctx->re++;
+                   break;
+                 case L'x':
+                   ctx->re++;
+                   if (ctx->re[0] != CHAR_LBRACE && ctx->re < ctx->re_end)
+                     {
+                       /* 8 bit hex char. */
+                       char tmp[3] = {0, 0, 0};
+                       long val;
+                       DPRINT(("tre_parse:  8 bit hex: '%.*" STRF "'\n",
+                               REST(ctx->re - 2)));
+
+                       if (tre_isxdigit_l(ctx->re[0], ctx->loc) &&
+                           ctx->re < ctx->re_end)
+                         {
+                           tmp[0] = (char)ctx->re[0];
+                           ctx->re++;
+                         }
+                       if (tre_isxdigit_l(ctx->re[0], ctx->loc) &&
+                           ctx->re < ctx->re_end)
+                         {
+                           tmp[1] = (char)ctx->re[0];
+                           ctx->re++;
+                         }
+                       val = strtol(tmp, NULL, 16);
+                       result = tre_ast_new_literal(ctx->mem, (int)val,
+                                                    (int)val, ctx->position);
+                       ctx->position++;
+                       break;
+                     }
+                   else if (ctx->re < ctx->re_end)
+                     {
+                       /* Wide char. */
+                       char tmp[32];
+                       long val;
+                       int i = 0;
+                       ctx->re++;
+                       while (ctx->re_end - ctx->re >= 0)
+                         {
+                           if (ctx->re[0] == CHAR_RBRACE)
+                             break;
+                           if (tre_isxdigit_l(ctx->re[0], ctx->loc))
+                             {
+                               tmp[i] = (char)ctx->re[0];
+                               i++;
+                               ctx->re++;
+                               continue;
+                             }
+                           return REG_EBRACE;
+                         }
+                       ctx->re++;
+                       tmp[i] = 0;
+                       val = strtol(tmp, NULL, 16);
+                       result = tre_ast_new_literal(ctx->mem, (int)val, (int)val,
+                                                    ctx->position);
+                       ctx->position++;
+                       break;
+                     }
+                   /*FALLTHROUGH*/
+
+                 default:
+                 unenhanced_backslash:
+                   if ((ctx->cflags & (REG_EXTENDED | REG_ENHANCED)) !=
+                       REG_EXTENDED &&
+                       tre_isdigit_l(*ctx->re, ctx->loc) && *ctx->re != L'0')
+                     {
+                       /* Back reference (only in BRE or enhanced). */
+                       int val = *ctx->re - L'0';
+                       DPRINT(("tre_parse:     backref: '%.*" STRF "'\n",
+                               REST(ctx->re - 1)));
+                       result = tre_ast_new_literal(ctx->mem, BACKREF, val,
+                                                    ctx->position);
+                       if (result == NULL)
+                         return REG_ESPACE;
+
+                       /* Set the backref with a submatch id in the invisible
+                        * range (which will be overridden if a real submatch
+                        * is needed) */
+                       result->submatch_id = ctx->submatch_id_invisible++;
+
+                       ctx->position++;
+                       ctx->num_reorder_tags++;
+                       ctx->max_backref = MAX(val, ctx->max_backref);
+                       ctx->re++;
+                     }
+                   else
+                     {
+                       /* Escaped character. */
+                       DPRINT(("tre_parse:     escaped: '%.*" STRF "'\n",
+                               REST(ctx->re - 1)));
+                       result = tre_ast_new_literal(ctx->mem, *ctx->re, *ctx->re,
+                                                    ctx->position);
+                       ctx->position++;
+                       ctx->re++;
+                     }
+                   break;
+                 }
+               if (result == NULL)
+                 return REG_ESPACE;
+               break;
+
+             case CHAR_PERIOD:  /* the any-symbol */
+               DPRINT(("tre_parse:       any: '%.*" STRF "'\n",
+                       REST(ctx->re)));
+               if (ctx->cflags & REG_NEWLINE)
+                 {
+                   tre_ast_node_t *tmp1;
+                   tre_ast_node_t *tmp2;
+                   tmp1 = tre_ast_new_literal(ctx->mem, 0, L'\n' - 1,
+                                              ctx->position);
+                   if (!tmp1)
+                     return REG_ESPACE;
+                   tmp2 = tre_ast_new_literal(ctx->mem, L'\n' + 1, TRE_CHAR_MAX,
+                                              ctx->position + 1);
+                   if (!tmp2)
+                     return REG_ESPACE;
+                   result = tre_ast_new_union(ctx->mem, tmp1, tmp2);
+                   if (!result)
+                     return REG_ESPACE;
+                   ctx->position += 2;
+                 }
+               else
+                 {
+                   result = tre_ast_new_literal(ctx->mem, 0, TRE_CHAR_MAX,
+                                                ctx->position);
+                   if (!result)
+                     return REG_ESPACE;
+                   ctx->position++;
+                 }
+               ctx->re++;
+               break;
+
+             case CHAR_CARET:   /* beginning of line assertion */
+               /* '^' has a special meaning everywhere in EREs, at the
+                  beginning of the RE and after \( is BREs.  It is also
+                  special in enhanced BREs at the beginning of each branches
+                  of a union */
+               if (ctx->cflags & REG_EXTENDED
+                   || bre_branch_begin
+                   || ctx->re == ctx->re_start)
+                 {
+                   DPRINT(("tre_parse:       BOL: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                                                ASSERT_AT_BOL, -1);
+                   if (result == NULL)
+                     return REG_ESPACE;
+                   ctx->re++;
+                 }
+               else
+                 goto parse_literal;
+               break;
+
+             case CHAR_DOLLAR:  /* end of line assertion. */
+               /* '$' is special everywhere in EREs, and in the end of the
+                  string and before \) is BREs. */
+               if (ctx->cflags & REG_EXTENDED
+                   || (ctx->re + 2 < ctx->re_end
+                       && *(ctx->re + 1) == CHAR_BACKSLASH
+                       && *(ctx->re + 2) == CHAR_RPAREN)
+                   || ctx->re + 1 == ctx->re_end)
+                 {
+                   DPRINT(("tre_parse:       EOL: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   result = tre_ast_new_literal(ctx->mem, ASSERTION,
+                                                ASSERT_AT_EOL, -1);
+                   if (result == NULL)
+                     return REG_ESPACE;
+                   ctx->re++;
+                 }
+               else
+                 goto parse_literal;
+               break;
+
+             default:
+             parse_literal:
+
+               if (temporary_cflags && ctx->re + 1 < ctx->re_end
+                   && *ctx->re == CHAR_BACKSLASH && *(ctx->re + 1) == L'E')
+                 {
+                   DPRINT(("tre_parse:  end tmps: '%.*" STRF "'\n",
+                           REST(ctx->re)));
+                   ctx->cflags &= ~temporary_cflags;
+                   temporary_cflags = 0;
+                   ctx->re += 2;
+                   if (ctx->re < ctx->re_end)
+                     {
+                       STACK_PUSHX(stack, int, 0);
+                       STACK_PUSHX(stack, int, PARSE_ATOM);
+                     }
+                   else
+                     {
+                       result = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
+                       if (!result) return REG_ESPACE;
+                     }
+                   break;
+                 }
+
+
+               /* We are expecting an atom.  If the subexpression (or the whole
+                  regexp ends here, we interpret it as an empty expression
+                  (which matches an empty string), which is an error.
+                  Iterations of an empty expression is also an error. */
+#ifdef REG_LITERAL
+               if (!(ctx->cflags & REG_LITERAL))
+                 {
+#endif /* REG_LITERAL */
+                   /* error on end of string */
+                   if (ctx->re >= ctx->re_end) return depth > 0 ? REG_EPAREN
+                                                      : REG_EMPTY;
+                   /* error on unions and iterations of empty expressions */
+                   if (ctx->cflags & REG_EXTENDED)
+                     {
+                       if (ctx->re < ctx->re_end)
+                         {
+                           if (*ctx->re == CHAR_PIPE) return REG_EMPTY;
+                           if (*ctx->re == CHAR_LBRACE)
+                             {
+                               ctx->re++;
+                 empty_parse_bound:
+                               /* We need to parse the bound first and return
+                                  any error, before returning REG_BADRPT */
+                               status = tre_parse_bound(ctx, NULL);
+#ifdef ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+                               /* For ERE, if REG_NOMATCH is returned, we
+                                  treat the lbrace as a literal. */
+                               if (status == REG_NOMATCH)
+                                 {
+                                   ctx->re--;
+                                   /* Drop down to literal-handling code */
+                                 }
+                               else
+                                 {
+#endif /* ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+                                   if (status != REG_OK)
+                                     return status;
+                                   return REG_BADRPT;
+#ifdef ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+                                 }
+#endif /* ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+                             }
+#ifdef ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND
+                           else
+#endif /* ERE_LITERAL_LBRACE_ON_NON_NUMERIC_BOUND */
+                           if (*ctx->re == CHAR_STAR
+                               || *ctx->re == CHAR_PLUS
+                               || *ctx->re == CHAR_QUESTIONMARK)
+                             {
+                               return REG_BADRPT;
+                             }
+                         }
+                     }
+                   else if (ctx->re + 1 < ctx->re_end
+                            && *ctx->re == CHAR_BACKSLASH
+                            && *(ctx->re + 1) == CHAR_LBRACE)
+                     {
+                       ctx->re += 2;
+                       goto empty_parse_bound;
+                     }
+#ifdef REG_LITERAL
+                 }
+#endif /* REG_LITERAL */
+
+               DPRINT(("tre_parse:     literal: '%.*" STRF "'\n",
+                       REST(ctx->re)));
+               /* Note that we can't use an tre_isalpha() test here, since there
+                  may be characters which are alphabetic but neither upper or
+                  lower case. */
+               if (ctx->cflags & REG_ICASE
+                   && (tre_isupper_l(*ctx->re, ctx->loc) ||
+                   tre_islower_l(*ctx->re, ctx->loc)))
+                 {
+                   tre_ast_node_t *tmp1;
+                   tre_ast_node_t *tmp2;
+
+                   /* XXX - Can there be more than one opposite-case
+                      counterpoints for some character in some locale?  Or
+                      more than two characters which all should be regarded
+                      the same character if case is ignored?  If yes, there
+                      does not seem to be a portable way to detect it.  I guess
+                      that at least for multi-character collating elements there
+                      could be several opposite-case counterpoints, but they
+                      cannot be supported portably anyway. */
+                   tmp1 = tre_ast_new_literal(ctx->mem,
+                                              tre_toupper_l(*ctx->re, ctx->loc),
+                                              tre_toupper_l(*ctx->re, ctx->loc),
+                                              ctx->position);
+                   if (!tmp1)
+                     return REG_ESPACE;
+                   tmp2 = tre_ast_new_literal(ctx->mem,
+                                              tre_tolower_l(*ctx->re, ctx->loc),
+                                              tre_tolower_l(*ctx->re, ctx->loc),
+                                              ctx->position);
+                   if (!tmp2)
+                     return REG_ESPACE;
+                   result = tre_ast_new_union(ctx->mem, tmp1, tmp2);
+                   if (!result)
+                     return REG_ESPACE;
+                 }
+               else
+                 {
+                   result = tre_ast_new_literal(ctx->mem, *ctx->re, *ctx->re,
+                                                ctx->position);
+                   if (!result)
+                     return REG_ESPACE;
+                 }
+               ctx->position++;
+               ctx->re++;
+               break;
+             }
+           break;
+         }
+
+       case PARSE_MARK_FOR_SUBMATCH:
+         {
+           int submatch_id = tre_stack_pop_int(stack);
+
+           ctx->cflags = tre_stack_pop_int(stack); /* restore cflags */
+           if (result->submatch_id >= 0 &&
+               result->submatch_id < SUBMATCH_ID_INVISIBLE_START)
+             {
+               tre_ast_node_t *n, *tmp_node;
+               if (submatch_id >= SUBMATCH_ID_INVISIBLE_START)
+                 break;
+               n = tre_ast_new_literal(ctx->mem, EMPTY, -1, -1);
+               if (n == NULL)
+                 return REG_ESPACE;
+               tmp_node = tre_ast_new_catenation(ctx->mem, n, result);
+               if (tmp_node == NULL)
+                 return REG_ESPACE;
+               tmp_node->num_submatches = result->num_submatches;
+               result = tmp_node;
+             }
+           result->submatch_id = submatch_id;
+           if (submatch_id < SUBMATCH_ID_INVISIBLE_START)
+             result->num_submatches++;
+           break;
+         }
+
+       default:
+         assert(0);
+         break;
+       }
+    }
+
+  /* Check for missing closing parentheses. */
+  if (depth > 0)
+    return REG_EPAREN;
+
+  ctx->result = result;
+
+  return REG_OK;
+}
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-parse.h b/regex/TRE/lib/tre-parse.h
new file mode 100644 (file)
index 0000000..431f407
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+  tre-parse.c - Regexp parser definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifndef TRE_PARSE_H
+#define TRE_PARSE_H 1
+
+#ifdef __LIBC__
+#include <xlocale_private.h>
+#else /* !__LIBC__ */
+#include <xlocale.h>
+#endif /* !__LIBC__ */
+
+/* Parse context. */
+typedef struct {
+  /* Memory allocator. The AST is allocated using this. */
+  tre_mem_t mem;
+  /* Stack used for keeping track of regexp syntax. */
+  tre_stack_t *stack;
+  /* The parse result. */
+  tre_ast_node_t *result;
+  /* The regexp to parse and its length. */
+  const tre_char_t *re;
+  /* The first character of the entire regexp. */
+  const tre_char_t *re_start;
+  /* The first character after the end of the regexp. */
+  const tre_char_t *re_end;
+  /* The current locale */
+  locale_t loc;
+  int len;
+  /* Current submatch ID. */
+  int submatch_id;
+  /* Current invisible submatch ID. */
+  int submatch_id_invisible;
+  /* Current position (number of literal). */
+  int position;
+  /* The highest back reference or -1 if none seen so far. */
+  int max_backref;
+  /* Number of tags that need reordering. */
+  int num_reorder_tags;
+  /* This flag is set if the regexp uses approximate matching. */
+  int have_approx;
+  /* Compilation flags. */
+  int cflags;
+  /* If this flag is set the top-level submatch is not captured. */
+  int nofirstsub;
+  /* The currently set approximate matching parameters. */
+  int params[TRE_PARAM_LAST];
+} tre_parse_ctx_t;
+
+/* Parses a wide character regexp pattern into a syntax tree.  This parser
+   handles both syntaxes (BRE and ERE), including the TRE extensions. */
+__private_extern__ reg_errcode_t
+tre_parse(tre_parse_ctx_t *ctx);
+
+#endif /* TRE_PARSE_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-stack.c b/regex/TRE/lib/tre-stack.c
new file mode 100644 (file)
index 0000000..8ad89c8
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+  tre-stack.c - Simple stack implementation
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
+#include <assert.h>
+
+#include "tre-internal.h"
+#include "tre-stack.h"
+#include "xmalloc.h"
+
+union tre_stack_item {
+  void *voidptr_value;
+  int int_value;
+};
+
+struct tre_stack_rec {
+  int size;
+  int max_size;
+  int increment;
+  int ptr;
+  union tre_stack_item *stack;
+};
+
+
+tre_stack_t *
+tre_stack_new(int size, int max_size, int increment)
+{
+  tre_stack_t *s;
+
+  s = xmalloc(sizeof(*s));
+  if (s != NULL)
+    {
+      s->stack = xmalloc(sizeof(*s->stack) * size);
+      if (s->stack == NULL)
+       {
+         xfree(s);
+         return NULL;
+       }
+      s->size = size;
+      s->max_size = max_size;
+      s->increment = increment;
+      s->ptr = 0;
+    }
+  return s;
+}
+
+void
+tre_stack_destroy(tre_stack_t *s)
+{
+  xfree(s->stack);
+  xfree(s);
+}
+
+int
+tre_stack_num_objects(tre_stack_t *s)
+{
+  return s->ptr;
+}
+
+static reg_errcode_t
+tre_stack_push(tre_stack_t *s, union tre_stack_item value)
+{
+  if (s->ptr < s->size)
+    {
+      s->stack[s->ptr] = value;
+      s->ptr++;
+    }
+  else
+    {
+      if (s->size >= s->max_size)
+       {
+         DPRINT(("tre_stack_push: stack full\n"));
+         return REG_ESPACE;
+       }
+      else
+       {
+         union tre_stack_item *new_buffer;
+         int new_size;
+         DPRINT(("tre_stack_push: trying to realloc more space\n"));
+         new_size = s->size + s->increment;
+         if (new_size > s->max_size)
+           new_size = s->max_size;
+         new_buffer = xrealloc(s->stack, sizeof(*new_buffer) * new_size);
+         if (new_buffer == NULL)
+           {
+             DPRINT(("tre_stack_push: realloc failed.\n"));
+             return REG_ESPACE;
+           }
+         DPRINT(("tre_stack_push: realloc succeeded.\n"));
+         assert(new_size > s->size);
+         s->size = new_size;
+         s->stack = new_buffer;
+         tre_stack_push(s, value);
+       }
+    }
+  return REG_OK;
+}
+
+#define define_pushf(typetag, type)  \
+  declare_pushf(typetag, type) {     \
+    union tre_stack_item item;      \
+    item.typetag ## _value = value;  \
+    return tre_stack_push(s, item);  \
+}
+
+define_pushf(int, int)
+define_pushf(voidptr, void *)
+
+#define define_popf(typetag, type)                 \
+  declare_popf(typetag, type) {                            \
+    return s->stack[--s->ptr].typetag ## _value;    \
+  }
+
+define_popf(int, int)
+define_popf(voidptr, void *)
+
+/* EOF */
diff --git a/regex/TRE/lib/tre-stack.h b/regex/TRE/lib/tre-stack.h
new file mode 100644 (file)
index 0000000..1002a1c
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+  tre-stack.h: Stack definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+
+#ifndef TRE_STACK_H
+#define TRE_STACK_H 1
+
+#include "tre.h"
+
+typedef struct tre_stack_rec tre_stack_t;
+
+/* Creates a new stack object. `size' is initial size in bytes, `max_size'
+   is maximum size, and `increment' specifies how much more space will be
+   allocated with realloc() if all space gets used up. Returns the stack
+   object or NULL if out of memory. */
+__private_extern__ tre_stack_t *
+tre_stack_new(int size, int max_size, int increment);
+
+/* Frees the stack object. */
+__private_extern__ void
+tre_stack_destroy(tre_stack_t *s);
+
+/* Returns the current number of objects in the stack. */
+__private_extern__ int
+tre_stack_num_objects(tre_stack_t *s);
+
+/* Each tre_stack_push_*(tre_stack_t *s, <type> value) function pushes
+   `value' on top of stack `s'.  Returns REG_ESPACE if out of memory.
+   This tries to realloc() more space before failing if maximum size
+   has not yet been reached.  Returns REG_OK if successful. */
+#define declare_pushf(typetag, type)                                         \
+  __private_extern__ reg_errcode_t tre_stack_push_ ## typetag(tre_stack_t *s, \
+                                                             type value)
+
+declare_pushf(voidptr, void *);
+declare_pushf(int, int);
+
+/* Each tre_stack_pop_*(tre_stack_t *s) function pops the topmost
+   element off of stack `s' and returns it.  The stack must not be
+   empty. */
+#define declare_popf(typetag, type)              \
+  __private_extern__ type tre_stack_pop_ ## typetag(tre_stack_t *s)
+
+declare_popf(voidptr, void *);
+declare_popf(int, int);
+
+/* Just to save some typing. */
+#define STACK_PUSH(s, typetag, value)                                        \
+  do                                                                         \
+    {                                                                        \
+      status = tre_stack_push_ ## typetag(s, value);                         \
+    }                                                                        \
+  while (/*CONSTCOND*/0)
+
+#define STACK_PUSHX(s, typetag, value)                                       \
+  {                                                                          \
+    status = tre_stack_push_ ## typetag(s, value);                           \
+    if (status != REG_OK)                                                    \
+      break;                                                                 \
+  }
+
+#define STACK_PUSHR(s, typetag, value)                                       \
+  {                                                                          \
+    reg_errcode_t _status;                                                   \
+    _status = tre_stack_push_ ## typetag(s, value);                          \
+    if (_status != REG_OK)                                                   \
+      return _status;                                                        \
+  }
+
+#endif /* TRE_STACK_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/tre.h b/regex/TRE/lib/tre.h
new file mode 100644 (file)
index 0000000..7827ce4
--- /dev/null
@@ -0,0 +1,328 @@
+/*
+  tre.h - TRE public API definitions
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifndef TRE_H
+#define TRE_H 1
+
+#include "tre-config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif /* HAVE_LIBUTF8_H */
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+/* Include the system regex.h to make TRE ABI compatible with the
+   system regex. */
+#include TRE_SYSTEM_REGEX_H_PATH
+#define tre_regcomp    regcomp
+#define tre_regexec    regexec
+#define tre_regerror   regerror
+#define tre_regfree    regfree
+
+#ifdef TRE_APPROX
+#define tre_regaexec   regaexec
+#define tre_reganexec  reganexec
+#define tre_regawexec  regawexec
+#define tre_regawnexec regawnexec
+#endif /* TRE_APPROX */
+#define tre_regncomp   regncomp
+#define tre_regnexec   regnexec
+#define tre_regwcomp   regwcomp
+#define tre_regwexec   regwexec
+#define tre_regwncomp  regwncomp
+#define tre_regwnexec  regwnexec
+
+#define tre_regcomp_l    regcomp_l
+#define tre_regncomp_l   regncomp_l
+#define tre_regwcomp_l   regwcomp_l
+#define tre_regwncomp_l  regwncomp_l
+#endif /* TRE_USE_SYSTEM_REGEX_H */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef TRE_USE_SYSTEM_REGEX_H
+
+#ifndef REG_OK
+#define REG_OK 0
+#endif /* !REG_OK */
+
+#ifndef HAVE_REG_ERRCODE_T
+typedef int reg_errcode_t;
+#endif /* !HAVE_REG_ERRCODE_T */
+
+#if !defined(REG_NOSPEC) && !defined(REG_LITERAL)
+#define REG_LITERAL 0x1000
+#endif
+
+/* Extra tre_regcomp() flags. */
+#ifndef REG_BASIC
+#define REG_BASIC      0
+#endif /* !REG_BASIC */
+#if 0
+#define REG_LEFT_ASSOC  (REG_LITERAL << 1)
+#define REG_UNGREEDY    (REG_LEFT_ASSOC << 1)
+
+/* Extra tre_regexec() flags. */
+#define REG_APPROX_MATCHER      0x1000
+#define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1)
+#endif
+
+#define RE_MAGIC  ((('r'^0200)<<8) | 'e')
+
+#else /* !TRE_USE_SYSTEM_REGEX_H */
+
+/* If the we're not using system regex.h, we need to define the
+   structs and enums ourselves. */
+
+typedef int regoff_t;
+typedef struct {
+  size_t re_nsub;      /* Number of parenthesized subexpressions. */
+  const void *re_endp; /* regex string end pointer (REG_PEND) */
+  void *value;        /* For internal use only. */
+} regex_t;
+
+typedef struct {
+  regoff_t rm_so;
+  regoff_t rm_eo;
+} regmatch_t;
+
+
+typedef enum {
+  REG_OK = 0,          /* No error. */
+  /* POSIX tre_regcomp() return error codes.  (In the order listed in the
+     standard.)         */
+  REG_NOMATCH,         /* No match. */
+  REG_BADPAT,          /* Invalid regexp. */
+  REG_ECOLLATE,                /* Unknown collating element. */
+  REG_ECTYPE,          /* Unknown character class name. */
+  REG_EESCAPE,         /* Trailing backslash. */
+  REG_ESUBREG,         /* Invalid back reference. */
+  REG_EBRACK,          /* "[]" imbalance */
+  REG_EPAREN,          /* "\(\)" or "()" imbalance */
+  REG_EBRACE,          /* "\{\}" or "{}" imbalance */
+  REG_BADBR,           /* Invalid content of {} */
+  REG_ERANGE,          /* Invalid use of range operator */
+  REG_ESPACE,          /* Out of memory.  */
+  REG_BADRPT,           /* Invalid use of repetition operators. */
+  REG_INVARG,           /* Invalid argument, e.g. negative-length string */
+  REG_ILLSEQ,           /* illegal byte sequence (bad multibyte character) */
+} reg_errcode_t;
+
+/* POSIX tre_regcomp() flags. */
+#define REG_EXTENDED   1
+#define REG_ICASE      (REG_EXTENDED << 1)
+#define REG_NEWLINE    (REG_ICASE << 1)
+#define REG_NOSUB      (REG_NEWLINE << 1)
+
+/* Extra tre_regcomp() flags. */
+#define REG_BASIC      0
+#define REG_LITERAL    (REG_NOSUB << 1)
+#define REG_LEFT_ASSOC  (REG_LITERAL << 1)
+#define REG_UNGREEDY    (REG_LEFT_ASSOC << 1)
+#define REG_PEND        (REG_UNGREEDY << 1)
+
+/* POSIX tre_regexec() flags. */
+#define REG_NOTBOL 1
+#define REG_NOTEOL (REG_NOTBOL << 1)
+
+/* Extra tre_regexec() flags. */
+#define REG_APPROX_MATCHER      (REG_NOTEOL << 1)
+#define REG_BACKTRACKING_MATCHER (REG_APPROX_MATCHER << 1)
+#define REG_STARTEND             (REG_BACKTRACKING_MATCHER << 1)
+
+#endif /* !TRE_USE_SYSTEM_REGEX_H */
+
+/* REG_NOSPEC and REG_LITERAL mean the same thing. */
+#if defined(REG_LITERAL) && !defined(REG_NOSPEC)
+#define REG_NOSPEC     REG_LITERAL
+#elif defined(REG_NOSPEC) && !defined(REG_LITERAL)
+#define REG_LITERAL    REG_NOSPEC
+#endif /* defined(REG_NOSPEC) */
+
+/* The maximum number of iterations in a bound expression. */
+#undef RE_DUP_MAX
+#define RE_DUP_MAX 255
+
+/* The POSIX.2 regexp functions */
+extern int
+tre_regcomp(regex_t * __restrict preg, const char * __restrict regex, int cflags);
+
+extern int
+tre_regexec(const regex_t * __restrict preg, const char * __restrict string, size_t nmatch,
+       regmatch_t pmatch[ __restrict ], int eflags);
+
+extern size_t
+tre_regerror(int errcode, const regex_t * __restrict preg, char * __restrict errbuf,
+        size_t errbuf_size);
+
+extern void
+tre_regfree(regex_t *preg);
+
+#ifdef TRE_WCHAR
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif /* HAVE_WCHAR_H */
+
+/* Wide character versions (not in POSIX.2). */
+extern int
+tre_regwcomp(regex_t * __restrict preg, const wchar_t * __restrict regex, int cflags);
+
+extern int
+tre_regwexec(const regex_t * __restrict preg, const wchar_t * __restrict string,
+        size_t nmatch, regmatch_t pmatch[ __restrict ], int eflags);
+#endif /* TRE_WCHAR */
+
+/* Versions with a maximum length argument and therefore the capability to
+   handle null characters in the middle of the strings (not in POSIX.2). */
+extern int
+tre_regncomp(regex_t * __restrict preg, const char * __restrict regex, size_t len, int cflags);
+
+extern int
+tre_regnexec(const regex_t * __restrict preg, const char * __restrict string, size_t len,
+        size_t nmatch, regmatch_t pmatch[ __restrict ], int eflags);
+
+#ifdef TRE_WCHAR
+extern int
+tre_regwncomp(regex_t * __restrict preg, const wchar_t * __restrict regex, size_t len, int cflags);
+
+extern int
+tre_regwnexec(const regex_t * __restrict preg, const wchar_t * __restrict string, size_t len,
+         size_t nmatch, regmatch_t pmatch[ __restrict ], int eflags);
+#endif /* TRE_WCHAR */
+
+/* Extended locale versions */
+#include <xlocale.h>
+
+extern int
+tre_regcomp_l(regex_t * __restrict preg, const char * __restrict regex, int cflags, locale_t __restrict loc);
+
+#ifdef TRE_WCHAR
+extern int
+tre_regwcomp_l(regex_t * __restrict preg, const wchar_t * __restrict regex, int cflags, locale_t __restrict loc);
+#endif /* TRE_WCHAR */
+
+extern int
+tre_regncomp_l(regex_t * __restrict preg, const char * __restrict regex, size_t len, int cflags, locale_t __restrict loc);
+
+#ifdef TRE_WCHAR
+extern int
+tre_regwncomp_l(regex_t * __restrict preg, const wchar_t * __restrict regex, size_t len, int cflags, locale_t __restrict loc);
+#endif /* TRE_WCHAR */
+
+#ifdef TRE_APPROX
+
+/* Approximate matching parameter struct. */
+typedef struct {
+  int cost_ins;               /* Default cost of an inserted character. */
+  int cost_del;               /* Default cost of a deleted character. */
+  int cost_subst;      /* Default cost of a substituted character. */
+  int max_cost;               /* Maximum allowed cost of a match. */
+
+  int max_ins;        /* Maximum allowed number of inserts. */
+  int max_del;        /* Maximum allowed number of deletes. */
+  int max_subst;       /* Maximum allowed number of substitutes. */
+  int max_err;        /* Maximum allowed number of errors total. */
+} regaparams_t;
+
+/* Approximate matching result struct. */
+typedef struct {
+  size_t nmatch;       /* Length of pmatch[] array. */
+  regmatch_t *pmatch;  /* Submatch data. */
+  int cost;           /* Cost of the match. */
+  int num_ins;        /* Number of inserts in the match. */
+  int num_del;        /* Number of deletes in the match. */
+  int num_subst;       /* Number of substitutes in the match. */
+} regamatch_t;
+
+
+/* Approximate matching functions. */
+extern int
+tre_regaexec(const regex_t * __restrict preg, const char * __restrict string,
+        regamatch_t * __restrict match, regaparams_t params, int eflags);
+
+extern int
+tre_reganexec(const regex_t * __restrict preg, const char * __restrict string, size_t len,
+         regamatch_t * __restrict match, regaparams_t params, int eflags);
+#ifdef TRE_WCHAR
+/* Wide character approximate matching. */
+extern int
+tre_regawexec(const regex_t * __restrict preg, const wchar_t * __restrict string,
+         regamatch_t * __restrict match, regaparams_t params, int eflags);
+
+extern int
+tre_regawnexec(const regex_t * __restrict preg, const wchar_t * __restrict string, size_t len,
+          regamatch_t * __restrict match, regaparams_t params, int eflags);
+#endif /* TRE_WCHAR */
+
+/* Sets the parameters to default values. */
+extern void
+tre_regaparams_default(regaparams_t *params);
+#endif /* TRE_APPROX */
+
+#ifdef TRE_WCHAR
+typedef wchar_t tre_char_t;
+#else /* !TRE_WCHAR */
+typedef unsigned char tre_char_t;
+#endif /* !TRE_WCHAR */
+
+#ifdef TRE_STR_USER
+typedef struct {
+  int (*get_next_char)(tre_char_t *c, unsigned int *pos_add, void *context);
+  void (*rewind)(size_t pos, void *context);
+  int (*compare)(size_t pos1, size_t pos2, size_t len, void *context);
+  void *context;
+} tre_str_source;
+
+extern int
+tre_reguexec(const regex_t * __restrict preg, const tre_str_source * __restrict string,
+        size_t nmatch, regmatch_t pmatch[ __restrict ], int eflags);
+#endif /* TRE_STR_USER */
+
+#ifndef __LIBC__
+/* Returns the version string. The returned string is static. */
+extern char *
+tre_version(void);
+
+/* Returns the value for a config parameter.  The type to which `result'
+   must point to depends of the value of `query', see documentation for
+   more details. */
+extern int
+tre_config(int query, void *result);
+
+enum {
+  TRE_CONFIG_APPROX,
+  TRE_CONFIG_WCHAR,
+  TRE_CONFIG_MULTIBYTE,
+  TRE_CONFIG_SYSTEM_ABI,
+  TRE_CONFIG_VERSION
+};
+
+/* Returns 1 if the compiled pattern has back references, 0 if not. */
+extern int
+tre_have_backrefs(const regex_t *preg);
+
+#ifdef TRE_APPROX
+/* Returns 1 if the compiled pattern uses approximate matching features,
+   0 if not. */
+extern int
+tre_have_approx(const regex_t *preg);
+#endif /* TRE_APPROX */
+#endif /* !__LIBC__ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif                         /* TRE_H */
+
+/* EOF */
diff --git a/regex/TRE/lib/xmalloc.h b/regex/TRE/lib/xmalloc.h
new file mode 100644 (file)
index 0000000..ce310af
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+  xmalloc.h - Simple malloc debugging library API
+
+  This software is released under a BSD-style license.
+  See the file LICENSE for details and copyright.
+
+*/
+
+#ifndef _XMALLOC_H
+#define _XMALLOC_H 1
+
+void *xmalloc_impl(size_t size, const char *file, int line, const char *func);
+void *xcalloc_impl(size_t nmemb, size_t size, const char *file, int line,
+                  const char *func);
+void xfree_impl(void *ptr, const char *file, int line, const char *func);
+void *xrealloc_impl(void *ptr, size_t new_size, const char *file, int line,
+                   const char *func);
+int xmalloc_dump_leaks(void);
+void xmalloc_configure(int fail_after);
+
+
+#ifndef XMALLOC_INTERNAL
+#ifdef MALLOC_DEBUGGING
+
+/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
+   which contains the name of the function currently being defined.
+#  define __XMALLOC_FUNCTION    __PRETTY_FUNCTION__
+   This is broken in G++ before version 2.6.
+   C9x has a similar variable called __func__, but prefer the GCC one since
+   it demangles C++ function names.  */
+# ifdef __GNUC__
+#  if __GNUC__ > 2 || (__GNUC__ == 2 \
+                      && __GNUC_MINOR__ >= (defined __cplusplus ? 6 : 4))
+#   define __XMALLOC_FUNCTION   __PRETTY_FUNCTION__
+#  else
+#   define __XMALLOC_FUNCTION   ((const char *) 0)
+#  endif
+# else
+#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#   define __XMALLOC_FUNCTION   __func__
+#  else
+#   define __XMALLOC_FUNCTION   ((const char *) 0)
+#  endif
+# endif
+
+#define xmalloc(size) xmalloc_impl(size, __FILE__, __LINE__, \
+                                  __XMALLOC_FUNCTION)
+#define xcalloc(nmemb, size) xcalloc_impl(nmemb, size, __FILE__, __LINE__, \
+                                         __XMALLOC_FUNCTION)
+#define xfree(ptr) xfree_impl(ptr, __FILE__, __LINE__, __XMALLOC_FUNCTION)
+#define xrealloc(ptr, new_size) xrealloc_impl(ptr, new_size, __FILE__, \
+                                             __LINE__, __XMALLOC_FUNCTION)
+#undef malloc
+#undef calloc
+#undef free
+#undef realloc
+
+#define malloc USE_XMALLOC_INSTEAD_OF_MALLOC
+#define calloc USE_XCALLOC_INSTEAD_OF_CALLOC
+#define free   USE_XFREE_INSTEAD_OF_FREE
+#define realloc USE_XREALLOC_INSTEAD_OF_REALLOC
+
+#else /* !MALLOC_DEBUGGING */
+
+#include <stdlib.h>
+
+#define xmalloc(size) malloc(size)
+#define xcalloc(nmemb, size) calloc(nmemb, size)
+#define xfree(ptr) free(ptr)
+#define xrealloc(ptr, new_size) realloc(ptr, new_size)
+
+#endif /* !MALLOC_DEBUGGING */
+#endif /* !XMALLOC_INTERNAL */
+
+#endif /* _XMALLOC_H */
+
+/* EOF */
diff --git a/regex/TRE/tre-0.8.0.tar.bz2 b/regex/TRE/tre-0.8.0.tar.bz2
new file mode 100644 (file)
index 0000000..cfcde9e
Binary files /dev/null and b/regex/TRE/tre-0.8.0.tar.bz2 differ
diff --git a/regex/TRE/tre-config.h b/regex/TRE/tre-config.h
new file mode 100644 (file)
index 0000000..2cbde5c
--- /dev/null
@@ -0,0 +1,44 @@
+/* lib/tre-config.h.  Generated from tre-config.h.in by configure.  */
+/* tre-config.h.in.  This file has all definitions that are needed in
+   `tre.h'.  Note that this file must contain only the bare minimum
+   of definitions without the TRE_ prefix to avoid conflicts between
+   definitions here and definitions included from somewhere else. */
+
+/* Define to 1 if you have the <libutf8.h> header file. */
+/* #undef HAVE_LIBUTF8_H */
+
+/* Define to 1 if the system has the type `reg_errcode_t'. */
+/* #undef HAVE_REG_ERRCODE_T */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define if you want to enable approximate matching functionality. */
+/* #undef TRE_APPROX */
+
+/* Define to enable multibyte character set support. */
+#define TRE_MULTIBYTE 1
+
+/* Define to the absolute path to the system tre.h */
+#define TRE_SYSTEM_REGEX_H_PATH <regex.h>
+
+/* Define to include the system regex.h from tre.h */
+#define TRE_USE_SYSTEM_REGEX_H 1
+
+/* Define to enable wide character (wchar_t) support. */
+#define TRE_WCHAR 1
+
+/* TRE version string. */
+#define TRE_VERSION "0.8.0"
+
+/* TRE version level 1. */
+#define TRE_VERSION_1 0
+
+/* TRE version level 2. */
+#define TRE_VERSION_2 8
+
+/* TRE version level 3. */
+#define TRE_VERSION_3 0
diff --git a/regex/TRE/tre-last-matched.h b/regex/TRE/tre-last-matched.h
new file mode 100644 (file)
index 0000000..3801e2c
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#include <bitstring.h>
+
+#ifndef __TRE_LAST_MATCHED_H__
+#define __TRE_LAST_MATCHED_H__
+
+#define __TRE_LAST_MATCHED_BRANCH_SHARED(_i)   \
+  struct _tre_ ## _i *last_matched;            \
+  int n_last_matched;                          \
+  int cmp_tag;                                 \
+  int n_tags;
+#define __TRE_LAST_MATCHED_SHARED(_i)          \
+  tre_ ## _i ## _t *branches;                  \
+  int n_branches;                              \
+  int start_tag;
+
+/* These structures record the relationship between each union branch and
+ * its tags.  The end_tag is a special tag, created at the end of each branch
+ * that can be used to detect which branch was last matched.  Then the tags
+ * of the other branches can be set to unmatched.  For example:
+ *
+ *     ((a)|(b))*
+ * 
+ * when matched against "ab", the tags associated with the first branch, need
+ * to be unset, because the last match was in the second branch.
+ *
+ * There are two sets of two structures.  The first structure records the
+ * branch info, while the second records union info; what branches form that
+ * union.  Because a branch may have nested unions, we need to record that
+ * as well.  The "n" field of the branch info structure records the number
+ * of unions at the top level of the branch (a union may itself have branches
+ * with nested unions, but those union are only counted with the immediate
+ * branch that contains them).  The "n" field of the union info structure is
+ * the count of branches in that union.
+ *
+ * The "end_tag" field of a branch info structure is the number of the special
+ * tag that is created at the end of each branch.  It can be used to determine
+ * which branch was last matched.
+ *
+ * The first set (the info_pre structures) are used during tre_add_tags() to
+ * record the tag info while tags are being added to the AST.  They use link
+ * lists, and the total number of branch and union structures used are
+ * recorded in n_branches and n_unions.  The second set (the info structures)
+ * are created from the first, leaving out the link pointers (these structures
+ * use arrays of structures, rather than link lists), and the n_branches and
+ * n_unions fields are no longer needed.  The info_pre structures are allocated
+ * using the tre_mem mechanism, while the info structure are allocated in
+ * one chuck with xmalloc (so it can be easily deallocated).
+ *
+ * The above macro are used for the shared fields of the structures. */
+
+struct _tre_last_matched_pre; /* forward reference */
+
+typedef struct _tre_last_matched_branch_pre {
+  struct _tre_last_matched_branch_pre *next;
+  __TRE_LAST_MATCHED_BRANCH_SHARED(last_matched_pre)
+  int tot_branches;
+  int tot_last_matched;
+  int tot_tags;
+  bitstr_t tags[0];
+} tre_last_matched_branch_pre_t;
+
+typedef struct _tre_last_matched_pre {
+  struct _tre_last_matched_pre *next;
+  __TRE_LAST_MATCHED_SHARED(last_matched_branch_pre)
+  int tot_branches;
+  int tot_last_matched;
+  int tot_tags;
+} tre_last_matched_pre_t;
+
+struct _tre_last_matched; /* forward reference */
+
+typedef struct _tre_last_matched_branch {
+  int *tags;
+  __TRE_LAST_MATCHED_BRANCH_SHARED(last_matched)
+} tre_last_matched_branch_t;
+
+typedef struct _tre_last_matched {
+  __TRE_LAST_MATCHED_SHARED(last_matched_branch)
+} tre_last_matched_t;
+
+#endif /* __TRE_LAST_MATCHED_H__ */
diff --git a/regex/cclass.h b/regex/cclass.h
deleted file mode 120000 (symlink)
index b39907d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./cclass.h
\ No newline at end of file
diff --git a/regex/cname.h b/regex/cname.h
deleted file mode 100644 (file)
index d3504a5..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)cname.h     8.3 (Berkeley) 3/20/94
- * $FreeBSD: src/lib/libc/regex/cname.h,v 1.4 2007/01/09 00:28:04 imp Exp $
- */
-
-/* character-name table */
-static const struct cname {
-       const char *name;
-       char code;
-} cnames[] = {
-       {"NUL",                 '\0'},
-       {"SOH",                 '\001'},
-       {"STX",                 '\002'},
-       {"ETX",                 '\003'},
-       {"EOT",                 '\004'},
-       {"ENQ",                 '\005'},
-       {"ACK",                 '\006'},
-       {"BEL",                 '\007'},
-       {"alert",               '\007'},
-       {"BS",                  '\010'},
-       {"backspace",           '\b'},
-       {"HT",                  '\011'},
-       {"tab",                 '\t'},
-       {"LF",                  '\012'},
-       {"newline",             '\n'},
-       {"VT",                  '\013'},
-       {"vertical-tab",        '\v'},
-       {"FF",                  '\014'},
-       {"form-feed",           '\f'},
-       {"CR",                  '\015'},
-       {"carriage-return",     '\r'},
-       {"SO",                  '\016'},
-       {"SI",                  '\017'},
-       {"DLE",                 '\020'},
-       {"DC1",                 '\021'},
-       {"DC2",                 '\022'},
-       {"DC3",                 '\023'},
-       {"DC4",                 '\024'},
-       {"NAK",                 '\025'},
-       {"SYN",                 '\026'},
-       {"ETB",                 '\027'},
-       {"CAN",                 '\030'},
-       {"EM",                  '\031'},
-       {"SUB",                 '\032'},
-       {"ESC",                 '\033'},
-       {"IS4",                 '\034'},
-       {"FS",                  '\034'},
-       {"IS3",                 '\035'},
-       {"GS",                  '\035'},
-       {"IS2",                 '\036'},
-       {"RS",                  '\036'},
-       {"IS1",                 '\037'},
-       {"US",                  '\037'},
-       {"space",               ' '},
-       {"exclamation-mark",    '!'},
-       {"quotation-mark",      '"'},
-       {"number-sign",         '#'},
-       {"dollar-sign",         '$'},
-       {"percent-sign",        '%'},
-       {"ampersand",           '&'},
-       {"apostrophe",          '\''},
-       {"left-parenthesis",    '('},
-       {"right-parenthesis",   ')'},
-       {"asterisk",            '*'},
-       {"plus-sign",           '+'},
-       {"comma",               ','},
-       {"hyphen",              '-'},
-       {"hyphen-minus",        '-'},
-       {"period",              '.'},
-       {"full-stop",           '.'},
-       {"slash",               '/'},
-       {"solidus",             '/'},
-       {"zero",                '0'},
-       {"one",                 '1'},
-       {"two",                 '2'},
-       {"three",               '3'},
-       {"four",                '4'},
-       {"five",                '5'},
-       {"six",                 '6'},
-       {"seven",               '7'},
-       {"eight",               '8'},
-       {"nine",                '9'},
-       {"colon",               ':'},
-       {"semicolon",           ';'},
-       {"less-than-sign",      '<'},
-       {"equals-sign",         '='},
-       {"greater-than-sign",   '>'},
-       {"question-mark",       '?'},
-       {"commercial-at",       '@'},
-       {"left-square-bracket", '['},
-       {"backslash",           '\\'},
-       {"reverse-solidus",     '\\'},
-       {"right-square-bracket",']'},
-       {"circumflex",          '^'},
-       {"circumflex-accent",   '^'},
-       {"underscore",          '_'},
-       {"low-line",            '_'},
-       {"grave-accent",        '`'},
-       {"left-brace",          '{'},
-       {"left-curly-bracket",  '{'},
-       {"vertical-line",       '|'},
-       {"right-brace",         '}'},
-       {"right-curly-bracket", '}'},
-       {"tilde",               '~'},
-       {"DEL", '\177'},
-       {NULL,  0}
-};
diff --git a/regex/cname.h.orig b/regex/cname.h.orig
deleted file mode 100644 (file)
index 19b4ddb..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)cname.h     8.3 (Berkeley) 3/20/94
- * $FreeBSD: src/lib/libc/regex/cname.h,v 1.4 2007/01/09 00:28:04 imp Exp $
- */
-
-/* character-name table */
-static struct cname {
-       char *name;
-       char code;
-} cnames[] = {
-       {"NUL",                 '\0'},
-       {"SOH",                 '\001'},
-       {"STX",                 '\002'},
-       {"ETX",                 '\003'},
-       {"EOT",                 '\004'},
-       {"ENQ",                 '\005'},
-       {"ACK",                 '\006'},
-       {"BEL",                 '\007'},
-       {"alert",               '\007'},
-       {"BS",                  '\010'},
-       {"backspace",           '\b'},
-       {"HT",                  '\011'},
-       {"tab",                 '\t'},
-       {"LF",                  '\012'},
-       {"newline",             '\n'},
-       {"VT",                  '\013'},
-       {"vertical-tab",        '\v'},
-       {"FF",                  '\014'},
-       {"form-feed",           '\f'},
-       {"CR",                  '\015'},
-       {"carriage-return",     '\r'},
-       {"SO",                  '\016'},
-       {"SI",                  '\017'},
-       {"DLE",                 '\020'},
-       {"DC1",                 '\021'},
-       {"DC2",                 '\022'},
-       {"DC3",                 '\023'},
-       {"DC4",                 '\024'},
-       {"NAK",                 '\025'},
-       {"SYN",                 '\026'},
-       {"ETB",                 '\027'},
-       {"CAN",                 '\030'},
-       {"EM",                  '\031'},
-       {"SUB",                 '\032'},
-       {"ESC",                 '\033'},
-       {"IS4",                 '\034'},
-       {"FS",                  '\034'},
-       {"IS3",                 '\035'},
-       {"GS",                  '\035'},
-       {"IS2",                 '\036'},
-       {"RS",                  '\036'},
-       {"IS1",                 '\037'},
-       {"US",                  '\037'},
-       {"space",               ' '},
-       {"exclamation-mark",    '!'},
-       {"quotation-mark",      '"'},
-       {"number-sign",         '#'},
-       {"dollar-sign",         '$'},
-       {"percent-sign",        '%'},
-       {"ampersand",           '&'},
-       {"apostrophe",          '\''},
-       {"left-parenthesis",    '('},
-       {"right-parenthesis",   ')'},
-       {"asterisk",            '*'},
-       {"plus-sign",           '+'},
-       {"comma",               ','},
-       {"hyphen",              '-'},
-       {"hyphen-minus",        '-'},
-       {"period",              '.'},
-       {"full-stop",           '.'},
-       {"slash",               '/'},
-       {"solidus",             '/'},
-       {"zero",                '0'},
-       {"one",                 '1'},
-       {"two",                 '2'},
-       {"three",               '3'},
-       {"four",                '4'},
-       {"five",                '5'},
-       {"six",                 '6'},
-       {"seven",               '7'},
-       {"eight",               '8'},
-       {"nine",                '9'},
-       {"colon",               ':'},
-       {"semicolon",           ';'},
-       {"less-than-sign",      '<'},
-       {"equals-sign",         '='},
-       {"greater-than-sign",   '>'},
-       {"question-mark",       '?'},
-       {"commercial-at",       '@'},
-       {"left-square-bracket", '['},
-       {"backslash",           '\\'},
-       {"reverse-solidus",     '\\'},
-       {"right-square-bracket",']'},
-       {"circumflex",          '^'},
-       {"circumflex-accent",   '^'},
-       {"underscore",          '_'},
-       {"low-line",            '_'},
-       {"grave-accent",        '`'},
-       {"left-brace",          '{'},
-       {"left-curly-bracket",  '{'},
-       {"vertical-line",       '|'},
-       {"right-brace",         '}'},
-       {"right-curly-bracket", '}'},
-       {"tilde",               '~'},
-       {"DEL", '\177'},
-       {NULL,  0}
-};
diff --git a/regex/engine.c b/regex/engine.c
deleted file mode 100644 (file)
index 75590e6..0000000
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)engine.c    8.5 (Berkeley) 3/20/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/engine.c,v 1.23 2009/09/16 06:32:23 dds Exp $");
-
-/*
- * The matching engine and friends.  This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define        matcher smatcher
-#define        fast    sfast
-#define        slow    sslow
-#define        dissect sdissect
-#define        backref sbackref
-#define        step    sstep
-#define        print   sprint
-#define        at      sat
-#define        match   smat
-#endif
-#ifdef LNAMES
-#define        matcher lmatcher
-#define        fast    lfast
-#define        slow    lslow
-#define        dissect ldissect
-#define        backref lbackref
-#define        step    lstep
-#define        print   lprint
-#define        at      lat
-#define        match   lmat
-#endif
-#ifdef MNAMES
-#define        matcher mmatcher
-#define        fast    mfast
-#define        slow    mslow
-#define        dissect mdissect
-#define        backref mbackref
-#define        step    mstep
-#define        print   mprint
-#define        at      mat
-#define        match   mmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
-       struct re_guts *g;
-       int eflags;
-       regmatch_t *pmatch;     /* [nsub+1] (0 element unused) */
-       const char *offp;       /* offsets work from here */
-       const char *beginp;     /* start of string -- virtual NUL precedes */
-       const char *endp;       /* end of string -- virtual NUL here */
-       const char *coldp;      /* can be no match starting before here */
-       const char **lastpos;   /* [nplus+1] */
-       STATEVARS;
-       states st;              /* current states */
-       states fresh;           /* states for a fresh start */
-       states tmp;             /* temporary */
-       states empty;           /* empty set of states */
-       mbstate_t mbs;          /* multibyte conversion state */
-};
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int);
-static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft);
-#define MAX_RECURSION  100
-#define        BOL     (OUT-1)
-#define        EOL     (BOL-1)
-#define        BOLEOL  (BOL-2)
-#define        NOTHING (BOL-3)
-#define        BOW     (BOL-4)
-#define        EOW     (BOL-5)
-#define        BADCHAR (BOL-6)
-#define        NONCHAR(c)      ((c) <= OUT)
-#ifdef REDEBUG
-static void print(struct match *m, const char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, const char *title, const char *start, const char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static const char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-
-#ifdef REDEBUG
-#define        SP(t, s, c)     print(m, t, s, c, stdout)
-#define        AT(t, p1, p2, s1, s2)   at(m, t, p1, p2, s1, s2)
-#define        NOTE(str)       { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define        SP(t, s, c)     /* nothing */
-#define        AT(t, p1, p2, s1, s2)   /* nothing */
-#define        NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(struct re_guts *g, const char *string, \
- ==    size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int                     /* 0 success, REG_NOMATCH failure */
-matcher(struct re_guts *g,
-       const char *string,
-       size_t nmatch,
-       regmatch_t pmatch[],
-       int eflags)
-{
-       const char *endp;
-       int i;
-       struct match mv;
-       struct match *m = &mv;
-       const char *dp;
-       const sopno gf = g->firststate+1;       /* +1 for OEND */
-       const sopno gl = g->laststate;
-       const char *start;
-       const char *stop;
-       /* Boyer-Moore algorithms variables */
-       const char *pp;
-       int cj, mj;
-       const char *mustfirst;
-       const char *mustlast;
-       int *matchjump;
-       int *charjump;
-
-       /* simplify the situation where possible */
-       if (g->cflags&REG_NOSUB)
-               nmatch = 0;
-       if (eflags&REG_STARTEND) {
-               start = string + pmatch[0].rm_so;
-               stop = string + pmatch[0].rm_eo;
-       } else {
-               start = string;
-               stop = start + strlen(start);
-       }
-       if (stop < start)
-               return(REG_INVARG);
-
-       /* prescreening; this does wonders for this rather slow code */
-       if (g->must != NULL) {
-               if (g->charjump != NULL && g->matchjump != NULL) {
-                       mustfirst = g->must;
-                       mustlast = g->must + g->mlen - 1;
-                       charjump = g->charjump;
-                       matchjump = g->matchjump;
-                       pp = mustlast;
-                       for (dp = start+g->mlen-1; dp < stop;) {
-                               /* Fast skip non-matches */
-                               while (dp < stop && charjump[(int)*dp])
-                                       dp += charjump[(int)*dp];
-
-                               if (dp >= stop)
-                                       break;
-
-                               /* Greedy matcher */
-                               /* We depend on not being used for
-                                * for strings of length 1
-                                */
-                               while (*--dp == *--pp && pp != mustfirst);
-
-                               if (*dp == *pp)
-                                       break;
-
-                               /* Jump to next possible match */
-                               mj = matchjump[pp - mustfirst];
-                               cj = charjump[(int)*dp];
-                               dp += (cj < mj ? mj : cj);
-                               pp = mustlast;
-                       }
-                       if (pp != mustfirst)
-                               return(REG_NOMATCH);
-               } else {
-                       for (dp = start; dp < stop; dp++)
-                               if (*dp == g->must[0] &&
-                                   stop - dp >= g->mlen &&
-                                   memcmp(dp, g->must, (size_t)g->mlen) == 0)
-                                       break;
-                       if (dp == stop)         /* we didn't find g->must */
-                               return(REG_NOMATCH);
-               }
-       }
-
-       /* match struct setup */
-       m->g = g;
-       m->eflags = eflags;
-       m->pmatch = NULL;
-       m->lastpos = NULL;
-       m->offp = string;
-       m->beginp = start;
-       m->endp = stop;
-       STATESETUP(m, 4);
-       SETUP(m->st);
-       SETUP(m->fresh);
-       SETUP(m->tmp);
-       SETUP(m->empty);
-       CLEAR(m->empty);
-       ZAPSTATE(&m->mbs);
-
-       /* Adjust start according to moffset, to speed things up */
-       if (g->moffset > -1)
-               start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
-
-       SP("mloop", m->st, *start);
-
-       /* this loop does only one repetition except for backrefs */
-       for (;;) {
-               endp = fast(m, start, stop, gf, gl);
-               if (endp == NULL) {             /* a miss */
-                       if (m->pmatch != NULL)
-                               free((char *)m->pmatch);
-                       if (m->lastpos != NULL)
-                               free((char *)m->lastpos);
-                       STATETEARDOWN(m);
-                       return(REG_NOMATCH);
-               }
-               if (nmatch == 0 && !g->backrefs)
-                       break;          /* no further info needed */
-
-               /* where? */
-               assert(m->coldp != NULL);
-               for (;;) {
-                       NOTE("finding start");
-                       endp = slow(m, m->coldp, stop, gf, gl);
-                       if (endp != NULL)
-                               break;
-                       assert(m->coldp < m->endp);
-                       m->coldp += XMBRTOWC(NULL, m->coldp,
-                           m->endp - m->coldp, &m->mbs, 0, g->loc);
-               }
-               if (nmatch == 1 && !g->backrefs)
-                       break;          /* no further info needed */
-
-               /* oh my, he wants the subexpressions... */
-               if (m->pmatch == NULL)
-                       m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
-                                                       sizeof(regmatch_t));
-               if (m->pmatch == NULL) {
-                       STATETEARDOWN(m);
-                       return(REG_ESPACE);
-               }
-               for (i = 1; i <= m->g->nsub; i++)
-                       m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
-               if (!g->backrefs && !(m->eflags&REG_BACKR)) {
-                       NOTE("dissecting");
-                       dp = dissect(m, m->coldp, endp, gf, gl);
-               } else {
-                       if (g->nplus > 0 && m->lastpos == NULL)
-                               m->lastpos = malloc((g->nplus+1) *
-                                               sizeof(const char *));
-                       if (g->nplus > 0 && m->lastpos == NULL) {
-                               free(m->pmatch);
-                               STATETEARDOWN(m);
-                               return(REG_ESPACE);
-                       }
-                       NOTE("backref dissect");
-                       dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0);
-               }
-               if (dp != NULL)
-                       break;
-
-               /* uh-oh... we couldn't find a subexpression-level match */
-               assert(g->backrefs);    /* must be back references doing it */
-               assert(g->nplus == 0 || m->lastpos != NULL);
-               for (;;) {
-                       if (dp != NULL || endp <= m->coldp)
-                               break;          /* defeat */
-                       NOTE("backoff");
-                       endp = slow(m, m->coldp, endp-1, gf, gl);
-                       if (endp == NULL)
-                               break;          /* defeat */
-                       /* try it on a shorter possibility */
-#ifndef NDEBUG
-                       for (i = 1; i <= m->g->nsub; i++) {
-                               assert(m->pmatch[i].rm_so == -1);
-                               assert(m->pmatch[i].rm_eo == -1);
-                       }
-#endif
-                       NOTE("backoff dissect");
-                       dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0);
-               }
-               assert(dp == NULL || dp == endp);
-               if (dp != NULL)         /* found a shorter one */
-                       break;
-
-               /* despite initial appearances, there is no match here */
-               NOTE("false alarm");
-               /* recycle starting later */
-               start = m->coldp + XMBRTOWC(NULL, m->coldp,
-                   stop - m->coldp, &m->mbs, 0, g->loc);
-               assert(start <= stop);
-       }
-
-       /* fill in the details if requested */
-       if (nmatch > 0) {
-               pmatch[0].rm_so = m->coldp - m->offp;
-               pmatch[0].rm_eo = endp - m->offp;
-       }
-       if (nmatch > 1) {
-               assert(m->pmatch != NULL);
-               for (i = 1; i < nmatch; i++)
-                       if (i <= m->g->nsub)
-                               pmatch[i] = m->pmatch[i];
-                       else {
-                               pmatch[i].rm_so = -1;
-                               pmatch[i].rm_eo = -1;
-                       }
-       }
-
-       if (m->pmatch != NULL)
-               free((char *)m->pmatch);
-       if (m->lastpos != NULL)
-               free((char *)m->lastpos);
-       STATETEARDOWN(m);
-       return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static const char *dissect(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* == stop (success) always */
-dissect(struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       int i;
-       sopno ss;               /* start sop of current subRE */
-       sopno es;               /* end sop of current subRE */
-       const char *sp;         /* start of string matched by it */
-       const char *stp;        /* string matched by it cannot pass here */
-       const char *rest;       /* start of rest of string */
-       const char *tail;       /* string unmatched by rest of RE */
-       sopno ssub;             /* start sop of subsubRE */
-       sopno esub;             /* end sop of subsubRE */
-       const char *ssp;        /* start of string matched by subsubRE */
-       const char *sep;        /* end of string matched by subsubRE */
-       const char *oldssp;     /* previous ssp */
-       const char *dp;
-
-       AT("diss", start, stop, startst, stopst);
-       sp = start;
-       for (ss = startst; ss < stopst; ss = es) {
-               /* identify end of subRE */
-               es = ss;
-               switch (OP(m->g->strip[es])) {
-               case OPLUS_:
-               case OQUEST_:
-                       es += OPND(m->g->strip[es]);
-                       break;
-               case OCH_:
-                       while (OP(m->g->strip[es]) != O_CH)
-                               es += OPND(m->g->strip[es]);
-                       break;
-               }
-               es++;
-
-               /* figure out what it matched */
-               switch (OP(m->g->strip[ss])) {
-               case OEND:
-                       assert(nope);
-                       break;
-               case OCHAR:
-                       sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0, m->g->loc);
-                       break;
-               case OBOL:
-               case OEOL:
-               case OBOW:
-               case OEOW:
-                       break;
-               case OANY:
-               case OANYOF:
-                       sp += XMBRTOWC(NULL, sp, stop - start, &m->mbs, 0, m->g->loc);
-                       break;
-               case OBACK_:
-               case O_BACK:
-                       assert(nope);
-                       break;
-               /* cases where length of match is hard to find */
-               case OQUEST_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = es - 1;
-                       /* did innards match? */
-                       if (slow(m, sp, rest, ssub, esub) != NULL) {
-                               dp = dissect(m, sp, rest, ssub, esub);
-                               assert(dp == rest);
-                       } else          /* no */
-                               assert(sp == rest);
-                       sp = rest;
-                       break;
-               case OPLUS_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = es - 1;
-                       ssp = sp;
-                       oldssp = ssp;
-                       for (;;) {      /* find last match of innards */
-                               sep = slow(m, ssp, rest, ssub, esub);
-                               if (sep == NULL || sep == ssp)
-                                       break;  /* failed or matched null */
-                               oldssp = ssp;   /* on to next try */
-                               ssp = sep;
-                       }
-                       if (sep == NULL) {
-                               /* last successful match */
-                               sep = ssp;
-                               ssp = oldssp;
-                       }
-                       else if (tail==rest) {
-                               /* Fix for test expr 105 */
-                               ssp = oldssp;
-                       }
-                       assert(sep == rest);    /* must exhaust substring */
-                       assert(slow(m, ssp, sep, ssub, esub) == rest);
-                       dp = dissect(m, ssp, sep, ssub, esub);
-                       assert(dp == sep);
-                       sp = rest;
-                       break;
-               case OCH_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = ss + OPND(m->g->strip[ss]) - 1;
-                       assert(OP(m->g->strip[esub]) == OOR1);
-                       for (;;) {      /* find first matching branch */
-                               if (slow(m, sp, rest, ssub, esub) == rest)
-                                       break;  /* it matched all of it */
-                               /* that one missed, try next one */
-                               assert(OP(m->g->strip[esub]) == OOR1);
-                               esub++;
-                               assert(OP(m->g->strip[esub]) == OOR2);
-                               ssub = esub + 1;
-                               esub += OPND(m->g->strip[esub]);
-                               if (OP(m->g->strip[esub]) == OOR2)
-                                       esub--;
-                               else
-                                       assert(OP(m->g->strip[esub]) == O_CH);
-                       }
-                       dp = dissect(m, sp, rest, ssub, esub);
-                       assert(dp == rest);
-                       sp = rest;
-                       break;
-               case O_PLUS:
-               case O_QUEST:
-               case OOR1:
-               case OOR2:
-               case O_CH:
-                       assert(nope);
-                       break;
-               case OLPAREN:
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_so = sp - m->offp;
-                       /* fix for T.regcomp 43: don't remember previous
-                          subexpression matches beyond the current one (i) */
-                       i++;
-                       while (i<= m->g->nsub) {
-                               m->pmatch[i].rm_so = -1;
-                               m->pmatch[i].rm_eo = -1;
-                               i++;
-                       }
-                       break;
-               case ORPAREN:
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_eo = sp - m->offp;
-                       break;
-               default:                /* uh oh */
-                       assert(nope);
-                       break;
-               }
-       }
-
-       assert(sp == stop);
-       return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static const char *backref(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static const char *            /* == stop (success) or NULL (failure) */
-backref(struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst,
-       sopno lev,              /* PLUS nesting level */
-       int rec)
-{
-       int i;
-       sopno ss;               /* start sop of current subRE */
-       const char *sp;         /* start of string matched by it */
-       sopno ssub;             /* start sop of subsubRE */
-       sopno esub;             /* end sop of subsubRE */
-       const char *ssp;        /* start of string matched by subsubRE */
-       const char *dp;
-       size_t len;
-       int hard;
-       sop s;
-       regoff_t offsave;
-       cset *cs;
-       wint_t wc;
-
-       AT("back", start, stop, startst, stopst);
-       sp = start;
-
-       /* get as far as we can with easy stuff */
-       hard = 0;
-       for (ss = startst; !hard && ss < stopst; ss++)
-               switch (OP(s = m->g->strip[ss])) {
-               case OCHAR:
-                       if (sp == stop)
-                               return(NULL);
-                       sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
-                       if (wc != OPND(s))
-                               return(NULL);
-                       break;
-               case OANY:
-                       if (sp == stop)
-                               return(NULL);
-                       sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
-                       if (wc == BADCHAR)
-                               return (NULL);
-                       break;
-               case OANYOF:
-                       if (sp == stop)
-                               return (NULL);
-                       cs = &m->g->sets[OPND(s)];
-                       sp += XMBRTOWC(&wc, sp, stop - sp, &m->mbs, BADCHAR, m->g->loc);
-                       if (wc == BADCHAR || !CHIN(cs, wc, m->g->loc))
-                               return(NULL);
-                       break;
-               case OBOL:
-                       if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OEOL:
-                       if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OBOW:
-                       if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp > m->beginp &&
-                                                       !ISWORD(*(sp-1), m->g->loc)) ) &&
-                                       (sp < m->endp && ISWORD(*sp, m->g->loc)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OEOW:
-                       if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp < m->endp && !ISWORD(*sp, m->g->loc)) ) &&
-                                       (sp > m->beginp && ISWORD(*(sp-1), m->g->loc)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case O_QUEST:
-                       break;
-               case OOR1:      /* matches null but needs to skip */
-                       ss++;
-                       s = m->g->strip[ss];
-                       do {
-                               assert(OP(s) == OOR2);
-                               ss += OPND(s);
-                       } while (OP(s = m->g->strip[ss]) != O_CH);
-                       /* note that the ss++ gets us past the O_CH */
-                       break;
-               default:        /* have to make a choice */
-                       hard = 1;
-                       break;
-               }
-       if (!hard) {            /* that was it! */
-               if (sp != stop)
-                       return(NULL);
-               return(sp);
-       }
-       ss--;                   /* adjust for the for's final increment */
-
-       /* the hard stuff */
-       AT("hard", sp, stop, ss, stopst);
-       s = m->g->strip[ss];
-       switch (OP(s)) {
-       case OBACK_:            /* the vilest depths */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               if (m->pmatch[i].rm_eo == -1)
-                       return(NULL);
-               assert(m->pmatch[i].rm_so != -1);
-               len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
-               if (len == 0 && rec++ > MAX_RECURSION)
-                       return(NULL);
-               assert(stop - m->beginp >= len);
-               if (sp > stop - len)
-                       return(NULL);   /* not enough left to match */
-               ssp = m->offp + m->pmatch[i].rm_so;
-               if (memcmp(sp, ssp, len) != 0)
-                       return(NULL);
-               while (m->g->strip[ss] != SOP(O_BACK, i))
-                       ss++;
-               return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
-               break;
-       case OQUEST_:           /* to null or not */
-               dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
-               if (dp != NULL)
-                       return(dp);     /* not */
-               return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
-               break;
-       case OPLUS_:
-               assert(m->lastpos != NULL);
-               assert(lev+1 <= m->g->nplus);
-               m->lastpos[lev+1] = sp;
-               return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
-               break;
-       case O_PLUS:
-               if (sp == m->lastpos[lev])      /* last pass matched null */
-                       return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
-               /* try another pass */
-               m->lastpos[lev] = sp;
-               dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev, rec);
-               if (dp == NULL)
-                       return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
-               else
-                       return(dp);
-               break;
-       case OCH_:              /* find the right one, if any */
-               ssub = ss + 1;
-               esub = ss + OPND(s) - 1;
-               assert(OP(m->g->strip[esub]) == OOR1);
-               for (;;) {      /* find first matching branch */
-                       dp = backref(m, sp, stop, ssub, esub, lev, rec);
-                       if (dp != NULL)
-                               return(dp);
-                       /* that one missed, try next one */
-                       if (OP(m->g->strip[esub]) == O_CH)
-                               return(NULL);   /* there is none */
-                       esub++;
-                       assert(OP(m->g->strip[esub]) == OOR2);
-                       ssub = esub + 1;
-                       esub += OPND(m->g->strip[esub]);
-                       if (OP(m->g->strip[esub]) == OOR2)
-                               esub--;
-                       else
-                               assert(OP(m->g->strip[esub]) == O_CH);
-               }
-               break;
-       case OLPAREN:           /* must undo assignment if rest fails */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               offsave = m->pmatch[i].rm_so;
-               m->pmatch[i].rm_so = sp - m->offp;
-               dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
-               if (dp != NULL)
-                       return(dp);
-               m->pmatch[i].rm_so = offsave;
-               return(NULL);
-               break;
-       case ORPAREN:           /* must undo assignment if rest fails */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               offsave = m->pmatch[i].rm_eo;
-               m->pmatch[i].rm_eo = sp - m->offp;
-               dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
-               if (dp != NULL)
-                       return(dp);
-               m->pmatch[i].rm_eo = offsave;
-               return(NULL);
-               break;
-       default:                /* uh oh */
-               assert(nope);
-               break;
-       }
-
-       /* "can't happen" */
-       assert(nope);
-       /* NOTREACHED */
-       return "shut up gcc";
-}
-
-/*
- - fast - step through the string at top speed
- == static const char *fast(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* where tentative match ended, or NULL */
-fast(  struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       states st = m->st;
-       states fresh = m->fresh;
-       states tmp = m->tmp;
-       const char *p = start;
-       wint_t c;
-       wint_t lastc;           /* previous c */
-       wint_t flagch;
-       int i;
-       const char *coldp;      /* last p after which no match was underway */
-       size_t clen;
-
-       CLEAR(st);
-       SET1(st, startst);
-       SP("fast", st, *p);
-       st = step(m->g, startst, stopst, st, NOTHING, st);
-       ASSIGN(fresh, st);
-       SP("start", st, *p);
-       coldp = NULL;
-       if (start == m->beginp)
-               c = OUT;
-       else {
-               /*
-                * XXX Wrong if the previous character was multi-byte.
-                * Newline never is (in encodings supported by FreeBSD),
-                * so this only breaks the ISWORD tests below.
-                */
-               c = (uch)*(start - 1);
-       }
-       for (;;) {
-               /* next character */
-               lastc = c;
-               if (p == m->endp) {
-                       clen = 0;
-                       c = OUT;
-               } else
-                       clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR, m->g->loc);
-               if (EQ(st, fresh))
-                       coldp = p;
-
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-               i = 0;
-               if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
-                       flagch = BOL;
-                       i = m->g->nbol;
-               }
-               if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
-                       flagch = (flagch == BOL) ? BOLEOL : EOL;
-                       i += m->g->neol;
-               }
-               if (i != 0) {
-                       for (; i > 0; i--)
-                               st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("boleol", st, c);
-               }
-
-               /* how about a word boundary? */
-               if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc, m->g->loc))) &&
-                                       (c != OUT && ISWORD(c, m->g->loc)) ) {
-                       flagch = BOW;
-               }
-               if ( (lastc != OUT && ISWORD(lastc, m->g->loc)) &&
-                               (flagch == EOL || (c != OUT && !ISWORD(c, m->g->loc))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-                       st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("boweow", st, c);
-               }
-
-               /* are we done? */
-               if (ISSET(st, stopst) || p == stop || clen > stop - p)
-                       break;          /* NOTE BREAK OUT */
-
-               /* no, we must deal with this character */
-               ASSIGN(tmp, st);
-               ASSIGN(st, fresh);
-               assert(c != OUT);
-               st = step(m->g, startst, stopst, tmp, c, st);
-               SP("aft", st, c);
-               assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
-               p += clen;
-       }
-
-       assert(coldp != NULL);
-       m->coldp = coldp;
-       if (ISSET(st, stopst))
-               return(p+XMBRTOWC(NULL, p, stop - p, &m->mbs, 0, m->g->loc));
-       else
-               return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static const char *slow(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* where it ended */
-slow(  struct match *m,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       states st = m->st;
-       states empty = m->empty;
-       states tmp = m->tmp;
-       const char *p = start;
-       wint_t c;
-       wint_t lastc;           /* previous c */
-       wint_t flagch;
-       int i;
-       const char *matchp;     /* last p at which a match ended */
-       size_t clen;
-
-       AT("slow", start, stop, startst, stopst);
-       CLEAR(st);
-       SET1(st, startst);
-       SP("sstart", st, *p);
-       st = step(m->g, startst, stopst, st, NOTHING, st);
-       matchp = NULL;
-       if (start == m->beginp)
-               c = OUT;
-       else {
-               /*
-                * XXX Wrong if the previous character was multi-byte.
-                * Newline never is (in encodings supported by FreeBSD),
-                * so this only breaks the ISWORD tests below.
-                */
-               c = (uch)*(start - 1);
-       }
-       for (;;) {
-               /* next character */
-               lastc = c;
-               if (p == m->endp) {
-                       c = OUT;
-                       clen = 0;
-               } else
-                       clen = XMBRTOWC(&c, p, m->endp - p, &m->mbs, BADCHAR, m->g->loc);
-
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-               i = 0;
-               if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
-                       flagch = BOL;
-                       i = m->g->nbol;
-               }
-               if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
-                       flagch = (flagch == BOL) ? BOLEOL : EOL;
-                       i += m->g->neol;
-               }
-               if (i != 0) {
-                       for (; i > 0; i--)
-                               st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("sboleol", st, c);
-               }
-
-               /* how about a word boundary? */
-               if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc, m->g->loc))) &&
-                                       (c != OUT && ISWORD(c, m->g->loc)) ) {
-                       flagch = BOW;
-               }
-               if ( (lastc != OUT && ISWORD(lastc, m->g->loc)) &&
-                               (flagch == EOL || (c != OUT && !ISWORD(c, m->g->loc))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-                       st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("sboweow", st, c);
-               }
-
-               /* are we done? */
-               if (ISSET(st, stopst))
-                       matchp = p;
-               if (EQ(st, empty) || p == stop || clen > stop - p)
-                       break;          /* NOTE BREAK OUT */
-
-               /* no, we must deal with this character */
-               ASSIGN(tmp, st);
-               ASSIGN(st, empty);
-               assert(c != OUT);
-               st = step(m->g, startst, stopst, tmp, c, st);
-               SP("saft", st, c);
-               assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
-               p += clen;
-       }
-
-       return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(struct re_guts *g, sopno start, sopno stop, \
- ==    states bef, int ch, states aft);
- == #define    BOL     (OUT-1)
- == #define    EOL     (BOL-1)
- == #define    BOLEOL  (BOL-2)
- == #define    NOTHING (BOL-3)
- == #define    BOW     (BOL-4)
- == #define    EOW     (BOL-5)
- == #define    BADCHAR (BOL-6)
- == #define    NONCHAR(c)      ((c) <= OUT)
- */
-static states
-step(struct re_guts *g,
-       sopno start,            /* start state within strip */
-       sopno stop,             /* state after stop state within strip */
-       states bef,             /* states reachable before */
-       wint_t ch,              /* character or NONCHAR code */
-       states aft)             /* states already known reachable after */
-{
-       cset *cs;
-       sop s;
-       sopno pc;
-       onestate here;          /* note, macros know this name */
-       sopno look;
-       int i;
-
-       for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
-               s = g->strip[pc];
-               switch (OP(s)) {
-               case OEND:
-                       assert(pc == stop-1);
-                       break;
-               case OCHAR:
-                       /* only characters can match */
-                       assert(!NONCHAR(ch) || ch != OPND(s));
-                       if (ch == OPND(s))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBOL:
-                       if (ch == BOL || ch == BOLEOL)
-                               FWD(aft, bef, 1);
-                       break;
-               case OEOL:
-                       if (ch == EOL || ch == BOLEOL)
-                               FWD(aft, bef, 1);
-                       break;
-               case OBOW:
-                       if (ch == BOW)
-                               FWD(aft, bef, 1);
-                       break;
-               case OEOW:
-                       if (ch == EOW)
-                               FWD(aft, bef, 1);
-                       break;
-               case OANY:
-                       if (!NONCHAR(ch))
-                               FWD(aft, bef, 1);
-                       break;
-               case OANYOF:
-                       cs = &g->sets[OPND(s)];
-                       if (!NONCHAR(ch) && CHIN(cs, ch, g->loc))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBACK_:            /* ignored here */
-               case O_BACK:
-                       FWD(aft, aft, 1);
-                       break;
-               case OPLUS_:            /* forward, this is just an empty */
-                       FWD(aft, aft, 1);
-                       break;
-               case O_PLUS:            /* both forward and back */
-                       FWD(aft, aft, 1);
-                       i = ISSETBACK(aft, OPND(s));
-                       BACK(aft, aft, OPND(s));
-                       if (!i && ISSETBACK(aft, OPND(s))) {
-                               /* oho, must reconsider loop body */
-                               pc -= OPND(s) + 1;
-                               INIT(here, pc);
-                       }
-                       break;
-               case OQUEST_:           /* two branches, both forward */
-                       FWD(aft, aft, 1);
-                       FWD(aft, aft, OPND(s));
-                       break;
-               case O_QUEST:           /* just an empty */
-                       FWD(aft, aft, 1);
-                       break;
-               case OLPAREN:           /* not significant here */
-               case ORPAREN:
-                       FWD(aft, aft, 1);
-                       break;
-               case OCH_:              /* mark the first two branches */
-                       FWD(aft, aft, 1);
-                       assert(OP(g->strip[pc+OPND(s)]) == OOR2);
-                       FWD(aft, aft, OPND(s));
-                       break;
-               case OOR1:              /* done a branch, find the O_CH */
-                       if (ISSTATEIN(aft, here)) {
-                               for (look = 1;
-                                               OP(s = g->strip[pc+look]) != O_CH;
-                                               look += OPND(s))
-                                       assert(OP(s) == OOR2);
-                               FWD(aft, aft, look + 1);
-                       }
-                       break;
-               case OOR2:              /* propagate OCH_'s marking */
-                       FWD(aft, aft, 1);
-                       if (OP(g->strip[pc+OPND(s)]) != O_CH) {
-                               assert(OP(g->strip[pc+OPND(s)]) == OOR2);
-                               FWD(aft, aft, OPND(s));
-                       }
-                       break;
-               case O_CH:              /* just empty */
-                       FWD(aft, aft, 1);
-                       break;
-               default:                /* ooooops... */
-                       assert(nope);
-                       break;
-               }
-       }
-
-       return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, const char *caption, states st, \
- ==    int ch, FILE *d);
- == #endif
- */
-static void
-print(struct match *m,
-       const char *caption,
-       states st,
-       int ch,
-       FILE *d)
-{
-       struct re_guts *g = m->g;
-       int i;
-       int first = 1;
-
-       if (!(m->eflags&REG_TRACE))
-               return;
-
-       fprintf(d, "%s", caption);
-       if (ch != '\0')
-               fprintf(d, " %s", pchar(ch));
-       for (i = 0; i < g->nstates; i++)
-               if (ISSET(st, i)) {
-                       fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
-                       first = 0;
-               }
-       fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, const char *title, const char *start, \
- ==                     const char *stop, sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(    struct match *m,
-       const char *title,
-       const char *start,
-       const char *stop,
-       sopno startst,
-       sopno stopst)
-{
-       if (!(m->eflags&REG_TRACE))
-               return;
-
-       printf("%s %s-", title, pchar(*start));
-       printf("%s ", pchar(*stop));
-       printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define        PCHARDONE       /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static const char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c?  Well, yes.  But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient.  It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static const char *            /* -> representation */
-pchar(int ch)
-{
-       static char pbuf[10];
-
-       if (isprint((uch)ch) || ch == ' ')
-               sprintf(pbuf, "%c", ch);
-       else
-               sprintf(pbuf, "\\%o", ch);
-       return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/regex/re_format.7 b/regex/re_format.7
deleted file mode 120000 (symlink)
index 9946732..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./re_format.7
\ No newline at end of file
diff --git a/regex/regcomp-fbsd.c b/regex/regcomp-fbsd.c
deleted file mode 100644 (file)
index a84a31d..0000000
+++ /dev/null
@@ -1,1876 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regcomp.c   8.5 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regcomp.c  8.5 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regcomp.c,v 1.36 2007/06/11 03:05:54 delphij Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-#include <runetype.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "collate.h"
-
-#include "utils.h"
-#include "regex2.h"
-
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
-       char *next;             /* next character in RE */
-       char *end;              /* end of string (-> NUL normally) */
-       int error;              /* has an error been seen? */
-       sop *strip;             /* malloced strip */
-       sopno ssize;            /* malloced strip size (allocated) */
-       sopno slen;             /* malloced strip length (used) */
-       int ncsalloc;           /* number of csets allocated */
-#if __DARWIN_UNIX03
-       int zerorepeats;
-#endif /* __DARWIN_UNIX03 */
-       struct re_guts *g;
-#      define  NPAREN  10      /* we need to remember () 1-9 for back refs */
-       sopno pbegin[NPAREN];   /* -> ( ([0] unused) */
-       sopno pend[NPAREN];     /* -> ) ([0] unused) */
-};
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(struct parse *p, wint_t stop);
-static void p_ere_exp(struct parse *p);
-static void p_str(struct parse *p);
-static void p_bre(struct parse *p, wint_t end1, wint_t end2);
-static int p_simp_re(struct parse *p, int starordinary);
-static int p_count(struct parse *p);
-static void p_bracket(struct parse *p);
-static void p_b_term(struct parse *p, cset *cs);
-static void p_b_cclass(struct parse *p, cset *cs);
-static void p_b_eclass(struct parse *p, cset *cs);
-static wint_t p_b_symbol(struct parse *p);
-static wint_t p_b_coll_elem(struct parse *p, wint_t endc);
-static wint_t othercase(wint_t ch, locale_t loc);
-static void bothcases(struct parse *p, wint_t ch);
-static void ordinary(struct parse *p, wint_t ch);
-static void nonnewline(struct parse *p);
-static void repeat(struct parse *p, sopno start, int from, int to);
-static int seterr(struct parse *p, int e);
-static cset *allocset(struct parse *p);
-static void freeset(struct parse *p, cset *cs);
-static void CHadd(struct parse *p, cset *cs, wint_t ch);
-static void CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max);
-static void CHaddtype(struct parse *p, cset *cs, wctype_t wct);
-static wint_t singleton(cset *cs, locale_t loc);
-static sopno dupl(struct parse *p, sopno start, sopno finish);
-static void doemit(struct parse *p, sop op, size_t opnd);
-static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(struct parse *p, sopno pos, sop value);
-static void enlarge(struct parse *p, sopno size);
-static void stripsnug(struct parse *p, struct re_guts *g);
-static void findmust(struct parse *p, struct re_guts *g);
-static int altoffset(sop *scan, int offset);
-static void computejumps(struct parse *p, struct re_guts *g);
-static void computematchjumps(struct parse *p, struct re_guts *g);
-static sopno pluscount(struct parse *p, struct re_guts *g);
-static wint_t wgetnext(struct parse *p);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-
-static char nuls[10];          /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE:  these know that the parse structure is named `p' !!!
- */
-#define        PEEK()  (*p->next)
-#define        PEEK2() (*(p->next+1))
-#define        MORE()  (p->next < p->end)
-#define        MORE2() (p->next+1 < p->end)
-#define        SEE(c)  (MORE() && PEEK() == (c))
-#define        SEETWO(a, b)    (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define        EAT(c)  ((SEE(c)) ? (NEXT(), 1) : 0)
-#define        EATTWO(a, b)    ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define        NEXT()  (p->next++)
-#define        NEXT2() (p->next += 2)
-#define        NEXTn(n)        (p->next += (n))
-#define        GETNEXT()       (*p->next++)
-#define        WGETNEXT()      wgetnext(p)
-#define        SETERROR(e)     seterr(p, (e))
-#define        REQUIRE(co, e)  ((co) || SETERROR(e))
-#define        MUSTSEE(c, e)   (REQUIRE(MORE() && PEEK() == (c), e))
-#define        MUSTEAT(c, e)   (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define        MUSTNOTSEE(c, e)        (REQUIRE(!MORE() || PEEK() != (c), e))
-#define        EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define        INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define        AHEAD(pos)              dofwd(p, pos, HERE()-(pos))
-#define        ASTERN(sop, pos)        EMIT(sop, HERE()-pos)
-#define        HERE()          (p->slen)
-#define        THERE()         (p->slen - 1)
-#define        THERETHERE()    (p->slen - 2)
-#define        DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0;          /* for use in asserts; shuts lint up */
-#else
-#define        never   0               /* some <assert.h>s have bugs too */
-#endif
-
-/* Macro used by computejump()/computematchjump() */
-#define MIN(a,b)       ((a)<(b)?(a):(b))
-
-/*
- - regcomp - interface for parser and compilation
- = extern int regcomp(regex_t *, const char *, int);
- = #define     REG_BASIC       0000
- = #define     REG_EXTENDED    0001
- = #define     REG_ICASE       0002
- = #define     REG_NOSUB       0004
- = #define     REG_NEWLINE     0010
- = #define     REG_NOSPEC      0020
- = #define     REG_PEND        0040
- = #define     REG_DUMP        0200
- */
-int                            /* 0 success, otherwise REG_something */
-regcomp(regex_t * __restrict preg,
-       const char * __restrict pattern,
-       int cflags)
-{
-       struct parse pa;
-       struct re_guts *g;
-       struct parse *p = &pa;
-       int i;
-       size_t len;
-#ifdef REDEBUG
-#      define  GOODFLAGS(f)    (f)
-#else
-#      define  GOODFLAGS(f)    ((f)&~REG_DUMP)
-#endif
-
-       cflags = GOODFLAGS(cflags);
-       if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
-               return(REG_INVARG);
-
-       if (cflags&REG_PEND) {
-               if (preg->re_endp < pattern)
-                       return(REG_INVARG);
-               len = preg->re_endp - pattern;
-       } else
-               len = strlen((char *)pattern);
-
-       /* do the mallocs early so failure handling is easy */
-       g = (struct re_guts *)malloc(sizeof(struct re_guts));
-       if (g == NULL)
-               return(REG_ESPACE);
-       p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
-       p->strip = (sop *)malloc(p->ssize * sizeof(sop));
-       p->slen = 0;
-       if (p->strip == NULL) {
-               free((char *)g);
-               return(REG_ESPACE);
-       }
-
-       /* set things up */
-       p->g = g;
-       p->next = (char *)pattern;      /* convenience; we do not modify it */
-       p->end = p->next + len;
-       p->error = 0;
-       p->ncsalloc = 0;
-#if __DARWIN_UNIX03
-       p->zerorepeats = 0;
-#endif /* __DARWIN_UNIX03 */
-       for (i = 0; i < NPAREN; i++) {
-               p->pbegin[i] = 0;
-               p->pend[i] = 0;
-       }
-       g->loc = __current_locale();
-       g->sets = NULL;
-       g->ncsets = 0;
-       g->cflags = cflags;
-       g->iflags = 0;
-       g->nbol = 0;
-       g->neol = 0;
-       g->must = NULL;
-       g->moffset = -1;
-       g->charjump = NULL;
-       g->matchjump = NULL;
-       g->mlen = 0;
-       g->nsub = 0;
-       g->backrefs = 0;
-
-       /* do it */
-       EMIT(OEND, 0);
-       g->firststate = THERE();
-       if (cflags&REG_EXTENDED)
-               p_ere(p, OUT);
-       else if (cflags&REG_NOSPEC)
-               p_str(p);
-       else
-               p_bre(p, OUT, OUT);
-       EMIT(OEND, 0);
-       g->laststate = THERE();
-
-       /* tidy up loose ends and fill things in */
-       stripsnug(p, g);
-       findmust(p, g);
-       /* only use Boyer-Moore algorithm if the pattern is bigger
-        * than three characters
-        */
-       if(g->mlen > 3) {
-               computejumps(p, g);
-               computematchjumps(p, g);
-               if(g->matchjump == NULL && g->charjump != NULL) {
-                       free(g->charjump);
-                       g->charjump = NULL;
-               }
-       }
-       g->nplus = pluscount(p, g);
-       g->magic = MAGIC2;
-       preg->re_nsub = g->nsub;
-       preg->re_g = g;
-       preg->re_magic = MAGIC1;
-#ifndef REDEBUG
-       /* not debugging, so can't rely on the assert() in regexec() */
-       if (g->iflags&BAD)
-               SETERROR(REG_ASSERT);
-#endif
-
-       /* win or lose, we're done */
-       if (p->error != 0)      /* lose */
-               regfree(preg);
-       return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(struct parse *p, int stop);
- */
-static void
-p_ere(struct parse *p,
-       int stop)               /* character this ERE should end at */
-{
-       char c;
-       sopno prevback;
-       sopno prevfwd;
-       sopno conc;
-       int first = 1;          /* is this the first alternative? */
-
-       for (;;) {
-               /* do a bunch of concatenated expressions */
-               conc = HERE();
-               while (MORE() && (c = PEEK()) != '|' && c != stop)
-                       p_ere_exp(p);
-#if __DARWIN_UNIX03
-               if (!p->zerorepeats) REQUIRE(HERE() != conc, REG_EMPTY);        /* require nonempty */
-               else p->zerorepeats--;
-#else
-               (void)REQUIRE(HERE() != conc, REG_EMPTY);       /* require nonempty */
-#endif
-               if (!EAT('|'))
-                       break;          /* NOTE BREAK OUT */
-
-               if (first) {
-                       INSERT(OCH_, conc);     /* offset is wrong */
-                       prevfwd = conc;
-                       prevback = conc;
-                       first = 0;
-               }
-               ASTERN(OOR1, prevback);
-               prevback = THERE();
-               AHEAD(prevfwd);                 /* fix previous offset */
-               prevfwd = HERE();
-               EMIT(OOR2, 0);                  /* offset is very wrong */
-       }
-
-       if (!first) {           /* tail-end fixups */
-               AHEAD(prevfwd);
-               ASTERN(O_CH, prevback);
-       }
-
-       assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(struct parse *p);
- */
-static void
-p_ere_exp(struct parse *p)
-{
-       char c;
-       wint_t wc;
-       sopno pos;
-       int count;
-       int count2;
-       sopno subno;
-       int wascaret = 0;
-
-       assert(MORE());         /* caller should have ensured this */
-       c = GETNEXT();
-
-       pos = HERE();
-       switch (c) {
-       case '(':
-               (void)REQUIRE(MORE(), REG_EPAREN);
-               p->g->nsub++;
-               subno = p->g->nsub;
-               if (subno < NPAREN)
-                       p->pbegin[subno] = HERE();
-               EMIT(OLPAREN, subno);
-               if (!SEE(')'))
-                       p_ere(p, ')');
-               if (subno < NPAREN) {
-                       p->pend[subno] = HERE();
-                       assert(p->pend[subno] != 0);
-               }
-               EMIT(ORPAREN, subno);
-               (void)MUSTEAT(')', REG_EPAREN);
-               break;
-#ifndef POSIX_MISTAKE
-       case ')':               /* happens only if no current unmatched ( */
-               /*
-                * You may ask, why the ifndef?  Because I didn't notice
-                * this until slightly too late for 1003.2, and none of the
-                * other 1003.2 regular-expression reviewers noticed it at
-                * all.  So an unmatched ) is legal POSIX, at least until
-                * we can get it fixed.
-                */
-               SETERROR(REG_EPAREN);
-               break;
-#endif
-       case '^':
-               EMIT(OBOL, 0);
-               p->g->iflags |= USEBOL;
-               p->g->nbol++;
-               wascaret = 1;
-               break;
-       case '$':
-               EMIT(OEOL, 0);
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-               break;
-       case '|':
-               SETERROR(REG_EMPTY);
-               break;
-       case '*':
-       case '+':
-       case '?':
-               SETERROR(REG_BADRPT);
-               break;
-       case '.':
-               if (p->g->cflags&REG_NEWLINE)
-                       nonnewline(p);
-               else
-                       EMIT(OANY, 0);
-               break;
-       case '[':
-               p_bracket(p);
-               break;
-       case '\\':
-               (void)REQUIRE(MORE(), REG_EESCAPE);
-               wc = WGETNEXT();
-               ordinary(p, wc);
-               break;
-       case '{':               /* okay as ordinary except if digit follows */
-               (void)REQUIRE(!MORE() || !isdigit_l((uch)PEEK(), p->g->loc), REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               p->next--;
-               wc = WGETNEXT();
-               ordinary(p, wc);
-               break;
-       }
-
-       if (!MORE())
-               return;
-       c = PEEK();
-       /* we call { a repetition if followed by a digit */
-       if (!( c == '*' || c == '+' || c == '?' ||
-                               (c == '{' && MORE2() && isdigit_l((uch)PEEK2(), p->g->loc)) ))
-               return;         /* no repetition, we're done */
-       NEXT();
-
-       (void)REQUIRE(!wascaret, REG_BADRPT);
-       switch (c) {
-       case '*':       /* implemented as +? */
-               /* this case does not require the (y|) trick, noKLUDGE */
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-               break;
-       case '+':
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               break;
-       case '?':
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, pos);              /* offset slightly wrong */
-               ASTERN(OOR1, pos);              /* this one's right */
-               AHEAD(pos);                     /* fix the OCH_ */
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-               break;
-       case '{':
-               count = p_count(p);
-               if (EAT(',')) {
-                       if (isdigit_l((uch)PEEK(), p->g->loc)) {
-                               count2 = p_count(p);
-                               (void)REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-                               count2 = INFINITY;
-               } else          /* just a single number */
-                       count2 = count;
-               repeat(p, pos, count, count2);
-               if (!EAT('}')) {        /* error heuristics */
-                       while (MORE() && PEEK() != '}')
-                               NEXT();
-                       (void)REQUIRE(MORE(), REG_EBRACE);
-                       SETERROR(REG_BADBR);
-               }
-               break;
-       }
-
-       if (!MORE())
-               return;
-       c = PEEK();
-       if (!( c == '*' || c == '+' || c == '?' ||
-                               (c == '{' && MORE2() && isdigit_l((uch)PEEK2(), p->g->loc)) ) )
-               return;
-       SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(struct parse *p);
- */
-static void
-p_str(struct parse *p)
-{
-#if __DARWIN_UNIX03
-       if (!p->zerorepeats) REQUIRE(MORE(), REG_EMPTY);
-       else p->zerorepeats--;
-#else  /* !__DARWIN_UNIX03 */
-       (void)REQUIRE(MORE(), REG_EMPTY);
-#endif /* __DARWIN_UNIX03 */
-       while (MORE())
-               ordinary(p, WGETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(struct parse *p, int end1, \
- ==    int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(struct parse *p,
-       int end1,               /* first terminating character */
-       int end2)               /* second terminating character */
-{
-       sopno start = HERE();
-       int first = 1;                  /* first subexpression? */
-       int wasdollar = 0;
-
-       if (EAT('^')) {
-               EMIT(OBOL, 0);
-               p->g->iflags |= USEBOL;
-               p->g->nbol++;
-       }
-       while (MORE() && !SEETWO(end1, end2)) {
-               wasdollar = p_simp_re(p, first);
-               first = 0;
-       }
-       if (wasdollar) {        /* oops, that was a trailing anchor */
-               DROP(1);
-               EMIT(OEOL, 0);
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-       }
-#if __DARWIN_UNIX03
-       if (!p->zerorepeats) REQUIRE(HERE() != start, REG_EMPTY);       /* require nonempty */
-       else p->zerorepeats--;
-#else  /* !__DARWIN_UNIX03 */
-       (void)REQUIRE(HERE() != start, REG_EMPTY);      /* require nonempty */
-#endif /* __DARWIN_UNIX03 */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(struct parse *p, int starordinary);
- */
-static int                     /* was the simple RE an unbackslashed $? */
-p_simp_re(struct parse *p,
-       int starordinary)       /* is a leading * an ordinary character? */
-{
-       int c;
-       int count;
-       int count2;
-       sopno pos;
-       int i;
-       wint_t wc;
-       sopno subno;
-#      define  BACKSL  (1<<CHAR_BIT)
-
-       pos = HERE();           /* repetion op, if any, covers from here */
-
-       assert(MORE());         /* caller should have ensured this */
-       c = GETNEXT();
-       if (c == '\\') {
-               (void)REQUIRE(MORE(), REG_EESCAPE);
-               c = BACKSL | GETNEXT();
-       }
-       switch (c) {
-       case '.':
-               if (p->g->cflags&REG_NEWLINE)
-                       nonnewline(p);
-               else
-                       EMIT(OANY, 0);
-               break;
-       case '[':
-               p_bracket(p);
-               break;
-       case BACKSL|'{':
-               SETERROR(REG_BADRPT);
-               break;
-       case BACKSL|'(':
-               p->g->nsub++;
-               subno = p->g->nsub;
-               if (subno < NPAREN)
-                       p->pbegin[subno] = HERE();
-               EMIT(OLPAREN, subno);
-               /* the MORE here is an error heuristic */
-               if (MORE() && !SEETWO('\\', ')'))
-                       p_bre(p, '\\', ')');
-               if (subno < NPAREN) {
-                       p->pend[subno] = HERE();
-                       assert(p->pend[subno] != 0);
-               }
-               EMIT(ORPAREN, subno);
-               (void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
-               break;
-       case BACKSL|')':        /* should not get here -- must be user */
-       case BACKSL|'}':
-               SETERROR(REG_EPAREN);
-               break;
-       case BACKSL|'1':
-       case BACKSL|'2':
-       case BACKSL|'3':
-       case BACKSL|'4':
-       case BACKSL|'5':
-       case BACKSL|'6':
-       case BACKSL|'7':
-       case BACKSL|'8':
-       case BACKSL|'9':
-               i = (c&~BACKSL) - '0';
-               assert(i < NPAREN);
-               if (p->pend[i] != 0) {
-#if __DARWIN_UNIX03
-                       int skip = 1;
-#endif /* __DARWIN_UNIX03 */
-                       assert(i <= p->g->nsub);
-                       EMIT(OBACK_, i);
-                       assert(p->pbegin[i] != 0);
-                       assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
-                       assert(OP(p->strip[p->pend[i]]) == ORPAREN);
-#if __DARWIN_UNIX03
-                       if (OP(p->strip[p->pbegin[i]+skip]) == OBOL) {
-                               skip++;         /* don't dup anchor in subexp */
-                       }
-                       (void) dupl(p, p->pbegin[i]+skip, p->pend[i]);
-#else  /* !__DARWIN_UNIX03 */
-                       (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
-#endif /* __DARWIN_UNIX03 */
-                       EMIT(O_BACK, i);
-               } else
-                       SETERROR(REG_ESUBREG);
-               p->g->backrefs = 1;
-               break;
-       case '*':
-               (void)REQUIRE(starordinary, REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               p->next--;
-               wc = WGETNEXT();
-               ordinary(p, wc);
-               break;
-       }
-
-       if (EAT('*')) {         /* implemented as +? */
-               /* this case does not require the (y|) trick, noKLUDGE */
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-       } else if (EATTWO('\\', '{')) {
-               (void)REQUIRE(MORE(), REG_EBRACE);
-               count = p_count(p);
-               if (EAT(',')) {
-                       if (MORE() && isdigit_l((uch)PEEK(), p->g->loc)) {
-                               count2 = p_count(p);
-                               (void)REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-                               count2 = INFINITY;
-               } else          /* just a single number */
-                       count2 = count;
-               repeat(p, pos, count, count2);
-               if (!EATTWO('\\', '}')) {       /* error heuristics */
-                       while (MORE() && !SEETWO('\\', '}'))
-                               NEXT();
-                       (void)REQUIRE(MORE(), REG_EBRACE);
-                       SETERROR(REG_BADBR);
-               }
-       } else if (c == '$')     /* $ (but not \$) ends it */
-               return(1);
-
-       return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(struct parse *p);
- */
-static int                     /* the value */
-p_count(struct parse *p)
-{
-       int count = 0;
-       int ndigits = 0;
-
-       while (MORE() && isdigit_l((uch)PEEK(), p->g->loc) && count <= DUPMAX) {
-               count = count*10 + (GETNEXT() - '0');
-               ndigits++;
-       }
-
-       (void)REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
-       return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(struct parse *p);
- */
-static void
-p_bracket(struct parse *p)
-{
-       cset *cs;
-       wint_t ch;
-
-       /* Dept of Truly Sickening Special-Case Kludges */
-       if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
-               EMIT(OBOW, 0);
-               NEXTn(6);
-               return;
-       }
-       if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
-               EMIT(OEOW, 0);
-               NEXTn(6);
-               return;
-       }
-
-       if ((cs = allocset(p)) == NULL)
-               return;
-
-       if (p->g->cflags&REG_ICASE)
-               cs->icase = 1;
-       if (EAT('^'))
-               cs->invert = 1;
-#if __DARWIN_UNIX03
-       if (PEEK2() != '-' && PEEK2() != ']') { /* Don't eat '-' or ']' if they're part of ranges
-                                                * but do process [^-] */
-       if (EAT(']'))
-               CHadd(p, cs, ']');
-       else if (EAT('-'))
-               CHadd(p, cs, '-');
-       }
-       if (MORE() && !SEETWO('-',']')) /* Parse RE []-'] */
-               p_b_term(p, cs);
-#else /* !__DARWIN_UNIX03 */
-       if (EAT(']'))
-               CHadd(p, cs, ']');
-       else if (EAT('-'))
-               CHadd(p, cs, '-');
-#endif /* __DARWIN_UNIX03 */
-       while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
-               p_b_term(p, cs);
-       if (EAT('-'))
-               CHadd(p, cs, '-');
-       (void)MUSTEAT(']', REG_EBRACK);
-
-       if (p->error != 0)      /* don't mess things up further */
-               return;
-
-       if (cs->invert && p->g->cflags&REG_NEWLINE)
-               cs->bmp['\n' >> 3] |= 1 << ('\n' & 7);
-
-       if ((ch = singleton(cs, p->g->loc)) != OUT) {   /* optimize singleton sets */
-               ordinary(p, ch);
-               freeset(p, cs);
-       } else
-               EMIT(OANYOF, (int)(cs - p->g->sets));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(struct parse *p, cset *cs);
- */
-static void
-p_b_term(struct parse *p, cset *cs)
-{
-       char c;
-       wint_t start, finish;
-       wint_t i;
-
-       /* classify what we've got */
-       switch ((MORE()) ? PEEK() : '\0') {
-       case '[':
-               c = (MORE2()) ? PEEK2() : '\0';
-               break;
-       case '-':
-#if __DARWIN_UNIX03
-               if (PEEK2() != '-') { /* Allow [---] */
-               SETERROR(REG_ERANGE);
-               return;                 /* NOTE RETURN */
-               } else
-                       c = '-';
-#else  /* !__DARWIN_UNIX03 */
-               SETERROR(REG_ERANGE);
-               return;                 /* NOTE RETURN */
-#endif /* __DARWIN_UNIX03 */
-               break;
-       default:
-               c = '\0';
-               break;
-       }
-
-       switch (c) {
-       case ':':               /* character class */
-               NEXT2();
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-               (void)REQUIRE(c != '-' && c != ']', REG_ECTYPE);
-               p_b_cclass(p, cs);
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               (void)REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
-               break;
-       case '=':               /* equivalence class */
-               NEXT2();
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-#if __DARWIN_UNIX03
-               REQUIRE(c != '-', REG_ECOLLATE); /* allow [=]=] */
-#else  /* !__DARWIN_UNIX03 */
-               (void)REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
-#endif /* __DARWIN_UNIX03 */
-               p_b_eclass(p, cs);
-               (void)REQUIRE(MORE(), REG_EBRACK);
-               (void)REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
-               break;
-       default:                /* symbol, ordinary character, or range */
-               start = p_b_symbol(p);
-               if (SEE('-') && MORE2() && PEEK2() != ']') {
-                       /* range */
-                       NEXT();
-                       if (EAT('-'))
-                               finish = '-';
-                       else
-                               finish = p_b_symbol(p);
-               } else
-                       finish = start;
-               if (start == finish)
-                       CHadd(p, cs, start);
-               else {
-                       if (p->g->loc->__collate_load_error) {
-                               (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE);
-                               CHaddrange(p, cs, start, finish);
-                       } else {
-                               (void)REQUIRE(__collate_range_cmp(start, finish, p->g->loc) <= 0, REG_ERANGE);
-                               for (i = 0; i <= UCHAR_MAX; i++) {
-                                       if (   __collate_range_cmp(start, i, p->g->loc) <= 0
-                                           && __collate_range_cmp(i, finish, p->g->loc) <= 0
-                                          )
-                                               CHadd(p, cs, i);
-                               }
-                       }
-               }
-               break;
-       }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(struct parse *p, cset *cs);
- */
-static void
-p_b_cclass(struct parse *p, cset *cs)
-{
-       char *sp = p->next;
-       size_t len;
-       wctype_t wct;
-       char clname[16];
-
-       while (MORE() && isalpha_l((uch)PEEK(), p->g->loc))
-               NEXT();
-       len = p->next - sp;
-       if (len >= sizeof(clname) - 1) {
-               SETERROR(REG_ECTYPE);
-               return;
-       }
-       memcpy(clname, sp, len);
-       clname[len] = '\0';
-       if ((wct = wctype_l(clname, p->g->loc)) == 0) {
-               SETERROR(REG_ECTYPE);
-               return;
-       }
-       CHaddtype(p, cs, wct);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(struct parse *p, cset *cs);
- */
-static void
-p_b_eclass(struct parse *p, cset *cs)
-{
-       char *sp = p->next;
-       int len, ec;
-       mbstate_t mbs;
-       int *newequiv_classes;
-       wint_t c;
-       while (MORE() && !SEETWO('=', ']'))
-               NEXT();
-       if (!MORE()) {
-               SETERROR(REG_EBRACK);
-               return;
-       }
-       len = p->next - sp;
-       memset(&mbs, 0, sizeof(mbs));
-       ec = __collate_equiv_class(sp, len, &mbs, p->g->loc);
-       if (ec > 0) {
-               newequiv_classes = realloc(cs->equiv_classes,
-                   (cs->nequiv_classes + 1) * sizeof(*cs->equiv_classes));
-               if (newequiv_classes == NULL) {
-                       SETERROR(REG_ESPACE);
-                       return;
-               }
-               cs->equiv_classes = newequiv_classes;
-               cs->equiv_classes[cs->nequiv_classes++] = ec;
-               return;
-       }
-       /* not an equivalence class, so fallback to a collating element */
-       p->next = sp;
-       c = p_b_coll_elem(p, '=');
-       CHadd(p, cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(struct parse *p);
- */
-static wint_t                  /* value of symbol */
-p_b_symbol(struct parse *p)
-{
-       wint_t value;
-
-       (void)REQUIRE(MORE(), REG_EBRACK);
-       if (!EATTWO('[', '.'))
-               return(WGETNEXT());
-
-       /* collating symbol */
-       value = p_b_coll_elem(p, '.');
-       (void)REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
-       return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(struct parse *p, int endc);
- */
-static wint_t                  /* value of collating element */
-p_b_coll_elem(struct parse *p,
-       wint_t endc)            /* name ended by endc,']' */
-{
-       char *sp = p->next;
-       const struct cname *cp;
-       int len;
-       mbstate_t mbs;
-       wchar_t wbuf[16];
-       size_t clen;
-
-       while (MORE() && !SEETWO(endc, ']'))
-               NEXT();
-       if (!MORE()) {
-               SETERROR(REG_EBRACK);
-               return(0);
-       }
-       len = p->next - sp;
-       for (cp = cnames; cp->name != NULL; cp++)
-               if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-                       return(cp->code);       /* known name */
-       memset(&mbs, 0, sizeof(mbs));
-       clen = __collate_collating_symbol(wbuf, 16, sp, len, &mbs, p->g->loc);
-       if (clen == 1)
-               return (*wbuf);                 /* single character */
-       else if (clen == (size_t)-1)
-               SETERROR(REG_ILLSEQ);
-       else
-               SETERROR(REG_ECOLLATE);         /* neither */
-       return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(wint_t ch, locale_t loc);
- */
-static wint_t                  /* if no counterpart, return ch */
-othercase(wint_t ch, locale_t loc)
-{
-       assert(iswalpha_l(ch, loc));
-       if (iswupper_l(ch, loc))
-               return(towlower_l(ch, loc));
-       else if (iswlower_l(ch, loc))
-               return(towupper_l(ch, loc));
-       else                    /* peculiar, but could happen */
-               return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(struct parse *p, wint_t ch)
-{
-       char *oldnext = p->next;
-       char *oldend = p->end;
-       char bracket[3 + MB_LEN_MAX];
-       size_t n;
-       mbstate_t mbs;
-
-       assert(othercase(ch, p->g->loc) != ch); /* p_bracket() would recurse */
-       p->next = bracket;
-       memset(&mbs, 0, sizeof(mbs));
-       n = wcrtomb_l(bracket, ch, &mbs, p->g->loc);
-       assert(n != (size_t)-1);
-       bracket[n] = ']';
-       bracket[n + 1] = '\0';
-       p->end = bracket+n+1;
-       p_bracket(p);
-       assert(p->next == p->end);
-       p->next = oldnext;
-       p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(struct parse *p, int ch);
- */
-static void
-ordinary(struct parse *p, wint_t ch)
-{
-       cset *cs;
-
-       if ((p->g->cflags&REG_ICASE) && iswalpha_l(ch, p->g->loc) && othercase(ch, p->g->loc) != ch)
-               bothcases(p, ch);
-       else if ((ch & OPDMASK) == ch)
-               EMIT(OCHAR, ch);
-       else {
-               /*
-                * Kludge: character is too big to fit into an OCHAR operand.
-                * Emit a singleton set.
-                */
-               if ((cs = allocset(p)) == NULL)
-                       return;
-               CHadd(p, cs, ch);
-               EMIT(OANYOF, (int)(cs - p->g->sets));
-       }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(struct parse *p)
-{
-       char *oldnext = p->next;
-       char *oldend = p->end;
-       char bracket[4];
-
-       p->next = bracket;
-       p->end = bracket+3;
-       bracket[0] = '^';
-       bracket[1] = '\n';
-       bracket[2] = ']';
-       bracket[3] = '\0';
-       p_bracket(p);
-       assert(p->next == bracket+3);
-       p->next = oldnext;
-       p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(struct parse *p,
-       sopno start,            /* operand from here to end of strip */
-       int from,               /* repeated from this number */
-       int to)                 /* to this number of times (maybe INFINITY) */
-{
-       sopno finish = HERE();
-#      define  N       2
-#      define  INF     3
-#      define  REP(f, t)       ((f)*8 + (t))
-#      define  MAP(n)  (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
-       sopno copy;
-
-       if (p->error != 0)      /* head off possible runaway recursion */
-               return;
-
-       assert(from <= to);
-
-       switch (REP(MAP(from), MAP(to))) {
-       case REP(0, 0):                 /* must be user doing this */
-               DROP(finish-start);     /* drop the operand */
-#if __DARWIN_UNIX03
-               p->zerorepeats++;
-#endif /* __DARWIN_UNIX03 */
-               break;
-       case REP(0, INF):               /* as x{1,}? */
-#if __DARWIN_UNIX03
-               /* this case does not require the (y|) trick, noKLUDGE */
-               /* Just like * =+?  */
-               INSERT(OPLUS_, start);
-               ASTERN(O_PLUS, start);
-               INSERT(OQUEST_, start);
-               ASTERN(O_QUEST, start);
-               break;
-#endif /* __DARWIN_UNIX03 */
-       case REP(0, 1):                 /* as x{1,1}? */
-       case REP(0, N):                 /* as x{1,n}? */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);            /* offset is wrong... */
-               repeat(p, start+1, 1, to);
-               ASTERN(OOR1, start);
-               AHEAD(start);                   /* ... fix it */
-               EMIT(OOR2, 0);
-               AHEAD(THERE());
-               ASTERN(O_CH, THERETHERE());
-               break;
-       case REP(1, 1):                 /* trivial case */
-               /* done */
-               break;
-       case REP(1, N):                 /* as x?x{1,n-1} */
-#if __DARWIN_UNIX03
-               INSERT(OQUEST_, start);
-               ASTERN(O_QUEST, start);
-#else /* !__DARWIN_UNIX03 */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);
-               ASTERN(OOR1, start);
-               AHEAD(start);
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-#endif /* __DARWIN_UNIX03 */
-               copy = dupl(p, start+1, finish+1);
-               assert(copy == finish+4);
-               repeat(p, copy, 1, to-1);
-               break;
-       case REP(1, INF):               /* as x+ */
-               INSERT(OPLUS_, start);
-               ASTERN(O_PLUS, start);
-               break;
-       case REP(N, N):                 /* as xx{m-1,n-1} */
-               copy = dupl(p, start, finish);
-               repeat(p, copy, from-1, to-1);
-               break;
-       case REP(N, INF):               /* as xx{n-1,INF} */
-               copy = dupl(p, start, finish);
-               repeat(p, copy, from-1, to);
-               break;
-       default:                        /* "can't happen" */
-               SETERROR(REG_ASSERT);   /* just in case */
-               break;
-       }
-}
-
-/*
- - wgetnext - helper function for WGETNEXT() macro. Gets the next wide
- - character from the parse struct, signals a REG_ILLSEQ error if the
- - character can't be converted. Returns the number of bytes consumed.
- */
-static wint_t
-wgetnext(struct parse *p)
-{
-       mbstate_t mbs;
-       wchar_t wc;
-       size_t n;
-
-       memset(&mbs, 0, sizeof(mbs));
-       n = mbrtowc_l(&wc, p->next, p->end - p->next, &mbs, p->g->loc);
-       if (n == (size_t)-1 || n == (size_t)-2) {
-               SETERROR(REG_ILLSEQ);
-               return (0);
-       }
-       if (n == 0)
-               n = 1;
-       p->next += n;
-       return (wc);
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(struct parse *p, int e);
- */
-static int                     /* useless but makes type checking happy */
-seterr(struct parse *p, int e)
-{
-       if (p->error == 0)      /* keep earliest error condition */
-               p->error = e;
-       p->next = nuls;         /* try to bring things to a halt */
-       p->end = nuls;
-       return(0);              /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(struct parse *p);
- */
-static cset *
-allocset(struct parse *p)
-{
-       cset *cs, *ncs;
-
-       ncs = realloc(p->g->sets, (p->g->ncsets + 1) * sizeof(*ncs));
-       if (ncs == NULL) {
-               SETERROR(REG_ESPACE);
-               return (NULL);
-       }
-       p->g->sets = ncs;
-       cs = &p->g->sets[p->g->ncsets++];
-       memset(cs, 0, sizeof(*cs));
-
-       return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(struct parse *p, cset *cs);
- */
-static void
-freeset(struct parse *p, cset *cs)
-{
-       cset *top = &p->g->sets[p->g->ncsets];
-
-       free(cs->wides);
-       free(cs->ranges);
-       free(cs->types);
-       memset(cs, 0, sizeof(*cs));
-       if (cs == top-1)        /* recover only the easy case */
-               p->g->ncsets--;
-}
-
-/*
- - singleton - Determine whether a set contains only one character,
- - returning it if so, otherwise returning OUT.
- */
-static wint_t
-singleton(cset *cs, locale_t loc)
-{
-       wint_t i, s, n;
-
-       for (i = n = 0; i < NC; i++)
-               if (CHIN(cs, i, loc)) {
-                       n++;
-                       s = i;
-               }
-       if (n == 1)
-               return (s);
-       if (cs->nwides == 1 && cs->nranges == 0 && cs->ntypes == 0 &&
-           cs->icase == 0)
-               return (cs->wides[0]);
-       /* Don't bother handling the other cases. */
-       return (OUT);
-}
-
-/*
- - CHadd - add character to character set.
- */
-static void
-CHadd(struct parse *p, cset *cs, wint_t ch)
-{
-       wint_t nch, *newwides;
-       assert(ch >= 0);
-       if (ch < NC)
-               cs->bmp[ch >> 3] |= 1 << (ch & 7);
-       else {
-               newwides = realloc(cs->wides, (cs->nwides + 1) *
-                   sizeof(*cs->wides));
-               if (newwides == NULL) {
-                       SETERROR(REG_ESPACE);
-                       return;
-               }
-               cs->wides = newwides;
-               cs->wides[cs->nwides++] = ch;
-       }
-       if (cs->icase) {
-               if ((nch = towlower_l(ch, p->g->loc)) < NC)
-                       cs->bmp[nch >> 3] |= 1 << (nch & 7);
-               if ((nch = towupper_l(ch, p->g->loc)) < NC)
-                       cs->bmp[nch >> 3] |= 1 << (nch & 7);
-       }
-}
-
-/*
- - CHaddrange - add all characters in the range [min,max] to a character set.
- */
-static void
-CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max)
-{
-       crange *newranges;
-
-       for (; min < NC && min <= max; min++)
-               CHadd(p, cs, min);
-       if (min >= max)
-               return;
-       newranges = realloc(cs->ranges, (cs->nranges + 1) *
-           sizeof(*cs->ranges));
-       if (newranges == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       cs->ranges = newranges;
-       cs->ranges[cs->nranges].min = min;
-       cs->ranges[cs->nranges].min = max;
-       cs->nranges++;
-}
-
-/*
- - CHaddtype - add all characters of a certain type to a character set.
- */
-static void
-CHaddtype(struct parse *p, cset *cs, wctype_t wct)
-{
-       wint_t i;
-       wctype_t *newtypes;
-
-       for (i = 0; i < NC; i++)
-               if (iswctype_l(i, wct, p->g->loc))
-                       CHadd(p, cs, i);
-       newtypes = realloc(cs->types, (cs->ntypes + 1) *
-           sizeof(*cs->types));
-       if (newtypes == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       cs->types = newtypes;
-       cs->types[cs->ntypes++] = wct;
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(struct parse *p, sopno start, sopno finish);
- */
-static sopno                   /* start of duplicate */
-dupl(struct parse *p,
-       sopno start,            /* from here */
-       sopno finish)           /* to this less one */
-{
-       sopno ret = HERE();
-       sopno len = finish - start;
-
-       assert(finish >= start);
-       if (len == 0)
-               return(ret);
-       enlarge(p, p->ssize + len);     /* this many unexpected additions */
-       assert(p->ssize >= p->slen + len);
-       (void) memcpy((char *)(p->strip + p->slen),
-               (char *)(p->strip + start), (size_t)len*sizeof(sop));
-       p->slen += len;
-       return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures.  Maybe later.
- */
-static void
-doemit(struct parse *p, sop op, size_t opnd)
-{
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       /* deal with oversize operands ("can't happen", more or less) */
-       assert(opnd < 1<<OPSHIFT);
-
-       /* deal with undersized strip */
-       if (p->slen >= p->ssize)
-               enlarge(p, (p->ssize+1) / 2 * 3);       /* +50% */
-       assert(p->slen < p->ssize);
-
-       /* finally, it's all reduced to the easy case */
-       p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(struct parse *p, sop op, size_t opnd, sopno pos)
-{
-       sopno sn;
-       sop s;
-       int i;
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       sn = HERE();
-       EMIT(op, opnd);         /* do checks, ensure space */
-       assert(HERE() == sn+1);
-       s = p->strip[sn];
-
-       /* adjust paren pointers */
-       assert(pos > 0);
-       for (i = 1; i < NPAREN; i++) {
-               if (p->pbegin[i] >= pos) {
-                       p->pbegin[i]++;
-               }
-               if (p->pend[i] >= pos) {
-                       p->pend[i]++;
-               }
-       }
-
-       memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
-                                               (HERE()-pos-1)*sizeof(sop));
-       p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(struct parse *p, sopno pos, sop value)
-{
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       assert(value < 1<<OPSHIFT);
-       p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(struct parse *p, sopno size);
- */
-static void
-enlarge(struct parse *p, sopno size)
-{
-       sop *sp;
-
-       if (p->ssize >= size)
-               return;
-
-       sp = (sop *)realloc(p->strip, size*sizeof(sop));
-       if (sp == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       p->strip = sp;
-       p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(struct parse *p, struct re_guts *g);
- */
-static void
-stripsnug(struct parse *p, struct re_guts *g)
-{
-       g->nstates = p->slen;
-       g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
-       if (g->strip == NULL) {
-               SETERROR(REG_ESPACE);
-               g->strip = p->strip;
-       }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(struct parse *p, struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences.  Someday.  This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(struct parse *p, struct re_guts *g)
-{
-       sop *scan;
-       sop *start;
-       sop *newstart;
-       sopno newlen;
-       sop s;
-       char *cp;
-       int offset;
-       char buf[MB_LEN_MAX];
-       size_t clen;
-       mbstate_t mbs;
-       struct __xlocale_st_runelocale *rl = p->g->loc->__lc_ctype;
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       /*
-        * It's not generally safe to do a ``char'' substring search on
-        * multibyte character strings, but it's safe for at least
-        * UTF-8 (see RFC 3629).
-        */
-       if (rl->__mb_cur_max > 1 &&
-           strcmp(rl->_CurrentRuneLocale.__encoding, "UTF-8") != 0)
-               return;
-
-       /* find the longest OCHAR sequence in strip */
-       newlen = 0;
-       offset = 0;
-       g->moffset = 0;
-       scan = g->strip + 1;
-       do {
-               s = *scan++;
-               switch (OP(s)) {
-               case OCHAR:             /* sequence member */
-                       if (newlen == 0) {              /* new sequence */
-                               memset(&mbs, 0, sizeof(mbs));
-                               newstart = scan - 1;
-                       }
-                       clen = wcrtomb_l(buf, OPND(s), &mbs, p->g->loc);
-                       if (clen == (size_t)-1)
-                               goto toohard;
-                       newlen += clen;
-                       break;
-               case OPLUS_:            /* things that don't break one */
-               case OLPAREN:
-               case ORPAREN:
-                       break;
-               case OQUEST_:           /* things that must be skipped */
-               case OCH_:
-                       offset = altoffset(scan, offset);
-                       scan--;
-                       do {
-                               scan += OPND(s);
-                               s = *scan;
-                               /* assert() interferes w debug printouts */
-                               if (OP(s) != O_QUEST && OP(s) != O_CH &&
-                                                       OP(s) != OOR2) {
-                                       g->iflags |= BAD;
-                                       return;
-                               }
-                       } while (OP(s) != O_QUEST && OP(s) != O_CH);
-                       /* FALLTHROUGH */
-               case OBOW:              /* things that break a sequence */
-               case OEOW:
-               case OBOL:
-               case OEOL:
-               case O_QUEST:
-               case O_CH:
-               case OEND:
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1) {
-                                       g->moffset += offset;
-                                       offset = newlen;
-                               } else
-                                       g->moffset = offset;
-                       } else {
-                               if (offset > -1)
-                                       offset += newlen;
-                       }
-                       newlen = 0;
-                       break;
-               case OANY:
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1) {
-                                       g->moffset += offset;
-                                       offset = newlen;
-                               } else
-                                       g->moffset = offset;
-                       } else {
-                               if (offset > -1)
-                                       offset += newlen;
-                       }
-                       if (offset > -1)
-                               offset++;
-                       newlen = 0;
-                       break;
-               case OANYOF:            /* may or may not invalidate offset */
-                       /* First, everything as OANY */
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1) {
-                                       g->moffset += offset;
-                                       offset = newlen;
-                               } else
-                                       g->moffset = offset;
-                       } else {
-                               if (offset > -1)
-                                       offset += newlen;
-                       }
-                       if (offset > -1)
-                               offset++;
-                       newlen = 0;
-                       break;
-               toohard:
-               default:
-                       /* Anything here makes it impossible or too hard
-                        * to calculate the offset -- so we give up;
-                        * save the last known good offset, in case the
-                        * must sequence doesn't occur later.
-                        */
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                               if (offset > -1)
-                                       g->moffset += offset;
-                               else
-                                       g->moffset = offset;
-                       }
-                       offset = -1;
-                       newlen = 0;
-                       break;
-               }
-       } while (OP(s) != OEND);
-
-       if (g->mlen == 0) {             /* there isn't one */
-               g->moffset = -1;
-               return;
-       }
-
-       /* turn it into a character string */
-       g->must = malloc((size_t)g->mlen + 1);
-       if (g->must == NULL) {          /* argh; just forget it */
-               g->mlen = 0;
-               g->moffset = -1;
-               return;
-       }
-       cp = g->must;
-       scan = start;
-       memset(&mbs, 0, sizeof(mbs));
-       while (cp < g->must + g->mlen) {
-               while (OP(s = *scan++) != OCHAR)
-                       continue;
-               clen = wcrtomb_l(cp, OPND(s), &mbs, p->g->loc);
-               assert(clen != (size_t)-1);
-               cp += clen;
-       }
-       assert(cp == g->must + g->mlen);
-       *cp++ = '\0';           /* just on general principles */
-}
-
-/*
- - altoffset - choose biggest offset among multiple choices
- == static int altoffset(sop *scan, int offset);
- *
- * Compute, recursively if necessary, the largest offset among multiple
- * re paths.
- */
-static int
-altoffset(sop *scan, int offset)
-{
-       int largest;
-       int try;
-       sop s;
-
-       /* If we gave up already on offsets, return */
-       if (offset == -1)
-               return -1;
-
-       largest = 0;
-       try = 0;
-       s = *scan++;
-       while (OP(s) != O_QUEST && OP(s) != O_CH) {
-               switch (OP(s)) {
-               case OOR1:
-                       if (try > largest)
-                               largest = try;
-                       try = 0;
-                       break;
-               case OQUEST_:
-               case OCH_:
-                       try = altoffset(scan, try);
-                       if (try == -1)
-                               return -1;
-                       scan--;
-                       do {
-                               scan += OPND(s);
-                               s = *scan;
-                               if (OP(s) != O_QUEST && OP(s) != O_CH &&
-                                                       OP(s) != OOR2)
-                                       return -1;
-                       } while (OP(s) != O_QUEST && OP(s) != O_CH);
-                       /* We must skip to the next position, or we'll
-                        * leave altoffset() too early.
-                        */
-                       scan++;
-                       break;
-               case OANYOF:
-               case OCHAR:
-               case OANY:
-                       try++;
-               case OBOW:
-               case OEOW:
-               case OLPAREN:
-               case ORPAREN:
-               case OOR2:
-                       break;
-               default:
-                       try = -1;
-                       break;
-               }
-               if (try == -1)
-                       return -1;
-               s = *scan++;
-       }
-
-       if (try > largest)
-               largest = try;
-
-       return largest+offset;
-}
-
-/*
- - computejumps - compute char jumps for BM scan
- == static void computejumps(struct parse *p, struct re_guts *g);
- *
- * This algorithm assumes g->must exists and is has size greater than
- * zero. It's based on the algorithm found on Computer Algorithms by
- * Sara Baase.
- *
- * A char jump is the number of characters one needs to jump based on
- * the value of the character from the text that was mismatched.
- */
-static void
-computejumps(struct parse *p, struct re_guts *g)
-{
-       int ch;
-       int mindex;
-
-       /* Avoid making errors worse */
-       if (p->error != 0)
-               return;
-
-       g->charjump = (int*) malloc((NC + 1) * sizeof(int));
-       if (g->charjump == NULL)        /* Not a fatal error */
-               return;
-       /* Adjust for signed chars, if necessary */
-       g->charjump = &g->charjump[-(CHAR_MIN)];
-
-       /* If the character does not exist in the pattern, the jump
-        * is equal to the number of characters in the pattern.
-        */
-       for (ch = CHAR_MIN; ch < (CHAR_MAX + 1); ch++)
-               g->charjump[ch] = g->mlen;
-
-       /* If the character does exist, compute the jump that would
-        * take us to the last character in the pattern equal to it
-        * (notice that we match right to left, so that last character
-        * is the first one that would be matched).
-        */
-       for (mindex = 0; mindex < g->mlen; mindex++)
-               g->charjump[(int)g->must[mindex]] = g->mlen - mindex - 1;
-}
-
-/*
- - computematchjumps - compute match jumps for BM scan
- == static void computematchjumps(struct parse *p, struct re_guts *g);
- *
- * This algorithm assumes g->must exists and is has size greater than
- * zero. It's based on the algorithm found on Computer Algorithms by
- * Sara Baase.
- *
- * A match jump is the number of characters one needs to advance based
- * on the already-matched suffix.
- * Notice that all values here are minus (g->mlen-1), because of the way
- * the search algorithm works.
- */
-static void
-computematchjumps(struct parse *p, struct re_guts *g)
-{
-       int mindex;             /* General "must" iterator */
-       int suffix;             /* Keeps track of matching suffix */
-       int ssuffix;            /* Keeps track of suffixes' suffix */
-       int* pmatches;          /* pmatches[k] points to the next i
-                                * such that i+1...mlen is a substring
-                                * of k+1...k+mlen-i-1
-                                */
-
-       /* Avoid making errors worse */
-       if (p->error != 0)
-               return;
-
-       pmatches = (int*) malloc(g->mlen * sizeof(unsigned int));
-       if (pmatches == NULL) {
-               g->matchjump = NULL;
-               return;
-       }
-
-       g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int));
-       if (g->matchjump == NULL)       /* Not a fatal error */
-               return;
-
-       /* Set maximum possible jump for each character in the pattern */
-       for (mindex = 0; mindex < g->mlen; mindex++)
-               g->matchjump[mindex] = 2*g->mlen - mindex - 1;
-
-       /* Compute pmatches[] */
-       for (mindex = g->mlen - 1, suffix = g->mlen; mindex >= 0;
-           mindex--, suffix--) {
-               pmatches[mindex] = suffix;
-
-               /* If a mismatch is found, interrupting the substring,
-                * compute the matchjump for that position. If no
-                * mismatch is found, then a text substring mismatched
-                * against the suffix will also mismatch against the
-                * substring.
-                */
-               while (suffix < g->mlen
-                   && g->must[mindex] != g->must[suffix]) {
-                       g->matchjump[suffix] = MIN(g->matchjump[suffix],
-                           g->mlen - mindex - 1);
-                       suffix = pmatches[suffix];
-               }
-       }
-
-       /* Compute the matchjump up to the last substring found to jump
-        * to the beginning of the largest must pattern prefix matching
-        * it's own suffix.
-        */
-       for (mindex = 0; mindex <= suffix; mindex++)
-               g->matchjump[mindex] = MIN(g->matchjump[mindex],
-                   g->mlen + suffix - mindex);
-
-        ssuffix = pmatches[suffix];
-        while (suffix < g->mlen) {
-                while (suffix <= ssuffix && suffix < g->mlen) {
-                        g->matchjump[suffix] = MIN(g->matchjump[suffix],
-                           g->mlen + ssuffix - suffix);
-                        suffix++;
-                }
-               if (suffix < g->mlen)
-                       ssuffix = pmatches[ssuffix];
-        }
-
-       free(pmatches);
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(struct parse *p, struct re_guts *g);
- */
-static sopno                   /* nesting depth */
-pluscount(struct parse *p, struct re_guts *g)
-{
-       sop *scan;
-       sop s;
-       sopno plusnest = 0;
-       sopno maxnest = 0;
-
-       if (p->error != 0)
-               return(0);      /* there may not be an OEND */
-
-       scan = g->strip + 1;
-       do {
-               s = *scan++;
-               switch (OP(s)) {
-               case OPLUS_:
-                       plusnest++;
-                       break;
-               case O_PLUS:
-                       if (plusnest > maxnest)
-                               maxnest = plusnest;
-                       plusnest--;
-                       break;
-               }
-       } while (OP(s) != OEND);
-       if (plusnest != 0)
-               g->iflags |= BAD;
-       return(maxnest);
-}
diff --git a/regex/regerror-fbsd.c b/regex/regerror-fbsd.c
deleted file mode 100644 (file)
index a22066c..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regerror.c  8.4 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regerror.c,v 1.11 2007/06/11 03:05:54 delphij Exp $");
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-/*
- = #define     REG_NOMATCH      1
- = #define     REG_BADPAT       2
- = #define     REG_ECOLLATE     3
- = #define     REG_ECTYPE       4
- = #define     REG_EESCAPE      5
- = #define     REG_ESUBREG      6
- = #define     REG_EBRACK       7
- = #define     REG_EPAREN       8
- = #define     REG_EBRACE       9
- = #define     REG_BADBR       10
- = #define     REG_ERANGE      11
- = #define     REG_ESPACE      12
- = #define     REG_BADRPT      13
- = #define     REG_EMPTY       14
- = #define     REG_ASSERT      15
- = #define     REG_INVARG      16
- = #define     REG_ILLSEQ      17
- = #define     REG_ATOI        255     // convert name to number (!)
- = #define     REG_ITOA        0400    // convert number to name (!)
- */
-static const struct rerr {
-       int code;
-       const char *name;
-       const char *explain;
-} rerrs[] = {
-       {REG_NOMATCH,   "REG_NOMATCH",  "regexec() failed to match"},
-       {REG_BADPAT,    "REG_BADPAT",   "invalid regular expression"},
-       {REG_ECOLLATE,  "REG_ECOLLATE", "invalid collating element"},
-       {REG_ECTYPE,    "REG_ECTYPE",   "invalid character class"},
-       {REG_EESCAPE,   "REG_EESCAPE",  "trailing backslash (\\)"},
-       {REG_ESUBREG,   "REG_ESUBREG",  "invalid backreference number"},
-       {REG_EBRACK,    "REG_EBRACK",   "brackets ([ ]) not balanced"},
-       {REG_EPAREN,    "REG_EPAREN",   "parentheses not balanced"},
-       {REG_EBRACE,    "REG_EBRACE",   "braces not balanced"},
-       {REG_BADBR,     "REG_BADBR",    "invalid repetition count(s)"},
-       {REG_ERANGE,    "REG_ERANGE",   "invalid character range"},
-       {REG_ESPACE,    "REG_ESPACE",   "out of memory"},
-       {REG_BADRPT,    "REG_BADRPT",   "repetition-operator operand invalid"},
-       {REG_EMPTY,     "REG_EMPTY",    "empty (sub)expression"},
-       {REG_ASSERT,    "REG_ASSERT",   "\"can't happen\" -- you found a bug"},
-       {REG_INVARG,    "REG_INVARG",   "invalid argument to regex routine"},
-       {REG_ILLSEQ,    "REG_ILLSEQ",   "illegal byte sequence"},
-       {0,             "",             "*** unknown regexp error code ***"}
-};
-
-/*
- - regerror - the interface to error numbers
- = extern size_t regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-size_t
-regerror(int errcode,
-        const regex_t * __restrict preg,
-        char * __restrict errbuf,
-        size_t errbuf_size)
-{
-       const struct rerr *r;
-       size_t len;
-       int target = errcode &~ REG_ITOA;
-       const char *s;
-       char convbuf[50];
-
-       if (errcode == REG_ATOI)
-               s = regatoi(preg, convbuf);
-       else {
-               for (r = rerrs; r->code != 0; r++)
-                       if (r->code == target)
-                               break;
-
-               if (errcode&REG_ITOA) {
-                       if (r->code != 0)
-                               (void) strcpy(convbuf, r->name);
-                       else
-                               sprintf(convbuf, "REG_0x%x", target);
-                       assert(strlen(convbuf) < sizeof(convbuf));
-                       s = convbuf;
-               } else
-                       s = r->explain;
-       }
-
-       len = strlen(s) + 1;
-       if (errbuf_size > 0) {
-               if (errbuf_size > len)
-                       (void) strcpy(errbuf, s);
-               else {
-                       (void) strncpy(errbuf, s, errbuf_size-1);
-                       errbuf[errbuf_size-1] = '\0';
-               }
-       }
-
-       return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(const regex_t *preg, char *localbuf)
-{
-       const struct rerr *r;
-
-       for (r = rerrs; r->code != 0; r++)
-               if (strcmp(r->name, preg->re_endp) == 0)
-                       break;
-       if (r->code == 0)
-               return("0");
-
-       sprintf(localbuf, "%d", r->code);
-       return(localbuf);
-}
diff --git a/regex/regerror-fbsd.c.orig b/regex/regerror-fbsd.c.orig
deleted file mode 100644 (file)
index 9364bd4..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regerror.c  8.4 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regerror.c,v 1.11 2007/06/11 03:05:54 delphij Exp $");
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-/*
- = #define     REG_NOMATCH      1
- = #define     REG_BADPAT       2
- = #define     REG_ECOLLATE     3
- = #define     REG_ECTYPE       4
- = #define     REG_EESCAPE      5
- = #define     REG_ESUBREG      6
- = #define     REG_EBRACK       7
- = #define     REG_EPAREN       8
- = #define     REG_EBRACE       9
- = #define     REG_BADBR       10
- = #define     REG_ERANGE      11
- = #define     REG_ESPACE      12
- = #define     REG_BADRPT      13
- = #define     REG_EMPTY       14
- = #define     REG_ASSERT      15
- = #define     REG_INVARG      16
- = #define     REG_ILLSEQ      17
- = #define     REG_ATOI        255     // convert name to number (!)
- = #define     REG_ITOA        0400    // convert number to name (!)
- */
-static struct rerr {
-       int code;
-       char *name;
-       char *explain;
-} rerrs[] = {
-       {REG_NOMATCH,   "REG_NOMATCH",  "regexec() failed to match"},
-       {REG_BADPAT,    "REG_BADPAT",   "invalid regular expression"},
-       {REG_ECOLLATE,  "REG_ECOLLATE", "invalid collating element"},
-       {REG_ECTYPE,    "REG_ECTYPE",   "invalid character class"},
-       {REG_EESCAPE,   "REG_EESCAPE",  "trailing backslash (\\)"},
-       {REG_ESUBREG,   "REG_ESUBREG",  "invalid backreference number"},
-       {REG_EBRACK,    "REG_EBRACK",   "brackets ([ ]) not balanced"},
-       {REG_EPAREN,    "REG_EPAREN",   "parentheses not balanced"},
-       {REG_EBRACE,    "REG_EBRACE",   "braces not balanced"},
-       {REG_BADBR,     "REG_BADBR",    "invalid repetition count(s)"},
-       {REG_ERANGE,    "REG_ERANGE",   "invalid character range"},
-       {REG_ESPACE,    "REG_ESPACE",   "out of memory"},
-       {REG_BADRPT,    "REG_BADRPT",   "repetition-operator operand invalid"},
-       {REG_EMPTY,     "REG_EMPTY",    "empty (sub)expression"},
-       {REG_ASSERT,    "REG_ASSERT",   "\"can't happen\" -- you found a bug"},
-       {REG_INVARG,    "REG_INVARG",   "invalid argument to regex routine"},
-       {REG_ILLSEQ,    "REG_ILLSEQ",   "illegal byte sequence"},
-       {0,             "",             "*** unknown regexp error code ***"}
-};
-
-/*
- - regerror - the interface to error numbers
- = extern size_t regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-size_t
-regerror(int errcode,
-        const regex_t * __restrict preg,
-        char * __restrict errbuf,
-        size_t errbuf_size)
-{
-       struct rerr *r;
-       size_t len;
-       int target = errcode &~ REG_ITOA;
-       char *s;
-       char convbuf[50];
-
-       if (errcode == REG_ATOI)
-               s = regatoi(preg, convbuf);
-       else {
-               for (r = rerrs; r->code != 0; r++)
-                       if (r->code == target)
-                               break;
-
-               if (errcode&REG_ITOA) {
-                       if (r->code != 0)
-                               (void) strcpy(convbuf, r->name);
-                       else
-                               sprintf(convbuf, "REG_0x%x", target);
-                       assert(strlen(convbuf) < sizeof(convbuf));
-                       s = convbuf;
-               } else
-                       s = r->explain;
-       }
-
-       len = strlen(s) + 1;
-       if (errbuf_size > 0) {
-               if (errbuf_size > len)
-                       (void) strcpy(errbuf, s);
-               else {
-                       (void) strncpy(errbuf, s, errbuf_size-1);
-                       errbuf[errbuf_size-1] = '\0';
-               }
-       }
-
-       return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(const regex_t *preg, char *localbuf)
-{
-       struct rerr *r;
-
-       for (r = rerrs; r->code != 0; r++)
-               if (strcmp(r->name, preg->re_endp) == 0)
-                       break;
-       if (r->code == 0)
-               return("0");
-
-       sprintf(localbuf, "%d", r->code);
-       return(localbuf);
-}
diff --git a/regex/regex.3 b/regex/regex.3
deleted file mode 100644 (file)
index dc3b5bf..0000000
+++ /dev/null
@@ -1,735 +0,0 @@
-.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
-.\" Copyright (c) 1992, 1993, 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Henry Spencer.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)regex.3     8.4 (Berkeley) 3/20/94
-.\" $FreeBSD: src/lib/libc/regex/regex.3,v 1.21 2007/01/09 00:28:04 imp Exp $
-.\"
-.Dd August 17, 2005
-.Dt REGEX 3
-.Os
-.Sh NAME
-.Nm regcomp ,
-.Nm regerror ,
-.Nm regexec ,
-.Nm regfree
-.Nd regular-expression library
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In regex.h
-.Ft int
-.Fo regcomp
-.Fa "regex_t *restrict preg"
-.Fa "const char *restrict pattern"
-.Fa "int cflags"
-.Fc
-.Ft size_t
-.Fo regerror
-.Fa "int errcode"
-.Fa "const regex_t *restrict preg"
-.Fa "char *restrict errbuf"
-.Fa "size_t errbuf_size"
-.Fc
-.Ft int
-.Fo regexec
-.Fa "const regex_t *restrict preg"
-.Fa "const char *restrict string"
-.Fa "size_t nmatch"
-.Fa "regmatch_t pmatch[restrict]"
-.Fa "int eflags"
-.Fc
-.Ft void
-.Fo regfree
-.Fa "regex_t *preg"
-.Fc
-.Sh DESCRIPTION
-These routines implement
-.St -p1003.2
-regular expressions
-.Pq Do RE Dc Ns s ;
-see
-.Xr re_format 7 .
-The
-.Fn regcomp
-function
-compiles an RE, written as a string, into an internal form.
-.Fn regexec
-matches that internal form against a string and reports results.
-.Fn regerror
-transforms error codes from either into human-readable messages.
-.Fn regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.Pp
-The header
-.In regex.h
-declares two structure types,
-.Ft regex_t
-and
-.Ft regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.Ft regoff_t ,
-and a number of constants with names starting with
-.Dq Dv REG_ .
-.Pp
-The
-.Fn regcomp
-function
-compiles the regular expression contained in the
-.Fa pattern
-string,
-subject to the flags in
-.Fa cflags ,
-and places the results in the
-.Ft regex_t
-structure pointed to by
-.Fa preg .
-The
-.Fa cflags
-argument
-is the bitwise OR of zero or more of the following flags:
-.Bl -tag -width REG_EXTENDED
-.It Dv REG_EXTENDED
-Compile modern
-.Pq Dq extended
-REs,
-rather than the obsolete
-.Pq Dq basic
-REs that
-are the default.
-.It Dv REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to
-.Dv REG_EXTENDED
-to improve readability.
-.It Dv REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the
-.Dq RE
-is a literal string.
-This is an extension,
-compatible with but not specified by
-.St -p1003.2 ,
-and should be used with
-caution in software intended to be portable to other systems.
-.Dv REG_EXTENDED
-and
-.Dv REG_NOSPEC
-may not be used
-in the same call to
-.Fn regcomp .
-.It Dv REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.Xr re_format 7 .
-.It Dv REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.It Dv REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-.Ql [^
-bracket expressions and
-.Ql .\&
-never match newline,
-a
-.Ql ^\&
-anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the
-.Ql $\&
-anchor matches the null string before any newline in the
-string in addition to its normal function.
-.It Dv REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.Va re_endp
-member of the structure pointed to by
-.Fa preg .
-The
-.Va re_endp
-member is of type
-.Ft "const char *" .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by
-.St -p1003.2 ,
-and should be used with
-caution in software intended to be portable to other systems.
-.El
-.Pp
-When successful,
-.Fn regcomp
-returns 0 and fills in the structure pointed to by
-.Fa preg .
-One member of that structure
-(other than
-.Va re_endp )
-is publicized:
-.Va re_nsub ,
-of type
-.Ft size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-.Dv REG_NOSUB
-flag was used).
-If
-.Fn regcomp
-fails, it returns a non-zero error code;
-see
-.Sx DIAGNOSTICS .
-.Pp
-The
-.Fn regexec
-function
-matches the compiled RE pointed to by
-.Fa preg
-against the
-.Fa string ,
-subject to the flags in
-.Fa eflags ,
-and reports results using
-.Fa nmatch ,
-.Fa pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.Fn regcomp .
-The compiled form is not altered during execution of
-.Fn regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.Pp
-By default,
-the NUL-terminated string pointed to by
-.Fa string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.Fa eflags
-argument is the bitwise OR of zero or more of the following flags:
-.Bl -tag -width REG_STARTEND
-.It Dv REG_NOTBOL
-The first character of
-the string
-is not the beginning of a line, so the
-.Ql ^\&
-anchor should not match before it.
-This does not affect the behavior of newlines under
-.Dv REG_NEWLINE .
-.It Dv REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the
-.Ql $\&
-anchor should not match before it.
-This does not affect the behavior of newlines under
-.Dv REG_NEWLINE .
-.It Dv REG_STARTEND
-The string is considered to start at
-.Fa string
-+
-.Fa pmatch Ns [0]. Ns Va rm_so
-and to have a terminating NUL located at
-.Fa string
-+
-.Fa pmatch Ns [0]. Ns Va rm_eo
-(there need not actually be a NUL at that location),
-regardless of the value of
-.Fa nmatch .
-See below for the definition of
-.Fa pmatch
-and
-.Fa nmatch .
-This is an extension,
-compatible with but not specified by
-.St -p1003.2 ,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero
-.Va rm_so
-does not imply
-.Dv REG_NOTBOL ;
-.Dv REG_STARTEND
-affects only the location of the string,
-not how it is matched.
-.El
-.Pp
-See
-.Xr re_format 7
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.Fa string .
-.Pp
-Normally,
-.Fn regexec
-returns 0 for success and the non-zero code
-.Dv REG_NOMATCH
-for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see
-.Sx DIAGNOSTICS .
-.Pp
-If
-.Dv REG_NOSUB
-was specified in the compilation of the RE,
-or if
-.Fa nmatch
-is 0,
-.Fn regexec
-ignores the
-.Fa pmatch
-argument (but see below for the case where
-.Dv REG_STARTEND
-is specified).
-Otherwise,
-.Fa pmatch
-points to an array of
-.Fa nmatch
-structures of type
-.Ft regmatch_t .
-Such a structure has at least the members
-.Va rm_so
-and
-.Va rm_eo ,
-both of type
-.Ft regoff_t
-(a signed arithmetic type at least as large as an
-.Ft off_t
-and a
-.Ft ssize_t ) ,
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.Fa string
-argument given to
-.Fn regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.Pp
-The 0th member of the
-.Fa pmatch
-array is filled in to indicate what substring of
-.Fa string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.Va i
-reports subexpression
-.Va i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array (corresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is,
-.Va i
->
-.Fa preg Ns -> Ns Va re_nsub ) )
-have both
-.Va rm_so
-and
-.Va rm_eo
-set to -1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE
-.Ql "(b*)+"
-matches
-.Ql bbb ,
-the parenthesized subexpression matches each of the three
-.So Li b Sc Ns s
-and then
-an infinite number of empty strings following the last
-.Ql b ,
-so the reported substring is one of the empties.)
-.Pp
-If
-.Dv REG_STARTEND
-is specified,
-.Fa pmatch
-must point to at least one
-.Ft regmatch_t
-(even if
-.Fa nmatch
-is 0 or
-.Dv REG_NOSUB
-was specified),
-to hold the input offsets for
-.Dv REG_STARTEND .
-Use for output is still entirely controlled by
-.Fa nmatch ;
-if
-.Fa nmatch
-is 0 or
-.Dv REG_NOSUB
-was specified,
-the value of
-.Fa pmatch Ns [0]
-will not be changed by a successful
-.Fn regexec .
-.Pp
-The
-.Fn regerror
-function
-maps a non-zero
-.Fa errcode
-from either
-.Fn regcomp
-or
-.Fn regexec
-to a human-readable, printable message.
-If
-.Fa preg
-is
-.No non\- Ns Dv NULL ,
-the error code should have arisen from use of
-the
-.Ft regex_t
-pointed to by
-.Fa preg ,
-and if the error code came from
-.Fn regcomp ,
-it should have been the result from the most recent
-.Fn regcomp
-using that
-.Ft regex_t .
-The
-.Fn ( regerror
-may be able to supply a more detailed message using information
-from the
-.Ft regex_t . )
-The
-.Fn regerror
-function
-places the NUL-terminated message into the buffer pointed to by
-.Fa errbuf ,
-limiting the length (including the NUL) to at most
-.Fa errbuf_size
-bytes.
-If the whole message will not fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.Fa errbuf_size
-is 0,
-.Fa errbuf
-is ignored but the return value is still correct.
-.Pp
-If the
-.Fa errcode
-given to
-.Fn regerror
-is first ORed with
-.Dv REG_ITOA ,
-the
-.Dq message
-that results is the printable name of the error code,
-e.g.\&
-.Dq Dv REG_NOMATCH ,
-rather than an explanation thereof.
-If
-.Fa errcode
-is
-.Dv REG_ATOI ,
-then
-.Fa preg
-shall be
-.No non\- Ns Dv NULL
-and the
-.Va re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.Fa errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-.Dv REG_ITOA
-and
-.Dv REG_ATOI
-are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by
-.St -p1003.2 ,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.Pp
-The
-.Fn regfree
-function
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.Fa preg .
-The remaining
-.Ft regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.Fn regexec
-or
-.Fn regerror
-is undefined.
-.Pp
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.Sh IMPLEMENTATION CHOICES
-There are a number of decisions that
-.St -p1003.2
-leaves up to the implementor,
-either by explicitly saying
-.Dq undefined
-or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.Pp
-See
-.Xr re_format 7
-for a discussion of the definition of case-independent matching.
-.Pp
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See
-.Sx BUGS
-for one short RE using them
-that will run almost any system out of memory.
-.Pp
-A backslashed character other than one specifically given a magic meaning
-by
-.St -p1003.2
-(such magic meanings occur only in obsolete
-.Bq Dq basic
-REs)
-is taken as an ordinary character.
-.Pp
-Any unmatched
-.Ql [\&
-is a
-.Dv REG_EBRACK
-error.
-.Pp
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.Pp
-.Dv RE_DUP_MAX ,
-the limit on repetition counts in bounded repetitions, is 255.
-.Pp
-A repetition operator
-.Ql ( ?\& ,
-.Ql *\& ,
-.Ql +\& ,
-or bounds)
-cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow
-.Ql ^\&
-or
-.Ql |\& .
-.Pp
-.Ql |\&
-cannot appear first or last in a (sub)expression or after another
-.Ql |\& ,
-i.e., an operand of
-.Ql |\&
-cannot be an empty subexpression.
-An empty parenthesized subexpression,
-.Ql "()" ,
-is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.Pp
-A
-.Ql {\&
-followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A
-.Ql {\&
-.Em not
-followed by a digit is considered an ordinary character.
-.Pp
-.Ql ^\&
-and
-.Ql $\&
-beginning and ending subexpressions in obsolete
-.Pq Dq basic
-REs are anchors, not ordinary characters.
-.Sh DIAGNOSTICS
-Non-zero error codes from
-.Fn regcomp
-and
-.Fn regexec
-include the following:
-.Pp
-.Bl -tag -width REG_ECOLLATE -compact
-.It Dv REG_NOMATCH
-The
-.Fn regexec
-function
-failed to match
-.It Dv REG_BADPAT
-invalid regular expression
-.It Dv REG_ECOLLATE
-invalid collating element
-.It Dv REG_ECTYPE
-invalid character class
-.It Dv REG_EESCAPE
-.Ql \e
-applied to unescapable character
-.It Dv REG_ESUBREG
-invalid backreference number
-.It Dv REG_EBRACK
-brackets
-.Ql "[ ]"
-not balanced
-.It Dv REG_EPAREN
-parentheses
-.Ql "( )"
-not balanced
-.It Dv REG_EBRACE
-braces
-.Ql "{ }"
-not balanced
-.It Dv REG_BADBR
-invalid repetition count(s) in
-.Ql "{ }"
-.It Dv REG_ERANGE
-invalid character range in
-.Ql "[ ]"
-.It Dv REG_ESPACE
-ran out of memory
-.It Dv REG_BADRPT
-.Ql ?\& ,
-.Ql *\& ,
-or
-.Ql +\&
-operand invalid
-.It Dv REG_EMPTY
-empty (sub)expression
-.It Dv REG_ASSERT
-cannot happen - you found a bug
-.It Dv REG_INVARG
-invalid argument, e.g.\& negative-length string
-.It Dv REG_ILLSEQ
-illegal byte sequence (bad multibyte character)
-.El
-.Sh SEE ALSO
-.Xr grep 1 ,
-.Xr re_format 7
-.Pp
-.St -p1003.2 ,
-sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.Sh HISTORY
-Originally written by
-.An Henry Spencer .
-Altered for inclusion in the
-.Bx 4.4
-distribution.
-.Sh BUGS
-This is an alpha release with known defects.
-Please report problems.
-.Pp
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.Pp
-The
-.Fn regexec
-function
-performance is poor.
-This will improve with later releases.
-The
-.Fa nmatch
-argument
-exceeding 0 is expensive;
-.Fa nmatch
-exceeding 1 is worse.
-The
-.Fn regexec
-function
-is largely insensitive to RE complexity
-.Em except
-that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.Pp
-The
-.Fn regcomp
-function
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-.Ql "((((a{1,100}){1,100}){1,100}){1,100}){1,100}"
-will (eventually) run almost any existing machine out of swap space.
-.Pp
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.Pp
-Due to a mistake in
-.St -p1003.2 ,
-things like
-.Ql "a)b"
-are legal REs because
-.Ql )\&
-is
-a special character only in the presence of a previous unmatched
-.Ql (\& .
-This cannot be fixed until the spec is fixed.
-.Pp
-The standard's definition of back references is vague.
-For example, does
-.Ql "a\e(\e(b\e)*\e2\e)*d"
-match
-.Ql "abbbd" ?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.Pp
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
-.Pp
-Word-boundary matching does not work properly in multibyte locales.
diff --git a/regex/regex2.h b/regex/regex2.h
deleted file mode 100644 (file)
index 8c0a49c..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regex2.h    8.4 (Berkeley) 3/20/94
- * $FreeBSD: src/lib/libc/regex/regex2.h,v 1.11 2007/01/09 00:28:04 imp Exp $
- */
-
-/*
- * First, the stuff that ends up in the outside-world include file
- = typedef off_t regoff_t;
- = typedef struct {
- =     int re_magic;
- =     size_t re_nsub;         // number of parenthesized subexpressions
- =     const char *re_endp;    // end pointer for REG_PEND
- =     struct re_guts *re_g;   // none of your business :-)
- = } regex_t;
- = typedef struct {
- =     regoff_t rm_so;         // start of match
- =     regoff_t rm_eo;         // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define        MAGIC1  ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker.  (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination.  Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- *   OOR1 and OOR2 are respectively the end and the beginning of one of
- *   the branches.  Note that there is an implicit OOR2 following OCH_
- *   and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef unsigned long sop;     /* strip operator */
-typedef long sopno;
-#define        OPRMASK 0xf8000000L
-#define        OPDMASK 0x07ffffffL
-#define        OPSHIFT ((unsigned)27)
-#define        OP(n)   ((n)&OPRMASK)
-#define        OPND(n) ((n)&OPDMASK)
-#define        SOP(op, opnd)   ((op)|(opnd))
-/* operators                      meaning      operand                 */
-/*                                             (back, fwd are offsets) */
-#define        OEND    (1L<<OPSHIFT)   /* endmarker    -                       */
-#define        OCHAR   (2L<<OPSHIFT)   /* character    wide character          */
-#define        OBOL    (3L<<OPSHIFT)   /* left anchor  -                       */
-#define        OEOL    (4L<<OPSHIFT)   /* right anchor -                       */
-#define        OANY    (5L<<OPSHIFT)   /* .            -                       */
-#define        OANYOF  (6L<<OPSHIFT)   /* [...]        set number              */
-#define        OBACK_  (7L<<OPSHIFT)   /* begin \d     paren number            */
-#define        O_BACK  (8L<<OPSHIFT)   /* end \d       paren number            */
-#define        OPLUS_  (9L<<OPSHIFT)   /* + prefix     fwd to suffix           */
-#define        O_PLUS  (10L<<OPSHIFT)  /* + suffix     back to prefix          */
-#define        OQUEST_ (11L<<OPSHIFT)  /* ? prefix     fwd to suffix           */
-#define        O_QUEST (12L<<OPSHIFT)  /* ? suffix     back to prefix          */
-#define        OLPAREN (13L<<OPSHIFT)  /* (            fwd to )                */
-#define        ORPAREN (14L<<OPSHIFT)  /* )            back to (               */
-#define        OCH_    (15L<<OPSHIFT)  /* begin choice fwd to OOR2             */
-#define        OOR1    (16L<<OPSHIFT)  /* | pt. 1      back to OOR1 or OCH_    */
-#define        OOR2    (17L<<OPSHIFT)  /* | pt. 2      fwd to OOR2 or O_CH     */
-#define        O_CH    (18L<<OPSHIFT)  /* end choice   back to OOR1            */
-#define        OBOW    (19L<<OPSHIFT)  /* begin word   -                       */
-#define        OEOW    (20L<<OPSHIFT)  /* end word     -                       */
-
-/*
- * Structures for [] character-set representation.
- */
-typedef struct {
-       wint_t          min;
-       wint_t          max;
-} crange;
-typedef struct {
-       unsigned char   bmp[NC / 8];
-       wctype_t        *types;
-       int             ntypes;
-       wint_t          *wides;
-       int             nwides;
-       crange          *ranges;
-       int             nranges;
-       int             invert;
-       int             icase;
-       int             *equiv_classes;
-       int             nequiv_classes;
-} cset;
-
-#include "collate.h"
-
-static int
-CHIN1(cset *cs, wint_t ch, locale_t loc)
-{
-       int i;
-
-       assert(ch >= 0);
-       for (i = 0; i < cs->nequiv_classes; i++)
-               /* sadly, we can only deal with single characters from an
-                * equivalence class */
-               if (__collate_equiv_match(cs->equiv_classes[i], NULL, 0, ch, NULL, 0, NULL, NULL, loc) > 0)
-                       return (!cs->invert);
-       if (ch < NC)
-               return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
-                   cs->invert);
-       for (i = 0; i < cs->nwides; i++)
-               if (ch == cs->wides[i])
-                       return (!cs->invert);
-       for (i = 0; i < cs->nranges; i++)
-               if (cs->ranges[i].min <= ch && ch <= cs->ranges[i].max)
-                       return (!cs->invert);
-       for (i = 0; i < cs->ntypes; i++)
-               if (iswctype_l(ch, cs->types[i], loc))
-                       return (!cs->invert);
-       return (cs->invert);
-}
-
-static __inline int
-CHIN(cset *cs, wint_t ch, locale_t loc)
-{
-
-       assert(ch >= 0);
-       if (ch < NC && cs->nequiv_classes == 0)
-               return (((cs->bmp[ch >> 3] & (1 << (ch & 7))) != 0) ^
-                   cs->invert);
-       else if (cs->icase)
-               return (CHIN1(cs, ch, loc) || CHIN1(cs, towlower_l(ch, loc), loc) ||
-                   CHIN1(cs, towupper_l(ch, loc), loc));
-       else
-               return (CHIN1(cs, ch, loc));
-}
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
-       int magic;
-#              define  MAGIC2  ((('R'^0200)<<8)|'E')
-       sop *strip;             /* malloced area for strip */
-       int ncsets;             /* number of csets in use */
-       cset *sets;             /* -> cset [ncsets] */
-       int cflags;             /* copy of regcomp() cflags argument */
-       sopno nstates;          /* = number of sops */
-       sopno firststate;       /* the initial OEND (normally 0) */
-       sopno laststate;        /* the final OEND */
-       int iflags;             /* internal flags */
-#              define  USEBOL  01      /* used ^ */
-#              define  USEEOL  02      /* used $ */
-#              define  BAD     04      /* something wrong */
-       int nbol;               /* number of ^ used */
-       int neol;               /* number of $ used */
-       char *must;             /* match must contain this string */
-       int moffset;            /* latest point at which must may be located */
-       int *charjump;          /* Boyer-Moore char jump table */
-       int *matchjump;         /* Boyer-Moore match jump table */
-       int mlen;               /* length of must */
-       size_t nsub;            /* copy of re_nsub */
-       int backrefs;           /* does it use back references? */
-       sopno nplus;            /* how deep does it nest +s? */
-       locale_t loc;           /* current locale */
-};
-
-/* misc utilities */
-#define        OUT     (CHAR_MIN - 2)  /* a non-character value */
-#define ISWORD(c,l)     (iswalnum_l((uch)(c), l) || (c) == '_')
diff --git a/regex/regexec-fbsd.c b/regex/regexec-fbsd.c
deleted file mode 100644 (file)
index 38c7281..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regexec.c   8.3 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regexec.c  8.3 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regexec.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
-
-#include "xlocale_private.h"
-
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c three times, after muchos fiddling with the
- * macros that code uses.  This lets the same code operate on two different
- * representations for state sets and characters.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-static int nope __unused = 0;  /* for use in asserts; shuts lint up */
-
-static __inline size_t
-xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy, locale_t loc)
-{
-       size_t nr;
-       wchar_t wc;
-
-       nr = mbrtowc_l(&wc, s, n, mbs, loc);
-       if (wi != NULL)
-               *wi = wc;
-       if (nr == 0)
-               return (1);
-       else if (nr == (size_t)-1 || nr == (size_t)-2) {
-               memset(mbs, 0, sizeof(*mbs));
-               if (wi != NULL)
-                       *wi = dummy;
-               return (1);
-       } else
-                return (nr);
-}
-
-static __inline size_t
-xmbrtowc_dummy(wint_t *wi,
-               const char *s,
-               size_t n __unused,
-               mbstate_t *mbs __unused,
-               wint_t dummy __unused,
-               locale_t loc __unused)
-{
-
-       if (wi != NULL)
-               *wi = (unsigned char)*s;
-       return (1);
-}
-
-/* macros for manipulating states, small version */
-#define        states  long
-#define        states1 states          /* for later use in regexec() decision */
-#define        CLEAR(v)        ((v) = 0)
-#define        SET0(v, n)      ((v) &= ~((unsigned long)1 << (n)))
-#define        SET1(v, n)      ((v) |= (unsigned long)1 << (n))
-#define        ISSET(v, n)     (((v) & ((unsigned long)1 << (n))) != 0)
-#define        ASSIGN(d, s)    ((d) = (s))
-#define        EQ(a, b)        ((a) == (b))
-#define        STATEVARS       long dummy      /* dummy version */
-#define        STATESETUP(m, n)        /* nothing */
-#define        STATETEARDOWN(m)        /* nothing */
-#define        SETUP(v)        ((v) = 0)
-#define        onestate        long
-#define        INIT(o, n)      ((o) = (unsigned long)1 << (n))
-#define        INC(o)  ((o) <<= 1)
-#define        ISSTATEIN(v, o) (((v) & (o)) != 0)
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst) |= ((unsigned long)(src)&(here)) << (n))
-#define        BACK(dst, src, n)       ((dst) |= ((unsigned long)(src)&(here)) >> (n))
-#define        ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
-/* no multibyte support */
-#define        XMBRTOWC        xmbrtowc_dummy
-#define        ZAPSTATE(mbs)   ((void)(mbs))
-/* function names */
-#define SNAMES                 /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-#undef XMBRTOWC
-#undef ZAPSTATE
-
-/* macros for manipulating states, large version */
-#define        states  char *
-#define        CLEAR(v)        memset(v, 0, m->g->nstates)
-#define        SET0(v, n)      ((v)[n] = 0)
-#define        SET1(v, n)      ((v)[n] = 1)
-#define        ISSET(v, n)     ((v)[n])
-#define        ASSIGN(d, s)    memcpy(d, s, m->g->nstates)
-#define        EQ(a, b)        (memcmp(a, b, m->g->nstates) == 0)
-#define        STATEVARS       long vn; char *space
-#define        STATESETUP(m, nv)       { (m)->space = malloc((nv)*(m)->g->nstates); \
-                               if ((m)->space == NULL) return(REG_ESPACE); \
-                               (m)->vn = 0; }
-#define        STATETEARDOWN(m)        { free((m)->space); }
-#define        SETUP(v)        ((v) = &m->space[m->vn++ * m->g->nstates])
-#define        onestate        long
-#define        INIT(o, n)      ((o) = (n))
-#define        INC(o)  ((o)++)
-#define        ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst)[here+(n)] |= (src)[here])
-#define        BACK(dst, src, n)       ((dst)[here-(n)] |= (src)[here])
-#define        ISSETBACK(v, n) ((v)[here - (n)])
-/* no multibyte support */
-#define        XMBRTOWC        xmbrtowc_dummy
-#define        ZAPSTATE(mbs)   ((void)(mbs))
-/* function names */
-#define        LNAMES                  /* flag */
-
-#undef __FBSDID
-#define __FBSDID(x)
-#include "engine.c"
-
-/* multibyte character & large states version */
-#undef LNAMES
-#undef XMBRTOWC
-#undef ZAPSTATE
-#define        XMBRTOWC        xmbrtowc
-#define        ZAPSTATE(mbs)   memset((mbs), 0, sizeof(*(mbs)))
-#define        MNAMES
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = extern int regexec(const regex_t *, const char *, size_t, \
- =                                     regmatch_t [], int);
- = #define     REG_NOTBOL      00001
- = #define     REG_NOTEOL      00002
- = #define     REG_STARTEND    00004
- = #define     REG_TRACE       00400   // tracing of execution
- = #define     REG_LARGE       01000   // force large representation
- = #define     REG_BACKR       02000   // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call.  Also, by this point the matchers
- * have been prototyped.
- */
-int                            /* 0 success, REG_NOMATCH failure */
-regexec(const regex_t * __restrict preg,
-       const char * __restrict string,
-       size_t nmatch,
-       regmatch_t pmatch[__restrict],
-       int eflags)
-{
-       struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-#      define  GOODFLAGS(f)    (f)
-#else
-#      define  GOODFLAGS(f)    ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
-       if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
-               return(REG_BADPAT);
-       assert(!(g->iflags&BAD));
-       if (g->iflags&BAD)              /* backstop for no-debug case */
-               return(REG_BADPAT);
-       eflags = GOODFLAGS(eflags);
-
-       g->loc = __current_locale();
-       if (MB_CUR_MAX_L(g->loc) > 1)
-               return(mmatcher(g, (char *)string, nmatch, pmatch, eflags));
-       else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
-               return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
-       else
-               return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/regex/regfree-fbsd.c b/regex/regfree-fbsd.c
deleted file mode 100644 (file)
index 4e231c9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)regfree.c   8.3 (Berkeley) 3/20/94
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regfree.c  8.3 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regfree.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <regex.h>
-#include <wchar.h>
-#include <wctype.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = extern void regfree(regex_t *);
- */
-void
-regfree(regex_t *preg)
-{
-       struct re_guts *g;
-       int i;
-
-       if (preg->re_magic != MAGIC1)   /* oops */
-               return;                 /* nice to complain, but hard */
-
-       g = preg->re_g;
-       if (g == NULL || g->magic != MAGIC2)    /* oops again */
-               return;
-       preg->re_magic = 0;             /* mark it invalid */
-       g->magic = 0;                   /* mark it invalid */
-
-       if (g->strip != NULL)
-               free((char *)g->strip);
-       if (g->sets != NULL) {
-               for (i = 0; i < g->ncsets; i++) {
-                       free(g->sets[i].ranges);
-                       free(g->sets[i].wides);
-                       free(g->sets[i].types);
-                       free(g->sets[i].equiv_classes);
-               }
-               free((char *)g->sets);
-       }
-       if (g->must != NULL)
-               free(g->must);
-       if (g->charjump != NULL)
-               free(&g->charjump[CHAR_MIN]);
-       if (g->matchjump != NULL)
-               free(g->matchjump);
-       free((char *)g);
-}
diff --git a/regex/utils.h b/regex/utils.h
deleted file mode 120000 (symlink)
index 55b5b71..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./utils.h
\ No newline at end of file
diff --git a/rpc/Makefile.inc b/rpc/Makefile.inc
deleted file mode 100644 (file)
index d65e093..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#      @(#)Makefile    5.11 (Berkeley) 9/6/90
-# $FreeBSD: src/lib/libc/rpc/Makefile.inc,v 1.21 2001/10/04 21:03:17 wpaul Exp $
-
-.PATH: ${.CURDIR}/../libc/rpc ${.CURDIR}/.
-MISRCS+= auth_none.c auth_unix.c authunix_prot.c bindresvport.c clnt_bcast.c \
-       clnt_dg.c clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c \
-       clnt_vc.c rpc_dtablesize.c getnetconfig.c getnetpath.c getrpcent.c \
-       getrpcport.c mt_misc.c pmap_clnt.c pmap_getmaps.c pmap_getport.c \
-       pmap_prot.c pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c \
-       rpc_callmsg.c rpc_generic.c rpc_soc.c rpcb_clnt.c rpcb_prot.c \
-       rpcb_st_xdr.c \
-       svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_generic.c \
-       svc_raw.c svc_run.c svc_simple.c svc_vc.c
-
-# XDR
-MISRCS+= xdr.c xdr_array.c xdr_float.c xdr_mem.c xdr_rec.c xdr_reference.c \
-       xdr_stdio.c
-
-# Secure-RPC
-MISRCS+= auth_time.c auth_des.c authdes_prot.c des_crypt.c des_soft.c \
-       crypt_client.c key_call.c key_prot_xdr.c getpublickey.c \
-       svc_auth_des.c
-
-# Resolver stuff
-MISRCS+= netname.c netnamer.c rpcdname.c
-
-# Misc Source
-MISRCS+= rtime.c
-
-# generated sources
-MISRCS+= crypt_clnt.c crypt_xdr.c crypt.h
-
-CLEANFILES+= crypt_clnt.c crypt_xdr.c crypt.h
-
-RPCDIR= ${DESTDIR}/usr/include/rpcsvc
-RPCGEN= rpcgen -C
-
-crypt_clnt.c: ${RPCDIR}/crypt.x crypt.h
-       ${RPCGEN} -l -o ${.TARGET} ${RPCDIR}/crypt.x
-
-crypt_xdr.c: ${RPCDIR}/crypt.x crypt.h
-       ${RPCGEN} -c -o ${.TARGET} ${RPCDIR}/crypt.x
-
-crypt.h: ${RPCDIR}/crypt.x
-       ${RPCGEN} -h -o ${.TARGET} ${RPCDIR}/crypt.x
-MAN+=  bindresvport.3 des_crypt.3 getnetconfig.3 getnetpath.3 getrpcent.3 \
-       getrpcport.3 rpc.3 rpc_soc.3 rpc_clnt_auth.3 rpc_clnt_calls.3 \
-       rpc_clnt_create.3 rpc_svc_calls.3 rpc_svc_create.3 rpc_svc_err.3 \
-       rpc_svc_reg.3 rpc_xdr.3 rpcbind.3 xdr.3 publickey.3 rpc_secure.3 \
-       rtime.3
-MAN+=  publickey.5 rpc.5 netconfig.5
-
-MLINKS+= bindresvport.3 bindresvport_sa.3
-
-MLINKS+= getnetconfig.3 endnetconfig.3                 \
-         getnetconfig.3 getnetconfigent.3              \
-         getnetconfig.3 nc_perror.3                    \
-         getnetconfig.3 nc_sperror.3                   \
-         getnetconfig.3 setnetconfig.3
-
-MLINKS+= getnetpath.3 setnetpath.3                     \
-         getnetpath.3 endnetpath.3
-
-MLINKS+= getrpcent.3 endrpcent.3                       \
-         getrpcent.3 getrpcbyname.3                    \
-         getrpcent.3 getrpcbynumber.3                  \
-         getrpcent.3 setrpcent.3
-
-MLINKS+= rpc_clnt_auth.3 auth_destroy.3                        \
-         rpc_clnt_auth.3 authnone_create.3             \
-         rpc_clnt_auth.3 authsys_create.3              \
-         rpc_clnt_auth.3 authsys_create_default.3
-         
-MLINKS+= rpc_clnt_calls.3 clnt_call.3                  \
-         rpc_clnt_calls.3 clnt_freeres.3               \
-         rpc_clnt_calls.3 clnt_geterr.3                        \
-         rpc_clnt_calls.3 clnt_perrno.3                        \
-         rpc_clnt_calls.3 clnt_perror.3                        \
-         rpc_clnt_calls.3 clnt_sperrno.3               \
-         rpc_clnt_calls.3 clnt_sperror.3               \
-         rpc_clnt_calls.3 rpc_broadcast.3              \
-         rpc_clnt_calls.3 rpc_broadcast_exp.3          \
-         rpc_clnt_calls.3 rpc_call.3
-         
-MLINKS+= rpc_clnt_create.3 clnt_control.3              \
-         rpc_clnt_create.3 clnt_create.3               \
-         rpc_clnt_create.3 clnt_create_vers.3          \
-         rpc_clnt_create.3 clnt_destroy.3              \
-         rpc_clnt_create.3 clnt_dg_create.3            \
-         rpc_clnt_create.3 clnt_pcreateerror.3         \
-         rpc_clnt_create.3 clnt_raw_create.3           \
-         rpc_clnt_create.3 clnt_spcreateerror.3                \
-         rpc_clnt_create.3 clnt_tli_create.3           \
-         rpc_clnt_create.3 clnt_tp_create.3            \
-         rpc_clnt_create.3 clnt_vc_create.3
-         
-MLINKS+= rpc_svc_calls.3 __svc_getcallercreds.3                \
-         rpc_svc_calls.3 svc_dg_enablecache.3          \
-         rpc_svc_calls.3 svc_exit.3                    \
-         rpc_svc_calls.3 svc_freeargs.3                        \
-         rpc_svc_calls.3 svc_getargs.3                 \
-         rpc_svc_calls.3 svc_getreq_common.3           \
-         rpc_svc_calls.3 svc_getreq_poll.3             \
-         rpc_svc_calls.3 svc_getreqset.3               \
-         rpc_svc_calls.3 svc_getrpccaller.3            \
-         rpc_svc_calls.3 svc_pollset.3                 \
-         rpc_svc_calls.3 svc_run.3                     \
-         rpc_svc_calls.3 svc_sendreply.3
-         
-MLINKS+= rpc_svc_create.3 svc_control.3                        \
-         rpc_svc_create.3 svc_create.3                 \
-         rpc_svc_create.3 svc_destroy.3                        \
-         rpc_svc_create.3 svc_dg_create.3              \
-         rpc_svc_create.3 svc_fd_create.3              \
-         rpc_svc_create.3 svc_raw_create.3             \
-         rpc_svc_create.3 svc_tli_create.3             \
-         rpc_svc_create.3 svc_tp_create.3              \
-         rpc_svc_create.3 svc_vc_create.3
-         
-MLINKS+= rpc_svc_err.3 svcerr_auth.3                   \
-         rpc_svc_err.3 svcerr_decode.3                 \
-         rpc_svc_err.3 svcerr_noproc.3                 \
-         rpc_svc_err.3 svcerr_noprog.3                 \
-         rpc_svc_err.3 svcerr_progvers.3               \
-         rpc_svc_err.3 svcerr_systemerr.3              \
-         rpc_svc_err.3 svcerr_weakauth.3
-         
-MLINKS+= rpc_svc_reg.3 rpc_reg.3                       \
-         rpc_svc_reg.3 svc_auth_reg.3                  \
-         rpc_svc_reg.3 svc_reg.3                       \
-         rpc_svc_reg.3 svc_unreg.3                     \
-         rpc_svc_reg.3 xprt_register.3                 \
-         rpc_svc_reg.3 xprt_unregister.3
-         
-MLINKS+= rpcbind.3 rpcb_getaddr.3                      \
-         rpcbind.3 rpcb_getmaps.3                      \
-         rpcbind.3 rpcb_gettime.3                      \
-         rpcbind.3 rpcb_rmtcall.3                      \
-         rpcbind.3 rpcb_set.3                          \
-         rpcbind.3 rpcb_unset.3
-         
-MLINKS+= rpc_soc.3 authunix_create.3                   \
-         rpc_soc.3 authunix_create_default.3           \
-         rpc_soc.3 callrpc.3                           \
-         rpc_soc.3 clnt_broadcast.3                    \
-         rpc_soc.3 clntraw_create.3                    \
-         rpc_soc.3 clnttcp_create.3                    \
-         rpc_soc.3 clntudp_bufcreate.3                 \
-         rpc_soc.3 clntudp_create.3                    \
-         rpc_soc.3 clntunix_create.3                   \
-         rpc_soc.3 get_myaddress.3                     \
-         rpc_soc.3 pmap_getmaps.3                      \
-         rpc_soc.3 pmap_getport.3                      \
-         rpc_soc.3 pmap_rmtcall.3                      \
-         rpc_soc.3 pmap_set.3                          \
-         rpc_soc.3 pmap_unset.3                                \
-         rpc_soc.3 registerrpc.3                       \
-         rpc_soc.3 rpc_createerr.3                     \
-         rpc_soc.3 svc_fds.3                           \
-         rpc_soc.3 svc_fdset.3                         \
-         rpc_soc.3 svc_getcaller.3                     \
-         rpc_soc.3 svc_register.3                      \
-         rpc_soc.3 svc_unregister.3                    \
-         rpc_soc.3 svcfd_create.3                      \
-         rpc_soc.3 svcraw_create.3                     \
-         rpc_soc.3 svctcp_create.3                     \
-         rpc_soc.3 svcudp_bufcreate.3                  \
-         rpc_soc.3 svcunix_create.3                    \
-         rpc_soc.3 svcunixfd_create.3                  \
-         rpc_soc.3 xdr_pmap.3                          \
-         rpc_soc.3 xdr_pmaplist.3
diff --git a/secure/Makefile.inc b/secure/Makefile.inc
deleted file mode 100644 (file)
index 9748566..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-.PATH: ${.CURDIR}/secure
-
-MISRCS += chk_fail.c           \
-         memcpy_chk.c          \
-         memmove_chk.c         \
-         memset_chk.c          \
-         strcpy_chk.c          \
-         stpcpy_chk.c          \
-         strncpy_chk.c         \
-         stpncpy_chk.c         \
-         strcat_chk.c          \
-         strncat_chk.c         \
-         sprintf_chk.c         \
-         snprintf_chk.c        \
-         vsprintf_chk.c        \
-         vsnprintf_chk.c
-
-LDBLSRCS += sprintf_chk.c      \
-           snprintf_chk.c      \
-           vsprintf_chk.c      \
-           vsnprintf_chk.c
index 4fb2fbd91d105fd96824cbbd10803ea31e5b1c91..ef45ead36cc13ad6306197cee23753c5535af5dc 100644 (file)
@@ -28,8 +28,7 @@
 
 extern void __chk_fail (void) __attribute__((__noreturn__));
 extern int __snprintf_chk (char * __restrict, size_t, int, size_t,
-                           const char * __restrict, ...)
-  __DARWIN_LDBL_COMPAT (__snprintf_chk);
+                           const char * __restrict, ...);
 
 int
 __snprintf_chk (char *s, size_t maxlen, int flags, size_t len,
index 62a2a60bdef6e83035628998475bc005174cf8cc..cf4a9565619656a17c7b745c82db145c51182155 100644 (file)
@@ -28,8 +28,7 @@
 
 extern void __chk_fail (void) __attribute__((__noreturn__));
 extern int __sprintf_chk (char * __restrict, int, size_t,
-                          const char * __restrict, ...)
-  __DARWIN_LDBL_COMPAT (__sprintf_chk);
+                          const char * __restrict, ...);
 
 int
 __sprintf_chk (char *s, int flags, size_t len, const char *format, ...)
index 5c7e2ccc34da3e97b74b515840f77d02eec74b09..f9e67408b552545af742ad3a61f704861afd449f 100644 (file)
@@ -28,8 +28,7 @@
 
 extern void __chk_fail (void) __attribute__((__noreturn__));
 extern int __vsnprintf_chk (char * __restrict, size_t, int, size_t,
-                            const char * __restrict, va_list arg)
-  __DARWIN_LDBL_COMPAT (__vsnprintf_chk);
+                            const char * __restrict, va_list arg);
 
 int
 __vsnprintf_chk (char *s, size_t maxlen, int flags, size_t len,
index 72a4004bf3ec49e07334c68ca04ab417607086f5..a2ca79b117ace10e4f7599a460a190532315c94f 100644 (file)
@@ -28,8 +28,7 @@
 
 extern void __chk_fail (void) __attribute__((__noreturn__));
 extern int __vsprintf_chk (char * __restrict, int, size_t,
-                           const char * __restrict, va_list arg)
-  __DARWIN_LDBL_COMPAT (__vsprintf_chk);
+                           const char * __restrict, va_list arg);
 
 int
 __vsprintf_chk (char *s, int flags, size_t len, const char *format,
index 5e089e15ced50f2bcf4cd4069caa7f8723442aed..90c56173b42d0489eaffd61ef9c2134ffd6a2b44 100644 (file)
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.15 2009/03/02 04:11:42 das Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 
@@ -43,7 +45,19 @@ asprintf(char ** __restrict s, char const * __restrict fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       ret = vasprintf(s, fmt, ap);
+       ret = vasprintf_l(s, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
+}
+
+int
+asprintf_l(char ** __restrict s, locale_t loc, char const * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       va_start(ap, fmt);
+       ret = vasprintf_l(s, loc, fmt, ap);
        va_end(ap);
        return (ret);
 }
diff --git a/stdio/FreeBSD/asprintf.c.patch b/stdio/FreeBSD/asprintf.c.patch
deleted file mode 100644 (file)
index bc41588..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- asprintf.c.bsdnew  2009-11-11 19:15:16.000000000 -0800
-+++ asprintf.c 2009-11-11 19:15:42.000000000 -0800
-@@ -33,6 +33,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.15 2009/03/02 04:11:42 das Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdarg.h>
-@@ -43,7 +45,19 @@ asprintf(char ** __restrict s, char cons
-       va_list ap;
-       va_start(ap, fmt);
--      ret = vasprintf(s, fmt, ap);
-+      ret = vasprintf_l(s, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+asprintf_l(char ** __restrict s, locale_t loc, char const * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      va_start(ap, fmt);
-+      ret = vasprintf_l(s, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
- }
index ff5a8644e73d230e3f1c9057297d240c5384cf98..22115faf1a16892f636fea6f85cfe3d5736f41d4 100644 (file)
@@ -27,7 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
 
-#define        _WITH_DPRINTF
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdarg.h>
 #include <stdio.h>
@@ -40,7 +41,19 @@ dprintf(int fd, const char * __restrict fmt, ...)
        int ret;
 
        va_start(ap, fmt);
-       ret = vdprintf(fd, fmt, ap);
+       ret = vdprintf_l(fd, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
+}
+
+int
+dprintf_l(int fd, locale_t loc, const char * __restrict fmt, ...)
+{
+       va_list ap;
+       int ret;
+
+       va_start(ap, fmt);
+       ret = vdprintf_l(fd, loc, fmt, ap);
        va_end(ap);
        return (ret);
 }
diff --git a/stdio/FreeBSD/dprintf.c.patch b/stdio/FreeBSD/dprintf.c.patch
deleted file mode 100644 (file)
index 43957fd..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---- dprintf.c.orig     2009-12-15 17:43:05.000000000 -0800
-+++ dprintf.c  2009-12-15 17:45:32.000000000 -0800
-@@ -27,7 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
--#define       _WITH_DPRINTF
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdarg.h>
- #include <stdio.h>
-@@ -40,7 +41,19 @@ dprintf(int fd, const char * __restrict 
-       int ret;
-       va_start(ap, fmt);
--      ret = vdprintf(fd, fmt, ap);
-+      ret = vdprintf_l(fd, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+dprintf_l(int fd, locale_t loc, const char * __restrict fmt, ...)
-+{
-+      va_list ap;
-+      int ret;
-+
-+      va_start(ap, fmt);
-+      ret = vdprintf_l(fd, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
- }
index e80edcfcf0cf0bf53d26e4e005cffc08ba5f3bad..91df68a9044f6d112d771bdf10b24f16ae5d51d9 100644 (file)
@@ -49,6 +49,13 @@ fclose(FILE *fp)
 {
        int r;
 
+       if (!__sdidinit)
+               __sinit();
+
+       if (fp == NULL) {
+               errno = EFAULT;
+               return (EOF);
+       }
        if (fp->_flags == 0) {  /* not open! */
                errno = EBADF;
                return (EOF);
@@ -65,7 +72,7 @@ fclose(FILE *fp)
                FREELB(fp);
        fp->_file = -1;
        fp->_r = fp->_w = 0;    /* Mess up if reaccessed. */
-       fp->_flags = 0;         /* Release this FILE for reuse. */
+       __sfprelease(fp);       /* Release this FILE for reuse. */
        FUNLOCKFILE(fp);
        return (r);
 }
diff --git a/stdio/FreeBSD/fclose.c.patch b/stdio/FreeBSD/fclose.c.patch
deleted file mode 100644 (file)
index 7e5eef7..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- fclose.c.bsdnew    2009-11-11 13:33:03.000000000 -0800
-+++ fclose.c   2009-11-11 13:33:03.000000000 -0800
-@@ -49,6 +49,13 @@ fclose(FILE *fp)
- {
-       int r;
-+      if (!__sdidinit)
-+              __sinit();
-+
-+      if (fp == NULL) {
-+              errno = EFAULT;
-+              return (EOF);
-+      }
-       if (fp->_flags == 0) {  /* not open! */
-               errno = EBADF;
-               return (EOF);
-@@ -65,7 +72,7 @@ fclose(FILE *fp)
-               FREELB(fp);
-       fp->_file = -1;
-       fp->_r = fp->_w = 0;    /* Mess up if reaccessed. */
--      fp->_flags = 0;         /* Release this FILE for reuse. */
-+      __sfprelease(fp);       /* Release this FILE for reuse. */
-       FUNLOCKFILE(fp);
-       return (r);
- }
index 4d106c4521c6a25498af2c21fc9897433a13d750..c49e36ed2d98310ec801fcdf3ab80d20a698ea28 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef VARIANT_DARWINEXTSN
+#define _DARWIN_UNLIMITED_STREAMS
+#define COUNT  0
+#elif defined(VARIANT_LEGACY)
+#define COUNT  0
+#else
+#define COUNT  1
+#endif
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)fdopen.c   8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
@@ -78,7 +87,7 @@ fdopen(fd, mode)
                return (NULL);
        }
 
-       if ((fp = __sfp()) == NULL)
+       if ((fp = __sfp(COUNT)) == NULL)
                return (NULL);
        fp->_flags = flags;
        /*
diff --git a/stdio/FreeBSD/fdopen.c.patch b/stdio/FreeBSD/fdopen.c.patch
deleted file mode 100644 (file)
index 466abe3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---- fdopen.c.bsdnew    2009-11-11 13:33:03.000000000 -0800
-+++ fdopen.c   2009-11-11 13:33:04.000000000 -0800
-@@ -30,6 +30,15 @@
-  * SUCH DAMAGE.
-  */
-+#ifdef VARIANT_DARWINEXTSN
-+#define _DARWIN_UNLIMITED_STREAMS
-+#define COUNT 0
-+#elif defined(VARIANT_LEGACY)
-+#define COUNT 0
-+#else
-+#define COUNT 1
-+#endif
-+
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)fdopen.c  8.1 (Berkeley) 6/4/93";
- #endif /* LIBC_SCCS and not lint */
-@@ -78,7 +87,7 @@ fdopen(fd, mode)
-               return (NULL);
-       }
--      if ((fp = __sfp()) == NULL)
-+      if ((fp = __sfp(COUNT)) == NULL)
-               return (NULL);
-       fp->_flags = flags;
-       /*
index 2507c795b1e3f1c6280ac24182a7ad2cffd7531d..5db1a1c61fd4636c32eb1e736f92ab1f1a3ba2e3 100644 (file)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/fflush.c,v 1.14 2007/01/09 00:28:06 imp E
 #include "namespace.h"
 #include <errno.h>
 #include <stdio.h>
+#include <string.h>
 #include "un-namespace.h"
 #include "libc_private.h"
 #include "local.h"
@@ -59,8 +60,10 @@ fflush(FILE *fp)
        FLOCKFILE(fp);
 
        /*
+        * 11103146: Conformance change:
+        * --- Begin History ---
         * There is disagreement about the correct behaviour of fflush()
-        * when passed a file which is not open for reading.  According to
+        * when passed a file which is not open for writing.  According to
         * the ISO C standard, the behaviour is undefined.
         * Under linux, such an fflush returns success and has no effect;
         * under Windows, such an fflush is documented as behaving instead
@@ -68,10 +71,14 @@ fflush(FILE *fp)
         * Given that applications may be written with the expectation of
         * either of these two behaviours, the only safe (non-astonishing)
         * option is to return EBADF and ask that applications be fixed.
+        * --- End History ---
+        * SUSv3 now requires that fflush() returns success on a read-only
+        * stream.  In addition, the conformance tests will warn if a fflush
+        * on a read-only stream does not set the file descriptor's file offset
+        * to the real position.  We won't be fixing the warning at this time.
         */
        if ((fp->_flags & (__SWR | __SRW)) == 0) {
-               errno = EBADF;
-               retval = EOF;
+               retval = 0;
        } else
                retval = __sflush(fp);
        FUNLOCKFILE(fp);
@@ -90,8 +97,7 @@ __fflush(FILE *fp)
        if (fp == NULL)
                return (_fwalk(sflush_locked));
        if ((fp->_flags & (__SWR | __SRW)) == 0) {
-               errno = EBADF;
-               retval = EOF;
+               retval = 0;
        } else
                retval = __sflush(fp);
        return (retval);
@@ -122,6 +128,14 @@ __sflush(FILE *fp)
        for (; n > 0; n -= t, p += t) {
                t = _swrite(fp, (char *)p, n);
                if (t <= 0) {
+                       /* 5340694: reset _p and _w on EAGAIN */
+                       if (t < 0 && errno == EAGAIN) {
+                               if (p > fp->_p) /* some was written */
+                                       memmove(fp->_p, p, n);
+                               fp->_p += n;
+                               if (!(fp->_flags & (__SLBF|__SNBF)))
+                                       fp->_w -= n;
+                       }
                        fp->_flags |= __SERR;
                        return (EOF);
                }
diff --git a/stdio/FreeBSD/fflush.c.patch b/stdio/FreeBSD/fflush.c.patch
deleted file mode 100644 (file)
index 7f6d2a6..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- fflush.c.bsdnew    2009-11-11 13:33:04.000000000 -0800
-+++ fflush.c   2009-11-11 13:33:04.000000000 -0800
-@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- #include "namespace.h"
- #include <errno.h>
- #include <stdio.h>
-+#include <string.h>
- #include "un-namespace.h"
- #include "libc_private.h"
- #include "local.h"
-@@ -122,6 +123,14 @@ __sflush(FILE *fp)
-       for (; n > 0; n -= t, p += t) {
-               t = _swrite(fp, (char *)p, n);
-               if (t <= 0) {
-+                      /* 5340694: reset _p and _w on EAGAIN */
-+                      if (t < 0 && errno == EAGAIN) {
-+                              if (p > fp->_p) /* some was written */
-+                                      memmove(fp->_p, p, n);
-+                              fp->_p += n;
-+                              if (!(fp->_flags & (__SLBF|__SNBF)))
-+                                      fp->_w -= n;
-+                      }
-                       fp->_flags |= __SERR;
-                       return (EOF);
-               }
index 4fb0a8a027556d29e4ff2f23933221f97b97aebb..61a3391667d2c38b8179a00d5d15d7dff55ba4ba 100644 (file)
@@ -97,6 +97,9 @@ These changes are lost as soon as the pointer becomes invalid.
 The argument
 .Fa stream
 is not a stream open for reading.
+.It Bq Er ENOMEM
+The internal line buffer could not be expanded due to lack of available memory,
+or because it would need to expand beyond INT_MAX in size.
 .El
 .Pp
 The
diff --git a/stdio/FreeBSD/fgetln.3.patch b/stdio/FreeBSD/fgetln.3.patch
deleted file mode 100644 (file)
index d134522..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- fgetln.3.orig      2010-07-09 13:54:22.000000000 -0700
-+++ fgetln.3   2010-07-10 12:40:15.000000000 -0700
-@@ -97,6 +97,9 @@
- The argument
- .Fa stream
- is not a stream open for reading.
-+.It Bq Er ENOMEM
-+The internal line buffer could not be expanded due to lack of available memory,
-+or because it would need to expand beyond INT_MAX in size.
- .El
- .Pp
- The
index bbad594a037b2f36c334079b9705d00153c049b5..8de4aa92e1f992541741cb560d7cd1b1440e2b70 100644 (file)
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fgetln.c  8.2 (Berkeley) 1/2/94";
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetln.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
 
 #include "namespace.h"
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -61,6 +62,10 @@ __slbexpand(FILE *fp, size_t newsize)
 #endif
        if (fp->_lb._size >= newsize)
                return (0);
+       if (newsize > INT_MAX) {
+               errno = ENOMEM;
+               return (-1);
+       }
        if ((p = realloc(fp->_lb._base, newsize)) == NULL)
                return (-1);
        fp->_lb._base = p;
@@ -159,6 +164,7 @@ fgetln(FILE *fp, size_t *lenp)
 
 error:
        *lenp = 0;              /* ??? */
+       fp->_flags |= __SERR;
        FUNLOCKFILE(fp);
        return (NULL);          /* ??? */
 }
diff --git a/stdio/FreeBSD/fgetln.c.patch b/stdio/FreeBSD/fgetln.c.patch
deleted file mode 100644 (file)
index 035233c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
---- fgetln.c.orig      2010-07-09 13:54:22.000000000 -0700
-+++ fgetln.c   2010-07-10 12:23:58.000000000 -0700
-@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fgetln.c 8.2
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetln.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
- #include "namespace.h"
-+#include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -61,6 +62,10 @@ __slbexpand(FILE *fp, size_t newsize)
- #endif
-       if (fp->_lb._size >= newsize)
-               return (0);
-+      if (newsize > INT_MAX) {
-+              errno = ENOMEM;
-+              return (-1);
-+      }
-       if ((p = realloc(fp->_lb._base, newsize)) == NULL)
-               return (-1);
-       fp->_lb._base = p;
-@@ -159,6 +164,7 @@ fgetln(FILE *fp, size_t *lenp)
- error:
-       *lenp = 0;              /* ??? */
-+      fp->_flags |= __SERR;
-       FUNLOCKFILE(fp);
-       return (NULL);          /* ??? */
- }
index 1570178e3bd4a5f59147b496218094a570089fb9..ead24c34a6f8265b0900fe39b957722b9d36aba1 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwc.c,v 1.13 2008/04/17 22:17:53 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <errno.h>
 #include <stdio.h>
@@ -47,7 +49,21 @@ fgetwc(FILE *fp)
 
        FLOCKFILE(fp);
        ORIENT(fp, 1);
-       r = __fgetwc(fp);
+       r = __fgetwc(fp, __current_locale());
+       FUNLOCKFILE(fp);
+
+       return (r);
+}
+
+wint_t
+fgetwc_l(FILE *fp, locale_t loc)
+{
+       wint_t r;
+
+       NORMALIZE_LOCALE(loc);
+       FLOCKFILE(fp);
+       ORIENT(fp, 1);
+       r = __fgetwc(fp, loc);
        FUNLOCKFILE(fp);
 
        return (r);
@@ -57,21 +73,23 @@ fgetwc(FILE *fp)
  * Non-MT-safe version.
  */
 wint_t
-__fgetwc(FILE *fp)
+__fgetwc(FILE *fp, locale_t loc)
 {
        wchar_t wc;
        size_t nconv;
+       struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
+       size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t) = xrl->__mbrtowc;
 
        if (fp->_r <= 0 && __srefill(fp))
                return (WEOF);
-       if (MB_CUR_MAX == 1) {
+       if (xrl->__mb_cur_max == 1) {
                /* Fast path for single-byte encodings. */
                wc = *fp->_p++;
                fp->_r--;
                return (wc);
        }
        do {
-               nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_mbstate);
+               nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_mbstate, loc);
                if (nconv == (size_t)-1)
                        break;
                else if (nconv == (size_t)-2)
diff --git a/stdio/FreeBSD/fgetwc.c.patch b/stdio/FreeBSD/fgetwc.c.patch
deleted file mode 100644 (file)
index eec75c7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
---- fgetwc.c.bsdnew    2009-11-11 13:33:05.000000000 -0800
-+++ fgetwc.c   2009-11-11 13:43:19.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwc.c,v 1.13 2008/04/17 22:17:53 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <stdio.h>
-@@ -47,7 +49,21 @@ fgetwc(FILE *fp)
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
--      r = __fgetwc(fp);
-+      r = __fgetwc(fp, __current_locale());
-+      FUNLOCKFILE(fp);
-+
-+      return (r);
-+}
-+
-+wint_t
-+fgetwc_l(FILE *fp, locale_t loc)
-+{
-+      wint_t r;
-+
-+      NORMALIZE_LOCALE(loc);
-+      FLOCKFILE(fp);
-+      ORIENT(fp, 1);
-+      r = __fgetwc(fp, loc);
-       FUNLOCKFILE(fp);
-       return (r);
-@@ -57,21 +73,23 @@ fgetwc(FILE *fp)
-  * Non-MT-safe version.
-  */
- wint_t
--__fgetwc(FILE *fp)
-+__fgetwc(FILE *fp, locale_t loc)
- {
-       wchar_t wc;
-       size_t nconv;
-+      struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
-+      size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t) = xrl->__mbrtowc;
-       if (fp->_r <= 0 && __srefill(fp))
-               return (WEOF);
--      if (MB_CUR_MAX == 1) {
-+      if (xrl->__mb_cur_max == 1) {
-               /* Fast path for single-byte encodings. */
-               wc = *fp->_p++;
-               fp->_r--;
-               return (wc);
-       }
-       do {
--              nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_mbstate);
-+              nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_mbstate, loc);
-               if (nconv == (size_t)-1)
-                       break;
-               else if (nconv == (size_t)-2)
index 5a8119c325167c124755364a5e833f473fc0ead9..c38fb39d59361bd209d47f3d6b19925ac937c796 100644 (file)
@@ -32,7 +32,8 @@
 .Dt FGETWLN 3
 .Os
 .Sh NAME
-.Nm fgetwln
+.Nm fgetwln ,
+.Nm fgetwln_l
 .Nd get a line of wide characters from a stream
 .Sh LIBRARY
 .Lb libc
@@ -41,6 +42,9 @@
 .In wchar.h
 .Ft wchar_t *
 .Fn fgetwln "FILE * restrict stream" "size_t * restrict len"
+.In xlocale.h
+.Ft wchar_t *
+.Fn fgetwln_l "FILE * restrict stream" "size_t * restrict len" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn fgetwln
@@ -58,6 +62,14 @@ points.
 (Note, however, that if the line is the last
 in a file that does not end in a newline,
 the returned text will not contain a newline.)
+.Pp
+While the
+.Fn fgetwln
+function uses the current locale, the
+.Fn fgetwln_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 Upon successful completion a pointer is returned;
 this pointer becomes invalid after the next
@@ -113,4 +125,5 @@ or
 .Xr ferror 3 ,
 .Xr fgetln 3 ,
 .Xr fgetws 3 ,
-.Xr fopen 3
+.Xr fopen 3 ,
+.Xr xlocale 3
diff --git a/stdio/FreeBSD/fgetwln.3.patch b/stdio/FreeBSD/fgetwln.3.patch
deleted file mode 100644 (file)
index 7be9de1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
---- fgetwln.3.orig     2009-10-29 11:41:29.000000000 -0700
-+++ fgetwln.3  2009-10-29 11:44:37.000000000 -0700
-@@ -32,7 +32,8 @@
- .Dt FGETWLN 3
- .Os
- .Sh NAME
--.Nm fgetwln
-+.Nm fgetwln ,
-+.Nm fgetwln_l
- .Nd get a line of wide characters from a stream
- .Sh LIBRARY
- .Lb libc
-@@ -41,6 +42,9 @@
- .In wchar.h
- .Ft wchar_t *
- .Fn fgetwln "FILE * restrict stream" "size_t * restrict len"
-+.In xlocale.h
-+.Ft wchar_t *
-+.Fn fgetwln_l "FILE * restrict stream" "size_t * restrict len" "locale_t loc"
- .Sh DESCRIPTION
- The
- .Fn fgetwln
-@@ -58,6 +62,14 @@ points.
- (Note, however, that if the line is the last
- in a file that does not end in a newline,
- the returned text will not contain a newline.)
-+.Pp
-+While the
-+.Fn fgetwln
-+function uses the current locale, the
-+.Fn fgetwln_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- Upon successful completion a pointer is returned;
- this pointer becomes invalid after the next
-@@ -113,4 +125,5 @@ or
- .Xr ferror 3 ,
- .Xr fgetln 3 ,
- .Xr fgetws 3 ,
--.Xr fopen 3
-+.Xr fopen 3 ,
-+.Xr xlocale 3
index 49b52af314421a56f41d7cf4600c130862b83271..43485cb149b8a53065a6630fbd11877a555f43f3 100644 (file)
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwln.c,v 1.2 2004/08/06 17:00:09 tjr E
 #include "local.h"
 
 wchar_t *
-fgetwln(FILE * __restrict fp, size_t *lenp)
+fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t loc)
 {
        wint_t wc;
        size_t len;
@@ -44,7 +44,7 @@ fgetwln(FILE * __restrict fp, size_t *lenp)
        ORIENT(fp, 1);
 
        len = 0;
-       while ((wc = __fgetwc(fp)) != WEOF) {
+       while ((wc = __fgetwc(fp, loc)) != WEOF) {
 #define        GROW    512
                if (len * sizeof(wchar_t) >= fp->_lb._size &&
                    __slbexpand(fp, (len + GROW) * sizeof(wchar_t)))
@@ -65,3 +65,9 @@ error:
        *lenp = 0;
        return (NULL);
 }
+
+wchar_t *
+fgetwln(FILE * __restrict fp, size_t *lenp)
+{
+       return fgetwln_l(fp, lenp, __current_locale());
+}
diff --git a/stdio/FreeBSD/fgetwln.c.patch b/stdio/FreeBSD/fgetwln.c.patch
deleted file mode 100644 (file)
index ee02383..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- fgetwln.c.orig     2005-09-14 19:51:14.000000000 -0700
-+++ fgetwln.c  2005-09-14 19:53:18.000000000 -0700
-@@ -35,7 +35,7 @@
- #include "local.h"
- wchar_t *
--fgetwln(FILE * __restrict fp, size_t *lenp)
-+fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t loc)
- {
-       wint_t wc;
-       size_t len;
-@@ -44,7 +44,7 @@
-       ORIENT(fp, 1);
-       len = 0;
--      while ((wc = __fgetwc(fp)) != WEOF) {
-+      while ((wc = __fgetwc(fp, loc)) != WEOF) {
- #define       GROW    512
-               if (len * sizeof(wchar_t) >= fp->_lb._size &&
-                   __slbexpand(fp, (len + GROW) * sizeof(wchar_t)))
-@@ -65,3 +65,9 @@
-       *lenp = 0;
-       return (NULL);
- }
-+
-+wchar_t *
-+fgetwln(FILE * __restrict fp, size_t *lenp)
-+{
-+      return fgetwln_l(fp, lenp, __current_locale());
-+}
index eba1bb9eb743f58c4bb803f47ab4391e241c2870..49c9d90f937b485903b71bca1de6733b764330d3 100644 (file)
@@ -37,7 +37,8 @@
 .Dt FGETWS 3
 .Os
 .Sh NAME
-.Nm fgetws
+.Nm fgetws ,
+.Nm fgetws_l
 .Nd get a line of wide characters from a stream
 .Sh LIBRARY
 .Lb libc
 .In stdio.h
 .In wchar.h
 .Ft "wchar_t *"
-.Fn fgetws "wchar_t * restrict ws" "int n" "FILE * restrict fp"
+.Fo fgetws
+.Fa "wchar_t *restrict ws"
+.Fa "int n"
+.Fa "FILE *restrict stream"
+.Fc
+.In stdio.h
+.In wchar.h
+.In xlocale.h
+.Ft "wchar_t *"
+.Fo fgetws_l
+.Fa "wchar_t *restrict ws"
+.Fa "int n"
+.Fa "FILE *restrict stream"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn fgetws
@@ -53,7 +68,7 @@ function
 reads at most one less than the number of characters specified by
 .Fa n
 from the given
-.Fa fp
+.Fa stream
 and stores them in the wide character string
 .Fa ws .
 Reading stops when a newline character is found,
@@ -62,6 +77,14 @@ The newline, if any, is retained.
 If any characters are read and there is no error, a
 .Ql \e0
 character is appended to end the string.
+.Pp
+While the
+.Fn fgetws
+function uses the current locale, the
+.Fn fgetws_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn fgetws
@@ -80,7 +103,8 @@ and the buffer contents are indeterminate.
 The
 .Fn fgetws
 function
-does not distinguish between end-of-file and error, and callers must use
+does not distinguish between end-of-file and error;
+callers must use
 .Xr feof 3
 and
 .Xr ferror 3
@@ -92,7 +116,7 @@ function will fail if:
 .Bl -tag -width Er
 .It Bq Er EBADF
 The given
-.Fa fp
+.Fa stream
 argument is not a readable stream.
 .It Bq Er EILSEQ
 The data obtained from the input stream does not form a valid
@@ -112,7 +136,8 @@ or
 .Sh SEE ALSO
 .Xr feof 3 ,
 .Xr ferror 3 ,
-.Xr fgets 3
+.Xr fgets 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn fgetws
diff --git a/stdio/FreeBSD/fgetws.3.patch b/stdio/FreeBSD/fgetws.3.patch
deleted file mode 100644 (file)
index e170d86..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
---- fgetws.3.bsdnew    2009-11-11 13:33:05.000000000 -0800
-+++ fgetws.3   2009-11-11 13:33:05.000000000 -0800
-@@ -37,7 +37,8 @@
- .Dt FGETWS 3
- .Os
- .Sh NAME
--.Nm fgetws
-+.Nm fgetws ,
-+.Nm fgetws_l
- .Nd get a line of wide characters from a stream
- .Sh LIBRARY
- .Lb libc
-@@ -45,7 +46,21 @@
- .In stdio.h
- .In wchar.h
- .Ft "wchar_t *"
--.Fn fgetws "wchar_t * restrict ws" "int n" "FILE * restrict fp"
-+.Fo fgetws
-+.Fa "wchar_t *restrict ws"
-+.Fa "int n"
-+.Fa "FILE *restrict stream"
-+.Fc
-+.In stdio.h
-+.In wchar.h
-+.In xlocale.h
-+.Ft "wchar_t *"
-+.Fo fgetws_l
-+.Fa "wchar_t *restrict ws"
-+.Fa "int n"
-+.Fa "FILE *restrict stream"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn fgetws
-@@ -53,7 +68,7 @@ function
- reads at most one less than the number of characters specified by
- .Fa n
- from the given
--.Fa fp
-+.Fa stream
- and stores them in the wide character string
- .Fa ws .
- Reading stops when a newline character is found,
-@@ -62,6 +77,14 @@ The newline, if any, is retained.
- If any characters are read and there is no error, a
- .Ql \e0
- character is appended to end the string.
-+.Pp
-+While the
-+.Fn fgetws
-+function uses the current locale, the
-+.Fn fgetws_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- Upon successful completion,
- .Fn fgetws
-@@ -80,7 +103,8 @@ and the buffer contents are indeterminat
- The
- .Fn fgetws
- function
--does not distinguish between end-of-file and error, and callers must use
-+does not distinguish between end-of-file and error;
-+callers must use
- .Xr feof 3
- and
- .Xr ferror 3
-@@ -92,7 +116,7 @@ function will fail if:
- .Bl -tag -width Er
- .It Bq Er EBADF
- The given
--.Fa fp
-+.Fa stream
- argument is not a readable stream.
- .It Bq Er EILSEQ
- The data obtained from the input stream does not form a valid
-@@ -112,7 +136,8 @@ or
- .Sh SEE ALSO
- .Xr feof 3 ,
- .Xr ferror 3 ,
--.Xr fgets 3
-+.Xr fgets 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn fgetws
index eaaa0f85870fa31d6dc8430b39e69ef9a25d8e49..278e8091c37e1089735b1aef5d1a12fa4942b90f 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetws.c,v 1.8 2009/11/25 04:45:45 wollman Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <errno.h>
 #include <stdio.h>
@@ -38,13 +40,18 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetws.c,v 1.8 2009/11/25 04:45:45 wollma
 #include "mblocal.h"
 
 wchar_t *
-fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
+fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t loc)
 {
        wchar_t *wsp;
        size_t nconv;
        const char *src;
        unsigned char *nl;
+       struct __xlocale_st_runelocale *rl;
+       size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, size_t, size_t, __darwin_mbstate_t * __restrict, locale_t);
 
+       NORMALIZE_LOCALE(loc);
+       rl = loc->__lc_ctype;
+       __mbsnrtowcs = rl->__mbsnrtowcs;
        FLOCKFILE(fp);
        ORIENT(fp, 1);
 
@@ -58,11 +65,11 @@ fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
                goto error;
        wsp = ws;
        do {
-               src = fp->_p;
+               src = (const char *)fp->_p;
                nl = memchr(fp->_p, '\n', fp->_r);
                nconv = __mbsnrtowcs(wsp, &src,
                    nl != NULL ? (nl - fp->_p + 1) : fp->_r,
-                   n - 1, &fp->_mbstate);
+                   n - 1, &fp->_mbstate, loc);
                if (nconv == (size_t)-1)
                        /* Conversion error */
                        goto error;
@@ -86,7 +93,7 @@ fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
        if (wsp == ws)
                /* EOF */
                goto error;
-       if (!__mbsinit(&fp->_mbstate))
+       if (!rl->__mbsinit(&fp->_mbstate, loc))
                /* Incomplete character */
                goto error;
        *wsp = L'\0';
@@ -98,3 +105,9 @@ error:
        FUNLOCKFILE(fp);
        return (NULL);
 }
+
+wchar_t *
+fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
+{
+       return fgetws_l(ws, n, fp, __current_locale());
+}
diff --git a/stdio/FreeBSD/fgetws.c.patch b/stdio/FreeBSD/fgetws.c.patch
deleted file mode 100644 (file)
index b16f5a7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
---- fgetws.c.bsdnew    2009-11-30 16:15:32.000000000 -0800
-+++ fgetws.c   2009-11-30 16:15:32.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetws.c,v 1.8 2009/11/25 04:45:45 wollman Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <stdio.h>
-@@ -38,13 +40,18 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- #include "mblocal.h"
- wchar_t *
--fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
-+fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t loc)
- {
-       wchar_t *wsp;
-       size_t nconv;
-       const char *src;
-       unsigned char *nl;
-+      struct __xlocale_st_runelocale *rl;
-+      size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, size_t, size_t, __darwin_mbstate_t * __restrict, locale_t);
-+      NORMALIZE_LOCALE(loc);
-+      rl = loc->__lc_ctype;
-+      __mbsnrtowcs = rl->__mbsnrtowcs;
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-@@ -58,11 +65,11 @@ fgetws(wchar_t * __restrict ws, int n, F
-               goto error;
-       wsp = ws;
-       do {
--              src = fp->_p;
-+              src = (const char *)fp->_p;
-               nl = memchr(fp->_p, '\n', fp->_r);
-               nconv = __mbsnrtowcs(wsp, &src,
-                   nl != NULL ? (nl - fp->_p + 1) : fp->_r,
--                  n - 1, &fp->_mbstate);
-+                  n - 1, &fp->_mbstate, loc);
-               if (nconv == (size_t)-1)
-                       /* Conversion error */
-                       goto error;
-@@ -86,7 +93,7 @@ fgetws(wchar_t * __restrict ws, int n, F
-       if (wsp == ws)
-               /* EOF */
-               goto error;
--      if (!__mbsinit(&fp->_mbstate))
-+      if (!rl->__mbsinit(&fp->_mbstate, loc))
-               /* Incomplete character */
-               goto error;
-       *wsp = L'\0';
-@@ -98,3 +105,9 @@ error:
-       FUNLOCKFILE(fp);
-       return (NULL);
- }
-+
-+wchar_t *
-+fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
-+{
-+      return fgetws_l(ws, n, fp, __current_locale());
-+}
index f370d7abc6982e138d63e2a23fedddb231cc80cb..6cade0b42b6621a6b4f7175233167d6050ece71a 100644 (file)
@@ -36,13 +36,18 @@ static char sccsid[] = "@(#)findfp.c        8.2 (Berkeley) 1/4/94";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Exp $");
 
+#include <TargetConditionals.h>
+
 #include <sys/param.h>
 #include <machine/atomic.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <libkern/OSAtomic.h>
+#include <errno.h>
 
+#include <pthread.h>
 #include <spinlock.h>
 
 #include "libc_private.h"
@@ -51,7 +56,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Ex
 
 int    __sdidinit;
 
+#if !TARGET_OS_EMBEDDED
 #define        NDYNAMIC 10             /* add ten more whenever necessary */
+#else
+#define        NDYNAMIC 1              /* add one at a time on embedded */
+#endif
 
 #define        std(flags, file) {              \
        ._flags = (flags),              \
@@ -61,12 +70,32 @@ int __sdidinit;
        ._read = __sread,               \
        ._seek = __sseek,               \
        ._write = __swrite,             \
+       ._extra = __sFX + file,         \
 }
+#define __sFXInit       {.fl_mutex = PTHREAD_MUTEX_INITIALIZER}
+  /* set counted */
+#define __sFXInit3      {.fl_mutex = PTHREAD_MUTEX_INITIALIZER, .counted = 1}
+
+static int __scounted;         /* streams counted against STREAM_MAX */
+static int __stream_max;
+
+#if !TARGET_OS_EMBEDDED
+/* usual and usual_extra are data pigs. See 7929728. For embedded we should
+ * always allocate dynamically, and probably should for desktop too. */
                                /* the usual - (stdin + stdout + stderr) */
 static FILE usual[FOPEN_MAX - 3];
+static struct __sFILEX usual_extra[FOPEN_MAX - 3];
 static struct glue uglue = { NULL, FOPEN_MAX - 3, usual };
+#endif /* !TARGET_OS_EMBEDDED */
+
+static struct __sFILEX __sFX[3] = {__sFXInit3, __sFXInit3, __sFXInit3};
 
-static FILE __sF[3] = {
+/*
+ * We can't make this 'static' due to binary compatibility concerns.
+ * This also means we cannot change the sizeof(FILE) and must continue to
+ * use the __sFILEX stuff to add to FILE.
+ */
+FILE __sF[3] = {
        std(__SRD, STDIN_FILENO),
        std(__SWR, STDOUT_FILENO),
        std(__SWR|__SNBF, STDERR_FILENO)
@@ -76,8 +105,13 @@ FILE *__stdinp = &__sF[0];
 FILE *__stdoutp = &__sF[1];
 FILE *__stderrp = &__sF[2];
 
+#if !TARGET_OS_EMBEDDED
 struct glue __sglue = { &uglue, 3, __sF };
 static struct glue *lastglue = &uglue;
+#else
+struct glue __sglue = { NULL, 3, __sF };
+static struct glue *lastglue = &__sglue;
+#endif
 
 static struct glue *   moreglue(int);
 
@@ -98,16 +132,25 @@ moreglue(n)
        struct glue *g;
        static FILE empty;
        FILE *p;
+       static struct __sFILEX emptyx = __sFXInit;
+       struct __sFILEX *fx;
 
-       g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE));
+       g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE) +
+           n * sizeof(struct __sFILEX));
        if (g == NULL)
                return (NULL);
        p = (FILE *)ALIGN(g + 1);
+       fx = (struct __sFILEX *)&p[n];
        g->next = NULL;
        g->niobs = n;
        g->iobs = p;
-       while (--n >= 0)
-               *p++ = empty;
+        
+       while (--n >= 0) {
+               *p = empty;
+               p->_extra = fx;
+               *p->_extra = emptyx;
+               p++, fx++;
+       }
        return (g);
 }
 
@@ -115,7 +158,7 @@ moreglue(n)
  * Find a free FILE for fopen et al.
  */
 FILE *
-__sfp()
+__sfp(int count)
 {
        FILE    *fp;
        int     n;
@@ -123,6 +166,15 @@ __sfp()
 
        if (!__sdidinit)
                __sinit();
+
+       if (count) {
+               if (__scounted >= __stream_max) {
+                       THREAD_UNLOCK();
+                       errno = EMFILE;
+                       return NULL;
+               }
+               OSAtomicIncrement32(&__scounted);
+       }
        /*
         * The list must be locked because a FILE may be updated.
         */
@@ -155,11 +207,24 @@ found:
        fp->_lb._base = NULL;   /* no line buffer */
        fp->_lb._size = 0;
 /*     fp->_lock = NULL; */    /* once set always set (reused) */
-       fp->_orientation = 0;
-       memset(&fp->_mbstate, 0, sizeof(mbstate_t));
+       INITEXTRA(fp);
+       fp->_extra->counted = count ? 1 : 0;
        return (fp);
 }
 
+/*
+ * Mark as free and update count as needed
+ */
+__private_extern__ void
+__sfprelease(FILE *fp)
+{
+       if (fp->_counted) {
+               OSAtomicDecrement32(&__scounted);
+               fp->_counted = 0;
+       }
+       fp->_flags = 0;
+}
+
 /*
  * XXX.  Force immediate allocation of internal memory.  Not used by stdio,
  * but documented historically for certain applications.  Bad applications.
@@ -209,8 +274,25 @@ _cleanup()
 void
 __sinit()
 {
+       THREAD_LOCK();
+       if (__sdidinit == 0) {
+#if !TARGET_OS_EMBEDDED
+               int i;
+#endif
+               /* Make sure we clean up on exit. */
+               __cleanup = _cleanup;           /* conservative */
+               __stream_max = sysconf(_SC_STREAM_MAX);
+               __scounted = 3;                 /* std{in,out,err} already exists */
+
+#if !TARGET_OS_EMBEDDED
+               /* Set _extra for the usual suspects. */
+               for (i = 0; i < FOPEN_MAX - 3; i++) {
+                       usual[i]._extra = &usual_extra[i];
+                       INITEXTRA(&usual[i]);
+               }
+#endif
 
-       /* Make sure we clean up on exit. */
-       __cleanup = _cleanup;           /* conservative */
-       __sdidinit = 1;
+               __sdidinit = 1;
+       }
+       THREAD_UNLOCK();
 }
diff --git a/stdio/FreeBSD/findfp.c.patch b/stdio/FreeBSD/findfp.c.patch
deleted file mode 100644 (file)
index 01da320..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
---- findfp.c.orig      2011-02-15 16:29:38.000000000 -0800
-+++ findfp.c   2011-02-16 10:36:00.000000000 -0800
-@@ -36,13 +36,18 @@ static char sccsid[] = "@(#)findfp.c       8.2
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Exp $");
-+#include <TargetConditionals.h>
-+
- #include <sys/param.h>
- #include <machine/atomic.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <libkern/OSAtomic.h>
-+#include <errno.h>
-+#include <pthread.h>
- #include <spinlock.h>
- #include "libc_private.h"
-@@ -51,7 +56,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- int   __sdidinit;
-+#if !TARGET_OS_EMBEDDED
- #define       NDYNAMIC 10             /* add ten more whenever necessary */
-+#else
-+#define       NDYNAMIC 1              /* add one at a time on embedded */
-+#endif
- #define       std(flags, file) {              \
-       ._flags = (flags),              \
-@@ -61,12 +70,32 @@ int        __sdidinit;
-       ._read = __sread,               \
-       ._seek = __sseek,               \
-       ._write = __swrite,             \
-+      ._extra = __sFX + file,         \
- }
-+#define __sFXInit       {.fl_mutex = PTHREAD_MUTEX_INITIALIZER}
-+  /* set counted */
-+#define __sFXInit3      {.fl_mutex = PTHREAD_MUTEX_INITIALIZER, .counted = 1}
-+
-+static int __scounted;                /* streams counted against STREAM_MAX */
-+static int __stream_max;
-+
-+#if !TARGET_OS_EMBEDDED
-+/* usual and usual_extra are data pigs. See 7929728. For embedded we should
-+ * always allocate dynamically, and probably should for desktop too. */
-                               /* the usual - (stdin + stdout + stderr) */
- static FILE usual[FOPEN_MAX - 3];
-+static struct __sFILEX usual_extra[FOPEN_MAX - 3];
- static struct glue uglue = { NULL, FOPEN_MAX - 3, usual };
-+#endif /* !TARGET_OS_EMBEDDED */
--static FILE __sF[3] = {
-+static struct __sFILEX __sFX[3] = {__sFXInit3, __sFXInit3, __sFXInit3};
-+
-+/*
-+ * We can't make this 'static' due to binary compatibility concerns.
-+ * This also means we cannot change the sizeof(FILE) and must continue to
-+ * use the __sFILEX stuff to add to FILE.
-+ */
-+FILE __sF[3] = {
-       std(__SRD, STDIN_FILENO),
-       std(__SWR, STDOUT_FILENO),
-       std(__SWR|__SNBF, STDERR_FILENO)
-@@ -76,8 +105,13 @@ FILE *__stdinp = &__sF[0];
- FILE *__stdoutp = &__sF[1];
- FILE *__stderrp = &__sF[2];
-+#if !TARGET_OS_EMBEDDED
- struct glue __sglue = { &uglue, 3, __sF };
- static struct glue *lastglue = &uglue;
-+#else
-+struct glue __sglue = { NULL, 3, __sF };
-+static struct glue *lastglue = &__sglue;
-+#endif
- static struct glue *  moreglue(int);
-@@ -98,16 +132,25 @@ moreglue(n)
-       struct glue *g;
-       static FILE empty;
-       FILE *p;
-+      static struct __sFILEX emptyx = __sFXInit;
-+      struct __sFILEX *fx;
--      g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE));
-+      g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE) +
-+          n * sizeof(struct __sFILEX));
-       if (g == NULL)
-               return (NULL);
-       p = (FILE *)ALIGN(g + 1);
-+      fx = (struct __sFILEX *)&p[n];
-       g->next = NULL;
-       g->niobs = n;
-       g->iobs = p;
--      while (--n >= 0)
--              *p++ = empty;
-+        
-+      while (--n >= 0) {
-+              *p = empty;
-+              p->_extra = fx;
-+              *p->_extra = emptyx;
-+              p++, fx++;
-+      }
-       return (g);
- }
-@@ -115,7 +158,7 @@ moreglue(n)
-  * Find a free FILE for fopen et al.
-  */
- FILE *
--__sfp()
-+__sfp(int count)
- {
-       FILE    *fp;
-       int     n;
-@@ -123,6 +166,15 @@ __sfp()
-       if (!__sdidinit)
-               __sinit();
-+
-+      if (count) {
-+              if (__scounted >= __stream_max) {
-+                      THREAD_UNLOCK();
-+                      errno = EMFILE;
-+                      return NULL;
-+              }
-+              OSAtomicIncrement32(&__scounted);
-+      }
-       /*
-        * The list must be locked because a FILE may be updated.
-        */
-@@ -155,12 +207,25 @@ found:
-       fp->_lb._base = NULL;   /* no line buffer */
-       fp->_lb._size = 0;
- /*    fp->_lock = NULL; */    /* once set always set (reused) */
--      fp->_orientation = 0;
--      memset(&fp->_mbstate, 0, sizeof(mbstate_t));
-+      INITEXTRA(fp);
-+      fp->_extra->counted = count ? 1 : 0;
-       return (fp);
- }
- /*
-+ * Mark as free and update count as needed
-+ */
-+__private_extern__ void
-+__sfprelease(FILE *fp)
-+{
-+      if (fp->_counted) {
-+              OSAtomicDecrement32(&__scounted);
-+              fp->_counted = 0;
-+      }
-+      fp->_flags = 0;
-+}
-+
-+/*
-  * XXX.  Force immediate allocation of internal memory.  Not used by stdio,
-  * but documented historically for certain applications.  Bad applications.
-  */
-@@ -209,8 +274,25 @@ _cleanup()
- void
- __sinit()
- {
-+      THREAD_LOCK();
-+      if (__sdidinit == 0) {
-+#if !TARGET_OS_EMBEDDED
-+              int i;
-+#endif
-+              /* Make sure we clean up on exit. */
-+              __cleanup = _cleanup;           /* conservative */
-+              __stream_max = sysconf(_SC_STREAM_MAX);
-+              __scounted = 3;                 /* std{in,out,err} already exists */
-+
-+#if !TARGET_OS_EMBEDDED
-+              /* Set _extra for the usual suspects. */
-+              for (i = 0; i < FOPEN_MAX - 3; i++) {
-+                      usual[i]._extra = &usual_extra[i];
-+                      INITEXTRA(&usual[i]);
-+              }
-+#endif
--      /* Make sure we clean up on exit. */
--      __cleanup = _cleanup;           /* conservative */
--      __sdidinit = 1;
-+              __sdidinit = 1;
-+      }
-+      THREAD_UNLOCK();
- }
index 17d175db19130c6ed12e31d6aef343d3507c63a3..3b90476c2c24bd323dbac74e0112d254e30e12ef 100644 (file)
@@ -81,10 +81,17 @@ __sflags(mode, optr)
        }
 
        /* [rwa]\+ or [rwa]b\+ means read and write */
-       if (*mode == '+' || (*mode == 'b' && mode[1] == '+')) {
+       if (*mode == 'b')
+               mode++;
+       if (*mode == '+') {
                ret = __SRW;
                m = O_RDWR;
+               mode++;
+               if (*mode == 'b')
+                       mode++;
        }
+       if (*mode == 'x')
+               o |= O_EXCL;
        *optr = m | o;
        return (ret);
 }
diff --git a/stdio/FreeBSD/flags.c.patch b/stdio/FreeBSD/flags.c.patch
deleted file mode 100644 (file)
index 1710d8a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- flags.c.bsdnew     2009-11-11 13:33:06.000000000 -0800
-+++ flags.c    2009-11-11 13:33:06.000000000 -0800
-@@ -81,10 +81,17 @@ __sflags(mode, optr)
-       }
-       /* [rwa]\+ or [rwa]b\+ means read and write */
--      if (*mode == '+' || (*mode == 'b' && mode[1] == '+')) {
-+      if (*mode == 'b')
-+              mode++;
-+      if (*mode == '+') {
-               ret = __SRW;
-               m = O_RDWR;
-+              mode++;
-+              if (*mode == 'b')
-+                      mode++;
-       }
-+      if (*mode == 'x')
-+              o |= O_EXCL;
-       *optr = m | o;
-       return (ret);
- }
index a8c9c26ecb686029d68b832047b18b93202fa101..924b9e54febba46511cac05522dcea2283b68ecc 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft void
-.Fn flockfile "FILE *stream"
+.Fn flockfile "FILE *file"
 .Ft int
-.Fn ftrylockfile "FILE *stream"
+.Fn ftrylockfile "FILE *file"
 .Ft void
-.Fn funlockfile "FILE *stream"
+.Fn funlockfile "FILE *file"
 .Sh DESCRIPTION
-These functions provide explicit application-level locking of stdio streams.
+These functions provide explicit application-level locking
+of stdio FILE objects.
 They can be used to avoid output from multiple threads being interspersed,
 input being dispersed among multiple readers, and to avoid the overhead
-of locking the stream for each operation.
+of locking the object for each operation.
 .Pp
 The
 .Fn flockfile
-function acquires an exclusive lock on the specified stream.
-If another thread has already locked the stream,
+function acquires an exclusive lock on the specified object.
+If another thread has already locked the object,
 .Fn flockfile
 will block until the lock is released.
 .Pp
@@ -65,19 +66,19 @@ returns non-zero instead of blocking.
 .Pp
 The
 .Fn funlockfile
-function releases the lock on a stream acquired by an earlier call to
+function releases the lock on an object acquired by an earlier call to
 .Fn flockfile
 or
 .Fn ftrylockfile .
 .Pp
 These functions behave as if there is a lock count associated
-with each stream.
+with each object.
 Each time
 .Fn flockfile
-is called on the stream, the count is incremented,
+is called on the object, the count is incremented,
 and each time
 .Fn funlockfile
-is called on the stream, the count is decremented.
+is called on the object, the count is decremented.
 The lock is only actually released when the count reaches zero.
 .Sh RETURN VALUES
 The
@@ -89,7 +90,7 @@ functions return no value.
 The
 .Fn ftrylockfile
 function
-returns zero if the stream was successfully locked,
+returns zero if the object was successfully locked,
 non-zero otherwise.
 .Sh SEE ALSO
 .Xr getc_unlocked 3 ,
@@ -97,7 +98,7 @@ non-zero otherwise.
 .Sh STANDARDS
 The
 .Fn flockfile ,
-.Fn ftrylockfile
+.Fn ftrylockfile ,
 and
 .Fn funlockfile
 functions conform to
diff --git a/stdio/FreeBSD/flockfile.3.patch b/stdio/FreeBSD/flockfile.3.patch
deleted file mode 100644 (file)
index 7cbffa9..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
---- _SB/Libc/stdio/FreeBSD/flockfile.3 2003-05-20 15:22:41.000000000 -0700
-+++ _SB/Libc/stdio/FreeBSD/flockfile.3.edit    2006-06-28 16:55:52.000000000 -0700
-@@ -37,21 +37,22 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft void
--.Fn flockfile "FILE *stream"
-+.Fn flockfile "FILE *file"
- .Ft int
--.Fn ftrylockfile "FILE *stream"
-+.Fn ftrylockfile "FILE *file"
- .Ft void
--.Fn funlockfile "FILE *stream"
-+.Fn funlockfile "FILE *file"
- .Sh DESCRIPTION
--These functions provide explicit application-level locking of stdio streams.
-+These functions provide explicit application-level locking
-+of stdio FILE objects.
- They can be used to avoid output from multiple threads being interspersed,
- input being dispersed among multiple readers, and to avoid the overhead
--of locking the stream for each operation.
-+of locking the object for each operation.
- .Pp
- The
- .Fn flockfile
--function acquires an exclusive lock on the specified stream.
--If another thread has already locked the stream,
-+function acquires an exclusive lock on the specified object.
-+If another thread has already locked the object,
- .Fn flockfile
- will block until the lock is released.
- .Pp
-@@ -65,19 +66,19 @@
- .Pp
- The
- .Fn funlockfile
--function releases the lock on a stream acquired by an earlier call to
-+function releases the lock on an object acquired by an earlier call to
- .Fn flockfile
- or
- .Fn ftrylockfile .
- .Pp
- These functions behave as if there is a lock count associated
--with each stream.
-+with each object.
- Each time
- .Fn flockfile
--is called on the stream, the count is incremented,
-+is called on the object, the count is incremented,
- and each time
- .Fn funlockfile
--is called on the stream, the count is decremented.
-+is called on the object, the count is decremented.
- The lock is only actually released when the count reaches zero.
- .Sh RETURN VALUES
- The
-@@ -89,7 +90,7 @@
- The
- .Fn ftrylockfile
- function
--returns zero if the stream was successfully locked,
-+returns zero if the object was successfully locked,
- non-zero otherwise.
- .Sh SEE ALSO
- .Xr getc_unlocked 3 ,
-@@ -97,7 +98,7 @@
- .Sh STANDARDS
- The
- .Fn flockfile ,
--.Fn ftrylockfile
-+.Fn ftrylockfile ,
- and
- .Fn funlockfile
- functions conform to
index aed05115db1c31d2a4e5fbaae6735659f4c5d665..3bb0c0f8b5755d568ba43a1ff10c8b6406c51978 100644 (file)
@@ -36,8 +36,8 @@
 .Dt FOPEN 3
 .Os
 .Sh NAME
-.Nm fopen ,
 .Nm fdopen ,
+.Nm fopen ,
 .Nm freopen
 .Nd stream open functions
 .Sh LIBRARY
 .Sh SYNOPSIS
 .In stdio.h
 .Ft FILE *
-.Fn fopen "const char * restrict path" "const char * restrict mode"
+.Fo fdopen
+.Fa "int fildes"
+.Fa "const char *mode"
+.Fc
 .Ft FILE *
-.Fn fdopen "int fildes" "const char *mode"
+.Fo fopen
+.Fa "const char *restrict filename"
+.Fa "const char *restrict mode"
+.Fc
 .Ft FILE *
-.Fn freopen "const char *path" "const char *mode" "FILE *stream"
+.Fo freopen
+.Fa "const char *restrict filename"
+.Fa "const char *restrict mode"
+.Fa "FILE *restrict stream"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn fopen
 function
 opens the file whose name is the string pointed to by
-.Fa path
+.Fa filename
 and associates a stream with it.
 .Pp
 The argument
@@ -103,6 +113,17 @@ This is strictly for compatibility with
 .St -isoC
 and has no effect; the ``b'' is ignored.
 .Pp
+Finally, as an extension to the standards (and thus may not be portable),
+.Fa mode
+string may end with the letter ``x'', which insists on creating a new file
+when used with ``w'' or ``a''.
+If
+.Fa path
+exists, then an error is returned (this is the equivalent of specifying
+.Dv O_EXCL
+with
+.Xr open 2 ) .
+.Pp
 Any created files will have mode
 .Pf \\*q Dv S_IRUSR
 \&|
@@ -144,7 +165,7 @@ The
 .Fn freopen
 function
 opens the file whose name is the string pointed to by
-.Fa path
+.Fa filename
 and associates the stream pointed to by
 .Fa stream
 with it.
@@ -156,7 +177,7 @@ argument is used just as in the
 function.
 .Pp
 If the
-.Fa path
+.Fa filename
 argument is
 .Dv NULL ,
 .Fn freopen
@@ -200,7 +221,7 @@ or
 .Sh RETURN VALUES
 Upon successful completion
 .Fn fopen ,
-.Fn fdopen
+.Fn fdopen ,
 and
 .Fn freopen
 return a
diff --git a/stdio/FreeBSD/fopen.3.patch b/stdio/FreeBSD/fopen.3.patch
deleted file mode 100644 (file)
index cfb6e0c..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
---- fopen.3.bsdnew     2009-11-11 13:33:06.000000000 -0800
-+++ fopen.3    2009-11-11 13:33:07.000000000 -0800
-@@ -36,8 +36,8 @@
- .Dt FOPEN 3
- .Os
- .Sh NAME
--.Nm fopen ,
- .Nm fdopen ,
-+.Nm fopen ,
- .Nm freopen
- .Nd stream open functions
- .Sh LIBRARY
-@@ -45,17 +45,27 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft FILE *
--.Fn fopen "const char * restrict path" "const char * restrict mode"
-+.Fo fdopen
-+.Fa "int fildes"
-+.Fa "const char *mode"
-+.Fc
- .Ft FILE *
--.Fn fdopen "int fildes" "const char *mode"
-+.Fo fopen
-+.Fa "const char *restrict filename"
-+.Fa "const char *restrict mode"
-+.Fc
- .Ft FILE *
--.Fn freopen "const char *path" "const char *mode" "FILE *stream"
-+.Fo freopen
-+.Fa "const char *restrict filename"
-+.Fa "const char *restrict mode"
-+.Fa "FILE *restrict stream"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn fopen
- function
- opens the file whose name is the string pointed to by
--.Fa path
-+.Fa filename
- and associates a stream with it.
- .Pp
- The argument
-@@ -103,6 +113,17 @@ This is strictly for compatibility with
- .St -isoC
- and has no effect; the ``b'' is ignored.
- .Pp
-+Finally, as an extension to the standards (and thus may not be portable),
-+.Fa mode
-+string may end with the letter ``x'', which insists on creating a new file
-+when used with ``w'' or ``a''.
-+If
-+.Fa path
-+exists, then an error is returned (this is the equivalent of specifying
-+.Dv O_EXCL
-+with
-+.Xr open 2 ) .
-+.Pp
- Any created files will have mode
- .Pf \\*q Dv S_IRUSR
- \&|
-@@ -144,7 +165,7 @@ The
- .Fn freopen
- function
- opens the file whose name is the string pointed to by
--.Fa path
-+.Fa filename
- and associates the stream pointed to by
- .Fa stream
- with it.
-@@ -156,7 +177,7 @@ argument is used just as in the
- function.
- .Pp
- If the
--.Fa path
-+.Fa filename
- argument is
- .Dv NULL ,
- .Fn freopen
-@@ -200,7 +221,7 @@ or
- .Sh RETURN VALUES
- Upon successful completion
- .Fn fopen ,
--.Fn fdopen
-+.Fn fdopen ,
- and
- .Fn freopen
- return a
index af7b71b40ca9f91729a48a43edf4b3fc3cc24ec1..df3deea7d5d401433ee605257236572404e09622 100644 (file)
  * SUCH DAMAGE.
  */
 
+#ifdef VARIANT_DARWINEXTSN
+#define _DARWIN_UNLIMITED_STREAMS
+#define COUNT  0
+#elif defined(VARIANT_LEGACY)
+#define COUNT  0
+#else
+#define COUNT  1
+#endif
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)fopen.c    8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
@@ -59,10 +68,10 @@ fopen(file, mode)
 
        if ((flags = __sflags(mode, &oflags)) == 0)
                return (NULL);
-       if ((fp = __sfp()) == NULL)
+       if ((fp = __sfp(COUNT)) == NULL)
                return (NULL);
        if ((f = _open(file, oflags, DEFFILEMODE)) < 0) {
-               fp->_flags = 0;                 /* release */
+               __sfprelease(fp);               /* release */
                return (NULL);
        }
        /*
diff --git a/stdio/FreeBSD/fopen.c.patch b/stdio/FreeBSD/fopen.c.patch
deleted file mode 100644 (file)
index cd254a8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- fopen.c.bsdnew     2009-11-11 13:33:07.000000000 -0800
-+++ fopen.c    2009-11-11 13:33:07.000000000 -0800
-@@ -30,6 +30,15 @@
-  * SUCH DAMAGE.
-  */
-+#ifdef VARIANT_DARWINEXTSN
-+#define _DARWIN_UNLIMITED_STREAMS
-+#define COUNT 0
-+#elif defined(VARIANT_LEGACY)
-+#define COUNT 0
-+#else
-+#define COUNT 1
-+#endif
-+
- #if defined(LIBC_SCCS) && !defined(lint)
- static char sccsid[] = "@(#)fopen.c   8.1 (Berkeley) 6/4/93";
- #endif /* LIBC_SCCS and not lint */
-@@ -59,10 +68,10 @@ fopen(file, mode)
-       if ((flags = __sflags(mode, &oflags)) == 0)
-               return (NULL);
--      if ((fp = __sfp()) == NULL)
-+      if ((fp = __sfp(COUNT)) == NULL)
-               return (NULL);
-       if ((f = _open(file, oflags, DEFFILEMODE)) < 0) {
--              fp->_flags = 0;                 /* release */
-+              __sfprelease(fp);               /* release */
-               return (NULL);
-       }
-       /*
index f061bc92dc2d42e1f6ec3db9e14000b62838ef5d..76bca945b9bb449bf13fecf92ecdfd5d70fc353e 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fprintf.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 
@@ -46,7 +48,20 @@ fprintf(FILE * __restrict fp, const char * __restrict fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       ret = vfprintf(fp, fmt, ap);
+       ret = vfprintf_l(fp, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
+}
+
+int
+fprintf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       /* no need to call NORMALIZE_LOCALE(loc), because vfprintf_l will */
+       va_start(ap, fmt);
+       ret = vfprintf_l(fp, loc, fmt, ap);
        va_end(ap);
        return (ret);
 }
diff --git a/stdio/FreeBSD/fprintf.c.patch b/stdio/FreeBSD/fprintf.c.patch
deleted file mode 100644 (file)
index add604c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---- fprintf.c.bsdnew   2009-11-11 13:33:07.000000000 -0800
-+++ fprintf.c  2009-11-11 13:33:07.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fprintf.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fprintf.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdarg.h>
-@@ -46,7 +48,20 @@ fprintf(FILE * __restrict fp, const char
-       va_list ap;
-       va_start(ap, fmt);
--      ret = vfprintf(fp, fmt, ap);
-+      ret = vfprintf_l(fp, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+fprintf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc), because vfprintf_l will */
-+      va_start(ap, fmt);
-+      ret = vfprintf_l(fp, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
- }
index c0feb0cfdb0f06450734d022a4518cfe7e1d83b7..4c4ca1ee898251e5b42e94a2be7094eeb2fabe01 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft int
-.Fn fputs "const char *str" "FILE *stream"
+.Fo fputs
+.Fa "const char *restrict s"
+.Fa "FILE *restrict stream"
+.Fc
 .Ft int
-.Fn puts "const char *str"
+.Fo puts
+.Fa "const char *s"
+.Fc
 .Sh DESCRIPTION
 The function
 .Fn fputs
 writes the string pointed to by
-.Fa str
+.Fa s
 to the stream pointed to by
 .Fa stream .
 .\" The terminating
@@ -61,7 +66,7 @@ to the stream pointed to by
 The function
 .Fn puts
 writes the string
-.Fa str ,
+.Fa s ,
 and a terminating newline character,
 to the stream
 .Dv stdout .
@@ -90,6 +95,14 @@ may also fail and set
 .Va errno
 for any of the errors specified for the routines
 .Xr write 2 .
+.Sh COMPATIBILITY
+.Fn fputs
+now returns a non-negative number (as opposed to 0)
+on successful completion.
+As a result, many tests (e.g., "fputs() == 0", "fputs() != 0")
+do not give the desired result.
+Use "fputs() != EOF" or "fputs() == EOF"
+to determine success or failure.
 .Sh SEE ALSO
 .Xr ferror 3 ,
 .Xr fputws 3 ,
@@ -102,3 +115,13 @@ and
 .Fn puts
 conform to
 .St -isoC .
+While not mentioned in the standard, both
+.Fn fputs
+and
+.Fn puts
+print
+.Ql (null)
+if
+.Fa str
+is
+.Dv NULL .
diff --git a/stdio/FreeBSD/fputs.3.patch b/stdio/FreeBSD/fputs.3.patch
deleted file mode 100644 (file)
index 8f929c4..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
---- fputs.3.bsdnew     2009-11-11 13:33:07.000000000 -0800
-+++ fputs.3    2009-11-11 13:33:08.000000000 -0800
-@@ -44,14 +44,19 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft int
--.Fn fputs "const char *str" "FILE *stream"
-+.Fo fputs
-+.Fa "const char *restrict s"
-+.Fa "FILE *restrict stream"
-+.Fc
- .Ft int
--.Fn puts "const char *str"
-+.Fo puts
-+.Fa "const char *s"
-+.Fc
- .Sh DESCRIPTION
- The function
- .Fn fputs
- writes the string pointed to by
--.Fa str
-+.Fa s
- to the stream pointed to by
- .Fa stream .
- .\" The terminating
-@@ -61,7 +66,7 @@ to the stream pointed to by
- The function
- .Fn puts
- writes the string
--.Fa str ,
-+.Fa s ,
- and a terminating newline character,
- to the stream
- .Dv stdout .
-@@ -90,6 +95,14 @@ may also fail and set
- .Va errno
- for any of the errors specified for the routines
- .Xr write 2 .
-+.Sh COMPATIBILITY
-+.Fn fputs
-+now returns a non-negative number (as opposed to 0)
-+on successful completion.
-+As a result, many tests (e.g., "fputs() == 0", "fputs() != 0")
-+do not give the desired result.
-+Use "fputs() != EOF" or "fputs() == EOF"
-+to determine success or failure.
- .Sh SEE ALSO
- .Xr ferror 3 ,
- .Xr fputws 3 ,
-@@ -102,3 +115,13 @@ and
- .Fn puts
- conform to
- .St -isoC .
-+While not mentioned in the standard, both
-+.Fn fputs
-+and
-+.Fn puts
-+print
-+.Ql (null)
-+if
-+.Fa str
-+is
-+.Dv NULL .
index a52168580c0c778430d717d8b49995d40d82b5aa..163541bec88ff73d8a2157aa7e41069b2747ca79 100644 (file)
@@ -44,6 +44,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/fputs.c,v 1.12 2007/01/09 00:28:06 imp Ex
 #include "libc_private.h"
 #include "local.h"
 
+// 3340719: __puts_null__ is used if string is NULL.  Defined in puts.c
+__private_extern__ char const __puts_null__[];
+
 /*
  * Write the given string to the given file.
  */
@@ -56,6 +59,9 @@ fputs(s, fp)
        struct __suio uio;
        struct __siov iov;
 
+       // 3340719: __puts_null__ is used if s is NULL
+       if(s == NULL)
+               s = __puts_null__;
        iov.iov_base = (void *)s;
        iov.iov_len = uio.uio_resid = strlen(s);
        uio.uio_iov = &iov;
@@ -64,5 +70,9 @@ fputs(s, fp)
        ORIENT(fp, -1);
        retval = __sfvwrite(fp, &uio);
        FUNLOCKFILE(fp);
+#if __DARWIN_UNIX03
+       if (retval == 0)
+               return iov.iov_len;
+#endif /* __DARWIN_UNIX03 */
        return (retval);
 }
diff --git a/stdio/FreeBSD/fputs.c.patch b/stdio/FreeBSD/fputs.c.patch
deleted file mode 100644 (file)
index 94ddea7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- fputs.c.bsdnew     2009-11-11 13:33:08.000000000 -0800
-+++ fputs.c    2009-11-11 13:33:08.000000000 -0800
-@@ -44,6 +44,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- #include "libc_private.h"
- #include "local.h"
-+// 3340719: __puts_null__ is used if string is NULL.  Defined in puts.c
-+__private_extern__ char const __puts_null__[];
-+
- /*
-  * Write the given string to the given file.
-  */
-@@ -56,6 +59,9 @@ fputs(s, fp)
-       struct __suio uio;
-       struct __siov iov;
-+      // 3340719: __puts_null__ is used if s is NULL
-+      if(s == NULL)
-+              s = __puts_null__;
-       iov.iov_base = (void *)s;
-       iov.iov_len = uio.uio_resid = strlen(s);
-       uio.uio_iov = &iov;
-@@ -64,5 +70,9 @@ fputs(s, fp)
-       ORIENT(fp, -1);
-       retval = __sfvwrite(fp, &uio);
-       FUNLOCKFILE(fp);
-+#if __DARWIN_UNIX03
-+      if (retval == 0)
-+              return iov.iov_len;
-+#endif /* __DARWIN_UNIX03 */
-       return (retval);
- }
index a26cdbd546af78f0afa14d4c8f398528de457757..e835bc27d5a83af61148fe79bd9f9207fc279c1f 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fputwc.c,v 1.11 2008/04/17 22:17:53 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <errno.h>
 #include <limits.h>
@@ -41,13 +43,14 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/fputwc.c,v 1.11 2008/04/17 22:17:53 jhb E
 /*
  * Non-MT-safe version.
  */
-wint_t
-__fputwc(wchar_t wc, FILE *fp)
+__private_extern__ wint_t
+__fputwc(wchar_t wc, FILE *fp, locale_t loc)
 {
        char buf[MB_LEN_MAX];
        size_t i, len;
+       struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
 
-       if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
+       if (xrl->__mb_cur_max == 1 && wc > 0 && wc <= UCHAR_MAX) {
                /*
                 * Assume single-byte locale with no special encoding.
                 * A more careful test would be to check
@@ -56,7 +59,7 @@ __fputwc(wchar_t wc, FILE *fp)
                *buf = (unsigned char)wc;
                len = 1;
        } else {
-               if ((len = __wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
+               if ((len = loc->__lc_ctype->__wcrtomb(buf, wc, &fp->_mbstate, loc)) == (size_t)-1) {
                        fp->_flags |= __SERR;
                        return (WEOF);
                }
@@ -79,7 +82,21 @@ fputwc(wchar_t wc, FILE *fp)
 
        FLOCKFILE(fp);
        ORIENT(fp, 1);
-       r = __fputwc(wc, fp);
+       r = __fputwc(wc, fp, __current_locale());
+       FUNLOCKFILE(fp);
+
+       return (r);
+}
+
+wint_t
+fputwc_l(wchar_t wc, FILE *fp, locale_t loc)
+{
+       wint_t r;
+
+       NORMALIZE_LOCALE(loc);
+       FLOCKFILE(fp);
+       ORIENT(fp, 1);
+       r = __fputwc(wc, fp, loc);
        FUNLOCKFILE(fp);
 
        return (r);
diff --git a/stdio/FreeBSD/fputwc.c.patch b/stdio/FreeBSD/fputwc.c.patch
deleted file mode 100644 (file)
index 7264139..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
---- fputwc.c.orig      2009-11-11 13:33:08.000000000 -0800
-+++ fputwc.c   2009-11-13 11:45:45.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fputwc.c,v 1.11 2008/04/17 22:17:53 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <limits.h>
-@@ -41,13 +43,14 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- /*
-  * Non-MT-safe version.
-  */
--wint_t
--__fputwc(wchar_t wc, FILE *fp)
-+__private_extern__ wint_t
-+__fputwc(wchar_t wc, FILE *fp, locale_t loc)
- {
-       char buf[MB_LEN_MAX];
-       size_t i, len;
-+      struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
--      if (MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX) {
-+      if (xrl->__mb_cur_max == 1 && wc > 0 && wc <= UCHAR_MAX) {
-               /*
-                * Assume single-byte locale with no special encoding.
-                * A more careful test would be to check
-@@ -56,7 +59,7 @@ __fputwc(wchar_t wc, FILE *fp)
-               *buf = (unsigned char)wc;
-               len = 1;
-       } else {
--              if ((len = __wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
-+              if ((len = loc->__lc_ctype->__wcrtomb(buf, wc, &fp->_mbstate, loc)) == (size_t)-1) {
-                       fp->_flags |= __SERR;
-                       return (WEOF);
-               }
-@@ -79,7 +82,21 @@ fputwc(wchar_t wc, FILE *fp)
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
--      r = __fputwc(wc, fp);
-+      r = __fputwc(wc, fp, __current_locale());
-+      FUNLOCKFILE(fp);
-+
-+      return (r);
-+}
-+
-+wint_t
-+fputwc_l(wchar_t wc, FILE *fp, locale_t loc)
-+{
-+      wint_t r;
-+
-+      NORMALIZE_LOCALE(loc);
-+      FLOCKFILE(fp);
-+      ORIENT(fp, 1);
-+      r = __fputwc(wc, fp, loc);
-       FUNLOCKFILE(fp);
-       return (r);
index 096e3491db86114ddf7546e7f9eed6d6cf851fc4..d7326b2942b4f3e427aaaac8f476defdca13124e 100644 (file)
@@ -37,7 +37,8 @@
 .Dt FPUTWS 3
 .Os
 .Sh NAME
-.Nm fputws
+.Nm fputws ,
+.Nm fputws_l
 .Nd output a line of wide characters to a stream
 .Sh LIBRARY
 .Lb libc
 .In stdio.h
 .In wchar.h
 .Ft int
-.Fn fputws "const wchar_t * restrict ws" "FILE * restrict fp"
+.Fo fputws
+.Fa "const wchar_t *restrict ws"
+.Fa "FILE *restrict stream"
+.Fc
+.In stdio.h
+.In wchar.h
+.In xlocale.h
+.Ft int
+.Fo fputws_l
+.Fa "const wchar_t *restrict ws"
+.Fa "FILE *restrict stream"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn fputws
 function writes the wide character string pointed to by
 .Fa ws
 to the stream pointed to by
-.Fa fp .
+.Fa stream .
+.Pp
+Although the
+.Fn fputws
+function uses the current locale, the
+.Fn fputws_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn fputws
@@ -65,7 +86,7 @@ function will fail if:
 .Bl -tag -width Er
 .It Bq Er EBADF
 The
-.Fa fp
+.Fa stream
 argument supplied
 is not a writable stream.
 .El
@@ -80,7 +101,8 @@ for any of the errors specified for the routine
 .Xr ferror 3 ,
 .Xr fputs 3 ,
 .Xr putwc 3 ,
-.Xr stdio 3
+.Xr stdio 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn fputws
diff --git a/stdio/FreeBSD/fputws.3.patch b/stdio/FreeBSD/fputws.3.patch
deleted file mode 100644 (file)
index 3b0e069..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
---- fputws.3.bsdnew    2009-11-11 13:33:08.000000000 -0800
-+++ fputws.3   2009-11-11 13:33:08.000000000 -0800
-@@ -37,7 +37,8 @@
- .Dt FPUTWS 3
- .Os
- .Sh NAME
--.Nm fputws
-+.Nm fputws ,
-+.Nm fputws_l
- .Nd output a line of wide characters to a stream
- .Sh LIBRARY
- .Lb libc
-@@ -45,14 +46,34 @@
- .In stdio.h
- .In wchar.h
- .Ft int
--.Fn fputws "const wchar_t * restrict ws" "FILE * restrict fp"
-+.Fo fputws
-+.Fa "const wchar_t *restrict ws"
-+.Fa "FILE *restrict stream"
-+.Fc
-+.In stdio.h
-+.In wchar.h
-+.In xlocale.h
-+.Ft int
-+.Fo fputws_l
-+.Fa "const wchar_t *restrict ws"
-+.Fa "FILE *restrict stream"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn fputws
- function writes the wide character string pointed to by
- .Fa ws
- to the stream pointed to by
--.Fa fp .
-+.Fa stream .
-+.Pp
-+Although the
-+.Fn fputws
-+function uses the current locale, the
-+.Fn fputws_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn fputws
-@@ -65,7 +86,7 @@ function will fail if:
- .Bl -tag -width Er
- .It Bq Er EBADF
- The
--.Fa fp
-+.Fa stream
- argument supplied
- is not a writable stream.
- .El
-@@ -80,7 +101,8 @@ for any of the errors specified for the 
- .Xr ferror 3 ,
- .Xr fputs 3 ,
- .Xr putwc 3 ,
--.Xr stdio 3
-+.Xr stdio 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn fputws
index 6c4a3330719b77f98d639fc3ae978b5f88ad7fad..1ff04845dcbeb470c2a2dfdb3b5df35ab8c8cae7 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fputws.c,v 1.8 2009/01/15 18:53:52 rdivacky Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <errno.h>
 #include <limits.h>
@@ -39,14 +41,18 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/fputws.c,v 1.8 2009/01/15 18:53:52 rdivac
 #include "mblocal.h"
 
 int
-fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
+fputws_l(const wchar_t * __restrict ws, FILE * __restrict fp, locale_t loc)
 {
        size_t nbytes;
        char buf[BUFSIZ];
        struct __suio uio;
        struct __siov iov;
-       const wchar_t *wsp;
+       const wchar_t *wsp = ws;
+       size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
+           size_t, size_t, mbstate_t * __restrict, locale_t);
 
+       NORMALIZE_LOCALE(loc);
+       __wcsnrtombs = loc->__lc_ctype->__wcsnrtombs;
        FLOCKFILE(fp);
        ORIENT(fp, 1);
        if (prepwrite(fp) != 0)
@@ -55,15 +61,14 @@ fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
        uio.uio_iovcnt = 1;
        iov.iov_base = buf;
        do {
-               wsp = ws;
                nbytes = __wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf),
-                   &fp->_mbstate);
+                   &fp->_mbstate, loc);
                if (nbytes == (size_t)-1)
                        goto error;
                iov.iov_len = uio.uio_resid = nbytes;
                if (__sfvwrite(fp, &uio) != 0)
                        goto error;
-       } while (ws != NULL);
+       } while (wsp != NULL);
        FUNLOCKFILE(fp);
        return (0);
 
@@ -71,3 +76,9 @@ error:
        FUNLOCKFILE(fp);
        return (-1);
 }
+
+int
+fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
+{
+       return fputws_l(ws, fp, __current_locale());
+}
diff --git a/stdio/FreeBSD/fputws.c.patch b/stdio/FreeBSD/fputws.c.patch
deleted file mode 100644 (file)
index 4b2e29a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- fputws.c.orig      2010-03-18 18:11:42.000000000 -0700
-+++ fputws.c   2010-03-18 18:17:53.000000000 -0700
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fputws.c,v 1.8 2009/01/15 18:53:52 rdivacky Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <limits.h>
-@@ -39,14 +41,18 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
- #include "mblocal.h"
- int
--fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
-+fputws_l(const wchar_t * __restrict ws, FILE * __restrict fp, locale_t loc)
- {
-       size_t nbytes;
-       char buf[BUFSIZ];
-       struct __suio uio;
-       struct __siov iov;
--      const wchar_t *wsp;
-+      const wchar_t *wsp = ws;
-+      size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
-+          size_t, size_t, mbstate_t * __restrict, locale_t);
-+      NORMALIZE_LOCALE(loc);
-+      __wcsnrtombs = loc->__lc_ctype->__wcsnrtombs;
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       if (prepwrite(fp) != 0)
-@@ -55,15 +61,14 @@ fputws(const wchar_t * __restrict ws, FI
-       uio.uio_iovcnt = 1;
-       iov.iov_base = buf;
-       do {
--              wsp = ws;
-               nbytes = __wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf),
--                  &fp->_mbstate);
-+                  &fp->_mbstate, loc);
-               if (nbytes == (size_t)-1)
-                       goto error;
-               iov.iov_len = uio.uio_resid = nbytes;
-               if (__sfvwrite(fp, &uio) != 0)
-                       goto error;
--      } while (ws != NULL);
-+      } while (wsp != NULL);
-       FUNLOCKFILE(fp);
-       return (0);
-@@ -71,3 +76,9 @@ error:
-       FUNLOCKFILE(fp);
-       return (-1);
- }
-+
-+int
-+fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
-+{
-+      return fputws_l(ws, fp, __current_locale());
-+}
index 4da3569d0ae7ddc5a888e6e6adbbb804d52de8a3..1ba5005db309bc160a668a5c3c0c7a2d69556276 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft size_t
-.Fn fread "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
+.Fn fread "void *restrict ptr" "size_t size" "size_t nitems" \
+    "FILE *restrict stream"
 .Ft size_t
-.Fn fwrite "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
+.Fn fwrite "const void *restrict ptr" "size_t size" "size_t nitems" \
+    "FILE *restrict stream"
 .Sh DESCRIPTION
 The function
 .Fn fread
 reads
-.Fa nmemb
+.Fa nitems
 objects, each
 .Fa size
 bytes long, from the stream pointed to by
@@ -62,7 +64,7 @@ storing them at the location given by
 The function
 .Fn fwrite
 writes
-.Fa nmemb
+.Fa nitems
 objects, each
 .Fa size
 bytes long, to the stream pointed to by
@@ -82,7 +84,7 @@ the return value is a short object count (or zero).
 .Pp
 The function
 .Fn fread
-does not distinguish between end-of-file and error, and callers
+does not distinguish between end-of-file and error; callers
 must use
 .Xr feof 3
 and
@@ -91,7 +93,7 @@ to determine which occurred.
 The function
 .Fn fwrite
 returns a value less than
-.Fa nmemb
+.Fa nitems
 only if a write error has occurred.
 .Sh SEE ALSO
 .Xr read 2 ,
diff --git a/stdio/FreeBSD/fread.3.patch b/stdio/FreeBSD/fread.3.patch
deleted file mode 100644 (file)
index 2b00f38..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
---- fread.3.bsdnew     2009-11-11 13:33:08.000000000 -0800
-+++ fread.3    2009-11-11 13:33:09.000000000 -0800
-@@ -44,14 +44,16 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft size_t
--.Fn fread "void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
-+.Fn fread "void *restrict ptr" "size_t size" "size_t nitems" \
-+    "FILE *restrict stream"
- .Ft size_t
--.Fn fwrite "const void * restrict ptr" "size_t size" "size_t nmemb" "FILE * restrict stream"
-+.Fn fwrite "const void *restrict ptr" "size_t size" "size_t nitems" \
-+    "FILE *restrict stream"
- .Sh DESCRIPTION
- The function
- .Fn fread
- reads
--.Fa nmemb
-+.Fa nitems
- objects, each
- .Fa size
- bytes long, from the stream pointed to by
-@@ -62,7 +64,7 @@ storing them at the location given by
- The function
- .Fn fwrite
- writes
--.Fa nmemb
-+.Fa nitems
- objects, each
- .Fa size
- bytes long, to the stream pointed to by
-@@ -82,7 +84,7 @@ the return value is a short object count
- .Pp
- The function
- .Fn fread
--does not distinguish between end-of-file and error, and callers
-+does not distinguish between end-of-file and error; callers
- must use
- .Xr feof 3
- and
-@@ -91,7 +93,7 @@ to determine which occurred.
- The function
- .Fn fwrite
- returns a value less than
--.Fa nmemb
-+.Fa nitems
- only if a write error has occurred.
- .Sh SEE ALSO
- .Xr read 2 ,
index 2430dab03f641e9c6055a260064e6c2d01094954..544d94a77c49bc02294004f887f7579d506afbd9 100644 (file)
@@ -63,7 +63,7 @@ __fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp)
 {
        size_t resid;
        char *p;
-       int r;
+       int r, ret;
        size_t total;
 
        /*
@@ -76,19 +76,66 @@ __fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp)
                fp->_r = 0;
        total = resid;
        p = buf;
+       /* first deal with anything left in buffer, plus any ungetc buffers */
        while (resid > (r = fp->_r)) {
                (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
                fp->_p += r;
                /* fp->_r = 0 ... done in __srefill */
                p += r;
                resid -= r;
-               if (__srefill(fp)) {
+               if ((ret = __srefill0(fp)) > 0)
+                       break;
+               else if (ret) {
                        /* no more input: return partial result */
                        return ((total - resid) / size);
                }
        }
-       (void)memcpy((void *)p, (void *)fp->_p, resid);
-       fp->_r -= resid;
-       fp->_p += resid;
+       /*
+        * 5980080: don't use optimization if __SMBF not set (meaning setvbuf
+        * was called, and the buffer belongs to the user).
+        * 6180417: but for unbuffered (__SMBF is not set), so specifically
+        * test for it.
+        */
+       if ((fp->_flags & (__SMBF | __SNBF)) && resid > fp->_bf._size) {
+               struct __sbuf save;
+               size_t n;
+
+               save = fp->_bf;
+               fp->_bf._base = p;
+               fp->_bf._size = resid;
+               while (fp->_bf._size > 0) {
+                       if ((ret = __srefill1(fp)) != 0) {
+                               /* no more input: return partial result */
+                               resid = fp->_bf._size;
+                               fp->_bf = save;
+                               fp->_p = fp->_bf._base;
+                               /* fp->_r = 0;  already set in __srefill1 */
+                               return ((total - resid) / size);
+                       }
+                       fp->_bf._base += fp->_r;
+                       fp->_bf._size -= fp->_r;
+               }
+               fp->_bf = save;
+               n = fp->_bf._size * ((resid - 1) / fp->_bf._size);
+               r = resid - n;
+               (void)memcpy((void *)fp->_bf._base, (void *)(p + n), (size_t)r);
+               fp->_p = fp->_bf._base + r;
+               fp->_r = 0;
+       } else {
+               while (resid > (r = fp->_r)) {
+                       (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
+                       fp->_p += r;
+                       /* fp->_r = 0 ... done in __srefill */
+                       p += r;
+                       resid -= r;
+                       if (__srefill1(fp)) {
+                               /* no more input: return partial result */
+                               return ((total - resid) / size);
+                       }
+               }
+               (void)memcpy((void *)p, (void *)fp->_p, resid);
+               fp->_r -= resid;
+               fp->_p += resid;
+       }
        return (count);
 }
diff --git a/stdio/FreeBSD/fread.c.patch b/stdio/FreeBSD/fread.c.patch
deleted file mode 100644 (file)
index 7d38746..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
---- fread.c.bsdnew     2009-11-11 13:33:09.000000000 -0800
-+++ fread.c    2009-11-11 14:14:22.000000000 -0800
-@@ -63,7 +63,7 @@ __fread(void * __restrict buf, size_t si
- {
-       size_t resid;
-       char *p;
--      int r;
-+      int r, ret;
-       size_t total;
-       /*
-@@ -76,19 +76,66 @@ __fread(void * __restrict buf, size_t si
-               fp->_r = 0;
-       total = resid;
-       p = buf;
-+      /* first deal with anything left in buffer, plus any ungetc buffers */
-       while (resid > (r = fp->_r)) {
-               (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
-               fp->_p += r;
-               /* fp->_r = 0 ... done in __srefill */
-               p += r;
-               resid -= r;
--              if (__srefill(fp)) {
-+              if ((ret = __srefill0(fp)) > 0)
-+                      break;
-+              else if (ret) {
-                       /* no more input: return partial result */
-                       return ((total - resid) / size);
-               }
-       }
--      (void)memcpy((void *)p, (void *)fp->_p, resid);
--      fp->_r -= resid;
--      fp->_p += resid;
-+      /*
-+       * 5980080: don't use optimization if __SMBF not set (meaning setvbuf
-+       * was called, and the buffer belongs to the user).
-+       * 6180417: but for unbuffered (__SMBF is not set), so specifically
-+       * test for it.
-+       */
-+      if ((fp->_flags & (__SMBF | __SNBF)) && resid > fp->_bf._size) {
-+              struct __sbuf save;
-+              size_t n;
-+
-+              save = fp->_bf;
-+              fp->_bf._base = p;
-+              fp->_bf._size = resid;
-+              while (fp->_bf._size > 0) {
-+                      if ((ret = __srefill1(fp)) != 0) {
-+                              /* no more input: return partial result */
-+                              resid = fp->_bf._size;
-+                              fp->_bf = save;
-+                              fp->_p = fp->_bf._base;
-+                              /* fp->_r = 0;  already set in __srefill1 */
-+                              return ((total - resid) / size);
-+                      }
-+                      fp->_bf._base += fp->_r;
-+                      fp->_bf._size -= fp->_r;
-+              }
-+              fp->_bf = save;
-+              n = fp->_bf._size * ((resid - 1) / fp->_bf._size);
-+              r = resid - n;
-+              (void)memcpy((void *)fp->_bf._base, (void *)(p + n), (size_t)r);
-+              fp->_p = fp->_bf._base + r;
-+              fp->_r = 0;
-+      } else {
-+              while (resid > (r = fp->_r)) {
-+                      (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
-+                      fp->_p += r;
-+                      /* fp->_r = 0 ... done in __srefill */
-+                      p += r;
-+                      resid -= r;
-+                      if (__srefill1(fp)) {
-+                              /* no more input: return partial result */
-+                              return ((total - resid) / size);
-+                      }
-+              }
-+              (void)memcpy((void *)p, (void *)fp->_p, resid);
-+              fp->_r -= resid;
-+              fp->_p += resid;
-+      }
-       return (count);
- }
index 524ae6d47a214b9a8d8475d2c293d2a6363200ba..3451106f9674a03a4e1bfa44d2cb1d1802701561 100644 (file)
@@ -98,7 +98,7 @@ freopen(file, mode, fp)
                    (oflags & O_ACCMODE)) {
                        fclose(fp);
                        FUNLOCKFILE(fp);
-                       errno = EINVAL;
+                       errno = EBADF;
                        return (NULL);
                }
                if (fp->_flags & __SWR)
@@ -131,6 +131,8 @@ freopen(file, mode, fp)
         * descriptor (if any) was associated with it.  If it was attached to
         * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin)
         * should work.  This is unnecessary if it was not a Unix file.
+        *
+        * For UNIX03, we always close if it was open.
         */
        if (fp->_flags == 0) {
                fp->_flags = __SEOF;    /* hold on to it */
@@ -141,11 +143,18 @@ freopen(file, mode, fp)
                if (fp->_flags & __SWR)
                        (void) __sflush(fp);
                /* if close is NULL, closing is a no-op, hence pointless */
+#if __DARWIN_UNIX03
+               if (fp->_close)
+                       (void) (*fp->_close)(fp->_cookie);
+               isopen = 0;
+               wantfd = -1;
+#else /* !__DARWIN_UNIX03 */
                isopen = fp->_close != NULL;
                if ((wantfd = fp->_file) < 0 && isopen) {
                        (void) (*fp->_close)(fp->_cookie);
                        isopen = 0;
                }
+#endif /* __DARWIN_UNIX03 */
        }
 
        /* Get a new descriptor to refer to the new file. */
@@ -186,7 +195,7 @@ finish:
        memset(&fp->_mbstate, 0, sizeof(mbstate_t));
 
        if (f < 0) {                    /* did not get it after all */
-               fp->_flags = 0;         /* set it free */
+               __sfprelease(fp);       /* set it free */
                FUNLOCKFILE(fp);
                errno = sverrno;        /* restore in case _close clobbered */
                return (NULL);
@@ -212,7 +221,7 @@ finish:
         * open.
         */
        if (f > SHRT_MAX) {
-               fp->_flags = 0;         /* set it free */
+               __sfprelease(fp);       /* set it free */
                FUNLOCKFILE(fp);
                errno = EMFILE;
                return (NULL);
diff --git a/stdio/FreeBSD/freopen.c.patch b/stdio/FreeBSD/freopen.c.patch
deleted file mode 100644 (file)
index ba84faa..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
---- freopen.c.bsdnew   2009-11-11 13:33:09.000000000 -0800
-+++ freopen.c  2009-11-11 14:45:57.000000000 -0800
-@@ -98,7 +98,7 @@ freopen(file, mode, fp)
-                   (oflags & O_ACCMODE)) {
-                       fclose(fp);
-                       FUNLOCKFILE(fp);
--                      errno = EINVAL;
-+                      errno = EBADF;
-                       return (NULL);
-               }
-               if (fp->_flags & __SWR)
-@@ -131,6 +131,8 @@ freopen(file, mode, fp)
-        * descriptor (if any) was associated with it.  If it was attached to
-        * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin)
-        * should work.  This is unnecessary if it was not a Unix file.
-+       *
-+       * For UNIX03, we always close if it was open.
-        */
-       if (fp->_flags == 0) {
-               fp->_flags = __SEOF;    /* hold on to it */
-@@ -141,11 +143,18 @@ freopen(file, mode, fp)
-               if (fp->_flags & __SWR)
-                       (void) __sflush(fp);
-               /* if close is NULL, closing is a no-op, hence pointless */
-+#if __DARWIN_UNIX03
-+              if (fp->_close)
-+                      (void) (*fp->_close)(fp->_cookie);
-+              isopen = 0;
-+              wantfd = -1;
-+#else /* !__DARWIN_UNIX03 */
-               isopen = fp->_close != NULL;
-               if ((wantfd = fp->_file) < 0 && isopen) {
-                       (void) (*fp->_close)(fp->_cookie);
-                       isopen = 0;
-               }
-+#endif /* __DARWIN_UNIX03 */
-       }
-       /* Get a new descriptor to refer to the new file. */
-@@ -186,7 +195,7 @@ finish:
-       memset(&fp->_mbstate, 0, sizeof(mbstate_t));
-       if (f < 0) {                    /* did not get it after all */
--              fp->_flags = 0;         /* set it free */
-+              __sfprelease(fp);       /* set it free */
-               FUNLOCKFILE(fp);
-               errno = sverrno;        /* restore in case _close clobbered */
-               return (NULL);
-@@ -212,7 +221,7 @@ finish:
-        * open.
-        */
-       if (f > SHRT_MAX) {
--              fp->_flags = 0;         /* set it free */
-+              __sfprelease(fp);       /* set it free */
-               FUNLOCKFILE(fp);
-               errno = EMFILE;
-               return (NULL);
index 27b6849af9bb1a4695cd33b0ef6ae7901c7861df..2db747e8af6c0a74c6d403180c4ec353c8d5ecf3 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fscanf.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fscanf.c,v 1.13 2007/01/09 00:28:06 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include <stdarg.h>
@@ -51,7 +53,22 @@ fscanf(FILE * __restrict fp, char const * __restrict fmt, ...)
 
        va_start(ap, fmt);
        FLOCKFILE(fp);
-       ret = __svfscanf(fp, fmt, ap);
+       ret = __svfscanf_l(fp, __current_locale(), fmt, ap);
+       va_end(ap);
+       FUNLOCKFILE(fp);
+       return (ret);
+}
+
+int
+fscanf_l(FILE * __restrict fp, locale_t loc, char const * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       NORMALIZE_LOCALE(loc);
+       va_start(ap, fmt);
+       FLOCKFILE(fp);
+       ret = __svfscanf_l(fp, loc, fmt, ap);
        va_end(ap);
        FUNLOCKFILE(fp);
        return (ret);
diff --git a/stdio/FreeBSD/fscanf.c.patch b/stdio/FreeBSD/fscanf.c.patch
deleted file mode 100644 (file)
index 4a2796c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- fscanf.c.bsdnew    2009-11-11 13:33:09.000000000 -0800
-+++ fscanf.c   2009-11-11 13:33:09.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fscanf.c 8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fscanf.c,v 1.13 2007/01/09 00:28:06 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include <stdarg.h>
-@@ -51,7 +53,22 @@ fscanf(FILE * __restrict fp, char const 
-       va_start(ap, fmt);
-       FLOCKFILE(fp);
--      ret = __svfscanf(fp, fmt, ap);
-+      ret = __svfscanf_l(fp, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      FUNLOCKFILE(fp);
-+      return (ret);
-+}
-+
-+int
-+fscanf_l(FILE * __restrict fp, locale_t loc, char const * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      NORMALIZE_LOCALE(loc);
-+      va_start(ap, fmt);
-+      FLOCKFILE(fp);
-+      ret = __svfscanf_l(fp, loc, fmt, ap);
-       va_end(ap);
-       FUNLOCKFILE(fp);
-       return (ret);
index 5a25dab0e5db601384103bb250c69d348e5c7b32..edf7791d96b873b39626b8cf0650c2b52d51269d 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft int
-.Fn fseek "FILE *stream" "long offset" "int whence"
-.Ft long
-.Fn ftell "FILE *stream"
-.Ft void
-.Fn rewind "FILE *stream"
+.Fo fgetpos
+.Fa "FILE *restrict stream"
+.Fa "fpos_t *restrict pos"
+.Fc
 .Ft int
-.Fn fgetpos "FILE * restrict stream" "fpos_t * restrict pos"
+.Fo fseek
+.Fa "FILE *stream"
+.Fa "long offset"
+.Fa "int whence"
+.Fc
 .Ft int
-.Fn fsetpos "FILE *stream" "const fpos_t *pos"
-.In sys/types.h
+.Fo fseeko
+.Fa "FILE *stream"
+.Fa "off_t offset"
+.Fa "int whence"
+.Fc
 .Ft int
-.Fn fseeko "FILE *stream" "off_t offset" "int whence"
+.Fo fsetpos
+.Fa "FILE *stream"
+.Fa "const fpos_t *pos"
+.Fc
+.Ft long
+.Fo ftell
+.Fa "FILE *stream"
+.Fc
 .Ft off_t
-.Fn ftello "FILE *stream"
+.Fo ftello
+.Fa "FILE *stream"
+.Fc
+.Ft void
+.Fo rewind
+.Fa "FILE *stream"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn fseek
@@ -243,12 +262,29 @@ for any of the errors specified for the routines
 .Xr lseek 2 ,
 and
 .Xr malloc 3 .
+.Sh LEGACY SYNOPSIS
+.Fd #include <stdio.h>
+.Fd #include <sys/types.h>
+.Pp
+.Ft int
+.br
+.Fo fseeko
+.Fa "FILE *stream"
+.Fa "off_t offset"
+.Fa "int whence"
+.Fc ;
+.Pp
+The include file
+.In sys/types.h
+supplies the definition for
+.Vt off_t .
 .Sh SEE ALSO
 .Xr lseek 2 ,
 .Xr clearerr 3 ,
 .Xr fwide 3 ,
 .Xr ungetc 3 ,
-.Xr ungetwc 3
+.Xr ungetwc 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn fgetpos ,
diff --git a/stdio/FreeBSD/fseek.3.patch b/stdio/FreeBSD/fseek.3.patch
deleted file mode 100644 (file)
index 91fe9fe..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
---- fseek.3.bsdnew     2009-11-11 13:33:09.000000000 -0800
-+++ fseek.3    2009-11-11 13:33:09.000000000 -0800
-@@ -49,20 +49,39 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft int
--.Fn fseek "FILE *stream" "long offset" "int whence"
--.Ft long
--.Fn ftell "FILE *stream"
--.Ft void
--.Fn rewind "FILE *stream"
-+.Fo fgetpos
-+.Fa "FILE *restrict stream"
-+.Fa "fpos_t *restrict pos"
-+.Fc
- .Ft int
--.Fn fgetpos "FILE * restrict stream" "fpos_t * restrict pos"
-+.Fo fseek
-+.Fa "FILE *stream"
-+.Fa "long offset"
-+.Fa "int whence"
-+.Fc
- .Ft int
--.Fn fsetpos "FILE *stream" "const fpos_t *pos"
--.In sys/types.h
-+.Fo fseeko
-+.Fa "FILE *stream"
-+.Fa "off_t offset"
-+.Fa "int whence"
-+.Fc
- .Ft int
--.Fn fseeko "FILE *stream" "off_t offset" "int whence"
-+.Fo fsetpos
-+.Fa "FILE *stream"
-+.Fa "const fpos_t *pos"
-+.Fc
-+.Ft long
-+.Fo ftell
-+.Fa "FILE *stream"
-+.Fc
- .Ft off_t
--.Fn ftello "FILE *stream"
-+.Fo ftello
-+.Fa "FILE *stream"
-+.Fc
-+.Ft void
-+.Fo rewind
-+.Fa "FILE *stream"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn fseek
-@@ -243,12 +262,29 @@ for any of the errors specified for the 
- .Xr lseek 2 ,
- and
- .Xr malloc 3 .
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <stdio.h>
-+.Fd #include <sys/types.h>
-+.Pp
-+.Ft int
-+.br
-+.Fo fseeko
-+.Fa "FILE *stream"
-+.Fa "off_t offset"
-+.Fa "int whence"
-+.Fc ;
-+.Pp
-+The include file
-+.In sys/types.h
-+supplies the definition for
-+.Vt off_t .
- .Sh SEE ALSO
- .Xr lseek 2 ,
- .Xr clearerr 3 ,
- .Xr fwide 3 ,
- .Xr ungetc 3 ,
--.Xr ungetwc 3
-+.Xr ungetwc 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn fgetpos ,
index a0849d270979c091f54ad30d8a70cedd642585eb..8bb5716320daf55f61d15c5762bf09d059d9a6a4 100644 (file)
@@ -101,6 +101,8 @@ _ftello(fp, offset)
         * Find offset of underlying I/O object, then
         * adjust for buffered bytes.
         */
+       if (__sflush(fp))               /* may adjust seek offset on append stream */
+               return (1);
        if (fp->_flags & __SOFF)
                pos = fp->_offset;
        else {
diff --git a/stdio/FreeBSD/ftell.c.patch b/stdio/FreeBSD/ftell.c.patch
deleted file mode 100644 (file)
index 528b85b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- ftell.c.bsdnew     2009-11-11 13:33:10.000000000 -0800
-+++ ftell.c    2009-11-11 13:33:10.000000000 -0800
-@@ -101,6 +101,8 @@ _ftello(fp, offset)
-        * Find offset of underlying I/O object, then
-        * adjust for buffered bytes.
-        */
-+      if (__sflush(fp))               /* may adjust seek offset on append stream */
-+              return (1);
-       if (fp->_flags & __SOFF)
-               pos = fp->_offset;
-       else {
index 64a56f261a56ded4c1808ab2dc552b2017384cce..408f0f42e2147e4f080743ba5e59608a8b9259b9 100644 (file)
@@ -63,7 +63,8 @@ funopen(const void *cookie,
                else
                        flags = __SRW;          /* read-write */
        }
-       if ((fp = __sfp()) == NULL)
+       /* funopen in not covered in SUSv3, so never count the streams */
+       if ((fp = __sfp(0)) == NULL)
                return (NULL);
        fp->_flags = flags;
        fp->_file = -1;
diff --git a/stdio/FreeBSD/funopen.c.patch b/stdio/FreeBSD/funopen.c.patch
deleted file mode 100644 (file)
index b7edcfc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- funopen.c.bsdnew   2009-11-11 13:33:10.000000000 -0800
-+++ funopen.c  2009-11-11 13:33:10.000000000 -0800
-@@ -63,7 +63,8 @@ funopen(cookie, readfn, writefn, seekfn,
-               else
-                       flags = __SRW;          /* read-write */
-       }
--      if ((fp = __sfp()) == NULL)
-+      /* funopen in not covered in SUSv3, so never count the streams */
-+      if ((fp = __sfp(0)) == NULL)
-               return (NULL);
-       fp->_flags = flags;
-       fp->_file = -1;
index 1c1961fbcc7399262ad6a9ddbd61620050f72ede..93163f3f1d94d779fed2eabf438a1c866883fafc 100644 (file)
@@ -63,10 +63,12 @@ If
 .Fa mode
 is less than zero,
 .Fa stream
-is set to byte-oriented.
-If it is greater than zero,
+is set to be byte-oriented.
+If
+.Fa mode
+is greater than zero,
 .Fa stream
-is set to wide-oriented.
+is set to be wide-oriented.
 Otherwise,
 .Fa mode
 is zero, and
diff --git a/stdio/FreeBSD/fwide.3.patch b/stdio/FreeBSD/fwide.3.patch
deleted file mode 100644 (file)
index c3c54ba..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- _SB/Libc/stdio/FreeBSD/fwide.3     2003-05-20 15:22:42.000000000 -0700
-+++ _SB/Libc/stdio/FreeBSD/fwide.3.edit        2006-06-28 16:55:52.000000000 -0700
-@@ -63,10 +63,12 @@
- .Fa mode
- is less than zero,
- .Fa stream
--is set to byte-oriented.
--If it is greater than zero,
-+is set to be byte-oriented.
-+If
-+.Fa mode
-+is greater than zero,
- .Fa stream
--is set to wide-oriented.
-+is set to be wide-oriented.
- Otherwise,
- .Fa mode
- is zero, and
index dcd6c3841fd319fe524f1fdd65a0c46c38bad804..5fefd4a20d4b1444b8df17ad7b0bab94810079f3 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -38,7 +40,21 @@ fwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       ret = vfwprintf(fp, fmt, ap);
+       ret = vfwprintf_l(fp, __current_locale(), fmt, ap);
+       va_end(ap);
+
+       return (ret);
+}
+
+int
+fwprintf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
+       va_start(ap, fmt);
+       ret = vfwprintf_l(fp, loc, fmt, ap);
        va_end(ap);
 
        return (ret);
diff --git a/stdio/FreeBSD/fwprintf.c.patch b/stdio/FreeBSD/fwprintf.c.patch
deleted file mode 100644 (file)
index f2c9940..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- fwprintf.c.orig    2003-05-20 15:22:42.000000000 -0700
-+++ fwprintf.c 2005-02-23 16:28:45.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -38,7 +40,21 @@
-       va_list ap;
-       va_start(ap, fmt);
--      ret = vfwprintf(fp, fmt, ap);
-+      ret = vfwprintf_l(fp, __current_locale(), fmt, ap);
-+      va_end(ap);
-+
-+      return (ret);
-+}
-+
-+int
-+fwprintf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
-+      va_start(ap, fmt);
-+      ret = vfwprintf_l(fp, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
index 0c40b93f17f0c5b41240742e3cc5fa048bf1810e..b1910c19bb16da25577ac79a21e1a7cd3c542a8c 100644 (file)
@@ -61,9 +61,10 @@ fwrite(buf, size, count, fp)
         * ANSI and SUSv2 require a return value of 0 if size or count are 0.
         */
        n = count * size;
+#if __DARWIN_UNIX03
        if (n == 0)
                return (0);
-
+#endif
        iov.iov_base = (void *)buf;
        uio.uio_resid = iov.iov_len = n;
        uio.uio_iov = &iov;
diff --git a/stdio/FreeBSD/fwrite.c.patch b/stdio/FreeBSD/fwrite.c.patch
deleted file mode 100644 (file)
index 5dcd790..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- fwrite.c.orig      2009-12-08 00:25:43.000000000 -0800
-+++ fwrite.c   2009-12-08 00:25:12.000000000 -0800
-@@ -61,9 +61,10 @@ fwrite(buf, size, count, fp)
-        * ANSI and SUSv2 require a return value of 0 if size or count are 0.
-        */
-       n = count * size;
-+#if __DARWIN_UNIX03
-       if (n == 0)
-               return (0);
--
-+#endif
-       iov.iov_base = (void *)buf;
-       uio.uio_resid = iov.iov_len = n;
-       uio.uio_iov = &iov;
index 47e8550215d998fc6041e8b7dddb834e3733d6c6..4fefaea1152148dbf23d21e815f034723a6ba782 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -38,7 +40,21 @@ fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
        int r;
 
        va_start(ap, fmt);
-       r = vfwscanf(fp, fmt, ap);
+       r = vfwscanf_l(fp, __current_locale(), fmt, ap);
+       va_end(ap);
+
+       return (r);
+}
+
+int
+fwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt, ...)
+{
+       va_list ap;
+       int r;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
+       va_start(ap, fmt);
+       r = vfwscanf_l(fp, loc, fmt, ap);
        va_end(ap);
 
        return (r);
diff --git a/stdio/FreeBSD/fwscanf.c.patch b/stdio/FreeBSD/fwscanf.c.patch
deleted file mode 100644 (file)
index 2b97333..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- fwscanf.c.orig     2003-05-20 15:22:42.000000000 -0700
-+++ fwscanf.c  2005-02-23 16:32:29.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -38,7 +40,21 @@
-       int r;
-       va_start(ap, fmt);
--      r = vfwscanf(fp, fmt, ap);
-+      r = vfwscanf_l(fp, __current_locale(), fmt, ap);
-+      va_end(ap);
-+
-+      return (r);
-+}
-+
-+int
-+fwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt, ...)
-+{
-+      va_list ap;
-+      int r;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
-+      va_start(ap, fmt);
-+      r = vfwscanf_l(fp, loc, fmt, ap);
-       va_end(ap);
-       return (r);
index 26a70229d125d6e993a1209797271fc1d2306ca0..b1c114b05b082930ac6a29cb74abe643b11999dd 100644 (file)
@@ -54,7 +54,7 @@
 .Ft int
 .Fn getc_unlocked "FILE *stream"
 .Ft int
-.Fn getchar void
+.Fn getchar "void"
 .Ft int
 .Fn getchar_unlocked "void"
 .Ft int
@@ -141,7 +141,7 @@ until the condition is cleared with
 .Sh STANDARDS
 The
 .Fn fgetc ,
-.Fn getc
+.Fn getc ,
 and
 .Fn getchar
 functions
diff --git a/stdio/FreeBSD/getc.3.patch b/stdio/FreeBSD/getc.3.patch
deleted file mode 100644 (file)
index 6435525..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- getc.3.bsdnew      2009-11-11 13:33:11.000000000 -0800
-+++ getc.3     2009-11-11 14:52:54.000000000 -0800
-@@ -54,7 +54,7 @@
- .Ft int
- .Fn getc_unlocked "FILE *stream"
- .Ft int
--.Fn getchar void
-+.Fn getchar "void"
- .Ft int
- .Fn getchar_unlocked "void"
- .Ft int
-@@ -141,7 +141,7 @@ until the condition is cleared with
- .Sh STANDARDS
- The
- .Fn fgetc ,
--.Fn getc
-+.Fn getc ,
- and
- .Fn getchar
- functions
index fba1461cf082660a47978dedf29dbba7836ef301..ddefe70d82cd3b73b29794dae399b568a60ccb27 100644 (file)
@@ -34,7 +34,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.Fd "#define _WITH_GETLINE"
 .In stdio.h
 .Ft ssize_t
 .Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream"
@@ -95,34 +94,6 @@ ssize_t linelen;
 while ((linelen = getline(&line, &linecap, fp)) > 0)
        fwrite(line, linelen, 1, stdout);
 .Ed
-.Sh COMPATIBILITY
-Many application writers used the name
-.Va getline
-before the
-.Fn getline
-function was introduced in
-.St -p1003.1 ,
-so a prototype is not provided by default in order to avoid
-compatibility problems.
-Applications that wish to use the
-.Fn getline
-function described herein should either request a strict
-.St -p1003.1-2008
-environment by defining the macro
-.Dv _POSIX_C_SOURCE
-to the value 200809 or greater, or by defining the macro
-.Dv _WITH_GETLINE ,
-prior to the inclusion of
-.In stdio.h .
-For compatibility with GNU libc, defining either
-.Dv _BSD_SOURCE
-or
-.Dv _GNU_SOURCE
-prior to the inclusion of
-.In stdio.h
-will also make
-.Fn getline
-available.
 .Sh ERRORS
 These functions may fail if:
 .Bl -tag -width Er
diff --git a/stdio/FreeBSD/getline.3.patch b/stdio/FreeBSD/getline.3.patch
deleted file mode 100644 (file)
index 34875e7..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
---- getline.3.orig     2009-12-15 15:37:17.000000000 -0800
-+++ getline.3  2009-12-15 15:37:57.000000000 -0800
-@@ -34,7 +34,6 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.Fd "#define _WITH_GETLINE"
- .In stdio.h
- .Ft ssize_t
- .Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream"
-@@ -95,34 +94,6 @@ ssize_t linelen;
- while ((linelen = getline(&line, &linecap, fp)) > 0)
-       fwrite(line, linelen, 1, stdout);
- .Ed
--.Sh COMPATIBILITY
--Many application writers used the name
--.Va getline
--before the
--.Fn getline
--function was introduced in
--.St -p1003.1 ,
--so a prototype is not provided by default in order to avoid
--compatibility problems.
--Applications that wish to use the
--.Fn getline
--function described herein should either request a strict
--.St -p1003.1-2008
--environment by defining the macro
--.Dv _POSIX_C_SOURCE
--to the value 200809 or greater, or by defining the macro
--.Dv _WITH_GETLINE ,
--prior to the inclusion of
--.In stdio.h .
--For compatibility with GNU libc, defining either
--.Dv _BSD_SOURCE
--or
--.Dv _GNU_SOURCE
--prior to the inclusion of
--.In stdio.h
--will also make
--.Fn getline
--available.
- .Sh ERRORS
- These functions may fail if:
- .Bl -tag -width Er
index 0f2fe2e445ad2e7d17bb50e714f0eea013effbcc..d994aadba1cf5b273b746185950969011cf7f9d1 100644 (file)
@@ -52,7 +52,7 @@
 .Ft wint_t
 .Fn getwc "FILE *stream"
 .Ft wint_t
-.Fn getwchar void
+.Fn getwchar "void"
 .Sh DESCRIPTION
 The
 .Fn fgetwc
@@ -75,6 +75,12 @@ is equivalent to
 .Fn getwc
 with the argument
 .Dv stdin .
+.Pp
+Extended locale versions of these functions are documented in
+.Xr getwc_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If successful, these routines return the next wide character
 from the
@@ -100,13 +106,14 @@ until the condition is cleared with
 .Xr fopen 3 ,
 .Xr fread 3 ,
 .Xr getc 3 ,
+.Xr getwc_l ,
 .Xr putwc 3 ,
 .Xr stdio 3 ,
 .Xr ungetwc 3
 .Sh STANDARDS
 The
 .Fn fgetwc ,
-.Fn getwc
+.Fn getwc ,
 and
 .Fn getwchar
 functions
diff --git a/stdio/FreeBSD/getwc.3.patch b/stdio/FreeBSD/getwc.3.patch
deleted file mode 100644 (file)
index a271508..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
---- getwc.3.bsdnew     2009-11-11 13:33:12.000000000 -0800
-+++ getwc.3    2009-11-11 14:56:18.000000000 -0800
-@@ -52,7 +52,7 @@
- .Ft wint_t
- .Fn getwc "FILE *stream"
- .Ft wint_t
--.Fn getwchar void
-+.Fn getwchar "void"
- .Sh DESCRIPTION
- The
- .Fn fgetwc
-@@ -75,6 +75,12 @@ is equivalent to
- .Fn getwc
- with the argument
- .Dv stdin .
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr getwc_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If successful, these routines return the next wide character
- from the
-@@ -100,13 +106,14 @@ until the condition is cleared with
- .Xr fopen 3 ,
- .Xr fread 3 ,
- .Xr getc 3 ,
-+.Xr getwc_l ,
- .Xr putwc 3 ,
- .Xr stdio 3 ,
- .Xr ungetwc 3
- .Sh STANDARDS
- The
- .Fn fgetwc ,
--.Fn getwc
-+.Fn getwc ,
- and
- .Fn getwchar
- functions
index 34a7de32584f00544565c5a3c82c584b6d9383b6..0128a77808354bead8094404d450419466cb5e07 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/getwc.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include <wchar.h>
@@ -44,5 +46,13 @@ wint_t
 getwc(FILE *fp)
 {
 
-       return (fgetwc(fp));
+       return (fgetwc_l(fp, __current_locale()));
+}
+
+wint_t
+getwc_l(FILE *fp, locale_t loc)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because fgetwc_l will */
+       return (fgetwc_l(fp, loc));
 }
diff --git a/stdio/FreeBSD/getwc.c.patch b/stdio/FreeBSD/getwc.c.patch
deleted file mode 100644 (file)
index f6594bd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- getwc.c.orig       2004-11-25 11:38:35.000000000 -0800
-+++ getwc.c    2005-02-23 17:28:11.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/getwc.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include <wchar.h>
-@@ -44,5 +46,13 @@
- getwc(FILE *fp)
- {
--      return (fgetwc(fp));
-+      return (fgetwc_l(fp, __current_locale()));
-+}
-+
-+wint_t
-+getwc_l(FILE *fp, locale_t loc)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because fgetwc_l will */
-+      return (fgetwc_l(fp, loc));
- }
index 1297cbb86f7f6c9c41d402179ddfa5bbc68aec4b..f5c2dd667ce30e0bd538f9824ef2166cc54f4509 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/getwchar.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include <wchar.h>
@@ -43,5 +45,13 @@ wint_t
 getwchar(void)
 {
 
-       return (fgetwc(stdin));
+       return (fgetwc_l(stdin, __current_locale()));
+}
+
+wint_t
+getwchar_l(locale_t loc)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because fgetwc_l will */
+       return (fgetwc_l(stdin, loc));
 }
diff --git a/stdio/FreeBSD/getwchar.c.patch b/stdio/FreeBSD/getwchar.c.patch
deleted file mode 100644 (file)
index 5b5e460..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- getwchar.c.orig    2004-11-25 11:38:35.000000000 -0800
-+++ getwchar.c 2005-02-23 17:30:01.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/getwchar.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include <wchar.h>
-@@ -43,5 +45,13 @@
- getwchar(void)
- {
--      return (fgetwc(stdin));
-+      return (fgetwc_l(stdin, __current_locale()));
-+}
-+
-+wint_t
-+getwchar_l(locale_t loc)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because fgetwc_l will */
-+      return (fgetwc_l(stdin, loc));
- }
index 0cb856e53da2b45526db256f511079f08ad0b5cf..88e143ceff9391117ad412946c8d5f834d6f89b9 100644 (file)
  * $FreeBSD: src/lib/libc/stdio/local.h,v 1.33 2008/05/05 16:03:52 jhb Exp $
  */
 
+#include <sys/cdefs.h>
+#include "xlocale_private.h"
 #include <sys/types.h> /* for off_t */
 #include <pthread.h>
+#include <limits.h>
 #include <string.h>
 #include <wchar.h>
 
@@ -50,36 +53,69 @@ extern int  _ftello(FILE *, fpos_t *);
 extern int     _fseeko(FILE *, off_t, int, int);
 extern int     __fflush(FILE *fp);
 extern void    __fcloseall(void);
-extern wint_t  __fgetwc(FILE *);
-extern wint_t  __fputwc(wchar_t, FILE *);
+extern wint_t  __fgetwc(FILE *, locale_t);
+extern wint_t  __fputwc(wchar_t, FILE *, locale_t);
 extern int     __sflush(FILE *);
-extern FILE    *__sfp(void);
+extern FILE    *__sfp(int);
+extern void    __sfprelease(FILE *);   /* mark free and update count as needed */
 extern int     __slbexpand(FILE *, size_t);
 extern int     __srefill(FILE *);
+extern int     __srefill0(FILE *);
+extern int     __srefill1(FILE *);
 extern int     __sread(void *, char *, int);
 extern int     __swrite(void *, char const *, int);
 extern fpos_t  __sseek(void *, fpos_t, int);
 extern int     __sclose(void *);
 extern void    __sinit(void);
 extern void    _cleanup(void);
+extern void    (*__cleanup)(void);
 extern void    __smakebuf(FILE *);
 extern int     __swhatbuf(FILE *, size_t *, int *);
 extern int     _fwalk(int (*)(FILE *));
-extern int     __svfscanf(FILE *, const char *, __va_list);
+extern int     __svfscanf_l(FILE *, locale_t, const char *, __va_list);
 extern int     __swsetup(FILE *);
 extern int     __sflags(const char *, int *);
 extern int     __ungetc(int, FILE *);
-extern wint_t  __ungetwc(wint_t, FILE *);
-extern int     __vfprintf(FILE *, const char *, __va_list);
+extern wint_t  __ungetwc(wint_t, FILE *, locale_t);
+extern int     __vfprintf(FILE *, locale_t, const char *, __va_list);
 extern int     __vfscanf(FILE *, const char *, __va_list);
-extern int     __vfwprintf(FILE *, const wchar_t *, __va_list);
-extern int     __vfwscanf(FILE * __restrict, const wchar_t * __restrict,
+extern int     __vfwprintf(FILE *, locale_t, const wchar_t *, __va_list);
+extern int     __vfwscanf(FILE * __restrict, locale_t, const wchar_t * __restrict,
                    __va_list);
 extern size_t  __fread(void * __restrict buf, size_t size, size_t count,
                FILE * __restrict fp);
 extern int     __sdidinit;
 
 
+/* hold a buncha junk that would grow the ABI */
+struct __sFILEX {
+       unsigned char   *up;    /* saved _p when _p is doing ungetc data */
+       pthread_mutex_t fl_mutex;       /* used for MT-safety */
+       pthread_t       fl_owner;       /* current owner */
+       int             fl_count;       /* recursive lock count */
+       int             orientation:2;  /* orientation for fwide() */
+       int             counted:1;      /* stream counted against STREAM_MAX */
+       mbstate_t       mbstate;        /* multibyte conversion state */
+};
+
+#define _up            _extra->up
+#define _fl_mutex      _extra->fl_mutex
+#define _fl_owner      _extra->fl_owner
+#define _fl_count      _extra->fl_count
+#define _orientation   _extra->orientation
+#define _mbstate       _extra->mbstate
+#define _counted       _extra->counted
+
+#define        INITEXTRA(fp) do { \
+       (fp)->_extra->up = NULL; \
+       (fp)->_extra->fl_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; \
+       (fp)->_extra->fl_owner = NULL; \
+       (fp)->_extra->fl_count = 0; \
+       (fp)->_extra->orientation = 0; \
+       memset(&(fp)->_extra->mbstate, 0, sizeof(mbstate_t)); \
+       (fp)->_extra->counted = 0; \
+} while(0);
+
 /*
  * Prepare the given FILE for writing, and return 0 iff it
  * can be written now.  Otherwise, return EOF and set errno.
diff --git a/stdio/FreeBSD/local.h.patch b/stdio/FreeBSD/local.h.patch
deleted file mode 100644 (file)
index 2024f06..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
---- local.h.orig       2011-02-15 10:44:57.000000000 -0800
-+++ local.h    2011-02-15 11:16:59.000000000 -0800
-@@ -33,8 +33,11 @@
-  * $FreeBSD: src/lib/libc/stdio/local.h,v 1.33 2008/05/05 16:03:52 jhb Exp $
-  */
-+#include <sys/cdefs.h>
-+#include "xlocale_private.h"
- #include <sys/types.h>        /* for off_t */
- #include <pthread.h>
-+#include <limits.h>
- #include <string.h>
- #include <wchar.h>
-@@ -50,36 +53,69 @@
- extern int    _fseeko(FILE *, off_t, int, int);
- extern int    __fflush(FILE *fp);
- extern void   __fcloseall(void);
--extern wint_t __fgetwc(FILE *);
--extern wint_t __fputwc(wchar_t, FILE *);
-+extern wint_t __fgetwc(FILE *, locale_t);
-+extern wint_t __fputwc(wchar_t, FILE *, locale_t);
- extern int    __sflush(FILE *);
--extern FILE   *__sfp(void);
-+extern FILE   *__sfp(int);
-+extern void   __sfprelease(FILE *);   /* mark free and update count as needed */
- extern int    __slbexpand(FILE *, size_t);
- extern int    __srefill(FILE *);
-+extern int    __srefill0(FILE *);
-+extern int    __srefill1(FILE *);
- extern int    __sread(void *, char *, int);
- extern int    __swrite(void *, char const *, int);
- extern fpos_t __sseek(void *, fpos_t, int);
- extern int    __sclose(void *);
- extern void   __sinit(void);
- extern void   _cleanup(void);
-+extern void   (*__cleanup)(void);
- extern void   __smakebuf(FILE *);
- extern int    __swhatbuf(FILE *, size_t *, int *);
- extern int    _fwalk(int (*)(FILE *));
--extern int    __svfscanf(FILE *, const char *, __va_list);
-+extern int    __svfscanf_l(FILE *, locale_t, const char *, __va_list) __DARWIN_LDBL_COMPAT(__svfscanf_l);
- extern int    __swsetup(FILE *);
- extern int    __sflags(const char *, int *);
- extern int    __ungetc(int, FILE *);
--extern wint_t __ungetwc(wint_t, FILE *);
--extern int    __vfprintf(FILE *, const char *, __va_list);
--extern int    __vfscanf(FILE *, const char *, __va_list);
--extern int    __vfwprintf(FILE *, const wchar_t *, __va_list);
--extern int    __vfwscanf(FILE * __restrict, const wchar_t * __restrict,
--                  __va_list);
-+extern wint_t __ungetwc(wint_t, FILE *, locale_t);
-+extern int    __vfprintf(FILE *, locale_t, const char *, __va_list) __DARWIN_LDBL_COMPAT(__vfprintf);
-+extern int    __vfscanf(FILE *, const char *, __va_list) __DARWIN_LDBL_COMPAT(__vfscanf);
-+extern int    __vfwprintf(FILE *, locale_t, const wchar_t *, __va_list) __DARWIN_LDBL_COMPAT(__vfwprintf);
-+extern int    __vfwscanf(FILE * __restrict, locale_t, const wchar_t * __restrict,
-+                  __va_list) __DARWIN_LDBL_COMPAT(__vfwscanf);
- extern size_t __fread(void * __restrict buf, size_t size, size_t count,
-               FILE * __restrict fp);
- extern int    __sdidinit;
-+/* hold a buncha junk that would grow the ABI */
-+struct __sFILEX {
-+      unsigned char   *up;    /* saved _p when _p is doing ungetc data */
-+      pthread_mutex_t fl_mutex;       /* used for MT-safety */
-+      pthread_t       fl_owner;       /* current owner */
-+      int             fl_count;       /* recursive lock count */
-+      int             orientation:2;  /* orientation for fwide() */
-+      int             counted:1;      /* stream counted against STREAM_MAX */
-+      mbstate_t       mbstate;        /* multibyte conversion state */
-+};
-+
-+#define _up           _extra->up
-+#define _fl_mutex     _extra->fl_mutex
-+#define _fl_owner     _extra->fl_owner
-+#define _fl_count     _extra->fl_count
-+#define _orientation  _extra->orientation
-+#define _mbstate      _extra->mbstate
-+#define _counted      _extra->counted
-+
-+#define       INITEXTRA(fp) do { \
-+      (fp)->_extra->up = NULL; \
-+      (fp)->_extra->fl_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; \
-+      (fp)->_extra->fl_owner = NULL; \
-+      (fp)->_extra->fl_count = 0; \
-+      (fp)->_extra->orientation = 0; \
-+      memset(&(fp)->_extra->mbstate, 0, sizeof(mbstate_t)); \
-+      (fp)->_extra->counted = 0; \
-+} while(0);
-+
- /*
-  * Prepare the given FILE for writing, and return 0 iff it
-  * can be written now.  Otherwise, return EOF and set errno.
index 7d90164cdf9a9108429a0c88ba34a7bdd3a57445..17e45e2c33f9750bf6db99b0385300314dc70b9f 100644 (file)
@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/makebuf.c,v 1.6 2007/01/09 00:28:07 imp E
 #include "libc_private.h"
 #include "local.h"
 
+#define MAXBUFSIZE     (1 << 16)
+#define TTYBUFSIZE     4096
+
 /*
  * Allocate a file buffer, or switch to unbuffered I/O.
  * Per the ANSI C standard, ALL tty devices default to line buffered.
@@ -69,6 +72,12 @@ __smakebuf(fp)
                return;
        }
        flags = __swhatbuf(fp, &size, &couldbetty);
+       if (couldbetty && isatty(fp->_file)) {
+               flags |= __SLBF;
+               /* st_blksize for ttys is 128K, so make it more reasonable */
+               if (size > TTYBUFSIZE)
+                       fp->_blksize = size = TTYBUFSIZE;
+       }
        if ((p = malloc(size)) == NULL) {
                fp->_flags |= __SNBF;
                fp->_bf._base = fp->_p = fp->_nbuf;
@@ -79,8 +88,6 @@ __smakebuf(fp)
        flags |= __SMBF;
        fp->_bf._base = fp->_p = p;
        fp->_bf._size = size;
-       if (couldbetty && isatty(fp->_file))
-               flags |= __SLBF;
        fp->_flags |= flags;
 }
 
@@ -113,8 +120,7 @@ __swhatbuf(fp, bufsize, couldbetty)
         * __sseek is mainly paranoia.)  It is safe to set _blksize
         * unconditionally; it will only be used if __SOPT is also set.
         */
-       *bufsize = st.st_blksize;
-       fp->_blksize = st.st_blksize;
+       fp->_blksize = *bufsize = st.st_blksize > MAXBUFSIZE ? MAXBUFSIZE : st.st_blksize;
        return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ?
            __SOPT : __SNPT);
 }
diff --git a/stdio/FreeBSD/makebuf.c.patch b/stdio/FreeBSD/makebuf.c.patch
deleted file mode 100644 (file)
index 970a38d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
---- makebuf.c.bsdnew   2009-11-11 13:33:12.000000000 -0800
-+++ makebuf.c  2009-11-11 13:33:13.000000000 -0800
-@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/m
- #include "libc_private.h"
- #include "local.h"
-+#define MAXBUFSIZE    (1 << 16)
-+#define TTYBUFSIZE    4096
-+
- /*
-  * Allocate a file buffer, or switch to unbuffered I/O.
-  * Per the ANSI C standard, ALL tty devices default to line buffered.
-@@ -69,6 +72,12 @@ __smakebuf(fp)
-               return;
-       }
-       flags = __swhatbuf(fp, &size, &couldbetty);
-+      if (couldbetty && isatty(fp->_file)) {
-+              flags |= __SLBF;
-+              /* st_blksize for ttys is 128K, so make it more reasonable */
-+              if (size > TTYBUFSIZE)
-+                      fp->_blksize = size = TTYBUFSIZE;
-+      }
-       if ((p = malloc(size)) == NULL) {
-               fp->_flags |= __SNBF;
-               fp->_bf._base = fp->_p = fp->_nbuf;
-@@ -79,8 +88,6 @@ __smakebuf(fp)
-       flags |= __SMBF;
-       fp->_bf._base = fp->_p = p;
-       fp->_bf._size = size;
--      if (couldbetty && isatty(fp->_file))
--              flags |= __SLBF;
-       fp->_flags |= flags;
- }
-@@ -113,8 +120,7 @@ __swhatbuf(fp, bufsize, couldbetty)
-        * __sseek is mainly paranoia.)  It is safe to set _blksize
-        * unconditionally; it will only be used if __SOPT is also set.
-        */
--      *bufsize = st.st_blksize;
--      fp->_blksize = st.st_blksize;
-+      fp->_blksize = *bufsize = st.st_blksize > MAXBUFSIZE ? MAXBUFSIZE : st.st_blksize;
-       return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ?
-           __SOPT : __SNPT);
- }
index af2eba70f0f5f8e474dd176f3eca5ea901489e3f..f55ceef025a77c153c6f44d0fa0afde8895e8ead 100644 (file)
@@ -32,6 +32,9 @@
 .Dt MKTEMP 3
 .Os
 .Sh NAME
+.Nm mkdtemp ,
+.Nm mkstemp ,
+.Nm mkstemps ,
 .Nm mktemp
 .Nd make temporary file name (unique)
 .Sh LIBRARY
 .Sh SYNOPSIS
 .In unistd.h
 .Ft char *
-.Fn mktemp "char *template"
+.Fo mkdtemp
+.Fa "char *template"
+.Fc
 .Ft int
-.Fn mkstemp "char *template"
+.Fo mkstemps
+.Fa "char *template"
+.Fa "int suffixlen"
+.Fc
+.In stdlib.h
 .Ft int
-.Fn mkstemps "char *template" "int suffixlen"
+.Fo mkstemp
+.Fa "char *template"
+.Fc
 .Ft char *
-.Fn mkdtemp "char *template"
+.Fo mktemp
+.Fa "char *template"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn mktemp
@@ -133,7 +146,7 @@ The pathname portion of the template is not an existing directory.
 .Pp
 The
 .Fn mkstemp ,
-.Fn mkstemps
+.Fn mkstemps ,
 and
 .Fn mkdtemp
 functions
@@ -167,7 +180,7 @@ A common problem that results in a core dump is that the programmer
 passes in a read-only string to
 .Fn mktemp ,
 .Fn mkstemp ,
-.Fn mkstemps
+.Fn mkstemps ,
 or
 .Fn mkdtemp .
 This is common with programs that were developed before
@@ -186,12 +199,19 @@ so that it will store string constants in a writable segment of memory.
 See
 .Xr gcc 1
 for more information.
+.Sh LEGACY SYNOPSIS
+.Fd #include <unistd.h>
+.Pp
+The include file
+.In unistd.h
+is necessary and sufficient for all functions.
 .Sh SEE ALSO
 .Xr chmod 2 ,
 .Xr getpid 2 ,
 .Xr mkdir 2 ,
 .Xr open 2 ,
-.Xr stat 2
+.Xr stat 2 ,
+.Xr compat 5
 .Sh HISTORY
 A
 .Fn mktemp
@@ -242,10 +262,3 @@ and the return status of the call should be tested for failure.
 This will ensure that the program does not continue blindly
 in the event that an attacker has already created the file
 with the intention of manipulating or reading its contents.
-.Pp
-The implementation of these functions calls
-.Xr arc4random 3 ,
-which is not reentrant.
-You must provide your own locking around this and other consumers of the
-.Xr arc4random 3
-API.
diff --git a/stdio/FreeBSD/mktemp.3.patch b/stdio/FreeBSD/mktemp.3.patch
deleted file mode 100644 (file)
index 03cafdd..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
---- mktemp.3.orig      2010-04-28 23:38:47.000000000 -0700
-+++ mktemp.3   2010-04-29 11:05:28.000000000 -0700
-@@ -32,6 +32,9 @@
- .Dt MKTEMP 3
- .Os
- .Sh NAME
-+.Nm mkdtemp ,
-+.Nm mkstemp ,
-+.Nm mkstemps ,
- .Nm mktemp
- .Nd make temporary file name (unique)
- .Sh LIBRARY
-@@ -39,13 +42,23 @@
- .Sh SYNOPSIS
- .In unistd.h
- .Ft char *
--.Fn mktemp "char *template"
-+.Fo mkdtemp
-+.Fa "char *template"
-+.Fc
- .Ft int
--.Fn mkstemp "char *template"
-+.Fo mkstemps
-+.Fa "char *template"
-+.Fa "int suffixlen"
-+.Fc
-+.In stdlib.h
- .Ft int
--.Fn mkstemps "char *template" "int suffixlen"
-+.Fo mkstemp
-+.Fa "char *template"
-+.Fc
- .Ft char *
--.Fn mkdtemp "char *template"
-+.Fo mktemp
-+.Fa "char *template"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn mktemp
-@@ -133,7 +146,7 @@ The pathname portion of the template is 
- .Pp
- The
- .Fn mkstemp ,
--.Fn mkstemps
-+.Fn mkstemps ,
- and
- .Fn mkdtemp
- functions
-@@ -167,7 +180,7 @@ A common problem that results in a core 
- passes in a read-only string to
- .Fn mktemp ,
- .Fn mkstemp ,
--.Fn mkstemps
-+.Fn mkstemps ,
- or
- .Fn mkdtemp .
- This is common with programs that were developed before
-@@ -186,12 +199,19 @@ so that it will store string constants i
- See
- .Xr gcc 1
- for more information.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <unistd.h>
-+.Pp
-+The include file
-+.In unistd.h
-+is necessary and sufficient for all functions.
- .Sh SEE ALSO
- .Xr chmod 2 ,
- .Xr getpid 2 ,
- .Xr mkdir 2 ,
- .Xr open 2 ,
--.Xr stat 2
-+.Xr stat 2 ,
-+.Xr compat 5
- .Sh HISTORY
- A
- .Fn mktemp
-@@ -242,10 +262,3 @@ and the return status of the call should
- This will ensure that the program does not continue blindly
- in the event that an attacker has already created the file
- with the intention of manipulating or reading its contents.
--.Pp
--The implementation of these functions calls
--.Xr arc4random 3 ,
--which is not reentrant.
--You must provide your own locking around this and other consumers of the
--.Xr arc4random 3
--API.
index 18e47c2bf387800d6a0552166aec0eb70a00c52a..30dc90113d88f0ab8a517745aaeebacfd27dc7cd 100644 (file)
@@ -49,7 +49,7 @@ char *_mktemp(char *);
 
 static int _gettemp(char *, int *, int, int);
 
-static const unsigned char padchar[] =
+static const char padchar[] =
 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
 int
diff --git a/stdio/FreeBSD/mktemp.c.patch b/stdio/FreeBSD/mktemp.c.patch
deleted file mode 100644 (file)
index 1c3da0c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- mktemp.c.orig      2010-04-08 10:37:06.000000000 -0700
-+++ mktemp.c   2010-04-08 10:40:05.000000000 -0700
-@@ -130,7 +130,7 @@ _gettemp(path, doopen, domkdir, slen)
-       /* Fill space with random characters */
-       while (trv >= path && *trv == 'X') {
--              rand = arc4random_uniform(sizeof(padchar) - 1);
-+              rand = arc4random() % (sizeof(padchar) - 1);
-               *trv-- = padchar[rand];
-       }
-       start = trv + 1;
index 2cae4e6e80b109e8e17a9cc4fc1535c8a1598ddc..4de7aba54b9915f64ea0517b4d43b431efefb1a6 100644 (file)
@@ -63,7 +63,10 @@ enum typeid {
        T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG,
        T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SSIZET,
        T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR,
-       T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR
+       T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR,
+#ifdef VECTORS
+       T_VECTOR,
+#endif
 };
 
 /* An expandable array of types. */
@@ -240,7 +243,7 @@ addwaster(struct typetable *types, wchar_t **fmtp)
  * It will be replaces with a malloc-ed one if it overflows.
  * Returns 0 on success. On failure, returns nonzero and sets errno.
  */ 
-int
+__private_extern__ int
 __find_arguments (const char *fmt0, va_list ap, union arg **argtable)
 {
        char *fmt;              /* format string */
@@ -342,7 +345,11 @@ reswitch:  switch (ch) {
                        /*FALLTHROUGH*/
                case 'c':
                        error = addtype(&types,
+#ifdef VECTORS
+                                       (flags & LONGINT) ? T_WINT : ((flags & VECTOR) ? T_VECTOR : T_INT));
+#else
                                        (flags & LONGINT) ? T_WINT : T_INT);
+#endif
                        if (error)
                                goto error;
                        break;
@@ -351,6 +358,12 @@ reswitch:  switch (ch) {
                        /*FALLTHROUGH*/
                case 'd':
                case 'i':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               if ((error = addtype(&types, T_VECTOR)))
+                                       goto error;
+                       } else
+#endif
                        if ((error = addsarg(&types, flags)))
                                goto error;
                        break;
@@ -360,10 +373,15 @@ reswitch: switch (ch) {
                case 'e':
                case 'E':
                case 'f':
+               case 'F':
                case 'g':
                case 'G':
                        error = addtype(&types,
+#ifdef VECTORS
+                           (flags & VECTOR) ? T_VECTOR : ((flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE));
+#else
                            (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE);
+#endif
                        if (error)
                                goto error;
                        break;
@@ -392,11 +410,21 @@ reswitch: switch (ch) {
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'o':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               if ((error = addtype(&types, T_VECTOR)))
+                                       goto error;
+                       } else
+#endif
                        if ((error = adduarg(&types, flags)))
                                goto error;
                        break;
                case 'p':
+#ifdef VECTORS
+                       if ((error = addtype(&types, (flags & VECTOR) ? T_VECTOR : TP_VOID)))
+#else
                        if ((error = addtype(&types, TP_VOID)))
+#endif
                                goto error;
                        break;
                case 'S':
@@ -414,6 +442,12 @@ reswitch:  switch (ch) {
                case 'u':
                case 'X':
                case 'x':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               if ((error = addtype(&types, T_VECTOR)))
+                                       goto error;
+                       } else
+#endif
                        if ((error = adduarg(&types, flags)))
                                goto error;
                        break;
@@ -431,7 +465,7 @@ error:
 }
 
 /* wchar version of __find_arguments. */
-int
+__private_extern__ int
 __find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable)
 {
        wchar_t *fmt;           /* format string */
@@ -551,6 +585,7 @@ reswitch:   switch (ch) {
                case 'e':
                case 'E':
                case 'f':
+               case 'F':
                case 'g':
                case 'G':
                        error = addtype(&types,
@@ -741,6 +776,11 @@ build_arg_table(struct typetable *types, va_list ap, union arg **argtable)
                        (*argtable) [n].longdoublearg = va_arg (ap, long double);
 #endif
                        break;
+#ifdef VECTORS
+                   case T_VECTOR:
+                       (*argtable) [n].vectorarg = va_arg (ap, VECTORTYPE);
+                       break;
+#endif /* VECTORS */
                    case TP_CHAR:
                        (*argtable) [n].pchararg = va_arg (ap, char *);
                        break;
diff --git a/stdio/FreeBSD/printf-pos.c.patch b/stdio/FreeBSD/printf-pos.c.patch
deleted file mode 100644 (file)
index fdbb58e..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
---- printf-pos.c.orig  2010-10-25 19:45:24.000000000 -0700
-+++ printf-pos.c       2010-10-25 19:47:02.000000000 -0700
-@@ -63,7 +63,10 @@ enum typeid {
-       T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG,
-       T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SSIZET,
-       T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR,
--      T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR
-+      T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR,
-+#ifdef VECTORS
-+      T_VECTOR,
-+#endif
- };
- /* An expandable array of types. */
-@@ -240,7 +243,7 @@ addwaster(struct typetable *types, wchar
-  * It will be replaces with a malloc-ed one if it overflows.
-  * Returns 0 on success. On failure, returns nonzero and sets errno.
-  */ 
--int
-+__private_extern__ int
- __find_arguments (const char *fmt0, va_list ap, union arg **argtable)
- {
-       char *fmt;              /* format string */
-@@ -342,7 +345,11 @@ reswitch: switch (ch) {
-                       /*FALLTHROUGH*/
-               case 'c':
-                       error = addtype(&types,
-+#ifdef VECTORS
-+                                      (flags & LONGINT) ? T_WINT : ((flags & VECTOR) ? T_VECTOR : T_INT));
-+#else
-                                       (flags & LONGINT) ? T_WINT : T_INT);
-+#endif
-                       if (error)
-                               goto error;
-                       break;
-@@ -351,6 +358,12 @@ reswitch: switch (ch) {
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              if ((error = addtype(&types, T_VECTOR)))
-+                                      goto error;
-+                      } else
-+#endif
-                       if ((error = addsarg(&types, flags)))
-                               goto error;
-                       break;
-@@ -360,10 +373,15 @@ reswitch:        switch (ch) {
-               case 'e':
-               case 'E':
-               case 'f':
-+              case 'F':
-               case 'g':
-               case 'G':
-                       error = addtype(&types,
-+#ifdef VECTORS
-+                          (flags & VECTOR) ? T_VECTOR : ((flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE));
-+#else
-                           (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE);
-+#endif
-                       if (error)
-                               goto error;
-                       break;
-@@ -392,11 +410,21 @@ reswitch:        switch (ch) {
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              if ((error = addtype(&types, T_VECTOR)))
-+                                      goto error;
-+                      } else
-+#endif
-                       if ((error = adduarg(&types, flags)))
-                               goto error;
-                       break;
-               case 'p':
-+#ifdef VECTORS
-+                      if ((error = addtype(&types, (flags & VECTOR) ? T_VECTOR : TP_VOID)))
-+#else
-                       if ((error = addtype(&types, TP_VOID)))
-+#endif
-                               goto error;
-                       break;
-               case 'S':
-@@ -414,6 +442,12 @@ reswitch: switch (ch) {
-               case 'u':
-               case 'X':
-               case 'x':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              if ((error = addtype(&types, T_VECTOR)))
-+                                      goto error;
-+                      } else
-+#endif
-                       if ((error = adduarg(&types, flags)))
-                               goto error;
-                       break;
-@@ -431,7 +465,7 @@ error:
- }
- /* wchar version of __find_arguments. */
--int
-+__private_extern__ int
- __find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable)
- {
-       wchar_t *fmt;           /* format string */
-@@ -551,6 +585,7 @@ reswitch:  switch (ch) {
-               case 'e':
-               case 'E':
-               case 'f':
-+              case 'F':
-               case 'g':
-               case 'G':
-                       error = addtype(&types,
-@@ -741,6 +776,11 @@ build_arg_table(struct typetable *types,
-                       (*argtable) [n].longdoublearg = va_arg (ap, long double);
- #endif
-                       break;
-+#ifdef VECTORS
-+                  case T_VECTOR:
-+                      (*argtable) [n].vectorarg = va_arg (ap, VECTORTYPE);
-+                      break;
-+#endif /* VECTORS */
-                   case TP_CHAR:
-                       (*argtable) [n].pchararg = va_arg (ap, char *);
-                       break;
index cbafaf93b24175ea772d7e89cbf7b62e009743cc..031d7f7c20d9ebae3ba2519f68a26705c7e168bd 100644 (file)
@@ -42,7 +42,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.Fd "#define _WITH_DPRINTF"
 .In stdio.h
 .Ft int
 .Fn printf "const char * restrict format" ...
@@ -98,7 +97,7 @@ write output to the given file descriptor;
 and
 .Fn vsnprintf
 write to the character string
-.Fa str ;
+.Fa s ;
 and
 .Fn asprintf
 and
@@ -106,6 +105,12 @@ and
 dynamically allocate a new string with
 .Xr malloc 3 .
 .Pp
+Extended locale versions of these functions are documented in
+.Xr printf_l 3 .
+See
+.Xr xlocale 3
+for more information.
+.Pp
 These functions write the output under the control of a
 .Fa format
 string that specifies how subsequent arguments
@@ -122,7 +127,7 @@ except for
 and
 .Fn vsnprintf ,
 which return the number of characters that would have been printed if the
-.Fa size
+.Fa n
 were unlimited
 (again, not including the final
 .Ql \e0 ) .
@@ -154,14 +159,14 @@ and
 .Fn vsnprintf
 functions
 will write at most
-.Fa size Ns \-1
+.Fa n Ns \-1
 of the characters printed into the output string
 (the
-.Fa size Ns 'th
+.Fa n Ns \'th
 character then gets the terminating
 .Ql \e0 ) ;
 if the return value is greater than or equal to the
-.Fa size
+.Fa n
 argument, the string was too short
 and some of the printed characters were discarded.
 The output is always null-terminated.
@@ -172,7 +177,11 @@ and
 .Fn vsprintf
 functions
 effectively assume an infinite
-.Fa size .
+.Fa n .
+.Pp
+For those routines that write to a user-provided character string,
+that string and the format strings should not overlap, as the
+behavior is undefined.
 .Pp
 The format string is composed of zero or more directives:
 ordinary
@@ -291,6 +300,20 @@ the non-monetary separator returned by
 .Xr localeconv 3 .
 .El
 .It
+An optional separator character (
+.Cm \ , | \;  | \ : | _
+) used for separating multiple values when printing an AltiVec or SSE vector,
+or other multi-value unit.
+.Pp
+NOTE: This is an extension to the
+.Fn printf
+specification.
+Behaviour of these values for
+.Fn printf 
+is only defined for operating systems conforming to the 
+AltiVec Technology Programming Interface Manual.
+(At time of writing this includes only Mac OS X 10.2 and later.)
+.It
 An optional decimal digit string specifying a minimum field width.
 If the converted value has fewer characters than the field width, it will
 be padded with spaces on the left (or right, if the left-adjustment
@@ -383,6 +406,34 @@ conversion:
 .It Sy Modifier Ta Cm c Ta Cm s
 .It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *"
 .El
+.Pp
+The AltiVec Technology Programming Interface Manual also defines five additional length modifiers
+which can be used (in place of the conventional length modifiers) for the printing of AltiVec or SSE vectors:
+.Bl -tag -compact
+.It Cm v
+Treat the argument as a vector value, unit length will be determined by the conversion
+specifier (default = 16 8-bit units for all integer conversions, 
+4 32-bit units for floating point conversions).
+.It Cm vh, hv
+Treat the argument as a vector of 8 16-bit units.
+.It Cm vl, lv
+Treat the argument as a vector of 4 32-bit units.
+.El
+.Pp
+NOTE: The vector length specifiers are extensions to the
+.Fn printf
+specification.
+Behaviour of these values for
+.Fn printf 
+is only defined for operating systems conforming to the 
+AltiVec Technology Programming Interface Manual.
+(At time of writing this includes only Mac OS X 10.2 and later.)
+.Pp
+As a further extension, for SSE2 64-bit units:
+.Bl -tag -compact
+.It Cm vll, llv
+Treat the argument as a vector of 2 64-bit units.
+.El
 .It
 A character that specifies the type of conversion to be applied.
 .El
@@ -561,10 +612,9 @@ For example,
 and
 .Li 0xc.9p-2
 are all equivalent.
-.Fx 8.0
-and later always prints finite non-zero numbers using
-.Ql 1
-as the digit before the hexadecimal point.
+The format chosen depends on the internal representation of the
+number, but the implementation guarantees that the length of the
+mantissa will be minimized.
 Zeroes are always represented with a mantissa of 0 (preceded by a
 .Ql -
 if appropriate) and an exponent of
@@ -781,34 +831,6 @@ Always use the proper secure idiom:
 .Pp
 .Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);"
 .Sh COMPATIBILITY
-Many application writers used the name
-.Va dprintf
-before the
-.Fn dprintf
-function was introduced in
-.St -p1003.1 ,
-so a prototype is not provided by default in order to avoid
-compatibility problems.
-Applications that wish to use the
-.Fn dprintf
-function described herein should either request a strict
-.St -p1003.1-2008
-environment by defining the macro
-.Dv _POSIX_C_SOURCE
-to the value 200809 or greater, or by defining the macro
-.Dv _WITH_DPRINTF ,
-prior to the inclusion of
-.In stdio.h .
-For compatibility with GNU libc, defining either
-.Dv _BSD_SOURCE
-or
-.Dv _GNU_SOURCE
-prior to the inclusion of
-.In stdio.h
-will also make
-.Fn dprintf
-available.
-.Pp
 The conversion formats
 .Cm \&%D , \&%O ,
 and
@@ -845,9 +867,11 @@ Insufficient storage space is available.
 .El
 .Sh SEE ALSO
 .Xr printf 1 ,
+.Xr printf_l 3 ,
 .Xr fmtcheck 3 ,
 .Xr scanf 3 ,
 .Xr setlocale 3 ,
+.Xr stdarg 3 ,
 .Xr wprintf 3
 .Sh STANDARDS
 Subject to the caveats noted in the
diff --git a/stdio/FreeBSD/printf.3.patch b/stdio/FreeBSD/printf.3.patch
deleted file mode 100644 (file)
index d34b422..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
---- printf.3.orig      2009-12-15 17:50:20.000000000 -0800
-+++ printf.3   2009-12-15 17:58:46.000000000 -0800
-@@ -42,7 +42,6 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.Fd "#define _WITH_DPRINTF"
- .In stdio.h
- .Ft int
- .Fn printf "const char * restrict format" ...
-@@ -98,7 +97,7 @@ write output to the given file descripto
- and
- .Fn vsnprintf
- write to the character string
--.Fa str ;
-+.Fa s ;
- and
- .Fn asprintf
- and
-@@ -106,6 +105,12 @@ and
- dynamically allocate a new string with
- .Xr malloc 3 .
- .Pp
-+Extended locale versions of these functions are documented in
-+.Xr printf_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
-+.Pp
- These functions write the output under the control of a
- .Fa format
- string that specifies how subsequent arguments
-@@ -122,7 +127,7 @@ except for
- and
- .Fn vsnprintf ,
- which return the number of characters that would have been printed if the
--.Fa size
-+.Fa n
- were unlimited
- (again, not including the final
- .Ql \e0 ) .
-@@ -154,14 +159,14 @@ and
- .Fn vsnprintf
- functions
- will write at most
--.Fa size Ns \-1
-+.Fa n Ns \-1
- of the characters printed into the output string
- (the
--.Fa size Ns 'th
-+.Fa n Ns \'th
- character then gets the terminating
- .Ql \e0 ) ;
- if the return value is greater than or equal to the
--.Fa size
-+.Fa n
- argument, the string was too short
- and some of the printed characters were discarded.
- The output is always null-terminated.
-@@ -172,7 +177,11 @@ and
- .Fn vsprintf
- functions
- effectively assume an infinite
--.Fa size .
-+.Fa n .
-+.Pp
-+For those routines that write to a user-provided character string,
-+that string and the format strings should not overlap, as the
-+behavior is undefined.
- .Pp
- The format string is composed of zero or more directives:
- ordinary
-@@ -291,6 +300,20 @@ the non-monetary separator returned by
- .Xr localeconv 3 .
- .El
- .It
-+An optional separator character (
-+.Cm \ , | \;  | \ : | _
-+) used for separating multiple values when printing an AltiVec or SSE vector,
-+or other multi-value unit.
-+.Pp
-+NOTE: This is an extension to the
-+.Fn printf
-+specification.
-+Behaviour of these values for
-+.Fn printf 
-+is only defined for operating systems conforming to the 
-+AltiVec Technology Programming Interface Manual.
-+(At time of writing this includes only Mac OS X 10.2 and later.)
-+.It
- An optional decimal digit string specifying a minimum field width.
- If the converted value has fewer characters than the field width, it will
- be padded with spaces on the left (or right, if the left-adjustment
-@@ -383,6 +406,34 @@ conversion:
- .It Sy Modifier Ta Cm c Ta Cm s
- .It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *"
- .El
-+.Pp
-+The AltiVec Technology Programming Interface Manual also defines five additional length modifiers
-+which can be used (in place of the conventional length modifiers) for the printing of AltiVec or SSE vectors:
-+.Bl -tag -compact
-+.It Cm v
-+Treat the argument as a vector value, unit length will be determined by the conversion
-+specifier (default = 16 8-bit units for all integer conversions, 
-+4 32-bit units for floating point conversions).
-+.It Cm vh, hv
-+Treat the argument as a vector of 8 16-bit units.
-+.It Cm vl, lv
-+Treat the argument as a vector of 4 32-bit units.
-+.El
-+.Pp
-+NOTE: The vector length specifiers are extensions to the
-+.Fn printf
-+specification.
-+Behaviour of these values for
-+.Fn printf 
-+is only defined for operating systems conforming to the 
-+AltiVec Technology Programming Interface Manual.
-+(At time of writing this includes only Mac OS X 10.2 and later.)
-+.Pp
-+As a further extension, for SSE2 64-bit units:
-+.Bl -tag -compact
-+.It Cm vll, llv
-+Treat the argument as a vector of 2 64-bit units.
-+.El
- .It
- A character that specifies the type of conversion to be applied.
- .El
-@@ -561,10 +612,9 @@ For example,
- and
- .Li 0xc.9p-2
- are all equivalent.
--.Fx 8.0
--and later always prints finite non-zero numbers using
--.Ql 1
--as the digit before the hexadecimal point.
-+The format chosen depends on the internal representation of the
-+number, but the implementation guarantees that the length of the
-+mantissa will be minimized.
- Zeroes are always represented with a mantissa of 0 (preceded by a
- .Ql -
- if appropriate) and an exponent of
-@@ -781,34 +831,6 @@ Always use the proper secure idiom:
- .Pp
- .Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);"
- .Sh COMPATIBILITY
--Many application writers used the name
--.Va dprintf
--before the
--.Fn dprintf
--function was introduced in
--.St -p1003.1 ,
--so a prototype is not provided by default in order to avoid
--compatibility problems.
--Applications that wish to use the
--.Fn dprintf
--function described herein should either request a strict
--.St -p1003.1-2008
--environment by defining the macro
--.Dv _POSIX_C_SOURCE
--to the value 200809 or greater, or by defining the macro
--.Dv _WITH_DPRINTF ,
--prior to the inclusion of
--.In stdio.h .
--For compatibility with GNU libc, defining either
--.Dv _BSD_SOURCE
--or
--.Dv _GNU_SOURCE
--prior to the inclusion of
--.In stdio.h
--will also make
--.Fn dprintf
--available.
--.Pp
- The conversion formats
- .Cm \&%D , \&%O ,
- and
-@@ -845,9 +867,11 @@ Insufficient storage space is available.
- .El
- .Sh SEE ALSO
- .Xr printf 1 ,
-+.Xr printf_l 3 ,
- .Xr fmtcheck 3 ,
- .Xr scanf 3 ,
- .Xr setlocale 3 ,
-+.Xr stdarg 3 ,
- .Xr wprintf 3
- .Sh STANDARDS
- Subject to the caveats noted in the
index c1ee17802083fc6fbdf2b25804f2232b59b4dd22..e65851a13fa323d5cd85b7cc81e2d1ad7baa09df 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)printf.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.11 2007/01/09 00:28:07 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 
@@ -46,7 +48,20 @@ printf(char const * __restrict fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       ret = vfprintf(stdout, fmt, ap);
+       ret = vfprintf_l(stdout, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
+}
+
+int
+printf_l(locale_t loc, char const * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfprintf_l will */
+       va_start(ap, fmt);
+       ret = vfprintf_l(stdout, loc, fmt, ap);
        va_end(ap);
        return (ret);
 }
diff --git a/stdio/FreeBSD/printf.c.patch b/stdio/FreeBSD/printf.c.patch
deleted file mode 100644 (file)
index dfd8cbe..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---- printf.c.bsdnew    2009-11-11 13:33:13.000000000 -0800
-+++ printf.c   2009-11-11 13:33:13.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)printf.c 8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.11 2007/01/09 00:28:07 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdarg.h>
-@@ -46,7 +48,20 @@ printf(char const * __restrict fmt, ...)
-       va_list ap;
-       va_start(ap, fmt);
--      ret = vfprintf(stdout, fmt, ap);
-+      ret = vfprintf_l(stdout, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+printf_l(locale_t loc, char const * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfprintf_l will */
-+      va_start(ap, fmt);
-+      ret = vfprintf_l(stdout, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
- }
index 01504f9c1a64f9350ac228172295b9f22eccd60e..27141e6d6174176ee522bbce8be283133341f95d 100644 (file)
@@ -79,14 +79,14 @@ io_init(struct io_state *iop, FILE *fp)
  * remain valid until io_flush() is called.
  */
 static inline int
-io_print(struct io_state *iop, const CHAR * __restrict ptr, int len)
+io_print(struct io_state *iop, const CHAR * __restrict ptr, int len, locale_t loc)
 {
 
        iop->iov[iop->uio.uio_iovcnt].iov_base = (char *)ptr;
        iop->iov[iop->uio.uio_iovcnt].iov_len = len;
        iop->uio.uio_resid += len;
        if (++iop->uio.uio_iovcnt >= NIOV)
-               return (__sprint(iop->fp, &iop->uio));
+               return (__sprint(iop->fp, loc, &iop->uio));
        else
                return (0);
 }
@@ -107,13 +107,13 @@ static const CHAR zeroes[PADSIZE] =
  * or the zeroes array.
  */
 static inline int
-io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with)
+io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with, locale_t loc)
 {
        int n;
 
        while (howmany > 0) {
                n = (howmany >= PADSIZE) ? PADSIZE : howmany;
-               if (io_print(iop, with, n))
+               if (io_print(iop, with, n, loc))
                        return (-1);
                howmany -= n;
        }
@@ -126,7 +126,7 @@ io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with)
  */
 static inline int
 io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep,
-              int len, const CHAR * __restrict with)
+              int len, const CHAR * __restrict with, locale_t loc)
 {
        int p_len;
 
@@ -134,19 +134,19 @@ io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep,
        if (p_len > len)
                p_len = len;
        if (p_len > 0) {
-               if (io_print(iop, p, p_len))
+               if (io_print(iop, p, p_len, loc))
                        return (-1);
        } else {
                p_len = 0;
        }
-       return (io_pad(iop, len - p_len, with));
+       return (io_pad(iop, len - p_len, with, loc));
 }
 
 static inline int
-io_flush(struct io_state *iop)
+io_flush(struct io_state *iop, locale_t loc)
 {
 
-       return (__sprint(iop->fp, &iop->uio));
+       return (__sprint(iop->fp, loc, &iop->uio));
 }
 
 /*
@@ -205,7 +205,7 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs)
                break;
 
        default:                        /* oops */
-               abort();
+               LIBC_ABORT("__ultoa: invalid base=%d", base);
        }
        return (cp);
 }
@@ -255,7 +255,7 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs)
                break;
 
        default:
-               abort();
+               LIBC_ABORT("__ujtoa: invalid base=%d", base);
        }
        return (cp);
 }
diff --git a/stdio/FreeBSD/printfcommon.h.patch b/stdio/FreeBSD/printfcommon.h.patch
deleted file mode 100644 (file)
index 38db417..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
---- printfcommon.h.orig        2009-11-12 13:29:57.000000000 -0800
-+++ printfcommon.h     2009-11-12 23:50:26.000000000 -0800
-@@ -79,14 +79,14 @@ io_init(struct io_state *iop, FILE *fp)
-  * remain valid until io_flush() is called.
-  */
- static inline int
--io_print(struct io_state *iop, const CHAR * __restrict ptr, int len)
-+io_print(struct io_state *iop, const CHAR * __restrict ptr, int len, locale_t loc)
- {
-       iop->iov[iop->uio.uio_iovcnt].iov_base = (char *)ptr;
-       iop->iov[iop->uio.uio_iovcnt].iov_len = len;
-       iop->uio.uio_resid += len;
-       if (++iop->uio.uio_iovcnt >= NIOV)
--              return (__sprint(iop->fp, &iop->uio));
-+              return (__sprint(iop->fp, loc, &iop->uio));
-       else
-               return (0);
- }
-@@ -107,13 +107,13 @@ static const CHAR zeroes[PADSIZE] =
-  * or the zeroes array.
-  */
- static inline int
--io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with)
-+io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with, locale_t loc)
- {
-       int n;
-       while (howmany > 0) {
-               n = (howmany >= PADSIZE) ? PADSIZE : howmany;
--              if (io_print(iop, with, n))
-+              if (io_print(iop, with, n, loc))
-                       return (-1);
-               howmany -= n;
-       }
-@@ -126,7 +126,7 @@ io_pad(struct io_state *iop, int howmany
-  */
- static inline int
- io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep,
--             int len, const CHAR * __restrict with)
-+             int len, const CHAR * __restrict with, locale_t loc)
- {
-       int p_len;
-@@ -134,19 +134,19 @@ io_printandpad(struct io_state *iop, con
-       if (p_len > len)
-               p_len = len;
-       if (p_len > 0) {
--              if (io_print(iop, p, p_len))
-+              if (io_print(iop, p, p_len, loc))
-                       return (-1);
-       } else {
-               p_len = 0;
-       }
--      return (io_pad(iop, len - p_len, with));
-+      return (io_pad(iop, len - p_len, with, loc));
- }
- static inline int
--io_flush(struct io_state *iop)
-+io_flush(struct io_state *iop, locale_t loc)
- {
--      return (__sprint(iop->fp, &iop->uio));
-+      return (__sprint(iop->fp, loc, &iop->uio));
- }
- /*
-@@ -205,7 +205,7 @@ __ultoa(u_long val, CHAR *endp, int base
-               break;
-       default:                        /* oops */
--              abort();
-+              LIBC_ABORT("__ultoa: invalid base=%d", base);
-       }
-       return (cp);
- }
-@@ -255,7 +255,7 @@ __ujtoa(uintmax_t val, CHAR *endp, int b
-               break;
-       default:
--              abort();
-+              LIBC_ABORT("__ujtoa: invalid base=%d", base);
-       }
-       return (cp);
- }
index ca7e05de1794407cc8150af63d1d715a146a870c..f57e8e9f957b4904deece8e71ede3a1e614a6d3f 100644 (file)
  * $FreeBSD: src/lib/libc/stdio/printflocal.h,v 1.3 2009/03/02 04:07:58 das Exp $
  */
 
+/* 
+ * Defining here VECTORS for all files that include this header (<rdar://problem/8466056>)
+ */
+#define        VECTORS
+
 /*
  * Flags used during conversion.
  */
@@ -49,6 +54,9 @@
 #define        PTRDIFFT        0x800           /* ptrdiff_t */
 #define        INTMAXT         0x1000          /* intmax_t */
 #define        CHARINT         0x2000          /* print char using int format */
+#ifdef VECTORS
+#define VECTOR          0x4000          /* Altivec or SSE vector */
+#endif /* VECTORS */
 
 /*
  * Macros for converting digits to letters and vice versa
 /* Size of the static argument table. */
 #define STATIC_ARG_TBL_SIZE 8
 
+#ifdef VECTORS
+typedef __attribute__ ((vector_size(16))) unsigned char VECTORTYPE;
+#ifdef __SSE2__
+#define V64TYPE
+#endif /* __SSE2__ */
+#endif /* VECTORS */
+
 union arg {
        int     intarg;
        u_int   uintarg;
@@ -87,6 +102,21 @@ union arg {
 #endif
        wint_t  wintarg;
        wchar_t *pwchararg;
+#ifdef VECTORS
+       VECTORTYPE              vectorarg;
+       unsigned char           vuchararg[16];
+       signed char             vchararg[16];
+       unsigned short          vushortarg[8];
+       signed short            vshortarg[8];
+       unsigned int            vuintarg[4];
+       signed int              vintarg[4];
+       float                   vfloatarg[4];
+#ifdef V64TYPE
+       double                  vdoublearg[2];
+       unsigned long long      vulonglongarg[2];
+       long long               vlonglongarg[2];
+#endif /* V64TYPE */
+#endif /* VECTORS */
 };
 
 /* Handle positional parameters. */
diff --git a/stdio/FreeBSD/printflocal.h.patch b/stdio/FreeBSD/printflocal.h.patch
deleted file mode 100644 (file)
index 209dc14..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- printflocal.h.orig 2009-11-12 13:40:46.000000000 -0800
-+++ printflocal.h      2009-11-12 23:06:25.000000000 -0800
-@@ -32,6 +32,11 @@
-  * $FreeBSD: src/lib/libc/stdio/printflocal.h,v 1.3 2009/03/02 04:07:58 das Exp $
-  */
-+/* 
-+ * Defining here VECTORS for all files that include this header (<rdar://problem/8466056>)
-+ */
-+#define        VECTORS
-+
- /*
-  * Flags used during conversion.
-  */
-@@ -49,6 +49,9 @@
- #define       PTRDIFFT        0x800           /* ptrdiff_t */
- #define       INTMAXT         0x1000          /* intmax_t */
- #define       CHARINT         0x2000          /* print char using int format */
-+#ifdef VECTORS
-+#define VECTOR          0x4000          /* Altivec or SSE vector */
-+#endif /* VECTORS */
- /*
-  * Macros for converting digits to letters and vice versa
-@@ -60,6 +63,13 @@
- /* Size of the static argument table. */
- #define STATIC_ARG_TBL_SIZE 8
-+#ifdef VECTORS
-+typedef __attribute__ ((vector_size(16))) unsigned char VECTORTYPE;
-+#ifdef __SSE2__
-+#define V64TYPE
-+#endif /* __SSE2__ */
-+#endif /* VECTORS */
-+
- union arg {
-       int     intarg;
-       u_int   uintarg;
-@@ -87,6 +97,21 @@ union arg {
- #endif
-       wint_t  wintarg;
-       wchar_t *pwchararg;
-+#ifdef VECTORS
-+      VECTORTYPE              vectorarg;
-+      unsigned char           vuchararg[16];
-+      signed char             vchararg[16];
-+      unsigned short          vushortarg[8];
-+      signed short            vshortarg[8];
-+      unsigned int            vuintarg[4];
-+      signed int              vintarg[4];
-+      float                   vfloatarg[4];
-+#ifdef V64TYPE
-+      double                  vdoublearg[2];
-+      unsigned long long      vulonglongarg[2];
-+      long long               vlonglongarg[2];
-+#endif /* V64TYPE */
-+#endif /* VECTORS */
- };
- /* Handle positional parameters. */
index 216c1cba2f5e7cfdac15b7f2208977cb28064a5a..b5370aa85869586d86c60df37b3c74146320e1a1 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft int
-.Fn fputc "int c" "FILE *stream"
+.Fo fputc
+.Fa "int c"
+.Fa "FILE *stream"
+.Fc
 .Ft int
-.Fn putc "int c" "FILE *stream"
+.Fo putc
+.Fa "int c"
+.Fa "FILE *stream"
+.Fc
 .Ft int
-.Fn putc_unlocked "int c" "FILE *stream"
+.Fo putc_unlocked
+.Fa "int c"
+.Fa "FILE *stream"
+.Fc
 .Ft int
-.Fn putchar "int c"
+.Fo putchar
+.Fa "int c"
+.Fc
 .Ft int
-.Fn putchar_unlocked "int c"
+.Fo putchar_unlocked
+.Fa "int c"
+.Fc
 .Ft int
-.Fn putw "int w" "FILE *stream"
+.Fo putw
+.Fa "int w"
+.Fa "FILE *stream"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn fputc
@@ -117,7 +133,7 @@ The functions,
 .Fn fputc ,
 .Fn putc ,
 .Fn putchar ,
-.Fn putc_unlocked
+.Fn putc_unlocked ,
 and
 .Fn putchar_unlocked
 return the character written.
diff --git a/stdio/FreeBSD/putc.3.patch b/stdio/FreeBSD/putc.3.patch
deleted file mode 100644 (file)
index 613d138..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
---- putc.3.bsdnew      2009-11-11 13:33:13.000000000 -0800
-+++ putc.3     2009-11-11 13:33:14.000000000 -0800
-@@ -48,17 +48,33 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft int
--.Fn fputc "int c" "FILE *stream"
--.Ft int
--.Fn putc "int c" "FILE *stream"
--.Ft int
--.Fn putc_unlocked "int c" "FILE *stream"
--.Ft int
--.Fn putchar "int c"
--.Ft int
--.Fn putchar_unlocked "int c"
--.Ft int
--.Fn putw "int w" "FILE *stream"
-+.Fo fputc
-+.Fa "int c"
-+.Fa "FILE *stream"
-+.Fc
-+.Ft int
-+.Fo putc
-+.Fa "int c"
-+.Fa "FILE *stream"
-+.Fc
-+.Ft int
-+.Fo putc_unlocked
-+.Fa "int c"
-+.Fa "FILE *stream"
-+.Fc
-+.Ft int
-+.Fo putchar
-+.Fa "int c"
-+.Fc
-+.Ft int
-+.Fo putchar_unlocked
-+.Fa "int c"
-+.Fc
-+.Ft int
-+.Fo putw
-+.Fa "int w"
-+.Fa "FILE *stream"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn fputc
-@@ -117,7 +133,7 @@ The functions,
- .Fn fputc ,
- .Fn putc ,
- .Fn putchar ,
--.Fn putc_unlocked
-+.Fn putc_unlocked ,
- and
- .Fn putchar_unlocked
- return the character written.
index 4b27733aa11a87afba8e4753aae38b5e8b3472d9..511cab4b5b6a2ce0073ec6f014f182f2868c7b6e 100644 (file)
@@ -44,6 +44,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/puts.c,v 1.11 2007/01/09 00:28:07 imp Exp
 #include "libc_private.h"
 #include "local.h"
 
+// 3340719: __puts_null__ is used if string is NULL.  Shared by fputs.c
+__private_extern__ char const __puts_null__[] = "(null)";
+
 /*
  * Write the given string to stdout, appending a newline.
  */
@@ -52,12 +55,15 @@ puts(s)
        char const *s;
 {
        int retval;
-       size_t c = strlen(s);
+       size_t c;
        struct __suio uio;
        struct __siov iov[2];
 
+       // 3340719: __puts_null__ is used if s is NULL
+       if(s == NULL)
+               s = __puts_null__;
        iov[0].iov_base = (void *)s;
-       iov[0].iov_len = c;
+       iov[0].iov_len = c = strlen(s);
        iov[1].iov_base = "\n";
        iov[1].iov_len = 1;
        uio.uio_resid = c + 1;
diff --git a/stdio/FreeBSD/puts.c.patch b/stdio/FreeBSD/puts.c.patch
deleted file mode 100644 (file)
index f56c66a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- puts.c.bsdnew      2009-11-11 13:33:14.000000000 -0800
-+++ puts.c     2009-11-11 13:33:14.000000000 -0800
-@@ -44,6 +44,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/p
- #include "libc_private.h"
- #include "local.h"
-+// 3340719: __puts_null__ is used if string is NULL.  Shared by fputs.c
-+__private_extern__ char const __puts_null__[] = "(null)";
-+
- /*
-  * Write the given string to stdout, appending a newline.
-  */
-@@ -52,12 +55,15 @@ puts(s)
-       char const *s;
- {
-       int retval;
--      size_t c = strlen(s);
-+      size_t c;
-       struct __suio uio;
-       struct __siov iov[2];
-+      // 3340719: __puts_null__ is used if s is NULL
-+      if(s == NULL)
-+              s = __puts_null__;
-       iov[0].iov_base = (void *)s;
--      iov[0].iov_len = c;
-+      iov[0].iov_len = c = strlen(s);
-       iov[1].iov_base = "\n";
-       iov[1].iov_len = 1;
-       uio.uio_resid = c + 1;
index 47b728c0a5348e2a049cbcb300bddcf94ee237a1..84799bccbc9db3d9d620d76e263091cfabc4540a 100644 (file)
 .In stdio.h
 .In wchar.h
 .Ft wint_t
-.Fn fputwc "wchar_t wc" "FILE *stream"
+.Fo fputwc
+.Fa "wchar_t wc"
+.Fa "FILE *stream"
+.Fc
 .Ft wint_t
-.Fn putwc "wchar_t wc" "FILE *stream"
+.Fo putwc
+.Fa "wchar_t wc"
+.Fa "FILE *stream"
+.Fc
 .Ft wint_t
-.Fn putwchar "wchar_t wc"
+.Fo putwchar
+.Fa "wchar_t wc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn fputwc
@@ -75,6 +83,12 @@ is identical to
 .Fn putwc
 with an output stream of
 .Dv stdout .
+.Pp
+Extended locale versions of these functions are documented in
+.Xr putwc_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn fputwc ,
@@ -91,6 +105,7 @@ is returned.
 .Xr fopen 3 ,
 .Xr getwc 3 ,
 .Xr putc 3 ,
+.Xr putwc_l 3 ,
 .Xr stdio 3
 .Sh STANDARDS
 The
diff --git a/stdio/FreeBSD/putwc.3.patch b/stdio/FreeBSD/putwc.3.patch
deleted file mode 100644 (file)
index a4b0008..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
---- putwc.3.bsdnew     2009-11-11 13:33:14.000000000 -0800
-+++ putwc.3    2009-11-11 13:33:14.000000000 -0800
-@@ -48,11 +48,19 @@
- .In stdio.h
- .In wchar.h
- .Ft wint_t
--.Fn fputwc "wchar_t wc" "FILE *stream"
-+.Fo fputwc
-+.Fa "wchar_t wc"
-+.Fa "FILE *stream"
-+.Fc
- .Ft wint_t
--.Fn putwc "wchar_t wc" "FILE *stream"
-+.Fo putwc
-+.Fa "wchar_t wc"
-+.Fa "FILE *stream"
-+.Fc
- .Ft wint_t
--.Fn putwchar "wchar_t wc"
-+.Fo putwchar
-+.Fa "wchar_t wc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn fputwc
-@@ -75,6 +83,12 @@ is identical to
- .Fn putwc
- with an output stream of
- .Dv stdout .
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr putwc_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn fputwc ,
-@@ -91,6 +105,7 @@ is returned.
- .Xr fopen 3 ,
- .Xr getwc 3 ,
- .Xr putc 3 ,
-+.Xr putwc_l 3 ,
- .Xr stdio 3
- .Sh STANDARDS
- The
index 0feec5b621c571eb19f5039634195729b7f50ca7..e8543091ffc33ccab3d8f54e34ba73c66d0b3086 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/putwc.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include <wchar.h>
@@ -44,5 +46,13 @@ wint_t
 putwc(wchar_t wc, FILE *fp)
 {
 
-       return (fputwc(wc, fp));
+       return (fputwc_l(wc, fp, __current_locale()));
+}
+
+wint_t
+putwc_l(wchar_t wc, FILE *fp, locale_t loc)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because fputwc_l will */
+       return (fputwc_l(wc, fp, loc));
 }
diff --git a/stdio/FreeBSD/putwc.c.patch b/stdio/FreeBSD/putwc.c.patch
deleted file mode 100644 (file)
index b8cbdee..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- putwc.c.orig       2004-11-25 11:38:35.000000000 -0800
-+++ putwc.c    2005-02-23 17:32:05.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/putwc.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include <wchar.h>
-@@ -44,5 +46,13 @@
- putwc(wchar_t wc, FILE *fp)
- {
--      return (fputwc(wc, fp));
-+      return (fputwc_l(wc, fp, __current_locale()));
-+}
-+
-+wint_t
-+putwc_l(wchar_t wc, FILE *fp, locale_t loc)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because fputwc_l will */
-+      return (fputwc_l(wc, fp, loc));
- }
index b983995d3e82d93858194ef6017610aa7c22f338..bc3ef1f7d07a18a7a19ea76b89b40cbde4286c98 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/putwchar.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include <wchar.h>
@@ -43,5 +45,13 @@ wint_t
 putwchar(wchar_t wc)
 {
 
-       return (fputwc(wc, stdout));
+       return (fputwc_l(wc, stdout, __current_locale()));
+}
+
+wint_t
+putwchar_l(wchar_t wc, locale_t loc)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because fputwc_l will */
+       return (fputwc_l(wc, stdout, loc));
 }
diff --git a/stdio/FreeBSD/putwchar.c.patch b/stdio/FreeBSD/putwchar.c.patch
deleted file mode 100644 (file)
index 6bcd527..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- putwchar.c.orig    2004-11-25 11:38:35.000000000 -0800
-+++ putwchar.c 2005-02-23 17:33:23.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/putwchar.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include <wchar.h>
-@@ -43,5 +45,13 @@
- putwchar(wchar_t wc)
- {
--      return (fputwc(wc, stdout));
-+      return (fputwc_l(wc, stdout, __current_locale()));
-+}
-+
-+wint_t
-+putwchar_l(wchar_t wc, locale_t loc)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because fputwc_l will */
-+      return (fputwc_l(wc, stdout, loc));
- }
index a7d486fcca55c7f85923efe43484b006c0d749d4..8d42bbb6e029e6e78190bc372f9088b3eaff1a0a 100644 (file)
@@ -64,8 +64,8 @@ lflush(FILE *fp)
  * Refill a stdio buffer.
  * Return EOF on eof or error, 0 otherwise.
  */
-int
-__srefill(FILE *fp)
+__private_extern__ int
+__srefill0(FILE *fp)
 {
 
        /* make sure stdio is set up */
@@ -130,6 +130,13 @@ __srefill(FILE *fp)
                if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
                        __sflush(fp);
        }
+       return (1);
+}
+
+__private_extern__ int
+__srefill1(FILE *fp)
+{
+
        fp->_p = fp->_bf._base;
        fp->_r = _sread(fp, (char *)fp->_p, fp->_bf._size);
        fp->_flags &= ~__SMOD;  /* buffer contents are again pristine */
@@ -144,3 +151,13 @@ __srefill(FILE *fp)
        }
        return (0);
 }
+
+int
+__srefill(FILE *fp)
+{
+       int ret;
+
+       if ((ret = __srefill0(fp)) <= 0)
+               return ret;
+       return __srefill1(fp);
+}
diff --git a/stdio/FreeBSD/refill.c.patch b/stdio/FreeBSD/refill.c.patch
deleted file mode 100644 (file)
index ef4573d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---- refill.c.bsdnew    2009-11-11 13:33:14.000000000 -0800
-+++ refill.c   2009-11-11 13:33:14.000000000 -0800
-@@ -64,8 +64,8 @@ lflush(FILE *fp)
-  * Refill a stdio buffer.
-  * Return EOF on eof or error, 0 otherwise.
-  */
--int
--__srefill(FILE *fp)
-+__private_extern__ int
-+__srefill0(FILE *fp)
- {
-       /* make sure stdio is set up */
-@@ -130,6 +130,13 @@ __srefill(FILE *fp)
-               if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
-                       __sflush(fp);
-       }
-+      return (1);
-+}
-+
-+__private_extern__ int
-+__srefill1(FILE *fp)
-+{
-+
-       fp->_p = fp->_bf._base;
-       fp->_r = _sread(fp, (char *)fp->_p, fp->_bf._size);
-       fp->_flags &= ~__SMOD;  /* buffer contents are again pristine */
-@@ -144,3 +151,13 @@ __srefill(FILE *fp)
-       }
-       return (0);
- }
-+
-+int
-+__srefill(FILE *fp)
-+{
-+      int ret;
-+
-+      if ((ret = __srefill0(fp)) <= 0)
-+              return ret;
-+      return __srefill1(fp);
-+}
index 618111f889482355f5499c9ff4b705d1d83bed76..5f1000387b43e6739f2809bd573c17565abd2d0f 100644 (file)
@@ -68,7 +68,7 @@ may fail and set
 .Va errno
 for any of the errors specified for the routines
 .Xr lstat 2 ,
-.Xr rmdir 2
+.Xr rmdir 2 ,
 or
 .Xr unlink 2 .
 .Sh SEE ALSO
diff --git a/stdio/FreeBSD/remove.3.patch b/stdio/FreeBSD/remove.3.patch
deleted file mode 100644 (file)
index 8a24b15..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- remove.3.bsdnew    2009-11-11 13:33:15.000000000 -0800
-+++ remove.3   2009-11-11 13:33:15.000000000 -0800
-@@ -68,7 +68,7 @@ may fail and set
- .Va errno
- for any of the errors specified for the routines
- .Xr lstat 2 ,
--.Xr rmdir 2
-+.Xr rmdir 2 ,
- or
- .Xr unlink 2 .
- .Sh SEE ALSO
index b5204ed3a038b6c5640892e491103c46f2dfc4a0..3dc282d75d17266aa433a12f964fb67809b81df6 100644 (file)
@@ -54,8 +54,8 @@ rewind(FILE *fp)
 
        FLOCKFILE(fp);
        if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
-               clearerr_unlocked(fp);
                errno = serrno;
        }
+       clearerr_unlocked(fp);  /* POSIX: clear stdio error regardless */
        FUNLOCKFILE(fp);
 }
diff --git a/stdio/FreeBSD/rewind.c.patch b/stdio/FreeBSD/rewind.c.patch
deleted file mode 100644 (file)
index ffdf7fd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- rewind.c.bsdnew    2009-11-11 13:33:15.000000000 -0800
-+++ rewind.c   2009-11-11 13:33:15.000000000 -0800
-@@ -54,8 +54,8 @@ rewind(FILE *fp)
-       FLOCKFILE(fp);
-       if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
--              clearerr_unlocked(fp);
-               errno = serrno;
-       }
-+      clearerr_unlocked(fp);  /* POSIX: clear stdio error regardless */
-       FUNLOCKFILE(fp);
- }
index 5f424fff4f64d33eed447456a85f9d968557ba63..4bf72403620ec1fef108ae46e13c91ca62cfb88b 100644 (file)
 .Dt SCANF 3
 .Os
 .Sh NAME
-.Nm scanf ,
 .Nm fscanf ,
+.Nm scanf ,
 .Nm sscanf ,
+.Nm vfscanf ,
 .Nm vscanf ,
-.Nm vsscanf ,
-.Nm vfscanf
+.Nm vsscanf
 .Nd input format conversion
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdio.h
 .Ft int
-.Fn scanf "const char * restrict format" ...
+.Fo fscanf
+.Fa "FILE *restrict stream"
+.Fa "const char *restrict format" ...
+.Fc
 .Ft int
-.Fn fscanf "FILE * restrict stream" "const char * restrict format" ...
+.Fo scanf
+.Fa "const char *restrict format" ...
+.Fc
 .Ft int
-.Fn sscanf "const char * restrict str" "const char * restrict format" ...
+.Fo sscanf
+.Fa "const char *restrict s"
+.Fa "const char *restrict format" ...
+.Fc
 .In stdarg.h
+.In stdio.h
 .Ft int
-.Fn vscanf "const char * restrict format" "va_list ap"
+.Fo vfscanf
+.Fa "FILE *restrict stream"
+.Fa "const char *restrict format"
+.Fa "va_list arg"
+.Fc
 .Ft int
-.Fn vsscanf "const char * restrict str" "const char * restrict format" "va_list ap"
+.Fo vscanf
+.Fa "const char *restrict format"
+.Fa "va_list arg"
+.Fc
 .Ft int
-.Fn vfscanf "FILE * restrict stream" "const char * restrict format" "va_list ap"
+.Fo vsscanf
+.Fa "const char *restrict s"
+.Fa "const char *restrict format"
+.Fa "va_list arg"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn scanf
 family of functions scans input according to a
-.Fa format
+.Fa format ,
 as described below.
 This format may contain
 .Em conversion specifiers ;
@@ -83,7 +103,8 @@ reads input from the stream pointer
 and
 .Fn sscanf
 reads its input from the character string pointed to by
-.Fa str .
+.Fa s .
+.Pp
 The
 .Fn vfscanf
 function
@@ -104,7 +125,8 @@ the
 .Fn vprintf
 and
 .Fn vsprintf
-functions respectively.
+functions, respectively.
+.Pp
 Each successive
 .Em pointer
 argument must correspond properly with
@@ -128,10 +150,16 @@ Scanning stops
 when an input character does not match such a format character.
 Scanning also stops
 when an input conversion cannot be made (see below).
+.Pp
+Extended locale versions of these functions are documented in
+.Xr scanf_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh CONVERSIONS
 Following the
 .Cm %
-character introducing a conversion
+character introducing a conversion,
 there may be a number of
 .Em flag
 characters, as follows:
@@ -411,7 +439,8 @@ Matches a pointer value (as printed by
 in
 .Xr printf 3 ) ;
 the next pointer must be a pointer to
-.Vt void .
+.Vt "void *"
+(or other pointer type).
 .It Cm n
 Nothing is expected;
 instead, the number of characters consumed thus far from the input
@@ -436,13 +465,10 @@ of
 causes an immediate return of
 .Dv EOF .
 .Sh RETURN VALUES
-These
-functions
-return
-the number of input items assigned, which can be fewer than provided
-for, or even zero, in the event of a matching failure.
-Zero
-indicates that, while there was input available,
+These functions return the number of input items assigned.
+This can be fewer than provided for, or even zero,
+in the event of a matching failure.
+Zero indicates that, although there was input available,
 no conversions were assigned;
 typically this is due to an invalid input character,
 such as an alphabetic character for a
@@ -459,6 +485,7 @@ the number of conversions which were successfully completed is returned.
 .Xr getc 3 ,
 .Xr mbrtowc 3 ,
 .Xr printf 3 ,
+.Xr scanf_l 3 ,
 .Xr strtod 3 ,
 .Xr strtol 3 ,
 .Xr strtoul 3 ,
@@ -469,7 +496,7 @@ The functions
 .Fn scanf ,
 .Fn sscanf ,
 .Fn vfscanf ,
-.Fn vscanf
+.Fn vscanf ,
 and
 .Fn vsscanf
 conform to
diff --git a/stdio/FreeBSD/scanf.3.patch b/stdio/FreeBSD/scanf.3.patch
deleted file mode 100644 (file)
index e8501fd..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
---- scanf.3.bsdnew     2009-11-11 13:33:15.000000000 -0800
-+++ scanf.3    2009-11-11 13:33:15.000000000 -0800
-@@ -36,35 +36,55 @@
- .Dt SCANF 3
- .Os
- .Sh NAME
--.Nm scanf ,
- .Nm fscanf ,
-+.Nm scanf ,
- .Nm sscanf ,
-+.Nm vfscanf ,
- .Nm vscanf ,
--.Nm vsscanf ,
--.Nm vfscanf
-+.Nm vsscanf
- .Nd input format conversion
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdio.h
- .Ft int
--.Fn scanf "const char * restrict format" ...
-+.Fo fscanf
-+.Fa "FILE *restrict stream"
-+.Fa "const char *restrict format" ...
-+.Fc
- .Ft int
--.Fn fscanf "FILE * restrict stream" "const char * restrict format" ...
-+.Fo scanf
-+.Fa "const char *restrict format" ...
-+.Fc
- .Ft int
--.Fn sscanf "const char * restrict str" "const char * restrict format" ...
-+.Fo sscanf
-+.Fa "const char *restrict s"
-+.Fa "const char *restrict format" ...
-+.Fc
- .In stdarg.h
-+.In stdio.h
- .Ft int
--.Fn vscanf "const char * restrict format" "va_list ap"
-+.Fo vfscanf
-+.Fa "FILE *restrict stream"
-+.Fa "const char *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Ft int
--.Fn vsscanf "const char * restrict str" "const char * restrict format" "va_list ap"
-+.Fo vscanf
-+.Fa "const char *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Ft int
--.Fn vfscanf "FILE * restrict stream" "const char * restrict format" "va_list ap"
-+.Fo vsscanf
-+.Fa "const char *restrict s"
-+.Fa "const char *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn scanf
- family of functions scans input according to a
--.Fa format
-+.Fa format ,
- as described below.
- This format may contain
- .Em conversion specifiers ;
-@@ -83,7 +103,8 @@ reads input from the stream pointer
- and
- .Fn sscanf
- reads its input from the character string pointed to by
--.Fa str .
-+.Fa s .
-+.Pp
- The
- .Fn vfscanf
- function
-@@ -104,7 +125,8 @@ the
- .Fn vprintf
- and
- .Fn vsprintf
--functions respectively.
-+functions, respectively.
-+.Pp
- Each successive
- .Em pointer
- argument must correspond properly with
-@@ -128,10 +150,16 @@ Scanning stops
- when an input character does not match such a format character.
- Scanning also stops
- when an input conversion cannot be made (see below).
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr scanf_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh CONVERSIONS
- Following the
- .Cm %
--character introducing a conversion
-+character introducing a conversion,
- there may be a number of
- .Em flag
- characters, as follows:
-@@ -411,7 +439,8 @@ Matches a pointer value (as printed by
- in
- .Xr printf 3 ) ;
- the next pointer must be a pointer to
--.Vt void .
-+.Vt "void *"
-+(or other pointer type).
- .It Cm n
- Nothing is expected;
- instead, the number of characters consumed thus far from the input
-@@ -436,13 +465,10 @@ of
- causes an immediate return of
- .Dv EOF .
- .Sh RETURN VALUES
--These
--functions
--return
--the number of input items assigned, which can be fewer than provided
--for, or even zero, in the event of a matching failure.
--Zero
--indicates that, while there was input available,
-+These functions return the number of input items assigned.
-+This can be fewer than provided for, or even zero,
-+in the event of a matching failure.
-+Zero indicates that, although there was input available,
- no conversions were assigned;
- typically this is due to an invalid input character,
- such as an alphabetic character for a
-@@ -459,6 +485,7 @@ the number of conversions which were suc
- .Xr getc 3 ,
- .Xr mbrtowc 3 ,
- .Xr printf 3 ,
-+.Xr scanf_l 3 ,
- .Xr strtod 3 ,
- .Xr strtol 3 ,
- .Xr strtoul 3 ,
-@@ -469,7 +496,7 @@ The functions
- .Fn scanf ,
- .Fn sscanf ,
- .Fn vfscanf ,
--.Fn vscanf
-+.Fn vscanf ,
- and
- .Fn vsscanf
- conform to
index 794149989c7ed177615dcd4b17e4b6d75e5f17b9..c2992ece1bd85c2ad1d65ed60364cea9334043de 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)scanf.c   8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/scanf.c,v 1.13 2007/01/09 00:28:07 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include <stdarg.h>
@@ -51,7 +53,22 @@ scanf(char const * __restrict fmt, ...)
 
        va_start(ap, fmt);
        FLOCKFILE(stdin);
-       ret = __svfscanf(stdin, fmt, ap);
+       ret = __svfscanf_l(stdin, __current_locale(), fmt, ap);
+       FUNLOCKFILE(stdin);
+       va_end(ap);
+       return (ret);
+}
+
+int
+scanf_l(locale_t loc, char const * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       NORMALIZE_LOCALE(loc);
+       va_start(ap, fmt);
+       FLOCKFILE(stdin);
+       ret = __svfscanf_l(stdin, loc, fmt, ap);
        FUNLOCKFILE(stdin);
        va_end(ap);
        return (ret);
diff --git a/stdio/FreeBSD/scanf.c.patch b/stdio/FreeBSD/scanf.c.patch
deleted file mode 100644 (file)
index 1462320..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- scanf.c.bsdnew     2009-11-11 13:33:15.000000000 -0800
-+++ scanf.c    2009-11-11 13:33:15.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)scanf.c  8.1 
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/scanf.c,v 1.13 2007/01/09 00:28:07 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include <stdarg.h>
-@@ -51,7 +53,22 @@ scanf(char const * __restrict fmt, ...)
-       va_start(ap, fmt);
-       FLOCKFILE(stdin);
--      ret = __svfscanf(stdin, fmt, ap);
-+      ret = __svfscanf_l(stdin, __current_locale(), fmt, ap);
-+      FUNLOCKFILE(stdin);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+scanf_l(locale_t loc, char const * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      NORMALIZE_LOCALE(loc);
-+      va_start(ap, fmt);
-+      FLOCKFILE(stdin);
-+      ret = __svfscanf_l(stdin, loc, fmt, ap);
-       FUNLOCKFILE(stdin);
-       va_end(ap);
-       return (ret);
index 8f4ef0a29e67deaa4372b8976fa55cc0adc30192..466d8b34f03be9f17c833f343873bcf9191e5645 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft void
-.Fn setbuf "FILE * restrict stream" "char * restrict buf"
+.Fo setbuf
+.Fa "FILE *restrict stream"
+.Fa "char *restrict buf"
+.Fc
 .Ft void
-.Fn setbuffer "FILE *stream" "char *buf" "int size"
+.Fo setbuffer
+.Fa "FILE *stream"
+.Fa "char *buf"
+.Fa "int size"
+.Fc
 .Ft int
-.Fn setlinebuf "FILE *stream"
+.Fo setlinebuf
+.Fa "FILE *stream"
+.Fc
 .Ft int
-.Fn setvbuf "FILE * restrict stream" "char * restrict buf" "int mode" "size_t size"
+.Fo setvbuf
+.Fa "FILE *restrict stream"
+.Fa "char *restrict buf"
+.Fa "int type"
+.Fa "size_t size"
+.Fc
 .Sh DESCRIPTION
-The three types of buffering available are unbuffered, block buffered,
-and line buffered.
+Three types of buffering are available:
+unbuffered, block buffered, and line buffered.
 When an output stream is unbuffered, information appears on the
 destination file or terminal as soon as written;
-when it is block buffered many characters are saved up and written as a block;
-when it is line buffered characters are saved up until a newline is
-output or input is read from any stream attached to a terminal device
+when it is block buffered,
+many characters are saved up and written as a block;
+when it is line buffered,
+characters are saved up until a newline is output
+or input is read from any stream attached to a terminal device
 (typically
 .Dv stdin ) .
 The function
@@ -69,17 +85,16 @@ may be used to force the block out early.
 (See
 .Xr fclose 3 . )
 .Pp
-Normally all files are block buffered.
+Normally, all files are block buffered.
 When the first
 .Tn I/O
 operation occurs on a file,
 .Xr malloc 3
-is called,
-and an optimally-sized buffer is obtained.
+is called and an optimally-sized buffer is obtained.
 If a stream refers to a terminal
 (as
 .Dv stdout
-normally does) it is line buffered.
+normally does), it is line buffered.
 The standard error stream
 .Dv stderr
 is always unbuffered.
@@ -89,7 +104,7 @@ The
 function
 may be used to alter the buffering behavior of a stream.
 The
-.Fa mode
+.Fa type
 argument must be one of the following three macros:
 .Bl -tag -width _IOFBF -offset indent
 .It Dv _IONBF
diff --git a/stdio/FreeBSD/setbuf.3.patch b/stdio/FreeBSD/setbuf.3.patch
deleted file mode 100644 (file)
index 4ba00dd..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
---- setbuf.3.bsdnew    2009-11-11 13:33:15.000000000 -0800
-+++ setbuf.3   2009-11-11 13:33:15.000000000 -0800
-@@ -46,21 +46,37 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft void
--.Fn setbuf "FILE * restrict stream" "char * restrict buf"
-+.Fo setbuf
-+.Fa "FILE *restrict stream"
-+.Fa "char *restrict buf"
-+.Fc
- .Ft void
--.Fn setbuffer "FILE *stream" "char *buf" "int size"
-+.Fo setbuffer
-+.Fa "FILE *stream"
-+.Fa "char *buf"
-+.Fa "int size"
-+.Fc
- .Ft int
--.Fn setlinebuf "FILE *stream"
-+.Fo setlinebuf
-+.Fa "FILE *stream"
-+.Fc
- .Ft int
--.Fn setvbuf "FILE * restrict stream" "char * restrict buf" "int mode" "size_t size"
-+.Fo setvbuf
-+.Fa "FILE *restrict stream"
-+.Fa "char *restrict buf"
-+.Fa "int type"
-+.Fa "size_t size"
-+.Fc
- .Sh DESCRIPTION
--The three types of buffering available are unbuffered, block buffered,
--and line buffered.
-+Three types of buffering are available:
-+unbuffered, block buffered, and line buffered.
- When an output stream is unbuffered, information appears on the
- destination file or terminal as soon as written;
--when it is block buffered many characters are saved up and written as a block;
--when it is line buffered characters are saved up until a newline is
--output or input is read from any stream attached to a terminal device
-+when it is block buffered,
-+many characters are saved up and written as a block;
-+when it is line buffered,
-+characters are saved up until a newline is output
-+or input is read from any stream attached to a terminal device
- (typically
- .Dv stdin ) .
- The function
-@@ -69,17 +85,16 @@ may be used to force the block out early
- (See
- .Xr fclose 3 . )
- .Pp
--Normally all files are block buffered.
-+Normally, all files are block buffered.
- When the first
- .Tn I/O
- operation occurs on a file,
- .Xr malloc 3
--is called,
--and an optimally-sized buffer is obtained.
-+is called and an optimally-sized buffer is obtained.
- If a stream refers to a terminal
- (as
- .Dv stdout
--normally does) it is line buffered.
-+normally does), it is line buffered.
- The standard error stream
- .Dv stderr
- is always unbuffered.
-@@ -89,7 +104,7 @@ The
- function
- may be used to alter the buffering behavior of a stream.
- The
--.Fa mode
-+.Fa type
- argument must be one of the following three macros:
- .Bl -tag -width _IOFBF -offset indent
- .It Dv _IONBF
index 61d9c8a31ea65e479c13afa0362be71a6c8a30f7..55f01cf22feb7e3565a42a5a1e929ae74b2f8e58 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)snprintf.c        8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -45,26 +47,24 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb
 int
 snprintf(char * __restrict str, size_t n, char const * __restrict fmt, ...)
 {
-       size_t on;
        int ret;
        va_list ap;
-       FILE f;
 
-       on = n;
-       if (n != 0)
-               n--;
-       if (n > INT_MAX)
-               n = INT_MAX;
        va_start(ap, fmt);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = n;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, fmt, ap);
-       if (on > 0)
-               *f._p = '\0';
+       ret = vsnprintf_l(str, n, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
+}
+
+int
+snprintf_l(char * __restrict str, size_t n, locale_t loc,
+    char const * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       va_start(ap, fmt);
+       ret = vsnprintf_l(str, n, loc, fmt, ap);
        va_end(ap);
        return (ret);
 }
diff --git a/stdio/FreeBSD/snprintf.c.patch b/stdio/FreeBSD/snprintf.c.patch
deleted file mode 100644 (file)
index fb74cf8..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
---- snprintf.c.orig    2009-11-30 16:15:30.000000000 -0800
-+++ snprintf.c 2009-12-02 16:48:44.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)snprintf.c       8
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdio.h>
- #include <stdarg.h>
-@@ -45,26 +47,24 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/s
- int
- snprintf(char * __restrict str, size_t n, char const * __restrict fmt, ...)
- {
--      size_t on;
-       int ret;
-       va_list ap;
--      FILE f;
--      on = n;
--      if (n != 0)
--              n--;
--      if (n > INT_MAX)
--              n = INT_MAX;
-       va_start(ap, fmt);
--      f._file = -1;
--      f._flags = __SWR | __SSTR;
--      f._bf._base = f._p = (unsigned char *)str;
--      f._bf._size = f._w = n;
--      f._orientation = 0;
--      memset(&f._mbstate, 0, sizeof(mbstate_t));
--      ret = __vfprintf(&f, fmt, ap);
--      if (on > 0)
--              *f._p = '\0';
-+      ret = vsnprintf_l(str, n, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+snprintf_l(char * __restrict str, size_t n, locale_t loc,
-+    char const * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      va_start(ap, fmt);
-+      ret = vsnprintf_l(str, n, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
- }
index 005d300894574c8f613ea81efd899c606ff441f0..f2cb3a959a214fdc67ee41938c88d732ce49bd55 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <limits.h>
@@ -46,17 +48,21 @@ sprintf(char * __restrict str, char const * __restrict fmt, ...)
 {
        int ret;
        va_list ap;
-       FILE f;
 
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = INT_MAX;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
        va_start(ap, fmt);
-       ret = __vfprintf(&f, fmt, ap);
+       ret = vsprintf_l(str, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
+}
+
+int
+sprintf_l(char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       va_start(ap, fmt);
+       ret = vsprintf_l(str, loc, fmt, ap);
        va_end(ap);
-       *f._p = 0;
        return (ret);
 }
diff --git a/stdio/FreeBSD/sprintf.c.patch b/stdio/FreeBSD/sprintf.c.patch
deleted file mode 100644 (file)
index b275aff..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
---- sprintf.c.orig     2009-11-30 16:15:30.000000000 -0800
-+++ sprintf.c  2009-12-02 16:49:29.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)sprintf.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdarg.h>
- #include <limits.h>
-@@ -46,17 +48,21 @@ sprintf(char * __restrict str, char cons
- {
-       int ret;
-       va_list ap;
--      FILE f;
--      f._file = -1;
--      f._flags = __SWR | __SSTR;
--      f._bf._base = f._p = (unsigned char *)str;
--      f._bf._size = f._w = INT_MAX;
--      f._orientation = 0;
--      memset(&f._mbstate, 0, sizeof(mbstate_t));
-       va_start(ap, fmt);
--      ret = __vfprintf(&f, fmt, ap);
-+      ret = vsprintf_l(str, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
-+}
-+
-+int
-+sprintf_l(char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      va_start(ap, fmt);
-+      ret = vsprintf_l(str, loc, fmt, ap);
-       va_end(ap);
--      *f._p = 0;
-       return (ret);
- }
index 15985624c99ddc11d6715687749fffd270312f58..16c313fe966d0b784895e9cbdb6b3f5a59b66b34 100644 (file)
@@ -36,42 +36,33 @@ static char sccsid[] = "@(#)sscanf.c        8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
 #include "local.h"
 
-static int eofread(void *, char *, int);
-
-/* ARGSUSED */
-static int
-eofread(cookie, buf, len)
-       void *cookie;
-       char *buf;
-       int len;
+int
+sscanf(const char * __restrict str, char const * __restrict fmt, ...)
 {
+       int ret;
+       va_list ap;
 
-       return (0);
+       va_start(ap, fmt);
+       ret = vsscanf_l(str, __current_locale(), fmt, ap);
+       va_end(ap);
+       return (ret);
 }
 
 int
-sscanf(const char * __restrict str, char const * __restrict fmt, ...)
+sscanf_l(const char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
 {
        int ret;
        va_list ap;
-       FILE f;
 
-       f._file = -1;
-       f._flags = __SRD;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._r = strlen(str);
-       f._read = eofread;
-       f._ub._base = NULL;
-       f._lb._base = NULL;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
        va_start(ap, fmt);
-       ret = __svfscanf(&f, fmt, ap);
+       ret = vsscanf_l(str, loc, fmt, ap);
        va_end(ap);
        return (ret);
 }
diff --git a/stdio/FreeBSD/sscanf.c.patch b/stdio/FreeBSD/sscanf.c.patch
deleted file mode 100644 (file)
index 6ab773c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
---- sscanf.c.orig      2009-11-30 16:15:30.000000000 -0800
-+++ sscanf.c   2009-12-02 16:50:00.000000000 -0800
-@@ -36,42 +36,33 @@ static char sccsid[] = "@(#)sscanf.c       8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <string.h>
- #include <stdarg.h>
- #include "local.h"
--static int eofread(void *, char *, int);
--
--/* ARGSUSED */
--static int
--eofread(cookie, buf, len)
--      void *cookie;
--      char *buf;
--      int len;
-+int
-+sscanf(const char * __restrict str, char const * __restrict fmt, ...)
- {
-+      int ret;
-+      va_list ap;
--      return (0);
-+      va_start(ap, fmt);
-+      ret = vsscanf_l(str, __current_locale(), fmt, ap);
-+      va_end(ap);
-+      return (ret);
- }
- int
--sscanf(const char * __restrict str, char const * __restrict fmt, ...)
-+sscanf_l(const char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
- {
-       int ret;
-       va_list ap;
--      FILE f;
--      f._file = -1;
--      f._flags = __SRD;
--      f._bf._base = f._p = (unsigned char *)str;
--      f._bf._size = f._r = strlen(str);
--      f._read = eofread;
--      f._ub._base = NULL;
--      f._lb._base = NULL;
--      f._orientation = 0;
--      memset(&f._mbstate, 0, sizeof(mbstate_t));
-       va_start(ap, fmt);
--      ret = __svfscanf(&f, fmt, ap);
-+      ret = vsscanf_l(str, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
- }
index 71488a1baf489131decd275805dab765c00956d7..1cf1be677da6c3ab6438ea32b456106a794a3975 100644 (file)
 .Vt FILE *stdin ;
 .Vt FILE *stdout ;
 .Vt FILE *stderr ;
+.Pp
+Note:
+The current implementation does not allow these variables
+to be evaluated at C compile/link time.
+That is, a runtime calculation must be performed, such as:
+.Bd -literal -offset indent
+#include <stdio.h>
+
+static FILE *var;
+
+int main() {
+    var = stdout;
+}
+.Ed
 .Sh DESCRIPTION
 The standard
 .Tn I/O
@@ -228,11 +242,21 @@ and
 .Dv putchar_unlocked
 exist and will be used if the macro
 definitions are explicitly removed.
+.Sh LEGACY SYNOPSIS
+The -D_NONSTD_SOURCE flag can be used
+to allow stdin, stdout, and/or stderr
+to be evaluated at compile/link time, as:
+.Bd -literal -offset indent
+#include <stdio.h>
+
+static FILE *var = stdout;
+.Ed
 .Sh SEE ALSO
 .Xr close 2 ,
 .Xr open 2 ,
 .Xr read 2 ,
-.Xr write 2
+.Xr write 2 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Nm
@@ -242,8 +266,9 @@ library conforms to
 .Bl -column "Description"
 .It Sy "Function       Description"
 .It "asprintf  formatted output conversion"
+.It ""
 .It "clearerr  check and reset stream status"
-.It "dprintf   formatted output conversion"
+.It ""
 .It "fclose    close a stream"
 .It "fdopen    stream open functions"
 .It "feof      check and reset stream status"
@@ -275,6 +300,7 @@ library conforms to
 .It "fwopen    open a stream"
 .It "fwprintf  formatted wide character output conversion"
 .It "fwrite    binary stream input/output"
+.It ""
 .It "getc      get next character or word from input stream"
 .It "getchar   get next character or word from input stream"
 .It "getdelim  get a line from a stream"
@@ -283,9 +309,11 @@ library conforms to
 .It "getw      get next character or word from input stream"
 .It "getwc     get next wide character from input stream"
 .It "getwchar  get next wide character from input stream"
+.It ""
 .It "mkdtemp   create unique temporary directory"
 .It "mkstemp   create unique temporary file"
 .It "mktemp    create unique temporary file"
+.It ""
 .It "perror    system error messages"
 .It "printf    formatted output conversion"
 .It "putc      output a character or word to a stream"
@@ -294,8 +322,10 @@ library conforms to
 .It "putw      output a character or word to a stream"
 .It "putwc     output a wide character to a stream"
 .It "putwchar  output a wide character to a stream"
+.It ""
 .It "remove    remove directory entry"
 .It "rewind    reposition a stream"
+.It ""
 .It "scanf     input format conversion"
 .It "setbuf    stream buffering operations"
 .It "setbuffer stream buffering operations"
@@ -308,13 +338,15 @@ library conforms to
 .It "swprintf  formatted wide character output conversion"
 .It "sys_errlist       system error messages"
 .It "sys_nerr  system error messages"
+.It ""
 .It "tempnam   temporary file routines"
 .It "tmpfile   temporary file routines"
 .It "tmpnam    temporary file routines"
+.It ""
 .It "ungetc    un-get character from input stream"
 .It "ungetwc   un-get wide character from input stream"
+.It ""
 .It "vasprintf formatted output conversion"
-.It "vdprintf  formatted output conversion"
 .It "vfprintf  formatted output conversion"
 .It "vfscanf   input format conversion"
 .It "vfwprintf formatted wide character output conversion"
@@ -325,6 +357,7 @@ library conforms to
 .It "vsscanf   input format conversion"
 .It "vswprintf formatted wide character output conversion"
 .It "vwprintf  formatted wide character output conversion"
+.It ""
 .It "wprintf   formatted wide character output conversion"
 .El
 .Sh BUGS
diff --git a/stdio/FreeBSD/stdio.3.patch b/stdio/FreeBSD/stdio.3.patch
deleted file mode 100644 (file)
index 06eaaad..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
---- stdio.3.bsdnew     2009-11-11 13:33:16.000000000 -0800
-+++ stdio.3    2009-11-11 15:14:22.000000000 -0800
-@@ -41,6 +41,20 @@
- .Vt FILE *stdin ;
- .Vt FILE *stdout ;
- .Vt FILE *stderr ;
-+.Pp
-+Note:
-+The current implementation does not allow these variables
-+to be evaluated at C compile/link time.
-+That is, a runtime calculation must be performed, such as:
-+.Bd -literal -offset indent
-+#include <stdio.h>
-+
-+static FILE *var;
-+
-+int main() {
-+    var = stdout;
-+}
-+.Ed
- .Sh DESCRIPTION
- The standard
- .Tn I/O
-@@ -228,11 +242,21 @@ and
- .Dv putchar_unlocked
- exist and will be used if the macro
- definitions are explicitly removed.
-+.Sh LEGACY SYNOPSIS
-+The -D_NONSTD_SOURCE flag can be used
-+to allow stdin, stdout, and/or stderr
-+to be evaluated at compile/link time, as:
-+.Bd -literal -offset indent
-+#include <stdio.h>
-+
-+static FILE *var = stdout;
-+.Ed
- .Sh SEE ALSO
- .Xr close 2 ,
- .Xr open 2 ,
- .Xr read 2 ,
--.Xr write 2
-+.Xr write 2 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Nm
-@@ -242,8 +266,9 @@ library conforms to
- .Bl -column "Description"
- .It Sy "Function      Description"
- .It "asprintf formatted output conversion"
-+.It ""
- .It "clearerr check and reset stream status"
--.It "dprintf  formatted output conversion"
-+.It ""
- .It "fclose   close a stream"
- .It "fdopen   stream open functions"
- .It "feof     check and reset stream status"
-@@ -275,6 +300,7 @@ library conforms to
- .It "fwopen   open a stream"
- .It "fwprintf formatted wide character output conversion"
- .It "fwrite   binary stream input/output"
-+.It ""
- .It "getc     get next character or word from input stream"
- .It "getchar  get next character or word from input stream"
- .It "getdelim get a line from a stream"
-@@ -283,9 +309,11 @@ library conforms to
- .It "getw     get next character or word from input stream"
- .It "getwc    get next wide character from input stream"
- .It "getwchar get next wide character from input stream"
-+.It ""
- .It "mkdtemp  create unique temporary directory"
- .It "mkstemp  create unique temporary file"
- .It "mktemp   create unique temporary file"
-+.It ""
- .It "perror   system error messages"
- .It "printf   formatted output conversion"
- .It "putc     output a character or word to a stream"
-@@ -294,8 +322,10 @@ library conforms to
- .It "putw     output a character or word to a stream"
- .It "putwc    output a wide character to a stream"
- .It "putwchar output a wide character to a stream"
-+.It ""
- .It "remove   remove directory entry"
- .It "rewind   reposition a stream"
-+.It ""
- .It "scanf    input format conversion"
- .It "setbuf   stream buffering operations"
- .It "setbuffer        stream buffering operations"
-@@ -308,13 +338,15 @@ library conforms to
- .It "swprintf formatted wide character output conversion"
- .It "sys_errlist      system error messages"
- .It "sys_nerr system error messages"
-+.It ""
- .It "tempnam  temporary file routines"
- .It "tmpfile  temporary file routines"
- .It "tmpnam   temporary file routines"
-+.It ""
- .It "ungetc   un-get character from input stream"
- .It "ungetwc  un-get wide character from input stream"
-+.It ""
- .It "vasprintf        formatted output conversion"
--.It "vdprintf formatted output conversion"
- .It "vfprintf formatted output conversion"
- .It "vfscanf  input format conversion"
- .It "vfwprintf        formatted wide character output conversion"
-@@ -325,6 +357,7 @@ library conforms to
- .It "vsscanf  input format conversion"
- .It "vswprintf        formatted wide character output conversion"
- .It "vwprintf formatted wide character output conversion"
-+.It ""
- .It "wprintf  formatted wide character output conversion"
- .El
- .Sh BUGS
index 190326a7b6e9c898292b822cac3b88445e1128f0..698b6c8697f5e2a10f6e4ec084ede4369f898409 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/swprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -38,7 +40,22 @@ swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       ret = vswprintf(s, n, fmt, ap);
+       ret = vswprintf_l(s, n, __current_locale(), fmt, ap);
+       va_end(ap);
+
+       return (ret);
+}
+
+int
+swprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
+    const wchar_t * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vswprintf_l will */
+       va_start(ap, fmt);
+       ret = vswprintf_l(s, n, loc, fmt, ap);
        va_end(ap);
 
        return (ret);
diff --git a/stdio/FreeBSD/swprintf.c.patch b/stdio/FreeBSD/swprintf.c.patch
deleted file mode 100644 (file)
index fb1425a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- swprintf.c.orig    2003-05-20 15:22:44.000000000 -0700
-+++ swprintf.c 2005-02-23 16:44:36.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/swprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -38,7 +40,22 @@
-       va_list ap;
-       va_start(ap, fmt);
--      ret = vswprintf(s, n, fmt, ap);
-+      ret = vswprintf_l(s, n, __current_locale(), fmt, ap);
-+      va_end(ap);
-+
-+      return (ret);
-+}
-+
-+int
-+swprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
-+    const wchar_t * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vswprintf_l will */
-+      va_start(ap, fmt);
-+      ret = vswprintf_l(s, n, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
index 81ac9f1256a2beb095aa717f28fb00de3c861789..4fc850a1b7dfc8f09aa601a935748c964f744f5b 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/swscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -38,7 +40,22 @@ swscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, ...)
        int r;
 
        va_start(ap, fmt);
-       r = vswscanf(str, fmt, ap);
+       r = vswscanf_l(str, __current_locale(), fmt, ap);
+       va_end(ap);
+
+       return (r);
+}
+
+int
+swscanf_l(const wchar_t * __restrict str, locale_t loc,
+    const wchar_t * __restrict fmt, ...)
+{
+       va_list ap;
+       int r;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vswscanf_l will */
+       va_start(ap, fmt);
+       r = vswscanf_l(str, loc, fmt, ap);
        va_end(ap);
 
        return (r);
diff --git a/stdio/FreeBSD/swscanf.c.patch b/stdio/FreeBSD/swscanf.c.patch
deleted file mode 100644 (file)
index 21dfbe4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- swscanf.c.orig     2003-05-20 15:22:44.000000000 -0700
-+++ swscanf.c  2005-02-23 16:46:10.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/swscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -38,7 +40,22 @@
-       int r;
-       va_start(ap, fmt);
--      r = vswscanf(str, fmt, ap);
-+      r = vswscanf_l(str, __current_locale(), fmt, ap);
-+      va_end(ap);
-+
-+      return (r);
-+}
-+
-+int
-+swscanf_l(const wchar_t * __restrict str, locale_t loc,
-+    const wchar_t * __restrict fmt, ...)
-+{
-+      va_list ap;
-+      int r;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vswscanf_l will */
-+      va_start(ap, fmt);
-+      r = vswscanf_l(str, loc, fmt, ap);
-       va_end(ap);
-       return (r);
index 72a5e60ba57f1e8d37ac3dc2d533041522f7c852..adc2adffe8940a04102e85e5f6aeca715fc8943d 100644 (file)
@@ -53,35 +53,60 @@ tempnam(dir, pfx)
        int sverrno;
        char *f, *name;
 
-       if (!(name = malloc(MAXPATHLEN)))
+       if (!(name = malloc(MAXPATHLEN))) {
                return(NULL);
+       }
 
        if (!pfx)
                pfx = "tmp.";
 
+#if !__DARWIN_UNIX03
        if (issetugid() == 0 && (f = getenv("TMPDIR"))) {
                (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
                    *(f + strlen(f) - 1) == '/'? "": "/", pfx);
-               if ((f = _mktemp(name)))
+               if ((f = _mktemp(name))) {
                        return(f);
+               }
        }
-
+#endif /* !__DARWIN_UNIX03 */
        if ((f = (char *)dir)) {
+#if __DARWIN_UNIX03
+           if (access(dir, W_OK) == 0) {
+#endif /* __DARWIN_UNIX03 */
                (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
                    *(f + strlen(f) - 1) == '/'? "": "/", pfx);
-               if ((f = _mktemp(name)))
+               if ((f = _mktemp(name))) {
                        return(f);
+               }
+#if __DARWIN_UNIX03
+           }
+#endif /* __DARWIN_UNIX03 */
        }
 
        f = P_tmpdir;
+#if __DARWIN_UNIX03
+       if (access(f, W_OK) == 0) {     /* directory accessible? */
+#endif /* __DARWIN_UNIX03 */
        (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
-       if ((f = _mktemp(name)))
+       if ((f = _mktemp(name))) {
                return(f);
+       }
 
+#if __DARWIN_UNIX03
+       }
+       if (issetugid() == 0 && (f = getenv("TMPDIR")) && access(f, W_OK) == 0) {
+               (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
+                   *(f + strlen(f) - 1) == '/'? "": "/", pfx);
+               if ((f = _mktemp(name))) {
+                       return(f);
+               }
+       }
+#endif /* __DARWIN_UNIX03 */
        f = _PATH_TMP;
        (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
-       if ((f = _mktemp(name)))
+       if ((f = _mktemp(name))) {
                return(f);
+       }
 
        sverrno = errno;
        free(name);
diff --git a/stdio/FreeBSD/tempnam.c.patch b/stdio/FreeBSD/tempnam.c.patch
deleted file mode 100644 (file)
index 7e1c8be..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- tempnam.c.orig     2010-10-25 19:45:24.000000000 -0700
-+++ tempnam.c  2010-10-25 22:01:51.000000000 -0700
-@@ -53,35 +53,60 @@ tempnam(dir, pfx)
-       int sverrno;
-       char *f, *name;
--      if (!(name = malloc(MAXPATHLEN)))
-+      if (!(name = malloc(MAXPATHLEN))) {
-               return(NULL);
-+      }
-       if (!pfx)
-               pfx = "tmp.";
-+#if !__DARWIN_UNIX03
-       if (issetugid() == 0 && (f = getenv("TMPDIR"))) {
-               (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
-                   *(f + strlen(f) - 1) == '/'? "": "/", pfx);
--              if ((f = _mktemp(name)))
-+              if ((f = _mktemp(name))) {
-                       return(f);
-+              }
-       }
--
-+#endif /* !__DARWIN_UNIX03 */
-       if ((f = (char *)dir)) {
-+#if __DARWIN_UNIX03
-+          if (access(dir, W_OK) == 0) {
-+#endif /* __DARWIN_UNIX03 */
-               (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
-                   *(f + strlen(f) - 1) == '/'? "": "/", pfx);
--              if ((f = _mktemp(name)))
-+              if ((f = _mktemp(name))) {
-                       return(f);
-+              }
-+#if __DARWIN_UNIX03
-+          }
-+#endif /* __DARWIN_UNIX03 */
-       }
-       f = P_tmpdir;
-+#if __DARWIN_UNIX03
-+      if (access(f, W_OK) == 0) {     /* directory accessible? */
-+#endif /* __DARWIN_UNIX03 */
-       (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
--      if ((f = _mktemp(name)))
-+      if ((f = _mktemp(name))) {
-               return(f);
-+      }
-+#if __DARWIN_UNIX03
-+      }
-+      if (issetugid() == 0 && (f = getenv("TMPDIR")) && access(f, W_OK) == 0) {
-+              (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
-+                  *(f + strlen(f) - 1) == '/'? "": "/", pfx);
-+              if ((f = _mktemp(name))) {
-+                      return(f);
-+              }
-+      }
-+#endif /* __DARWIN_UNIX03 */
-       f = _PATH_TMP;
-       (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
--      if ((f = _mktemp(name)))
-+      if ((f = _mktemp(name))) {
-               return(f);
-+      }
-       sverrno = errno;
-       free(name);
index 3392af25ff93045f90733a1dfdf679180ec99833..5f377d98223ffda7df282232cafe5b5160c96d91 100644 (file)
@@ -32,7 +32,7 @@
 .\"     @(#)tmpnam.3   8.2 (Berkeley) 11/17/93
 .\" $FreeBSD: src/lib/libc/stdio/tmpnam.3,v 1.20 2007/03/16 21:46:24 maxim Exp $
 .\"
-.Dd March 18, 2007
+.Dd November 12, 2008
 .Dt TMPFILE 3
 .Os
 .Sh NAME
 .Sh SYNOPSIS
 .In stdio.h
 .Ft FILE *
-.Fn tmpfile void
+.Fo tmpfile
+.Fa "void"
+.Fc
 .Ft char *
-.Fn tmpnam "char *str"
+.Fo tmpnam
+.Fa "char *s"
+.Fc
 .Ft char *
-.Fn tempnam "const char *tmpdir" "const char *prefix"
+.Fo tempnam
+.Fa "const char *dir"
+.Fa "const char *pfx"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn tmpfile
@@ -63,12 +70,13 @@ returns, causing the file to be automatically deleted when the last
 reference to it is closed.
 The file is opened with the access value
 .Ql w+ .
-The file is created in the directory determined by the environment variable
+If the environment variable
 .Ev TMPDIR
-if set.
-The default location if
+is defined,
+the file is created in the specified directory.
+The default location, if
 .Ev TMPDIR
-is not set is
+is not set, is
 .Pa /tmp .
 .Pp
 The
@@ -83,7 +91,7 @@ past.
 is defined in the include file
 .In stdio.h .
 If the argument
-.Fa str
+.Fa s
 is
 .Pf non- Dv NULL ,
 the file name is copied to the buffer it references.
@@ -93,7 +101,7 @@ In either case,
 returns a pointer to the file name.
 .Pp
 The buffer referenced by
-.Fa str
+.Fa s
 is expected to be at least
 .Dv L_tmpnam
 bytes in length.
@@ -109,21 +117,23 @@ is similar to
 but provides the ability to specify the directory which will
 contain the temporary file and the file name prefix.
 .Pp
-The environment variable
-.Ev TMPDIR
-(if set), the argument
-.Fa tmpdir
+The argument
+.Fa dir
 (if
 .Pf non- Dv NULL ) ,
 the directory
 .Dv P_tmpdir ,
-and the directory
+the environment variable
+.Ev TMPDIR
+(if set),
+the directory
 .Pa /tmp
+and finally, the current directory,
 are tried, in the listed order, as directories in which to store the
 temporary file.
 .Pp
 The argument
-.Fa prefix ,
+.Fa pfx ,
 if
 .Pf non- Dv NULL ,
 is used to specify a file name prefix, which will be the
@@ -235,6 +245,12 @@ It is strongly suggested that
 be used in place of these functions.
 (See
 the FSA.)
+.Sh LEGACY DESCRIPTION
+In legacy mode, the order directories are tried by the
+.Fn tempnam
+function is different; the environment variable
+.Ev TMPDIR
+(if defined) is used first.
 .Sh SEE ALSO
 .Xr mkstemp 3 ,
 .Xr mktemp 3
diff --git a/stdio/FreeBSD/tmpnam.3.patch b/stdio/FreeBSD/tmpnam.3.patch
deleted file mode 100644 (file)
index 24478e1..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
---- tmpnam.3.bsdnew    2009-11-11 13:33:17.000000000 -0800
-+++ tmpnam.3   2009-11-11 15:17:16.000000000 -0800
-@@ -32,7 +32,7 @@
- .\"     @(#)tmpnam.3  8.2 (Berkeley) 11/17/93
- .\" $FreeBSD: src/lib/libc/stdio/tmpnam.3,v 1.20 2007/03/16 21:46:24 maxim Exp $
- .\"
--.Dd March 18, 2007
-+.Dd November 12, 2008
- .Dt TMPFILE 3
- .Os
- .Sh NAME
-@@ -45,11 +45,18 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft FILE *
--.Fn tmpfile void
-+.Fo tmpfile
-+.Fa "void"
-+.Fc
- .Ft char *
--.Fn tmpnam "char *str"
-+.Fo tmpnam
-+.Fa "char *s"
-+.Fc
- .Ft char *
--.Fn tempnam "const char *tmpdir" "const char *prefix"
-+.Fo tempnam
-+.Fa "const char *dir"
-+.Fa "const char *pfx"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn tmpfile
-@@ -63,12 +70,13 @@ returns, causing the file to be automati
- reference to it is closed.
- The file is opened with the access value
- .Ql w+ .
--The file is created in the directory determined by the environment variable
-+If the environment variable
- .Ev TMPDIR
--if set.
--The default location if
-+is defined,
-+the file is created in the specified directory.
-+The default location, if
- .Ev TMPDIR
--is not set is
-+is not set, is
- .Pa /tmp .
- .Pp
- The
-@@ -83,7 +91,7 @@ past.
- is defined in the include file
- .In stdio.h .
- If the argument
--.Fa str
-+.Fa s
- is
- .Pf non- Dv NULL ,
- the file name is copied to the buffer it references.
-@@ -93,7 +101,7 @@ In either case,
- returns a pointer to the file name.
- .Pp
- The buffer referenced by
--.Fa str
-+.Fa s
- is expected to be at least
- .Dv L_tmpnam
- bytes in length.
-@@ -109,21 +117,23 @@ is similar to
- but provides the ability to specify the directory which will
- contain the temporary file and the file name prefix.
- .Pp
--The environment variable
--.Ev TMPDIR
--(if set), the argument
--.Fa tmpdir
-+The argument
-+.Fa dir
- (if
- .Pf non- Dv NULL ) ,
- the directory
- .Dv P_tmpdir ,
--and the directory
-+the environment variable
-+.Ev TMPDIR
-+(if set),
-+the directory
- .Pa /tmp
-+and finally, the current directory,
- are tried, in the listed order, as directories in which to store the
- temporary file.
- .Pp
- The argument
--.Fa prefix ,
-+.Fa pfx ,
- if
- .Pf non- Dv NULL ,
- is used to specify a file name prefix, which will be the
-@@ -235,6 +245,12 @@ It is strongly suggested that
- be used in place of these functions.
- (See
- the FSA.)
-+.Sh LEGACY DESCRIPTION
-+In legacy mode, the order directories are tried by the
-+.Fn tempnam
-+function is different; the environment variable
-+.Ev TMPDIR
-+(if defined) is used first.
- .Sh SEE ALSO
- .Xr mkstemp 3 ,
- .Xr mktemp 3
index f3ab680805e4e97405a895f8cce2dc28e964bb8c..6dad888a2941790f3f34e6d8d9bbd1840234a77d 100644 (file)
@@ -40,21 +40,35 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/tmpnam.c,v 1.6 2007/01/09 00:28:07 imp Ex
 
 #include <stdio.h>
 #include <unistd.h>
+#include <pthread.h>
+#include <stdlib.h>
 
 __warn_references(tmpnam,
     "warning: tmpnam() possibly used unsafely; consider using mkstemp()");
 
 extern char *_mktemp(char *);
 
+static char *tmpnam_buf = NULL;
+static pthread_once_t tmpnam_buf_control = PTHREAD_ONCE_INIT;
+
+static void tmpnam_buf_allocate(void)
+{
+       tmpnam_buf = malloc(L_tmpnam);
+}
+
 char *
 tmpnam(s)
        char *s;
 {
        static u_long tmpcount;
-       static char buf[L_tmpnam];
 
-       if (s == NULL)
-               s = buf;
+       if (s == NULL) {
+               if (pthread_once(&tmpnam_buf_control, tmpnam_buf_allocate)
+                       || !tmpnam_buf) {
+                       return NULL;
+               }
+               s = tmpnam_buf;
+       }
        (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXX", P_tmpdir, tmpcount);
        ++tmpcount;
        return (_mktemp(s));
diff --git a/stdio/FreeBSD/tmpnam.c.patch b/stdio/FreeBSD/tmpnam.c.patch
deleted file mode 100644 (file)
index 5ff86df..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---- tmpnam.c.orig      2010-07-06 16:02:20.000000000 -0700
-+++ tmpnam.c   2010-07-06 16:32:52.000000000 -0700
-@@ -40,21 +40,35 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/t
- #include <stdio.h>
- #include <unistd.h>
-+#include <pthread.h>
-+#include <stdlib.h>
- __warn_references(tmpnam,
-     "warning: tmpnam() possibly used unsafely; consider using mkstemp()");
- extern char *_mktemp(char *);
-+static char *tmpnam_buf = NULL;
-+static pthread_once_t tmpnam_buf_control = PTHREAD_ONCE_INIT;
-+
-+static void tmpnam_buf_allocate(void)
-+{
-+      tmpnam_buf = malloc(L_tmpnam);
-+}
-+
- char *
- tmpnam(s)
-       char *s;
- {
-       static u_long tmpcount;
--      static char buf[L_tmpnam];
--      if (s == NULL)
--              s = buf;
-+      if (s == NULL) {
-+              if (pthread_once(&tmpnam_buf_control, tmpnam_buf_allocate)
-+                      || !tmpnam_buf) {
-+                      return NULL;
-+              }
-+              s = tmpnam_buf;
-+      }
-       (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXX", P_tmpdir, tmpcount);
-       ++tmpcount;
-       return (_mktemp(s));
index ee280eb9a745add23e872d37e90fa81a90b8ffe3..169a02ba0d86c2f02673841476b2e86433f3b54a 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft int
-.Fn ungetc "int c" "FILE *stream"
+.Fo ungetc
+.Fa "int c"
+.Fa "FILE *stream"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn ungetc
@@ -52,20 +55,20 @@ function pushes the character
 (converted to an unsigned char)
 back onto the input stream pointed to by
 .Fa stream .
-The pushed-back characters will be returned by subsequent reads on the
-stream (in reverse order).
-A successful intervening call,
-using the same stream,
+The pushed-back characters will be returned (in reverse order)
+by subsequent reads on the stream.
+A successful intervening call
 to one of the file positioning functions
 .Xr ( fseek 3 ,
 .Xr fsetpos 3 ,
 or
-.Xr rewind 3 )
-will discard the pushed back characters.
+.Xr rewind 3 ) ,
+using the same stream,
+will discard the pushed-back characters.
 .Pp
-One character of push-back is guaranteed,
+Only one character of push-back is guaranteed,
 but as long as there is sufficient memory,
-an effectively infinite amount of pushback is allowed.
+an effectively infinite amount of push-back is allowed.
 .Pp
 If a character is successfully pushed-back,
 the end-of-file indicator for the stream is cleared.
diff --git a/stdio/FreeBSD/ungetc.3.patch b/stdio/FreeBSD/ungetc.3.patch
deleted file mode 100644 (file)
index bc9668d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
---- ungetc.3.bsdnew    2009-11-11 13:33:17.000000000 -0800
-+++ ungetc.3   2009-11-11 13:33:18.000000000 -0800
-@@ -43,7 +43,10 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft int
--.Fn ungetc "int c" "FILE *stream"
-+.Fo ungetc
-+.Fa "int c"
-+.Fa "FILE *stream"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn ungetc
-@@ -52,20 +55,20 @@ function pushes the character
- (converted to an unsigned char)
- back onto the input stream pointed to by
- .Fa stream .
--The pushed-back characters will be returned by subsequent reads on the
--stream (in reverse order).
--A successful intervening call,
--using the same stream,
-+The pushed-back characters will be returned (in reverse order)
-+by subsequent reads on the stream.
-+A successful intervening call
- to one of the file positioning functions
- .Xr ( fseek 3 ,
- .Xr fsetpos 3 ,
- or
--.Xr rewind 3 )
--will discard the pushed back characters.
-+.Xr rewind 3 ) ,
-+using the same stream,
-+will discard the pushed-back characters.
- .Pp
--One character of push-back is guaranteed,
-+Only one character of push-back is guaranteed,
- but as long as there is sufficient memory,
--an effectively infinite amount of pushback is allowed.
-+an effectively infinite amount of push-back is allowed.
- .Pp
- If a character is successfully pushed-back,
- the end-of-file indicator for the stream is cleared.
index 561825340a12e50f2a0c9993f8f07b0902582d4b..726ec65838597604629eeb03bbc653bbb675cc7b 100644 (file)
@@ -38,7 +38,8 @@
 .Dt UNGETWC 3
 .Os
 .Sh NAME
-.Nm ungetwc
+.Nm ungetwc ,
+.Nm ungetwc_l
 .Nd un-get wide character from input stream
 .Sh LIBRARY
 .Lb libc
 .In stdio.h
 .In wchar.h
 .Ft wint_t
-.Fn ungetwc "wint_t wc" "FILE *stream"
+.Fo ungetwc
+.Fa "wint_t wc"
+.Fa "FILE *stream"
+.Fc
+.In stdio.h
+.In wchar.h
+.In xlocale.h
+.Ft wint_t
+.Fo ungetwc_l
+.Fa "wint_t wc"
+.Fa "FILE *stream"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn ungetwc
@@ -56,22 +69,31 @@ function pushes the wide character
 .Vt wchar_t )
 back onto the input stream pointed to by
 .Fa stream .
-The pushed-backed wide characters will be returned by subsequent reads on the
-stream (in reverse order).
-A successful intervening call, using the same stream, to one of the file
+The pushed-backed wide characters will be returned (in reverse order)
+by subsequent reads on the stream.
+A successful intervening call to one of the file
 positioning functions
 .Xr fseek 3 ,
 .Xr fsetpos 3 ,
 or
-.Xr rewind 3
-will discard the pushed back wide characters.
+.Xr rewind 3 ,
+using the same stream,
+will discard the pushed-back wide characters.
 .Pp
-One wide character of push-back is guaranteed,
-but as long as there is
-sufficient memory, an effectively infinite amount of pushback is allowed.
+Only one wide character of push-back is guaranteed,
+but as long as there is sufficient memory,
+an effectively infinite amount of push-back is allowed.
 .Pp
 If a character is successfully pushed-back,
 the end-of-file indicator for the stream is cleared.
+.Pp
+Although the
+.Fn ungetwc
+function uses the current locale, the
+.Fn ungetwc_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn ungetwc
@@ -87,7 +109,8 @@ character equals
 the operation will fail and the stream will remain unchanged.
 .Sh SEE ALSO
 .Xr fseek 3 ,
-.Xr getwc 3
+.Xr getwc 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn ungetwc
diff --git a/stdio/FreeBSD/ungetwc.3.patch b/stdio/FreeBSD/ungetwc.3.patch
deleted file mode 100644 (file)
index 8bf0a85..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
---- ungetwc.3.bsdnew   2009-11-11 13:33:18.000000000 -0800
-+++ ungetwc.3  2009-11-11 13:33:18.000000000 -0800
-@@ -38,7 +38,8 @@
- .Dt UNGETWC 3
- .Os
- .Sh NAME
--.Nm ungetwc
-+.Nm ungetwc ,
-+.Nm ungetwc_l
- .Nd un-get wide character from input stream
- .Sh LIBRARY
- .Lb libc
-@@ -46,7 +47,19 @@
- .In stdio.h
- .In wchar.h
- .Ft wint_t
--.Fn ungetwc "wint_t wc" "FILE *stream"
-+.Fo ungetwc
-+.Fa "wint_t wc"
-+.Fa "FILE *stream"
-+.Fc
-+.In stdio.h
-+.In wchar.h
-+.In xlocale.h
-+.Ft wint_t
-+.Fo ungetwc_l
-+.Fa "wint_t wc"
-+.Fa "FILE *stream"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn ungetwc
-@@ -56,22 +69,31 @@ function pushes the wide character
- .Vt wchar_t )
- back onto the input stream pointed to by
- .Fa stream .
--The pushed-backed wide characters will be returned by subsequent reads on the
--stream (in reverse order).
--A successful intervening call, using the same stream, to one of the file
-+The pushed-backed wide characters will be returned (in reverse order)
-+by subsequent reads on the stream.
-+A successful intervening call to one of the file
- positioning functions
- .Xr fseek 3 ,
- .Xr fsetpos 3 ,
- or
--.Xr rewind 3
--will discard the pushed back wide characters.
-+.Xr rewind 3 ,
-+using the same stream,
-+will discard the pushed-back wide characters.
- .Pp
--One wide character of push-back is guaranteed,
--but as long as there is
--sufficient memory, an effectively infinite amount of pushback is allowed.
-+Only one wide character of push-back is guaranteed,
-+but as long as there is sufficient memory,
-+an effectively infinite amount of push-back is allowed.
- .Pp
- If a character is successfully pushed-back,
- the end-of-file indicator for the stream is cleared.
-+.Pp
-+Although the
-+.Fn ungetwc
-+function uses the current locale, the
-+.Fn ungetwc_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn ungetwc
-@@ -87,7 +109,8 @@ character equals
- the operation will fail and the stream will remain unchanged.
- .Sh SEE ALSO
- .Xr fseek 3 ,
--.Xr getwc 3
-+.Xr getwc 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn ungetwc
index 47e84ae5f63c125f01621830469b08913588e8d2..37e6402a8774bf4b2e9f980a4d7519ec5b6a4de9 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/ungetwc.c,v 1.11 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <errno.h>
 #include <limits.h>
@@ -42,14 +44,14 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/ungetwc.c,v 1.11 2008/04/17 22:17:54 jhb
  * Non-MT-safe version.
  */
 wint_t
-__ungetwc(wint_t wc, FILE *fp)
+__ungetwc(wint_t wc, FILE *fp, locale_t loc)
 {
        char buf[MB_LEN_MAX];
        size_t len;
 
        if (wc == WEOF)
                return (WEOF);
-       if ((len = __wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
+       if ((len = loc->__lc_ctype->__wcrtomb(buf, wc, &fp->_mbstate, loc)) == (size_t)-1) {
                fp->_flags |= __SERR;
                return (WEOF);
        }
@@ -70,7 +72,21 @@ ungetwc(wint_t wc, FILE *fp)
 
        FLOCKFILE(fp);
        ORIENT(fp, 1);
-       r = __ungetwc(wc, fp);
+       r = __ungetwc(wc, fp, __current_locale());
+       FUNLOCKFILE(fp);
+
+       return (r);
+}
+
+wint_t
+ungetwc_l(wint_t wc, FILE *fp, locale_t loc)
+{
+       wint_t r;
+
+       NORMALIZE_LOCALE(loc);
+       FLOCKFILE(fp);
+       ORIENT(fp, 1);
+       r = __ungetwc(wc, fp, loc);
        FUNLOCKFILE(fp);
 
        return (r);
diff --git a/stdio/FreeBSD/ungetwc.c.patch b/stdio/FreeBSD/ungetwc.c.patch
deleted file mode 100644 (file)
index e9e1c3d..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
---- ungetwc.c.bsdnew   2009-11-11 13:33:18.000000000 -0800
-+++ ungetwc.c  2009-11-11 16:30:36.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/ungetwc.c,v 1.11 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <limits.h>
-@@ -42,14 +44,14 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/u
-  * Non-MT-safe version.
-  */
- wint_t
--__ungetwc(wint_t wc, FILE *fp)
-+__ungetwc(wint_t wc, FILE *fp, locale_t loc)
- {
-       char buf[MB_LEN_MAX];
-       size_t len;
-       if (wc == WEOF)
-               return (WEOF);
--      if ((len = __wcrtomb(buf, wc, &fp->_mbstate)) == (size_t)-1) {
-+      if ((len = loc->__lc_ctype->__wcrtomb(buf, wc, &fp->_mbstate, loc)) == (size_t)-1) {
-               fp->_flags |= __SERR;
-               return (WEOF);
-       }
-@@ -70,7 +72,21 @@ ungetwc(wint_t wc, FILE *fp)
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
--      r = __ungetwc(wc, fp);
-+      r = __ungetwc(wc, fp, __current_locale());
-+      FUNLOCKFILE(fp);
-+
-+      return (r);
-+}
-+
-+wint_t
-+ungetwc_l(wint_t wc, FILE *fp, locale_t loc)
-+{
-+      wint_t r;
-+
-+      NORMALIZE_LOCALE(loc);
-+      FLOCKFILE(fp);
-+      ORIENT(fp, 1);
-+      r = __ungetwc(wc, fp, loc);
-       FUNLOCKFILE(fp);
-       return (r);
index fd5bfa2dba12656cc97608ace2021fcc8c25d5c7..d872a9e136ff03c1bb849e7ef57c2b54d1b104fb 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.19 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include "local.h"
 
 int
-vasprintf(str, fmt, ap)
+vasprintf_l(str, loc, fmt, ap)
        char **str;
+       locale_t loc;
        const char *fmt;
        __va_list ap;
 {
        int ret;
        FILE f;
-
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
+       
+       NORMALIZE_LOCALE(loc);
        f._file = -1;
        f._flags = __SWR | __SSTR | __SALC;
        f._bf._base = f._p = (unsigned char *)malloc(128);
@@ -55,7 +62,7 @@ vasprintf(str, fmt, ap)
        f._bf._size = f._w = 127;               /* Leave room for the NUL */
        f._orientation = 0;
        memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, fmt, ap);
+       ret = __vfprintf(&f, loc, fmt, ap);
        if (ret < 0) {
                free(f._bf._base);
                *str = NULL;
@@ -66,3 +73,12 @@ vasprintf(str, fmt, ap)
        *str = (char *)f._bf._base;
        return (ret);
 }
+
+int
+vasprintf(str, fmt, ap)
+       char **str;
+       const char *fmt;
+       __va_list ap;
+{
+       return vasprintf_l(str, __current_locale(), fmt, ap);
+}
diff --git a/stdio/FreeBSD/vasprintf.c.patch b/stdio/FreeBSD/vasprintf.c.patch
deleted file mode 100644 (file)
index e08af0e..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
---- vasprintf.c.orig   2009-11-30 16:15:30.000000000 -0800
-+++ vasprintf.c        2009-12-03 15:19:16.000000000 -0800
-@@ -30,20 +30,27 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.19 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
- #include "local.h"
- int
--vasprintf(str, fmt, ap)
-+vasprintf_l(str, loc, fmt, ap)
-       char **str;
-+      locale_t loc;
-       const char *fmt;
-       __va_list ap;
- {
-       int ret;
-       FILE f;
--
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-+      
-+      NORMALIZE_LOCALE(loc);
-       f._file = -1;
-       f._flags = __SWR | __SSTR | __SALC;
-       f._bf._base = f._p = (unsigned char *)malloc(128);
-@@ -55,7 +62,7 @@ vasprintf(str, fmt, ap)
-       f._bf._size = f._w = 127;               /* Leave room for the NUL */
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
--      ret = __vfprintf(&f, fmt, ap);
-+      ret = __vfprintf(&f, loc, fmt, ap);
-       if (ret < 0) {
-               free(f._bf._base);
-               *str = NULL;
-@@ -66,3 +73,12 @@ vasprintf(str, fmt, ap)
-       *str = (char *)f._bf._base;
-       return (ret);
- }
-+
-+int
-+vasprintf(str, fmt, ap)
-+      char **str;
-+      const char *fmt;
-+      __va_list ap;
-+{
-+      return vasprintf_l(str, __current_locale(), fmt, ap);
-+}
index cba376b1ae05586ae3121aada9c7667d23502870..5625bd6c45411e943b88b998959ca85a609dc6b2 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <errno.h>
 #include <limits.h>
@@ -37,11 +39,16 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.1 2009/03/04 03:38:51 das
 #include "local.h"
 
 int
-vdprintf(int fd, const char * __restrict fmt, va_list ap)
+vdprintf_l(int fd, locale_t loc, const char * __restrict fmt, va_list ap)
 {
        FILE f;
        unsigned char buf[BUFSIZ];
        int ret;
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
+
+       NORMALIZE_LOCALE(loc);
 
        if (fd > SHRT_MAX) {
                errno = EMFILE;
@@ -59,8 +66,13 @@ vdprintf(int fd, const char * __restrict fmt, va_list ap)
        f._orientation = 0;
        bzero(&f._mbstate, sizeof(f._mbstate));
 
-       if ((ret = __vfprintf(&f, fmt, ap)) < 0)
+       if ((ret = __vfprintf(&f, loc, fmt, ap)) < 0)
                return (ret);
 
        return (__fflush(&f) ? EOF : ret);
 }
+
+int
+vdprintf(int fd, const char * __restrict fmt, va_list ap) {
+       return vdprintf_l(fd, __current_locale(), fmt, ap);
+}
diff --git a/stdio/FreeBSD/vdprintf.c.patch b/stdio/FreeBSD/vdprintf.c.patch
deleted file mode 100644 (file)
index 519239b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
---- vdprintf.c.orig    2009-12-15 17:43:09.000000000 -0800
-+++ vdprintf.c 2009-12-15 18:09:12.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <errno.h>
- #include <limits.h>
-@@ -37,11 +39,16 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include "local.h"
- int
--vdprintf(int fd, const char * __restrict fmt, va_list ap)
-+vdprintf_l(int fd, locale_t loc, const char * __restrict fmt, va_list ap)
- {
-       FILE f;
-       unsigned char buf[BUFSIZ];
-       int ret;
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-+
-+      NORMALIZE_LOCALE(loc);
-       if (fd > SHRT_MAX) {
-               errno = EMFILE;
-@@ -59,8 +66,13 @@ vdprintf(int fd, const char * __restrict
-       f._orientation = 0;
-       bzero(&f._mbstate, sizeof(f._mbstate));
--      if ((ret = __vfprintf(&f, fmt, ap)) < 0)
-+      if ((ret = __vfprintf(&f, loc, fmt, ap)) < 0)
-               return (ret);
-       return (__fflush(&f) ? EOF : ret);
- }
-+
-+int
-+vdprintf(int fd, const char * __restrict fmt, va_list ap) {
-+      return vdprintf_l(fd, __current_locale(), fmt, ap);
-+}
index df992ced9506dd4e207db8496dacbf7f56800dda..28673b4ae163dbdf6a2e787b028063bce57f9ebc 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vfprintf.c        8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.90 2009/02/28 06:06:57 das Exp $");
 
+#include "xlocale_private.h"
+
 /*
  * Actual printf innards.
  *
@@ -54,7 +56,10 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.90 2009/02/28 06:06:57 das
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
+#if 0 // xprintf pending API review
 #include <printf.h>
+#endif
+#include <errno.h>
 
 #include <stdarg.h>
 #include "un-namespace.h"
@@ -64,10 +69,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.90 2009/02/28 06:06:57 das
 #include "fvwrite.h"
 #include "printflocal.h"
 
-static int     __sprint(FILE *, struct __suio *);
-static int     __sbprintf(FILE *, const char *, va_list) __printflike(2, 0)
-       __noinline;
-static char    *__wcsconv(wchar_t *, int);
+static int     __sprint(FILE *, locale_t, struct __suio *);
+static int     __sbprintf(FILE *, locale_t, const char *, va_list) __printflike(3, 0);
+static char    *__wcsconv(wchar_t *, int, locale_t);
+
+__private_extern__ const char *__fix_nogrouping(const char *);
 
 #define        CHAR    char
 #include "printfcommon.h"
@@ -87,12 +93,12 @@ struct grouping_state {
  * of bytes that will be needed.
  */
 static int
-grouping_init(struct grouping_state *gs, int ndigits)
+grouping_init(struct grouping_state *gs, int ndigits, locale_t loc)
 {
        struct lconv *locale;
 
-       locale = localeconv();
-       gs->grouping = locale->grouping;
+       locale = localeconv_l(loc);
+       gs->grouping = __fix_nogrouping(locale->grouping);
        gs->thousands_sep = locale->thousands_sep;
        gs->thousep_len = strlen(gs->thousands_sep);
 
@@ -116,11 +122,11 @@ grouping_init(struct grouping_state *gs, int ndigits)
  */
 static int
 grouping_print(struct grouping_state *gs, struct io_state *iop,
-              const CHAR *cp, const CHAR *ep)
+              const CHAR *cp, const CHAR *ep, locale_t loc)
 {
        const CHAR *cp0 = cp;
 
-       if (io_printandpad(iop, cp, ep, gs->lead, zeroes))
+       if (io_printandpad(iop, cp, ep, gs->lead, zeroes, loc))
                return (-1);
        cp += gs->lead;
        while (gs->nseps > 0 || gs->nrepeats > 0) {
@@ -130,9 +136,9 @@ grouping_print(struct grouping_state *gs, struct io_state *iop,
                        gs->grouping--;
                        gs->nseps--;
                }
-               if (io_print(iop, gs->thousands_sep, gs->thousep_len))
+               if (io_print(iop, gs->thousands_sep, gs->thousep_len, loc))
                        return (-1);
-               if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes))
+               if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, loc))
                        return (-1);
                cp += *gs->grouping;
        }
@@ -146,7 +152,7 @@ grouping_print(struct grouping_state *gs, struct io_state *iop,
  * then reset it so that it can be reused.
  */
 static int
-__sprint(FILE *fp, struct __suio *uio)
+__sprint(FILE *fp, locale_t loc __unused, struct __suio *uio)
 {
        int err;
 
@@ -166,11 +172,14 @@ __sprint(FILE *fp, struct __suio *uio)
  * worries about ungetc buffers and so forth.
  */
 static int
-__sbprintf(FILE *fp, const char *fmt, va_list ap)
+__sbprintf(FILE *fp, locale_t loc, const char *fmt, va_list ap)
 {
        int ret;
        FILE fake;
        unsigned char buf[BUFSIZ];
+       struct __sFILEX ext;
+       fake._extra = &ext;
+       INITEXTRA(&fake);
 
        /* XXX This is probably not needed. */
        if (prepwrite(fp) != 0)
@@ -190,7 +199,7 @@ __sbprintf(FILE *fp, const char *fmt, va_list ap)
        fake._lbfsize = 0;      /* not actually used, but Just In Case */
 
        /* do the work, then copy any error status */
-       ret = __vfprintf(&fake, fmt, ap);
+       ret = __vfprintf(&fake, loc, fmt, ap);
        if (ret >= 0 && __fflush(&fake))
                ret = EOF;
        if (fake._flags & __SERR)
@@ -205,7 +214,7 @@ __sbprintf(FILE *fp, const char *fmt, va_list ap)
  * string ends is null-terminated.
  */
 static char *
-__wcsconv(wchar_t *wcsarg, int prec)
+__wcsconv(wchar_t *wcsarg, int prec, locale_t loc)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
@@ -218,7 +227,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
        if (prec < 0) {
                p = wcsarg;
                mbs = initial;
-               nbytes = wcsrtombs(NULL, (const wchar_t **)&p, 0, &mbs);
+               nbytes = wcsrtombs_l(NULL, (const wchar_t **)&p, 0, &mbs, loc);
                if (nbytes == (size_t)-1)
                        return (NULL);
        } else {
@@ -234,7 +243,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
                        p = wcsarg;
                        mbs = initial;
                        for (;;) {
-                               clen = wcrtomb(buf, *p++, &mbs);
+                               clen = wcrtomb_l(buf, *p++, &mbs, loc);
                                if (clen == 0 || clen == (size_t)-1 ||
                                    nbytes + clen > prec)
                                        break;
@@ -248,8 +257,8 @@ __wcsconv(wchar_t *wcsarg, int prec)
        /* Fill the output buffer. */
        p = wcsarg;
        mbs = initial;
-       if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p,
-           nbytes, &mbs)) == (size_t)-1) {
+       if ((nbytes = wcsrtombs_l(convbuf, (const wchar_t **)&p,
+           nbytes, &mbs, loc)) == (size_t)-1) {
                free(convbuf);
                return (NULL);
        }
@@ -261,22 +270,30 @@ __wcsconv(wchar_t *wcsarg, int prec)
  * MT-safe version
  */
 int
-vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
+vfprintf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt0, va_list ap)
 
 {
        int ret;
 
+       NORMALIZE_LOCALE(loc);
        FLOCKFILE(fp);
        /* optimise fprintf(stderr) (and other unbuffered Unix files) */
        if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
            fp->_file >= 0)
-               ret = __sbprintf(fp, fmt0, ap);
+               ret = __sbprintf(fp, loc, fmt0, ap);
        else
-               ret = __vfprintf(fp, fmt0, ap);
+               ret = __vfprintf(fp, loc, fmt0, ap);
        FUNLOCKFILE(fp);
        return (ret);
 }
 
+int
+vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
+
+{
+       return vfprintf_l(fp, __current_locale(), fmt0, ap);
+}
+
 /*
  * The size of the buffer we use as scratch space for integer
  * conversions, among other things.  We need enough space to
@@ -291,8 +308,8 @@ vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
 /*
  * Non-MT-safe version
  */
-int
-__vfprintf(FILE *fp, const char *fmt0, va_list ap)
+__private_extern__ int
+__vfprintf(FILE *fp, locale_t loc, const char *fmt0, va_list ap)
 {
        char *fmt;              /* format string */
        int ch;                 /* character from fmt */
@@ -334,6 +351,11 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
        int ndig;               /* actual number of digits returned by dtoa */
        char expstr[MAXEXPDIG+2];       /* buffer for exponent string: e+ZZZ */
        char *dtoaresult;       /* buffer allocated by dtoa */
+#endif
+#ifdef VECTORS
+       union arg vval;         /* Vector argument. */
+       char *pct;              /* Pointer to '%' at beginning of specifier. */
+       char vsep;              /* Vector separator character. */
 #endif
        u_long  ulval;          /* integer arguments %[diouxX] */
        uintmax_t ujval;        /* %j, %ll, %q, %t, %z integers */
@@ -357,19 +379,19 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
 
        /* BEWARE, these `goto error' on error. */
 #define        PRINT(ptr, len) { \
-       if (io_print(&io, (ptr), (len)))        \
+       if (io_print(&io, (ptr), (len), loc))   \
                goto error; \
 }
 #define        PAD(howmany, with) { \
-       if (io_pad(&io, (howmany), (with))) \
+       if (io_pad(&io, (howmany), (with), loc)) \
                goto error; \
 }
 #define        PRINTANDPAD(p, ep, len, with) { \
-       if (io_printandpad(&io, (p), (ep), (len), (with))) \
+       if (io_printandpad(&io, (p), (ep), (len), (with), loc)) \
                goto error; \
 }
 #define        FLUSH() { \
-       if (io_flush(&io)) \
+       if (io_flush(&io, loc)) \
                goto error; \
 }
 
@@ -405,7 +427,7 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
 #define        UJARG() \
        (flags&INTMAXT ? GETARG(uintmax_t) : \
            flags&SIZET ? (uintmax_t)GETARG(size_t) : \
-           flags&PTRDIFFT ? (uintmax_t)GETARG(ptrdiff_t) : \
+           flags&PTRDIFFT ? (uintmax_t)(unsigned long)GETARG(ptrdiff_t) : \
            (uintmax_t)GETARG(unsigned long long))
 
        /*
@@ -436,14 +458,19 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
                val = GETARG (int); \
        }
 
+#if 0 // xprintf pending API review
        if (__use_xprintf == 0 && getenv("USE_XPRINTF"))
                __use_xprintf = 1;
        if (__use_xprintf > 0)
-               return (__xvprintf(fp, fmt0, ap));
+               return (__xvprintf(fp, loc, fmt0, ap));
+#endif
 
        /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
-       if (prepwrite(fp) != 0)
+       if (prepwrite(fp) != 0) {
+               errno = EBADF;
                return (EOF);
+       }
+       ORIENT(fp, -1);
 
        convbuf = NULL;
        fmt = (char *)fmt0;
@@ -454,7 +481,7 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
        ret = 0;
 #ifndef NO_FLOATING_POINT
        dtoaresult = NULL;
-       decimal_point = localeconv()->decimal_point;
+       decimal_point = localeconv_l(loc)->decimal_point;
        /* The overwhelmingly common case is decpt_len == 1. */
        decpt_len = (decimal_point[1] == '\0' ? 1 : strlen(decimal_point));
 #endif
@@ -475,6 +502,9 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
                }
                if (ch == '\0')
                        goto done;
+#ifdef VECTORS
+               pct = fmt;
+#endif /* VECTORS */
                fmt++;          /* skip over '%' */
 
                flags = 0;
@@ -484,6 +514,9 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap)
                gs.grouping = NULL;
                sign = '\0';
                ox[1] = '\0';
+#ifdef VECTORS
+               vsep = 'X'; /* Illegal value, changed to defaults later. */
+#endif /* VECTORS */
 
 rflag:         ch = *fmt++;
 reswitch:      switch (ch) {
@@ -499,6 +532,11 @@ reswitch:  switch (ch) {
                case '#':
                        flags |= ALT;
                        goto rflag;
+#ifdef VECTORS
+               case ',': case ';': case ':': case '_':
+                       vsep = ch;
+                       goto rflag;
+#endif /* VECTORS */
                case '*':
                        /*-
                         * ``A negative field width argument is taken as a
@@ -595,14 +633,18 @@ reswitch: switch (ch) {
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'c':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & LONGINT) {
                                static const mbstate_t initial;
                                mbstate_t mbs;
                                size_t mbseqlen;
 
                                mbs = initial;
-                               mbseqlen = wcrtomb(cp = buf,
-                                   (wchar_t)GETARG(wint_t), &mbs);
+                               mbseqlen = wcrtomb_l(cp = buf,
+                                   (wchar_t)GETARG(wint_t), &mbs, loc);
                                if (mbseqlen == (size_t)-1) {
                                        fp->_flags |= __SERR;
                                        goto error;
@@ -619,6 +661,10 @@ reswitch:  switch (ch) {
                        /*FALLTHROUGH*/
                case 'd':
                case 'i':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE) {
                                ujval = SJARG();
                                if ((intmax_t)ujval < 0) {
@@ -637,6 +683,12 @@ reswitch:  switch (ch) {
 #ifndef NO_FLOATING_POINT
                case 'a':
                case 'A':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        if (ch == 'a') {
                                ox[1] = 'x';
                                xdigs = xdigs_lower;
@@ -668,6 +720,12 @@ reswitch:  switch (ch) {
                        goto fp_common;
                case 'e':
                case 'E':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        expchar = ch;
                        if (prec < 0)   /* account for digit before decpt */
                                prec = DEFPREC + 1;
@@ -676,10 +734,22 @@ reswitch: switch (ch) {
                        goto fp_begin;
                case 'f':
                case 'F':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        expchar = '\0';
                        goto fp_begin;
                case 'g':
                case 'G':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        expchar = ch - ('g' - 'e');
                        if (prec == 0)
                                prec = 1;
@@ -750,37 +820,46 @@ fp_common:
                                if (prec || flags & ALT)
                                        size += prec + decpt_len;
                                if ((flags & GROUPING) && expt > 0)
-                                       size += grouping_init(&gs, expt);
+                                       size += grouping_init(&gs, expt, loc);
                        }
                        break;
 #endif /* !NO_FLOATING_POINT */
                case 'n':
+               {
                        /*
                         * Assignment-like behavior is specified if the
                         * value overflows or is otherwise unrepresentable.
                         * C99 says to use `signed char' for %hhn conversions.
                         */
-                       if (flags & LLONGINT)
-                               *GETARG(long long *) = ret;
+                       void *ptr = GETARG(void *);
+                       if (ptr == NULL)
+                               continue;
+                       else if (flags & LLONGINT)
+                               *(long long *)ptr = ret;
                        else if (flags & SIZET)
-                               *GETARG(ssize_t *) = (ssize_t)ret;
+                               *(ssize_t *)ptr = (ssize_t)ret;
                        else if (flags & PTRDIFFT)
-                               *GETARG(ptrdiff_t *) = ret;
+                               *(ptrdiff_t *)ptr = ret;
                        else if (flags & INTMAXT)
-                               *GETARG(intmax_t *) = ret;
+                               *(intmax_t *)ptr = ret;
                        else if (flags & LONGINT)
-                               *GETARG(long *) = ret;
+                               *(long *)ptr = ret;
                        else if (flags & SHORTINT)
-                               *GETARG(short *) = ret;
+                               *(short *)ptr = ret;
                        else if (flags & CHARINT)
-                               *GETARG(signed char *) = ret;
+                               *(signed char *)ptr = ret;
                        else
-                               *GETARG(int *) = ret;
+                               *(int *)ptr = ret;
                        continue;       /* no output */
+               }
                case 'O':
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'o':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
                        else
@@ -795,6 +874,10 @@ fp_common:
                         * defined manner.''
                         *      -- ANSI X3J11
                         */
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        ujval = (uintmax_t)(uintptr_t)GETARG(void *);
                        base = 16;
                        xdigs = xdigs_lower;
@@ -813,7 +896,7 @@ fp_common:
                                if ((wcp = GETARG(wchar_t *)) == NULL)
                                        cp = "(null)";
                                else {
-                                       convbuf = __wcsconv(wcp, prec);
+                                       convbuf = __wcsconv(wcp, prec, loc);
                                        if (convbuf == NULL) {
                                                fp->_flags |= __SERR;
                                                goto error;
@@ -829,6 +912,10 @@ fp_common:
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'u':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
                        else
@@ -841,6 +928,10 @@ fp_common:
                case 'x':
                        xdigs = xdigs_lower;
 hex:
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
                        else
@@ -858,6 +949,7 @@ nosign:                     sign = '\0';
                         * ``... diouXx conversions ... if a precision is
                         * specified, the 0 flag will be ignored.''
                         *      -- ANSI X3J11
+                        * except for %#.0o and zero value
                         */
 number:                        if ((dprec = prec) >= 0)
                                flags &= ~ZEROPAD;
@@ -885,10 +977,15 @@ number:                   if ((dprec = prec) >= 0)
                        }
                        size = buf + BUF - cp;
                        if (size > BUF) /* should never happen */
-                               abort();
+                               LIBC_ABORT("size (%d) > BUF (%d)", size, BUF);
                        if ((flags & GROUPING) && size != 0)
-                               size += grouping_init(&gs, size);
+                               size += grouping_init(&gs, size, loc);
                        break;
+#ifdef VECTORS
+               case 'v':
+                       flags |= VECTOR;
+                       goto rflag;
+#endif /* VECTORS */
                default:        /* "%?" prints ?, unless ? is NUL */
                        if (ch == '\0')
                                goto done;
@@ -900,6 +997,290 @@ number:                   if ((dprec = prec) >= 0)
                        break;
                }
 
+#ifdef VECTORS
+               if (flags & VECTOR) {
+                       /*
+                        * Do the minimum amount of work necessary to construct
+                        * a format specifier that can be used to recursively
+                        * call vfprintf() for each element in the vector.
+                        */
+                       int i, j;       /* Counter. */
+                       int vcnt;       /* Number of elements in vector. */
+                       char *vfmt;     /* Pointer to format specifier. */
+#define EXTRAHH 2
+                       char vfmt_buf[32 + EXTRAHH]; /* Static buffer for format spec. */
+                       int vwidth = 0; /* Width specified via '*'. */
+                       int vprec = 0;  /* Precision specified via '*'. */
+                       char *vstr;     /* Used for asprintf(). */
+                       int vlen;       /* Length returned by asprintf(). */
+                       enum {
+                           V_CHAR, V_SHORT, V_INT,
+                           V_PCHAR, V_PSHORT, V_PINT,
+                           V_FLOAT,
+#ifdef V64TYPE
+                           V_LONGLONG, V_PLONGLONG,
+                           V_DOUBLE,
+#endif /* V64TYPE */
+                       } vtype;
+
+                       vval.vectorarg = GETARG(VECTORTYPE);
+                       /*
+                        * Set vfmt.  If vfmt_buf may not be big enough,
+                        * malloc() space, taking care to free it later.
+                        * (EXTRAHH is for possible extra "hh")
+                        */
+                       if (&fmt[-1] - pct + EXTRAHH < sizeof(vfmt_buf))
+                               vfmt = vfmt_buf;
+                       else
+                               vfmt = (char *)malloc(&fmt[-1] - pct + EXTRAHH + 1);
+
+                       /* Set the separator character, if not specified. */
+                       if (vsep == 'X') {
+                               if (ch == 'c')
+                                       vsep = '\0';
+                               else
+                                       vsep = ' ';
+                       }
+
+                       /* Create the format specifier. */
+                       for (i = j = 0; i < &fmt[-1] - pct; i++) {
+                               switch (pct[i]) {
+                               case ',': case ';': case ':': case '_':
+                               case 'v': case 'h': case 'l':
+                                       /* Ignore. */
+                                       break;
+                               case '*':
+                                       if (pct[i - 1] != '.')
+                                               vwidth = 1;
+                                       else
+                                               vprec = 1;
+                                       /* FALLTHROUGH */
+                               default:
+                                       vfmt[j++] = pct[i];
+                               }
+                       }
+               
+                       /*
+                        * Determine the number of elements in the vector and
+                        * finish up the format specifier.
+                        */
+                       if (flags & SHORTINT) {
+                               switch (ch) {
+                               case 'c':
+                                       vtype = V_SHORT;
+                                       break;
+                               case 'p':
+                                       vtype = V_PSHORT;
+                                       break;
+                               default:
+                                       vfmt[j++] = 'h';
+                                       vtype = V_SHORT;
+                                       break;
+                               }
+                               vcnt = 8;
+                       } else if (flags & LONGINT) {
+                               vcnt = 4;
+                               vtype = (ch == 'p') ? V_PINT : V_INT;
+#ifdef V64TYPE
+                       } else if (flags & LLONGINT) {
+                               switch (ch) {
+                               case 'a':
+                               case 'A':
+                               case 'e':
+                               case 'E':
+                               case 'f':
+                               case 'g':
+                               case 'G':
+                                       vcnt = 2;
+                                       vtype = V_DOUBLE;
+                                       break;
+                               case 'd':
+                               case 'i':
+                               case 'u':
+                               case 'o':
+                               case 'p':
+                               case 'x':
+                               case 'X':
+                                       vfmt[j++] = 'l';
+                                       vfmt[j++] = 'l';
+                                       vcnt = 2;
+                                       vtype = (ch == 'p') ? V_PLONGLONG : V_LONGLONG;
+                                       break;
+                               default:
+                                       /*
+                                        * The default case should never
+                                        * happen.
+                                        */
+                               case 'c':
+                                       vcnt = 16;
+                                       vtype = V_CHAR;
+                               }
+#endif /* V64TYPE */
+                       } else {
+                               switch (ch) {
+                               case 'a':
+                               case 'A':
+                               case 'e':
+                               case 'E':
+                               case 'f':
+                               case 'g':
+                               case 'G':
+                                       vcnt = 4;
+                                       vtype = V_FLOAT;
+                                       break;
+                               default:
+                                       /*
+                                        * The default case should never
+                                        * happen.
+                                        */
+                               case 'd':
+                               case 'i':
+                               case 'u':
+                               case 'o':
+                               case 'x':
+                               case 'X':
+                                       vfmt[j++] = 'h';
+                                       vfmt[j++] = 'h';
+                                       /* drop through */
+                               case 'p':
+                               case 'c':
+                                       vcnt = 16;
+                                       vtype = (ch == 'p') ? V_PCHAR : V_CHAR;
+                               }
+                       }
+                       vfmt[j++] = ch;
+                       vfmt[j++] = '\0';
+
+/* Get a vector element. */
+#ifdef V64TYPE
+#define VPRINT(type, ind, args...) do {                                        \
+       switch (type) {                                                 \
+       case V_CHAR:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_PCHAR:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_SHORT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_PSHORT:                                                  \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_INT:                                                     \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_PINT:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_LONGLONG:                                                \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vulonglongarg[ind]); \
+               break;                                                  \
+       case V_PLONGLONG:                                               \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vulonglongarg[ind]); \
+               break;                                                  \
+       case V_FLOAT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
+               break;                                                  \
+       case V_DOUBLE:                                                  \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vdoublearg[ind]); \
+               break;                                                  \
+       }                                                               \
+       ret += vlen;                                                    \
+       PRINT(vstr, vlen);                                              \
+       FLUSH();                                                        \
+       free(vstr);                                                     \
+} while (0)
+#else /* !V64TYPE */
+#define VPRINT(type, ind, args...) do {                                        \
+       switch (type) {                                                 \
+       case V_CHAR:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_PCHAR:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_SHORT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_PSHORT:                                                  \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_INT:                                                     \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_PINT:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_FLOAT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
+               break;                                                  \
+       }                                                               \
+       ret += vlen;                                                    \
+       PRINT(vstr, vlen);                                              \
+       FLUSH();                                                        \
+       free(vstr);                                                     \
+} while (0)
+#endif /* V64TYPE */
+
+                       /* Actually print. */
+                       if (vwidth == 0) {
+                               if (vprec == 0) {
+                                       /* First element. */
+                                       VPRINT(vtype, 0);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i);
+                                       }
+                               } else {
+                                       /* First element. */
+                                       VPRINT(vtype, 0, prec);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i, prec);
+                                       }
+                               }
+                       } else {
+                               if (vprec == 0) {
+                                       /* First element. */
+                                       VPRINT(vtype, 0, width);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i, width);
+                                       }
+                               } else {
+                                       /* First element. */
+                                       VPRINT(vtype, 0, width, prec);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i, width, prec);
+                                       }
+                               }
+                       }
+#undef VPRINT
+
+                       if (vfmt != vfmt_buf)
+                               free(vfmt);
+
+                       continue;
+               }
+#endif /* VECTORS */
                /*
                 * All reasonable formats wind up here.  At this point, `cp'
                 * points to a string which (if not flags&LADJUST) should be
@@ -950,7 +1331,7 @@ number:                    if ((dprec = prec) >= 0)
                        /* leading zeroes from decimal precision */
                        PAD(dprec - size, zeroes);
                        if (gs.grouping) {
-                               if (grouping_print(&gs, &io, cp, buf+BUF) < 0)
+                               if (grouping_print(&gs, &io, cp, buf+BUF, loc) < 0)
                                        goto error;
                        } else {
                                PRINT(cp, size);
@@ -968,7 +1349,7 @@ number:                    if ((dprec = prec) >= 0)
                                } else {
                                        if (gs.grouping) {
                                                n = grouping_print(&gs, &io,
-                                                   cp, dtoaend);
+                                                   cp, dtoaend, loc);
                                                if (n < 0)
                                                        goto error;
                                                cp += n;
diff --git a/stdio/FreeBSD/vfprintf.c.patch b/stdio/FreeBSD/vfprintf.c.patch
deleted file mode 100644 (file)
index b3ffc42..0000000
+++ /dev/null
@@ -1,864 +0,0 @@
---- vfprintf.c.orig    2010-11-22 22:37:24.000000000 -0800
-+++ vfprintf.c 2010-11-22 22:38:38.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vfprintf.c       8
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.90 2009/02/28 06:06:57 das Exp $");
-+#include "xlocale_private.h"
-+
- /*
-  * Actual printf innards.
-  *
-@@ -54,7 +56,10 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include <stdlib.h>
- #include <string.h>
- #include <wchar.h>
-+#if 0 // xprintf pending API review
- #include <printf.h>
-+#endif
-+#include <errno.h>
- #include <stdarg.h>
- #include "un-namespace.h"
-@@ -64,10 +69,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include "fvwrite.h"
- #include "printflocal.h"
--static int    __sprint(FILE *, struct __suio *);
--static int    __sbprintf(FILE *, const char *, va_list) __printflike(2, 0)
--      __noinline;
--static char   *__wcsconv(wchar_t *, int);
-+static int    __sprint(FILE *, locale_t, struct __suio *);
-+static int    __sbprintf(FILE *, locale_t, const char *, va_list) __printflike(3, 0);
-+static char   *__wcsconv(wchar_t *, int, locale_t);
-+
-+__private_extern__ const char *__fix_nogrouping(const char *);
- #define       CHAR    char
- #include "printfcommon.h"
-@@ -87,12 +93,12 @@ struct grouping_state {
-  * of bytes that will be needed.
-  */
- static int
--grouping_init(struct grouping_state *gs, int ndigits)
-+grouping_init(struct grouping_state *gs, int ndigits, locale_t loc)
- {
-       struct lconv *locale;
--      locale = localeconv();
--      gs->grouping = locale->grouping;
-+      locale = localeconv_l(loc);
-+      gs->grouping = __fix_nogrouping(locale->grouping);
-       gs->thousands_sep = locale->thousands_sep;
-       gs->thousep_len = strlen(gs->thousands_sep);
-@@ -116,11 +122,11 @@ grouping_init(struct grouping_state *gs,
-  */
- static int
- grouping_print(struct grouping_state *gs, struct io_state *iop,
--             const CHAR *cp, const CHAR *ep)
-+             const CHAR *cp, const CHAR *ep, locale_t loc)
- {
-       const CHAR *cp0 = cp;
--      if (io_printandpad(iop, cp, ep, gs->lead, zeroes))
-+      if (io_printandpad(iop, cp, ep, gs->lead, zeroes, loc))
-               return (-1);
-       cp += gs->lead;
-       while (gs->nseps > 0 || gs->nrepeats > 0) {
-@@ -130,9 +136,9 @@ grouping_print(struct grouping_state *gs
-                       gs->grouping--;
-                       gs->nseps--;
-               }
--              if (io_print(iop, gs->thousands_sep, gs->thousep_len))
-+              if (io_print(iop, gs->thousands_sep, gs->thousep_len, loc))
-                       return (-1);
--              if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes))
-+              if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, loc))
-                       return (-1);
-               cp += *gs->grouping;
-       }
-@@ -146,7 +152,7 @@ grouping_print(struct grouping_state *gs
-  * then reset it so that it can be reused.
-  */
- static int
--__sprint(FILE *fp, struct __suio *uio)
-+__sprint(FILE *fp, locale_t loc __unused, struct __suio *uio)
- {
-       int err;
-@@ -166,11 +172,14 @@ __sprint(FILE *fp, struct __suio *uio)
-  * worries about ungetc buffers and so forth.
-  */
- static int
--__sbprintf(FILE *fp, const char *fmt, va_list ap)
-+__sbprintf(FILE *fp, locale_t loc, const char *fmt, va_list ap)
- {
-       int ret;
-       FILE fake;
-       unsigned char buf[BUFSIZ];
-+      struct __sFILEX ext;
-+      fake._extra = &ext;
-+      INITEXTRA(&fake);
-       /* XXX This is probably not needed. */
-       if (prepwrite(fp) != 0)
-@@ -190,7 +199,7 @@ __sbprintf(FILE *fp, const char *fmt, va
-       fake._lbfsize = 0;      /* not actually used, but Just In Case */
-       /* do the work, then copy any error status */
--      ret = __vfprintf(&fake, fmt, ap);
-+      ret = __vfprintf(&fake, loc, fmt, ap);
-       if (ret >= 0 && __fflush(&fake))
-               ret = EOF;
-       if (fake._flags & __SERR)
-@@ -205,7 +214,7 @@ __sbprintf(FILE *fp, const char *fmt, va
-  * string ends is null-terminated.
-  */
- static char *
--__wcsconv(wchar_t *wcsarg, int prec)
-+__wcsconv(wchar_t *wcsarg, int prec, locale_t loc)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-@@ -218,7 +227,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
-       if (prec < 0) {
-               p = wcsarg;
-               mbs = initial;
--              nbytes = wcsrtombs(NULL, (const wchar_t **)&p, 0, &mbs);
-+              nbytes = wcsrtombs_l(NULL, (const wchar_t **)&p, 0, &mbs, loc);
-               if (nbytes == (size_t)-1)
-                       return (NULL);
-       } else {
-@@ -234,7 +243,7 @@ __wcsconv(wchar_t *wcsarg, int prec)
-                       p = wcsarg;
-                       mbs = initial;
-                       for (;;) {
--                              clen = wcrtomb(buf, *p++, &mbs);
-+                              clen = wcrtomb_l(buf, *p++, &mbs, loc);
-                               if (clen == 0 || clen == (size_t)-1 ||
-                                   nbytes + clen > prec)
-                                       break;
-@@ -248,8 +257,8 @@ __wcsconv(wchar_t *wcsarg, int prec)
-       /* Fill the output buffer. */
-       p = wcsarg;
-       mbs = initial;
--      if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p,
--          nbytes, &mbs)) == (size_t)-1) {
-+      if ((nbytes = wcsrtombs_l(convbuf, (const wchar_t **)&p,
-+          nbytes, &mbs, loc)) == (size_t)-1) {
-               free(convbuf);
-               return (NULL);
-       }
-@@ -261,22 +270,30 @@ __wcsconv(wchar_t *wcsarg, int prec)
-  * MT-safe version
-  */
- int
--vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
-+vfprintf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt0, va_list ap)
- {
-       int ret;
-+      NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       /* optimise fprintf(stderr) (and other unbuffered Unix files) */
-       if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
-           fp->_file >= 0)
--              ret = __sbprintf(fp, fmt0, ap);
-+              ret = __sbprintf(fp, loc, fmt0, ap);
-       else
--              ret = __vfprintf(fp, fmt0, ap);
-+              ret = __vfprintf(fp, loc, fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
- }
-+int
-+vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
-+
-+{
-+      return vfprintf_l(fp, __current_locale(), fmt0, ap);
-+}
-+
- /*
-  * The size of the buffer we use as scratch space for integer
-  * conversions, among other things.  We need enough space to
-@@ -291,8 +308,8 @@ vfprintf(FILE * __restrict fp, const cha
- /*
-  * Non-MT-safe version
-  */
--int
--__vfprintf(FILE *fp, const char *fmt0, va_list ap)
-+__private_extern__ int
-+__vfprintf(FILE *fp, locale_t loc, const char *fmt0, va_list ap)
- {
-       char *fmt;              /* format string */
-       int ch;                 /* character from fmt */
-@@ -335,6 +352,11 @@ __vfprintf(FILE *fp, const char *fmt0, v
-       char expstr[MAXEXPDIG+2];       /* buffer for exponent string: e+ZZZ */
-       char *dtoaresult;       /* buffer allocated by dtoa */
- #endif
-+#ifdef VECTORS
-+      union arg vval;         /* Vector argument. */
-+      char *pct;              /* Pointer to '%' at beginning of specifier. */
-+      char vsep;              /* Vector separator character. */
-+#endif
-       u_long  ulval;          /* integer arguments %[diouxX] */
-       uintmax_t ujval;        /* %j, %ll, %q, %t, %z integers */
-       int base;               /* base for [diouxX] conversion */
-@@ -357,19 +379,19 @@ __vfprintf(FILE *fp, const char *fmt0, v
-       /* BEWARE, these `goto error' on error. */
- #define       PRINT(ptr, len) { \
--      if (io_print(&io, (ptr), (len)))        \
-+      if (io_print(&io, (ptr), (len), loc))   \
-               goto error; \
- }
- #define       PAD(howmany, with) { \
--      if (io_pad(&io, (howmany), (with))) \
-+      if (io_pad(&io, (howmany), (with), loc)) \
-               goto error; \
- }
- #define       PRINTANDPAD(p, ep, len, with) { \
--      if (io_printandpad(&io, (p), (ep), (len), (with))) \
-+      if (io_printandpad(&io, (p), (ep), (len), (with), loc)) \
-               goto error; \
- }
- #define       FLUSH() { \
--      if (io_flush(&io)) \
-+      if (io_flush(&io, loc)) \
-               goto error; \
- }
-@@ -405,7 +427,7 @@ __vfprintf(FILE *fp, const char *fmt0, v
- #define       UJARG() \
-       (flags&INTMAXT ? GETARG(uintmax_t) : \
-           flags&SIZET ? (uintmax_t)GETARG(size_t) : \
--          flags&PTRDIFFT ? (uintmax_t)GETARG(ptrdiff_t) : \
-+          flags&PTRDIFFT ? (uintmax_t)(unsigned long)GETARG(ptrdiff_t) : \
-           (uintmax_t)GETARG(unsigned long long))
-       /*
-@@ -436,14 +458,19 @@ __vfprintf(FILE *fp, const char *fmt0, v
-               val = GETARG (int); \
-       }
-+#if 0 // xprintf pending API review
-       if (__use_xprintf == 0 && getenv("USE_XPRINTF"))
-               __use_xprintf = 1;
-       if (__use_xprintf > 0)
--              return (__xvprintf(fp, fmt0, ap));
-+              return (__xvprintf(fp, loc, fmt0, ap));
-+#endif
-       /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
--      if (prepwrite(fp) != 0)
-+      if (prepwrite(fp) != 0) {
-+              errno = EBADF;
-               return (EOF);
-+      }
-+      ORIENT(fp, -1);
-       convbuf = NULL;
-       fmt = (char *)fmt0;
-@@ -454,7 +481,7 @@ __vfprintf(FILE *fp, const char *fmt0, v
-       ret = 0;
- #ifndef NO_FLOATING_POINT
-       dtoaresult = NULL;
--      decimal_point = localeconv()->decimal_point;
-+      decimal_point = localeconv_l(loc)->decimal_point;
-       /* The overwhelmingly common case is decpt_len == 1. */
-       decpt_len = (decimal_point[1] == '\0' ? 1 : strlen(decimal_point));
- #endif
-@@ -475,6 +502,9 @@ __vfprintf(FILE *fp, const char *fmt0, v
-               }
-               if (ch == '\0')
-                       goto done;
-+#ifdef VECTORS
-+              pct = fmt;
-+#endif /* VECTORS */
-               fmt++;          /* skip over '%' */
-               flags = 0;
-@@ -484,6 +514,9 @@ __vfprintf(FILE *fp, const char *fmt0, v
-               gs.grouping = NULL;
-               sign = '\0';
-               ox[1] = '\0';
-+#ifdef VECTORS
-+              vsep = 'X'; /* Illegal value, changed to defaults later. */
-+#endif /* VECTORS */
- rflag:                ch = *fmt++;
- reswitch:     switch (ch) {
-@@ -499,6 +532,11 @@ reswitch: switch (ch) {
-               case '#':
-                       flags |= ALT;
-                       goto rflag;
-+#ifdef VECTORS
-+              case ',': case ';': case ':': case '_':
-+                      vsep = ch;
-+                      goto rflag;
-+#endif /* VECTORS */
-               case '*':
-                       /*-
-                        * ``A negative field width argument is taken as a
-@@ -595,14 +633,18 @@ reswitch:        switch (ch) {
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'c':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & LONGINT) {
-                               static const mbstate_t initial;
-                               mbstate_t mbs;
-                               size_t mbseqlen;
-                               mbs = initial;
--                              mbseqlen = wcrtomb(cp = buf,
--                                  (wchar_t)GETARG(wint_t), &mbs);
-+                              mbseqlen = wcrtomb_l(cp = buf,
-+                                  (wchar_t)GETARG(wint_t), &mbs, loc);
-                               if (mbseqlen == (size_t)-1) {
-                                       fp->_flags |= __SERR;
-                                       goto error;
-@@ -619,6 +661,10 @@ reswitch: switch (ch) {
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE) {
-                               ujval = SJARG();
-                               if ((intmax_t)ujval < 0) {
-@@ -637,6 +683,12 @@ reswitch: switch (ch) {
- #ifndef NO_FLOATING_POINT
-               case 'a':
-               case 'A':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       if (ch == 'a') {
-                               ox[1] = 'x';
-                               xdigs = xdigs_lower;
-@@ -650,6 +702,12 @@ reswitch: switch (ch) {
-                               prec++;
-                       if (dtoaresult != NULL)
-                               freedtoa(dtoaresult);
-+#ifdef LDBL_COMPAT
-+                      fparg.dbl = GETARG(double);
-+                      dtoaresult = cp =
-+                          __hdtoa(fparg.dbl, xdigs, prec,
-+                          &expt, &signflag, &dtoaend);
-+#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult = cp =
-@@ -661,6 +719,7 @@ reswitch:  switch (ch) {
-                                   __hdtoa(fparg.dbl, xdigs, prec,
-                                   &expt, &signflag, &dtoaend);
-                       }
-+#endif /* LDBL_COMPAT */
-                       if (prec < 0)
-                               prec = dtoaend - cp;
-                       if (expt == INT_MAX)
-@@ -668,6 +727,12 @@ reswitch: switch (ch) {
-                       goto fp_common;
-               case 'e':
-               case 'E':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       expchar = ch;
-                       if (prec < 0)   /* account for digit before decpt */
-                               prec = DEFPREC + 1;
-@@ -676,10 +741,22 @@ reswitch:        switch (ch) {
-                       goto fp_begin;
-               case 'f':
-               case 'F':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       expchar = '\0';
-                       goto fp_begin;
-               case 'g':
-               case 'G':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       expchar = ch - ('g' - 'e');
-                       if (prec == 0)
-                               prec = 1;
-@@ -688,6 +765,14 @@ fp_begin:
-                               prec = DEFPREC;
-                       if (dtoaresult != NULL)
-                               freedtoa(dtoaresult);
-+#ifdef LDBL_COMPAT
-+                      fparg.dbl = GETARG(double);
-+                      dtoaresult = cp =
-+                          dtoa(fparg.dbl, expchar ? 2 : 3, prec,
-+                          &expt, &signflag, &dtoaend);
-+                      if (expt == 9999)
-+                              expt = INT_MAX;
-+#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult = cp =
-@@ -701,6 +786,7 @@ fp_begin:
-                               if (expt == 9999)
-                                       expt = INT_MAX;
-                       }
-+#endif /* LDBL_COMPAT */
- fp_common:
-                       if (signflag)
-                               sign = '-';
-@@ -750,37 +836,46 @@ fp_common:
-                               if (prec || flags & ALT)
-                                       size += prec + decpt_len;
-                               if ((flags & GROUPING) && expt > 0)
--                                      size += grouping_init(&gs, expt);
-+                                      size += grouping_init(&gs, expt, loc);
-                       }
-                       break;
- #endif /* !NO_FLOATING_POINT */
-               case 'n':
-+              {
-                       /*
-                        * Assignment-like behavior is specified if the
-                        * value overflows or is otherwise unrepresentable.
-                        * C99 says to use `signed char' for %hhn conversions.
-                        */
--                      if (flags & LLONGINT)
--                              *GETARG(long long *) = ret;
-+                      void *ptr = GETARG(void *);
-+                      if (ptr == NULL)
-+                              continue;
-+                      else if (flags & LLONGINT)
-+                              *(long long *)ptr = ret;
-                       else if (flags & SIZET)
--                              *GETARG(ssize_t *) = (ssize_t)ret;
-+                              *(ssize_t *)ptr = (ssize_t)ret;
-                       else if (flags & PTRDIFFT)
--                              *GETARG(ptrdiff_t *) = ret;
-+                              *(ptrdiff_t *)ptr = ret;
-                       else if (flags & INTMAXT)
--                              *GETARG(intmax_t *) = ret;
-+                              *(intmax_t *)ptr = ret;
-                       else if (flags & LONGINT)
--                              *GETARG(long *) = ret;
-+                              *(long *)ptr = ret;
-                       else if (flags & SHORTINT)
--                              *GETARG(short *) = ret;
-+                              *(short *)ptr = ret;
-                       else if (flags & CHARINT)
--                              *GETARG(signed char *) = ret;
-+                              *(signed char *)ptr = ret;
-                       else
--                              *GETARG(int *) = ret;
-+                              *(int *)ptr = ret;
-                       continue;       /* no output */
-+              }
-               case 'O':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-@@ -795,6 +890,10 @@ fp_common:
-                        * defined manner.''
-                        *      -- ANSI X3J11
-                        */
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       ujval = (uintmax_t)(uintptr_t)GETARG(void *);
-                       base = 16;
-                       xdigs = xdigs_lower;
-@@ -813,7 +912,7 @@ fp_common:
-                               if ((wcp = GETARG(wchar_t *)) == NULL)
-                                       cp = "(null)";
-                               else {
--                                      convbuf = __wcsconv(wcp, prec);
-+                                      convbuf = __wcsconv(wcp, prec, loc);
-                                       if (convbuf == NULL) {
-                                               fp->_flags |= __SERR;
-                                               goto error;
-@@ -829,6 +928,10 @@ fp_common:
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'u':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-@@ -841,6 +944,10 @@ fp_common:
-               case 'x':
-                       xdigs = xdigs_lower;
- hex:
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-@@ -858,6 +965,7 @@ nosign:                    sign = '\0';
-                        * ``... diouXx conversions ... if a precision is
-                        * specified, the 0 flag will be ignored.''
-                        *      -- ANSI X3J11
-+                       * except for %#.0o and zero value
-                        */
- number:                       if ((dprec = prec) >= 0)
-                               flags &= ~ZEROPAD;
-@@ -885,10 +993,15 @@ number:                  if ((dprec = prec) >= 0)
-                       }
-                       size = buf + BUF - cp;
-                       if (size > BUF) /* should never happen */
--                              abort();
-+                              LIBC_ABORT("size (%d) > BUF (%d)", size, BUF);
-                       if ((flags & GROUPING) && size != 0)
--                              size += grouping_init(&gs, size);
-+                              size += grouping_init(&gs, size, loc);
-                       break;
-+#ifdef VECTORS
-+              case 'v':
-+                      flags |= VECTOR;
-+                      goto rflag;
-+#endif /* VECTORS */
-               default:        /* "%?" prints ?, unless ? is NUL */
-                       if (ch == '\0')
-                               goto done;
-@@ -900,6 +1013,290 @@ number:                 if ((dprec = prec) >= 0)
-                       break;
-               }
-+#ifdef VECTORS
-+              if (flags & VECTOR) {
-+                      /*
-+                       * Do the minimum amount of work necessary to construct
-+                       * a format specifier that can be used to recursively
-+                       * call vfprintf() for each element in the vector.
-+                       */
-+                      int i, j;       /* Counter. */
-+                      int vcnt;       /* Number of elements in vector. */
-+                      char *vfmt;     /* Pointer to format specifier. */
-+#define EXTRAHH 2
-+                      char vfmt_buf[32 + EXTRAHH]; /* Static buffer for format spec. */
-+                      int vwidth = 0; /* Width specified via '*'. */
-+                      int vprec = 0;  /* Precision specified via '*'. */
-+                      char *vstr;     /* Used for asprintf(). */
-+                      int vlen;       /* Length returned by asprintf(). */
-+                      enum {
-+                          V_CHAR, V_SHORT, V_INT,
-+                          V_PCHAR, V_PSHORT, V_PINT,
-+                          V_FLOAT,
-+#ifdef V64TYPE
-+                          V_LONGLONG, V_PLONGLONG,
-+                          V_DOUBLE,
-+#endif /* V64TYPE */
-+                      } vtype;
-+
-+                      vval.vectorarg = GETARG(VECTORTYPE);
-+                      /*
-+                       * Set vfmt.  If vfmt_buf may not be big enough,
-+                       * malloc() space, taking care to free it later.
-+                       * (EXTRAHH is for possible extra "hh")
-+                       */
-+                      if (&fmt[-1] - pct + EXTRAHH < sizeof(vfmt_buf))
-+                              vfmt = vfmt_buf;
-+                      else
-+                              vfmt = (char *)malloc(&fmt[-1] - pct + EXTRAHH + 1);
-+
-+                      /* Set the separator character, if not specified. */
-+                      if (vsep == 'X') {
-+                              if (ch == 'c')
-+                                      vsep = '\0';
-+                              else
-+                                      vsep = ' ';
-+                      }
-+
-+                      /* Create the format specifier. */
-+                      for (i = j = 0; i < &fmt[-1] - pct; i++) {
-+                              switch (pct[i]) {
-+                              case ',': case ';': case ':': case '_':
-+                              case 'v': case 'h': case 'l':
-+                                      /* Ignore. */
-+                                      break;
-+                              case '*':
-+                                      if (pct[i - 1] != '.')
-+                                              vwidth = 1;
-+                                      else
-+                                              vprec = 1;
-+                                      /* FALLTHROUGH */
-+                              default:
-+                                      vfmt[j++] = pct[i];
-+                              }
-+                      }
-+              
-+                      /*
-+                       * Determine the number of elements in the vector and
-+                       * finish up the format specifier.
-+                       */
-+                      if (flags & SHORTINT) {
-+                              switch (ch) {
-+                              case 'c':
-+                                      vtype = V_SHORT;
-+                                      break;
-+                              case 'p':
-+                                      vtype = V_PSHORT;
-+                                      break;
-+                              default:
-+                                      vfmt[j++] = 'h';
-+                                      vtype = V_SHORT;
-+                                      break;
-+                              }
-+                              vcnt = 8;
-+                      } else if (flags & LONGINT) {
-+                              vcnt = 4;
-+                              vtype = (ch == 'p') ? V_PINT : V_INT;
-+#ifdef V64TYPE
-+                      } else if (flags & LLONGINT) {
-+                              switch (ch) {
-+                              case 'a':
-+                              case 'A':
-+                              case 'e':
-+                              case 'E':
-+                              case 'f':
-+                              case 'g':
-+                              case 'G':
-+                                      vcnt = 2;
-+                                      vtype = V_DOUBLE;
-+                                      break;
-+                              case 'd':
-+                              case 'i':
-+                              case 'u':
-+                              case 'o':
-+                              case 'p':
-+                              case 'x':
-+                              case 'X':
-+                                      vfmt[j++] = 'l';
-+                                      vfmt[j++] = 'l';
-+                                      vcnt = 2;
-+                                      vtype = (ch == 'p') ? V_PLONGLONG : V_LONGLONG;
-+                                      break;
-+                              default:
-+                                      /*
-+                                       * The default case should never
-+                                       * happen.
-+                                       */
-+                              case 'c':
-+                                      vcnt = 16;
-+                                      vtype = V_CHAR;
-+                              }
-+#endif /* V64TYPE */
-+                      } else {
-+                              switch (ch) {
-+                              case 'a':
-+                              case 'A':
-+                              case 'e':
-+                              case 'E':
-+                              case 'f':
-+                              case 'g':
-+                              case 'G':
-+                                      vcnt = 4;
-+                                      vtype = V_FLOAT;
-+                                      break;
-+                              default:
-+                                      /*
-+                                       * The default case should never
-+                                       * happen.
-+                                       */
-+                              case 'd':
-+                              case 'i':
-+                              case 'u':
-+                              case 'o':
-+                              case 'x':
-+                              case 'X':
-+                                      vfmt[j++] = 'h';
-+                                      vfmt[j++] = 'h';
-+                                      /* drop through */
-+                              case 'p':
-+                              case 'c':
-+                                      vcnt = 16;
-+                                      vtype = (ch == 'p') ? V_PCHAR : V_CHAR;
-+                              }
-+                      }
-+                      vfmt[j++] = ch;
-+                      vfmt[j++] = '\0';
-+
-+/* Get a vector element. */
-+#ifdef V64TYPE
-+#define VPRINT(type, ind, args...) do {                                       \
-+      switch (type) {                                                 \
-+      case V_CHAR:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_PCHAR:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_SHORT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_PSHORT:                                                  \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_INT:                                                     \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_PINT:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_LONGLONG:                                                \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vulonglongarg[ind]); \
-+              break;                                                  \
-+      case V_PLONGLONG:                                               \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vulonglongarg[ind]); \
-+              break;                                                  \
-+      case V_FLOAT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-+              break;                                                  \
-+      case V_DOUBLE:                                                  \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vdoublearg[ind]); \
-+              break;                                                  \
-+      }                                                               \
-+      ret += vlen;                                                    \
-+      PRINT(vstr, vlen);                                              \
-+      FLUSH();                                                        \
-+      free(vstr);                                                     \
-+} while (0)
-+#else /* !V64TYPE */
-+#define VPRINT(type, ind, args...) do {                                       \
-+      switch (type) {                                                 \
-+      case V_CHAR:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_PCHAR:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_SHORT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_PSHORT:                                                  \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_INT:                                                     \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_PINT:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_FLOAT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-+              break;                                                  \
-+      }                                                               \
-+      ret += vlen;                                                    \
-+      PRINT(vstr, vlen);                                              \
-+      FLUSH();                                                        \
-+      free(vstr);                                                     \
-+} while (0)
-+#endif /* V64TYPE */
-+
-+                      /* Actually print. */
-+                      if (vwidth == 0) {
-+                              if (vprec == 0) {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i);
-+                                      }
-+                              } else {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0, prec);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i, prec);
-+                                      }
-+                              }
-+                      } else {
-+                              if (vprec == 0) {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0, width);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i, width);
-+                                      }
-+                              } else {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0, width, prec);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i, width, prec);
-+                                      }
-+                              }
-+                      }
-+#undef VPRINT
-+
-+                      if (vfmt != vfmt_buf)
-+                              free(vfmt);
-+
-+                      continue;
-+              }
-+#endif /* VECTORS */
-               /*
-                * All reasonable formats wind up here.  At this point, `cp'
-                * points to a string which (if not flags&LADJUST) should be
-@@ -950,7 +1347,7 @@ number:                   if ((dprec = prec) >= 0)
-                       /* leading zeroes from decimal precision */
-                       PAD(dprec - size, zeroes);
-                       if (gs.grouping) {
--                              if (grouping_print(&gs, &io, cp, buf+BUF) < 0)
-+                              if (grouping_print(&gs, &io, cp, buf+BUF, loc) < 0)
-                                       goto error;
-                       } else {
-                               PRINT(cp, size);
-@@ -968,7 +1365,7 @@ number:                   if ((dprec = prec) >= 0)
-                               } else {
-                                       if (gs.grouping) {
-                                               n = grouping_print(&gs, &io,
--                                                  cp, dtoaend);
-+                                                  cp, dtoaend, loc);
-                                               if (n < 0)
-                                                       goto error;
-                                               cp += n;
index 69b7297ca9bb56e564c885db157b9b6d2733b93f..a3f9f3e871a4e0eab9ba7d1e235fc2bf8d6884c4 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.43 2009/01/19 06:19:51 das Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <ctype.h>
 #include <inttypes.h>
@@ -46,6 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.43 2009/01/19 06:19:51 das
 #include <string.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <pthread.h>
 #include "un-namespace.h"
 
 #include "collate.h"
@@ -93,9 +96,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.43 2009/01/19 06:19:51 das
 #define        CT_INT          3       /* %[dioupxX] conversion */
 #define        CT_FLOAT        4       /* %[efgEFG] conversion */
 
-static const u_char *__sccl(char *, const u_char *);
+static const u_char *__sccl(char *, const u_char *, locale_t);
 #ifndef NO_FLOATING_POINT
-static int parsefloat(FILE *, char *, char *);
+static int parsefloat(FILE *, char **, size_t, locale_t);
 #endif
 
 __weak_reference(__vfscanf, vfscanf);
@@ -104,12 +107,24 @@ __weak_reference(__vfscanf, vfscanf);
  * __vfscanf - MT-safe version
  */
 int
-__vfscanf(FILE *fp, char const *fmt0, va_list ap)
+__vfscanf(FILE * __restrict fp, char const * __restrict fmt0, va_list ap)
 {
        int ret;
 
        FLOCKFILE(fp);
-       ret = __svfscanf(fp, fmt0, ap);
+       ret = __svfscanf_l(fp, __current_locale(), fmt0, ap);
+       FUNLOCKFILE(fp);
+       return (ret);
+}
+
+int
+vfscanf_l(FILE * __restrict fp, locale_t loc, char const * __restrict fmt0, va_list ap)
+{
+       int ret;
+
+       NORMALIZE_LOCALE(loc);
+       FLOCKFILE(fp);
+       ret = __svfscanf_l(fp, loc, fmt0, ap);
        FUNLOCKFILE(fp);
        return (ret);
 }
@@ -117,8 +132,8 @@ __vfscanf(FILE *fp, char const *fmt0, va_list ap)
 /*
  * __svfscanf - non-MT-safe version of __vfscanf
  */
-int
-__svfscanf(FILE *fp, const char *fmt0, va_list ap)
+__private_extern__ int
+__svfscanf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt0, va_list ap)
 {
        const u_char *fmt = (const u_char *)fmt0;
        int c;                  /* character from format, or conversion */
@@ -128,36 +143,43 @@ __svfscanf(FILE *fp, const char *fmt0, va_list ap)
        int flags;              /* flags as defined above */
        char *p0;               /* saves original value of p when necessary */
        int nassigned;          /* number of fields assigned */
-       int nconversions;       /* number of conversions */
        int nread;              /* number of characters consumed from fp */
        int base;               /* base argument to conversion function */
        char ccltab[256];       /* character class table for %[...] */
        char buf[BUF];          /* buffer for numeric and mb conversions */
        wchar_t *wcp;           /* handy wide character pointer */
        size_t nconv;           /* length of multibyte sequence converted */
+       int index;              /* %index$, zero if unset */
+       va_list ap_orig;        /* to reset ap to first argument */
        static const mbstate_t initial;
        mbstate_t mbs;
+       int mb_cur_max;
 
        /* `basefix' is used to avoid `if' tests in the integer scanner */
        static short basefix[17] =
                { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
 
+       NORMALIZE_LOCALE(loc);
+       mb_cur_max = MB_CUR_MAX_L(loc);
        ORIENT(fp, -1);
 
        nassigned = 0;
-       nconversions = 0;
        nread = 0;
+       va_copy(ap_orig, ap);
        for (;;) {
                c = *fmt++;
                if (c == 0)
                        return (nassigned);
-               if (isspace(c)) {
-                       while ((fp->_r > 0 || __srefill(fp) == 0) && isspace(*fp->_p))
+               if (isspace_l(c, loc)) {
+                       while ((fp->_r > 0 || __srefill(fp) == 0) && isspace_l(*fp->_p, loc))
                                nread++, fp->_r--, fp->_p++;
                        continue;
                }
-               if (c != '%')
+               if (c != '%') {
+                       if (fp->_r <= 0 && __srefill(fp))
+                               goto input_failure;
                        goto literal;
+               }
                width = 0;
                flags = 0;
                /*
@@ -167,15 +189,35 @@ __svfscanf(FILE *fp, const char *fmt0, va_list ap)
 again:         c = *fmt++;
                switch (c) {
                case '%':
+                       /* Consume leading white space */
+                       for(;;) {
+                               if (fp->_r <= 0 && __srefill(fp))
+                                       goto input_failure;
+                               if (!isspace_l(*fp->_p, loc))
+                                       break;
+                               nread++;
+                               fp->_r--;
+                               fp->_p++;
+                       }
 literal:
-                       if (fp->_r <= 0 && __srefill(fp))
-                               goto input_failure;
                        if (*fp->_p != c)
                                goto match_failure;
                        fp->_r--, fp->_p++;
                        nread++;
                        continue;
 
+               case '$':
+                       index = width;
+                       if (index < 1 || index > NL_ARGMAX || fmt[-3] != '%') {
+                               goto input_failure;
+                       }
+                       width = 0;
+                       va_end(ap);
+                       va_copy(ap, ap_orig); /* reset to %1$ */
+                       for (; index > 1; index--) {
+                               va_arg(ap, void*);
+                       }
+                       goto again;
                case '*':
                        flags |= SUPPRESS;
                        goto again;
@@ -262,7 +304,7 @@ literal:
                        break;
 
                case '[':
-                       fmt = __sccl(ccltab, fmt);
+                       fmt = __sccl(ccltab, fmt, loc);
                        flags |= NOSKIP;
                        c = CT_CCL;
                        break;
@@ -283,27 +325,28 @@ literal:
                        break;
 
                case 'n':
-                       nconversions++;
-                       if (flags & SUPPRESS)   /* ??? */
+               {
+                       void *ptr = va_arg(ap, void *);
+                       if ((ptr == NULL) || (flags & SUPPRESS))        /* ??? */
                                continue;
-                       if (flags & SHORTSHORT)
-                               *va_arg(ap, char *) = nread;
+                       else if (flags & SHORTSHORT)
+                               *(char *)ptr = nread;
                        else if (flags & SHORT)
-                               *va_arg(ap, short *) = nread;
+                               *(short *)ptr = nread;
                        else if (flags & LONG)
-                               *va_arg(ap, long *) = nread;
+                               *(long *)ptr = nread;
                        else if (flags & LONGLONG)
-                               *va_arg(ap, long long *) = nread;
+                               *(long long *)ptr = nread;
                        else if (flags & INTMAXT)
-                               *va_arg(ap, intmax_t *) = nread;
+                               *(intmax_t *)ptr = nread;
                        else if (flags & SIZET)
-                               *va_arg(ap, size_t *) = nread;
+                               *(size_t *)ptr = nread;
                        else if (flags & PTRDIFFT)
-                               *va_arg(ap, ptrdiff_t *) = nread;
+                               *(ptrdiff_t *)ptr = nread;
                        else
-                               *va_arg(ap, int *) = nread;
+                               *(int *)ptr = nread;
                        continue;
-
+               }
                default:
                        goto match_failure;
 
@@ -325,7 +368,7 @@ literal:
                 * that suppress this.
                 */
                if ((flags & NOSKIP) == 0) {
-                       while (isspace(*fp->_p)) {
+                       while (isspace_l(*fp->_p, loc)) {
                                nread++;
                                if (--fp->_r > 0)
                                        fp->_p++;
@@ -355,7 +398,7 @@ literal:
                                        wcp = NULL;
                                n = 0;
                                while (width != 0) {
-                                       if (n == MB_CUR_MAX) {
+                                       if (n == mb_cur_max) {
                                                fp->_flags |= __SERR;
                                                goto input_failure;
                                        }
@@ -363,7 +406,7 @@ literal:
                                        fp->_p++;
                                        fp->_r--;
                                        mbs = initial;
-                                       nconv = mbrtowc(wcp, buf, n, &mbs);
+                                       nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
                                        if (nconv == (size_t)-1) {
                                                fp->_flags |= __SERR;
                                                goto input_failure;
@@ -416,7 +459,6 @@ literal:
                                nread += r;
                                nassigned++;
                        }
-                       nconversions++;
                        break;
 
                case CT_CCL:
@@ -435,7 +477,7 @@ literal:
                                n = 0;
                                nchars = 0;
                                while (width != 0) {
-                                       if (n == MB_CUR_MAX) {
+                                       if (n == mb_cur_max) {
                                                fp->_flags |= __SERR;
                                                goto input_failure;
                                        }
@@ -443,7 +485,7 @@ literal:
                                        fp->_p++;
                                        fp->_r--;
                                        mbs = initial;
-                                       nconv = mbrtowc(wcp, buf, n, &mbs);
+                                       nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
                                        if (nconv == (size_t)-1) {
                                                fp->_flags |= __SERR;
                                                goto input_failure;
@@ -451,8 +493,8 @@ literal:
                                        if (nconv == 0)
                                                *wcp = L'\0';
                                        if (nconv != (size_t)-2) {
-                                               if (wctob(*wcp) != EOF &&
-                                                   !ccltab[wctob(*wcp)]) {
+                                               if (wctob_l(*wcp, loc) != EOF &&
+                                                   !ccltab[wctob_l(*wcp, loc)]) {
                                                        while (n != 0) {
                                                                n--;
                                                                __ungetc(buf[n],
@@ -520,7 +562,6 @@ literal:
                                nassigned++;
                        }
                        nread += n;
-                       nconversions++;
                        break;
 
                case CT_STRING:
@@ -535,8 +576,8 @@ literal:
                                else
                                        wcp = &twc;
                                n = 0;
-                               while (!isspace(*fp->_p) && width != 0) {
-                                       if (n == MB_CUR_MAX) {
+                               while (width != 0) {
+                                       if (n == mb_cur_max) {
                                                fp->_flags |= __SERR;
                                                goto input_failure;
                                        }
@@ -544,7 +585,7 @@ literal:
                                        fp->_p++;
                                        fp->_r--;
                                        mbs = initial;
-                                       nconv = mbrtowc(wcp, buf, n, &mbs);
+                                       nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
                                        if (nconv == (size_t)-1) {
                                                fp->_flags |= __SERR;
                                                goto input_failure;
@@ -552,7 +593,7 @@ literal:
                                        if (nconv == 0)
                                                *wcp = L'\0';
                                        if (nconv != (size_t)-2) {
-                                               if (iswspace(*wcp)) {
+                                               if (iswspace_l(*wcp, loc)) {
                                                        while (n != 0) {
                                                                n--;
                                                                __ungetc(buf[n],
@@ -580,7 +621,7 @@ literal:
                                }
                        } else if (flags & SUPPRESS) {
                                n = 0;
-                               while (!isspace(*fp->_p)) {
+                               while (!isspace_l(*fp->_p, loc)) {
                                        n++, fp->_r--, fp->_p++;
                                        if (--width == 0)
                                                break;
@@ -590,7 +631,7 @@ literal:
                                nread += n;
                        } else {
                                p0 = p = va_arg(ap, char *);
-                               while (!isspace(*fp->_p)) {
+                               while (!isspace_l(*fp->_p, loc)) {
                                        fp->_r--;
                                        *p++ = *fp->_p++;
                                        if (--width == 0)
@@ -602,7 +643,6 @@ literal:
                                nread += p - p0;
                                nassigned++;
                        }
-                       nconversions++;
                        continue;
 
                case CT_INT:
@@ -733,9 +773,9 @@ literal:
 
                                *p = 0;
                                if ((flags & UNSIGNED) == 0)
-                                   res = strtoimax(buf, (char **)NULL, base);
+                                   res = strtoimax_l(buf, (char **)NULL, base, loc);
                                else
-                                   res = strtoumax(buf, (char **)NULL, base);
+                                   res = strtoumax_l(buf, (char **)NULL, base, loc);
                                if (flags & POINTER)
                                        *va_arg(ap, void **) =
                                                        (void *)(uintptr_t)res;
@@ -758,41 +798,46 @@ literal:
                                nassigned++;
                        }
                        nread += p - buf;
-                       nconversions++;
                        break;
 
 #ifndef NO_FLOATING_POINT
                case CT_FLOAT:
+               {
+                       char *pbuf;
                        /* scan a floating point number as if by strtod */
-                       if (width == 0 || width > sizeof(buf) - 1)
-                               width = sizeof(buf) - 1;
-                       if ((width = parsefloat(fp, buf, buf + width)) == 0)
+                       if ((width = parsefloat(fp, &pbuf, width, loc)) == 0)
                                goto match_failure;
                        if ((flags & SUPPRESS) == 0) {
                                if (flags & LONGDBL) {
-                                       long double res = strtold(buf, &p);
+                                       long double res = strtold_l(pbuf, &p, loc);
                                        *va_arg(ap, long double *) = res;
                                } else if (flags & LONG) {
-                                       double res = strtod(buf, &p);
+                                       double res = strtod_l(pbuf, &p, loc);
                                        *va_arg(ap, double *) = res;
                                } else {
-                                       float res = strtof(buf, &p);
+                                       float res = strtof_l(pbuf, &p, loc);
                                        *va_arg(ap, float *) = res;
                                }
                                nassigned++;
                        }
                        nread += width;
-                       nconversions++;
                        break;
+               }
 #endif /* !NO_FLOATING_POINT */
                }
        }
 input_failure:
-       return (nconversions != 0 ? nassigned : EOF);
+       return (nassigned ? nassigned : EOF);
 match_failure:
        return (nassigned);
 }
 
+int
+__svfscanf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
+{
+       return __svfscanf_l(fp, __current_locale(), fmt0, ap);
+}
+
 /*
  * Fill in the given table from the scanset at the given format
  * (just after `[').  Return a pointer to the character past the
@@ -800,9 +845,10 @@ match_failure:
  * considered part of the scanset.
  */
 static const u_char *
-__sccl(tab, fmt)
+__sccl(tab, fmt, loc)
        char *tab;
        const u_char *fmt;
+       locale_t loc;
 {
        int c, n, v, i;
 
@@ -838,6 +884,7 @@ doswitch:
                        return (fmt - 1);
 
                case '-':
+               {
                        /*
                         * A scanset of the form
                         *      [01+-]
@@ -858,8 +905,8 @@ doswitch:
                         */
                        n = *fmt;
                        if (n == ']'
-                           || (__collate_load_error ? n < c :
-                               __collate_range_cmp (n, c) < 0
+                           || (loc->__collate_load_error ? n < c :
+                               __collate_range_cmp (n, c, loc) < 0
                               )
                           ) {
                                c = '-';
@@ -867,14 +914,14 @@ doswitch:
                        }
                        fmt++;
                        /* fill in the range */
-                       if (__collate_load_error) {
+                       if (loc->__collate_load_error) {
                                do {
                                        tab[++c] = v;
                                } while (c < n);
                        } else {
                                for (i = 0; i < 256; i ++)
-                                       if (   __collate_range_cmp (c, i) < 0
-                                           && __collate_range_cmp (i, n) <= 0
+                                       if (   __collate_range_cmp (c, i, loc) < 0
+                                           && __collate_range_cmp (i, n, loc) <= 0
                                           )
                                                tab[i] = v;
                        }
@@ -894,7 +941,7 @@ doswitch:
                                return (fmt);
 #endif
                        break;
-
+               }
                case ']':               /* end of scanset */
                        return (fmt);
 
@@ -907,8 +954,54 @@ doswitch:
 }
 
 #ifndef NO_FLOATING_POINT
+/*
+ * Maintain a per-thread parsefloat buffer, shared by __svfscanf_l and
+ * __vfwscanf.
+ */
+#ifdef BUILDING_VARIANT
+extern char *__parsefloat_buf(size_t s);
+#else /* !BUILDING_VARIANT */
+__private_extern__ char *
+__parsefloat_buf(size_t s)
+{
+       char *b;
+       static pthread_key_t    parsefloat_tsd_key = (pthread_key_t)-1;
+       static pthread_mutex_t  parsefloat_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
+       static size_t bsiz = 0;
+
+       if (parsefloat_tsd_key == (pthread_key_t)-1) {
+               pthread_mutex_lock(&parsefloat_tsd_lock);
+               if (parsefloat_tsd_key == (pthread_key_t)-1) {
+                       parsefloat_tsd_key = __LIBC_PTHREAD_KEY_PARSEFLOAT;
+                       pthread_key_init_np(parsefloat_tsd_key, free);
+               }
+               pthread_mutex_unlock(&parsefloat_tsd_lock);
+       }
+       if ((b = (char *)pthread_getspecific(parsefloat_tsd_key)) == NULL) {
+               bsiz = s > BUF ? s : BUF;
+               b = (char *)malloc(bsiz);
+               if (b == NULL) {
+                       bsiz = 0;
+                       return NULL;
+               }
+               pthread_setspecific(parsefloat_tsd_key, b);
+               return b;
+       }
+       if (s > bsiz) {
+               b = (char *)reallocf(b, s);
+               pthread_setspecific(parsefloat_tsd_key, b);
+               if (b == NULL) {
+                       bsiz = 0;
+                       return NULL;
+               }
+               bsiz = s;
+       }
+       return b;
+}
+#endif /* BUILDING_VARIANT */
+
 static int
-parsefloat(FILE *fp, char *buf, char *end)
+parsefloat(FILE *fp, char **buf, size_t width, locale_t loc)
 {
        char *commit, *p;
        int infnanpos = 0, decptpos = 0;
@@ -917,9 +1010,18 @@ parsefloat(FILE *fp, char *buf, char *end)
                S_DIGITS, S_DECPT, S_FRAC, S_EXP, S_EXPDIGITS
        } state = S_START;
        unsigned char c;
-       const char *decpt = localeconv()->decimal_point;
+       const char *decpt = localeconv_l(loc)->decimal_point;
        _Bool gotmantdig = 0, ishex = 0;
+       char *b;
+       char *e;
+       size_t s;
 
+       s = (width == 0 ? BUF : (width + 1));
+       if ((b = __parsefloat_buf(s)) == NULL) {
+               *buf = NULL;
+               return 0;
+       }
+       e = b + (s - 1);
        /*
         * We set commit = p whenever the string we have read so far
         * constitutes a valid representation of a floating point
@@ -929,8 +1031,8 @@ parsefloat(FILE *fp, char *buf, char *end)
         * always necessary to read at least one character that doesn't
         * match; thus, we can't short-circuit "infinity" or "nan(...)".
         */
-       commit = buf - 1;
-       for (p = buf; p < end; ) {
+       commit = b - 1;
+       for (p = b; width == 0 || p < e; ) {
                c = *fp->_p;
 reswitch:
                switch (state) {
@@ -988,7 +1090,7 @@ reswitch:
                                if (c == ')') {
                                        commit = p;
                                        state = S_DONE;
-                               } else if (!isalnum(c) && c != '_')
+                               } else if (!isalnum_l(c, loc) && c != '_')
                                        goto parsedone;
                                break;
                        }
@@ -1006,7 +1108,7 @@ reswitch:
                                goto reswitch;
                        }
                case S_DIGITS:
-                       if ((ishex && isxdigit(c)) || isdigit(c)) {
+                       if ((ishex && isxdigit_l(c, loc)) || isdigit_l(c, loc)) {
                                gotmantdig = 1;
                                commit = p;
                                break;
@@ -1041,7 +1143,7 @@ reswitch:
                                        goto parsedone;
                                else
                                        state = S_EXP;
-                       } else if ((ishex && isxdigit(c)) || isdigit(c)) {
+                       } else if ((ishex && isxdigit_l(c, loc)) || isdigit_l(c, loc)) {
                                commit = p;
                                gotmantdig = 1;
                        } else
@@ -1054,13 +1156,26 @@ reswitch:
                        else
                                goto reswitch;
                case S_EXPDIGITS:
-                       if (isdigit(c))
+                       if (isdigit_l(c, loc))
                                commit = p;
                        else
                                goto parsedone;
                        break;
                default:
-                       abort();
+                       LIBC_ABORT("unknown state %d", state);
+               }
+               if (p >= e) {
+                       ssize_t diff = (p - b);
+                       ssize_t com = (commit - b);
+                       s += BUF;
+                       b = __parsefloat_buf(s);
+                       if (b == NULL) {
+                               *buf = NULL;
+                               return 0;
+                       }
+                       e = b + (s - 1);
+                       p = b + diff;
+                       commit = b + com;
                }
                *p++ = c;
                if (--fp->_r > 0)
@@ -1073,6 +1188,7 @@ parsedone:
        while (commit < --p)
                __ungetc(*(u_char *)p, fp);
        *++commit = '\0';
-       return (commit - buf);
+       *buf = b;
+       return (commit - b);
 }
 #endif
diff --git a/stdio/FreeBSD/vfscanf.c.patch b/stdio/FreeBSD/vfscanf.c.patch
deleted file mode 100644 (file)
index 4dd84b8..0000000
+++ /dev/null
@@ -1,612 +0,0 @@
---- vfscanf.c.orig     2010-07-15 10:03:36.000000000 -0700
-+++ vfscanf.c  2010-07-15 10:18:58.000000000 -0700
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vfscanf.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.43 2009/01/19 06:19:51 das Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <ctype.h>
- #include <inttypes.h>
-@@ -46,6 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include <string.h>
- #include <wchar.h>
- #include <wctype.h>
-+#include <pthread.h>
- #include "un-namespace.h"
- #include "collate.h"
-@@ -93,9 +96,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #define       CT_INT          3       /* %[dioupxX] conversion */
- #define       CT_FLOAT        4       /* %[efgEFG] conversion */
--static const u_char *__sccl(char *, const u_char *);
-+static const u_char *__sccl(char *, const u_char *, locale_t);
- #ifndef NO_FLOATING_POINT
--static int parsefloat(FILE *, char *, char *);
-+static int parsefloat(FILE *, char **, size_t, locale_t);
- #endif
- __weak_reference(__vfscanf, vfscanf);
-@@ -104,12 +107,24 @@ __weak_reference(__vfscanf, vfscanf);
-  * __vfscanf - MT-safe version
-  */
- int
--__vfscanf(FILE *fp, char const *fmt0, va_list ap)
-+__vfscanf(FILE * __restrict fp, char const * __restrict fmt0, va_list ap)
- {
-       int ret;
-       FLOCKFILE(fp);
--      ret = __svfscanf(fp, fmt0, ap);
-+      ret = __svfscanf_l(fp, __current_locale(), fmt0, ap);
-+      FUNLOCKFILE(fp);
-+      return (ret);
-+}
-+
-+int
-+vfscanf_l(FILE * __restrict fp, locale_t loc, char const * __restrict fmt0, va_list ap)
-+{
-+      int ret;
-+
-+      NORMALIZE_LOCALE(loc);
-+      FLOCKFILE(fp);
-+      ret = __svfscanf_l(fp, loc, fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
- }
-@@ -117,8 +132,8 @@ __vfscanf(FILE *fp, char const *fmt0, va
- /*
-  * __svfscanf - non-MT-safe version of __vfscanf
-  */
--int
--__svfscanf(FILE *fp, const char *fmt0, va_list ap)
-+__private_extern__ int
-+__svfscanf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt0, va_list ap)
- {
-       const u_char *fmt = (const u_char *)fmt0;
-       int c;                  /* character from format, or conversion */
-@@ -128,36 +143,43 @@ __svfscanf(FILE *fp, const char *fmt0, v
-       int flags;              /* flags as defined above */
-       char *p0;               /* saves original value of p when necessary */
-       int nassigned;          /* number of fields assigned */
--      int nconversions;       /* number of conversions */
-       int nread;              /* number of characters consumed from fp */
-       int base;               /* base argument to conversion function */
-       char ccltab[256];       /* character class table for %[...] */
-       char buf[BUF];          /* buffer for numeric and mb conversions */
-       wchar_t *wcp;           /* handy wide character pointer */
-       size_t nconv;           /* length of multibyte sequence converted */
-+      int index;              /* %index$, zero if unset */
-+      va_list ap_orig;        /* to reset ap to first argument */
-       static const mbstate_t initial;
-       mbstate_t mbs;
-+      int mb_cur_max;
-       /* `basefix' is used to avoid `if' tests in the integer scanner */
-       static short basefix[17] =
-               { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-+      NORMALIZE_LOCALE(loc);
-+      mb_cur_max = MB_CUR_MAX_L(loc);
-       ORIENT(fp, -1);
-       nassigned = 0;
--      nconversions = 0;
-       nread = 0;
-+      va_copy(ap_orig, ap);
-       for (;;) {
-               c = *fmt++;
-               if (c == 0)
-                       return (nassigned);
--              if (isspace(c)) {
--                      while ((fp->_r > 0 || __srefill(fp) == 0) && isspace(*fp->_p))
-+              if (isspace_l(c, loc)) {
-+                      while ((fp->_r > 0 || __srefill(fp) == 0) && isspace_l(*fp->_p, loc))
-                               nread++, fp->_r--, fp->_p++;
-                       continue;
-               }
--              if (c != '%')
-+              if (c != '%') {
-+                      if (fp->_r <= 0 && __srefill(fp))
-+                              goto input_failure;
-                       goto literal;
-+              }
-               width = 0;
-               flags = 0;
-               /*
-@@ -167,15 +189,35 @@ __svfscanf(FILE *fp, const char *fmt0, v
- again:                c = *fmt++;
-               switch (c) {
-               case '%':
-+                      /* Consume leading white space */
-+                      for(;;) {
-+                              if (fp->_r <= 0 && __srefill(fp))
-+                                      goto input_failure;
-+                              if (!isspace_l(*fp->_p, loc))
-+                                      break;
-+                              nread++;
-+                              fp->_r--;
-+                              fp->_p++;
-+                      }
- literal:
--                      if (fp->_r <= 0 && __srefill(fp))
--                              goto input_failure;
-                       if (*fp->_p != c)
-                               goto match_failure;
-                       fp->_r--, fp->_p++;
-                       nread++;
-                       continue;
-+              case '$':
-+                      index = width;
-+                      if (index < 1 || index > NL_ARGMAX || fmt[-3] != '%') {
-+                              goto input_failure;
-+                      }
-+                      width = 0;
-+                      va_end(ap);
-+                      va_copy(ap, ap_orig); /* reset to %1$ */
-+                      for (; index > 1; index--) {
-+                              va_arg(ap, void*);
-+                      }
-+                      goto again;
-               case '*':
-                       flags |= SUPPRESS;
-                       goto again;
-@@ -262,7 +304,7 @@ literal:
-                       break;
-               case '[':
--                      fmt = __sccl(ccltab, fmt);
-+                      fmt = __sccl(ccltab, fmt, loc);
-                       flags |= NOSKIP;
-                       c = CT_CCL;
-                       break;
-@@ -283,27 +325,28 @@ literal:
-                       break;
-               case 'n':
--                      nconversions++;
--                      if (flags & SUPPRESS)   /* ??? */
-+              {
-+                      void *ptr = va_arg(ap, void *);
-+                      if ((ptr == NULL) || (flags & SUPPRESS))        /* ??? */
-                               continue;
--                      if (flags & SHORTSHORT)
--                              *va_arg(ap, char *) = nread;
-+                      else if (flags & SHORTSHORT)
-+                              *(char *)ptr = nread;
-                       else if (flags & SHORT)
--                              *va_arg(ap, short *) = nread;
-+                              *(short *)ptr = nread;
-                       else if (flags & LONG)
--                              *va_arg(ap, long *) = nread;
-+                              *(long *)ptr = nread;
-                       else if (flags & LONGLONG)
--                              *va_arg(ap, long long *) = nread;
-+                              *(long long *)ptr = nread;
-                       else if (flags & INTMAXT)
--                              *va_arg(ap, intmax_t *) = nread;
-+                              *(intmax_t *)ptr = nread;
-                       else if (flags & SIZET)
--                              *va_arg(ap, size_t *) = nread;
-+                              *(size_t *)ptr = nread;
-                       else if (flags & PTRDIFFT)
--                              *va_arg(ap, ptrdiff_t *) = nread;
-+                              *(ptrdiff_t *)ptr = nread;
-                       else
--                              *va_arg(ap, int *) = nread;
-+                              *(int *)ptr = nread;
-                       continue;
--
-+              }
-               default:
-                       goto match_failure;
-@@ -325,7 +368,7 @@ literal:
-                * that suppress this.
-                */
-               if ((flags & NOSKIP) == 0) {
--                      while (isspace(*fp->_p)) {
-+                      while (isspace_l(*fp->_p, loc)) {
-                               nread++;
-                               if (--fp->_r > 0)
-                                       fp->_p++;
-@@ -355,7 +398,7 @@ literal:
-                                       wcp = NULL;
-                               n = 0;
-                               while (width != 0) {
--                                      if (n == MB_CUR_MAX) {
-+                                      if (n == mb_cur_max) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-@@ -363,7 +406,7 @@ literal:
-                                       fp->_p++;
-                                       fp->_r--;
-                                       mbs = initial;
--                                      nconv = mbrtowc(wcp, buf, n, &mbs);
-+                                      nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
-                                       if (nconv == (size_t)-1) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-@@ -416,7 +459,6 @@ literal:
-                               nread += r;
-                               nassigned++;
-                       }
--                      nconversions++;
-                       break;
-               case CT_CCL:
-@@ -435,7 +477,7 @@ literal:
-                               n = 0;
-                               nchars = 0;
-                               while (width != 0) {
--                                      if (n == MB_CUR_MAX) {
-+                                      if (n == mb_cur_max) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-@@ -443,7 +485,7 @@ literal:
-                                       fp->_p++;
-                                       fp->_r--;
-                                       mbs = initial;
--                                      nconv = mbrtowc(wcp, buf, n, &mbs);
-+                                      nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
-                                       if (nconv == (size_t)-1) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-@@ -451,8 +493,8 @@ literal:
-                                       if (nconv == 0)
-                                               *wcp = L'\0';
-                                       if (nconv != (size_t)-2) {
--                                              if (wctob(*wcp) != EOF &&
--                                                  !ccltab[wctob(*wcp)]) {
-+                                              if (wctob_l(*wcp, loc) != EOF &&
-+                                                  !ccltab[wctob_l(*wcp, loc)]) {
-                                                       while (n != 0) {
-                                                               n--;
-                                                               __ungetc(buf[n],
-@@ -520,7 +562,6 @@ literal:
-                               nassigned++;
-                       }
-                       nread += n;
--                      nconversions++;
-                       break;
-               case CT_STRING:
-@@ -535,8 +576,8 @@ literal:
-                               else
-                                       wcp = &twc;
-                               n = 0;
--                              while (!isspace(*fp->_p) && width != 0) {
--                                      if (n == MB_CUR_MAX) {
-+                              while (width != 0) {
-+                                      if (n == mb_cur_max) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-@@ -544,7 +585,7 @@ literal:
-                                       fp->_p++;
-                                       fp->_r--;
-                                       mbs = initial;
--                                      nconv = mbrtowc(wcp, buf, n, &mbs);
-+                                      nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
-                                       if (nconv == (size_t)-1) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-@@ -552,7 +593,7 @@ literal:
-                                       if (nconv == 0)
-                                               *wcp = L'\0';
-                                       if (nconv != (size_t)-2) {
--                                              if (iswspace(*wcp)) {
-+                                              if (iswspace_l(*wcp, loc)) {
-                                                       while (n != 0) {
-                                                               n--;
-                                                               __ungetc(buf[n],
-@@ -580,7 +621,7 @@ literal:
-                               }
-                       } else if (flags & SUPPRESS) {
-                               n = 0;
--                              while (!isspace(*fp->_p)) {
-+                              while (!isspace_l(*fp->_p, loc)) {
-                                       n++, fp->_r--, fp->_p++;
-                                       if (--width == 0)
-                                               break;
-@@ -590,7 +631,7 @@ literal:
-                               nread += n;
-                       } else {
-                               p0 = p = va_arg(ap, char *);
--                              while (!isspace(*fp->_p)) {
-+                              while (!isspace_l(*fp->_p, loc)) {
-                                       fp->_r--;
-                                       *p++ = *fp->_p++;
-                                       if (--width == 0)
-@@ -602,7 +643,6 @@ literal:
-                               nread += p - p0;
-                               nassigned++;
-                       }
--                      nconversions++;
-                       continue;
-               case CT_INT:
-@@ -733,9 +773,9 @@ literal:
-                               *p = 0;
-                               if ((flags & UNSIGNED) == 0)
--                                  res = strtoimax(buf, (char **)NULL, base);
-+                                  res = strtoimax_l(buf, (char **)NULL, base, loc);
-                               else
--                                  res = strtoumax(buf, (char **)NULL, base);
-+                                  res = strtoumax_l(buf, (char **)NULL, base, loc);
-                               if (flags & POINTER)
-                                       *va_arg(ap, void **) =
-                                                       (void *)(uintptr_t)res;
-@@ -758,41 +798,46 @@ literal:
-                               nassigned++;
-                       }
-                       nread += p - buf;
--                      nconversions++;
-                       break;
- #ifndef NO_FLOATING_POINT
-               case CT_FLOAT:
-+              {
-+                      char *pbuf;
-                       /* scan a floating point number as if by strtod */
--                      if (width == 0 || width > sizeof(buf) - 1)
--                              width = sizeof(buf) - 1;
--                      if ((width = parsefloat(fp, buf, buf + width)) == 0)
-+                      if ((width = parsefloat(fp, &pbuf, width, loc)) == 0)
-                               goto match_failure;
-                       if ((flags & SUPPRESS) == 0) {
-                               if (flags & LONGDBL) {
--                                      long double res = strtold(buf, &p);
-+                                      long double res = strtold_l(pbuf, &p, loc);
-                                       *va_arg(ap, long double *) = res;
-                               } else if (flags & LONG) {
--                                      double res = strtod(buf, &p);
-+                                      double res = strtod_l(pbuf, &p, loc);
-                                       *va_arg(ap, double *) = res;
-                               } else {
--                                      float res = strtof(buf, &p);
-+                                      float res = strtof_l(pbuf, &p, loc);
-                                       *va_arg(ap, float *) = res;
-                               }
-                               nassigned++;
-                       }
-                       nread += width;
--                      nconversions++;
-                       break;
-+              }
- #endif /* !NO_FLOATING_POINT */
-               }
-       }
- input_failure:
--      return (nconversions != 0 ? nassigned : EOF);
-+      return (nassigned ? nassigned : EOF);
- match_failure:
-       return (nassigned);
- }
-+int
-+__svfscanf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
-+{
-+      return __svfscanf_l(fp, __current_locale(), fmt0, ap);
-+}
-+
- /*
-  * Fill in the given table from the scanset at the given format
-  * (just after `[').  Return a pointer to the character past the
-@@ -800,9 +845,10 @@ match_failure:
-  * considered part of the scanset.
-  */
- static const u_char *
--__sccl(tab, fmt)
-+__sccl(tab, fmt, loc)
-       char *tab;
-       const u_char *fmt;
-+      locale_t loc;
- {
-       int c, n, v, i;
-@@ -838,6 +884,7 @@ doswitch:
-                       return (fmt - 1);
-               case '-':
-+              {
-                       /*
-                        * A scanset of the form
-                        *      [01+-]
-@@ -858,8 +905,8 @@ doswitch:
-                        */
-                       n = *fmt;
-                       if (n == ']'
--                          || (__collate_load_error ? n < c :
--                              __collate_range_cmp (n, c) < 0
-+                          || (loc->__collate_load_error ? n < c :
-+                              __collate_range_cmp (n, c, loc) < 0
-                              )
-                          ) {
-                               c = '-';
-@@ -867,14 +914,14 @@ doswitch:
-                       }
-                       fmt++;
-                       /* fill in the range */
--                      if (__collate_load_error) {
-+                      if (loc->__collate_load_error) {
-                               do {
-                                       tab[++c] = v;
-                               } while (c < n);
-                       } else {
-                               for (i = 0; i < 256; i ++)
--                                      if (   __collate_range_cmp (c, i) < 0
--                                          && __collate_range_cmp (i, n) <= 0
-+                                      if (   __collate_range_cmp (c, i, loc) < 0
-+                                          && __collate_range_cmp (i, n, loc) <= 0
-                                          )
-                                               tab[i] = v;
-                       }
-@@ -894,7 +941,7 @@ doswitch:
-                               return (fmt);
- #endif
-                       break;
--
-+              }
-               case ']':               /* end of scanset */
-                       return (fmt);
-@@ -907,8 +954,54 @@ doswitch:
- }
- #ifndef NO_FLOATING_POINT
-+/*
-+ * Maintain a per-thread parsefloat buffer, shared by __svfscanf_l and
-+ * __vfwscanf.
-+ */
-+#ifdef BUILDING_VARIANT
-+extern char *__parsefloat_buf(size_t s);
-+#else /* !BUILDING_VARIANT */
-+__private_extern__ char *
-+__parsefloat_buf(size_t s)
-+{
-+      char *b;
-+      static pthread_key_t    parsefloat_tsd_key = (pthread_key_t)-1;
-+      static pthread_mutex_t  parsefloat_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
-+      static size_t bsiz = 0;
-+
-+      if (parsefloat_tsd_key == (pthread_key_t)-1) {
-+              pthread_mutex_lock(&parsefloat_tsd_lock);
-+              if (parsefloat_tsd_key == (pthread_key_t)-1) {
-+                      parsefloat_tsd_key = __LIBC_PTHREAD_KEY_PARSEFLOAT;
-+                      pthread_key_init_np(parsefloat_tsd_key, free);
-+              }
-+              pthread_mutex_unlock(&parsefloat_tsd_lock);
-+      }
-+      if ((b = (char *)pthread_getspecific(parsefloat_tsd_key)) == NULL) {
-+              bsiz = s > BUF ? s : BUF;
-+              b = (char *)malloc(bsiz);
-+              if (b == NULL) {
-+                      bsiz = 0;
-+                      return NULL;
-+              }
-+              pthread_setspecific(parsefloat_tsd_key, b);
-+              return b;
-+      }
-+      if (s > bsiz) {
-+              b = (char *)reallocf(b, s);
-+              pthread_setspecific(parsefloat_tsd_key, b);
-+              if (b == NULL) {
-+                      bsiz = 0;
-+                      return NULL;
-+              }
-+              bsiz = s;
-+      }
-+      return b;
-+}
-+#endif /* BUILDING_VARIANT */
-+
- static int
--parsefloat(FILE *fp, char *buf, char *end)
-+parsefloat(FILE *fp, char **buf, size_t width, locale_t loc)
- {
-       char *commit, *p;
-       int infnanpos = 0, decptpos = 0;
-@@ -917,9 +1010,18 @@ parsefloat(FILE *fp, char *buf, char *en
-               S_DIGITS, S_DECPT, S_FRAC, S_EXP, S_EXPDIGITS
-       } state = S_START;
-       unsigned char c;
--      const char *decpt = localeconv()->decimal_point;
-+      const char *decpt = localeconv_l(loc)->decimal_point;
-       _Bool gotmantdig = 0, ishex = 0;
--
-+      char *b;
-+      char *e;
-+      size_t s;
-+
-+      s = (width == 0 ? BUF : (width + 1));
-+      if ((b = __parsefloat_buf(s)) == NULL) {
-+              *buf = NULL;
-+              return 0;
-+      }
-+      e = b + (s - 1);
-       /*
-        * We set commit = p whenever the string we have read so far
-        * constitutes a valid representation of a floating point
-@@ -929,8 +1031,8 @@ parsefloat(FILE *fp, char *buf, char *en
-        * always necessary to read at least one character that doesn't
-        * match; thus, we can't short-circuit "infinity" or "nan(...)".
-        */
--      commit = buf - 1;
--      for (p = buf; p < end; ) {
-+      commit = b - 1;
-+      for (p = b; width == 0 || p < e; ) {
-               c = *fp->_p;
- reswitch:
-               switch (state) {
-@@ -988,7 +1090,7 @@ reswitch:
-                               if (c == ')') {
-                                       commit = p;
-                                       state = S_DONE;
--                              } else if (!isalnum(c) && c != '_')
-+                              } else if (!isalnum_l(c, loc) && c != '_')
-                                       goto parsedone;
-                               break;
-                       }
-@@ -1006,7 +1108,7 @@ reswitch:
-                               goto reswitch;
-                       }
-               case S_DIGITS:
--                      if ((ishex && isxdigit(c)) || isdigit(c)) {
-+                      if ((ishex && isxdigit_l(c, loc)) || isdigit_l(c, loc)) {
-                               gotmantdig = 1;
-                               commit = p;
-                               break;
-@@ -1041,7 +1143,7 @@ reswitch:
-                                       goto parsedone;
-                               else
-                                       state = S_EXP;
--                      } else if ((ishex && isxdigit(c)) || isdigit(c)) {
-+                      } else if ((ishex && isxdigit_l(c, loc)) || isdigit_l(c, loc)) {
-                               commit = p;
-                               gotmantdig = 1;
-                       } else
-@@ -1054,13 +1156,26 @@ reswitch:
-                       else
-                               goto reswitch;
-               case S_EXPDIGITS:
--                      if (isdigit(c))
-+                      if (isdigit_l(c, loc))
-                               commit = p;
-                       else
-                               goto parsedone;
-                       break;
-               default:
--                      abort();
-+                      LIBC_ABORT("unknown state %d", state);
-+              }
-+              if (p >= e) {
-+                      ssize_t diff = (p - b);
-+                      ssize_t com = (commit - b);
-+                      s += BUF;
-+                      b = __parsefloat_buf(s);
-+                      if (b == NULL) {
-+                              *buf = NULL;
-+                              return 0;
-+                      }
-+                      e = b + (s - 1);
-+                      p = b + diff;
-+                      commit = b + com;
-               }
-               *p++ = c;
-               if (--fp->_r > 0)
-@@ -1073,6 +1188,7 @@ parsedone:
-       while (commit < --p)
-               __ungetc(*(u_char *)p, fp);
-       *++commit = '\0';
--      return (commit - buf);
-+      *buf = b;
-+      return (commit - b);
- }
- #endif
index 5e1c059c0f106fece8ff817f20f9e5e1a58a3e46..31764a9110e116d0cdd1f0fe36a75adebeb410c7 100644 (file)
@@ -38,6 +38,8 @@ static char sccsid[] = "@(#)vfprintf.c        8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.42 2009/11/25 04:27:55 wollman Exp $");
 
+#include "xlocale_private.h"
+
 /*
  * Actual wprintf innards.
  *
@@ -59,6 +61,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.42 2009/11/25 04:27:55 wo
 #include <string.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <errno.h>
 #include "un-namespace.h"
 
 #include "libc_private.h"
@@ -66,10 +69,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.42 2009/11/25 04:27:55 wo
 #include "fvwrite.h"
 #include "printflocal.h"
 
-static int     __sprint(FILE *, struct __suio *);
-static int     __sbprintf(FILE *, const wchar_t *, va_list) __noinline;
-static wint_t  __xfputwc(wchar_t, FILE *);
-static wchar_t *__mbsconv(char *, int);
+static int     __sprint(FILE *, locale_t, struct __suio *);
+static int     __sbprintf(FILE *, locale_t, const wchar_t *, va_list);
+static wint_t  __xfputwc(wchar_t, FILE *, locale_t);
+static wchar_t *__mbsconv(char *, int, locale_t);
+__private_extern__ const char *__fix_nogrouping(const char *);
 
 #define        CHAR    wchar_t
 #include "printfcommon.h"
@@ -85,29 +89,29 @@ struct grouping_state {
 static const mbstate_t initial_mbs;
 
 static inline wchar_t
-get_decpt(void)
+get_decpt(locale_t loc)
 {
        mbstate_t mbs;
        wchar_t decpt;
        int nconv;
 
        mbs = initial_mbs;
-       nconv = mbrtowc(&decpt, localeconv()->decimal_point, MB_CUR_MAX, &mbs);
+       nconv = mbrtowc_l(&decpt, localeconv_l(loc)->decimal_point, MB_CUR_MAX_L(loc), &mbs, loc);
        if (nconv == (size_t)-1 || nconv == (size_t)-2)
                decpt = '.';    /* failsafe */
        return (decpt);
 }
 
 static inline wchar_t
-get_thousep(void)
+get_thousep(locale_t loc)
 {
        mbstate_t mbs;
        wchar_t thousep;
        int nconv;
 
        mbs = initial_mbs;
-       nconv = mbrtowc(&thousep, localeconv()->thousands_sep,
-           MB_CUR_MAX, &mbs);
+       nconv = mbrtowc_l(&thousep, localeconv_l(loc)->thousands_sep,
+           MB_CUR_MAX_L(loc), &mbs, loc);
        if (nconv == (size_t)-1 || nconv == (size_t)-2)
                thousep = '\0';    /* failsafe */
        return (thousep);
@@ -119,11 +123,11 @@ get_thousep(void)
  * of wide characters that will be printed.
  */
 static int
-grouping_init(struct grouping_state *gs, int ndigits)
+grouping_init(struct grouping_state *gs, int ndigits, locale_t loc)
 {
 
-       gs->grouping = localeconv()->grouping;
-       gs->thousands_sep = get_thousep();
+       gs->grouping = __fix_nogrouping(localeconv_l(loc)->grouping);
+       gs->thousands_sep = get_thousep(loc);
 
        gs->nseps = gs->nrepeats = 0;
        gs->lead = ndigits;
@@ -145,11 +149,11 @@ grouping_init(struct grouping_state *gs, int ndigits)
  */
 static int
 grouping_print(struct grouping_state *gs, struct io_state *iop,
-              const CHAR *cp, const CHAR *ep)
+              const CHAR *cp, const CHAR *ep, locale_t loc)
 {
        const CHAR *cp0 = cp;
 
-       if (io_printandpad(iop, cp, ep, gs->lead, zeroes))
+       if (io_printandpad(iop, cp, ep, gs->lead, zeroes, loc))
                return (-1);
        cp += gs->lead;
        while (gs->nseps > 0 || gs->nrepeats > 0) {
@@ -159,9 +163,9 @@ grouping_print(struct grouping_state *gs, struct io_state *iop,
                        gs->grouping--;
                        gs->nseps--;
                }
-               if (io_print(iop, &gs->thousands_sep, 1))
+               if (io_print(iop, &gs->thousands_sep, 1, loc))
                        return (-1);
-               if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes))
+               if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, loc))
                        return (-1);
                cp += *gs->grouping;
        }
@@ -180,7 +184,7 @@ grouping_print(struct grouping_state *gs, struct io_state *iop,
  * string eclipses the benefits of buffering.
  */
 static int
-__sprint(FILE *fp, struct __suio *uio)
+__sprint(FILE *fp, locale_t loc, struct __suio *uio)
 {
        struct __siov *iov;
        wchar_t *p;
@@ -191,7 +195,7 @@ __sprint(FILE *fp, struct __suio *uio)
                p = (wchar_t *)iov->iov_base;
                len = iov->iov_len;
                for (i = 0; i < len; i++) {
-                       if (__xfputwc(p[i], fp) == WEOF)
+                       if (__xfputwc(p[i], fp, loc) == WEOF)
                                return (-1);
                }
        }
@@ -205,11 +209,14 @@ __sprint(FILE *fp, struct __suio *uio)
  * worries about ungetc buffers and so forth.
  */
 static int
-__sbprintf(FILE *fp, const wchar_t *fmt, va_list ap)
+__sbprintf(FILE *fp, locale_t loc, const wchar_t *fmt, va_list ap)
 {
        int ret;
        FILE fake;
        unsigned char buf[BUFSIZ];
+       struct __sFILEX ext;
+       fake._extra = &ext;
+       INITEXTRA(&fake);
 
        /* XXX This is probably not needed. */
        if (prepwrite(fp) != 0)
@@ -229,7 +236,7 @@ __sbprintf(FILE *fp, const wchar_t *fmt, va_list ap)
        fake._lbfsize = 0;      /* not actually used, but Just In Case */
 
        /* do the work, then copy any error status */
-       ret = __vfwprintf(&fake, fmt, ap);
+       ret = __vfwprintf(&fake, loc, fmt, ap);
        if (ret >= 0 && __fflush(&fake))
                ret = WEOF;
        if (fake._flags & __SERR)
@@ -242,7 +249,7 @@ __sbprintf(FILE *fp, const wchar_t *fmt, va_list ap)
  * File must already be locked.
  */
 static wint_t
-__xfputwc(wchar_t wc, FILE *fp)
+__xfputwc(wchar_t wc, FILE *fp, locale_t loc)
 {
        mbstate_t mbs;
        char buf[MB_LEN_MAX];
@@ -251,10 +258,10 @@ __xfputwc(wchar_t wc, FILE *fp)
        size_t len;
 
        if ((fp->_flags & __SSTR) == 0)
-               return (__fputwc(wc, fp));
+               return (__fputwc(wc, fp, loc));
 
        mbs = initial_mbs;
-       if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1) {
+       if ((len = wcrtomb_l(buf, wc, &mbs, loc)) == (size_t)-1) {
                fp->_flags |= __SERR;
                return (WEOF);
        }
@@ -273,12 +280,13 @@ __xfputwc(wchar_t wc, FILE *fp)
  * that the multibyte char. string ends in a null character.
  */
 static wchar_t *
-__mbsconv(char *mbsarg, int prec)
+__mbsconv(char *mbsarg, int prec, locale_t loc)
 {
        mbstate_t mbs;
        wchar_t *convbuf, *wcp;
        const char *p;
-       size_t insize, nchars, nconv;
+       size_t insize, nchars, nconv = 0;
+       int mb_cur_max = MB_CUR_MAX_L(loc);
 
        if (mbsarg == NULL)
                return (NULL);
@@ -296,7 +304,7 @@ __mbsconv(char *mbsarg, int prec)
                insize = nchars = nconv = 0;
                mbs = initial_mbs;
                while (nchars != (size_t)prec) {
-                       nconv = mbrlen(p, MB_CUR_MAX, &mbs);
+                       nconv = mbrlen_l(p, mb_cur_max, &mbs, loc);
                        if (nconv == 0 || nconv == (size_t)-1 ||
                            nconv == (size_t)-2)
                                break;
@@ -323,7 +331,7 @@ __mbsconv(char *mbsarg, int prec)
        p = mbsarg;
        mbs = initial_mbs;
        while (insize != 0) {
-               nconv = mbrtowc(wcp, p, insize, &mbs);
+               nconv = mbrtowc_l(wcp, p, insize, &mbs, loc);
                if (nconv == 0 || nconv == (size_t)-1 || nconv == (size_t)-2)
                        break;
                wcp++;
@@ -343,22 +351,28 @@ __mbsconv(char *mbsarg, int prec)
  * MT-safe version
  */
 int
-vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
-
+vfwprintf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt0, va_list ap)
 {
        int ret;
 
+       NORMALIZE_LOCALE(loc);
        FLOCKFILE(fp);
        /* optimise fprintf(stderr) (and other unbuffered Unix files) */
        if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
            fp->_file >= 0)
-               ret = __sbprintf(fp, fmt0, ap);
+               ret = __sbprintf(fp, loc, fmt0, ap);
        else
-               ret = __vfwprintf(fp, fmt0, ap);
+               ret = __vfwprintf(fp, loc, fmt0, ap);
        FUNLOCKFILE(fp);
        return (ret);
 }
 
+int
+vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
+{
+       return vfwprintf_l(fp, __current_locale(), fmt0, ap);
+}
+
 /*
  * The size of the buffer we use as scratch space for integer
  * conversions, among other things.  We need enough space to
@@ -373,8 +387,8 @@ vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
 /*
  * Non-MT-safe version
  */
-int
-__vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
+__private_extern__ int
+__vfwprintf(FILE *fp, locale_t loc, const wchar_t *fmt0, va_list ap)
 {
        wchar_t *fmt;           /* format string */
        wchar_t ch;             /* character from fmt */
@@ -414,6 +428,11 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
        int ndig;               /* actual number of digits returned by dtoa */
        wchar_t expstr[MAXEXPDIG+2];    /* buffer for exponent string: e+ZZZ */
        char *dtoaresult;       /* buffer allocated by dtoa */
+#endif
+#ifdef VECTORS
+       union arg vval;         /* Vector argument. */
+       wchar_t *pct;           /* Pointer to '%' at beginning of specifier. */
+       wchar_t vsep;           /* Vector separator character. */
 #endif
        u_long  ulval;          /* integer arguments %[diouxX] */
        uintmax_t ujval;        /* %j, %ll, %q, %t, %z integers */
@@ -437,19 +456,19 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
 
        /* BEWARE, these `goto error' on error. */
 #define        PRINT(ptr, len) do {                    \
-       if (io_print(&io, (ptr), (len)))        \
+       if (io_print(&io, (ptr), (len), loc))   \
                goto error; \
 } while (0)
 #define        PAD(howmany, with) { \
-       if (io_pad(&io, (howmany), (with))) \
+       if (io_pad(&io, (howmany), (with), loc)) \
                goto error; \
 }
 #define        PRINTANDPAD(p, ep, len, with) { \
-       if (io_printandpad(&io, (p), (ep), (len), (with))) \
+       if (io_printandpad(&io, (p), (ep), (len), (with), loc)) \
                goto error; \
 }
 #define        FLUSH() { \
-       if (io_flush(&io)) \
+       if (io_flush(&io, loc)) \
                goto error; \
 }
 
@@ -485,7 +504,7 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
 #define        UJARG() \
        (flags&INTMAXT ? GETARG(uintmax_t) : \
            flags&SIZET ? (uintmax_t)GETARG(size_t) : \
-           flags&PTRDIFFT ? (uintmax_t)GETARG(ptrdiff_t) : \
+           flags&PTRDIFFT ? (uintmax_t)(unsigned long)GETARG(ptrdiff_t) : \
            (uintmax_t)GETARG(unsigned long long))
 
        /*
@@ -518,8 +537,11 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
 
 
        /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */
-       if (prepwrite(fp) != 0)
+       if (prepwrite(fp) != 0) {
+               errno = EBADF;
                return (EOF);
+       }
+       ORIENT(fp, 1);
 
        convbuf = NULL;
        fmt = (wchar_t *)fmt0;
@@ -529,7 +551,7 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
        io_init(&io, fp);
        ret = 0;
 #ifndef NO_FLOATING_POINT
-       decimal_point = get_decpt();
+       decimal_point = get_decpt(loc);
 #endif
 
        /*
@@ -548,6 +570,9 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
                }
                if (ch == '\0')
                        goto done;
+#ifdef VECTORS
+               pct = fmt;
+#endif /* VECTORS */
                fmt++;          /* skip over '%' */
 
                flags = 0;
@@ -557,6 +582,9 @@ __vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
                gs.grouping = NULL;
                sign = '\0';
                ox[1] = '\0';
+#ifdef VECTORS
+               vsep = 'X'; /* Illegal value, changed to defaults later. */
+#endif /* VECTORS */
 
 rflag:         ch = *fmt++;
 reswitch:      switch (ch) {
@@ -572,6 +600,11 @@ reswitch:  switch (ch) {
                case '#':
                        flags |= ALT;
                        goto rflag;
+#ifdef VECTORS
+               case ',': case ';': case ':': case '_':
+                       vsep = ch;
+                       goto rflag;
+#endif /* VECTORS */
                case '*':
                        /*-
                         * ``A negative field width argument is taken as a
@@ -668,10 +701,14 @@ reswitch: switch (ch) {
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'c':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & LONGINT)
                                *(cp = buf) = (wchar_t)GETARG(wint_t);
                        else
-                               *(cp = buf) = (wchar_t)btowc(GETARG(int));
+                               *(cp = buf) = (wchar_t)btowc_l(GETARG(int), loc);
                        size = 1;
                        sign = '\0';
                        break;
@@ -680,6 +717,10 @@ reswitch:  switch (ch) {
                        /*FALLTHROUGH*/
                case 'd':
                case 'i':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE) {
                                ujval = SJARG();
                                if ((intmax_t)ujval < 0) {
@@ -698,6 +739,12 @@ reswitch:  switch (ch) {
 #ifndef NO_FLOATING_POINT
                case 'a':
                case 'A':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        if (ch == 'a') {
                                ox[1] = 'x';
                                xdigs = xdigs_lower;
@@ -727,11 +774,17 @@ reswitch: switch (ch) {
                        if (convbuf != NULL)
                                free(convbuf);
                        ndig = dtoaend - dtoaresult;
-                       cp = convbuf = __mbsconv(dtoaresult, -1);
+                       cp = convbuf = __mbsconv(dtoaresult, -1, loc);
                        freedtoa(dtoaresult);
                        goto fp_common;
                case 'e':
                case 'E':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        expchar = ch;
                        if (prec < 0)   /* account for digit before decpt */
                                prec = DEFPREC + 1;
@@ -740,10 +793,22 @@ reswitch: switch (ch) {
                        goto fp_begin;
                case 'f':
                case 'F':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        expchar = '\0';
                        goto fp_begin;
                case 'g':
                case 'G':
+#ifdef VECTORS
+                       if (flags & VECTOR) {
+                               flags |= FPT;
+                               break;
+                       }
+#endif /* VECTORS */
                        expchar = ch - ('g' - 'e');
                        if (prec == 0)
                                prec = 1;
@@ -766,7 +831,7 @@ fp_begin:
                                        expt = INT_MAX;
                        }
                        ndig = dtoaend - dtoaresult;
-                       cp = convbuf = __mbsconv(dtoaresult, -1);
+                       cp = convbuf = __mbsconv(dtoaresult, -1, loc);
                        freedtoa(dtoaresult);
 fp_common:
                        if (signflag)
@@ -816,37 +881,46 @@ fp_common:
                                if (prec || flags & ALT)
                                        size += prec + 1;
                                if ((flags & GROUPING) && expt > 0)
-                                       size += grouping_init(&gs, expt);
+                                       size += grouping_init(&gs, expt, loc);
                        }
                        break;
 #endif /* !NO_FLOATING_POINT */
                case 'n':
+               {
                        /*
                         * Assignment-like behavior is specified if the
                         * value overflows or is otherwise unrepresentable.
                         * C99 says to use `signed char' for %hhn conversions.
                         */
-                       if (flags & LLONGINT)
-                               *GETARG(long long *) = ret;
+                       void *ptr = GETARG(void *);
+                       if (ptr == NULL)
+                               continue;
+                       else if (flags & LLONGINT)
+                               *(long long *)ptr = ret;
                        else if (flags & SIZET)
-                               *GETARG(ssize_t *) = (ssize_t)ret;
+                               *(ssize_t *)ptr = (ssize_t)ret;
                        else if (flags & PTRDIFFT)
-                               *GETARG(ptrdiff_t *) = ret;
+                               *(ptrdiff_t *)ptr = ret;
                        else if (flags & INTMAXT)
-                               *GETARG(intmax_t *) = ret;
+                               *(intmax_t *)ptr = ret;
                        else if (flags & LONGINT)
-                               *GETARG(long *) = ret;
+                               *(long *)ptr = ret;
                        else if (flags & SHORTINT)
-                               *GETARG(short *) = ret;
+                               *(short *)ptr = ret;
                        else if (flags & CHARINT)
-                               *GETARG(signed char *) = ret;
+                               *(signed char *)ptr = ret;
                        else
-                               *GETARG(int *) = ret;
+                               *(int *)ptr = ret;
                        continue;       /* no output */
+               }
                case 'O':
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'o':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
                        else
@@ -861,6 +935,10 @@ fp_common:
                         * defined manner.''
                         *      -- ANSI X3J11
                         */
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        ujval = (uintmax_t)(uintptr_t)GETARG(void *);
                        base = 16;
                        xdigs = xdigs_lower;
@@ -882,7 +960,7 @@ fp_common:
                                if ((mbp = GETARG(char *)) == NULL)
                                        cp = L"(null)";
                                else {
-                                       convbuf = __mbsconv(mbp, prec);
+                                       convbuf = __mbsconv(mbp, prec, loc);
                                        if (convbuf == NULL) {
                                                fp->_flags |= __SERR;
                                                goto error;
@@ -890,13 +968,23 @@ fp_common:
                                        cp = convbuf;
                                }
                        }
+#if 0 // wcsnlen needs API review first
                        size = (prec >= 0) ? wcsnlen(cp, prec) : wcslen(cp);
+#else
+                       size = wcslen(cp);
+                       if(prec >= 0 && prec < size)
+                               size = prec;
+#endif
                        sign = '\0';
                        break;
                case 'U':
                        flags |= LONGINT;
                        /*FALLTHROUGH*/
                case 'u':
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
                        else
@@ -909,6 +997,10 @@ fp_common:
                case 'x':
                        xdigs = xdigs_lower;
 hex:
+#ifdef VECTORS
+                       if (flags & VECTOR)
+                               break;
+#endif /* VECTORS */
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
                        else
@@ -926,6 +1018,7 @@ nosign:                    sign = '\0';
                         * ``... diouXx conversions ... if a precision is
                         * specified, the 0 flag will be ignored.''
                         *      -- ANSI X3J11
+                        * except for %#.0o and zero value
                         */
 number:                        if ((dprec = prec) >= 0)
                                flags &= ~ZEROPAD;
@@ -953,10 +1046,15 @@ number:                  if ((dprec = prec) >= 0)
                        }
                        size = buf + BUF - cp;
                        if (size > BUF) /* should never happen */
-                               abort();
+                               LIBC_ABORT("size (%d) > BUF (%d)", size, BUF);
                        if ((flags & GROUPING) && size != 0)
-                               size += grouping_init(&gs, size);
+                               size += grouping_init(&gs, size, loc);
                        break;
+#ifdef VECTORS
+               case 'v':
+                       flags |= VECTOR;
+                       goto rflag;
+#endif /* VECTORS */
                default:        /* "%?" prints ?, unless ? is NUL */
                        if (ch == '\0')
                                goto done;
@@ -968,6 +1066,288 @@ number:                  if ((dprec = prec) >= 0)
                        break;
                }
 
+#ifdef VECTORS
+               if (flags & VECTOR) {
+                       /*
+                        * Do the minimum amount of work necessary to construct
+                        * a format specifier that can be used to recursively
+                        * call vfprintf() for each element in the vector.
+                        */
+                       int i, j;       /* Counter. */
+                       int vcnt;       /* Number of elements in vector. */
+                       char *vfmt;     /* Pointer to format specifier. */
+#define EXTRAHH 2
+                       char vfmt_buf[32 + EXTRAHH]; /* Static buffer for format spec. */
+                       int vwidth = 0; /* Width specified via '*'. */
+                       int vprec = 0;  /* Precision specified via '*'. */
+                       char *vstr;     /* Used for asprintf(). */
+                       int vlen;       /* Length returned by asprintf(). */
+                       enum {
+                           V_CHAR, V_SHORT, V_INT,
+                           V_PCHAR, V_PSHORT, V_PINT,
+                           V_FLOAT,
+#ifdef V64TYPE
+                           V_LONGLONG, V_PLONGLONG,
+                           V_DOUBLE,
+#endif /* V64TYPE */
+                       } vtype;
+
+                       vval.vectorarg = GETARG(VECTORTYPE);
+                       /*
+                        * Set vfmt.  If vfmt_buf may not be big enough,
+                        * malloc() space, taking care to free it later.
+                        * (EXTRAHH is for possible extra "hh")
+                        */
+                       if (&fmt[-1] - pct + EXTRAHH < sizeof(vfmt_buf))
+                               vfmt = vfmt_buf;
+                       else
+                               vfmt = (char *)malloc(&fmt[-1] - pct + EXTRAHH + 1);
+
+                       /* Set the separator character, if not specified. */
+                       if (vsep == 'X') {
+                               if (ch == 'c')
+                                       vsep = '\0';
+                               else
+                                       vsep = ' ';
+                       }
+
+                       /* Create the format specifier. */
+                       for (i = j = 0; i < &fmt[-1] - pct; i++) {
+                               switch (pct[i]) {
+                               case ',': case ';': case ':': case '_':
+                               case 'v': case 'h': case 'l':
+                                       /* Ignore. */
+                                       break;
+                               case '*':
+                                       if (pct[i - 1] != '.')
+                                               vwidth = 1;
+                                       else
+                                               vprec = 1;
+                                       /* FALLTHROUGH */
+                               default:
+                                       vfmt[j++] = pct[i];
+                               }
+                       }
+               
+                       /*
+                        * Determine the number of elements in the vector and
+                        * finish up the format specifier.
+                        */
+                       if (flags & SHORTINT) {
+                               switch (ch) {
+                               case 'c':
+                                       vtype = V_SHORT;
+                                       break;
+                               case 'p':
+                                       vtype = V_PSHORT;
+                                       break;
+                               default:
+                                       vfmt[j++] = 'h';
+                                       vtype = V_SHORT;
+                                       break;
+                               }
+                               vcnt = 8;
+                       } else if (flags & LONGINT) {
+                               vcnt = 4;
+                               vtype = (ch == 'p') ? V_PINT : V_INT;
+#ifdef V64TYPE
+                       } else if (flags & LLONGINT) {
+                               switch (ch) {
+                               case 'a':
+                               case 'A':
+                               case 'e':
+                               case 'E':
+                               case 'f':
+                               case 'g':
+                               case 'G':
+                                       vcnt = 2;
+                                       vtype = V_DOUBLE;
+                                       break;
+                               case 'd':
+                               case 'i':
+                               case 'u':
+                               case 'o':
+                               case 'p':
+                               case 'x':
+                               case 'X':
+                                       vfmt[j++] = 'l';
+                                       vfmt[j++] = 'l';
+                                       vcnt = 2;
+                                       vtype = (ch == 'p') ? V_PLONGLONG : V_LONGLONG;
+                                       break;
+                               default:
+                                       /*
+                                        * The default case should never
+                                        * happen.
+                                        */
+                               case 'c':
+                                       vcnt = 16;
+                                       vtype = V_CHAR;
+                               }
+#endif /* V64TYPE */
+                       } else {
+                               switch (ch) {
+                               case 'a':
+                               case 'A':
+                               case 'e':
+                               case 'E':
+                               case 'f':
+                               case 'g':
+                               case 'G':
+                                       vcnt = 4;
+                                       vtype = V_FLOAT;
+                                       break;
+                               default:
+                                       /*
+                                        * The default case should never
+                                        * happen.
+                                        */
+                               case 'd':
+                               case 'i':
+                               case 'u':
+                               case 'o':
+                               case 'x':
+                               case 'X':
+                                       vfmt[j++] = 'h';
+                                       vfmt[j++] = 'h';
+                                       /* drop through */
+                               case 'p':
+                               case 'c':
+                                       vcnt = 16;
+                                       vtype = (ch == 'p') ? V_PCHAR : V_CHAR;
+                               }
+                       }
+                       vfmt[j++] = ch;
+                       vfmt[j++] = '\0';
+
+/* Get a vector element. */
+#ifdef V64TYPE
+#define VPRINT(type, ind, args...) do {                                        \
+       switch (type) {                                                 \
+       case V_CHAR:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_PCHAR:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_SHORT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_PSHORT:                                                  \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_INT:                                                     \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_PINT:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_LONGLONG:                                                \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vulonglongarg[ind]); \
+               break;                                                  \
+       case V_PLONGLONG:                                               \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vulonglongarg[ind]); \
+               break;                                                  \
+       case V_FLOAT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
+               break;                                                  \
+       case V_DOUBLE:                                                  \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vdoublearg[ind]); \
+               break;                                                  \
+       }                                                               \
+       ret += vlen;                                                    \
+       PRINT(vstr, vlen);                                              \
+       free(vstr);                                                     \
+} while (0)
+#else /* !V64TYPE */
+#define VPRINT(type, ind, args...) do {                                        \
+       switch (type) {                                                 \
+       case V_CHAR:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_PCHAR:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
+               break;                                                  \
+       case V_SHORT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_PSHORT:                                                  \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
+               break;                                                  \
+       case V_INT:                                                     \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_PINT:                                                    \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
+               break;                                                  \
+       case V_FLOAT:                                                   \
+               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
+               break;                                                  \
+       }                                                               \
+       ret += vlen;                                                    \
+       PRINT(vstr, vlen);                                              \
+       free(vstr);                                                     \
+} while (0)
+#endif /* V64TYPE */
+
+                       /* Actually print. */
+                       if (vwidth == 0) {
+                               if (vprec == 0) {
+                                       /* First element. */
+                                       VPRINT(vtype, 0);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i);
+                                       }
+                               } else {
+                                       /* First element. */
+                                       VPRINT(vtype, 0, prec);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i, prec);
+                                       }
+                               }
+                       } else {
+                               if (vprec == 0) {
+                                       /* First element. */
+                                       VPRINT(vtype, 0, width);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i, width);
+                                       }
+                               } else {
+                                       /* First element. */
+                                       VPRINT(vtype, 0, width, prec);
+                                       for (i = 1; i < vcnt; i++) {
+                                               /* Separator. */
+                                               if(vsep)
+                                                       PRINT(&vsep, 1);
+
+                                               /* Element. */
+                                               VPRINT(vtype, i, width, prec);
+                                       }
+                               }
+                       }
+#undef VPRINT
+
+                       if (vfmt != vfmt_buf)
+                               free(vfmt);
+
+                       continue;
+               }
+#endif /* VECTORS */
                /*
                 * All reasonable formats wind up here.  At this point, `cp'
                 * points to a string which (if not flags&LADJUST) should be
@@ -1018,7 +1398,7 @@ number:                   if ((dprec = prec) >= 0)
                        /* leading zeroes from decimal precision */
                        PAD(dprec - size, zeroes);
                        if (gs.grouping) {
-                               if (grouping_print(&gs, &io, cp, buf+BUF) < 0)
+                               if (grouping_print(&gs, &io, cp, buf+BUF, loc) < 0)
                                        goto error;
                        } else {
                                PRINT(cp, size);
@@ -1036,7 +1416,7 @@ number:                   if ((dprec = prec) >= 0)
                                } else {
                                        if (gs.grouping) {
                                                n = grouping_print(&gs, &io,
-                                                   cp, convbuf + ndig);
+                                                   cp, convbuf + ndig, loc);
                                                if (n < 0)
                                                        goto error;
                                                cp += n;
diff --git a/stdio/FreeBSD/vfwprintf.c.patch b/stdio/FreeBSD/vfwprintf.c.patch
deleted file mode 100644 (file)
index ac8b4e2..0000000
+++ /dev/null
@@ -1,927 +0,0 @@
---- vfwprintf.c.orig   2010-07-15 10:03:36.000000000 -0700
-+++ vfwprintf.c        2010-07-15 10:49:02.000000000 -0700
-@@ -38,6 +38,8 @@ static char sccsid[] = "@(#)vfprintf.c       8
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.42 2009/11/25 04:27:55 wollman Exp $");
-+#include "xlocale_private.h"
-+
- /*
-  * Actual wprintf innards.
-  *
-@@ -59,6 +61,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include <string.h>
- #include <wchar.h>
- #include <wctype.h>
-+#include <errno.h>
- #include "un-namespace.h"
- #include "libc_private.h"
-@@ -66,10 +69,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include "fvwrite.h"
- #include "printflocal.h"
--static int    __sprint(FILE *, struct __suio *);
--static int    __sbprintf(FILE *, const wchar_t *, va_list) __noinline;
--static wint_t __xfputwc(wchar_t, FILE *);
--static wchar_t        *__mbsconv(char *, int);
-+static int    __sprint(FILE *, locale_t, struct __suio *);
-+static int    __sbprintf(FILE *, locale_t, const wchar_t *, va_list);
-+static wint_t __xfputwc(wchar_t, FILE *, locale_t);
-+static wchar_t        *__mbsconv(char *, int, locale_t);
-+__private_extern__ const char *__fix_nogrouping(const char *);
- #define       CHAR    wchar_t
- #include "printfcommon.h"
-@@ -85,29 +89,29 @@ struct grouping_state {
- static const mbstate_t initial_mbs;
- static inline wchar_t
--get_decpt(void)
-+get_decpt(locale_t loc)
- {
-       mbstate_t mbs;
-       wchar_t decpt;
-       int nconv;
-       mbs = initial_mbs;
--      nconv = mbrtowc(&decpt, localeconv()->decimal_point, MB_CUR_MAX, &mbs);
-+      nconv = mbrtowc_l(&decpt, localeconv_l(loc)->decimal_point, MB_CUR_MAX_L(loc), &mbs, loc);
-       if (nconv == (size_t)-1 || nconv == (size_t)-2)
-               decpt = '.';    /* failsafe */
-       return (decpt);
- }
- static inline wchar_t
--get_thousep(void)
-+get_thousep(locale_t loc)
- {
-       mbstate_t mbs;
-       wchar_t thousep;
-       int nconv;
-       mbs = initial_mbs;
--      nconv = mbrtowc(&thousep, localeconv()->thousands_sep,
--          MB_CUR_MAX, &mbs);
-+      nconv = mbrtowc_l(&thousep, localeconv_l(loc)->thousands_sep,
-+          MB_CUR_MAX_L(loc), &mbs, loc);
-       if (nconv == (size_t)-1 || nconv == (size_t)-2)
-               thousep = '\0';    /* failsafe */
-       return (thousep);
-@@ -119,11 +123,11 @@ get_thousep(void)
-  * of wide characters that will be printed.
-  */
- static int
--grouping_init(struct grouping_state *gs, int ndigits)
-+grouping_init(struct grouping_state *gs, int ndigits, locale_t loc)
- {
--      gs->grouping = localeconv()->grouping;
--      gs->thousands_sep = get_thousep();
-+      gs->grouping = __fix_nogrouping(localeconv_l(loc)->grouping);
-+      gs->thousands_sep = get_thousep(loc);
-       gs->nseps = gs->nrepeats = 0;
-       gs->lead = ndigits;
-@@ -145,11 +149,11 @@ grouping_init(struct grouping_state *gs,
-  */
- static int
- grouping_print(struct grouping_state *gs, struct io_state *iop,
--             const CHAR *cp, const CHAR *ep)
-+             const CHAR *cp, const CHAR *ep, locale_t loc)
- {
-       const CHAR *cp0 = cp;
--      if (io_printandpad(iop, cp, ep, gs->lead, zeroes))
-+      if (io_printandpad(iop, cp, ep, gs->lead, zeroes, loc))
-               return (-1);
-       cp += gs->lead;
-       while (gs->nseps > 0 || gs->nrepeats > 0) {
-@@ -159,9 +163,9 @@ grouping_print(struct grouping_state *gs
-                       gs->grouping--;
-                       gs->nseps--;
-               }
--              if (io_print(iop, &gs->thousands_sep, 1))
-+              if (io_print(iop, &gs->thousands_sep, 1, loc))
-                       return (-1);
--              if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes))
-+              if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, loc))
-                       return (-1);
-               cp += *gs->grouping;
-       }
-@@ -180,7 +184,7 @@ grouping_print(struct grouping_state *gs
-  * string eclipses the benefits of buffering.
-  */
- static int
--__sprint(FILE *fp, struct __suio *uio)
-+__sprint(FILE *fp, locale_t loc, struct __suio *uio)
- {
-       struct __siov *iov;
-       wchar_t *p;
-@@ -191,7 +195,7 @@ __sprint(FILE *fp, struct __suio *uio)
-               p = (wchar_t *)iov->iov_base;
-               len = iov->iov_len;
-               for (i = 0; i < len; i++) {
--                      if (__xfputwc(p[i], fp) == WEOF)
-+                      if (__xfputwc(p[i], fp, loc) == WEOF)
-                               return (-1);
-               }
-       }
-@@ -205,11 +209,14 @@ __sprint(FILE *fp, struct __suio *uio)
-  * worries about ungetc buffers and so forth.
-  */
- static int
--__sbprintf(FILE *fp, const wchar_t *fmt, va_list ap)
-+__sbprintf(FILE *fp, locale_t loc, const wchar_t *fmt, va_list ap)
- {
-       int ret;
-       FILE fake;
-       unsigned char buf[BUFSIZ];
-+      struct __sFILEX ext;
-+      fake._extra = &ext;
-+      INITEXTRA(&fake);
-       /* XXX This is probably not needed. */
-       if (prepwrite(fp) != 0)
-@@ -229,7 +236,7 @@ __sbprintf(FILE *fp, const wchar_t *fmt,
-       fake._lbfsize = 0;      /* not actually used, but Just In Case */
-       /* do the work, then copy any error status */
--      ret = __vfwprintf(&fake, fmt, ap);
-+      ret = __vfwprintf(&fake, loc, fmt, ap);
-       if (ret >= 0 && __fflush(&fake))
-               ret = WEOF;
-       if (fake._flags & __SERR)
-@@ -242,7 +249,7 @@ __sbprintf(FILE *fp, const wchar_t *fmt,
-  * File must already be locked.
-  */
- static wint_t
--__xfputwc(wchar_t wc, FILE *fp)
-+__xfputwc(wchar_t wc, FILE *fp, locale_t loc)
- {
-       mbstate_t mbs;
-       char buf[MB_LEN_MAX];
-@@ -251,10 +258,10 @@ __xfputwc(wchar_t wc, FILE *fp)
-       size_t len;
-       if ((fp->_flags & __SSTR) == 0)
--              return (__fputwc(wc, fp));
-+              return (__fputwc(wc, fp, loc));
-       mbs = initial_mbs;
--      if ((len = wcrtomb(buf, wc, &mbs)) == (size_t)-1) {
-+      if ((len = wcrtomb_l(buf, wc, &mbs, loc)) == (size_t)-1) {
-               fp->_flags |= __SERR;
-               return (WEOF);
-       }
-@@ -273,12 +280,13 @@ __xfputwc(wchar_t wc, FILE *fp)
-  * that the multibyte char. string ends in a null character.
-  */
- static wchar_t *
--__mbsconv(char *mbsarg, int prec)
-+__mbsconv(char *mbsarg, int prec, locale_t loc)
- {
-       mbstate_t mbs;
-       wchar_t *convbuf, *wcp;
-       const char *p;
--      size_t insize, nchars, nconv;
-+      size_t insize, nchars, nconv = 0;
-+      int mb_cur_max = MB_CUR_MAX_L(loc);
-       if (mbsarg == NULL)
-               return (NULL);
-@@ -296,7 +304,7 @@ __mbsconv(char *mbsarg, int prec)
-               insize = nchars = nconv = 0;
-               mbs = initial_mbs;
-               while (nchars != (size_t)prec) {
--                      nconv = mbrlen(p, MB_CUR_MAX, &mbs);
-+                      nconv = mbrlen_l(p, mb_cur_max, &mbs, loc);
-                       if (nconv == 0 || nconv == (size_t)-1 ||
-                           nconv == (size_t)-2)
-                               break;
-@@ -323,7 +331,7 @@ __mbsconv(char *mbsarg, int prec)
-       p = mbsarg;
-       mbs = initial_mbs;
-       while (insize != 0) {
--              nconv = mbrtowc(wcp, p, insize, &mbs);
-+              nconv = mbrtowc_l(wcp, p, insize, &mbs, loc);
-               if (nconv == 0 || nconv == (size_t)-1 || nconv == (size_t)-2)
-                       break;
-               wcp++;
-@@ -343,22 +351,28 @@ __mbsconv(char *mbsarg, int prec)
-  * MT-safe version
-  */
- int
--vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
--
-+vfwprintf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt0, va_list ap)
- {
-       int ret;
-+      NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       /* optimise fprintf(stderr) (and other unbuffered Unix files) */
-       if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
-           fp->_file >= 0)
--              ret = __sbprintf(fp, fmt0, ap);
-+              ret = __sbprintf(fp, loc, fmt0, ap);
-       else
--              ret = __vfwprintf(fp, fmt0, ap);
-+              ret = __vfwprintf(fp, loc, fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
- }
-+int
-+vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
-+{
-+      return vfwprintf_l(fp, __current_locale(), fmt0, ap);
-+}
-+
- /*
-  * The size of the buffer we use as scratch space for integer
-  * conversions, among other things.  We need enough space to
-@@ -373,8 +387,8 @@ vfwprintf(FILE * __restrict fp, const wc
- /*
-  * Non-MT-safe version
-  */
--int
--__vfwprintf(FILE *fp, const wchar_t *fmt0, va_list ap)
-+__private_extern__ int
-+__vfwprintf(FILE *fp, locale_t loc, const wchar_t *fmt0, va_list ap)
- {
-       wchar_t *fmt;           /* format string */
-       wchar_t ch;             /* character from fmt */
-@@ -415,6 +429,11 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
-       wchar_t expstr[MAXEXPDIG+2];    /* buffer for exponent string: e+ZZZ */
-       char *dtoaresult;       /* buffer allocated by dtoa */
- #endif
-+#ifdef VECTORS
-+      union arg vval;         /* Vector argument. */
-+      wchar_t *pct;           /* Pointer to '%' at beginning of specifier. */
-+      wchar_t vsep;           /* Vector separator character. */
-+#endif
-       u_long  ulval;          /* integer arguments %[diouxX] */
-       uintmax_t ujval;        /* %j, %ll, %q, %t, %z integers */
-       int base;               /* base for [diouxX] conversion */
-@@ -437,19 +456,19 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
-       /* BEWARE, these `goto error' on error. */
- #define       PRINT(ptr, len) do {                    \
--      if (io_print(&io, (ptr), (len)))        \
-+      if (io_print(&io, (ptr), (len), loc))   \
-               goto error; \
- } while (0)
- #define       PAD(howmany, with) { \
--      if (io_pad(&io, (howmany), (with))) \
-+      if (io_pad(&io, (howmany), (with), loc)) \
-               goto error; \
- }
- #define       PRINTANDPAD(p, ep, len, with) { \
--      if (io_printandpad(&io, (p), (ep), (len), (with))) \
-+      if (io_printandpad(&io, (p), (ep), (len), (with), loc)) \
-               goto error; \
- }
- #define       FLUSH() { \
--      if (io_flush(&io)) \
-+      if (io_flush(&io, loc)) \
-               goto error; \
- }
-@@ -485,7 +504,7 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
- #define       UJARG() \
-       (flags&INTMAXT ? GETARG(uintmax_t) : \
-           flags&SIZET ? (uintmax_t)GETARG(size_t) : \
--          flags&PTRDIFFT ? (uintmax_t)GETARG(ptrdiff_t) : \
-+          flags&PTRDIFFT ? (uintmax_t)(unsigned long)GETARG(ptrdiff_t) : \
-           (uintmax_t)GETARG(unsigned long long))
-       /*
-@@ -518,8 +537,11 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
-       /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */
--      if (prepwrite(fp) != 0)
-+      if (prepwrite(fp) != 0) {
-+              errno = EBADF;
-               return (EOF);
-+      }
-+      ORIENT(fp, 1);
-       convbuf = NULL;
-       fmt = (wchar_t *)fmt0;
-@@ -529,7 +551,7 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
-       io_init(&io, fp);
-       ret = 0;
- #ifndef NO_FLOATING_POINT
--      decimal_point = get_decpt();
-+      decimal_point = get_decpt(loc);
- #endif
-       /*
-@@ -548,6 +570,9 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
-               }
-               if (ch == '\0')
-                       goto done;
-+#ifdef VECTORS
-+              pct = fmt;
-+#endif /* VECTORS */
-               fmt++;          /* skip over '%' */
-               flags = 0;
-@@ -557,6 +582,9 @@ __vfwprintf(FILE *fp, const wchar_t *fmt
-               gs.grouping = NULL;
-               sign = '\0';
-               ox[1] = '\0';
-+#ifdef VECTORS
-+              vsep = 'X'; /* Illegal value, changed to defaults later. */
-+#endif /* VECTORS */
- rflag:                ch = *fmt++;
- reswitch:     switch (ch) {
-@@ -572,6 +600,11 @@ reswitch: switch (ch) {
-               case '#':
-                       flags |= ALT;
-                       goto rflag;
-+#ifdef VECTORS
-+              case ',': case ';': case ':': case '_':
-+                      vsep = ch;
-+                      goto rflag;
-+#endif /* VECTORS */
-               case '*':
-                       /*-
-                        * ``A negative field width argument is taken as a
-@@ -668,10 +701,14 @@ reswitch:        switch (ch) {
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'c':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & LONGINT)
-                               *(cp = buf) = (wchar_t)GETARG(wint_t);
-                       else
--                              *(cp = buf) = (wchar_t)btowc(GETARG(int));
-+                              *(cp = buf) = (wchar_t)btowc_l(GETARG(int), loc);
-                       size = 1;
-                       sign = '\0';
-                       break;
-@@ -680,6 +717,10 @@ reswitch: switch (ch) {
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE) {
-                               ujval = SJARG();
-                               if ((intmax_t)ujval < 0) {
-@@ -698,6 +739,12 @@ reswitch: switch (ch) {
- #ifndef NO_FLOATING_POINT
-               case 'a':
-               case 'A':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       if (ch == 'a') {
-                               ox[1] = 'x';
-                               xdigs = xdigs_lower;
-@@ -709,6 +756,12 @@ reswitch: switch (ch) {
-                       }
-                       if (prec >= 0)
-                               prec++;
-+#ifdef LDBL_COMPAT
-+                      fparg.dbl = GETARG(double);
-+                      dtoaresult =
-+                          __hdtoa(fparg.dbl, xdigs, prec,
-+                              &expt, &signflag, &dtoaend);
-+#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult =
-@@ -720,6 +773,7 @@ reswitch:  switch (ch) {
-                                   __hdtoa(fparg.dbl, xdigs, prec,
-                                       &expt, &signflag, &dtoaend);
-                       }
-+#endif /* LDBL_COMPAT */
-                       if (prec < 0)
-                               prec = dtoaend - dtoaresult;
-                       if (expt == INT_MAX)
-@@ -727,11 +781,17 @@ reswitch:        switch (ch) {
-                       if (convbuf != NULL)
-                               free(convbuf);
-                       ndig = dtoaend - dtoaresult;
--                      cp = convbuf = __mbsconv(dtoaresult, -1);
-+                      cp = convbuf = __mbsconv(dtoaresult, -1, loc);
-                       freedtoa(dtoaresult);
-                       goto fp_common;
-               case 'e':
-               case 'E':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       expchar = ch;
-                       if (prec < 0)   /* account for digit before decpt */
-                               prec = DEFPREC + 1;
-@@ -740,10 +800,22 @@ reswitch:        switch (ch) {
-                       goto fp_begin;
-               case 'f':
-               case 'F':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       expchar = '\0';
-                       goto fp_begin;
-               case 'g':
-               case 'G':
-+#ifdef VECTORS
-+                      if (flags & VECTOR) {
-+                              flags |= FPT;
-+                              break;
-+                      }
-+#endif /* VECTORS */
-                       expchar = ch - ('g' - 'e');
-                       if (prec == 0)
-                               prec = 1;
-@@ -752,6 +824,14 @@ fp_begin:
-                               prec = DEFPREC;
-                       if (convbuf != NULL)
-                               free(convbuf);
-+#ifdef LDBL_COMPAT
-+                      fparg.dbl = GETARG(double);
-+                      dtoaresult =
-+                          dtoa(fparg.dbl, expchar ? 2 : 3, prec,
-+                          &expt, &signflag, &dtoaend);
-+                      if (expt == 9999)
-+                              expt = INT_MAX;
-+#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult =
-@@ -765,8 +845,9 @@ fp_begin:
-                               if (expt == 9999)
-                                       expt = INT_MAX;
-                       }
-+#endif /* LDBL_COMPAT */
-                       ndig = dtoaend - dtoaresult;
--                      cp = convbuf = __mbsconv(dtoaresult, -1);
-+                      cp = convbuf = __mbsconv(dtoaresult, -1, loc);
-                       freedtoa(dtoaresult);
- fp_common:
-                       if (signflag)
-@@ -816,37 +897,46 @@ fp_common:
-                               if (prec || flags & ALT)
-                                       size += prec + 1;
-                               if ((flags & GROUPING) && expt > 0)
--                                      size += grouping_init(&gs, expt);
-+                                      size += grouping_init(&gs, expt, loc);
-                       }
-                       break;
- #endif /* !NO_FLOATING_POINT */
-               case 'n':
-+              {
-                       /*
-                        * Assignment-like behavior is specified if the
-                        * value overflows or is otherwise unrepresentable.
-                        * C99 says to use `signed char' for %hhn conversions.
-                        */
--                      if (flags & LLONGINT)
--                              *GETARG(long long *) = ret;
-+                      void *ptr = GETARG(void *);
-+                      if (ptr == NULL)
-+                              continue;
-+                      else if (flags & LLONGINT)
-+                              *(long long *)ptr = ret;
-                       else if (flags & SIZET)
--                              *GETARG(ssize_t *) = (ssize_t)ret;
-+                              *(ssize_t *)ptr = (ssize_t)ret;
-                       else if (flags & PTRDIFFT)
--                              *GETARG(ptrdiff_t *) = ret;
-+                              *(ptrdiff_t *)ptr = ret;
-                       else if (flags & INTMAXT)
--                              *GETARG(intmax_t *) = ret;
-+                              *(intmax_t *)ptr = ret;
-                       else if (flags & LONGINT)
--                              *GETARG(long *) = ret;
-+                              *(long *)ptr = ret;
-                       else if (flags & SHORTINT)
--                              *GETARG(short *) = ret;
-+                              *(short *)ptr = ret;
-                       else if (flags & CHARINT)
--                              *GETARG(signed char *) = ret;
-+                              *(signed char *)ptr = ret;
-                       else
--                              *GETARG(int *) = ret;
-+                              *(int *)ptr = ret;
-                       continue;       /* no output */
-+              }
-               case 'O':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-@@ -861,6 +951,10 @@ fp_common:
-                        * defined manner.''
-                        *      -- ANSI X3J11
-                        */
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       ujval = (uintmax_t)(uintptr_t)GETARG(void *);
-                       base = 16;
-                       xdigs = xdigs_lower;
-@@ -882,7 +976,7 @@ fp_common:
-                               if ((mbp = GETARG(char *)) == NULL)
-                                       cp = L"(null)";
-                               else {
--                                      convbuf = __mbsconv(mbp, prec);
-+                                      convbuf = __mbsconv(mbp, prec, loc);
-                                       if (convbuf == NULL) {
-                                               fp->_flags |= __SERR;
-                                               goto error;
-@@ -890,13 +984,23 @@ fp_common:
-                                       cp = convbuf;
-                               }
-                       }
-+#if 0 // wcsnlen needs API review first
-                       size = (prec >= 0) ? wcsnlen(cp, prec) : wcslen(cp);
-+#else
-+                      size = wcslen(cp);
-+                      if(prec >= 0 && prec < size)
-+                              size = prec;
-+#endif
-                       sign = '\0';
-                       break;
-               case 'U':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'u':
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-@@ -909,6 +1013,10 @@ fp_common:
-               case 'x':
-                       xdigs = xdigs_lower;
- hex:
-+#ifdef VECTORS
-+                      if (flags & VECTOR)
-+                              break;
-+#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-@@ -926,6 +1034,7 @@ nosign:                   sign = '\0';
-                        * ``... diouXx conversions ... if a precision is
-                        * specified, the 0 flag will be ignored.''
-                        *      -- ANSI X3J11
-+                       * except for %#.0o and zero value
-                        */
- number:                       if ((dprec = prec) >= 0)
-                               flags &= ~ZEROPAD;
-@@ -953,10 +1062,15 @@ number:                 if ((dprec = prec) >= 0)
-                       }
-                       size = buf + BUF - cp;
-                       if (size > BUF) /* should never happen */
--                              abort();
-+                              LIBC_ABORT("size (%d) > BUF (%d)", size, BUF);
-                       if ((flags & GROUPING) && size != 0)
--                              size += grouping_init(&gs, size);
-+                              size += grouping_init(&gs, size, loc);
-                       break;
-+#ifdef VECTORS
-+              case 'v':
-+                      flags |= VECTOR;
-+                      goto rflag;
-+#endif /* VECTORS */
-               default:        /* "%?" prints ?, unless ? is NUL */
-                       if (ch == '\0')
-                               goto done;
-@@ -968,6 +1082,288 @@ number:                 if ((dprec = prec) >= 0)
-                       break;
-               }
-+#ifdef VECTORS
-+              if (flags & VECTOR) {
-+                      /*
-+                       * Do the minimum amount of work necessary to construct
-+                       * a format specifier that can be used to recursively
-+                       * call vfprintf() for each element in the vector.
-+                       */
-+                      int i, j;       /* Counter. */
-+                      int vcnt;       /* Number of elements in vector. */
-+                      char *vfmt;     /* Pointer to format specifier. */
-+#define EXTRAHH 2
-+                      char vfmt_buf[32 + EXTRAHH]; /* Static buffer for format spec. */
-+                      int vwidth = 0; /* Width specified via '*'. */
-+                      int vprec = 0;  /* Precision specified via '*'. */
-+                      char *vstr;     /* Used for asprintf(). */
-+                      int vlen;       /* Length returned by asprintf(). */
-+                      enum {
-+                          V_CHAR, V_SHORT, V_INT,
-+                          V_PCHAR, V_PSHORT, V_PINT,
-+                          V_FLOAT,
-+#ifdef V64TYPE
-+                          V_LONGLONG, V_PLONGLONG,
-+                          V_DOUBLE,
-+#endif /* V64TYPE */
-+                      } vtype;
-+
-+                      vval.vectorarg = GETARG(VECTORTYPE);
-+                      /*
-+                       * Set vfmt.  If vfmt_buf may not be big enough,
-+                       * malloc() space, taking care to free it later.
-+                       * (EXTRAHH is for possible extra "hh")
-+                       */
-+                      if (&fmt[-1] - pct + EXTRAHH < sizeof(vfmt_buf))
-+                              vfmt = vfmt_buf;
-+                      else
-+                              vfmt = (char *)malloc(&fmt[-1] - pct + EXTRAHH + 1);
-+
-+                      /* Set the separator character, if not specified. */
-+                      if (vsep == 'X') {
-+                              if (ch == 'c')
-+                                      vsep = '\0';
-+                              else
-+                                      vsep = ' ';
-+                      }
-+
-+                      /* Create the format specifier. */
-+                      for (i = j = 0; i < &fmt[-1] - pct; i++) {
-+                              switch (pct[i]) {
-+                              case ',': case ';': case ':': case '_':
-+                              case 'v': case 'h': case 'l':
-+                                      /* Ignore. */
-+                                      break;
-+                              case '*':
-+                                      if (pct[i - 1] != '.')
-+                                              vwidth = 1;
-+                                      else
-+                                              vprec = 1;
-+                                      /* FALLTHROUGH */
-+                              default:
-+                                      vfmt[j++] = pct[i];
-+                              }
-+                      }
-+              
-+                      /*
-+                       * Determine the number of elements in the vector and
-+                       * finish up the format specifier.
-+                       */
-+                      if (flags & SHORTINT) {
-+                              switch (ch) {
-+                              case 'c':
-+                                      vtype = V_SHORT;
-+                                      break;
-+                              case 'p':
-+                                      vtype = V_PSHORT;
-+                                      break;
-+                              default:
-+                                      vfmt[j++] = 'h';
-+                                      vtype = V_SHORT;
-+                                      break;
-+                              }
-+                              vcnt = 8;
-+                      } else if (flags & LONGINT) {
-+                              vcnt = 4;
-+                              vtype = (ch == 'p') ? V_PINT : V_INT;
-+#ifdef V64TYPE
-+                      } else if (flags & LLONGINT) {
-+                              switch (ch) {
-+                              case 'a':
-+                              case 'A':
-+                              case 'e':
-+                              case 'E':
-+                              case 'f':
-+                              case 'g':
-+                              case 'G':
-+                                      vcnt = 2;
-+                                      vtype = V_DOUBLE;
-+                                      break;
-+                              case 'd':
-+                              case 'i':
-+                              case 'u':
-+                              case 'o':
-+                              case 'p':
-+                              case 'x':
-+                              case 'X':
-+                                      vfmt[j++] = 'l';
-+                                      vfmt[j++] = 'l';
-+                                      vcnt = 2;
-+                                      vtype = (ch == 'p') ? V_PLONGLONG : V_LONGLONG;
-+                                      break;
-+                              default:
-+                                      /*
-+                                       * The default case should never
-+                                       * happen.
-+                                       */
-+                              case 'c':
-+                                      vcnt = 16;
-+                                      vtype = V_CHAR;
-+                              }
-+#endif /* V64TYPE */
-+                      } else {
-+                              switch (ch) {
-+                              case 'a':
-+                              case 'A':
-+                              case 'e':
-+                              case 'E':
-+                              case 'f':
-+                              case 'g':
-+                              case 'G':
-+                                      vcnt = 4;
-+                                      vtype = V_FLOAT;
-+                                      break;
-+                              default:
-+                                      /*
-+                                       * The default case should never
-+                                       * happen.
-+                                       */
-+                              case 'd':
-+                              case 'i':
-+                              case 'u':
-+                              case 'o':
-+                              case 'x':
-+                              case 'X':
-+                                      vfmt[j++] = 'h';
-+                                      vfmt[j++] = 'h';
-+                                      /* drop through */
-+                              case 'p':
-+                              case 'c':
-+                                      vcnt = 16;
-+                                      vtype = (ch == 'p') ? V_PCHAR : V_CHAR;
-+                              }
-+                      }
-+                      vfmt[j++] = ch;
-+                      vfmt[j++] = '\0';
-+
-+/* Get a vector element. */
-+#ifdef V64TYPE
-+#define VPRINT(type, ind, args...) do {                                       \
-+      switch (type) {                                                 \
-+      case V_CHAR:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_PCHAR:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_SHORT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_PSHORT:                                                  \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_INT:                                                     \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_PINT:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_LONGLONG:                                                \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vulonglongarg[ind]); \
-+              break;                                                  \
-+      case V_PLONGLONG:                                               \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vulonglongarg[ind]); \
-+              break;                                                  \
-+      case V_FLOAT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-+              break;                                                  \
-+      case V_DOUBLE:                                                  \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vdoublearg[ind]); \
-+              break;                                                  \
-+      }                                                               \
-+      ret += vlen;                                                    \
-+      PRINT(vstr, vlen);                                              \
-+      free(vstr);                                                     \
-+} while (0)
-+#else /* !V64TYPE */
-+#define VPRINT(type, ind, args...) do {                                       \
-+      switch (type) {                                                 \
-+      case V_CHAR:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_PCHAR:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-+              break;                                                  \
-+      case V_SHORT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_PSHORT:                                                  \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-+              break;                                                  \
-+      case V_INT:                                                     \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_PINT:                                                    \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-+              break;                                                  \
-+      case V_FLOAT:                                                   \
-+              vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-+              break;                                                  \
-+      }                                                               \
-+      ret += vlen;                                                    \
-+      PRINT(vstr, vlen);                                              \
-+      free(vstr);                                                     \
-+} while (0)
-+#endif /* V64TYPE */
-+
-+                      /* Actually print. */
-+                      if (vwidth == 0) {
-+                              if (vprec == 0) {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i);
-+                                      }
-+                              } else {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0, prec);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i, prec);
-+                                      }
-+                              }
-+                      } else {
-+                              if (vprec == 0) {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0, width);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i, width);
-+                                      }
-+                              } else {
-+                                      /* First element. */
-+                                      VPRINT(vtype, 0, width, prec);
-+                                      for (i = 1; i < vcnt; i++) {
-+                                              /* Separator. */
-+                                              if(vsep)
-+                                                      PRINT(&vsep, 1);
-+
-+                                              /* Element. */
-+                                              VPRINT(vtype, i, width, prec);
-+                                      }
-+                              }
-+                      }
-+#undef VPRINT
-+
-+                      if (vfmt != vfmt_buf)
-+                              free(vfmt);
-+
-+                      continue;
-+              }
-+#endif /* VECTORS */
-               /*
-                * All reasonable formats wind up here.  At this point, `cp'
-                * points to a string which (if not flags&LADJUST) should be
-@@ -1018,7 +1414,7 @@ number:                  if ((dprec = prec) >= 0)
-                       /* leading zeroes from decimal precision */
-                       PAD(dprec - size, zeroes);
-                       if (gs.grouping) {
--                              if (grouping_print(&gs, &io, cp, buf+BUF) < 0)
-+                              if (grouping_print(&gs, &io, cp, buf+BUF, loc) < 0)
-                                       goto error;
-                       } else {
-                               PRINT(cp, size);
-@@ -1036,7 +1432,7 @@ number:                  if ((dprec = prec) >= 0)
-                               } else {
-                                       if (gs.grouping) {
-                                               n = grouping_print(&gs, &io,
--                                                  cp, convbuf + ndig);
-+                                                  cp, convbuf + ndig, loc);
-                                               if (n < 0)
-                                                       goto error;
-                                               cp += n;
index 79b54692b66ab48cc1c71a076e10093da987a5af..bba07f2735cc72ceb1752514da8513e7a48e8ca4 100644 (file)
@@ -38,6 +38,8 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwscanf.c,v 1.17 2009/01/19 06:19:51 das Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <ctype.h>
 #include <inttypes.h>
@@ -96,7 +98,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwscanf.c,v 1.17 2009/01/19 06:19:51 das
 #define        CT_FLOAT        4       /* %[efgEFG] conversion */
 
 #ifndef NO_FLOATING_POINT
-static int parsefloat(FILE *, wchar_t *, wchar_t *);
+static int parsefloat(FILE *, wchar_t **, size_t, locale_t loc);
 #endif
 
 #define        INCCL(_c)       \
@@ -115,7 +117,21 @@ vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
 
        FLOCKFILE(fp);
        ORIENT(fp, 1);
-       ret = __vfwscanf(fp, fmt, ap);
+       ret = __vfwscanf(fp, __current_locale(), fmt, ap);
+       FUNLOCKFILE(fp);
+       return (ret);
+}
+
+int
+vfwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
+    va_list ap)
+{
+       int ret;
+
+       NORMALIZE_LOCALE(loc);
+       FLOCKFILE(fp);
+       ORIENT(fp, 1);
+       ret = __vfwscanf(fp, loc, fmt, ap);
        FUNLOCKFILE(fp);
        return (ret);
 }
@@ -123,8 +139,9 @@ vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
 /*
  * Non-MT-safe version.
  */
-int
-__vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
+__private_extern__ int
+__vfwscanf(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
+    va_list ap)
 {
        wint_t c;               /* character from format, or conversion */
        size_t width;           /* field width, or 0 */
@@ -133,7 +150,6 @@ __vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
        int flags;              /* flags as defined above */
        wchar_t *p0;            /* saves original value of p when necessary */
        int nassigned;          /* number of fields assigned */
-       int nconversions;       /* number of conversions */
        int nread;              /* number of characters consumed from fp */
        int base;               /* base argument to conversion function */
        wchar_t buf[BUF];       /* buffer for numeric conversions */
@@ -144,30 +160,36 @@ __vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
        char *mbp;              /* multibyte string pointer for %c %s %[ */
        size_t nconv;           /* number of bytes in mb. conversion */
        char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */
+       int index;              /* for %index$ */
+       va_list ap_orig;        /* to reset ap to first argument */
        mbstate_t mbs;
+       int mb_cur_max = MB_CUR_MAX_L(loc);
 
        /* `basefix' is used to avoid `if' tests in the integer scanner */
        static short basefix[17] =
                { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
 
        nassigned = 0;
-       nconversions = 0;
        nread = 0;
        ccls = ccle = NULL;
+       va_copy(ap_orig, ap);
        for (;;) {
                c = *fmt++;
                if (c == 0)
                        return (nassigned);
-               if (iswspace(c)) {
-                       while ((c = __fgetwc(fp)) != WEOF &&
-                           iswspace(c))
+               if (iswspace_l(c, loc)) {
+                       while ((c = __fgetwc(fp, loc)) != WEOF &&
+                           iswspace_l(c, loc))
                                ;
                        if (c != WEOF)
-                               __ungetwc(c, fp);
+                               __ungetwc(c, fp, loc);
                        continue;
                }
-               if (c != '%')
+               if (c != '%') {
+                       if ((wi = __fgetwc(fp, loc)) == WEOF)
+                               goto input_failure;
                        goto literal;
+               }
                width = 0;
                flags = 0;
                /*
@@ -177,16 +199,34 @@ __vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
 again:         c = *fmt++;
                switch (c) {
                case '%':
+               /* Consume leading white space */
+                       for(;;) {
+                               if ((wi = __fgetwc(fp, loc)) == WEOF)
+                                       goto input_failure;
+                               if (!iswspace_l(wi, loc))
+                                       break;
+                               nread++;
+                       }
 literal:
-                       if ((wi = __fgetwc(fp)) == WEOF)
-                               goto input_failure;
                        if (wi != c) {
-                               __ungetwc(wi, fp);
-                               goto input_failure;
+                               __ungetwc(wi, fp, loc);
+                               goto match_failure;
                        }
                        nread++;
                        continue;
 
+               case '$':
+                       index = width;
+                       if (index < 1 || index > NL_ARGMAX || fmt[-3] != '%') {
+                               goto input_failure;
+                       }
+                       width = 0;
+                       va_end(ap);
+                       va_copy(ap, ap_orig); /* reset to %1$ */
+                       for (; index > 1; index--) {
+                               va_arg(ap, void*);
+                       }
+                       goto again;
                case '*':
                        flags |= SUPPRESS;
                        goto again;
@@ -305,27 +345,28 @@ literal:
                        break;
 
                case 'n':
-                       nconversions++;
-                       if (flags & SUPPRESS)   /* ??? */
+               {
+                       void *ptr = va_arg(ap, void *);
+                       if ((ptr == NULL) || (flags & SUPPRESS))        /* ??? */
                                continue;
-                       if (flags & SHORTSHORT)
-                               *va_arg(ap, char *) = nread;
+                       else if (flags & SHORTSHORT)
+                               *(char *)ptr = nread;
                        else if (flags & SHORT)
-                               *va_arg(ap, short *) = nread;
+                               *(short *)ptr = nread;
                        else if (flags & LONG)
-                               *va_arg(ap, long *) = nread;
+                               *(long *)ptr = nread;
                        else if (flags & LONGLONG)
-                               *va_arg(ap, long long *) = nread;
+                               *(long long *)ptr = nread;
                        else if (flags & INTMAXT)
-                               *va_arg(ap, intmax_t *) = nread;
+                               *(intmax_t *)ptr = nread;
                        else if (flags & SIZET)
-                               *va_arg(ap, size_t *) = nread;
+                               *(size_t *)ptr = nread;
                        else if (flags & PTRDIFFT)
-                               *va_arg(ap, ptrdiff_t *) = nread;
+                               *(ptrdiff_t *)ptr = nread;
                        else
-                               *va_arg(ap, int *) = nread;
+                               *(int *)ptr = nread;
                        continue;
-
+               }
                default:
                        goto match_failure;
 
@@ -341,11 +382,11 @@ literal:
                 * that suppress this.
                 */
                if ((flags & NOSKIP) == 0) {
-                       while ((wi = __fgetwc(fp)) != WEOF && iswspace(wi))
+                       while ((wi = __fgetwc(fp, loc)) != WEOF && iswspace_l(wi, loc))
                                nread++;
                        if (wi == WEOF)
                                goto input_failure;
-                       __ungetwc(wi, fp);
+                       __ungetwc(wi, fp, loc);
                }
 
                /*
@@ -362,7 +403,7 @@ literal:
                                        p = va_arg(ap, wchar_t *);
                                n = 0;
                                while (width-- != 0 &&
-                                   (wi = __fgetwc(fp)) != WEOF) {
+                                   (wi = __fgetwc(fp, loc)) != WEOF) {
                                        if (!(flags & SUPPRESS))
                                                *p++ = (wchar_t)wi;
                                        n++;
@@ -378,19 +419,19 @@ literal:
                                n = 0;
                                mbs = initial_mbs;
                                while (width != 0 &&
-                                   (wi = __fgetwc(fp)) != WEOF) {
-                                       if (width >= MB_CUR_MAX &&
+                                   (wi = __fgetwc(fp, loc)) != WEOF) {
+                                       if (width >= mb_cur_max &&
                                            !(flags & SUPPRESS)) {
-                                               nconv = wcrtomb(mbp, wi, &mbs);
+                                               nconv = wcrtomb_l(mbp, wi, &mbs, loc);
                                                if (nconv == (size_t)-1)
                                                        goto input_failure;
                                        } else {
-                                               nconv = wcrtomb(mbbuf, wi,
-                                                   &mbs);
+                                               nconv = wcrtomb_l(mbbuf, wi,
+                                                   &mbs, loc);
                                                if (nconv == (size_t)-1)
                                                        goto input_failure;
                                                if (nconv > width) {
-                                                       __ungetwc(wi, fp);
+                                                       __ungetwc(wi, fp, loc);
                                                        break;
                                                }
                                                if (!(flags & SUPPRESS))
@@ -408,7 +449,6 @@ literal:
                                if (!(flags & SUPPRESS))
                                        nassigned++;
                        }
-                       nconversions++;
                        break;
 
                case CT_CCL:
@@ -418,20 +458,20 @@ literal:
                        /* take only those things in the class */
                        if ((flags & SUPPRESS) && (flags & LONG)) {
                                n = 0;
-                               while ((wi = __fgetwc(fp)) != WEOF &&
+                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
                                    width-- != 0 && INCCL(wi))
                                        n++;
                                if (wi != WEOF)
-                                       __ungetwc(wi, fp);
+                                       __ungetwc(wi, fp, loc);
                                if (n == 0)
                                        goto match_failure;
                        } else if (flags & LONG) {
                                p0 = p = va_arg(ap, wchar_t *);
-                               while ((wi = __fgetwc(fp)) != WEOF &&
+                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
                                    width-- != 0 && INCCL(wi))
                                        *p++ = (wchar_t)wi;
                                if (wi != WEOF)
-                                       __ungetwc(wi, fp);
+                                       __ungetwc(wi, fp, loc);
                                n = p - p0;
                                if (n == 0)
                                        goto match_failure;
@@ -442,16 +482,16 @@ literal:
                                        mbp = va_arg(ap, char *);
                                n = 0;
                                mbs = initial_mbs;
-                               while ((wi = __fgetwc(fp)) != WEOF &&
+                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
                                    width != 0 && INCCL(wi)) {
-                                       if (width >= MB_CUR_MAX &&
+                                       if (width >= mb_cur_max &&
                                           !(flags & SUPPRESS)) {
-                                               nconv = wcrtomb(mbp, wi, &mbs);
+                                               nconv = wcrtomb_l(mbp, wi, &mbs, loc);
                                                if (nconv == (size_t)-1)
                                                        goto input_failure;
                                        } else {
-                                               nconv = wcrtomb(mbbuf, wi,
-                                                   &mbs);
+                                               nconv = wcrtomb_l(mbbuf, wi,
+                                                   &mbs, loc);
                                                if (nconv == (size_t)-1)
                                                        goto input_failure;
                                                if (nconv > width)
@@ -466,14 +506,15 @@ literal:
                                        n++;
                                }
                                if (wi != WEOF)
-                                       __ungetwc(wi, fp);
+                                       __ungetwc(wi, fp, loc);
+                               if (n == 0)
+                                       goto match_failure;
                                if (!(flags & SUPPRESS)) {
                                        *mbp = 0;
                                        nassigned++;
                                }
                        }
                        nread += n;
-                       nconversions++;
                        break;
 
                case CT_STRING:
@@ -481,39 +522,39 @@ literal:
                        if (width == 0)
                                width = (size_t)~0;
                        if ((flags & SUPPRESS) && (flags & LONG)) {
-                               while ((wi = __fgetwc(fp)) != WEOF &&
+                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
                                    width-- != 0 &&
-                                   !iswspace(wi))
+                                   !iswspace_l(wi, loc))
                                        nread++;
                                if (wi != WEOF)
-                                       __ungetwc(wi, fp);
+                                       __ungetwc(wi, fp, loc);
                        } else if (flags & LONG) {
                                p0 = p = va_arg(ap, wchar_t *);
-                               while ((wi = __fgetwc(fp)) != WEOF &&
+                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
                                    width-- != 0 &&
-                                   !iswspace(wi)) {
+                                   !iswspace_l(wi, loc)) {
                                        *p++ = (wchar_t)wi;
                                        nread++;
                                }
                                if (wi != WEOF)
-                                       __ungetwc(wi, fp);
+                                       __ungetwc(wi, fp, loc);
                                *p = '\0';
                                nassigned++;
                        } else {
                                if (!(flags & SUPPRESS))
                                        mbp = va_arg(ap, char *);
                                mbs = initial_mbs;
-                               while ((wi = __fgetwc(fp)) != WEOF &&
+                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
                                    width != 0 &&
-                                   !iswspace(wi)) {
-                                       if (width >= MB_CUR_MAX &&
+                                   !iswspace_l(wi, loc)) {
+                                       if (width >= mb_cur_max &&
                                            !(flags & SUPPRESS)) {
-                                               nconv = wcrtomb(mbp, wi, &mbs);
+                                               nconv = wcrtomb_l(mbp, wi, &mbs, loc);
                                                if (nconv == (size_t)-1)
                                                        goto input_failure;
                                        } else {
-                                               nconv = wcrtomb(mbbuf, wi,
-                                                   &mbs);
+                                               nconv = wcrtomb_l(mbbuf, wi,
+                                                   &mbs, loc);
                                                if (nconv == (size_t)-1)
                                                        goto input_failure;
                                                if (nconv > width)
@@ -528,13 +569,12 @@ literal:
                                        nread++;
                                }
                                if (wi != WEOF)
-                                       __ungetwc(wi, fp);
+                                       __ungetwc(wi, fp, loc);
                                if (!(flags & SUPPRESS)) {
                                        *mbp = 0;
                                        nassigned++;
                                }
                        }
-                       nconversions++;
                        continue;
 
                case CT_INT:
@@ -544,7 +584,7 @@ literal:
                                width = sizeof(buf) / sizeof(*buf) - 1;
                        flags |= SIGNOK | NDIGITS | NZDIGITS;
                        for (p = buf; width; width--) {
-                               c = __fgetwc(fp);
+                               c = __fgetwc(fp, loc);
                                /*
                                 * Switch on the character; `goto ok'
                                 * if we accept it as a part of number.
@@ -628,7 +668,7 @@ literal:
                                 * for a number.  Stop accumulating digits.
                                 */
                                if (c != WEOF)
-                                       __ungetwc(c, fp);
+                                       __ungetwc(c, fp, loc);
                                break;
                ok:
                                /*
@@ -644,22 +684,22 @@ literal:
                         */
                        if (flags & NDIGITS) {
                                if (p > buf)
-                                       __ungetwc(*--p, fp);
+                                       __ungetwc(*--p, fp, loc);
                                goto match_failure;
                        }
                        c = p[-1];
                        if (c == 'x' || c == 'X') {
                                --p;
-                               __ungetwc(c, fp);
+                               __ungetwc(c, fp, loc);
                        }
                        if ((flags & SUPPRESS) == 0) {
                                uintmax_t res;
 
                                *p = 0;
                                if ((flags & UNSIGNED) == 0)
-                                   res = wcstoimax(buf, NULL, base);
+                                   res = wcstoimax_l(buf, NULL, base, loc);
                                else
-                                   res = wcstoumax(buf, NULL, base);
+                                   res = wcstoumax_l(buf, NULL, base, loc);
                                if (flags & POINTER)
                                        *va_arg(ap, void **) =
                                                        (void *)(uintptr_t)res;
@@ -682,45 +722,45 @@ literal:
                                nassigned++;
                        }
                        nread += p - buf;
-                       nconversions++;
                        break;
 
 #ifndef NO_FLOATING_POINT
                case CT_FLOAT:
+               {
+                       wchar_t *pbuf;
                        /* scan a floating point number as if by strtod */
-                       if (width == 0 || width > sizeof(buf) /
-                           sizeof(*buf) - 1)
-                               width = sizeof(buf) / sizeof(*buf) - 1;
-                       if ((width = parsefloat(fp, buf, buf + width)) == 0)
+                       if ((width = parsefloat(fp, &pbuf, width, loc)) == 0)
                                goto match_failure;
                        if ((flags & SUPPRESS) == 0) {
                                if (flags & LONGDBL) {
-                                       long double res = wcstold(buf, &p);
+                                       long double res = wcstold_l(pbuf, &p, loc);
                                        *va_arg(ap, long double *) = res;
                                } else if (flags & LONG) {
-                                       double res = wcstod(buf, &p);
+                                       double res = wcstod_l(pbuf, &p, loc);
                                        *va_arg(ap, double *) = res;
                                } else {
-                                       float res = wcstof(buf, &p);
+                                       float res = wcstof_l(pbuf, &p, loc);
                                        *va_arg(ap, float *) = res;
                                }
                                nassigned++;
                        }
                        nread += width;
-                       nconversions++;
                        break;
+               }
 #endif /* !NO_FLOATING_POINT */
                }
        }
 input_failure:
-       return (nconversions != 0 ? nassigned : EOF);
+       return (nassigned ? nassigned : EOF);
 match_failure:
        return (nassigned);
 }
 
 #ifndef NO_FLOATING_POINT
+extern char *__parsefloat_buf(size_t s);  /* see vfscanf-fbsd.c */
+
 static int
-parsefloat(FILE *fp, wchar_t *buf, wchar_t *end)
+parsefloat(FILE *fp, wchar_t **buf, size_t width, locale_t loc)
 {
        mbstate_t mbs;
        size_t nconv;
@@ -733,12 +773,22 @@ parsefloat(FILE *fp, wchar_t *buf, wchar_t *end)
        wchar_t c;
        wchar_t decpt;
        _Bool gotmantdig = 0, ishex = 0;
+       wchar_t *b;
+       wchar_t *e;
+       size_t s;
 
        mbs = initial_mbs;
-       nconv = mbrtowc(&decpt, localeconv()->decimal_point, MB_CUR_MAX, &mbs);
+
+       nconv = mbrtowc_l(&decpt, localeconv()->decimal_point, MB_CUR_MAX_L(loc), &mbs, loc);
        if (nconv == (size_t)-1 || nconv == (size_t)-2)
-               decpt = '.';    /* failsafe */
+               decpt = '.';    /* failsafe */
 
+       s = (width == 0 ? BUF : (width + 1));
+       if ((b = (wchar_t *)__parsefloat_buf(s * sizeof(wchar_t))) == NULL) {
+               *buf = NULL;
+               return 0;
+       }
+       e = b + (s - 1);
        /*
         * We set commit = p whenever the string we have read so far
         * constitutes a valid representation of a floating point
@@ -748,10 +798,10 @@ parsefloat(FILE *fp, wchar_t *buf, wchar_t *end)
         * always necessary to read at least one character that doesn't
         * match; thus, we can't short-circuit "infinity" or "nan(...)".
         */
-       commit = buf - 1;
+       commit = b - 1;
        c = WEOF;
-       for (p = buf; p < end; ) {
-               if ((c = __fgetwc(fp)) == WEOF)
+       for (p = b; width == 0 || p < e; ) {
+               if ((c = __fgetwc(fp, loc)) == WEOF)
                        break;
 reswitch:
                switch (state) {
@@ -809,7 +859,7 @@ reswitch:
                                if (c == ')') {
                                        commit = p;
                                        state = S_DONE;
-                               } else if (!iswalnum(c) && c != '_')
+                               } else if (!iswalnum_l(c, loc) && c != '_')
                                        goto parsedone;
                                break;
                        }
@@ -827,7 +877,7 @@ reswitch:
                                goto reswitch;
                        }
                case S_DIGITS:
-                       if ((ishex && iswxdigit(c)) || iswdigit(c))
+                       if ((ishex && iswxdigit_l(c, loc)) || iswdigit_l(c, loc))
                                gotmantdig = 1;
                        else {
                                state = S_FRAC;
@@ -844,7 +894,7 @@ reswitch:
                                        goto parsedone;
                                else
                                        state = S_EXP;
-                       } else if ((ishex && iswxdigit(c)) || iswdigit(c)) {
+                       } else if ((ishex && iswxdigit_l(c, loc)) || iswdigit_l(c, loc)) {
                                commit = p;
                                gotmantdig = 1;
                        } else
@@ -857,13 +907,26 @@ reswitch:
                        else
                                goto reswitch;
                case S_EXPDIGITS:
-                       if (iswdigit(c))
+                       if (iswdigit_l(c, loc))
                                commit = p;
                        else
                                goto parsedone;
                        break;
                default:
-                       abort();
+                       LIBC_ABORT("unknown state %d", state);
+               }
+               if (p >= e) {
+                       ssize_t diff = (p - b);
+                       ssize_t com = (commit - b);
+                       s += BUF;
+                       b = (wchar_t *)__parsefloat_buf(s * sizeof(wchar_t));
+                       if (b == NULL) {
+                               *buf = NULL;
+                               return 0;
+                       }
+                       e = b + (s - 1);
+                       p = b + diff;
+                       commit = b + com;
                }
                *p++ = c;
                c = WEOF;
@@ -871,10 +934,11 @@ reswitch:
 
 parsedone:
        if (c != WEOF)
-               __ungetwc(c, fp);
+               __ungetwc(c, fp, loc);
        while (commit < --p)
-               __ungetwc(*p, fp);
+               __ungetwc(*p, fp, loc);
        *++commit = '\0';
-       return (commit - buf);
+       *buf = b;
+       return (commit - b);
 }
 #endif
diff --git a/stdio/FreeBSD/vfwscanf.c.patch b/stdio/FreeBSD/vfwscanf.c.patch
deleted file mode 100644 (file)
index 7a22303..0000000
+++ /dev/null
@@ -1,589 +0,0 @@
-Index: vfwscanf.c
-===================================================================
---- vfwscanf.c (revision 55443)
-+++ vfwscanf.c (working copy)
-@@ -38,6 +38,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vfwscanf.c,v 1.17 2009/01/19 06:19:51 das Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <ctype.h>
- #include <inttypes.h>
-@@ -96,7 +98,7 @@
- #define       CT_FLOAT        4       /* %[efgEFG] conversion */
- #ifndef NO_FLOATING_POINT
--static int parsefloat(FILE *, wchar_t *, wchar_t *);
-+static int parsefloat(FILE *, wchar_t **, size_t, locale_t loc);
- #endif
- #define       INCCL(_c)       \
-@@ -115,16 +117,31 @@
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
--      ret = __vfwscanf(fp, fmt, ap);
-+      ret = __vfwscanf(fp, __current_locale(), fmt, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
- }
-+int
-+vfwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
-+    va_list ap)
-+{
-+      int ret;
-+
-+      NORMALIZE_LOCALE(loc);
-+      FLOCKFILE(fp);
-+      ORIENT(fp, 1);
-+      ret = __vfwscanf(fp, loc, fmt, ap);
-+      FUNLOCKFILE(fp);
-+      return (ret);
-+}
-+
- /*
-  * Non-MT-safe version.
-  */
--int
--__vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
-+__private_extern__ int
-+__vfwscanf(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
-+    va_list ap)
- {
-       wint_t c;               /* character from format, or conversion */
-       size_t width;           /* field width, or 0 */
-@@ -133,7 +150,6 @@
-       int flags;              /* flags as defined above */
-       wchar_t *p0;            /* saves original value of p when necessary */
-       int nassigned;          /* number of fields assigned */
--      int nconversions;       /* number of conversions */
-       int nread;              /* number of characters consumed from fp */
-       int base;               /* base argument to conversion function */
-       wchar_t buf[BUF];       /* buffer for numeric conversions */
-@@ -144,30 +160,36 @@
-       char *mbp;              /* multibyte string pointer for %c %s %[ */
-       size_t nconv;           /* number of bytes in mb. conversion */
-       char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */
-+      int index;              /* for %index$ */
-+      va_list ap_orig;        /* to reset ap to first argument */
-       mbstate_t mbs;
-+      int mb_cur_max = MB_CUR_MAX_L(loc);
-       /* `basefix' is used to avoid `if' tests in the integer scanner */
-       static short basefix[17] =
-               { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-       nassigned = 0;
--      nconversions = 0;
-       nread = 0;
-       ccls = ccle = NULL;
-+      va_copy(ap_orig, ap);
-       for (;;) {
-               c = *fmt++;
-               if (c == 0)
-                       return (nassigned);
--              if (iswspace(c)) {
--                      while ((c = __fgetwc(fp)) != WEOF &&
--                          iswspace(c))
-+              if (iswspace_l(c, loc)) {
-+                      while ((c = __fgetwc(fp, loc)) != WEOF &&
-+                          iswspace_l(c, loc))
-                               ;
-                       if (c != WEOF)
--                              __ungetwc(c, fp);
-+                              __ungetwc(c, fp, loc);
-                       continue;
-               }
--              if (c != '%')
-+              if (c != '%') {
-+                      if ((wi = __fgetwc(fp, loc)) == WEOF)
-+                              goto input_failure;
-                       goto literal;
-+              }
-               width = 0;
-               flags = 0;
-               /*
-@@ -177,16 +199,34 @@
- again:                c = *fmt++;
-               switch (c) {
-               case '%':
-+              /* Consume leading white space */
-+                      for(;;) {
-+                              if ((wi = __fgetwc(fp, loc)) == WEOF)
-+                                      goto input_failure;
-+                              if (!iswspace_l(wi, loc))
-+                                      break;
-+                              nread++;
-+                      }
- literal:
--                      if ((wi = __fgetwc(fp)) == WEOF)
--                              goto input_failure;
-                       if (wi != c) {
--                              __ungetwc(wi, fp);
--                              goto input_failure;
-+                              __ungetwc(wi, fp, loc);
-+                              goto match_failure;
-                       }
-                       nread++;
-                       continue;
-+              case '$':
-+                      index = width;
-+                      if (index < 1 || index > NL_ARGMAX || fmt[-3] != '%') {
-+                              goto input_failure;
-+                      }
-+                      width = 0;
-+                      va_end(ap);
-+                      va_copy(ap, ap_orig); /* reset to %1$ */
-+                      for (; index > 1; index--) {
-+                              va_arg(ap, void*);
-+                      }
-+                      goto again;
-               case '*':
-                       flags |= SUPPRESS;
-                       goto again;
-@@ -305,27 +345,28 @@
-                       break;
-               case 'n':
--                      nconversions++;
--                      if (flags & SUPPRESS)   /* ??? */
-+              {
-+                      void *ptr = va_arg(ap, void *);
-+                      if ((ptr == NULL) || (flags & SUPPRESS))        /* ??? */
-                               continue;
--                      if (flags & SHORTSHORT)
--                              *va_arg(ap, char *) = nread;
-+                      else if (flags & SHORTSHORT)
-+                              *(char *)ptr = nread;
-                       else if (flags & SHORT)
--                              *va_arg(ap, short *) = nread;
-+                              *(short *)ptr = nread;
-                       else if (flags & LONG)
--                              *va_arg(ap, long *) = nread;
-+                              *(long *)ptr = nread;
-                       else if (flags & LONGLONG)
--                              *va_arg(ap, long long *) = nread;
-+                              *(long long *)ptr = nread;
-                       else if (flags & INTMAXT)
--                              *va_arg(ap, intmax_t *) = nread;
-+                              *(intmax_t *)ptr = nread;
-                       else if (flags & SIZET)
--                              *va_arg(ap, size_t *) = nread;
-+                              *(size_t *)ptr = nread;
-                       else if (flags & PTRDIFFT)
--                              *va_arg(ap, ptrdiff_t *) = nread;
-+                              *(ptrdiff_t *)ptr = nread;
-                       else
--                              *va_arg(ap, int *) = nread;
-+                              *(int *)ptr = nread;
-                       continue;
--
-+              }
-               default:
-                       goto match_failure;
-@@ -341,11 +382,11 @@
-                * that suppress this.
-                */
-               if ((flags & NOSKIP) == 0) {
--                      while ((wi = __fgetwc(fp)) != WEOF && iswspace(wi))
-+                      while ((wi = __fgetwc(fp, loc)) != WEOF && iswspace_l(wi, loc))
-                               nread++;
-                       if (wi == WEOF)
-                               goto input_failure;
--                      __ungetwc(wi, fp);
-+                      __ungetwc(wi, fp, loc);
-               }
-               /*
-@@ -362,7 +403,7 @@
-                                       p = va_arg(ap, wchar_t *);
-                               n = 0;
-                               while (width-- != 0 &&
--                                  (wi = __fgetwc(fp)) != WEOF) {
-+                                  (wi = __fgetwc(fp, loc)) != WEOF) {
-                                       if (!(flags & SUPPRESS))
-                                               *p++ = (wchar_t)wi;
-                                       n++;
-@@ -378,19 +419,19 @@
-                               n = 0;
-                               mbs = initial_mbs;
-                               while (width != 0 &&
--                                  (wi = __fgetwc(fp)) != WEOF) {
--                                      if (width >= MB_CUR_MAX &&
-+                                  (wi = __fgetwc(fp, loc)) != WEOF) {
-+                                      if (width >= mb_cur_max &&
-                                           !(flags & SUPPRESS)) {
--                                              nconv = wcrtomb(mbp, wi, &mbs);
-+                                              nconv = wcrtomb_l(mbp, wi, &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                       } else {
--                                              nconv = wcrtomb(mbbuf, wi,
--                                                  &mbs);
-+                                              nconv = wcrtomb_l(mbbuf, wi,
-+                                                  &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                               if (nconv > width) {
--                                                      __ungetwc(wi, fp);
-+                                                      __ungetwc(wi, fp, loc);
-                                                       break;
-                                               }
-                                               if (!(flags & SUPPRESS))
-@@ -408,7 +449,6 @@
-                               if (!(flags & SUPPRESS))
-                                       nassigned++;
-                       }
--                      nconversions++;
-                       break;
-               case CT_CCL:
-@@ -418,20 +458,20 @@
-                       /* take only those things in the class */
-                       if ((flags & SUPPRESS) && (flags & LONG)) {
-                               n = 0;
--                              while ((wi = __fgetwc(fp)) != WEOF &&
-+                              while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 && INCCL(wi))
-                                       n++;
-                               if (wi != WEOF)
--                                      __ungetwc(wi, fp);
-+                                      __ungetwc(wi, fp, loc);
-                               if (n == 0)
-                                       goto match_failure;
-                       } else if (flags & LONG) {
-                               p0 = p = va_arg(ap, wchar_t *);
--                              while ((wi = __fgetwc(fp)) != WEOF &&
-+                              while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 && INCCL(wi))
-                                       *p++ = (wchar_t)wi;
-                               if (wi != WEOF)
--                                      __ungetwc(wi, fp);
-+                                      __ungetwc(wi, fp, loc);
-                               n = p - p0;
-                               if (n == 0)
-                                       goto match_failure;
-@@ -442,16 +482,16 @@
-                                       mbp = va_arg(ap, char *);
-                               n = 0;
-                               mbs = initial_mbs;
--                              while ((wi = __fgetwc(fp)) != WEOF &&
-+                              while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width != 0 && INCCL(wi)) {
--                                      if (width >= MB_CUR_MAX &&
-+                                      if (width >= mb_cur_max &&
-                                          !(flags & SUPPRESS)) {
--                                              nconv = wcrtomb(mbp, wi, &mbs);
-+                                              nconv = wcrtomb_l(mbp, wi, &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                       } else {
--                                              nconv = wcrtomb(mbbuf, wi,
--                                                  &mbs);
-+                                              nconv = wcrtomb_l(mbbuf, wi,
-+                                                  &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                               if (nconv > width)
-@@ -466,14 +506,15 @@
-                                       n++;
-                               }
-                               if (wi != WEOF)
--                                      __ungetwc(wi, fp);
-+                                      __ungetwc(wi, fp, loc);
-+                              if (n == 0)
-+                                      goto match_failure;
-                               if (!(flags & SUPPRESS)) {
-                                       *mbp = 0;
-                                       nassigned++;
-                               }
-                       }
-                       nread += n;
--                      nconversions++;
-                       break;
-               case CT_STRING:
-@@ -481,39 +522,39 @@
-                       if (width == 0)
-                               width = (size_t)~0;
-                       if ((flags & SUPPRESS) && (flags & LONG)) {
--                              while ((wi = __fgetwc(fp)) != WEOF &&
-+                              while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 &&
--                                  !iswspace(wi))
-+                                  !iswspace_l(wi, loc))
-                                       nread++;
-                               if (wi != WEOF)
--                                      __ungetwc(wi, fp);
-+                                      __ungetwc(wi, fp, loc);
-                       } else if (flags & LONG) {
-                               p0 = p = va_arg(ap, wchar_t *);
--                              while ((wi = __fgetwc(fp)) != WEOF &&
-+                              while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 &&
--                                  !iswspace(wi)) {
-+                                  !iswspace_l(wi, loc)) {
-                                       *p++ = (wchar_t)wi;
-                                       nread++;
-                               }
-                               if (wi != WEOF)
--                                      __ungetwc(wi, fp);
-+                                      __ungetwc(wi, fp, loc);
-                               *p = '\0';
-                               nassigned++;
-                       } else {
-                               if (!(flags & SUPPRESS))
-                                       mbp = va_arg(ap, char *);
-                               mbs = initial_mbs;
--                              while ((wi = __fgetwc(fp)) != WEOF &&
-+                              while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width != 0 &&
--                                  !iswspace(wi)) {
--                                      if (width >= MB_CUR_MAX &&
-+                                  !iswspace_l(wi, loc)) {
-+                                      if (width >= mb_cur_max &&
-                                           !(flags & SUPPRESS)) {
--                                              nconv = wcrtomb(mbp, wi, &mbs);
-+                                              nconv = wcrtomb_l(mbp, wi, &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                       } else {
--                                              nconv = wcrtomb(mbbuf, wi,
--                                                  &mbs);
-+                                              nconv = wcrtomb_l(mbbuf, wi,
-+                                                  &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                               if (nconv > width)
-@@ -528,13 +569,12 @@
-                                       nread++;
-                               }
-                               if (wi != WEOF)
--                                      __ungetwc(wi, fp);
-+                                      __ungetwc(wi, fp, loc);
-                               if (!(flags & SUPPRESS)) {
-                                       *mbp = 0;
-                                       nassigned++;
-                               }
-                       }
--                      nconversions++;
-                       continue;
-               case CT_INT:
-@@ -544,7 +584,7 @@
-                               width = sizeof(buf) / sizeof(*buf) - 1;
-                       flags |= SIGNOK | NDIGITS | NZDIGITS;
-                       for (p = buf; width; width--) {
--                              c = __fgetwc(fp);
-+                              c = __fgetwc(fp, loc);
-                               /*
-                                * Switch on the character; `goto ok'
-                                * if we accept it as a part of number.
-@@ -628,7 +668,7 @@
-                                * for a number.  Stop accumulating digits.
-                                */
-                               if (c != WEOF)
--                                      __ungetwc(c, fp);
-+                                      __ungetwc(c, fp, loc);
-                               break;
-               ok:
-                               /*
-@@ -644,22 +684,22 @@
-                        */
-                       if (flags & NDIGITS) {
-                               if (p > buf)
--                                      __ungetwc(*--p, fp);
-+                                      __ungetwc(*--p, fp, loc);
-                               goto match_failure;
-                       }
-                       c = p[-1];
-                       if (c == 'x' || c == 'X') {
-                               --p;
--                              __ungetwc(c, fp);
-+                              __ungetwc(c, fp, loc);
-                       }
-                       if ((flags & SUPPRESS) == 0) {
-                               uintmax_t res;
-                               *p = 0;
-                               if ((flags & UNSIGNED) == 0)
--                                  res = wcstoimax(buf, NULL, base);
-+                                  res = wcstoimax_l(buf, NULL, base, loc);
-                               else
--                                  res = wcstoumax(buf, NULL, base);
-+                                  res = wcstoumax_l(buf, NULL, base, loc);
-                               if (flags & POINTER)
-                                       *va_arg(ap, void **) =
-                                                       (void *)(uintptr_t)res;
-@@ -682,45 +722,45 @@
-                               nassigned++;
-                       }
-                       nread += p - buf;
--                      nconversions++;
-                       break;
- #ifndef NO_FLOATING_POINT
-               case CT_FLOAT:
-+              {
-+                      wchar_t *pbuf;
-                       /* scan a floating point number as if by strtod */
--                      if (width == 0 || width > sizeof(buf) /
--                          sizeof(*buf) - 1)
--                              width = sizeof(buf) / sizeof(*buf) - 1;
--                      if ((width = parsefloat(fp, buf, buf + width)) == 0)
-+                      if ((width = parsefloat(fp, &pbuf, width, loc)) == 0)
-                               goto match_failure;
-                       if ((flags & SUPPRESS) == 0) {
-                               if (flags & LONGDBL) {
--                                      long double res = wcstold(buf, &p);
-+                                      long double res = wcstold_l(pbuf, &p, loc);
-                                       *va_arg(ap, long double *) = res;
-                               } else if (flags & LONG) {
--                                      double res = wcstod(buf, &p);
-+                                      double res = wcstod_l(pbuf, &p, loc);
-                                       *va_arg(ap, double *) = res;
-                               } else {
--                                      float res = wcstof(buf, &p);
-+                                      float res = wcstof_l(pbuf, &p, loc);
-                                       *va_arg(ap, float *) = res;
-                               }
-                               nassigned++;
-                       }
-                       nread += width;
--                      nconversions++;
-                       break;
-+              }
- #endif /* !NO_FLOATING_POINT */
-               }
-       }
- input_failure:
--      return (nconversions != 0 ? nassigned : EOF);
-+      return (nassigned ? nassigned : EOF);
- match_failure:
-       return (nassigned);
- }
- #ifndef NO_FLOATING_POINT
-+extern char *__parsefloat_buf(size_t s);  /* see vfscanf-fbsd.c */
-+
- static int
--parsefloat(FILE *fp, wchar_t *buf, wchar_t *end)
-+parsefloat(FILE *fp, wchar_t **buf, size_t width, locale_t loc)
- {
-       mbstate_t mbs;
-       size_t nconv;
-@@ -733,12 +773,22 @@
-       wchar_t c;
-       wchar_t decpt;
-       _Bool gotmantdig = 0, ishex = 0;
-+      wchar_t *b;
-+      wchar_t *e;
-+      size_t s;
-       mbs = initial_mbs;
--      nconv = mbrtowc(&decpt, localeconv()->decimal_point, MB_CUR_MAX, &mbs);
-+
-+      nconv = mbrtowc_l(&decpt, localeconv()->decimal_point, MB_CUR_MAX_L(loc), &mbs, loc);
-       if (nconv == (size_t)-1 || nconv == (size_t)-2)
--              decpt = '.';    /* failsafe */
-+              decpt = '.';    /* failsafe */
-+      s = (width == 0 ? BUF : (width + 1));
-+      if ((b = (wchar_t *)__parsefloat_buf(s * sizeof(wchar_t))) == NULL) {
-+              *buf = NULL;
-+              return 0;
-+      }
-+      e = b + (s - 1);
-       /*
-        * We set commit = p whenever the string we have read so far
-        * constitutes a valid representation of a floating point
-@@ -748,10 +798,10 @@
-        * always necessary to read at least one character that doesn't
-        * match; thus, we can't short-circuit "infinity" or "nan(...)".
-        */
--      commit = buf - 1;
-+      commit = b - 1;
-       c = WEOF;
--      for (p = buf; p < end; ) {
--              if ((c = __fgetwc(fp)) == WEOF)
-+      for (p = b; width == 0 || p < e; ) {
-+              if ((c = __fgetwc(fp, loc)) == WEOF)
-                       break;
- reswitch:
-               switch (state) {
-@@ -809,7 +859,7 @@
-                               if (c == ')') {
-                                       commit = p;
-                                       state = S_DONE;
--                              } else if (!iswalnum(c) && c != '_')
-+                              } else if (!iswalnum_l(c, loc) && c != '_')
-                                       goto parsedone;
-                               break;
-                       }
-@@ -827,7 +877,7 @@
-                               goto reswitch;
-                       }
-               case S_DIGITS:
--                      if ((ishex && iswxdigit(c)) || iswdigit(c))
-+                      if ((ishex && iswxdigit_l(c, loc)) || iswdigit_l(c, loc))
-                               gotmantdig = 1;
-                       else {
-                               state = S_FRAC;
-@@ -844,7 +894,7 @@
-                                       goto parsedone;
-                               else
-                                       state = S_EXP;
--                      } else if ((ishex && iswxdigit(c)) || iswdigit(c)) {
-+                      } else if ((ishex && iswxdigit_l(c, loc)) || iswdigit_l(c, loc)) {
-                               commit = p;
-                               gotmantdig = 1;
-                       } else
-@@ -857,24 +907,38 @@
-                       else
-                               goto reswitch;
-               case S_EXPDIGITS:
--                      if (iswdigit(c))
-+                      if (iswdigit_l(c, loc))
-                               commit = p;
-                       else
-                               goto parsedone;
-                       break;
-               default:
--                      abort();
-+                      LIBC_ABORT("unknown state %d", state);
-               }
-+              if (p >= e) {
-+                      ssize_t diff = (p - b);
-+                      ssize_t com = (commit - b);
-+                      s += BUF;
-+                      b = (wchar_t *)__parsefloat_buf(s * sizeof(wchar_t));
-+                      if (b == NULL) {
-+                              *buf = NULL;
-+                              return 0;
-+                      }
-+                      e = b + (s - 1);
-+                      p = b + diff;
-+                      commit = b + com;
-+              }
-               *p++ = c;
-               c = WEOF;
-       }
- parsedone:
-       if (c != WEOF)
--              __ungetwc(c, fp);
-+              __ungetwc(c, fp, loc);
-       while (commit < --p)
--              __ungetwc(*p, fp);
-+              __ungetwc(*p, fp, loc);
-       *++commit = '\0';
--      return (commit - buf);
-+      *buf = b;
-+      return (commit - b);
- }
- #endif
index b11af0d74338366ce799c42fc7c5a2fa321ab52c..894cd79bcf847371f5506591d802b73eb48e2fa0 100644 (file)
@@ -36,11 +36,21 @@ static char sccsid[] = "@(#)vprintf.c       8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vprintf.c,v 1.11 2007/01/09 00:28:08 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 
 int
 vprintf(const char * __restrict fmt, __va_list ap)
 {
 
-       return (vfprintf(stdout, fmt, ap));
+       return (vfprintf_l(stdout, __current_locale(), fmt, ap));
+}
+
+int
+vprintf_l(locale_t loc, const char * __restrict fmt, __va_list ap)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfprintf_l will */
+       return (vfprintf_l(stdout, loc, fmt, ap));
 }
diff --git a/stdio/FreeBSD/vprintf.c.patch b/stdio/FreeBSD/vprintf.c.patch
deleted file mode 100644 (file)
index 5616998..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- vprintf.c.bsdnew   2009-11-11 13:33:19.000000000 -0800
-+++ vprintf.c  2009-11-11 13:33:19.000000000 -0800
-@@ -36,11 +36,21 @@ static char sccsid[] = "@(#)vprintf.c      8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vprintf.c,v 1.11 2007/01/09 00:28:08 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- int
- vprintf(const char * __restrict fmt, __va_list ap)
- {
--      return (vfprintf(stdout, fmt, ap));
-+      return (vfprintf_l(stdout, __current_locale(), fmt, ap));
-+}
-+
-+int
-+vprintf_l(locale_t loc, const char * __restrict fmt, __va_list ap)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfprintf_l will */
-+      return (vfprintf_l(stdout, loc, fmt, ap));
- }
index 7792970ac6356f25de34f422eda6621828301af9..397382e49b1acc32b170fa11583073980f7dc940 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vscanf.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vscanf.c,v 1.13 2007/01/09 00:28:08 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <stdio.h>
 #include "un-namespace.h"
@@ -50,7 +52,22 @@ vscanf(fmt, ap)
        int retval;
 
        FLOCKFILE(stdin);
-       retval = __svfscanf(stdin, fmt, ap);
+       retval = __svfscanf_l(stdin, __current_locale(), fmt, ap);
+       FUNLOCKFILE(stdin);
+       return (retval);
+}
+
+int
+vscanf_l(loc, fmt, ap)
+       locale_t loc;
+       const char * __restrict fmt;
+       __va_list ap;
+{
+       int retval;
+
+       NORMALIZE_LOCALE(loc);
+       FLOCKFILE(stdin);
+       retval = __svfscanf_l(stdin, loc, fmt, ap);
        FUNLOCKFILE(stdin);
        return (retval);
 }
diff --git a/stdio/FreeBSD/vscanf.c.patch b/stdio/FreeBSD/vscanf.c.patch
deleted file mode 100644 (file)
index 26c561c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- vscanf.c.bsdnew    2009-11-11 13:33:19.000000000 -0800
-+++ vscanf.c   2009-11-11 13:33:19.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vscanf.c 8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vscanf.c,v 1.13 2007/01/09 00:28:08 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <stdio.h>
- #include "un-namespace.h"
-@@ -50,7 +52,22 @@ vscanf(fmt, ap)
-       int retval;
-       FLOCKFILE(stdin);
--      retval = __svfscanf(stdin, fmt, ap);
-+      retval = __svfscanf_l(stdin, __current_locale(), fmt, ap);
-+      FUNLOCKFILE(stdin);
-+      return (retval);
-+}
-+
-+int
-+vscanf_l(loc, fmt, ap)
-+      locale_t loc;
-+      const char * __restrict fmt;
-+      __va_list ap;
-+{
-+      int retval;
-+
-+      NORMALIZE_LOCALE(loc);
-+      FLOCKFILE(stdin);
-+      retval = __svfscanf_l(stdin, loc, fmt, ap);
-       FUNLOCKFILE(stdin);
-       return (retval);
- }
index 1a20c99dd77780b2b421f047ca857bc40da47c10..5f9a2958f67585e65129a47f0302ff2f4adb5e43 100644 (file)
@@ -36,19 +36,25 @@ static char sccsid[] = "@(#)vsnprintf.c     8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vsnprintf.c,v 1.24 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdio.h>
 #include "local.h"
 
 int
-vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt,
+vsnprintf_l(char * __restrict str, size_t n, locale_t loc, const char * __restrict fmt,
     __va_list ap)
 {
        size_t on;
        int ret;
        char dummy[2];
        FILE f;
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
 
+       NORMALIZE_LOCALE(loc);
        on = n;
        if (n != 0)
                n--;
@@ -67,8 +73,15 @@ vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt,
        f._bf._size = f._w = n;
        f._orientation = 0;
        memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, fmt, ap);
+       ret = __vfprintf(&f, loc, fmt, ap);
        if (on > 0)
                *f._p = '\0';
        return (ret);
 }
+
+int
+vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt,
+    __va_list ap)
+{
+       return vsnprintf_l(str, n, __current_locale(), fmt, ap);
+}
diff --git a/stdio/FreeBSD/vsnprintf.c.patch b/stdio/FreeBSD/vsnprintf.c.patch
deleted file mode 100644 (file)
index a765aae..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
---- vsnprintf.c.orig   2009-11-30 16:15:30.000000000 -0800
-+++ vsnprintf.c        2009-12-03 15:20:43.000000000 -0800
-@@ -36,19 +36,25 @@ static char sccsid[] = "@(#)vsnprintf.c    
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vsnprintf.c,v 1.24 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdio.h>
- #include "local.h"
- int
--vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt,
-+vsnprintf_l(char * __restrict str, size_t n, locale_t loc, const char * __restrict fmt,
-     __va_list ap)
- {
-       size_t on;
-       int ret;
-       char dummy[2];
-       FILE f;
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-+      NORMALIZE_LOCALE(loc);
-       on = n;
-       if (n != 0)
-               n--;
-@@ -67,8 +73,15 @@ vsnprintf(char * __restrict str, size_t 
-       f._bf._size = f._w = n;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
--      ret = __vfprintf(&f, fmt, ap);
-+      ret = __vfprintf(&f, loc, fmt, ap);
-       if (on > 0)
-               *f._p = '\0';
-       return (ret);
- }
-+
-+int
-+vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt,
-+    __va_list ap)
-+{
-+      return vsnprintf_l(str, n, __current_locale(), fmt, ap);
-+}
index 6cbc3681dc679b613e89d17a28f668e140983b20..9b85352cb44617cec43a34b34d46b0ca75f264e6 100644 (file)
@@ -36,23 +36,35 @@ static char sccsid[] = "@(#)vsprintf.c      8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <limits.h>
 #include "local.h"
 
 int
-vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
+vsprintf_l(char * __restrict str, locale_t loc, const char * __restrict fmt, __va_list ap)
 {
        int ret;
        FILE f;
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
 
+       NORMALIZE_LOCALE(loc);
        f._file = -1;
        f._flags = __SWR | __SSTR;
        f._bf._base = f._p = (unsigned char *)str;
        f._bf._size = f._w = INT_MAX;
        f._orientation = 0;
        memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, fmt, ap);
+       ret = __vfprintf(&f, loc, fmt, ap);
        *f._p = 0;
        return (ret);
 }
+
+int
+vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
+{
+       return vsprintf_l(str, __current_locale(), fmt, ap);
+}
diff --git a/stdio/FreeBSD/vsprintf.c.patch b/stdio/FreeBSD/vsprintf.c.patch
deleted file mode 100644 (file)
index 1a59860..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
---- vsprintf.c.orig    2009-11-30 16:15:30.000000000 -0800
-+++ vsprintf.c 2009-12-03 15:20:55.000000000 -0800
-@@ -36,23 +36,35 @@ static char sccsid[] = "@(#)vsprintf.c     8
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <limits.h>
- #include "local.h"
- int
--vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
-+vsprintf_l(char * __restrict str, locale_t loc, const char * __restrict fmt, __va_list ap)
- {
-       int ret;
-       FILE f;
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-+      NORMALIZE_LOCALE(loc);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = INT_MAX;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
--      ret = __vfprintf(&f, fmt, ap);
-+      ret = __vfprintf(&f, loc, fmt, ap);
-       *f._p = 0;
-       return (ret);
- }
-+
-+int
-+vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
-+{
-+      return vsprintf_l(str, __current_locale(), fmt, ap);
-+}
index 86a3837bbf9a53a7eadf2eed7595bd4464611e87..71442599d2a6cc57fc217f126577662db99809a6 100644 (file)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdio.h>
 #include <string.h>
 #include "local.h"
@@ -55,12 +57,16 @@ eofread(cookie, buf, len)
 }
 
 int
-vsscanf(str, fmt, ap)
+vsscanf_l(str, loc, fmt, ap)
        const char * __restrict str;
+       locale_t loc;
        const char * __restrict fmt;
        __va_list ap;
 {
        FILE f;
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
 
        f._file = -1;
        f._flags = __SRD;
@@ -71,5 +77,15 @@ vsscanf(str, fmt, ap)
        f._lb._base = NULL;
        f._orientation = 0;
        memset(&f._mbstate, 0, sizeof(mbstate_t));
-       return (__svfscanf(&f, fmt, ap));
+       return (__svfscanf_l(&f, loc, fmt, ap));
 }
+
+int
+vsscanf(str, fmt, ap)
+       const char * __restrict str;
+       const char * __restrict fmt;
+       __va_list ap;
+{
+       return vsscanf_l(str, __current_locale(), fmt, ap);
+}
+
diff --git a/stdio/FreeBSD/vsscanf.c.patch b/stdio/FreeBSD/vsscanf.c.patch
deleted file mode 100644 (file)
index 1f13645..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
---- vsscanf.c.orig     2011-03-01 17:54:44.000000000 -0800
-+++ vsscanf.c  2011-03-01 18:03:46.000000000 -0800
-@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vsscanf.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdio.h>
- #include <string.h>
- #include "local.h"
-@@ -55,12 +57,16 @@ eofread(cookie, buf, len)
- }
- int
--vsscanf(str, fmt, ap)
-+vsscanf_l(str, loc, fmt, ap)
-       const char * __restrict str;
-+      locale_t loc;
-       const char * __restrict fmt;
-       __va_list ap;
- {
-       FILE f;
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-       f._file = -1;
-       f._flags = __SRD;
-@@ -71,5 +77,15 @@ vsscanf(str, fmt, ap)
-       f._lb._base = NULL;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
--      return (__svfscanf(&f, fmt, ap));
-+      return (__svfscanf_l(&f, loc, fmt, ap));
- }
-+
-+int
-+vsscanf(str, fmt, ap)
-+      const char * __restrict str;
-+      const char * __restrict fmt;
-+      __va_list ap;
-+{
-+      return vsscanf_l(str, __current_locale(), fmt, ap);
-+}
-+
index d2911c5526408d8e4152334d4b69616be3ab0241..4227e74d93b93f04308858354d386605e9454249 100644 (file)
@@ -33,6 +33,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.16 2002/08/21 16:19:57 mik
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.7 2008/04/17 22:17:54 jhb Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -40,8 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.7 2008/04/17 22:17:54 jhb
 #include "local.h"
 
 int
-vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
-    __va_list ap)
+vswprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
+    const wchar_t * __restrict fmt, __va_list ap)
 {
        static const mbstate_t initial;
        mbstate_t mbs;
@@ -49,7 +51,11 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
        char *mbp;
        int ret, sverrno;
        size_t nwc;
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
 
+       NORMALIZE_LOCALE(loc);
        if (n == 0) {
                errno = EINVAL;
                return (-1);
@@ -65,7 +71,7 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
        f._bf._size = f._w = 127;               /* Leave room for the NUL */
        f._orientation = 0;
        memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfwprintf(&f, fmt, ap);
+       ret = __vfwprintf(&f, loc, fmt, ap);
        if (ret < 0) {
                sverrno = errno;
                free(f._bf._base);
@@ -79,7 +85,7 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
         * fputwc() did in __vfwprintf().
         */
        mbs = initial;
-       nwc = mbsrtowcs(s, (const char **)&mbp, n, &mbs);
+       nwc = mbsrtowcs_l(s, (const char **)&mbp, n, &mbs, loc);
        free(f._bf._base);
        if (nwc == (size_t)-1) {
                errno = EILSEQ;
@@ -93,3 +99,10 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
 
        return (ret);
 }
+
+int
+vswprintf(wchar_t * __restrict s, size_t n,
+    const wchar_t * __restrict fmt, __va_list ap)
+{
+       return vswprintf_l(s, n, __current_locale(), fmt, ap);
+}
diff --git a/stdio/FreeBSD/vswprintf.c.patch b/stdio/FreeBSD/vswprintf.c.patch
deleted file mode 100644 (file)
index 9e5555c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
---- vswprintf.c.orig   2009-11-30 16:15:30.000000000 -0800
-+++ vswprintf.c        2009-12-03 15:21:59.000000000 -0800
-@@ -33,6 +33,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdio/va
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.7 2008/04/17 22:17:54 jhb Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
-@@ -40,8 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
- #include "local.h"
- int
--vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
--    __va_list ap)
-+vswprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
-+    const wchar_t * __restrict fmt, __va_list ap)
- {
-       static const mbstate_t initial;
-       mbstate_t mbs;
-@@ -49,7 +51,11 @@ vswprintf(wchar_t * __restrict s, size_t
-       char *mbp;
-       int ret, sverrno;
-       size_t nwc;
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-+      NORMALIZE_LOCALE(loc);
-       if (n == 0) {
-               errno = EINVAL;
-               return (-1);
-@@ -65,7 +71,7 @@ vswprintf(wchar_t * __restrict s, size_t
-       f._bf._size = f._w = 127;               /* Leave room for the NUL */
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
--      ret = __vfwprintf(&f, fmt, ap);
-+      ret = __vfwprintf(&f, loc, fmt, ap);
-       if (ret < 0) {
-               sverrno = errno;
-               free(f._bf._base);
-@@ -79,7 +85,7 @@ vswprintf(wchar_t * __restrict s, size_t
-        * fputwc() did in __vfwprintf().
-        */
-       mbs = initial;
--      nwc = mbsrtowcs(s, (const char **)&mbp, n, &mbs);
-+      nwc = mbsrtowcs_l(s, (const char **)&mbp, n, &mbs, loc);
-       free(f._bf._base);
-       if (nwc == (size_t)-1) {
-               errno = EILSEQ;
-@@ -93,3 +99,10 @@ vswprintf(wchar_t * __restrict s, size_t
-       return (ret);
- }
-+
-+int
-+vswprintf(wchar_t * __restrict s, size_t n,
-+    const wchar_t * __restrict fmt, __va_list ap)
-+{
-+      return vswprintf_l(s, n, __current_locale(), fmt, ap);
-+}
index 1c2648fc7462bd4d43e8f5e17ea04823ff213b32..d688164f639a814322ccb3b318ca9414774efcfe 100644 (file)
@@ -39,6 +39,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.11 2002/08/21 16:19:57 mike
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vswscanf.c,v 1.6 2009/01/15 18:53:52 rdivacky Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -57,7 +59,7 @@ eofread(void *cookie, char *buf, int len)
 }
 
 int
-vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
+vswscanf_l(const wchar_t * __restrict str, locale_t loc, const wchar_t * __restrict fmt,
     va_list ap)
 {
        static const mbstate_t initial;
@@ -67,16 +69,20 @@ vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
        size_t mlen;
        int r;
        const wchar_t *strp;
+       struct __sFILEX ext;
+       f._extra = &ext;
+       INITEXTRA(&f);
 
+       NORMALIZE_LOCALE(loc);
        /*
         * XXX Convert the wide character string to multibyte, which
         * __vfwscanf() will convert back to wide characters.
         */
-       if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX + 1)) == NULL)
+       if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX_L(loc) + 1)) == NULL)
                return (EOF);
        mbs = initial;
        strp = str;
-       if ((mlen = wcsrtombs(mbstr, &strp, SIZE_T_MAX, &mbs)) == (size_t)-1) {
+       if ((mlen = wcsrtombs_l(mbstr, &strp, SIZE_T_MAX, &mbs, loc)) == (size_t)-1) {
                free(mbstr);
                return (EOF);
        }
@@ -89,8 +95,16 @@ vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
        f._lb._base = NULL;
        f._orientation = 0;
        memset(&f._mbstate, 0, sizeof(mbstate_t));
-       r = __vfwscanf(&f, fmt, ap);
+       r = __vfwscanf(&f, loc, fmt, ap);
        free(mbstr);
 
        return (r);
 }
+
+int
+vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
+    va_list ap)
+{
+       return vswscanf_l(str, __current_locale(), fmt, ap);
+}
+
diff --git a/stdio/FreeBSD/vswscanf.c.patch b/stdio/FreeBSD/vswscanf.c.patch
deleted file mode 100644 (file)
index a0a7584..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
---- vswscanf.c.orig    2009-11-30 16:15:30.000000000 -0800
-+++ vswscanf.c 2009-12-03 15:21:47.000000000 -0800
-@@ -39,6 +39,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdio/vs
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vswscanf.c,v 1.6 2009/01/15 18:53:52 rdivacky Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <stdarg.h>
- #include <stdio.h>
-@@ -57,7 +59,7 @@ eofread(void *cookie, char *buf, int len
- }
- int
--vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
-+vswscanf_l(const wchar_t * __restrict str, locale_t loc, const wchar_t * __restrict fmt,
-     va_list ap)
- {
-       static const mbstate_t initial;
-@@ -67,16 +69,20 @@ vswscanf(const wchar_t * __restrict str,
-       size_t mlen;
-       int r;
-       const wchar_t *strp;
-+      struct __sFILEX ext;
-+      f._extra = &ext;
-+      INITEXTRA(&f);
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * XXX Convert the wide character string to multibyte, which
-        * __vfwscanf() will convert back to wide characters.
-        */
--      if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX + 1)) == NULL)
-+      if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX_L(loc) + 1)) == NULL)
-               return (EOF);
-       mbs = initial;
-       strp = str;
--      if ((mlen = wcsrtombs(mbstr, &strp, SIZE_T_MAX, &mbs)) == (size_t)-1) {
-+      if ((mlen = wcsrtombs_l(mbstr, &strp, SIZE_T_MAX, &mbs, loc)) == (size_t)-1) {
-               free(mbstr);
-               return (EOF);
-       }
-@@ -89,8 +95,16 @@ vswscanf(const wchar_t * __restrict str,
-       f._lb._base = NULL;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
--      r = __vfwscanf(&f, fmt, ap);
-+      r = __vfwscanf(&f, loc, fmt, ap);
-       free(mbstr);
-       return (r);
- }
-+
-+int
-+vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
-+    va_list ap)
-+{
-+      return vswscanf_l(str, __current_locale(), fmt, ap);
-+}
-+
index 4390c0696fda3810343b5fbe5663f69586087384..634f06d78e8dd1d3c38bedcb2fd8b995e380a5a9 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -35,5 +37,13 @@ int
 vwprintf(const wchar_t * __restrict fmt, va_list ap)
 {
 
-       return (vfwprintf(stdout, fmt, ap));
+       return (vfwprintf_l(stdout, __current_locale(), fmt, ap));
+}
+
+int
+vwprintf_l(locale_t loc, const wchar_t * __restrict fmt, va_list ap)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
+       return (vfwprintf_l(stdout, loc, fmt, ap));
 }
diff --git a/stdio/FreeBSD/vwprintf.c.patch b/stdio/FreeBSD/vwprintf.c.patch
deleted file mode 100644 (file)
index 2c01963..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- vwprintf.c.orig    2003-05-20 15:22:44.000000000 -0700
-+++ vwprintf.c 2005-02-23 17:05:10.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -35,5 +37,13 @@
- vwprintf(const wchar_t * __restrict fmt, va_list ap)
- {
--      return (vfwprintf(stdout, fmt, ap));
-+      return (vfwprintf_l(stdout, __current_locale(), fmt, ap));
-+}
-+
-+int
-+vwprintf_l(locale_t loc, const wchar_t * __restrict fmt, va_list ap)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
-+      return (vfwprintf_l(stdout, loc, fmt, ap));
- }
index 6e103d5485d2e09f6f169251dacb749628f730fb..3b2fb2891e7f2897493844230c752759ca19131e 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/vwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -35,5 +37,13 @@ int
 vwscanf(const wchar_t * __restrict fmt, va_list ap)
 {
 
-       return (vfwscanf(stdin, fmt, ap));
+       return (vfwscanf_l(stdin, __current_locale(), fmt, ap));
+}
+
+int
+vwscanf_l(locale_t loc, const wchar_t * __restrict fmt, va_list ap)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
+       return (vfwscanf_l(stdin, loc, fmt, ap));
 }
diff --git a/stdio/FreeBSD/vwscanf.c.patch b/stdio/FreeBSD/vwscanf.c.patch
deleted file mode 100644 (file)
index 049cc49..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- vwscanf.c.orig     2003-05-20 15:22:44.000000000 -0700
-+++ vwscanf.c  2005-02-23 17:06:42.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/vwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -35,5 +37,13 @@
- vwscanf(const wchar_t * __restrict fmt, va_list ap)
- {
--      return (vfwscanf(stdin, fmt, ap));
-+      return (vfwscanf_l(stdin, __current_locale(), fmt, ap));
-+}
-+
-+int
-+vwscanf_l(locale_t loc, const wchar_t * __restrict fmt, va_list ap)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
-+      return (vfwscanf_l(stdin, loc, fmt, ap));
- }
index 4f1c4aaea36fa495bbd2b2391165cb8c6bd1d589..9e9b59eaedc49dfeb3ef3764cac3c4fbfb494057 100644 (file)
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)wbuf.c    8.1 (Berkeley) 6/4/93";
 __FBSDID("$FreeBSD: src/lib/libc/stdio/wbuf.c,v 1.12 2007/01/09 00:28:08 imp Exp $");
 
 #include <stdio.h>
+#include <errno.h>
 #include "local.h"
 
 /*
@@ -61,8 +62,10 @@ __swbuf(c, fp)
         * calls might wrap _w from negative to positive.
         */
        fp->_w = fp->_lbfsize;
-       if (prepwrite(fp) != 0)
+       if (prepwrite(fp) != 0) {
+               errno = EBADF;
                return (EOF);
+       }
        c = (unsigned char)c;
 
        ORIENT(fp, -1);
diff --git a/stdio/FreeBSD/wbuf.c.patch b/stdio/FreeBSD/wbuf.c.patch
deleted file mode 100644 (file)
index f878a04..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- wbuf.c.bsdnew      2009-11-11 13:33:20.000000000 -0800
-+++ wbuf.c     2009-11-11 13:33:22.000000000 -0800
-@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)wbuf.c   8.1 (
- __FBSDID("$FreeBSD: src/lib/libc/stdio/wbuf.c,v 1.12 2007/01/09 00:28:08 imp Exp $");
- #include <stdio.h>
-+#include <errno.h>
- #include "local.h"
- /*
-@@ -61,8 +62,10 @@ __swbuf(c, fp)
-        * calls might wrap _w from negative to positive.
-        */
-       fp->_w = fp->_lbfsize;
--      if (prepwrite(fp) != 0)
-+      if (prepwrite(fp) != 0) {
-+              errno = EBADF;
-               return (EOF);
-+      }
-       c = (unsigned char)c;
-       ORIENT(fp, -1);
index 39713e217e69e02c11676cab717e89cf4f396bd0..d1c34986dce9048df5deb5aeff93477c2dde13a2 100644 (file)
 .Dt WPRINTF 3
 .Os
 .Sh NAME
-.Nm wprintf , fwprintf , swprintf ,
-.Nm vwprintf , vfwprintf , vswprintf
+.Nm fwprintf ,
+.Nm swprintf ,
+.Nm vfwprintf ,
+.Nm vswprintf ,
+.Nm vwprintf ,
+.Nm wprintf
 .Nd formatted wide character output conversion
 .Sh LIBRARY
 .Lb libc
 .In stdio.h
 .In wchar.h
 .Ft int
-.Fn fwprintf "FILE * restrict stream" "const wchar_t * restrict format" ...
+.Fo fwprintf
+.Fa "FILE *restrict stream"
+.Fa "const wchar_t *restrict format"
+.Fa ...
+.Fc
 .Ft int
-.Fn swprintf "wchar_t * restrict ws" "size_t n" "const wchar_t * restrict format" ...
+.Fo swprintf
+.Fa "wchar_t *restrict ws"
+.Fa "size_t n"
+.Fa "const wchar_t *restrict format"
+.Fa ...
+.Fc
 .Ft int
-.Fn wprintf "const wchar_t * restrict format" ...
+.Fo wprintf
+.Fa "const wchar_t *restrict format"
+.Fa ...
+.Fc
 .In stdarg.h
+.In stdio.h
+.In wchar.h
 .Ft int
-.Fn vfwprintf "FILE * restrict stream" "const wchar_t * restrict" "va_list ap"
+.Fo vfwprintf
+.Fa "FILE *restrict stream"
+.Fa "const wchar_t *restrict format"
+.Fa "va_list arg"
+.Fc
 .Ft int
-.Fn vswprintf "wchar_t * restrict ws" "size_t n" "const wchar_t *restrict format" "va_list ap"
+.Fo vswprintf
+.Fa "wchar_t *restrict ws"
+.Fa "size_t n"
+.Fa "const wchar_t *restrict format"
+.Fa "va_list arg"
+.Fc
 .Ft int
-.Fn vwprintf "const wchar_t * restrict format" "va_list ap"
+.Fo vwprintf
+.Fa "const wchar_t *restrict format"
+.Fa "va_list arg"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wprintf
 family of functions produces output according to a
-.Fa format
+.Fa format ,
 as described below.
 The
 .Fn wprintf
@@ -83,6 +113,12 @@ and
 write to the wide character string
 .Fa ws .
 .Pp
+Extended locale versions of these functions are documented in
+.Xr wprintf_l 3 .
+See
+.Xr xlocale 3
+for more information.
+.Pp
 These functions write the output under the control of a
 .Fa format
 string that specifies how subsequent arguments
@@ -92,7 +128,7 @@ are converted for output.
 .Pp
 These functions return the number of characters printed
 (not including the trailing
-.Ql \e0
+.Ql \e0 ,
 used to end output to strings).
 .Pp
 The
@@ -598,6 +634,7 @@ Refer to
 .Xr putwc 3 ,
 .Xr setlocale 3 ,
 .Xr wcsrtombs 3 ,
+.Xr wprintf_l 3 ,
 .Xr wscanf 3
 .Sh STANDARDS
 Subject to the caveats noted in the
@@ -610,7 +647,7 @@ the
 .Fn fwprintf ,
 .Fn swprintf ,
 .Fn vwprintf ,
-.Fn vfwprintf
+.Fn vfwprintf ,
 and
 .Fn vswprintf
 functions
diff --git a/stdio/FreeBSD/wprintf.3.patch b/stdio/FreeBSD/wprintf.3.patch
deleted file mode 100644 (file)
index ed363e1..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
---- wprintf.3.bsdnew   2009-11-11 13:33:22.000000000 -0800
-+++ wprintf.3  2009-11-11 13:33:22.000000000 -0800
-@@ -37,8 +37,12 @@
- .Dt WPRINTF 3
- .Os
- .Sh NAME
--.Nm wprintf , fwprintf , swprintf ,
--.Nm vwprintf , vfwprintf , vswprintf
-+.Nm fwprintf ,
-+.Nm swprintf ,
-+.Nm vfwprintf ,
-+.Nm vswprintf ,
-+.Nm vwprintf ,
-+.Nm wprintf
- .Nd formatted wide character output conversion
- .Sh LIBRARY
- .Lb libc
-@@ -46,23 +50,49 @@
- .In stdio.h
- .In wchar.h
- .Ft int
--.Fn fwprintf "FILE * restrict stream" "const wchar_t * restrict format" ...
-+.Fo fwprintf
-+.Fa "FILE *restrict stream"
-+.Fa "const wchar_t *restrict format"
-+.Fa ...
-+.Fc
- .Ft int
--.Fn swprintf "wchar_t * restrict ws" "size_t n" "const wchar_t * restrict format" ...
-+.Fo swprintf
-+.Fa "wchar_t *restrict ws"
-+.Fa "size_t n"
-+.Fa "const wchar_t *restrict format"
-+.Fa ...
-+.Fc
- .Ft int
--.Fn wprintf "const wchar_t * restrict format" ...
-+.Fo wprintf
-+.Fa "const wchar_t *restrict format"
-+.Fa ...
-+.Fc
- .In stdarg.h
-+.In stdio.h
-+.In wchar.h
- .Ft int
--.Fn vfwprintf "FILE * restrict stream" "const wchar_t * restrict" "va_list ap"
-+.Fo vfwprintf
-+.Fa "FILE *restrict stream"
-+.Fa "const wchar_t *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Ft int
--.Fn vswprintf "wchar_t * restrict ws" "size_t n" "const wchar_t *restrict format" "va_list ap"
-+.Fo vswprintf
-+.Fa "wchar_t *restrict ws"
-+.Fa "size_t n"
-+.Fa "const wchar_t *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Ft int
--.Fn vwprintf "const wchar_t * restrict format" "va_list ap"
-+.Fo vwprintf
-+.Fa "const wchar_t *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wprintf
- family of functions produces output according to a
--.Fa format
-+.Fa format ,
- as described below.
- The
- .Fn wprintf
-@@ -83,6 +113,12 @@ and
- write to the wide character string
- .Fa ws .
- .Pp
-+Extended locale versions of these functions are documented in
-+.Xr wprintf_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
-+.Pp
- These functions write the output under the control of a
- .Fa format
- string that specifies how subsequent arguments
-@@ -92,7 +128,7 @@ are converted for output.
- .Pp
- These functions return the number of characters printed
- (not including the trailing
--.Ql \e0
-+.Ql \e0 ,
- used to end output to strings).
- .Pp
- The
-@@ -598,6 +634,7 @@ Refer to
- .Xr putwc 3 ,
- .Xr setlocale 3 ,
- .Xr wcsrtombs 3 ,
-+.Xr wprintf_l 3 ,
- .Xr wscanf 3
- .Sh STANDARDS
- Subject to the caveats noted in the
-@@ -610,7 +647,7 @@ the
- .Fn fwprintf ,
- .Fn swprintf ,
- .Fn vwprintf ,
--.Fn vfwprintf
-+.Fn vfwprintf ,
- and
- .Fn vswprintf
- functions
index 4b5596e1da2ce4cbd047e44c6ea700a5915739fa..42deed095c1b1dcc86782dd3c2c7a20752a5b052 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/wprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -38,7 +40,21 @@ wprintf(const wchar_t * __restrict fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       ret = vfwprintf(stdout, fmt, ap);
+       ret = vfwprintf_l(stdout, __current_locale(), fmt, ap);
+       va_end(ap);
+
+       return (ret);
+}
+
+int
+wprintf_l(locale_t loc, const wchar_t * __restrict fmt, ...)
+{
+       int ret;
+       va_list ap;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
+       va_start(ap, fmt);
+       ret = vfwprintf_l(stdout, loc, fmt, ap);
        va_end(ap);
 
        return (ret);
diff --git a/stdio/FreeBSD/wprintf.c.patch b/stdio/FreeBSD/wprintf.c.patch
deleted file mode 100644 (file)
index f4db718..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- wprintf.c.orig     2003-05-20 15:22:45.000000000 -0700
-+++ wprintf.c  2005-02-23 17:09:14.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/wprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -38,7 +40,21 @@
-       va_list ap;
-       va_start(ap, fmt);
--      ret = vfwprintf(stdout, fmt, ap);
-+      ret = vfwprintf_l(stdout, __current_locale(), fmt, ap);
-+      va_end(ap);
-+
-+      return (ret);
-+}
-+
-+int
-+wprintf_l(locale_t loc, const wchar_t * __restrict fmt, ...)
-+{
-+      int ret;
-+      va_list ap;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
-+      va_start(ap, fmt);
-+      ret = vfwprintf_l(stdout, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
index 21d32ab70c077674a7c8bf68a3d14a67977ebaa4..54fa5d6a69e453f3573589905346faa1bade9b8a 100644 (file)
 .Dt WSCANF 3
 .Os
 .Sh NAME
-.Nm wscanf ,
 .Nm fwscanf ,
 .Nm swscanf ,
-.Nm vwscanf ,
+.Nm vfwscanf ,
 .Nm vswscanf ,
-.Nm vfwscanf
+.Nm vwscanf ,
+.Nm wscanf
 .Nd wide character input format conversion
 .Sh LIBRARY
 .Lb libc
 .In stdio.h
 .In wchar.h
 .Ft int
-.Fn wscanf "const wchar_t * restrict format" ...
+.Fo fwscanf
+.Fa "FILE *restrict stream"
+.Fa "const wchar_t *restrict format"
+.Fa ...
+.Fc
 .Ft int
-.Fn fwscanf "FILE * restrict stream" "const wchar_t * restrict format" ...
+.Fo swscanf
+.Fa "const wchar_t *restrict ws"
+.Fa "const wchar_t *restrict format"
+.Fa ...
+.Fc
 .Ft int
-.Fn swscanf "const wchar_t * restrict str" "const wchar_t * restrict format" ...
+.Fo wscanf
+.Fa "const wchar_t *restrict format"
+.Fa ...
+.Fc
 .In stdarg.h
+.In stdio.h
+.In wchar.h
 .Ft int
-.Fn vwscanf "const wchar_t * restrict format" "va_list ap"
+.Fo vfwscanf
+.Fa "FILE *restrict stream"
+.Fa "const wchar_t *restrict format"
+.Fa "va_list arg"
+.Fc
 .Ft int
-.Fn vswscanf "const wchar_t * restrict str" "const wchar_t * restrict format" "va_list ap"
+.Fo vswscanf
+.Fa "const wchar_t *restrict ws"
+.Fa "const wchar_t *restrict format"
+.Fa "va_list arg"
+.Fc
 .Ft int
-.Fn vfwscanf "FILE * restrict stream" "const wchar_t * restrict format" "va_list ap"
+.Fo vwscanf
+.Fa "const wchar_t *restrict format"
+.Fa "va_list arg"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wscanf
-family of functions scans input according to a
+family of functions scans input, according to a
 .Fa format
 as described below.
 This format may contain
@@ -85,7 +109,8 @@ reads input from the stream pointer
 and
 .Fn swscanf
 reads its input from the wide character string pointed to by
-.Fa str .
+.Fa ws .
+.Pp
 The
 .Fn vfwscanf
 function
@@ -117,6 +142,7 @@ conversion below).
 All conversions are introduced by the
 .Cm %
 (percent sign) character.
+.Pp
 The
 .Fa format
 string
@@ -130,10 +156,16 @@ Scanning stops
 when an input character does not match such a format character.
 Scanning also stops
 when an input conversion cannot be made (see below).
+.Pp
+Extended locale versions of these functions are documented in
+.Xr wscanf_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh CONVERSIONS
 Following the
 .Cm %
-character introducing a conversion
+character introducing a conversion,
 there may be a number of
 .Em flag
 characters, as follows:
@@ -429,15 +461,12 @@ of
 causes an immediate return of
 .Dv EOF .
 .Sh RETURN VALUES
-These
-functions
-return
-the number of input items assigned, which can be fewer than provided
-for, or even zero, in the event of a matching failure.
-Zero
-indicates that, while there was input available,
+These functions return the number of input items assigned,
+which can be fewer than provided for, or even zero,
+in the event of a matching failure.
+Zero indicates that, while there was input available,
 no conversions were assigned;
-typically this is due to an invalid input character,
+typically, this is due to an invalid input character,
 such as an alphabetic character for a
 .Ql %d
 conversion.
@@ -455,14 +484,15 @@ the number of conversions which were successfully completed is returned.
 .Xr wcstod 3 ,
 .Xr wcstol 3 ,
 .Xr wcstoul 3 ,
-.Xr wprintf 3
+.Xr wprintf 3 ,
+.Xr wscanf_l 3
 .Sh STANDARDS
 The
 .Fn fwscanf ,
 .Fn wscanf ,
 .Fn swscanf ,
 .Fn vfwscanf ,
-.Fn vwscanf
+.Fn vwscanf ,
 and
 .Fn vswscanf
 functions
diff --git a/stdio/FreeBSD/wscanf.3.patch b/stdio/FreeBSD/wscanf.3.patch
deleted file mode 100644 (file)
index 744d3e9..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
---- wscanf.3.bsdnew    2009-11-11 13:33:22.000000000 -0800
-+++ wscanf.3   2009-11-11 13:33:22.000000000 -0800
-@@ -37,12 +37,12 @@
- .Dt WSCANF 3
- .Os
- .Sh NAME
--.Nm wscanf ,
- .Nm fwscanf ,
- .Nm swscanf ,
--.Nm vwscanf ,
-+.Nm vfwscanf ,
- .Nm vswscanf ,
--.Nm vfwscanf
-+.Nm vwscanf ,
-+.Nm wscanf
- .Nd wide character input format conversion
- .Sh LIBRARY
- .Lb libc
-@@ -50,22 +50,46 @@
- .In stdio.h
- .In wchar.h
- .Ft int
--.Fn wscanf "const wchar_t * restrict format" ...
-+.Fo fwscanf
-+.Fa "FILE *restrict stream"
-+.Fa "const wchar_t *restrict format"
-+.Fa ...
-+.Fc
- .Ft int
--.Fn fwscanf "FILE * restrict stream" "const wchar_t * restrict format" ...
-+.Fo swscanf
-+.Fa "const wchar_t *restrict ws"
-+.Fa "const wchar_t *restrict format"
-+.Fa ...
-+.Fc
- .Ft int
--.Fn swscanf "const wchar_t * restrict str" "const wchar_t * restrict format" ...
-+.Fo wscanf
-+.Fa "const wchar_t *restrict format"
-+.Fa ...
-+.Fc
- .In stdarg.h
-+.In stdio.h
-+.In wchar.h
- .Ft int
--.Fn vwscanf "const wchar_t * restrict format" "va_list ap"
-+.Fo vfwscanf
-+.Fa "FILE *restrict stream"
-+.Fa "const wchar_t *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Ft int
--.Fn vswscanf "const wchar_t * restrict str" "const wchar_t * restrict format" "va_list ap"
-+.Fo vswscanf
-+.Fa "const wchar_t *restrict ws"
-+.Fa "const wchar_t *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Ft int
--.Fn vfwscanf "FILE * restrict stream" "const wchar_t * restrict format" "va_list ap"
-+.Fo vwscanf
-+.Fa "const wchar_t *restrict format"
-+.Fa "va_list arg"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wscanf
--family of functions scans input according to a
-+family of functions scans input, according to a
- .Fa format
- as described below.
- This format may contain
-@@ -85,7 +109,8 @@ reads input from the stream pointer
- and
- .Fn swscanf
- reads its input from the wide character string pointed to by
--.Fa str .
-+.Fa ws .
-+.Pp
- The
- .Fn vfwscanf
- function
-@@ -117,6 +142,7 @@ conversion below).
- All conversions are introduced by the
- .Cm %
- (percent sign) character.
-+.Pp
- The
- .Fa format
- string
-@@ -130,10 +156,16 @@ Scanning stops
- when an input character does not match such a format character.
- Scanning also stops
- when an input conversion cannot be made (see below).
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr wscanf_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh CONVERSIONS
- Following the
- .Cm %
--character introducing a conversion
-+character introducing a conversion,
- there may be a number of
- .Em flag
- characters, as follows:
-@@ -429,15 +461,12 @@ of
- causes an immediate return of
- .Dv EOF .
- .Sh RETURN VALUES
--These
--functions
--return
--the number of input items assigned, which can be fewer than provided
--for, or even zero, in the event of a matching failure.
--Zero
--indicates that, while there was input available,
-+These functions return the number of input items assigned,
-+which can be fewer than provided for, or even zero,
-+in the event of a matching failure.
-+Zero indicates that, while there was input available,
- no conversions were assigned;
--typically this is due to an invalid input character,
-+typically, this is due to an invalid input character,
- such as an alphabetic character for a
- .Ql %d
- conversion.
-@@ -455,14 +484,15 @@ the number of conversions which were suc
- .Xr wcstod 3 ,
- .Xr wcstol 3 ,
- .Xr wcstoul 3 ,
--.Xr wprintf 3
-+.Xr wprintf 3 ,
-+.Xr wscanf_l 3
- .Sh STANDARDS
- The
- .Fn fwscanf ,
- .Fn wscanf ,
- .Fn swscanf ,
- .Fn vfwscanf ,
--.Fn vwscanf
-+.Fn vwscanf ,
- and
- .Fn vswscanf
- functions
index 86290272cd5cec18baa98e3f886d1226bfe55d27..99dc48dc65a2b06fd8f454ff613ad94a26918969 100644 (file)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdio/wscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <wchar.h>
@@ -38,7 +40,21 @@ wscanf(const wchar_t * __restrict fmt, ...)
        int r;
 
        va_start(ap, fmt);
-       r = vfwscanf(stdin, fmt, ap);
+       r = vfwscanf_l(stdin, __current_locale(), fmt, ap);
+       va_end(ap);
+
+       return (r);
+}
+
+int
+wscanf_l(locale_t loc, const wchar_t * __restrict fmt, ...)
+{
+       va_list ap;
+       int r;
+
+       /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
+       va_start(ap, fmt);
+       r = vfwscanf_l(stdin, loc, fmt, ap);
        va_end(ap);
 
        return (r);
diff --git a/stdio/FreeBSD/wscanf.c.patch b/stdio/FreeBSD/wscanf.c.patch
deleted file mode 100644 (file)
index 4843b22..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- wscanf.c.orig      2003-05-20 15:22:45.000000000 -0700
-+++ wscanf.c   2005-02-23 17:10:53.000000000 -0800
-@@ -27,6 +27,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdio/wscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdarg.h>
- #include <stdio.h>
- #include <wchar.h>
-@@ -38,7 +40,21 @@
-       int r;
-       va_start(ap, fmt);
--      r = vfwscanf(stdin, fmt, ap);
-+      r = vfwscanf_l(stdin, __current_locale(), fmt, ap);
-+      va_end(ap);
-+
-+      return (r);
-+}
-+
-+int
-+wscanf_l(locale_t loc, const wchar_t * __restrict fmt, ...)
-+{
-+      va_list ap;
-+      int r;
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
-+      va_start(ap, fmt);
-+      r = vfwscanf_l(stdin, loc, fmt, ap);
-       va_end(ap);
-       return (r);
diff --git a/stdio/Makefile.inc b/stdio/Makefile.inc
deleted file mode 100644 (file)
index a22dde9..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-#      @(#)Makefile.inc        8.3 (Berkeley) 4/17/94
-# $FreeBSD: src/lib/libc/stdio/Makefile.inc,v 1.32 2003/01/10 06:22:28 tjr Exp $
-
-# stdio sources
-.PATH: ${.CURDIR}/stdio
-CWD := ${.CURDIR}/stdio
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= _flock_stub.c asprintf.c clrerr.c dprintf.c fclose.c fdopen.c feof.c ferror.c \
-       fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetwc.c fgetwln.c fgetws.c \
-       fileno.c findfp.c flags.c fopen.c fprintf.c fpurge.c fputc.c fputs.c \
-       fputwc.c fputws.c fread.c freopen.c fscanf.c fseek.c fsetpos.c \
-       ftell.c funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwscanf.c \
-       fwrite.c getc.c getchar.c getdelim.c getline.c gets.c getw.c getwc.c getwchar.c makebuf.c \
-       mktemp.c perror.c printf.c printf-pos.c putc.c putchar.c puts.c putw.c putwc.c \
-       putwchar.c refill.c remove.c rewind.c rget.c scanf.c setbuf.c \
-       setbuffer.c setvbuf.c snprintf.c sprintf.c sscanf.c stdio.c \
-       swprintf.c swscanf.c tempnam.c tmpfile.c tmpnam.c ungetc.c ungetwc.c \
-       vasprintf.c vdprintf.c vfprintf.c vfscanf.c vfwprintf.c vfwscanf.c \
-       vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c vswprintf.c \
-       vswscanf.c vwprintf.c vwscanf.c wbuf.c wprintf.c wscanf.c wsetup.c
-FBSDHDRS= floatio.h fvwrite.h glue.h local.h printfcommon.h printflocal.h
-.include "Makefile.fbsd_end"
-
-# also build 64-bit long double versions (ppc only)
-LDBLSRCS += asprintf.c dprintf.c fprintf.c fscanf.c fwprintf.c fwscanf.c printf.c \
-           scanf.c snprintf.c sprintf.c sscanf.c swprintf.c swscanf.c \
-           vasprintf.c vdprintf.c vfprintf.c vfscanf.c vfwprintf.c vfwscanf.c \
-           vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c vswprintf.c \
-           vswscanf.c vwprintf.c vwscanf.c wprintf.c wscanf.c
-
-LEGACYSRCS+= fdopen.c fopen.c fputs.c freopen.c fwrite.c tempnam.c
-DARWINEXTSNSRCS+= fdopen.c fopen.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-fdopen-fbsd.c += -DLIBC_ALIAS_FDOPEN
-CFLAGS-fopen-fbsd.c += -DLIBC_ALIAS_FOPEN
-CFLAGS-fputs-fbsd.c += -DLIBC_ALIAS_FPUTS
-CFLAGS-freopen-fbsd.c += -DLIBC_ALIAS_FREOPEN
-CFLAGS-fwrite-fbsd.c += -DLIBC_ALIAS_FWRITE
-CFLAGS-tempnam-fbsd.c += -DLIBC_ALIAS_TEMPNAM
-CFLAGS-tmpfile-fbsd.c += -D_DARWIN_UNLIMITED_STREAMS
-
-.if ${LIB} == "c"
-MAN3+= getwc_l.3 putwc_l.3 printf_l.3 scanf_l.3 wprintf_l.3 wscanf_l.3
-
-.include "Makefile.fbsd_begin"
-FBSDMAN3= fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetwln.3 fgetws.3 flockfile.3 \
-       fopen.3 fputs.3 fputws.3 fread.3 fseek.3 funopen.3 fwide.3 getc.3 \
-       getline.3 getwc.3 mktemp.3 printf.3 putc.3 putwc.3 remove.3 scanf.3 setbuf.3 \
-       stdio.3 tmpnam.3 ungetc.3 ungetwc.3 wprintf.3 wscanf.3
-.include "Makefile.fbsd_end"
-
-MLINKS+= ferror.3 clearerr.3                   \
-         ferror.3 clearerr_unlocked.3          \
-         ferror.3 feof.3                       \
-         ferror.3 feof_unlocked.3              \
-         ferror.3 ferror_unlocked.3            \
-         ferror.3 fileno.3                     \
-         ferror.3 fileno_unlocked.3
-
-MLINKS+= fflush.3 fpurge.3
-
-MLINKS+= fgets.3 gets.3
-
-MLINKS+= fgetwln.3 fgetwln_l.3
-
-MLINKS+= fgetws.3 fgetws_l.3
-
-MLINKS+= flockfile.3 ftrylockfile.3            \
-         flockfile.3 funlockfile.3
-
-MLINKS+= fopen.3 fdopen.3                      \
-         fopen.3 freopen.3
-
-MLINKS+= fputs.3 puts.3
-
-MLINKS+= fputws.3 fputws_l.3
-
-MLINKS+= fread.3 fwrite.3
-
-MLINKS+= fseek.3 fgetpos.3                     \
-         fseek.3 fseeko.3                      \
-         fseek.3 fsetpos.3                     \
-         fseek.3 ftell.3                       \
-         fseek.3 ftello.3                      \
-         fseek.3 rewind.3
-
-MLINKS+= funopen.3 fropen.3                    \
-         funopen.3 fwopen.3
-
-MLINKS+= getline.3 getdelim.3
-
-MLINKS+= getc.3 fgetc.3                                \
-         getc.3 getc_unlocked.3                        \
-         getc.3 getchar.3                      \
-         getc.3 getchar_unlocked.3             \
-         getc.3 getw.3
-
-MLINKS+= getwc.3 fgetwc.3                      \
-         getwc.3 getwchar.3
-
-MLINKS+= getwc_l.3 fgetwc_l.3                  \
-         getwc_l.3 getwchar_l.3
-
-MLINKS+= mktemp.3 mkdtemp.3                    \
-         mktemp.3 mkstemp.3                    \
-         mktemp.3 mkstemps.3
-
-MLINKS+= printf.3 asprintf.3                   \
-         printf.3 dprintf.3                    \
-         printf.3 fprintf.3                    \
-         printf.3 snprintf.3                   \
-         printf.3 sprintf.3                    \
-         printf.3 vasprintf.3                  \
-         printf.3 vdprintf.3                   \
-         printf.3 vfprintf.3                   \
-         printf.3 vprintf.3                    \
-         printf.3 vsnprintf.3                  \
-         printf.3 vsprintf.3
-
-MLINKS+= printf_l.3 asprintf_l.3               \
-         printf_l.3 fprintf_l.3                        \
-         printf_l.3 snprintf_l.3               \
-         printf_l.3 sprintf_l.3                        \
-         printf_l.3 vasprintf_l.3              \
-         printf_l.3 vfprintf_l.3               \
-         printf_l.3 vprintf_l.3                        \
-         printf_l.3 vsnprintf_l.3              \
-         printf_l.3 vsprintf_l.3
-
-MLINKS+= putc.3 fputc.3                                \
-         putc.3 putc_unlocked.3                        \
-         putc.3 putchar.3                      \
-         putc.3 putchar_unlocked.3             \
-         putc.3 putw.3
-
-MLINKS+= putwc.3 fputwc.3                      \
-         putwc.3 putwchar.3
-
-MLINKS+= putwc_l.3 fputwc_l.3                  \
-         putwc_l.3 putwchar_l.3
-
-MLINKS+= scanf.3 fscanf.3                      \
-         scanf.3 sscanf.3                      \
-         scanf.3 vfscanf.3                     \
-         scanf.3 vscanf.3                      \
-         scanf.3 vsscanf.3
-
-MLINKS+= scanf_l.3 fscanf_l.3                  \
-         scanf_l.3 sscanf_l.3                  \
-         scanf_l.3 vfscanf_l.3                 \
-         scanf_l.3 vscanf_l.3                  \
-         scanf_l.3 vsscanf_l.3
-
-MLINKS+= setbuf.3 setbuffer.3                  \
-         setbuf.3 setlinebuf.3                 \
-         setbuf.3 setvbuf.3
-
-MLINKS+= tmpnam.3 tempnam.3                    \
-         tmpnam.3 tmpfile.3
-
-MLINKS+= ungetwc.3 ungetwc_l.3
-
-MLINKS+= wprintf.3 fwprintf.3                  \
-         wprintf.3 swprintf.3                  \
-         wprintf.3 vwprintf.3                  \
-         wprintf.3 vfwprintf.3                 \
-         wprintf.3 vswprintf.3
-
-MLINKS+= wprintf_l.3 fwprintf_l.3              \
-         wprintf_l.3 swprintf_l.3              \
-         wprintf_l.3 vwprintf_l.3              \
-         wprintf_l.3 vfwprintf_l.3             \
-         wprintf_l.3 vswprintf_l.3
-
-MLINKS+= wscanf.3 fwscanf.3                    \
-         wscanf.3 swscanf.3                    \
-         wscanf.3 vfwscanf.3                   \
-         wscanf.3 vswscanf.3                   \
-         wscanf.3 vwscanf.3
-
-MLINKS+= wscanf_l.3 fwscanf_l.3                        \
-         wscanf_l.3 swscanf_l.3                        \
-         wscanf_l.3 vfwscanf_l.3               \
-         wscanf_l.3 vswscanf_l.3               \
-         wscanf_l.3 vwscanf_l.3
-.endif
diff --git a/stdio/_flock_stub-fbsd.c b/stdio/_flock_stub-fbsd.c
deleted file mode 120000 (symlink)
index 6ed2784..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./_flock_stub.c
\ No newline at end of file
diff --git a/stdio/asprintf-fbsd.c b/stdio/asprintf-fbsd.c
deleted file mode 100644 (file)
index 90c5617..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.15 2009/03/02 04:11:42 das Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-int
-asprintf(char ** __restrict s, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vasprintf_l(s, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-asprintf_l(char ** __restrict s, locale_t loc, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vasprintf_l(s, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/clrerr-fbsd.c b/stdio/clrerr-fbsd.c
deleted file mode 120000 (symlink)
index c958cba..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./clrerr.c
\ No newline at end of file
diff --git a/stdio/dprintf-fbsd.c b/stdio/dprintf-fbsd.c
deleted file mode 100644 (file)
index 22115fa..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include "un-namespace.h"
-
-int
-dprintf(int fd, const char * __restrict fmt, ...)
-{
-       va_list ap;
-       int ret;
-
-       va_start(ap, fmt);
-       ret = vdprintf_l(fd, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-dprintf_l(int fd, locale_t loc, const char * __restrict fmt, ...)
-{
-       va_list ap;
-       int ret;
-
-       va_start(ap, fmt);
-       ret = vdprintf_l(fd, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/fclose-fbsd.c b/stdio/fclose-fbsd.c
deleted file mode 100644 (file)
index 91df68a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fclose.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fclose.c,v 1.12 2007/01/09 00:28:06 imp Exp $");
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-int
-fclose(FILE *fp)
-{
-       int r;
-
-       if (!__sdidinit)
-               __sinit();
-
-       if (fp == NULL) {
-               errno = EFAULT;
-               return (EOF);
-       }
-       if (fp->_flags == 0) {  /* not open! */
-               errno = EBADF;
-               return (EOF);
-       }
-       FLOCKFILE(fp);
-       r = fp->_flags & __SWR ? __sflush(fp) : 0;
-       if (fp->_close != NULL && (*fp->_close)(fp->_cookie) < 0)
-               r = EOF;
-       if (fp->_flags & __SMBF)
-               free((char *)fp->_bf._base);
-       if (HASUB(fp))
-               FREEUB(fp);
-       if (HASLB(fp))
-               FREELB(fp);
-       fp->_file = -1;
-       fp->_r = fp->_w = 0;    /* Mess up if reaccessed. */
-       __sfprelease(fp);       /* Release this FILE for reuse. */
-       FUNLOCKFILE(fp);
-       return (r);
-}
diff --git a/stdio/fclose.3 b/stdio/fclose.3
deleted file mode 120000 (symlink)
index dd8386c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fclose.3
\ No newline at end of file
diff --git a/stdio/fdopen-fbsd.c b/stdio/fdopen-fbsd.c
deleted file mode 100644 (file)
index c49e36e..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef VARIANT_DARWINEXTSN
-#define _DARWIN_UNLIMITED_STREAMS
-#define COUNT  0
-#elif defined(VARIANT_LEGACY)
-#define COUNT  0
-#else
-#define COUNT  1
-#endif
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fdopen.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fdopen.c,v 1.11 2008/05/10 18:39:20 antoine Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <limits.h>
-#include "un-namespace.h"
-#include "local.h"
-
-FILE *
-fdopen(fd, mode)
-       int fd;
-       const char *mode;
-{
-       FILE *fp;
-       int flags, oflags, fdflags, tmp;
-
-       /*
-        * File descriptors are a full int, but _file is only a short.
-        * If we get a valid file descriptor that is greater than
-        * SHRT_MAX, then the fd will get sign-extended into an
-        * invalid file descriptor.  Handle this case by failing the
-        * open.
-        */
-       if (fd > SHRT_MAX) {
-               errno = EMFILE;
-               return (NULL);
-       }
-
-       if ((flags = __sflags(mode, &oflags)) == 0)
-               return (NULL);
-
-       /* Make sure the mode the user wants is a subset of the actual mode. */
-       if ((fdflags = _fcntl(fd, F_GETFL, 0)) < 0)
-               return (NULL);
-       tmp = fdflags & O_ACCMODE;
-       if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       if ((fp = __sfp(COUNT)) == NULL)
-               return (NULL);
-       fp->_flags = flags;
-       /*
-        * If opened for appending, but underlying descriptor does not have
-        * O_APPEND bit set, assert __SAPP so that __swrite() caller
-        * will _sseek() to the end before write.
-        */
-       if ((oflags & O_APPEND) && !(fdflags & O_APPEND))
-               fp->_flags |= __SAPP;
-       fp->_file = fd;
-       fp->_cookie = fp;
-       fp->_read = __sread;
-       fp->_write = __swrite;
-       fp->_seek = __sseek;
-       fp->_close = __sclose;
-       return (fp);
-}
diff --git a/stdio/feof-fbsd.c b/stdio/feof-fbsd.c
deleted file mode 120000 (symlink)
index c1253c2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./feof.c
\ No newline at end of file
diff --git a/stdio/ferror-fbsd.c b/stdio/ferror-fbsd.c
deleted file mode 120000 (symlink)
index 5ad5a2f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ferror.c
\ No newline at end of file
diff --git a/stdio/ferror.3 b/stdio/ferror.3
deleted file mode 120000 (symlink)
index 4890b6d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ferror.3
\ No newline at end of file
diff --git a/stdio/fflush-fbsd.c b/stdio/fflush-fbsd.c
deleted file mode 100644 (file)
index 7c83b75..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fflush.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fflush.c,v 1.14 2007/01/09 00:28:06 imp Exp $");
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-static int     sflush_locked(FILE *);
-
-/*
- * Flush a single file, or (if fp is NULL) all files.
- * MT-safe version
- */
-int
-fflush(FILE *fp)
-{
-       int retval;
-
-       if (fp == NULL)
-               return (_fwalk(sflush_locked));
-       FLOCKFILE(fp);
-
-       /*
-        * There is disagreement about the correct behaviour of fflush()
-        * when passed a file which is not open for reading.  According to
-        * the ISO C standard, the behaviour is undefined.
-        * Under linux, such an fflush returns success and has no effect;
-        * under Windows, such an fflush is documented as behaving instead
-        * as fpurge().
-        * Given that applications may be written with the expectation of
-        * either of these two behaviours, the only safe (non-astonishing)
-        * option is to return EBADF and ask that applications be fixed.
-        */
-       if ((fp->_flags & (__SWR | __SRW)) == 0) {
-               errno = EBADF;
-               retval = EOF;
-       } else
-               retval = __sflush(fp);
-       FUNLOCKFILE(fp);
-       return (retval);
-}
-
-/*
- * Flush a single file, or (if fp is NULL) all files.
- * Non-MT-safe version
- */
-int
-__fflush(FILE *fp)
-{
-       int retval;
-
-       if (fp == NULL)
-               return (_fwalk(sflush_locked));
-       if ((fp->_flags & (__SWR | __SRW)) == 0) {
-               errno = EBADF;
-               retval = EOF;
-       } else
-               retval = __sflush(fp);
-       return (retval);
-}
-
-int
-__sflush(FILE *fp)
-{
-       unsigned char *p;
-       int n, t;
-
-       t = fp->_flags;
-       if ((t & __SWR) == 0)
-               return (0);
-
-       if ((p = fp->_bf._base) == NULL)
-               return (0);
-
-       n = fp->_p - p;         /* write this much */
-
-       /*
-        * Set these immediately to avoid problems with longjmp and to allow
-        * exchange buffering (via setvbuf) in user write function.
-        */
-       fp->_p = p;
-       fp->_w = t & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
-
-       for (; n > 0; n -= t, p += t) {
-               t = _swrite(fp, (char *)p, n);
-               if (t <= 0) {
-                       /* 5340694: reset _p and _w on EAGAIN */
-                       if (t < 0 && errno == EAGAIN) {
-                               if (p > fp->_p) /* some was written */
-                                       memmove(fp->_p, p, n);
-                               fp->_p += n;
-                               if (!(fp->_flags & (__SLBF|__SNBF)))
-                                       fp->_w -= n;
-                       }
-                       fp->_flags |= __SERR;
-                       return (EOF);
-               }
-       }
-       return (0);
-}
-
-static int
-sflush_locked(FILE *fp)
-{
-       int     ret;
-
-       FLOCKFILE(fp);
-       ret = __sflush(fp);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
diff --git a/stdio/fflush.3 b/stdio/fflush.3
deleted file mode 120000 (symlink)
index e6c2eaf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fflush.3
\ No newline at end of file
diff --git a/stdio/fgetc-fbsd.c b/stdio/fgetc-fbsd.c
deleted file mode 120000 (symlink)
index bdb4e54..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fgetc.c
\ No newline at end of file
diff --git a/stdio/fgetln-fbsd.c b/stdio/fgetln-fbsd.c
deleted file mode 100644 (file)
index 8de4aa9..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fgetln.c   8.2 (Berkeley) 1/2/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetln.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-/*
- * Expand the line buffer.  Return -1 on error.
-#ifdef notdef
- * The `new size' does not account for a terminating '\0',
- * so we add 1 here.
-#endif
- */
-int
-__slbexpand(FILE *fp, size_t newsize)
-{
-       void *p;
-
-#ifdef notdef
-       ++newsize;
-#endif
-       if (fp->_lb._size >= newsize)
-               return (0);
-       if (newsize > INT_MAX) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       if ((p = realloc(fp->_lb._base, newsize)) == NULL)
-               return (-1);
-       fp->_lb._base = p;
-       fp->_lb._size = newsize;
-       return (0);
-}
-
-/*
- * Get an input line.  The returned pointer often (but not always)
- * points into a stdio buffer.  Fgetln does not alter the text of
- * the returned line (which is thus not a C string because it will
- * not necessarily end with '\0'), but does allow callers to modify
- * it if they wish.  Thus, we set __SMOD in case the caller does.
- */
-char *
-fgetln(FILE *fp, size_t *lenp)
-{
-       unsigned char *p;
-       size_t len;
-       size_t off;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, -1);
-       /* make sure there is input */
-       if (fp->_r <= 0 && __srefill(fp)) {
-               *lenp = 0;
-               FUNLOCKFILE(fp);
-               return (NULL);
-       }
-
-       /* look for a newline in the input */
-       if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) != NULL) {
-               char *ret;
-
-               /*
-                * Found one.  Flag buffer as modified to keep fseek from
-                * `optimising' a backward seek, in case the user stomps on
-                * the text.
-                */
-               p++;            /* advance over it */
-               ret = (char *)fp->_p;
-               *lenp = len = p - fp->_p;
-               fp->_flags |= __SMOD;
-               fp->_r -= len;
-               fp->_p = p;
-               FUNLOCKFILE(fp);
-               return (ret);
-       }
-
-       /*
-        * We have to copy the current buffered data to the line buffer.
-        * As a bonus, though, we can leave off the __SMOD.
-        *
-        * OPTIMISTIC is length that we (optimistically) expect will
-        * accomodate the `rest' of the string, on each trip through the
-        * loop below.
-        */
-#define OPTIMISTIC 80
-
-       for (len = fp->_r, off = 0;; len += fp->_r) {
-               size_t diff;
-
-               /*
-                * Make sure there is room for more bytes.  Copy data from
-                * file buffer to line buffer, refill file and look for
-                * newline.  The loop stops only when we find a newline.
-                */
-               if (__slbexpand(fp, len + OPTIMISTIC))
-                       goto error;
-               (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
-                   len - off);
-               off = len;
-               if (__srefill(fp))
-                       break;  /* EOF or error: return partial line */
-               if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
-                       continue;
-
-               /* got it: finish up the line (like code above) */
-               p++;
-               diff = p - fp->_p;
-               len += diff;
-               if (__slbexpand(fp, len))
-                       goto error;
-               (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
-                   diff);
-               fp->_r -= diff;
-               fp->_p = p;
-               break;
-       }
-       *lenp = len;
-#ifdef notdef
-       fp->_lb._base[len] = 0;
-#endif
-       FUNLOCKFILE(fp);
-       return ((char *)fp->_lb._base);
-
-error:
-       *lenp = 0;              /* ??? */
-       fp->_flags |= __SERR;
-       FUNLOCKFILE(fp);
-       return (NULL);          /* ??? */
-}
diff --git a/stdio/fgetln.3 b/stdio/fgetln.3
deleted file mode 100644 (file)
index 61a3391..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fgetln.3   8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/stdio/fgetln.3,v 1.10 2009/02/28 06:00:58 das Exp $
-.\"
-.Dd April 19, 1994
-.Dt FGETLN 3
-.Os
-.Sh NAME
-.Nm fgetln
-.Nd get a line from a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft char *
-.Fn fgetln "FILE *stream" "size_t *len"
-.Sh DESCRIPTION
-The
-.Fn fgetln
-function
-returns a pointer to the next line from the stream referenced by
-.Fa stream .
-This line is
-.Em not
-a C string as it does not end with a terminating
-.Dv NUL
-character.
-The length of the line, including the final newline,
-is stored in the memory location to which
-.Fa len
-points.
-(Note, however, that if the line is the last
-in a file that does not end in a newline,
-the returned text will not contain a newline.)
-.Sh RETURN VALUES
-Upon successful completion a pointer is returned;
-this pointer becomes invalid after the next
-.Tn I/O
-operation on
-.Fa stream
-(whether successful or not)
-or as soon as the stream is closed.
-Otherwise,
-.Dv NULL
-is returned.
-The
-.Fn fgetln
-function
-does not distinguish between end-of-file and error; the routines
-.Xr feof 3
-and
-.Xr ferror 3
-must be used
-to determine which occurred.
-If an error occurs, the global variable
-.Va errno
-is set to indicate the error.
-The end-of-file condition is remembered, even on a terminal, and all
-subsequent attempts to read will return
-.Dv NULL
-until the condition is
-cleared with
-.Xr clearerr 3 .
-.Pp
-The text to which the returned pointer points may be modified,
-provided that no changes are made beyond the returned size.
-These changes are lost as soon as the pointer becomes invalid.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa stream
-is not a stream open for reading.
-.It Bq Er ENOMEM
-The internal line buffer could not be expanded due to lack of available memory,
-or because it would need to expand beyond INT_MAX in size.
-.El
-.Pp
-The
-.Fn fgetln
-function
-may also fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr fflush 3 ,
-.Xr malloc 3 ,
-.Xr read 2 ,
-.Xr stat 2 ,
-or
-.Xr realloc 3 .
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fgets 3 ,
-.Xr fgetwln 3 ,
-.Xr fopen 3 ,
-.Xr getline 3 ,
-.Xr putc 3
-.Sh HISTORY
-The
-.Fn fgetln
-function first appeared in
-.Bx 4.4 .
diff --git a/stdio/fgetpos-fbsd.c b/stdio/fgetpos-fbsd.c
deleted file mode 120000 (symlink)
index 331e98f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fgetpos.c
\ No newline at end of file
diff --git a/stdio/fgets-fbsd.c b/stdio/fgets-fbsd.c
deleted file mode 120000 (symlink)
index f32d128..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fgets.c
\ No newline at end of file
diff --git a/stdio/fgets.3 b/stdio/fgets.3
deleted file mode 120000 (symlink)
index e9f5002..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fgets.3
\ No newline at end of file
diff --git a/stdio/fgetwc-fbsd.c b/stdio/fgetwc-fbsd.c
deleted file mode 100644 (file)
index ead24c3..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwc.c,v 1.13 2008/04/17 22:17:53 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-#include "mblocal.h"
-
-/*
- * MT-safe version.
- */
-wint_t
-fgetwc(FILE *fp)
-{
-       wint_t r;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       r = __fgetwc(fp, __current_locale());
-       FUNLOCKFILE(fp);
-
-       return (r);
-}
-
-wint_t
-fgetwc_l(FILE *fp, locale_t loc)
-{
-       wint_t r;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       r = __fgetwc(fp, loc);
-       FUNLOCKFILE(fp);
-
-       return (r);
-}
-
-/*
- * Non-MT-safe version.
- */
-wint_t
-__fgetwc(FILE *fp, locale_t loc)
-{
-       wchar_t wc;
-       size_t nconv;
-       struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
-       size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t) = xrl->__mbrtowc;
-
-       if (fp->_r <= 0 && __srefill(fp))
-               return (WEOF);
-       if (xrl->__mb_cur_max == 1) {
-               /* Fast path for single-byte encodings. */
-               wc = *fp->_p++;
-               fp->_r--;
-               return (wc);
-       }
-       do {
-               nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_mbstate, loc);
-               if (nconv == (size_t)-1)
-                       break;
-               else if (nconv == (size_t)-2)
-                       continue;
-               else if (nconv == 0) {
-                       /*
-                        * Assume that the only valid representation of
-                        * the null wide character is a single null byte.
-                        */
-                       fp->_p++;
-                       fp->_r--;
-                       return (L'\0');
-               } else {
-                       fp->_p += nconv;
-                       fp->_r -= nconv;
-                       return (wc);
-               }
-       } while (__srefill(fp) == 0);
-       fp->_flags |= __SERR;
-       errno = EILSEQ;
-       return (WEOF);
-}
diff --git a/stdio/fgetwln-fbsd.c b/stdio/fgetwln-fbsd.c
deleted file mode 100644 (file)
index 43485cb..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwln.c,v 1.2 2004/08/06 17:00:09 tjr Exp $");
-
-#include "namespace.h"
-#include <stdio.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-wchar_t *
-fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t loc)
-{
-       wint_t wc;
-       size_t len;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-
-       len = 0;
-       while ((wc = __fgetwc(fp, loc)) != WEOF) {
-#define        GROW    512
-               if (len * sizeof(wchar_t) >= fp->_lb._size &&
-                   __slbexpand(fp, (len + GROW) * sizeof(wchar_t)))
-                       goto error;
-               *((wchar_t *)fp->_lb._base + len++) = wc;
-               if (wc == L'\n')
-                       break;
-       }
-       if (len == 0)
-               goto error;
-
-       FUNLOCKFILE(fp);
-       *lenp = len;
-       return ((wchar_t *)fp->_lb._base);
-
-error:
-       FUNLOCKFILE(fp);
-       *lenp = 0;
-       return (NULL);
-}
-
-wchar_t *
-fgetwln(FILE * __restrict fp, size_t *lenp)
-{
-       return fgetwln_l(fp, lenp, __current_locale());
-}
diff --git a/stdio/fgetwln.3 b/stdio/fgetwln.3
deleted file mode 100644 (file)
index c38fb39..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fgetln.3   8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/stdio/fgetwln.3,v 1.3 2007/01/09 00:28:06 imp Exp $
-.\"
-.Dd July 16, 2004
-.Dt FGETWLN 3
-.Os
-.Sh NAME
-.Nm fgetwln ,
-.Nm fgetwln_l
-.Nd get a line of wide characters from a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft wchar_t *
-.Fn fgetwln "FILE * restrict stream" "size_t * restrict len"
-.In xlocale.h
-.Ft wchar_t *
-.Fn fgetwln_l "FILE * restrict stream" "size_t * restrict len" "locale_t loc"
-.Sh DESCRIPTION
-The
-.Fn fgetwln
-function
-returns a pointer to the next line from the stream referenced by
-.Fa stream .
-This line is
-.Em not
-a standard wide character string as it does not end with a terminating
-null wide character.
-The length of the line, including the final newline,
-is stored in the memory location to which
-.Fa len
-points.
-(Note, however, that if the line is the last
-in a file that does not end in a newline,
-the returned text will not contain a newline.)
-.Pp
-While the
-.Fn fgetwln
-function uses the current locale, the
-.Fn fgetwln_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-Upon successful completion a pointer is returned;
-this pointer becomes invalid after the next
-.Tn I/O
-operation on
-.Fa stream
-(whether successful or not)
-or as soon as the stream is closed.
-Otherwise,
-.Dv NULL
-is returned.
-The
-.Fn fgetwln
-function
-does not distinguish between end-of-file and error; the routines
-.Xr feof 3
-and
-.Xr ferror 3
-must be used
-to determine which occurred.
-If an error occurs, the global variable
-.Va errno
-is set to indicate the error.
-The end-of-file condition is remembered, even on a terminal, and all
-subsequent attempts to read will return
-.Dv NULL
-until the condition is
-cleared with
-.Xr clearerr 3 .
-.Pp
-The text to which the returned pointer points may be modified,
-provided that no changes are made beyond the returned size.
-These changes are lost as soon as the pointer becomes invalid.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa stream
-is not a stream open for reading.
-.El
-.Pp
-The
-.Fn fgetwln
-function
-may also fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr mbrtowc 3 ,
-.Xr realloc 3 ,
-or
-.Xr read 2 .
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fgetln 3 ,
-.Xr fgetws 3 ,
-.Xr fopen 3 ,
-.Xr xlocale 3
diff --git a/stdio/fgetws-fbsd.c b/stdio/fgetws-fbsd.c
deleted file mode 100644 (file)
index 278e809..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetws.c,v 1.8 2009/11/25 04:45:45 wollman Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-#include "mblocal.h"
-
-wchar_t *
-fgetws_l(wchar_t * __restrict ws, int n, FILE * __restrict fp, locale_t loc)
-{
-       wchar_t *wsp;
-       size_t nconv;
-       const char *src;
-       unsigned char *nl;
-       struct __xlocale_st_runelocale *rl;
-       size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, size_t, size_t, __darwin_mbstate_t * __restrict, locale_t);
-
-       NORMALIZE_LOCALE(loc);
-       rl = loc->__lc_ctype;
-       __mbsnrtowcs = rl->__mbsnrtowcs;
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-
-       if (n <= 0) {
-               errno = EINVAL;
-               goto error;
-       }
-
-       if (fp->_r <= 0 && __srefill(fp))
-               /* EOF */
-               goto error;
-       wsp = ws;
-       do {
-               src = (const char *)fp->_p;
-               nl = memchr(fp->_p, '\n', fp->_r);
-               nconv = __mbsnrtowcs(wsp, &src,
-                   nl != NULL ? (nl - fp->_p + 1) : fp->_r,
-                   n - 1, &fp->_mbstate, loc);
-               if (nconv == (size_t)-1)
-                       /* Conversion error */
-                       goto error;
-               if (src == NULL) {
-                       /*
-                        * We hit a null byte. Increment the character count,
-                        * since mbsnrtowcs()'s return value doesn't include
-                        * the terminating null, then resume conversion
-                        * after the null.
-                        */
-                       nconv++;
-                       src = memchr(fp->_p, '\0', fp->_r);
-                       src++;
-               }
-               fp->_r -= (unsigned char *)src - fp->_p;
-               fp->_p = (unsigned char *)src;
-               n -= nconv;
-               wsp += nconv;
-       } while (wsp[-1] != L'\n' && n > 1 && (fp->_r > 0 ||
-           __srefill(fp) == 0));
-       if (wsp == ws)
-               /* EOF */
-               goto error;
-       if (!rl->__mbsinit(&fp->_mbstate, loc))
-               /* Incomplete character */
-               goto error;
-       *wsp = L'\0';
-       FUNLOCKFILE(fp);
-
-       return (ws);
-
-error:
-       FUNLOCKFILE(fp);
-       return (NULL);
-}
-
-wchar_t *
-fgetws(wchar_t * __restrict ws, int n, FILE * __restrict fp)
-{
-       return fgetws_l(ws, n, fp, __current_locale());
-}
diff --git a/stdio/fgetws.3 b/stdio/fgetws.3
deleted file mode 100644 (file)
index 49c9d90..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fgets.3    8.1 (Berkeley) 6/4/93
-.\" FreeBSD: src/lib/libc/stdio/fgets.3,v 1.16 2002/05/31 05:01:17 archie Exp
-.\" $FreeBSD: src/lib/libc/stdio/fgetws.3,v 1.4 2007/01/09 00:28:06 imp Exp $
-.\"
-.Dd August 6, 2002
-.Dt FGETWS 3
-.Os
-.Sh NAME
-.Nm fgetws ,
-.Nm fgetws_l
-.Nd get a line of wide characters from a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft "wchar_t *"
-.Fo fgetws
-.Fa "wchar_t *restrict ws"
-.Fa "int n"
-.Fa "FILE *restrict stream"
-.Fc
-.In stdio.h
-.In wchar.h
-.In xlocale.h
-.Ft "wchar_t *"
-.Fo fgetws_l
-.Fa "wchar_t *restrict ws"
-.Fa "int n"
-.Fa "FILE *restrict stream"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fgetws
-function
-reads at most one less than the number of characters specified by
-.Fa n
-from the given
-.Fa stream
-and stores them in the wide character string
-.Fa ws .
-Reading stops when a newline character is found,
-at end-of-file or error.
-The newline, if any, is retained.
-If any characters are read and there is no error, a
-.Ql \e0
-character is appended to end the string.
-.Pp
-While the
-.Fn fgetws
-function uses the current locale, the
-.Fn fgetws_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn fgetws
-returns
-.Fa ws .
-If end-of-file occurs before any characters are read,
-.Fn fgetws
-returns
-.Dv NULL
-and the buffer contents remain unchanged.
-If an error occurs,
-.Fn fgetws
-returns
-.Dv NULL
-and the buffer contents are indeterminate.
-The
-.Fn fgetws
-function
-does not distinguish between end-of-file and error;
-callers must use
-.Xr feof 3
-and
-.Xr ferror 3
-to determine which occurred.
-.Sh ERRORS
-The
-.Fn fgetws
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The given
-.Fa stream
-argument is not a readable stream.
-.It Bq Er EILSEQ
-The data obtained from the input stream does not form a valid
-multibyte character.
-.El
-.Pp
-The function
-.Fn fgetws
-may also fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr fflush 3 ,
-.Xr fstat 2 ,
-.Xr read 2 ,
-or
-.Xr malloc 3 .
-.Sh SEE ALSO
-.Xr feof 3 ,
-.Xr ferror 3 ,
-.Xr fgets 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn fgetws
-function
-conforms to
-.St -p1003.1-2001 .
diff --git a/stdio/fileno-fbsd.c b/stdio/fileno-fbsd.c
deleted file mode 120000 (symlink)
index 45ad009..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fileno.c
\ No newline at end of file
diff --git a/stdio/findfp-fbsd.c b/stdio/findfp-fbsd.c
deleted file mode 100644 (file)
index 6cade0b..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)findfp.c   8.2 (Berkeley) 1/4/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Exp $");
-
-#include <TargetConditionals.h>
-
-#include <sys/param.h>
-#include <machine/atomic.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libkern/OSAtomic.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include <spinlock.h>
-
-#include "libc_private.h"
-#include "local.h"
-#include "glue.h"
-
-int    __sdidinit;
-
-#if !TARGET_OS_EMBEDDED
-#define        NDYNAMIC 10             /* add ten more whenever necessary */
-#else
-#define        NDYNAMIC 1              /* add one at a time on embedded */
-#endif
-
-#define        std(flags, file) {              \
-       ._flags = (flags),              \
-       ._file = (file),                \
-       ._cookie = __sF + (file),       \
-       ._close = __sclose,             \
-       ._read = __sread,               \
-       ._seek = __sseek,               \
-       ._write = __swrite,             \
-       ._extra = __sFX + file,         \
-}
-#define __sFXInit       {.fl_mutex = PTHREAD_MUTEX_INITIALIZER}
-  /* set counted */
-#define __sFXInit3      {.fl_mutex = PTHREAD_MUTEX_INITIALIZER, .counted = 1}
-
-static int __scounted;         /* streams counted against STREAM_MAX */
-static int __stream_max;
-
-#if !TARGET_OS_EMBEDDED
-/* usual and usual_extra are data pigs. See 7929728. For embedded we should
- * always allocate dynamically, and probably should for desktop too. */
-                               /* the usual - (stdin + stdout + stderr) */
-static FILE usual[FOPEN_MAX - 3];
-static struct __sFILEX usual_extra[FOPEN_MAX - 3];
-static struct glue uglue = { NULL, FOPEN_MAX - 3, usual };
-#endif /* !TARGET_OS_EMBEDDED */
-
-static struct __sFILEX __sFX[3] = {__sFXInit3, __sFXInit3, __sFXInit3};
-
-/*
- * We can't make this 'static' due to binary compatibility concerns.
- * This also means we cannot change the sizeof(FILE) and must continue to
- * use the __sFILEX stuff to add to FILE.
- */
-FILE __sF[3] = {
-       std(__SRD, STDIN_FILENO),
-       std(__SWR, STDOUT_FILENO),
-       std(__SWR|__SNBF, STDERR_FILENO)
-};
-
-FILE *__stdinp = &__sF[0];
-FILE *__stdoutp = &__sF[1];
-FILE *__stderrp = &__sF[2];
-
-#if !TARGET_OS_EMBEDDED
-struct glue __sglue = { &uglue, 3, __sF };
-static struct glue *lastglue = &uglue;
-#else
-struct glue __sglue = { NULL, 3, __sF };
-static struct glue *lastglue = &__sglue;
-#endif
-
-static struct glue *   moreglue(int);
-
-static spinlock_t thread_lock = _SPINLOCK_INITIALIZER;
-#define THREAD_LOCK()  if (__isthreaded) _SPINLOCK(&thread_lock)
-#define THREAD_UNLOCK()        if (__isthreaded) _SPINUNLOCK(&thread_lock)
-
-#if NOT_YET
-#define        SET_GLUE_PTR(ptr, val)  atomic_set_rel_ptr(&(ptr), (uintptr_t)(val))
-#else
-#define        SET_GLUE_PTR(ptr, val)  ptr = val
-#endif
-
-static struct glue *
-moreglue(n)
-       int n;
-{
-       struct glue *g;
-       static FILE empty;
-       FILE *p;
-       static struct __sFILEX emptyx = __sFXInit;
-       struct __sFILEX *fx;
-
-       g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE) +
-           n * sizeof(struct __sFILEX));
-       if (g == NULL)
-               return (NULL);
-       p = (FILE *)ALIGN(g + 1);
-       fx = (struct __sFILEX *)&p[n];
-       g->next = NULL;
-       g->niobs = n;
-       g->iobs = p;
-        
-       while (--n >= 0) {
-               *p = empty;
-               p->_extra = fx;
-               *p->_extra = emptyx;
-               p++, fx++;
-       }
-       return (g);
-}
-
-/*
- * Find a free FILE for fopen et al.
- */
-FILE *
-__sfp(int count)
-{
-       FILE    *fp;
-       int     n;
-       struct glue *g;
-
-       if (!__sdidinit)
-               __sinit();
-
-       if (count) {
-               if (__scounted >= __stream_max) {
-                       THREAD_UNLOCK();
-                       errno = EMFILE;
-                       return NULL;
-               }
-               OSAtomicIncrement32(&__scounted);
-       }
-       /*
-        * The list must be locked because a FILE may be updated.
-        */
-       THREAD_LOCK();
-       for (g = &__sglue; g != NULL; g = g->next) {
-               for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
-                       if (fp->_flags == 0)
-                               goto found;
-       }
-       THREAD_UNLOCK();        /* don't hold lock while malloc()ing. */
-       if ((g = moreglue(NDYNAMIC)) == NULL)
-               return (NULL);
-       THREAD_LOCK();          /* reacquire the lock */
-       SET_GLUE_PTR(lastglue->next, g); /* atomically append glue to list */
-       lastglue = g;           /* not atomic; only accessed when locked */
-       fp = g->iobs;
-found:
-       fp->_flags = 1;         /* reserve this slot; caller sets real flags */
-       THREAD_UNLOCK();
-       fp->_p = NULL;          /* no current pointer */
-       fp->_w = 0;             /* nothing to read or write */
-       fp->_r = 0;
-       fp->_bf._base = NULL;   /* no buffer */
-       fp->_bf._size = 0;
-       fp->_lbfsize = 0;       /* not line buffered */
-       fp->_file = -1;         /* no file */
-/*     fp->_cookie = <any>; */ /* caller sets cookie, _read/_write etc */
-       fp->_ub._base = NULL;   /* no ungetc buffer */
-       fp->_ub._size = 0;
-       fp->_lb._base = NULL;   /* no line buffer */
-       fp->_lb._size = 0;
-/*     fp->_lock = NULL; */    /* once set always set (reused) */
-       INITEXTRA(fp);
-       fp->_extra->counted = count ? 1 : 0;
-       return (fp);
-}
-
-/*
- * Mark as free and update count as needed
- */
-__private_extern__ void
-__sfprelease(FILE *fp)
-{
-       if (fp->_counted) {
-               OSAtomicDecrement32(&__scounted);
-               fp->_counted = 0;
-       }
-       fp->_flags = 0;
-}
-
-/*
- * XXX.  Force immediate allocation of internal memory.  Not used by stdio,
- * but documented historically for certain applications.  Bad applications.
- */
-__warn_references(f_prealloc, 
-       "warning: this program uses f_prealloc(), which is not recommended.");
-
-void
-f_prealloc(void)
-{
-       struct glue *g;
-       int n;
-
-       n = getdtablesize() - FOPEN_MAX + 20;           /* 20 for slop. */
-       /*
-        * It should be safe to walk the list without locking it;
-        * new nodes are only added to the end and none are ever
-        * removed.
-        */
-       for (g = &__sglue; (n -= g->niobs) > 0 && g->next; g = g->next)
-               /* void */;
-       if ((n > 0) && ((g = moreglue(n)) != NULL)) {
-               THREAD_LOCK();
-               SET_GLUE_PTR(lastglue->next, g);
-               lastglue = g;
-               THREAD_UNLOCK();
-       }
-}
-
-/*
- * exit() calls _cleanup() through *__cleanup, set whenever we
- * open or buffer a file.  This chicanery is done so that programs
- * that do not use stdio need not link it all in.
- *
- * The name `_cleanup' is, alas, fairly well known outside stdio.
- */
-void
-_cleanup()
-{
-       /* (void) _fwalk(fclose); */
-       (void) _fwalk(__sflush);                /* `cheating' */
-}
-
-/*
- * __sinit() is called whenever stdio's internal variables must be set up.
- */
-void
-__sinit()
-{
-       THREAD_LOCK();
-       if (__sdidinit == 0) {
-#if !TARGET_OS_EMBEDDED
-               int i;
-#endif
-               /* Make sure we clean up on exit. */
-               __cleanup = _cleanup;           /* conservative */
-               __stream_max = sysconf(_SC_STREAM_MAX);
-               __scounted = 3;                 /* std{in,out,err} already exists */
-
-#if !TARGET_OS_EMBEDDED
-               /* Set _extra for the usual suspects. */
-               for (i = 0; i < FOPEN_MAX - 3; i++) {
-                       usual[i]._extra = &usual_extra[i];
-                       INITEXTRA(&usual[i]);
-               }
-#endif
-
-               __sdidinit = 1;
-       }
-       THREAD_UNLOCK();
-}
diff --git a/stdio/flags-fbsd.c b/stdio/flags-fbsd.c
deleted file mode 100644 (file)
index 3b90476..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)flags.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/flags.c,v 1.10 2007/01/09 00:28:06 imp Exp $");
-
-#include <sys/types.h>
-#include <sys/file.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include "local.h"
-
-/*
- * Return the (stdio) flags for a given mode.  Store the flags
- * to be passed to an _open() syscall through *optr.
- * Return 0 on error.
- */
-int
-__sflags(mode, optr)
-       const char *mode;
-       int *optr;
-{
-       int ret, m, o;
-
-       switch (*mode++) {
-
-       case 'r':       /* open for reading */
-               ret = __SRD;
-               m = O_RDONLY;
-               o = 0;
-               break;
-
-       case 'w':       /* open for writing */
-               ret = __SWR;
-               m = O_WRONLY;
-               o = O_CREAT | O_TRUNC;
-               break;
-
-       case 'a':       /* open for appending */
-               ret = __SWR;
-               m = O_WRONLY;
-               o = O_CREAT | O_APPEND;
-               break;
-
-       default:        /* illegal mode */
-               errno = EINVAL;
-               return (0);
-       }
-
-       /* [rwa]\+ or [rwa]b\+ means read and write */
-       if (*mode == 'b')
-               mode++;
-       if (*mode == '+') {
-               ret = __SRW;
-               m = O_RDWR;
-               mode++;
-               if (*mode == 'b')
-                       mode++;
-       }
-       if (*mode == 'x')
-               o |= O_EXCL;
-       *optr = m | o;
-       return (ret);
-}
diff --git a/stdio/floatio.h b/stdio/floatio.h
deleted file mode 120000 (symlink)
index a04c54b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./floatio.h
\ No newline at end of file
diff --git a/stdio/flockfile.3 b/stdio/flockfile.3
deleted file mode 100644 (file)
index 924b9e5..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-.\" Copyright (c) 2003 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/stdio/flockfile.3,v 1.3 2003/01/13 01:29:14 tjr Exp $
-.\"
-.Dd January 10, 2003
-.Dt FLOCKFILE 3
-.Os
-.Sh NAME
-.Nm flockfile ,
-.Nm ftrylockfile ,
-.Nm funlockfile
-.Nd "stdio locking functions"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft void
-.Fn flockfile "FILE *file"
-.Ft int
-.Fn ftrylockfile "FILE *file"
-.Ft void
-.Fn funlockfile "FILE *file"
-.Sh DESCRIPTION
-These functions provide explicit application-level locking
-of stdio FILE objects.
-They can be used to avoid output from multiple threads being interspersed,
-input being dispersed among multiple readers, and to avoid the overhead
-of locking the object for each operation.
-.Pp
-The
-.Fn flockfile
-function acquires an exclusive lock on the specified object.
-If another thread has already locked the object,
-.Fn flockfile
-will block until the lock is released.
-.Pp
-The
-.Fn ftrylockfile
-function is a non-blocking version of
-.Fn flockfile ;
-if the lock cannot be acquired immediately,
-.Fn ftrylockfile
-returns non-zero instead of blocking.
-.Pp
-The
-.Fn funlockfile
-function releases the lock on an object acquired by an earlier call to
-.Fn flockfile
-or
-.Fn ftrylockfile .
-.Pp
-These functions behave as if there is a lock count associated
-with each object.
-Each time
-.Fn flockfile
-is called on the object, the count is incremented,
-and each time
-.Fn funlockfile
-is called on the object, the count is decremented.
-The lock is only actually released when the count reaches zero.
-.Sh RETURN VALUES
-The
-.Fn flockfile
-and
-.Fn funlockfile
-functions return no value.
-.Pp
-The
-.Fn ftrylockfile
-function
-returns zero if the object was successfully locked,
-non-zero otherwise.
-.Sh SEE ALSO
-.Xr getc_unlocked 3 ,
-.Xr putc_unlocked 3
-.Sh STANDARDS
-The
-.Fn flockfile ,
-.Fn ftrylockfile ,
-and
-.Fn funlockfile
-functions conform to
-.St -p1003.1-2001 .
diff --git a/stdio/fopen-fbsd.c b/stdio/fopen-fbsd.c
deleted file mode 100644 (file)
index df3deea..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef VARIANT_DARWINEXTSN
-#define _DARWIN_UNLIMITED_STREAMS
-#define COUNT  0
-#elif defined(VARIANT_LEGACY)
-#define COUNT  0
-#else
-#define COUNT  1
-#endif
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fopen.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fopen.c,v 1.14 2008/04/22 17:03:32 jhb Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <limits.h>
-#include "un-namespace.h"
-
-#include "local.h"
-
-FILE *
-fopen(file, mode)
-       const char * __restrict file;
-       const char * __restrict mode;
-{
-       FILE *fp;
-       int f;
-       int flags, oflags;
-
-       if ((flags = __sflags(mode, &oflags)) == 0)
-               return (NULL);
-       if ((fp = __sfp(COUNT)) == NULL)
-               return (NULL);
-       if ((f = _open(file, oflags, DEFFILEMODE)) < 0) {
-               __sfprelease(fp);               /* release */
-               return (NULL);
-       }
-       /*
-        * File descriptors are a full int, but _file is only a short.
-        * If we get a valid file descriptor that is greater than
-        * SHRT_MAX, then the fd will get sign-extended into an
-        * invalid file descriptor.  Handle this case by failing the
-        * open.
-        */
-       if (f > SHRT_MAX) {
-               fp->_flags = 0;                 /* release */
-               _close(f);
-               errno = EMFILE;
-               return (NULL);
-       }
-       fp->_file = f;
-       fp->_flags = flags;
-       fp->_cookie = fp;
-       fp->_read = __sread;
-       fp->_write = __swrite;
-       fp->_seek = __sseek;
-       fp->_close = __sclose;
-       /*
-        * When opening in append mode, even though we use O_APPEND,
-        * we need to seek to the end so that ftell() gets the right
-        * answer.  If the user then alters the seek pointer, or
-        * the file extends, this will fail, but there is not much
-        * we can do about this.  (We could set __SAPP and check in
-        * fseek and ftell.)
-        */
-       if (oflags & O_APPEND)
-               (void)_sseek(fp, (fpos_t)0, SEEK_END);
-       return (fp);
-}
diff --git a/stdio/fopen.3 b/stdio/fopen.3
deleted file mode 100644 (file)
index 3bb0c0f..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fopen.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/fopen.3,v 1.21 2009/09/09 19:38:19 ed Exp $
-.\"
-.Dd January 26, 2003
-.Dt FOPEN 3
-.Os
-.Sh NAME
-.Nm fdopen ,
-.Nm fopen ,
-.Nm freopen
-.Nd stream open functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft FILE *
-.Fo fdopen
-.Fa "int fildes"
-.Fa "const char *mode"
-.Fc
-.Ft FILE *
-.Fo fopen
-.Fa "const char *restrict filename"
-.Fa "const char *restrict mode"
-.Fc
-.Ft FILE *
-.Fo freopen
-.Fa "const char *restrict filename"
-.Fa "const char *restrict mode"
-.Fa "FILE *restrict stream"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fopen
-function
-opens the file whose name is the string pointed to by
-.Fa filename
-and associates a stream with it.
-.Pp
-The argument
-.Fa mode
-points to a string beginning with one of the following
-sequences (Additional characters may follow these sequences.):
-.Bl -tag -width indent
-.It Dq Li r
-Open text file for reading.
-The stream is positioned at the beginning of the file.
-.It Dq Li r+
-Open for reading and writing.
-The stream is positioned at the beginning of the file.
-.It Dq Li w
-Truncate to zero length or create text file for writing.
-The stream is positioned at the beginning of the file.
-.It Dq Li w+
-Open for reading and writing.
-The file is created if it does not exist, otherwise it is truncated.
-The stream is positioned at the beginning of the file.
-.It Dq Li a
-Open for writing.
-The file is created if it does not exist.
-The stream is positioned at the end of the file.
-Subsequent writes to the file will always end up at the then current
-end of file, irrespective of any intervening
-.Xr fseek 3
-or similar.
-.It Dq Li a+
-Open for reading and writing.
-The file is created if it does not exist.
-The stream is positioned at the end of the file.
-Subsequent writes to the file will always end up at the then current
-end of file, irrespective of any intervening
-.Xr fseek 3
-or similar.
-.El
-.Pp
-The
-.Fa mode
-string can also include the letter ``b'' either as last character or
-as a character between the characters in any of the two-character strings
-described above.
-This is strictly for compatibility with
-.St -isoC
-and has no effect; the ``b'' is ignored.
-.Pp
-Finally, as an extension to the standards (and thus may not be portable),
-.Fa mode
-string may end with the letter ``x'', which insists on creating a new file
-when used with ``w'' or ``a''.
-If
-.Fa path
-exists, then an error is returned (this is the equivalent of specifying
-.Dv O_EXCL
-with
-.Xr open 2 ) .
-.Pp
-Any created files will have mode
-.Pf \\*q Dv S_IRUSR
-\&|
-.Dv S_IWUSR
-\&|
-.Dv S_IRGRP
-\&|
-.Dv S_IWGRP
-\&|
-.Dv S_IROTH
-\&|
-.Dv S_IWOTH Ns \\*q
-.Pq Li 0666 ,
-as modified by the process'
-umask value (see
-.Xr umask 2 ) .
-.Pp
-Reads and writes may be intermixed on read/write streams in any order,
-and do not require an intermediate seek as in previous versions of
-.Em stdio .
-This is not portable to other systems, however;
-.Tn ANSI C
-requires that
-a file positioning function intervene between output and input, unless
-an input operation encounters end-of-file.
-.Pp
-The
-.Fn fdopen
-function associates a stream with the existing file descriptor,
-.Fa fildes .
-The mode
-of the stream must be compatible with the mode of the file descriptor.
-When the stream is closed via
-.Xr fclose 3 ,
-.Fa fildes
-is closed also.
-.Pp
-The
-.Fn freopen
-function
-opens the file whose name is the string pointed to by
-.Fa filename
-and associates the stream pointed to by
-.Fa stream
-with it.
-The original stream (if it exists) is closed.
-The
-.Fa mode
-argument is used just as in the
-.Fn fopen
-function.
-.Pp
-If the
-.Fa filename
-argument is
-.Dv NULL ,
-.Fn freopen
-attempts to re-open the file associated with
-.Fa stream
-with a new mode.
-The new mode must be compatible with the mode that the stream was originally
-opened with:
-.Bl -bullet -offset indent
-.It
-Streams originally opened with mode
-.Dq Li r
-can only be reopened with that same mode.
-.It
-Streams originally opened with mode
-.Dq Li a
-can be reopened with the same mode, or mode
-.Dq Li w .
-.It
-Streams originally opened with mode
-.Dq Li w
-can be reopened with the same mode, or mode
-.Dq Li a .
-.It
-Streams originally opened with mode
-.Dq Li r+ ,
-.Dq Li w+ ,
-or
-.Dq Li a+
-can be reopened with any mode.
-.El
-.Pp
-The primary use of the
-.Fn freopen
-function
-is to change the file associated with a
-standard text stream
-.Dv ( stderr , stdin ,
-or
-.Dv stdout ) .
-.Sh RETURN VALUES
-Upon successful completion
-.Fn fopen ,
-.Fn fdopen ,
-and
-.Fn freopen
-return a
-.Tn FILE
-pointer.
-Otherwise,
-.Dv NULL
-is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa mode
-argument
-to
-.Fn fopen ,
-.Fn fdopen ,
-or
-.Fn freopen
-was invalid.
-.El
-.Pp
-The
-.Fn fopen ,
-.Fn fdopen
-and
-.Fn freopen
-functions
-may also fail and set
-.Va errno
-for any of the errors specified for the routine
-.Xr malloc 3 .
-.Pp
-The
-.Fn fopen
-function
-may also fail and set
-.Va errno
-for any of the errors specified for the routine
-.Xr open 2 .
-.Pp
-The
-.Fn fdopen
-function
-may also fail and set
-.Va errno
-for any of the errors specified for the routine
-.Xr fcntl 2 .
-.Pp
-The
-.Fn freopen
-function
-may also fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr open 2 ,
-.Xr fclose 3
-and
-.Xr fflush 3 .
-.Sh SEE ALSO
-.Xr open 2 ,
-.Xr fclose 3 ,
-.Xr fileno 3 ,
-.Xr fseek 3 ,
-.Xr funopen 3
-.Sh STANDARDS
-The
-.Fn fopen
-and
-.Fn freopen
-functions
-conform to
-.St -isoC .
-The
-.Fn fdopen
-function
-conforms to
-.St -p1003.1-88 .
diff --git a/stdio/fprintf-fbsd.c b/stdio/fprintf-fbsd.c
deleted file mode 100644 (file)
index 76bca94..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fprintf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fprintf.c,v 1.11 2007/01/09 00:28:06 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-int
-fprintf(FILE * __restrict fp, const char * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vfprintf_l(fp, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-fprintf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       /* no need to call NORMALIZE_LOCALE(loc), because vfprintf_l will */
-       va_start(ap, fmt);
-       ret = vfprintf_l(fp, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/fpurge-fbsd.c b/stdio/fpurge-fbsd.c
deleted file mode 120000 (symlink)
index 87455f1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fpurge.c
\ No newline at end of file
diff --git a/stdio/fputc-fbsd.c b/stdio/fputc-fbsd.c
deleted file mode 120000 (symlink)
index c141df3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fputc.c
\ No newline at end of file
diff --git a/stdio/fputs-fbsd.c b/stdio/fputs-fbsd.c
deleted file mode 100644 (file)
index 163541b..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fputs.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fputs.c,v 1.12 2007/01/09 00:28:06 imp Exp $");
-
-#include "namespace.h"
-#include <stdio.h>
-#include <string.h>
-#include "un-namespace.h"
-#include "fvwrite.h"
-#include "libc_private.h"
-#include "local.h"
-
-// 3340719: __puts_null__ is used if string is NULL.  Defined in puts.c
-__private_extern__ char const __puts_null__[];
-
-/*
- * Write the given string to the given file.
- */
-int
-fputs(s, fp)
-       const char * __restrict s;
-       FILE * __restrict fp;
-{
-       int retval;
-       struct __suio uio;
-       struct __siov iov;
-
-       // 3340719: __puts_null__ is used if s is NULL
-       if(s == NULL)
-               s = __puts_null__;
-       iov.iov_base = (void *)s;
-       iov.iov_len = uio.uio_resid = strlen(s);
-       uio.uio_iov = &iov;
-       uio.uio_iovcnt = 1;
-       FLOCKFILE(fp);
-       ORIENT(fp, -1);
-       retval = __sfvwrite(fp, &uio);
-       FUNLOCKFILE(fp);
-#if __DARWIN_UNIX03
-       if (retval == 0)
-               return iov.iov_len;
-#endif /* __DARWIN_UNIX03 */
-       return (retval);
-}
diff --git a/stdio/fputs.3 b/stdio/fputs.3
deleted file mode 100644 (file)
index 4c4ca1e..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fputs.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/fputs.3,v 1.14 2007/04/19 14:01:04 phk Exp $
-.\"
-.Dd June 4, 1993
-.Dt FPUTS 3
-.Os
-.Sh NAME
-.Nm fputs ,
-.Nm puts
-.Nd output a line to a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fo fputs
-.Fa "const char *restrict s"
-.Fa "FILE *restrict stream"
-.Fc
-.Ft int
-.Fo puts
-.Fa "const char *s"
-.Fc
-.Sh DESCRIPTION
-The function
-.Fn fputs
-writes the string pointed to by
-.Fa s
-to the stream pointed to by
-.Fa stream .
-.\" The terminating
-.\" .Dv NUL
-.\" character is not written.
-.Pp
-The function
-.Fn puts
-writes the string
-.Fa s ,
-and a terminating newline character,
-to the stream
-.Dv stdout .
-.Sh RETURN VALUES
-The functions
-.Fn fputs
-and
-.Fn puts
-return a nonnegative integer on success and
-.Dv EOF
-on error.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa stream
-argument
-is not a writable stream.
-.El
-.Pp
-The functions
-.Fn fputs
-and
-.Fn puts
-may also fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr write 2 .
-.Sh COMPATIBILITY
-.Fn fputs
-now returns a non-negative number (as opposed to 0)
-on successful completion.
-As a result, many tests (e.g., "fputs() == 0", "fputs() != 0")
-do not give the desired result.
-Use "fputs() != EOF" or "fputs() == EOF"
-to determine success or failure.
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fputws 3 ,
-.Xr putc 3 ,
-.Xr stdio 3
-.Sh STANDARDS
-The functions
-.Fn fputs
-and
-.Fn puts
-conform to
-.St -isoC .
-While not mentioned in the standard, both
-.Fn fputs
-and
-.Fn puts
-print
-.Ql (null)
-if
-.Fa str
-is
-.Dv NULL .
diff --git a/stdio/fputwc-fbsd.c b/stdio/fputwc-fbsd.c
deleted file mode 100644 (file)
index e835bc2..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fputwc.c,v 1.11 2008/04/17 22:17:53 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-#include "mblocal.h"
-
-/*
- * Non-MT-safe version.
- */
-__private_extern__ wint_t
-__fputwc(wchar_t wc, FILE *fp, locale_t loc)
-{
-       char buf[MB_LEN_MAX];
-       size_t i, len;
-       struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
-
-       if (xrl->__mb_cur_max == 1 && wc > 0 && wc <= UCHAR_MAX) {
-               /*
-                * Assume single-byte locale with no special encoding.
-                * A more careful test would be to check
-                * _CurrentRuneLocale->encoding.
-                */
-               *buf = (unsigned char)wc;
-               len = 1;
-       } else {
-               if ((len = loc->__lc_ctype->__wcrtomb(buf, wc, &fp->_mbstate, loc)) == (size_t)-1) {
-                       fp->_flags |= __SERR;
-                       return (WEOF);
-               }
-       }
-
-       for (i = 0; i < len; i++)
-               if (__sputc((unsigned char)buf[i], fp) == EOF)
-                       return (WEOF);
-
-       return ((wint_t)wc);
-}
-
-/*
- * MT-safe version.
- */
-wint_t
-fputwc(wchar_t wc, FILE *fp)
-{
-       wint_t r;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       r = __fputwc(wc, fp, __current_locale());
-       FUNLOCKFILE(fp);
-
-       return (r);
-}
-
-wint_t
-fputwc_l(wchar_t wc, FILE *fp, locale_t loc)
-{
-       wint_t r;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       r = __fputwc(wc, fp, loc);
-       FUNLOCKFILE(fp);
-
-       return (r);
-}
diff --git a/stdio/fputws-fbsd.c b/stdio/fputws-fbsd.c
deleted file mode 100644 (file)
index 1ff0484..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fputws.c,v 1.8 2009/01/15 18:53:52 rdivacky Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "fvwrite.h"
-#include "libc_private.h"
-#include "local.h"
-#include "mblocal.h"
-
-int
-fputws_l(const wchar_t * __restrict ws, FILE * __restrict fp, locale_t loc)
-{
-       size_t nbytes;
-       char buf[BUFSIZ];
-       struct __suio uio;
-       struct __siov iov;
-       const wchar_t *wsp = ws;
-       size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
-           size_t, size_t, mbstate_t * __restrict, locale_t);
-
-       NORMALIZE_LOCALE(loc);
-       __wcsnrtombs = loc->__lc_ctype->__wcsnrtombs;
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       if (prepwrite(fp) != 0)
-               goto error;
-       uio.uio_iov = &iov;
-       uio.uio_iovcnt = 1;
-       iov.iov_base = buf;
-       do {
-               nbytes = __wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf),
-                   &fp->_mbstate, loc);
-               if (nbytes == (size_t)-1)
-                       goto error;
-               iov.iov_len = uio.uio_resid = nbytes;
-               if (__sfvwrite(fp, &uio) != 0)
-                       goto error;
-       } while (wsp != NULL);
-       FUNLOCKFILE(fp);
-       return (0);
-
-error:
-       FUNLOCKFILE(fp);
-       return (-1);
-}
-
-int
-fputws(const wchar_t * __restrict ws, FILE * __restrict fp)
-{
-       return fputws_l(ws, fp, __current_locale());
-}
diff --git a/stdio/fputws.3 b/stdio/fputws.3
deleted file mode 100644 (file)
index d7326b2..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fputs.3    8.1 (Berkeley) 6/4/93
-.\" FreeBSD: src/lib/libc/stdio/fputs.3,v 1.8 2001/10/01 16:08:59 ru Exp
-.\" $FreeBSD: src/lib/libc/stdio/fputws.3,v 1.6 2007/01/09 00:28:06 imp Exp $
-.\"
-.Dd August 6, 2002
-.Dt FPUTWS 3
-.Os
-.Sh NAME
-.Nm fputws ,
-.Nm fputws_l
-.Nd output a line of wide characters to a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft int
-.Fo fputws
-.Fa "const wchar_t *restrict ws"
-.Fa "FILE *restrict stream"
-.Fc
-.In stdio.h
-.In wchar.h
-.In xlocale.h
-.Ft int
-.Fo fputws_l
-.Fa "const wchar_t *restrict ws"
-.Fa "FILE *restrict stream"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fputws
-function writes the wide character string pointed to by
-.Fa ws
-to the stream pointed to by
-.Fa stream .
-.Pp
-Although the
-.Fn fputws
-function uses the current locale, the
-.Fn fputws_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn fputws
-function
-returns 0 on success and \-1 on error.
-.Sh ERRORS
-The
-.Fn fputws
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa stream
-argument supplied
-is not a writable stream.
-.El
-.Pp
-The
-.Fn fputws
-function may also fail and set
-.Va errno
-for any of the errors specified for the routine
-.Xr write 2 .
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fputs 3 ,
-.Xr putwc 3 ,
-.Xr stdio 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn fputws
-function conforms to
-.St -p1003.1-2001 .
diff --git a/stdio/fread-fbsd.c b/stdio/fread-fbsd.c
deleted file mode 100644 (file)
index 544d94a..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fread.c    8.2 (Berkeley) 12/11/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fread.c,v 1.16 2009/07/12 13:09:43 ed Exp $");
-
-#include "namespace.h"
-#include <stdio.h>
-#include <string.h>
-#include "un-namespace.h"
-#include "local.h"
-#include "libc_private.h"
-
-/*
- * MT-safe version
- */
-
-size_t
-fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp)
-{
-       size_t ret;
-
-       FLOCKFILE(fp);
-       ret = __fread(buf, size, count, fp);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-size_t
-__fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp)
-{
-       size_t resid;
-       char *p;
-       int r, ret;
-       size_t total;
-
-       /*
-        * ANSI and SUSv2 require a return value of 0 if size or count are 0.
-        */
-       if ((resid = count * size) == 0)
-               return (0);
-       ORIENT(fp, -1);
-       if (fp->_r < 0)
-               fp->_r = 0;
-       total = resid;
-       p = buf;
-       /* first deal with anything left in buffer, plus any ungetc buffers */
-       while (resid > (r = fp->_r)) {
-               (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
-               fp->_p += r;
-               /* fp->_r = 0 ... done in __srefill */
-               p += r;
-               resid -= r;
-               if ((ret = __srefill0(fp)) > 0)
-                       break;
-               else if (ret) {
-                       /* no more input: return partial result */
-                       return ((total - resid) / size);
-               }
-       }
-       /*
-        * 5980080: don't use optimization if __SMBF not set (meaning setvbuf
-        * was called, and the buffer belongs to the user).
-        * 6180417: but for unbuffered (__SMBF is not set), so specifically
-        * test for it.
-        */
-       if ((fp->_flags & (__SMBF | __SNBF)) && resid > fp->_bf._size) {
-               struct __sbuf save;
-               size_t n;
-
-               save = fp->_bf;
-               fp->_bf._base = p;
-               fp->_bf._size = resid;
-               while (fp->_bf._size > 0) {
-                       if ((ret = __srefill1(fp)) != 0) {
-                               /* no more input: return partial result */
-                               resid = fp->_bf._size;
-                               fp->_bf = save;
-                               fp->_p = fp->_bf._base;
-                               /* fp->_r = 0;  already set in __srefill1 */
-                               return ((total - resid) / size);
-                       }
-                       fp->_bf._base += fp->_r;
-                       fp->_bf._size -= fp->_r;
-               }
-               fp->_bf = save;
-               n = fp->_bf._size * ((resid - 1) / fp->_bf._size);
-               r = resid - n;
-               (void)memcpy((void *)fp->_bf._base, (void *)(p + n), (size_t)r);
-               fp->_p = fp->_bf._base + r;
-               fp->_r = 0;
-       } else {
-               while (resid > (r = fp->_r)) {
-                       (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
-                       fp->_p += r;
-                       /* fp->_r = 0 ... done in __srefill */
-                       p += r;
-                       resid -= r;
-                       if (__srefill1(fp)) {
-                               /* no more input: return partial result */
-                               return ((total - resid) / size);
-                       }
-               }
-               (void)memcpy((void *)p, (void *)fp->_p, resid);
-               fp->_r -= resid;
-               fp->_p += resid;
-       }
-       return (count);
-}
diff --git a/stdio/fread.3 b/stdio/fread.3
deleted file mode 100644 (file)
index 1ba5005..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fread.3    8.2 (Berkeley) 3/8/94
-.\" $FreeBSD: src/lib/libc/stdio/fread.3,v 1.10 2007/01/09 00:28:06 imp Exp $
-.\"
-.Dd March 8, 1994
-.Dt FREAD 3
-.Os
-.Sh NAME
-.Nm fread ,
-.Nm fwrite
-.Nd binary stream input/output
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft size_t
-.Fn fread "void *restrict ptr" "size_t size" "size_t nitems" \
-    "FILE *restrict stream"
-.Ft size_t
-.Fn fwrite "const void *restrict ptr" "size_t size" "size_t nitems" \
-    "FILE *restrict stream"
-.Sh DESCRIPTION
-The function
-.Fn fread
-reads
-.Fa nitems
-objects, each
-.Fa size
-bytes long, from the stream pointed to by
-.Fa stream ,
-storing them at the location given by
-.Fa ptr .
-.Pp
-The function
-.Fn fwrite
-writes
-.Fa nitems
-objects, each
-.Fa size
-bytes long, to the stream pointed to by
-.Fa stream ,
-obtaining them from the location given by
-.Fa ptr .
-.Sh RETURN VALUES
-The functions
-.Fn fread
-and
-.Fn fwrite
-advance the file position indicator for the stream
-by the number of bytes read or written.
-They return the number of objects read or written.
-If an error occurs, or the end-of-file is reached,
-the return value is a short object count (or zero).
-.Pp
-The function
-.Fn fread
-does not distinguish between end-of-file and error; callers
-must use
-.Xr feof 3
-and
-.Xr ferror 3
-to determine which occurred.
-The function
-.Fn fwrite
-returns a value less than
-.Fa nitems
-only if a write error has occurred.
-.Sh SEE ALSO
-.Xr read 2 ,
-.Xr write 2
-.Sh STANDARDS
-The functions
-.Fn fread
-and
-.Fn fwrite
-conform to
-.St -isoC .
diff --git a/stdio/freopen-fbsd.c b/stdio/freopen-fbsd.c
deleted file mode 100644 (file)
index 3451106..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)freopen.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/freopen.c,v 1.21 2008/04/17 22:17:54 jhb Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-/*
- * Re-direct an existing, open (probably) file to some other file.
- * ANSI is written such that the original file gets closed if at
- * all possible, no matter what.
- */
-FILE *
-freopen(file, mode, fp)
-       const char * __restrict file;
-       const char * __restrict mode;
-       FILE *fp;
-{
-       int f;
-       int dflags, flags, isopen, oflags, sverrno, wantfd;
-
-       if ((flags = __sflags(mode, &oflags)) == 0) {
-               sverrno = errno;
-               (void) fclose(fp);
-               errno = sverrno;
-               return (NULL);
-       }
-
-       FLOCKFILE(fp);
-
-       if (!__sdidinit)
-               __sinit();
-
-       /*
-        * If the filename is a NULL pointer, the caller is asking us to
-        * re-open the same file with a different mode. We allow this only
-        * if the modes are compatible.
-        */
-       if (file == NULL) {
-               /* See comment below regarding freopen() of closed files. */
-               if (fp->_flags == 0) {
-                       FUNLOCKFILE(fp);
-                       errno = EINVAL;
-                       return (NULL);
-               }
-               if ((dflags = _fcntl(fp->_file, F_GETFL)) < 0) {
-                       sverrno = errno;
-                       fclose(fp);
-                       FUNLOCKFILE(fp);
-                       errno = sverrno;
-                       return (NULL);
-               }
-               if ((dflags & O_ACCMODE) != O_RDWR && (dflags & O_ACCMODE) !=
-                   (oflags & O_ACCMODE)) {
-                       fclose(fp);
-                       FUNLOCKFILE(fp);
-                       errno = EBADF;
-                       return (NULL);
-               }
-               if (fp->_flags & __SWR)
-                       (void) __sflush(fp);
-               if ((oflags ^ dflags) & O_APPEND) {
-                       dflags &= ~O_APPEND;
-                       dflags |= oflags & O_APPEND;
-                       if (_fcntl(fp->_file, F_SETFL, dflags) < 0) {
-                               sverrno = errno;
-                               fclose(fp);
-                               FUNLOCKFILE(fp);
-                               errno = sverrno;
-                               return (NULL);
-                       }
-               }
-               if (oflags & O_TRUNC)
-                       (void) ftruncate(fp->_file, (off_t)0);
-               if (!(oflags & O_APPEND))
-                       (void) _sseek(fp, (fpos_t)0, SEEK_SET);
-               f = fp->_file;
-               isopen = 0;
-               wantfd = -1;
-               goto finish;
-       }
-
-       /*
-        * There are actually programs that depend on being able to "freopen"
-        * descriptors that weren't originally open.  Keep this from breaking.
-        * Remember whether the stream was open to begin with, and which file
-        * descriptor (if any) was associated with it.  If it was attached to
-        * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin)
-        * should work.  This is unnecessary if it was not a Unix file.
-        *
-        * For UNIX03, we always close if it was open.
-        */
-       if (fp->_flags == 0) {
-               fp->_flags = __SEOF;    /* hold on to it */
-               isopen = 0;
-               wantfd = -1;
-       } else {
-               /* flush the stream; ANSI doesn't require this. */
-               if (fp->_flags & __SWR)
-                       (void) __sflush(fp);
-               /* if close is NULL, closing is a no-op, hence pointless */
-#if __DARWIN_UNIX03
-               if (fp->_close)
-                       (void) (*fp->_close)(fp->_cookie);
-               isopen = 0;
-               wantfd = -1;
-#else /* !__DARWIN_UNIX03 */
-               isopen = fp->_close != NULL;
-               if ((wantfd = fp->_file) < 0 && isopen) {
-                       (void) (*fp->_close)(fp->_cookie);
-                       isopen = 0;
-               }
-#endif /* __DARWIN_UNIX03 */
-       }
-
-       /* Get a new descriptor to refer to the new file. */
-       f = _open(file, oflags, DEFFILEMODE);
-       if (f < 0 && isopen) {
-               /* If out of fd's close the old one and try again. */
-               if (errno == ENFILE || errno == EMFILE) {
-                       (void) (*fp->_close)(fp->_cookie);
-                       isopen = 0;
-                       f = _open(file, oflags, DEFFILEMODE);
-               }
-       }
-       sverrno = errno;
-
-finish:
-       /*
-        * Finish closing fp.  Even if the open succeeded above, we cannot
-        * keep fp->_base: it may be the wrong size.  This loses the effect
-        * of any setbuffer calls, but stdio has always done this before.
-        */
-       if (isopen)
-               (void) (*fp->_close)(fp->_cookie);
-       if (fp->_flags & __SMBF)
-               free((char *)fp->_bf._base);
-       fp->_w = 0;
-       fp->_r = 0;
-       fp->_p = NULL;
-       fp->_bf._base = NULL;
-       fp->_bf._size = 0;
-       fp->_lbfsize = 0;
-       if (HASUB(fp))
-               FREEUB(fp);
-       fp->_ub._size = 0;
-       if (HASLB(fp))
-               FREELB(fp);
-       fp->_lb._size = 0;
-       fp->_orientation = 0;
-       memset(&fp->_mbstate, 0, sizeof(mbstate_t));
-
-       if (f < 0) {                    /* did not get it after all */
-               __sfprelease(fp);       /* set it free */
-               FUNLOCKFILE(fp);
-               errno = sverrno;        /* restore in case _close clobbered */
-               return (NULL);
-       }
-
-       /*
-        * If reopening something that was open before on a real file, try
-        * to maintain the descriptor.  Various C library routines (perror)
-        * assume stderr is always fd STDERR_FILENO, even if being freopen'd.
-        */
-       if (wantfd >= 0 && f != wantfd) {
-               if (_dup2(f, wantfd) >= 0) {
-                       (void)_close(f);
-                       f = wantfd;
-               }
-       }
-
-       /*
-        * File descriptors are a full int, but _file is only a short.
-        * If we get a valid file descriptor that is greater than
-        * SHRT_MAX, then the fd will get sign-extended into an
-        * invalid file descriptor.  Handle this case by failing the
-        * open.
-        */
-       if (f > SHRT_MAX) {
-               __sfprelease(fp);       /* set it free */
-               FUNLOCKFILE(fp);
-               errno = EMFILE;
-               return (NULL);
-       }
-
-       fp->_flags = flags;
-       fp->_file = f;
-       fp->_cookie = fp;
-       fp->_read = __sread;
-       fp->_write = __swrite;
-       fp->_seek = __sseek;
-       fp->_close = __sclose;
-       /*
-        * When opening in append mode, even though we use O_APPEND,
-        * we need to seek to the end so that ftell() gets the right
-        * answer.  If the user then alters the seek pointer, or
-        * the file extends, this will fail, but there is not much
-        * we can do about this.  (We could set __SAPP and check in
-        * fseek and ftell.)
-        */
-       if (oflags & O_APPEND)
-               (void) _sseek(fp, (fpos_t)0, SEEK_END);
-       FUNLOCKFILE(fp);
-       return (fp);
-}
diff --git a/stdio/fscanf-fbsd.c b/stdio/fscanf-fbsd.c
deleted file mode 100644 (file)
index 2db747e..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fscanf.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fscanf.c,v 1.13 2007/01/09 00:28:06 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include <stdarg.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-int
-fscanf(FILE * __restrict fp, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       FLOCKFILE(fp);
-       ret = __svfscanf_l(fp, __current_locale(), fmt, ap);
-       va_end(ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-int
-fscanf_l(FILE * __restrict fp, locale_t loc, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       NORMALIZE_LOCALE(loc);
-       va_start(ap, fmt);
-       FLOCKFILE(fp);
-       ret = __svfscanf_l(fp, loc, fmt, ap);
-       va_end(ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
diff --git a/stdio/fseek-fbsd.c b/stdio/fseek-fbsd.c
deleted file mode 120000 (symlink)
index 9d9ddce..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fseek.c
\ No newline at end of file
diff --git a/stdio/fseek.3 b/stdio/fseek.3
deleted file mode 100644 (file)
index edf7791..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)fseek.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/fseek.3,v 1.27 2007/06/18 02:13:04 ache Exp $
-.\"
-.Dd March 19, 2004
-.Dt FSEEK 3
-.Os
-.Sh NAME
-.Nm fgetpos ,
-.Nm fseek ,
-.Nm fseeko ,
-.Nm fsetpos ,
-.Nm ftell ,
-.Nm ftello ,
-.Nm rewind
-.Nd reposition a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fo fgetpos
-.Fa "FILE *restrict stream"
-.Fa "fpos_t *restrict pos"
-.Fc
-.Ft int
-.Fo fseek
-.Fa "FILE *stream"
-.Fa "long offset"
-.Fa "int whence"
-.Fc
-.Ft int
-.Fo fseeko
-.Fa "FILE *stream"
-.Fa "off_t offset"
-.Fa "int whence"
-.Fc
-.Ft int
-.Fo fsetpos
-.Fa "FILE *stream"
-.Fa "const fpos_t *pos"
-.Fc
-.Ft long
-.Fo ftell
-.Fa "FILE *stream"
-.Fc
-.Ft off_t
-.Fo ftello
-.Fa "FILE *stream"
-.Fc
-.Ft void
-.Fo rewind
-.Fa "FILE *stream"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fseek
-function sets the file position indicator for the stream pointed
-to by
-.Fa stream .
-The new position, measured in bytes, is obtained by adding
-.Fa offset
-bytes to the position specified by
-.Fa whence .
-If
-.Fa whence
-is set to
-.Dv SEEK_SET ,
-.Dv SEEK_CUR ,
-or
-.Dv SEEK_END ,
-the offset is relative to the
-start of the file, the current position indicator, or end-of-file,
-respectively.
-A successful call to the
-.Fn fseek
-function clears the end-of-file indicator for the stream and undoes
-any effects of the
-.Xr ungetc 3
-and
-.Xr ungetwc 3
-functions on the same stream.
-.Pp
-The
-.Fn ftell
-function
-obtains the current value of the file position indicator for the
-stream pointed to by
-.Fa stream .
-.Pp
-The
-.Fn rewind
-function sets the file position indicator for the stream pointed
-to by
-.Fa stream
-to the beginning of the file.
-It is equivalent to:
-.Pp
-.Dl (void)fseek(stream, 0L, SEEK_SET)
-.Pp
-except that the error indicator for the stream is also cleared
-(see
-.Xr clearerr 3 ) .
-.Pp
-Since
-.Fn rewind
-does not return a value,
-an application wishing to detect errors should clear
-.Va errno ,
-then call
-.Fn rewind ,
-and if
-.Va errno
-is non-zero, assume an error has occurred.
-.Pp
-The
-.Fn fseeko
-function is identical to
-.Fn fseek ,
-except it takes an
-.Fa off_t
-argument
-instead of a
-.Fa long .
-Likewise, the
-.Fn ftello
-function is identical to
-.Fn ftell ,
-except it returns an
-.Fa off_t .
-.Pp
-The
-.Fn fgetpos
-and
-.Fn fsetpos
-functions
-are alternate interfaces for retrieving and setting the current position in
-the file, similar to
-.Fn ftell
-and
-.Fn fseek ,
-except that the current position is stored in an opaque object of
-type
-.Vt fpos_t
-pointed to by
-.Fa pos .
-These functions provide a portable way to seek to offsets larger than
-those that can be represented by a
-.Vt long int .
-They may also store additional state information in the
-.Vt fpos_t
-object to facilitate seeking within files containing multibyte
-characters with state-dependent encodings.
-Although
-.Vt fpos_t
-has traditionally been an integral type,
-applications cannot assume that it is;
-in particular, they must not perform arithmetic on objects
-of this type.
-.Pp
-If the stream is a wide character stream (see
-.Xr fwide 3 ) ,
-the position specified by the combination of
-.Fa offset
-and
-.Fa whence
-must contain the first byte of a multibyte sequence.
-.Sh RETURN VALUES
-The
-.Fn rewind
-function
-returns no value.
-.Pp
-.Rv -std fgetpos fseek fseeko fsetpos
-.Pp
-Upon successful completion,
-.Fn ftell
-and
-.Fn ftello
-return the current offset.
-Otherwise, \-1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa stream
-argument
-is not a seekable stream.
-.It Bq Er EINVAL
-The
-.Fa whence
-argument is invalid or
-the resulting file-position
-indicator would be set to a negative value.
-.It Bq Er EOVERFLOW
-The resulting file offset would be a value which
-cannot be represented correctly in an object of type
-.Fa off_t
-for
-.Fn fseeko
-and
-.Fn ftello
-or
-.Fa long
-for
-.Fn fseek
-and
-.Fn ftell .
-.It Bq Er ESPIPE
-The file descriptor underlying stream is associated with a pipe or FIFO
-or file-position indicator value is unspecified
-(see
-.Xr ungetc 3 ) .
-.El
-.Pp
-The functions
-.Fn fgetpos ,
-.Fn fseek ,
-.Fn fseeko ,
-.Fn fsetpos ,
-.Fn ftell ,
-.Fn ftello ,
-and
-.Fn rewind
-may also fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr fflush 3 ,
-.Xr fstat 2 ,
-.Xr lseek 2 ,
-and
-.Xr malloc 3 .
-.Sh LEGACY SYNOPSIS
-.Fd #include <stdio.h>
-.Fd #include <sys/types.h>
-.Pp
-.Ft int
-.br
-.Fo fseeko
-.Fa "FILE *stream"
-.Fa "off_t offset"
-.Fa "int whence"
-.Fc ;
-.Pp
-The include file
-.In sys/types.h
-supplies the definition for
-.Vt off_t .
-.Sh SEE ALSO
-.Xr lseek 2 ,
-.Xr clearerr 3 ,
-.Xr fwide 3 ,
-.Xr ungetc 3 ,
-.Xr ungetwc 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn fgetpos ,
-.Fn fsetpos ,
-.Fn fseek ,
-.Fn ftell ,
-and
-.Fn rewind
-functions
-conform to
-.St -isoC .
-.Pp
-The
-.Fn fseeko
-and
-.Fn ftello
-functions conform to
-.St -p1003.1-2001 .
diff --git a/stdio/fsetpos-fbsd.c b/stdio/fsetpos-fbsd.c
deleted file mode 120000 (symlink)
index 513eb4a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fsetpos.c
\ No newline at end of file
diff --git a/stdio/ftell-fbsd.c b/stdio/ftell-fbsd.c
deleted file mode 100644 (file)
index 8bb5716..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ftell.c    8.2 (Berkeley) 5/4/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/ftell.c,v 1.27 2007/01/09 00:28:06 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include "un-namespace.h"
-#include "local.h"
-#include "libc_private.h"
-
-/*
- * standard ftell function.
- */
-long
-ftell(fp)
-       FILE *fp;
-{
-       off_t rv;
-
-       rv = ftello(fp);
-       if (rv > LONG_MAX) {
-               errno = EOVERFLOW;
-               return (-1);
-       }
-       return (rv);
-}
-
-/*
- * ftello: return current offset.
- */
-off_t
-ftello(fp)
-       FILE *fp;
-{
-       fpos_t rv;
-       int ret;
-
-       FLOCKFILE(fp);
-       ret = _ftello(fp, &rv);
-       FUNLOCKFILE(fp);
-       if (ret)
-               return (-1);
-       if (rv < 0) {   /* Unspecified value because of ungetc() at 0 */
-               errno = ESPIPE;
-               return (-1);
-       }
-       return (rv);
-}
-
-int
-_ftello(fp, offset)
-       FILE *fp;
-       fpos_t *offset;
-{
-       fpos_t pos;
-       size_t n;
-
-       if (fp->_seek == NULL) {
-               errno = ESPIPE;                 /* historic practice */
-               return (1);
-       }
-
-       /*
-        * Find offset of underlying I/O object, then
-        * adjust for buffered bytes.
-        */
-       if (__sflush(fp))               /* may adjust seek offset on append stream */
-               return (1);
-       if (fp->_flags & __SOFF)
-               pos = fp->_offset;
-       else {
-               pos = _sseek(fp, (fpos_t)0, SEEK_CUR);
-               if (pos == -1)
-                       return (1);
-       }
-       if (fp->_flags & __SRD) {
-               /*
-                * Reading.  Any unread characters (including
-                * those from ungetc) cause the position to be
-                * smaller than that in the underlying object.
-                */
-               if ((pos -= (HASUB(fp) ? fp->_ur : fp->_r)) < 0) {
-                       fp->_flags |= __SERR;
-                       errno = EIO;
-                       return (1);
-               }
-               if (HASUB(fp))
-                       pos -= fp->_r;  /* Can be negative at this point. */
-       } else if ((fp->_flags & __SWR) && fp->_p != NULL) {
-               /*
-                * Writing.  Any buffered characters cause the
-                * position to be greater than that in the
-                * underlying object.
-                */
-               n = fp->_p - fp->_bf._base;
-               if (pos > OFF_MAX - n) {
-                       errno = EOVERFLOW;
-                       return (1);
-               }
-               pos += n;
-       }
-       *offset = pos;
-       return (0);
-}
diff --git a/stdio/funopen-fbsd.c b/stdio/funopen-fbsd.c
deleted file mode 100644 (file)
index 408f0f4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)funopen.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/funopen.c,v 1.7 2009/12/05 19:31:38 ed Exp $");
-
-#include <stdio.h>
-#include <errno.h>
-
-#include "local.h"
-
-FILE *
-funopen(const void *cookie,
-       int (*readfn)(void *, char *, int),
-       int (*writefn)(void *, const char *, int),
-       fpos_t (*seekfn)(void *, fpos_t, int),
-       int (*closefn)(void *))
-{
-       FILE *fp;
-       int flags;
-
-       if (readfn == NULL) {
-               if (writefn == NULL) {          /* illegal */
-                       errno = EINVAL;
-                       return (NULL);
-               } else
-                       flags = __SWR;          /* write only */
-       } else {
-               if (writefn == NULL)
-                       flags = __SRD;          /* read only */
-               else
-                       flags = __SRW;          /* read-write */
-       }
-       /* funopen in not covered in SUSv3, so never count the streams */
-       if ((fp = __sfp(0)) == NULL)
-               return (NULL);
-       fp->_flags = flags;
-       fp->_file = -1;
-       fp->_cookie = (void *)cookie;
-       fp->_read = readfn;
-       fp->_write = writefn;
-       fp->_seek = seekfn;
-       fp->_close = closefn;
-       return (fp);
-}
diff --git a/stdio/funopen.3 b/stdio/funopen.3
deleted file mode 120000 (symlink)
index 0d1067a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./funopen.3
\ No newline at end of file
diff --git a/stdio/fvwrite-fbsd.c b/stdio/fvwrite-fbsd.c
deleted file mode 120000 (symlink)
index 82b857c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fvwrite.c
\ No newline at end of file
diff --git a/stdio/fvwrite.h b/stdio/fvwrite.h
deleted file mode 120000 (symlink)
index 365b356..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fvwrite.h
\ No newline at end of file
diff --git a/stdio/fwalk-fbsd.c b/stdio/fwalk-fbsd.c
deleted file mode 120000 (symlink)
index f72aef9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fwalk.c
\ No newline at end of file
diff --git a/stdio/fwide-fbsd.c b/stdio/fwide-fbsd.c
deleted file mode 120000 (symlink)
index 76245a0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./fwide.c
\ No newline at end of file
diff --git a/stdio/fwide.3 b/stdio/fwide.3
deleted file mode 100644 (file)
index 93163f3..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-.\"    $NetBSD: fwide.3,v 1.3 2002/02/07 07:00:25 ross Exp $
-.\"
-.\" Copyright (c)2001 Citrus Project,
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Citrus: xpg4dl/FreeBSD/lib/libc/stdio/fwide.3,v 1.2 2001/12/07 04:47:08 yamt Exp $
-.\" $FreeBSD: src/lib/libc/stdio/fwide.3,v 1.3 2002/12/18 12:45:10 ru Exp $
-.\"
-.Dd October 24, 2001
-.Dt FWIDE 3
-.Os
-.Sh NAME
-.Nm fwide
-.Nd get/set orientation of a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft int
-.Fn fwide "FILE *stream" "int mode"
-.Sh DESCRIPTION
-The
-.Fn fwide
-function
-determines the orientation of the stream pointed at by
-.Fa stream .
-.Pp
-If the orientation of
-.Fa stream
-has already been determined,
-.Fn fwide
-leaves it unchanged.
-Otherwise,
-.Fn fwide
-sets the orientation of
-.Fa stream
-according to
-.Fa mode .
-.Pp
-If
-.Fa mode
-is less than zero,
-.Fa stream
-is set to be byte-oriented.
-If
-.Fa mode
-is greater than zero,
-.Fa stream
-is set to be wide-oriented.
-Otherwise,
-.Fa mode
-is zero, and
-.Fa stream
-is unchanged.
-.Sh RETURN VALUES
-The
-.Fn fwide
-function
-returns a value according to orientation after the call of
-.Fn fwide ;
-a value less than zero if byte-oriented, a value greater than zero
-if wide-oriented, and zero if the stream has no orientation.
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fgetc 3 ,
-.Xr fgetwc 3 ,
-.Xr fopen 3 ,
-.Xr fputc 3 ,
-.Xr fputwc 3 ,
-.Xr freopen 3 ,
-.Xr stdio 3
-.Sh STANDARDS
-The
-.Fn fwide
-function
-conforms to
-.St -isoC-99 .
diff --git a/stdio/fwprintf-fbsd.c b/stdio/fwprintf-fbsd.c
deleted file mode 100644 (file)
index 5fefd4a..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-fwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vfwprintf_l(fp, __current_locale(), fmt, ap);
-       va_end(ap);
-
-       return (ret);
-}
-
-int
-fwprintf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
-       va_start(ap, fmt);
-       ret = vfwprintf_l(fp, loc, fmt, ap);
-       va_end(ap);
-
-       return (ret);
-}
diff --git a/stdio/fwrite-fbsd.c b/stdio/fwrite-fbsd.c
deleted file mode 100644 (file)
index b1910c1..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fwrite.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fwrite.c,v 1.13 2009/07/12 13:09:43 ed Exp $");
-
-#include "namespace.h"
-#include <stdio.h>
-#include "un-namespace.h"
-#include "local.h"
-#include "fvwrite.h"
-#include "libc_private.h"
-
-/*
- * Write `count' objects (each size `size') from memory to the given file.
- * Return the number of whole objects written.
- */
-size_t
-fwrite(buf, size, count, fp)
-       const void * __restrict buf;
-       size_t size, count;
-       FILE * __restrict fp;
-{
-       size_t n;
-       struct __suio uio;
-       struct __siov iov;
-
-       /*
-        * ANSI and SUSv2 require a return value of 0 if size or count are 0.
-        */
-       n = count * size;
-#if __DARWIN_UNIX03
-       if (n == 0)
-               return (0);
-#endif
-       iov.iov_base = (void *)buf;
-       uio.uio_resid = iov.iov_len = n;
-       uio.uio_iov = &iov;
-       uio.uio_iovcnt = 1;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, -1);
-       /*
-        * The usual case is success (__sfvwrite returns 0);
-        * skip the divide if this happens, since divides are
-        * generally slow and since this occurs whenever size==0.
-        */
-       if (__sfvwrite(fp, &uio) != 0)
-           count = (n - uio.uio_resid) / size;
-       FUNLOCKFILE(fp);
-       return (count);
-}
diff --git a/stdio/fwscanf-fbsd.c b/stdio/fwscanf-fbsd.c
deleted file mode 100644 (file)
index 4fefaea..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
-{
-       va_list ap;
-       int r;
-
-       va_start(ap, fmt);
-       r = vfwscanf_l(fp, __current_locale(), fmt, ap);
-       va_end(ap);
-
-       return (r);
-}
-
-int
-fwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt, ...)
-{
-       va_list ap;
-       int r;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
-       va_start(ap, fmt);
-       r = vfwscanf_l(fp, loc, fmt, ap);
-       va_end(ap);
-
-       return (r);
-}
diff --git a/stdio/getc-fbsd.c b/stdio/getc-fbsd.c
deleted file mode 120000 (symlink)
index 06a612e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getc.c
\ No newline at end of file
diff --git a/stdio/getc.3 b/stdio/getc.3
deleted file mode 100644 (file)
index b1c114b..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)getc.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/getc.3,v 1.21 2007/01/09 00:28:06 imp Exp $
-.\"
-.Dd January 10, 2003
-.Dt GETC 3
-.Os
-.Sh NAME
-.Nm fgetc ,
-.Nm getc ,
-.Nm getc_unlocked ,
-.Nm getchar ,
-.Nm getchar_unlocked ,
-.Nm getw
-.Nd get next character or word from input stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fn fgetc "FILE *stream"
-.Ft int
-.Fn getc "FILE *stream"
-.Ft int
-.Fn getc_unlocked "FILE *stream"
-.Ft int
-.Fn getchar "void"
-.Ft int
-.Fn getchar_unlocked "void"
-.Ft int
-.Fn getw "FILE *stream"
-.Sh DESCRIPTION
-The
-.Fn fgetc
-function
-obtains the next input character (if present) from the stream pointed at by
-.Fa stream ,
-or the next character pushed back on the stream via
-.Xr ungetc 3 .
-.Pp
-The
-.Fn getc
-function
-acts essentially identically to
-.Fn fgetc ,
-but is a macro that expands in-line.
-.Pp
-The
-.Fn getchar
-function
-is equivalent to
-.Fn getc stdin .
-.Pp
-The
-.Fn getw
-function
-obtains the next
-.Vt int
-(if present)
-from the stream pointed at by
-.Fa stream .
-.Pp
-The
-.Fn getc_unlocked
-and
-.Fn getchar_unlocked
-functions are equivalent to
-.Fn getc
-and
-.Fn getchar
-respectively,
-except that the caller is responsible for locking the stream
-with
-.Xr flockfile 3
-before calling them.
-These functions may be used to avoid the overhead of locking the stream
-for each character, and to avoid input being dispersed among multiple
-threads reading from the same stream.
-.Sh RETURN VALUES
-If successful, these routines return the next requested object
-from the
-.Fa stream .
-Character values are returned as an
-.Vt "unsigned char"
-converted to an
-.Vt int .
-If the stream is at end-of-file or a read error occurs,
-the routines return
-.Dv EOF .
-The routines
-.Xr feof 3
-and
-.Xr ferror 3
-must be used to distinguish between end-of-file and error.
-If an error occurs, the global variable
-.Va errno
-is set to indicate the error.
-The end-of-file condition is remembered, even on a terminal, and all
-subsequent attempts to read will return
-.Dv EOF
-until the condition is cleared with
-.Xr clearerr 3 .
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr flockfile 3 ,
-.Xr fopen 3 ,
-.Xr fread 3 ,
-.Xr getwc 3 ,
-.Xr putc 3 ,
-.Xr ungetc 3
-.Sh STANDARDS
-The
-.Fn fgetc ,
-.Fn getc ,
-and
-.Fn getchar
-functions
-conform to
-.St -isoC .
-The
-.Fn getc_unlocked
-and
-.Fn getchar_unlocked
-functions conform to
-.St -p1003.1-2001 .
-.Sh BUGS
-Since
-.Dv EOF
-is a valid integer value,
-.Xr feof 3
-and
-.Xr ferror 3
-must be used to check for failure after calling
-.Fn getw .
-The size and byte order of an
-.Vt int
-varies from one machine to another, and
-.Fn getw
-is not recommended for portable applications.
-.Pp
diff --git a/stdio/getchar-fbsd.c b/stdio/getchar-fbsd.c
deleted file mode 120000 (symlink)
index 776594f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getchar.c
\ No newline at end of file
diff --git a/stdio/getdelim-fbsd.c b/stdio/getdelim-fbsd.c
deleted file mode 120000 (symlink)
index d0d70e5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getdelim.c
\ No newline at end of file
diff --git a/stdio/getline-fbsd.c b/stdio/getline-fbsd.c
deleted file mode 120000 (symlink)
index 4ac67a7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getline.c
\ No newline at end of file
diff --git a/stdio/getline.3 b/stdio/getline.3
deleted file mode 100644 (file)
index ddefe70..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-.\" Copyright (c) 2009 David Schultz <das@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/stdio/getline.3,v 1.2 2009/04/06 13:50:04 das Exp $
-.\"
-.Dd March 29, 2009
-.Dt GETLINE 3
-.Os
-.Sh NAME
-.Nm getdelim ,
-.Nm getline
-.Nd get a line from a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft ssize_t
-.Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream"
-.Ft ssize_t
-.Fn getline "char ** restrict linep" "size_t * restrict linecapp" " FILE * restrict stream"
-.Sh DESCRIPTION
-The
-.Fn getdelim
-function reads a line from
-.Fa stream ,
-delimited by the character
-.Fa delimiter .
-The
-.Fn getline
-function is equivalent to
-.Fn getdelim
-with the newline character as the delimiter.
-The delimiter character is included as part of the line, unless
-the end of the file is reached.
-The caller may provide a pointer to a malloc buffer for the line in
-.Fa *linep ,
-and the capacity of that buffer in
-.Fa *linecapp ;
-if
-.Fa *linecapp
-is 0, then
-.Fa *linep
-is treated as
-.Dv NULL .
-These functions may expand the buffer as needed, as if via
-.Fn realloc ,
-and update
-.Fa *linep
-and
-.Fa *linecapp
-accordingly.
-.Sh RETURN VALUES
-The
-.Fn getdelim
-and
-.Fn getline
-functions return the number of characters written, excluding the
-terminating
-.Dv NULL .
-The value \-1 is returned if an error occurs, or if end-of-file is reached.
-.Sh EXAMPLES
-The following code fragment reads lines from a file and
-writes them to standard output.
-The
-.Fn fwrite
-function is used in case the line contains embedded
-.Dv NUL
-characters.
-.Bd -literal -offset indent
-char *line = NULL;
-size_t linecap = 0;
-ssize_t linelen;
-while ((linelen = getline(&line, &linecap, fp)) > 0)
-       fwrite(line, linelen, 1, stdout);
-.Ed
-.Sh ERRORS
-These functions may fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Either
-.Fa linep
-or
-.Fa linecapp
-is
-.Dv NULL .
-.It Bq Er EOVERFLOW
-No delimiter was found in the first
-.Dv SSIZE_MAX
-characters.
-.El
-.Pp
-These functions may also fail for any of the errors specified for
-.Fn fgets
-and
-.Fn malloc .
-.Sh SEE ALSO
-.Xr fgetln 3 ,
-.Xr fgets 3 ,
-.Xr malloc 3
-.Sh STANDARDS
-The
-.Fn getdelim
-and
-.Fn getline
-functions conform to
-.St -p1003.1-2008 .
-.Sh HISTORY
-These routines first appeared in
-.Fx 8.0 .
-.Sh BUGS
-There are no wide character versions of
-.Fn getdelim
-or
-.Fn getline .
diff --git a/stdio/gets-fbsd.c b/stdio/gets-fbsd.c
deleted file mode 120000 (symlink)
index 4810abf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./gets.c
\ No newline at end of file
diff --git a/stdio/getw-fbsd.c b/stdio/getw-fbsd.c
deleted file mode 120000 (symlink)
index 2cb73af..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getw.c
\ No newline at end of file
diff --git a/stdio/getwc-fbsd.c b/stdio/getwc-fbsd.c
deleted file mode 100644 (file)
index 0128a77..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/getwc.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-#undef getwc
-
-/*
- * Synonym for fgetwc(). The only difference is that getwc(), if it is a
- * macro, may evaluate `fp' more than once.
- */
-wint_t
-getwc(FILE *fp)
-{
-
-       return (fgetwc_l(fp, __current_locale()));
-}
-
-wint_t
-getwc_l(FILE *fp, locale_t loc)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because fgetwc_l will */
-       return (fgetwc_l(fp, loc));
-}
diff --git a/stdio/getwc.3 b/stdio/getwc.3
deleted file mode 100644 (file)
index d994aad..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-.\"    $NetBSD: getwc.3,v 1.3 2002/02/07 07:00:26 ross Exp $
-.\"
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)getc.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/getwc.3,v 1.8 2007/01/09 00:28:06 imp Exp $
-.\"
-.Dd March 3, 2004
-.Dt GETWC 3
-.Os
-.Sh NAME
-.Nm fgetwc ,
-.Nm getwc ,
-.Nm getwchar
-.Nd get next wide character from input stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft wint_t
-.Fn fgetwc "FILE *stream"
-.Ft wint_t
-.Fn getwc "FILE *stream"
-.Ft wint_t
-.Fn getwchar "void"
-.Sh DESCRIPTION
-The
-.Fn fgetwc
-function
-obtains the next input wide character (if present) from the stream pointed at by
-.Fa stream ,
-or the next character pushed back on the stream via
-.Xr ungetwc 3 .
-.Pp
-The
-.Fn getwc
-function
-acts essentially identically to
-.Fn fgetwc .
-.Pp
-The
-.Fn getwchar
-function
-is equivalent to
-.Fn getwc
-with the argument
-.Dv stdin .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr getwc_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If successful, these routines return the next wide character
-from the
-.Fa stream .
-If the stream is at end-of-file or a read error occurs,
-the routines return
-.Dv WEOF .
-The routines
-.Xr feof 3
-and
-.Xr ferror 3
-must be used to distinguish between end-of-file and error.
-If an error occurs, the global variable
-.Va errno
-is set to indicate the error.
-The end-of-file condition is remembered, even on a terminal, and all
-subsequent attempts to read will return
-.Dv WEOF
-until the condition is cleared with
-.Xr clearerr 3 .
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fopen 3 ,
-.Xr fread 3 ,
-.Xr getc 3 ,
-.Xr getwc_l ,
-.Xr putwc 3 ,
-.Xr stdio 3 ,
-.Xr ungetwc 3
-.Sh STANDARDS
-The
-.Fn fgetwc ,
-.Fn getwc ,
-and
-.Fn getwchar
-functions
-conform to
-.St -isoC-99 .
diff --git a/stdio/getwchar-fbsd.c b/stdio/getwchar-fbsd.c
deleted file mode 100644 (file)
index f5c2dd6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/getwchar.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-#undef getwchar
-
-/*
- * Synonym for fgetwc(stdin).
- */
-wint_t
-getwchar(void)
-{
-
-       return (fgetwc_l(stdin, __current_locale()));
-}
-
-wint_t
-getwchar_l(locale_t loc)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because fgetwc_l will */
-       return (fgetwc_l(stdin, loc));
-}
diff --git a/stdio/glue.h b/stdio/glue.h
deleted file mode 120000 (symlink)
index 5f05123..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./glue.h
\ No newline at end of file
diff --git a/stdio/local.h b/stdio/local.h
deleted file mode 100644 (file)
index 73958b7..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)local.h     8.3 (Berkeley) 7/3/94
- * $FreeBSD: src/lib/libc/stdio/local.h,v 1.33 2008/05/05 16:03:52 jhb Exp $
- */
-
-#include <sys/cdefs.h>
-#include "xlocale_private.h"
-#include <sys/types.h> /* for off_t */
-#include <pthread.h>
-#include <limits.h>
-#include <string.h>
-#include <wchar.h>
-
-/*
- * Information local to this implementation of stdio,
- * in particular, macros and private variables.
- */
-
-extern int     _sread(FILE *, char *, int);
-extern int     _swrite(FILE *, char const *, int);
-extern fpos_t  _sseek(FILE *, fpos_t, int);
-extern int     _ftello(FILE *, fpos_t *);
-extern int     _fseeko(FILE *, off_t, int, int);
-extern int     __fflush(FILE *fp);
-extern void    __fcloseall(void);
-extern wint_t  __fgetwc(FILE *, locale_t);
-extern wint_t  __fputwc(wchar_t, FILE *, locale_t);
-extern int     __sflush(FILE *);
-extern FILE    *__sfp(int);
-extern void    __sfprelease(FILE *);   /* mark free and update count as needed */
-extern int     __slbexpand(FILE *, size_t);
-extern int     __srefill(FILE *);
-extern int     __srefill0(FILE *);
-extern int     __srefill1(FILE *);
-extern int     __sread(void *, char *, int);
-extern int     __swrite(void *, char const *, int);
-extern fpos_t  __sseek(void *, fpos_t, int);
-extern int     __sclose(void *);
-extern void    __sinit(void);
-extern void    _cleanup(void);
-extern void    (*__cleanup)(void);
-extern void    __smakebuf(FILE *);
-extern int     __swhatbuf(FILE *, size_t *, int *);
-extern int     _fwalk(int (*)(FILE *));
-extern int     __svfscanf_l(FILE *, locale_t, const char *, __va_list) __DARWIN_LDBL_COMPAT(__svfscanf_l);
-extern int     __swsetup(FILE *);
-extern int     __sflags(const char *, int *);
-extern int     __ungetc(int, FILE *);
-extern wint_t  __ungetwc(wint_t, FILE *, locale_t);
-extern int     __vfprintf(FILE *, locale_t, const char *, __va_list) __DARWIN_LDBL_COMPAT(__vfprintf);
-extern int     __vfscanf(FILE *, const char *, __va_list) __DARWIN_LDBL_COMPAT(__vfscanf);
-extern int     __vfwprintf(FILE *, locale_t, const wchar_t *, __va_list) __DARWIN_LDBL_COMPAT(__vfwprintf);
-extern int     __vfwscanf(FILE * __restrict, locale_t, const wchar_t * __restrict,
-                   __va_list) __DARWIN_LDBL_COMPAT(__vfwscanf);
-extern size_t  __fread(void * __restrict buf, size_t size, size_t count,
-               FILE * __restrict fp);
-extern int     __sdidinit;
-
-
-/* hold a buncha junk that would grow the ABI */
-struct __sFILEX {
-       unsigned char   *up;    /* saved _p when _p is doing ungetc data */
-       pthread_mutex_t fl_mutex;       /* used for MT-safety */
-       pthread_t       fl_owner;       /* current owner */
-       int             fl_count;       /* recursive lock count */
-       int             orientation:2;  /* orientation for fwide() */
-       int             counted:1;      /* stream counted against STREAM_MAX */
-       mbstate_t       mbstate;        /* multibyte conversion state */
-};
-
-#define _up            _extra->up
-#define _fl_mutex      _extra->fl_mutex
-#define _fl_owner      _extra->fl_owner
-#define _fl_count      _extra->fl_count
-#define _orientation   _extra->orientation
-#define _mbstate       _extra->mbstate
-#define _counted       _extra->counted
-
-#define        INITEXTRA(fp) do { \
-       (fp)->_extra->up = NULL; \
-       (fp)->_extra->fl_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; \
-       (fp)->_extra->fl_owner = NULL; \
-       (fp)->_extra->fl_count = 0; \
-       (fp)->_extra->orientation = 0; \
-       memset(&(fp)->_extra->mbstate, 0, sizeof(mbstate_t)); \
-       (fp)->_extra->counted = 0; \
-} while(0);
-
-/*
- * Prepare the given FILE for writing, and return 0 iff it
- * can be written now.  Otherwise, return EOF and set errno.
- */
-#define        prepwrite(fp) \
-       ((((fp)->_flags & __SWR) == 0 || \
-           ((fp)->_bf._base == NULL && ((fp)->_flags & __SSTR) == 0)) && \
-        __swsetup(fp))
-
-/*
- * Test whether the given stdio file has an active ungetc buffer;
- * release such a buffer, without restoring ordinary unread data.
- */
-#define        HASUB(fp) ((fp)->_ub._base != NULL)
-#define        FREEUB(fp) { \
-       if ((fp)->_ub._base != (fp)->_ubuf) \
-               free((char *)(fp)->_ub._base); \
-       (fp)->_ub._base = NULL; \
-}
-
-/*
- * test for an fgetln() buffer.
- */
-#define        HASLB(fp) ((fp)->_lb._base != NULL)
-#define        FREELB(fp) { \
-       free((char *)(fp)->_lb._base); \
-       (fp)->_lb._base = NULL; \
-}
-
-/*
- * Set the orientation for a stream. If o > 0, the stream has wide-
- * orientation. If o < 0, the stream has byte-orientation.
- */
-#define        ORIENT(fp, o)   do {                            \
-       if ((fp)->_orientation == 0)                    \
-               (fp)->_orientation = (o);               \
-} while (0)
diff --git a/stdio/makebuf-fbsd.c b/stdio/makebuf-fbsd.c
deleted file mode 100644 (file)
index 17e45e2..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)makebuf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/makebuf.c,v 1.6 2007/01/09 00:28:07 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "local.h"
-
-#define MAXBUFSIZE     (1 << 16)
-#define TTYBUFSIZE     4096
-
-/*
- * Allocate a file buffer, or switch to unbuffered I/O.
- * Per the ANSI C standard, ALL tty devices default to line buffered.
- *
- * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
- * optimisation) right after the _fstat() that finds the buffer size.
- */
-void
-__smakebuf(fp)
-       FILE *fp;
-{
-       void *p;
-       int flags;
-       size_t size;
-       int couldbetty;
-
-       if (fp->_flags & __SNBF) {
-               fp->_bf._base = fp->_p = fp->_nbuf;
-               fp->_bf._size = 1;
-               return;
-       }
-       flags = __swhatbuf(fp, &size, &couldbetty);
-       if (couldbetty && isatty(fp->_file)) {
-               flags |= __SLBF;
-               /* st_blksize for ttys is 128K, so make it more reasonable */
-               if (size > TTYBUFSIZE)
-                       fp->_blksize = size = TTYBUFSIZE;
-       }
-       if ((p = malloc(size)) == NULL) {
-               fp->_flags |= __SNBF;
-               fp->_bf._base = fp->_p = fp->_nbuf;
-               fp->_bf._size = 1;
-               return;
-       }
-       __cleanup = _cleanup;
-       flags |= __SMBF;
-       fp->_bf._base = fp->_p = p;
-       fp->_bf._size = size;
-       fp->_flags |= flags;
-}
-
-/*
- * Internal routine to determine `proper' buffering for a file.
- */
-int
-__swhatbuf(fp, bufsize, couldbetty)
-       FILE *fp;
-       size_t *bufsize;
-       int *couldbetty;
-{
-       struct stat st;
-
-       if (fp->_file < 0 || _fstat(fp->_file, &st) < 0) {
-               *couldbetty = 0;
-               *bufsize = BUFSIZ;
-               return (__SNPT);
-       }
-
-       /* could be a tty iff it is a character device */
-       *couldbetty = (st.st_mode & S_IFMT) == S_IFCHR;
-       if (st.st_blksize <= 0) {
-               *bufsize = BUFSIZ;
-               return (__SNPT);
-       }
-
-       /*
-        * Optimise fseek() only if it is a regular file.  (The test for
-        * __sseek is mainly paranoia.)  It is safe to set _blksize
-        * unconditionally; it will only be used if __SOPT is also set.
-        */
-       fp->_blksize = *bufsize = st.st_blksize > MAXBUFSIZE ? MAXBUFSIZE : st.st_blksize;
-       return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ?
-           __SOPT : __SNPT);
-}
diff --git a/stdio/mktemp-fbsd.c b/stdio/mktemp-fbsd.c
deleted file mode 100644 (file)
index 5e288f8..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mktemp.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/mktemp.c,v 1.32 2010/02/28 13:31:29 jh Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-char *_mktemp(char *);
-
-static int _gettemp(char *, int *, int, int);
-
-static const unsigned char padchar[] =
-"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-int
-mkstemps(path, slen)
-       char *path;
-       int slen;
-{
-       int fd;
-
-       return (_gettemp(path, &fd, 0, slen) ? fd : -1);
-}
-
-int
-mkstemp(path)
-       char *path;
-{
-       int fd;
-
-       return (_gettemp(path, &fd, 0, 0) ? fd : -1);
-}
-
-char *
-mkdtemp(path)
-       char *path;
-{
-       return (_gettemp(path, (int *)NULL, 1, 0) ? path : (char *)NULL);
-}
-
-char *
-_mktemp(path)
-       char *path;
-{
-       return (_gettemp(path, (int *)NULL, 0, 0) ? path : (char *)NULL);
-}
-
-__warn_references(mktemp,
-    "warning: mktemp() possibly used unsafely; consider using mkstemp()");
-
-char *
-mktemp(path)
-       char *path;
-{
-       return (_mktemp(path));
-}
-
-static int
-_gettemp(path, doopen, domkdir, slen)
-       char *path;
-       int *doopen;
-       int domkdir;
-       int slen;
-{
-       char *start, *trv, *suffp, *carryp;
-       char *pad;
-       struct stat sbuf;
-       int rval;
-       uint32_t rand;
-       char carrybuf[MAXPATHLEN];
-
-       if ((doopen != NULL && domkdir) || slen < 0) {
-               errno = EINVAL;
-               return (0);
-       }
-
-       for (trv = path; *trv != '\0'; ++trv)
-               ;
-       if (trv - path >= MAXPATHLEN) {
-               errno = ENAMETOOLONG;
-               return (0);
-       }
-       trv -= slen;
-       suffp = trv;
-       --trv;
-       if (trv < path || NULL != strchr(suffp, '/')) {
-               errno = EINVAL;
-               return (0);
-       }
-
-       /* Fill space with random characters */
-       while (trv >= path && *trv == 'X') {
-               rand = arc4random() % (sizeof(padchar) - 1);
-               *trv-- = padchar[rand];
-       }
-       start = trv + 1;
-
-       /* save first combination of random characters */
-       memcpy(carrybuf, start, suffp - start);
-
-       /*
-        * check the target directory.
-        */
-       if (doopen != NULL || domkdir) {
-               for (; trv > path; --trv) {
-                       if (*trv == '/') {
-                               *trv = '\0';
-                               rval = stat(path, &sbuf);
-                               *trv = '/';
-                               if (rval != 0)
-                                       return (0);
-                               if (!S_ISDIR(sbuf.st_mode)) {
-                                       errno = ENOTDIR;
-                                       return (0);
-                               }
-                               break;
-                       }
-               }
-       }
-
-       for (;;) {
-               if (doopen) {
-                       if ((*doopen =
-                           _open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
-                               return (1);
-                       if (errno != EEXIST)
-                               return (0);
-               } else if (domkdir) {
-                       if (mkdir(path, 0700) == 0)
-                               return (1);
-                       if (errno != EEXIST)
-                               return (0);
-               } else if (lstat(path, &sbuf))
-                       return (errno == ENOENT);
-
-               /* If we have a collision, cycle through the space of filenames */
-               for (trv = start, carryp = carrybuf;;) {
-                       /* have we tried all possible permutations? */
-                       if (trv == suffp)
-                               return (0); /* yes - exit with EEXIST */
-                       pad = strchr(padchar, *trv);
-                       if (pad == NULL) {
-                               /* this should never happen */
-                               errno = EIO;
-                               return (0);
-                       }
-                       /* increment character */
-                       *trv = (*++pad == '\0') ? padchar[0] : *pad;
-                       /* carry to next position? */
-                       if (*trv == *carryp) {
-                               /* increment position and loop */
-                               ++trv;
-                               ++carryp;
-                       } else {
-                               /* try with new name */
-                               break;
-                       }
-               }
-       }
-       /*NOTREACHED*/
-}
diff --git a/stdio/mktemp.3 b/stdio/mktemp.3
deleted file mode 100644 (file)
index f55ceef..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)mktemp.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/mktemp.3,v 1.22 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd February 11, 1998
-.Dt MKTEMP 3
-.Os
-.Sh NAME
-.Nm mkdtemp ,
-.Nm mkstemp ,
-.Nm mkstemps ,
-.Nm mktemp
-.Nd make temporary file name (unique)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft char *
-.Fo mkdtemp
-.Fa "char *template"
-.Fc
-.Ft int
-.Fo mkstemps
-.Fa "char *template"
-.Fa "int suffixlen"
-.Fc
-.In stdlib.h
-.Ft int
-.Fo mkstemp
-.Fa "char *template"
-.Fc
-.Ft char *
-.Fo mktemp
-.Fa "char *template"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mktemp
-function
-takes the given file name template and overwrites a portion of it
-to create a file name.
-This file name is guaranteed not to exist at the time of function invocation
-and is suitable for use
-by the application.
-The template may be any file name with some number of
-.Ql X Ns s
-appended
-to it, for example
-.Pa /tmp/temp.XXXXXX .
-The trailing
-.Ql X Ns s
-are replaced with a
-unique alphanumeric combination.
-The number of unique file names
-.Fn mktemp
-can return depends on the number of
-.Ql X Ns s
-provided; six
-.Ql X Ns s
-will
-result in
-.Fn mktemp
-selecting one of 56800235584 (62 ** 6) possible temporary file names.
-.Pp
-The
-.Fn mkstemp
-function
-makes the same replacement to the template and creates the template file,
-mode 0600, returning a file descriptor opened for reading and writing.
-This avoids the race between testing for a file's existence and opening it
-for use.
-.Pp
-The
-.Fn mkstemps
-function acts the same as
-.Fn mkstemp ,
-except it permits a suffix to exist in the template.
-The template should be of the form
-.Pa /tmp/tmpXXXXXXsuffix .
-The
-.Fn mkstemps
-function
-is told the length of the suffix string.
-.Pp
-The
-.Fn mkdtemp
-function makes the same replacement to the template as in
-.Fn mktemp
-and creates the template directory, mode 0700.
-.Sh RETURN VALUES
-The
-.Fn mktemp
-and
-.Fn mkdtemp
-functions return a pointer to the template on success and
-.Dv NULL
-on failure.
-The
-.Fn mkstemp
-and
-.Fn mkstemps
-functions
-return \-1 if no suitable file could be created.
-If either call fails an error code is placed in the global variable
-.Va errno .
-.Sh ERRORS
-The
-.Fn mkstemp ,
-.Fn mkstemps
-and
-.Fn mkdtemp
-functions
-may set
-.Va errno
-to one of the following values:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-The pathname portion of the template is not an existing directory.
-.El
-.Pp
-The
-.Fn mkstemp ,
-.Fn mkstemps ,
-and
-.Fn mkdtemp
-functions
-may also set
-.Va errno
-to any value specified by the
-.Xr stat 2
-function.
-.Pp
-The
-.Fn mkstemp
-and
-.Fn mkstemps
-functions
-may also set
-.Va errno
-to any value specified by the
-.Xr open 2
-function.
-.Pp
-The
-.Fn mkdtemp
-function
-may also set
-.Va errno
-to any value specified by the
-.Xr mkdir 2
-function.
-.Sh NOTES
-A common problem that results in a core dump is that the programmer
-passes in a read-only string to
-.Fn mktemp ,
-.Fn mkstemp ,
-.Fn mkstemps ,
-or
-.Fn mkdtemp .
-This is common with programs that were developed before
-.St -isoC
-compilers were common.
-For example, calling
-.Fn mkstemp
-with an argument of
-.Qq /tmp/tempfile.XXXXXX
-will result in a core dump due to
-.Fn mkstemp
-attempting to modify the string constant that was given.
-If the program in question makes heavy use of that type
-of function call, you do have the option of compiling the program
-so that it will store string constants in a writable segment of memory.
-See
-.Xr gcc 1
-for more information.
-.Sh LEGACY SYNOPSIS
-.Fd #include <unistd.h>
-.Pp
-The include file
-.In unistd.h
-is necessary and sufficient for all functions.
-.Sh SEE ALSO
-.Xr chmod 2 ,
-.Xr getpid 2 ,
-.Xr mkdir 2 ,
-.Xr open 2 ,
-.Xr stat 2 ,
-.Xr compat 5
-.Sh HISTORY
-A
-.Fn mktemp
-function appeared in
-.At v7 .
-The
-.Fn mkstemp
-function appeared in
-.Bx 4.4 .
-The
-.Fn mkdtemp
-function first appeared in
-.Ox 2.2 ,
-and later in
-.Fx 3.2 .
-The
-.Fn mkstemps
-function first appeared in
-.Ox 2.4 ,
-and later in
-.Fx 3.4 .
-.Sh BUGS
-This family of functions produces filenames which can be guessed,
-though the risk is minimized when large numbers of
-.Ql X Ns s
-are used to
-increase the number of possible temporary filenames.
-This makes the race in
-.Fn mktemp ,
-between testing for a file's existence (in the
-.Fn mktemp
-function call)
-and opening it for use
-(later in the user application)
-particularly dangerous from a security perspective.
-Whenever it is possible,
-.Fn mkstemp
-should be used instead, since it does not have the race condition.
-If
-.Fn mkstemp
-cannot be used, the filename created by
-.Fn mktemp
-should be created using the
-.Dv O_EXCL
-flag to
-.Xr open 2
-and the return status of the call should be tested for failure.
-This will ensure that the program does not continue blindly
-in the event that an attacker has already created the file
-with the intention of manipulating or reading its contents.
diff --git a/stdio/perror-fbsd.c b/stdio/perror-fbsd.c
deleted file mode 120000 (symlink)
index 4cbf19f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./perror.c
\ No newline at end of file
diff --git a/stdio/printf-fbsd.c b/stdio/printf-fbsd.c
deleted file mode 100644 (file)
index e65851a..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)printf.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.11 2007/01/09 00:28:07 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-int
-printf(char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vfprintf_l(stdout, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-printf_l(locale_t loc, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfprintf_l will */
-       va_start(ap, fmt);
-       ret = vfprintf_l(stdout, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/printf-pos-fbsd.c b/stdio/printf-pos-fbsd.c
deleted file mode 100644 (file)
index 4de7aba..0000000
+++ /dev/null
@@ -1,798 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/printf-pos.c,v 1.6 2009/03/02 04:07:58 das Exp $");
-
-/*
- * This is the code responsible for handling positional arguments
- * (%m$ and %m$.n$) for vfprintf() and vfwprintf().
- */
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-
-#include "un-namespace.h"
-#include "printflocal.h"
-
-/*
- * Type ids for argument type table.
- */
-enum typeid {
-       T_UNUSED, TP_SHORT, T_INT, T_U_INT, TP_INT,
-       T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG,
-       T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SSIZET,
-       T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR,
-       T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR,
-#ifdef VECTORS
-       T_VECTOR,
-#endif
-};
-
-/* An expandable array of types. */
-struct typetable {
-       enum typeid *table; /* table of types */
-       enum typeid stattable[STATIC_ARG_TBL_SIZE];
-       int tablesize;          /* current size of type table */
-       int tablemax;           /* largest used index in table */
-       int nextarg;            /* 1-based argument index */
-};
-
-static int     __grow_type_table(struct typetable *);
-static void    build_arg_table (struct typetable *, va_list, union arg **);
-
-/*
- * Initialize a struct typetable.
- */
-static inline void
-inittypes(struct typetable *types)
-{
-       int n;
-
-       types->table = types->stattable;
-       types->tablesize = STATIC_ARG_TBL_SIZE;
-       types->tablemax = 0; 
-       types->nextarg = 1;
-       for (n = 0; n < STATIC_ARG_TBL_SIZE; n++)
-               types->table[n] = T_UNUSED;
-}
-
-/*
- * struct typetable destructor.
- */ 
-static inline void
-freetypes(struct typetable *types)
-{
-
-       if (types->table != types->stattable)
-               free (types->table);
-}
-
-/*
- * Ensure that there is space to add a new argument type to the type table.
- * Expand the table if necessary. Returns 0 on success.
- */
-static inline int
-_ensurespace(struct typetable *types)
-{
-
-       if (types->nextarg >= types->tablesize) {
-               if (__grow_type_table(types))
-                       return (-1);
-       }
-       if (types->nextarg > types->tablemax)
-               types->tablemax = types->nextarg;
-       return (0);
-}
-
-/*
- * Add an argument type to the table, expanding if necessary.
- * Returns 0 on success.
- */
-static inline int
-addtype(struct typetable *types, enum typeid type)
-{
-
-       if (_ensurespace(types))
-               return (-1);
-       types->table[types->nextarg++] = type;
-       return (0);
-}
-
-static inline int
-addsarg(struct typetable *types, int flags)
-{
-
-       if (_ensurespace(types))
-               return (-1);
-       if (flags & INTMAXT)
-               types->table[types->nextarg++] = T_INTMAXT;
-       else if (flags & SIZET)
-               types->table[types->nextarg++] = T_SSIZET;
-       else if (flags & PTRDIFFT)
-               types->table[types->nextarg++] = T_PTRDIFFT;
-       else if (flags & LLONGINT)
-               types->table[types->nextarg++] = T_LLONG;
-       else if (flags & LONGINT)
-               types->table[types->nextarg++] = T_LONG;
-       else
-               types->table[types->nextarg++] = T_INT;
-       return (0);
-}
-
-static inline int
-adduarg(struct typetable *types, int flags)
-{
-
-       if (_ensurespace(types))
-               return (-1);
-       if (flags & INTMAXT)
-               types->table[types->nextarg++] = T_UINTMAXT;
-       else if (flags & SIZET)
-               types->table[types->nextarg++] = T_SIZET;
-       else if (flags & PTRDIFFT)
-               types->table[types->nextarg++] = T_SIZET;
-       else if (flags & LLONGINT)
-               types->table[types->nextarg++] = T_U_LLONG;
-       else if (flags & LONGINT)
-               types->table[types->nextarg++] = T_U_LONG;
-       else
-               types->table[types->nextarg++] = T_U_INT;
-       return (0);
-}
-
-/*
- * Add * arguments to the type array.
- */
-static inline int
-addaster(struct typetable *types, char **fmtp)
-{
-       char *cp;
-       int n2;
-
-       n2 = 0;
-       cp = *fmtp;
-       while (is_digit(*cp)) {
-               n2 = 10 * n2 + to_digit(*cp);
-               cp++;
-       }
-       if (*cp == '$') {
-               int hold = types->nextarg;
-               types->nextarg = n2;
-               if (addtype(types, T_INT))
-                       return (-1);
-               types->nextarg = hold;
-               *fmtp = ++cp;
-       } else {
-               if (addtype(types, T_INT))
-                       return (-1);
-       }
-       return (0);
-}
-
-static inline int
-addwaster(struct typetable *types, wchar_t **fmtp)
-{
-       wchar_t *cp;
-       int n2;
-
-       n2 = 0;
-       cp = *fmtp;
-       while (is_digit(*cp)) {
-               n2 = 10 * n2 + to_digit(*cp);
-               cp++;
-       }
-       if (*cp == '$') {
-               int hold = types->nextarg;
-               types->nextarg = n2;
-               if (addtype(types, T_INT))
-                       return (-1);
-               types->nextarg = hold;
-               *fmtp = ++cp;
-       } else {
-               if (addtype(types, T_INT))
-                       return (-1);
-       }
-       return (0);
-}
-
-/*
- * Find all arguments when a positional parameter is encountered.  Returns a
- * table, indexed by argument number, of pointers to each arguments.  The
- * initial argument table should be an array of STATIC_ARG_TBL_SIZE entries.
- * It will be replaces with a malloc-ed one if it overflows.
- * Returns 0 on success. On failure, returns nonzero and sets errno.
- */ 
-__private_extern__ int
-__find_arguments (const char *fmt0, va_list ap, union arg **argtable)
-{
-       char *fmt;              /* format string */
-       int ch;                 /* character from fmt */
-       int n;                  /* handy integer (short term usage) */
-       int error;
-       int flags;              /* flags as above */
-       int width;              /* width from format (%8d), or 0 */
-       struct typetable types; /* table of types */
-
-       fmt = (char *)fmt0;
-       inittypes(&types);
-       error = 0;
-
-       /*
-        * Scan the format for conversions (`%' character).
-        */
-       for (;;) {
-               while ((ch = *fmt) != '\0' && ch != '%')
-                       fmt++;
-               if (ch == '\0')
-                       goto done;
-               fmt++;          /* skip over '%' */
-
-               flags = 0;
-               width = 0;
-
-rflag:         ch = *fmt++;
-reswitch:      switch (ch) {
-               case ' ':
-               case '#':
-                       goto rflag;
-               case '*':
-                       if ((error = addaster(&types, &fmt)))
-                               goto error;
-                       goto rflag;
-               case '-':
-               case '+':
-               case '\'':
-                       goto rflag;
-               case '.':
-                       if ((ch = *fmt++) == '*') {
-                               if ((error = addaster(&types, &fmt)))
-                                       goto error;
-                               goto rflag;
-                       }
-                       while (is_digit(ch)) {
-                               ch = *fmt++;
-                       }
-                       goto reswitch;
-               case '0':
-                       goto rflag;
-               case '1': case '2': case '3': case '4':
-               case '5': case '6': case '7': case '8': case '9':
-                       n = 0;
-                       do {
-                               n = 10 * n + to_digit(ch);
-                               ch = *fmt++;
-                       } while (is_digit(ch));
-                       if (ch == '$') {
-                               types.nextarg = n;
-                               goto rflag;
-                       }
-                       width = n;
-                       goto reswitch;
-#ifndef NO_FLOATING_POINT
-               case 'L':
-                       flags |= LONGDBL;
-                       goto rflag;
-#endif
-               case 'h':
-                       if (flags & SHORTINT) {
-                               flags &= ~SHORTINT;
-                               flags |= CHARINT;
-                       } else
-                               flags |= SHORTINT;
-                       goto rflag;
-               case 'j':
-                       flags |= INTMAXT;
-                       goto rflag;
-               case 'l':
-                       if (flags & LONGINT) {
-                               flags &= ~LONGINT;
-                               flags |= LLONGINT;
-                       } else
-                               flags |= LONGINT;
-                       goto rflag;
-               case 'q':
-                       flags |= LLONGINT;      /* not necessarily */
-                       goto rflag;
-               case 't':
-                       flags |= PTRDIFFT;
-                       goto rflag;
-               case 'z':
-                       flags |= SIZET;
-                       goto rflag;
-               case 'C':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'c':
-                       error = addtype(&types,
-#ifdef VECTORS
-                                       (flags & LONGINT) ? T_WINT : ((flags & VECTOR) ? T_VECTOR : T_INT));
-#else
-                                       (flags & LONGINT) ? T_WINT : T_INT);
-#endif
-                       if (error)
-                               goto error;
-                       break;
-               case 'D':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               if ((error = addtype(&types, T_VECTOR)))
-                                       goto error;
-                       } else
-#endif
-                       if ((error = addsarg(&types, flags)))
-                               goto error;
-                       break;
-#ifndef NO_FLOATING_POINT
-               case 'a':
-               case 'A':
-               case 'e':
-               case 'E':
-               case 'f':
-               case 'F':
-               case 'g':
-               case 'G':
-                       error = addtype(&types,
-#ifdef VECTORS
-                           (flags & VECTOR) ? T_VECTOR : ((flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE));
-#else
-                           (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE);
-#endif
-                       if (error)
-                               goto error;
-                       break;
-#endif /* !NO_FLOATING_POINT */
-               case 'n':
-                       if (flags & INTMAXT)
-                               error = addtype(&types, TP_INTMAXT);
-                       else if (flags & PTRDIFFT)
-                               error = addtype(&types, TP_PTRDIFFT);
-                       else if (flags & SIZET)
-                               error = addtype(&types, TP_SSIZET);
-                       else if (flags & LLONGINT)
-                               error = addtype(&types, TP_LLONG);
-                       else if (flags & LONGINT)
-                               error = addtype(&types, TP_LONG);
-                       else if (flags & SHORTINT)
-                               error = addtype(&types, TP_SHORT);
-                       else if (flags & CHARINT)
-                               error = addtype(&types, TP_SCHAR);
-                       else
-                               error = addtype(&types, TP_INT);
-                       if (error)
-                               goto error;
-                       continue;       /* no output */
-               case 'O':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               if ((error = addtype(&types, T_VECTOR)))
-                                       goto error;
-                       } else
-#endif
-                       if ((error = adduarg(&types, flags)))
-                               goto error;
-                       break;
-               case 'p':
-#ifdef VECTORS
-                       if ((error = addtype(&types, (flags & VECTOR) ? T_VECTOR : TP_VOID)))
-#else
-                       if ((error = addtype(&types, TP_VOID)))
-#endif
-                               goto error;
-                       break;
-               case 'S':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 's':
-                       error = addtype(&types,
-                                       (flags & LONGINT) ? TP_WCHAR : TP_CHAR);
-                       if (error)
-                               goto error;
-                       break;
-               case 'U':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'u':
-               case 'X':
-               case 'x':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               if ((error = addtype(&types, T_VECTOR)))
-                                       goto error;
-                       } else
-#endif
-                       if ((error = adduarg(&types, flags)))
-                               goto error;
-                       break;
-               default:        /* "%?" prints ?, unless ? is NUL */
-                       if (ch == '\0')
-                               goto done;
-                       break;
-               }
-       }
-done:
-       build_arg_table(&types, ap, argtable);
-error:
-       freetypes(&types);
-       return (error || *argtable == NULL);
-}
-
-/* wchar version of __find_arguments. */
-__private_extern__ int
-__find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable)
-{
-       wchar_t *fmt;           /* format string */
-       wchar_t ch;             /* character from fmt */
-       int n;                  /* handy integer (short term usage) */
-       int error;
-       int flags;              /* flags as above */
-       int width;              /* width from format (%8d), or 0 */
-       struct typetable types; /* table of types */
-
-       fmt = (wchar_t *)fmt0;
-       inittypes(&types);
-       error = 0;
-
-       /*
-        * Scan the format for conversions (`%' character).
-        */
-       for (;;) {
-               while ((ch = *fmt) != '\0' && ch != '%')
-                       fmt++;
-               if (ch == '\0')
-                       goto done;
-               fmt++;          /* skip over '%' */
-
-               flags = 0;
-               width = 0;
-
-rflag:         ch = *fmt++;
-reswitch:      switch (ch) {
-               case ' ':
-               case '#':
-                       goto rflag;
-               case '*':
-                       if ((error = addwaster(&types, &fmt)))
-                               goto error;
-                       goto rflag;
-               case '-':
-               case '+':
-               case '\'':
-                       goto rflag;
-               case '.':
-                       if ((ch = *fmt++) == '*') {
-                               if ((error = addwaster(&types, &fmt)))
-                                       goto error;
-                               goto rflag;
-                       }
-                       while (is_digit(ch)) {
-                               ch = *fmt++;
-                       }
-                       goto reswitch;
-               case '0':
-                       goto rflag;
-               case '1': case '2': case '3': case '4':
-               case '5': case '6': case '7': case '8': case '9':
-                       n = 0;
-                       do {
-                               n = 10 * n + to_digit(ch);
-                               ch = *fmt++;
-                       } while (is_digit(ch));
-                       if (ch == '$') {
-                               types.nextarg = n;
-                               goto rflag;
-                       }
-                       width = n;
-                       goto reswitch;
-#ifndef NO_FLOATING_POINT
-               case 'L':
-                       flags |= LONGDBL;
-                       goto rflag;
-#endif
-               case 'h':
-                       if (flags & SHORTINT) {
-                               flags &= ~SHORTINT;
-                               flags |= CHARINT;
-                       } else
-                               flags |= SHORTINT;
-                       goto rflag;
-               case 'j':
-                       flags |= INTMAXT;
-                       goto rflag;
-               case 'l':
-                       if (flags & LONGINT) {
-                               flags &= ~LONGINT;
-                               flags |= LLONGINT;
-                       } else
-                               flags |= LONGINT;
-                       goto rflag;
-               case 'q':
-                       flags |= LLONGINT;      /* not necessarily */
-                       goto rflag;
-               case 't':
-                       flags |= PTRDIFFT;
-                       goto rflag;
-               case 'z':
-                       flags |= SIZET;
-                       goto rflag;
-               case 'C':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'c':
-                       error = addtype(&types,
-                                       (flags & LONGINT) ? T_WINT : T_INT);
-                       if (error)
-                               goto error;
-                       break;
-               case 'D':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-                       if ((error = addsarg(&types, flags)))
-                               goto error;
-                       break;
-#ifndef NO_FLOATING_POINT
-               case 'a':
-               case 'A':
-               case 'e':
-               case 'E':
-               case 'f':
-               case 'F':
-               case 'g':
-               case 'G':
-                       error = addtype(&types,
-                           (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE);
-                       if (error)
-                               goto error;
-                       break;
-#endif /* !NO_FLOATING_POINT */
-               case 'n':
-                       if (flags & INTMAXT)
-                               error = addtype(&types, TP_INTMAXT);
-                       else if (flags & PTRDIFFT)
-                               error = addtype(&types, TP_PTRDIFFT);
-                       else if (flags & SIZET)
-                               error = addtype(&types, TP_SSIZET);
-                       else if (flags & LLONGINT)
-                               error = addtype(&types, TP_LLONG);
-                       else if (flags & LONGINT)
-                               error = addtype(&types, TP_LONG);
-                       else if (flags & SHORTINT)
-                               error = addtype(&types, TP_SHORT);
-                       else if (flags & CHARINT)
-                               error = addtype(&types, TP_SCHAR);
-                       else
-                               error = addtype(&types, TP_INT);
-                       if (error)
-                               goto error;
-                       continue;       /* no output */
-               case 'O':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-                       if ((error = adduarg(&types, flags)))
-                               goto error;
-                       break;
-               case 'p':
-                       if ((error = addtype(&types, TP_VOID)))
-                               goto error;
-                       break;
-               case 'S':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 's':
-                       error = addtype(&types,
-                           (flags & LONGINT) ? TP_WCHAR : TP_CHAR);
-                       if (error)
-                               goto error;
-                       break;
-               case 'U':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'u':
-               case 'X':
-               case 'x':
-                       if ((error = adduarg(&types, flags)))
-                               goto error;
-                       break;
-               default:        /* "%?" prints ?, unless ? is NUL */
-                       if (ch == '\0')
-                               goto done;
-                       break;
-               }
-       }
-done:
-       build_arg_table(&types, ap, argtable);
-error:
-       freetypes(&types);
-       return (error || *argtable == NULL);
-}
-
-/*
- * Increase the size of the type table. Returns 0 on success.
- */
-static int
-__grow_type_table(struct typetable *types)
-{
-       enum typeid *const oldtable = types->table;
-       const int oldsize = types->tablesize;
-       enum typeid *newtable;
-       int n, newsize = oldsize * 2;
-
-       if (newsize < types->nextarg + 1)
-               newsize = types->nextarg + 1;
-       if (oldsize == STATIC_ARG_TBL_SIZE) {
-               if ((newtable = malloc(newsize * sizeof(enum typeid))) == NULL)
-                       return (-1);
-               bcopy(oldtable, newtable, oldsize * sizeof(enum typeid));
-       } else {
-               newtable = realloc(oldtable, newsize * sizeof(enum typeid));
-               if (newtable == NULL)
-                       return (-1);
-       }
-       for (n = oldsize; n < newsize; n++)
-               newtable[n] = T_UNUSED;
-
-       types->table = newtable;
-       types->tablesize = newsize;
-
-       return (0);
-}
-
-/*
- * Build the argument table from the completed type table.
- * On malloc failure, *argtable is set to NULL.
- */
-static void
-build_arg_table(struct typetable *types, va_list ap, union arg **argtable)
-{
-       int n;
-
-       if (types->tablemax >= STATIC_ARG_TBL_SIZE) {
-               *argtable = (union arg *)
-                   malloc (sizeof (union arg) * (types->tablemax + 1));
-               if (*argtable == NULL)
-                       return;
-       }
-
-       (*argtable) [0].intarg = 0;
-       for (n = 1; n <= types->tablemax; n++) {
-               switch (types->table[n]) {
-                   case T_UNUSED: /* whoops! */
-                       (*argtable) [n].intarg = va_arg (ap, int);
-                       break;
-                   case TP_SCHAR:
-                       (*argtable) [n].pschararg = va_arg (ap, signed char *);
-                       break;
-                   case TP_SHORT:
-                       (*argtable) [n].pshortarg = va_arg (ap, short *);
-                       break;
-                   case T_INT:
-                       (*argtable) [n].intarg = va_arg (ap, int);
-                       break;
-                   case T_U_INT:
-                       (*argtable) [n].uintarg = va_arg (ap, unsigned int);
-                       break;
-                   case TP_INT:
-                       (*argtable) [n].pintarg = va_arg (ap, int *);
-                       break;
-                   case T_LONG:
-                       (*argtable) [n].longarg = va_arg (ap, long);
-                       break;
-                   case T_U_LONG:
-                       (*argtable) [n].ulongarg = va_arg (ap, unsigned long);
-                       break;
-                   case TP_LONG:
-                       (*argtable) [n].plongarg = va_arg (ap, long *);
-                       break;
-                   case T_LLONG:
-                       (*argtable) [n].longlongarg = va_arg (ap, long long);
-                       break;
-                   case T_U_LLONG:
-                       (*argtable) [n].ulonglongarg = va_arg (ap, unsigned long long);
-                       break;
-                   case TP_LLONG:
-                       (*argtable) [n].plonglongarg = va_arg (ap, long long *);
-                       break;
-                   case T_PTRDIFFT:
-                       (*argtable) [n].ptrdiffarg = va_arg (ap, ptrdiff_t);
-                       break;
-                   case TP_PTRDIFFT:
-                       (*argtable) [n].pptrdiffarg = va_arg (ap, ptrdiff_t *);
-                       break;
-                   case T_SIZET:
-                       (*argtable) [n].sizearg = va_arg (ap, size_t);
-                       break;
-                   case T_SSIZET:
-                       (*argtable) [n].sizearg = va_arg (ap, ssize_t);
-                       break;
-                   case TP_SSIZET:
-                       (*argtable) [n].pssizearg = va_arg (ap, ssize_t *);
-                       break;
-                   case T_INTMAXT:
-                       (*argtable) [n].intmaxarg = va_arg (ap, intmax_t);
-                       break;
-                   case T_UINTMAXT:
-                       (*argtable) [n].uintmaxarg = va_arg (ap, uintmax_t);
-                       break;
-                   case TP_INTMAXT:
-                       (*argtable) [n].pintmaxarg = va_arg (ap, intmax_t *);
-                       break;
-                   case T_DOUBLE:
-#ifndef NO_FLOATING_POINT
-                       (*argtable) [n].doublearg = va_arg (ap, double);
-#endif
-                       break;
-                   case T_LONG_DOUBLE:
-#ifndef NO_FLOATING_POINT
-                       (*argtable) [n].longdoublearg = va_arg (ap, long double);
-#endif
-                       break;
-#ifdef VECTORS
-                   case T_VECTOR:
-                       (*argtable) [n].vectorarg = va_arg (ap, VECTORTYPE);
-                       break;
-#endif /* VECTORS */
-                   case TP_CHAR:
-                       (*argtable) [n].pchararg = va_arg (ap, char *);
-                       break;
-                   case TP_VOID:
-                       (*argtable) [n].pvoidarg = va_arg (ap, void *);
-                       break;
-                   case T_WINT:
-                       (*argtable) [n].wintarg = va_arg (ap, wint_t);
-                       break;
-                   case TP_WCHAR:
-                       (*argtable) [n].pwchararg = va_arg (ap, wchar_t *);
-                       break;
-               }
-       }
-}
diff --git a/stdio/printf.3 b/stdio/printf.3
deleted file mode 100644 (file)
index 031d7f7..0000000
+++ /dev/null
@@ -1,932 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)printf.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.64 2009/12/02 07:51:25 brueffer Exp $
-.\"
-.Dd December 2, 2009
-.Dt PRINTF 3
-.Os
-.Sh NAME
-.Nm printf , fprintf , sprintf , snprintf , asprintf , dprintf ,
-.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf, vdprintf
-.Nd formatted output conversion
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fn printf "const char * restrict format" ...
-.Ft int
-.Fn fprintf "FILE * restrict stream" "const char * restrict format" ...
-.Ft int
-.Fn sprintf "char * restrict str" "const char * restrict format" ...
-.Ft int
-.Fn snprintf "char * restrict str" "size_t size" "const char * restrict format" ...
-.Ft int
-.Fn asprintf "char **ret" "const char *format" ...
-.Ft int
-.Fn dprintf "int fd" "const char * restrict format" ...
-.In stdarg.h
-.Ft int
-.Fn vprintf "const char * restrict format" "va_list ap"
-.Ft int
-.Fn vfprintf "FILE * restrict stream" "const char * restrict format" "va_list ap"
-.Ft int
-.Fn vsprintf "char * restrict str" "const char * restrict format" "va_list ap"
-.Ft int
-.Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap"
-.Ft int
-.Fn vasprintf "char **ret" "const char *format" "va_list ap"
-.Ft int
-.Fn vdprintf "int fd" "const char * restrict format" "va_list ap"
-.Sh DESCRIPTION
-The
-.Fn printf
-family of functions produces output according to a
-.Fa format
-as described below.
-The
-.Fn printf
-and
-.Fn vprintf
-functions
-write output to
-.Dv stdout ,
-the standard output stream;
-.Fn fprintf
-and
-.Fn vfprintf
-write output to the given output
-.Fa stream ;
-.Fn dprintf
-and
-.Fn vdprintf
-write output to the given file descriptor;
-.Fn sprintf ,
-.Fn snprintf ,
-.Fn vsprintf ,
-and
-.Fn vsnprintf
-write to the character string
-.Fa s ;
-and
-.Fn asprintf
-and
-.Fn vasprintf
-dynamically allocate a new string with
-.Xr malloc 3 .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr printf_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Pp
-These functions write the output under the control of a
-.Fa format
-string that specifies how subsequent arguments
-(or arguments accessed via the variable-length argument facilities of
-.Xr stdarg 3 )
-are converted for output.
-.Pp
-These functions return the number of characters printed
-(not including the trailing
-.Ql \e0
-used to end output to strings) or a negative value if an output error occurs,
-except for
-.Fn snprintf
-and
-.Fn vsnprintf ,
-which return the number of characters that would have been printed if the
-.Fa n
-were unlimited
-(again, not including the final
-.Ql \e0 ) .
-.Pp
-The
-.Fn asprintf
-and
-.Fn vasprintf
-functions
-set
-.Fa *ret
-to be a pointer to a buffer sufficiently large to hold the formatted string.
-This pointer should be passed to
-.Xr free 3
-to release the allocated storage when it is no longer needed.
-If sufficient space cannot be allocated,
-.Fn asprintf
-and
-.Fn vasprintf
-will return \-1 and set
-.Fa ret
-to be a
-.Dv NULL
-pointer.
-.Pp
-The
-.Fn snprintf
-and
-.Fn vsnprintf
-functions
-will write at most
-.Fa n Ns \-1
-of the characters printed into the output string
-(the
-.Fa n Ns \'th
-character then gets the terminating
-.Ql \e0 ) ;
-if the return value is greater than or equal to the
-.Fa n
-argument, the string was too short
-and some of the printed characters were discarded.
-The output is always null-terminated.
-.Pp
-The
-.Fn sprintf
-and
-.Fn vsprintf
-functions
-effectively assume an infinite
-.Fa n .
-.Pp
-For those routines that write to a user-provided character string,
-that string and the format strings should not overlap, as the
-behavior is undefined.
-.Pp
-The format string is composed of zero or more directives:
-ordinary
-.\" multibyte
-characters (not
-.Cm % ) ,
-which are copied unchanged to the output stream;
-and conversion specifications, each of which results
-in fetching zero or more subsequent arguments.
-Each conversion specification is introduced by
-the
-.Cm %
-character.
-The arguments must correspond properly (after type promotion)
-with the conversion specifier.
-After the
-.Cm % ,
-the following appear in sequence:
-.Bl -bullet
-.It
-An optional field, consisting of a decimal digit string followed by a
-.Cm $ ,
-specifying the next argument to access.
-If this field is not provided, the argument following the last
-argument accessed will be used.
-Arguments are numbered starting at
-.Cm 1 .
-If unaccessed arguments in the format string are interspersed with ones that
-are accessed the results will be indeterminate.
-.It
-Zero or more of the following flags:
-.Bl -tag -width ".So \  Sc (space)"
-.It Sq Cm #
-The value should be converted to an
-.Dq alternate form .
-For
-.Cm c , d , i , n , p , s ,
-and
-.Cm u
-conversions, this option has no effect.
-For
-.Cm o
-conversions, the precision of the number is increased to force the first
-character of the output string to a zero.
-For
-.Cm x
-and
-.Cm X
-conversions, a non-zero result has the string
-.Ql 0x
-(or
-.Ql 0X
-for
-.Cm X
-conversions) prepended to it.
-For
-.Cm a , A , e , E , f , F , g ,
-and
-.Cm G
-conversions, the result will always contain a decimal point, even if no
-digits follow it (normally, a decimal point appears in the results of
-those conversions only if a digit follows).
-For
-.Cm g
-and
-.Cm G
-conversions, trailing zeros are not removed from the result as they
-would otherwise be.
-.It So Cm 0 Sc (zero)
-Zero padding.
-For all conversions except
-.Cm n ,
-the converted value is padded on the left with zeros rather than blanks.
-If a precision is given with a numeric conversion
-.Cm ( d , i , o , u , i , x ,
-and
-.Cm X ) ,
-the
-.Cm 0
-flag is ignored.
-.It Sq Cm \-
-A negative field width flag;
-the converted value is to be left adjusted on the field boundary.
-Except for
-.Cm n
-conversions, the converted value is padded on the right with blanks,
-rather than on the left with blanks or zeros.
-A
-.Cm \-
-overrides a
-.Cm 0
-if both are given.
-.It So "\ " Sc (space)
-A blank should be left before a positive number
-produced by a signed conversion
-.Cm ( a , A , d , e , E , f , F , g , G ,
-or
-.Cm i ) .
-.It Sq Cm +
-A sign must always be placed before a
-number produced by a signed conversion.
-A
-.Cm +
-overrides a space if both are used.
-.It Sq Cm '
-Decimal conversions
-.Cm ( d , u ,
-or
-.Cm i )
-or the integral portion of a floating point conversion
-.Cm ( f
-or
-.Cm F )
-should be grouped and separated by thousands using
-the non-monetary separator returned by
-.Xr localeconv 3 .
-.El
-.It
-An optional separator character (
-.Cm \ , | \;  | \ : | _
-) used for separating multiple values when printing an AltiVec or SSE vector,
-or other multi-value unit.
-.Pp
-NOTE: This is an extension to the
-.Fn printf
-specification.
-Behaviour of these values for
-.Fn printf 
-is only defined for operating systems conforming to the 
-AltiVec Technology Programming Interface Manual.
-(At time of writing this includes only Mac OS X 10.2 and later.)
-.It
-An optional decimal digit string specifying a minimum field width.
-If the converted value has fewer characters than the field width, it will
-be padded with spaces on the left (or right, if the left-adjustment
-flag has been given) to fill out
-the field width.
-.It
-An optional precision, in the form of a period
-.Cm \&.
-followed by an
-optional digit string.
-If the digit string is omitted, the precision is taken as zero.
-This gives the minimum number of digits to appear for
-.Cm d , i , o , u , x ,
-and
-.Cm X
-conversions, the number of digits to appear after the decimal-point for
-.Cm a , A , e , E , f ,
-and
-.Cm F
-conversions, the maximum number of significant digits for
-.Cm g
-and
-.Cm G
-conversions, or the maximum number of characters to be printed from a
-string for
-.Cm s
-conversions.
-.It
-An optional length modifier, that specifies the size of the argument.
-The following length modifiers are valid for the
-.Cm d , i , n , o , u , x ,
-or
-.Cm X
-conversion:
-.Bl -column ".Cm q Em (deprecated)" ".Vt signed char" ".Vt unsigned long long" ".Vt long long *"
-.It Sy Modifier Ta Cm d , i Ta Cm o , u , x , X Ta Cm n
-.It Cm hh Ta Vt "signed char" Ta Vt "unsigned char" Ta Vt "signed char *"
-.It Cm h Ta Vt short Ta Vt "unsigned short" Ta Vt "short *"
-.It Cm l No (ell) Ta Vt long Ta Vt "unsigned long" Ta Vt "long *"
-.It Cm ll No (ell ell) Ta Vt "long long" Ta Vt "unsigned long long" Ta Vt "long long *"
-.It Cm j Ta Vt intmax_t Ta Vt uintmax_t Ta Vt "intmax_t *"
-.It Cm t Ta Vt ptrdiff_t Ta (see note) Ta Vt "ptrdiff_t *"
-.It Cm z Ta (see note) Ta Vt size_t Ta (see note)
-.It Cm q Em (deprecated) Ta Vt quad_t Ta Vt u_quad_t Ta Vt "quad_t *"
-.El
-.Pp
-Note:
-the
-.Cm t
-modifier, when applied to a
-.Cm o , u , x ,
-or
-.Cm X
-conversion, indicates that the argument is of an unsigned type
-equivalent in size to a
-.Vt ptrdiff_t .
-The
-.Cm z
-modifier, when applied to a
-.Cm d
-or
-.Cm i
-conversion, indicates that the argument is of a signed type equivalent in
-size to a
-.Vt size_t .
-Similarly, when applied to an
-.Cm n
-conversion, it indicates that the argument is a pointer to a signed type
-equivalent in size to a
-.Vt size_t .
-.Pp
-The following length modifier is valid for the
-.Cm a , A , e , E , f , F , g ,
-or
-.Cm G
-conversion:
-.Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G"
-.It Sy Modifier Ta Cm a , A , e , E , f , F , g , G
-.It Cm l No (ell) Ta Vt double
-(ignored, same behavior as without it)
-.It Cm L Ta Vt "long double"
-.El
-.Pp
-The following length modifier is valid for the
-.Cm c
-or
-.Cm s
-conversion:
-.Bl -column ".Sy Modifier" ".Vt wint_t" ".Vt wchar_t *"
-.It Sy Modifier Ta Cm c Ta Cm s
-.It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *"
-.El
-.Pp
-The AltiVec Technology Programming Interface Manual also defines five additional length modifiers
-which can be used (in place of the conventional length modifiers) for the printing of AltiVec or SSE vectors:
-.Bl -tag -compact
-.It Cm v
-Treat the argument as a vector value, unit length will be determined by the conversion
-specifier (default = 16 8-bit units for all integer conversions, 
-4 32-bit units for floating point conversions).
-.It Cm vh, hv
-Treat the argument as a vector of 8 16-bit units.
-.It Cm vl, lv
-Treat the argument as a vector of 4 32-bit units.
-.El
-.Pp
-NOTE: The vector length specifiers are extensions to the
-.Fn printf
-specification.
-Behaviour of these values for
-.Fn printf 
-is only defined for operating systems conforming to the 
-AltiVec Technology Programming Interface Manual.
-(At time of writing this includes only Mac OS X 10.2 and later.)
-.Pp
-As a further extension, for SSE2 64-bit units:
-.Bl -tag -compact
-.It Cm vll, llv
-Treat the argument as a vector of 2 64-bit units.
-.El
-.It
-A character that specifies the type of conversion to be applied.
-.El
-.Pp
-A field width or precision, or both, may be indicated by
-an asterisk
-.Ql *
-or an asterisk followed by one or more decimal digits and a
-.Ql $
-instead of a
-digit string.
-In this case, an
-.Vt int
-argument supplies the field width or precision.
-A negative field width is treated as a left adjustment flag followed by a
-positive field width; a negative precision is treated as though it were
-missing.
-If a single format directive mixes positional
-.Pq Li nn$
-and non-positional arguments, the results are undefined.
-.Pp
-The conversion specifiers and their meanings are:
-.Bl -tag -width ".Cm diouxX"
-.It Cm diouxX
-The
-.Vt int
-(or appropriate variant) argument is converted to signed decimal
-.Cm ( d
-and
-.Cm i ) ,
-unsigned octal
-.Pq Cm o ,
-unsigned decimal
-.Pq Cm u ,
-or unsigned hexadecimal
-.Cm ( x
-and
-.Cm X )
-notation.
-The letters
-.Dq Li abcdef
-are used for
-.Cm x
-conversions; the letters
-.Dq Li ABCDEF
-are used for
-.Cm X
-conversions.
-The precision, if any, gives the minimum number of digits that must
-appear; if the converted value requires fewer digits, it is padded on
-the left with zeros.
-.It Cm DOU
-The
-.Vt "long int"
-argument is converted to signed decimal, unsigned octal, or unsigned
-decimal, as if the format had been
-.Cm ld , lo ,
-or
-.Cm lu
-respectively.
-These conversion characters are deprecated, and will eventually disappear.
-.It Cm eE
-The
-.Vt double
-argument is rounded and converted in the style
-.Sm off
-.Oo \- Oc Ar d Li \&. Ar ddd Li e \\*[Pm] Ar dd
-.Sm on
-where there is one digit before the
-decimal-point character
-and the number of digits after it is equal to the precision;
-if the precision is missing,
-it is taken as 6; if the precision is
-zero, no decimal-point character appears.
-An
-.Cm E
-conversion uses the letter
-.Ql E
-(rather than
-.Ql e )
-to introduce the exponent.
-The exponent always contains at least two digits; if the value is zero,
-the exponent is 00.
-.Pp
-For
-.Cm a , A , e , E , f , F , g ,
-and
-.Cm G
-conversions, positive and negative infinity are represented as
-.Li inf
-and
-.Li -inf
-respectively when using the lowercase conversion character, and
-.Li INF
-and
-.Li -INF
-respectively when using the uppercase conversion character.
-Similarly, NaN is represented as
-.Li nan
-when using the lowercase conversion, and
-.Li NAN
-when using the uppercase conversion.
-.It Cm fF
-The
-.Vt double
-argument is rounded and converted to decimal notation in the style
-.Sm off
-.Oo \- Oc Ar ddd Li \&. Ar ddd ,
-.Sm on
-where the number of digits after the decimal-point character
-is equal to the precision specification.
-If the precision is missing, it is taken as 6; if the precision is
-explicitly zero, no decimal-point character appears.
-If a decimal point appears, at least one digit appears before it.
-.It Cm gG
-The
-.Vt double
-argument is converted in style
-.Cm f
-or
-.Cm e
-(or
-.Cm F
-or
-.Cm E
-for
-.Cm G
-conversions).
-The precision specifies the number of significant digits.
-If the precision is missing, 6 digits are given; if the precision is zero,
-it is treated as 1.
-Style
-.Cm e
-is used if the exponent from its conversion is less than \-4 or greater than
-or equal to the precision.
-Trailing zeros are removed from the fractional part of the result; a
-decimal point appears only if it is followed by at least one digit.
-.It Cm aA
-The
-.Vt double
-argument is rounded and converted to hexadecimal notation in the style
-.Sm off
-.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d ,
-.Sm on
-where the number of digits after the hexadecimal-point character
-is equal to the precision specification.
-If the precision is missing, it is taken as enough to represent
-the floating-point number exactly, and no rounding occurs.
-If the precision is zero, no hexadecimal-point character appears.
-The
-.Cm p
-is a literal character
-.Ql p ,
-and the exponent consists of a positive or negative sign
-followed by a decimal number representing an exponent of 2.
-The
-.Cm A
-conversion uses the prefix
-.Dq Li 0X
-(rather than
-.Dq Li 0x ) ,
-the letters
-.Dq Li ABCDEF
-(rather than
-.Dq Li abcdef )
-to represent the hex digits, and the letter
-.Ql P
-(rather than
-.Ql p )
-to separate the mantissa and exponent.
-.Pp
-Note that there may be multiple valid ways to represent floating-point
-numbers in this hexadecimal format.
-For example,
-.Li 0x1.92p+1 , 0x3.24p+0 , 0x6.48p-1 ,
-and
-.Li 0xc.9p-2
-are all equivalent.
-The format chosen depends on the internal representation of the
-number, but the implementation guarantees that the length of the
-mantissa will be minimized.
-Zeroes are always represented with a mantissa of 0 (preceded by a
-.Ql -
-if appropriate) and an exponent of
-.Li +0 .
-.It Cm C
-Treated as
-.Cm c
-with the
-.Cm l
-(ell) modifier.
-.It Cm c
-The
-.Vt int
-argument is converted to an
-.Vt "unsigned char" ,
-and the resulting character is written.
-.Pp
-If the
-.Cm l
-(ell) modifier is used, the
-.Vt wint_t
-argument shall be converted to a
-.Vt wchar_t ,
-and the (potentially multi-byte) sequence representing the
-single wide character is written, including any shift sequences.
-If a shift sequence is used, the shift state is also restored
-to the original state after the character.
-.It Cm S
-Treated as
-.Cm s
-with the
-.Cm l
-(ell) modifier.
-.It Cm s
-The
-.Vt "char *"
-argument is expected to be a pointer to an array of character type (pointer
-to a string).
-Characters from the array are written up to (but not including)
-a terminating
-.Dv NUL
-character;
-if a precision is specified, no more than the number specified are
-written.
-If a precision is given, no null character
-need be present; if the precision is not specified, or is greater than
-the size of the array, the array must contain a terminating
-.Dv NUL
-character.
-.Pp
-If the
-.Cm l
-(ell) modifier is used, the
-.Vt "wchar_t *"
-argument is expected to be a pointer to an array of wide characters
-(pointer to a wide string).
-For each wide character in the string, the (potentially multi-byte)
-sequence representing the
-wide character is written, including any shift sequences.
-If any shift sequence is used, the shift state is also restored
-to the original state after the string.
-Wide characters from the array are written up to (but not including)
-a terminating wide
-.Dv NUL
-character;
-if a precision is specified, no more than the number of bytes specified are
-written (including shift sequences).
-Partial characters are never written.
-If a precision is given, no null character
-need be present; if the precision is not specified, or is greater than
-the number of bytes required to render the multibyte representation of
-the string, the array must contain a terminating wide
-.Dv NUL
-character.
-.It Cm p
-The
-.Vt "void *"
-pointer argument is printed in hexadecimal (as if by
-.Ql %#x
-or
-.Ql %#lx ) .
-.It Cm n
-The number of characters written so far is stored into the
-integer indicated by the
-.Vt "int *"
-(or variant) pointer argument.
-No argument is converted.
-.It Cm %
-A
-.Ql %
-is written.
-No argument is converted.
-The complete conversion specification
-is
-.Ql %% .
-.El
-.Pp
-The decimal point
-character is defined in the program's locale (category
-.Dv LC_NUMERIC ) .
-.Pp
-In no case does a non-existent or small field width cause truncation of
-a numeric field; if the result of a conversion is wider than the field
-width, the
-field is expanded to contain the conversion result.
-.Sh EXAMPLES
-To print a date and time in the form
-.Dq Li "Sunday, July 3, 10:02" ,
-where
-.Fa weekday
-and
-.Fa month
-are pointers to strings:
-.Bd -literal -offset indent
-#include <stdio.h>
-fprintf(stdout, "%s, %s %d, %.2d:%.2d\en",
-       weekday, month, day, hour, min);
-.Ed
-.Pp
-To print \*(Pi
-to five decimal places:
-.Bd -literal -offset indent
-#include <math.h>
-#include <stdio.h>
-fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));
-.Ed
-.Pp
-To allocate a 128 byte string and print into it:
-.Bd -literal -offset indent
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-char *newfmt(const char *fmt, ...)
-{
-       char *p;
-       va_list ap;
-       if ((p = malloc(128)) == NULL)
-               return (NULL);
-       va_start(ap, fmt);
-       (void) vsnprintf(p, 128, fmt, ap);
-       va_end(ap);
-       return (p);
-}
-.Ed
-.Sh SECURITY CONSIDERATIONS
-The
-.Fn sprintf
-and
-.Fn vsprintf
-functions are easily misused in a manner which enables malicious users
-to arbitrarily change a running program's functionality through
-a buffer overflow attack.
-Because
-.Fn sprintf
-and
-.Fn vsprintf
-assume an infinitely long string,
-callers must be careful not to overflow the actual space;
-this is often hard to assure.
-For safety, programmers should use the
-.Fn snprintf
-interface instead.
-For example:
-.Bd -literal
-void
-foo(const char *arbitrary_string, const char *and_another)
-{
-       char onstack[8];
-
-#ifdef BAD
-       /*
-        * This first sprintf is bad behavior.  Do not use sprintf!
-        */
-       sprintf(onstack, "%s, %s", arbitrary_string, and_another);
-#else
-       /*
-        * The following two lines demonstrate better use of
-        * snprintf().
-        */
-       snprintf(onstack, sizeof(onstack), "%s, %s", arbitrary_string,
-           and_another);
-#endif
-}
-.Ed
-.Pp
-The
-.Fn printf
-and
-.Fn sprintf
-family of functions are also easily misused in a manner
-allowing malicious users to arbitrarily change a running program's
-functionality by either causing the program
-to print potentially sensitive data
-.Dq "left on the stack" ,
-or causing it to generate a memory fault or bus error
-by dereferencing an invalid pointer.
-.Pp
-.Cm %n
-can be used to write arbitrary data to potentially carefully-selected
-addresses.
-Programmers are therefore strongly advised to never pass untrusted strings
-as the
-.Fa format
-argument, as an attacker can put format specifiers in the string
-to mangle your stack,
-leading to a possible security hole.
-This holds true even if the string was built using a function like
-.Fn snprintf ,
-as the resulting string may still contain user-supplied conversion specifiers
-for later interpolation by
-.Fn printf .
-.Pp
-Always use the proper secure idiom:
-.Pp
-.Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);"
-.Sh COMPATIBILITY
-The conversion formats
-.Cm \&%D , \&%O ,
-and
-.Cm %U
-are not standard and
-are provided only for backward compatibility.
-The effect of padding the
-.Cm %p
-format with zeros (either by the
-.Cm 0
-flag or by specifying a precision), and the benign effect (i.e., none)
-of the
-.Cm #
-flag on
-.Cm %n
-and
-.Cm %p
-conversions, as well as other
-nonsensical combinations such as
-.Cm %Ld ,
-are not standard; such combinations
-should be avoided.
-.Sh ERRORS
-In addition to the errors documented for the
-.Xr write 2
-system call, the
-.Fn printf
-family of functions may fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid wide character code was encountered.
-.It Bq Er ENOMEM
-Insufficient storage space is available.
-.El
-.Sh SEE ALSO
-.Xr printf 1 ,
-.Xr printf_l 3 ,
-.Xr fmtcheck 3 ,
-.Xr scanf 3 ,
-.Xr setlocale 3 ,
-.Xr stdarg 3 ,
-.Xr wprintf 3
-.Sh STANDARDS
-Subject to the caveats noted in the
-.Sx BUGS
-section below, the
-.Fn fprintf ,
-.Fn printf ,
-.Fn sprintf ,
-.Fn vprintf ,
-.Fn vfprintf ,
-and
-.Fn vsprintf
-functions
-conform to
-.St -ansiC
-and
-.St -isoC-99 .
-With the same reservation, the
-.Fn snprintf
-and
-.Fn vsnprintf
-functions conform to
-.St -isoC-99 ,
-while
-.Fn dprintf
-and
-.Fn vdprintf
-conform to
-.St -p1003.1-2008 .
-.Sh HISTORY
-The functions
-.Fn asprintf
-and
-.Fn vasprintf
-first appeared in the
-.Tn GNU C
-library.
-These were implemented by
-.An Peter Wemm Aq peter@FreeBSD.org
-in
-.Fx 2.2 ,
-but were later replaced with a different implementation
-from
-.An Todd C. Miller Aq Todd.Miller@courtesan.com
-for
-.Ox 2.3 .
-The
-.Fn dprintf
-and
-.Fn vdprintf
-functions were added in
-.Fx 8.0 .
-.Sh BUGS
-The
-.Nm
-family of functions do not correctly handle multibyte characters in the
-.Fa format
-argument.
diff --git a/stdio/printfcommon.h b/stdio/printfcommon.h
deleted file mode 100644 (file)
index 27141e6..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/stdio/printfcommon.h,v 1.4 2009/01/22 08:14:28 das Exp $
- */
-
-/*
- * This file defines common routines used by both printf and wprintf.
- * You must define CHAR to either char or wchar_t prior to including this.
- */
-
-
-#ifndef NO_FLOATING_POINT
-
-#define        dtoa            __dtoa
-#define        freedtoa        __freedtoa
-
-#include <float.h>
-#include <math.h>
-#include "floatio.h"
-#include "gdtoa.h"
-
-#define        DEFPREC         6
-
-static int exponent(CHAR *, int, CHAR);
-
-#endif /* !NO_FLOATING_POINT */
-
-static CHAR    *__ujtoa(uintmax_t, CHAR *, int, int, const char *);
-static CHAR    *__ultoa(u_long, CHAR *, int, int, const char *);
-
-#define NIOV 8
-struct io_state {
-       FILE *fp;
-       struct __suio uio;      /* output information: summary */
-       struct __siov iov[NIOV];/* ... and individual io vectors */
-};
-
-static inline void
-io_init(struct io_state *iop, FILE *fp)
-{
-
-       iop->uio.uio_iov = iop->iov;
-       iop->uio.uio_resid = 0;
-       iop->uio.uio_iovcnt = 0;
-       iop->fp = fp;
-}
-
-/*
- * WARNING: The buffer passed to io_print() is not copied immediately; it must
- * remain valid until io_flush() is called.
- */
-static inline int
-io_print(struct io_state *iop, const CHAR * __restrict ptr, int len, locale_t loc)
-{
-
-       iop->iov[iop->uio.uio_iovcnt].iov_base = (char *)ptr;
-       iop->iov[iop->uio.uio_iovcnt].iov_len = len;
-       iop->uio.uio_resid += len;
-       if (++iop->uio.uio_iovcnt >= NIOV)
-               return (__sprint(iop->fp, loc, &iop->uio));
-       else
-               return (0);
-}
-
-/*
- * Choose PADSIZE to trade efficiency vs. size.  If larger printf
- * fields occur frequently, increase PADSIZE and make the initialisers
- * below longer.
- */
-#define        PADSIZE 16              /* pad chunk size */
-static const CHAR blanks[PADSIZE] =
-{' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
-static const CHAR zeroes[PADSIZE] =
-{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
-
-/*
- * Pad with blanks or zeroes. 'with' should point to either the blanks array
- * or the zeroes array.
- */
-static inline int
-io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with, locale_t loc)
-{
-       int n;
-
-       while (howmany > 0) {
-               n = (howmany >= PADSIZE) ? PADSIZE : howmany;
-               if (io_print(iop, with, n, loc))
-                       return (-1);
-               howmany -= n;
-       }
-       return (0);
-}
-
-/*
- * Print exactly len characters of the string spanning p to ep, truncating
- * or padding with 'with' as necessary.
- */
-static inline int
-io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep,
-              int len, const CHAR * __restrict with, locale_t loc)
-{
-       int p_len;
-
-       p_len = ep - p;
-       if (p_len > len)
-               p_len = len;
-       if (p_len > 0) {
-               if (io_print(iop, p, p_len, loc))
-                       return (-1);
-       } else {
-               p_len = 0;
-       }
-       return (io_pad(iop, len - p_len, with, loc));
-}
-
-static inline int
-io_flush(struct io_state *iop, locale_t loc)
-{
-
-       return (__sprint(iop->fp, loc, &iop->uio));
-}
-
-/*
- * Convert an unsigned long to ASCII for printf purposes, returning
- * a pointer to the first character of the string representation.
- * Octal numbers can be forced to have a leading zero; hex numbers
- * use the given digits.
- */
-static CHAR *
-__ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs)
-{
-       CHAR *cp = endp;
-       long sval;
-
-       /*
-        * Handle the three cases separately, in the hope of getting
-        * better/faster code.
-        */
-       switch (base) {
-       case 10:
-               if (val < 10) { /* many numbers are 1 digit */
-                       *--cp = to_char(val);
-                       return (cp);
-               }
-               /*
-                * On many machines, unsigned arithmetic is harder than
-                * signed arithmetic, so we do at most one unsigned mod and
-                * divide; this is sufficient to reduce the range of
-                * the incoming value to where signed arithmetic works.
-                */
-               if (val > LONG_MAX) {
-                       *--cp = to_char(val % 10);
-                       sval = val / 10;
-               } else
-                       sval = val;
-               do {
-                       *--cp = to_char(sval % 10);
-                       sval /= 10;
-               } while (sval != 0);
-               break;
-
-       case 8:
-               do {
-                       *--cp = to_char(val & 7);
-                       val >>= 3;
-               } while (val);
-               if (octzero && *cp != '0')
-                       *--cp = '0';
-               break;
-
-       case 16:
-               do {
-                       *--cp = xdigs[val & 15];
-                       val >>= 4;
-               } while (val);
-               break;
-
-       default:                        /* oops */
-               LIBC_ABORT("__ultoa: invalid base=%d", base);
-       }
-       return (cp);
-}
-
-/* Identical to __ultoa, but for intmax_t. */
-static CHAR *
-__ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs)
-{
-       CHAR *cp = endp;
-       intmax_t sval;
-
-       /* quick test for small values; __ultoa is typically much faster */
-       /* (perhaps instead we should run until small, then call __ultoa?) */
-       if (val <= ULONG_MAX)
-               return (__ultoa((u_long)val, endp, base, octzero, xdigs));
-       switch (base) {
-       case 10:
-               if (val < 10) {
-                       *--cp = to_char(val % 10);
-                       return (cp);
-               }
-               if (val > INTMAX_MAX) {
-                       *--cp = to_char(val % 10);
-                       sval = val / 10;
-               } else
-                       sval = val;
-               do {
-                       *--cp = to_char(sval % 10);
-                       sval /= 10;
-               } while (sval != 0);
-               break;
-
-       case 8:
-               do {
-                       *--cp = to_char(val & 7);
-                       val >>= 3;
-               } while (val);
-               if (octzero && *cp != '0')
-                       *--cp = '0';
-               break;
-
-       case 16:
-               do {
-                       *--cp = xdigs[val & 15];
-                       val >>= 4;
-               } while (val);
-               break;
-
-       default:
-               LIBC_ABORT("__ujtoa: invalid base=%d", base);
-       }
-       return (cp);
-}
-
-#ifndef NO_FLOATING_POINT
-
-static int
-exponent(CHAR *p0, int exp, CHAR fmtch)
-{
-       CHAR *p, *t;
-       CHAR expbuf[MAXEXPDIG];
-
-       p = p0;
-       *p++ = fmtch;
-       if (exp < 0) {
-               exp = -exp;
-               *p++ = '-';
-       }
-       else
-               *p++ = '+';
-       t = expbuf + MAXEXPDIG;
-       if (exp > 9) {
-               do {
-                       *--t = to_char(exp % 10);
-               } while ((exp /= 10) > 9);
-               *--t = to_char(exp);
-               for (; t < expbuf + MAXEXPDIG; *p++ = *t++);
-       }
-       else {
-               /*
-                * Exponents for decimal floating point conversions
-                * (%[eEgG]) must be at least two characters long,
-                * whereas exponents for hexadecimal conversions can
-                * be only one character long.
-                */
-               if (fmtch == 'e' || fmtch == 'E')
-                       *p++ = '0';
-               *p++ = to_char(exp);
-       }
-       return (p - p0);
-}
-
-#endif /* !NO_FLOATING_POINT */
diff --git a/stdio/printflocal.h b/stdio/printflocal.h
deleted file mode 100644 (file)
index f57e8e9..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/stdio/printflocal.h,v 1.3 2009/03/02 04:07:58 das Exp $
- */
-
-/* 
- * Defining here VECTORS for all files that include this header (<rdar://problem/8466056>)
- */
-#define        VECTORS
-
-/*
- * Flags used during conversion.
- */
-#define        ALT             0x001           /* alternate form */
-#define        LADJUST         0x004           /* left adjustment */
-#define        LONGDBL         0x008           /* long double */
-#define        LONGINT         0x010           /* long integer */
-#define        LLONGINT        0x020           /* long long integer */
-#define        SHORTINT        0x040           /* short integer */
-#define        ZEROPAD         0x080           /* zero (as opposed to blank) pad */
-#define        FPT             0x100           /* Floating point number */
-#define        GROUPING        0x200           /* use grouping ("'" flag) */
-                                       /* C99 additional size modifiers: */
-#define        SIZET           0x400           /* size_t */
-#define        PTRDIFFT        0x800           /* ptrdiff_t */
-#define        INTMAXT         0x1000          /* intmax_t */
-#define        CHARINT         0x2000          /* print char using int format */
-#ifdef VECTORS
-#define VECTOR          0x4000          /* Altivec or SSE vector */
-#endif /* VECTORS */
-
-/*
- * Macros for converting digits to letters and vice versa
- */
-#define        to_digit(c)     ((c) - '0')
-#define is_digit(c)    ((unsigned)to_digit(c) <= 9)
-#define        to_char(n)      ((n) + '0')
-
-/* Size of the static argument table. */
-#define STATIC_ARG_TBL_SIZE 8
-
-#ifdef VECTORS
-typedef __attribute__ ((vector_size(16))) unsigned char VECTORTYPE;
-#ifdef __SSE2__
-#define V64TYPE
-#endif /* __SSE2__ */
-#endif /* VECTORS */
-
-union arg {
-       int     intarg;
-       u_int   uintarg;
-       long    longarg;
-       u_long  ulongarg;
-       long long longlongarg;
-       unsigned long long ulonglongarg;
-       ptrdiff_t ptrdiffarg;
-       size_t  sizearg;
-       intmax_t intmaxarg;
-       uintmax_t uintmaxarg;
-       void    *pvoidarg;
-       char    *pchararg;
-       signed char *pschararg;
-       short   *pshortarg;
-       int     *pintarg;
-       long    *plongarg;
-       long long *plonglongarg;
-       ptrdiff_t *pptrdiffarg;
-       ssize_t *pssizearg;
-       intmax_t *pintmaxarg;
-#ifndef NO_FLOATING_POINT
-       double  doublearg;
-       long double longdoublearg;
-#endif
-       wint_t  wintarg;
-       wchar_t *pwchararg;
-#ifdef VECTORS
-       VECTORTYPE              vectorarg;
-       unsigned char           vuchararg[16];
-       signed char             vchararg[16];
-       unsigned short          vushortarg[8];
-       signed short            vshortarg[8];
-       unsigned int            vuintarg[4];
-       signed int              vintarg[4];
-       float                   vfloatarg[4];
-#ifdef V64TYPE
-       double                  vdoublearg[2];
-       unsigned long long      vulonglongarg[2];
-       long long               vlonglongarg[2];
-#endif /* V64TYPE */
-#endif /* VECTORS */
-};
-
-/* Handle positional parameters. */
-int    __find_arguments(const char *, va_list, union arg **);
-int    __find_warguments(const wchar_t *, va_list, union arg **);
diff --git a/stdio/putc-fbsd.c b/stdio/putc-fbsd.c
deleted file mode 120000 (symlink)
index 5d17899..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./putc.c
\ No newline at end of file
diff --git a/stdio/putc.3 b/stdio/putc.3
deleted file mode 100644 (file)
index b5370aa..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)putc.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/putc.3,v 1.16 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd January 10, 2003
-.Dt PUTC 3
-.Os
-.Sh NAME
-.Nm fputc ,
-.Nm putc ,
-.Nm putc_unlocked ,
-.Nm putchar ,
-.Nm putchar_unlocked ,
-.Nm putw
-.Nd output a character or word to a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fo fputc
-.Fa "int c"
-.Fa "FILE *stream"
-.Fc
-.Ft int
-.Fo putc
-.Fa "int c"
-.Fa "FILE *stream"
-.Fc
-.Ft int
-.Fo putc_unlocked
-.Fa "int c"
-.Fa "FILE *stream"
-.Fc
-.Ft int
-.Fo putchar
-.Fa "int c"
-.Fc
-.Ft int
-.Fo putchar_unlocked
-.Fa "int c"
-.Fc
-.Ft int
-.Fo putw
-.Fa "int w"
-.Fa "FILE *stream"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fputc
-function
-writes the character
-.Fa c
-(converted to an ``unsigned char'')
-to the output stream pointed to by
-.Fa stream .
-.Pp
-The
-.Fn putc
-macro acts essentially identically to
-.Fn fputc ,
-but is a macro that expands in-line.
-It may evaluate
-.Fa stream
-more than once, so arguments given to
-.Fn putc
-should not be expressions with potential side effects.
-.Pp
-The
-.Fn putchar
-function
-is identical to
-.Fn putc
-with an output stream of
-.Dv stdout .
-.Pp
-The
-.Fn putw
-function
-writes the specified
-.Vt int
-to the named output
-.Fa stream .
-.Pp
-The
-.Fn putc_unlocked
-and
-.Fn putchar_unlocked
-functions are equivalent to
-.Fn putc
-and
-.Fn putchar
-respectively,
-except that the caller is responsible for locking the stream
-with
-.Xr flockfile 3
-before calling them.
-These functions may be used to avoid the overhead of locking the stream
-for each character, and to avoid output being interspersed from multiple
-threads writing to the same stream.
-.Sh RETURN VALUES
-The functions,
-.Fn fputc ,
-.Fn putc ,
-.Fn putchar ,
-.Fn putc_unlocked ,
-and
-.Fn putchar_unlocked
-return the character written.
-If an error occurs, the value
-.Dv EOF
-is returned.
-The
-.Fn putw
-function
-returns 0 on success;
-.Dv EOF
-is returned if
-a write error occurs,
-or if an attempt is made to write a read-only stream.
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr flockfile 3 ,
-.Xr fopen 3 ,
-.Xr getc 3 ,
-.Xr putwc 3 ,
-.Xr stdio 3
-.Sh STANDARDS
-The functions
-.Fn fputc ,
-.Fn putc ,
-and
-.Fn putchar ,
-conform to
-.St -isoC .
-The
-.Fn putc_unlocked
-and
-.Fn putchar_unlocked
-functions conform to
-.St -p1003.1-2001 .
-A function
-.Fn putw
-function appeared in
-.At v6 .
-.Sh BUGS
-The size and byte order of an
-.Vt int
-varies from one machine to another, and
-.Fn putw
-is not recommended for portable applications.
diff --git a/stdio/putchar-fbsd.c b/stdio/putchar-fbsd.c
deleted file mode 120000 (symlink)
index 931f024..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./putchar.c
\ No newline at end of file
diff --git a/stdio/puts-fbsd.c b/stdio/puts-fbsd.c
deleted file mode 100644 (file)
index 511cab4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)puts.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/puts.c,v 1.11 2007/01/09 00:28:07 imp Exp $");
-
-#include "namespace.h"
-#include <stdio.h>
-#include <string.h>
-#include "un-namespace.h"
-#include "fvwrite.h"
-#include "libc_private.h"
-#include "local.h"
-
-// 3340719: __puts_null__ is used if string is NULL.  Shared by fputs.c
-__private_extern__ char const __puts_null__[] = "(null)";
-
-/*
- * Write the given string to stdout, appending a newline.
- */
-int
-puts(s)
-       char const *s;
-{
-       int retval;
-       size_t c;
-       struct __suio uio;
-       struct __siov iov[2];
-
-       // 3340719: __puts_null__ is used if s is NULL
-       if(s == NULL)
-               s = __puts_null__;
-       iov[0].iov_base = (void *)s;
-       iov[0].iov_len = c = strlen(s);
-       iov[1].iov_base = "\n";
-       iov[1].iov_len = 1;
-       uio.uio_resid = c + 1;
-       uio.uio_iov = &iov[0];
-       uio.uio_iovcnt = 2;
-       FLOCKFILE(stdout);
-       ORIENT(stdout, -1);
-       retval = __sfvwrite(stdout, &uio) ? EOF : '\n';
-       FUNLOCKFILE(stdout);
-       return (retval);
-}
diff --git a/stdio/putw-fbsd.c b/stdio/putw-fbsd.c
deleted file mode 120000 (symlink)
index f7fa830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./putw.c
\ No newline at end of file
diff --git a/stdio/putwc-fbsd.c b/stdio/putwc-fbsd.c
deleted file mode 100644 (file)
index e854309..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/putwc.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-#undef putwc
-
-/*
- * Synonym for fputwc(). The only difference is that putwc(), if it is a
- * macro, may evaluate `fp' more than once.
- */
-wint_t
-putwc(wchar_t wc, FILE *fp)
-{
-
-       return (fputwc_l(wc, fp, __current_locale()));
-}
-
-wint_t
-putwc_l(wchar_t wc, FILE *fp, locale_t loc)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because fputwc_l will */
-       return (fputwc_l(wc, fp, loc));
-}
diff --git a/stdio/putwc.3 b/stdio/putwc.3
deleted file mode 100644 (file)
index 84799bc..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-.\"    $NetBSD: putwc.3,v 1.2 2002/02/07 07:00:26 ross Exp $
-.\"
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)putc.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/putwc.3,v 1.8 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd March 3, 2004
-.Dt PUTWC 3
-.Os
-.Sh NAME
-.Nm fputwc ,
-.Nm putwc ,
-.Nm putwchar
-.Nd output a wide character to a stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft wint_t
-.Fo fputwc
-.Fa "wchar_t wc"
-.Fa "FILE *stream"
-.Fc
-.Ft wint_t
-.Fo putwc
-.Fa "wchar_t wc"
-.Fa "FILE *stream"
-.Fc
-.Ft wint_t
-.Fo putwchar
-.Fa "wchar_t wc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fputwc
-function
-writes the wide character
-.Fa wc
-to the output stream pointed to by
-.Fa stream .
-.Pp
-The
-.Fn putwc
-function
-acts essentially identically to
-.Fn fputwc .
-.Pp
-The
-.Fn putwchar
-function
-is identical to
-.Fn putwc
-with an output stream of
-.Dv stdout .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr putwc_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn fputwc ,
-.Fn putwc ,
-and
-.Fn putwchar
-functions
-return the wide character written.
-If an error occurs, the value
-.Dv WEOF
-is returned.
-.Sh SEE ALSO
-.Xr ferror 3 ,
-.Xr fopen 3 ,
-.Xr getwc 3 ,
-.Xr putc 3 ,
-.Xr putwc_l 3 ,
-.Xr stdio 3
-.Sh STANDARDS
-The
-.Fn fputwc ,
-.Fn putwc ,
-and
-.Fn putwchar
-functions
-conform to
-.St -isoC-99 .
diff --git a/stdio/putwchar-fbsd.c b/stdio/putwchar-fbsd.c
deleted file mode 100644 (file)
index bc3ef1f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/putwchar.c,v 1.3 2004/05/25 10:42:52 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-#undef putwchar
-
-/*
- * Synonym for fputwc(wc, stdout).
- */
-wint_t
-putwchar(wchar_t wc)
-{
-
-       return (fputwc_l(wc, stdout, __current_locale()));
-}
-
-wint_t
-putwchar_l(wchar_t wc, locale_t loc)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because fputwc_l will */
-       return (fputwc_l(wc, stdout, loc));
-}
diff --git a/stdio/refill-fbsd.c b/stdio/refill-fbsd.c
deleted file mode 100644 (file)
index 8d42bbb..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)refill.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/refill.c,v 1.20 2008/04/17 22:17:54 jhb Exp $");
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "local.h"
-
-static int lflush(FILE *);
-
-static int
-lflush(FILE *fp)
-{
-       int     ret = 0;
-
-       if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR)) {
-               FLOCKFILE(fp);
-               ret = __sflush(fp);
-               FUNLOCKFILE(fp);
-       }
-       return (ret);
-}
-
-/*
- * Refill a stdio buffer.
- * Return EOF on eof or error, 0 otherwise.
- */
-__private_extern__ int
-__srefill0(FILE *fp)
-{
-
-       /* make sure stdio is set up */
-       if (!__sdidinit)
-               __sinit();
-
-       ORIENT(fp, -1);
-
-       fp->_r = 0;             /* largely a convenience for callers */
-
-       /* SysV does not make this test; take it out for compatibility */
-       if (fp->_flags & __SEOF)
-               return (EOF);
-
-       /* if not already reading, have to be reading and writing */
-       if ((fp->_flags & __SRD) == 0) {
-               if ((fp->_flags & __SRW) == 0) {
-                       errno = EBADF;
-                       fp->_flags |= __SERR;
-                       return (EOF);
-               }
-               /* switch to reading */
-               if (fp->_flags & __SWR) {
-                       if (__sflush(fp))
-                               return (EOF);
-                       fp->_flags &= ~__SWR;
-                       fp->_w = 0;
-                       fp->_lbfsize = 0;
-               }
-               fp->_flags |= __SRD;
-       } else {
-               /*
-                * We were reading.  If there is an ungetc buffer,
-                * we must have been reading from that.  Drop it,
-                * restoring the previous buffer (if any).  If there
-                * is anything in that buffer, return.
-                */
-               if (HASUB(fp)) {
-                       FREEUB(fp);
-                       if ((fp->_r = fp->_ur) != 0) {
-                               fp->_p = fp->_up;
-                               return (0);
-                       }
-               }
-       }
-
-       if (fp->_bf._base == NULL)
-               __smakebuf(fp);
-
-       /*
-        * Before reading from a line buffered or unbuffered file,
-        * flush all line buffered output files, per the ANSI C
-        * standard.
-        */
-       if (fp->_flags & (__SLBF|__SNBF)) {
-               /* Ignore this file in _fwalk to avoid potential deadlock. */
-               fp->_flags |= __SIGN;
-               (void) _fwalk(lflush);
-               fp->_flags &= ~__SIGN;
-
-               /* Now flush this file without locking it. */
-               if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
-                       __sflush(fp);
-       }
-       return (1);
-}
-
-__private_extern__ int
-__srefill1(FILE *fp)
-{
-
-       fp->_p = fp->_bf._base;
-       fp->_r = _sread(fp, (char *)fp->_p, fp->_bf._size);
-       fp->_flags &= ~__SMOD;  /* buffer contents are again pristine */
-       if (fp->_r <= 0) {
-               if (fp->_r == 0)
-                       fp->_flags |= __SEOF;
-               else {
-                       fp->_r = 0;
-                       fp->_flags |= __SERR;
-               }
-               return (EOF);
-       }
-       return (0);
-}
-
-int
-__srefill(FILE *fp)
-{
-       int ret;
-
-       if ((ret = __srefill0(fp)) <= 0)
-               return ret;
-       return __srefill1(fp);
-}
diff --git a/stdio/remove-fbsd.c b/stdio/remove-fbsd.c
deleted file mode 120000 (symlink)
index 77af909..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./remove.c
\ No newline at end of file
diff --git a/stdio/remove.3 b/stdio/remove.3
deleted file mode 100644 (file)
index 5f10003..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)remove.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/remove.3,v 1.10 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt REMOVE 3
-.Os
-.Sh NAME
-.Nm remove
-.Nd remove directory entry
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fn remove "const char *path"
-.Sh DESCRIPTION
-The
-.Fn remove
-function removes the file or directory specified by
-.Fa path .
-.Pp
-If
-.Fa path
-specifies a directory,
-.Fn remove "path"
-is the equivalent of
-.Fn rmdir "path" .
-Otherwise, it is the equivalent of
-.Fn unlink "path" .
-.Sh RETURN VALUES
-.Rv -std remove
-.Sh ERRORS
-The
-.Fn remove
-function
-may fail and set
-.Va errno
-for any of the errors specified for the routines
-.Xr lstat 2 ,
-.Xr rmdir 2 ,
-or
-.Xr unlink 2 .
-.Sh SEE ALSO
-.Xr rmdir 2 ,
-.Xr unlink 2
-.Sh STANDARDS
-The
-.Fn remove
-function conforms to
-.St -isoC
-and
-.St -xpg4.2 .
diff --git a/stdio/rewind-fbsd.c b/stdio/rewind-fbsd.c
deleted file mode 100644 (file)
index 3dc282d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rewind.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/rewind.c,v 1.12 2007/01/09 00:28:07 imp Exp $");
-
-#include "namespace.h"
-#include <errno.h>
-#include <stdio.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-void
-rewind(FILE *fp)
-{
-       int serrno = errno;
-
-       /* make sure stdio is set up */
-       if (!__sdidinit)
-               __sinit();
-
-       FLOCKFILE(fp);
-       if (_fseeko(fp, (off_t)0, SEEK_SET, 1) == 0) {
-               errno = serrno;
-       }
-       clearerr_unlocked(fp);  /* POSIX: clear stdio error regardless */
-       FUNLOCKFILE(fp);
-}
diff --git a/stdio/rget-fbsd.c b/stdio/rget-fbsd.c
deleted file mode 120000 (symlink)
index 6508de2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rget.c
\ No newline at end of file
diff --git a/stdio/scanf-fbsd.c b/stdio/scanf-fbsd.c
deleted file mode 100644 (file)
index c2992ec..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)scanf.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/scanf.c,v 1.13 2007/01/09 00:28:07 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include <stdarg.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-int
-scanf(char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       FLOCKFILE(stdin);
-       ret = __svfscanf_l(stdin, __current_locale(), fmt, ap);
-       FUNLOCKFILE(stdin);
-       va_end(ap);
-       return (ret);
-}
-
-int
-scanf_l(locale_t loc, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       NORMALIZE_LOCALE(loc);
-       va_start(ap, fmt);
-       FLOCKFILE(stdin);
-       ret = __svfscanf_l(stdin, loc, fmt, ap);
-       FUNLOCKFILE(stdin);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/scanf.3 b/stdio/scanf.3
deleted file mode 100644 (file)
index 4bf7240..0000000
+++ /dev/null
@@ -1,540 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)scanf.3    8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/stdio/scanf.3,v 1.25 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd January 4, 2003
-.Dt SCANF 3
-.Os
-.Sh NAME
-.Nm fscanf ,
-.Nm scanf ,
-.Nm sscanf ,
-.Nm vfscanf ,
-.Nm vscanf ,
-.Nm vsscanf
-.Nd input format conversion
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fo fscanf
-.Fa "FILE *restrict stream"
-.Fa "const char *restrict format" ...
-.Fc
-.Ft int
-.Fo scanf
-.Fa "const char *restrict format" ...
-.Fc
-.Ft int
-.Fo sscanf
-.Fa "const char *restrict s"
-.Fa "const char *restrict format" ...
-.Fc
-.In stdarg.h
-.In stdio.h
-.Ft int
-.Fo vfscanf
-.Fa "FILE *restrict stream"
-.Fa "const char *restrict format"
-.Fa "va_list arg"
-.Fc
-.Ft int
-.Fo vscanf
-.Fa "const char *restrict format"
-.Fa "va_list arg"
-.Fc
-.Ft int
-.Fo vsscanf
-.Fa "const char *restrict s"
-.Fa "const char *restrict format"
-.Fa "va_list arg"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn scanf
-family of functions scans input according to a
-.Fa format ,
-as described below.
-This format may contain
-.Em conversion specifiers ;
-the results from such conversions, if any,
-are stored through the
-.Em pointer
-arguments.
-The
-.Fn scanf
-function
-reads input from the standard input stream
-.Dv stdin ,
-.Fn fscanf
-reads input from the stream pointer
-.Fa stream ,
-and
-.Fn sscanf
-reads its input from the character string pointed to by
-.Fa s .
-.Pp
-The
-.Fn vfscanf
-function
-is analogous to
-.Xr vfprintf 3
-and reads input from the stream pointer
-.Fa stream
-using a variable argument list of pointers (see
-.Xr stdarg 3 ) .
-The
-.Fn vscanf
-function scans a variable argument list from the standard input and
-the
-.Fn vsscanf
-function scans it from a string;
-these are analogous to
-the
-.Fn vprintf
-and
-.Fn vsprintf
-functions, respectively.
-.Pp
-Each successive
-.Em pointer
-argument must correspond properly with
-each successive conversion specifier
-(but see the
-.Cm *
-conversion below).
-All conversions are introduced by the
-.Cm %
-(percent sign) character.
-The
-.Fa format
-string
-may also contain other characters.
-White space (such as blanks, tabs, or newlines) in the
-.Fa format
-string match any amount of white space, including none, in the input.
-Everything else
-matches only itself.
-Scanning stops
-when an input character does not match such a format character.
-Scanning also stops
-when an input conversion cannot be made (see below).
-.Pp
-Extended locale versions of these functions are documented in
-.Xr scanf_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh CONVERSIONS
-Following the
-.Cm %
-character introducing a conversion,
-there may be a number of
-.Em flag
-characters, as follows:
-.Bl -tag -width ".Cm l No (ell)"
-.It Cm *
-Suppresses assignment.
-The conversion that follows occurs as usual, but no pointer is used;
-the result of the conversion is simply discarded.
-.It Cm hh
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt char
-(rather than
-.Vt int ) .
-.It Cm h
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "short int"
-(rather than
-.Vt int ) .
-.It Cm l No (ell)
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "long int"
-(rather than
-.Vt int ) ,
-that the conversion will be one of
-.Cm a , e , f ,
-or
-.Cm g
-and the next pointer is a pointer to
-.Vt double
-(rather than
-.Vt float ) ,
-or that the conversion will be one of
-.Cm c ,
-.Cm s
-or
-.Cm \&[
-and the next pointer is a pointer to an array of
-.Vt wchar_t
-(rather than
-.Vt char ) .
-.It Cm ll No (ell ell)
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "long long int"
-(rather than
-.Vt int ) .
-.It Cm L
-Indicates that the conversion will be one of
-.Cm a , e , f ,
-or
-.Cm g
-and the next pointer is a pointer to
-.Vt "long double" .
-.It Cm j
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt intmax_t
-(rather than
-.Vt int ) .
-.It Cm t
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt ptrdiff_t
-(rather than
-.Vt int ) .
-.It Cm z
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt size_t
-(rather than
-.Vt int ) .
-.It Cm q
-(deprecated.)
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "long long int"
-(rather than
-.Vt int ) .
-.El
-.Pp
-In addition to these flags,
-there may be an optional maximum field width,
-expressed as a decimal integer,
-between the
-.Cm %
-and the conversion.
-If no width is given,
-a default of
-.Dq infinity
-is used (with one exception, below);
-otherwise at most this many bytes are scanned
-in processing the conversion.
-In the case of the
-.Cm lc ,
-.Cm ls
-and
-.Cm l[
-conversions, the field width specifies the maximum number
-of multibyte characters that will be scanned.
-Before conversion begins,
-most conversions skip white space;
-this white space is not counted against the field width.
-.Pp
-The following conversions are available:
-.Bl -tag -width XXXX
-.It Cm %
-Matches a literal
-.Ql % .
-That is,
-.Dq Li %%
-in the format string
-matches a single input
-.Ql %
-character.
-No conversion is done, and assignment does not occur.
-.It Cm d
-Matches an optionally signed decimal integer;
-the next pointer must be a pointer to
-.Vt int .
-.It Cm i
-Matches an optionally signed integer;
-the next pointer must be a pointer to
-.Vt int .
-The integer is read in base 16 if it begins
-with
-.Ql 0x
-or
-.Ql 0X ,
-in base 8 if it begins with
-.Ql 0 ,
-and in base 10 otherwise.
-Only characters that correspond to the base are used.
-.It Cm o
-Matches an octal integer;
-the next pointer must be a pointer to
-.Vt "unsigned int" .
-.It Cm u
-Matches an optionally signed decimal integer;
-the next pointer must be a pointer to
-.Vt "unsigned int" .
-.It Cm x , X
-Matches an optionally signed hexadecimal integer;
-the next pointer must be a pointer to
-.Vt "unsigned int" .
-.It Cm a , A , e , E , f , F , g , G
-Matches a floating-point number in the style of
-.Xr strtod 3 .
-The next pointer must be a pointer to
-.Vt float
-(unless
-.Cm l
-or
-.Cm L
-is specified.)
-.It Cm s
-Matches a sequence of non-white-space characters;
-the next pointer must be a pointer to
-.Vt char ,
-and the array must be large enough to accept all the sequence and the
-terminating
-.Dv NUL
-character.
-The input string stops at white space
-or at the maximum field width, whichever occurs first.
-.Pp
-If an
-.Cm l
-qualifier is present, the next pointer must be a pointer to
-.Vt wchar_t ,
-into which the input will be placed after conversion by
-.Xr mbrtowc 3 .
-.It Cm S
-The same as
-.Cm ls .
-.It Cm c
-Matches a sequence of
-.Em width
-count
-characters (default 1);
-the next pointer must be a pointer to
-.Vt char ,
-and there must be enough room for all the characters
-(no terminating
-.Dv NUL
-is added).
-The usual skip of leading white space is suppressed.
-To skip white space first, use an explicit space in the format.
-.Pp
-If an
-.Cm l
-qualifier is present, the next pointer must be a pointer to
-.Vt wchar_t ,
-into which the input will be placed after conversion by
-.Xr mbrtowc 3 .
-.It Cm C
-The same as
-.Cm lc .
-.It Cm \&[
-Matches a nonempty sequence of characters from the specified set
-of accepted characters;
-the next pointer must be a pointer to
-.Vt char ,
-and there must be enough room for all the characters in the string,
-plus a terminating
-.Dv NUL
-character.
-The usual skip of leading white space is suppressed.
-The string is to be made up of characters in
-(or not in)
-a particular set;
-the set is defined by the characters between the open bracket
-.Cm [
-character
-and a close bracket
-.Cm ]
-character.
-The set
-.Em excludes
-those characters
-if the first character after the open bracket is a circumflex
-.Cm ^ .
-To include a close bracket in the set,
-make it the first character after the open bracket
-or the circumflex;
-any other position will end the set.
-The hyphen character
-.Cm -
-is also special;
-when placed between two other characters,
-it adds all intervening characters to the set.
-To include a hyphen,
-make it the last character before the final close bracket.
-For instance,
-.Ql [^]0-9-]
-means the set
-.Dq "everything except close bracket, zero through nine, and hyphen" .
-The string ends with the appearance of a character not in the
-(or, with a circumflex, in) set
-or when the field width runs out.
-.Pp
-If an
-.Cm l
-qualifier is present, the next pointer must be a pointer to
-.Vt wchar_t ,
-into which the input will be placed after conversion by
-.Xr mbrtowc 3 .
-.It Cm p
-Matches a pointer value (as printed by
-.Ql %p
-in
-.Xr printf 3 ) ;
-the next pointer must be a pointer to
-.Vt "void *"
-(or other pointer type).
-.It Cm n
-Nothing is expected;
-instead, the number of characters consumed thus far from the input
-is stored through the next pointer,
-which must be a pointer to
-.Vt int .
-This is
-.Em not
-a conversion, although it can be suppressed with the
-.Cm *
-flag.
-.El
-.Pp
-The decimal point
-character is defined in the program's locale (category
-.Dv LC_NUMERIC ) .
-.Pp
-For backwards compatibility, a
-.Dq conversion
-of
-.Ql %\e0
-causes an immediate return of
-.Dv EOF .
-.Sh RETURN VALUES
-These functions return the number of input items assigned.
-This can be fewer than provided for, or even zero,
-in the event of a matching failure.
-Zero indicates that, although there was input available,
-no conversions were assigned;
-typically this is due to an invalid input character,
-such as an alphabetic character for a
-.Ql %d
-conversion.
-The value
-.Dv EOF
-is returned if an input failure occurs before any conversion such as an
-end-of-file occurs.
-If an error or end-of-file occurs after conversion
-has begun,
-the number of conversions which were successfully completed is returned.
-.Sh SEE ALSO
-.Xr getc 3 ,
-.Xr mbrtowc 3 ,
-.Xr printf 3 ,
-.Xr scanf_l 3 ,
-.Xr strtod 3 ,
-.Xr strtol 3 ,
-.Xr strtoul 3 ,
-.Xr wscanf 3
-.Sh STANDARDS
-The functions
-.Fn fscanf ,
-.Fn scanf ,
-.Fn sscanf ,
-.Fn vfscanf ,
-.Fn vscanf ,
-and
-.Fn vsscanf
-conform to
-.St -isoC-99 .
-.Sh BUGS
-Earlier implementations of
-.Nm
-treated
-.Cm \&%D , \&%E , \&%F , \&%O
-and
-.Cm \&%X
-as their lowercase equivalents with an
-.Cm l
-modifier.
-In addition,
-.Nm
-treated an unknown conversion character as
-.Cm \&%d
-or
-.Cm \&%D ,
-depending on its case.
-This functionality has been removed.
-.Pp
-Numerical strings are truncated to 512 characters; for example,
-.Cm %f
-and
-.Cm %d
-are implicitly
-.Cm %512f
-and
-.Cm %512d .
-.Pp
-The
-.Cm %n$
-modifiers for positional arguments are not implemented.
-.Pp
-The
-.Nm
-family of functions do not correctly handle multibyte characters in the
-.Fa format
-argument.
diff --git a/stdio/setbuf-fbsd.c b/stdio/setbuf-fbsd.c
deleted file mode 120000 (symlink)
index 329af07..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setbuf.c
\ No newline at end of file
diff --git a/stdio/setbuf.3 b/stdio/setbuf.3
deleted file mode 100644 (file)
index 466d8b3..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)setbuf.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/setbuf.3,v 1.17 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt SETBUF 3
-.Os
-.Sh NAME
-.Nm setbuf ,
-.Nm setbuffer ,
-.Nm setlinebuf ,
-.Nm setvbuf
-.Nd stream buffering operations
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft void
-.Fo setbuf
-.Fa "FILE *restrict stream"
-.Fa "char *restrict buf"
-.Fc
-.Ft void
-.Fo setbuffer
-.Fa "FILE *stream"
-.Fa "char *buf"
-.Fa "int size"
-.Fc
-.Ft int
-.Fo setlinebuf
-.Fa "FILE *stream"
-.Fc
-.Ft int
-.Fo setvbuf
-.Fa "FILE *restrict stream"
-.Fa "char *restrict buf"
-.Fa "int type"
-.Fa "size_t size"
-.Fc
-.Sh DESCRIPTION
-Three types of buffering are available:
-unbuffered, block buffered, and line buffered.
-When an output stream is unbuffered, information appears on the
-destination file or terminal as soon as written;
-when it is block buffered,
-many characters are saved up and written as a block;
-when it is line buffered,
-characters are saved up until a newline is output
-or input is read from any stream attached to a terminal device
-(typically
-.Dv stdin ) .
-The function
-.Xr fflush 3
-may be used to force the block out early.
-(See
-.Xr fclose 3 . )
-.Pp
-Normally, all files are block buffered.
-When the first
-.Tn I/O
-operation occurs on a file,
-.Xr malloc 3
-is called and an optimally-sized buffer is obtained.
-If a stream refers to a terminal
-(as
-.Dv stdout
-normally does), it is line buffered.
-The standard error stream
-.Dv stderr
-is always unbuffered.
-.Pp
-The
-.Fn setvbuf
-function
-may be used to alter the buffering behavior of a stream.
-The
-.Fa type
-argument must be one of the following three macros:
-.Bl -tag -width _IOFBF -offset indent
-.It Dv _IONBF
-unbuffered
-.It Dv _IOLBF
-line buffered
-.It Dv _IOFBF
-fully buffered
-.El
-.Pp
-The
-.Fa size
-argument may be given as zero
-to obtain deferred optimal-size buffer allocation as usual.
-If it is not zero,
-then except for unbuffered files, the
-.Fa buf
-argument should point to a buffer at least
-.Fa size
-bytes long;
-this buffer will be used instead of the current buffer.
-If
-.Fa buf
-is not
-.Dv NULL ,
-it is the caller's responsibility to
-.Xr free 3
-this buffer after closing the stream.
-(If the
-.Fa size
-argument
-is not zero but
-.Fa buf
-is
-.Dv NULL ,
-a buffer of the given size will be allocated immediately,
-and released on close.
-This is an extension to ANSI C;
-portable code should use a size of 0 with any
-.Dv NULL
-buffer.)
-.Pp
-The
-.Fn setvbuf
-function may be used at any time,
-but may have peculiar side effects
-(such as discarding input or flushing output)
-if the stream is ``active''.
-Portable applications should call it only once on any given stream,
-and before any
-.Tn I/O
-is performed.
-.Pp
-The other three calls are, in effect, simply aliases for calls to
-.Fn setvbuf .
-Except for the lack of a return value, the
-.Fn setbuf
-function is exactly equivalent to the call
-.Pp
-.Dl "setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);"
-.Pp
-The
-.Fn setbuffer
-function
-is the same, except that the size of the buffer is up to the caller,
-rather than being determined by the default
-.Dv BUFSIZ .
-The
-.Fn setlinebuf
-function
-is exactly equivalent to the call:
-.Pp
-.Dl "setvbuf(stream, (char *)NULL, _IOLBF, 0);"
-.Sh RETURN VALUES
-The
-.Fn setvbuf
-function returns 0 on success, or
-.Dv EOF
-if the request cannot be honored
-(note that the stream is still functional in this case).
-.Pp
-The
-.Fn setlinebuf
-function returns what the equivalent
-.Fn setvbuf
-would have returned.
-.Sh SEE ALSO
-.Xr fclose 3 ,
-.Xr fopen 3 ,
-.Xr fread 3 ,
-.Xr malloc 3 ,
-.Xr printf 3 ,
-.Xr puts 3
-.Sh STANDARDS
-The
-.Fn setbuf
-and
-.Fn setvbuf
-functions
-conform to
-.St -isoC .
-.Sh BUGS
-The
-.Fn setbuffer
-and
-.Fn setlinebuf
-functions are not portable to versions of
-.Bx
-before
-.Bx 4.2 .
-On
-.Bx 4.2
-and
-.Bx 4.3
-systems,
-.Fn setbuf
-always uses a suboptimal buffer size and should be avoided.
diff --git a/stdio/setbuffer-fbsd.c b/stdio/setbuffer-fbsd.c
deleted file mode 120000 (symlink)
index ee91e10..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setbuffer.c
\ No newline at end of file
diff --git a/stdio/setvbuf-fbsd.c b/stdio/setvbuf-fbsd.c
deleted file mode 120000 (symlink)
index dfc0b57..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./setvbuf.c
\ No newline at end of file
diff --git a/stdio/snprintf-fbsd.c b/stdio/snprintf-fbsd.c
deleted file mode 100644 (file)
index 55f01cf..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "local.h"
-
-int
-snprintf(char * __restrict str, size_t n, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vsnprintf_l(str, n, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-snprintf_l(char * __restrict str, size_t n, locale_t loc,
-    char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vsnprintf_l(str, n, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/sprintf-fbsd.c b/stdio/sprintf-fbsd.c
deleted file mode 100644 (file)
index f2cb3a9..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sprintf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <limits.h>
-#include "local.h"
-
-int
-sprintf(char * __restrict str, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vsprintf_l(str, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-sprintf_l(char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vsprintf_l(str, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/sscanf-fbsd.c b/stdio/sscanf-fbsd.c
deleted file mode 100644 (file)
index 16c313f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sscanf.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include "local.h"
-
-int
-sscanf(const char * __restrict str, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vsscanf_l(str, __current_locale(), fmt, ap);
-       va_end(ap);
-       return (ret);
-}
-
-int
-sscanf_l(const char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vsscanf_l(str, loc, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/stdio/stdio-fbsd.c b/stdio/stdio-fbsd.c
deleted file mode 120000 (symlink)
index 5731d59..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./stdio.c
\ No newline at end of file
diff --git a/stdio/stdio.3 b/stdio/stdio.3
deleted file mode 100644 (file)
index 1cf1be6..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)stdio.3    8.7 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/stdio/stdio.3,v 1.30 2009/03/04 03:38:51 das Exp $
-.\"
-.Dd March 3, 2009
-.Dt STDIO 3
-.Os
-.Sh NAME
-.Nm stdio
-.Nd standard input/output library functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Vt FILE *stdin ;
-.Vt FILE *stdout ;
-.Vt FILE *stderr ;
-.Pp
-Note:
-The current implementation does not allow these variables
-to be evaluated at C compile/link time.
-That is, a runtime calculation must be performed, such as:
-.Bd -literal -offset indent
-#include <stdio.h>
-
-static FILE *var;
-
-int main() {
-    var = stdout;
-}
-.Ed
-.Sh DESCRIPTION
-The standard
-.Tn I/O
-library provides a simple and efficient buffered stream
-.Tn I/O
-interface.
-Input and output is mapped into logical data streams
-and the physical
-.Tn I/O
-characteristics are concealed.
-The functions and macros are listed
-below; more information is available from the individual man pages.
-.Pp
-A stream is associated with an external file (which may be a physical
-device) by
-.Em opening
-a file, which may involve creating a new file.
-Creating an
-existing file causes its former contents to be discarded.
-If a file can support positioning requests (such as a disk file, as opposed
-to a terminal) then a
-.Em file position indicator
-associated with the stream is positioned at the start of the file (byte
-zero), unless the file is opened with append mode.
-If append mode
-is used, the position indicator will be placed at the end-of-file.
-The position indicator is maintained by subsequent reads, writes
-and positioning requests.
-All input occurs as if the characters
-were read by successive calls to the
-.Xr fgetc 3
-function; all output takes place as if all characters were
-written by successive calls to the
-.Xr fputc 3
-function.
-.Pp
-A file is disassociated from a stream by
-.Em closing
-the file.
-Output streams are flushed (any unwritten buffer contents are transferred
-to the host environment) before the stream is disassociated from the file.
-The value of a pointer to a
-.Dv FILE
-object is indeterminate (garbage) after a file is closed.
-.Pp
-A file may be subsequently reopened, by the same or another program
-execution, and its contents reclaimed or modified (if it can be repositioned
-at the start).
-If the main function returns to its original caller, or
-the
-.Xr exit 3
-function is called, all open files are closed (hence all output
-streams are flushed) before program termination.
-Other methods
-of program termination may not close files properly and hence
-buffered output may be lost.
-In particular,
-.Xr _exit 2
-does not flush stdio files.
-Neither does an exit due to a signal.
-Buffers are flushed by
-.Xr abort 3
-as required by POSIX, although previous implementations did not.
-.Pp
-This implementation makes no distinction between
-.Dq text
-and
-.Dq binary
-streams.
-In effect, all streams are binary.
-No translation is performed and no extra padding appears on any stream.
-.Pp
-At program startup, three streams are predefined and need not be
-opened explicitly:
-.Bl -bullet -compact -offset indent
-.It
-.Em standard input
-(for reading conventional input),
-.It
-.Em standard output
-(for writing conventional output), and
-.It
-.Em standard error
-(for writing diagnostic output).
-.El
-These streams are abbreviated
-.Dv stdin , stdout
-and
-.Dv stderr .
-Initially, the standard error stream
-is unbuffered; the standard input and output streams are
-fully buffered if and only if the streams do not refer to
-an interactive or
-.Dq terminal
-device, as determined by the
-.Xr isatty 3
-function.
-In fact,
-.Em all
-freshly-opened streams that refer to terminal devices
-default to line buffering, and
-pending output to such streams is written automatically
-whenever such an input stream is read.
-Note that this applies only to
-.Dq "true reads" ;
-if the read request can be satisfied by existing buffered data,
-no automatic flush will occur.
-In these cases,
-or when a large amount of computation is done after printing
-part of a line on an output terminal, it is necessary to
-.Xr fflush 3
-the standard output before going off and computing so that the output
-will appear.
-Alternatively, these defaults may be modified via the
-.Xr setvbuf 3
-function.
-.Pp
-The
-.Nm
-library is a part of the library
-.Nm libc
-and routines are automatically loaded as needed by the C compiler.
-The
-.Tn SYNOPSIS
-sections of the following manual pages indicate which include files
-are to be used, what the compiler declaration for the function
-looks like and which external variables are of interest.
-.Pp
-The following are defined as macros;
-these names may not be re-used
-without first removing their current definitions with
-.Ic #undef :
-.Dv BUFSIZ ,
-.Dv EOF ,
-.Dv FILENAME_MAX ,
-.Dv FOPEN_MAX ,
-.Dv L_ctermid ,
-.Dv L_cuserid ,
-.Dv L_tmpnam ,
-.Dv NULL ,
-.Dv P_tmpdir ,
-.Dv SEEK_CUR ,
-.Dv SEEK_END ,
-.Dv SEEK_SET ,
-.Dv TMP_MAX ,
-.Dv clearerr ,
-.Dv clearerr_unlocked ,
-.Dv feof ,
-.Dv feof_unlocked ,
-.Dv ferror ,
-.Dv ferror_unlocked ,
-.Dv fileno ,
-.Dv fileno_unlocked ,
-.Dv fropen ,
-.Dv fwopen ,
-.Dv getc ,
-.Dv getc_unlocked ,
-.Dv getchar ,
-.Dv getchar_unlocked ,
-.Dv putc ,
-.Dv putc_unlocked ,
-.Dv putchar ,
-.Dv putchar_unlocked ,
-.Dv stderr ,
-.Dv stdin
-and
-.Dv stdout .
-Function versions of the macro functions
-.Dv clearerr ,
-.Dv clearerr_unlocked ,
-.Dv feof ,
-.Dv feof_unlocked ,
-.Dv ferror ,
-.Dv ferror_unlocked ,
-.Dv fileno ,
-.Dv fileno_unlocked ,
-.Dv getc ,
-.Dv getc_unlocked ,
-.Dv getchar ,
-.Dv getchar_unlocked ,
-.Dv putc ,
-.Dv putc_unlocked ,
-.Dv putchar ,
-and
-.Dv putchar_unlocked
-exist and will be used if the macro
-definitions are explicitly removed.
-.Sh LEGACY SYNOPSIS
-The -D_NONSTD_SOURCE flag can be used
-to allow stdin, stdout, and/or stderr
-to be evaluated at compile/link time, as:
-.Bd -literal -offset indent
-#include <stdio.h>
-
-static FILE *var = stdout;
-.Ed
-.Sh SEE ALSO
-.Xr close 2 ,
-.Xr open 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Nm
-library conforms to
-.St -isoC-99 .
-.Sh LIST OF FUNCTIONS
-.Bl -column "Description"
-.It Sy "Function       Description"
-.It "asprintf  formatted output conversion"
-.It ""
-.It "clearerr  check and reset stream status"
-.It ""
-.It "fclose    close a stream"
-.It "fdopen    stream open functions"
-.It "feof      check and reset stream status"
-.It "ferror    check and reset stream status"
-.It "fflush    flush a stream"
-.It "fgetc     get next character or word from input stream"
-.It "fgetln    get a line from a stream"
-.It "fgetpos   reposition a stream"
-.It "fgets     get a line from a stream"
-.It "fgetwc    get next wide character from input stream"
-.It "fgetws    get a line of wide characters from a stream"
-.It "fileno    check and reset stream status"
-.It "fopen     stream open functions"
-.It "fprintf   formatted output conversion"
-.It "fpurge    flush a stream"
-.It "fputc     output a character or word to a stream"
-.It "fputs     output a line to a stream"
-.It "fputwc    output a wide character to a stream"
-.It "fputws    output a line of wide characters to a stream"
-.It "fread     binary stream input/output"
-.It "freopen   stream open functions"
-.It "fropen    open a stream"
-.It "fscanf    input format conversion"
-.It "fseek     reposition a stream"
-.It "fsetpos   reposition a stream"
-.It "ftell     reposition a stream"
-.It "funopen   open a stream"
-.It "fwide     set/get orientation of stream"
-.It "fwopen    open a stream"
-.It "fwprintf  formatted wide character output conversion"
-.It "fwrite    binary stream input/output"
-.It ""
-.It "getc      get next character or word from input stream"
-.It "getchar   get next character or word from input stream"
-.It "getdelim  get a line from a stream"
-.It "getline   get a line from a stream"
-.It "gets      get a line from a stream"
-.It "getw      get next character or word from input stream"
-.It "getwc     get next wide character from input stream"
-.It "getwchar  get next wide character from input stream"
-.It ""
-.It "mkdtemp   create unique temporary directory"
-.It "mkstemp   create unique temporary file"
-.It "mktemp    create unique temporary file"
-.It ""
-.It "perror    system error messages"
-.It "printf    formatted output conversion"
-.It "putc      output a character or word to a stream"
-.It "putchar   output a character or word to a stream"
-.It "puts      output a line to a stream"
-.It "putw      output a character or word to a stream"
-.It "putwc     output a wide character to a stream"
-.It "putwchar  output a wide character to a stream"
-.It ""
-.It "remove    remove directory entry"
-.It "rewind    reposition a stream"
-.It ""
-.It "scanf     input format conversion"
-.It "setbuf    stream buffering operations"
-.It "setbuffer stream buffering operations"
-.It "setlinebuf        stream buffering operations"
-.It "setvbuf   stream buffering operations"
-.It "snprintf  formatted output conversion"
-.It "sprintf   formatted output conversion"
-.It "sscanf    input format conversion"
-.It "strerror  system error messages"
-.It "swprintf  formatted wide character output conversion"
-.It "sys_errlist       system error messages"
-.It "sys_nerr  system error messages"
-.It ""
-.It "tempnam   temporary file routines"
-.It "tmpfile   temporary file routines"
-.It "tmpnam    temporary file routines"
-.It ""
-.It "ungetc    un-get character from input stream"
-.It "ungetwc   un-get wide character from input stream"
-.It ""
-.It "vasprintf formatted output conversion"
-.It "vfprintf  formatted output conversion"
-.It "vfscanf   input format conversion"
-.It "vfwprintf formatted wide character output conversion"
-.It "vprintf   formatted output conversion"
-.It "vscanf    input format conversion"
-.It "vsnprintf formatted output conversion"
-.It "vsprintf  formatted output conversion"
-.It "vsscanf   input format conversion"
-.It "vswprintf formatted wide character output conversion"
-.It "vwprintf  formatted wide character output conversion"
-.It ""
-.It "wprintf   formatted wide character output conversion"
-.El
-.Sh BUGS
-The standard buffered functions do not interact well with certain other
-library and system functions, especially
-.Xr vfork 2 .
diff --git a/stdio/swprintf-fbsd.c b/stdio/swprintf-fbsd.c
deleted file mode 100644 (file)
index 698b6c8..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/swprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vswprintf_l(s, n, __current_locale(), fmt, ap);
-       va_end(ap);
-
-       return (ret);
-}
-
-int
-swprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
-    const wchar_t * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vswprintf_l will */
-       va_start(ap, fmt);
-       ret = vswprintf_l(s, n, loc, fmt, ap);
-       va_end(ap);
-
-       return (ret);
-}
diff --git a/stdio/swscanf-fbsd.c b/stdio/swscanf-fbsd.c
deleted file mode 100644 (file)
index 4fc850a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/swscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-swscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, ...)
-{
-       va_list ap;
-       int r;
-
-       va_start(ap, fmt);
-       r = vswscanf_l(str, __current_locale(), fmt, ap);
-       va_end(ap);
-
-       return (r);
-}
-
-int
-swscanf_l(const wchar_t * __restrict str, locale_t loc,
-    const wchar_t * __restrict fmt, ...)
-{
-       va_list ap;
-       int r;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vswscanf_l will */
-       va_start(ap, fmt);
-       r = vswscanf_l(str, loc, fmt, ap);
-       va_end(ap);
-
-       return (r);
-}
diff --git a/stdio/tempnam-fbsd.c b/stdio/tempnam-fbsd.c
deleted file mode 100644 (file)
index adc2adf..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tempnam.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/tempnam.c,v 1.11 2007/01/09 00:28:07 imp Exp $");
-
-#include <sys/param.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <paths.h>
-
-__warn_references(tempnam,
-    "warning: tempnam() possibly used unsafely; consider using mkstemp()");
-
-extern char *_mktemp(char *);
-
-char *
-tempnam(dir, pfx)
-       const char *dir, *pfx;
-{
-       int sverrno;
-       char *f, *name;
-
-       if (!(name = malloc(MAXPATHLEN))) {
-               return(NULL);
-       }
-
-       if (!pfx)
-               pfx = "tmp.";
-
-#if !__DARWIN_UNIX03
-       if (issetugid() == 0 && (f = getenv("TMPDIR"))) {
-               (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
-                   *(f + strlen(f) - 1) == '/'? "": "/", pfx);
-               if ((f = _mktemp(name))) {
-                       return(f);
-               }
-       }
-#endif /* !__DARWIN_UNIX03 */
-       if ((f = (char *)dir)) {
-#if __DARWIN_UNIX03
-           if (access(dir, W_OK) == 0) {
-#endif /* __DARWIN_UNIX03 */
-               (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
-                   *(f + strlen(f) - 1) == '/'? "": "/", pfx);
-               if ((f = _mktemp(name))) {
-                       return(f);
-               }
-#if __DARWIN_UNIX03
-           }
-#endif /* __DARWIN_UNIX03 */
-       }
-
-       f = P_tmpdir;
-#if __DARWIN_UNIX03
-       if (access(f, W_OK) == 0) {     /* directory accessible? */
-#endif /* __DARWIN_UNIX03 */
-       (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
-       if ((f = _mktemp(name))) {
-               return(f);
-       }
-
-#if __DARWIN_UNIX03
-       }
-       if (issetugid() == 0 && (f = getenv("TMPDIR")) && access(f, W_OK) == 0) {
-               (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
-                   *(f + strlen(f) - 1) == '/'? "": "/", pfx);
-               if ((f = _mktemp(name))) {
-                       return(f);
-               }
-       }
-#endif /* __DARWIN_UNIX03 */
-       f = _PATH_TMP;
-       (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
-       if ((f = _mktemp(name))) {
-               return(f);
-       }
-
-       sverrno = errno;
-       free(name);
-       errno = sverrno;
-       return(NULL);
-}
diff --git a/stdio/tmpfile-fbsd.c b/stdio/tmpfile-fbsd.c
deleted file mode 120000 (symlink)
index 771e10e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./tmpfile.c
\ No newline at end of file
diff --git a/stdio/tmpnam-fbsd.c b/stdio/tmpnam-fbsd.c
deleted file mode 100644 (file)
index 6dad888..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tmpnam.c   8.3 (Berkeley) 3/28/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/tmpnam.c,v 1.6 2007/01/09 00:28:07 imp Exp $");
-
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <stdlib.h>
-
-__warn_references(tmpnam,
-    "warning: tmpnam() possibly used unsafely; consider using mkstemp()");
-
-extern char *_mktemp(char *);
-
-static char *tmpnam_buf = NULL;
-static pthread_once_t tmpnam_buf_control = PTHREAD_ONCE_INIT;
-
-static void tmpnam_buf_allocate(void)
-{
-       tmpnam_buf = malloc(L_tmpnam);
-}
-
-char *
-tmpnam(s)
-       char *s;
-{
-       static u_long tmpcount;
-
-       if (s == NULL) {
-               if (pthread_once(&tmpnam_buf_control, tmpnam_buf_allocate)
-                       || !tmpnam_buf) {
-                       return NULL;
-               }
-               s = tmpnam_buf;
-       }
-       (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXX", P_tmpdir, tmpcount);
-       ++tmpcount;
-       return (_mktemp(s));
-}
diff --git a/stdio/tmpnam.3 b/stdio/tmpnam.3
deleted file mode 100644 (file)
index 5f377d9..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-.\" Copyright (c) 1988, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)tmpnam.3   8.2 (Berkeley) 11/17/93
-.\" $FreeBSD: src/lib/libc/stdio/tmpnam.3,v 1.20 2007/03/16 21:46:24 maxim Exp $
-.\"
-.Dd November 12, 2008
-.Dt TMPFILE 3
-.Os
-.Sh NAME
-.Nm tempnam ,
-.Nm tmpfile ,
-.Nm tmpnam
-.Nd temporary file routines
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft FILE *
-.Fo tmpfile
-.Fa "void"
-.Fc
-.Ft char *
-.Fo tmpnam
-.Fa "char *s"
-.Fc
-.Ft char *
-.Fo tempnam
-.Fa "const char *dir"
-.Fa "const char *pfx"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn tmpfile
-function
-returns a pointer to a stream associated with a file descriptor returned
-by the routine
-.Xr mkstemp 3 .
-The created file is unlinked before
-.Fn tmpfile
-returns, causing the file to be automatically deleted when the last
-reference to it is closed.
-The file is opened with the access value
-.Ql w+ .
-If the environment variable
-.Ev TMPDIR
-is defined,
-the file is created in the specified directory.
-The default location, if
-.Ev TMPDIR
-is not set, is
-.Pa /tmp .
-.Pp
-The
-.Fn tmpnam
-function
-returns a pointer to a file name, in the
-.Dv P_tmpdir
-directory, which
-did not reference an existing file at some indeterminate point in the
-past.
-.Dv P_tmpdir
-is defined in the include file
-.In stdio.h .
-If the argument
-.Fa s
-is
-.Pf non- Dv NULL ,
-the file name is copied to the buffer it references.
-Otherwise, the file name is copied to a static buffer.
-In either case,
-.Fn tmpnam
-returns a pointer to the file name.
-.Pp
-The buffer referenced by
-.Fa s
-is expected to be at least
-.Dv L_tmpnam
-bytes in length.
-.Dv L_tmpnam
-is defined in the include file
-.In stdio.h .
-.Pp
-The
-.Fn tempnam
-function
-is similar to
-.Fn tmpnam ,
-but provides the ability to specify the directory which will
-contain the temporary file and the file name prefix.
-.Pp
-The argument
-.Fa dir
-(if
-.Pf non- Dv NULL ) ,
-the directory
-.Dv P_tmpdir ,
-the environment variable
-.Ev TMPDIR
-(if set),
-the directory
-.Pa /tmp
-and finally, the current directory,
-are tried, in the listed order, as directories in which to store the
-temporary file.
-.Pp
-The argument
-.Fa pfx ,
-if
-.Pf non- Dv NULL ,
-is used to specify a file name prefix, which will be the
-first part of the created file name.
-The
-.Fn tempnam
-function
-allocates memory in which to store the file name; the returned pointer
-may be used as a subsequent argument to
-.Xr free 3 .
-.Sh RETURN VALUES
-The
-.Fn tmpfile
-function
-returns a pointer to an open file stream on success, and a
-.Dv NULL
-pointer
-on error.
-.Pp
-The
-.Fn tmpnam
-and
-.Fn tempfile
-functions
-return a pointer to a file name on success, and a
-.Dv NULL
-pointer
-on error.
-.Sh ENVIRONMENT
-.Bl -tag -width Ds
-.It Ev TMPDIR
-.Pf [ Fn tempnam
-only]
-If set,
-the directory in which the temporary file is stored.
-.Ev TMPDIR
-is ignored for processes
-for which
-.Xr issetugid 2
-is true.
-.El
-.Sh COMPATIBILITY
-These interfaces are provided from System V and
-.Tn ANSI
-compatibility only.
-.Pp
-Most historic implementations of these functions provide
-only a limited number of possible temporary file names
-(usually 26)
-before file names will start being recycled.
-System V implementations of these functions
-(and of
-.Xr mktemp 3 )
-use the
-.Xr access 2
-system call to determine whether or not the temporary file
-may be created.
-This has obvious ramifications for setuid or setgid programs,
-complicating the portable use of these interfaces in such programs.
-.Pp
-The
-.Fn tmpfile
-interface should not be used in software expected to be used on other systems
-if there is any possibility that the user does not wish the temporary file to
-be publicly readable and writable.
-.Sh ERRORS
-The
-.Fn tmpfile
-function
-may fail and set the global variable
-.Va errno
-for any of the errors specified for the library functions
-.Xr fdopen 3
-or
-.Xr mkstemp 3 .
-.Pp
-The
-.Fn tmpnam
-function
-may fail and set
-.Va errno
-for any of the errors specified for the library function
-.Xr mktemp 3 .
-.Pp
-The
-.Fn tempnam
-function
-may fail and set
-.Va errno
-for any of the errors specified for the library functions
-.Xr malloc 3
-or
-.Xr mktemp 3 .
-.Sh SECURITY CONSIDERATIONS
-The
-.Fn tmpnam
-and
-.Fn tempnam
-functions are susceptible to a race condition
-occurring between the selection of the file name
-and the creation of the file,
-which allows malicious users
-to potentially overwrite arbitrary files in the system,
-depending on the level of privilege of the running program.
-Additionally, there is no means by which
-file permissions may be specified.
-It is strongly suggested that
-.Xr mkstemp 3
-be used in place of these functions.
-(See
-the FSA.)
-.Sh LEGACY DESCRIPTION
-In legacy mode, the order directories are tried by the
-.Fn tempnam
-function is different; the environment variable
-.Ev TMPDIR
-(if defined) is used first.
-.Sh SEE ALSO
-.Xr mkstemp 3 ,
-.Xr mktemp 3
-.Sh STANDARDS
-The
-.Fn tmpfile
-and
-.Fn tmpnam
-functions
-conform to
-.St -isoC .
diff --git a/stdio/ungetc-fbsd.c b/stdio/ungetc-fbsd.c
deleted file mode 120000 (symlink)
index 3680701..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ungetc.c
\ No newline at end of file
diff --git a/stdio/ungetc.3 b/stdio/ungetc.3
deleted file mode 100644 (file)
index 169a02b..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ungetc.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/ungetc.3,v 1.14 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt UNGETC 3
-.Os
-.Sh NAME
-.Nm ungetc
-.Nd un-get character from input stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fo ungetc
-.Fa "int c"
-.Fa "FILE *stream"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn ungetc
-function pushes the character
-.Fa c
-(converted to an unsigned char)
-back onto the input stream pointed to by
-.Fa stream .
-The pushed-back characters will be returned (in reverse order)
-by subsequent reads on the stream.
-A successful intervening call
-to one of the file positioning functions
-.Xr ( fseek 3 ,
-.Xr fsetpos 3 ,
-or
-.Xr rewind 3 ) ,
-using the same stream,
-will discard the pushed-back characters.
-.Pp
-Only one character of push-back is guaranteed,
-but as long as there is sufficient memory,
-an effectively infinite amount of push-back is allowed.
-.Pp
-If a character is successfully pushed-back,
-the end-of-file indicator for the stream is cleared.
-The file-position indicator is decremented
-by each successful call to
-.Fn ungetc ;
-if its value was 0 before a call, its value is unspecified after
-the call.
-.Sh RETURN VALUES
-The
-.Fn ungetc
-function returns the character pushed-back after the conversion,
-or
-.Dv EOF
-if the operation fails.
-If the value of the argument
-.Fa c
-character equals
-.Dv EOF ,
-the operation will fail and the stream will remain unchanged.
-.Sh SEE ALSO
-.Xr fseek 3 ,
-.Xr getc 3 ,
-.Xr setvbuf 3 ,
-.Xr ungetwc 3
-.Sh STANDARDS
-The
-.Fn ungetc
-function conforms to
-.St -isoC .
diff --git a/stdio/ungetwc-fbsd.c b/stdio/ungetwc-fbsd.c
deleted file mode 100644 (file)
index 37e6402..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * Copyright (c) 2002-2004 Tim J. Robbins.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/ungetwc.c,v 1.11 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-#include "mblocal.h"
-
-/*
- * Non-MT-safe version.
- */
-wint_t
-__ungetwc(wint_t wc, FILE *fp, locale_t loc)
-{
-       char buf[MB_LEN_MAX];
-       size_t len;
-
-       if (wc == WEOF)
-               return (WEOF);
-       if ((len = loc->__lc_ctype->__wcrtomb(buf, wc, &fp->_mbstate, loc)) == (size_t)-1) {
-               fp->_flags |= __SERR;
-               return (WEOF);
-       }
-       while (len-- != 0)
-               if (__ungetc((unsigned char)buf[len], fp) == EOF)
-                       return (WEOF);
-
-       return (wc);
-}
-
-/*
- * MT-safe version.
- */
-wint_t
-ungetwc(wint_t wc, FILE *fp)
-{
-       wint_t r;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       r = __ungetwc(wc, fp, __current_locale());
-       FUNLOCKFILE(fp);
-
-       return (r);
-}
-
-wint_t
-ungetwc_l(wint_t wc, FILE *fp, locale_t loc)
-{
-       wint_t r;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       r = __ungetwc(wc, fp, loc);
-       FUNLOCKFILE(fp);
-
-       return (r);
-}
diff --git a/stdio/ungetwc.3 b/stdio/ungetwc.3
deleted file mode 100644 (file)
index 726ec65..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-.\"    $NetBSD: ungetwc.3,v 1.3 2002/02/07 07:00:27 ross Exp $
-.\"
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ungetc.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/ungetwc.3,v 1.6 2007/01/09 00:28:07 imp Exp $
-.\"
-.Dd March 3, 2004
-.Dt UNGETWC 3
-.Os
-.Sh NAME
-.Nm ungetwc ,
-.Nm ungetwc_l
-.Nd un-get wide character from input stream
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft wint_t
-.Fo ungetwc
-.Fa "wint_t wc"
-.Fa "FILE *stream"
-.Fc
-.In stdio.h
-.In wchar.h
-.In xlocale.h
-.Ft wint_t
-.Fo ungetwc_l
-.Fa "wint_t wc"
-.Fa "FILE *stream"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn ungetwc
-function pushes the wide character
-.Fa wc
-(converted to an
-.Vt wchar_t )
-back onto the input stream pointed to by
-.Fa stream .
-The pushed-backed wide characters will be returned (in reverse order)
-by subsequent reads on the stream.
-A successful intervening call to one of the file
-positioning functions
-.Xr fseek 3 ,
-.Xr fsetpos 3 ,
-or
-.Xr rewind 3 ,
-using the same stream,
-will discard the pushed-back wide characters.
-.Pp
-Only one wide character of push-back is guaranteed,
-but as long as there is sufficient memory,
-an effectively infinite amount of push-back is allowed.
-.Pp
-If a character is successfully pushed-back,
-the end-of-file indicator for the stream is cleared.
-.Pp
-Although the
-.Fn ungetwc
-function uses the current locale, the
-.Fn ungetwc_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn ungetwc
-function
-returns
-the wide character pushed-back after the conversion, or
-.Dv WEOF
-if the operation fails.
-If the value of the argument
-.Fa c
-character equals
-.Dv WEOF ,
-the operation will fail and the stream will remain unchanged.
-.Sh SEE ALSO
-.Xr fseek 3 ,
-.Xr getwc 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn ungetwc
-function conforms to
-.St -isoC-99 .
diff --git a/stdio/vasprintf-fbsd.c b/stdio/vasprintf-fbsd.c
deleted file mode 100644 (file)
index d872a9e..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*     $OpenBSD: vasprintf.c,v 1.4 1998/06/21 22:13:47 millert Exp $   */
-
-/*
- * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.19 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "local.h"
-
-int
-vasprintf_l(str, loc, fmt, ap)
-       char **str;
-       locale_t loc;
-       const char *fmt;
-       __va_list ap;
-{
-       int ret;
-       FILE f;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-       
-       NORMALIZE_LOCALE(loc);
-       f._file = -1;
-       f._flags = __SWR | __SSTR | __SALC;
-       f._bf._base = f._p = (unsigned char *)malloc(128);
-       if (f._bf._base == NULL) {
-               *str = NULL;
-               errno = ENOMEM;
-               return (-1);
-       }
-       f._bf._size = f._w = 127;               /* Leave room for the NUL */
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, loc, fmt, ap);
-       if (ret < 0) {
-               free(f._bf._base);
-               *str = NULL;
-               errno = ENOMEM;
-               return (-1);
-       }
-       *f._p = '\0';
-       *str = (char *)f._bf._base;
-       return (ret);
-}
-
-int
-vasprintf(str, fmt, ap)
-       char **str;
-       const char *fmt;
-       __va_list ap;
-{
-       return vasprintf_l(str, __current_locale(), fmt, ap);
-}
diff --git a/stdio/vdprintf-fbsd.c b/stdio/vdprintf-fbsd.c
deleted file mode 100644 (file)
index 5625bd6..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.1 2009/03/04 03:38:51 das Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include "un-namespace.h"
-
-#include "local.h"
-
-int
-vdprintf_l(int fd, locale_t loc, const char * __restrict fmt, va_list ap)
-{
-       FILE f;
-       unsigned char buf[BUFSIZ];
-       int ret;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-
-       NORMALIZE_LOCALE(loc);
-
-       if (fd > SHRT_MAX) {
-               errno = EMFILE;
-               return (EOF);
-       }
-
-       f._p = buf;
-       f._w = sizeof(buf);
-       f._flags = __SWR;
-       f._file = fd;
-       f._cookie = &f;
-       f._write = __swrite;
-       f._bf._base = buf;
-       f._bf._size = sizeof(buf);
-       f._orientation = 0;
-       bzero(&f._mbstate, sizeof(f._mbstate));
-
-       if ((ret = __vfprintf(&f, loc, fmt, ap)) < 0)
-               return (ret);
-
-       return (__fflush(&f) ? EOF : ret);
-}
-
-int
-vdprintf(int fd, const char * __restrict fmt, va_list ap) {
-       return vdprintf_l(fd, __current_locale(), fmt, ap);
-}
diff --git a/stdio/vfprintf-fbsd.c b/stdio/vfprintf-fbsd.c
deleted file mode 100644 (file)
index 3182836..0000000
+++ /dev/null
@@ -1,1419 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.90 2009/02/28 06:06:57 das Exp $");
-
-#include "xlocale_private.h"
-
-/*
- * Actual printf innards.
- *
- * This code is large and complicated...
- */
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <limits.h>
-#include <locale.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#if 0 // xprintf pending API review
-#include <printf.h>
-#endif
-#include <errno.h>
-
-#include <stdarg.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "local.h"
-#include "fvwrite.h"
-#include "printflocal.h"
-
-static int     __sprint(FILE *, locale_t, struct __suio *);
-static int     __sbprintf(FILE *, locale_t, const char *, va_list) __printflike(3, 0);
-static char    *__wcsconv(wchar_t *, int, locale_t);
-
-__private_extern__ const char *__fix_nogrouping(const char *);
-
-#define        CHAR    char
-#include "printfcommon.h"
-
-struct grouping_state {
-       char *thousands_sep;    /* locale-specific thousands separator */
-       int thousep_len;        /* length of thousands_sep */
-       const char *grouping;   /* locale-specific numeric grouping rules */
-       int lead;               /* sig figs before decimal or group sep */
-       int nseps;              /* number of group separators with ' */
-       int nrepeats;           /* number of repeats of the last group */
-};
-
-/*
- * Initialize the thousands' grouping state in preparation to print a
- * number with ndigits digits. This routine returns the total number
- * of bytes that will be needed.
- */
-static int
-grouping_init(struct grouping_state *gs, int ndigits, locale_t loc)
-{
-       struct lconv *locale;
-
-       locale = localeconv_l(loc);
-       gs->grouping = __fix_nogrouping(locale->grouping);
-       gs->thousands_sep = locale->thousands_sep;
-       gs->thousep_len = strlen(gs->thousands_sep);
-
-       gs->nseps = gs->nrepeats = 0;
-       gs->lead = ndigits;
-       while (*gs->grouping != CHAR_MAX) {
-               if (gs->lead <= *gs->grouping)
-                       break;
-               gs->lead -= *gs->grouping;
-               if (*(gs->grouping+1)) {
-                       gs->nseps++;
-                       gs->grouping++;
-               } else
-                       gs->nrepeats++;
-       }
-       return ((gs->nseps + gs->nrepeats) * gs->thousep_len);
-}
-
-/*
- * Print a number with thousands' separators.
- */
-static int
-grouping_print(struct grouping_state *gs, struct io_state *iop,
-              const CHAR *cp, const CHAR *ep, locale_t loc)
-{
-       const CHAR *cp0 = cp;
-
-       if (io_printandpad(iop, cp, ep, gs->lead, zeroes, loc))
-               return (-1);
-       cp += gs->lead;
-       while (gs->nseps > 0 || gs->nrepeats > 0) {
-               if (gs->nrepeats > 0)
-                       gs->nrepeats--;
-               else {
-                       gs->grouping--;
-                       gs->nseps--;
-               }
-               if (io_print(iop, gs->thousands_sep, gs->thousep_len, loc))
-                       return (-1);
-               if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, loc))
-                       return (-1);
-               cp += *gs->grouping;
-       }
-       if (cp > ep)
-               cp = ep;
-       return (cp - cp0);
-}
-
-/*
- * Flush out all the vectors defined by the given uio,
- * then reset it so that it can be reused.
- */
-static int
-__sprint(FILE *fp, locale_t loc __unused, struct __suio *uio)
-{
-       int err;
-
-       if (uio->uio_resid == 0) {
-               uio->uio_iovcnt = 0;
-               return (0);
-       }
-       err = __sfvwrite(fp, uio);
-       uio->uio_resid = 0;
-       uio->uio_iovcnt = 0;
-       return (err);
-}
-
-/*
- * Helper function for `fprintf to unbuffered unix file': creates a
- * temporary buffer.  We only work on write-only files; this avoids
- * worries about ungetc buffers and so forth.
- */
-static int
-__sbprintf(FILE *fp, locale_t loc, const char *fmt, va_list ap)
-{
-       int ret;
-       FILE fake;
-       unsigned char buf[BUFSIZ];
-       struct __sFILEX ext;
-       fake._extra = &ext;
-       INITEXTRA(&fake);
-
-       /* XXX This is probably not needed. */
-       if (prepwrite(fp) != 0)
-               return (EOF);
-
-       /* copy the important variables */
-       fake._flags = fp->_flags & ~__SNBF;
-       fake._file = fp->_file;
-       fake._cookie = fp->_cookie;
-       fake._write = fp->_write;
-       fake._orientation = fp->_orientation;
-       fake._mbstate = fp->_mbstate;
-
-       /* set up the buffer */
-       fake._bf._base = fake._p = buf;
-       fake._bf._size = fake._w = sizeof(buf);
-       fake._lbfsize = 0;      /* not actually used, but Just In Case */
-
-       /* do the work, then copy any error status */
-       ret = __vfprintf(&fake, loc, fmt, ap);
-       if (ret >= 0 && __fflush(&fake))
-               ret = EOF;
-       if (fake._flags & __SERR)
-               fp->_flags |= __SERR;
-       return (ret);
-}
-
-/*
- * Convert a wide character string argument for the %ls format to a multibyte
- * string representation. If not -1, prec specifies the maximum number of
- * bytes to output, and also means that we can't assume that the wide char.
- * string ends is null-terminated.
- */
-static char *
-__wcsconv(wchar_t *wcsarg, int prec, locale_t loc)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       char buf[MB_LEN_MAX];
-       wchar_t *p;
-       char *convbuf;
-       size_t clen, nbytes;
-
-       /* Allocate space for the maximum number of bytes we could output. */
-       if (prec < 0) {
-               p = wcsarg;
-               mbs = initial;
-               nbytes = wcsrtombs_l(NULL, (const wchar_t **)&p, 0, &mbs, loc);
-               if (nbytes == (size_t)-1)
-                       return (NULL);
-       } else {
-               /*
-                * Optimisation: if the output precision is small enough,
-                * just allocate enough memory for the maximum instead of
-                * scanning the string.
-                */
-               if (prec < 128)
-                       nbytes = prec;
-               else {
-                       nbytes = 0;
-                       p = wcsarg;
-                       mbs = initial;
-                       for (;;) {
-                               clen = wcrtomb_l(buf, *p++, &mbs, loc);
-                               if (clen == 0 || clen == (size_t)-1 ||
-                                   nbytes + clen > prec)
-                                       break;
-                               nbytes += clen;
-                       }
-               }
-       }
-       if ((convbuf = malloc(nbytes + 1)) == NULL)
-               return (NULL);
-
-       /* Fill the output buffer. */
-       p = wcsarg;
-       mbs = initial;
-       if ((nbytes = wcsrtombs_l(convbuf, (const wchar_t **)&p,
-           nbytes, &mbs, loc)) == (size_t)-1) {
-               free(convbuf);
-               return (NULL);
-       }
-       convbuf[nbytes] = '\0';
-       return (convbuf);
-}
-
-/*
- * MT-safe version
- */
-int
-vfprintf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt0, va_list ap)
-
-{
-       int ret;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       /* optimise fprintf(stderr) (and other unbuffered Unix files) */
-       if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
-           fp->_file >= 0)
-               ret = __sbprintf(fp, loc, fmt0, ap);
-       else
-               ret = __vfprintf(fp, loc, fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-int
-vfprintf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
-
-{
-       return vfprintf_l(fp, __current_locale(), fmt0, ap);
-}
-
-/*
- * The size of the buffer we use as scratch space for integer
- * conversions, among other things.  We need enough space to
- * write a uintmax_t in octal (plus one byte).
- */
-#if UINTMAX_MAX <= UINT64_MAX
-#define        BUF     32
-#else
-#error "BUF must be large enough to format a uintmax_t"
-#endif
-
-/*
- * Non-MT-safe version
- */
-__private_extern__ int
-__vfprintf(FILE *fp, locale_t loc, const char *fmt0, va_list ap)
-{
-       char *fmt;              /* format string */
-       int ch;                 /* character from fmt */
-       int n, n2;              /* handy integer (short term usage) */
-       char *cp;               /* handy char pointer (short term usage) */
-       int flags;              /* flags as above */
-       int ret;                /* return value accumulator */
-       int width;              /* width from format (%8d), or 0 */
-       int prec;               /* precision from format; <0 for N/A */
-       char sign;              /* sign prefix (' ', '+', '-', or \0) */
-       struct grouping_state gs; /* thousands' grouping info */
-
-#ifndef NO_FLOATING_POINT
-       /*
-        * We can decompose the printed representation of floating
-        * point numbers into several parts, some of which may be empty:
-        *
-        * [+|-| ] [0x|0X] MMM . NNN [e|E|p|P] [+|-] ZZ
-        *    A       B     ---C---      D       E   F
-        *
-        * A:   'sign' holds this value if present; '\0' otherwise
-        * B:   ox[1] holds the 'x' or 'X'; '\0' if not hexadecimal
-        * C:   cp points to the string MMMNNN.  Leading and trailing
-        *      zeros are not in the string and must be added.
-        * D:   expchar holds this character; '\0' if no exponent, e.g. %f
-        * F:   at least two digits for decimal, at least one digit for hex
-        */
-       char *decimal_point;    /* locale specific decimal point */
-       int decpt_len;          /* length of decimal_point */
-       int signflag;           /* true if float is negative */
-       union {                 /* floating point arguments %[aAeEfFgG] */
-               double dbl;
-               long double ldbl;
-       } fparg;
-       int expt;               /* integer value of exponent */
-       char expchar;           /* exponent character: [eEpP\0] */
-       char *dtoaend;          /* pointer to end of converted digits */
-       int expsize;            /* character count for expstr */
-       int ndig;               /* actual number of digits returned by dtoa */
-       char expstr[MAXEXPDIG+2];       /* buffer for exponent string: e+ZZZ */
-       char *dtoaresult;       /* buffer allocated by dtoa */
-#endif
-#ifdef VECTORS
-       union arg vval;         /* Vector argument. */
-       char *pct;              /* Pointer to '%' at beginning of specifier. */
-       char vsep;              /* Vector separator character. */
-#endif
-       u_long  ulval;          /* integer arguments %[diouxX] */
-       uintmax_t ujval;        /* %j, %ll, %q, %t, %z integers */
-       int base;               /* base for [diouxX] conversion */
-       int dprec;              /* a copy of prec if [diouxX], 0 otherwise */
-       int realsz;             /* field size expanded by dprec, sign, etc */
-       int size;               /* size of converted field or string */
-       int prsize;             /* max size of printed field */
-       const char *xdigs;      /* digits for %[xX] conversion */
-       struct io_state io;     /* I/O buffering state */
-       char buf[BUF];          /* buffer with space for digits of uintmax_t */
-       char ox[2];             /* space for 0x; ox[1] is either x, X, or \0 */
-       union arg *argtable;    /* args, built due to positional arg */
-       union arg statargtable [STATIC_ARG_TBL_SIZE];
-       int nextarg;            /* 1-based argument index */
-       va_list orgap;          /* original argument pointer */
-       char *convbuf;          /* wide to multibyte conversion result */
-
-       static const char xdigs_lower[16] = "0123456789abcdef";
-       static const char xdigs_upper[16] = "0123456789ABCDEF";
-
-       /* BEWARE, these `goto error' on error. */
-#define        PRINT(ptr, len) { \
-       if (io_print(&io, (ptr), (len), loc))   \
-               goto error; \
-}
-#define        PAD(howmany, with) { \
-       if (io_pad(&io, (howmany), (with), loc)) \
-               goto error; \
-}
-#define        PRINTANDPAD(p, ep, len, with) { \
-       if (io_printandpad(&io, (p), (ep), (len), (with), loc)) \
-               goto error; \
-}
-#define        FLUSH() { \
-       if (io_flush(&io, loc)) \
-               goto error; \
-}
-
-       /*
-        * Get the argument indexed by nextarg.   If the argument table is
-        * built, use it to get the argument.  If its not, get the next
-        * argument (and arguments must be gotten sequentially).
-        */
-#define GETARG(type) \
-       ((argtable != NULL) ? *((type*)(&argtable[nextarg++])) : \
-           (nextarg++, va_arg(ap, type)))
-
-       /*
-        * To extend shorts properly, we need both signed and unsigned
-        * argument extraction methods.
-        */
-#define        SARG() \
-       (flags&LONGINT ? GETARG(long) : \
-           flags&SHORTINT ? (long)(short)GETARG(int) : \
-           flags&CHARINT ? (long)(signed char)GETARG(int) : \
-           (long)GETARG(int))
-#define        UARG() \
-       (flags&LONGINT ? GETARG(u_long) : \
-           flags&SHORTINT ? (u_long)(u_short)GETARG(int) : \
-           flags&CHARINT ? (u_long)(u_char)GETARG(int) : \
-           (u_long)GETARG(u_int))
-#define        INTMAX_SIZE     (INTMAXT|SIZET|PTRDIFFT|LLONGINT)
-#define SJARG() \
-       (flags&INTMAXT ? GETARG(intmax_t) : \
-           flags&SIZET ? (intmax_t)GETARG(ssize_t) : \
-           flags&PTRDIFFT ? (intmax_t)GETARG(ptrdiff_t) : \
-           (intmax_t)GETARG(long long))
-#define        UJARG() \
-       (flags&INTMAXT ? GETARG(uintmax_t) : \
-           flags&SIZET ? (uintmax_t)GETARG(size_t) : \
-           flags&PTRDIFFT ? (uintmax_t)(unsigned long)GETARG(ptrdiff_t) : \
-           (uintmax_t)GETARG(unsigned long long))
-
-       /*
-        * Get * arguments, including the form *nn$.  Preserve the nextarg
-        * that the argument can be gotten once the type is determined.
-        */
-#define GETASTER(val) \
-       n2 = 0; \
-       cp = fmt; \
-       while (is_digit(*cp)) { \
-               n2 = 10 * n2 + to_digit(*cp); \
-               cp++; \
-       } \
-       if (*cp == '$') { \
-               int hold = nextarg; \
-               if (argtable == NULL) { \
-                       argtable = statargtable; \
-                       if (__find_arguments (fmt0, orgap, &argtable)) { \
-                               ret = EOF; \
-                               goto error; \
-                       } \
-               } \
-               nextarg = n2; \
-               val = GETARG (int); \
-               nextarg = hold; \
-               fmt = ++cp; \
-       } else { \
-               val = GETARG (int); \
-       }
-
-#if 0 // xprintf pending API review
-       if (__use_xprintf == 0 && getenv("USE_XPRINTF"))
-               __use_xprintf = 1;
-       if (__use_xprintf > 0)
-               return (__xvprintf(fp, loc, fmt0, ap));
-#endif
-
-       /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
-       if (prepwrite(fp) != 0) {
-               errno = EBADF;
-               return (EOF);
-       }
-       ORIENT(fp, -1);
-
-       convbuf = NULL;
-       fmt = (char *)fmt0;
-       argtable = NULL;
-       nextarg = 1;
-       va_copy(orgap, ap);
-       io_init(&io, fp);
-       ret = 0;
-#ifndef NO_FLOATING_POINT
-       dtoaresult = NULL;
-       decimal_point = localeconv_l(loc)->decimal_point;
-       /* The overwhelmingly common case is decpt_len == 1. */
-       decpt_len = (decimal_point[1] == '\0' ? 1 : strlen(decimal_point));
-#endif
-
-       /*
-        * Scan the format for conversions (`%' character).
-        */
-       for (;;) {
-               for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++)
-                       /* void */;
-               if ((n = fmt - cp) != 0) {
-                       if ((unsigned)ret + n > INT_MAX) {
-                               ret = EOF;
-                               goto error;
-                       }
-                       PRINT(cp, n);
-                       ret += n;
-               }
-               if (ch == '\0')
-                       goto done;
-#ifdef VECTORS
-               pct = fmt;
-#endif /* VECTORS */
-               fmt++;          /* skip over '%' */
-
-               flags = 0;
-               dprec = 0;
-               width = 0;
-               prec = -1;
-               gs.grouping = NULL;
-               sign = '\0';
-               ox[1] = '\0';
-#ifdef VECTORS
-               vsep = 'X'; /* Illegal value, changed to defaults later. */
-#endif /* VECTORS */
-
-rflag:         ch = *fmt++;
-reswitch:      switch (ch) {
-               case ' ':
-                       /*-
-                        * ``If the space and + flags both appear, the space
-                        * flag will be ignored.''
-                        *      -- ANSI X3J11
-                        */
-                       if (!sign)
-                               sign = ' ';
-                       goto rflag;
-               case '#':
-                       flags |= ALT;
-                       goto rflag;
-#ifdef VECTORS
-               case ',': case ';': case ':': case '_':
-                       vsep = ch;
-                       goto rflag;
-#endif /* VECTORS */
-               case '*':
-                       /*-
-                        * ``A negative field width argument is taken as a
-                        * - flag followed by a positive field width.''
-                        *      -- ANSI X3J11
-                        * They don't exclude field widths read from args.
-                        */
-                       GETASTER (width);
-                       if (width >= 0)
-                               goto rflag;
-                       width = -width;
-                       /* FALLTHROUGH */
-               case '-':
-                       flags |= LADJUST;
-                       goto rflag;
-               case '+':
-                       sign = '+';
-                       goto rflag;
-               case '\'':
-                       flags |= GROUPING;
-                       goto rflag;
-               case '.':
-                       if ((ch = *fmt++) == '*') {
-                               GETASTER (prec);
-                               goto rflag;
-                       }
-                       prec = 0;
-                       while (is_digit(ch)) {
-                               prec = 10 * prec + to_digit(ch);
-                               ch = *fmt++;
-                       }
-                       goto reswitch;
-               case '0':
-                       /*-
-                        * ``Note that 0 is taken as a flag, not as the
-                        * beginning of a field width.''
-                        *      -- ANSI X3J11
-                        */
-                       flags |= ZEROPAD;
-                       goto rflag;
-               case '1': case '2': case '3': case '4':
-               case '5': case '6': case '7': case '8': case '9':
-                       n = 0;
-                       do {
-                               n = 10 * n + to_digit(ch);
-                               ch = *fmt++;
-                       } while (is_digit(ch));
-                       if (ch == '$') {
-                               nextarg = n;
-                               if (argtable == NULL) {
-                                       argtable = statargtable;
-                                       if (__find_arguments (fmt0, orgap,
-                                                             &argtable)) {
-                                               ret = EOF;
-                                               goto error;
-                                       }
-                               }
-                               goto rflag;
-                       }
-                       width = n;
-                       goto reswitch;
-#ifndef NO_FLOATING_POINT
-               case 'L':
-                       flags |= LONGDBL;
-                       goto rflag;
-#endif
-               case 'h':
-                       if (flags & SHORTINT) {
-                               flags &= ~SHORTINT;
-                               flags |= CHARINT;
-                       } else
-                               flags |= SHORTINT;
-                       goto rflag;
-               case 'j':
-                       flags |= INTMAXT;
-                       goto rflag;
-               case 'l':
-                       if (flags & LONGINT) {
-                               flags &= ~LONGINT;
-                               flags |= LLONGINT;
-                       } else
-                               flags |= LONGINT;
-                       goto rflag;
-               case 'q':
-                       flags |= LLONGINT;      /* not necessarily */
-                       goto rflag;
-               case 't':
-                       flags |= PTRDIFFT;
-                       goto rflag;
-               case 'z':
-                       flags |= SIZET;
-                       goto rflag;
-               case 'C':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'c':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & LONGINT) {
-                               static const mbstate_t initial;
-                               mbstate_t mbs;
-                               size_t mbseqlen;
-
-                               mbs = initial;
-                               mbseqlen = wcrtomb_l(cp = buf,
-                                   (wchar_t)GETARG(wint_t), &mbs, loc);
-                               if (mbseqlen == (size_t)-1) {
-                                       fp->_flags |= __SERR;
-                                       goto error;
-                               }
-                               size = (int)mbseqlen;
-                       } else {
-                               *(cp = buf) = GETARG(int);
-                               size = 1;
-                       }
-                       sign = '\0';
-                       break;
-               case 'D':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE) {
-                               ujval = SJARG();
-                               if ((intmax_t)ujval < 0) {
-                                       ujval = -ujval;
-                                       sign = '-';
-                               }
-                       } else {
-                               ulval = SARG();
-                               if ((long)ulval < 0) {
-                                       ulval = -ulval;
-                                       sign = '-';
-                               }
-                       }
-                       base = 10;
-                       goto number;
-#ifndef NO_FLOATING_POINT
-               case 'a':
-               case 'A':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       if (ch == 'a') {
-                               ox[1] = 'x';
-                               xdigs = xdigs_lower;
-                               expchar = 'p';
-                       } else {
-                               ox[1] = 'X';
-                               xdigs = xdigs_upper;
-                               expchar = 'P';
-                       }
-                       if (prec >= 0)
-                               prec++;
-                       if (dtoaresult != NULL)
-                               freedtoa(dtoaresult);
-#ifdef LDBL_COMPAT
-                       fparg.dbl = GETARG(double);
-                       dtoaresult = cp =
-                           __hdtoa(fparg.dbl, xdigs, prec,
-                           &expt, &signflag, &dtoaend);
-#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult = cp =
-                                   __hldtoa(fparg.ldbl, xdigs, prec,
-                                   &expt, &signflag, &dtoaend);
-                       } else {
-                               fparg.dbl = GETARG(double);
-                               dtoaresult = cp =
-                                   __hdtoa(fparg.dbl, xdigs, prec,
-                                   &expt, &signflag, &dtoaend);
-                       }
-#endif /* LDBL_COMPAT */
-                       if (prec < 0)
-                               prec = dtoaend - cp;
-                       if (expt == INT_MAX)
-                               ox[1] = '\0';
-                       goto fp_common;
-               case 'e':
-               case 'E':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       expchar = ch;
-                       if (prec < 0)   /* account for digit before decpt */
-                               prec = DEFPREC + 1;
-                       else
-                               prec++;
-                       goto fp_begin;
-               case 'f':
-               case 'F':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       expchar = '\0';
-                       goto fp_begin;
-               case 'g':
-               case 'G':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       expchar = ch - ('g' - 'e');
-                       if (prec == 0)
-                               prec = 1;
-fp_begin:
-                       if (prec < 0)
-                               prec = DEFPREC;
-                       if (dtoaresult != NULL)
-                               freedtoa(dtoaresult);
-#ifdef LDBL_COMPAT
-                       fparg.dbl = GETARG(double);
-                       dtoaresult = cp =
-                           dtoa(fparg.dbl, expchar ? 2 : 3, prec,
-                           &expt, &signflag, &dtoaend);
-                       if (expt == 9999)
-                               expt = INT_MAX;
-#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult = cp =
-                                   __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec,
-                                   &expt, &signflag, &dtoaend);
-                       } else {
-                               fparg.dbl = GETARG(double);
-                               dtoaresult = cp =
-                                   dtoa(fparg.dbl, expchar ? 2 : 3, prec,
-                                   &expt, &signflag, &dtoaend);
-                               if (expt == 9999)
-                                       expt = INT_MAX;
-                       }
-#endif /* LDBL_COMPAT */
-fp_common:
-                       if (signflag)
-                               sign = '-';
-                       if (expt == INT_MAX) {  /* inf or nan */
-                               if (*cp == 'N') {
-                                       cp = (ch >= 'a') ? "nan" : "NAN";
-                                       sign = '\0';
-                               } else
-                                       cp = (ch >= 'a') ? "inf" : "INF";
-                               size = 3;
-                               flags &= ~ZEROPAD;
-                               break;
-                       }
-                       flags |= FPT;
-                       ndig = dtoaend - cp;
-                       if (ch == 'g' || ch == 'G') {
-                               if (expt > -4 && expt <= prec) {
-                                       /* Make %[gG] smell like %[fF] */
-                                       expchar = '\0';
-                                       if (flags & ALT)
-                                               prec -= expt;
-                                       else
-                                               prec = ndig - expt;
-                                       if (prec < 0)
-                                               prec = 0;
-                               } else {
-                                       /*
-                                        * Make %[gG] smell like %[eE], but
-                                        * trim trailing zeroes if no # flag.
-                                        */
-                                       if (!(flags & ALT))
-                                               prec = ndig;
-                               }
-                       }
-                       if (expchar) {
-                               expsize = exponent(expstr, expt - 1, expchar);
-                               size = expsize + prec;
-                               if (prec > 1 || flags & ALT)
-                                       size += decpt_len;
-                       } else {
-                               /* space for digits before decimal point */
-                               if (expt > 0)
-                                       size = expt;
-                               else    /* "0" */
-                                       size = 1;
-                               /* space for decimal pt and following digits */
-                               if (prec || flags & ALT)
-                                       size += prec + decpt_len;
-                               if ((flags & GROUPING) && expt > 0)
-                                       size += grouping_init(&gs, expt, loc);
-                       }
-                       break;
-#endif /* !NO_FLOATING_POINT */
-               case 'n':
-               {
-                       /*
-                        * Assignment-like behavior is specified if the
-                        * value overflows or is otherwise unrepresentable.
-                        * C99 says to use `signed char' for %hhn conversions.
-                        */
-                       void *ptr = GETARG(void *);
-                       if (ptr == NULL)
-                               continue;
-                       else if (flags & LLONGINT)
-                               *(long long *)ptr = ret;
-                       else if (flags & SIZET)
-                               *(ssize_t *)ptr = (ssize_t)ret;
-                       else if (flags & PTRDIFFT)
-                               *(ptrdiff_t *)ptr = ret;
-                       else if (flags & INTMAXT)
-                               *(intmax_t *)ptr = ret;
-                       else if (flags & LONGINT)
-                               *(long *)ptr = ret;
-                       else if (flags & SHORTINT)
-                               *(short *)ptr = ret;
-                       else if (flags & CHARINT)
-                               *(signed char *)ptr = ret;
-                       else
-                               *(int *)ptr = ret;
-                       continue;       /* no output */
-               }
-               case 'O':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-                               ulval = UARG();
-                       base = 8;
-                       goto nosign;
-               case 'p':
-                       /*-
-                        * ``The argument shall be a pointer to void.  The
-                        * value of the pointer is converted to a sequence
-                        * of printable characters, in an implementation-
-                        * defined manner.''
-                        *      -- ANSI X3J11
-                        */
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       ujval = (uintmax_t)(uintptr_t)GETARG(void *);
-                       base = 16;
-                       xdigs = xdigs_lower;
-                       flags = flags | INTMAXT;
-                       ox[1] = 'x';
-                       goto nosign;
-               case 'S':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 's':
-                       if (flags & LONGINT) {
-                               wchar_t *wcp;
-
-                               if (convbuf != NULL)
-                                       free(convbuf);
-                               if ((wcp = GETARG(wchar_t *)) == NULL)
-                                       cp = "(null)";
-                               else {
-                                       convbuf = __wcsconv(wcp, prec, loc);
-                                       if (convbuf == NULL) {
-                                               fp->_flags |= __SERR;
-                                               goto error;
-                                       }
-                                       cp = convbuf;
-                               }
-                       } else if ((cp = GETARG(char *)) == NULL)
-                               cp = "(null)";
-                       size = (prec >= 0) ? strnlen(cp, prec) : strlen(cp);
-                       sign = '\0';
-                       break;
-               case 'U':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'u':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-                               ulval = UARG();
-                       base = 10;
-                       goto nosign;
-               case 'X':
-                       xdigs = xdigs_upper;
-                       goto hex;
-               case 'x':
-                       xdigs = xdigs_lower;
-hex:
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-                               ulval = UARG();
-                       base = 16;
-                       /* leading 0x/X only if non-zero */
-                       if (flags & ALT &&
-                           (flags & INTMAX_SIZE ? ujval != 0 : ulval != 0))
-                               ox[1] = ch;
-
-                       flags &= ~GROUPING;
-                       /* unsigned conversions */
-nosign:                        sign = '\0';
-                       /*-
-                        * ``... diouXx conversions ... if a precision is
-                        * specified, the 0 flag will be ignored.''
-                        *      -- ANSI X3J11
-                        * except for %#.0o and zero value
-                        */
-number:                        if ((dprec = prec) >= 0)
-                               flags &= ~ZEROPAD;
-
-                       /*-
-                        * ``The result of converting a zero value with an
-                        * explicit precision of zero is no characters.''
-                        *      -- ANSI X3J11
-                        *
-                        * ``The C Standard is clear enough as is.  The call
-                        * printf("%#.0o", 0) should print 0.''
-                        *      -- Defect Report #151
-                        */
-                       cp = buf + BUF;
-                       if (flags & INTMAX_SIZE) {
-                               if (ujval != 0 || prec != 0 ||
-                                   (flags & ALT && base == 8))
-                                       cp = __ujtoa(ujval, cp, base,
-                                           flags & ALT, xdigs);
-                       } else {
-                               if (ulval != 0 || prec != 0 ||
-                                   (flags & ALT && base == 8))
-                                       cp = __ultoa(ulval, cp, base,
-                                           flags & ALT, xdigs);
-                       }
-                       size = buf + BUF - cp;
-                       if (size > BUF) /* should never happen */
-                               LIBC_ABORT("size (%d) > BUF (%d)", size, BUF);
-                       if ((flags & GROUPING) && size != 0)
-                               size += grouping_init(&gs, size, loc);
-                       break;
-#ifdef VECTORS
-               case 'v':
-                       flags |= VECTOR;
-                       goto rflag;
-#endif /* VECTORS */
-               default:        /* "%?" prints ?, unless ? is NUL */
-                       if (ch == '\0')
-                               goto done;
-                       /* pretend it was %c with argument ch */
-                       cp = buf;
-                       *cp = ch;
-                       size = 1;
-                       sign = '\0';
-                       break;
-               }
-
-#ifdef VECTORS
-               if (flags & VECTOR) {
-                       /*
-                        * Do the minimum amount of work necessary to construct
-                        * a format specifier that can be used to recursively
-                        * call vfprintf() for each element in the vector.
-                        */
-                       int i, j;       /* Counter. */
-                       int vcnt;       /* Number of elements in vector. */
-                       char *vfmt;     /* Pointer to format specifier. */
-#define EXTRAHH 2
-                       char vfmt_buf[32 + EXTRAHH]; /* Static buffer for format spec. */
-                       int vwidth = 0; /* Width specified via '*'. */
-                       int vprec = 0;  /* Precision specified via '*'. */
-                       char *vstr;     /* Used for asprintf(). */
-                       int vlen;       /* Length returned by asprintf(). */
-                       enum {
-                           V_CHAR, V_SHORT, V_INT,
-                           V_PCHAR, V_PSHORT, V_PINT,
-                           V_FLOAT,
-#ifdef V64TYPE
-                           V_LONGLONG, V_PLONGLONG,
-                           V_DOUBLE,
-#endif /* V64TYPE */
-                       } vtype;
-
-                       vval.vectorarg = GETARG(VECTORTYPE);
-                       /*
-                        * Set vfmt.  If vfmt_buf may not be big enough,
-                        * malloc() space, taking care to free it later.
-                        * (EXTRAHH is for possible extra "hh")
-                        */
-                       if (&fmt[-1] - pct + EXTRAHH < sizeof(vfmt_buf))
-                               vfmt = vfmt_buf;
-                       else
-                               vfmt = (char *)malloc(&fmt[-1] - pct + EXTRAHH + 1);
-
-                       /* Set the separator character, if not specified. */
-                       if (vsep == 'X') {
-                               if (ch == 'c')
-                                       vsep = '\0';
-                               else
-                                       vsep = ' ';
-                       }
-
-                       /* Create the format specifier. */
-                       for (i = j = 0; i < &fmt[-1] - pct; i++) {
-                               switch (pct[i]) {
-                               case ',': case ';': case ':': case '_':
-                               case 'v': case 'h': case 'l':
-                                       /* Ignore. */
-                                       break;
-                               case '*':
-                                       if (pct[i - 1] != '.')
-                                               vwidth = 1;
-                                       else
-                                               vprec = 1;
-                                       /* FALLTHROUGH */
-                               default:
-                                       vfmt[j++] = pct[i];
-                               }
-                       }
-               
-                       /*
-                        * Determine the number of elements in the vector and
-                        * finish up the format specifier.
-                        */
-                       if (flags & SHORTINT) {
-                               switch (ch) {
-                               case 'c':
-                                       vtype = V_SHORT;
-                                       break;
-                               case 'p':
-                                       vtype = V_PSHORT;
-                                       break;
-                               default:
-                                       vfmt[j++] = 'h';
-                                       vtype = V_SHORT;
-                                       break;
-                               }
-                               vcnt = 8;
-                       } else if (flags & LONGINT) {
-                               vcnt = 4;
-                               vtype = (ch == 'p') ? V_PINT : V_INT;
-#ifdef V64TYPE
-                       } else if (flags & LLONGINT) {
-                               switch (ch) {
-                               case 'a':
-                               case 'A':
-                               case 'e':
-                               case 'E':
-                               case 'f':
-                               case 'g':
-                               case 'G':
-                                       vcnt = 2;
-                                       vtype = V_DOUBLE;
-                                       break;
-                               case 'd':
-                               case 'i':
-                               case 'u':
-                               case 'o':
-                               case 'p':
-                               case 'x':
-                               case 'X':
-                                       vfmt[j++] = 'l';
-                                       vfmt[j++] = 'l';
-                                       vcnt = 2;
-                                       vtype = (ch == 'p') ? V_PLONGLONG : V_LONGLONG;
-                                       break;
-                               default:
-                                       /*
-                                        * The default case should never
-                                        * happen.
-                                        */
-                               case 'c':
-                                       vcnt = 16;
-                                       vtype = V_CHAR;
-                               }
-#endif /* V64TYPE */
-                       } else {
-                               switch (ch) {
-                               case 'a':
-                               case 'A':
-                               case 'e':
-                               case 'E':
-                               case 'f':
-                               case 'g':
-                               case 'G':
-                                       vcnt = 4;
-                                       vtype = V_FLOAT;
-                                       break;
-                               default:
-                                       /*
-                                        * The default case should never
-                                        * happen.
-                                        */
-                               case 'd':
-                               case 'i':
-                               case 'u':
-                               case 'o':
-                               case 'x':
-                               case 'X':
-                                       vfmt[j++] = 'h';
-                                       vfmt[j++] = 'h';
-                                       /* drop through */
-                               case 'p':
-                               case 'c':
-                                       vcnt = 16;
-                                       vtype = (ch == 'p') ? V_PCHAR : V_CHAR;
-                               }
-                       }
-                       vfmt[j++] = ch;
-                       vfmt[j++] = '\0';
-
-/* Get a vector element. */
-#ifdef V64TYPE
-#define VPRINT(type, ind, args...) do {                                        \
-       switch (type) {                                                 \
-       case V_CHAR:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_PCHAR:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_SHORT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_PSHORT:                                                  \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_INT:                                                     \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_PINT:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_LONGLONG:                                                \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vulonglongarg[ind]); \
-               break;                                                  \
-       case V_PLONGLONG:                                               \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vulonglongarg[ind]); \
-               break;                                                  \
-       case V_FLOAT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-               break;                                                  \
-       case V_DOUBLE:                                                  \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vdoublearg[ind]); \
-               break;                                                  \
-       }                                                               \
-       ret += vlen;                                                    \
-       PRINT(vstr, vlen);                                              \
-       FLUSH();                                                        \
-       free(vstr);                                                     \
-} while (0)
-#else /* !V64TYPE */
-#define VPRINT(type, ind, args...) do {                                        \
-       switch (type) {                                                 \
-       case V_CHAR:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_PCHAR:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_SHORT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_PSHORT:                                                  \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_INT:                                                     \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_PINT:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_FLOAT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-               break;                                                  \
-       }                                                               \
-       ret += vlen;                                                    \
-       PRINT(vstr, vlen);                                              \
-       FLUSH();                                                        \
-       free(vstr);                                                     \
-} while (0)
-#endif /* V64TYPE */
-
-                       /* Actually print. */
-                       if (vwidth == 0) {
-                               if (vprec == 0) {
-                                       /* First element. */
-                                       VPRINT(vtype, 0);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i);
-                                       }
-                               } else {
-                                       /* First element. */
-                                       VPRINT(vtype, 0, prec);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i, prec);
-                                       }
-                               }
-                       } else {
-                               if (vprec == 0) {
-                                       /* First element. */
-                                       VPRINT(vtype, 0, width);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i, width);
-                                       }
-                               } else {
-                                       /* First element. */
-                                       VPRINT(vtype, 0, width, prec);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i, width, prec);
-                                       }
-                               }
-                       }
-#undef VPRINT
-
-                       if (vfmt != vfmt_buf)
-                               free(vfmt);
-
-                       continue;
-               }
-#endif /* VECTORS */
-               /*
-                * All reasonable formats wind up here.  At this point, `cp'
-                * points to a string which (if not flags&LADJUST) should be
-                * padded out to `width' places.  If flags&ZEROPAD, it should
-                * first be prefixed by any sign or other prefix; otherwise,
-                * it should be blank padded before the prefix is emitted.
-                * After any left-hand padding and prefixing, emit zeroes
-                * required by a decimal [diouxX] precision, then print the
-                * string proper, then emit zeroes required by any leftover
-                * floating precision; finally, if LADJUST, pad with blanks.
-                *
-                * Compute actual size, so we know how much to pad.
-                * size excludes decimal prec; realsz includes it.
-                */
-               realsz = dprec > size ? dprec : size;
-               if (sign)
-                       realsz++;
-               if (ox[1])
-                       realsz += 2;
-
-               prsize = width > realsz ? width : realsz;
-               if ((unsigned)ret + prsize > INT_MAX) {
-                       ret = EOF;
-                       goto error;
-               }
-
-               /* right-adjusting blank padding */
-               if ((flags & (LADJUST|ZEROPAD)) == 0)
-                       PAD(width - realsz, blanks);
-
-               /* prefix */
-               if (sign)
-                       PRINT(&sign, 1);
-
-               if (ox[1]) {    /* ox[1] is either x, X, or \0 */
-                       ox[0] = '0';
-                       PRINT(ox, 2);
-               }
-
-               /* right-adjusting zero padding */
-               if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD)
-                       PAD(width - realsz, zeroes);
-
-               /* the string or number proper */
-#ifndef NO_FLOATING_POINT
-               if ((flags & FPT) == 0) {
-#endif
-                       /* leading zeroes from decimal precision */
-                       PAD(dprec - size, zeroes);
-                       if (gs.grouping) {
-                               if (grouping_print(&gs, &io, cp, buf+BUF, loc) < 0)
-                                       goto error;
-                       } else {
-                               PRINT(cp, size);
-                       }
-#ifndef NO_FLOATING_POINT
-               } else {        /* glue together f_p fragments */
-                       if (!expchar) { /* %[fF] or sufficiently short %[gG] */
-                               if (expt <= 0) {
-                                       PRINT(zeroes, 1);
-                                       if (prec || flags & ALT)
-                                               PRINT(decimal_point,decpt_len);
-                                       PAD(-expt, zeroes);
-                                       /* already handled initial 0's */
-                                       prec += expt;
-                               } else {
-                                       if (gs.grouping) {
-                                               n = grouping_print(&gs, &io,
-                                                   cp, dtoaend, loc);
-                                               if (n < 0)
-                                                       goto error;
-                                               cp += n;
-                                       } else {
-                                               PRINTANDPAD(cp, dtoaend,
-                                                   expt, zeroes);
-                                               cp += expt;
-                                       }
-                                       if (prec || flags & ALT)
-                                               PRINT(decimal_point,decpt_len);
-                               }
-                               PRINTANDPAD(cp, dtoaend, prec, zeroes);
-                       } else {        /* %[eE] or sufficiently long %[gG] */
-                               if (prec > 1 || flags & ALT) {
-                                       PRINT(cp++, 1);
-                                       PRINT(decimal_point, decpt_len);
-                                       PRINT(cp, ndig-1);
-                                       PAD(prec - ndig, zeroes);
-                               } else  /* XeYYY */
-                                       PRINT(cp, 1);
-                               PRINT(expstr, expsize);
-                       }
-               }
-#endif
-               /* left-adjusting padding (always blank) */
-               if (flags & LADJUST)
-                       PAD(width - realsz, blanks);
-
-               /* finally, adjust ret */
-               ret += prsize;
-
-               FLUSH();        /* copy out the I/O vectors */
-       }
-done:
-       FLUSH();
-error:
-       va_end(orgap);
-#ifndef NO_FLOATING_POINT
-       if (dtoaresult != NULL)
-               freedtoa(dtoaresult);
-#endif
-       if (convbuf != NULL)
-               free(convbuf);
-       if (__sferror(fp))
-               ret = EOF;
-       if ((argtable != NULL) && (argtable != statargtable))
-               free (argtable);
-       return (ret);
-       /* NOTREACHED */
-}
-
diff --git a/stdio/vfscanf-fbsd.c b/stdio/vfscanf-fbsd.c
deleted file mode 100644 (file)
index a3f9f3e..0000000
+++ /dev/null
@@ -1,1194 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfscanf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.43 2009/01/19 06:19:51 das Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <ctype.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <pthread.h>
-#include "un-namespace.h"
-
-#include "collate.h"
-#include "libc_private.h"
-#include "local.h"
-
-#ifndef NO_FLOATING_POINT
-#include <locale.h>
-#endif
-
-#define        BUF             513     /* Maximum length of numeric string. */
-
-/*
- * Flags used during conversion.
- */
-#define        LONG            0x01    /* l: long or double */
-#define        LONGDBL         0x02    /* L: long double */
-#define        SHORT           0x04    /* h: short */
-#define        SUPPRESS        0x08    /* *: suppress assignment */
-#define        POINTER         0x10    /* p: void * (as hex) */
-#define        NOSKIP          0x20    /* [ or c: do not skip blanks */
-#define        LONGLONG        0x400   /* ll: long long (+ deprecated q: quad) */
-#define        INTMAXT         0x800   /* j: intmax_t */
-#define        PTRDIFFT        0x1000  /* t: ptrdiff_t */
-#define        SIZET           0x2000  /* z: size_t */
-#define        SHORTSHORT      0x4000  /* hh: char */
-#define        UNSIGNED        0x8000  /* %[oupxX] conversions */
-
-/*
- * The following are used in integral conversions only:
- * SIGNOK, NDIGITS, PFXOK, and NZDIGITS
- */
-#define        SIGNOK          0x40    /* +/- is (still) legal */
-#define        NDIGITS         0x80    /* no digits detected */
-#define        PFXOK           0x100   /* 0x prefix is (still) legal */
-#define        NZDIGITS        0x200   /* no zero digits detected */
-#define        HAVESIGN        0x10000 /* sign detected */
-
-/*
- * Conversion types.
- */
-#define        CT_CHAR         0       /* %c conversion */
-#define        CT_CCL          1       /* %[...] conversion */
-#define        CT_STRING       2       /* %s conversion */
-#define        CT_INT          3       /* %[dioupxX] conversion */
-#define        CT_FLOAT        4       /* %[efgEFG] conversion */
-
-static const u_char *__sccl(char *, const u_char *, locale_t);
-#ifndef NO_FLOATING_POINT
-static int parsefloat(FILE *, char **, size_t, locale_t);
-#endif
-
-__weak_reference(__vfscanf, vfscanf);
-
-/*
- * __vfscanf - MT-safe version
- */
-int
-__vfscanf(FILE * __restrict fp, char const * __restrict fmt0, va_list ap)
-{
-       int ret;
-
-       FLOCKFILE(fp);
-       ret = __svfscanf_l(fp, __current_locale(), fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-int
-vfscanf_l(FILE * __restrict fp, locale_t loc, char const * __restrict fmt0, va_list ap)
-{
-       int ret;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       ret = __svfscanf_l(fp, loc, fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-/*
- * __svfscanf - non-MT-safe version of __vfscanf
- */
-__private_extern__ int
-__svfscanf_l(FILE * __restrict fp, locale_t loc, const char * __restrict fmt0, va_list ap)
-{
-       const u_char *fmt = (const u_char *)fmt0;
-       int c;                  /* character from format, or conversion */
-       size_t width;           /* field width, or 0 */
-       char *p;                /* points into all kinds of strings */
-       int n;                  /* handy integer */
-       int flags;              /* flags as defined above */
-       char *p0;               /* saves original value of p when necessary */
-       int nassigned;          /* number of fields assigned */
-       int nread;              /* number of characters consumed from fp */
-       int base;               /* base argument to conversion function */
-       char ccltab[256];       /* character class table for %[...] */
-       char buf[BUF];          /* buffer for numeric and mb conversions */
-       wchar_t *wcp;           /* handy wide character pointer */
-       size_t nconv;           /* length of multibyte sequence converted */
-       int index;              /* %index$, zero if unset */
-       va_list ap_orig;        /* to reset ap to first argument */
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       int mb_cur_max;
-
-       /* `basefix' is used to avoid `if' tests in the integer scanner */
-       static short basefix[17] =
-               { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-
-       NORMALIZE_LOCALE(loc);
-       mb_cur_max = MB_CUR_MAX_L(loc);
-       ORIENT(fp, -1);
-
-       nassigned = 0;
-       nread = 0;
-       va_copy(ap_orig, ap);
-       for (;;) {
-               c = *fmt++;
-               if (c == 0)
-                       return (nassigned);
-               if (isspace_l(c, loc)) {
-                       while ((fp->_r > 0 || __srefill(fp) == 0) && isspace_l(*fp->_p, loc))
-                               nread++, fp->_r--, fp->_p++;
-                       continue;
-               }
-               if (c != '%') {
-                       if (fp->_r <= 0 && __srefill(fp))
-                               goto input_failure;
-                       goto literal;
-               }
-               width = 0;
-               flags = 0;
-               /*
-                * switch on the format.  continue if done;
-                * break once format type is derived.
-                */
-again:         c = *fmt++;
-               switch (c) {
-               case '%':
-                       /* Consume leading white space */
-                       for(;;) {
-                               if (fp->_r <= 0 && __srefill(fp))
-                                       goto input_failure;
-                               if (!isspace_l(*fp->_p, loc))
-                                       break;
-                               nread++;
-                               fp->_r--;
-                               fp->_p++;
-                       }
-literal:
-                       if (*fp->_p != c)
-                               goto match_failure;
-                       fp->_r--, fp->_p++;
-                       nread++;
-                       continue;
-
-               case '$':
-                       index = width;
-                       if (index < 1 || index > NL_ARGMAX || fmt[-3] != '%') {
-                               goto input_failure;
-                       }
-                       width = 0;
-                       va_end(ap);
-                       va_copy(ap, ap_orig); /* reset to %1$ */
-                       for (; index > 1; index--) {
-                               va_arg(ap, void*);
-                       }
-                       goto again;
-               case '*':
-                       flags |= SUPPRESS;
-                       goto again;
-               case 'j':
-                       flags |= INTMAXT;
-                       goto again;
-               case 'l':
-                       if (flags & LONG) {
-                               flags &= ~LONG;
-                               flags |= LONGLONG;
-                       } else
-                               flags |= LONG;
-                       goto again;
-               case 'q':
-                       flags |= LONGLONG;      /* not quite */
-                       goto again;
-               case 't':
-                       flags |= PTRDIFFT;
-                       goto again;
-               case 'z':
-                       flags |= SIZET;
-                       goto again;
-               case 'L':
-                       flags |= LONGDBL;
-                       goto again;
-               case 'h':
-                       if (flags & SHORT) {
-                               flags &= ~SHORT;
-                               flags |= SHORTSHORT;
-                       } else
-                               flags |= SHORT;
-                       goto again;
-
-               case '0': case '1': case '2': case '3': case '4':
-               case '5': case '6': case '7': case '8': case '9':
-                       width = width * 10 + c - '0';
-                       goto again;
-
-               /*
-                * Conversions.
-                */
-               case 'd':
-                       c = CT_INT;
-                       base = 10;
-                       break;
-
-               case 'i':
-                       c = CT_INT;
-                       base = 0;
-                       break;
-
-               case 'o':
-                       c = CT_INT;
-                       flags |= UNSIGNED;
-                       base = 8;
-                       break;
-
-               case 'u':
-                       c = CT_INT;
-                       flags |= UNSIGNED;
-                       base = 10;
-                       break;
-
-               case 'X':
-               case 'x':
-                       flags |= PFXOK; /* enable 0x prefixing */
-                       c = CT_INT;
-                       flags |= UNSIGNED;
-                       base = 16;
-                       break;
-
-#ifndef NO_FLOATING_POINT
-               case 'A': case 'E': case 'F': case 'G':
-               case 'a': case 'e': case 'f': case 'g':
-                       c = CT_FLOAT;
-                       break;
-#endif
-
-               case 'S':
-                       flags |= LONG;
-                       /* FALLTHROUGH */
-               case 's':
-                       c = CT_STRING;
-                       break;
-
-               case '[':
-                       fmt = __sccl(ccltab, fmt, loc);
-                       flags |= NOSKIP;
-                       c = CT_CCL;
-                       break;
-
-               case 'C':
-                       flags |= LONG;
-                       /* FALLTHROUGH */
-               case 'c':
-                       flags |= NOSKIP;
-                       c = CT_CHAR;
-                       break;
-
-               case 'p':       /* pointer format is like hex */
-                       flags |= POINTER | PFXOK;
-                       c = CT_INT;             /* assumes sizeof(uintmax_t) */
-                       flags |= UNSIGNED;      /*      >= sizeof(uintptr_t) */
-                       base = 16;
-                       break;
-
-               case 'n':
-               {
-                       void *ptr = va_arg(ap, void *);
-                       if ((ptr == NULL) || (flags & SUPPRESS))        /* ??? */
-                               continue;
-                       else if (flags & SHORTSHORT)
-                               *(char *)ptr = nread;
-                       else if (flags & SHORT)
-                               *(short *)ptr = nread;
-                       else if (flags & LONG)
-                               *(long *)ptr = nread;
-                       else if (flags & LONGLONG)
-                               *(long long *)ptr = nread;
-                       else if (flags & INTMAXT)
-                               *(intmax_t *)ptr = nread;
-                       else if (flags & SIZET)
-                               *(size_t *)ptr = nread;
-                       else if (flags & PTRDIFFT)
-                               *(ptrdiff_t *)ptr = nread;
-                       else
-                               *(int *)ptr = nread;
-                       continue;
-               }
-               default:
-                       goto match_failure;
-
-               /*
-                * Disgusting backwards compatibility hack.     XXX
-                */
-               case '\0':      /* compat */
-                       return (EOF);
-               }
-
-               /*
-                * We have a conversion that requires input.
-                */
-               if (fp->_r <= 0 && __srefill(fp))
-                       goto input_failure;
-
-               /*
-                * Consume leading white space, except for formats
-                * that suppress this.
-                */
-               if ((flags & NOSKIP) == 0) {
-                       while (isspace_l(*fp->_p, loc)) {
-                               nread++;
-                               if (--fp->_r > 0)
-                                       fp->_p++;
-                               else if (__srefill(fp))
-                                       goto input_failure;
-                       }
-                       /*
-                        * Note that there is at least one character in
-                        * the buffer, so conversions that do not set NOSKIP
-                        * ca no longer result in an input failure.
-                        */
-               }
-
-               /*
-                * Do the conversion.
-                */
-               switch (c) {
-
-               case CT_CHAR:
-                       /* scan arbitrary characters (sets NOSKIP) */
-                       if (width == 0)
-                               width = 1;
-                       if (flags & LONG) {
-                               if ((flags & SUPPRESS) == 0)
-                                       wcp = va_arg(ap, wchar_t *);
-                               else
-                                       wcp = NULL;
-                               n = 0;
-                               while (width != 0) {
-                                       if (n == mb_cur_max) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-                                       buf[n++] = *fp->_p;
-                                       fp->_p++;
-                                       fp->_r--;
-                                       mbs = initial;
-                                       nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
-                                       if (nconv == (size_t)-1) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-                                       if (nconv == 0 && !(flags & SUPPRESS))
-                                               *wcp = L'\0';
-                                       if (nconv != (size_t)-2) {
-                                               nread += n;
-                                               width--;
-                                               if (!(flags & SUPPRESS))
-                                                       wcp++;
-                                               n = 0;
-                                       }
-                                       if (fp->_r <= 0 && __srefill(fp)) {
-                                               if (n != 0) {
-                                                       fp->_flags |= __SERR;
-                                                       goto input_failure;
-                                               }
-                                               break;
-                                       }
-                               }
-                               if (!(flags & SUPPRESS))
-                                       nassigned++;
-                       } else if (flags & SUPPRESS) {
-                               size_t sum = 0;
-                               for (;;) {
-                                       if ((n = fp->_r) < width) {
-                                               sum += n;
-                                               width -= n;
-                                               fp->_p += n;
-                                               if (__srefill(fp)) {
-                                                       if (sum == 0)
-                                                           goto input_failure;
-                                                       break;
-                                               }
-                                       } else {
-                                               sum += width;
-                                               fp->_r -= width;
-                                               fp->_p += width;
-                                               break;
-                                       }
-                               }
-                               nread += sum;
-                       } else {
-                               size_t r = __fread((void *)va_arg(ap, char *), 1,
-                                   width, fp);
-
-                               if (r == 0)
-                                       goto input_failure;
-                               nread += r;
-                               nassigned++;
-                       }
-                       break;
-
-               case CT_CCL:
-                       /* scan a (nonempty) character class (sets NOSKIP) */
-                       if (width == 0)
-                               width = (size_t)~0;     /* `infinity' */
-                       /* take only those things in the class */
-                       if (flags & LONG) {
-                               wchar_t twc;
-                               int nchars;
-
-                               if ((flags & SUPPRESS) == 0)
-                                       wcp = va_arg(ap, wchar_t *);
-                               else
-                                       wcp = &twc;
-                               n = 0;
-                               nchars = 0;
-                               while (width != 0) {
-                                       if (n == mb_cur_max) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-                                       buf[n++] = *fp->_p;
-                                       fp->_p++;
-                                       fp->_r--;
-                                       mbs = initial;
-                                       nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
-                                       if (nconv == (size_t)-1) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-                                       if (nconv == 0)
-                                               *wcp = L'\0';
-                                       if (nconv != (size_t)-2) {
-                                               if (wctob_l(*wcp, loc) != EOF &&
-                                                   !ccltab[wctob_l(*wcp, loc)]) {
-                                                       while (n != 0) {
-                                                               n--;
-                                                               __ungetc(buf[n],
-                                                                   fp);
-                                                       }
-                                                       break;
-                                               }
-                                               nread += n;
-                                               width--;
-                                               if (!(flags & SUPPRESS))
-                                                       wcp++;
-                                               nchars++;
-                                               n = 0;
-                                       }
-                                       if (fp->_r <= 0 && __srefill(fp)) {
-                                               if (n != 0) {
-                                                       fp->_flags |= __SERR;
-                                                       goto input_failure;
-                                               }
-                                               break;
-                                       }
-                               }
-                               if (n != 0) {
-                                       fp->_flags |= __SERR;
-                                       goto input_failure;
-                               }
-                               n = nchars;
-                               if (n == 0)
-                                       goto match_failure;
-                               if (!(flags & SUPPRESS)) {
-                                       *wcp = L'\0';
-                                       nassigned++;
-                               }
-                       } else if (flags & SUPPRESS) {
-                               n = 0;
-                               while (ccltab[*fp->_p]) {
-                                       n++, fp->_r--, fp->_p++;
-                                       if (--width == 0)
-                                               break;
-                                       if (fp->_r <= 0 && __srefill(fp)) {
-                                               if (n == 0)
-                                                       goto input_failure;
-                                               break;
-                                       }
-                               }
-                               if (n == 0)
-                                       goto match_failure;
-                       } else {
-                               p0 = p = va_arg(ap, char *);
-                               while (ccltab[*fp->_p]) {
-                                       fp->_r--;
-                                       *p++ = *fp->_p++;
-                                       if (--width == 0)
-                                               break;
-                                       if (fp->_r <= 0 && __srefill(fp)) {
-                                               if (p == p0)
-                                                       goto input_failure;
-                                               break;
-                                       }
-                               }
-                               n = p - p0;
-                               if (n == 0)
-                                       goto match_failure;
-                               *p = 0;
-                               nassigned++;
-                       }
-                       nread += n;
-                       break;
-
-               case CT_STRING:
-                       /* like CCL, but zero-length string OK, & no NOSKIP */
-                       if (width == 0)
-                               width = (size_t)~0;
-                       if (flags & LONG) {
-                               wchar_t twc;
-
-                               if ((flags & SUPPRESS) == 0)
-                                       wcp = va_arg(ap, wchar_t *);
-                               else
-                                       wcp = &twc;
-                               n = 0;
-                               while (width != 0) {
-                                       if (n == mb_cur_max) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-                                       buf[n++] = *fp->_p;
-                                       fp->_p++;
-                                       fp->_r--;
-                                       mbs = initial;
-                                       nconv = mbrtowc_l(wcp, buf, n, &mbs, loc);
-                                       if (nconv == (size_t)-1) {
-                                               fp->_flags |= __SERR;
-                                               goto input_failure;
-                                       }
-                                       if (nconv == 0)
-                                               *wcp = L'\0';
-                                       if (nconv != (size_t)-2) {
-                                               if (iswspace_l(*wcp, loc)) {
-                                                       while (n != 0) {
-                                                               n--;
-                                                               __ungetc(buf[n],
-                                                                   fp);
-                                                       }
-                                                       break;
-                                               }
-                                               nread += n;
-                                               width--;
-                                               if (!(flags & SUPPRESS))
-                                                       wcp++;
-                                               n = 0;
-                                       }
-                                       if (fp->_r <= 0 && __srefill(fp)) {
-                                               if (n != 0) {
-                                                       fp->_flags |= __SERR;
-                                                       goto input_failure;
-                                               }
-                                               break;
-                                       }
-                               }
-                               if (!(flags & SUPPRESS)) {
-                                       *wcp = L'\0';
-                                       nassigned++;
-                               }
-                       } else if (flags & SUPPRESS) {
-                               n = 0;
-                               while (!isspace_l(*fp->_p, loc)) {
-                                       n++, fp->_r--, fp->_p++;
-                                       if (--width == 0)
-                                               break;
-                                       if (fp->_r <= 0 && __srefill(fp))
-                                               break;
-                               }
-                               nread += n;
-                       } else {
-                               p0 = p = va_arg(ap, char *);
-                               while (!isspace_l(*fp->_p, loc)) {
-                                       fp->_r--;
-                                       *p++ = *fp->_p++;
-                                       if (--width == 0)
-                                               break;
-                                       if (fp->_r <= 0 && __srefill(fp))
-                                               break;
-                               }
-                               *p = 0;
-                               nread += p - p0;
-                               nassigned++;
-                       }
-                       continue;
-
-               case CT_INT:
-                       /* scan an integer as if by the conversion function */
-#ifdef hardway
-                       if (width == 0 || width > sizeof(buf) - 1)
-                               width = sizeof(buf) - 1;
-#else
-                       /* size_t is unsigned, hence this optimisation */
-                       if (--width > sizeof(buf) - 2)
-                               width = sizeof(buf) - 2;
-                       width++;
-#endif
-                       flags |= SIGNOK | NDIGITS | NZDIGITS;
-                       for (p = buf; width; width--) {
-                               c = *fp->_p;
-                               /*
-                                * Switch on the character; `goto ok'
-                                * if we accept it as a part of number.
-                                */
-                               switch (c) {
-
-                               /*
-                                * The digit 0 is always legal, but is
-                                * special.  For %i conversions, if no
-                                * digits (zero or nonzero) have been
-                                * scanned (only signs), we will have
-                                * base==0.  In that case, we should set
-                                * it to 8 and enable 0x prefixing.
-                                * Also, if we have not scanned zero digits
-                                * before this, do not turn off prefixing
-                                * (someone else will turn it off if we
-                                * have scanned any nonzero digits).
-                                */
-                               case '0':
-                                       if (base == 0) {
-                                               base = 8;
-                                               flags |= PFXOK;
-                                       }
-                                       if (flags & NZDIGITS)
-                                           flags &= ~(SIGNOK|NZDIGITS|NDIGITS);
-                                       else
-                                           flags &= ~(SIGNOK|PFXOK|NDIGITS);
-                                       goto ok;
-
-                               /* 1 through 7 always legal */
-                               case '1': case '2': case '3':
-                               case '4': case '5': case '6': case '7':
-                                       base = basefix[base];
-                                       flags &= ~(SIGNOK | PFXOK | NDIGITS);
-                                       goto ok;
-
-                               /* digits 8 and 9 ok iff decimal or hex */
-                               case '8': case '9':
-                                       base = basefix[base];
-                                       if (base <= 8)
-                                               break;  /* not legal here */
-                                       flags &= ~(SIGNOK | PFXOK | NDIGITS);
-                                       goto ok;
-
-                               /* letters ok iff hex */
-                               case 'A': case 'B': case 'C':
-                               case 'D': case 'E': case 'F':
-                               case 'a': case 'b': case 'c':
-                               case 'd': case 'e': case 'f':
-                                       /* no need to fix base here */
-                                       if (base <= 10)
-                                               break;  /* not legal here */
-                                       flags &= ~(SIGNOK | PFXOK | NDIGITS);
-                                       goto ok;
-
-                               /* sign ok only as first character */
-                               case '+': case '-':
-                                       if (flags & SIGNOK) {
-                                               flags &= ~SIGNOK;
-                                               flags |= HAVESIGN;
-                                               goto ok;
-                                       }
-                                       break;
-                                       
-                               /*
-                                * x ok iff flag still set & 2nd char (or
-                                * 3rd char if we have a sign).
-                                */
-                               case 'x': case 'X':
-                                       if (flags & PFXOK && p ==
-                                           buf + 1 + !!(flags & HAVESIGN)) {
-                                               base = 16;      /* if %i */
-                                               flags &= ~PFXOK;
-                                               goto ok;
-                                       }
-                                       break;
-                               }
-
-                               /*
-                                * If we got here, c is not a legal character
-                                * for a number.  Stop accumulating digits.
-                                */
-                               break;
-               ok:
-                               /*
-                                * c is legal: store it and look at the next.
-                                */
-                               *p++ = c;
-                               if (--fp->_r > 0)
-                                       fp->_p++;
-                               else if (__srefill(fp))
-                                       break;          /* EOF */
-                       }
-                       /*
-                        * If we had only a sign, it is no good; push
-                        * back the sign.  If the number ends in `x',
-                        * it was [sign] '0' 'x', so push back the x
-                        * and treat it as [sign] '0'.
-                        */
-                       if (flags & NDIGITS) {
-                               if (p > buf)
-                                       (void) __ungetc(*(u_char *)--p, fp);
-                               goto match_failure;
-                       }
-                       c = ((u_char *)p)[-1];
-                       if (c == 'x' || c == 'X') {
-                               --p;
-                               (void) __ungetc(c, fp);
-                       }
-                       if ((flags & SUPPRESS) == 0) {
-                               uintmax_t res;
-
-                               *p = 0;
-                               if ((flags & UNSIGNED) == 0)
-                                   res = strtoimax_l(buf, (char **)NULL, base, loc);
-                               else
-                                   res = strtoumax_l(buf, (char **)NULL, base, loc);
-                               if (flags & POINTER)
-                                       *va_arg(ap, void **) =
-                                                       (void *)(uintptr_t)res;
-                               else if (flags & SHORTSHORT)
-                                       *va_arg(ap, char *) = res;
-                               else if (flags & SHORT)
-                                       *va_arg(ap, short *) = res;
-                               else if (flags & LONG)
-                                       *va_arg(ap, long *) = res;
-                               else if (flags & LONGLONG)
-                                       *va_arg(ap, long long *) = res;
-                               else if (flags & INTMAXT)
-                                       *va_arg(ap, intmax_t *) = res;
-                               else if (flags & PTRDIFFT)
-                                       *va_arg(ap, ptrdiff_t *) = res;
-                               else if (flags & SIZET)
-                                       *va_arg(ap, size_t *) = res;
-                               else
-                                       *va_arg(ap, int *) = res;
-                               nassigned++;
-                       }
-                       nread += p - buf;
-                       break;
-
-#ifndef NO_FLOATING_POINT
-               case CT_FLOAT:
-               {
-                       char *pbuf;
-                       /* scan a floating point number as if by strtod */
-                       if ((width = parsefloat(fp, &pbuf, width, loc)) == 0)
-                               goto match_failure;
-                       if ((flags & SUPPRESS) == 0) {
-                               if (flags & LONGDBL) {
-                                       long double res = strtold_l(pbuf, &p, loc);
-                                       *va_arg(ap, long double *) = res;
-                               } else if (flags & LONG) {
-                                       double res = strtod_l(pbuf, &p, loc);
-                                       *va_arg(ap, double *) = res;
-                               } else {
-                                       float res = strtof_l(pbuf, &p, loc);
-                                       *va_arg(ap, float *) = res;
-                               }
-                               nassigned++;
-                       }
-                       nread += width;
-                       break;
-               }
-#endif /* !NO_FLOATING_POINT */
-               }
-       }
-input_failure:
-       return (nassigned ? nassigned : EOF);
-match_failure:
-       return (nassigned);
-}
-
-int
-__svfscanf(FILE * __restrict fp, const char * __restrict fmt0, va_list ap)
-{
-       return __svfscanf_l(fp, __current_locale(), fmt0, ap);
-}
-
-/*
- * Fill in the given table from the scanset at the given format
- * (just after `[').  Return a pointer to the character past the
- * closing `]'.  The table has a 1 wherever characters should be
- * considered part of the scanset.
- */
-static const u_char *
-__sccl(tab, fmt, loc)
-       char *tab;
-       const u_char *fmt;
-       locale_t loc;
-{
-       int c, n, v, i;
-
-       /* first `clear' the whole table */
-       c = *fmt++;             /* first char hat => negated scanset */
-       if (c == '^') {
-               v = 1;          /* default => accept */
-               c = *fmt++;     /* get new first char */
-       } else
-               v = 0;          /* default => reject */
-
-       /* XXX: Will not work if sizeof(tab*) > sizeof(char) */
-       (void) memset(tab, v, 256);
-
-       if (c == 0)
-               return (fmt - 1);/* format ended before closing ] */
-
-       /*
-        * Now set the entries corresponding to the actual scanset
-        * to the opposite of the above.
-        *
-        * The first character may be ']' (or '-') without being special;
-        * the last character may be '-'.
-        */
-       v = 1 - v;
-       for (;;) {
-               tab[c] = v;             /* take character c */
-doswitch:
-               n = *fmt++;             /* and examine the next */
-               switch (n) {
-
-               case 0:                 /* format ended too soon */
-                       return (fmt - 1);
-
-               case '-':
-               {
-                       /*
-                        * A scanset of the form
-                        *      [01+-]
-                        * is defined as `the digit 0, the digit 1,
-                        * the character +, the character -', but
-                        * the effect of a scanset such as
-                        *      [a-zA-Z0-9]
-                        * is implementation defined.  The V7 Unix
-                        * scanf treats `a-z' as `the letters a through
-                        * z', but treats `a-a' as `the letter a, the
-                        * character -, and the letter a'.
-                        *
-                        * For compatibility, the `-' is not considerd
-                        * to define a range if the character following
-                        * it is either a close bracket (required by ANSI)
-                        * or is not numerically greater than the character
-                        * we just stored in the table (c).
-                        */
-                       n = *fmt;
-                       if (n == ']'
-                           || (loc->__collate_load_error ? n < c :
-                               __collate_range_cmp (n, c, loc) < 0
-                              )
-                          ) {
-                               c = '-';
-                               break;  /* resume the for(;;) */
-                       }
-                       fmt++;
-                       /* fill in the range */
-                       if (loc->__collate_load_error) {
-                               do {
-                                       tab[++c] = v;
-                               } while (c < n);
-                       } else {
-                               for (i = 0; i < 256; i ++)
-                                       if (   __collate_range_cmp (c, i, loc) < 0
-                                           && __collate_range_cmp (i, n, loc) <= 0
-                                          )
-                                               tab[i] = v;
-                       }
-#if 1  /* XXX another disgusting compatibility hack */
-                       c = n;
-                       /*
-                        * Alas, the V7 Unix scanf also treats formats
-                        * such as [a-c-e] as `the letters a through e'.
-                        * This too is permitted by the standard....
-                        */
-                       goto doswitch;
-#else
-                       c = *fmt++;
-                       if (c == 0)
-                               return (fmt - 1);
-                       if (c == ']')
-                               return (fmt);
-#endif
-                       break;
-               }
-               case ']':               /* end of scanset */
-                       return (fmt);
-
-               default:                /* just another character */
-                       c = n;
-                       break;
-               }
-       }
-       /* NOTREACHED */
-}
-
-#ifndef NO_FLOATING_POINT
-/*
- * Maintain a per-thread parsefloat buffer, shared by __svfscanf_l and
- * __vfwscanf.
- */
-#ifdef BUILDING_VARIANT
-extern char *__parsefloat_buf(size_t s);
-#else /* !BUILDING_VARIANT */
-__private_extern__ char *
-__parsefloat_buf(size_t s)
-{
-       char *b;
-       static pthread_key_t    parsefloat_tsd_key = (pthread_key_t)-1;
-       static pthread_mutex_t  parsefloat_tsd_lock = PTHREAD_MUTEX_INITIALIZER;
-       static size_t bsiz = 0;
-
-       if (parsefloat_tsd_key == (pthread_key_t)-1) {
-               pthread_mutex_lock(&parsefloat_tsd_lock);
-               if (parsefloat_tsd_key == (pthread_key_t)-1) {
-                       parsefloat_tsd_key = __LIBC_PTHREAD_KEY_PARSEFLOAT;
-                       pthread_key_init_np(parsefloat_tsd_key, free);
-               }
-               pthread_mutex_unlock(&parsefloat_tsd_lock);
-       }
-       if ((b = (char *)pthread_getspecific(parsefloat_tsd_key)) == NULL) {
-               bsiz = s > BUF ? s : BUF;
-               b = (char *)malloc(bsiz);
-               if (b == NULL) {
-                       bsiz = 0;
-                       return NULL;
-               }
-               pthread_setspecific(parsefloat_tsd_key, b);
-               return b;
-       }
-       if (s > bsiz) {
-               b = (char *)reallocf(b, s);
-               pthread_setspecific(parsefloat_tsd_key, b);
-               if (b == NULL) {
-                       bsiz = 0;
-                       return NULL;
-               }
-               bsiz = s;
-       }
-       return b;
-}
-#endif /* BUILDING_VARIANT */
-
-static int
-parsefloat(FILE *fp, char **buf, size_t width, locale_t loc)
-{
-       char *commit, *p;
-       int infnanpos = 0, decptpos = 0;
-       enum {
-               S_START, S_GOTSIGN, S_INF, S_NAN, S_DONE, S_MAYBEHEX,
-               S_DIGITS, S_DECPT, S_FRAC, S_EXP, S_EXPDIGITS
-       } state = S_START;
-       unsigned char c;
-       const char *decpt = localeconv_l(loc)->decimal_point;
-       _Bool gotmantdig = 0, ishex = 0;
-       char *b;
-       char *e;
-       size_t s;
-
-       s = (width == 0 ? BUF : (width + 1));
-       if ((b = __parsefloat_buf(s)) == NULL) {
-               *buf = NULL;
-               return 0;
-       }
-       e = b + (s - 1);
-       /*
-        * We set commit = p whenever the string we have read so far
-        * constitutes a valid representation of a floating point
-        * number by itself.  At some point, the parse will complete
-        * or fail, and we will ungetc() back to the last commit point.
-        * To ensure that the file offset gets updated properly, it is
-        * always necessary to read at least one character that doesn't
-        * match; thus, we can't short-circuit "infinity" or "nan(...)".
-        */
-       commit = b - 1;
-       for (p = b; width == 0 || p < e; ) {
-               c = *fp->_p;
-reswitch:
-               switch (state) {
-               case S_START:
-                       state = S_GOTSIGN;
-                       if (c == '-' || c == '+')
-                               break;
-                       else
-                               goto reswitch;
-               case S_GOTSIGN:
-                       switch (c) {
-                       case '0':
-                               state = S_MAYBEHEX;
-                               commit = p;
-                               break;
-                       case 'I':
-                       case 'i':
-                               state = S_INF;
-                               break;
-                       case 'N':
-                       case 'n':
-                               state = S_NAN;
-                               break;
-                       default:
-                               state = S_DIGITS;
-                               goto reswitch;
-                       }
-                       break;
-               case S_INF:
-                       if (infnanpos > 6 ||
-                           (c != "nfinity"[infnanpos] &&
-                            c != "NFINITY"[infnanpos]))
-                               goto parsedone;
-                       if (infnanpos == 1 || infnanpos == 6)
-                               commit = p;     /* inf or infinity */
-                       infnanpos++;
-                       break;
-               case S_NAN:
-                       switch (infnanpos) {
-                       case 0:
-                               if (c != 'A' && c != 'a')
-                                       goto parsedone;
-                               break;
-                       case 1:
-                               if (c != 'N' && c != 'n')
-                                       goto parsedone;
-                               else
-                                       commit = p;
-                               break;
-                       case 2:
-                               if (c != '(')
-                                       goto parsedone;
-                               break;
-                       default:
-                               if (c == ')') {
-                                       commit = p;
-                                       state = S_DONE;
-                               } else if (!isalnum_l(c, loc) && c != '_')
-                                       goto parsedone;
-                               break;
-                       }
-                       infnanpos++;
-                       break;
-               case S_DONE:
-                       goto parsedone;
-               case S_MAYBEHEX:
-                       state = S_DIGITS;
-                       if (c == 'X' || c == 'x') {
-                               ishex = 1;
-                               break;
-                       } else {        /* we saw a '0', but no 'x' */
-                               gotmantdig = 1;
-                               goto reswitch;
-                       }
-               case S_DIGITS:
-                       if ((ishex && isxdigit_l(c, loc)) || isdigit_l(c, loc)) {
-                               gotmantdig = 1;
-                               commit = p;
-                               break;
-                       } else {
-                               state = S_DECPT;
-                               goto reswitch;
-                       }
-               case S_DECPT:
-                       if (c == decpt[decptpos]) {
-                               if (decpt[++decptpos] == '\0') {
-                                       /* We read the complete decpt seq. */
-                                       state = S_FRAC;
-                                       if (gotmantdig)
-                                               commit = p;
-                               }
-                               break;
-                       } else if (!decptpos) {
-                               /* We didn't read any decpt characters. */
-                               state = S_FRAC;
-                               goto reswitch;
-                       } else {
-                               /*
-                                * We read part of a multibyte decimal point,
-                                * but the rest is invalid, so bail.
-                                */
-                               goto parsedone;
-                       }
-               case S_FRAC:
-                       if (((c == 'E' || c == 'e') && !ishex) ||
-                           ((c == 'P' || c == 'p') && ishex)) {
-                               if (!gotmantdig)
-                                       goto parsedone;
-                               else
-                                       state = S_EXP;
-                       } else if ((ishex && isxdigit_l(c, loc)) || isdigit_l(c, loc)) {
-                               commit = p;
-                               gotmantdig = 1;
-                       } else
-                               goto parsedone;
-                       break;
-               case S_EXP:
-                       state = S_EXPDIGITS;
-                       if (c == '-' || c == '+')
-                               break;
-                       else
-                               goto reswitch;
-               case S_EXPDIGITS:
-                       if (isdigit_l(c, loc))
-                               commit = p;
-                       else
-                               goto parsedone;
-                       break;
-               default:
-                       LIBC_ABORT("unknown state %d", state);
-               }
-               if (p >= e) {
-                       ssize_t diff = (p - b);
-                       ssize_t com = (commit - b);
-                       s += BUF;
-                       b = __parsefloat_buf(s);
-                       if (b == NULL) {
-                               *buf = NULL;
-                               return 0;
-                       }
-                       e = b + (s - 1);
-                       p = b + diff;
-                       commit = b + com;
-               }
-               *p++ = c;
-               if (--fp->_r > 0)
-                       fp->_p++;
-               else if (__srefill(fp))
-                       break;  /* EOF */
-       }
-
-parsedone:
-       while (commit < --p)
-               __ungetc(*(u_char *)p, fp);
-       *++commit = '\0';
-       *buf = b;
-       return (commit - b);
-}
-#endif
diff --git a/stdio/vfwprintf-fbsd.c b/stdio/vfwprintf-fbsd.c
deleted file mode 100644 (file)
index d085dcc..0000000
+++ /dev/null
@@ -1,1482 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.42 2009/11/25 04:27:55 wollman Exp $");
-
-#include "xlocale_private.h"
-
-/*
- * Actual wprintf innards.
- *
- * Avoid making gratuitous changes to this source file; it should be kept
- * as close as possible to vfprintf.c for ease of maintenance.
- */
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <ctype.h>
-#include <limits.h>
-#include <locale.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <errno.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "local.h"
-#include "fvwrite.h"
-#include "printflocal.h"
-
-static int     __sprint(FILE *, locale_t, struct __suio *);
-static int     __sbprintf(FILE *, locale_t, const wchar_t *, va_list);
-static wint_t  __xfputwc(wchar_t, FILE *, locale_t);
-static wchar_t *__mbsconv(char *, int, locale_t);
-__private_extern__ const char *__fix_nogrouping(const char *);
-
-#define        CHAR    wchar_t
-#include "printfcommon.h"
-
-struct grouping_state {
-       wchar_t thousands_sep;  /* locale-specific thousands separator */
-       const char *grouping;   /* locale-specific numeric grouping rules */
-       int lead;               /* sig figs before decimal or group sep */
-       int nseps;              /* number of group separators with ' */
-       int nrepeats;           /* number of repeats of the last group */
-};
-
-static const mbstate_t initial_mbs;
-
-static inline wchar_t
-get_decpt(locale_t loc)
-{
-       mbstate_t mbs;
-       wchar_t decpt;
-       int nconv;
-
-       mbs = initial_mbs;
-       nconv = mbrtowc_l(&decpt, localeconv_l(loc)->decimal_point, MB_CUR_MAX_L(loc), &mbs, loc);
-       if (nconv == (size_t)-1 || nconv == (size_t)-2)
-               decpt = '.';    /* failsafe */
-       return (decpt);
-}
-
-static inline wchar_t
-get_thousep(locale_t loc)
-{
-       mbstate_t mbs;
-       wchar_t thousep;
-       int nconv;
-
-       mbs = initial_mbs;
-       nconv = mbrtowc_l(&thousep, localeconv_l(loc)->thousands_sep,
-           MB_CUR_MAX_L(loc), &mbs, loc);
-       if (nconv == (size_t)-1 || nconv == (size_t)-2)
-               thousep = '\0';    /* failsafe */
-       return (thousep);
-}
-
-/*
- * Initialize the thousands' grouping state in preparation to print a
- * number with ndigits digits. This routine returns the total number
- * of wide characters that will be printed.
- */
-static int
-grouping_init(struct grouping_state *gs, int ndigits, locale_t loc)
-{
-
-       gs->grouping = __fix_nogrouping(localeconv_l(loc)->grouping);
-       gs->thousands_sep = get_thousep(loc);
-
-       gs->nseps = gs->nrepeats = 0;
-       gs->lead = ndigits;
-       while (*gs->grouping != CHAR_MAX) {
-               if (gs->lead <= *gs->grouping)
-                       break;
-               gs->lead -= *gs->grouping;
-               if (*(gs->grouping+1)) {
-                       gs->nseps++;
-                       gs->grouping++;
-               } else
-                       gs->nrepeats++;
-       }
-       return (gs->nseps + gs->nrepeats);
-}
-
-/*
- * Print a number with thousands' separators.
- */
-static int
-grouping_print(struct grouping_state *gs, struct io_state *iop,
-              const CHAR *cp, const CHAR *ep, locale_t loc)
-{
-       const CHAR *cp0 = cp;
-
-       if (io_printandpad(iop, cp, ep, gs->lead, zeroes, loc))
-               return (-1);
-       cp += gs->lead;
-       while (gs->nseps > 0 || gs->nrepeats > 0) {
-               if (gs->nrepeats > 0)
-                       gs->nrepeats--;
-               else {
-                       gs->grouping--;
-                       gs->nseps--;
-               }
-               if (io_print(iop, &gs->thousands_sep, 1, loc))
-                       return (-1);
-               if (io_printandpad(iop, cp, ep, *gs->grouping, zeroes, loc))
-                       return (-1);
-               cp += *gs->grouping;
-       }
-       if (cp > ep)
-               cp = ep;
-       return (cp - cp0);
-}
-
-
-/*
- * Flush out all the vectors defined by the given uio,
- * then reset it so that it can be reused.
- *
- * XXX The fact that we do this a character at a time and convert to a
- * multibyte character sequence even if the destination is a wide
- * string eclipses the benefits of buffering.
- */
-static int
-__sprint(FILE *fp, locale_t loc, struct __suio *uio)
-{
-       struct __siov *iov;
-       wchar_t *p;
-       int i, len;
-
-       iov = uio->uio_iov;
-       for (; uio->uio_resid != 0; uio->uio_resid -= len, iov++) {
-               p = (wchar_t *)iov->iov_base;
-               len = iov->iov_len;
-               for (i = 0; i < len; i++) {
-                       if (__xfputwc(p[i], fp, loc) == WEOF)
-                               return (-1);
-               }
-       }
-       uio->uio_iovcnt = 0;
-       return (0);
-}
-
-/*
- * Helper function for `fprintf to unbuffered unix file': creates a
- * temporary buffer.  We only work on write-only files; this avoids
- * worries about ungetc buffers and so forth.
- */
-static int
-__sbprintf(FILE *fp, locale_t loc, const wchar_t *fmt, va_list ap)
-{
-       int ret;
-       FILE fake;
-       unsigned char buf[BUFSIZ];
-       struct __sFILEX ext;
-       fake._extra = &ext;
-       INITEXTRA(&fake);
-
-       /* XXX This is probably not needed. */
-       if (prepwrite(fp) != 0)
-               return (EOF);
-
-       /* copy the important variables */
-       fake._flags = fp->_flags & ~__SNBF;
-       fake._file = fp->_file;
-       fake._cookie = fp->_cookie;
-       fake._write = fp->_write;
-       fake._orientation = fp->_orientation;
-       fake._mbstate = fp->_mbstate;
-
-       /* set up the buffer */
-       fake._bf._base = fake._p = buf;
-       fake._bf._size = fake._w = sizeof(buf);
-       fake._lbfsize = 0;      /* not actually used, but Just In Case */
-
-       /* do the work, then copy any error status */
-       ret = __vfwprintf(&fake, loc, fmt, ap);
-       if (ret >= 0 && __fflush(&fake))
-               ret = WEOF;
-       if (fake._flags & __SERR)
-               fp->_flags |= __SERR;
-       return (ret);
-}
-
-/*
- * Like __fputwc, but handles fake string (__SSTR) files properly.
- * File must already be locked.
- */
-static wint_t
-__xfputwc(wchar_t wc, FILE *fp, locale_t loc)
-{
-       mbstate_t mbs;
-       char buf[MB_LEN_MAX];
-       struct __suio uio;
-       struct __siov iov;
-       size_t len;
-
-       if ((fp->_flags & __SSTR) == 0)
-               return (__fputwc(wc, fp, loc));
-
-       mbs = initial_mbs;
-       if ((len = wcrtomb_l(buf, wc, &mbs, loc)) == (size_t)-1) {
-               fp->_flags |= __SERR;
-               return (WEOF);
-       }
-       uio.uio_iov = &iov;
-       uio.uio_resid = len;
-       uio.uio_iovcnt = 1;
-       iov.iov_base = buf;
-       iov.iov_len = len;
-       return (__sfvwrite(fp, &uio) != EOF ? (wint_t)wc : WEOF);
-}
-
-/*
- * Convert a multibyte character string argument for the %s format to a wide
- * string representation. ``prec'' specifies the maximum number of bytes
- * to output. If ``prec'' is greater than or equal to zero, we can't assume
- * that the multibyte char. string ends in a null character.
- */
-static wchar_t *
-__mbsconv(char *mbsarg, int prec, locale_t loc)
-{
-       mbstate_t mbs;
-       wchar_t *convbuf, *wcp;
-       const char *p;
-       size_t insize, nchars, nconv = 0;
-       int mb_cur_max = MB_CUR_MAX_L(loc);
-
-       if (mbsarg == NULL)
-               return (NULL);
-
-       /*
-        * Supplied argument is a multibyte string; convert it to wide
-        * characters first.
-        */
-       if (prec >= 0) {
-               /*
-                * String is not guaranteed to be NUL-terminated. Find the
-                * number of characters to print.
-                */
-               p = mbsarg;
-               insize = nchars = nconv = 0;
-               mbs = initial_mbs;
-               while (nchars != (size_t)prec) {
-                       nconv = mbrlen_l(p, mb_cur_max, &mbs, loc);
-                       if (nconv == 0 || nconv == (size_t)-1 ||
-                           nconv == (size_t)-2)
-                               break;
-                       p += nconv;
-                       nchars++;
-                       insize += nconv;
-               }
-               if (nconv == (size_t)-1 || nconv == (size_t)-2)
-                       return (NULL);
-       } else {
-               insize = strlen(mbsarg);
-               nconv = 0;
-       }
-
-       /*
-        * Allocate buffer for the result and perform the conversion,
-        * converting at most `size' bytes of the input multibyte string to
-        * wide characters for printing.
-        */
-       convbuf = malloc((insize + 1) * sizeof(*convbuf));
-       if (convbuf == NULL)
-               return (NULL);
-       wcp = convbuf;
-       p = mbsarg;
-       mbs = initial_mbs;
-       while (insize != 0) {
-               nconv = mbrtowc_l(wcp, p, insize, &mbs, loc);
-               if (nconv == 0 || nconv == (size_t)-1 || nconv == (size_t)-2)
-                       break;
-               wcp++;
-               p += nconv;
-               insize -= nconv;
-       }
-       if (nconv == (size_t)-1 || nconv == (size_t)-2) {
-               free(convbuf);
-               return (NULL);
-       }
-       *wcp = L'\0';
-
-       return (convbuf);
-}
-
-/*
- * MT-safe version
- */
-int
-vfwprintf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt0, va_list ap)
-{
-       int ret;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       /* optimise fprintf(stderr) (and other unbuffered Unix files) */
-       if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
-           fp->_file >= 0)
-               ret = __sbprintf(fp, loc, fmt0, ap);
-       else
-               ret = __vfwprintf(fp, loc, fmt0, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-int
-vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, va_list ap)
-{
-       return vfwprintf_l(fp, __current_locale(), fmt0, ap);
-}
-
-/*
- * The size of the buffer we use as scratch space for integer
- * conversions, among other things.  We need enough space to
- * write a uintmax_t in octal (plus one byte).
- */
-#if UINTMAX_MAX <= UINT64_MAX
-#define        BUF     32
-#else
-#error "BUF must be large enough to format a uintmax_t"
-#endif
-
-/*
- * Non-MT-safe version
- */
-__private_extern__ int
-__vfwprintf(FILE *fp, locale_t loc, const wchar_t *fmt0, va_list ap)
-{
-       wchar_t *fmt;           /* format string */
-       wchar_t ch;             /* character from fmt */
-       int n, n2;              /* handy integer (short term usage) */
-       wchar_t *cp;            /* handy char pointer (short term usage) */
-       int flags;              /* flags as above */
-       int ret;                /* return value accumulator */
-       int width;              /* width from format (%8d), or 0 */
-       int prec;               /* precision from format; <0 for N/A */
-       wchar_t sign;           /* sign prefix (' ', '+', '-', or \0) */
-       struct grouping_state gs; /* thousands' grouping info */
-#ifndef NO_FLOATING_POINT
-       /*
-        * We can decompose the printed representation of floating
-        * point numbers into several parts, some of which may be empty:
-        *
-        * [+|-| ] [0x|0X] MMM . NNN [e|E|p|P] [+|-] ZZ
-        *    A       B     ---C---      D       E   F
-        *
-        * A:   'sign' holds this value if present; '\0' otherwise
-        * B:   ox[1] holds the 'x' or 'X'; '\0' if not hexadecimal
-        * C:   cp points to the string MMMNNN.  Leading and trailing
-        *      zeros are not in the string and must be added.
-        * D:   expchar holds this character; '\0' if no exponent, e.g. %f
-        * F:   at least two digits for decimal, at least one digit for hex
-        */
-       wchar_t decimal_point;  /* locale specific decimal point */
-       int signflag;           /* true if float is negative */
-       union {                 /* floating point arguments %[aAeEfFgG] */
-               double dbl;
-               long double ldbl;
-       } fparg;
-       int expt;               /* integer value of exponent */
-       char expchar;           /* exponent character: [eEpP\0] */
-       char *dtoaend;          /* pointer to end of converted digits */
-       int expsize;            /* character count for expstr */
-       int ndig;               /* actual number of digits returned by dtoa */
-       wchar_t expstr[MAXEXPDIG+2];    /* buffer for exponent string: e+ZZZ */
-       char *dtoaresult;       /* buffer allocated by dtoa */
-#endif
-#ifdef VECTORS
-       union arg vval;         /* Vector argument. */
-       wchar_t *pct;           /* Pointer to '%' at beginning of specifier. */
-       wchar_t vsep;           /* Vector separator character. */
-#endif
-       u_long  ulval;          /* integer arguments %[diouxX] */
-       uintmax_t ujval;        /* %j, %ll, %q, %t, %z integers */
-       int base;               /* base for [diouxX] conversion */
-       int dprec;              /* a copy of prec if [diouxX], 0 otherwise */
-       int realsz;             /* field size expanded by dprec, sign, etc */
-       int size;               /* size of converted field or string */
-       int prsize;             /* max size of printed field */
-       const char *xdigs;      /* digits for [xX] conversion */
-       struct io_state io;     /* I/O buffering state */
-       wchar_t buf[BUF];       /* buffer with space for digits of uintmax_t */
-       wchar_t ox[2];          /* space for 0x hex-prefix */
-       union arg *argtable;    /* args, built due to positional arg */
-       union arg statargtable [STATIC_ARG_TBL_SIZE];
-       int nextarg;            /* 1-based argument index */
-       va_list orgap;          /* original argument pointer */
-       wchar_t *convbuf;       /* multibyte to wide conversion result */
-
-       static const char xdigs_lower[16] = "0123456789abcdef";
-       static const char xdigs_upper[16] = "0123456789ABCDEF";
-
-       /* BEWARE, these `goto error' on error. */
-#define        PRINT(ptr, len) do {                    \
-       if (io_print(&io, (ptr), (len), loc))   \
-               goto error; \
-} while (0)
-#define        PAD(howmany, with) { \
-       if (io_pad(&io, (howmany), (with), loc)) \
-               goto error; \
-}
-#define        PRINTANDPAD(p, ep, len, with) { \
-       if (io_printandpad(&io, (p), (ep), (len), (with), loc)) \
-               goto error; \
-}
-#define        FLUSH() { \
-       if (io_flush(&io, loc)) \
-               goto error; \
-}
-
-       /*
-        * Get the argument indexed by nextarg.   If the argument table is
-        * built, use it to get the argument.  If its not, get the next
-        * argument (and arguments must be gotten sequentially).
-        */
-#define GETARG(type) \
-       ((argtable != NULL) ? *((type*)(&argtable[nextarg++])) : \
-           (nextarg++, va_arg(ap, type)))
-
-       /*
-        * To extend shorts properly, we need both signed and unsigned
-        * argument extraction methods.
-        */
-#define        SARG() \
-       (flags&LONGINT ? GETARG(long) : \
-           flags&SHORTINT ? (long)(short)GETARG(int) : \
-           flags&CHARINT ? (long)(signed char)GETARG(int) : \
-           (long)GETARG(int))
-#define        UARG() \
-       (flags&LONGINT ? GETARG(u_long) : \
-           flags&SHORTINT ? (u_long)(u_short)GETARG(int) : \
-           flags&CHARINT ? (u_long)(u_char)GETARG(int) : \
-           (u_long)GETARG(u_int))
-#define        INTMAX_SIZE     (INTMAXT|SIZET|PTRDIFFT|LLONGINT)
-#define SJARG() \
-       (flags&INTMAXT ? GETARG(intmax_t) : \
-           flags&SIZET ? (intmax_t)GETARG(ssize_t) : \
-           flags&PTRDIFFT ? (intmax_t)GETARG(ptrdiff_t) : \
-           (intmax_t)GETARG(long long))
-#define        UJARG() \
-       (flags&INTMAXT ? GETARG(uintmax_t) : \
-           flags&SIZET ? (uintmax_t)GETARG(size_t) : \
-           flags&PTRDIFFT ? (uintmax_t)(unsigned long)GETARG(ptrdiff_t) : \
-           (uintmax_t)GETARG(unsigned long long))
-
-       /*
-        * Get * arguments, including the form *nn$.  Preserve the nextarg
-        * that the argument can be gotten once the type is determined.
-        */
-#define GETASTER(val) \
-       n2 = 0; \
-       cp = fmt; \
-       while (is_digit(*cp)) { \
-               n2 = 10 * n2 + to_digit(*cp); \
-               cp++; \
-       } \
-       if (*cp == '$') { \
-               int hold = nextarg; \
-               if (argtable == NULL) { \
-                       argtable = statargtable; \
-                       if (__find_warguments (fmt0, orgap, &argtable)) { \
-                               ret = EOF; \
-                               goto error; \
-                       } \
-               } \
-               nextarg = n2; \
-               val = GETARG (int); \
-               nextarg = hold; \
-               fmt = ++cp; \
-       } else { \
-               val = GETARG (int); \
-       }
-
-
-       /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */
-       if (prepwrite(fp) != 0) {
-               errno = EBADF;
-               return (EOF);
-       }
-       ORIENT(fp, 1);
-
-       convbuf = NULL;
-       fmt = (wchar_t *)fmt0;
-       argtable = NULL;
-       nextarg = 1;
-       va_copy(orgap, ap);
-       io_init(&io, fp);
-       ret = 0;
-#ifndef NO_FLOATING_POINT
-       decimal_point = get_decpt(loc);
-#endif
-
-       /*
-        * Scan the format for conversions (`%' character).
-        */
-       for (;;) {
-               for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++)
-                       /* void */;
-               if ((n = fmt - cp) != 0) {
-                       if ((unsigned)ret + n > INT_MAX) {
-                               ret = EOF;
-                               goto error;
-                       }
-                       PRINT(cp, n);
-                       ret += n;
-               }
-               if (ch == '\0')
-                       goto done;
-#ifdef VECTORS
-               pct = fmt;
-#endif /* VECTORS */
-               fmt++;          /* skip over '%' */
-
-               flags = 0;
-               dprec = 0;
-               width = 0;
-               prec = -1;
-               gs.grouping = NULL;
-               sign = '\0';
-               ox[1] = '\0';
-#ifdef VECTORS
-               vsep = 'X'; /* Illegal value, changed to defaults later. */
-#endif /* VECTORS */
-
-rflag:         ch = *fmt++;
-reswitch:      switch (ch) {
-               case ' ':
-                       /*-
-                        * ``If the space and + flags both appear, the space
-                        * flag will be ignored.''
-                        *      -- ANSI X3J11
-                        */
-                       if (!sign)
-                               sign = ' ';
-                       goto rflag;
-               case '#':
-                       flags |= ALT;
-                       goto rflag;
-#ifdef VECTORS
-               case ',': case ';': case ':': case '_':
-                       vsep = ch;
-                       goto rflag;
-#endif /* VECTORS */
-               case '*':
-                       /*-
-                        * ``A negative field width argument is taken as a
-                        * - flag followed by a positive field width.''
-                        *      -- ANSI X3J11
-                        * They don't exclude field widths read from args.
-                        */
-                       GETASTER (width);
-                       if (width >= 0)
-                               goto rflag;
-                       width = -width;
-                       /* FALLTHROUGH */
-               case '-':
-                       flags |= LADJUST;
-                       goto rflag;
-               case '+':
-                       sign = '+';
-                       goto rflag;
-               case '\'':
-                       flags |= GROUPING;
-                       goto rflag;
-               case '.':
-                       if ((ch = *fmt++) == '*') {
-                               GETASTER (prec);
-                               goto rflag;
-                       }
-                       prec = 0;
-                       while (is_digit(ch)) {
-                               prec = 10 * prec + to_digit(ch);
-                               ch = *fmt++;
-                       }
-                       goto reswitch;
-               case '0':
-                       /*-
-                        * ``Note that 0 is taken as a flag, not as the
-                        * beginning of a field width.''
-                        *      -- ANSI X3J11
-                        */
-                       flags |= ZEROPAD;
-                       goto rflag;
-               case '1': case '2': case '3': case '4':
-               case '5': case '6': case '7': case '8': case '9':
-                       n = 0;
-                       do {
-                               n = 10 * n + to_digit(ch);
-                               ch = *fmt++;
-                       } while (is_digit(ch));
-                       if (ch == '$') {
-                               nextarg = n;
-                               if (argtable == NULL) {
-                                       argtable = statargtable;
-                                       if (__find_warguments (fmt0, orgap,
-                                                              &argtable)) {
-                                               ret = EOF;
-                                               goto error;
-                                       }
-                               }
-                               goto rflag;
-                       }
-                       width = n;
-                       goto reswitch;
-#ifndef NO_FLOATING_POINT
-               case 'L':
-                       flags |= LONGDBL;
-                       goto rflag;
-#endif
-               case 'h':
-                       if (flags & SHORTINT) {
-                               flags &= ~SHORTINT;
-                               flags |= CHARINT;
-                       } else
-                               flags |= SHORTINT;
-                       goto rflag;
-               case 'j':
-                       flags |= INTMAXT;
-                       goto rflag;
-               case 'l':
-                       if (flags & LONGINT) {
-                               flags &= ~LONGINT;
-                               flags |= LLONGINT;
-                       } else
-                               flags |= LONGINT;
-                       goto rflag;
-               case 'q':
-                       flags |= LLONGINT;      /* not necessarily */
-                       goto rflag;
-               case 't':
-                       flags |= PTRDIFFT;
-                       goto rflag;
-               case 'z':
-                       flags |= SIZET;
-                       goto rflag;
-               case 'C':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'c':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & LONGINT)
-                               *(cp = buf) = (wchar_t)GETARG(wint_t);
-                       else
-                               *(cp = buf) = (wchar_t)btowc_l(GETARG(int), loc);
-                       size = 1;
-                       sign = '\0';
-                       break;
-               case 'D':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'd':
-               case 'i':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE) {
-                               ujval = SJARG();
-                               if ((intmax_t)ujval < 0) {
-                                       ujval = -ujval;
-                                       sign = '-';
-                               }
-                       } else {
-                               ulval = SARG();
-                               if ((long)ulval < 0) {
-                                       ulval = -ulval;
-                                       sign = '-';
-                               }
-                       }
-                       base = 10;
-                       goto number;
-#ifndef NO_FLOATING_POINT
-               case 'a':
-               case 'A':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       if (ch == 'a') {
-                               ox[1] = 'x';
-                               xdigs = xdigs_lower;
-                               expchar = 'p';
-                       } else {
-                               ox[1] = 'X';
-                               xdigs = xdigs_upper;
-                               expchar = 'P';
-                       }
-                       if (prec >= 0)
-                               prec++;
-#ifdef LDBL_COMPAT
-                       fparg.dbl = GETARG(double);
-                       dtoaresult =
-                           __hdtoa(fparg.dbl, xdigs, prec,
-                               &expt, &signflag, &dtoaend);
-#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult =
-                                   __hldtoa(fparg.ldbl, xdigs, prec,
-                                       &expt, &signflag, &dtoaend);
-                       } else {
-                               fparg.dbl = GETARG(double);
-                               dtoaresult =
-                                   __hdtoa(fparg.dbl, xdigs, prec,
-                                       &expt, &signflag, &dtoaend);
-                       }
-#endif /* LDBL_COMPAT */
-                       if (prec < 0)
-                               prec = dtoaend - dtoaresult;
-                       if (expt == INT_MAX)
-                               ox[1] = '\0';
-                       if (convbuf != NULL)
-                               free(convbuf);
-                       ndig = dtoaend - dtoaresult;
-                       cp = convbuf = __mbsconv(dtoaresult, -1, loc);
-                       freedtoa(dtoaresult);
-                       goto fp_common;
-               case 'e':
-               case 'E':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       expchar = ch;
-                       if (prec < 0)   /* account for digit before decpt */
-                               prec = DEFPREC + 1;
-                       else
-                               prec++;
-                       goto fp_begin;
-               case 'f':
-               case 'F':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       expchar = '\0';
-                       goto fp_begin;
-               case 'g':
-               case 'G':
-#ifdef VECTORS
-                       if (flags & VECTOR) {
-                               flags |= FPT;
-                               break;
-                       }
-#endif /* VECTORS */
-                       expchar = ch - ('g' - 'e');
-                       if (prec == 0)
-                               prec = 1;
-fp_begin:
-                       if (prec < 0)
-                               prec = DEFPREC;
-                       if (convbuf != NULL)
-                               free(convbuf);
-#ifdef LDBL_COMPAT
-                       fparg.dbl = GETARG(double);
-                       dtoaresult =
-                           dtoa(fparg.dbl, expchar ? 2 : 3, prec,
-                           &expt, &signflag, &dtoaend);
-                       if (expt == 9999)
-                               expt = INT_MAX;
-#else /* !LDBL_COMPAT */
-                       if (flags & LONGDBL) {
-                               fparg.ldbl = GETARG(long double);
-                               dtoaresult =
-                                   __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec,
-                                   &expt, &signflag, &dtoaend);
-                       } else {
-                               fparg.dbl = GETARG(double);
-                               dtoaresult =
-                                   dtoa(fparg.dbl, expchar ? 2 : 3, prec,
-                                   &expt, &signflag, &dtoaend);
-                               if (expt == 9999)
-                                       expt = INT_MAX;
-                       }
-#endif /* LDBL_COMPAT */
-                       ndig = dtoaend - dtoaresult;
-                       cp = convbuf = __mbsconv(dtoaresult, -1, loc);
-                       freedtoa(dtoaresult);
-fp_common:
-                       if (signflag)
-                               sign = '-';
-                       if (expt == INT_MAX) {  /* inf or nan */
-                               if (*cp == 'N') {
-                                       cp = (ch >= 'a') ? L"nan" : L"NAN";
-                                       sign = '\0';
-                               } else
-                                       cp = (ch >= 'a') ? L"inf" : L"INF";
-                               size = 3;
-                               flags &= ~ZEROPAD;
-                               break;
-                       }
-                       flags |= FPT;
-                       if (ch == 'g' || ch == 'G') {
-                               if (expt > -4 && expt <= prec) {
-                                       /* Make %[gG] smell like %[fF] */
-                                       expchar = '\0';
-                                       if (flags & ALT)
-                                               prec -= expt;
-                                       else
-                                               prec = ndig - expt;
-                                       if (prec < 0)
-                                               prec = 0;
-                               } else {
-                                       /*
-                                        * Make %[gG] smell like %[eE], but
-                                        * trim trailing zeroes if no # flag.
-                                        */
-                                       if (!(flags & ALT))
-                                               prec = ndig;
-                               }
-                       }
-                       if (expchar) {
-                               expsize = exponent(expstr, expt - 1, expchar);
-                               size = expsize + prec;
-                               if (prec > 1 || flags & ALT)
-                                       ++size;
-                       } else {
-                               /* space for digits before decimal point */
-                               if (expt > 0)
-                                       size = expt;
-                               else    /* "0" */
-                                       size = 1;
-                               /* space for decimal pt and following digits */
-                               if (prec || flags & ALT)
-                                       size += prec + 1;
-                               if ((flags & GROUPING) && expt > 0)
-                                       size += grouping_init(&gs, expt, loc);
-                       }
-                       break;
-#endif /* !NO_FLOATING_POINT */
-               case 'n':
-               {
-                       /*
-                        * Assignment-like behavior is specified if the
-                        * value overflows or is otherwise unrepresentable.
-                        * C99 says to use `signed char' for %hhn conversions.
-                        */
-                       void *ptr = GETARG(void *);
-                       if (ptr == NULL)
-                               continue;
-                       else if (flags & LLONGINT)
-                               *(long long *)ptr = ret;
-                       else if (flags & SIZET)
-                               *(ssize_t *)ptr = (ssize_t)ret;
-                       else if (flags & PTRDIFFT)
-                               *(ptrdiff_t *)ptr = ret;
-                       else if (flags & INTMAXT)
-                               *(intmax_t *)ptr = ret;
-                       else if (flags & LONGINT)
-                               *(long *)ptr = ret;
-                       else if (flags & SHORTINT)
-                               *(short *)ptr = ret;
-                       else if (flags & CHARINT)
-                               *(signed char *)ptr = ret;
-                       else
-                               *(int *)ptr = ret;
-                       continue;       /* no output */
-               }
-               case 'O':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'o':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-                               ulval = UARG();
-                       base = 8;
-                       goto nosign;
-               case 'p':
-                       /*-
-                        * ``The argument shall be a pointer to void.  The
-                        * value of the pointer is converted to a sequence
-                        * of printable characters, in an implementation-
-                        * defined manner.''
-                        *      -- ANSI X3J11
-                        */
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       ujval = (uintmax_t)(uintptr_t)GETARG(void *);
-                       base = 16;
-                       xdigs = xdigs_lower;
-                       flags = flags | INTMAXT;
-                       ox[1] = 'x';
-                       goto nosign;
-               case 'S':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 's':
-                       if (flags & LONGINT) {
-                               if ((cp = GETARG(wchar_t *)) == NULL)
-                                       cp = L"(null)";
-                       } else {
-                               char *mbp;
-
-                               if (convbuf != NULL)
-                                       free(convbuf);
-                               if ((mbp = GETARG(char *)) == NULL)
-                                       cp = L"(null)";
-                               else {
-                                       convbuf = __mbsconv(mbp, prec, loc);
-                                       if (convbuf == NULL) {
-                                               fp->_flags |= __SERR;
-                                               goto error;
-                                       }
-                                       cp = convbuf;
-                               }
-                       }
-#if 0 // wcsnlen needs API review first
-                       size = (prec >= 0) ? wcsnlen(cp, prec) : wcslen(cp);
-#else
-                       size = wcslen(cp);
-                       if(prec >= 0 && prec < size)
-                               size = prec;
-#endif
-                       sign = '\0';
-                       break;
-               case 'U':
-                       flags |= LONGINT;
-                       /*FALLTHROUGH*/
-               case 'u':
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-                               ulval = UARG();
-                       base = 10;
-                       goto nosign;
-               case 'X':
-                       xdigs = xdigs_upper;
-                       goto hex;
-               case 'x':
-                       xdigs = xdigs_lower;
-hex:
-#ifdef VECTORS
-                       if (flags & VECTOR)
-                               break;
-#endif /* VECTORS */
-                       if (flags & INTMAX_SIZE)
-                               ujval = UJARG();
-                       else
-                               ulval = UARG();
-                       base = 16;
-                       /* leading 0x/X only if non-zero */
-                       if (flags & ALT &&
-                           (flags & INTMAX_SIZE ? ujval != 0 : ulval != 0))
-                               ox[1] = ch;
-
-                       flags &= ~GROUPING;
-                       /* unsigned conversions */
-nosign:                        sign = '\0';
-                       /*-
-                        * ``... diouXx conversions ... if a precision is
-                        * specified, the 0 flag will be ignored.''
-                        *      -- ANSI X3J11
-                        * except for %#.0o and zero value
-                        */
-number:                        if ((dprec = prec) >= 0)
-                               flags &= ~ZEROPAD;
-
-                       /*-
-                        * ``The result of converting a zero value with an
-                        * explicit precision of zero is no characters.''
-                        *      -- ANSI X3J11
-                        *
-                        * ``The C Standard is clear enough as is.  The call
-                        * printf("%#.0o", 0) should print 0.''
-                        *      -- Defect Report #151
-                        */
-                       cp = buf + BUF;
-                       if (flags & INTMAX_SIZE) {
-                               if (ujval != 0 || prec != 0 ||
-                                   (flags & ALT && base == 8))
-                                       cp = __ujtoa(ujval, cp, base,
-                                           flags & ALT, xdigs);
-                       } else {
-                               if (ulval != 0 || prec != 0 ||
-                                   (flags & ALT && base == 8))
-                                       cp = __ultoa(ulval, cp, base,
-                                           flags & ALT, xdigs);
-                       }
-                       size = buf + BUF - cp;
-                       if (size > BUF) /* should never happen */
-                               LIBC_ABORT("size (%d) > BUF (%d)", size, BUF);
-                       if ((flags & GROUPING) && size != 0)
-                               size += grouping_init(&gs, size, loc);
-                       break;
-#ifdef VECTORS
-               case 'v':
-                       flags |= VECTOR;
-                       goto rflag;
-#endif /* VECTORS */
-               default:        /* "%?" prints ?, unless ? is NUL */
-                       if (ch == '\0')
-                               goto done;
-                       /* pretend it was %c with argument ch */
-                       cp = buf;
-                       *cp = ch;
-                       size = 1;
-                       sign = '\0';
-                       break;
-               }
-
-#ifdef VECTORS
-               if (flags & VECTOR) {
-                       /*
-                        * Do the minimum amount of work necessary to construct
-                        * a format specifier that can be used to recursively
-                        * call vfprintf() for each element in the vector.
-                        */
-                       int i, j;       /* Counter. */
-                       int vcnt;       /* Number of elements in vector. */
-                       char *vfmt;     /* Pointer to format specifier. */
-#define EXTRAHH 2
-                       char vfmt_buf[32 + EXTRAHH]; /* Static buffer for format spec. */
-                       int vwidth = 0; /* Width specified via '*'. */
-                       int vprec = 0;  /* Precision specified via '*'. */
-                       char *vstr;     /* Used for asprintf(). */
-                       int vlen;       /* Length returned by asprintf(). */
-                       enum {
-                           V_CHAR, V_SHORT, V_INT,
-                           V_PCHAR, V_PSHORT, V_PINT,
-                           V_FLOAT,
-#ifdef V64TYPE
-                           V_LONGLONG, V_PLONGLONG,
-                           V_DOUBLE,
-#endif /* V64TYPE */
-                       } vtype;
-
-                       vval.vectorarg = GETARG(VECTORTYPE);
-                       /*
-                        * Set vfmt.  If vfmt_buf may not be big enough,
-                        * malloc() space, taking care to free it later.
-                        * (EXTRAHH is for possible extra "hh")
-                        */
-                       if (&fmt[-1] - pct + EXTRAHH < sizeof(vfmt_buf))
-                               vfmt = vfmt_buf;
-                       else
-                               vfmt = (char *)malloc(&fmt[-1] - pct + EXTRAHH + 1);
-
-                       /* Set the separator character, if not specified. */
-                       if (vsep == 'X') {
-                               if (ch == 'c')
-                                       vsep = '\0';
-                               else
-                                       vsep = ' ';
-                       }
-
-                       /* Create the format specifier. */
-                       for (i = j = 0; i < &fmt[-1] - pct; i++) {
-                               switch (pct[i]) {
-                               case ',': case ';': case ':': case '_':
-                               case 'v': case 'h': case 'l':
-                                       /* Ignore. */
-                                       break;
-                               case '*':
-                                       if (pct[i - 1] != '.')
-                                               vwidth = 1;
-                                       else
-                                               vprec = 1;
-                                       /* FALLTHROUGH */
-                               default:
-                                       vfmt[j++] = pct[i];
-                               }
-                       }
-               
-                       /*
-                        * Determine the number of elements in the vector and
-                        * finish up the format specifier.
-                        */
-                       if (flags & SHORTINT) {
-                               switch (ch) {
-                               case 'c':
-                                       vtype = V_SHORT;
-                                       break;
-                               case 'p':
-                                       vtype = V_PSHORT;
-                                       break;
-                               default:
-                                       vfmt[j++] = 'h';
-                                       vtype = V_SHORT;
-                                       break;
-                               }
-                               vcnt = 8;
-                       } else if (flags & LONGINT) {
-                               vcnt = 4;
-                               vtype = (ch == 'p') ? V_PINT : V_INT;
-#ifdef V64TYPE
-                       } else if (flags & LLONGINT) {
-                               switch (ch) {
-                               case 'a':
-                               case 'A':
-                               case 'e':
-                               case 'E':
-                               case 'f':
-                               case 'g':
-                               case 'G':
-                                       vcnt = 2;
-                                       vtype = V_DOUBLE;
-                                       break;
-                               case 'd':
-                               case 'i':
-                               case 'u':
-                               case 'o':
-                               case 'p':
-                               case 'x':
-                               case 'X':
-                                       vfmt[j++] = 'l';
-                                       vfmt[j++] = 'l';
-                                       vcnt = 2;
-                                       vtype = (ch == 'p') ? V_PLONGLONG : V_LONGLONG;
-                                       break;
-                               default:
-                                       /*
-                                        * The default case should never
-                                        * happen.
-                                        */
-                               case 'c':
-                                       vcnt = 16;
-                                       vtype = V_CHAR;
-                               }
-#endif /* V64TYPE */
-                       } else {
-                               switch (ch) {
-                               case 'a':
-                               case 'A':
-                               case 'e':
-                               case 'E':
-                               case 'f':
-                               case 'g':
-                               case 'G':
-                                       vcnt = 4;
-                                       vtype = V_FLOAT;
-                                       break;
-                               default:
-                                       /*
-                                        * The default case should never
-                                        * happen.
-                                        */
-                               case 'd':
-                               case 'i':
-                               case 'u':
-                               case 'o':
-                               case 'x':
-                               case 'X':
-                                       vfmt[j++] = 'h';
-                                       vfmt[j++] = 'h';
-                                       /* drop through */
-                               case 'p':
-                               case 'c':
-                                       vcnt = 16;
-                                       vtype = (ch == 'p') ? V_PCHAR : V_CHAR;
-                               }
-                       }
-                       vfmt[j++] = ch;
-                       vfmt[j++] = '\0';
-
-/* Get a vector element. */
-#ifdef V64TYPE
-#define VPRINT(type, ind, args...) do {                                        \
-       switch (type) {                                                 \
-       case V_CHAR:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_PCHAR:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_SHORT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_PSHORT:                                                  \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_INT:                                                     \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_PINT:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_LONGLONG:                                                \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vulonglongarg[ind]); \
-               break;                                                  \
-       case V_PLONGLONG:                                               \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vulonglongarg[ind]); \
-               break;                                                  \
-       case V_FLOAT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-               break;                                                  \
-       case V_DOUBLE:                                                  \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vdoublearg[ind]); \
-               break;                                                  \
-       }                                                               \
-       ret += vlen;                                                    \
-       PRINT(vstr, vlen);                                              \
-       free(vstr);                                                     \
-} while (0)
-#else /* !V64TYPE */
-#define VPRINT(type, ind, args...) do {                                        \
-       switch (type) {                                                 \
-       case V_CHAR:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_PCHAR:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuchararg[ind]); \
-               break;                                                  \
-       case V_SHORT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_PSHORT:                                                  \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vushortarg[ind]); \
-               break;                                                  \
-       case V_INT:                                                     \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_PINT:                                                    \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, (void *)(uintptr_t)vval.vuintarg[ind]); \
-               break;                                                  \
-       case V_FLOAT:                                                   \
-               vlen = asprintf_l(&vstr, loc, vfmt , ## args, vval.vfloatarg[ind]); \
-               break;                                                  \
-       }                                                               \
-       ret += vlen;                                                    \
-       PRINT(vstr, vlen);                                              \
-       free(vstr);                                                     \
-} while (0)
-#endif /* V64TYPE */
-
-                       /* Actually print. */
-                       if (vwidth == 0) {
-                               if (vprec == 0) {
-                                       /* First element. */
-                                       VPRINT(vtype, 0);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i);
-                                       }
-                               } else {
-                                       /* First element. */
-                                       VPRINT(vtype, 0, prec);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i, prec);
-                                       }
-                               }
-                       } else {
-                               if (vprec == 0) {
-                                       /* First element. */
-                                       VPRINT(vtype, 0, width);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i, width);
-                                       }
-                               } else {
-                                       /* First element. */
-                                       VPRINT(vtype, 0, width, prec);
-                                       for (i = 1; i < vcnt; i++) {
-                                               /* Separator. */
-                                               if(vsep)
-                                                       PRINT(&vsep, 1);
-
-                                               /* Element. */
-                                               VPRINT(vtype, i, width, prec);
-                                       }
-                               }
-                       }
-#undef VPRINT
-
-                       if (vfmt != vfmt_buf)
-                               free(vfmt);
-
-                       continue;
-               }
-#endif /* VECTORS */
-               /*
-                * All reasonable formats wind up here.  At this point, `cp'
-                * points to a string which (if not flags&LADJUST) should be
-                * padded out to `width' places.  If flags&ZEROPAD, it should
-                * first be prefixed by any sign or other prefix; otherwise,
-                * it should be blank padded before the prefix is emitted.
-                * After any left-hand padding and prefixing, emit zeroes
-                * required by a decimal [diouxX] precision, then print the
-                * string proper, then emit zeroes required by any leftover
-                * floating precision; finally, if LADJUST, pad with blanks.
-                *
-                * Compute actual size, so we know how much to pad.
-                * size excludes decimal prec; realsz includes it.
-                */
-               realsz = dprec > size ? dprec : size;
-               if (sign)
-                       realsz++;
-               if (ox[1])
-                       realsz += 2;
-
-               prsize = width > realsz ? width : realsz;
-               if ((unsigned)ret + prsize > INT_MAX) {
-                       ret = EOF;
-                       goto error;
-               }
-
-               /* right-adjusting blank padding */
-               if ((flags & (LADJUST|ZEROPAD)) == 0)
-                       PAD(width - realsz, blanks);
-
-               /* prefix */
-               if (sign)
-                       PRINT(&sign, 1);
-
-               if (ox[1]) {    /* ox[1] is either x, X, or \0 */
-                       ox[0] = '0';
-                       PRINT(ox, 2);
-               }
-
-               /* right-adjusting zero padding */
-               if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD)
-                       PAD(width - realsz, zeroes);
-
-               /* the string or number proper */
-#ifndef NO_FLOATING_POINT
-               if ((flags & FPT) == 0) {
-#endif
-                       /* leading zeroes from decimal precision */
-                       PAD(dprec - size, zeroes);
-                       if (gs.grouping) {
-                               if (grouping_print(&gs, &io, cp, buf+BUF, loc) < 0)
-                                       goto error;
-                       } else {
-                               PRINT(cp, size);
-                       }
-#ifndef NO_FLOATING_POINT
-               } else {        /* glue together f_p fragments */
-                       if (!expchar) { /* %[fF] or sufficiently short %[gG] */
-                               if (expt <= 0) {
-                                       PRINT(zeroes, 1);
-                                       if (prec || flags & ALT)
-                                               PRINT(&decimal_point, 1);
-                                       PAD(-expt, zeroes);
-                                       /* already handled initial 0's */
-                                       prec += expt;
-                               } else {
-                                       if (gs.grouping) {
-                                               n = grouping_print(&gs, &io,
-                                                   cp, convbuf + ndig, loc);
-                                               if (n < 0)
-                                                       goto error;
-                                               cp += n;
-                                       } else {
-                                               PRINTANDPAD(cp, convbuf + ndig,
-                                                   expt, zeroes);
-                                               cp += expt;
-                                       }
-                                       if (prec || flags & ALT)
-                                               PRINT(&decimal_point, 1);
-                               }
-                               PRINTANDPAD(cp, convbuf + ndig, prec, zeroes);
-                       } else {        /* %[eE] or sufficiently long %[gG] */
-                               if (prec > 1 || flags & ALT) {
-                                       buf[0] = *cp++;
-                                       buf[1] = decimal_point;
-                                       PRINT(buf, 2);
-                                       PRINT(cp, ndig-1);
-                                       PAD(prec - ndig, zeroes);
-                               } else  /* XeYYY */
-                                       PRINT(cp, 1);
-                               PRINT(expstr, expsize);
-                       }
-               }
-#endif
-               /* left-adjusting padding (always blank) */
-               if (flags & LADJUST)
-                       PAD(width - realsz, blanks);
-
-               /* finally, adjust ret */
-               ret += prsize;
-
-               FLUSH();        /* copy out the I/O vectors */
-       }
-done:
-       FLUSH();
-error:
-       va_end(orgap);
-       if (convbuf != NULL)
-               free(convbuf);
-       if (__sferror(fp))
-               ret = EOF;
-       if ((argtable != NULL) && (argtable != statargtable))
-               free (argtable);
-       return (ret);
-       /* NOTREACHED */
-}
diff --git a/stdio/vfwscanf-fbsd.c b/stdio/vfwscanf-fbsd.c
deleted file mode 100644 (file)
index bba07f2..0000000
+++ /dev/null
@@ -1,944 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfscanf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwscanf.c,v 1.17 2009/01/19 06:19:51 das Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <ctype.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "local.h"
-
-#ifndef NO_FLOATING_POINT
-#include <locale.h>
-#endif
-
-#define        BUF             513     /* Maximum length of numeric string. */
-
-/*
- * Flags used during conversion.
- */
-#define        LONG            0x01    /* l: long or double */
-#define        LONGDBL         0x02    /* L: long double */
-#define        SHORT           0x04    /* h: short */
-#define        SUPPRESS        0x08    /* *: suppress assignment */
-#define        POINTER         0x10    /* p: void * (as hex) */
-#define        NOSKIP          0x20    /* [ or c: do not skip blanks */
-#define        LONGLONG        0x400   /* ll: long long (+ deprecated q: quad) */
-#define        INTMAXT         0x800   /* j: intmax_t */
-#define        PTRDIFFT        0x1000  /* t: ptrdiff_t */
-#define        SIZET           0x2000  /* z: size_t */
-#define        SHORTSHORT      0x4000  /* hh: char */
-#define        UNSIGNED        0x8000  /* %[oupxX] conversions */
-
-/*
- * The following are used in integral conversions only:
- * SIGNOK, NDIGITS, PFXOK, and NZDIGITS
- */
-#define        SIGNOK          0x40    /* +/- is (still) legal */
-#define        NDIGITS         0x80    /* no digits detected */
-#define        PFXOK           0x100   /* 0x prefix is (still) legal */
-#define        NZDIGITS        0x200   /* no zero digits detected */
-#define        HAVESIGN        0x10000 /* sign detected */
-
-/*
- * Conversion types.
- */
-#define        CT_CHAR         0       /* %c conversion */
-#define        CT_CCL          1       /* %[...] conversion */
-#define        CT_STRING       2       /* %s conversion */
-#define        CT_INT          3       /* %[dioupxX] conversion */
-#define        CT_FLOAT        4       /* %[efgEFG] conversion */
-
-#ifndef NO_FLOATING_POINT
-static int parsefloat(FILE *, wchar_t **, size_t, locale_t loc);
-#endif
-
-#define        INCCL(_c)       \
-       (cclcompl ? (wmemchr(ccls, (_c), ccle - ccls) == NULL) : \
-       (wmemchr(ccls, (_c), ccle - ccls) != NULL))
-
-static const mbstate_t initial_mbs;
-
-/*
- * MT-safe version.
- */
-int
-vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
-{
-       int ret;
-
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       ret = __vfwscanf(fp, __current_locale(), fmt, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-int
-vfwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
-    va_list ap)
-{
-       int ret;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(fp);
-       ORIENT(fp, 1);
-       ret = __vfwscanf(fp, loc, fmt, ap);
-       FUNLOCKFILE(fp);
-       return (ret);
-}
-
-/*
- * Non-MT-safe version.
- */
-__private_extern__ int
-__vfwscanf(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
-    va_list ap)
-{
-       wint_t c;               /* character from format, or conversion */
-       size_t width;           /* field width, or 0 */
-       wchar_t *p;             /* points into all kinds of strings */
-       int n;                  /* handy integer */
-       int flags;              /* flags as defined above */
-       wchar_t *p0;            /* saves original value of p when necessary */
-       int nassigned;          /* number of fields assigned */
-       int nread;              /* number of characters consumed from fp */
-       int base;               /* base argument to conversion function */
-       wchar_t buf[BUF];       /* buffer for numeric conversions */
-       const wchar_t *ccls;    /* character class start */
-       const wchar_t *ccle;    /* character class end */
-       int cclcompl;           /* ccl is complemented? */
-       wint_t wi;              /* handy wint_t */
-       char *mbp;              /* multibyte string pointer for %c %s %[ */
-       size_t nconv;           /* number of bytes in mb. conversion */
-       char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */
-       int index;              /* for %index$ */
-       va_list ap_orig;        /* to reset ap to first argument */
-       mbstate_t mbs;
-       int mb_cur_max = MB_CUR_MAX_L(loc);
-
-       /* `basefix' is used to avoid `if' tests in the integer scanner */
-       static short basefix[17] =
-               { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
-
-       nassigned = 0;
-       nread = 0;
-       ccls = ccle = NULL;
-       va_copy(ap_orig, ap);
-       for (;;) {
-               c = *fmt++;
-               if (c == 0)
-                       return (nassigned);
-               if (iswspace_l(c, loc)) {
-                       while ((c = __fgetwc(fp, loc)) != WEOF &&
-                           iswspace_l(c, loc))
-                               ;
-                       if (c != WEOF)
-                               __ungetwc(c, fp, loc);
-                       continue;
-               }
-               if (c != '%') {
-                       if ((wi = __fgetwc(fp, loc)) == WEOF)
-                               goto input_failure;
-                       goto literal;
-               }
-               width = 0;
-               flags = 0;
-               /*
-                * switch on the format.  continue if done;
-                * break once format type is derived.
-                */
-again:         c = *fmt++;
-               switch (c) {
-               case '%':
-               /* Consume leading white space */
-                       for(;;) {
-                               if ((wi = __fgetwc(fp, loc)) == WEOF)
-                                       goto input_failure;
-                               if (!iswspace_l(wi, loc))
-                                       break;
-                               nread++;
-                       }
-literal:
-                       if (wi != c) {
-                               __ungetwc(wi, fp, loc);
-                               goto match_failure;
-                       }
-                       nread++;
-                       continue;
-
-               case '$':
-                       index = width;
-                       if (index < 1 || index > NL_ARGMAX || fmt[-3] != '%') {
-                               goto input_failure;
-                       }
-                       width = 0;
-                       va_end(ap);
-                       va_copy(ap, ap_orig); /* reset to %1$ */
-                       for (; index > 1; index--) {
-                               va_arg(ap, void*);
-                       }
-                       goto again;
-               case '*':
-                       flags |= SUPPRESS;
-                       goto again;
-               case 'j':
-                       flags |= INTMAXT;
-                       goto again;
-               case 'l':
-                       if (flags & LONG) {
-                               flags &= ~LONG;
-                               flags |= LONGLONG;
-                       } else
-                               flags |= LONG;
-                       goto again;
-               case 'q':
-                       flags |= LONGLONG;      /* not quite */
-                       goto again;
-               case 't':
-                       flags |= PTRDIFFT;
-                       goto again;
-               case 'z':
-                       flags |= SIZET;
-                       goto again;
-               case 'L':
-                       flags |= LONGDBL;
-                       goto again;
-               case 'h':
-                       if (flags & SHORT) {
-                               flags &= ~SHORT;
-                               flags |= SHORTSHORT;
-                       } else
-                               flags |= SHORT;
-                       goto again;
-
-               case '0': case '1': case '2': case '3': case '4':
-               case '5': case '6': case '7': case '8': case '9':
-                       width = width * 10 + c - '0';
-                       goto again;
-
-               /*
-                * Conversions.
-                */
-               case 'd':
-                       c = CT_INT;
-                       base = 10;
-                       break;
-
-               case 'i':
-                       c = CT_INT;
-                       base = 0;
-                       break;
-
-               case 'o':
-                       c = CT_INT;
-                       flags |= UNSIGNED;
-                       base = 8;
-                       break;
-
-               case 'u':
-                       c = CT_INT;
-                       flags |= UNSIGNED;
-                       base = 10;
-                       break;
-
-               case 'X':
-               case 'x':
-                       flags |= PFXOK; /* enable 0x prefixing */
-                       c = CT_INT;
-                       flags |= UNSIGNED;
-                       base = 16;
-                       break;
-
-#ifndef NO_FLOATING_POINT
-               case 'A': case 'E': case 'F': case 'G':
-               case 'a': case 'e': case 'f': case 'g':
-                       c = CT_FLOAT;
-                       break;
-#endif
-
-               case 'S':
-                       flags |= LONG;
-                       /* FALLTHROUGH */
-               case 's':
-                       c = CT_STRING;
-                       break;
-
-               case '[':
-                       ccls = fmt;
-                       if (*fmt == '^') {
-                               cclcompl = 1;
-                               fmt++;
-                       } else
-                               cclcompl = 0;
-                       if (*fmt == ']')
-                               fmt++;
-                       while (*fmt != '\0' && *fmt != ']')
-                               fmt++;
-                       ccle = fmt;
-                       fmt++;
-                       flags |= NOSKIP;
-                       c = CT_CCL;
-                       break;
-
-               case 'C':
-                       flags |= LONG;
-                       /* FALLTHROUGH */
-               case 'c':
-                       flags |= NOSKIP;
-                       c = CT_CHAR;
-                       break;
-
-               case 'p':       /* pointer format is like hex */
-                       flags |= POINTER | PFXOK;
-                       c = CT_INT;             /* assumes sizeof(uintmax_t) */
-                       flags |= UNSIGNED;      /*      >= sizeof(uintptr_t) */
-                       base = 16;
-                       break;
-
-               case 'n':
-               {
-                       void *ptr = va_arg(ap, void *);
-                       if ((ptr == NULL) || (flags & SUPPRESS))        /* ??? */
-                               continue;
-                       else if (flags & SHORTSHORT)
-                               *(char *)ptr = nread;
-                       else if (flags & SHORT)
-                               *(short *)ptr = nread;
-                       else if (flags & LONG)
-                               *(long *)ptr = nread;
-                       else if (flags & LONGLONG)
-                               *(long long *)ptr = nread;
-                       else if (flags & INTMAXT)
-                               *(intmax_t *)ptr = nread;
-                       else if (flags & SIZET)
-                               *(size_t *)ptr = nread;
-                       else if (flags & PTRDIFFT)
-                               *(ptrdiff_t *)ptr = nread;
-                       else
-                               *(int *)ptr = nread;
-                       continue;
-               }
-               default:
-                       goto match_failure;
-
-               /*
-                * Disgusting backwards compatibility hack.     XXX
-                */
-               case '\0':      /* compat */
-                       return (EOF);
-               }
-
-               /*
-                * Consume leading white space, except for formats
-                * that suppress this.
-                */
-               if ((flags & NOSKIP) == 0) {
-                       while ((wi = __fgetwc(fp, loc)) != WEOF && iswspace_l(wi, loc))
-                               nread++;
-                       if (wi == WEOF)
-                               goto input_failure;
-                       __ungetwc(wi, fp, loc);
-               }
-
-               /*
-                * Do the conversion.
-                */
-               switch (c) {
-
-               case CT_CHAR:
-                       /* scan arbitrary characters (sets NOSKIP) */
-                       if (width == 0)
-                               width = 1;
-                       if (flags & LONG) {
-                               if (!(flags & SUPPRESS))
-                                       p = va_arg(ap, wchar_t *);
-                               n = 0;
-                               while (width-- != 0 &&
-                                   (wi = __fgetwc(fp, loc)) != WEOF) {
-                                       if (!(flags & SUPPRESS))
-                                               *p++ = (wchar_t)wi;
-                                       n++;
-                               }
-                               if (n == 0)
-                                       goto input_failure;
-                               nread += n;
-                               if (!(flags & SUPPRESS))
-                                       nassigned++;
-                       } else {
-                               if (!(flags & SUPPRESS))
-                                       mbp = va_arg(ap, char *);
-                               n = 0;
-                               mbs = initial_mbs;
-                               while (width != 0 &&
-                                   (wi = __fgetwc(fp, loc)) != WEOF) {
-                                       if (width >= mb_cur_max &&
-                                           !(flags & SUPPRESS)) {
-                                               nconv = wcrtomb_l(mbp, wi, &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                       } else {
-                                               nconv = wcrtomb_l(mbbuf, wi,
-                                                   &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                               if (nconv > width) {
-                                                       __ungetwc(wi, fp, loc);
-                                                       break;
-                                               }
-                                               if (!(flags & SUPPRESS))
-                                                       memcpy(mbp, mbbuf,
-                                                           nconv);
-                                       }
-                                       if (!(flags & SUPPRESS))
-                                               mbp += nconv;
-                                       width -= nconv;
-                                       n++;
-                               }
-                               if (n == 0)
-                                       goto input_failure;
-                               nread += n;
-                               if (!(flags & SUPPRESS))
-                                       nassigned++;
-                       }
-                       break;
-
-               case CT_CCL:
-                       /* scan a (nonempty) character class (sets NOSKIP) */
-                       if (width == 0)
-                               width = (size_t)~0;     /* `infinity' */
-                       /* take only those things in the class */
-                       if ((flags & SUPPRESS) && (flags & LONG)) {
-                               n = 0;
-                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 && INCCL(wi))
-                                       n++;
-                               if (wi != WEOF)
-                                       __ungetwc(wi, fp, loc);
-                               if (n == 0)
-                                       goto match_failure;
-                       } else if (flags & LONG) {
-                               p0 = p = va_arg(ap, wchar_t *);
-                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 && INCCL(wi))
-                                       *p++ = (wchar_t)wi;
-                               if (wi != WEOF)
-                                       __ungetwc(wi, fp, loc);
-                               n = p - p0;
-                               if (n == 0)
-                                       goto match_failure;
-                               *p = 0;
-                               nassigned++;
-                       } else {
-                               if (!(flags & SUPPRESS))
-                                       mbp = va_arg(ap, char *);
-                               n = 0;
-                               mbs = initial_mbs;
-                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width != 0 && INCCL(wi)) {
-                                       if (width >= mb_cur_max &&
-                                          !(flags & SUPPRESS)) {
-                                               nconv = wcrtomb_l(mbp, wi, &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                       } else {
-                                               nconv = wcrtomb_l(mbbuf, wi,
-                                                   &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                               if (nconv > width)
-                                                       break;
-                                               if (!(flags & SUPPRESS))
-                                                       memcpy(mbp, mbbuf,
-                                                           nconv);
-                                       }
-                                       if (!(flags & SUPPRESS))
-                                               mbp += nconv;
-                                       width -= nconv;
-                                       n++;
-                               }
-                               if (wi != WEOF)
-                                       __ungetwc(wi, fp, loc);
-                               if (n == 0)
-                                       goto match_failure;
-                               if (!(flags & SUPPRESS)) {
-                                       *mbp = 0;
-                                       nassigned++;
-                               }
-                       }
-                       nread += n;
-                       break;
-
-               case CT_STRING:
-                       /* like CCL, but zero-length string OK, & no NOSKIP */
-                       if (width == 0)
-                               width = (size_t)~0;
-                       if ((flags & SUPPRESS) && (flags & LONG)) {
-                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 &&
-                                   !iswspace_l(wi, loc))
-                                       nread++;
-                               if (wi != WEOF)
-                                       __ungetwc(wi, fp, loc);
-                       } else if (flags & LONG) {
-                               p0 = p = va_arg(ap, wchar_t *);
-                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width-- != 0 &&
-                                   !iswspace_l(wi, loc)) {
-                                       *p++ = (wchar_t)wi;
-                                       nread++;
-                               }
-                               if (wi != WEOF)
-                                       __ungetwc(wi, fp, loc);
-                               *p = '\0';
-                               nassigned++;
-                       } else {
-                               if (!(flags & SUPPRESS))
-                                       mbp = va_arg(ap, char *);
-                               mbs = initial_mbs;
-                               while ((wi = __fgetwc(fp, loc)) != WEOF &&
-                                   width != 0 &&
-                                   !iswspace_l(wi, loc)) {
-                                       if (width >= mb_cur_max &&
-                                           !(flags & SUPPRESS)) {
-                                               nconv = wcrtomb_l(mbp, wi, &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                       } else {
-                                               nconv = wcrtomb_l(mbbuf, wi,
-                                                   &mbs, loc);
-                                               if (nconv == (size_t)-1)
-                                                       goto input_failure;
-                                               if (nconv > width)
-                                                       break;
-                                               if (!(flags & SUPPRESS))
-                                                       memcpy(mbp, mbbuf,
-                                                           nconv);
-                                       }
-                                       if (!(flags & SUPPRESS))
-                                               mbp += nconv;
-                                       width -= nconv;
-                                       nread++;
-                               }
-                               if (wi != WEOF)
-                                       __ungetwc(wi, fp, loc);
-                               if (!(flags & SUPPRESS)) {
-                                       *mbp = 0;
-                                       nassigned++;
-                               }
-                       }
-                       continue;
-
-               case CT_INT:
-                       /* scan an integer as if by the conversion function */
-                       if (width == 0 || width > sizeof(buf) /
-                           sizeof(*buf) - 1)
-                               width = sizeof(buf) / sizeof(*buf) - 1;
-                       flags |= SIGNOK | NDIGITS | NZDIGITS;
-                       for (p = buf; width; width--) {
-                               c = __fgetwc(fp, loc);
-                               /*
-                                * Switch on the character; `goto ok'
-                                * if we accept it as a part of number.
-                                */
-                               switch (c) {
-
-                               /*
-                                * The digit 0 is always legal, but is
-                                * special.  For %i conversions, if no
-                                * digits (zero or nonzero) have been
-                                * scanned (only signs), we will have
-                                * base==0.  In that case, we should set
-                                * it to 8 and enable 0x prefixing.
-                                * Also, if we have not scanned zero digits
-                                * before this, do not turn off prefixing
-                                * (someone else will turn it off if we
-                                * have scanned any nonzero digits).
-                                */
-                               case '0':
-                                       if (base == 0) {
-                                               base = 8;
-                                               flags |= PFXOK;
-                                       }
-                                       if (flags & NZDIGITS)
-                                           flags &= ~(SIGNOK|NZDIGITS|NDIGITS);
-                                       else
-                                           flags &= ~(SIGNOK|PFXOK|NDIGITS);
-                                       goto ok;
-
-                               /* 1 through 7 always legal */
-                               case '1': case '2': case '3':
-                               case '4': case '5': case '6': case '7':
-                                       base = basefix[base];
-                                       flags &= ~(SIGNOK | PFXOK | NDIGITS);
-                                       goto ok;
-
-                               /* digits 8 and 9 ok iff decimal or hex */
-                               case '8': case '9':
-                                       base = basefix[base];
-                                       if (base <= 8)
-                                               break;  /* not legal here */
-                                       flags &= ~(SIGNOK | PFXOK | NDIGITS);
-                                       goto ok;
-
-                               /* letters ok iff hex */
-                               case 'A': case 'B': case 'C':
-                               case 'D': case 'E': case 'F':
-                               case 'a': case 'b': case 'c':
-                               case 'd': case 'e': case 'f':
-                                       /* no need to fix base here */
-                                       if (base <= 10)
-                                               break;  /* not legal here */
-                                       flags &= ~(SIGNOK | PFXOK | NDIGITS);
-                                       goto ok;
-
-                               /* sign ok only as first character */
-                               case '+': case '-':
-                                       if (flags & SIGNOK) {
-                                               flags &= ~SIGNOK;
-                                               flags |= HAVESIGN;
-                                               goto ok;
-                                       }
-                                       break;
-                                       
-                               /*
-                                * x ok iff flag still set & 2nd char (or
-                                * 3rd char if we have a sign).
-                                */
-                               case 'x': case 'X':
-                                       if (flags & PFXOK && p ==
-                                           buf + 1 + !!(flags & HAVESIGN)) {
-                                               base = 16;      /* if %i */
-                                               flags &= ~PFXOK;
-                                               goto ok;
-                                       }
-                                       break;
-                               }
-
-                               /*
-                                * If we got here, c is not a legal character
-                                * for a number.  Stop accumulating digits.
-                                */
-                               if (c != WEOF)
-                                       __ungetwc(c, fp, loc);
-                               break;
-               ok:
-                               /*
-                                * c is legal: store it and look at the next.
-                                */
-                               *p++ = (wchar_t)c;
-                       }
-                       /*
-                        * If we had only a sign, it is no good; push
-                        * back the sign.  If the number ends in `x',
-                        * it was [sign] '0' 'x', so push back the x
-                        * and treat it as [sign] '0'.
-                        */
-                       if (flags & NDIGITS) {
-                               if (p > buf)
-                                       __ungetwc(*--p, fp, loc);
-                               goto match_failure;
-                       }
-                       c = p[-1];
-                       if (c == 'x' || c == 'X') {
-                               --p;
-                               __ungetwc(c, fp, loc);
-                       }
-                       if ((flags & SUPPRESS) == 0) {
-                               uintmax_t res;
-
-                               *p = 0;
-                               if ((flags & UNSIGNED) == 0)
-                                   res = wcstoimax_l(buf, NULL, base, loc);
-                               else
-                                   res = wcstoumax_l(buf, NULL, base, loc);
-                               if (flags & POINTER)
-                                       *va_arg(ap, void **) =
-                                                       (void *)(uintptr_t)res;
-                               else if (flags & SHORTSHORT)
-                                       *va_arg(ap, char *) = res;
-                               else if (flags & SHORT)
-                                       *va_arg(ap, short *) = res;
-                               else if (flags & LONG)
-                                       *va_arg(ap, long *) = res;
-                               else if (flags & LONGLONG)
-                                       *va_arg(ap, long long *) = res;
-                               else if (flags & INTMAXT)
-                                       *va_arg(ap, intmax_t *) = res;
-                               else if (flags & PTRDIFFT)
-                                       *va_arg(ap, ptrdiff_t *) = res;
-                               else if (flags & SIZET)
-                                       *va_arg(ap, size_t *) = res;
-                               else
-                                       *va_arg(ap, int *) = res;
-                               nassigned++;
-                       }
-                       nread += p - buf;
-                       break;
-
-#ifndef NO_FLOATING_POINT
-               case CT_FLOAT:
-               {
-                       wchar_t *pbuf;
-                       /* scan a floating point number as if by strtod */
-                       if ((width = parsefloat(fp, &pbuf, width, loc)) == 0)
-                               goto match_failure;
-                       if ((flags & SUPPRESS) == 0) {
-                               if (flags & LONGDBL) {
-                                       long double res = wcstold_l(pbuf, &p, loc);
-                                       *va_arg(ap, long double *) = res;
-                               } else if (flags & LONG) {
-                                       double res = wcstod_l(pbuf, &p, loc);
-                                       *va_arg(ap, double *) = res;
-                               } else {
-                                       float res = wcstof_l(pbuf, &p, loc);
-                                       *va_arg(ap, float *) = res;
-                               }
-                               nassigned++;
-                       }
-                       nread += width;
-                       break;
-               }
-#endif /* !NO_FLOATING_POINT */
-               }
-       }
-input_failure:
-       return (nassigned ? nassigned : EOF);
-match_failure:
-       return (nassigned);
-}
-
-#ifndef NO_FLOATING_POINT
-extern char *__parsefloat_buf(size_t s);  /* see vfscanf-fbsd.c */
-
-static int
-parsefloat(FILE *fp, wchar_t **buf, size_t width, locale_t loc)
-{
-       mbstate_t mbs;
-       size_t nconv;
-       wchar_t *commit, *p;
-       int infnanpos = 0;
-       enum {
-               S_START, S_GOTSIGN, S_INF, S_NAN, S_DONE, S_MAYBEHEX,
-               S_DIGITS, S_FRAC, S_EXP, S_EXPDIGITS
-       } state = S_START;
-       wchar_t c;
-       wchar_t decpt;
-       _Bool gotmantdig = 0, ishex = 0;
-       wchar_t *b;
-       wchar_t *e;
-       size_t s;
-
-       mbs = initial_mbs;
-
-       nconv = mbrtowc_l(&decpt, localeconv()->decimal_point, MB_CUR_MAX_L(loc), &mbs, loc);
-       if (nconv == (size_t)-1 || nconv == (size_t)-2)
-               decpt = '.';    /* failsafe */
-
-       s = (width == 0 ? BUF : (width + 1));
-       if ((b = (wchar_t *)__parsefloat_buf(s * sizeof(wchar_t))) == NULL) {
-               *buf = NULL;
-               return 0;
-       }
-       e = b + (s - 1);
-       /*
-        * We set commit = p whenever the string we have read so far
-        * constitutes a valid representation of a floating point
-        * number by itself.  At some point, the parse will complete
-        * or fail, and we will ungetc() back to the last commit point.
-        * To ensure that the file offset gets updated properly, it is
-        * always necessary to read at least one character that doesn't
-        * match; thus, we can't short-circuit "infinity" or "nan(...)".
-        */
-       commit = b - 1;
-       c = WEOF;
-       for (p = b; width == 0 || p < e; ) {
-               if ((c = __fgetwc(fp, loc)) == WEOF)
-                       break;
-reswitch:
-               switch (state) {
-               case S_START:
-                       state = S_GOTSIGN;
-                       if (c == '-' || c == '+')
-                               break;
-                       else
-                               goto reswitch;
-               case S_GOTSIGN:
-                       switch (c) {
-                       case '0':
-                               state = S_MAYBEHEX;
-                               commit = p;
-                               break;
-                       case 'I':
-                       case 'i':
-                               state = S_INF;
-                               break;
-                       case 'N':
-                       case 'n':
-                               state = S_NAN;
-                               break;
-                       default:
-                               state = S_DIGITS;
-                               goto reswitch;
-                       }
-                       break;
-               case S_INF:
-                       if (infnanpos > 6 ||
-                           (c != "nfinity"[infnanpos] &&
-                            c != "NFINITY"[infnanpos]))
-                               goto parsedone;
-                       if (infnanpos == 1 || infnanpos == 6)
-                               commit = p;     /* inf or infinity */
-                       infnanpos++;
-                       break;
-               case S_NAN:
-                       switch (infnanpos) {
-                       case 0:
-                               if (c != 'A' && c != 'a')
-                                       goto parsedone;
-                               break;
-                       case 1:
-                               if (c != 'N' && c != 'n')
-                                       goto parsedone;
-                               else
-                                       commit = p;
-                               break;
-                       case 2:
-                               if (c != '(')
-                                       goto parsedone;
-                               break;
-                       default:
-                               if (c == ')') {
-                                       commit = p;
-                                       state = S_DONE;
-                               } else if (!iswalnum_l(c, loc) && c != '_')
-                                       goto parsedone;
-                               break;
-                       }
-                       infnanpos++;
-                       break;
-               case S_DONE:
-                       goto parsedone;
-               case S_MAYBEHEX:
-                       state = S_DIGITS;
-                       if (c == 'X' || c == 'x') {
-                               ishex = 1;
-                               break;
-                       } else {        /* we saw a '0', but no 'x' */
-                               gotmantdig = 1;
-                               goto reswitch;
-                       }
-               case S_DIGITS:
-                       if ((ishex && iswxdigit_l(c, loc)) || iswdigit_l(c, loc))
-                               gotmantdig = 1;
-                       else {
-                               state = S_FRAC;
-                               if (c != decpt)
-                                       goto reswitch;
-                       }
-                       if (gotmantdig)
-                               commit = p;
-                       break;
-               case S_FRAC:
-                       if (((c == 'E' || c == 'e') && !ishex) ||
-                           ((c == 'P' || c == 'p') && ishex)) {
-                               if (!gotmantdig)
-                                       goto parsedone;
-                               else
-                                       state = S_EXP;
-                       } else if ((ishex && iswxdigit_l(c, loc)) || iswdigit_l(c, loc)) {
-                               commit = p;
-                               gotmantdig = 1;
-                       } else
-                               goto parsedone;
-                       break;
-               case S_EXP:
-                       state = S_EXPDIGITS;
-                       if (c == '-' || c == '+')
-                               break;
-                       else
-                               goto reswitch;
-               case S_EXPDIGITS:
-                       if (iswdigit_l(c, loc))
-                               commit = p;
-                       else
-                               goto parsedone;
-                       break;
-               default:
-                       LIBC_ABORT("unknown state %d", state);
-               }
-               if (p >= e) {
-                       ssize_t diff = (p - b);
-                       ssize_t com = (commit - b);
-                       s += BUF;
-                       b = (wchar_t *)__parsefloat_buf(s * sizeof(wchar_t));
-                       if (b == NULL) {
-                               *buf = NULL;
-                               return 0;
-                       }
-                       e = b + (s - 1);
-                       p = b + diff;
-                       commit = b + com;
-               }
-               *p++ = c;
-               c = WEOF;
-       }
-
-parsedone:
-       if (c != WEOF)
-               __ungetwc(c, fp, loc);
-       while (commit < --p)
-               __ungetwc(*p, fp, loc);
-       *++commit = '\0';
-       *buf = b;
-       return (commit - b);
-}
-#endif
diff --git a/stdio/vprintf-fbsd.c b/stdio/vprintf-fbsd.c
deleted file mode 100644 (file)
index 894cd79..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vprintf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vprintf.c,v 1.11 2007/01/09 00:28:08 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-
-int
-vprintf(const char * __restrict fmt, __va_list ap)
-{
-
-       return (vfprintf_l(stdout, __current_locale(), fmt, ap));
-}
-
-int
-vprintf_l(locale_t loc, const char * __restrict fmt, __va_list ap)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfprintf_l will */
-       return (vfprintf_l(stdout, loc, fmt, ap));
-}
diff --git a/stdio/vscanf-fbsd.c b/stdio/vscanf-fbsd.c
deleted file mode 100644 (file)
index 397382e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vscanf.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vscanf.c,v 1.13 2007/01/09 00:28:08 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <stdio.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "local.h"
-
-int
-vscanf(fmt, ap)
-       const char * __restrict fmt;
-       __va_list ap;
-{
-       int retval;
-
-       FLOCKFILE(stdin);
-       retval = __svfscanf_l(stdin, __current_locale(), fmt, ap);
-       FUNLOCKFILE(stdin);
-       return (retval);
-}
-
-int
-vscanf_l(loc, fmt, ap)
-       locale_t loc;
-       const char * __restrict fmt;
-       __va_list ap;
-{
-       int retval;
-
-       NORMALIZE_LOCALE(loc);
-       FLOCKFILE(stdin);
-       retval = __svfscanf_l(stdin, loc, fmt, ap);
-       FUNLOCKFILE(stdin);
-       return (retval);
-}
diff --git a/stdio/vsnprintf-fbsd.c b/stdio/vsnprintf-fbsd.c
deleted file mode 100644 (file)
index 5f9a295..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsnprintf.c        8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vsnprintf.c,v 1.24 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdio.h>
-#include "local.h"
-
-int
-vsnprintf_l(char * __restrict str, size_t n, locale_t loc, const char * __restrict fmt,
-    __va_list ap)
-{
-       size_t on;
-       int ret;
-       char dummy[2];
-       FILE f;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-
-       NORMALIZE_LOCALE(loc);
-       on = n;
-       if (n != 0)
-               n--;
-       if (n > INT_MAX)
-               n = INT_MAX;
-       /* Stdio internals do not deal correctly with zero length buffer */
-       if (n == 0) {
-               if (on > 0)
-                       *str = '\0';
-               str = dummy;
-               n = 1;
-       }
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = n;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, loc, fmt, ap);
-       if (on > 0)
-               *f._p = '\0';
-       return (ret);
-}
-
-int
-vsnprintf(char * __restrict str, size_t n, const char * __restrict fmt,
-    __va_list ap)
-{
-       return vsnprintf_l(str, n, __current_locale(), fmt, ap);
-}
diff --git a/stdio/vsprintf-fbsd.c b/stdio/vsprintf-fbsd.c
deleted file mode 100644 (file)
index 9b85352..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <limits.h>
-#include "local.h"
-
-int
-vsprintf_l(char * __restrict str, locale_t loc, const char * __restrict fmt, __va_list ap)
-{
-       int ret;
-       FILE f;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-
-       NORMALIZE_LOCALE(loc);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = INT_MAX;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfprintf(&f, loc, fmt, ap);
-       *f._p = 0;
-       return (ret);
-}
-
-int
-vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
-{
-       return vsprintf_l(str, __current_locale(), fmt, ap);
-}
diff --git a/stdio/vsscanf-fbsd.c b/stdio/vsscanf-fbsd.c
deleted file mode 100644 (file)
index 7144259..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsscanf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdio.h>
-#include <string.h>
-#include "local.h"
-
-static int
-eofread(void *, char *, int);
-
-/* ARGSUSED */
-static int
-eofread(cookie, buf, len)
-       void *cookie;
-       char *buf;
-       int len;
-{
-
-       return (0);
-}
-
-int
-vsscanf_l(str, loc, fmt, ap)
-       const char * __restrict str;
-       locale_t loc;
-       const char * __restrict fmt;
-       __va_list ap;
-{
-       FILE f;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-
-       f._file = -1;
-       f._flags = __SRD;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._r = strlen(str);
-       f._read = eofread;
-       f._ub._base = NULL;
-       f._lb._base = NULL;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       return (__svfscanf_l(&f, loc, fmt, ap));
-}
-
-int
-vsscanf(str, fmt, ap)
-       const char * __restrict str;
-       const char * __restrict fmt;
-       __va_list ap;
-{
-       return vsscanf_l(str, __current_locale(), fmt, ap);
-}
-
diff --git a/stdio/vswprintf-fbsd.c b/stdio/vswprintf-fbsd.c
deleted file mode 100644 (file)
index 4227e74..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*     $OpenBSD: vasprintf.c,v 1.4 1998/06/21 22:13:47 millert Exp $   */
-
-/*
- * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-__FBSDID("FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.16 2002/08/21 16:19:57 mike Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.7 2008/04/17 22:17:54 jhb Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "local.h"
-
-int
-vswprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
-    const wchar_t * __restrict fmt, __va_list ap)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       FILE f;
-       char *mbp;
-       int ret, sverrno;
-       size_t nwc;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-
-       NORMALIZE_LOCALE(loc);
-       if (n == 0) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       f._file = -1;
-       f._flags = __SWR | __SSTR | __SALC;
-       f._bf._base = f._p = (unsigned char *)malloc(128);
-       if (f._bf._base == NULL) {
-               errno = ENOMEM;
-               return (-1);
-       }
-       f._bf._size = f._w = 127;               /* Leave room for the NUL */
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       ret = __vfwprintf(&f, loc, fmt, ap);
-       if (ret < 0) {
-               sverrno = errno;
-               free(f._bf._base);
-               errno = sverrno;
-               return (-1);
-       }
-       *f._p = '\0';
-       mbp = f._bf._base;
-       /*
-        * XXX Undo the conversion from wide characters to multibyte that
-        * fputwc() did in __vfwprintf().
-        */
-       mbs = initial;
-       nwc = mbsrtowcs_l(s, (const char **)&mbp, n, &mbs, loc);
-       free(f._bf._base);
-       if (nwc == (size_t)-1) {
-               errno = EILSEQ;
-               return (-1);
-       }
-       if (nwc == n) {
-               s[n - 1] = L'\0';
-               errno = EOVERFLOW;
-               return (-1);
-       }
-
-       return (ret);
-}
-
-int
-vswprintf(wchar_t * __restrict s, size_t n,
-    const wchar_t * __restrict fmt, __va_list ap)
-{
-       return vswprintf_l(s, n, __current_locale(), fmt, ap);
-}
diff --git a/stdio/vswscanf-fbsd.c b/stdio/vswscanf-fbsd.c
deleted file mode 100644 (file)
index d688164..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsscanf.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.11 2002/08/21 16:19:57 mike Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vswscanf.c,v 1.6 2009/01/15 18:53:52 rdivacky Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "local.h"
-
-static int     eofread(void *, char *, int);
-
-static int
-eofread(void *cookie, char *buf, int len)
-{
-
-       return (0);
-}
-
-int
-vswscanf_l(const wchar_t * __restrict str, locale_t loc, const wchar_t * __restrict fmt,
-    va_list ap)
-{
-       static const mbstate_t initial;
-       mbstate_t mbs;
-       FILE f;
-       char *mbstr;
-       size_t mlen;
-       int r;
-       const wchar_t *strp;
-       struct __sFILEX ext;
-       f._extra = &ext;
-       INITEXTRA(&f);
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * XXX Convert the wide character string to multibyte, which
-        * __vfwscanf() will convert back to wide characters.
-        */
-       if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX_L(loc) + 1)) == NULL)
-               return (EOF);
-       mbs = initial;
-       strp = str;
-       if ((mlen = wcsrtombs_l(mbstr, &strp, SIZE_T_MAX, &mbs, loc)) == (size_t)-1) {
-               free(mbstr);
-               return (EOF);
-       }
-       f._file = -1;
-       f._flags = __SRD;
-       f._bf._base = f._p = (unsigned char *)mbstr;
-       f._bf._size = f._r = mlen;
-       f._read = eofread;
-       f._ub._base = NULL;
-       f._lb._base = NULL;
-       f._orientation = 0;
-       memset(&f._mbstate, 0, sizeof(mbstate_t));
-       r = __vfwscanf(&f, loc, fmt, ap);
-       free(mbstr);
-
-       return (r);
-}
-
-int
-vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt,
-    va_list ap)
-{
-       return vswscanf_l(str, __current_locale(), fmt, ap);
-}
-
diff --git a/stdio/vwprintf-fbsd.c b/stdio/vwprintf-fbsd.c
deleted file mode 100644 (file)
index 634f06d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-vwprintf(const wchar_t * __restrict fmt, va_list ap)
-{
-
-       return (vfwprintf_l(stdout, __current_locale(), fmt, ap));
-}
-
-int
-vwprintf_l(locale_t loc, const wchar_t * __restrict fmt, va_list ap)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
-       return (vfwprintf_l(stdout, loc, fmt, ap));
-}
diff --git a/stdio/vwscanf-fbsd.c b/stdio/vwscanf-fbsd.c
deleted file mode 100644 (file)
index 3b2fb28..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-vwscanf(const wchar_t * __restrict fmt, va_list ap)
-{
-
-       return (vfwscanf_l(stdin, __current_locale(), fmt, ap));
-}
-
-int
-vwscanf_l(locale_t loc, const wchar_t * __restrict fmt, va_list ap)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
-       return (vfwscanf_l(stdin, loc, fmt, ap));
-}
diff --git a/stdio/wbuf-fbsd.c b/stdio/wbuf-fbsd.c
deleted file mode 100644 (file)
index 9e9b59e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)wbuf.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/wbuf.c,v 1.12 2007/01/09 00:28:08 imp Exp $");
-
-#include <stdio.h>
-#include <errno.h>
-#include "local.h"
-
-/*
- * Write the given character into the (probably full) buffer for
- * the given file.  Flush the buffer out if it is or becomes full,
- * or if c=='\n' and the file is line buffered.
- *
- * Non-MT-safe
- */
-int
-__swbuf(c, fp)
-       int c;
-       FILE *fp;
-{
-       int n;
-
-       /*
-        * In case we cannot write, or longjmp takes us out early,
-        * make sure _w is 0 (if fully- or un-buffered) or -_bf._size
-        * (if line buffered) so that we will get called again.
-        * If we did not do this, a sufficient number of putc()
-        * calls might wrap _w from negative to positive.
-        */
-       fp->_w = fp->_lbfsize;
-       if (prepwrite(fp) != 0) {
-               errno = EBADF;
-               return (EOF);
-       }
-       c = (unsigned char)c;
-
-       ORIENT(fp, -1);
-
-       /*
-        * If it is completely full, flush it out.  Then, in any case,
-        * stuff c into the buffer.  If this causes the buffer to fill
-        * completely, or if c is '\n' and the file is line buffered,
-        * flush it (perhaps a second time).  The second flush will always
-        * happen on unbuffered streams, where _bf._size==1; fflush()
-        * guarantees that putc() will always call wbuf() by setting _w
-        * to 0, so we need not do anything else.
-        */
-       n = fp->_p - fp->_bf._base;
-       if (n >= fp->_bf._size) {
-               if (__fflush(fp))
-                       return (EOF);
-               n = 0;
-       }
-       fp->_w--;
-       *fp->_p++ = c;
-       if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n'))
-               if (__fflush(fp))
-                       return (EOF);
-       return (c);
-}
diff --git a/stdio/wprintf-fbsd.c b/stdio/wprintf-fbsd.c
deleted file mode 100644 (file)
index 42deed0..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/wprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-wprintf(const wchar_t * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vfwprintf_l(stdout, __current_locale(), fmt, ap);
-       va_end(ap);
-
-       return (ret);
-}
-
-int
-wprintf_l(locale_t loc, const wchar_t * __restrict fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfwprintf_l will */
-       va_start(ap, fmt);
-       ret = vfwprintf_l(stdout, loc, fmt, ap);
-       va_end(ap);
-
-       return (ret);
-}
diff --git a/stdio/wprintf.3 b/stdio/wprintf.3
deleted file mode 100644 (file)
index d1c3498..0000000
+++ /dev/null
@@ -1,655 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)printf.3   8.1 (Berkeley) 6/4/93
-.\" FreeBSD: src/lib/libc/stdio/printf.3,v 1.47 2002/09/06 11:23:55 tjr Exp
-.\" $FreeBSD: src/lib/libc/stdio/wprintf.3,v 1.6 2007/01/09 00:28:08 imp Exp $
-.\"
-.Dd July 5, 2003
-.Dt WPRINTF 3
-.Os
-.Sh NAME
-.Nm fwprintf ,
-.Nm swprintf ,
-.Nm vfwprintf ,
-.Nm vswprintf ,
-.Nm vwprintf ,
-.Nm wprintf
-.Nd formatted wide character output conversion
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft int
-.Fo fwprintf
-.Fa "FILE *restrict stream"
-.Fa "const wchar_t *restrict format"
-.Fa ...
-.Fc
-.Ft int
-.Fo swprintf
-.Fa "wchar_t *restrict ws"
-.Fa "size_t n"
-.Fa "const wchar_t *restrict format"
-.Fa ...
-.Fc
-.Ft int
-.Fo wprintf
-.Fa "const wchar_t *restrict format"
-.Fa ...
-.Fc
-.In stdarg.h
-.In stdio.h
-.In wchar.h
-.Ft int
-.Fo vfwprintf
-.Fa "FILE *restrict stream"
-.Fa "const wchar_t *restrict format"
-.Fa "va_list arg"
-.Fc
-.Ft int
-.Fo vswprintf
-.Fa "wchar_t *restrict ws"
-.Fa "size_t n"
-.Fa "const wchar_t *restrict format"
-.Fa "va_list arg"
-.Fc
-.Ft int
-.Fo vwprintf
-.Fa "const wchar_t *restrict format"
-.Fa "va_list arg"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wprintf
-family of functions produces output according to a
-.Fa format ,
-as described below.
-The
-.Fn wprintf
-and
-.Fn vwprintf
-functions
-write output to
-.Dv stdout ,
-the standard output stream;
-.Fn fwprintf
-and
-.Fn vfwprintf
-write output to the given output
-.Fa stream ;
-.Fn swprintf
-and
-.Fn vswprintf
-write to the wide character string
-.Fa ws .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr wprintf_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Pp
-These functions write the output under the control of a
-.Fa format
-string that specifies how subsequent arguments
-(or arguments accessed via the variable-length argument facilities of
-.Xr stdarg 3 )
-are converted for output.
-.Pp
-These functions return the number of characters printed
-(not including the trailing
-.Ql \e0 ,
-used to end output to strings).
-.Pp
-The
-.Fn swprintf
-and
-.Fn vswprintf
-functions will fail if
-.Fa n
-or more wide characters were requested to be written,
-.Pp
-The format string is composed of zero or more directives:
-ordinary
-characters (not
-.Cm % ) ,
-which are copied unchanged to the output stream;
-and conversion specifications, each of which results
-in fetching zero or more subsequent arguments.
-Each conversion specification is introduced by
-the
-.Cm %
-character.
-The arguments must correspond properly (after type promotion)
-with the conversion specifier.
-After the
-.Cm % ,
-the following appear in sequence:
-.Bl -bullet
-.It
-An optional field, consisting of a decimal digit string followed by a
-.Cm $ ,
-specifying the next argument to access.
-If this field is not provided, the argument following the last
-argument accessed will be used.
-Arguments are numbered starting at
-.Cm 1 .
-If unaccessed arguments in the format string are interspersed with ones that
-are accessed the results will be indeterminate.
-.It
-Zero or more of the following flags:
-.Bl -tag -width ".So \  Sc (space)"
-.It Sq Cm #
-The value should be converted to an
-.Dq alternate form .
-For
-.Cm c , d , i , n , p , s ,
-and
-.Cm u
-conversions, this option has no effect.
-For
-.Cm o
-conversions, the precision of the number is increased to force the first
-character of the output string to a zero (except if a zero value is printed
-with an explicit precision of zero).
-For
-.Cm x
-and
-.Cm X
-conversions, a non-zero result has the string
-.Ql 0x
-(or
-.Ql 0X
-for
-.Cm X
-conversions) prepended to it.
-For
-.Cm a , A , e , E , f , F , g ,
-and
-.Cm G
-conversions, the result will always contain a decimal point, even if no
-digits follow it (normally, a decimal point appears in the results of
-those conversions only if a digit follows).
-For
-.Cm g
-and
-.Cm G
-conversions, trailing zeros are not removed from the result as they
-would otherwise be.
-.It So Cm 0 Sc (zero)
-Zero padding.
-For all conversions except
-.Cm n ,
-the converted value is padded on the left with zeros rather than blanks.
-If a precision is given with a numeric conversion
-.Cm ( d , i , o , u , i , x ,
-and
-.Cm X ) ,
-the
-.Cm 0
-flag is ignored.
-.It Sq Cm \-
-A negative field width flag;
-the converted value is to be left adjusted on the field boundary.
-Except for
-.Cm n
-conversions, the converted value is padded on the right with blanks,
-rather than on the left with blanks or zeros.
-A
-.Cm \-
-overrides a
-.Cm 0
-if both are given.
-.It So "\ " Sc (space)
-A blank should be left before a positive number
-produced by a signed conversion
-.Cm ( a , A , d , e , E , f , F , g , G ,
-or
-.Cm i ) .
-.It Sq Cm +
-A sign must always be placed before a
-number produced by a signed conversion.
-A
-.Cm +
-overrides a space if both are used.
-.It Sq Cm '
-Decimal conversions
-.Cm ( d , u ,
-or
-.Cm i )
-or the integral portion of a floating point conversion
-.Cm ( f
-or
-.Cm F )
-should be grouped and separated by thousands using
-the non-monetary separator returned by
-.Xr localeconv 3 .
-.El
-.It
-An optional decimal digit string specifying a minimum field width.
-If the converted value has fewer characters than the field width, it will
-be padded with spaces on the left (or right, if the left-adjustment
-flag has been given) to fill out
-the field width.
-.It
-An optional precision, in the form of a period
-.Cm \&.
-followed by an
-optional digit string.
-If the digit string is omitted, the precision is taken as zero.
-This gives the minimum number of digits to appear for
-.Cm d , i , o , u , x ,
-and
-.Cm X
-conversions, the number of digits to appear after the decimal-point for
-.Cm a , A , e , E , f ,
-and
-.Cm F
-conversions, the maximum number of significant digits for
-.Cm g
-and
-.Cm G
-conversions, or the maximum number of characters to be printed from a
-string for
-.Cm s
-conversions.
-.It
-An optional length modifier, that specifies the size of the argument.
-The following length modifiers are valid for the
-.Cm d , i , n , o , u , x ,
-or
-.Cm X
-conversion:
-.Bl -column ".Cm q Em (deprecated)" ".Vt signed char" ".Vt unsigned long long" ".Vt long long *"
-.It Sy Modifier Ta Cm d , i Ta Cm o , u , x , X Ta Cm n
-.It Cm hh Ta Vt "signed char" Ta Vt "unsigned char" Ta Vt "signed char *"
-.It Cm h Ta Vt short Ta Vt "unsigned short" Ta Vt "short *"
-.It Cm l No (ell) Ta Vt long Ta Vt "unsigned long" Ta Vt "long *"
-.It Cm ll No (ell ell) Ta Vt "long long" Ta Vt "unsigned long long" Ta Vt "long long *"
-.It Cm j Ta Vt intmax_t Ta Vt uintmax_t Ta Vt "intmax_t *"
-.It Cm t Ta Vt ptrdiff_t Ta (see note) Ta Vt "ptrdiff_t *"
-.It Cm z Ta (see note) Ta Vt size_t Ta (see note)
-.It Cm q Em (deprecated) Ta Vt quad_t Ta Vt u_quad_t Ta Vt "quad_t *"
-.El
-.Pp
-Note:
-the
-.Cm t
-modifier, when applied to a
-.Cm o , u , x ,
-or
-.Cm X
-conversion, indicates that the argument is of an unsigned type
-equivalent in size to a
-.Vt ptrdiff_t .
-The
-.Cm z
-modifier, when applied to a
-.Cm d
-or
-.Cm i
-conversion, indicates that the argument is of a signed type equivalent in
-size to a
-.Vt size_t .
-Similarly, when applied to an
-.Cm n
-conversion, it indicates that the argument is a pointer to a signed type
-equivalent in size to a
-.Vt size_t .
-.Pp
-The following length modifier is valid for the
-.Cm a , A , e , E , f , F , g ,
-or
-.Cm G
-conversion:
-.Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G"
-.It Sy Modifier Ta Cm a , A , e , E , f , F , g , G
-.It Cm L Ta Vt "long double"
-.El
-.Pp
-The following length modifier is valid for the
-.Cm c
-or
-.Cm s
-conversion:
-.Bl -column ".Sy Modifier" ".Vt wint_t" ".Vt wchar_t *"
-.It Sy Modifier Ta Cm c Ta Cm s
-.It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *"
-.El
-.It
-A character that specifies the type of conversion to be applied.
-.El
-.Pp
-A field width or precision, or both, may be indicated by
-an asterisk
-.Ql *
-or an asterisk followed by one or more decimal digits and a
-.Ql $
-instead of a
-digit string.
-In this case, an
-.Vt int
-argument supplies the field width or precision.
-A negative field width is treated as a left adjustment flag followed by a
-positive field width; a negative precision is treated as though it were
-missing.
-If a single format directive mixes positional
-.Pq Li nn$
-and non-positional arguments, the results are undefined.
-.Pp
-The conversion specifiers and their meanings are:
-.Bl -tag -width ".Cm diouxX"
-.It Cm diouxX
-The
-.Vt int
-(or appropriate variant) argument is converted to signed decimal
-.Cm ( d
-and
-.Cm i ) ,
-unsigned octal
-.Pq Cm o ,
-unsigned decimal
-.Pq Cm u ,
-or unsigned hexadecimal
-.Cm ( x
-and
-.Cm X )
-notation.
-The letters
-.Dq Li abcdef
-are used for
-.Cm x
-conversions; the letters
-.Dq Li ABCDEF
-are used for
-.Cm X
-conversions.
-The precision, if any, gives the minimum number of digits that must
-appear; if the converted value requires fewer digits, it is padded on
-the left with zeros.
-.It Cm DOU
-The
-.Vt "long int"
-argument is converted to signed decimal, unsigned octal, or unsigned
-decimal, as if the format had been
-.Cm ld , lo ,
-or
-.Cm lu
-respectively.
-These conversion characters are deprecated, and will eventually disappear.
-.It Cm eE
-The
-.Vt double
-argument is rounded and converted in the style
-.Sm off
-.Oo \- Oc Ar d Li \&. Ar ddd Li e \\*[Pm] Ar dd
-.Sm on
-where there is one digit before the
-decimal-point character
-and the number of digits after it is equal to the precision;
-if the precision is missing,
-it is taken as 6; if the precision is
-zero, no decimal-point character appears.
-An
-.Cm E
-conversion uses the letter
-.Ql E
-(rather than
-.Ql e )
-to introduce the exponent.
-The exponent always contains at least two digits; if the value is zero,
-the exponent is 00.
-.Pp
-For
-.Cm a , A , e , E , f , F , g ,
-and
-.Cm G
-conversions, positive and negative infinity are represented as
-.Li inf
-and
-.Li -inf
-respectively when using the lowercase conversion character, and
-.Li INF
-and
-.Li -INF
-respectively when using the uppercase conversion character.
-Similarly, NaN is represented as
-.Li nan
-when using the lowercase conversion, and
-.Li NAN
-when using the uppercase conversion.
-.It Cm fF
-The
-.Vt double
-argument is rounded and converted to decimal notation in the style
-.Sm off
-.Oo \- Oc Ar ddd Li \&. Ar ddd ,
-.Sm on
-where the number of digits after the decimal-point character
-is equal to the precision specification.
-If the precision is missing, it is taken as 6; if the precision is
-explicitly zero, no decimal-point character appears.
-If a decimal point appears, at least one digit appears before it.
-.It Cm gG
-The
-.Vt double
-argument is converted in style
-.Cm f
-or
-.Cm e
-(or
-.Cm F
-or
-.Cm E
-for
-.Cm G
-conversions).
-The precision specifies the number of significant digits.
-If the precision is missing, 6 digits are given; if the precision is zero,
-it is treated as 1.
-Style
-.Cm e
-is used if the exponent from its conversion is less than \-4 or greater than
-or equal to the precision.
-Trailing zeros are removed from the fractional part of the result; a
-decimal point appears only if it is followed by at least one digit.
-.It Cm aA
-The
-.Vt double
-argument is converted to hexadecimal notation in the style
-.Sm off
-.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d ,
-.Sm on
-where the number of digits after the hexadecimal-point character
-is equal to the precision specification.
-If the precision is missing, it is taken as enough to exactly
-represent the floating-point number; if the precision is
-explicitly zero, no hexadecimal-point character appears.
-This is an exact conversion of the mantissa+exponent internal
-floating point representation; the
-.Sm off
-.Oo \- Oc Li 0x Ar h Li \&. Ar hhh
-.Sm on
-portion represents exactly the mantissa; only denormalized
-mantissas have a zero value to the left of the hexadecimal
-point.
-The
-.Cm p
-is a literal character
-.Ql p ;
-the exponent is preceded by a positive or negative sign
-and is represented in decimal, using only enough characters
-to represent the exponent.
-The
-.Cm A
-conversion uses the prefix
-.Dq Li 0X
-(rather than
-.Dq Li 0x ) ,
-the letters
-.Dq Li ABCDEF
-(rather than
-.Dq Li abcdef )
-to represent the hex digits, and the letter
-.Ql P
-(rather than
-.Ql p )
-to separate the mantissa and exponent.
-.It Cm C
-Treated as
-.Cm c
-with the
-.Cm l
-(ell) modifier.
-.It Cm c
-The
-.Vt int
-argument is converted to an
-.Vt "unsigned char" ,
-then to a
-.Vt wchar_t
-as if by
-.Xr btowc 3 ,
-and the resulting character is written.
-.Pp
-If the
-.Cm l
-(ell) modifier is used, the
-.Vt wint_t
-argument is converted to a
-.Vt wchar_t
-and written.
-.It Cm S
-Treated as
-.Cm s
-with the
-.Cm l
-(ell) modifier.
-.It Cm s
-The
-.Vt "char *"
-argument is expected to be a pointer to an array of character type (pointer
-to a string) containing a multibyte sequence.
-Characters from the array are converted to wide characters and written up to
-(but not including)
-a terminating
-.Dv NUL
-character;
-if a precision is specified, no more than the number specified are
-written.
-If a precision is given, no null character
-need be present; if the precision is not specified, or is greater than
-the size of the array, the array must contain a terminating
-.Dv NUL
-character.
-.Pp
-If the
-.Cm l
-(ell) modifier is used, the
-.Vt "wchar_t *"
-argument is expected to be a pointer to an array of wide characters
-(pointer to a wide string).
-Each wide character in the string
-is written.
-Wide characters from the array are written up to (but not including)
-a terminating wide
-.Dv NUL
-character;
-if a precision is specified, no more than the number specified are
-written (including shift sequences).
-If a precision is given, no null character
-need be present; if the precision is not specified, or is greater than
-the number of characters in
-the string, the array must contain a terminating wide
-.Dv NUL
-character.
-.It Cm p
-The
-.Vt "void *"
-pointer argument is printed in hexadecimal (as if by
-.Ql %#x
-or
-.Ql %#lx ) .
-.It Cm n
-The number of characters written so far is stored into the
-integer indicated by the
-.Vt "int *"
-(or variant) pointer argument.
-No argument is converted.
-.It Cm %
-A
-.Ql %
-is written.
-No argument is converted.
-The complete conversion specification
-is
-.Ql %% .
-.El
-.Pp
-The decimal point
-character is defined in the program's locale (category
-.Dv LC_NUMERIC ) .
-.Pp
-In no case does a non-existent or small field width cause truncation of
-a numeric field; if the result of a conversion is wider than the field
-width, the
-field is expanded to contain the conversion result.
-.Sh SECURITY CONSIDERATIONS
-Refer to
-.Xr printf 3 .
-.Sh SEE ALSO
-.Xr btowc 3 ,
-.Xr fputws 3 ,
-.Xr printf 3 ,
-.Xr putwc 3 ,
-.Xr setlocale 3 ,
-.Xr wcsrtombs 3 ,
-.Xr wprintf_l 3 ,
-.Xr wscanf 3
-.Sh STANDARDS
-Subject to the caveats noted in the
-.Sx BUGS
-section
-of
-.Xr printf 3 ,
-the
-.Fn wprintf ,
-.Fn fwprintf ,
-.Fn swprintf ,
-.Fn vwprintf ,
-.Fn vfwprintf ,
-and
-.Fn vswprintf
-functions
-conform to
-.St -isoC-99 .
diff --git a/stdio/wscanf-fbsd.c b/stdio/wscanf-fbsd.c
deleted file mode 100644 (file)
index 99dc48d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/wscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-wscanf(const wchar_t * __restrict fmt, ...)
-{
-       va_list ap;
-       int r;
-
-       va_start(ap, fmt);
-       r = vfwscanf_l(stdin, __current_locale(), fmt, ap);
-       va_end(ap);
-
-       return (r);
-}
-
-int
-wscanf_l(locale_t loc, const wchar_t * __restrict fmt, ...)
-{
-       va_list ap;
-       int r;
-
-       /* no need to call NORMALIZE_LOCALE(loc) because vfwscanf_l will */
-       va_start(ap, fmt);
-       r = vfwscanf_l(stdin, loc, fmt, ap);
-       va_end(ap);
-
-       return (r);
-}
diff --git a/stdio/wscanf.3 b/stdio/wscanf.3
deleted file mode 100644 (file)
index 54fa5d6..0000000
+++ /dev/null
@@ -1,509 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)scanf.3    8.2 (Berkeley) 12/11/93
-.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
-.\" $FreeBSD: src/lib/libc/stdio/wscanf.3,v 1.7 2007/01/09 00:28:08 imp Exp $
-.\"
-.Dd July 5, 2003
-.Dt WSCANF 3
-.Os
-.Sh NAME
-.Nm fwscanf ,
-.Nm swscanf ,
-.Nm vfwscanf ,
-.Nm vswscanf ,
-.Nm vwscanf ,
-.Nm wscanf
-.Nd wide character input format conversion
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.In wchar.h
-.Ft int
-.Fo fwscanf
-.Fa "FILE *restrict stream"
-.Fa "const wchar_t *restrict format"
-.Fa ...
-.Fc
-.Ft int
-.Fo swscanf
-.Fa "const wchar_t *restrict ws"
-.Fa "const wchar_t *restrict format"
-.Fa ...
-.Fc
-.Ft int
-.Fo wscanf
-.Fa "const wchar_t *restrict format"
-.Fa ...
-.Fc
-.In stdarg.h
-.In stdio.h
-.In wchar.h
-.Ft int
-.Fo vfwscanf
-.Fa "FILE *restrict stream"
-.Fa "const wchar_t *restrict format"
-.Fa "va_list arg"
-.Fc
-.Ft int
-.Fo vswscanf
-.Fa "const wchar_t *restrict ws"
-.Fa "const wchar_t *restrict format"
-.Fa "va_list arg"
-.Fc
-.Ft int
-.Fo vwscanf
-.Fa "const wchar_t *restrict format"
-.Fa "va_list arg"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wscanf
-family of functions scans input, according to a
-.Fa format
-as described below.
-This format may contain
-.Em conversion specifiers ;
-the results from such conversions, if any,
-are stored through the
-.Em pointer
-arguments.
-The
-.Fn wscanf
-function
-reads input from the standard input stream
-.Dv stdin ,
-.Fn fwscanf
-reads input from the stream pointer
-.Fa stream ,
-and
-.Fn swscanf
-reads its input from the wide character string pointed to by
-.Fa ws .
-.Pp
-The
-.Fn vfwscanf
-function
-is analogous to
-.Xr vfwprintf 3
-and reads input from the stream pointer
-.Fa stream
-using a variable argument list of pointers (see
-.Xr stdarg 3 ) .
-The
-.Fn vwscanf
-function scans a variable argument list from the standard input and
-the
-.Fn vswscanf
-function scans it from a wide character string;
-these are analogous to
-the
-.Fn vwprintf
-and
-.Fn vswprintf
-functions respectively.
-Each successive
-.Em pointer
-argument must correspond properly with
-each successive conversion specifier
-(but see the
-.Cm *
-conversion below).
-All conversions are introduced by the
-.Cm %
-(percent sign) character.
-.Pp
-The
-.Fa format
-string
-may also contain other characters.
-White space (such as blanks, tabs, or newlines) in the
-.Fa format
-string match any amount of white space, including none, in the input.
-Everything else
-matches only itself.
-Scanning stops
-when an input character does not match such a format character.
-Scanning also stops
-when an input conversion cannot be made (see below).
-.Pp
-Extended locale versions of these functions are documented in
-.Xr wscanf_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh CONVERSIONS
-Following the
-.Cm %
-character introducing a conversion,
-there may be a number of
-.Em flag
-characters, as follows:
-.Bl -tag -width ".Cm l No (ell)"
-.It Cm *
-Suppresses assignment.
-The conversion that follows occurs as usual, but no pointer is used;
-the result of the conversion is simply discarded.
-.It Cm hh
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt char
-(rather than
-.Vt int ) .
-.It Cm h
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "short int"
-(rather than
-.Vt int ) .
-.It Cm l No (ell)
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "long int"
-(rather than
-.Vt int ) ,
-that the conversion will be one of
-.Cm a , e , f ,
-or
-.Cm g
-and the next pointer is a pointer to
-.Vt double
-(rather than
-.Vt float ) ,
-or that the conversion will be one of
-.Cm c
-or
-.Cm s
-and the next pointer is a pointer to an array of
-.Vt wchar_t
-(rather than
-.Vt char ) .
-.It Cm ll No (ell ell)
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "long long int"
-(rather than
-.Vt int ) .
-.It Cm L
-Indicates that the conversion will be one of
-.Cm a , e , f ,
-or
-.Cm g
-and the next pointer is a pointer to
-.Vt "long double" .
-.It Cm j
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt intmax_t
-(rather than
-.Vt int ) .
-.It Cm t
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt ptrdiff_t
-(rather than
-.Vt int ) .
-.It Cm z
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt size_t
-(rather than
-.Vt int ) .
-.It Cm q
-(deprecated.)
-Indicates that the conversion will be one of
-.Cm dioux
-or
-.Cm n
-and the next pointer is a pointer to a
-.Vt "long long int"
-(rather than
-.Vt int ) .
-.El
-.Pp
-In addition to these flags,
-there may be an optional maximum field width,
-expressed as a decimal integer,
-between the
-.Cm %
-and the conversion.
-If no width is given,
-a default of
-.Dq infinity
-is used (with one exception, below);
-otherwise at most this many characters are scanned
-in processing the conversion.
-Before conversion begins,
-most conversions skip white space;
-this white space is not counted against the field width.
-.Pp
-The following conversions are available:
-.Bl -tag -width XXXX
-.It Cm %
-Matches a literal
-.Ql % .
-That is,
-.Dq Li %%
-in the format string
-matches a single input
-.Ql %
-character.
-No conversion is done, and assignment does not occur.
-.It Cm d
-Matches an optionally signed decimal integer;
-the next pointer must be a pointer to
-.Vt int .
-.It Cm i
-Matches an optionally signed integer;
-the next pointer must be a pointer to
-.Vt int .
-The integer is read in base 16 if it begins
-with
-.Ql 0x
-or
-.Ql 0X ,
-in base 8 if it begins with
-.Ql 0 ,
-and in base 10 otherwise.
-Only characters that correspond to the base are used.
-.It Cm o
-Matches an octal integer;
-the next pointer must be a pointer to
-.Vt "unsigned int" .
-.It Cm u
-Matches an optionally signed decimal integer;
-the next pointer must be a pointer to
-.Vt "unsigned int" .
-.It Cm x , X
-Matches an optionally signed hexadecimal integer;
-the next pointer must be a pointer to
-.Vt "unsigned int" .
-.It Cm a , A , e , E , f , F , g , G
-Matches a floating-point number in the style of
-.Xr wcstod 3 .
-The next pointer must be a pointer to
-.Vt float
-(unless
-.Cm l
-or
-.Cm L
-is specified.)
-.It Cm s
-Matches a sequence of non-white-space wide characters;
-the next pointer must be a pointer to
-.Vt char ,
-and the array must be large enough to accept the multibyte representation
-of all the sequence and the
-terminating
-.Dv NUL
-character.
-The input string stops at white space
-or at the maximum field width, whichever occurs first.
-.Pp
-If an
-.Cm l
-qualifier is present, the next pointer must be a pointer to
-.Vt wchar_t ,
-into which the input will be placed.
-.It Cm S
-The same as
-.Cm ls .
-.It Cm c
-Matches a sequence of
-.Em width
-count
-wide characters (default 1);
-the next pointer must be a pointer to
-.Vt char ,
-and there must be enough room for the multibyte representation
-of all the characters
-(no terminating
-.Dv NUL
-is added).
-The usual skip of leading white space is suppressed.
-To skip white space first, use an explicit space in the format.
-.Pp
-If an
-.Cm l
-qualifier is present, the next pointer must be a pointer to
-.Vt wchar_t ,
-into which the input will be placed.
-.It Cm C
-The same as
-.Cm lc .
-.It Cm \&[
-Matches a nonempty sequence of characters from the specified set
-of accepted characters;
-the next pointer must be a pointer to
-.Vt char ,
-and there must be enough room for the multibyte representation of
-all the characters in the string,
-plus a terminating
-.Dv NUL
-character.
-The usual skip of leading white space is suppressed.
-The string is to be made up of characters in
-(or not in)
-a particular set;
-the set is defined by the characters between the open bracket
-.Cm [
-character
-and a close bracket
-.Cm ]
-character.
-The set
-.Em excludes
-those characters
-if the first character after the open bracket is a circumflex
-.Cm ^ .
-To include a close bracket in the set,
-make it the first character after the open bracket
-or the circumflex;
-any other position will end the set.
-To include a hyphen in the set,
-make it the last character before the final close bracket;
-some implementations of
-.Fn wscanf
-use
-.Dq Li A-Z
-to represent the range of characters between
-.Ql A
-and
-.Ql Z .
-The string ends with the appearance of a character not in the
-(or, with a circumflex, in) set
-or when the field width runs out.
-.Pp
-If an
-.Cm l
-qualifier is present, the next pointer must be a pointer to
-.Vt wchar_t ,
-into which the input will be placed.
-.It Cm p
-Matches a pointer value (as printed by
-.Ql %p
-in
-.Xr wprintf 3 ) ;
-the next pointer must be a pointer to
-.Vt void .
-.It Cm n
-Nothing is expected;
-instead, the number of characters consumed thus far from the input
-is stored through the next pointer,
-which must be a pointer to
-.Vt int .
-This is
-.Em not
-a conversion, although it can be suppressed with the
-.Cm *
-flag.
-.El
-.Pp
-The decimal point
-character is defined in the program's locale (category
-.Dv LC_NUMERIC ) .
-.Pp
-For backwards compatibility, a
-.Dq conversion
-of
-.Ql %\e0
-causes an immediate return of
-.Dv EOF .
-.Sh RETURN VALUES
-These functions return the number of input items assigned,
-which can be fewer than provided for, or even zero,
-in the event of a matching failure.
-Zero indicates that, while there was input available,
-no conversions were assigned;
-typically, this is due to an invalid input character,
-such as an alphabetic character for a
-.Ql %d
-conversion.
-The value
-.Dv EOF
-is returned if an input failure occurs before any conversion such as an
-end-of-file occurs.
-If an error or end-of-file occurs after conversion
-has begun,
-the number of conversions which were successfully completed is returned.
-.Sh SEE ALSO
-.Xr fgetwc 3 ,
-.Xr scanf 3 ,
-.Xr wcrtomb 3 ,
-.Xr wcstod 3 ,
-.Xr wcstol 3 ,
-.Xr wcstoul 3 ,
-.Xr wprintf 3 ,
-.Xr wscanf_l 3
-.Sh STANDARDS
-The
-.Fn fwscanf ,
-.Fn wscanf ,
-.Fn swscanf ,
-.Fn vfwscanf ,
-.Fn vwscanf ,
-and
-.Fn vswscanf
-functions
-conform to
-.St -isoC-99 .
-.Sh BUGS
-In addition to the bugs documented in
-.Xr scanf 3 ,
-.Fn wscanf
-does not support the
-.Dq Li A-Z
-notation for specifying character ranges with the character
-class conversion
-.Pq Sq Cm %[ .
diff --git a/stdio/wsetup-fbsd.c b/stdio/wsetup-fbsd.c
deleted file mode 120000 (symlink)
index 4f613d3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wsetup.c
\ No newline at end of file
index c283b31b5a0174f99305d339255e0398065aab32..80ed972b25abc3fe34976582d018176cc511fac4 100644 (file)
@@ -58,6 +58,13 @@ The
 .Fn abort
 function is thread-safe.
 It is unknown if it is async-cancel-safe.
+.Pp
+The
+.Fn abort
+function causes a report to be generated by Crash Reporter.  If you wish to
+terminate without generating a crash report, use
+.Xr exit 3
+instead.
 .Sh RETURN VALUES
 The
 .Fn abort
diff --git a/stdlib/FreeBSD/abort.3.patch b/stdlib/FreeBSD/abort.3.patch
deleted file mode 100644 (file)
index af99681..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---- abort.3.orig       2010-02-22 12:52:54.000000000 -0800
-+++ abort.3    2010-02-22 12:56:29.000000000 -0800
-@@ -58,6 +58,13 @@ The
- .Fn abort
- function is thread-safe.
- It is unknown if it is async-cancel-safe.
-+.Pp
-+The
-+.Fn abort
-+function causes a report to be generated by Crash Reporter.  If you wish to
-+terminate without generating a crash report, use
-+.Xr exit 3
-+instead.
- .Sh RETURN VALUES
- The
- .Fn abort
index 50e34b00916c59f2520a11a044cfe5519189d2d9..0fcbb9e5f794a7673aa93d80a8dac55f5f2df0ad 100644 (file)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.11 2007/01/09 00:28:09 imp E
 
 #include "namespace.h"
 #include <signal.h>
+#include <stdarg.h>
 #include <stdlib.h>
 #include <stddef.h>
 #include <unistd.h>
@@ -43,11 +44,22 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.11 2007/01/09 00:28:09 imp E
 
 #include "libc_private.h"
 
+#include "CrashReporterClient.h"
+#include "_simple.h"
+
+extern void (*__cleanup)();
+extern void __abort(void) __dead2;
+
+#define TIMEOUT        10000   /* 10 milliseconds */
+
 void
 abort()
 {
        struct sigaction act;
 
+       if (!CRGetCrashLogMessage())
+               CRSetCrashLogMessage("abort() called");
+
        /*
         * POSIX requires we flush stdio buffers on abort.
         * XXX ISO C requires that abort() be async-signal-safe.
@@ -61,19 +73,90 @@ abort()
         * any errors -- ISO C doesn't allow abort to return anyway.
         */
        sigdelset(&act.sa_mask, SIGABRT);
-       (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-       (void)raise(SIGABRT);
+
+       /* <rdar://problem/7397932> abort() should call pthread_kill to deliver a signal to the aborting thread 
+        * This helps gdb focus on the thread calling abort()
+        */
+       if (__is_threaded) {
+           /* Block all signals on all other threads */
+           sigset_t fullmask;
+           sigfillset(&fullmask);
+           (void)_sigprocmask(SIG_SETMASK, &fullmask, NULL);
+
+           /* <rdar://problem/8400096> Set the workqueue killable */
+           __pthread_workqueue_setkill(1);
+
+           (void)pthread_sigmask(SIG_SETMASK, &act.sa_mask, NULL);
+           (void)pthread_kill(pthread_self(), SIGABRT);
+       } else {
+           (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
+           (void)kill(getpid(), SIGABRT);
+       }
+       usleep(TIMEOUT); /* give time for signal to happen */
 
        /*
         * If SIGABRT was ignored, or caught and the handler returns, do
         * it again, only harder.
         */
+        __abort();
+}
+
+__private_extern__ void
+__abort()
+{
+       struct sigaction act;
+
+       if (!CRGetCrashLogMessage())
+               CRSetCrashLogMessage("__abort() called");
        act.sa_handler = SIG_DFL;
        act.sa_flags = 0;
        sigfillset(&act.sa_mask);
        (void)_sigaction(SIGABRT, &act, NULL);
        sigdelset(&act.sa_mask, SIGABRT);
+
+       /* <rdar://problem/7397932> abort() should call pthread_kill to deliver a signal to the aborting thread 
+        * This helps gdb focus on the thread calling abort()
+        */
+       if (__is_threaded) {
+           /* Block all signals on all other threads */
+           sigset_t fullmask;
+           sigfillset(&fullmask);
+           (void)_sigprocmask(SIG_SETMASK, &fullmask, NULL);
+
+           /* <rdar://problem/8400096> Set the workqueue killable */
+           __pthread_workqueue_setkill(1);
+
+           (void)pthread_sigmask(SIG_SETMASK, &act.sa_mask, NULL);
+           (void)pthread_kill(pthread_self(), SIGABRT);
+       } else {
+           (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
+           (void)kill(getpid(), SIGABRT);
+       }
+       usleep(TIMEOUT); /* give time for signal to happen */
+
+       /* If for some reason SIGABRT was not delivered, we exit using __builtin_trap
+        * which generates an illegal instruction on i386: <rdar://problem/8400958>
+        * and SIGTRAP on arm.
+        */
+       sigfillset(&act.sa_mask);
+       sigdelset(&act.sa_mask, SIGILL);
+       sigdelset(&act.sa_mask, SIGTRAP);
        (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-       (void)raise(SIGABRT);
-       exit(1);
+       __builtin_trap();
+}
+
+__private_extern__ void
+abort_report_np(const char *fmt, ...)
+{
+       _SIMPLE_STRING s;
+       va_list ap;
+
+       if ((s = _simple_salloc()) != NULL) {
+               va_start(ap, fmt);
+               _simple_vsprintf(s, fmt, ap);
+               va_end(ap);
+               CRSetCrashLogMessage(_simple_string(s));
+       } else
+               CRSetCrashLogMessage(fmt); /* the format string is better than nothing */
+       abort();
 }
diff --git a/stdlib/FreeBSD/abort.c.patch b/stdlib/FreeBSD/abort.c.patch
deleted file mode 100644 (file)
index bb72417..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
---- abort.c.orig       2010-09-07 22:42:56.000000000 -0700
-+++ abort.c    2010-09-07 22:46:29.000000000 -0700
-@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include "namespace.h"
- #include <signal.h>
-+#include <stdarg.h>
- #include <stdlib.h>
- #include <stddef.h>
- #include <unistd.h>
-@@ -43,11 +44,22 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include "libc_private.h"
-+#include "CrashReporterClient.h"
-+#include "_simple.h"
-+
-+extern void (*__cleanup)();
-+extern void __abort(void) __dead2;
-+
-+#define TIMEOUT       10000   /* 10 milliseconds */
-+
- void
- abort()
- {
-       struct sigaction act;
-+      if (!CRGetCrashLogMessage())
-+              CRSetCrashLogMessage("abort() called");
-+
-       /*
-        * POSIX requires we flush stdio buffers on abort.
-        * XXX ISO C requires that abort() be async-signal-safe.
-@@ -61,19 +73,90 @@ abort()
-        * any errors -- ISO C doesn't allow abort to return anyway.
-        */
-       sigdelset(&act.sa_mask, SIGABRT);
--      (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
--      (void)raise(SIGABRT);
-+
-+      /* <rdar://problem/7397932> abort() should call pthread_kill to deliver a signal to the aborting thread 
-+       * This helps gdb focus on the thread calling abort()
-+       */
-+      if (__is_threaded) {
-+          /* Block all signals on all other threads */
-+          sigset_t fullmask;
-+          sigfillset(&fullmask);
-+          (void)_sigprocmask(SIG_SETMASK, &fullmask, NULL);
-+
-+          /* <rdar://problem/8400096> Set the workqueue killable */
-+          __pthread_workqueue_setkill(1);
-+
-+          (void)pthread_sigmask(SIG_SETMASK, &act.sa_mask, NULL);
-+          (void)pthread_kill(pthread_self(), SIGABRT);
-+      } else {
-+          (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-+          (void)kill(getpid(), SIGABRT);
-+      }
-+      usleep(TIMEOUT); /* give time for signal to happen */
-       /*
-        * If SIGABRT was ignored, or caught and the handler returns, do
-        * it again, only harder.
-        */
-+       __abort();
-+}
-+
-+__private_extern__ void
-+__abort()
-+{
-+      struct sigaction act;
-+
-+      if (!CRGetCrashLogMessage())
-+              CRSetCrashLogMessage("__abort() called");
-       act.sa_handler = SIG_DFL;
-       act.sa_flags = 0;
-       sigfillset(&act.sa_mask);
-       (void)_sigaction(SIGABRT, &act, NULL);
-       sigdelset(&act.sa_mask, SIGABRT);
-+
-+      /* <rdar://problem/7397932> abort() should call pthread_kill to deliver a signal to the aborting thread 
-+       * This helps gdb focus on the thread calling abort()
-+       */
-+      if (__is_threaded) {
-+          /* Block all signals on all other threads */
-+          sigset_t fullmask;
-+          sigfillset(&fullmask);
-+          (void)_sigprocmask(SIG_SETMASK, &fullmask, NULL);
-+
-+          /* <rdar://problem/8400096> Set the workqueue killable */
-+          __pthread_workqueue_setkill(1);
-+
-+          (void)pthread_sigmask(SIG_SETMASK, &act.sa_mask, NULL);
-+          (void)pthread_kill(pthread_self(), SIGABRT);
-+      } else {
-+          (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-+          (void)kill(getpid(), SIGABRT);
-+      }
-+      usleep(TIMEOUT); /* give time for signal to happen */
-+
-+      /* If for some reason SIGABRT was not delivered, we exit using __builtin_trap
-+       * which generates an illegal instruction on i386: <rdar://problem/8400958>
-+       * and SIGTRAP on arm.
-+       */
-+      sigfillset(&act.sa_mask);
-+      sigdelset(&act.sa_mask, SIGILL);
-+      sigdelset(&act.sa_mask, SIGTRAP);
-       (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
--      (void)raise(SIGABRT);
--      exit(1);
-+      __builtin_trap();
-+}
-+
-+__private_extern__ void
-+abort_report_np(const char *fmt, ...)
-+{
-+      _SIMPLE_STRING s;
-+      va_list ap;
-+
-+      if ((s = _simple_salloc()) != NULL) {
-+              va_start(ap, fmt);
-+              _simple_vsprintf(s, fmt, ap);
-+              va_end(ap);
-+              CRSetCrashLogMessage(_simple_string(s));
-+      } else
-+              CRSetCrashLogMessage(fmt); /* the format string is better than nothing */
-+      abort();
- }
index d53f7c13f51b075e324275ddec098bb12c52a20b..9dc52992ecc65c186d375a491634fd19d5c202d9 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn abs "int j"
+.Fn abs "int i"
 .Sh DESCRIPTION
 The
 .Fn abs
-function
-computes
-the absolute value of the integer
-.Fa j .
+function computes the absolute value of the integer
+.Fa i .
 .Sh RETURN VALUES
 The
 .Fn abs
diff --git a/stdlib/FreeBSD/abs.3.patch b/stdlib/FreeBSD/abs.3.patch
deleted file mode 100644 (file)
index 6ea6642..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- abs.3.bsdnew       2009-11-13 14:11:46.000000000 -0800
-+++ abs.3      2009-11-13 14:11:46.000000000 -0800
-@@ -43,14 +43,12 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft int
--.Fn abs "int j"
-+.Fn abs "int i"
- .Sh DESCRIPTION
- The
- .Fn abs
--function
--computes
--the absolute value of the integer
--.Fa j .
-+function computes the absolute value of the integer
-+.Fa i .
- .Sh RETURN VALUES
- The
- .Fn abs
index 9866edfb2f0f2290b9a33ed98ea46ea485566846..492100a9e437ab4e70003e097d9f2ec8a96af046 100644 (file)
 .Sh NAME
 .Nm alloca
 .Nd memory allocator
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
+.In alloca.h
+or
+.br
 .In stdlib.h
 .Ft void *
 .Fn alloca "size_t size"
 .Sh DESCRIPTION
 The
 .Fn alloca
-function
+macro
 allocates
 .Fa size
 bytes of space in the stack frame of the caller.
 This temporary space is automatically freed on
 return.
 .Sh RETURN VALUES
-The
 .Fn alloca
-function returns a pointer to the beginning of the allocated space.
+returns a pointer to the beginning of the allocated space.
 .Sh SEE ALSO
 .Xr brk 2 ,
 .Xr calloc 3 ,
@@ -60,24 +60,20 @@ function returns a pointer to the beginning of the allocated space.
 .Xr malloc 3 ,
 .Xr realloc 3
 .Sh HISTORY
-The
 .Fn alloca
-function appeared in
+appeared in
 .At 32v .
 .\" .Bx ?? .
 .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
 .\" The first man page (or link to a man page that I can find at the
 .\" moment is 4.3...
 .Sh BUGS
-The
 .Fn alloca
-function
 is machine and compiler dependent;
 its use is discouraged.
 .Pp
-The
 .Fn alloca
-function is slightly unsafe because it cannot ensure that the pointer
+is slightly unsafe because it cannot ensure that the pointer
 returned points to a valid and usable block of memory.
 The allocation made may exceed the bounds of the stack, or even go
 further into other objects in memory, and
@@ -86,3 +82,8 @@ cannot determine such an error.
 Avoid
 .Fn alloca
 with large unbounded allocations.
+.Pp
+The use of C99 variable-length arrays and
+.Fn alloca
+in the same function will cause the lifetime of alloca's storage to be limited to the block containing the
+.Fn alloca
diff --git a/stdlib/FreeBSD/alloca.3.patch b/stdlib/FreeBSD/alloca.3.patch
deleted file mode 100644 (file)
index bf397fb..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- alloca.3.orig      2010-02-22 12:44:05.000000000 -0800
-+++ alloca.3   2010-02-22 12:50:53.000000000 -0800
-@@ -34,25 +34,25 @@
- .Sh NAME
- .Nm alloca
- .Nd memory allocator
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
-+.In alloca.h
-+or
-+.br
- .In stdlib.h
- .Ft void *
- .Fn alloca "size_t size"
- .Sh DESCRIPTION
- The
- .Fn alloca
--function
-+macro
- allocates
- .Fa size
- bytes of space in the stack frame of the caller.
- This temporary space is automatically freed on
- return.
- .Sh RETURN VALUES
--The
- .Fn alloca
--function returns a pointer to the beginning of the allocated space.
-+returns a pointer to the beginning of the allocated space.
- .Sh SEE ALSO
- .Xr brk 2 ,
- .Xr calloc 3 ,
-@@ -60,24 +60,20 @@ function returns a pointer to the beginn
- .Xr malloc 3 ,
- .Xr realloc 3
- .Sh HISTORY
--The
- .Fn alloca
--function appeared in
-+appeared in
- .At 32v .
- .\" .Bx ?? .
- .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
- .\" The first man page (or link to a man page that I can find at the
- .\" moment is 4.3...
- .Sh BUGS
--The
- .Fn alloca
--function
- is machine and compiler dependent;
- its use is discouraged.
- .Pp
--The
- .Fn alloca
--function is slightly unsafe because it cannot ensure that the pointer
-+is slightly unsafe because it cannot ensure that the pointer
- returned points to a valid and usable block of memory.
- The allocation made may exceed the bounds of the stack, or even go
- further into other objects in memory, and
-@@ -86,3 +82,8 @@ cannot determine such an error.
- Avoid
- .Fn alloca
- with large unbounded allocations.
-+.Pp
-+The use of C99 variable-length arrays and
-+.Fn alloca
-+in the same function will cause the lifetime of alloca's storage to be limited to the block containing the
-+.Fn alloca
index bf40c80829b62e376f159548d73102ed43e33a2b..b3d978ba97bcf44dade06274faff283fbb90ffd2 100644 (file)
 .\"     @(#)atexit.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.11 2007/01/09 00:28:09 imp Exp $
 .\"
-.Dd September 6, 2002
+.Dd May 20, 2008
 .Dt ATEXIT 3
 .Os
 .Sh NAME
 .Nm atexit
 .Nd register a function to be called on exit
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn atexit "void (*function)(void)"
+.Fn atexit "void (*func)(void)"
+#ifdef UNIFDEF_BLOCKS
+.Ft int
+.Fn atexit_b "void (^block)(void)"
+#endif
 .Sh DESCRIPTION
 The
 .Fn atexit
 function
-registers the given
-.Fa function
+registers the function
+.Fa func
 to be called at program exit, whether via
 .Xr exit 3
 or via return from the program's
 .Fn main .
 Functions so registered are called in reverse order;
 no arguments are passed.
+#ifdef UNIFDEF_BLOCKS
+.Pp
+The
+.Fn atexit_b
+function is like
+.Fn atexit
+except the callback is a block pointer instead of a function pointer.
+.Bd -ragged -offset indent
+Note: The
+.Fn Block_copy
+function (defined in
+.In Blocks.h )
+is used by
+.Fn atexit_b
+to make a copy of the block, especially for the case when a stack-based
+block might go out of scope when the subroutine returns.
+.Ed
+#endif
 .Pp
-These functions must not call
+These callbacks must not call
 .Fn exit ;
 if it should be necessary to terminate the process while in such a
 function, the
 .Xr _exit 2
 function should be used.
-(Alternatively, the function may cause abnormal
+(Alternatively, the callbacks may cause abnormal
 process termination, for example by calling
 .Xr abort 3 . )
 .Pp
-At least 32 functions can always be registered,
-and more are allowed as long as sufficient memory can be allocated.
+At least 32 callbacks can always be registered;
+more are allowed as long as sufficient memory can be allocated.
 .\" XXX {ATEXIT_MAX} is not implemented yet
 .Sh RETURN VALUES
-.Rv -std atexit
+#ifdef UNIFDEF_BLOCKS
+.ds ATEXIT_B atexit_b
+#endif
+.Rv -std atexit \*[ATEXIT_B]
 .Sh ERRORS
 .Bl -tag -width Er
 .It Bq Er ENOMEM
diff --git a/stdlib/FreeBSD/atexit.3.patch b/stdlib/FreeBSD/atexit.3.patch
deleted file mode 100644 (file)
index 5d23a79..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
---- atexit.3.bsdnew    2009-11-13 14:11:47.000000000 -0800
-+++ atexit.3   2009-11-13 14:11:47.000000000 -0800
-@@ -32,46 +32,69 @@
- .\"     @(#)atexit.3  8.1 (Berkeley) 6/4/93
- .\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.11 2007/01/09 00:28:09 imp Exp $
- .\"
--.Dd September 6, 2002
-+.Dd May 20, 2008
- .Dt ATEXIT 3
- .Os
- .Sh NAME
- .Nm atexit
- .Nd register a function to be called on exit
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft int
--.Fn atexit "void (*function)(void)"
-+.Fn atexit "void (*func)(void)"
-+#ifdef UNIFDEF_BLOCKS
-+.Ft int
-+.Fn atexit_b "void (^block)(void)"
-+#endif
- .Sh DESCRIPTION
- The
- .Fn atexit
- function
--registers the given
--.Fa function
-+registers the function
-+.Fa func
- to be called at program exit, whether via
- .Xr exit 3
- or via return from the program's
- .Fn main .
- Functions so registered are called in reverse order;
- no arguments are passed.
-+#ifdef UNIFDEF_BLOCKS
-+.Pp
-+The
-+.Fn atexit_b
-+function is like
-+.Fn atexit
-+except the callback is a block pointer instead of a function pointer.
-+.Bd -ragged -offset indent
-+Note: The
-+.Fn Block_copy
-+function (defined in
-+.In Blocks.h )
-+is used by
-+.Fn atexit_b
-+to make a copy of the block, especially for the case when a stack-based
-+block might go out of scope when the subroutine returns.
-+.Ed
-+#endif
- .Pp
--These functions must not call
-+These callbacks must not call
- .Fn exit ;
- if it should be necessary to terminate the process while in such a
- function, the
- .Xr _exit 2
- function should be used.
--(Alternatively, the function may cause abnormal
-+(Alternatively, the callbacks may cause abnormal
- process termination, for example by calling
- .Xr abort 3 . )
- .Pp
--At least 32 functions can always be registered,
--and more are allowed as long as sufficient memory can be allocated.
-+At least 32 callbacks can always be registered;
-+more are allowed as long as sufficient memory can be allocated.
- .\" XXX {ATEXIT_MAX} is not implemented yet
- .Sh RETURN VALUES
--.Rv -std atexit
-+#ifdef UNIFDEF_BLOCKS
-+.ds ATEXIT_B atexit_b
-+#endif
-+.Rv -std atexit \*[ATEXIT_B]
- .Sh ERRORS
- .Bl -tag -width Er
- .It Bq Er ENOMEM
index 05dad84025954574484d29997d0dccb7e156afe2..6acc776147cba9b1928ee68b30101578be027d5d 100644 (file)
@@ -41,14 +41,23 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/atexit.c,v 1.8 2007/01/09 00:28:09 imp E
 #include <stdlib.h>
 #include <unistd.h>
 #include <pthread.h>
+#if defined(__DYNAMIC__) || defined (__BLOCKS__)
+#include <dlfcn.h>
+#endif /* defined(__DYNAMIC__) */
 #include "atexit.h"
 #include "un-namespace.h"
 
+#ifdef __BLOCKS__
+#include <Block.h>
+#endif /* __BLOCKS__ */
 #include "libc_private.h"
 
 #define        ATEXIT_FN_EMPTY 0
 #define        ATEXIT_FN_STD   1
 #define        ATEXIT_FN_CXA   2
+#ifdef __BLOCKS__
+#define        ATEXIT_FN_BLK   3
+#endif /* __BLOCKS__ */
 
 static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -63,6 +72,9 @@ struct atexit {
                union {
                        void (*std_func)(void);
                        void (*cxa_func)(void *);
+#ifdef __BLOCKS__
+                       void (^block)(void);
+#endif /* __BLOCKS__ */
                } fn_ptr;                       /* function pointer */
                void *fn_arg;                   /* argument for CXA callback */
                void *fn_dso;                   /* shared module handle */
@@ -70,6 +82,7 @@ struct atexit {
 };
 
 static struct atexit *__atexit;                /* points to head of LIFO stack */
+static int new_registration;
 
 /*
  * Register the function described by 'fptr' to be called at application
@@ -105,6 +118,7 @@ atexit_register(struct atexit_fn *fptr)
                __atexit = p;
        }
        p->fns[p->ind++] = *fptr;
+       new_registration = 1;
        _MUTEX_UNLOCK(&atexit_mutex);
        return 0;
 }
@@ -116,17 +130,50 @@ int
 atexit(void (*func)(void))
 {
        struct atexit_fn fn;
+       struct dl_info info;
        int error;
 
        fn.fn_type = ATEXIT_FN_STD;
-       fn.fn_ptr.std_func = func;;
+       fn.fn_ptr.std_func = func;
        fn.fn_arg = NULL;
+#if defined(__DYNAMIC__)
+       if ( dladdr(func, &info) )
+               fn.fn_dso = info.dli_fbase;
+       else 
+               fn.fn_dso = NULL;
+#else /* ! defined(__DYNAMIC__) */
        fn.fn_dso = NULL;
+#endif /* defined(__DYNAMIC__) */
 
        error = atexit_register(&fn);   
        return (error);
 }
 
+#ifdef __BLOCKS__
+int
+atexit_b(void (^block)(void))
+{
+       struct atexit_fn fn;
+       struct dl_info info;
+       int error;
+
+       fn.fn_type = ATEXIT_FN_BLK;
+       fn.fn_ptr.block = Block_copy(block);
+       fn.fn_arg = NULL;
+#if defined(__DYNAMIC__)
+       if ( dladdr(block, &info) )
+               fn.fn_dso = info.dli_fbase;
+       else 
+               fn.fn_dso = NULL;
+#else /* ! defined(__DYNAMIC__) */
+       fn.fn_dso = NULL;
+#endif /* defined(__DYNAMIC__) */
+
+       error = atexit_register(&fn);   
+       return (error);
+}
+#endif /* __BLOCKS__ */
+
 /*
  * Register a function to be performed at exit or when an shared object
  * with given dso handle is unloaded dynamically.
@@ -152,13 +199,14 @@ __cxa_atexit(void (*func)(void *), void *arg, void *dso)
  * handlers are called.
  */
 void
-__cxa_finalize(void *dso)
+__cxa_finalize(const void *dso)
 {
        struct atexit *p;
        struct atexit_fn fn;
        int n;
 
        _MUTEX_LOCK(&atexit_mutex);
+restart:
        for (p = __atexit; p; p = p->next) {
                for (n = p->ind; --n >= 0;) {
                        if (p->fns[n].fn_type == ATEXIT_FN_EMPTY)
@@ -171,6 +219,7 @@ __cxa_finalize(void *dso)
                          has already been called.
                        */
                        p->fns[n].fn_type = ATEXIT_FN_EMPTY;
+                       new_registration = 0;
                        _MUTEX_UNLOCK(&atexit_mutex);
                
                        /* Call the function of correct type. */
@@ -178,7 +227,13 @@ __cxa_finalize(void *dso)
                                fn.fn_ptr.cxa_func(fn.fn_arg);
                        else if (fn.fn_type == ATEXIT_FN_STD)
                                fn.fn_ptr.std_func();
+#ifdef __BLOCKS__
+                       else if (fn.fn_type == ATEXIT_FN_BLK)
+                               fn.fn_ptr.block();
+#endif /* __BLOCKS__ */
                        _MUTEX_LOCK(&atexit_mutex);
+                       if (new_registration)
+                           goto restart;
                }
        }
        _MUTEX_UNLOCK(&atexit_mutex);
diff --git a/stdlib/FreeBSD/atexit.c.patch b/stdlib/FreeBSD/atexit.c.patch
deleted file mode 100644 (file)
index a75ede0..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
---- atexit.c.bsdnew    2009-11-13 14:11:47.000000000 -0800
-+++ atexit.c   2009-11-13 14:11:47.000000000 -0800
-@@ -41,14 +41,23 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <stdlib.h>
- #include <unistd.h>
- #include <pthread.h>
-+#if defined(__DYNAMIC__) || defined (__BLOCKS__)
-+#include <dlfcn.h>
-+#endif /* defined(__DYNAMIC__) */
- #include "atexit.h"
- #include "un-namespace.h"
-+#ifdef __BLOCKS__
-+#include <Block.h>
-+#endif /* __BLOCKS__ */
- #include "libc_private.h"
- #define       ATEXIT_FN_EMPTY 0
- #define       ATEXIT_FN_STD   1
- #define       ATEXIT_FN_CXA   2
-+#ifdef __BLOCKS__
-+#define       ATEXIT_FN_BLK   3
-+#endif /* __BLOCKS__ */
- static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER;
-@@ -63,6 +72,9 @@ struct atexit {
-               union {
-                       void (*std_func)(void);
-                       void (*cxa_func)(void *);
-+#ifdef __BLOCKS__
-+                      void (^block)(void);
-+#endif /* __BLOCKS__ */
-               } fn_ptr;                       /* function pointer */
-               void *fn_arg;                   /* argument for CXA callback */
-               void *fn_dso;                   /* shared module handle */
-@@ -70,6 +82,7 @@ struct atexit {
- };
- static struct atexit *__atexit;               /* points to head of LIFO stack */
-+static int new_registration;
- /*
-  * Register the function described by 'fptr' to be called at application
-@@ -105,6 +118,7 @@ atexit_register(struct atexit_fn *fptr)
-               __atexit = p;
-       }
-       p->fns[p->ind++] = *fptr;
-+      new_registration = 1;
-       _MUTEX_UNLOCK(&atexit_mutex);
-       return 0;
- }
-@@ -116,17 +130,50 @@ int
- atexit(void (*func)(void))
- {
-       struct atexit_fn fn;
-+      struct dl_info info;
-       int error;
-       fn.fn_type = ATEXIT_FN_STD;
--      fn.fn_ptr.std_func = func;;
-+      fn.fn_ptr.std_func = func;
-       fn.fn_arg = NULL;
-+#if defined(__DYNAMIC__)
-+      if ( dladdr(func, &info) )
-+              fn.fn_dso = info.dli_fbase;
-+      else 
-+              fn.fn_dso = NULL;
-+#else /* ! defined(__DYNAMIC__) */
-       fn.fn_dso = NULL;
-+#endif /* defined(__DYNAMIC__) */
-       error = atexit_register(&fn);   
-       return (error);
- }
-+#ifdef __BLOCKS__
-+int
-+atexit_b(void (^block)(void))
-+{
-+      struct atexit_fn fn;
-+      struct dl_info info;
-+      int error;
-+
-+      fn.fn_type = ATEXIT_FN_BLK;
-+      fn.fn_ptr.block = Block_copy(block);
-+      fn.fn_arg = NULL;
-+#if defined(__DYNAMIC__)
-+      if ( dladdr(block, &info) )
-+              fn.fn_dso = info.dli_fbase;
-+      else 
-+              fn.fn_dso = NULL;
-+#else /* ! defined(__DYNAMIC__) */
-+      fn.fn_dso = NULL;
-+#endif /* defined(__DYNAMIC__) */
-+
-+      error = atexit_register(&fn);   
-+      return (error);
-+}
-+#endif /* __BLOCKS__ */
-+
- /*
-  * Register a function to be performed at exit or when an shared object
-  * with given dso handle is unloaded dynamically.
-@@ -152,13 +199,14 @@ __cxa_atexit(void (*func)(void *), void 
-  * handlers are called.
-  */
- void
--__cxa_finalize(void *dso)
-+__cxa_finalize(const void *dso)
- {
-       struct atexit *p;
-       struct atexit_fn fn;
-       int n;
-       _MUTEX_LOCK(&atexit_mutex);
-+restart:
-       for (p = __atexit; p; p = p->next) {
-               for (n = p->ind; --n >= 0;) {
-                       if (p->fns[n].fn_type == ATEXIT_FN_EMPTY)
-@@ -171,6 +219,7 @@ __cxa_finalize(void *dso)
-                         has already been called.
-                       */
-                       p->fns[n].fn_type = ATEXIT_FN_EMPTY;
-+                      new_registration = 0;
-                       _MUTEX_UNLOCK(&atexit_mutex);
-               
-                       /* Call the function of correct type. */
-@@ -178,7 +227,13 @@ __cxa_finalize(void *dso)
-                               fn.fn_ptr.cxa_func(fn.fn_arg);
-                       else if (fn.fn_type == ATEXIT_FN_STD)
-                               fn.fn_ptr.std_func();
-+#ifdef __BLOCKS__
-+                      else if (fn.fn_type == ATEXIT_FN_BLK)
-+                              fn.fn_ptr.block();
-+#endif /* __BLOCKS__ */
-                       _MUTEX_LOCK(&atexit_mutex);
-+                      if (new_registration)
-+                          goto restart;
-               }
-       }
-       _MUTEX_UNLOCK(&atexit_mutex);
index 94929b5660833bb10cf5d5e6987af278d3c592a6..56220ef30c1f1908b4a5e80f8b6e7a77594f3e7f 100644 (file)
@@ -33,4 +33,4 @@
 /* must be at least 32 to guarantee ANSI conformance */
 #define        ATEXIT_SIZE     32
 
-void __cxa_finalize(void *dso);
+void __cxa_finalize(const void *dso);
diff --git a/stdlib/FreeBSD/atexit.h.patch b/stdlib/FreeBSD/atexit.h.patch
deleted file mode 100644 (file)
index cea87c1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- atexit.h.bsdnew    2009-11-13 14:11:47.000000000 -0800
-+++ atexit.h   2009-11-13 14:11:47.000000000 -0800
-@@ -33,4 +33,4 @@
- /* must be at least 32 to guarantee ANSI conformance */
- #define       ATEXIT_SIZE     32
--void __cxa_finalize(void *dso);
-+void __cxa_finalize(const void *dso);
index e417e279932104415b729727e19d1f5145125fba..28f0870db5402bbfbb1280ae57bf0b8a43f70f94 100644 (file)
@@ -36,7 +36,8 @@
 .Dt ATOF 3
 .Os
 .Sh NAME
-.Nm atof
+.Nm atof ,
+.Nm atof_l
 .Nd convert
 .Tn ASCII
 string to double
@@ -45,33 +46,50 @@ string to double
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft double
-.Fn atof "const char *nptr"
+.Fn atof "const char *str"
+.In xlocale.h
+.Ft double
+.Fn atof_l "const char *str" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn atof
 function converts the initial portion of the string pointed to by
-.Fa nptr
+.Fa str
 to
 .Vt double
 representation.
 .Pp
 It is equivalent to:
 .Bd -literal -offset indent
-strtod(nptr, (char **)NULL);
+strtod(str, (char **)NULL);
 .Ed
 .Pp
 The decimal point
 character is defined in the program's locale (category
 .Dv LC_NUMERIC ) .
+.Pp
+While the
+.Fn atof
+function uses the current locale, the
+.Fn atof_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh IMPLEMENTATION NOTES
 The
 .Fn atof
-function is not thread-safe and also not async-cancel-safe.
+and
+.Fn atof_l
+functions are thread-safe and async-cancel-safe.
 .Pp
 The
 .Fn atof
-function has been deprecated by
+and
+.Fn atof_l
+functions have been deprecated by
 .Fn strtod
+and
+.Fn strtod_l
 and should not be used in new code.
 .Sh ERRORS
 The function
@@ -84,7 +102,8 @@ on an error.
 .Xr atol 3 ,
 .Xr strtod 3 ,
 .Xr strtol 3 ,
-.Xr strtoul 3
+.Xr strtoul 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn atof
diff --git a/stdlib/FreeBSD/atof.3.patch b/stdlib/FreeBSD/atof.3.patch
deleted file mode 100644 (file)
index ae7bddc..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
---- atof.3.orig        2010-02-08 16:26:10.000000000 -0800
-+++ atof.3     2010-02-13 20:58:26.000000000 -0800
-@@ -36,7 +36,8 @@
- .Dt ATOF 3
- .Os
- .Sh NAME
--.Nm atof
-+.Nm atof ,
-+.Nm atof_l
- .Nd convert
- .Tn ASCII
- string to double
-@@ -45,33 +46,50 @@ string to double
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft double
--.Fn atof "const char *nptr"
-+.Fn atof "const char *str"
-+.In xlocale.h
-+.Ft double
-+.Fn atof_l "const char *str" "locale_t loc"
- .Sh DESCRIPTION
- The
- .Fn atof
- function converts the initial portion of the string pointed to by
--.Fa nptr
-+.Fa str
- to
- .Vt double
- representation.
- .Pp
- It is equivalent to:
- .Bd -literal -offset indent
--strtod(nptr, (char **)NULL);
-+strtod(str, (char **)NULL);
- .Ed
- .Pp
- The decimal point
- character is defined in the program's locale (category
- .Dv LC_NUMERIC ) .
-+.Pp
-+While the
-+.Fn atof
-+function uses the current locale, the
-+.Fn atof_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh IMPLEMENTATION NOTES
- The
- .Fn atof
--function is not thread-safe and also not async-cancel-safe.
-+and
-+.Fn atof_l
-+functions are thread-safe and async-cancel-safe.
- .Pp
- The
- .Fn atof
--function has been deprecated by
-+and
-+.Fn atof_l
-+functions have been deprecated by
- .Fn strtod
-+and
-+.Fn strtod_l
- and should not be used in new code.
- .Sh ERRORS
- The function
-@@ -84,7 +102,8 @@ on an error.
- .Xr atol 3 ,
- .Xr strtod 3 ,
- .Xr strtol 3 ,
--.Xr strtoul 3
-+.Xr strtoul 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn atof
index 8ece0972c6349e4e0aabd64492d6b81873a79020..fff3e7d077162599598ddbdc4328a99e487812d3 100644 (file)
@@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atof.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/atof.c,v 1.6 2007/01/09 00:28:09 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 
 double
 atof(ascii)
        const char *ascii;
 {
-       return strtod(ascii, (char **)NULL);
+       return strtod_l(ascii, (char **)NULL, __current_locale());
+}
+
+double
+atof_l(ascii, loc)
+       const char *ascii;
+       locale_t loc;
+{
+       /* no need to call NORMALIZE_LOCALE(loc) because strtod_l will */
+       return strtod_l(ascii, (char **)NULL, loc);
 }
diff --git a/stdlib/FreeBSD/atof.c.patch b/stdlib/FreeBSD/atof.c.patch
deleted file mode 100644 (file)
index 35b0776..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- atof.c.bsdnew      2009-11-13 14:11:47.000000000 -0800
-+++ atof.c     2009-11-13 14:11:47.000000000 -0800
-@@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atof.c 8.1 (
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/atof.c,v 1.6 2007/01/09 00:28:09 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- double
- atof(ascii)
-       const char *ascii;
- {
--      return strtod(ascii, (char **)NULL);
-+      return strtod_l(ascii, (char **)NULL, __current_locale());
-+}
-+
-+double
-+atof_l(ascii, loc)
-+      const char *ascii;
-+      locale_t loc;
-+{
-+      /* no need to call NORMALIZE_LOCALE(loc) because strtod_l will */
-+      return strtod_l(ascii, (char **)NULL, loc);
- }
index a73998e1a2227c4b52ff5912809a56fd1ef8dd78..3dc33e8cd354d2ff635ccf918e801a8cf9d2058a 100644 (file)
@@ -36,7 +36,8 @@
 .Dt ATOI 3
 .Os
 .Sh NAME
-.Nm atoi
+.Nm atoi ,
+.Nm atoi_l
 .Nd convert
 .Tn ASCII
 string to integer
@@ -45,25 +46,46 @@ string to integer
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn atoi "const char *nptr"
+.Fn atoi "const char *str"
+.In xlocale.h
+.Ft int
+.Fn atoi_l "const char *str" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn atoi
 function converts the initial portion of the string pointed to by
-.Fa nptr
+.Fa str
 to
 .Vt int
 representation.
 .Pp
 It is equivalent to:
 .Bd -literal -offset indent
-(int)strtol(nptr, (char **)NULL, 10);
+(int)strtol(str, (char **)NULL, 10);
 .Ed
 .Pp
+While the
+.Fn atoi
+function uses the current locale, the
+.Fn atoi_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn atoi
+and
+.Fn atoi_l
+functions are thread-safe and async-cancel-safe.
+.Pp
 The
 .Fn atoi
-function has been deprecated by
+and
+.Fn atoi_l
+functions have been deprecated by
 .Fn strtol
+and
+.Fn strtol_l
 and should not be used in new code.
 .Sh ERRORS
 The function
@@ -76,7 +98,8 @@ on an error.
 .Xr atol 3 ,
 .Xr strtod 3 ,
 .Xr strtol 3 ,
-.Xr strtoul 3
+.Xr strtoul 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn atoi
diff --git a/stdlib/FreeBSD/atoi.3.patch b/stdlib/FreeBSD/atoi.3.patch
deleted file mode 100644 (file)
index a322d59..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
---- atoi.3.orig        2010-02-08 16:26:10.000000000 -0800
-+++ atoi.3     2010-02-13 20:59:41.000000000 -0800
-@@ -36,7 +36,8 @@
- .Dt ATOI 3
- .Os
- .Sh NAME
--.Nm atoi
-+.Nm atoi ,
-+.Nm atoi_l
- .Nd convert
- .Tn ASCII
- string to integer
-@@ -45,25 +46,46 @@ string to integer
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft int
--.Fn atoi "const char *nptr"
-+.Fn atoi "const char *str"
-+.In xlocale.h
-+.Ft int
-+.Fn atoi_l "const char *str" "locale_t loc"
- .Sh DESCRIPTION
- The
- .Fn atoi
- function converts the initial portion of the string pointed to by
--.Fa nptr
-+.Fa str
- to
- .Vt int
- representation.
- .Pp
- It is equivalent to:
- .Bd -literal -offset indent
--(int)strtol(nptr, (char **)NULL, 10);
-+(int)strtol(str, (char **)NULL, 10);
- .Ed
- .Pp
-+While the
-+.Fn atoi
-+function uses the current locale, the
-+.Fn atoi_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
-+.Sh IMPLEMENTATION NOTES
-+The
-+.Fn atoi
-+and
-+.Fn atoi_l
-+functions are thread-safe and async-cancel-safe.
-+.Pp
- The
- .Fn atoi
--function has been deprecated by
-+and
-+.Fn atoi_l
-+functions have been deprecated by
- .Fn strtol
-+and
-+.Fn strtol_l
- and should not be used in new code.
- .Sh ERRORS
- The function
-@@ -76,7 +98,8 @@ on an error.
- .Xr atol 3 ,
- .Xr strtod 3 ,
- .Xr strtol 3 ,
--.Xr strtoul 3
-+.Xr strtoul 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn atoi
index 38ab6325c6cdf049a06928a5bac979df19948419..ac6fcca974227610969c351764803adbf3d7de17 100644 (file)
@@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atoi.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoi.c,v 1.6 2007/01/09 00:28:09 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 
 int
 atoi(str)
        const char *str;
 {
-       return (int)strtol(str, (char **)NULL, 10);
+       return (int)strtol_l(str, (char **)NULL, 10, __current_locale());
+}
+
+int
+atoi_l(str, loc)
+       const char *str;
+       locale_t loc;
+{
+       /* no need to call NORMALIZE_LOCALE(loc) because strtol_l will */
+       return (int)strtol_l(str, (char **)NULL, 10, loc);
 }
diff --git a/stdlib/FreeBSD/atoi.c.patch b/stdlib/FreeBSD/atoi.c.patch
deleted file mode 100644 (file)
index ed23851..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- atoi.c.bsdnew      2009-11-13 14:11:47.000000000 -0800
-+++ atoi.c     2009-11-13 14:11:47.000000000 -0800
-@@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atoi.c 8.1 (
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoi.c,v 1.6 2007/01/09 00:28:09 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- int
- atoi(str)
-       const char *str;
- {
--      return (int)strtol(str, (char **)NULL, 10);
-+      return (int)strtol_l(str, (char **)NULL, 10, __current_locale());
-+}
-+
-+int
-+atoi_l(str, loc)
-+      const char *str;
-+      locale_t loc;
-+{
-+      /* no need to call NORMALIZE_LOCALE(loc) because strtol_l will */
-+      return (int)strtol_l(str, (char **)NULL, 10, loc);
- }
index 68bf9425718ecfc6fa587f65cd5923de65c5f253..2c211511e7f6d8137d860b4147fcc6c274c098ac 100644 (file)
@@ -36,7 +36,8 @@
 .Dt ATOL 3
 .Os
 .Sh NAME
-.Nm atol , atoll
+.Nm atol , atoll ,
+.Nm atol_l , atoll_l
 .Nd convert
 .Tn ASCII
 string to
@@ -49,14 +50,19 @@ integer
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft long
-.Fn atol "const char *nptr"
+.Fn atol "const char *str"
 .Ft "long long"
-.Fn atoll "const char *nptr"
+.Fn atoll "const char *str"
+.In xlocale.h
+.Ft long
+.Fn atol_l "const char *str" "locale_t loc"
+.Ft "long long"
+.Fn atoll_l "const char *str" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn atol
 function converts the initial portion of the string pointed to by
-.Fa nptr
+.Fa str
 to
 .Vt long
 integer
@@ -64,12 +70,12 @@ representation.
 .Pp
 It is equivalent to:
 .Pp
-.Dl "strtol(nptr, (char **)NULL, 10);"
+.Dl "strtol(str, (char **)NULL, 10);"
 .Pp
 The
 .Fn atoll
 function converts the initial portion of the string pointed to by
-.Fa nptr
+.Fa str
 to
 .Vt "long long"
 integer
@@ -77,8 +83,28 @@ representation.
 .Pp
 It is equivalent to:
 .Pp
-.Dl "strtoll(nptr, (char **)NULL, 10);"
-.Sh COMPATIBILITY
+.Dl "strtoll(str, (char **)NULL, 10);"
+.Pp
+While the
+.Fn atol
+and
+.Fn atoll
+functions use the current locale, the
+.Fn atol_l
+and
+.Fn atoll_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn atol ,
+.Fn atoll ,
+.Fn atol_l ,
+and
+.Fn atoll_l
+functions are thread-safe and async-cancel-safe.
+.Pp
 The
 .Fx
 implementations of the
@@ -121,7 +147,8 @@ on an error.
 .Xr atoi 3 ,
 .Xr strtod 3 ,
 .Xr strtol 3 ,
-.Xr strtoul 3
+.Xr strtoul 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn atol
diff --git a/stdlib/FreeBSD/atol.3.patch b/stdlib/FreeBSD/atol.3.patch
deleted file mode 100644 (file)
index 6ad8177..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
---- atol.3.orig        2010-02-08 16:26:10.000000000 -0800
-+++ atol.3     2010-02-13 21:01:28.000000000 -0800
-@@ -36,7 +36,8 @@
- .Dt ATOL 3
- .Os
- .Sh NAME
--.Nm atol , atoll
-+.Nm atol , atoll ,
-+.Nm atol_l , atoll_l
- .Nd convert
- .Tn ASCII
- string to
-@@ -49,14 +50,19 @@ integer
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft long
--.Fn atol "const char *nptr"
-+.Fn atol "const char *str"
- .Ft "long long"
--.Fn atoll "const char *nptr"
-+.Fn atoll "const char *str"
-+.In xlocale.h
-+.Ft long
-+.Fn atol_l "const char *str" "locale_t loc"
-+.Ft "long long"
-+.Fn atoll_l "const char *str" "locale_t loc"
- .Sh DESCRIPTION
- The
- .Fn atol
- function converts the initial portion of the string pointed to by
--.Fa nptr
-+.Fa str
- to
- .Vt long
- integer
-@@ -64,12 +70,12 @@ representation.
- .Pp
- It is equivalent to:
- .Pp
--.Dl "strtol(nptr, (char **)NULL, 10);"
-+.Dl "strtol(str, (char **)NULL, 10);"
- .Pp
- The
- .Fn atoll
- function converts the initial portion of the string pointed to by
--.Fa nptr
-+.Fa str
- to
- .Vt "long long"
- integer
-@@ -77,8 +83,28 @@ representation.
- .Pp
- It is equivalent to:
- .Pp
--.Dl "strtoll(nptr, (char **)NULL, 10);"
--.Sh COMPATIBILITY
-+.Dl "strtoll(str, (char **)NULL, 10);"
-+.Pp
-+While the
-+.Fn atol
-+and
-+.Fn atoll
-+functions use the current locale, the
-+.Fn atol_l
-+and
-+.Fn atoll_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
-+.Sh IMPLEMENTATION NOTES
-+The
-+.Fn atol ,
-+.Fn atoll ,
-+.Fn atol_l ,
-+and
-+.Fn atoll_l
-+functions are thread-safe and async-cancel-safe.
-+.Pp
- The
- .Fx
- implementations of the
-@@ -121,7 +147,8 @@ on an error.
- .Xr atoi 3 ,
- .Xr strtod 3 ,
- .Xr strtol 3 ,
--.Xr strtoul 3
-+.Xr strtoul 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn atol
index 2209340ec45dfcbaa66171ea02a197e843cd58e1..5e52d95ca288ad0a430f0207fb078c0d62c9fcd2 100644 (file)
@@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atol.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 
 long
 atol(str)
        const char *str;
 {
-       return strtol(str, (char **)NULL, 10);
+       return strtol_l(str, (char **)NULL, 10, __current_locale());
+}
+
+long
+atol_l(str, loc)
+       const char *str;
+       locale_t loc;
+{
+       /* no need to call NORMALIZE_LOCALE(loc) because strtol_l will */
+       return strtol_l(str, (char **)NULL, 10, loc);
 }
diff --git a/stdlib/FreeBSD/atol.c.patch b/stdlib/FreeBSD/atol.c.patch
deleted file mode 100644 (file)
index 93958d9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- atol.c.bsdnew      2009-11-13 14:11:47.000000000 -0800
-+++ atol.c     2009-11-13 14:11:47.000000000 -0800
-@@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atol.c 8.1 (
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- long
- atol(str)
-       const char *str;
- {
--      return strtol(str, (char **)NULL, 10);
-+      return strtol_l(str, (char **)NULL, 10, __current_locale());
-+}
-+
-+long
-+atol_l(str, loc)
-+      const char *str;
-+      locale_t loc;
-+{
-+      /* no need to call NORMALIZE_LOCALE(loc) because strtol_l will */
-+      return strtol_l(str, (char **)NULL, 10, loc);
- }
index c5bc881e650dd8f5e0569ea4e5c972ac3e020f6f..c25a4daff4a8e9dc58ac57fc4f0f46eabc180b56 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoll.c,v 1.5 2007/01/09 00:28:09 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 
 long long
 atoll(str)
        const char *str;
 {
-       return strtoll(str, (char **)NULL, 10);
+       return strtoll_l(str, (char **)NULL, 10, __current_locale());
+}
+
+long long
+atoll_l(str, loc)
+       const char *str;
+       locale_t loc;
+{
+       /* no need to call NORMALIZE_LOCALE(loc) because strtoll_l will */
+       return strtoll_l(str, (char **)NULL, 10, loc);
 }
diff --git a/stdlib/FreeBSD/atoll.c.patch b/stdlib/FreeBSD/atoll.c.patch
deleted file mode 100644 (file)
index fb43ecf..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- atoll.c.bsdnew     2009-11-13 14:11:47.000000000 -0800
-+++ atoll.c    2009-11-13 14:11:47.000000000 -0800
-@@ -30,11 +30,22 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoll.c,v 1.5 2007/01/09 00:28:09 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- long long
- atoll(str)
-       const char *str;
- {
--      return strtoll(str, (char **)NULL, 10);
-+      return strtoll_l(str, (char **)NULL, 10, __current_locale());
-+}
-+
-+long long
-+atoll_l(str, loc)
-+      const char *str;
-+      locale_t loc;
-+{
-+      /* no need to call NORMALIZE_LOCALE(loc) because strtoll_l will */
-+      return strtoll_l(str, (char **)NULL, 10, loc);
- }
index 5ae58674d87d952babc3246a8b9a93fe3e19eee1..857f800c2d016dc813d7994221b31200dd148d61 100644 (file)
 .\"     @(#)bsearch.3  8.3 (Berkeley) 4/19/94
 .\" $FreeBSD: src/lib/libc/stdlib/bsearch.3,v 1.9 2007/01/09 00:28:09 imp Exp $
 .\"
-.Dd April 19, 1994
+.Dd May 20, 2008
 .Dt BSEARCH 3
 .Os
 .Sh NAME
+#ifdef UNIFDEF_BLOCKS
+.Nm bsearch ,
+.Nm bsearch_b
+#else
 .Nm bsearch
+#endif
 .Nd binary search of a sorted table
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft void *
-.Fn bsearch "const void *key" "const void *base" "size_t nmemb" "size_t size" "int (*compar) (const void *, const void *)"
+.Fn bsearch "const void *key" "const void *base" "size_t nel" "size_t width" "int (*compar) (const void *, const void *)"
+#ifdef UNIFDEF_BLOCKS
+.Ft void *
+.Fn bsearch_b "const void *key" "const void *base" "size_t nel" "size_t width" "int (^compar) (const void *, const void *)"
+#endif
 .Sh DESCRIPTION
 The
 .Fn bsearch
 function searches an array of
-.Fa nmemb
+.Fa nel
 objects, the initial member of which is
 pointed to by
 .Fa base ,
 for a member that matches the object pointed to by
 .Fa key .
-The size of each member of the array is specified by
-.Fa size .
+The size (in bytes) of each member of the array is specified by
+.Fa width .
 .Pp
 The contents of the array should be in ascending sorted order according
 to the comparison function referenced by
@@ -66,15 +73,33 @@ routine
 is expected to have
 two arguments which point to the
 .Fa key
-object and to an array member, in that order, and should return an integer
+object and to an array member, in that order.
+It should return an integer which is
 less than, equal to, or greater than zero if the
 .Fa key
 object is found, respectively, to be less than, to match, or be
 greater than the array member.
+#ifdef UNIFDEF_BLOCKS
+.Pp
+The
+.Fn bsearch_b
+function is like
+.Fn bsearch
+except the callback
+.Fa compar
+is a block pointer instead of a function pointer.
+#endif
 .Sh RETURN VALUES
 The
 .Fn bsearch
-function returns a pointer to a matching member of the array, or a null
+#ifdef UNIFDEF_BLOCKS
+and
+.Fn bsearch_b
+functions
+#else
+function
+#endif
+returns a pointer to a matching member of the array, or a null
 pointer if no match is found.
 If two members compare as equal, which member is matched is unspecified.
 .Sh SEE ALSO
diff --git a/stdlib/FreeBSD/bsearch.3.patch b/stdlib/FreeBSD/bsearch.3.patch
deleted file mode 100644 (file)
index 4486b7d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
---- bsearch.3.bsdnew   2009-11-13 14:11:47.000000000 -0800
-+++ bsearch.3  2009-11-13 14:11:48.000000000 -0800
-@@ -32,30 +32,37 @@
- .\"     @(#)bsearch.3 8.3 (Berkeley) 4/19/94
- .\" $FreeBSD: src/lib/libc/stdlib/bsearch.3,v 1.9 2007/01/09 00:28:09 imp Exp $
- .\"
--.Dd April 19, 1994
-+.Dd May 20, 2008
- .Dt BSEARCH 3
- .Os
- .Sh NAME
-+#ifdef UNIFDEF_BLOCKS
-+.Nm bsearch ,
-+.Nm bsearch_b
-+#else
- .Nm bsearch
-+#endif
- .Nd binary search of a sorted table
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft void *
--.Fn bsearch "const void *key" "const void *base" "size_t nmemb" "size_t size" "int (*compar) (const void *, const void *)"
-+.Fn bsearch "const void *key" "const void *base" "size_t nel" "size_t width" "int (*compar) (const void *, const void *)"
-+#ifdef UNIFDEF_BLOCKS
-+.Ft void *
-+.Fn bsearch_b "const void *key" "const void *base" "size_t nel" "size_t width" "int (^compar) (const void *, const void *)"
-+#endif
- .Sh DESCRIPTION
- The
- .Fn bsearch
- function searches an array of
--.Fa nmemb
-+.Fa nel
- objects, the initial member of which is
- pointed to by
- .Fa base ,
- for a member that matches the object pointed to by
- .Fa key .
--The size of each member of the array is specified by
--.Fa size .
-+The size (in bytes) of each member of the array is specified by
-+.Fa width .
- .Pp
- The contents of the array should be in ascending sorted order according
- to the comparison function referenced by
-@@ -66,15 +73,33 @@ routine
- is expected to have
- two arguments which point to the
- .Fa key
--object and to an array member, in that order, and should return an integer
-+object and to an array member, in that order.
-+It should return an integer which is
- less than, equal to, or greater than zero if the
- .Fa key
- object is found, respectively, to be less than, to match, or be
- greater than the array member.
-+#ifdef UNIFDEF_BLOCKS
-+.Pp
-+The
-+.Fn bsearch_b
-+function is like
-+.Fn bsearch
-+except the callback
-+.Fa compar
-+is a block pointer instead of a function pointer.
-+#endif
- .Sh RETURN VALUES
- The
- .Fn bsearch
--function returns a pointer to a matching member of the array, or a null
-+#ifdef UNIFDEF_BLOCKS
-+and
-+.Fn bsearch_b
-+functions
-+#else
-+function
-+#endif
-+returns a pointer to a matching member of the array, or a null
- pointer if no match is found.
- If two members compare as equal, which member is matched is unspecified.
- .Sh SEE ALSO
index b6988690e30103821c3f668bb36358329426a956..6af42914320fa063622d3ed5a7ede29b9d82a671 100644 (file)
@@ -77,3 +77,31 @@ bsearch(key, base0, nmemb, size, compar)
        }
        return (NULL);
 }
+
+#ifdef __BLOCKS__
+void *
+bsearch_b(key, base0, nmemb, size, compar)
+       const void *key;
+       const void *base0;
+       size_t nmemb;
+       size_t size;
+       int (^compar)(const void *, const void *);
+{
+       const char *base = base0;
+       size_t lim;
+       int cmp;
+       const void *p;
+
+       for (lim = nmemb; lim != 0; lim >>= 1) {
+               p = base + (lim >> 1) * size;
+               cmp = compar(key, p);
+               if (cmp == 0)
+                       return ((void *)p);
+               if (cmp > 0) {  /* key > p: move right */
+                       base = (char *)p + size;
+                       lim--;
+               }               /* else move left */
+       }
+       return (NULL);
+}
+#endif /* __BLOCKS__ */
diff --git a/stdlib/FreeBSD/bsearch.c.patch b/stdlib/FreeBSD/bsearch.c.patch
deleted file mode 100644 (file)
index 4d86020..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- bsearch.c.bsdnew   2009-11-13 14:11:48.000000000 -0800
-+++ bsearch.c  2009-11-13 14:11:48.000000000 -0800
-@@ -77,3 +77,31 @@ bsearch(key, base0, nmemb, size, compar)
-       }
-       return (NULL);
- }
-+
-+#ifdef __BLOCKS__
-+void *
-+bsearch_b(key, base0, nmemb, size, compar)
-+      const void *key;
-+      const void *base0;
-+      size_t nmemb;
-+      size_t size;
-+      int (^compar)(const void *, const void *);
-+{
-+      const char *base = base0;
-+      size_t lim;
-+      int cmp;
-+      const void *p;
-+
-+      for (lim = nmemb; lim != 0; lim >>= 1) {
-+              p = base + (lim >> 1) * size;
-+              cmp = compar(key, p);
-+              if (cmp == 0)
-+                      return ((void *)p);
-+              if (cmp > 0) {  /* key > p: move right */
-+                      base = (char *)p + size;
-+                      lim--;
-+              }               /* else move left */
-+      }
-+      return (NULL);
-+}
-+#endif /* __BLOCKS__ */
index b29ca13c5a8ce3a7dcec0f0d061562c450056e3b..4a5bd35b37b9997b41f92efad8b076319f5fd580 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft div_t
-.Fn div "int num" "int denom"
+.Fn div "int numer" "int denom"
 .Sh DESCRIPTION
 The
 .Fn div
 function
 computes the value
-.Fa num/denom
-and returns the quotient and remainder in a structure named
+.Fa numer/denom
+(numerator/denominator).
+It returns a structure named
 .Fa div_t
 that contains two
 .Vt int
 members named
 .Va quot
-and
-.Va rem .
+(quotient) and
+.Va rem
+(remainder).
 .Sh SEE ALSO
 .Xr imaxdiv 3 ,
 .Xr ldiv 3 ,
diff --git a/stdlib/FreeBSD/div.3.patch b/stdlib/FreeBSD/div.3.patch
deleted file mode 100644 (file)
index 9d2d044..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- div.3.bsdnew       2009-11-13 14:11:48.000000000 -0800
-+++ div.3      2009-11-13 14:11:48.000000000 -0800
-@@ -41,21 +41,23 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft div_t
--.Fn div "int num" "int denom"
-+.Fn div "int numer" "int denom"
- .Sh DESCRIPTION
- The
- .Fn div
- function
- computes the value
--.Fa num/denom
--and returns the quotient and remainder in a structure named
-+.Fa numer/denom
-+(numerator/denominator).
-+It returns a structure named
- .Fa div_t
- that contains two
- .Vt int
- members named
- .Va quot
--and
--.Va rem .
-+(quotient) and
-+.Va rem
-+(remainder).
- .Sh SEE ALSO
- .Xr imaxdiv 3 ,
- .Xr ldiv 3 ,
index 84496009ad9577835ab7db438748fa2f45e9c40a..aa23703ec0c6e0489716829f65c310baee6a198c 100644 (file)
@@ -42,15 +42,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/exit.c,v 1.9 2007/01/09 00:28:09 imp Exp
 #include "libc_private.h"
 
 void (*__cleanup)(void);
-
-/*
- * This variable is zero until a process has created a thread.
- * It is used to avoid calling locking functions in libc when they
- * are not required. By default, libc is intended to be(come)
- * thread-safe, but without a (significant) penalty to non-threaded
- * processes.
- */
-int    __isthreaded    = 0;
+extern void __exit(int);
 
 /*
  * Exit, flushing stdio buffers if necessary.
@@ -59,13 +51,8 @@ void
 exit(status)
        int status;
 {
-       /* Ensure that the auto-initialization routine is linked in: */
-       extern int _thread_autoinit_dummy_decl;
-
-       _thread_autoinit_dummy_decl = 1;
-
        __cxa_finalize(NULL);
        if (__cleanup)
                (*__cleanup)();
-       _exit(status);
+       __exit(status);
 }
diff --git a/stdlib/FreeBSD/exit.c.patch b/stdlib/FreeBSD/exit.c.patch
deleted file mode 100644 (file)
index 7afb640..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- exit.c.bsdnew      2009-11-13 14:11:48.000000000 -0800
-+++ exit.c     2009-11-13 14:47:07.000000000 -0800
-@@ -42,15 +42,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include "libc_private.h"
- void (*__cleanup)(void);
--
--/*
-- * This variable is zero until a process has created a thread.
-- * It is used to avoid calling locking functions in libc when they
-- * are not required. By default, libc is intended to be(come)
-- * thread-safe, but without a (significant) penalty to non-threaded
-- * processes.
-- */
--int   __isthreaded    = 0;
-+extern void __exit(int);
- /*
-  * Exit, flushing stdio buffers if necessary.
-@@ -59,13 +51,8 @@ void
- exit(status)
-       int status;
- {
--      /* Ensure that the auto-initialization routine is linked in: */
--      extern int _thread_autoinit_dummy_decl;
--
--      _thread_autoinit_dummy_decl = 1;
--
-       __cxa_finalize(NULL);
-       if (__cleanup)
-               (*__cleanup)();
--      _exit(status);
-+      __exit(status);
- }
index fc1963287a5ed7f38c7034aaa419bf876eb92a0d..498a365c429d9afb8ec080a612d55ccc2512e1b1 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft char *
-.Fn getenv "const char *name"
+.Fo getenv
+.Fa "const char *name"
+.Fc
 .Ft int
-.Fn setenv "const char *name" "const char *value" "int overwrite"
+.Fo putenv
+.Fa "char *string"
+.Fc
 .Ft int
-.Fn putenv "const char *string"
-.Ft void
-.Fn unsetenv "const char *name"
+.Fo setenv
+.Fa "const char *name"
+.Fa "const char *value"
+.Fa "int overwrite"
+.Fc
+.Ft int
+.Fo unsetenv
+.Fa "const char *name"
+.Fc
 .Sh DESCRIPTION
 These functions set, unset and fetch environment variables from the
 host
@@ -104,12 +114,26 @@ equivalent to:
 setenv(name, value, 1);
 .Ed
 .Pp
+The string pointed to by
+.Fa string
+becomes part of the environment.
+A program should not alter or free the string,
+and should not use stack or other transient string variables
+as arguments to
+.Fn putenv .
+The
+.Fn setenv
+function is strongly preferred to
+.Fn putenv .
+.Pp
 The
 .Fn unsetenv
 function
 deletes all instances of the variable name pointed to by
 .Fa name
 from the list.
+Note that only the variable name (e.g., "NAME") should be given;
+"NAME=value" will not work.
 .Sh RETURN VALUES
 The
 .Fn getenv
@@ -122,20 +146,60 @@ is not in the current environment,
 .Dv NULL
 is returned.
 .Pp
-.Rv -std setenv putenv
+.Rv -std setenv putenv unsetenv
 .Sh ERRORS
 .Bl -tag -width Er
+.It Bq Er EINVAL
+The function
+.Fn unsetenv
+failed because
+.Fa name
+was not found in the environment list.
 .It Bq Er ENOMEM
 The function
 .Fn setenv
 or
 .Fn putenv
-failed because they were unable to allocate memory for the environment.
+failed because it was unable to allocate memory for the environment.
 .El
+.Sh LEGACY SYNOPSIS
+.Fd #include <stdlib.h>
+.Pp
+.Ft void
+.br
+.Fo unsetenv
+.Fa "const char *name"
+.Fc ;
+.Pp
+.Fn unsetenv
+doesn't return a value.
+.Sh COMPATIBILITY
+.Fn putenv
+no longer copies its input buffer.
+This often appears in crash logs as a crash in
+.Fn getenv .
+Avoid passing local buffers or freeing the memory
+that is passed to
+.Fn putenv .
+Use
+.Fn setenv ,  
+which still makes an internal copy of its buffers.
+.Pp
+.Fn unsetenv
+no longer parses the variable name;
+e.g., unsetenv ("FOO=BAR") no longer works.
+Use unsetenv("FOO").
+.Fn unsetenv
+also now returns a status value and will set
+.Va errno
+to EINVAL if
+.Fa name
+is not a defined environment variable.
 .Sh SEE ALSO
 .Xr csh 1 ,
 .Xr sh 1 ,
 .Xr execve 2 ,
+.Xr compat 5 ,
 .Xr environ 7
 .Sh STANDARDS
 The
diff --git a/stdlib/FreeBSD/getenv.3.patch b/stdlib/FreeBSD/getenv.3.patch
deleted file mode 100644 (file)
index 2e2be3b..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
---- getenv.3   2004-11-25 11:38:41.000000000 -0800
-+++ getenv.3.edit      2006-09-17 20:33:52.000000000 -0700
-@@ -50,13 +50,23 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft char *
--.Fn getenv "const char *name"
-+.Fo getenv
-+.Fa "const char *name"
-+.Fc
- .Ft int
--.Fn setenv "const char *name" "const char *value" "int overwrite"
-+.Fo putenv
-+.Fa "char *string"
-+.Fc
- .Ft int
--.Fn putenv "const char *string"
--.Ft void
--.Fn unsetenv "const char *name"
-+.Fo setenv
-+.Fa "const char *name"
-+.Fa "const char *value"
-+.Fa "int overwrite"
-+.Fc
-+.Ft int
-+.Fo unsetenv
-+.Fa "const char *name"
-+.Fc
- .Sh DESCRIPTION
- These functions set, unset and fetch environment variables from the
- host
-@@ -104,12 +114,26 @@
- setenv(name, value, 1);
- .Ed
- .Pp
-+The string pointed to by
-+.Fa string
-+becomes part of the environment.
-+A program should not alter or free the string,
-+and should not use stack or other transient string variables
-+as arguments to
-+.Fn putenv .
-+The
-+.Fn setenv
-+function is strongly preferred to
-+.Fn putenv .
-+.Pp
- The
- .Fn unsetenv
- function
- deletes all instances of the variable name pointed to by
- .Fa name
- from the list.
-+Note that only the variable name (e.g., "NAME") should be given;
-+"NAME=value" will not work.
- .Sh RETURN VALUES
- The
- .Fn getenv
-@@ -122,20 +146,60 @@
- .Dv NULL
- is returned.
- .Pp
--.Rv -std setenv putenv
-+.Rv -std setenv putenv unsetenv
- .Sh ERRORS
- .Bl -tag -width Er
-+.It Bq Er EINVAL
-+The function
-+.Fn unsetenv
-+failed because
-+.Fa name
-+was not found in the environment list.
- .It Bq Er ENOMEM
- The function
- .Fn setenv
- or
- .Fn putenv
--failed because they were unable to allocate memory for the environment.
-+failed because it was unable to allocate memory for the environment.
- .El
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <stdlib.h>
-+.Pp
-+.Ft void
-+.br
-+.Fo unsetenv
-+.Fa "const char *name"
-+.Fc ;
-+.Pp
-+.Fn unsetenv
-+doesn't return a value.
-+.Sh COMPATIBILITY
-+.Fn putenv
-+no longer copies its input buffer.
-+This often appears in crash logs as a crash in
-+.Fn getenv .
-+Avoid passing local buffers or freeing the memory
-+that is passed to
-+.Fn putenv .
-+Use
-+.Fn setenv ,  
-+which still makes an internal copy of its buffers.
-+.Pp
-+.Fn unsetenv
-+no longer parses the variable name;
-+e.g., unsetenv ("FOO=BAR") no longer works.
-+Use unsetenv("FOO").
-+.Fn unsetenv
-+also now returns a status value and will set
-+.Va errno
-+to EINVAL if
-+.Fa name
-+is not a defined environment variable.
- .Sh SEE ALSO
- .Xr csh 1 ,
- .Xr sh 1 ,
- .Xr execve 2 ,
-+.Xr compat 5 ,
- .Xr environ 7
- .Sh STANDARDS
- The
index b1e034a3ff8aadee38a4d4ecc384f8d2f28f1f8b..47b60dfab1c9f9a56de038c3c16c14bf1998b1ba 100644 (file)
@@ -36,8 +36,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.8 2007/05/01 16:02:41 ache
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
+#include <crt_externs.h>
 
-inline char *__findenv(const char *, int *);
+__private_extern__ char *__findenv(const char *, int *, char **);
 
 /*
  * __findenv --
@@ -48,12 +49,12 @@ inline char *__findenv(const char *, int *);
  *
  *     This routine *should* be a static; don't use it.
  */
-inline char *
-__findenv(name, offset)
+__private_extern__ char *
+__findenv(name, offset, environ)
        const char *name;
        int *offset;
+       char **environ;
 {
-       extern char **environ;
        int len, i;
        const char *np;
        char **p, *cp;
@@ -75,6 +76,19 @@ __findenv(name, offset)
        return (NULL);
 }
 
+/*
+ * _getenvp -- SPI using an arbitrary pointer to string array (the array must
+ * have been created with malloc) and an env state, created by _allocenvstate().
+ *     Returns ptr to value associated with name, if any, else NULL.
+ */
+char *
+_getenvp(const char *name, char ***envp, void *state __unused)
+{
+       int offset;
+
+       return (__findenv(name, &offset, *envp));
+}
+
 /*
  * getenv --
  *     Returns ptr to value associated with name, if any, else NULL.
@@ -85,5 +99,5 @@ getenv(name)
 {
        int offset;
 
-       return (__findenv(name, &offset));
+       return (__findenv(name, &offset, *_NSGetEnviron()));
 }
diff --git a/stdlib/FreeBSD/getenv.c.patch b/stdlib/FreeBSD/getenv.c.patch
deleted file mode 100644 (file)
index 2155a0b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
---- getenv.c.bsdnew    2009-11-13 15:14:36.000000000 -0800
-+++ getenv.c   2009-11-13 15:14:50.000000000 -0800
-@@ -36,8 +36,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <stdlib.h>
- #include <stddef.h>
- #include <string.h>
-+#include <crt_externs.h>
--inline char *__findenv(const char *, int *);
-+__private_extern__ char *__findenv(const char *, int *, char **);
- /*
-  * __findenv --
-@@ -48,12 +49,12 @@ inline char *__findenv(const char *, int
-  *
-  *    This routine *should* be a static; don't use it.
-  */
--inline char *
--__findenv(name, offset)
-+__private_extern__ char *
-+__findenv(name, offset, environ)
-       const char *name;
-       int *offset;
-+      char **environ;
- {
--      extern char **environ;
-       int len, i;
-       const char *np;
-       char **p, *cp;
-@@ -76,6 +77,19 @@ __findenv(name, offset)
- }
- /*
-+ * _getenvp -- SPI using an arbitrary pointer to string array (the array must
-+ * have been created with malloc) and an env state, created by _allocenvstate().
-+ *    Returns ptr to value associated with name, if any, else NULL.
-+ */
-+char *
-+_getenvp(const char *name, char ***envp, void *state __unused)
-+{
-+      int offset;
-+
-+      return (__findenv(name, &offset, *envp));
-+}
-+
-+/*
-  * getenv --
-  *    Returns ptr to value associated with name, if any, else NULL.
-  */
-@@ -85,5 +99,5 @@ getenv(name)
- {
-       int offset;
--      return (__findenv(name, &offset));
-+      return (__findenv(name, &offset, *_NSGetEnviron()));
- }
index 375907ac6cfc88ae783d13519c2e9ecee47ea72e..c45494c8a8056c1ba59a62920e9f672a927c3443 100644 (file)
@@ -44,16 +44,24 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/getopt.c,v 1.8 2007/01/09 00:28:10 imp E
 
 #include "libc_private.h"
 
+#ifndef BUILDING_VARIANT
 int    opterr = 1,             /* if error message should be printed */
        optind = 1,             /* index into parent argv vector */
        optopt,                 /* character checked for validity */
        optreset;               /* reset getopt */
 char   *optarg;                /* argument associated with option */
+#endif /* !BUILDING_VARIANT */
 
 #define        BADCH   (int)'?'
 #define        BADARG  (int)':'
 #define        EMSG    ""
 
+#if __DARWIN_UNIX03
+#define PROGNAME nargv[0]
+#else
+#define PROGNAME _getprogname()
+#endif
+
 /*
  * getopt --
  *     Parse argc/argv argument vector.
@@ -99,8 +107,8 @@ getopt(nargc, nargv, ostr)
                        ++optind;
                if (opterr && *ostr != ':')
                        (void)fprintf(stderr,
-                           "%s: illegal option -- %c\n", _getprogname(),
-                           optopt);
+                           "%s: illegal option -- %c\n",
+                           PROGNAME, optopt);
                return (BADCH);
        }
 
@@ -119,13 +127,19 @@ getopt(nargc, nargv, ostr)
                        optarg = nargv[optind];
                else {
                        /* option-argument absent */
+#if __DARWIN_UNIX03
+                       /* Yes, the standard will put optind past the last
+                          argument */
+                       ++optind;
+                       optarg = NULL;
+#endif /* __DARWIN_UNIX03 */
                        place = EMSG;
                        if (*ostr == ':')
                                return (BADARG);
                        if (opterr)
                                (void)fprintf(stderr,
                                    "%s: option requires an argument -- %c\n",
-                                   _getprogname(), optopt);
+                                   PROGNAME, optopt);
                        return (BADCH);
                }
                place = EMSG;
diff --git a/stdlib/FreeBSD/getopt.c.patch b/stdlib/FreeBSD/getopt.c.patch
deleted file mode 100644 (file)
index b4b18e9..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
---- getopt.c.bsdnew    2009-11-13 14:11:48.000000000 -0800
-+++ getopt.c   2009-11-13 14:11:48.000000000 -0800
-@@ -44,16 +44,24 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include "libc_private.h"
-+#ifndef BUILDING_VARIANT
- int   opterr = 1,             /* if error message should be printed */
-       optind = 1,             /* index into parent argv vector */
-       optopt,                 /* character checked for validity */
-       optreset;               /* reset getopt */
- char  *optarg;                /* argument associated with option */
-+#endif /* !BUILDING_VARIANT */
- #define       BADCH   (int)'?'
- #define       BADARG  (int)':'
- #define       EMSG    ""
-+#if __DARWIN_UNIX03
-+#define PROGNAME nargv[0]
-+#else
-+#define PROGNAME _getprogname()
-+#endif
-+
- /*
-  * getopt --
-  *    Parse argc/argv argument vector.
-@@ -99,8 +107,8 @@ getopt(nargc, nargv, ostr)
-                       ++optind;
-               if (opterr && *ostr != ':')
-                       (void)fprintf(stderr,
--                          "%s: illegal option -- %c\n", _getprogname(),
--                          optopt);
-+                          "%s: illegal option -- %c\n",
-+                          PROGNAME, optopt);
-               return (BADCH);
-       }
-@@ -119,13 +127,19 @@ getopt(nargc, nargv, ostr)
-                       optarg = nargv[optind];
-               else {
-                       /* option-argument absent */
-+#if __DARWIN_UNIX03
-+                      /* Yes, the standard will put optind past the last
-+                         argument */
-+                      ++optind;
-+                      optarg = NULL;
-+#endif /* __DARWIN_UNIX03 */
-                       place = EMSG;
-                       if (*ostr == ':')
-                               return (BADARG);
-                       if (opterr)
-                               (void)fprintf(stderr,
-                                   "%s: option requires an argument -- %c\n",
--                                  _getprogname(), optopt);
-+                                  PROGNAME, optopt);
-                       return (BADCH);
-               }
-               place = EMSG;
index 544e3438f28bf788d1505d0f458f61755cdb5660..c1ddee227418c5c93b64b9c3e76c9a5d15a5f83b 100644 (file)
 .In stdlib.h
 .Vt extern char *suboptarg ;
 .Ft int
-.Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep"
+.Fo getsubopt
+.Fa "char **optionp"
+.Fa "char *const *keylistp"
+.Fa "char **valuep"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn getsubopt
 function
-parses a string containing tokens delimited by one or more tab, space or
-comma
+parses a string containing tokens that are delimited
+by one or more tab, space, or comma
 .Pq Ql \&,
 characters.
-It is intended for use in parsing groups of option arguments provided
-as part of a utility command line.
+It is intended for use in parsing groups of option arguments
+that are provided as part of a utility command line.
 .Pp
 The argument
 .Fa optionp
 is a pointer to a pointer to the string.
 The argument
-.Fa tokens
+.Fa keylistp
 is a pointer to a
 .Dv NULL Ns -terminated
 array of pointers to strings.
@@ -65,10 +69,10 @@ The
 .Fn getsubopt
 function
 returns the zero-based offset of the pointer in the
-.Fa tokens
-array referencing a string which matches the first token
-in the string, or, \-1 if the string contains no tokens or
-.Fa tokens
+.Fa keylistp
+array, referencing a string which matches the first token in the string
+ or \-1 if the string contains no tokens or
+.Fa keylistp
 does not contain a matching string.
 .Pp
 If the token is of the form ``name=value'', the location referenced by
@@ -93,7 +97,7 @@ will be set to point to the ``value'' portion of the token, or
 if no ``value'' portion was present.
 .Sh EXAMPLES
 .Bd -literal -compact
-char *tokens[] = {
+char *keylistp[] = {
        #define ONE     0
                "one",
        #define TWO     1
@@ -114,7 +118,7 @@ while ((ch = getopt(argc, argv, "ab:")) != \-1) {
        case 'b':
                options = optarg;
                while (*options) {
-                       switch(getsubopt(&options, tokens, &value)) {
+                       switch(getsubopt(&options, keylistp, &value)) {
                        case ONE:
                                /* process ``one'' sub option */
                                break;
diff --git a/stdlib/FreeBSD/getsubopt.3.patch b/stdlib/FreeBSD/getsubopt.3.patch
deleted file mode 100644 (file)
index 9198467..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
---- getsubopt.3.bsdnew 2009-11-13 14:11:48.000000000 -0800
-+++ getsubopt.3        2009-11-13 14:11:48.000000000 -0800
-@@ -40,23 +40,27 @@
- .In stdlib.h
- .Vt extern char *suboptarg ;
- .Ft int
--.Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep"
-+.Fo getsubopt
-+.Fa "char **optionp"
-+.Fa "char *const *keylistp"
-+.Fa "char **valuep"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn getsubopt
- function
--parses a string containing tokens delimited by one or more tab, space or
--comma
-+parses a string containing tokens that are delimited
-+by one or more tab, space, or comma
- .Pq Ql \&,
- characters.
--It is intended for use in parsing groups of option arguments provided
--as part of a utility command line.
-+It is intended for use in parsing groups of option arguments
-+that are provided as part of a utility command line.
- .Pp
- The argument
- .Fa optionp
- is a pointer to a pointer to the string.
- The argument
--.Fa tokens
-+.Fa keylistp
- is a pointer to a
- .Dv NULL Ns -terminated
- array of pointers to strings.
-@@ -65,10 +69,10 @@ The
- .Fn getsubopt
- function
- returns the zero-based offset of the pointer in the
--.Fa tokens
--array referencing a string which matches the first token
--in the string, or, \-1 if the string contains no tokens or
--.Fa tokens
-+.Fa keylistp
-+array, referencing a string which matches the first token in the string
-+ or \-1 if the string contains no tokens or
-+.Fa keylistp
- does not contain a matching string.
- .Pp
- If the token is of the form ``name=value'', the location referenced by
-@@ -93,7 +97,7 @@ will be set to point to the ``value'' po
- if no ``value'' portion was present.
- .Sh EXAMPLES
- .Bd -literal -compact
--char *tokens[] = {
-+char *keylistp[] = {
-       #define ONE     0
-               "one",
-       #define TWO     1
-@@ -114,7 +118,7 @@ while ((ch = getopt(argc, argv, "ab:")) 
-       case 'b':
-               options = optarg;
-               while (*options) {
--                      switch(getsubopt(&options, tokens, &value)) {
-+                      switch(getsubopt(&options, keylistp, &value)) {
-                       case ONE:
-                               /* process ``one'' sub option */
-                               break;
diff --git a/stdlib/FreeBSD/heapsort_b.c b/stdlib/FreeBSD/heapsort_b.c
new file mode 100644 (file)
index 0000000..b424604
--- /dev/null
@@ -0,0 +1,181 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)heapsort.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/heapsort.c,v 1.6 2008/01/13 02:11:10 das Exp $");
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+/*
+ * Swap two areas of size number of bytes.  Although qsort(3) permits random
+ * blocks of memory to be sorted, sorting pointers is almost certainly the
+ * common case (and, were it not, could easily be made so).  Regardless, it
+ * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
+ * arithmetic gets lost in the time required for comparison function calls.
+ */
+#define        SWAP(a, b, count, size, tmp) { \
+       count = size; \
+       do { \
+               tmp = *a; \
+               *a++ = *b; \
+               *b++ = tmp; \
+       } while (--count); \
+}
+
+/* Copy one block of size size to another. */
+#define COPY(a, b, count, size, tmp1, tmp2) { \
+       count = size; \
+       tmp1 = a; \
+       tmp2 = b; \
+       do { \
+               *tmp1++ = *tmp2++; \
+       } while (--count); \
+}
+
+/*
+ * Build the list into a heap, where a heap is defined such that for
+ * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
+ *
+ * There two cases.  If j == nmemb, select largest of Ki and Kj.  If
+ * j < nmemb, select largest of Ki, Kj and Kj+1.
+ */
+#define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \
+       for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
+           par_i = child_i) { \
+               child = base + child_i * size; \
+               if (child_i < nmemb && compar(child, child + size) < 0) { \
+                       child += size; \
+                       ++child_i; \
+               } \
+               par = base + par_i * size; \
+               if (compar(child, par) <= 0) \
+                       break; \
+               SWAP(par, child, count, size, tmp); \
+       } \
+}
+
+/*
+ * Select the top of the heap and 'heapify'.  Since by far the most expensive
+ * action is the call to the compar function, a considerable optimization
+ * in the average case can be achieved due to the fact that k, the displaced
+ * elememt, is ususally quite small, so it would be preferable to first
+ * heapify, always maintaining the invariant that the larger child is copied
+ * over its parent's record.
+ *
+ * Then, starting from the *bottom* of the heap, finding k's correct place,
+ * again maintianing the invariant.  As a result of the invariant no element
+ * is 'lost' when k is assigned its correct place in the heap.
+ *
+ * The time savings from this optimization are on the order of 15-20% for the
+ * average case. See Knuth, Vol. 3, page 158, problem 18.
+ *
+ * XXX Don't break the #define SELECT line, below.  Reiser cpp gets upset.
+ */
+#define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
+       for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
+               child = base + child_i * size; \
+               if (child_i < nmemb && compar(child, child + size) < 0) { \
+                       child += size; \
+                       ++child_i; \
+               } \
+               par = base + par_i * size; \
+               COPY(par, child, count, size, tmp1, tmp2); \
+       } \
+       for (;;) { \
+               child_i = par_i; \
+               par_i = child_i / 2; \
+               child = base + child_i * size; \
+               par = base + par_i * size; \
+               if (child_i == 1 || compar(k, par) < 0) { \
+                       COPY(child, k, count, size, tmp1, tmp2); \
+                       break; \
+               } \
+               COPY(child, par, count, size, tmp1, tmp2); \
+       } \
+}
+
+/*
+ * Heapsort -- Knuth, Vol. 3, page 145.  Runs in O (N lg N), both average
+ * and worst.  While heapsort is faster than the worst case of quicksort,
+ * the BSD quicksort does median selection so that the chance of finding
+ * a data set that will trigger the worst case is nonexistent.  Heapsort's
+ * only advantage over quicksort is that it requires little additional memory.
+ */
+int
+heapsort_b(vbase, nmemb, size, compar)
+       void *vbase;
+       size_t nmemb, size;
+       int (^compar)(const void *, const void *);
+{
+       size_t cnt, i, j, l;
+       char tmp, *tmp1, *tmp2;
+       char *base, *k, *p, *t;
+
+       if (nmemb <= 1)
+               return (0);
+
+       if (!size) {
+               errno = EINVAL;
+               return (-1);
+       }
+
+       if ((k = malloc(size)) == NULL)
+               return (-1);
+
+       /*
+        * Items are numbered from 1 to nmemb, so offset from size bytes
+        * below the starting address.
+        */
+       base = (char *)vbase - size;
+
+       for (l = nmemb / 2 + 1; --l;)
+               CREATE(l, nmemb, i, j, t, p, size, cnt, tmp);
+
+       /*
+        * For each element of the heap, save the largest element into its
+        * final slot, save the displaced element (k), then recreate the
+        * heap.
+        */
+       while (nmemb > 1) {
+               COPY(k, base + nmemb * size, cnt, size, tmp1, tmp2);
+               COPY(base + nmemb * size, base + size, cnt, size, tmp1, tmp2);
+               --nmemb;
+               SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2);
+       }
+       free(k);
+       return (0);
+}
diff --git a/stdlib/FreeBSD/heapsort_b.c.patch b/stdlib/FreeBSD/heapsort_b.c.patch
deleted file mode 100644 (file)
index c1cab16..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- heapsort_b.c.orig  2008-09-24 13:48:45.000000000 -0700
-+++ heapsort_b.c       2008-09-24 13:48:56.000000000 -0700
-@@ -136,10 +136,10 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * only advantage over quicksort is that it requires little additional memory.
-  */
- int
--heapsort(vbase, nmemb, size, compar)
-+heapsort_b(vbase, nmemb, size, compar)
-       void *vbase;
-       size_t nmemb, size;
--      int (*compar)(const void *, const void *);
-+      int (^compar)(const void *, const void *);
- {
-       size_t cnt, i, j, l;
-       char tmp, *tmp1, *tmp2;
diff --git a/stdlib/FreeBSD/heapsort_r.c b/stdlib/FreeBSD/heapsort_r.c
new file mode 100644 (file)
index 0000000..2f0b26f
--- /dev/null
@@ -0,0 +1,182 @@
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)heapsort.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/heapsort.c,v 1.6 2008/01/13 02:11:10 das Exp $");
+
+#include <errno.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+/*
+ * Swap two areas of size number of bytes.  Although qsort(3) permits random
+ * blocks of memory to be sorted, sorting pointers is almost certainly the
+ * common case (and, were it not, could easily be made so).  Regardless, it
+ * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
+ * arithmetic gets lost in the time required for comparison function calls.
+ */
+#define        SWAP(a, b, count, size, tmp) { \
+       count = size; \
+       do { \
+               tmp = *a; \
+               *a++ = *b; \
+               *b++ = tmp; \
+       } while (--count); \
+}
+
+/* Copy one block of size size to another. */
+#define COPY(a, b, count, size, tmp1, tmp2) { \
+       count = size; \
+       tmp1 = a; \
+       tmp2 = b; \
+       do { \
+               *tmp1++ = *tmp2++; \
+       } while (--count); \
+}
+
+/*
+ * Build the list into a heap, where a heap is defined such that for
+ * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
+ *
+ * There two cases.  If j == nmemb, select largest of Ki and Kj.  If
+ * j < nmemb, select largest of Ki, Kj and Kj+1.
+ */
+#define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \
+       for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
+           par_i = child_i) { \
+               child = base + child_i * size; \
+               if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
+                       child += size; \
+                       ++child_i; \
+               } \
+               par = base + par_i * size; \
+               if (compar(thunk, child, par) <= 0) \
+                       break; \
+               SWAP(par, child, count, size, tmp); \
+       } \
+}
+
+/*
+ * Select the top of the heap and 'heapify'.  Since by far the most expensive
+ * action is the call to the compar function, a considerable optimization
+ * in the average case can be achieved due to the fact that k, the displaced
+ * elememt, is ususally quite small, so it would be preferable to first
+ * heapify, always maintaining the invariant that the larger child is copied
+ * over its parent's record.
+ *
+ * Then, starting from the *bottom* of the heap, finding k's correct place,
+ * again maintianing the invariant.  As a result of the invariant no element
+ * is 'lost' when k is assigned its correct place in the heap.
+ *
+ * The time savings from this optimization are on the order of 15-20% for the
+ * average case. See Knuth, Vol. 3, page 158, problem 18.
+ *
+ * XXX Don't break the #define SELECT line, below.  Reiser cpp gets upset.
+ */
+#define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
+       for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
+               child = base + child_i * size; \
+               if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
+                       child += size; \
+                       ++child_i; \
+               } \
+               par = base + par_i * size; \
+               COPY(par, child, count, size, tmp1, tmp2); \
+       } \
+       for (;;) { \
+               child_i = par_i; \
+               par_i = child_i / 2; \
+               child = base + child_i * size; \
+               par = base + par_i * size; \
+               if (child_i == 1 || compar(thunk, k, par) < 0) { \
+                       COPY(child, k, count, size, tmp1, tmp2); \
+                       break; \
+               } \
+               COPY(child, par, count, size, tmp1, tmp2); \
+       } \
+}
+
+/*
+ * Heapsort -- Knuth, Vol. 3, page 145.  Runs in O (N lg N), both average
+ * and worst.  While heapsort is faster than the worst case of quicksort,
+ * the BSD quicksort does median selection so that the chance of finding
+ * a data set that will trigger the worst case is nonexistent.  Heapsort's
+ * only advantage over quicksort is that it requires little additional memory.
+ */
+__private_extern__ int
+__heapsort_r(vbase, nmemb, size, thunk, compar)
+       void *vbase;
+       size_t nmemb, size;
+       void *thunk;
+       int (*compar)(void *, const void *, const void *);
+{
+       size_t cnt, i, j, l;
+       char tmp, *tmp1, *tmp2;
+       char *base, *k, *p, *t;
+
+       if (nmemb <= 1)
+               return (0);
+
+       if (!size) {
+               errno = EINVAL;
+               return (-1);
+       }
+
+       if ((k = malloc(size)) == NULL)
+               return (-1);
+
+       /*
+        * Items are numbered from 1 to nmemb, so offset from size bytes
+        * below the starting address.
+        */
+       base = (char *)vbase - size;
+
+       for (l = nmemb / 2 + 1; --l;)
+               CREATE(l, nmemb, i, j, t, p, size, cnt, tmp);
+
+       /*
+        * For each element of the heap, save the largest element into its
+        * final slot, save the displaced element (k), then recreate the
+        * heap.
+        */
+       while (nmemb > 1) {
+               COPY(k, base + nmemb * size, cnt, size, tmp1, tmp2);
+               COPY(base + nmemb * size, base + size, cnt, size, tmp1, tmp2);
+               --nmemb;
+               SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2);
+       }
+       free(k);
+       return (0);
+}
diff --git a/stdlib/FreeBSD/heapsort_r.c.patch b/stdlib/FreeBSD/heapsort_r.c.patch
deleted file mode 100644 (file)
index 04968f7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
---- heapsort_r.c.orig  2008-09-24 13:48:45.000000000 -0700
-+++ heapsort_r.c       2008-09-24 13:59:08.000000000 -0700
-@@ -77,12 +77,12 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-       for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
-           par_i = child_i) { \
-               child = base + child_i * size; \
--              if (child_i < nmemb && compar(child, child + size) < 0) { \
-+              if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
-                       child += size; \
-                       ++child_i; \
-               } \
-               par = base + par_i * size; \
--              if (compar(child, par) <= 0) \
-+              if (compar(thunk, child, par) <= 0) \
-                       break; \
-               SWAP(par, child, count, size, tmp); \
-       } \
-@@ -108,7 +108,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
-       for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
-               child = base + child_i * size; \
--              if (child_i < nmemb && compar(child, child + size) < 0) { \
-+              if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
-                       child += size; \
-                       ++child_i; \
-               } \
-@@ -120,7 +120,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-               par_i = child_i / 2; \
-               child = base + child_i * size; \
-               par = base + par_i * size; \
--              if (child_i == 1 || compar(k, par) < 0) { \
-+              if (child_i == 1 || compar(thunk, k, par) < 0) { \
-                       COPY(child, k, count, size, tmp1, tmp2); \
-                       break; \
-               } \
-@@ -135,11 +135,12 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * a data set that will trigger the worst case is nonexistent.  Heapsort's
-  * only advantage over quicksort is that it requires little additional memory.
-  */
--int
--heapsort(vbase, nmemb, size, compar)
-+__private_extern__ int
-+__heapsort_r(vbase, nmemb, size, thunk, compar)
-       void *vbase;
-       size_t nmemb, size;
--      int (*compar)(const void *, const void *);
-+      void *thunk;
-+      int (*compar)(void *, const void *, const void *);
- {
-       size_t cnt, i, j, l;
-       char tmp, *tmp1, *tmp2;
index 2a6bad57fecf7e4867a0e4fb99bceba466905ee0..a9f5e12f53cbefc659076a1b97124dd578994dcf 100644 (file)
 The
 .Fn imaxdiv
 function computes the value of
-.Fa numer
+.Fa numer ,
 divided by
-.Fa denom
-and returns the stored result in the form of the
+.Fa denom .
+The stored result is returned in the form of the
 .Vt imaxdiv_t
 type.
 .Pp
@@ -52,7 +52,7 @@ The
 type is defined as:
 .Bd -literal -offset indent
 typedef struct {
-       intmax_t quot; /* Quotient. */
+       intmax_t quot; /* Quotient.  */
        intmax_t rem;  /* Remainder. */
 } imaxdiv_t;
 .Ed
diff --git a/stdlib/FreeBSD/imaxdiv.3.patch b/stdlib/FreeBSD/imaxdiv.3.patch
deleted file mode 100644 (file)
index 8b7d615..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- _SB/Libc/stdlib/FreeBSD/imaxdiv.3  2003-05-20 15:23:24.000000000 -0700
-+++ _SB/Libc/stdlib/FreeBSD/imaxdiv.3.edit     2006-06-28 16:55:52.000000000 -0700
-@@ -40,10 +40,10 @@
- The
- .Fn imaxdiv
- function computes the value of
--.Fa numer
-+.Fa numer ,
- divided by
--.Fa denom
--and returns the stored result in the form of the
-+.Fa denom .
-+The stored result is returned in the form of the
- .Vt imaxdiv_t
- type.
- .Pp
-@@ -52,7 +52,7 @@
- type is defined as:
- .Bd -literal -offset indent
- typedef struct {
--      intmax_t quot; /* Quotient. */
-+      intmax_t quot; /* Quotient.  */
-       intmax_t rem;  /* Remainder. */
- } imaxdiv_t;
- .Ed
index 06f93bf20fc346e0fe35cb252ffe683ee9119775..b1d47d6b3b679107f6135d4e9e67476561b82ea3 100644 (file)
@@ -20,7 +20,7 @@
 .Sh SYNOPSIS
 .In search.h
 .Ft void
-.Fn insque "void *element1" "void *pred"
+.Fn insque "void *element" "void *pred"
 .Ft void
 .Fn remque "void *element"
 .Sh DESCRIPTION
diff --git a/stdlib/FreeBSD/insque.3.patch b/stdlib/FreeBSD/insque.3.patch
deleted file mode 100644 (file)
index 8edc8e3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- _SB/Libc/stdlib/FreeBSD/insque.3   2003-05-20 15:23:24.000000000 -0700
-+++ _SB/Libc/stdlib/FreeBSD/insque.3.edit      2006-06-28 16:55:52.000000000 -0700
-@@ -20,7 +20,7 @@
- .Sh SYNOPSIS
- .In search.h
- .Ft void
--.Fn insque "void *element1" "void *pred"
-+.Fn insque "void *element" "void *pred"
- .Ft void
- .Fn remque "void *element"
- .Sh DESCRIPTION
index b38d8adb658ccd02d6446def1f837a7a742bbc6b..b0009556ffee1cf0b7d1f157cba41d65f9d8fea3 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft long
-.Fn labs "long j"
+.Fn labs "long i"
 .Sh DESCRIPTION
 The
 .Fn labs
 function
 returns the absolute value of the long integer
-.Fa j .
+.Fa i .
 .Sh SEE ALSO
 .Xr abs 3 ,
 .Xr cabs 3 ,
diff --git a/stdlib/FreeBSD/labs.3.patch b/stdlib/FreeBSD/labs.3.patch
deleted file mode 100644 (file)
index baa4f45..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- labs.3.bsdnew      2009-11-13 14:11:49.000000000 -0800
-+++ labs.3     2009-11-13 14:11:49.000000000 -0800
-@@ -43,13 +43,13 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft long
--.Fn labs "long j"
-+.Fn labs "long i"
- .Sh DESCRIPTION
- The
- .Fn labs
- function
- returns the absolute value of the long integer
--.Fa j .
-+.Fa i .
- .Sh SEE ALSO
- .Xr abs 3 ,
- .Xr cabs 3 ,
index 492d5084f28ee4ec4592e2aa7746763bc38e1825..904f0d5ef4ae405e0b6678ee8c72939605a67152 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft ldiv_t
-.Fn ldiv "long num" "long denom"
+.Fn ldiv "long numer" "long denom"
 .Sh DESCRIPTION
 The
 .Fn ldiv
 function
 computes the value
-.Fa num Ns / Ns Fa denom
-and returns the quotient and remainder in a structure named
+.Fa numer Ns / Ns Fa denom
+(numerator/denominator).
+Ir returns the quotient and remainder in a structure named
 .Vt ldiv_t
 that contains two
 .Vt long
diff --git a/stdlib/FreeBSD/ldiv.3.patch b/stdlib/FreeBSD/ldiv.3.patch
deleted file mode 100644 (file)
index 107a217..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- ldiv.3.bsdnew      2009-11-13 14:11:49.000000000 -0800
-+++ ldiv.3     2009-11-13 14:11:49.000000000 -0800
-@@ -43,14 +43,15 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft ldiv_t
--.Fn ldiv "long num" "long denom"
-+.Fn ldiv "long numer" "long denom"
- .Sh DESCRIPTION
- The
- .Fn ldiv
- function
- computes the value
--.Fa num Ns / Ns Fa denom
--and returns the quotient and remainder in a structure named
-+.Fa numer Ns / Ns Fa denom
-+(numerator/denominator).
-+Ir returns the quotient and remainder in a structure named
- .Vt ldiv_t
- that contains two
- .Vt long
index a8238dacea5a41728be65651e7eb9d4b0149b34f..96b104fd938daa5dd5ae407cd40d349ff2523366 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft "long long"
-.Fn llabs "long long j"
+.Fn llabs "long long i"
 .Sh DESCRIPTION
 The
 .Fn llabs
 function returns the absolute value of
-.Fa j .
+.Fa i .
 .Sh SEE ALSO
 .Xr abs 3 ,
 .Xr fabs 3 ,
diff --git a/stdlib/FreeBSD/llabs.3.patch b/stdlib/FreeBSD/llabs.3.patch
deleted file mode 100644 (file)
index 0ff3af8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
---- _SB/Libc/stdlib/FreeBSD/llabs.3    2003-05-20 15:23:24.000000000 -0700
-+++ _SB/Libc/stdlib/FreeBSD/llabs.3.edit       2006-06-28 16:55:53.000000000 -0700
-@@ -35,12 +35,12 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft "long long"
--.Fn llabs "long long j"
-+.Fn llabs "long long i"
- .Sh DESCRIPTION
- The
- .Fn llabs
- function returns the absolute value of
--.Fa j .
-+.Fa i .
- .Sh SEE ALSO
- .Xr abs 3 ,
- .Xr fabs 3 ,
index 96ecf1aeec70fc12d1261abed11564bd0e9c8b5f..98f4813574728d9a920fcb4315cf8c1dc27b8a3b 100644 (file)
 The
 .Fn lldiv
 function computes the value of
-.Fa numer
+.Fa numer ,
 divided by
-.Fa denom
-and returns the stored result in the form of the
+.Fa denom .
+It returns the stored result in the form of the
 .Vt lldiv_t
 type.
 .Pp
@@ -52,7 +52,7 @@ The
 type is defined as:
 .Bd -literal -offset indent
 typedef struct {
-       long long quot; /* Quotient. */
+       long long quot; /* Quotient.  */
        long long rem;  /* Remainder. */
 } lldiv_t;
 .Ed
diff --git a/stdlib/FreeBSD/lldiv.3.patch b/stdlib/FreeBSD/lldiv.3.patch
deleted file mode 100644 (file)
index b5320de..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- _SB/Libc/stdlib/FreeBSD/lldiv.3    2003-05-20 15:23:24.000000000 -0700
-+++ _SB/Libc/stdlib/FreeBSD/lldiv.3.edit       2006-06-28 16:55:53.000000000 -0700
-@@ -40,10 +40,10 @@
- The
- .Fn lldiv
- function computes the value of
--.Fa numer
-+.Fa numer ,
- divided by
--.Fa denom
--and returns the stored result in the form of the
-+.Fa denom .
-+It returns the stored result in the form of the
- .Vt lldiv_t
- type.
- .Pp
-@@ -52,7 +52,7 @@
- type is defined as:
- .Bd -literal -offset indent
- typedef struct {
--      long long quot; /* Quotient. */
-+      long long quot; /* Quotient.  */
-       long long rem;  /* Remainder. */
- } lldiv_t;
- .Ed
index 3ad6f6c790dd2db88fe7593e070eebf581a38b51..5be997c5b26d1e08f10cddf457a0b41e4866ae6e 100644 (file)
 .Dt LSEARCH 3
 .Os
 .Sh NAME
-.Nm lsearch ,
-.Nm lfind
+.Nm lfind ,
+.Nm lsearch
 .Nd linear search and append
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In search.h
 .Ft "void *"
-.Fo lsearch
-.Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
+.Fo lfind
+.Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
 .Fc
 .Ft "void *"
-.Fo lfind
-.Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
+.Fo lsearch
+.Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
 .Fc
 .Sh DESCRIPTION
@@ -34,8 +34,8 @@ The
 .Fn lsearch
 and
 .Fn lfind
-functions walk linearly through an array and compare each element with
-the one to be sought using a supplied comparison function.
+functions walk linearly through an array, comparing each element with
+the one to be sought, by means of a supplied comparison function.
 .Pp
 The
 .Fa key
diff --git a/stdlib/FreeBSD/lsearch.3.patch b/stdlib/FreeBSD/lsearch.3.patch
deleted file mode 100644 (file)
index ddf90a4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---- lsearch.3.bsdnew   2009-11-13 14:11:50.000000000 -0800
-+++ lsearch.3  2009-11-13 14:11:50.000000000 -0800
-@@ -12,21 +12,21 @@
- .Dt LSEARCH 3
- .Os
- .Sh NAME
--.Nm lsearch ,
--.Nm lfind
-+.Nm lfind ,
-+.Nm lsearch
- .Nd linear search and append
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In search.h
- .Ft "void *"
--.Fo lsearch
--.Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
-+.Fo lfind
-+.Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
- .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
- .Fc
- .Ft "void *"
--.Fo lfind
--.Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
-+.Fo lsearch
-+.Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
- .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
- .Fc
- .Sh DESCRIPTION
-@@ -34,8 +34,8 @@ The
- .Fn lsearch
- and
- .Fn lfind
--functions walk linearly through an array and compare each element with
--the one to be sought using a supplied comparison function.
-+functions walk linearly through an array, comparing each element with
-+the one to be sought, by means of a supplied comparison function.
- .Pp
- The
- .Fa key
index 3802a3212e9610a296050369e3c88577ca70e48b..96cef24d16ff27e80f6ff6c96527d3b3ecd17493 100644 (file)
 .Dt MEMORY 3
 .Os
 .Sh NAME
-.Nm malloc ,
-.Nm free ,
-.Nm realloc ,
-.Nm calloc ,
 .Nm alloca ,
-.Nm mmap
+.Nm calloc ,
+.Nm free ,
+.Nm malloc ,
+.Nm mmap ,
+.Nm realloc
 .Nd general memory allocation operations
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft void *
-.Fn malloc "size_t size"
-.Ft void
-.Fn free "void *ptr"
+.Fo alloca
+.Fa "size_t size"
+.Fc
 .Ft void *
-.Fn realloc "void *ptr" "size_t size"
+.Fo calloc
+.Fa "size_t nelem"
+.Fa "size_t elsize"
+.Fc
+.Ft void
+.Fo free
+.Fa "void *ptr"
+.Fc
 .Ft void *
-.Fn calloc "size_t nelem" "size_t elsize"
+.Fo malloc
+.Fa "size_t size"
+.Fc
 .Ft void *
-.Fn alloca "size_t size"
-.In sys/types.h
+.Fo realloc
+.Fa "void *ptr"
+.Fa "size_t size"
+.Fc
 .In sys/mman.h
 .Ft void *
-.Fn mmap "void * addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
+.Fo mmap
+.Fa "void * addr"
+.Fa "size_t len"
+.Fa "int prot"
+.Fa "int flags"
+.Fa "int fildes"
+.Fa "off_t off"
+.Fc
 .Sh DESCRIPTION
 These functions allocate and free memory for the calling process.
 They are described in the
 individual manual pages.
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/mman.h>
+.Pp
+.Ft void *
+.br
+.Fo mmap
+.Fa "void * addr"
+.Fa "size_t len"
+.Fa "int prot"
+.Fa "int flags"
+.Fa "int fildes"
+.Fa "off_t off"
+.Fc ;
+.Pp
+The include file
+.In sys/types.h
+is needed for this function.
+.Sh COMPATIBILITY
+.Fn mmap
+now returns with
+.Va errno
+set to EINVAL in places that historically succeeded.
+The rules have changed as follows:
+.Bl -bullet
+.It
+The
+.Fa flags
+parameter must specify either MAP_PRIVATE or MAP_SHARED.
+.It
+The
+.Fa size
+parameter must not be 0.
+.It
+The
+.Fa off
+parameter must be a multiple of pagesize,
+as returned by
+.Fn sysconf .
+.El
 .Sh SEE ALSO
 .Xr mmap 2 ,
 .Xr alloca 3 ,
 .Xr calloc 3 ,
 .Xr free 3 ,
 .Xr malloc 3 ,
-.Xr realloc 3
+.Xr realloc 3 ,
+.Xr compat 5
 .Sh STANDARDS
 These functions, with the exception of
 .Fn alloca
diff --git a/stdlib/FreeBSD/memory.3.patch b/stdlib/FreeBSD/memory.3.patch
deleted file mode 100644 (file)
index 900b4cd..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
---- memory.3.bsdnew    2009-11-13 14:11:50.000000000 -0800
-+++ memory.3   2009-11-13 14:11:50.000000000 -0800
-@@ -32,42 +32,101 @@
- .Dt MEMORY 3
- .Os
- .Sh NAME
--.Nm malloc ,
--.Nm free ,
--.Nm realloc ,
--.Nm calloc ,
- .Nm alloca ,
--.Nm mmap
-+.Nm calloc ,
-+.Nm free ,
-+.Nm malloc ,
-+.Nm mmap ,
-+.Nm realloc
- .Nd general memory allocation operations
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft void *
--.Fn malloc "size_t size"
--.Ft void
--.Fn free "void *ptr"
-+.Fo alloca
-+.Fa "size_t size"
-+.Fc
- .Ft void *
--.Fn realloc "void *ptr" "size_t size"
-+.Fo calloc
-+.Fa "size_t nelem"
-+.Fa "size_t elsize"
-+.Fc
-+.Ft void
-+.Fo free
-+.Fa "void *ptr"
-+.Fc
- .Ft void *
--.Fn calloc "size_t nelem" "size_t elsize"
-+.Fo malloc
-+.Fa "size_t size"
-+.Fc
- .Ft void *
--.Fn alloca "size_t size"
--.In sys/types.h
-+.Fo realloc
-+.Fa "void *ptr"
-+.Fa "size_t size"
-+.Fc
- .In sys/mman.h
- .Ft void *
--.Fn mmap "void * addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
-+.Fo mmap
-+.Fa "void * addr"
-+.Fa "size_t len"
-+.Fa "int prot"
-+.Fa "int flags"
-+.Fa "int fildes"
-+.Fa "off_t off"
-+.Fc
- .Sh DESCRIPTION
- These functions allocate and free memory for the calling process.
- They are described in the
- individual manual pages.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/types.h>
-+.Fd #include <sys/mman.h>
-+.Pp
-+.Ft void *
-+.br
-+.Fo mmap
-+.Fa "void * addr"
-+.Fa "size_t len"
-+.Fa "int prot"
-+.Fa "int flags"
-+.Fa "int fildes"
-+.Fa "off_t off"
-+.Fc ;
-+.Pp
-+The include file
-+.In sys/types.h
-+is needed for this function.
-+.Sh COMPATIBILITY
-+.Fn mmap
-+now returns with
-+.Va errno
-+set to EINVAL in places that historically succeeded.
-+The rules have changed as follows:
-+.Bl -bullet
-+.It
-+The
-+.Fa flags
-+parameter must specify either MAP_PRIVATE or MAP_SHARED.
-+.It
-+The
-+.Fa size
-+parameter must not be 0.
-+.It
-+The
-+.Fa off
-+parameter must be a multiple of pagesize,
-+as returned by
-+.Fn sysconf .
-+.El
- .Sh SEE ALSO
- .Xr mmap 2 ,
- .Xr alloca 3 ,
- .Xr calloc 3 ,
- .Xr free 3 ,
- .Xr malloc 3 ,
--.Xr realloc 3
-+.Xr realloc 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- These functions, with the exception of
- .Fn alloca
index 82acb0a51ce878690b51f67c8d852526e5419fda..319f307d58d3e3433caaaefaef5fbc7a58ded111 100644 (file)
@@ -264,7 +264,8 @@ setup(list1, list2, n, size, cmp)
        int (*cmp)(const void *, const void *);
        u_char *list1, *list2;
 {
-       int i, length, size2, tmp, sense;
+       size_t i, size2;
+       int length, tmp, sense;
        u_char *f1, *f2, *s, *l2, *last, *p2;
 
        size2 = size*2;
diff --git a/stdlib/FreeBSD/merge.c.patch b/stdlib/FreeBSD/merge.c.patch
deleted file mode 100644 (file)
index 95d1c18..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- merge.c.orig       2008-02-17 16:11:51.000000000 -0800
-+++ merge.c    2008-02-17 20:26:24.000000000 -0800
-@@ -264,7 +264,8 @@ setup(list1, list2, n, size, cmp)
-       int (*cmp)(const void *, const void *);
-       u_char *list1, *list2;
- {
--      int i, length, size2, tmp, sense;
-+      size_t i, size2;
-+      int length, tmp, sense;
-       u_char *f1, *f2, *s, *l2, *last, *p2;
-       size2 = size*2;
diff --git a/stdlib/FreeBSD/merge_b.c b/stdlib/FreeBSD/merge_b.c
new file mode 100644 (file)
index 0000000..6caebaa
--- /dev/null
@@ -0,0 +1,352 @@
+/*-
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Peter McIlroy.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/merge.c,v 1.8 2007/01/09 00:28:10 imp Exp $");
+
+/*
+ * Hybrid exponential search/linear search merge sort with hybrid
+ * natural/pairwise first pass.  Requires about .3% more comparisons
+ * for random data than LSMS with pairwise first pass alone.
+ * It works for objects as small as two bytes.
+ */
+
+#define NATURAL
+#define THRESHOLD 16   /* Best choice for natural merge cut-off. */
+
+/* #define NATURAL to get hybrid natural merge.
+ * (The default is pairwise merging.)
+ */
+
+#include <sys/types.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+static void setup(u_char *, u_char *, size_t, size_t,
+    int (^)(const void *, const void *));
+static void insertionsort(u_char *, size_t, size_t,
+    int (^)(const void *, const void *));
+
+#define ISIZE sizeof(int)
+#define PSIZE sizeof(u_char *)
+#define ICOPY_LIST(src, dst, last)                             \
+       do                                                      \
+       *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE;    \
+       while(src < last)
+#define ICOPY_ELT(src, dst, i)                                 \
+       do                                                      \
+       *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE;  \
+       while (i -= ISIZE)
+
+#define CCOPY_LIST(src, dst, last)             \
+       do                                      \
+               *dst++ = *src++;                \
+       while (src < last)
+#define CCOPY_ELT(src, dst, i)                 \
+       do                                      \
+               *dst++ = *src++;                \
+       while (i -= 1)
+
+/*
+ * Find the next possible pointer head.  (Trickery for forcing an array
+ * to do double duty as a linked list when objects do not align with word
+ * boundaries.
+ */
+/* Assumption: PSIZE is a power of 2. */
+#define EVAL(p) (u_char **)                                            \
+       ((u_char *)0 +                                                  \
+           (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
+
+/*
+ * Arguments are as for qsort.
+ */
+int
+mergesort_b(base, nmemb, size, cmp)
+       void *base;
+       size_t nmemb;
+       size_t size;
+       int (^cmp)(const void *, const void *);
+{
+       size_t i;
+       int sense;
+       int big, iflag;
+       u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
+       u_char *list2, *list1, *p2, *p, *last, **p1;
+
+       if (size < PSIZE / 2) {         /* Pointers must fit into 2 * size. */
+               errno = EINVAL;
+               return (-1);
+       }
+
+       if (nmemb == 0)
+               return (0);
+
+       /*
+        * XXX
+        * Stupid subtraction for the Cray.
+        */
+       iflag = 0;
+       if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
+               iflag = 1;
+
+       if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
+               return (-1);
+
+       list1 = base;
+       setup(list1, list2, nmemb, size, cmp);
+       last = list2 + nmemb * size;
+       i = big = 0;
+       while (*EVAL(list2) != last) {
+           l2 = list1;
+           p1 = EVAL(list1);
+           for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
+               p2 = *EVAL(p2);
+               f1 = l2;
+               f2 = l1 = list1 + (p2 - list2);
+               if (p2 != last)
+                       p2 = *EVAL(p2);
+               l2 = list1 + (p2 - list2);
+               while (f1 < l1 && f2 < l2) {
+                       if (cmp(f1, f2) <= 0) {
+                               q = f2;
+                               b = f1, t = l1;
+                               sense = -1;
+                       } else {
+                               q = f1;
+                               b = f2, t = l2;
+                               sense = 0;
+                       }
+                       if (!big) {     /* here i = 0 */
+                               while ((b += size) < t && cmp(q, b) >sense)
+                                       if (++i == 6) {
+                                               big = 1;
+                                               goto EXPONENTIAL;
+                                       }
+                       } else {
+EXPONENTIAL:                   for (i = size; ; i <<= 1)
+                                       if ((p = (b + i)) >= t) {
+                                               if ((p = t - size) > b &&
+                                                   cmp(q, p) <= sense)
+                                                       t = p;
+                                               else
+                                                       b = p;
+                                               break;
+                                       } else if (cmp(q, p) <= sense) {
+                                               t = p;
+                                               if (i == size)
+                                                       big = 0;
+                                               goto FASTCASE;
+                                       } else
+                                               b = p;
+                               while (t > b+size) {
+                                       i = (((t - b) / size) >> 1) * size;
+                                       if (cmp(q, p = b + i) <= sense)
+                                               t = p;
+                                       else
+                                               b = p;
+                               }
+                               goto COPY;
+FASTCASE:                      while (i > size)
+                                       if (cmp(q,
+                                               p = b + (i >>= 1)) <= sense)
+                                               t = p;
+                                       else
+                                               b = p;
+COPY:                          b = t;
+                       }
+                       i = size;
+                       if (q == f1) {
+                               if (iflag) {
+                                       ICOPY_LIST(f2, tp2, b);
+                                       ICOPY_ELT(f1, tp2, i);
+                               } else {
+                                       CCOPY_LIST(f2, tp2, b);
+                                       CCOPY_ELT(f1, tp2, i);
+                               }
+                       } else {
+                               if (iflag) {
+                                       ICOPY_LIST(f1, tp2, b);
+                                       ICOPY_ELT(f2, tp2, i);
+                               } else {
+                                       CCOPY_LIST(f1, tp2, b);
+                                       CCOPY_ELT(f2, tp2, i);
+                               }
+                       }
+               }
+               if (f2 < l2) {
+                       if (iflag)
+                               ICOPY_LIST(f2, tp2, l2);
+                       else
+                               CCOPY_LIST(f2, tp2, l2);
+               } else if (f1 < l1) {
+                       if (iflag)
+                               ICOPY_LIST(f1, tp2, l1);
+                       else
+                               CCOPY_LIST(f1, tp2, l1);
+               }
+               *p1 = l2;
+           }
+           tp2 = list1;        /* swap list1, list2 */
+           list1 = list2;
+           list2 = tp2;
+           last = list2 + nmemb*size;
+       }
+       if (base == list2) {
+               memmove(list2, list1, nmemb*size);
+               list2 = list1;
+       }
+       free(list2);
+       return (0);
+}
+
+#define        swap(a, b) {                                    \
+               s = b;                                  \
+               i = size;                               \
+               do {                                    \
+                       tmp = *a; *a++ = *s; *s++ = tmp; \
+               } while (--i);                          \
+               a -= size;                              \
+       }
+#define reverse(bot, top) {                            \
+       s = top;                                        \
+       do {                                            \
+               i = size;                               \
+               do {                                    \
+                       tmp = *bot; *bot++ = *s; *s++ = tmp; \
+               } while (--i);                          \
+               s -= size2;                             \
+       } while(bot < s);                               \
+}
+
+/*
+ * Optional hybrid natural/pairwise first pass.  Eats up list1 in runs of
+ * increasing order, list2 in a corresponding linked list.  Checks for runs
+ * when THRESHOLD/2 pairs compare with same sense.  (Only used when NATURAL
+ * is defined.  Otherwise simple pairwise merging is used.)
+ */
+void
+setup(list1, list2, n, size, cmp)
+       size_t n, size;
+       int (^cmp)(const void *, const void *);
+       u_char *list1, *list2;
+{
+       size_t i, size2;
+       int length, tmp, sense;
+       u_char *f1, *f2, *s, *l2, *last, *p2;
+
+       size2 = size*2;
+       if (n <= 5) {
+               insertionsort(list1, n, size, cmp);
+               *EVAL(list2) = (u_char*) list2 + n*size;
+               return;
+       }
+       /*
+        * Avoid running pointers out of bounds; limit n to evens
+        * for simplicity.
+        */
+       i = 4 + (n & 1);
+       insertionsort(list1 + (n - i) * size, i, size, cmp);
+       last = list1 + size * (n - i);
+       *EVAL(list2 + (last - list1)) = list2 + n * size;
+
+#ifdef NATURAL
+       p2 = list2;
+       f1 = list1;
+       sense = (cmp(f1, f1 + size) > 0);
+       for (; f1 < last; sense = !sense) {
+               length = 2;
+                                       /* Find pairs with same sense. */
+               for (f2 = f1 + size2; f2 < last; f2 += size2) {
+                       if ((cmp(f2, f2+ size) > 0) != sense)
+                               break;
+                       length += 2;
+               }
+               if (length < THRESHOLD) {               /* Pairwise merge */
+                       do {
+                               p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
+                               if (sense > 0)
+                                       swap (f1, f1 + size);
+                       } while ((f1 += size2) < f2);
+               } else {                                /* Natural merge */
+                       l2 = f2;
+                       for (f2 = f1 + size2; f2 < l2; f2 += size2) {
+                               if ((cmp(f2-size, f2) > 0) != sense) {
+                                       p2 = *EVAL(p2) = f2 - list1 + list2;
+                                       if (sense > 0)
+                                               reverse(f1, f2-size);
+                                       f1 = f2;
+                               }
+                       }
+                       if (sense > 0)
+                               reverse (f1, f2-size);
+                       f1 = f2;
+                       if (f2 < last || cmp(f2 - size, f2) > 0)
+                               p2 = *EVAL(p2) = f2 - list1 + list2;
+                       else
+                               p2 = *EVAL(p2) = list2 + n*size;
+               }
+       }
+#else          /* pairwise merge only. */
+       for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
+               p2 = *EVAL(p2) = p2 + size2;
+               if (cmp (f1, f1 + size) > 0)
+                       swap(f1, f1 + size);
+       }
+#endif /* NATURAL */
+}
+
+/*
+ * This is to avoid out-of-bounds addresses in sorting the
+ * last 4 elements.
+ */
+static void
+insertionsort(a, n, size, cmp)
+       u_char *a;
+       size_t n, size;
+       int (^cmp)(const void *, const void *);
+{
+       u_char *ai, *s, *t, *u, tmp;
+       int i;
+
+       for (ai = a+size; --n >= 1; ai += size)
+               for (t = ai; t > a; t -= size) {
+                       u = t - size;
+                       if (cmp(u, t) <= 0)
+                               break;
+                       swap(u, t);
+               }
+}
diff --git a/stdlib/FreeBSD/merge_b.c.patch b/stdlib/FreeBSD/merge_b.c.patch
deleted file mode 100644 (file)
index 7bf8e65..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
---- merge_b.c.orig     2008-05-21 02:51:18.000000000 -0700
-+++ merge_b.c  2008-05-21 02:54:59.000000000 -0700
-@@ -57,9 +57,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <string.h>
- static void setup(u_char *, u_char *, size_t, size_t,
--    int (*)(const void *, const void *));
-+    int (^)(const void *, const void *));
- static void insertionsort(u_char *, size_t, size_t,
--    int (*)(const void *, const void *));
-+    int (^)(const void *, const void *));
- #define ISIZE sizeof(int)
- #define PSIZE sizeof(u_char *)
-@@ -95,11 +95,11 @@ static void insertionsort(u_char *, size
-  * Arguments are as for qsort.
-  */
- int
--mergesort(base, nmemb, size, cmp)
-+mergesort_b(base, nmemb, size, cmp)
-       void *base;
-       size_t nmemb;
-       size_t size;
--      int (*cmp)(const void *, const void *);
-+      int (^cmp)(const void *, const void *);
- {
-       size_t i;
-       int sense;
-@@ -141,7 +141,7 @@ mergesort(base, nmemb, size, cmp)
-                       p2 = *EVAL(p2);
-               l2 = list1 + (p2 - list2);
-               while (f1 < l1 && f2 < l2) {
--                      if ((*cmp)(f1, f2) <= 0) {
-+                      if (cmp(f1, f2) <= 0) {
-                               q = f2;
-                               b = f1, t = l1;
-                               sense = -1;
-@@ -160,12 +160,12 @@ mergesort(base, nmemb, size, cmp)
- EXPONENTIAL:                  for (i = size; ; i <<= 1)
-                                       if ((p = (b + i)) >= t) {
-                                               if ((p = t - size) > b &&
--                                                  (*cmp)(q, p) <= sense)
-+                                                  cmp(q, p) <= sense)
-                                                       t = p;
-                                               else
-                                                       b = p;
-                                               break;
--                                      } else if ((*cmp)(q, p) <= sense) {
-+                                      } else if (cmp(q, p) <= sense) {
-                                               t = p;
-                                               if (i == size)
-                                                       big = 0;
-@@ -174,14 +174,14 @@ EXPONENTIAL:                     for (i = size; ; i <<
-                                               b = p;
-                               while (t > b+size) {
-                                       i = (((t - b) / size) >> 1) * size;
--                                      if ((*cmp)(q, p = b + i) <= sense)
-+                                      if (cmp(q, p = b + i) <= sense)
-                                               t = p;
-                                       else
-                                               b = p;
-                               }
-                               goto COPY;
- FASTCASE:                     while (i > size)
--                                      if ((*cmp)(q,
-+                                      if (cmp(q,
-                                               p = b + (i >>= 1)) <= sense)
-                                               t = p;
-                                       else
-@@ -261,10 +261,11 @@ COPY:                            b = t;
- void
- setup(list1, list2, n, size, cmp)
-       size_t n, size;
--      int (*cmp)(const void *, const void *);
-+      int (^cmp)(const void *, const void *);
-       u_char *list1, *list2;
- {
--      int i, length, size2, tmp, sense;
-+      size_t i, size2;
-+      int length, tmp, sense;
-       u_char *f1, *f2, *s, *l2, *last, *p2;
-       size2 = size*2;
-@@ -336,7 +337,7 @@ static void
- insertionsort(a, n, size, cmp)
-       u_char *a;
-       size_t n, size;
--      int (*cmp)(const void *, const void *);
-+      int (^cmp)(const void *, const void *);
- {
-       u_char *ai, *s, *t, *u, tmp;
-       int i;
diff --git a/stdlib/FreeBSD/psort.3 b/stdlib/FreeBSD/psort.3
new file mode 100644 (file)
index 0000000..e5572fc
--- /dev/null
@@ -0,0 +1,177 @@
+.\" Copyright (c) 1990, 1991, 1993
+.\"    The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the American National Standards Committee X3, on Information
+.\" Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)qsort.3    8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/stdlib/qsort.3,v 1.17 2007/01/09 00:28:10 imp Exp $
+.\"
+.Dd Nov 25, 2008
+.Dt PSORT 3
+.Os "Mac OS X"
+.Sh NAME
+.Nm psort ,
+#ifdef UNIFDEF_BLOCKS
+.Nm psort_b ,
+#endif
+.Nm psort_r
+.Nd parallel sort functions
+.Sh SYNOPSIS
+.In stdlib.h
+.Ft void
+.Fo psort
+.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
+.Fc
+#ifdef UNIFDEF_BLOCKS
+.Ft void
+.Fo psort_b
+.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
+.Fc
+#endif
+.Ft void
+.Fo psort_r
+.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "void *thunk"
+.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
+.Fc
+.Sh DESCRIPTION
+The
+#ifdef UNIFDEF_BLOCKS
+.Fn psort ,
+.Fn psort_b ,
+#else
+.Fn psort
+#endif
+and
+.Fn psort_r
+functions are parallel sort routines that are drop-in compatible with the
+corresponding
+.Fn qsort
+function (see
+.Xr qsort 3
+for a description of the arguments).
+On multiprocessor machines, multiple threads may be created to simultaneously
+perform the sort calculations, resulting in an overall faster sort result.
+Overhead in managing the threads limits the maximum speed improvement to
+somewhat less that the number of processors available.
+For example, on a 4-processor machine, a typical sort on a large array might
+result in 3.2 times faster sorting than a regular
+.Fn qsort .
+.Sh RESTRICTIONS
+Because of the multi-threaded nature of the sort, the comparison function
+is expected to perform its own synchronization that might be required for
+data physically
+.Em outside
+the two objects passed to the comparison function.
+However, no synchronization is required for the two
+object themselves, unless some third party is also accessing those objects.
+.Pp
+Additional memory is temporary allocated to deal with the parallel nature
+of the computation.
+.Pp
+Because of the overhead of maintaining multiple threads, the
+.Fn psort
+family of routines may choose to just call
+.Xr qsort 3
+when there is no advantage to parallelizing (for example, when the number of
+objects in the array is too small, or only one processor is available).
+.Pp
+Like
+.Xr qsort 3 ,
+the sort is not stable.
+.Sh RETURN VALUES
+The
+#ifdef UNIFDEF_BLOCKS
+.Fn psort ,
+.Fn psort_b
+#else
+.Fn psort
+#endif
+and
+.Fn psort_r
+functions
+return no value.
+.Sh SEE ALSO
+.Xr qsort 3
+.Sh SEE ALSO
+.Xr sort 1 ,
+.Xr radixsort 3
+.Rs
+.%A Hoare, C.A.R.
+.%D 1962
+.%T "Quicksort"
+.%J "The Computer Journal"
+.%V 5:1
+.%P pp. 10-15
+.Re
+.Rs
+.%A Williams, J.W.J
+.%D 1964
+.%T "Heapsort"
+.%J "Communications of the ACM"
+.%V 7:1
+.%P pp. 347-348
+.Re
+.Rs
+.%A Knuth, D.E.
+.%D 1968
+.%B "The Art of Computer Programming"
+.%V Vol. 3
+.%T "Sorting and Searching"
+.%P pp. 114-123, 145-149
+.Re
+.Rs
+.%A McIlroy, P.M.
+.%T "Optimistic Sorting and Information Theoretic Complexity"
+.%J "Fourth Annual ACM-SIAM Symposium on Discrete Algorithms"
+.%V January 1992
+.Re
+.Rs
+.%A Bentley, J.L.
+.%A McIlroy, M.D.
+.%T "Engineering a Sort Function"
+.%J "Software--Practice and Experience"
+.%V Vol. 23(11)
+.%P pp. 1249-1265
+.%D November\ 1993
+.Re
+.Sh STANDARDS
+The
+.Fn qsort
+function
+conforms to
+.St -isoC .
diff --git a/stdlib/FreeBSD/psort.c b/stdlib/FreeBSD/psort.c
new file mode 100644 (file)
index 0000000..a95ce60
--- /dev/null
@@ -0,0 +1,444 @@
+/****************************************************************************/
+/*-
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)qsort.c    8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
+
+#include <stdlib.h>
+#include <pthread.h>
+#include <dispatch/dispatch.h>
+#include <stddef.h>
+#include <string.h>
+#include <libkern/OSAtomic.h>
+#include <sys/mman.h>
+#include <errno.h>
+#define __APPLE_API_PRIVATE
+#include <machine/cpu_capabilities.h>
+
+#ifdef I_AM_PSORT_R
+typedef int             cmp_t(void *, const void *, const void *);
+#else
+typedef int             cmp_t(const void *, const void *);
+#endif
+#ifdef I_AM_PSORT_B
+static inline char     *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
+#else
+static inline char     *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
+#endif
+static inline void      swapfunc(char *, char *, int, int) __attribute__((always_inline));
+
+#define min(a, b)      (a) < (b) ? a : b
+
+#define NARGS                  ((PAGESIZE - offsetof(struct page, args)) / sizeof(union args))
+#define PAGESIZE               4096
+#define PARALLEL_MIN_SIZE      2000    /* determine heuristically */
+
+struct shared; /* forward reference */
+union args {
+    union args *next;
+    struct {
+       struct shared *shared;
+       void *a;
+       size_t n;
+       int depth_limit;
+    } /* anonymous */;
+};
+
+struct page {
+    struct page *next;
+    union args args[0];
+};
+
+struct shared {
+    char *who;
+    union args *freelist;
+    struct page *pagelist;
+#ifdef I_AM_PSORT_R
+    void *thunk;
+#endif
+#ifdef I_AM_PSORT_B
+    cmp_t ^cmp;
+#else
+    cmp_t *cmp;
+#endif
+    size_t es;
+    size_t turnoff;
+    dispatch_queue_t queue;
+    pthread_cond_t cond;
+    pthread_mutex_t mutex;
+    OSSpinLock sharedlock;
+    int count;
+};
+
+static union args *
+getargs(struct shared *shared)
+{
+    union args *args;
+
+    OSSpinLockLock(&shared->sharedlock);
+    if(!shared->freelist) {
+       struct page *page;
+       union args *prev;
+       int i;
+       if((page = (struct page *)mmap(NULL, PAGESIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == NULL)
+           return NULL;
+       page->next = shared->pagelist;
+       shared->pagelist = page;
+       prev = NULL;
+       for(args = page->args, i = NARGS; i > 0; args++, i--) {
+           args->next = prev;
+           prev = args;
+       }
+       shared->freelist = prev;
+    }
+    args = shared->freelist;
+    shared->freelist = args->next;
+    OSSpinLockUnlock(&shared->sharedlock);
+    return args;
+}
+
+static void
+returnargs(struct shared *shared, union args *args)
+{
+    OSSpinLockLock(&shared->sharedlock);
+    args->next = shared->freelist;
+    shared->freelist = args;
+    OSSpinLockUnlock(&shared->sharedlock);
+}
+
+/*
+ * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
+ */
+#define swapcode(TYPE, parmi, parmj, n) {              \
+       long i = (n) / sizeof (TYPE);                   \
+       TYPE *pi = (TYPE *) (parmi);            \
+       TYPE *pj = (TYPE *) (parmj);            \
+       do {                                            \
+               TYPE    t = *pi;                \
+               *pi++ = *pj;                            \
+               *pj++ = t;                              \
+        } while (--i > 0);                             \
+}
+
+#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
+       es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
+
+static inline void
+swapfunc(a, b, n, swaptype)
+       char *a, *b;
+       int n, swaptype;
+{
+       if(swaptype <= 1)
+               swapcode(long, a, b, n)
+       else
+               swapcode(char, a, b, n)
+}
+
+#define swap(a, b)                                     \
+       if (swaptype == 0) {                            \
+               long t = *(long *)(a);                  \
+               *(long *)(a) = *(long *)(b);            \
+               *(long *)(b) = t;                       \
+       } else                                          \
+               swapfunc(a, b, es, swaptype)
+
+#define vecswap(a, b, n)       if ((n) > 0) swapfunc(a, b, n, swaptype)
+
+#ifdef I_AM_PSORT_R
+#define        CMP(t, x, y) (cmp((t), (x), (y)))
+#else
+#define        CMP(t, x, y) (cmp((x), (y)))
+#endif
+
+static inline char *
+med3(char *a, char *b, char *c,
+#ifdef I_AM_PSORT_B
+cmp_t ^cmp,
+#else
+cmp_t *cmp,
+#endif
+void *thunk
+#ifndef I_AM_PSORT_R
+__unused
+#endif
+)
+{
+       return CMP(thunk, a, b) < 0 ?
+              (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
+              :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
+}
+
+#ifdef __LP64__
+#define DEPTH(x)       (2 * (flsl((long)(x)) - 1))
+#else /* !__LP64__ */
+#define DEPTH(x)       (2 * (fls((int)(x)) - 1))
+#endif /* __LP64__ */
+
+#ifdef I_AM_PSORT_R
+int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
+#endif
+
+static void _psort_parallel(void *x);
+
+static void
+_psort(void *a, size_t n, size_t es,
+#ifdef I_AM_PSORT_R
+void *thunk,
+#else
+#define thunk  NULL
+#endif
+#ifdef I_AM_PSORT_B
+cmp_t ^cmp,
+#else
+cmp_t *cmp,
+#endif
+int depth_limit, struct shared *shared)
+{
+       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
+       size_t d, r;
+       int cmp_result;
+       int swaptype, swap_cnt;
+
+loop:
+       if (depth_limit-- <= 0) {
+#ifdef I_AM_PSORT_B
+               heapsort_b(a, n, es, cmp);
+#elif defined(I_AM_PSORT_R)
+               __heapsort_r(a, n, es, thunk, cmp);
+#else
+               heapsort(a, n, es, cmp);
+#endif
+               return;
+       }
+       SWAPINIT(a, es);
+       swap_cnt = 0;
+       if (n < 7) {
+               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
+                       for (pl = pm; 
+                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
+                            pl -= es)
+                               swap(pl, pl - es);
+               return;
+       }
+       pm = (char *)a + (n / 2) * es;
+       if (n > 7) {
+               pl = a;
+               pn = (char *)a + (n - 1) * es;
+               if (n > 40) {
+                       d = (n / 8) * es;
+                       pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
+                       pm = med3(pm - d, pm, pm + d, cmp, thunk);
+                       pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
+               }
+               pm = med3(pl, pm, pn, cmp, thunk);
+       }
+       swap(a, pm);
+       pa = pb = (char *)a + es;
+
+       pc = pd = (char *)a + (n - 1) * es;
+       for (;;) {
+               while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
+                       if (cmp_result == 0) {
+                               swap_cnt = 1;
+                               swap(pa, pb);
+                               pa += es;
+                       }
+                       pb += es;
+               }
+               while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
+                       if (cmp_result == 0) {
+                               swap_cnt = 1;
+                               swap(pc, pd);
+                               pd -= es;
+                       }
+                       pc -= es;
+               }
+               if (pb > pc)
+                       break;
+               swap(pb, pc);
+               swap_cnt = 1;
+               pb += es;
+               pc -= es;
+       }
+
+       pn = (char *)a + n * es;
+       r = min(pa - (char *)a, pb - pa);
+       vecswap(a, pb - r, r);
+       r = min(pd - pc, pn - pd - es);
+       vecswap(pb, pn - r, r);
+
+       if (swap_cnt == 0) {  /* Switch to insertion sort */
+               r = 1 + n / 4; /* n >= 7, so r >= 2 */
+               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
+                       for (pl = pm; 
+                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
+                            pl -= es) {
+                               swap(pl, pl - es);
+                               if (++swap_cnt > r) goto nevermind;
+                       }
+               return;
+       }
+
+nevermind:
+       if ((r = pb - pa) > es) {
+               r /= es;
+               if (shared && r > shared->turnoff) {
+                       union args *args = getargs(shared);
+
+                       if (args == NULL)
+                               LIBC_ABORT("%s: getargs: %s", shared->who, strerror(errno));
+                       args->shared = shared;
+                       args->a = a;
+                       args->n = r;
+                       args->depth_limit = depth_limit;
+                       OSAtomicIncrement32(&shared->count);
+                       dispatch_async_f(shared->queue, args, _psort_parallel);
+               } else {
+#ifdef I_AM_PSORT_R
+                       _psort(a, r, es, thunk, cmp, depth_limit, NULL);
+#else
+                       _psort(a, r, es, cmp, depth_limit, NULL);
+#endif
+               }
+       }
+       if ((r = pd - pc) > es) {
+               /* Iterate rather than recurse to save stack space */
+               a = pn - r;
+               n = r / es;
+               goto loop;
+       }
+/*             psort(pn - r, r / es, es, cmp);*/
+}
+
+static void
+_psort_parallel(void *x)
+{
+       union args *args = (union args *)x;
+       struct shared *shared = args->shared;
+
+       _psort(args->a, args->n, shared->es,
+#ifdef I_AM_PSORT_R
+               shared->thunk,
+#endif
+               shared->cmp, args->depth_limit, shared);
+       returnargs(shared, args);
+       if(OSAtomicDecrement32(&shared->count) <= 0) {
+               pthread_mutex_lock(&shared->mutex);
+               pthread_cond_signal(&shared->cond);
+               pthread_mutex_unlock(&shared->mutex);
+       }
+}
+
+/* fast, approximate integer square root */
+static size_t
+isqrt(size_t x)
+{
+    size_t s = 1L << (flsl(x) / 2);
+    return (s + x / s) / 2;
+}
+
+void
+#ifdef I_AM_PSORT_R
+psort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+#elif defined(I_AM_PSORT_B)
+psort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
+#else
+psort(void *a, size_t n, size_t es, cmp_t *cmp)
+#endif
+{
+       if (n >= PARALLEL_MIN_SIZE && _NumCPUs() > 1) {
+               struct shared shared;
+               union args *args;
+
+               bzero(&shared, sizeof(shared));
+               shared.sharedlock = OS_SPINLOCK_INIT;
+               if ((args = getargs(&shared)) != NULL) {
+                       struct page *p, *pp;
+#ifdef I_AM_PSORT_R
+                       shared.who = "psort_r";
+                       shared.thunk = thunk;
+#elif defined(I_AM_PSORT_B)
+                       shared.who = "psort_b";
+#else
+                       shared.who = "psort";
+#endif
+                       shared.cmp = cmp;
+                       shared.es = es;
+                       shared.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
+                       shared.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
+                       shared.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
+                       args->a = a;
+                       args->n = n;
+                       args->depth_limit = DEPTH(n);
+                       args->shared = &shared;
+                       /*
+                        * The turnoff value is the size of a partition that,
+                        * below which, we stop doing in parallel, and just do
+                        * in the current thread.  The value of sqrt(n) was
+                        * determined heuristically.  There is a smaller
+                        * dependence on the slowness of the comparison
+                        * function, and there might be a dependence on the
+                        * number of processors, but the algorithm has not been
+                        * determined.  Because the sensitivity to the turnoff
+                        * value is relatively low, we use a fast, approximate
+                        * integer square root routine that is good enough for
+                        * this purpose.
+                        */
+                       shared.turnoff = isqrt(n);
+                       OSAtomicIncrement32(&shared.count);
+                       _psort_parallel(args);
+
+                       /* wait for queue to drain */
+                       pthread_mutex_lock(&shared.mutex);
+                       while(shared.count > 0)
+                               pthread_cond_wait(&shared.cond, &shared.mutex);
+
+                       pthread_mutex_unlock(&shared.mutex);
+                       pthread_mutex_destroy(&shared.mutex);
+                       pthread_cond_destroy(&shared.cond);
+                       for(p = shared.pagelist; p; p = pp) {
+                               pp = p->next;
+                               munmap(p, PAGESIZE);
+                       }
+                       return;
+               }
+       }
+       /* Just call qsort */
+#ifdef I_AM_PSORT_R
+       qsort_r(a, n, es, thunk, cmp);
+#elif defined(I_AM_PSORT_B)
+       qsort_b(a, n, es, cmp);
+#else
+       qsort(a, n, es, cmp);
+#endif
+}
diff --git a/stdlib/FreeBSD/psort_b.c b/stdlib/FreeBSD/psort_b.c
new file mode 120000 (symlink)
index 0000000..945c9b4
--- /dev/null
@@ -0,0 +1 @@
+.
\ No newline at end of file
diff --git a/stdlib/FreeBSD/psort_r.c b/stdlib/FreeBSD/psort_r.c
new file mode 120000 (symlink)
index 0000000..945c9b4
--- /dev/null
@@ -0,0 +1 @@
+.
\ No newline at end of file
index e74d34657b50908f7b8e36137024cb23c8ffea1d..a2c53be35158b4a4a00c8d754180888537368740 100644 (file)
@@ -35,22 +35,66 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/putenv.c,v 1.6 2007/05/01 16:02:41 ache
 
 #include <stdlib.h>
 #include <string.h>
+#include <sys/types.h>
+#include <db.h>
+#include <crt_externs.h>
+#include <errno.h> 
+
+extern struct owned_ptr *__env_owned;
+
+#ifdef LEGACY_CRT1_ENVIRON
+extern char **_saved_environ;
+#endif /* LEGACY_CRT1_ENVIRON */
+
+__private_extern__ int __init__env_owned(int);
+__private_extern__ int __setenv(const char *, const char *, int, int, char ***, struct owned_ptr *);
+
+#ifndef BUILDING_VARIANT
+/*
+ * _putenvp -- SPI using an arbitrary pointer to string array (the array must
+ * have been created with malloc) and an env state, created by _allocenvstate().
+ *     Returns ptr to value associated with name, if any, else NULL.
+ */
+int
+_putenvp(char *str, char ***envp, void *state)
+{
+       if (__init__env_owned(1)) return (-1);
+       return (__setenv(str, NULL, 1, 0, envp, (state ? (struct owned_ptr *)state : __env_owned)));
+}
+#endif /* BUILDING_VARIANT */
 
 int
 putenv(str)
-       const char *str;
+       char *str;
 {
-       char *p, *equal;
-       int rval;
+#ifdef LEGACY_CRT1_ENVIRON
+       int ret;
+#endif /* LEGACY_CRT1_ENVIRON */
 
-       if ((p = strdup(str)) == NULL)
-               return (-1);
-       if ((equal = index(p, '=')) == NULL) {
-               (void)free(p);
+#if __DARWIN_UNIX03
+       if (str == NULL || *str == 0 || index(str, '=') == NULL) {
+               errno = EINVAL;
                return (-1);
        }
-       *equal = '\0';
-       rval = setenv(p, equal + 1, 1);
-       (void)free(p);
-       return (rval);
+#else /* !__DARWIN_UNIX03 */
+       if (index(str, '=') == NULL)
+               return (-1);
+#endif /* __DARWIN_UNIX03 */
+       if (__init__env_owned(1)) return (-1);
+#ifdef LEGACY_CRT1_ENVIRON
+       ret =
+#else /* !LEGACY_CRT1_ENVIRON */
+       return
+#endif /* !LEGACY_CRT1_ENVIRON */
+           __setenv(str, NULL, 1,
+#if __DARWIN_UNIX03
+               0,
+#else /* !__DARWIN_UNIX03 */
+               -1,
+#endif /* __DARWIN_UNIX03 */
+               _NSGetEnviron(), __env_owned);
+#ifdef LEGACY_CRT1_ENVIRON
+       _saved_environ = *_NSGetEnviron();
+       return ret;
+#endif /* LEGACY_CRT1_ENVIRON */
 }
diff --git a/stdlib/FreeBSD/putenv.c.patch b/stdlib/FreeBSD/putenv.c.patch
deleted file mode 100644 (file)
index 47a412e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
---- putenv.c.orig      2011-04-12 22:08:20.000000000 -0700
-+++ putenv.c   2011-04-13 14:33:50.000000000 -0700
-@@ -35,22 +35,81 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <stdlib.h>
- #include <string.h>
-+#include <sys/types.h>
-+#include <db.h>
-+#include <crt_externs.h>
-+#include <malloc/malloc.h>
-+#include <errno.h> 
-+
-+extern malloc_zone_t *__zone0;
-+#ifdef LEGACY_CRT1_ENVIRON
-+extern char **_saved_environ;
-+#endif /* LEGACY_CRT1_ENVIRON */
-+
-+extern void __malloc_check_env_name(const char *);
-+__private_extern__ int __setenv(const char *, const char *, int, int, char ***, malloc_zone_t *);
-+
-+#ifndef BUILDING_VARIANT
-+/*
-+ * _putenvp -- SPI using an arbitrary pointer to string array (the array must
-+ * have been created with malloc) and an env state, created by _allocenvstate().
-+ *    Returns ptr to value associated with name, if any, else NULL.
-+ */
-+int
-+_putenvp(char *str, char ***envp, void *state)
-+{
-+      /* insure __zone0 is set up */
-+      if (!__zone0) {
-+          __zone0 = malloc_create_zone(0, 0);
-+          if (!__zone0) {
-+                  errno = ENOMEM;
-+                  return (-1);
-+          }
-+      }
-+      return (__setenv(str, NULL, 1, 0, envp, (state ? (malloc_zone_t *)state : __zone0)));
-+}
-+#endif /* BUILDING_VARIANT */
- int
- putenv(str)
--      const char *str;
-+      char *str;
- {
--      char *p, *equal;
--      int rval;
-+#ifdef LEGACY_CRT1_ENVIRON
-+      int ret;
-+#endif /* LEGACY_CRT1_ENVIRON */
--      if ((p = strdup(str)) == NULL)
-+#if __DARWIN_UNIX03
-+      if (str == NULL || *str == 0 || index(str, '=') == NULL) {
-+              errno = EINVAL;
-               return (-1);
--      if ((equal = index(p, '=')) == NULL) {
--              (void)free(p);
-+      }
-+#else /* !__DARWIN_UNIX03 */
-+      if (index(str, '=') == NULL)
-               return (-1);
-+#endif /* __DARWIN_UNIX03 */
-+      /* insure __zone0 is set up before calling __malloc_check_env_name */
-+      if (!__zone0) {
-+          __zone0 = malloc_create_zone(0, 0);
-+          if (!__zone0) {
-+                  errno = ENOMEM;
-+                  return (-1);
-+          }
-       }
--      *equal = '\0';
--      rval = setenv(p, equal + 1, 1);
--      (void)free(p);
--      return (rval);
-+      __malloc_check_env_name(str); /* see if we are changing a malloc environment variable */
-+#ifdef LEGACY_CRT1_ENVIRON
-+      ret =
-+#else /* !LEGACY_CRT1_ENVIRON */
-+      return
-+#endif /* !LEGACY_CRT1_ENVIRON */
-+          __setenv(str, NULL, 1,
-+#if __DARWIN_UNIX03
-+              0,
-+#else /* !__DARWIN_UNIX03 */
-+              -1,
-+#endif /* __DARWIN_UNIX03 */
-+              _NSGetEnviron(), __zone0);
-+#ifdef LEGACY_CRT1_ENVIRON
-+      _saved_environ = *_NSGetEnviron();
-+      return ret;
-+#endif /* LEGACY_CRT1_ENVIRON */
- }
index 23a116c3d24792ee4bc209c8764150bdc85d3024..f137a8d0a1242606702da05ac7314e1ceb04498e 100644 (file)
 .Dt QSORT 3
 .Os
 .Sh NAME
-.Nm qsort , qsort_r , heapsort , mergesort
+.Nm heapsort ,
+#ifdef UNIFDEF_BLOCKS
+.Nm heapsort_b ,
+#endif
+.Nm mergesort ,
+#ifdef UNIFDEF_BLOCKS
+.Nm mergesort_b ,
+#endif
+.Nm qsort ,
+#ifdef UNIFDEF_BLOCKS
+.Nm qsort_b ,
+#endif
+.Nm qsort_r
 .Nd sort functions
-.Sh LIBRARY
-.Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
-.Ft void
-.Fo qsort
+.Ft int
+.Fo heapsort
 .Fa "void *base"
-.Fa "size_t nmemb"
-.Fa "size_t size"
+.Fa "size_t nel"
+.Fa "size_t width"
 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
 .Fc
-.Ft void
-.Fo qsort_r
+#ifdef UNIFDEF_BLOCKS
+.Ft int
+.Fo heapsort_b
 .Fa "void *base"
-.Fa "size_t nmemb"
-.Fa "size_t size"
-.Fa "void *thunk"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
 .Fc
+#endif
 .Ft int
-.Fo heapsort
+.Fo mergesort
 .Fa "void *base"
-.Fa "size_t nmemb"
-.Fa "size_t size"
+.Fa "size_t nel"
+.Fa "size_t width"
 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
 .Fc
+#ifdef UNIFDEF_BLOCKS
 .Ft int
-.Fo mergesort
+.Fo mergesort_b
+.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
+.Fc
+#endif
+.Ft void
+.Fo qsort
 .Fa "void *base"
-.Fa "size_t nmemb"
-.Fa "size_t size"
+.Fa "size_t nel"
+.Fa "size_t width"
 .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
 .Fc
+#ifdef UNIFDEF_BLOCKS
+.Ft void
+.Fo qsort_b
+.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
+.Fc
+#endif
+.Ft void
+.Fo qsort_r
+.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "void *thunk"
+.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn qsort
@@ -80,7 +117,7 @@ The
 function is a modified selection sort.
 The
 .Fn mergesort
-function is a modified merge sort with exponential search
+function is a modified merge sort with exponential search,
 intended for sorting data with pre-existing order.
 .Pp
 The
@@ -88,19 +125,19 @@ The
 and
 .Fn heapsort
 functions sort an array of
-.Fa nmemb
+.Fa nel
 objects, the initial member of which is pointed to by
 .Fa base .
 The size of each object is specified by
-.Fa size .
+.Fa width .
 The
 .Fn mergesort
 function
 behaves similarly, but
 .Em requires
 that
-.Fa size
-be greater than
+.Fa width
+be greater than or equal to
 .Dq "sizeof(void *) / 2" .
 .Pp
 The contents of the array
@@ -135,7 +172,7 @@ and
 .Fn heapsort
 are
 .Em not
-stable, that is, if two members compare as equal, their order in
+stable; that is, if two members compare as equal, their order in
 the sorted array is undefined.
 The
 .Fn mergesort
@@ -179,8 +216,8 @@ does not allocate memory, it is implemented using recursion.
 The function
 .Fn mergesort
 requires additional memory of size
-.Fa nmemb *
-.Fa size
+.Fa nel *
+.Fa width
 bytes; it should be used only when space is not at a premium.
 The
 .Fn mergesort
@@ -192,19 +229,40 @@ Normally,
 .Fn qsort
 is faster than
 .Fn mergesort
-is faster than
+which is faster than
 .Fn heapsort .
 Memory availability and pre-existing order in the data can make this
 untrue.
+#ifdef UNIFDEF_BLOCKS
+.Pp
+The
+.Fn heapsort_b ,
+.Fn mergesort_b ,
+and
+.Fn qsort_b
+routines are like the corresponding routines without the _b suffix, expect
+that the
+.Fa compar
+callback is a block pointer instead of a function pointer.
+#endif
 .Sh RETURN VALUES
 The
+#ifdef UNIFDEF_BLOCKS
+.Fn qsort ,
+.Fn qsort_b
+#else
 .Fn qsort
+#endif
 and
 .Fn qsort_r
 functions
 return no value.
 .Pp
-.Rv -std heapsort mergesort
+#ifdef UNIFDEF_BLOCKS
+.ds HEAPSORT_B heapsort_b
+.ds MERGESORT_B mergesort_b
+#endif
+.Rv -std heapsort \*[HEAPSORT_B] mergesort \*[MERGESORT_B]
 .Sh COMPATIBILITY
 Previous versions of
 .Fn qsort
@@ -213,26 +271,46 @@ did not permit the comparison routine itself to call
 This is no longer true.
 .Sh ERRORS
 The
+#ifdef UNIFDEF_BLOCKS
+.Fn heapsort ,
+.Fn heapsort_b ,
+.Fn mergesort ,
+and
+.Fn mergesort_b
+#else
 .Fn heapsort
 and
 .Fn mergesort
+#endif
 functions succeed unless:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The
-.Fa size
+.Fa width
 argument is zero, or,
 the
-.Fa size
+.Fa width
 argument to
 .Fn mergesort
+#ifdef UNIFDEF_BLOCKS
+or
+.Fn mergesort_b
+#endif
 is less than
 .Dq "sizeof(void *) / 2" .
 .It Bq Er ENOMEM
 The
+#ifdef UNIFDEF_BLOCKS
+.Fn heapsort ,
+.Fn heapsort_b ,
+.Fn mergesort ,
+or
+.Fn mergesort_b
+#else
 .Fn heapsort
 or
 .Fn mergesort
+#endif
 functions
 were unable to allocate memory.
 .El
diff --git a/stdlib/FreeBSD/qsort.3.patch b/stdlib/FreeBSD/qsort.3.patch
deleted file mode 100644 (file)
index f511988..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
---- qsort.3.orig       2010-10-07 21:23:04.000000000 -0700
-+++ qsort.3    2010-10-07 21:24:45.000000000 -0700
-@@ -36,41 +36,78 @@
- .Dt QSORT 3
- .Os
- .Sh NAME
--.Nm qsort , qsort_r , heapsort , mergesort
-+.Nm heapsort ,
-+#ifdef UNIFDEF_BLOCKS
-+.Nm heapsort_b ,
-+#endif
-+.Nm mergesort ,
-+#ifdef UNIFDEF_BLOCKS
-+.Nm mergesort_b ,
-+#endif
-+.Nm qsort ,
-+#ifdef UNIFDEF_BLOCKS
-+.Nm qsort_b ,
-+#endif
-+.Nm qsort_r
- .Nd sort functions
--.Sh LIBRARY
--.Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
--.Ft void
--.Fo qsort
-+.Ft int
-+.Fo heapsort
- .Fa "void *base"
--.Fa "size_t nmemb"
--.Fa "size_t size"
-+.Fa "size_t nel"
-+.Fa "size_t width"
- .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
- .Fc
--.Ft void
--.Fo qsort_r
-+#ifdef UNIFDEF_BLOCKS
-+.Ft int
-+.Fo heapsort_b
- .Fa "void *base"
--.Fa "size_t nmemb"
--.Fa "size_t size"
--.Fa "void *thunk"
--.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
-+.Fa "size_t nel"
-+.Fa "size_t width"
-+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
- .Fc
-+#endif
- .Ft int
--.Fo heapsort
-+.Fo mergesort
- .Fa "void *base"
--.Fa "size_t nmemb"
--.Fa "size_t size"
-+.Fa "size_t nel"
-+.Fa "size_t width"
- .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
- .Fc
-+#ifdef UNIFDEF_BLOCKS
- .Ft int
--.Fo mergesort
-+.Fo mergesort_b
-+.Fa "void *base"
-+.Fa "size_t nel"
-+.Fa "size_t width"
-+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-+.Fc
-+#endif
-+.Ft void
-+.Fo qsort
- .Fa "void *base"
--.Fa "size_t nmemb"
--.Fa "size_t size"
-+.Fa "size_t nel"
-+.Fa "size_t width"
- .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
- .Fc
-+#ifdef UNIFDEF_BLOCKS
-+.Ft void
-+.Fo qsort_b
-+.Fa "void *base"
-+.Fa "size_t nel"
-+.Fa "size_t width"
-+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-+.Fc
-+#endif
-+.Ft void
-+.Fo qsort_r
-+.Fa "void *base"
-+.Fa "size_t nel"
-+.Fa "size_t width"
-+.Fa "void *thunk"
-+.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn qsort
-@@ -80,7 +117,7 @@
- function is a modified selection sort.
- The
- .Fn mergesort
--function is a modified merge sort with exponential search
-+function is a modified merge sort with exponential search,
- intended for sorting data with pre-existing order.
- .Pp
- The
-@@ -88,19 +125,19 @@
- and
- .Fn heapsort
- functions sort an array of
--.Fa nmemb
-+.Fa nel
- objects, the initial member of which is pointed to by
- .Fa base .
- The size of each object is specified by
--.Fa size .
-+.Fa width .
- The
- .Fn mergesort
- function
- behaves similarly, but
- .Em requires
- that
--.Fa size
--be greater than
-+.Fa width
-+be greater than or equal to
- .Dq "sizeof(void *) / 2" .
- .Pp
- The contents of the array
-@@ -135,7 +172,7 @@
- .Fn heapsort
- are
- .Em not
--stable, that is, if two members compare as equal, their order in
-+stable; that is, if two members compare as equal, their order in
- the sorted array is undefined.
- The
- .Fn mergesort
-@@ -179,8 +216,8 @@
- The function
- .Fn mergesort
- requires additional memory of size
--.Fa nmemb *
--.Fa size
-+.Fa nel *
-+.Fa width
- bytes; it should be used only when space is not at a premium.
- The
- .Fn mergesort
-@@ -192,19 +229,40 @@
- .Fn qsort
- is faster than
- .Fn mergesort
--is faster than
-+which is faster than
- .Fn heapsort .
- Memory availability and pre-existing order in the data can make this
- untrue.
-+#ifdef UNIFDEF_BLOCKS
-+.Pp
-+The
-+.Fn heapsort_b ,
-+.Fn mergesort_b ,
-+and
-+.Fn qsort_b
-+routines are like the corresponding routines without the _b suffix, expect
-+that the
-+.Fa compar
-+callback is a block pointer instead of a function pointer.
-+#endif
- .Sh RETURN VALUES
- The
-+#ifdef UNIFDEF_BLOCKS
-+.Fn qsort ,
-+.Fn qsort_b
-+#else
- .Fn qsort
-+#endif
- and
- .Fn qsort_r
- functions
- return no value.
- .Pp
--.Rv -std heapsort mergesort
-+#ifdef UNIFDEF_BLOCKS
-+.ds HEAPSORT_B heapsort_b
-+.ds MERGESORT_B mergesort_b
-+#endif
-+.Rv -std heapsort \*[HEAPSORT_B] mergesort \*[MERGESORT_B]
- .Sh COMPATIBILITY
- Previous versions of
- .Fn qsort
-@@ -213,26 +271,46 @@
- This is no longer true.
- .Sh ERRORS
- The
-+#ifdef UNIFDEF_BLOCKS
-+.Fn heapsort ,
-+.Fn heapsort_b ,
-+.Fn mergesort ,
-+and
-+.Fn mergesort_b
-+#else
- .Fn heapsort
- and
- .Fn mergesort
-+#endif
- functions succeed unless:
- .Bl -tag -width Er
- .It Bq Er EINVAL
- The
--.Fa size
-+.Fa width
- argument is zero, or,
- the
--.Fa size
-+.Fa width
- argument to
- .Fn mergesort
-+#ifdef UNIFDEF_BLOCKS
-+or
-+.Fn mergesort_b
-+#endif
- is less than
- .Dq "sizeof(void *) / 2" .
- .It Bq Er ENOMEM
- The
-+#ifdef UNIFDEF_BLOCKS
-+.Fn heapsort ,
-+.Fn heapsort_b ,
-+.Fn mergesort ,
-+or
-+.Fn mergesort_b
-+#else
- .Fn heapsort
- or
- .Fn mergesort
-+#endif
- functions
- were unable to allocate memory.
- .El
index 095ec8bca24371a34c828e4527cdff28b41b089c..1d0e3c54f46e2a4a8a40b780f2537c00389810ed 100644 (file)
@@ -34,14 +34,19 @@ static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
 
 #include <stdlib.h>
+#include <string.h>
 
 #ifdef I_AM_QSORT_R
 typedef int             cmp_t(void *, const void *, const void *);
 #else
 typedef int             cmp_t(const void *, const void *);
 #endif
-static inline char     *med3(char *, char *, char *, cmp_t *, void *);
-static inline void      swapfunc(char *, char *, int, int);
+#ifdef I_AM_QSORT_B
+static inline char     *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
+#else
+static inline char     *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
+#endif
+static inline void      swapfunc(char *, char *, int, int) __attribute__((always_inline));
 
 #define min(a, b)      (a) < (b) ? a : b
 
@@ -90,7 +95,13 @@ swapfunc(a, b, n, swaptype)
 #endif
 
 static inline char *
-med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
+med3(char *a, char *b, char *c,
+#ifdef I_AM_QSORT_B
+cmp_t ^cmp,
+#else
+cmp_t *cmp,
+#endif
+void *thunk
 #ifndef I_AM_QSORT_R
 __unused
 #endif
@@ -101,21 +112,47 @@ __unused
               :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
 }
 
+#ifdef __LP64__
+#define DEPTH(x)       (2 * (flsl((long)(x)) - 1))
+#else /* !__LP64__ */
+#define DEPTH(x)       (2 * (fls((int)(x)) - 1))
+#endif /* __LP64__ */
+
 #ifdef I_AM_QSORT_R
-void
-qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
+#endif
+
+static void
+_qsort(void *a, size_t n, size_t es,
+#ifdef I_AM_QSORT_R
+void *thunk,
 #else
-#define thunk NULL
-void
-qsort(void *a, size_t n, size_t es, cmp_t *cmp)
+#define thunk  NULL
+#endif
+#ifdef I_AM_QSORT_B
+cmp_t ^cmp,
+#else
+cmp_t *cmp,
 #endif
+int depth_limit)
 {
        char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
        size_t d, r;
        int cmp_result;
        int swaptype, swap_cnt;
 
-loop:  SWAPINIT(a, es);
+loop:
+       if (depth_limit-- <= 0) {
+#ifdef I_AM_QSORT_B
+               heapsort_b(a, n, es, cmp);
+#elif defined(I_AM_QSORT_R)
+               __heapsort_r(a, n, es, thunk, cmp);
+#else
+               heapsort(a, n, es, cmp);
+#endif
+               return;
+       }
+       SWAPINIT(a, es);
        swap_cnt = 0;
        if (n < 7) {
                for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
@@ -165,25 +202,31 @@ loop:     SWAPINIT(a, es);
                pb += es;
                pc -= es;
        }
+
+       pn = (char *)a + n * es;
+       r = min(pa - (char *)a, pb - pa);
+       vecswap(a, pb - r, r);
+       r = min(pd - pc, pn - pd - es);
+       vecswap(pb, pn - r, r);
+
        if (swap_cnt == 0) {  /* Switch to insertion sort */
+               r = 1 + n / 4; /* n >= 7, so r >= 2 */
                for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
                        for (pl = pm; 
                             pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es)
+                            pl -= es) {
                                swap(pl, pl - es);
+                               if (++swap_cnt > r) goto nevermind;
+                       }
                return;
        }
 
-       pn = (char *)a + n * es;
-       r = min(pa - (char *)a, pb - pa);
-       vecswap(a, pb - r, r);
-       r = min(pd - pc, pn - pd - es);
-       vecswap(pb, pn - r, r);
+nevermind:
        if ((r = pb - pa) > es)
 #ifdef I_AM_QSORT_R
-               qsort_r(a, r / es, es, thunk, cmp);
+               _qsort(a, r / es, es, thunk, cmp, depth_limit);
 #else
-               qsort(a, r / es, es, cmp);
+               _qsort(a, r / es, es, cmp, depth_limit);
 #endif
        if ((r = pd - pc) > es) {
                /* Iterate rather than recurse to save stack space */
@@ -193,3 +236,19 @@ loop:      SWAPINIT(a, es);
        }
 /*             qsort(pn - r, r / es, es, cmp);*/
 }
+
+void
+#ifdef I_AM_QSORT_R
+qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+#elif defined(I_AM_QSORT_B)
+qsort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
+#else
+qsort(void *a, size_t n, size_t es, cmp_t *cmp)
+#endif
+{
+       _qsort(a, n, es,
+#ifdef I_AM_QSORT_R
+               thunk,
+#endif
+               cmp, DEPTH(n));
+}
diff --git a/stdlib/FreeBSD/qsort.c.patch b/stdlib/FreeBSD/qsort.c.patch
deleted file mode 100644 (file)
index c1fc970..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
---- qsort.c.orig       2008-09-24 19:55:30.000000000 -0700
-+++ qsort.c    2008-09-25 12:28:18.000000000 -0700
-@@ -34,14 +34,19 @@ static char sccsid[] = "@(#)qsort.c        8.1 
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
- #include <stdlib.h>
-+#include <string.h>
- #ifdef I_AM_QSORT_R
- typedef int            cmp_t(void *, const void *, const void *);
- #else
- typedef int            cmp_t(const void *, const void *);
- #endif
--static inline char    *med3(char *, char *, char *, cmp_t *, void *);
--static inline void     swapfunc(char *, char *, int, int);
-+#ifdef I_AM_QSORT_B
-+static inline char    *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
-+#else
-+static inline char    *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
-+#endif
-+static inline void     swapfunc(char *, char *, int, int) __attribute__((always_inline));
- #define min(a, b)     (a) < (b) ? a : b
-@@ -90,7 +95,13 @@ swapfunc(a, b, n, swaptype)
- #endif
- static inline char *
--med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
-+med3(char *a, char *b, char *c,
-+#ifdef I_AM_QSORT_B
-+cmp_t ^cmp,
-+#else
-+cmp_t *cmp,
-+#endif
-+void *thunk
- #ifndef I_AM_QSORT_R
- __unused
- #endif
-@@ -101,21 +112,47 @@ __unused
-               :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
- }
-+#ifdef __LP64__
-+#define DEPTH(x)      (2 * (flsl((long)(x)) - 1))
-+#else /* !__LP64__ */
-+#define DEPTH(x)      (2 * (fls((int)(x)) - 1))
-+#endif /* __LP64__ */
-+
- #ifdef I_AM_QSORT_R
--void
--qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-+int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
-+#endif
-+
-+static void
-+_qsort(void *a, size_t n, size_t es,
-+#ifdef I_AM_QSORT_R
-+void *thunk,
- #else
--#define thunk NULL
--void
--qsort(void *a, size_t n, size_t es, cmp_t *cmp)
-+#define thunk NULL
-+#endif
-+#ifdef I_AM_QSORT_B
-+cmp_t ^cmp,
-+#else
-+cmp_t *cmp,
- #endif
-+int depth_limit)
- {
-       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
-       size_t d, r;
-       int cmp_result;
-       int swaptype, swap_cnt;
--loop: SWAPINIT(a, es);
-+loop:
-+      if (depth_limit-- <= 0) {
-+#ifdef I_AM_QSORT_B
-+              heapsort_b(a, n, es, cmp);
-+#elif defined(I_AM_QSORT_R)
-+              __heapsort_r(a, n, es, thunk, cmp);
-+#else
-+              heapsort(a, n, es, cmp);
-+#endif
-+              return;
-+      }
-+      SWAPINIT(a, es);
-       swap_cnt = 0;
-       if (n < 7) {
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-@@ -165,25 +202,31 @@ loop:    SWAPINIT(a, es);
-               pb += es;
-               pc -= es;
-       }
-+
-+      pn = (char *)a + n * es;
-+      r = min(pa - (char *)a, pb - pa);
-+      vecswap(a, pb - r, r);
-+      r = min(pd - pc, pn - pd - es);
-+      vecswap(pb, pn - r, r);
-+
-       if (swap_cnt == 0) {  /* Switch to insertion sort */
-+              r = 1 + n / 4; /* n >= 7, so r >= 2 */
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
--                           pl -= es)
-+                           pl -= es) {
-                               swap(pl, pl - es);
-+                              if (++swap_cnt > r) goto nevermind;
-+                      }
-               return;
-       }
--      pn = (char *)a + n * es;
--      r = min(pa - (char *)a, pb - pa);
--      vecswap(a, pb - r, r);
--      r = min(pd - pc, pn - pd - es);
--      vecswap(pb, pn - r, r);
-+nevermind:
-       if ((r = pb - pa) > es)
- #ifdef I_AM_QSORT_R
--              qsort_r(a, r / es, es, thunk, cmp);
-+              _qsort(a, r / es, es, thunk, cmp, depth_limit);
- #else
--              qsort(a, r / es, es, cmp);
-+              _qsort(a, r / es, es, cmp, depth_limit);
- #endif
-       if ((r = pd - pc) > es) {
-               /* Iterate rather than recurse to save stack space */
-@@ -193,3 +236,19 @@ loop:     SWAPINIT(a, es);
-       }
- /*            qsort(pn - r, r / es, es, cmp);*/
- }
-+
-+void
-+#ifdef I_AM_QSORT_R
-+qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-+#elif defined(I_AM_QSORT_B)
-+qsort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
-+#else
-+qsort(void *a, size_t n, size_t es, cmp_t *cmp)
-+#endif
-+{
-+      _qsort(a, n, es,
-+#ifdef I_AM_QSORT_R
-+              thunk,
-+#endif
-+              cmp, DEPTH(n));
-+}
diff --git a/stdlib/FreeBSD/qsort_r.c.patch b/stdlib/FreeBSD/qsort_r.c.patch
deleted file mode 100644 (file)
index 031e772..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- qsort_r.c.orig     Mon Apr 28 16:37:26 2003
-+++ qsort_r.c  Sat May  3 14:29:49 2003
-@@ -5,4 +5,4 @@
-  * $FreeBSD: src/lib/libc/stdlib/qsort_r.c,v 1.1 2002/09/10 02:04:49 wollman Exp $
-  */
- #define I_AM_QSORT_R
--#include "qsort.c"
-+#include "qsort-fbsd.c"
index 5e7c6dc39d5e8477237240c3cbfbbc729983a805..5208ce91ea969d47a7408c5b1562c7e4bfcf2728 100644 (file)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/radixsort.c,v 1.8 2007/01/09 00:28:10 im
 #include <stdlib.h>
 #include <stddef.h>
 #include <errno.h>
+#include <pthread.h>
 
 typedef struct {
        const u_char **sa;
@@ -60,11 +61,17 @@ typedef struct {
 } stack;
 
 static inline void simplesort
-(const u_char **, int, int, const u_char *, u_int);
+(const u_char **, int, int, const u_char *, u_int) __attribute__((always_inline));
 static void r_sort_a(const u_char **, int, int, const u_char *, u_int);
 static void r_sort_b(const u_char **, const u_char **, int, int,
     const u_char *, u_int);
 
+static int *r_sort_a_count;
+static int *r_sort_b_count;
+
+static void r_sort_count_allocate(void);
+static pthread_once_t r_sort_count_control = PTHREAD_ONCE_INIT;
+
 #define        THRESHOLD       20              /* Divert to simplesort(). */
 #define        SIZE            512             /* Default stack size. */
 
@@ -124,6 +131,12 @@ sradixsort(a, n, tab, endch)
        return (0);
 }
 
+static void r_sort_count_allocate(void)
+{
+       r_sort_a_count = calloc(256, sizeof(int));
+       r_sort_b_count = calloc(256, sizeof(int));
+}
+
 #define empty(s)       (s >= sp)
 #define pop(a, n, i)   a = (--sp)->sa, n = sp->sn, i = sp->si
 #define push(a, n, i)  sp->sa = a, sp->sn = n, (sp++)->si = i
@@ -137,13 +150,19 @@ r_sort_a(a, n, i, tr, endch)
        const u_char *tr;
        u_int endch;
 {
-       static int count[256], nc, bmin;
+       static int *count, nc, bmin;
        int c;
        const u_char **ak, *r;
        stack s[SIZE], *sp, *sp0, *sp1, temp;
        int *cp, bigc;
        const u_char **an, *t, **aj, **top[256];
 
+       if (pthread_once(&r_sort_count_control, r_sort_count_allocate)) {
+               return;
+       }
+
+       count = r_sort_a_count;
+
        /* Set up stack. */
        sp = s;
        push(a, n, i);
@@ -239,13 +258,19 @@ r_sort_b(a, ta, n, i, tr, endch)
        const u_char *tr;
        u_int endch;
 {
-       static int count[256], nc, bmin;
+       static int *count, nc, bmin;
        int c;
        const u_char **ak, **ai;
        stack s[512], *sp, *sp0, *sp1, temp;
        const u_char **top[256];
        int *cp, bigc;
 
+       if (pthread_once(&r_sort_count_control, r_sort_count_allocate)) {
+               return;
+       }
+
+       count = r_sort_b_count;
+
        sp = s;
        push(a, n, i);
        while (!empty(s)) {
diff --git a/stdlib/FreeBSD/radixsort.c.patch b/stdlib/FreeBSD/radixsort.c.patch
deleted file mode 100644 (file)
index 60f3cd6..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
---- radixsort.c.orig   2010-06-21 14:05:02.000000000 -0700
-+++ radixsort.c        2010-06-21 14:26:55.000000000 -0700
-@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <stdlib.h>
- #include <stddef.h>
- #include <errno.h>
-+#include <pthread.h>
- typedef struct {
-       const u_char **sa;
-@@ -60,11 +61,17 @@ typedef struct {
- } stack;
- static inline void simplesort
--(const u_char **, int, int, const u_char *, u_int);
-+(const u_char **, int, int, const u_char *, u_int) __attribute__((always_inline));
- static void r_sort_a(const u_char **, int, int, const u_char *, u_int);
- static void r_sort_b(const u_char **, const u_char **, int, int,
-     const u_char *, u_int);
-+static int *r_sort_a_count;
-+static int *r_sort_b_count;
-+
-+static void r_sort_count_allocate(void);
-+static pthread_once_t r_sort_count_control = PTHREAD_ONCE_INIT;
-+
- #define       THRESHOLD       20              /* Divert to simplesort(). */
- #define       SIZE            512             /* Default stack size. */
-@@ -124,6 +131,12 @@ sradixsort(a, n, tab, endch)
-       return (0);
- }
-+static void r_sort_count_allocate(void)
-+{
-+      r_sort_a_count = calloc(256, sizeof(int));
-+      r_sort_b_count = calloc(256, sizeof(int));
-+}
-+
- #define empty(s)      (s >= sp)
- #define pop(a, n, i)  a = (--sp)->sa, n = sp->sn, i = sp->si
- #define push(a, n, i) sp->sa = a, sp->sn = n, (sp++)->si = i
-@@ -137,13 +150,19 @@ r_sort_a(a, n, i, tr, endch)
-       const u_char *tr;
-       u_int endch;
- {
--      static int count[256], nc, bmin;
-+      static int *count, nc, bmin;
-       int c;
-       const u_char **ak, *r;
-       stack s[SIZE], *sp, *sp0, *sp1, temp;
-       int *cp, bigc;
-       const u_char **an, *t, **aj, **top[256];
-+      if (pthread_once(&r_sort_count_control, r_sort_count_allocate)) {
-+              return;
-+      }
-+
-+      count = r_sort_a_count;
-+
-       /* Set up stack. */
-       sp = s;
-       push(a, n, i);
-@@ -239,13 +258,19 @@ r_sort_b(a, ta, n, i, tr, endch)
-       const u_char *tr;
-       u_int endch;
- {
--      static int count[256], nc, bmin;
-+      static int *count, nc, bmin;
-       int c;
-       const u_char **ak, **ai;
-       stack s[512], *sp, *sp0, *sp1, temp;
-       const u_char **top[256];
-       int *cp, bigc;
-+      if (pthread_once(&r_sort_count_control, r_sort_count_allocate)) {
-+              return;
-+      }
-+
-+      count = r_sort_b_count;
-+
-       sp = s;
-       push(a, n, i);
-       while (!empty(s)) {
index f4705234bb6158a1b9bdeb34e42e528b3b6a7239..fec6ac633b7ba8d33aa80319fc098322a30cb572 100644 (file)
 .Os
 .Sh NAME
 .Nm rand ,
+.Nm rand_r ,
 .Nm srand ,
-.Nm sranddev ,
-.Nm rand_r
+.Nm sranddev
 .Nd bad random number generator
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
-.Ft void
-.Fn srand "unsigned seed"
-.Ft void
-.Fn sranddev void
 .Ft int
-.Fn rand void
+.Fo rand
+.Fa void
+.Fc
 .Ft int
-.Fn rand_r "unsigned *ctx"
+.Fo rand_r
+.Fa "unsigned *seed"
+.Fc
+.Ft void
+.Fo srand
+.Fa "unsigned seed"
+.Fc
+.Ft void
+.Fo sranddev
+.Fa void
+.Fc
 .Sh DESCRIPTION
 .Bf -symbolic
 These interfaces are obsoleted by
@@ -85,7 +93,7 @@ seeded with a value of 1.
 .Pp
 The
 .Fn sranddev
-function initializes a seed using the
+function initializes a seed, using the
 .Xr random 4
 random number device which returns good random numbers.
 However, the
@@ -98,7 +106,7 @@ function
 provides the same functionality as
 .Fn rand .
 A pointer to the context value
-.Fa ctx
+.Fa seed
 must be supplied by the caller.
 .Sh SEE ALSO
 .Xr random 3 ,
diff --git a/stdlib/FreeBSD/rand.3.patch b/stdlib/FreeBSD/rand.3.patch
deleted file mode 100644 (file)
index f0944a2..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
---- rand.3.bsdnew      2009-11-13 14:11:50.000000000 -0800
-+++ rand.3     2009-11-13 14:11:50.000000000 -0800
-@@ -37,22 +37,30 @@
- .Os
- .Sh NAME
- .Nm rand ,
-+.Nm rand_r ,
- .Nm srand ,
--.Nm sranddev ,
--.Nm rand_r
-+.Nm sranddev
- .Nd bad random number generator
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
--.Ft void
--.Fn srand "unsigned seed"
--.Ft void
--.Fn sranddev void
- .Ft int
--.Fn rand void
-+.Fo rand
-+.Fa void
-+.Fc
- .Ft int
--.Fn rand_r "unsigned *ctx"
-+.Fo rand_r
-+.Fa "unsigned *seed"
-+.Fc
-+.Ft void
-+.Fo srand
-+.Fa "unsigned seed"
-+.Fc
-+.Ft void
-+.Fo sranddev
-+.Fa void
-+.Fc
- .Sh DESCRIPTION
- .Bf -symbolic
- These interfaces are obsoleted by
-@@ -85,7 +93,7 @@ seeded with a value of 1.
- .Pp
- The
- .Fn sranddev
--function initializes a seed using the
-+function initializes a seed, using the
- .Xr random 4
- random number device which returns good random numbers.
- However, the
-@@ -98,7 +106,7 @@ function
- provides the same functionality as
- .Fn rand .
- A pointer to the context value
--.Fa ctx
-+.Fa seed
- must be supplied by the caller.
- .Sh SEE ALSO
- .Xr random 3 ,
index 4c3f06110dfcbf0f97e8a7887593372128b42c63..84c8755c53da4c9c0537344c2fdb8484c471f032 100644 (file)
 .Dt RANDOM 3
 .Os
 .Sh NAME
+.Nm initstate ,
 .Nm random ,
+.Nm setstate ,
 .Nm srandom ,
-.Nm srandomdev ,
-.Nm initstate ,
-.Nm setstate
+.Nm srandomdev
 .Nd better random number generator; routines for changing generators
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
+.Ft char *
+.Fo initstate
+.Fa "unsigned seed"
+.Fa "char *state"
+.Fa "size_t size"
+.Fc
 .Ft long
-.Fn random void
+.Fo random
+.Fa void
+.Fc
+.Ft char *
+.Fo setstate
+.Fa "const char *state"
+.Fc
 .Ft void
-.Fn srandom "unsigned long seed"
+.Fo srandom
+.Fa "unsigned seed"
+.Fc
 .Ft void
-.Fn srandomdev void
-.Ft char *
-.Fn initstate "unsigned long seed" "char *state" "long n"
-.Ft char *
-.Fn setstate "char *state"
+.Fo srandomdev
+.Fa void
+.Fc
 .Sh DESCRIPTION
 The
 .Fn random
 function
-uses a non-linear additive feedback random number generator employing a
-default table of size 31 long integers to return successive pseudo-random
+uses a non-linear, additive feedback, random number generator, employing a
+default table of size 31 long integers.
+It returns successive pseudo-random
 numbers in the range from 0 to
 .if t 2\u\s731\s10\d\(mi1.
 .if n (2**31)\(mi1.
@@ -78,7 +91,7 @@ The difference is that
 .Xr rand 3
 produces a much less random sequence \(em in fact, the low dozen bits
 generated by rand go through a cyclic pattern.
-All the bits generated by
+All of the bits generated by
 .Fn random
 are usable.
 For example,
@@ -87,18 +100,21 @@ will produce a random binary
 value.
 .Pp
 Like
+.Xr srand 3 ,
+.Fn srandom
+sets the initial seed value for future calls to
+.Fn random .
+Like
 .Xr rand 3 ,
 .Fn random
 will by default produce a sequence of numbers that can be duplicated
 by calling
 .Fn srandom
-with
-.Ql 1
-as the seed.
+with the same seed.
 .Pp
 The
 .Fn srandomdev
-routine initializes a state array using the
+routine initializes a state array, using the
 .Xr random 4
 random number device which returns good random numbers,
 suitable for cryptographic use.
@@ -123,7 +139,7 @@ more state, the better the random numbers will be.
 the nearest known amount.
 Using less than 8 bytes will cause an error.)
 The seed for the initialization (which specifies a starting point for
-the random number sequence, and provides for restarting at the same
+the random number sequence and provides for restarting at the same
 point) is also an argument.
 The
 .Fn initstate
@@ -162,7 +178,7 @@ it is initialized.
 With 256 bytes of state information, the period of the random number
 generator is greater than
 .if t 2\u\s769\s10\d,
-.if n 2**69
+.if n 2**69 ,
 which should be sufficient for most purposes.
 .Sh DIAGNOSTICS
 If
@@ -171,11 +187,36 @@ is called with less than 8 bytes of state information, or if
 .Fn setstate
 detects that the state information has been garbled, error
 messages are printed on the standard error output.
+.Sh LEGACY SYNOPSIS
+.Fd #include <stdlib.h>
+.Pp
+.Ft char *
+.br
+.Fo initstate
+.Fa "unsigned long seed"
+.Fa "char *state"
+.Fa "long size"
+.Fc ;
+.Pp
+.Ft char *
+.br
+.Fo setstate
+.Fa "char *state"
+.Fc ;
+.Pp
+.Ft void
+.br
+.Fo srandom
+.Fa "unsigned long seed"
+.Fc ;
+.Pp
+The type of each parameter is different in the legacy version.
 .Sh SEE ALSO
 .Xr arc4random 3 ,
 .Xr rand 3 ,
 .Xr srand 3 ,
-.Xr random 4
+.Xr random 4 ,
+.Xr compat 5
 .Sh HISTORY
 These
 functions appeared in
diff --git a/stdlib/FreeBSD/random.3.patch b/stdlib/FreeBSD/random.3.patch
deleted file mode 100644 (file)
index 61c0621..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
---- random.3.orig      2010-04-28 23:38:47.000000000 -0700
-+++ random.3   2010-04-29 09:47:13.000000000 -0700
-@@ -32,32 +32,45 @@
- .Dt RANDOM 3
- .Os
- .Sh NAME
-+.Nm initstate ,
- .Nm random ,
-+.Nm setstate ,
- .Nm srandom ,
--.Nm srandomdev ,
--.Nm initstate ,
--.Nm setstate
-+.Nm srandomdev
- .Nd better random number generator; routines for changing generators
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
-+.Ft char *
-+.Fo initstate
-+.Fa "unsigned seed"
-+.Fa "char *state"
-+.Fa "size_t size"
-+.Fc
- .Ft long
--.Fn random void
-+.Fo random
-+.Fa void
-+.Fc
-+.Ft char *
-+.Fo setstate
-+.Fa "const char *state"
-+.Fc
- .Ft void
--.Fn srandom "unsigned long seed"
-+.Fo srandom
-+.Fa "unsigned seed"
-+.Fc
- .Ft void
--.Fn srandomdev void
--.Ft char *
--.Fn initstate "unsigned long seed" "char *state" "long n"
--.Ft char *
--.Fn setstate "char *state"
-+.Fo srandomdev
-+.Fa void
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn random
- function
--uses a non-linear additive feedback random number generator employing a
--default table of size 31 long integers to return successive pseudo-random
-+uses a non-linear, additive feedback, random number generator, employing a
-+default table of size 31 long integers.
-+It returns successive pseudo-random
- numbers in the range from 0 to
- .if t 2\u\s731\s10\d\(mi1.
- .if n (2**31)\(mi1.
-@@ -78,7 +91,7 @@ The difference is that
- .Xr rand 3
- produces a much less random sequence \(em in fact, the low dozen bits
- generated by rand go through a cyclic pattern.
--All the bits generated by
-+All of the bits generated by
- .Fn random
- are usable.
- For example,
-@@ -87,18 +100,21 @@ will produce a random binary
- value.
- .Pp
- Like
-+.Xr srand 3 ,
-+.Fn srandom
-+sets the initial seed value for future calls to
-+.Fn random .
-+Like
- .Xr rand 3 ,
- .Fn random
- will by default produce a sequence of numbers that can be duplicated
- by calling
- .Fn srandom
--with
--.Ql 1
--as the seed.
-+with the same seed.
- .Pp
- The
- .Fn srandomdev
--routine initializes a state array using the
-+routine initializes a state array, using the
- .Xr random 4
- random number device which returns good random numbers,
- suitable for cryptographic use.
-@@ -123,7 +139,7 @@ more state, the better the random number
- the nearest known amount.
- Using less than 8 bytes will cause an error.)
- The seed for the initialization (which specifies a starting point for
--the random number sequence, and provides for restarting at the same
-+the random number sequence and provides for restarting at the same
- point) is also an argument.
- The
- .Fn initstate
-@@ -162,7 +178,7 @@ it is initialized.
- With 256 bytes of state information, the period of the random number
- generator is greater than
- .if t 2\u\s769\s10\d,
--.if n 2**69
-+.if n 2**69 ,
- which should be sufficient for most purposes.
- .Sh DIAGNOSTICS
- If
-@@ -171,11 +187,36 @@ is called with less than 8 bytes of stat
- .Fn setstate
- detects that the state information has been garbled, error
- messages are printed on the standard error output.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <stdlib.h>
-+.Pp
-+.Ft char *
-+.br
-+.Fo initstate
-+.Fa "unsigned long seed"
-+.Fa "char *state"
-+.Fa "long size"
-+.Fc ;
-+.Pp
-+.Ft char *
-+.br
-+.Fo setstate
-+.Fa "char *state"
-+.Fc ;
-+.Pp
-+.Ft void
-+.br
-+.Fo srandom
-+.Fa "unsigned long seed"
-+.Fc ;
-+.Pp
-+The type of each parameter is different in the legacy version.
- .Sh SEE ALSO
- .Xr arc4random 3 ,
- .Xr rand 3 ,
- .Xr srand 3 ,
--.Xr random 4
-+.Xr random 4 ,
-+.Xr compat 5
- .Sh HISTORY
- These
- functions appeared in
index 693550b2380464bedba0d31ad1c87f263ca719bf..15db6402313f72dd02e463998ef07a3e159a1860 100644 (file)
@@ -33,6 +33,14 @@ static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.25 2007/01/09 00:28:10 imp Exp $");
 
+/*
+ * We always compile with __DARWIN_UNIX03 set to one, relying on the fact that
+ * (for non-LP64) sizeof(int) == sizeof(long) == sizeof(size_t), so that we
+ * don't have to have two different versions of the prototypes.  For LP64,
+ * we only support the POSIX-compatible prototypes.
+ */
+#undef         __DARWIN_UNIX03
+#define        __DARWIN_UNIX03 1
 #include "namespace.h"
 #include <sys/time.h>          /* for srandomdev() */
 #include <fcntl.h>             /* for srandomdev() */
@@ -216,7 +224,7 @@ static int rand_deg = DEG_3;
 static int rand_sep = SEP_3;
 static uint32_t *end_ptr = &randtbl[DEG_3 + 1];
 
-static inline uint32_t good_rand(int32_t);
+static inline uint32_t good_rand(int32_t) __attribute__((always_inline));
 
 static inline uint32_t good_rand (x)
        int32_t x;
@@ -265,7 +273,7 @@ static inline uint32_t good_rand (x)
  */
 void
 srandom(x)
-       unsigned long x;
+       unsigned x;
 {
        int i, lim;
 
@@ -353,9 +361,9 @@ srandomdev()
  */
 char *
 initstate(seed, arg_state, n)
-       unsigned long seed;             /* seed for R.N.G. */
+       unsigned seed;          /* seed for R.N.G. */
        char *arg_state;                /* pointer to state array */
-       long n;                         /* # bytes of state info */
+       size_t n;                               /* # bytes of state info */
 {
        char *ostate = (char *)(&state[-1]);
        uint32_t *int_arg_state = (uint32_t *)arg_state;
@@ -421,7 +429,7 @@ initstate(seed, arg_state, n)
  */
 char *
 setstate(arg_state)
-       char *arg_state;                /* pointer to state array */
+       const char *arg_state;          /* pointer to state array */
 {
        uint32_t *new_state = (uint32_t *)arg_state;
        uint32_t type = new_state[0] % MAX_TYPES;
diff --git a/stdlib/FreeBSD/random.c.patch b/stdlib/FreeBSD/random.c.patch
deleted file mode 100644 (file)
index d7feafa..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
---- random.c.bsdnew    2009-11-13 14:11:50.000000000 -0800
-+++ random.c   2009-11-13 14:11:51.000000000 -0800
-@@ -33,6 +33,14 @@ static char sccsid[] = "@(#)random.c        8.2
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.25 2007/01/09 00:28:10 imp Exp $");
-+/*
-+ * We always compile with __DARWIN_UNIX03 set to one, relying on the fact that
-+ * (for non-LP64) sizeof(int) == sizeof(long) == sizeof(size_t), so that we
-+ * don't have to have two different versions of the prototypes.  For LP64,
-+ * we only support the POSIX-compatible prototypes.
-+ */
-+#undef        __DARWIN_UNIX03
-+#define       __DARWIN_UNIX03 1
- #include "namespace.h"
- #include <sys/time.h>          /* for srandomdev() */
- #include <fcntl.h>             /* for srandomdev() */
-@@ -216,7 +224,7 @@ static int rand_deg = DEG_3;
- static int rand_sep = SEP_3;
- static uint32_t *end_ptr = &randtbl[DEG_3 + 1];
--static inline uint32_t good_rand(int32_t);
-+static inline uint32_t good_rand(int32_t) __attribute__((always_inline));
- static inline uint32_t good_rand (x)
-       int32_t x;
-@@ -265,7 +273,7 @@ static inline uint32_t good_rand (x)
-  */
- void
- srandom(x)
--      unsigned long x;
-+      unsigned x;
- {
-       int i, lim;
-@@ -353,9 +361,9 @@ srandomdev()
-  */
- char *
- initstate(seed, arg_state, n)
--      unsigned long seed;             /* seed for R.N.G. */
-+      unsigned seed;          /* seed for R.N.G. */
-       char *arg_state;                /* pointer to state array */
--      long n;                         /* # bytes of state info */
-+      size_t n;                               /* # bytes of state info */
- {
-       char *ostate = (char *)(&state[-1]);
-       uint32_t *int_arg_state = (uint32_t *)arg_state;
-@@ -421,7 +429,7 @@ initstate(seed, arg_state, n)
-  */
- char *
- setstate(arg_state)
--      char *arg_state;                /* pointer to state array */
-+      const char *arg_state;          /* pointer to state array */
- {
-       uint32_t *new_state = (uint32_t *)arg_state;
-       uint32_t type = new_state[0] % MAX_TYPES;
index dc6ba9abe92c5d9a6805c444521b6036bfe74832..3ffdf9c676bb1186dc47f438e4c887177ff581bd 100644 (file)
 .\"     @(#)realpath.3 8.2 (Berkeley) 2/16/94
 .\" $FreeBSD: src/lib/libc/stdlib/realpath.3,v 1.14 2007/01/09 00:28:10 imp Exp $
 .\"
-.Dd February 16, 1994
+.Dd April 5, 2008
 .Dt REALPATH 3
 .Os
 .Sh NAME
 .Nm realpath
 .Nd returns the canonicalized absolute pathname
-.Sh LIBRARY
-.Lb libc
+.\" .Sh LIBRARY
+.\" .Lb libc
 .Sh SYNOPSIS
-.In sys/param.h
 .In stdlib.h
 .Ft "char *"
-.Fn realpath "const char *pathname" "char resolved_path[PATH_MAX]"
+.Fo realpath
+.Fa "const char *restrict file_name"
+.Fa "char *restrict resolved_name"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn realpath
 function resolves all symbolic links, extra
 .Dq /
-characters and references to
+characters, and references to
 .Pa /./
 and
 .Pa /../
 in
-.Fa pathname ,
-and copies the resulting absolute pathname into
-the memory referenced by
-.Fa resolved_path .
-The
-.Fa resolved_path
+.Fa file_name .
+If the
+.Fa resolved_name
 argument
+is non-NULL, the resulting absolute pathname is copied there (it
 .Em must
 refer to a buffer capable of storing at least
 .Dv PATH_MAX
-characters.
+characters).
+.Pp
+As a permitted extension to the standard, if
+.Fa resolved_name
+is NULL, 
+memory is allocated for the resulting absolute pathname, and is returned by
+.Fn realpath .
+This memory should be freed by a call to
+.Xr free 3
+when no longer needed.
 .Pp
 The
 .Fn realpath
 function will resolve both absolute and relative paths
 and return the absolute pathname corresponding to
-.Fa pathname .
-All but the last component of
-.Fa pathname
+.Fa file_name .
+All components of
+.Fa file_name
 must exist when
 .Fn realpath
 is called.
 .Sh "RETURN VALUES"
-The
+On success, the
 .Fn realpath
-function returns
-.Fa resolved_path
-on success.
+function returns the address of the resulting absolute pathname, which is
+.Fa resolved_name
+if it was non-NULL, or the address of newly allocated memory.
 If an error occurs,
 .Fn realpath
 returns
-.Dv NULL ,
-and
-.Fa resolved_path
+.Dv NULL .
+If
+.Fa resolved_name
+was non-NULL, it will
 contains the pathname which caused the problem.
 .Sh ERRORS
 The function
@@ -95,24 +105,44 @@ The function
 may fail and set the external variable
 .Va errno
 for any of the errors specified for the library functions
+.Xr alloca 3 ,
+.Xr getattrlist 2 ,
+.Xr getcwd 3 ,
 .Xr lstat 2 ,
-.Xr readlink 2
+.Xr readlink 2 ,
+.Xr stat 2 ,
 and
-.Xr getcwd 3 .
-.Sh CAVEATS
-This implementation of
+.Xr strdup 3 .
+.\" .Sh CAVEATS
+.\" This implementation of
+.\" .Fn realpath
+.\" differs slightly from the Solaris implementation.
+.\" The
+.\" .Bx 4.4
+.\" version always returns absolute pathnames,
+.\" whereas the Solaris implementation will,
+.\" under certain circumstances, return a relative
+.\" .Fa resolved_name
+.\" when given a relative
+.\" .Fa file_name .
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/param.h>
+.Fd #include <stdlib.h>
+.Pp
+The include file
+.In sys/param.h
+is necessary.
+.Sh LEGACY DESCRIPTION
+In legacy mode,
+the last component of
+.Fa file_name
+does not need to exist when
 .Fn realpath
-differs slightly from the Solaris implementation.
-The
-.Bx 4.4
-version always returns absolute pathnames,
-whereas the Solaris implementation will,
-under certain circumstances, return a relative
-.Fa resolved_path
-when given a relative
-.Fa pathname .
+is called.
 .Sh "SEE ALSO"
-.Xr getcwd 3
+.Xr free 3 ,
+.Xr getcwd 3 ,
+.Xr compat 5
 .Sh HISTORY
 The
 .Fn realpath
diff --git a/stdlib/FreeBSD/realpath.3.patch b/stdlib/FreeBSD/realpath.3.patch
deleted file mode 100644 (file)
index f253985..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
---- realpath.3.bsdnew  2009-11-13 14:11:51.000000000 -0800
-+++ realpath.3 2009-11-13 14:11:51.000000000 -0800
-@@ -31,63 +31,73 @@
- .\"     @(#)realpath.3        8.2 (Berkeley) 2/16/94
- .\" $FreeBSD: src/lib/libc/stdlib/realpath.3,v 1.14 2007/01/09 00:28:10 imp Exp $
- .\"
--.Dd February 16, 1994
-+.Dd April 5, 2008
- .Dt REALPATH 3
- .Os
- .Sh NAME
- .Nm realpath
- .Nd returns the canonicalized absolute pathname
--.Sh LIBRARY
--.Lb libc
-+.\" .Sh LIBRARY
-+.\" .Lb libc
- .Sh SYNOPSIS
--.In sys/param.h
- .In stdlib.h
- .Ft "char *"
--.Fn realpath "const char *pathname" "char resolved_path[PATH_MAX]"
-+.Fo realpath
-+.Fa "const char *restrict file_name"
-+.Fa "char *restrict resolved_name"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn realpath
- function resolves all symbolic links, extra
- .Dq /
--characters and references to
-+characters, and references to
- .Pa /./
- and
- .Pa /../
- in
--.Fa pathname ,
--and copies the resulting absolute pathname into
--the memory referenced by
--.Fa resolved_path .
--The
--.Fa resolved_path
-+.Fa file_name .
-+If the
-+.Fa resolved_name
- argument
-+is non-NULL, the resulting absolute pathname is copied there (it
- .Em must
- refer to a buffer capable of storing at least
- .Dv PATH_MAX
--characters.
-+characters).
-+.Pp
-+As a permitted extension to the standard, if
-+.Fa resolved_name
-+is NULL, 
-+memory is allocated for the resulting absolute pathname, and is returned by
-+.Fn realpath .
-+This memory should be freed by a call to
-+.Xr free 3
-+when no longer needed.
- .Pp
- The
- .Fn realpath
- function will resolve both absolute and relative paths
- and return the absolute pathname corresponding to
--.Fa pathname .
--All but the last component of
--.Fa pathname
-+.Fa file_name .
-+All components of
-+.Fa file_name
- must exist when
- .Fn realpath
- is called.
- .Sh "RETURN VALUES"
--The
-+On success, the
- .Fn realpath
--function returns
--.Fa resolved_path
--on success.
-+function returns the address of the resulting absolute pathname, which is
-+.Fa resolved_name
-+if it was non-NULL, or the address of newly allocated memory.
- If an error occurs,
- .Fn realpath
- returns
--.Dv NULL ,
--and
--.Fa resolved_path
-+.Dv NULL .
-+If
-+.Fa resolved_name
-+was non-NULL, it will
- contains the pathname which caused the problem.
- .Sh ERRORS
- The function
-@@ -95,24 +105,44 @@ The function
- may fail and set the external variable
- .Va errno
- for any of the errors specified for the library functions
-+.Xr alloca 3 ,
-+.Xr getattrlist 2 ,
-+.Xr getcwd 3 ,
- .Xr lstat 2 ,
--.Xr readlink 2
-+.Xr readlink 2 ,
-+.Xr stat 2 ,
- and
--.Xr getcwd 3 .
--.Sh CAVEATS
--This implementation of
-+.Xr strdup 3 .
-+.\" .Sh CAVEATS
-+.\" This implementation of
-+.\" .Fn realpath
-+.\" differs slightly from the Solaris implementation.
-+.\" The
-+.\" .Bx 4.4
-+.\" version always returns absolute pathnames,
-+.\" whereas the Solaris implementation will,
-+.\" under certain circumstances, return a relative
-+.\" .Fa resolved_name
-+.\" when given a relative
-+.\" .Fa file_name .
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/param.h>
-+.Fd #include <stdlib.h>
-+.Pp
-+The include file
-+.In sys/param.h
-+is necessary.
-+.Sh LEGACY DESCRIPTION
-+In legacy mode,
-+the last component of
-+.Fa file_name
-+does not need to exist when
- .Fn realpath
--differs slightly from the Solaris implementation.
--The
--.Bx 4.4
--version always returns absolute pathnames,
--whereas the Solaris implementation will,
--under certain circumstances, return a relative
--.Fa resolved_path
--when given a relative
--.Fa pathname .
-+is called.
- .Sh "SEE ALSO"
--.Xr getcwd 3
-+.Xr free 3 ,
-+.Xr getcwd 3 ,
-+.Xr compat 5
- .Sh HISTORY
- The
- .Fn realpath
index 31e097787b8fb67f29c3e409c470c1335e93d788..234bce9a84d36d46ade64a2fa9acf0c13a1f9cf3 100644 (file)
@@ -35,13 +35,41 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/realpath.c,v 1.20 2003/05/28 08:23:01 fj
 #include "namespace.h"
 #include <sys/param.h>
 #include <sys/stat.h>
+#include <sys/mount.h>
 
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/attr.h>
+#include <sys/vnode.h>
 #include "un-namespace.h"
 
+struct attrs {
+       u_int32_t len;
+       attrreference_t name;
+       dev_t dev;
+       fsobj_type_t type;
+       fsobj_id_t id;
+       char buf[PATH_MAX];
+};
+
+#ifndef BUILDING_VARIANT
+__private_extern__ struct attrlist _rp_alist = {
+       ATTR_BIT_MAP_COUNT,
+       0,
+       ATTR_CMN_NAME | ATTR_CMN_DEVID | ATTR_CMN_OBJTYPE | ATTR_CMN_OBJID,
+       0,
+       0,
+       0,
+       0,
+};
+#else /* BUILDING_VARIANT */
+__private_extern__ struct attrlist _rp_alist;
+#endif /* BUILDING_VARIANT */
+
+extern char * __private_getcwd(char *, size_t, int);
+
 /*
  * char *realpath(const char *path, char resolved[PATH_MAX]);
  *
@@ -50,36 +78,89 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/realpath.c,v 1.20 2003/05/28 08:23:01 fj
  * in which case the path which caused trouble is left in (resolved).
  */
 char *
-realpath(const char *path, char resolved[PATH_MAX])
+realpath(const char *path, char inresolved[PATH_MAX])
 {
+       struct attrs attrs;
        struct stat sb;
        char *p, *q, *s;
-       size_t left_len, resolved_len;
+       size_t left_len, resolved_len, save_resolved_len;
        unsigned symlinks;
-       int serrno, slen;
+       int serrno, slen, useattrs, islink;
        char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
+       dev_t dev, lastdev;
+       struct statfs sfs;
+       static dev_t rootdev;
+       static int rootdev_inited = 0;
+       ino_t inode;
+       char *resolved;
 
+       if (path == NULL) {
+               errno = EINVAL;
+               return (NULL);
+       }
+#if __DARWIN_UNIX03
+       if (*path == 0) {
+               errno = ENOENT;
+               return (NULL);
+       }
+#endif /* __DARWIN_UNIX03 */
+       /*
+        * Extension to the standard; if inresolved == NULL, allocate memory
+        */
+       if (!inresolved) {
+           if ((resolved = malloc(PATH_MAX)) == NULL) return (NULL);
+       } else {
+           resolved = inresolved;
+       }
+       if (!rootdev_inited) {
+               rootdev_inited = 1;
+               if (stat("/", &sb) < 0) {
+error_return:
+                       if (!inresolved) {
+                               int e = errno;
+                               free(resolved);
+                               errno = e;
+                       }
+                       return (NULL);
+               }
+               rootdev = sb.st_dev;
+       }
        serrno = errno;
        symlinks = 0;
        if (path[0] == '/') {
                resolved[0] = '/';
                resolved[1] = '\0';
-               if (path[1] == '\0')
+               if (path[1] == '\0') {
                        return (resolved);
+               }
                resolved_len = 1;
                left_len = strlcpy(left, path + 1, sizeof(left));
        } else {
-               if (getcwd(resolved, PATH_MAX) == NULL) {
+#if !defined(VARIANT_DARWINEXTSN) && __DARWIN_UNIX03
+               /* 4447159: don't use GETPATH, so this will fail if */
+               /* if parent directories are not readable, as per POSIX */
+               if (__private_getcwd(resolved, PATH_MAX, 0) == NULL)
+#else /* VARIANT_DARWINEXTSN || !__DARWIN_UNIX03 */
+               if (__private_getcwd(resolved, PATH_MAX, 1) == NULL)
+#endif /* !VARIANT_DARWINEXTSN && __DARWIN_UNIX03 */
+               {
                        strlcpy(resolved, ".", PATH_MAX);
-                       return (NULL);
+                       goto error_return;
                }
                resolved_len = strlen(resolved);
                left_len = strlcpy(left, path, sizeof(left));
        }
        if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
                errno = ENAMETOOLONG;
-               return (NULL);
+               goto error_return;
        }
+       if (resolved_len > 1) {
+               if (stat(resolved, &sb) < 0) {
+                       goto error_return;
+               }
+               lastdev = sb.st_dev;
+       } else
+               lastdev = rootdev;
 
        /*
         * Iterate over path components in `left'.
@@ -93,7 +174,7 @@ realpath(const char *path, char resolved[PATH_MAX])
                s = p ? p : left + left_len;
                if (s - left >= sizeof(next_token)) {
                        errno = ENAMETOOLONG;
-                       return (NULL);
+                       goto error_return;
                }
                memcpy(next_token, left, s - left);
                next_token[s - left] = '\0';
@@ -103,7 +184,7 @@ realpath(const char *path, char resolved[PATH_MAX])
                if (resolved[resolved_len - 1] != '/') {
                        if (resolved_len + 1 >= PATH_MAX) {
                                errno = ENAMETOOLONG;
-                               return (NULL);
+                               goto error_return;
                        }
                        resolved[resolved_len++] = '/';
                        resolved[resolved_len] = '\0';
@@ -126,6 +207,13 @@ realpath(const char *path, char resolved[PATH_MAX])
                        continue;
                }
 
+               /*
+                * Save resolved_len, so that we can later null out
+                * the the appended next_token, and replace with the
+                * real name (matters on case-insensitive filesystems).
+                */
+               save_resolved_len = resolved_len;
+
                /*
                 * Append the next path component and lstat() it. If
                 * lstat() fails we still can return successfully if
@@ -134,27 +222,89 @@ realpath(const char *path, char resolved[PATH_MAX])
                resolved_len = strlcat(resolved, next_token, PATH_MAX);
                if (resolved_len >= PATH_MAX) {
                        errno = ENAMETOOLONG;
-                       return (NULL);
+                       goto error_return;
                }
-               if (lstat(resolved, &sb) != 0) {
+               if (getattrlist(resolved, &_rp_alist, &attrs, sizeof(attrs), FSOPT_NOFOLLOW) == 0) {
+                       useattrs = 1;
+                       islink = (attrs.type == VLNK);
+                       dev = attrs.dev;
+                       inode = attrs.id.fid_objno;
+               } else if (errno == ENOTSUP || errno == EINVAL) {
+                       if ((useattrs = lstat(resolved, &sb)) == 0) {
+                               islink = S_ISLNK(sb.st_mode);
+                               dev = sb.st_dev;
+                               inode = sb.st_ino;
+                       }
+               } else
+                       useattrs = -1;
+               if (useattrs < 0) {
+#if !__DARWIN_UNIX03
                        if (errno == ENOENT && p == NULL) {
                                errno = serrno;
                                return (resolved);
                        }
-                       return (NULL);
+#endif /* !__DARWIN_UNIX03 */
+                       goto error_return;
                }
-               if (S_ISLNK(sb.st_mode)) {
+               if (dev != lastdev) {
+                       /*
+                        * We have crossed a mountpoint.  For volumes like UDF
+                        * the getattrlist name may not match the actual
+                        * mountpoint, so we just copy the mountpoint directly.
+                        * (3703138).  However, the mountpoint may not be
+                        * accessible, as when chroot-ed, so check first.
+                        * There may be a file on the chroot-ed volume with
+                        * the same name as the mountpoint, so compare device
+                        * and inode numbers.
+                        */
+                       lastdev = dev;
+                       if (statfs(resolved, &sfs) == 0 && lstat(sfs.f_mntonname, &sb) == 0 && dev == sb.st_dev && inode == sb.st_ino) {
+                               /*
+                                * However, it's possible that the mountpoint
+                                * path matches, even though it isn't the real
+                                * path in the chroot-ed environment, so check
+                                * that each component of the mountpoint
+                                * is a directory (and not a symlink)
+                                */
+                               char temp[sizeof(sfs.f_mntonname)];
+                               char *cp;
+                               int ok = 1;
+
+                               strcpy(temp, sfs.f_mntonname);
+                               for(;;) {
+                                       if ((cp = strrchr(temp, '/')) == NULL) {
+                                               ok = 0;
+                                               break;
+                                       }
+                                       if (cp <= temp)
+                                               break;
+                                       *cp = 0;
+                                       if (lstat(temp, &sb) < 0 || (sb.st_mode & S_IFMT) != S_IFDIR) {
+                                               ok = 0;
+                                               break;
+                                       }
+                               }
+                               if (ok) {
+                                       resolved_len = strlcpy(resolved, sfs.f_mntonname, PATH_MAX);
+                                       continue;
+                               }
+                       }
+                       /* if we fail, use the other methods. */
+               }
+               if (islink) {
                        if (symlinks++ > MAXSYMLINKS) {
                                errno = ELOOP;
-                               return (NULL);
+                               goto error_return;
                        }
                        slen = readlink(resolved, symlink, sizeof(symlink) - 1);
-                       if (slen < 0)
-                               return (NULL);
+                       if (slen < 0) {
+                               goto error_return;
+                       }
                        symlink[slen] = '\0';
                        if (symlink[0] == '/') {
                                resolved[1] = 0;
                                resolved_len = 1;
+                               lastdev = rootdev;
                        } else if (resolved_len > 1) {
                                /* Strip the last path component. */
                                resolved[resolved_len - 1] = '\0';
@@ -172,7 +322,7 @@ realpath(const char *path, char resolved[PATH_MAX])
                                if (symlink[slen - 1] != '/') {
                                        if (slen + 1 >= sizeof(symlink)) {
                                                errno = ENAMETOOLONG;
-                                               return (NULL);
+                                               goto error_return;
                                        }
                                        symlink[slen] = '/';
                                        symlink[slen + 1] = 0;
@@ -180,11 +330,34 @@ realpath(const char *path, char resolved[PATH_MAX])
                                left_len = strlcat(symlink, left, sizeof(left));
                                if (left_len >= sizeof(left)) {
                                        errno = ENAMETOOLONG;
-                                       return (NULL);
+                                       goto error_return;
                                }
                        }
                        left_len = strlcpy(left, symlink, sizeof(left));
+               } else if (useattrs) {
+                       /*
+                        * attrs already has the real name.
+                        */
+
+                       resolved[save_resolved_len] = '\0';
+                       resolved_len = strlcat(resolved, (const char *)&attrs.name + attrs.name.attr_dataoffset, PATH_MAX);
+                       if (resolved_len >= PATH_MAX) {
+                               errno = ENAMETOOLONG;
+                               goto error_return;
+                       }
                }
+               /*
+                * For the case of useattrs == 0, we could scan the directory
+                * and try to match the inode.  There are many problems with
+                * this: (1) the directory may not be readable, (2) for multiple
+                * hard links, we would find the first, but not necessarily
+                * the one specified in the path, (3) we can't try to do
+                * a case-insensitive search to match the right one in (2),
+                * because the underlying filesystem may do things like
+                * decompose composed characters.  For most cases, doing
+                * nothing is the right thing when useattrs == 0, so we punt
+                * for now.
+                */
        }
 
        /*
diff --git a/stdlib/FreeBSD/realpath.c.patch b/stdlib/FreeBSD/realpath.c.patch
deleted file mode 100644 (file)
index 604474d..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
---- realpath.c.orig    2010-06-24 17:32:55.000000000 -0700
-+++ realpath.c 2010-06-25 13:46:50.000000000 -0700
-@@ -35,13 +35,41 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include "namespace.h"
- #include <sys/param.h>
- #include <sys/stat.h>
-+#include <sys/mount.h>
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
-+#include <sys/attr.h>
-+#include <sys/vnode.h>
- #include "un-namespace.h"
-+struct attrs {
-+      u_int32_t len;
-+      attrreference_t name;
-+      dev_t dev;
-+      fsobj_type_t type;
-+      fsobj_id_t id;
-+      char buf[PATH_MAX];
-+};
-+
-+#ifndef BUILDING_VARIANT
-+__private_extern__ struct attrlist _rp_alist = {
-+      ATTR_BIT_MAP_COUNT,
-+      0,
-+      ATTR_CMN_NAME | ATTR_CMN_DEVID | ATTR_CMN_OBJTYPE | ATTR_CMN_OBJID,
-+      0,
-+      0,
-+      0,
-+      0,
-+};
-+#else /* BUILDING_VARIANT */
-+__private_extern__ struct attrlist _rp_alist;
-+#endif /* BUILDING_VARIANT */
-+
-+extern char * __private_getcwd(char *, size_t, int);
-+
- /*
-  * char *realpath(const char *path, char resolved[PATH_MAX]);
-  *
-@@ -50,36 +78,89 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * in which case the path which caused trouble is left in (resolved).
-  */
- char *
--realpath(const char *path, char resolved[PATH_MAX])
-+realpath(const char *path, char inresolved[PATH_MAX])
- {
-+      struct attrs attrs;
-       struct stat sb;
-       char *p, *q, *s;
--      size_t left_len, resolved_len;
-+      size_t left_len, resolved_len, save_resolved_len;
-       unsigned symlinks;
--      int serrno, slen;
-+      int serrno, slen, useattrs, islink;
-       char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
-+      dev_t dev, lastdev;
-+      struct statfs sfs;
-+      static dev_t rootdev;
-+      static int rootdev_inited = 0;
-+      ino_t inode;
-+      char *resolved;
-+      if (path == NULL) {
-+              errno = EINVAL;
-+              return (NULL);
-+      }
-+#if __DARWIN_UNIX03
-+      if (*path == 0) {
-+              errno = ENOENT;
-+              return (NULL);
-+      }
-+#endif /* __DARWIN_UNIX03 */
-+      /*
-+       * Extension to the standard; if inresolved == NULL, allocate memory
-+       */
-+      if (!inresolved) {
-+          if ((resolved = malloc(PATH_MAX)) == NULL) return (NULL);
-+      } else {
-+          resolved = inresolved;
-+      }
-+      if (!rootdev_inited) {
-+              rootdev_inited = 1;
-+              if (stat("/", &sb) < 0) {
-+error_return:
-+                      if (!inresolved) {
-+                              int e = errno;
-+                              free(resolved);
-+                              errno = e;
-+                      }
-+                      return (NULL);
-+              }
-+              rootdev = sb.st_dev;
-+      }
-       serrno = errno;
-       symlinks = 0;
-       if (path[0] == '/') {
-               resolved[0] = '/';
-               resolved[1] = '\0';
--              if (path[1] == '\0')
-+              if (path[1] == '\0') {
-                       return (resolved);
-+              }
-               resolved_len = 1;
-               left_len = strlcpy(left, path + 1, sizeof(left));
-       } else {
--              if (getcwd(resolved, PATH_MAX) == NULL) {
-+#if !defined(VARIANT_DARWINEXTSN) && __DARWIN_UNIX03
-+              /* 4447159: don't use GETPATH, so this will fail if */
-+              /* if parent directories are not readable, as per POSIX */
-+              if (__private_getcwd(resolved, PATH_MAX, 0) == NULL)
-+#else /* VARIANT_DARWINEXTSN || !__DARWIN_UNIX03 */
-+              if (__private_getcwd(resolved, PATH_MAX, 1) == NULL)
-+#endif /* !VARIANT_DARWINEXTSN && __DARWIN_UNIX03 */
-+              {
-                       strlcpy(resolved, ".", PATH_MAX);
--                      return (NULL);
-+                      goto error_return;
-               }
-               resolved_len = strlen(resolved);
-               left_len = strlcpy(left, path, sizeof(left));
-       }
-       if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
-               errno = ENAMETOOLONG;
--              return (NULL);
-+              goto error_return;
-       }
-+      if (resolved_len > 1) {
-+              if (stat(resolved, &sb) < 0) {
-+                      goto error_return;
-+              }
-+              lastdev = sb.st_dev;
-+      } else
-+              lastdev = rootdev;
-       /*
-        * Iterate over path components in `left'.
-@@ -93,7 +174,7 @@ realpath(const char *path, char resolved
-               s = p ? p : left + left_len;
-               if (s - left >= sizeof(next_token)) {
-                       errno = ENAMETOOLONG;
--                      return (NULL);
-+                      goto error_return;
-               }
-               memcpy(next_token, left, s - left);
-               next_token[s - left] = '\0';
-@@ -103,7 +184,7 @@ realpath(const char *path, char resolved
-               if (resolved[resolved_len - 1] != '/') {
-                       if (resolved_len + 1 >= PATH_MAX) {
-                               errno = ENAMETOOLONG;
--                              return (NULL);
-+                              goto error_return;
-                       }
-                       resolved[resolved_len++] = '/';
-                       resolved[resolved_len] = '\0';
-@@ -127,6 +208,13 @@ realpath(const char *path, char resolved
-               }
-               /*
-+               * Save resolved_len, so that we can later null out
-+               * the the appended next_token, and replace with the
-+               * real name (matters on case-insensitive filesystems).
-+               */
-+              save_resolved_len = resolved_len;
-+
-+              /*
-                * Append the next path component and lstat() it. If
-                * lstat() fails we still can return successfully if
-                * there are no more path components left.
-@@ -134,27 +222,89 @@ realpath(const char *path, char resolved
-               resolved_len = strlcat(resolved, next_token, PATH_MAX);
-               if (resolved_len >= PATH_MAX) {
-                       errno = ENAMETOOLONG;
--                      return (NULL);
-+                      goto error_return;
-               }
--              if (lstat(resolved, &sb) != 0) {
-+              if (getattrlist(resolved, &_rp_alist, &attrs, sizeof(attrs), FSOPT_NOFOLLOW) == 0) {
-+                      useattrs = 1;
-+                      islink = (attrs.type == VLNK);
-+                      dev = attrs.dev;
-+                      inode = attrs.id.fid_objno;
-+              } else if (errno == ENOTSUP || errno == EINVAL) {
-+                      if ((useattrs = lstat(resolved, &sb)) == 0) {
-+                              islink = S_ISLNK(sb.st_mode);
-+                              dev = sb.st_dev;
-+                              inode = sb.st_ino;
-+                      }
-+              } else
-+                      useattrs = -1;
-+              if (useattrs < 0) {
-+#if !__DARWIN_UNIX03
-                       if (errno == ENOENT && p == NULL) {
-                               errno = serrno;
-                               return (resolved);
-                       }
--                      return (NULL);
-+#endif /* !__DARWIN_UNIX03 */
-+                      goto error_return;
-               }
--              if (S_ISLNK(sb.st_mode)) {
-+              if (dev != lastdev) {
-+                      /*
-+                       * We have crossed a mountpoint.  For volumes like UDF
-+                       * the getattrlist name may not match the actual
-+                       * mountpoint, so we just copy the mountpoint directly.
-+                       * (3703138).  However, the mountpoint may not be
-+                       * accessible, as when chroot-ed, so check first.
-+                       * There may be a file on the chroot-ed volume with
-+                       * the same name as the mountpoint, so compare device
-+                       * and inode numbers.
-+                       */
-+                      lastdev = dev;
-+                      if (statfs(resolved, &sfs) == 0 && lstat(sfs.f_mntonname, &sb) == 0 && dev == sb.st_dev && inode == sb.st_ino) {
-+                              /*
-+                               * However, it's possible that the mountpoint
-+                               * path matches, even though it isn't the real
-+                               * path in the chroot-ed environment, so check
-+                               * that each component of the mountpoint
-+                               * is a directory (and not a symlink)
-+                               */
-+                              char temp[sizeof(sfs.f_mntonname)];
-+                              char *cp;
-+                              int ok = 1;
-+
-+                              strcpy(temp, sfs.f_mntonname);
-+                              for(;;) {
-+                                      if ((cp = strrchr(temp, '/')) == NULL) {
-+                                              ok = 0;
-+                                              break;
-+                                      }
-+                                      if (cp <= temp)
-+                                              break;
-+                                      *cp = 0;
-+                                      if (lstat(temp, &sb) < 0 || (sb.st_mode & S_IFMT) != S_IFDIR) {
-+                                              ok = 0;
-+                                              break;
-+                                      }
-+                              }
-+                              if (ok) {
-+                                      resolved_len = strlcpy(resolved, sfs.f_mntonname, PATH_MAX);
-+                                      continue;
-+                              }
-+                      }
-+                      /* if we fail, use the other methods. */
-+              }
-+              if (islink) {
-                       if (symlinks++ > MAXSYMLINKS) {
-                               errno = ELOOP;
--                              return (NULL);
-+                              goto error_return;
-                       }
-                       slen = readlink(resolved, symlink, sizeof(symlink) - 1);
--                      if (slen < 0)
--                              return (NULL);
-+                      if (slen < 0) {
-+                              goto error_return;
-+                      }
-                       symlink[slen] = '\0';
-                       if (symlink[0] == '/') {
-                               resolved[1] = 0;
-                               resolved_len = 1;
-+                              lastdev = rootdev;
-                       } else if (resolved_len > 1) {
-                               /* Strip the last path component. */
-                               resolved[resolved_len - 1] = '\0';
-@@ -172,7 +322,7 @@ realpath(const char *path, char resolved
-                               if (symlink[slen - 1] != '/') {
-                                       if (slen + 1 >= sizeof(symlink)) {
-                                               errno = ENAMETOOLONG;
--                                              return (NULL);
-+                                              goto error_return;
-                                       }
-                                       symlink[slen] = '/';
-                                       symlink[slen + 1] = 0;
-@@ -180,11 +330,34 @@ realpath(const char *path, char resolved
-                               left_len = strlcat(symlink, left, sizeof(left));
-                               if (left_len >= sizeof(left)) {
-                                       errno = ENAMETOOLONG;
--                                      return (NULL);
-+                                      goto error_return;
-                               }
-                       }
-                       left_len = strlcpy(left, symlink, sizeof(left));
-+              } else if (useattrs) {
-+                      /*
-+                       * attrs already has the real name.
-+                       */
-+
-+                      resolved[save_resolved_len] = '\0';
-+                      resolved_len = strlcat(resolved, (const char *)&attrs.name + attrs.name.attr_dataoffset, PATH_MAX);
-+                      if (resolved_len >= PATH_MAX) {
-+                              errno = ENAMETOOLONG;
-+                              goto error_return;
-+                      }
-               }
-+              /*
-+               * For the case of useattrs == 0, we could scan the directory
-+               * and try to match the inode.  There are many problems with
-+               * this: (1) the directory may not be readable, (2) for multiple
-+               * hard links, we would find the first, but not necessarily
-+               * the one specified in the path, (3) we can't try to do
-+               * a case-insensitive search to match the right one in (2),
-+               * because the underlying filesystem may do things like
-+               * decompose composed characters.  For most cases, doing
-+               * nothing is the right thing when useattrs == 0, so we punt
-+               * for now.
-+               */
-       }
-       /*
index 6e0596e7787d4d004c42ea9b5c2bef287ceeda4f..7a12cea3e41e3d7241eea07d22c856d8ab5b469d 100644 (file)
@@ -36,81 +36,471 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/setenv.c,v 1.14 2007/05/01 16:02:41 ache
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
+#include <crt_externs.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
 
-char *__findenv(const char *, int *);
+struct owned_ptr;
+__private_extern__ char *__findenv(const char *, int *, char **);
+__private_extern__ int __setenv(const char *, const char *, int, int, char ***, struct owned_ptr *);
+__private_extern__ void __unsetenv(const char *, char **, struct owned_ptr *);
+
+__private_extern__ struct owned_ptr *__env_owned;
+__private_extern__ int __init__env_owned(int);
 
 /*
- * setenv --
- *     Set the value of the environmental variable "name" to be
- *     "value".  If rewrite is set, replace any current value.
+ * _cthread_init_routine used to be called from crt1.o to initialize threads.
+ * This is no longer needed, as initialization happens in dylib initializers,
+ * but is provided to maintain backwards compatibility.  Normally, for 10.5
+ * or greater, _cthread_init_routine does nothing.
+ *
+ * Before 10.5, the _start routine in crt1.o clobbers environ with the original
+ * stack value, which effectively undoes any environment changes made in
+ * initializers.  When LEGACY_CRT1_ENVIRON is defined, we replace the
+ * do-nothing routine with one that attempts to restore the environ value.
+ * But this only works if the setenv (and family) routines were used
+ * exclusively, (no direct manipulation of environ).  Note that according to
+ * SUSv3, direct manipulation of environ may result in undefined behavior in
+ * setenv and family, so we don't support that (on less than 10.5).
  */
-int
-setenv(name, value, rewrite)
+#ifdef BUILDING_VARIANT
+#  ifdef LEGACY_CRT1_ENVIRON
+extern char **_saved_environ;
+#  endif /* LEGACY_CRT1_ENVIRON */
+#else /* !BUILDING_VARIANT */
+#  ifdef LEGACY_CRT1_ENVIRON
+__private_extern__ char **_saved_environ = NULL;
+
+static int
+_legacy_crt1_environ(void)
+{
+       if (_saved_environ) *_NSGetEnviron() = _saved_environ;
+       return 0;
+}
+int (*_cthread_init_routine)(void) = _legacy_crt1_environ;
+
+#  else /* !LEGACY_CRT1_ENVIRON */
+static int _do_nothing(void) { return 0; }
+int (*_cthread_init_routine)(void) = _do_nothing;
+#  endif /* !LEGACY_CRT1_ENVIRON */
+
+__private_extern__ struct owned_ptr *__env_owned = NULL;
+
+/*
+ * The owned_ptr structure is a table of pointers that we own, and can
+ * realloc/free as we choose.  table[0] is always NULL, so it is always
+ * less that any real pointer.  "used" is the number of table entries in use
+ * (including the initial NULL), while "size" is the allocated size of the
+ * table (used to enlarge the size of the table when needed).
+ */
+struct owned_ptr {
+    const void **table;
+    int used;
+    int size;
+};
+
+#define OWNED_PTR_INITIAL_SIZE 8
+
+__private_extern__ int _owned_ptr_search(struct owned_ptr * __restrict, const void * __restrict, int * __restrict);
+
+__private_extern__ void
+_owned_ptr_add(struct owned_ptr * __restrict owned, const void * __restrict ptr)
+{
+       int index;
+
+       if (_owned_ptr_search(owned, ptr, &index) == 0) return; /* already there */
+       if (owned->used >= owned->size) {
+               int new_size = 2 * owned->size;
+               const void **new_table = (const void **)realloc(owned->table,
+                                        new_size * sizeof(const void *));
+               if (!new_table) {
+                       /* no memory to enlarge the table, so just drop */
+                       return;
+               }
+               owned->table = new_table;
+               owned->size = new_size;
+       }
+       memmove(owned->table + index + 2, owned->table + index + 1,
+               sizeof(void *) * (owned->used - index - 1));
+       owned->table[index + 1] = ptr;
+       owned->used++;
+}
+
+__private_extern__ struct owned_ptr *
+_owned_ptr_alloc(void)
+{
+       struct owned_ptr *owned;
+
+       owned = (struct owned_ptr *)malloc(sizeof(struct owned_ptr));
+       if (!owned) return NULL;
+       owned->table = (const void **)malloc(OWNED_PTR_INITIAL_SIZE *
+                                            sizeof(const void *));
+       if (!owned->table) {
+               int save = errno;
+               free(owned);
+               errno = save;
+               return NULL;
+       }
+       owned->table[0] = NULL;
+       owned->used = 1;
+       owned->size = OWNED_PTR_INITIAL_SIZE;
+       return owned;
+}
+
+__private_extern__ void
+_owned_ptr_delete(struct owned_ptr *owned, int index)
+{
+       if (!index || index >= owned->used) return;
+       memmove(owned->table + index, owned->table + index + 1,
+               sizeof(void *) * (owned->used - index - 1));
+       owned->used--;
+}
+
+__private_extern__ void
+_owned_ptr_free(struct owned_ptr *owned)
+{
+       free(owned->table);
+       free(owned);
+}
+
+/*
+ * Search owned->table for "ptr".  Zero is returned if found, non-zero means
+ * not found.  If "result" is non-NULL, the found index is returned in it, or
+ * if not found, the index of the immediate lower value (ptr can be inserted
+ * after this index).
+ */
+__private_extern__ int
+_owned_ptr_search(struct owned_ptr * __restrict owned, const void * __restrict ptr, int * __restrict result)
+{
+       int low = 0;
+       int high = owned->used - 1;
+       int cur;
+
+       if (owned->table[high] < ptr) {
+               if (result) *result = high;
+               return -1;
+       } else if (owned->table[high] == ptr) {
+               if (result) *result = high;
+               return 0;
+       }
+       while (high - low > 1) {
+               cur = (low + high) / 2;
+               if (ptr > owned->table[cur]) {
+                       low = cur;
+               } else if (ptr < owned->table[cur]) {
+                       high = cur;
+               } else {
+                       /* match found */
+                       if (result) *result = cur;
+                       return 0;
+               }
+       }
+       /* no match found; *result will be the insert-after position */
+       if (result) *result = low;
+       return -1;
+}
+
+/*
+ * Initialize the process's __env_owned structure
+ */
+__private_extern__ int
+__init__env_owned(int should_set_errno)
+{
+       int save;
+
+       if (__env_owned) return 0;
+
+       if (!should_set_errno)
+               save = errno;
+       __env_owned = _owned_ptr_alloc();
+       if (!__env_owned) {
+               if (!should_set_errno)
+                       errno = save;
+               return -1;
+       }
+       return 0;
+}
+
+/*
+ * The copy flag may have 3 values:
+ *  1 - make a copy of the name/value pair
+ *  0 - take the name as a user-supplied name=value string
+ * -1 - like 0, except we copy of the name=value string in name
+ */
+__private_extern__ int
+__setenv(name, value, rewrite, copy, environp, owned)
        const char *name;
        const char *value;
-       int rewrite;
+       int rewrite, copy;
+       char ***environp;
+       struct owned_ptr *owned;
 {
-       extern char **environ;
-       static char **alloced;                  /* if allocated space before */
        char *c;
-       int l_value, offset;
+       int offset;
+       int oindex;
 
-       if (*value == '=')                      /* no `=' in value */
-               ++value;
-       l_value = strlen(value);
-       if ((c = __findenv(name, &offset))) {   /* find if already exists */
+       if ((c = __findenv(name, &offset, *environp))) { /* find if already exists */
+               char *e;
                if (!rewrite)
                        return (0);
-               if (strlen(c) >= l_value) {     /* old larger; copy over */
-                       while ( (*c++ = *value++) );
-                       return (0);
+               /*
+                * In UNIX03, we can overwrite only if we allocated the
+                * string.  Then we can realloc it if it is too small.
+                */
+               e = (*environp)[offset];
+               if (_owned_ptr_search(owned, e, &oindex) == 0) {
+                       if (copy > 0) {
+                               size_t l_value = strlen(value);
+                               if (strlen(c) < l_value) {      /* old smaller; resize*/
+                                       char *r;
+                                       size_t len = c - e;
+                                       if ((r = realloc(e, l_value + len + 1)) == NULL)
+                                               return (-1);
+                                       if (r != e) {
+                                               (*environp)[offset] = r;
+                                               c = r + len;
+                                               _owned_ptr_delete(owned, oindex);
+                                               _owned_ptr_add(owned, r);
+                                       }
+                               }
+                               while ( (*c++ = *value++) );
+                               return (0);
+                       }
+                       /* Free up the slot for later use (putenv) */
+                       _owned_ptr_delete(owned, oindex);
+                       free(e);
                }
        } else {                                        /* create new slot */
                int cnt;
                char **p;
 
-               for (p = environ, cnt = 0; *p; ++p, ++cnt);
-               if (alloced == environ) {                       /* just increase size */
-                       p = (char **)realloc((char *)environ,
+               for (p = *environp, cnt = 0; *p; ++p, ++cnt);
+               if (_owned_ptr_search(owned, *environp, &oindex) == 0) {        /* just increase size */
+                       p = (char **)realloc((char *)*environp,
                            (size_t)(sizeof(char *) * (cnt + 2)));
                        if (!p)
                                return (-1);
-                       alloced = environ = p;
+                       if (*environp != p) {
+                               _owned_ptr_delete(owned, oindex);
+                               _owned_ptr_add(owned, p);
+                               *environp = p;
+                       }
                }
                else {                          /* get new space */
                                                /* copy old entries into it */
                        p = malloc((size_t)(sizeof(char *) * (cnt + 2)));
                        if (!p)
                                return (-1);
-                       bcopy(environ, p, cnt * sizeof(char *));
-                       alloced = environ = p;
+                       _owned_ptr_add(owned, p);
+                       bcopy(*environp, p, cnt * sizeof(char *));
+                       *environp = p;
                }
-               environ[cnt + 1] = NULL;
+               (*environp)[cnt + 1] = NULL;
                offset = cnt;
        }
-       for (c = (char *)name; *c && *c != '='; ++c);   /* no `=' in name */
-       if (!(environ[offset] =                 /* name + `=' + value */
-           malloc((size_t)((int)(c - name) + l_value + 2))))
-               return (-1);
-       for (c = environ[offset]; (*c = *name++) && *c != '='; ++c);
-       for (*c++ = '='; (*c++ = *value++); );
+       /* For non Unix03, or UnixO3 setenv(), we make a copy of the user's
+        * strings.  For Unix03 putenv(), we put the string directly in
+        * the environment. */
+       if (copy > 0) {
+               for (c = (char *)name; *c && *c != '='; ++c);   /* no `=' in name */
+               if (!((*environp)[offset] =                     /* name + `=' + value */
+                   malloc((size_t)((int)(c - name) + strlen(value) + 2))))
+                       return (-1);
+               _owned_ptr_add(owned, (*environp)[offset]);
+               for (c = (*environp)[offset]; (*c = *name++) && *c != '='; ++c);
+               for (*c++ = '='; (*c++ = *value++); );
+       } else {
+               /* the legacy behavior copies the string */
+               if (copy < 0) {
+                       size_t len = strlen(name);
+                       if((c = malloc(len + 1)) == NULL)
+                               return (-1);
+                       _owned_ptr_add(owned, c);
+                       memcpy(c, name, len + 1);
+                       name = c;
+               }
+               (*environp)[offset] = (char *)name;
+       }
        return (0);
 }
 
+__private_extern__ void
+__unsetenv(const char *name, char **environ, struct owned_ptr *owned)
+{
+       char **p;
+       int offset;
+       int oindex;
+
+       while (__findenv(name, &offset, environ)) { /* if set multiple times */
+               /* if we malloc-ed it, free it first */
+               if (_owned_ptr_search(owned, environ[offset], &oindex) == 0) {
+                       _owned_ptr_delete(owned, oindex);
+                       free(environ[offset]);
+               }
+               for (p = &environ[offset];; ++p)
+                       if (!(*p = *(p + 1)))
+                               break;
+       }
+}
+
+/****************************************************************************/
+/*
+ * _allocenvstate -- SPI that creates a new state (opaque)
+ */
+void *
+_allocenvstate(void)
+{
+       return _owned_ptr_alloc();
+}
+
+/*
+ * _copyenv -- SPI that copies a NULL-tereminated char * array in a newly
+ * allocated buffer, compatible with the other SPI env routines.  If env
+ * is NULL, a char * array composed of a single NULL is returned.  NULL
+ * is returned on error.  (This isn't needed anymore, as __setenv will
+ * automatically make a copy.)
+ */
+char **
+_copyenv(char **env)
+{
+       char **p;
+       int cnt = 1;
+
+       if (env)
+               for (p = env; *p; ++p, ++cnt);
+       p = (char **)malloc((size_t)(sizeof(char *) * cnt));
+       if (!p)
+               return (NULL);
+       if (env)
+               bcopy(env, p, cnt * sizeof(char *));
+       else
+               *p = NULL;
+       return p;
+}
+
+/*
+ * _deallocenvstate -- SPI that frees all the memory associated with the state
+ * and all allocated strings, including the environment array itself if it
+ * was copied.
+ */
+int
+_deallocenvstate(void *state)
+{
+       struct owned_ptr *owned;
+
+       if (!(owned = (struct owned_ptr *)state) || owned == __env_owned) {
+               errno = EINVAL;
+               return -1;
+       }
+       _owned_ptr_free(owned);
+       return 0;
+}
+
+/*
+ * setenvp -- SPI using an arbitrary pointer to string array and an env state,
+ * created by _allocenvstate().  Initial checking is not done.
+ *
+ *     Set the value of the environmental variable "name" to be
+ *     "value".  If rewrite is set, replace any current value.
+ */
+int
+_setenvp(const char *name, const char *value, int rewrite, char ***envp, void *state)
+{
+       if (__init__env_owned(1)) return (-1);
+       return (__setenv(name, value, rewrite, 1, envp, (state ? (struct owned_ptr *)state : __env_owned)));
+}
+
+/*
+ * unsetenv(name) -- SPI using an arbitrary pointer to string array and an env
+ * state, created by _allocenvstate().  Initial checking is not done.
+ *
+ *     Delete environmental variable "name".
+ */
+int
+_unsetenvp(const char *name, char ***envp, void *state)
+{
+       if (__init__env_owned(1)) return (-1);
+       __unsetenv(name, *envp, (state ? (struct owned_ptr *)state : __env_owned));
+       return 0;
+}
+
+#endif /* !BUILD_VARIANT */
+
+/*
+ * setenv --
+ *     Set the value of the environmental variable "name" to be
+ *     "value".  If rewrite is set, replace any current value.
+ */
+int
+setenv(name, value, rewrite)
+       const char *name;
+       const char *value;
+       int rewrite;
+{
+#ifdef LEGACY_CRT1_ENVIRON
+       int ret;
+#endif /* LEGACY_CRT1_ENVIRON */
+
+       /* no null ptr or empty str */
+       if(name == NULL || *name == 0) {
+               errno = EINVAL;
+               return (-1);
+       }
+
+#if __DARWIN_UNIX03
+       /* no '=' in name */
+       if (strchr(name, '=')) {
+               errno = EINVAL;
+               return (-1);
+       }
+#endif /* __DARWIN_UNIX03 */
+
+       if (*value == '=')                      /* no `=' in value */
+               ++value;
+       if (__init__env_owned(1)) return (-1);
+#ifdef LEGACY_CRT1_ENVIRON
+       ret = __setenv(name, value, rewrite, 1, _NSGetEnviron(), __env_owned);
+       _saved_environ = *_NSGetEnviron();
+       return ret;
+#else /* !LEGACY_CRT1_ENVIRON */
+       return (__setenv(name, value, rewrite, 1, _NSGetEnviron(), __env_owned));
+#endif /* !LEGACY_CRT1_ENVIRON */
+}
+
 /*
  * unsetenv(name) --
  *     Delete environmental variable "name".
  */
+#if __DARWIN_UNIX03
+int
+#else /* !__DARWIN_UNIX03 */
 void
+#endif /* __DARWIN_UNIX03 */
 unsetenv(name)
        const char *name;
 {
-       extern char **environ;
-       char **p;
-       int offset;
+#if __DARWIN_UNIX03
+       /* no null ptr or empty str */
+       if(name == NULL || *name == 0) {
+               errno = EINVAL;
+               return (-1);
+       }
 
-       while (__findenv(name, &offset))        /* if set multiple times */
-               for (p = &environ[offset];; ++p)
-                       if (!(*p = *(p + 1)))
-                               break;
+       /* no '=' in name */
+       if (strchr(name, '=')) {
+               errno = EINVAL;
+               return (-1);
+       }
+       if (__init__env_owned(1)) return (-1);
+#else /* !__DARWIN_UNIX03 */
+       /* no null ptr or empty str */
+       if(name == NULL || *name == 0)
+               return;
+       if (__init__env_owned(0)) return;
+#endif /* __DARWIN_UNIX03 */
+       __unsetenv(name, *_NSGetEnviron(), __env_owned);
+#if __DARWIN_UNIX03
+       return 0;
+#endif /* __DARWIN_UNIX03 */
 }
diff --git a/stdlib/FreeBSD/setenv.c.patch b/stdlib/FreeBSD/setenv.c.patch
deleted file mode 100644 (file)
index 4d46b4f..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
---- setenv.c.orig      2011-04-13 01:21:14.000000000 -0700
-+++ setenv.c   2011-04-13 14:44:04.000000000 -0700
-@@ -36,32 +36,115 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <stddef.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <crt_externs.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <fcntl.h>
-+#include <malloc/malloc.h>
--char *__findenv(const char *, int *);
-+#define       ZONE_OWNS_PTR(zone, ptr)        (malloc_zone_from_ptr((ptr)) == zone)
-+
-+extern malloc_zone_t *__zone0;
-+extern void __malloc_check_env_name(const char *);
-+
-+__private_extern__ char *__findenv(const char *, int *, char **);
-+__private_extern__ int __setenv(const char *, const char *, int, int, char ***, malloc_zone_t *);
-+__private_extern__ void __unsetenv(const char *, char **, malloc_zone_t *);
-+__private_extern__ int init__zone0(int);
- /*
-- * setenv --
-- *    Set the value of the environmental variable "name" to be
-- *    "value".  If rewrite is set, replace any current value.
-+ * _cthread_init_routine used to be called from crt1.o to initialize threads.
-+ * This is no longer needed, as initialization happens in dylib initializers,
-+ * but is provided to maintain backwards compatibility.  Normally, for 10.5
-+ * or greater, _cthread_init_routine does nothing.
-+ *
-+ * Before 10.5, the _start routine in crt1.o clobbers environ with the original
-+ * stack value, which effectively undoes any environment changes made in
-+ * initializers.  When LEGACY_CRT1_ENVIRON is defined, we replace the
-+ * do-nothing routine with one that attempts to restore the environ value.
-+ * But this only works if the setenv (and family) routines were used
-+ * exclusively, (no direct manipulation of environ).  Note that according to
-+ * SUSv3, direct manipulation of environ may result in undefined behavior in
-+ * setenv and family, so we don't support that (on less than 10.5).
-  */
--int
--setenv(name, value, rewrite)
-+#ifdef BUILDING_VARIANT
-+#  ifdef LEGACY_CRT1_ENVIRON
-+extern char **_saved_environ;
-+#  endif /* LEGACY_CRT1_ENVIRON */
-+#else /* !BUILDING_VARIANT */
-+#  ifdef LEGACY_CRT1_ENVIRON
-+__private_extern__ char **_saved_environ = NULL;
-+
-+static int
-+_legacy_crt1_environ(void)
-+{
-+      if (_saved_environ) *_NSGetEnviron() = _saved_environ;
-+      return 0;
-+}
-+int (*_cthread_init_routine)(void) = _legacy_crt1_environ;
-+
-+#  else /* !LEGACY_CRT1_ENVIRON */
-+static int _do_nothing(void) { return 0; }
-+int (*_cthread_init_routine)(void) = _do_nothing;
-+#  endif /* !LEGACY_CRT1_ENVIRON */
-+
-+/*
-+ * Create the environment malloc zone and give it a recognizable name.
-+ */
-+__private_extern__ int
-+init__zone0(int should_set_errno)
-+{
-+      if (__zone0) return (0);
-+
-+      __zone0 = malloc_create_zone(0, 0);
-+      if (!__zone0) {
-+              if (should_set_errno) {
-+                      errno = ENOMEM;
-+              }
-+              return (-1);
-+      }
-+      malloc_set_zone_name(__zone0, "environ");
-+      return (0);
-+}
-+
-+/*
-+ * The copy flag may have 3 values:
-+ *  1 - make a copy of the name/value pair
-+ *  0 - take the name as a user-supplied name=value string
-+ * -1 - like 0, except we copy of the name=value string in name
-+ */
-+__private_extern__ int
-+__setenv(name, value, rewrite, copy, environp, envz)
-       const char *name;
-       const char *value;
--      int rewrite;
-+      int rewrite, copy;
-+      char ***environp;
-+      malloc_zone_t *envz;
- {
--      extern char **environ;
--      static char **alloced;                  /* if allocated space before */
-       char *c;
--      int l_value, offset;
-+      int offset;
--      if (*value == '=')                      /* no `=' in value */
--              ++value;
--      l_value = strlen(value);
--      if ((c = __findenv(name, &offset))) {   /* find if already exists */
-+      if ((c = __findenv(name, &offset, *environp))) { /* find if already exists */
-+              char *e;
-               if (!rewrite)
-                       return (0);
--              if (strlen(c) >= l_value) {     /* old larger; copy over */
-+              /*
-+               * In UNIX03, we can overwrite only if we allocated the
-+               * string.  Then we can realloc it if it is too small.
-+               */
-+              e = (*environp)[offset];
-+              if (copy > 0 && ZONE_OWNS_PTR(envz, e)) {
-+                      size_t l_value = strlen(value);
-+                      if (strlen(c) < l_value) {      /* old smaller; resize*/
-+                              char *r;
-+                              size_t len = c - e;
-+                              if ((r = realloc(e, l_value + len + 1)) == NULL)
-+                                      return (-1);
-+                              if (r != e) {
-+                                      (*environp)[offset] = r;
-+                                      c = r + len;
-+                              }
-+                      }
-                       while ( (*c++ = *value++) );
-                       return (0);
-               }
-@@ -69,48 +152,235 @@ setenv(name, value, rewrite)
-               int cnt;
-               char **p;
--              for (p = environ, cnt = 0; *p; ++p, ++cnt);
--              if (alloced == environ) {                       /* just increase size */
--                      p = (char **)realloc((char *)environ,
-+              for (p = *environp, cnt = 0; *p; ++p, ++cnt);
-+              if (ZONE_OWNS_PTR(envz, *environp)) {   /* just increase size */
-+                      p = (char **)realloc((char *)*environp,
-                           (size_t)(sizeof(char *) * (cnt + 2)));
-                       if (!p)
-                               return (-1);
--                      alloced = environ = p;
-+                      *environp = p;
-               }
-               else {                          /* get new space */
-                                               /* copy old entries into it */
--                      p = malloc((size_t)(sizeof(char *) * (cnt + 2)));
-+                      p = malloc_zone_malloc(envz, (size_t)(sizeof(char *) * (cnt + 2)));
-                       if (!p)
-                               return (-1);
--                      bcopy(environ, p, cnt * sizeof(char *));
--                      alloced = environ = p;
-+                      bcopy(*environp, p, cnt * sizeof(char *));
-+                      *environp = p;
-               }
--              environ[cnt + 1] = NULL;
-+              (*environp)[cnt + 1] = NULL;
-               offset = cnt;
-       }
--      for (c = (char *)name; *c && *c != '='; ++c);   /* no `=' in name */
--      if (!(environ[offset] =                 /* name + `=' + value */
--          malloc((size_t)((int)(c - name) + l_value + 2))))
--              return (-1);
--      for (c = environ[offset]; (*c = *name++) && *c != '='; ++c);
--      for (*c++ = '='; (*c++ = *value++); );
-+      /* For non Unix03, or UnixO3 setenv(), we make a copy of the user's
-+       * strings.  For Unix03 putenv(), we put the string directly in
-+       * the environment. */
-+      if (copy > 0) {
-+              for (c = (char *)name; *c && *c != '='; ++c);   /* no `=' in name */
-+              if (!((*environp)[offset] =                     /* name + `=' + value */
-+                  malloc_zone_malloc(envz, (size_t)((int)(c - name) + strlen(value) + 2))))
-+                      return (-1);
-+              for (c = (*environp)[offset]; (*c = *name++) && *c != '='; ++c);
-+              for (*c++ = '='; (*c++ = *value++); );
-+      } else {
-+              /* the legacy behavior copies the string */
-+              if (copy < 0) {
-+                      size_t len = strlen(name);
-+                      if((c = malloc_zone_malloc(envz, len + 1)) == NULL)
-+                              return (-1);
-+                      memcpy(c, name, len + 1);
-+                      name = c;
-+              }
-+              /* if we malloc-ed the previous value, free it first */
-+              if ((*environp)[offset] != NULL && ZONE_OWNS_PTR(envz, (*environp)[offset]))
-+                      free((*environp)[offset]);
-+              (*environp)[offset] = (char *)name;
-+      }
-       return (0);
- }
-+__private_extern__ void
-+__unsetenv(const char *name, char **environ, malloc_zone_t *envz)
-+{
-+      char **p;
-+      int offset;
-+
-+      while (__findenv(name, &offset, environ)) { /* if set multiple times */
-+              /* if we malloc-ed it, free it first */
-+              if (ZONE_OWNS_PTR(envz, environ[offset]))
-+                      free(environ[offset]);
-+              for (p = &environ[offset];; ++p)
-+                      if (!(*p = *(p + 1)))
-+                              break;
-+      }
-+}
-+
-+/****************************************************************************/
-+/*
-+ * _allocenvstate -- SPI that creates a new state (opaque)
-+ */
-+void *
-+_allocenvstate(void)
-+{
-+      malloc_zone_t *zone;
-+      zone = malloc_create_zone(1000 /* unused */, 0 /* unused */);
-+      if (zone) {
-+              malloc_set_zone_name(zone, "environ");
-+      }
-+      return (void *)zone;
-+}
-+
-+/*
-+ * _copyenv -- SPI that copies a NULL-tereminated char * array in a newly
-+ * allocated buffer, compatible with the other SPI env routines.  If env
-+ * is NULL, a char * array composed of a single NULL is returned.  NULL
-+ * is returned on error.  (This isn't needed anymore, as __setenv will
-+ * automatically make a copy in the zone.)
-+ */
-+char **
-+_copyenv(char **env)
-+{
-+      char **p;
-+      int cnt = 1;
-+
-+      if (env)
-+              for (p = env; *p; ++p, ++cnt);
-+      p = (char **)malloc((size_t)(sizeof(char *) * cnt));
-+      if (!p)
-+              return (NULL);
-+      if (env)
-+              bcopy(env, p, cnt * sizeof(char *));
-+      else
-+              *p = NULL;
-+      return p;
-+}
-+
-+/*
-+ * _deallocenvstate -- SPI that frees all the memory associated with the state
-+ * and all allocated strings, including the environment array itself if it
-+ * was copied.
-+ */
-+int
-+_deallocenvstate(void *state)
-+{
-+      malloc_zone_t *envz;
-+
-+      if (!(envz = (malloc_zone_t *)state) || envz == __zone0) {
-+              errno = EINVAL;
-+              return -1;
-+      }
-+      malloc_destroy_zone(envz);
-+      return 0;
-+}
-+
-+/*
-+ * setenvp -- SPI using an arbitrary pointer to string array and an env state,
-+ * created by _allocenvstate().  Initial checking is not done.
-+ *
-+ *    Set the value of the environmental variable "name" to be
-+ *    "value".  If rewrite is set, replace any current value.
-+ */
-+int
-+_setenvp(const char *name, const char *value, int rewrite, char ***envp, void *state)
-+{
-+      if (init__zone0(1)) return (-1);
-+      return (__setenv(name, value, rewrite, 1, envp, (state ? (malloc_zone_t *)state : __zone0)));
-+}
-+
-+/*
-+ * unsetenv(name) -- SPI using an arbitrary pointer to string array and an env
-+ * state, created by _allocenvstate().  Initial checking is not done.
-+ *
-+ *    Delete environmental variable "name".
-+ */
-+int
-+_unsetenvp(const char *name, char ***envp, void *state)
-+{
-+      if (init__zone0(1)) return (-1);
-+      __unsetenv(name, *envp, (state ? (malloc_zone_t *)state : __zone0));
-+      return 0;
-+}
-+
-+#endif /* !BUILD_VARIANT */
-+
-+/*
-+ * setenv --
-+ *    Set the value of the environmental variable "name" to be
-+ *    "value".  If rewrite is set, replace any current value.
-+ */
-+int
-+setenv(name, value, rewrite)
-+      const char *name;
-+      const char *value;
-+      int rewrite;
-+{
-+#ifdef LEGACY_CRT1_ENVIRON
-+      int ret;
-+#endif /* LEGACY_CRT1_ENVIRON */
-+
-+      /* no null ptr or empty str */
-+      if(name == NULL || *name == 0) {
-+              errno = EINVAL;
-+              return (-1);
-+      }
-+
-+#if __DARWIN_UNIX03
-+      /* no '=' in name */
-+      if (strchr(name, '=')) {
-+              errno = EINVAL;
-+              return (-1);
-+      }
-+#endif /* __DARWIN_UNIX03 */
-+
-+      if (*value == '=')                      /* no `=' in value */
-+              ++value;
-+      /* insure __zone0 is set up before calling __malloc_check_env_name */
-+      if (init__zone0(1)) return (-1);
-+      __malloc_check_env_name(name); /* see if we are changing a malloc environment variable */
-+#ifdef LEGACY_CRT1_ENVIRON
-+      ret = __setenv(name, value, rewrite, 1, _NSGetEnviron(), __zone0);
-+      _saved_environ = *_NSGetEnviron();
-+      return ret;
-+#else /* !LEGACY_CRT1_ENVIRON */
-+      return (__setenv(name, value, rewrite, 1, _NSGetEnviron(), __zone0));
-+#endif /* !LEGACY_CRT1_ENVIRON */
-+}
-+
- /*
-  * unsetenv(name) --
-  *    Delete environmental variable "name".
-  */
-+#if __DARWIN_UNIX03
-+int
-+#else /* !__DARWIN_UNIX03 */
- void
-+#endif /* __DARWIN_UNIX03 */
- unsetenv(name)
-       const char *name;
- {
--      extern char **environ;
--      char **p;
--      int offset;
-+#if __DARWIN_UNIX03
-+      /* no null ptr or empty str */
-+      if(name == NULL || *name == 0) {
-+              errno = EINVAL;
-+              return (-1);
-+      }
--      while (__findenv(name, &offset))        /* if set multiple times */
--              for (p = &environ[offset];; ++p)
--                      if (!(*p = *(p + 1)))
--                              break;
-+      /* no '=' in name */
-+      if (strchr(name, '=')) {
-+              errno = EINVAL;
-+              return (-1);
-+      }
-+      /* insure __zone0 is set up before calling __malloc_check_env_name */
-+      if (init__zone0(1)) return (-1);
-+#else /* !__DARWIN_UNIX03 */
-+      /* no null ptr or empty str */
-+      if(name == NULL || *name == 0)
-+              return;
-+      /* insure __zone0 is set up before calling __malloc_check_env_name */
-+      if (init__zone0(0)) return;
-+#endif /* __DARWIN_UNIX03 */
-+      __malloc_check_env_name(name); /* see if we are changing a malloc environment variable */
-+      __unsetenv(name, *_NSGetEnviron(), __zone0);
-+#if __DARWIN_UNIX03
-+      return 0;
-+#endif /* __DARWIN_UNIX03 */
- }
index 022c45b8cceedf74072e6e91c612f08ac8070169..60cacbd9a13f945ea82604d6d8162a20f970fd19 100644 (file)
@@ -85,6 +85,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strhash.c,v 1.10 2002/03/22 21:53:10 obr
 
 static int _hash(int size, char *key);
 static hash_node *list_find(caddr_t key, hash_node *head);
+static int assign_key(char *key, hash_node *node);
 
 
 /*
@@ -242,8 +243,6 @@ hash_search(hash_table *table, caddr_t key, void *datum,
     else{
        if (datum){
 
-           static int assign_key();
-
            hash_node *new = (hash_node *)malloc(sizeof(hash_node));
 
            if (!new || !assign_key(key, new)){
diff --git a/stdlib/FreeBSD/strhash.c.patch b/stdlib/FreeBSD/strhash.c.patch
deleted file mode 100644 (file)
index fcd8c7c..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- strhash.c.orig     2004-08-27 15:27:37.000000000 -0700
-+++ strhash.c  2004-08-27 15:29:08.000000000 -0700
-@@ -85,6 +85,7 @@
- static int _hash(int size, char *key);
- static hash_node *list_find(caddr_t key, hash_node *head);
-+static int assign_key(char *key, hash_node *node);
- /*
-@@ -242,8 +243,6 @@
-     else{
-       if (datum){
--          static int assign_key();
--
-           hash_node *new = (hash_node *)malloc(sizeof(hash_node));
-           if (!new || !assign_key(key, new)){
index 42352b3d50dcabbc89dfd34bd94c87d8534a0ac2..463553da3884558b906bb3dc4a3afd13b4cb97b5 100644 (file)
@@ -45,11 +45,20 @@ string to floating point
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft double
-.Fn strtod "const char * restrict nptr" "char ** restrict endptr"
+.Fo strtod
+.Fa "const char *restrict nptr"
+.Fa "char **restrict endptr"
+.Fc
 .Ft float
-.Fn strtof "const char * restrict nptr" "char ** restrict endptr"
+.Fo strtof
+.Fa "const char *restrict nptr"
+.Fa "char **restrict endptr"
+.Fc
 .Ft "long double"
-.Fn strtold "const char * restrict nptr" "char ** restrict endptr"
+.Fo strtold
+.Fa "const char *restrict nptr"
+.Fa "char **restrict endptr"
+.Fc
 .Sh DESCRIPTION
 These conversion
 functions convert the initial portion of the string
@@ -62,16 +71,17 @@ and
 .Vt "long double"
 representation, respectively.
 .Pp
-The expected form of the string is an optional plus (``+'') or minus
-sign (``\-'') followed by either:
+The expected form of the string
+is an optional plus (``+'') or minus (``\-'') sign,
+followed by either:
 .Bl -bullet
 .It
-a decimal significand consisting of a sequence of decimal digits
-optionally containing a decimal-point character, or
+a decimal significand, consisting of a sequence of decimal digits
+(optionally containing a decimal-point character) or
 .It
-a hexadecimal significand consisting of a ``0X'' or ``0x'' followed
-by a sequence of hexadecimal digits optionally containing a
-decimal-point character.
+a hexadecimal significand, consisting of a ``0X'' or ``0x'' followed
+by a sequence of hexadecimal digits
+(optionally containing a decimal-point character).
 .El
 .Pp
 In both cases, the significand may be optionally followed by an
@@ -116,6 +126,12 @@ function) are skipped.
 The decimal point
 character is defined in the program's locale (category
 .Dv LC_NUMERIC ) .
+.Pp
+Extended locale versions of these functions are documented in
+.Xr strtod_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn strtod ,
@@ -161,6 +177,7 @@ Overflow or underflow occurred.
 .Xr atoi 3 ,
 .Xr atol 3 ,
 .Xr nan 3 ,
+.Xr strtod_l 3 ,
 .Xr strtol 3 ,
 .Xr strtoul 3 ,
 .Xr wcstod 3
@@ -169,8 +186,7 @@ The
 .Fn strtod
 function
 conforms to
-.St -isoC-99 ,
-with the exception of the bug noted below.
+.St -isoC-99 .
 .Sh AUTHORS
 The author of this software is
 .An David M. Gay .
diff --git a/stdlib/FreeBSD/strtod.3.patch b/stdlib/FreeBSD/strtod.3.patch
deleted file mode 100644 (file)
index 600a792..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
---- strtod.3.orig      2010-04-29 10:40:21.000000000 -0700
-+++ strtod.3   2010-04-29 10:40:42.000000000 -0700
-@@ -45,11 +45,20 @@ string to floating point
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft double
--.Fn strtod "const char * restrict nptr" "char ** restrict endptr"
-+.Fo strtod
-+.Fa "const char *restrict nptr"
-+.Fa "char **restrict endptr"
-+.Fc
- .Ft float
--.Fn strtof "const char * restrict nptr" "char ** restrict endptr"
-+.Fo strtof
-+.Fa "const char *restrict nptr"
-+.Fa "char **restrict endptr"
-+.Fc
- .Ft "long double"
--.Fn strtold "const char * restrict nptr" "char ** restrict endptr"
-+.Fo strtold
-+.Fa "const char *restrict nptr"
-+.Fa "char **restrict endptr"
-+.Fc
- .Sh DESCRIPTION
- These conversion
- functions convert the initial portion of the string
-@@ -62,16 +71,17 @@ and
- .Vt "long double"
- representation, respectively.
- .Pp
--The expected form of the string is an optional plus (``+'') or minus
--sign (``\-'') followed by either:
-+The expected form of the string
-+is an optional plus (``+'') or minus (``\-'') sign,
-+followed by either:
- .Bl -bullet
- .It
--a decimal significand consisting of a sequence of decimal digits
--optionally containing a decimal-point character, or
-+a decimal significand, consisting of a sequence of decimal digits
-+(optionally containing a decimal-point character) or
- .It
--a hexadecimal significand consisting of a ``0X'' or ``0x'' followed
--by a sequence of hexadecimal digits optionally containing a
--decimal-point character.
-+a hexadecimal significand, consisting of a ``0X'' or ``0x'' followed
-+by a sequence of hexadecimal digits
-+(optionally containing a decimal-point character).
- .El
- .Pp
- In both cases, the significand may be optionally followed by an
-@@ -116,6 +126,12 @@ function) are skipped.
- The decimal point
- character is defined in the program's locale (category
- .Dv LC_NUMERIC ) .
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr strtod_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn strtod ,
-@@ -161,6 +177,7 @@ Overflow or underflow occurred.
- .Xr atoi 3 ,
- .Xr atol 3 ,
- .Xr nan 3 ,
-+.Xr strtod_l 3 ,
- .Xr strtol 3 ,
- .Xr strtoul 3 ,
- .Xr wcstod 3
-@@ -169,8 +186,7 @@ The
- .Fn strtod
- function
- conforms to
--.St -isoC-99 ,
--with the exception of the bug noted below.
-+.St -isoC-99 .
- .Sh AUTHORS
- The author of this software is
- .An David M. Gay .
index 09e073f473e6a0a6c333185e78e7af66e5ac9569..0c4c99469abbb880f907affbf1998cb8f6a41b69 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtol.c     8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 i
  * alphabets and digits are each contiguous.
  */
 intmax_t
-strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
+strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
+    locale_t loc)
 {
        const char *s;
        uintmax_t acc;
@@ -53,6 +56,7 @@ strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
        uintmax_t cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * Skip white space and pick up leading +/- sign if any.
         * If base is 0, allow 0x for hex and 0 for octal, else
@@ -61,7 +65,7 @@ strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
        s = nptr;
        do {
                c = *s++;
-       } while (isspace((unsigned char)c));
+       } while (isspace_l((unsigned char)c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -138,3 +142,9 @@ noconv:
                *endptr = (char *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+intmax_t
+strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
+{
+       return strtoimax_l(nptr, endptr, base, __current_locale());
+}
diff --git a/stdlib/FreeBSD/strtoimax.c.patch b/stdlib/FreeBSD/strtoimax.c.patch
deleted file mode 100644 (file)
index 5725b73..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- strtoimax.c.bsdnew 2009-11-13 14:11:51.000000000 -0800
-+++ strtoimax.c        2009-11-13 14:11:51.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtol.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <errno.h>
- #include <stdlib.h>
-@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * alphabets and digits are each contiguous.
-  */
- intmax_t
--strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
-+strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-+    locale_t loc)
- {
-       const char *s;
-       uintmax_t acc;
-@@ -53,6 +56,7 @@ strtoimax(const char * __restrict nptr, 
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * Skip white space and pick up leading +/- sign if any.
-        * If base is 0, allow 0x for hex and 0 for octal, else
-@@ -61,7 +65,7 @@ strtoimax(const char * __restrict nptr, 
-       s = nptr;
-       do {
-               c = *s++;
--      } while (isspace((unsigned char)c));
-+      } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -138,3 +142,9 @@ noconv:
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+intmax_t
-+strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
-+{
-+      return strtoimax_l(nptr, endptr, base, __current_locale());
-+}
index 42f7db381708faca4b73d95c48d9c84a24cebd6c..6a6c99ea0b124e92318cd2bdc152abf61d4109f9 100644 (file)
 .Dt STRTOL 3
 .Os
 .Sh NAME
-.Nm strtol , strtoll , strtoimax , strtoq
+.Nm strtoimax ,
+.Nm strtol ,
+.Nm strtoll ,
+.Nm strtoq
 .Nd "convert a string value to a"
 .Vt long , "long long" , intmax_t
 or
@@ -45,26 +48,41 @@ integer
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
+.In inttypes.h
+.Ft intmax_t
+.Fo strtoimax
+.Fa "const char *restrict str"
+.Fa "char **restrict endptr"
+.Fa "int base"
+.Fc
 .In stdlib.h
-.In limits.h
 .Ft long
-.Fn strtol "const char * restrict nptr" "char ** restrict endptr" "int base"
+.Fo strtol
+.Fa "const char *restrict str"
+.Fa "char **restrict endptr"
+.Fa "int base"
+.Fc
 .Ft long long
-.Fn strtoll "const char * restrict nptr" "char ** restrict endptr" "int base"
-.In inttypes.h
-.Ft intmax_t
-.Fn strtoimax "const char * restrict nptr" "char ** restrict endptr" "int base"
+.Fo strtoll
+.Fa "const char *restrict str"
+.Fa "char **restrict endptr"
+.Fa "int base"
+.Fc
 .In sys/types.h
 .In stdlib.h
 .In limits.h
 .Ft quad_t
-.Fn strtoq "const char *nptr" "char **endptr" "int base"
+.Fo strtoq
+.Fa "const char *str"
+.Fa "char **endptr"
+.Fa "int base"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strtol
 function
 converts the string in
-.Fa nptr
+.Fa str
 to a
 .Vt long
 value.
@@ -72,7 +90,7 @@ The
 .Fn strtoll
 function
 converts the string in
-.Fa nptr
+.Fa str
 to a
 .Vt "long long"
 value.
@@ -80,7 +98,7 @@ The
 .Fn strtoimax
 function
 converts the string in
-.Fa nptr
+.Fa str
 to an
 .Vt intmax_t
 value.
@@ -88,7 +106,7 @@ The
 .Fn strtoq
 function
 converts the string in
-.Fa nptr
+.Fa str
 to a
 .Vt quad_t
 value.
@@ -143,11 +161,11 @@ stores the address of the first invalid character in
 If there were no digits at all, however,
 .Fn strtol
 stores the original value of
-.Fa nptr
+.Fa str
 in
 .Fa *endptr .
 (Thus, if
-.Fa *nptr
+.Fa *str
 is not
 .Ql \e0
 but
@@ -155,11 +173,17 @@ but
 is
 .Ql \e0
 on return, the entire string was valid.)
+.Pp
+Extended locale versions of these functions are documented in
+.Xr strtol_l 3 .
+See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn strtol ,
 .Fn strtoll ,
-.Fn strtoimax
+.Fn strtoimax ,
 and
 .Fn strtoq
 functions
@@ -177,7 +201,7 @@ is set to
 .Er ERANGE
 and the function return value is clamped according
 to the following table.
-.Bl -column -offset indent ".Fn strtoimax" ".Sy underflow" ".Sy overflow"
+.Bl -column -offset indent ".Fn strtoimax" ".Dv INTMAX_MIN" ".Dv INTMAX_MAX"
 .It Sy Function Ta Sy underflow Ta Sy overflow
 .It Fn strtol Ta Dv LONG_MIN Ta Dv LONG_MAX
 .It Fn strtoll Ta Dv LLONG_MIN Ta Dv LLONG_MAX
@@ -195,14 +219,25 @@ no conversion could be performed
 .It Bq Er ERANGE
 The given string was out of range; the value converted has been clamped.
 .El
+.Sh LEGACY SYNOPSIS
+.Fd #include <stdlib.h>
+.Fd #include <limits.h>
+.Pp
+.In limits.h
+is necessary for the
+.Fn strtol
+and
+.Fn strtoll
+functions.
 .Sh SEE ALSO
 .Xr atof 3 ,
 .Xr atoi 3 ,
 .Xr atol 3 ,
 .Xr strtod 3 ,
-.Xr strtonum 3 ,
+.Xr strtol_l 3 ,
 .Xr strtoul 3 ,
-.Xr wcstol 3
+.Xr wcstol 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn strtol
diff --git a/stdlib/FreeBSD/strtol.3.patch b/stdlib/FreeBSD/strtol.3.patch
deleted file mode 100644 (file)
index befb02b..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
---- strtol.3.bsdnew    2009-11-13 14:11:51.000000000 -0800
-+++ strtol.3   2009-11-13 14:33:25.000000000 -0800
-@@ -36,7 +36,10 @@
- .Dt STRTOL 3
- .Os
- .Sh NAME
--.Nm strtol , strtoll , strtoimax , strtoq
-+.Nm strtoimax ,
-+.Nm strtol ,
-+.Nm strtoll ,
-+.Nm strtoq
- .Nd "convert a string value to a"
- .Vt long , "long long" , intmax_t
- or
-@@ -45,26 +48,41 @@ integer
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
-+.In inttypes.h
-+.Ft intmax_t
-+.Fo strtoimax
-+.Fa "const char *restrict str"
-+.Fa "char **restrict endptr"
-+.Fa "int base"
-+.Fc
- .In stdlib.h
--.In limits.h
- .Ft long
--.Fn strtol "const char * restrict nptr" "char ** restrict endptr" "int base"
-+.Fo strtol
-+.Fa "const char *restrict str"
-+.Fa "char **restrict endptr"
-+.Fa "int base"
-+.Fc
- .Ft long long
--.Fn strtoll "const char * restrict nptr" "char ** restrict endptr" "int base"
--.In inttypes.h
--.Ft intmax_t
--.Fn strtoimax "const char * restrict nptr" "char ** restrict endptr" "int base"
-+.Fo strtoll
-+.Fa "const char *restrict str"
-+.Fa "char **restrict endptr"
-+.Fa "int base"
-+.Fc
- .In sys/types.h
- .In stdlib.h
- .In limits.h
- .Ft quad_t
--.Fn strtoq "const char *nptr" "char **endptr" "int base"
-+.Fo strtoq
-+.Fa "const char *str"
-+.Fa "char **endptr"
-+.Fa "int base"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strtol
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to a
- .Vt long
- value.
-@@ -72,7 +90,7 @@ The
- .Fn strtoll
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to a
- .Vt "long long"
- value.
-@@ -80,7 +98,7 @@ The
- .Fn strtoimax
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to an
- .Vt intmax_t
- value.
-@@ -88,7 +106,7 @@ The
- .Fn strtoq
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to a
- .Vt quad_t
- value.
-@@ -143,11 +161,11 @@ stores the address of the first invalid 
- If there were no digits at all, however,
- .Fn strtol
- stores the original value of
--.Fa nptr
-+.Fa str
- in
- .Fa *endptr .
- (Thus, if
--.Fa *nptr
-+.Fa *str
- is not
- .Ql \e0
- but
-@@ -155,11 +173,17 @@ but
- is
- .Ql \e0
- on return, the entire string was valid.)
-+.Pp
-+Extended locale versions of these functions are documented in
-+.Xr strtol_l 3 .
-+See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn strtol ,
- .Fn strtoll ,
--.Fn strtoimax
-+.Fn strtoimax ,
- and
- .Fn strtoq
- functions
-@@ -177,7 +201,7 @@ is set to
- .Er ERANGE
- and the function return value is clamped according
- to the following table.
--.Bl -column -offset indent ".Fn strtoimax" ".Sy underflow" ".Sy overflow"
-+.Bl -column -offset indent ".Fn strtoimax" ".Dv INTMAX_MIN" ".Dv INTMAX_MAX"
- .It Sy Function Ta Sy underflow Ta Sy overflow
- .It Fn strtol Ta Dv LONG_MIN Ta Dv LONG_MAX
- .It Fn strtoll Ta Dv LLONG_MIN Ta Dv LLONG_MAX
-@@ -195,14 +219,25 @@ no conversion could be performed
- .It Bq Er ERANGE
- The given string was out of range; the value converted has been clamped.
- .El
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <stdlib.h>
-+.Fd #include <limits.h>
-+.Pp
-+.In limits.h
-+is necessary for the
-+.Fn strtol
-+and
-+.Fn strtoll
-+functions.
- .Sh SEE ALSO
- .Xr atof 3 ,
- .Xr atoi 3 ,
- .Xr atol 3 ,
- .Xr strtod 3 ,
--.Xr strtonum 3 ,
-+.Xr strtol_l 3 ,
- .Xr strtoul 3 ,
--.Xr wcstol 3
-+.Xr wcstol 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn strtol
index 6bb1551e094b63eed90f2d6d6ba438e9f46df53b..cac93b25da449502d249e0f474ba76c25a068b9f 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtol.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <ctype.h>
 #include <errno.h>
@@ -46,7 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp
  * alphabets and digits are each contiguous.
  */
 long
-strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
+strtol_l(const char * __restrict nptr, char ** __restrict endptr, int base,
+    locale_t loc)
 {
        const char *s;
        unsigned long acc;
@@ -54,6 +57,7 @@ strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
        unsigned long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * Skip white space and pick up leading +/- sign if any.
         * If base is 0, allow 0x for hex and 0 for octal, else
@@ -62,7 +66,7 @@ strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
        s = nptr;
        do {
                c = *s++;
-       } while (isspace((unsigned char)c));
+       } while (isspace_l((unsigned char)c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -138,3 +142,9 @@ noconv:
                *endptr = (char *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+long
+strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
+{
+       return strtol_l(nptr, endptr, base, __current_locale());
+}
diff --git a/stdlib/FreeBSD/strtol.c.patch b/stdlib/FreeBSD/strtol.c.patch
deleted file mode 100644 (file)
index d968ad7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- strtol.c.bsdnew    2009-11-13 14:11:51.000000000 -0800
-+++ strtol.c   2009-11-13 14:11:51.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtol.c 8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <ctype.h>
- #include <errno.h>
-@@ -46,7 +48,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * alphabets and digits are each contiguous.
-  */
- long
--strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
-+strtol_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-+    locale_t loc)
- {
-       const char *s;
-       unsigned long acc;
-@@ -54,6 +57,7 @@ strtol(const char * __restrict nptr, cha
-       unsigned long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * Skip white space and pick up leading +/- sign if any.
-        * If base is 0, allow 0x for hex and 0 for octal, else
-@@ -62,7 +66,7 @@ strtol(const char * __restrict nptr, cha
-       s = nptr;
-       do {
-               c = *s++;
--      } while (isspace((unsigned char)c));
-+      } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -138,3 +142,9 @@ noconv:
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+long
-+strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
-+{
-+      return strtol_l(nptr, endptr, base, __current_locale());
-+}
index 80dac676dc3c7c31402b5e9805a92d8baac7de5c..f7e11f3cb2d45515e687ed598d4cd2dd9fde1e60 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoq.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <errno.h>
 #include <ctype.h>
@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp
  * alphabets and digits are each contiguous.
  */
 long long
-strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
+strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
+    locale_t loc)
 {
        const char *s;
        unsigned long long acc;
@@ -53,6 +56,7 @@ strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
        unsigned long long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * Skip white space and pick up leading +/- sign if any.
         * If base is 0, allow 0x for hex and 0 for octal, else
@@ -61,7 +65,7 @@ strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
        s = nptr;
        do {
                c = *s++;
-       } while (isspace((unsigned char)c));
+       } while (isspace_l((unsigned char)c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -138,3 +142,9 @@ noconv:
                *endptr = (char *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+long long
+strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
+{
+       return strtoll_l(nptr, endptr, base, __current_locale());
+}
diff --git a/stdlib/FreeBSD/strtoll.c.patch b/stdlib/FreeBSD/strtoll.c.patch
deleted file mode 100644 (file)
index 9510635..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- strtoll.c.bsdnew   2009-11-13 14:11:51.000000000 -0800
-+++ strtoll.c  2009-11-13 14:11:51.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoq.c 8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <errno.h>
- #include <ctype.h>
-@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * alphabets and digits are each contiguous.
-  */
- long long
--strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
-+strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-+    locale_t loc)
- {
-       const char *s;
-       unsigned long long acc;
-@@ -53,6 +56,7 @@ strtoll(const char * __restrict nptr, ch
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * Skip white space and pick up leading +/- sign if any.
-        * If base is 0, allow 0x for hex and 0 for octal, else
-@@ -61,7 +65,7 @@ strtoll(const char * __restrict nptr, ch
-       s = nptr;
-       do {
-               c = *s++;
--      } while (isspace((unsigned char)c));
-+      } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -138,3 +142,9 @@ noconv:
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+long long
-+strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
-+{
-+      return strtoll_l(nptr, endptr, base, __current_locale());
-+}
index 0d101d5fed4e10c434b1d122dbbc300609db5575..9dd03e200ba9d302a860dd9c4c2ed80caaf9aac9 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoq.c  8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoq.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 
 #include <stdlib.h>
@@ -44,5 +46,13 @@ quad_t
 strtoq(const char *nptr, char **endptr, int base)
 {
 
-       return strtoll(nptr, endptr, base);
+       return strtoll_l(nptr, endptr, base, __current_locale());
+}
+
+quad_t
+strtoq_l(const char *nptr, char **endptr, int base, locale_t loc)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because strtoll_l will */
+       return strtoll_l(nptr, endptr, base, loc);
 }
diff --git a/stdlib/FreeBSD/strtoq.c.patch b/stdlib/FreeBSD/strtoq.c.patch
deleted file mode 100644 (file)
index b5a517d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- strtoq.c.bsdnew    2009-11-13 14:11:51.000000000 -0800
-+++ strtoq.c   2009-11-13 14:11:51.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoq.c 8.1
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoq.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <stdlib.h>
-@@ -44,5 +46,13 @@ quad_t
- strtoq(const char *nptr, char **endptr, int base)
- {
--      return strtoll(nptr, endptr, base);
-+      return strtoll_l(nptr, endptr, base, __current_locale());
-+}
-+
-+quad_t
-+strtoq_l(const char *nptr, char **endptr, int base, locale_t loc)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because strtoll_l will */
-+      return strtoll_l(nptr, endptr, base, loc);
- }
index adc66437bf11b450ea9cc48e3afb3b8d60e88868..91c759eea54dff03e53b2ae539b7b84936113c7b 100644 (file)
 .Dt STRTOUL 3
 .Os
 .Sh NAME
-.Nm strtoul , strtoull , strtoumax , strtouq
+.Nm strtoul ,
+.Nm strtoull ,
+.Nm strtoumax ,
+.Nm strtouq
 .Nd "convert a string to an"
 .Vt "unsigned long" , "unsigned long long" , uintmax_t ,
 or
@@ -46,25 +49,40 @@ integer
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
-.In limits.h
 .Ft "unsigned long"
-.Fn strtoul "const char * restrict nptr" "char ** restrict endptr" "int base"
+.Fo strtoul
+.Fa "const char *restrict str"
+.Fa "char **restrict endptr"
+.Fa "int base"
+.Fc
 .Ft "unsigned long long"
-.Fn strtoull "const char * restrict nptr" "char ** restrict endptr" "int base"
+.Fo strtoull
+.Fa "const char *restrict str"
+.Fa "char **restrict endptr"
+.Fa "int base"
+.Fc
 .In inttypes.h
 .Ft uintmax_t
-.Fn strtoumax "const char * restrict nptr" "char ** restrict endptr" "int base"
+.Fo strtoumax
+.Fa "const char *restrict str"
+.Fa "char **restrict endptr"
+.Fa "int base"
+.Fc
 .In sys/types.h
 .In stdlib.h
 .In limits.h
 .Ft u_quad_t
-.Fn strtouq "const char *nptr" "char **endptr" "int base"
+.Fo strtouq
+.Fa "const char *str"
+.Fa "char **endptr"
+.Fa "int base"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strtoul
 function
 converts the string in
-.Fa nptr
+.Fa str
 to an
 .Vt "unsigned long"
 value.
@@ -72,7 +90,7 @@ The
 .Fn strtoull
 function
 converts the string in
-.Fa nptr
+.Fa str
 to an
 .Vt "unsigned long long"
 value.
@@ -80,7 +98,7 @@ The
 .Fn strtoumax
 function
 converts the string in
-.Fa nptr
+.Fa str
 to an
 .Vt uintmax_t
 value.
@@ -88,7 +106,7 @@ The
 .Fn strtouq
 function
 converts the string in
-.Fa nptr
+.Fa str
 to a
 .Vt u_quad_t
 value.
@@ -142,11 +160,11 @@ stores the address of the first invalid character in
 If there were no digits at all, however,
 .Fn strtoul
 stores the original value of
-.Fa nptr
+.Fa str
 in
 .Fa *endptr .
 (Thus, if
-.Fa *nptr
+.Fa *str
 is not
 .Ql \e0
 but
@@ -201,10 +219,22 @@ no conversion could be performed
 .It Bq Er ERANGE
 The given string was out of range; the value converted has been clamped.
 .El
+.Sh LEGACY SYNOPSIS
+.Fd #include <stdlib.h>
+.Fd #include <limits.h>
+.Pp
+.In limits.h
+is necessary for the
+.Fn strtoul
+and
+.Fn strtoull
+functions.
 .Sh SEE ALSO
 .Xr strtol 3 ,
+.Xr strtol_l 3 ,
 .Xr strtonum 3 ,
-.Xr wcstoul 3
+.Xr wcstoul 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The
 .Fn strtoul
diff --git a/stdlib/FreeBSD/strtoul.3.patch b/stdlib/FreeBSD/strtoul.3.patch
deleted file mode 100644 (file)
index e9730cd..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
---- strtoul.3.bsdnew   2009-11-13 14:11:51.000000000 -0800
-+++ strtoul.3  2009-11-13 14:40:07.000000000 -0800
-@@ -36,7 +36,10 @@
- .Dt STRTOUL 3
- .Os
- .Sh NAME
--.Nm strtoul , strtoull , strtoumax , strtouq
-+.Nm strtoul ,
-+.Nm strtoull ,
-+.Nm strtoumax ,
-+.Nm strtouq
- .Nd "convert a string to an"
- .Vt "unsigned long" , "unsigned long long" , uintmax_t ,
- or
-@@ -46,25 +49,40 @@ integer
- .Lb libc
- .Sh SYNOPSIS
- .In stdlib.h
--.In limits.h
- .Ft "unsigned long"
--.Fn strtoul "const char * restrict nptr" "char ** restrict endptr" "int base"
-+.Fo strtoul
-+.Fa "const char *restrict str"
-+.Fa "char **restrict endptr"
-+.Fa "int base"
-+.Fc
- .Ft "unsigned long long"
--.Fn strtoull "const char * restrict nptr" "char ** restrict endptr" "int base"
-+.Fo strtoull
-+.Fa "const char *restrict str"
-+.Fa "char **restrict endptr"
-+.Fa "int base"
-+.Fc
- .In inttypes.h
- .Ft uintmax_t
--.Fn strtoumax "const char * restrict nptr" "char ** restrict endptr" "int base"
-+.Fo strtoumax
-+.Fa "const char *restrict str"
-+.Fa "char **restrict endptr"
-+.Fa "int base"
-+.Fc
- .In sys/types.h
- .In stdlib.h
- .In limits.h
- .Ft u_quad_t
--.Fn strtouq "const char *nptr" "char **endptr" "int base"
-+.Fo strtouq
-+.Fa "const char *str"
-+.Fa "char **endptr"
-+.Fa "int base"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strtoul
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to an
- .Vt "unsigned long"
- value.
-@@ -72,7 +90,7 @@ The
- .Fn strtoull
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to an
- .Vt "unsigned long long"
- value.
-@@ -80,7 +98,7 @@ The
- .Fn strtoumax
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to an
- .Vt uintmax_t
- value.
-@@ -88,7 +106,7 @@ The
- .Fn strtouq
- function
- converts the string in
--.Fa nptr
-+.Fa str
- to a
- .Vt u_quad_t
- value.
-@@ -142,11 +160,11 @@ stores the address of the first invalid 
- If there were no digits at all, however,
- .Fn strtoul
- stores the original value of
--.Fa nptr
-+.Fa str
- in
- .Fa *endptr .
- (Thus, if
--.Fa *nptr
-+.Fa *str
- is not
- .Ql \e0
- but
-@@ -201,10 +219,22 @@ no conversion could be performed
- .It Bq Er ERANGE
- The given string was out of range; the value converted has been clamped.
- .El
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <stdlib.h>
-+.Fd #include <limits.h>
-+.Pp
-+.In limits.h
-+is necessary for the
-+.Fn strtoul
-+and
-+.Fn strtoull
-+functions.
- .Sh SEE ALSO
- .Xr strtol 3 ,
-+.Xr strtol_l 3 ,
- .Xr strtonum 3 ,
--.Xr wcstoul 3
-+.Xr wcstoul 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The
- .Fn strtoul
index 76cd7b0816a6469a91ead2af0975d978d2122d6f..c7b5967335c53c558f8a07ab42d459bdc0a78383 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <ctype.h>
 #include <errno.h>
@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp
  * alphabets and digits are each contiguous.
  */
 unsigned long
-strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
+strtoul_l(const char * __restrict nptr, char ** __restrict endptr, int base,
+    locale_t loc)
 {
        const char *s;
        unsigned long acc;
@@ -53,13 +56,14 @@ strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
        unsigned long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtol for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (isspace((unsigned char)c));
+       } while (isspace_l((unsigned char)c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -116,3 +120,9 @@ noconv:
                *endptr = (char *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+unsigned long
+strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
+{
+       return strtoul_l(nptr, endptr, base, __current_locale());
+}
diff --git a/stdlib/FreeBSD/strtoul.c.patch b/stdlib/FreeBSD/strtoul.c.patch
deleted file mode 100644 (file)
index 9c56431..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- strtoul.c.bsdnew   2009-11-13 14:11:52.000000000 -0800
-+++ strtoul.c  2009-11-13 14:11:52.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoul.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <ctype.h>
- #include <errno.h>
-@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * alphabets and digits are each contiguous.
-  */
- unsigned long
--strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
-+strtoul_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-+    locale_t loc)
- {
-       const char *s;
-       unsigned long acc;
-@@ -53,13 +56,14 @@ strtoul(const char * __restrict nptr, ch
-       unsigned long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (isspace((unsigned char)c));
-+      } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -116,3 +120,9 @@ noconv:
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+unsigned long
-+strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
-+{
-+      return strtoul_l(nptr, endptr, base, __current_locale());
-+}
index 38d6194bf80d01377784366a3f27e7c84b60cf7b..8f2fd94c23c73c2dfa3ccb373244081f142bd6f2 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <limits.h>
 #include <errno.h>
 #include <ctype.h>
@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 im
  * alphabets and digits are each contiguous.
  */
 unsigned long long
-strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
+strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
+    locale_t loc)
 {
        const char *s;
        unsigned long long acc;
@@ -53,13 +56,14 @@ strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
        unsigned long long cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtoq for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (isspace((unsigned char)c));
+       } while (isspace_l((unsigned char)c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -116,3 +120,9 @@ noconv:
                *endptr = (char *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+unsigned long long
+strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
+{
+       return strtoull_l(nptr, endptr, base, __current_locale());
+}
diff --git a/stdlib/FreeBSD/strtoull.c.patch b/stdlib/FreeBSD/strtoull.c.patch
deleted file mode 100644 (file)
index fac7b63..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- strtoull.c.bsdnew  2009-11-13 14:11:52.000000000 -0800
-+++ strtoull.c 2009-11-13 14:11:52.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtouq.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <limits.h>
- #include <errno.h>
- #include <ctype.h>
-@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * alphabets and digits are each contiguous.
-  */
- unsigned long long
--strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
-+strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-+    locale_t loc)
- {
-       const char *s;
-       unsigned long long acc;
-@@ -53,13 +56,14 @@ strtoull(const char * __restrict nptr, c
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoq for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (isspace((unsigned char)c));
-+      } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -116,3 +120,9 @@ noconv:
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+unsigned long long
-+strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
-+{
-+      return strtoull_l(nptr, endptr, base, __current_locale());
-+}
index f592063250bbb0e9a398826ddcf6d303c7f54a0e..22400a5532db965c4924cf270bf5f8f175988830 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtoul.c    8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 i
  * alphabets and digits are each contiguous.
  */
 uintmax_t
-strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base)
+strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
+    locale_t loc)
 {
        const char *s;
        uintmax_t acc;
@@ -53,13 +56,14 @@ strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base)
        uintmax_t cutoff;
        int neg, any, cutlim;
 
+       NORMALIZE_LOCALE(loc);
        /*
         * See strtoimax for comments as to the logic used.
         */
        s = nptr;
        do {
                c = *s++;
-       } while (isspace((unsigned char)c));
+       } while (isspace_l((unsigned char)c, loc));
        if (c == '-') {
                neg = 1;
                c = *s++;
@@ -116,3 +120,9 @@ noconv:
                *endptr = (char *)(any ? s - 1 : nptr);
        return (acc);
 }
+
+uintmax_t
+strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base)
+{
+       return strtoumax_l(nptr, endptr, base, __current_locale());
+}
diff --git a/stdlib/FreeBSD/strtoumax.c.patch b/stdlib/FreeBSD/strtoumax.c.patch
deleted file mode 100644 (file)
index fbbc5e0..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- strtoumax.c.bsdnew 2009-11-13 14:11:52.000000000 -0800
-+++ strtoumax.c        2009-11-13 14:11:52.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtoul
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <errno.h>
- #include <stdlib.h>
-@@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * alphabets and digits are each contiguous.
-  */
- uintmax_t
--strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base)
-+strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-+    locale_t loc)
- {
-       const char *s;
-       uintmax_t acc;
-@@ -53,13 +56,14 @@ strtoumax(const char * __restrict nptr, 
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-+      NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoimax for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
--      } while (isspace((unsigned char)c));
-+      } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-@@ -116,3 +120,9 @@ noconv:
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
- }
-+
-+uintmax_t
-+strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base)
-+{
-+      return strtoumax_l(nptr, endptr, base, __current_locale());
-+}
index 614c5b87058a0684ab9b973d614c6ea5ffaaa723..29f0f13c067cbf30b9e03c4f89e408ddb4ca3cb8 100644 (file)
@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtouq.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 
 #include <stdlib.h>
@@ -44,5 +46,13 @@ u_quad_t
 strtouq(const char *nptr, char **endptr, int base)
 {
 
-       return strtoull(nptr, endptr, base);
+       return strtoull_l(nptr, endptr, base, __current_locale());
+}
+
+u_quad_t
+strtouq_l(const char *nptr, char **endptr, int base, locale_t loc)
+{
+
+       /* no need to call NORMALIZE_LOCALE(loc) because strtoull_l will */
+       return strtoull_l(nptr, endptr, base, loc);
 }
diff --git a/stdlib/FreeBSD/strtouq.c.patch b/stdlib/FreeBSD/strtouq.c.patch
deleted file mode 100644 (file)
index cfeabed..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- strtouq.c.bsdnew   2009-11-13 14:11:52.000000000 -0800
-+++ strtouq.c  2009-11-13 14:11:52.000000000 -0800
-@@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtouq.c        8.
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtouq.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <stdlib.h>
-@@ -44,5 +46,13 @@ u_quad_t
- strtouq(const char *nptr, char **endptr, int base)
- {
--      return strtoull(nptr, endptr, base);
-+      return strtoull_l(nptr, endptr, base, __current_locale());
-+}
-+
-+u_quad_t
-+strtouq_l(const char *nptr, char **endptr, int base, locale_t loc)
-+{
-+
-+      /* no need to call NORMALIZE_LOCALE(loc) because strtoull_l will */
-+      return strtoull_l(nptr, endptr, base, loc);
- }
index ba5fb6e7917f55e834b5ed5dc1c5ed31ba9b9a07..72bc6cbba6a7edcb85f4b2658fed36aaead8b91e 100644 (file)
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
-.Fn system "const char *string"
+.Fn system "const char *command"
 .Sh DESCRIPTION
 The
 .Fn system
 function
 hands the argument
-.Fa string
+.Fa command
 to the command interpreter
 .Xr sh 1 .
 The calling process waits for the shell
@@ -62,7 +62,7 @@ and blocking
 .Dv SIGCHLD .
 .Pp
 If
-.Fa string
+.Fa command
 is a
 .Dv NULL
 pointer,
diff --git a/stdlib/FreeBSD/system.3.patch b/stdlib/FreeBSD/system.3.patch
deleted file mode 100644 (file)
index b202c83..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
---- system.3.bsdnew    2009-11-13 14:11:52.000000000 -0800
-+++ system.3   2009-11-13 14:11:52.000000000 -0800
-@@ -43,13 +43,13 @@
- .Sh SYNOPSIS
- .In stdlib.h
- .Ft int
--.Fn system "const char *string"
-+.Fn system "const char *command"
- .Sh DESCRIPTION
- The
- .Fn system
- function
- hands the argument
--.Fa string
-+.Fa command
- to the command interpreter
- .Xr sh 1 .
- The calling process waits for the shell
-@@ -62,7 +62,7 @@ and blocking
- .Dv SIGCHLD .
- .Pp
- If
--.Fa string
-+.Fa command
- is a
- .Dv NULL
- pointer,
index 8cdc1ddc18b5c3fa6bf86c74da9559dafdcab0eb..c2a56c7c51cc30dce5e5fd2e262807a3e86195ed 100644 (file)
@@ -40,23 +40,61 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/system.c,v 1.11 2007/01/09 00:28:10 imp
 #include <stdlib.h>
 #include <stddef.h>
 #include <unistd.h>
+#include <spawn.h>
 #include <paths.h>
 #include <errno.h>
 #include "un-namespace.h"
 #include "libc_private.h"
 
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+
+#if __DARWIN_UNIX03
+#include <pthread.h>
+
+static pthread_mutex_t __systemfn_mutex = PTHREAD_MUTEX_INITIALIZER;
+extern int __unix_conforming;
+#ifdef VARIANT_CANCELABLE
+extern void _pthread_testcancel(pthread_t thread, int isconforming);
+#endif /* VARIANT_CANCELABLE */
+#endif /* __DARWIN_UNIX03 */
+
 int
 __system(command)
        const char *command;
 {
        pid_t pid, savedpid;
-       int pstat;
+       int pstat, err;
        struct sigaction ign, intact, quitact;
-       sigset_t newsigblock, oldsigblock;
+       sigset_t newsigblock, oldsigblock, defaultsig;
+       posix_spawnattr_t attr;
+       short flags = POSIX_SPAWN_SETSIGMASK;
+       const char *argv[] = {"sh", "-c", command, NULL};
+
+#if __DARWIN_UNIX03
+       if (__unix_conforming == 0)
+               __unix_conforming = 1;
+#ifdef VARIANT_CANCELABLE
+       _pthread_testcancel(pthread_self(), 1);
+#endif /* VARIANT_CANCELABLE */
+#endif /* __DARWIN_UNIX03 */
+
+       if (!command) {         /* just checking... */
+               if (access(_PATH_BSHELL, F_OK) == -1)   /* if no sh or no access */
+                       return(0);
+               else
+                       return(1);
+       }
 
-       if (!command)           /* just checking... */
-               return(1);
+       if ((err = posix_spawnattr_init(&attr)) != 0) {
+               errno = err;
+               return -1;
+       }
+       (void)sigemptyset(&defaultsig);
 
+#if __DARWIN_UNIX03
+       pthread_mutex_lock(&__systemfn_mutex);
+#endif /* __DARWIN_UNIX03 */
        /*
         * Ignore SIGINT and SIGQUIT, block SIGCHLD. Remember to save
         * existing signal dispositions.
@@ -65,33 +103,45 @@ __system(command)
        (void)sigemptyset(&ign.sa_mask);
        ign.sa_flags = 0;
        (void)_sigaction(SIGINT, &ign, &intact);
+       if (intact.sa_handler != SIG_IGN) {
+               sigaddset(&defaultsig, SIGINT);
+               flags |= POSIX_SPAWN_SETSIGDEF;
+       }
        (void)_sigaction(SIGQUIT, &ign, &quitact);
+       if (quitact.sa_handler != SIG_IGN) {
+               sigaddset(&defaultsig, SIGQUIT);
+               flags |= POSIX_SPAWN_SETSIGDEF;
+       }
        (void)sigemptyset(&newsigblock);
        (void)sigaddset(&newsigblock, SIGCHLD);
        (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
-       switch(pid = fork()) {
-       case -1:                        /* error */
-               break;
-       case 0:                         /* child */
-               /*
-                * Restore original signal dispositions and exec the command.
-                */
-               (void)_sigaction(SIGINT, &intact, NULL);
-               (void)_sigaction(SIGQUIT,  &quitact, NULL);
-               (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
-               execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
-               _exit(127);
-       default:                        /* parent */
+       (void)posix_spawnattr_setsigmask(&attr, &oldsigblock);
+       if (flags & POSIX_SPAWN_SETSIGDEF) {
+               (void)posix_spawnattr_setsigdefault(&attr, &defaultsig);
+       }
+       (void)posix_spawnattr_setflags(&attr, flags);
+
+       err = posix_spawn(&pid, _PATH_BSHELL, NULL, &attr, (char *const *)argv, environ);
+       (void)posix_spawnattr_destroy(&attr);
+       if (err == 0) {
                savedpid = pid;
                do {
                        pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
                } while (pid == -1 && errno == EINTR);
-               break;
+               if (pid == -1) pstat = -1;
+       } else if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */
+               pstat = -1;
+       } else {
+               pstat = W_EXITCODE(127, 0); /* couldn't exec shell */
        }
+
        (void)_sigaction(SIGINT, &intact, NULL);
        (void)_sigaction(SIGQUIT,  &quitact, NULL);
        (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
-       return(pid == -1 ? -1 : pstat);
+#if __DARWIN_UNIX03
+       pthread_mutex_unlock(&__systemfn_mutex);
+#endif /* __DARWIN_UNIX03 */
+       return(pstat);
 }
 
 __weak_reference(__system, system);
diff --git a/stdlib/FreeBSD/system.c.patch b/stdlib/FreeBSD/system.c.patch
deleted file mode 100644 (file)
index 6691e7a..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
---- system.c.bsdnew    2009-11-13 14:11:52.000000000 -0800
-+++ system.c   2009-11-13 14:11:52.000000000 -0800
-@@ -40,23 +40,61 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #include <stdlib.h>
- #include <stddef.h>
- #include <unistd.h>
-+#include <spawn.h>
- #include <paths.h>
- #include <errno.h>
- #include "un-namespace.h"
- #include "libc_private.h"
-+#include <crt_externs.h>
-+#define environ (*_NSGetEnviron())
-+
-+#if __DARWIN_UNIX03
-+#include <pthread.h>
-+
-+static pthread_mutex_t __systemfn_mutex = PTHREAD_MUTEX_INITIALIZER;
-+extern int __unix_conforming;
-+#ifdef VARIANT_CANCELABLE
-+extern void _pthread_testcancel(pthread_t thread, int isconforming);
-+#endif /* VARIANT_CANCELABLE */
-+#endif /* __DARWIN_UNIX03 */
-+
- int
- __system(command)
-       const char *command;
- {
-       pid_t pid, savedpid;
--      int pstat;
-+      int pstat, err;
-       struct sigaction ign, intact, quitact;
--      sigset_t newsigblock, oldsigblock;
-+      sigset_t newsigblock, oldsigblock, defaultsig;
-+      posix_spawnattr_t attr;
-+      short flags = POSIX_SPAWN_SETSIGMASK;
-+      const char *argv[] = {"sh", "-c", command, NULL};
-+
-+#if __DARWIN_UNIX03
-+      if (__unix_conforming == 0)
-+              __unix_conforming = 1;
-+#ifdef VARIANT_CANCELABLE
-+      _pthread_testcancel(pthread_self(), 1);
-+#endif /* VARIANT_CANCELABLE */
-+#endif /* __DARWIN_UNIX03 */
-+
-+      if (!command) {         /* just checking... */
-+              if (access(_PATH_BSHELL, F_OK) == -1)   /* if no sh or no access */
-+                      return(0);
-+              else
-+                      return(1);
-+      }
--      if (!command)           /* just checking... */
--              return(1);
-+      if ((err = posix_spawnattr_init(&attr)) != 0) {
-+              errno = err;
-+              return -1;
-+      }
-+      (void)sigemptyset(&defaultsig);
-+#if __DARWIN_UNIX03
-+      pthread_mutex_lock(&__systemfn_mutex);
-+#endif /* __DARWIN_UNIX03 */
-       /*
-        * Ignore SIGINT and SIGQUIT, block SIGCHLD. Remember to save
-        * existing signal dispositions.
-@@ -65,33 +103,45 @@ __system(command)
-       (void)sigemptyset(&ign.sa_mask);
-       ign.sa_flags = 0;
-       (void)_sigaction(SIGINT, &ign, &intact);
-+      if (intact.sa_handler != SIG_IGN) {
-+              sigaddset(&defaultsig, SIGINT);
-+              flags |= POSIX_SPAWN_SETSIGDEF;
-+      }
-       (void)_sigaction(SIGQUIT, &ign, &quitact);
-+      if (quitact.sa_handler != SIG_IGN) {
-+              sigaddset(&defaultsig, SIGQUIT);
-+              flags |= POSIX_SPAWN_SETSIGDEF;
-+      }
-       (void)sigemptyset(&newsigblock);
-       (void)sigaddset(&newsigblock, SIGCHLD);
-       (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
--      switch(pid = fork()) {
--      case -1:                        /* error */
--              break;
--      case 0:                         /* child */
--              /*
--               * Restore original signal dispositions and exec the command.
--               */
--              (void)_sigaction(SIGINT, &intact, NULL);
--              (void)_sigaction(SIGQUIT,  &quitact, NULL);
--              (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
--              execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
--              _exit(127);
--      default:                        /* parent */
-+      (void)posix_spawnattr_setsigmask(&attr, &oldsigblock);
-+      if (flags & POSIX_SPAWN_SETSIGDEF) {
-+              (void)posix_spawnattr_setsigdefault(&attr, &defaultsig);
-+      }
-+      (void)posix_spawnattr_setflags(&attr, flags);
-+
-+      err = posix_spawn(&pid, _PATH_BSHELL, NULL, &attr, (char *const *)argv, environ);
-+      (void)posix_spawnattr_destroy(&attr);
-+      if (err == 0) {
-               savedpid = pid;
-               do {
-                       pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
-               } while (pid == -1 && errno == EINTR);
--              break;
-+              if (pid == -1) pstat = -1;
-+      } else if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */
-+              pstat = -1;
-+      } else {
-+              pstat = W_EXITCODE(127, 0); /* couldn't exec shell */
-       }
-+
-       (void)_sigaction(SIGINT, &intact, NULL);
-       (void)_sigaction(SIGQUIT,  &quitact, NULL);
-       (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
--      return(pid == -1 ? -1 : pstat);
-+#if __DARWIN_UNIX03
-+      pthread_mutex_unlock(&__systemfn_mutex);
-+#endif /* __DARWIN_UNIX03 */
-+      return(pstat);
- }
- __weak_reference(__system, system);
index d7121d4bdd64a82b73e4fa8c37c2eb0b2baa7357..9d7a863206aab5ab83f221f707437dbfdcb3e1d3 100644 (file)
 .Dt TSEARCH 3
 .Os
 .Sh NAME
-.Nm tsearch , tfind , tdelete , twalk
+.Nm tdelete ,
+.Nm tfind ,
+.Nm tsearch ,
+.Nm twalk
 .Nd manipulate binary search trees
 .Sh SYNOPSIS
 .In search.h
 .Ft void *
-.Fn tdelete "const void * restrict key" "void ** restrict rootp" "int (*compar) (const void *, const void *)"
+.Fo tdelete
+.Fa "const void *restrict key"
+.Fa "void **restrict rootp"
+.Fa "int (*compar) (const void *key1, const void *key2)"
+.Fc
 .Ft void *
-.Fn tfind "const void *key" "void * const *rootp" "int (*compar) (const void *, const void *)"
+.Fo tfind
+.Fa "const void *key"
+.Fa "void *const *rootp"
+.Fa "int (*compar) (const void *key1, const void *key2)"
+.Fc
 .Ft void *
-.Fn tsearch "const void *key" "void **rootp" "int (*compar) (const void *, const void *)"
+.Fo tsearch
+.Fa "const void *key"
+.Fa "void **rootp"
+.Fa "int (*compar) (const void *key1, const void *key2)"
+.Fc
 .Ft void
-.Fn twalk "const void *root" "void (*action) (const void *, VISIT, int)"
+.Fo twalk
+.Fa "const void *root"
+.Fa "void (*action) (const void *node, VISIT order, int level)"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn tdelete ,
@@ -50,39 +68,46 @@ The
 .Fn tsearch ,
 and
 .Fn twalk
-functions manage binary search trees based on algorithms T and D
+functions manage binary search trees, based on algorithms T and D
 from Knuth (6.2.2).
 The comparison function passed in by
-the user has the same style of return values as
+the user takes two arguments, each of which is a key
+pointer.
+This function has the same style of return values as
 .Xr strcmp 3 .
 .Pp
 The
 .Fn tfind
 function
-searches for the datum matched by the argument
+searches for a node whose key matches the argument
 .Fa key
 in the binary tree rooted at
 .Fa rootp ,
-returning a pointer to the datum if it is found and NULL
+returning a pointer to the node if it is found and NULL
 if it is not.
 .Pp
+Note that a node is itself a pointer to the key of the node.
+Thus, you should generally cast this result to a
+double pointer to the data type stored in the tree, for example
+(struct myType **), and use double indirection to retrieve the
+original key value.
+.Pp
 The
 .Fn tsearch
-function
-is identical to
+function is identical to
 .Fn tfind
-except that if no match is found,
+except that, if no match is found,
+it inserts a new node for the
 .Fa key
-is inserted into the tree and a pointer to it is returned.
+into the tree and returns a pointer to the node.
 If
 .Fa rootp
-points to a NULL value a new binary search tree is created.
+points to a NULL value, a new binary search tree is created.
 .Pp
 The
 .Fn tdelete
-function
-deletes a node from the specified binary search tree and returns
-a pointer to the parent of the node to be deleted.
+function deletes a node from the specified binary search tree
+and returns a pointer to the parent of the node that was deleted.
 It takes the same arguments as
 .Fn tfind
 and
@@ -93,20 +118,44 @@ will be adjusted.
 .Pp
 The
 .Fn twalk
-function
-walks the binary search tree rooted in
+function walks the binary search tree rooted in
 .Fa root
 and calls the function
 .Fa action
 on each node.
 The
 .Fa action
-function
-is called with three arguments: a pointer to the current node,
+function is called with three arguments: a pointer to the current node,
 a value from the enum
 .Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;"
 specifying the traversal type, and a node level (where level
 zero is the root of the tree).
+.Pp
+As
+.Fn twalk
+traverses the tree, it calls the
+.Fa action
+function with the traversal type "preorder"
+before visiting the left subtree of the
+.Fa node ,
+with the
+traversal type "postorder" before visiting the right subtree
+of the
+.Fa node ,
+and with the traversal type "endorder" after
+visiting the right subtree of the
+.Fa node .
+.Pp.
+The
+.Fa action
+function is called only once for a leaf-node, with the
+traversal type "leaf."
+.Pp
+Note: the names for the traversal types differ somewhat from
+common parlance.  The traversal type "postorder" corresponds
+to what would typically be referred to as in-order, and the
+traversal type "endorder" corresponds to what would typically
+be referred to as post-order.
 .Sh RETURN VALUES
 The
 .Fn tsearch
@@ -121,7 +170,7 @@ and
 functions
 return NULL if
 .Fa rootp
-is NULL or the datum cannot be found.
+is NULL or the node cannot be found.
 .Pp
 The
 .Fn twalk
diff --git a/stdlib/FreeBSD/tsearch.3.patch b/stdlib/FreeBSD/tsearch.3.patch
deleted file mode 100644 (file)
index 7e8355c..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
---- tsearch.3.bsdnew   2009-11-13 14:11:52.000000000 -0800
-+++ tsearch.3  2009-11-13 14:42:09.000000000 -0800
-@@ -31,18 +31,36 @@
- .Dt TSEARCH 3
- .Os
- .Sh NAME
--.Nm tsearch , tfind , tdelete , twalk
-+.Nm tdelete ,
-+.Nm tfind ,
-+.Nm tsearch ,
-+.Nm twalk
- .Nd manipulate binary search trees
- .Sh SYNOPSIS
- .In search.h
- .Ft void *
--.Fn tdelete "const void * restrict key" "void ** restrict rootp" "int (*compar) (const void *, const void *)"
-+.Fo tdelete
-+.Fa "const void *restrict key"
-+.Fa "void **restrict rootp"
-+.Fa "int (*compar) (const void *key1, const void *key2)"
-+.Fc
- .Ft void *
--.Fn tfind "const void *key" "void * const *rootp" "int (*compar) (const void *, const void *)"
-+.Fo tfind
-+.Fa "const void *key"
-+.Fa "void *const *rootp"
-+.Fa "int (*compar) (const void *key1, const void *key2)"
-+.Fc
- .Ft void *
--.Fn tsearch "const void *key" "void **rootp" "int (*compar) (const void *, const void *)"
-+.Fo tsearch
-+.Fa "const void *key"
-+.Fa "void **rootp"
-+.Fa "int (*compar) (const void *key1, const void *key2)"
-+.Fc
- .Ft void
--.Fn twalk "const void *root" "void (*action) (const void *, VISIT, int)"
-+.Fo twalk
-+.Fa "const void *root"
-+.Fa "void (*action) (const void *node, VISIT order, int level)"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn tdelete ,
-@@ -50,39 +68,46 @@ The
- .Fn tsearch ,
- and
- .Fn twalk
--functions manage binary search trees based on algorithms T and D
-+functions manage binary search trees, based on algorithms T and D
- from Knuth (6.2.2).
- The comparison function passed in by
--the user has the same style of return values as
-+the user takes two arguments, each of which is a key
-+pointer.
-+This function has the same style of return values as
- .Xr strcmp 3 .
- .Pp
- The
- .Fn tfind
- function
--searches for the datum matched by the argument
-+searches for a node whose key matches the argument
- .Fa key
- in the binary tree rooted at
- .Fa rootp ,
--returning a pointer to the datum if it is found and NULL
-+returning a pointer to the node if it is found and NULL
- if it is not.
- .Pp
-+Note that a node is itself a pointer to the key of the node.
-+Thus, you should generally cast this result to a
-+double pointer to the data type stored in the tree, for example
-+(struct myType **), and use double indirection to retrieve the
-+original key value.
-+.Pp
- The
- .Fn tsearch
--function
--is identical to
-+function is identical to
- .Fn tfind
--except that if no match is found,
-+except that, if no match is found,
-+it inserts a new node for the
- .Fa key
--is inserted into the tree and a pointer to it is returned.
-+into the tree and returns a pointer to the node.
- If
- .Fa rootp
--points to a NULL value a new binary search tree is created.
-+points to a NULL value, a new binary search tree is created.
- .Pp
- The
- .Fn tdelete
--function
--deletes a node from the specified binary search tree and returns
--a pointer to the parent of the node to be deleted.
-+function deletes a node from the specified binary search tree
-+and returns a pointer to the parent of the node that was deleted.
- It takes the same arguments as
- .Fn tfind
- and
-@@ -93,20 +118,44 @@ will be adjusted.
- .Pp
- The
- .Fn twalk
--function
--walks the binary search tree rooted in
-+function walks the binary search tree rooted in
- .Fa root
- and calls the function
- .Fa action
- on each node.
- The
- .Fa action
--function
--is called with three arguments: a pointer to the current node,
-+function is called with three arguments: a pointer to the current node,
- a value from the enum
- .Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;"
- specifying the traversal type, and a node level (where level
- zero is the root of the tree).
-+.Pp
-+As
-+.Fn twalk
-+traverses the tree, it calls the
-+.Fa action
-+function with the traversal type "preorder"
-+before visiting the left subtree of the
-+.Fa node ,
-+with the
-+traversal type "postorder" before visiting the right subtree
-+of the
-+.Fa node ,
-+and with the traversal type "endorder" after
-+visiting the right subtree of the
-+.Fa node .
-+.Pp.
-+The
-+.Fa action
-+function is called only once for a leaf-node, with the
-+traversal type "leaf."
-+.Pp
-+Note: the names for the traversal types differ somewhat from
-+common parlance.  The traversal type "postorder" corresponds
-+to what would typically be referred to as in-order, and the
-+traversal type "endorder" corresponds to what would typically
-+be referred to as post-order.
- .Sh RETURN VALUES
- The
- .Fn tsearch
-@@ -121,7 +170,7 @@ and
- functions
- return NULL if
- .Fa rootp
--is NULL or the datum cannot be found.
-+is NULL or the node cannot be found.
- .Pp
- The
- .Fn twalk
diff --git a/stdlib/Makefile.inc b/stdlib/Makefile.inc
deleted file mode 100644 (file)
index c33b883..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-#      from @(#)Makefile.inc   8.3 (Berkeley) 2/4/95
-# $FreeBSD: src/lib/libc/stdlib/Makefile.inc,v 1.45 2003/04/05 07:33:46 tjr Exp $
-
-# machine-dependent stdlib sources
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc"
-
-# machine-independent stdlib sources
-.PATH: ${.CURDIR}/stdlib
-CWD := ${.CURDIR}/stdlib
-
-MISRCS+=a64l.c grantpt.c l64a.c
-.ifdef FEATURE_BLOCKS
-MISRCS+=qsort_b.c
-.endif # FEATURE_BLOCKS
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS=_Exit_.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
-       bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c getsubopt.c \
-       hcreate.c heapsort.c imaxabs.c imaxdiv.c insque.c labs.c \
-       ldiv.c llabs.c lldiv.c lsearch.c merge.c putenv.c qsort.c qsort_r.c \
-       radixsort.c rand.c random.c reallocf.c realpath.c remque.c setenv.c \
-       strhash.c strtoimax.c strtol.c strtoll.c strtoq.c strtoul.c \
-       strtoull.c strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c \
-       twalk.c
-FBSDHDRS= atexit.h
-.include "Makefile.fbsd_end"
-
-# special cases: heapsort_b-fbsd.c, merge_b-fbsd.c
-.for _file in heapsort merge
-.ifmake autopatch
-.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
-AUTOPATCHSRCS+= ${_cwd}/${_file}_b-fbsd.c
-${_cwd}/${_file}_b-fbsd.c: ${_cwd}/FreeBSD/${_file}.c
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${.ALLSRC:S/${_file}/${_file}_b/}.patch
-.endfor # _cwd
-.else # !autopatch
-.ifdef FEATURE_BLOCKS
-MISRCS+= ${_file}_b.c
-.endif # FEATURE_BLOCKS
-.endif # autopatch
-.endfor # _file
-
-# special cases: heapsort_r-fbsd.c
-.for _file in heapsort
-.ifmake autopatch
-.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
-AUTOPATCHSRCS+= ${_cwd}/${_file}_r-fbsd.c
-${_cwd}/${_file}_r-fbsd.c: ${_cwd}/FreeBSD/${_file}.c
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${.ALLSRC:S/${_file}/${_file}_r/}.patch
-.endfor # _cwd
-.else # !autopatch
-MISRCS+= ${_file}_r.c
-.endif # autopatch
-.endfor # _file
-
-# special cases: psort{,_b,_r}-fbsd.c psort.3
-.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
-.ifmake autopatch
-AUTOPATCHSRCS+= ${_cwd}/psort-fbsd.c
-${_cwd}/psort-fbsd.c: ${_cwd}/qsort-fbsd.c
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${_cwd}/psort.c.patch
-.for _file in psort_b psort_r
-AUTOPATCHSRCS+= ${_cwd}/${_file}-fbsd.c
-${_cwd}/${_file}-fbsd.c: ${_cwd}/psort-fbsd.c
-       ${LN} ${.ALLSRC} ${.TARGET}
-.endfor # _file
-AUTOPATCHMAN+= ${_cwd}/psort.3
-${_cwd}/psort.3: ${_cwd}/qsort.3
-       ${CP} ${.ALLSRC} ${.TARGET}
-       ${PATCH} ${.TARGET} ${_cwd}/psort.3.patch
-.else # !autopatch
-MISRCS+= psort.c psort_r.c
-CFLAGS-psort_r-fbsd.c += -DI_AM_PSORT_R
-.ifdef FEATURE_BLOCKS
-MISRCS+= psort_b.c
-CFLAGS-psort_b-fbsd.c += -DI_AM_PSORT_B
-.endif # FEATURE_BLOCKS
-.endif # autopatch
-.endfor # _cwd
-
-.include "Makefile.nbsd_begin"
-NBSDMISRCS = strfmon.c
-.include "Makefile.nbsd_end"
-
-# 4302056: compile qsort.c and bsearch.c with -fexceptions
-.for _src in qsort-fbsd.c bsearch-fbsd.c
-CFLAGS-${_src} += -fexceptions
-.endfor
-
-PRIV_INSTHDRS += ${SRCROOT}/stdlib/atexit.h
-
-.include "Makefile.obsd_begin"
-OBSDMISRCS=ecvt.c gcvt.c
-.include "Makefile.obsd_end"
-
-LEGACYSRCS+= getopt.c putenv.c realpath.c setenv.c system.c
-DARWINEXTSNSRCS += realpath.c
-CANCELABLESRCS += system.c
-DYLDSRCS += atexit.c exit.c gettimeofday.c heapsort.c merge.c qsort.c reallocf.c realpath.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-getopt-fbsd.c += -DLIBC_ALIAS_GETOPT
-CFLAGS-putenv-fbsd.c += -DLIBC_ALIAS_PUTENV
-CFLAGS-realpath-fbsd.c += -DLIBC_ALIAS_REALPATH
-CFLAGS-setenv-fbsd.c += -DLIBC_ALIAS_SETENV -DLIBC_ALIAS_UNSETENV
-CFLAGS-system-fbsd.c += -DLIBC_ALIAS_SYSTEM
-
-.if ${LIB} == "c"
-MAN3+= a64l.3 grantpt.3 psort.3
-MAN3+= strtod_l.3 strtol_l.3
-
-.include "Makefile.fbsd_begin"
-FBSDMAN3= abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \
-       div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \
-       hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \
-       lsearch.3 memory.3 qsort.3 radixsort.3 rand.3 random.3 realpath.3 \
-       strtod.3 strtol.3 strtoul.3 system.3 tsearch.3
-.include "Makefile.fbsd_end"
-
-.include "Makefile.nbsd_begin"
-NBSDMAN3= strfmon.3
-.include "Makefile.nbsd_end"
-
-.include "Makefile.obsd_begin"
-OBSDMAN3= ecvt.3
-.include "Makefile.obsd_end"
-
-MLINKS+= a64l.3 l64a.3
-
-.ifdef FEATURE_BLOCKS
-MLINKS+= atexit.3 atexit_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= atof.3 atof_l.3
-
-MLINKS+= atoi.3 atoi_l.3
-
-MLINKS+= atol.3 atol_l.3                       \
-         atol.3 atoll.3                                \
-         atol.3 atoll_l.3
-
-.ifdef FEATURE_BLOCKS
-MLINKS+= bsearch.3 bsearch_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= ecvt.3 fcvt.3                         \
-         ecvt.3 gcvt.3
-
-MLINKS+= exit.3 _Exit.3
-
-MLINKS+= getenv.3 putenv.3                     \
-         getenv.3 setenv.3                     \
-         getenv.3 unsetenv.3
-
-MLINKS+= getopt_long.3 getopt_long_only.3
-
-MLINKS+= grantpt.3 posix_openpt.3              \
-         grantpt.3 ptsname.3                   \
-         grantpt.3 unlockpt.3
-
-MLINKS+= hcreate.3 hdestroy.3                  \
-         hcreate.3 hsearch.3
-
-MLINKS+= insque.3 remque.3
-
-MLINKS+= lsearch.3 lfind.3
-
-MLINKS+= psort.3 psort_r.3
-.ifdef FEATURE_BLOCKS
-MLINKS+= psort.3 psort_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= qsort.3 heapsort.3                    \
-         qsort.3 mergesort.3                   \
-         qsort.3 qsort_r.3
-.ifdef FEATURE_BLOCKS
-MLINKS+= qsort.3 heapsort_b.3                  \
-         qsort.3 mergesort_b.3                 \
-         qsort.3 qsort_b.3
-.endif # FEATURE_BLOCKS
-
-MLINKS+= radixsort.3 sradixsort.3
-
-MLINKS+= rand.3 rand_r.3                       \
-         rand.3 srand.3                                \
-         rand.3 sranddev.3
-
-MLINKS+= random.3 initstate.3                  \
-         random.3 setstate.3                   \
-         random.3 srandom.3                    \
-         random.3 srandomdev.3
-
-MLINKS+=strfmon.3 strfmon_l.3
-
-MLINKS+= strtod.3 strtof.3                     \
-         strtod.3 strtold.3
-
-MLINKS+= strtod_l.3 strtof_l.3                 \
-         strtod_l.3 strtold_l.3
-
-MLINKS+= strtol.3 strtoll.3                    \
-         strtol.3 strtoq.3                     \
-         strtol.3 strtoimax.3
-
-MLINKS+= strtol_l.3 strtoimax_l.3              \
-         strtol_l.3 strtoll_l.3                        \
-         strtol_l.3 strtoq_l.3                 \
-         strtol_l.3 strtoul_l.3                        \
-         strtol_l.3 strtoull_l.3               \
-         strtol_l.3 strtoumax_l.3              \
-         strtol_l.3 strtouq_l.3
-
-MLINKS+= strtoul.3 strtoull.3                  \
-         strtoul.3 strtoumax.3                 \
-         strtoul.3 strtouq.3
-
-MLINKS+= tsearch.3 tdelete.3                   \
-         tsearch.3 tfind.3                     \
-         tsearch.3 twalk.3
-.endif
index 7d7fe40cb470254698f8781560e92fae2697a298..6b6976fec71185f176fefbc0cfdfb80531fe4acf 100644 (file)
 .Dt STRFMON 3
 .Os
 .Sh NAME
-.Nm strfmon
+.Nm strfmon ,
+.Nm strfmon_l
 .Nd convert monetary value to string
-.Sh LIBRARY
-.Lb libc
+.\" .Sh LIBRARY
+.\" .Lb libc
 .Sh SYNOPSIS
 .In monetary.h
 .Ft ssize_t
-.Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..."
+.Fo strfmon
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "const char *restrict format"
+.Fa "..."
+.Fc
+.In monetary.h
+.In xlocale.h
+.Ft ssize_t
+.Fo strfmon_l
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "locale_t loc"
+.Fa "const char *restrict format"
+.Fa "..."
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strfmon
 function places characters into the array pointed to by
-.Fa s
+.Fa s ,
 as controlled by the string pointed to by
 .Fa format .
 No more than
 .Fa maxsize
 bytes are placed into the array.
 .Pp
+While the
+.Fn strfmon
+function uses the current locale, the
+.Fn strfmon_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
+.Pp
 The format string is composed of zero or more directives:
 ordinary characters (not
 .Cm % ) ,
@@ -116,9 +140,9 @@ character is written.
 .El
 .El
 .Sh RETURN VALUES
-If the total number of resulting bytes including the terminating
+If the total number of resulting bytes, including the terminating
 .Dv NULL
-byte is not more than
+byte, is not more than
 .Fa maxsize ,
 .Fn strfmon
 returns the number of bytes placed into the array pointed to by
@@ -143,8 +167,23 @@ The format string is invalid.
 .It Bq Er ENOMEM
 Not enough memory for temporary buffers.
 .El
+.Sh EXAMPLE
+.Bd -literal -offset indent -compact
+  #include <stdio.h>
+  #include <monetary.h>
+  #include <locale.h>
+
+  int main() {
+          char buf[200];
+          setlocale(LC_ALL, "en_US");
+          (void)strfmon (buf, sizeof(buf)-1, "%n" , 123456.78);
+          printf("%s\n", buf);
+  }
+.Ed
+.Pp
 .Sh SEE ALSO
-.Xr localeconv 3
+.Xr localeconv 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strfmon
diff --git a/stdlib/NetBSD/strfmon.3.patch b/stdlib/NetBSD/strfmon.3.patch
deleted file mode 100644 (file)
index 1a72c21..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
---- strfmon.3.orig     2010-02-08 16:26:10.000000000 -0800
-+++ strfmon.3  2010-02-08 17:57:07.000000000 -0800
-@@ -30,25 +30,49 @@
- .Dt STRFMON 3
- .Os
- .Sh NAME
--.Nm strfmon
-+.Nm strfmon ,
-+.Nm strfmon_l
- .Nd convert monetary value to string
--.Sh LIBRARY
--.Lb libc
-+.\" .Sh LIBRARY
-+.\" .Lb libc
- .Sh SYNOPSIS
- .In monetary.h
- .Ft ssize_t
--.Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..."
-+.Fo strfmon
-+.Fa "char *restrict s"
-+.Fa "size_t maxsize"
-+.Fa "const char *restrict format"
-+.Fa "..."
-+.Fc
-+.In monetary.h
-+.In xlocale.h
-+.Ft ssize_t
-+.Fo strfmon_l
-+.Fa "char *restrict s"
-+.Fa "size_t maxsize"
-+.Fa "locale_t loc"
-+.Fa "const char *restrict format"
-+.Fa "..."
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strfmon
- function places characters into the array pointed to by
--.Fa s
-+.Fa s ,
- as controlled by the string pointed to by
- .Fa format .
- No more than
- .Fa maxsize
- bytes are placed into the array.
- .Pp
-+While the
-+.Fn strfmon
-+function uses the current locale, the
-+.Fn strfmon_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
-+.Pp
- The format string is composed of zero or more directives:
- ordinary characters (not
- .Cm % ) ,
-@@ -116,9 +140,9 @@ character is written.
- .El
- .El
- .Sh RETURN VALUES
--If the total number of resulting bytes including the terminating
-+If the total number of resulting bytes, including the terminating
- .Dv NULL
--byte is not more than
-+byte, is not more than
- .Fa maxsize ,
- .Fn strfmon
- returns the number of bytes placed into the array pointed to by
-@@ -143,8 +167,23 @@ The format string is invalid.
- .It Bq Er ENOMEM
- Not enough memory for temporary buffers.
- .El
-+.Sh EXAMPLE
-+.Bd -literal -offset indent -compact
-+  #include <stdio.h>
-+  #include <monetary.h>
-+  #include <locale.h>
-+
-+  int main() {
-+          char buf[200];
-+          setlocale(LC_ALL, "en_US");
-+          (void)strfmon (buf, sizeof(buf)-1, "%n" , 123456.78);
-+          printf("%s\n", buf);
-+  }
-+.Ed
-+.Pp
- .Sh SEE ALSO
--.Xr localeconv 3
-+.Xr localeconv 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn strfmon
index d53ed7f13e583328d84aeb8dfa47c8726e2b9510..2afa83568dab5e3ffc70d23a5e83a02a10b5898d 100644 (file)
@@ -41,6 +41,8 @@ __RCSID("$NetBSD: strfmon.c,v 1.7 2009/01/30 23:46:03 lukem Exp $");
 #include <monetary.h>
 #endif
 
+#include "xlocale_private.h"
+
 #include <sys/types.h>
 #include <ctype.h>
 #include <errno.h>
@@ -75,9 +77,9 @@ __RCSID("$NetBSD: strfmon.c,v 1.7 2009/01/30 23:46:03 lukem Exp $");
                PRINT(*tmps++);                                 \
 } while (/* CONSTCOND */ 0)
 
-#define GET_NUMBER(VAR)        do {                                    \
+#define GET_NUMBER(VAR,LOC)    do {                            \
        VAR = 0;                                                \
-       while (isdigit((unsigned char)*fmt)) {                  \
+       while (isdigit_l((unsigned char)*fmt, (LOC))) {                 \
                VAR *= 10;                                      \
                VAR += *fmt - '0';                              \
                if (VAR > 0x00ffffff)                           \
@@ -99,15 +101,13 @@ __RCSID("$NetBSD: strfmon.c,v 1.7 2009/01/30 23:46:03 lukem Exp $");
        groups++;                                               \
 } while (/* CONSTCOND */ 0)
 
-static void __setup_vars(int, char *, char *, char *, const char **);
-static int __calc_left_pad(int, char *);
-static char *__format_grouped_double(double, int *, int, int, int);
+static void __setup_vars(int, char *, char *, char *, const char **, struct lconv *);
+static int __calc_left_pad(int, char *, struct lconv *);
+static char *__format_grouped_double(double, int *, int, int, int, struct lconv *, locale_t);
 
-ssize_t
-strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
-    ...)
+static ssize_t
+_strfmon(char * __restrict s, size_t maxsize, locale_t loc, const char * __restrict format, va_list ap)
 {
-       va_list         ap;
        char            *dst;           /* output destination pointer */
        const char      *fmt;           /* current format poistion pointer */
        struct lconv    *lc;            /* pointer to lconv structure */
@@ -131,9 +131,7 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
        char            *tmpptr;        /* temporary vars */
        int             sverrno;
 
-        va_start(ap, format);
-
-       lc = localeconv();
+       lc = localeconv_l(loc);
        dst = s;
        fmt = format;
        asciivalue = NULL;
@@ -197,9 +195,9 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
                }
 
                /* field Width */
-               if (isdigit((unsigned char)*fmt)) {
+               if (isdigit_l((unsigned char)*fmt, loc)) {
                        ptrdiff_t d = dst - s;
-                       GET_NUMBER(width);
+                       GET_NUMBER(width, loc);
                        /* Do we have enough space to put number with
                         * required width ?
                         */
@@ -210,16 +208,16 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
 
                /* Left precision */
                if (*fmt == '#') {
-                       if (!isdigit((unsigned char)*++fmt))
+                       if (!isdigit_l((unsigned char)*++fmt, loc))
                                goto format_error;
-                       GET_NUMBER(left_prec);
+                       GET_NUMBER(left_prec, loc);
                }
 
                /* Right precision */
                if (*fmt == '.') {
-                       if (!isdigit((unsigned char)*++fmt))
+                       if (!isdigit_l((unsigned char)*++fmt, loc))
                                goto format_error;
-                       GET_NUMBER(right_prec);
+                       GET_NUMBER(right_prec, loc);
                }
 
                /* Conversion Characters */
@@ -239,8 +237,10 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
                        free(currency_symbol);
                if (flags & USE_INTL_CURRENCY) {
                        currency_symbol = strdup(lc->int_curr_symbol);
-                       if (currency_symbol != NULL)
+                       if (currency_symbol != NULL) {
                                space_char = *(currency_symbol+3);
+                               currency_symbol[3] = '\0';
+                       }
                } else
                        currency_symbol = strdup(lc->currency_symbol);
 
@@ -259,21 +259,21 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
                /* fill left_prec with amount of padding chars */
                if (left_prec >= 0) {
                        pad_size = __calc_left_pad((flags ^ IS_NEGATIVE),
-                                                       currency_symbol) -
-                                  __calc_left_pad(flags, currency_symbol);
+                                                       currency_symbol, lc) -
+                                  __calc_left_pad(flags, currency_symbol, lc);
                        if (pad_size < 0)
                                pad_size = 0;
                }
 
                asciivalue = __format_grouped_double(value, &flags,
-                               left_prec, right_prec, pad_char);
+                               left_prec, right_prec, pad_char, lc, loc);
                if (asciivalue == NULL)
                        goto end_error;         /* errno already set     */
                                                /* to ENOMEM by malloc() */
 
                /* set some variables for later use */
                __setup_vars(flags, &cs_precedes, &sep_by_space,
-                               &sign_posn, &signstr);
+                               &sign_posn, &signstr, lc);
 
                /*
                 * Description of some LC_MONETARY's values:
@@ -333,8 +333,11 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
                                } else if (sep_by_space == 1)
                                        PRINT(space_char);
                        }
-               } else if (sign_posn == 1)
+               } else if (sign_posn == 1) {
                        PRINTS(signstr);
+                       if (sep_by_space == 2)
+                               PRINT(' ');
+               }
 
                PRINTS(asciivalue);
 
@@ -368,8 +371,12 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
                        PRINTS(signstr);
                }
 
-               if (sign_posn == 0 && (flags & IS_NEGATIVE))
-                       PRINT(')');
+               if (sign_posn == 0) {
+                       if (flags & IS_NEGATIVE)
+                               PRINT(')');
+                       else if (left_prec >= 0)
+                               PRINT(' ');
+               }
 
                if (dst - tmpptr < width) {
                        if (flags & LEFT_JUSTIFY) {
@@ -386,7 +393,6 @@ strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
        }
 
        PRINT('\0');
-       va_end(ap);
        free(asciivalue);
        free(currency_symbol);
        return (dst - s - 1);   /* return size of put data except trailing '\0' */
@@ -405,14 +411,12 @@ end_error:
        if (currency_symbol != NULL)
                free(currency_symbol);
        errno = sverrno;
-       va_end(ap);
        return (-1);
 }
 
 static void
 __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
-               char *sign_posn, const char **signstr) {
-       struct lconv *lc = localeconv();
+               char *sign_posn, const char **signstr, struct lconv *lc) {
 
        if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
                *cs_precedes = lc->int_n_cs_precedes;
@@ -448,13 +452,13 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
 }
 
 static int
-__calc_left_pad(int flags, char *cur_symb) {
+__calc_left_pad(int flags, char *cur_symb, struct lconv *lc) {
 
        char cs_precedes, sep_by_space, sign_posn;
        const char *signstr;
        int left_chars = 0;
 
-       __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr);
+       __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr, lc);
 
        if (cs_precedes != 0) {
                left_chars += strlen(cur_symb);
@@ -463,6 +467,10 @@ __calc_left_pad(int flags, char *cur_symb) {
        }
 
        switch (sign_posn) {
+               case 0:
+                       if (flags & IS_NEGATIVE)
+                               left_chars++;
+                       break;
                case 1:
                        left_chars += strlen(signstr);
                        break;
@@ -498,9 +506,11 @@ get_groups(int size, char *grouping) {
 }
 
 /* convert double to ASCII */
+__private_extern__ const char *__fix_nogrouping(const char *);
+
 static char *
 __format_grouped_double(double value, int *flags,
-                       int left_prec, int right_prec, int pad_char) {
+                       int left_prec, int right_prec, int pad_char, struct lconv *lc, locale_t loc) {
 
        char            *rslt;
        char            *avalue;
@@ -512,14 +522,13 @@ __format_grouped_double(double value, int *flags,
 
        int             padded;
 
-       struct lconv    *lc = localeconv();
        char            *grouping;
        char            decimal_point;
        char            thousands_sep;
 
        int groups = 0;
 
-       grouping = lc->mon_grouping;
+       grouping = __fix_nogrouping(lc->mon_grouping);
        decimal_point = *lc->mon_decimal_point;
        if (decimal_point == '\0')
                decimal_point = *lc->decimal_point;
@@ -546,9 +555,9 @@ __format_grouped_double(double value, int *flags,
                left_prec += get_groups(left_prec, grouping);
 
        /* convert to string */
-       snprintf(fmt, sizeof(fmt), "%%%d.%df", left_prec + right_prec + 1,
+       snprintf_l(fmt, sizeof(fmt), loc, "%%%d.%df", left_prec + right_prec + 1,
            right_prec);
-       avalue_size = asprintf(&avalue, fmt, value);
+       avalue_size = asprintf_l(&avalue, loc, fmt, value);
        if (avalue_size < 0)
                return (NULL);
 
@@ -621,3 +630,30 @@ __format_grouped_double(double value, int *flags,
        free(avalue);
        return (rslt);
 }
+
+ssize_t
+strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
+    ...)
+{
+       ssize_t         ret;
+       va_list         ap;
+
+       va_start(ap, format);
+       ret = _strfmon(s, maxsize, __current_locale(), format, ap);
+       va_end(ap);
+       return ret;
+}
+
+ssize_t
+strfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
+    const char * __restrict format, ...)
+{
+       ssize_t         ret;
+       va_list         ap;
+
+       NORMALIZE_LOCALE(loc);
+       va_start(ap, format);
+       ret = _strfmon(s, maxsize, loc, format, ap);
+       va_end(ap);
+       return ret;
+}
diff --git a/stdlib/NetBSD/strfmon.c.patch b/stdlib/NetBSD/strfmon.c.patch
deleted file mode 100644 (file)
index 7e73ea7..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
---- strfmon.c.orig     2008-04-04 21:54:54.000000000 -0700
-+++ strfmon.c  2008-04-04 22:11:39.000000000 -0700
-@@ -41,6 +41,8 @@ __RCSID("$NetBSD: strfmon.c,v 1.6 2008/0
- #include <monetary.h>
- #endif
-+#include "xlocale_private.h"
-+
- #include <sys/types.h>
- #include <ctype.h>
- #include <errno.h>
-@@ -75,9 +77,9 @@ __RCSID("$NetBSD: strfmon.c,v 1.6 2008/0
-               PRINT(*tmps++);                                 \
- } while (/* CONSTCOND */ 0)
--#define GET_NUMBER(VAR)       do {                                    \
-+#define GET_NUMBER(VAR,LOC)   do {                            \
-       VAR = 0;                                                \
--      while (isdigit((unsigned char)*fmt)) {                  \
-+      while (isdigit_l((unsigned char)*fmt, (LOC))) {                 \
-               VAR *= 10;                                      \
-               VAR += *fmt - '0';                              \
-               if (VAR > 0x00ffffff)                           \
-@@ -99,15 +101,13 @@ __RCSID("$NetBSD: strfmon.c,v 1.6 2008/0
-       groups++;                                               \
- } while (/* CONSTCOND */ 0)
--static void __setup_vars(int, char *, char *, char *, const char **);
--static int __calc_left_pad(int, char *);
--static char *__format_grouped_double(double, int *, int, int, int);
-+static void __setup_vars(int, char *, char *, char *, const char **, struct lconv *);
-+static int __calc_left_pad(int, char *, struct lconv *);
-+static char *__format_grouped_double(double, int *, int, int, int, struct lconv *, locale_t);
--ssize_t
--strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
--    ...)
-+static ssize_t
-+_strfmon(char * __restrict s, size_t maxsize, locale_t loc, const char * __restrict format, va_list ap)
- {
--      va_list         ap;
-       char            *dst;           /* output destination pointer */
-       const char      *fmt;           /* current format poistion pointer */
-       struct lconv    *lc;            /* pointer to lconv structure */
-@@ -131,9 +131,7 @@ strfmon(char * __restrict s, size_t maxs
-       char            *tmpptr;        /* temporary vars */
-       int             sverrno;
--        va_start(ap, format);
--
--      lc = localeconv();
-+      lc = localeconv_l(loc);
-       dst = s;
-       fmt = format;
-       asciivalue = NULL;
-@@ -197,9 +195,9 @@ strfmon(char * __restrict s, size_t maxs
-               }
-               /* field Width */
--              if (isdigit((unsigned char)*fmt)) {
-+              if (isdigit_l((unsigned char)*fmt, loc)) {
-                       ptrdiff_t d = dst - s;
--                      GET_NUMBER(width);
-+                      GET_NUMBER(width, loc);
-                       /* Do we have enough space to put number with
-                        * required width ?
-                        */
-@@ -210,16 +208,16 @@ strfmon(char * __restrict s, size_t maxs
-               /* Left precision */
-               if (*fmt == '#') {
--                      if (!isdigit((unsigned char)*++fmt))
-+                      if (!isdigit_l((unsigned char)*++fmt, loc))
-                               goto format_error;
--                      GET_NUMBER(left_prec);
-+                      GET_NUMBER(left_prec, loc);
-               }
-               /* Right precision */
-               if (*fmt == '.') {
--                      if (!isdigit((unsigned char)*++fmt))
-+                      if (!isdigit_l((unsigned char)*++fmt, loc))
-                               goto format_error;
--                      GET_NUMBER(right_prec);
-+                      GET_NUMBER(right_prec, loc);
-               }
-               /* Conversion Characters */
-@@ -239,8 +237,10 @@ strfmon(char * __restrict s, size_t maxs
-                       free(currency_symbol);
-               if (flags & USE_INTL_CURRENCY) {
-                       currency_symbol = strdup(lc->int_curr_symbol);
--                      if (currency_symbol != NULL)
-+                      if (currency_symbol != NULL) {
-                               space_char = *(currency_symbol+3);
-+                              currency_symbol[3] = '\0';
-+                      }
-               } else
-                       currency_symbol = strdup(lc->currency_symbol);
-@@ -259,21 +259,21 @@ strfmon(char * __restrict s, size_t maxs
-               /* fill left_prec with amount of padding chars */
-               if (left_prec >= 0) {
-                       pad_size = __calc_left_pad((flags ^ IS_NEGATIVE),
--                                                      currency_symbol) -
--                                 __calc_left_pad(flags, currency_symbol);
-+                                                      currency_symbol, lc) -
-+                                 __calc_left_pad(flags, currency_symbol, lc);
-                       if (pad_size < 0)
-                               pad_size = 0;
-               }
-               asciivalue = __format_grouped_double(value, &flags,
--                              left_prec, right_prec, pad_char);
-+                              left_prec, right_prec, pad_char, lc, loc);
-               if (asciivalue == NULL)
-                       goto end_error;         /* errno already set     */
-                                               /* to ENOMEM by malloc() */
-               /* set some variables for later use */
-               __setup_vars(flags, &cs_precedes, &sep_by_space,
--                              &sign_posn, &signstr);
-+                              &sign_posn, &signstr, lc);
-               /*
-                * Description of some LC_MONETARY's values:
-@@ -333,8 +333,11 @@ strfmon(char * __restrict s, size_t maxs
-                               } else if (sep_by_space == 1)
-                                       PRINT(space_char);
-                       }
--              } else if (sign_posn == 1)
-+              } else if (sign_posn == 1) {
-                       PRINTS(signstr);
-+                      if (sep_by_space == 2)
-+                              PRINT(' ');
-+              }
-               PRINTS(asciivalue);
-@@ -368,8 +371,12 @@ strfmon(char * __restrict s, size_t maxs
-                       PRINTS(signstr);
-               }
--              if (sign_posn == 0 && (flags & IS_NEGATIVE))
--                      PRINT(')');
-+              if (sign_posn == 0) {
-+                      if (flags & IS_NEGATIVE)
-+                              PRINT(')');
-+                      else if (left_prec >= 0)
-+                              PRINT(' ');
-+              }
-               if (dst - tmpptr < width) {
-                       if (flags & LEFT_JUSTIFY) {
-@@ -386,7 +393,6 @@ strfmon(char * __restrict s, size_t maxs
-       }
-       PRINT('\0');
--      va_end(ap);
-       free(asciivalue);
-       free(currency_symbol);
-       return (dst - s - 1);   /* return size of put data except trailing '\0' */
-@@ -405,14 +411,12 @@ end_error:
-       if (currency_symbol != NULL)
-               free(currency_symbol);
-       errno = sverrno;
--      va_end(ap);
-       return (-1);
- }
- static void
- __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
--              char *sign_posn, const char **signstr) {
--      struct lconv *lc = localeconv();
-+              char *sign_posn, const char **signstr, struct lconv *lc) {
-       if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
-               *cs_precedes = lc->int_n_cs_precedes;
-@@ -448,13 +452,13 @@ __setup_vars(int flags, char *cs_precede
- }
- static int
--__calc_left_pad(int flags, char *cur_symb) {
-+__calc_left_pad(int flags, char *cur_symb, struct lconv *lc) {
-       char cs_precedes, sep_by_space, sign_posn;
-       const char *signstr;
-       int left_chars = 0;
--      __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr);
-+      __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr, lc);
-       if (cs_precedes != 0) {
-               left_chars += strlen(cur_symb);
-@@ -463,6 +467,10 @@ __calc_left_pad(int flags, char *cur_sym
-       }
-       switch (sign_posn) {
-+              case 0:
-+                      if (flags & IS_NEGATIVE)
-+                              left_chars++;
-+                      break;
-               case 1:
-                       left_chars += strlen(signstr);
-                       break;
-@@ -498,9 +506,11 @@ get_groups(int size, char *grouping) {
- }
- /* convert double to ASCII */
-+__private_extern__ const char *__fix_nogrouping(const char *);
-+
- static char *
- __format_grouped_double(double value, int *flags,
--                      int left_prec, int right_prec, int pad_char) {
-+                      int left_prec, int right_prec, int pad_char, struct lconv *lc, locale_t loc) {
-       char            *rslt;
-       char            *avalue;
-@@ -512,14 +522,13 @@ __format_grouped_double(double value, in
-       int             padded;
--      struct lconv    *lc = localeconv();
-       char            *grouping;
-       char            decimal_point;
-       char            thousands_sep;
-       int groups = 0;
--      grouping = lc->mon_grouping;
-+      grouping = __fix_nogrouping(lc->mon_grouping);
-       decimal_point = *lc->mon_decimal_point;
-       if (decimal_point == '\0')
-               decimal_point = *lc->decimal_point;
-@@ -546,9 +555,9 @@ __format_grouped_double(double value, in
-               left_prec += get_groups(left_prec, grouping);
-       /* convert to string */
--      snprintf(fmt, sizeof(fmt), "%%%d.%df", left_prec + right_prec + 1,
-+      snprintf_l(fmt, sizeof(fmt), loc, "%%%d.%df", left_prec + right_prec + 1,
-           right_prec);
--      avalue_size = asprintf(&avalue, fmt, value);
-+      avalue_size = asprintf_l(&avalue, loc, fmt, value);
-       if (avalue_size < 0)
-               return (NULL);
-@@ -621,3 +630,30 @@ __format_grouped_double(double value, in
-       free(avalue);
-       return (rslt);
- }
-+
-+ssize_t
-+strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
-+    ...)
-+{
-+      ssize_t         ret;
-+      va_list         ap;
-+
-+      va_start(ap, format);
-+      ret = _strfmon(s, maxsize, __current_locale(), format, ap);
-+      va_end(ap);
-+      return ret;
-+}
-+
-+ssize_t
-+strfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
-+    const char * __restrict format, ...)
-+{
-+      ssize_t         ret;
-+      va_list         ap;
-+
-+      NORMALIZE_LOCALE(loc);
-+      va_start(ap, format);
-+      ret = _strfmon(s, maxsize, loc, format, ap);
-+      va_end(ap);
-+      return ret;
-+}
index 0717a2c02a171ffb1e31af741a885816638d6485..d8d663eff963eb059d06268d514b37c61e8bdcbb 100644 (file)
@@ -31,9 +31,9 @@ string
 .Sh SYNOPSIS
 .Fd #include <stdlib.h>
 .Ft char *
-.Fn ecvt "double value" "int ndigit" "int *decpt" "int *sign"
+.Fn ecvt "double value" "int ndigit" "int * restrict decpt" "int * restrict sign"
 .Ft char *
-.Fn fcvt "double value" "int ndigit" "int *decpt" "int *sign"
+.Fn fcvt "double value" "int ndigit" "int * restrict decpt" "int * restrict sign"
 .Ft char *
 .Fn gcvt "double value" "int ndigit" "char *buf"
 .Sh DESCRIPTION
diff --git a/stdlib/OpenBSD/ecvt.3.patch b/stdlib/OpenBSD/ecvt.3.patch
deleted file mode 100644 (file)
index 63e8b3b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- ecvt.3.orig        Thu Jul  8 16:06:45 2004
-+++ ecvt.3     Thu Jul  8 17:54:49 2004
-@@ -31,9 +31,9 @@
- .Sh SYNOPSIS
- .Fd #include <stdlib.h>
- .Ft char *
--.Fn ecvt "double value" "int ndigit" "int *decpt" "int *sign"
-+.Fn ecvt "double value" "int ndigit" "int * restrict decpt" "int * restrict sign"
- .Ft char *
--.Fn fcvt "double value" "int ndigit" "int *decpt" "int *sign"
-+.Fn fcvt "double value" "int ndigit" "int * restrict decpt" "int * restrict sign"
- .Ft char *
- .Fn gcvt "double value" "int ndigit" "char *buf"
- .Sh DESCRIPTION
index 03ff918967729c64e06e8e81c69f032cf0702bf1..869674e9d988bfb8b9ec853071f9030303e74bea 100644 (file)
@@ -20,6 +20,7 @@
  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
  */
 
+#include <sys/cdefs.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -29,7 +30,7 @@ extern void  __freedtoa(char *);
 static char *__cvt(double, int, int *, int *, int, int);
 
 static char *
-__cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad)
+__cvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign, int fmode, int pad)
 {
        static char *s;
        char *p, *rve, c;
@@ -95,13 +96,13 @@ __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad)
 }
 
 char *
-ecvt(double value, int ndigit, int *decpt, int *sign)
+ecvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
 {
        return(__cvt(value, ndigit, decpt, sign, 0, 1));
 }
 
 char *
-fcvt(double value, int ndigit, int *decpt, int *sign)
+fcvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
 {
        return(__cvt(value, ndigit, decpt, sign, 1, 1));
 }
diff --git a/stdlib/OpenBSD/ecvt.c.patch b/stdlib/OpenBSD/ecvt.c.patch
deleted file mode 100644 (file)
index 96586f4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- ecvt.c.orig        2009-11-06 00:43:00.000000000 -0800
-+++ ecvt.c     2009-11-06 00:45:11.000000000 -0800
-@@ -20,6 +20,7 @@
-  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
-  */
-+#include <sys/cdefs.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -29,7 +30,7 @@ extern void  __freedtoa(char *);
- static char *__cvt(double, int, int *, int *, int, int);
- static char *
--__cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad)
-+__cvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign, int fmode, int pad)
- {
-       static char *s;
-       char *p, *rve, c;
-@@ -95,13 +96,13 @@ __cvt(double value, int ndigit, int *dec
- }
- char *
--ecvt(double value, int ndigit, int *decpt, int *sign)
-+ecvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
- {
-       return(__cvt(value, ndigit, decpt, sign, 0, 1));
- }
- char *
--fcvt(double value, int ndigit, int *decpt, int *sign)
-+fcvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
- {
-       return(__cvt(value, ndigit, decpt, sign, 1, 1));
- }
index e5488d912dd837790a9e72c70b927f947703e40c..703f78315461b7d6ef21accf85791dcb4d6fff28 100644 (file)
@@ -68,7 +68,7 @@ gcvt(double value, int ndigit, char *buf)
                        sign = 0;
                src = digits;
                *dst++ = *src++;
-               *dst++ = *lconv->decimal_point;
+               dst = stpcpy(dst, lconv->decimal_point);
                while (*src != '\0')
                        *dst++ = *src++;
                *dst++ = 'e';
@@ -101,7 +101,7 @@ gcvt(double value, int ndigit, char *buf)
                if (*src != '\0') {
                        if (src == digits)
                                *dst++ = '0';   /* zero before decimal point */
-                       *dst++ = *lconv->decimal_point;
+                       dst = stpcpy(dst, lconv->decimal_point);
                        for (i = decpt; digits[i] != '\0'; i++) {
                                *dst++ = digits[i];
                        }
diff --git a/stdlib/OpenBSD/gcvt.c.patch b/stdlib/OpenBSD/gcvt.c.patch
deleted file mode 100644 (file)
index 63377e9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- gcvt.c.orig        2009-11-06 00:45:45.000000000 -0800
-+++ gcvt.c     2009-11-06 00:52:51.000000000 -0800
-@@ -68,7 +68,7 @@ gcvt(double value, int ndigit, char *buf
-                       sign = 0;
-               src = digits;
-               *dst++ = *src++;
--              *dst++ = *lconv->decimal_point;
-+              dst = stpcpy(dst, lconv->decimal_point);
-               while (*src != '\0')
-                       *dst++ = *src++;
-               *dst++ = 'e';
-@@ -101,7 +101,7 @@ gcvt(double value, int ndigit, char *buf
-               if (*src != '\0') {
-                       if (src == digits)
-                               *dst++ = '0';   /* zero before decimal point */
--                      *dst++ = *lconv->decimal_point;
-+                      dst = stpcpy(dst, lconv->decimal_point);
-                       for (i = decpt; digits[i] != '\0'; i++) {
-                               *dst++ = digits[i];
-                       }
diff --git a/stdlib/_Exit_-fbsd.c b/stdlib/_Exit_-fbsd.c
deleted file mode 120000 (symlink)
index b2b392f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./_Exit_.c
\ No newline at end of file
diff --git a/stdlib/abort-fbsd.c b/stdlib/abort-fbsd.c
deleted file mode 100644 (file)
index 0fcbb9e..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)abort.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.11 2007/01/09 00:28:09 imp Exp $");
-
-#include "namespace.h"
-#include <signal.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-
-#include "CrashReporterClient.h"
-#include "_simple.h"
-
-extern void (*__cleanup)();
-extern void __abort(void) __dead2;
-
-#define TIMEOUT        10000   /* 10 milliseconds */
-
-void
-abort()
-{
-       struct sigaction act;
-
-       if (!CRGetCrashLogMessage())
-               CRSetCrashLogMessage("abort() called");
-
-       /*
-        * POSIX requires we flush stdio buffers on abort.
-        * XXX ISO C requires that abort() be async-signal-safe.
-        */
-       if (__cleanup)
-               (*__cleanup)();
-
-       sigfillset(&act.sa_mask);
-       /*
-        * Don't block SIGABRT to give any handler a chance; we ignore
-        * any errors -- ISO C doesn't allow abort to return anyway.
-        */
-       sigdelset(&act.sa_mask, SIGABRT);
-
-       /* <rdar://problem/7397932> abort() should call pthread_kill to deliver a signal to the aborting thread 
-        * This helps gdb focus on the thread calling abort()
-        */
-       if (__is_threaded) {
-           /* Block all signals on all other threads */
-           sigset_t fullmask;
-           sigfillset(&fullmask);
-           (void)_sigprocmask(SIG_SETMASK, &fullmask, NULL);
-
-           /* <rdar://problem/8400096> Set the workqueue killable */
-           __pthread_workqueue_setkill(1);
-
-           (void)pthread_sigmask(SIG_SETMASK, &act.sa_mask, NULL);
-           (void)pthread_kill(pthread_self(), SIGABRT);
-       } else {
-           (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-           (void)kill(getpid(), SIGABRT);
-       }
-       usleep(TIMEOUT); /* give time for signal to happen */
-
-       /*
-        * If SIGABRT was ignored, or caught and the handler returns, do
-        * it again, only harder.
-        */
-        __abort();
-}
-
-__private_extern__ void
-__abort()
-{
-       struct sigaction act;
-
-       if (!CRGetCrashLogMessage())
-               CRSetCrashLogMessage("__abort() called");
-       act.sa_handler = SIG_DFL;
-       act.sa_flags = 0;
-       sigfillset(&act.sa_mask);
-       (void)_sigaction(SIGABRT, &act, NULL);
-       sigdelset(&act.sa_mask, SIGABRT);
-
-       /* <rdar://problem/7397932> abort() should call pthread_kill to deliver a signal to the aborting thread 
-        * This helps gdb focus on the thread calling abort()
-        */
-       if (__is_threaded) {
-           /* Block all signals on all other threads */
-           sigset_t fullmask;
-           sigfillset(&fullmask);
-           (void)_sigprocmask(SIG_SETMASK, &fullmask, NULL);
-
-           /* <rdar://problem/8400096> Set the workqueue killable */
-           __pthread_workqueue_setkill(1);
-
-           (void)pthread_sigmask(SIG_SETMASK, &act.sa_mask, NULL);
-           (void)pthread_kill(pthread_self(), SIGABRT);
-       } else {
-           (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-           (void)kill(getpid(), SIGABRT);
-       }
-       usleep(TIMEOUT); /* give time for signal to happen */
-
-       /* If for some reason SIGABRT was not delivered, we exit using __builtin_trap
-        * which generates an illegal instruction on i386: <rdar://problem/8400958>
-        * and SIGTRAP on arm.
-        */
-       sigfillset(&act.sa_mask);
-       sigdelset(&act.sa_mask, SIGILL);
-       sigdelset(&act.sa_mask, SIGTRAP);
-       (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
-       __builtin_trap();
-}
-
-__private_extern__ void
-abort_report_np(const char *fmt, ...)
-{
-       _SIMPLE_STRING s;
-       va_list ap;
-
-       if ((s = _simple_salloc()) != NULL) {
-               va_start(ap, fmt);
-               _simple_vsprintf(s, fmt, ap);
-               va_end(ap);
-               CRSetCrashLogMessage(_simple_string(s));
-       } else
-               CRSetCrashLogMessage(fmt); /* the format string is better than nothing */
-       abort();
-}
diff --git a/stdlib/abort.3 b/stdlib/abort.3
deleted file mode 100644 (file)
index 80ed972..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)abort.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/abort.3,v 1.10 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt ABORT 3
-.Os
-.Sh NAME
-.Nm abort
-.Nd cause abnormal program termination
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft void
-.Fn abort void
-.Sh DESCRIPTION
-The
-.Fn abort
-function causes abnormal program termination to occur, unless the
-signal
-.Dv SIGABRT
-is being caught and the signal handler does not return.
-.Pp
-Any open streams are flushed and closed.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn abort
-function is thread-safe.
-It is unknown if it is async-cancel-safe.
-.Pp
-The
-.Fn abort
-function causes a report to be generated by Crash Reporter.  If you wish to
-terminate without generating a crash report, use
-.Xr exit 3
-instead.
-.Sh RETURN VALUES
-The
-.Fn abort
-function
-never returns.
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr exit 3
-.Sh STANDARDS
-The
-.Fn abort
-function
-conforms to
-.St -p1003.1-90 .
-The
-.Fn abort
-function also conforms to
-.St -isoC-99
-with the implementation specific details as noted above.
diff --git a/stdlib/abs-fbsd.c b/stdlib/abs-fbsd.c
deleted file mode 120000 (symlink)
index 9ff17c5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./abs.c
\ No newline at end of file
diff --git a/stdlib/abs.3 b/stdlib/abs.3
deleted file mode 100644 (file)
index 9dc5299..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)abs.3      8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/abs.3,v 1.13 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd November 14, 2001
-.Dt ABS 3
-.Os
-.Sh NAME
-.Nm abs
-.Nd integer absolute value function
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fn abs "int i"
-.Sh DESCRIPTION
-The
-.Fn abs
-function computes the absolute value of the integer
-.Fa i .
-.Sh RETURN VALUES
-The
-.Fn abs
-function
-returns
-the absolute value.
-.Sh SEE ALSO
-.Xr cabs 3 ,
-.Xr fabs 3 ,
-.Xr floor 3 ,
-.Xr hypot 3 ,
-.Xr imaxabs 3 ,
-.Xr labs 3 ,
-.Xr llabs 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn abs
-function conforms to
-.St -isoC-99 .
-.Sh BUGS
-The absolute value of the most negative integer remains negative.
diff --git a/stdlib/alloca.3 b/stdlib/alloca.3
deleted file mode 100644 (file)
index 492100a..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)alloca.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/alloca.3,v 1.13 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd September 5, 2006
-.Dt ALLOCA 3
-.Os
-.Sh NAME
-.Nm alloca
-.Nd memory allocator
-.Sh SYNOPSIS
-.In alloca.h
-or
-.br
-.In stdlib.h
-.Ft void *
-.Fn alloca "size_t size"
-.Sh DESCRIPTION
-The
-.Fn alloca
-macro
-allocates
-.Fa size
-bytes of space in the stack frame of the caller.
-This temporary space is automatically freed on
-return.
-.Sh RETURN VALUES
-.Fn alloca
-returns a pointer to the beginning of the allocated space.
-.Sh SEE ALSO
-.Xr brk 2 ,
-.Xr calloc 3 ,
-.Xr getpagesize 3 ,
-.Xr malloc 3 ,
-.Xr realloc 3
-.Sh HISTORY
-.Fn alloca
-appeared in
-.At 32v .
-.\" .Bx ?? .
-.\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
-.\" The first man page (or link to a man page that I can find at the
-.\" moment is 4.3...
-.Sh BUGS
-.Fn alloca
-is machine and compiler dependent;
-its use is discouraged.
-.Pp
-.Fn alloca
-is slightly unsafe because it cannot ensure that the pointer
-returned points to a valid and usable block of memory.
-The allocation made may exceed the bounds of the stack, or even go
-further into other objects in memory, and
-.Fn alloca
-cannot determine such an error.
-Avoid
-.Fn alloca
-with large unbounded allocations.
-.Pp
-The use of C99 variable-length arrays and
-.Fn alloca
-in the same function will cause the lifetime of alloca's storage to be limited to the block containing the
-.Fn alloca
diff --git a/stdlib/atexit-fbsd.c b/stdlib/atexit-fbsd.c
deleted file mode 100644 (file)
index 6acc776..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atexit.c   8.2 (Berkeley) 7/3/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/atexit.c,v 1.8 2007/01/09 00:28:09 imp Exp $");
-
-#include "namespace.h"
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <pthread.h>
-#if defined(__DYNAMIC__) || defined (__BLOCKS__)
-#include <dlfcn.h>
-#endif /* defined(__DYNAMIC__) */
-#include "atexit.h"
-#include "un-namespace.h"
-
-#ifdef __BLOCKS__
-#include <Block.h>
-#endif /* __BLOCKS__ */
-#include "libc_private.h"
-
-#define        ATEXIT_FN_EMPTY 0
-#define        ATEXIT_FN_STD   1
-#define        ATEXIT_FN_CXA   2
-#ifdef __BLOCKS__
-#define        ATEXIT_FN_BLK   3
-#endif /* __BLOCKS__ */
-
-static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-#define _MUTEX_LOCK(x)         if (__isthreaded) _pthread_mutex_lock(x)
-#define _MUTEX_UNLOCK(x)       if (__isthreaded) _pthread_mutex_unlock(x)
-
-struct atexit {
-       struct atexit *next;                    /* next in list */
-       int ind;                                /* next index in this table */
-       struct atexit_fn {
-               int fn_type;                    /* ATEXIT_? from above */
-               union {
-                       void (*std_func)(void);
-                       void (*cxa_func)(void *);
-#ifdef __BLOCKS__
-                       void (^block)(void);
-#endif /* __BLOCKS__ */
-               } fn_ptr;                       /* function pointer */
-               void *fn_arg;                   /* argument for CXA callback */
-               void *fn_dso;                   /* shared module handle */
-       } fns[ATEXIT_SIZE];                     /* the table itself */
-};
-
-static struct atexit *__atexit;                /* points to head of LIFO stack */
-static int new_registration;
-
-/*
- * Register the function described by 'fptr' to be called at application
- * exit or owning shared object unload time. This is a helper function
- * for atexit and __cxa_atexit.
- */
-static int
-atexit_register(struct atexit_fn *fptr)
-{
-       static struct atexit __atexit0; /* one guaranteed table */
-       struct atexit *p;
-
-       _MUTEX_LOCK(&atexit_mutex);
-       if ((p = __atexit) == NULL)
-               __atexit = p = &__atexit0;
-       else while (p->ind >= ATEXIT_SIZE) {
-               struct atexit *old__atexit;
-               old__atexit = __atexit;
-               _MUTEX_UNLOCK(&atexit_mutex);
-               if ((p = (struct atexit *)malloc(sizeof(*p))) == NULL)
-                       return (-1);
-               _MUTEX_LOCK(&atexit_mutex);
-               if (old__atexit != __atexit) {
-                       /* Lost race, retry operation */
-                       _MUTEX_UNLOCK(&atexit_mutex);
-                       free(p);
-                       _MUTEX_LOCK(&atexit_mutex);
-                       p = __atexit;
-                       continue;
-               }
-               p->ind = 0;
-               p->next = __atexit;
-               __atexit = p;
-       }
-       p->fns[p->ind++] = *fptr;
-       new_registration = 1;
-       _MUTEX_UNLOCK(&atexit_mutex);
-       return 0;
-}
-
-/*
- * Register a function to be performed at exit.
- */
-int
-atexit(void (*func)(void))
-{
-       struct atexit_fn fn;
-       struct dl_info info;
-       int error;
-
-       fn.fn_type = ATEXIT_FN_STD;
-       fn.fn_ptr.std_func = func;
-       fn.fn_arg = NULL;
-#if defined(__DYNAMIC__)
-       if ( dladdr(func, &info) )
-               fn.fn_dso = info.dli_fbase;
-       else 
-               fn.fn_dso = NULL;
-#else /* ! defined(__DYNAMIC__) */
-       fn.fn_dso = NULL;
-#endif /* defined(__DYNAMIC__) */
-
-       error = atexit_register(&fn);   
-       return (error);
-}
-
-#ifdef __BLOCKS__
-int
-atexit_b(void (^block)(void))
-{
-       struct atexit_fn fn;
-       struct dl_info info;
-       int error;
-
-       fn.fn_type = ATEXIT_FN_BLK;
-       fn.fn_ptr.block = Block_copy(block);
-       fn.fn_arg = NULL;
-#if defined(__DYNAMIC__)
-       if ( dladdr(block, &info) )
-               fn.fn_dso = info.dli_fbase;
-       else 
-               fn.fn_dso = NULL;
-#else /* ! defined(__DYNAMIC__) */
-       fn.fn_dso = NULL;
-#endif /* defined(__DYNAMIC__) */
-
-       error = atexit_register(&fn);   
-       return (error);
-}
-#endif /* __BLOCKS__ */
-
-/*
- * Register a function to be performed at exit or when an shared object
- * with given dso handle is unloaded dynamically.
- */
-int
-__cxa_atexit(void (*func)(void *), void *arg, void *dso)
-{
-       struct atexit_fn fn;
-       int error;
-
-       fn.fn_type = ATEXIT_FN_CXA;
-       fn.fn_ptr.cxa_func = func;;
-       fn.fn_arg = arg;
-       fn.fn_dso = dso;
-
-       error = atexit_register(&fn);   
-       return (error);
-}
-
-/*
- * Call all handlers registered with __cxa_atexit for the shared
- * object owning 'dso'.  Note: if 'dso' is NULL, then all remaining
- * handlers are called.
- */
-void
-__cxa_finalize(const void *dso)
-{
-       struct atexit *p;
-       struct atexit_fn fn;
-       int n;
-
-       _MUTEX_LOCK(&atexit_mutex);
-restart:
-       for (p = __atexit; p; p = p->next) {
-               for (n = p->ind; --n >= 0;) {
-                       if (p->fns[n].fn_type == ATEXIT_FN_EMPTY)
-                               continue; /* already been called */
-                       if (dso != NULL && dso != p->fns[n].fn_dso)
-                               continue; /* wrong DSO */
-                       fn = p->fns[n];
-                       /*
-                         Mark entry to indicate that this particular handler
-                         has already been called.
-                       */
-                       p->fns[n].fn_type = ATEXIT_FN_EMPTY;
-                       new_registration = 0;
-                       _MUTEX_UNLOCK(&atexit_mutex);
-               
-                       /* Call the function of correct type. */
-                       if (fn.fn_type == ATEXIT_FN_CXA)
-                               fn.fn_ptr.cxa_func(fn.fn_arg);
-                       else if (fn.fn_type == ATEXIT_FN_STD)
-                               fn.fn_ptr.std_func();
-#ifdef __BLOCKS__
-                       else if (fn.fn_type == ATEXIT_FN_BLK)
-                               fn.fn_ptr.block();
-#endif /* __BLOCKS__ */
-                       _MUTEX_LOCK(&atexit_mutex);
-                       if (new_registration)
-                           goto restart;
-               }
-       }
-       _MUTEX_UNLOCK(&atexit_mutex);
-}
diff --git a/stdlib/atexit.3 b/stdlib/atexit.3
deleted file mode 100644 (file)
index b3d978b..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)atexit.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.11 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd May 20, 2008
-.Dt ATEXIT 3
-.Os
-.Sh NAME
-.Nm atexit
-.Nd register a function to be called on exit
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fn atexit "void (*func)(void)"
-#ifdef UNIFDEF_BLOCKS
-.Ft int
-.Fn atexit_b "void (^block)(void)"
-#endif
-.Sh DESCRIPTION
-The
-.Fn atexit
-function
-registers the function
-.Fa func
-to be called at program exit, whether via
-.Xr exit 3
-or via return from the program's
-.Fn main .
-Functions so registered are called in reverse order;
-no arguments are passed.
-#ifdef UNIFDEF_BLOCKS
-.Pp
-The
-.Fn atexit_b
-function is like
-.Fn atexit
-except the callback is a block pointer instead of a function pointer.
-.Bd -ragged -offset indent
-Note: The
-.Fn Block_copy
-function (defined in
-.In Blocks.h )
-is used by
-.Fn atexit_b
-to make a copy of the block, especially for the case when a stack-based
-block might go out of scope when the subroutine returns.
-.Ed
-#endif
-.Pp
-These callbacks must not call
-.Fn exit ;
-if it should be necessary to terminate the process while in such a
-function, the
-.Xr _exit 2
-function should be used.
-(Alternatively, the callbacks may cause abnormal
-process termination, for example by calling
-.Xr abort 3 . )
-.Pp
-At least 32 callbacks can always be registered;
-more are allowed as long as sufficient memory can be allocated.
-.\" XXX {ATEXIT_MAX} is not implemented yet
-.Sh RETURN VALUES
-#ifdef UNIFDEF_BLOCKS
-.ds ATEXIT_B atexit_b
-#endif
-.Rv -std atexit \*[ATEXIT_B]
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er ENOMEM
-No memory was available to add the function to the list.
-The existing list of functions is unmodified.
-.El
-.Sh SEE ALSO
-.Xr exit 3
-.Sh STANDARDS
-The
-.Fn atexit
-function
-conforms to
-.St -isoC .
diff --git a/stdlib/atexit.h b/stdlib/atexit.h
deleted file mode 100644 (file)
index 56220ef..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     @(#)atexit.h    8.2 (Berkeley) 7/3/94
- * $FreeBSD: src/lib/libc/stdlib/atexit.h,v 1.4 2007/01/09 00:28:09 imp Exp $
- */
-
-/* must be at least 32 to guarantee ANSI conformance */
-#define        ATEXIT_SIZE     32
-
-void __cxa_finalize(const void *dso);
diff --git a/stdlib/atof-fbsd.c b/stdlib/atof-fbsd.c
deleted file mode 100644 (file)
index fff3e7d..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atof.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/atof.c,v 1.6 2007/01/09 00:28:09 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-
-double
-atof(ascii)
-       const char *ascii;
-{
-       return strtod_l(ascii, (char **)NULL, __current_locale());
-}
-
-double
-atof_l(ascii, loc)
-       const char *ascii;
-       locale_t loc;
-{
-       /* no need to call NORMALIZE_LOCALE(loc) because strtod_l will */
-       return strtod_l(ascii, (char **)NULL, loc);
-}
diff --git a/stdlib/atof.3 b/stdlib/atof.3
deleted file mode 100644 (file)
index 28f0870..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)atof.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/atof.3,v 1.17 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt ATOF 3
-.Os
-.Sh NAME
-.Nm atof ,
-.Nm atof_l
-.Nd convert
-.Tn ASCII
-string to double
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft double
-.Fn atof "const char *str"
-.In xlocale.h
-.Ft double
-.Fn atof_l "const char *str" "locale_t loc"
-.Sh DESCRIPTION
-The
-.Fn atof
-function converts the initial portion of the string pointed to by
-.Fa str
-to
-.Vt double
-representation.
-.Pp
-It is equivalent to:
-.Bd -literal -offset indent
-strtod(str, (char **)NULL);
-.Ed
-.Pp
-The decimal point
-character is defined in the program's locale (category
-.Dv LC_NUMERIC ) .
-.Pp
-While the
-.Fn atof
-function uses the current locale, the
-.Fn atof_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn atof
-and
-.Fn atof_l
-functions are thread-safe and async-cancel-safe.
-.Pp
-The
-.Fn atof
-and
-.Fn atof_l
-functions have been deprecated by
-.Fn strtod
-and
-.Fn strtod_l
-and should not be used in new code.
-.Sh ERRORS
-The function
-.Fn atof
-need not affect the value of
-.Va errno
-on an error.
-.Sh SEE ALSO
-.Xr atoi 3 ,
-.Xr atol 3 ,
-.Xr strtod 3 ,
-.Xr strtol 3 ,
-.Xr strtoul 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn atof
-function conforms to
-.St -p1003.1-90 ,
-.St -isoC ,
-and
-.St -isoC-99 .
diff --git a/stdlib/atoi-fbsd.c b/stdlib/atoi-fbsd.c
deleted file mode 100644 (file)
index ac6fcca..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atoi.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/atoi.c,v 1.6 2007/01/09 00:28:09 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-
-int
-atoi(str)
-       const char *str;
-{
-       return (int)strtol_l(str, (char **)NULL, 10, __current_locale());
-}
-
-int
-atoi_l(str, loc)
-       const char *str;
-       locale_t loc;
-{
-       /* no need to call NORMALIZE_LOCALE(loc) because strtol_l will */
-       return (int)strtol_l(str, (char **)NULL, 10, loc);
-}
diff --git a/stdlib/atoi.3 b/stdlib/atoi.3
deleted file mode 100644 (file)
index 3dc33e8..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)atoi.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/atoi.3,v 1.14 2007/10/19 06:23:39 davidxu Exp $
-.\"
-.Dd June 4, 1993
-.Dt ATOI 3
-.Os
-.Sh NAME
-.Nm atoi ,
-.Nm atoi_l
-.Nd convert
-.Tn ASCII
-string to integer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fn atoi "const char *str"
-.In xlocale.h
-.Ft int
-.Fn atoi_l "const char *str" "locale_t loc"
-.Sh DESCRIPTION
-The
-.Fn atoi
-function converts the initial portion of the string pointed to by
-.Fa str
-to
-.Vt int
-representation.
-.Pp
-It is equivalent to:
-.Bd -literal -offset indent
-(int)strtol(str, (char **)NULL, 10);
-.Ed
-.Pp
-While the
-.Fn atoi
-function uses the current locale, the
-.Fn atoi_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn atoi
-and
-.Fn atoi_l
-functions are thread-safe and async-cancel-safe.
-.Pp
-The
-.Fn atoi
-and
-.Fn atoi_l
-functions have been deprecated by
-.Fn strtol
-and
-.Fn strtol_l
-and should not be used in new code.
-.Sh ERRORS
-The function
-.Fn atoi
-need not affect the value of
-.Va errno
-on an error.
-.Sh SEE ALSO
-.Xr atof 3 ,
-.Xr atol 3 ,
-.Xr strtod 3 ,
-.Xr strtol 3 ,
-.Xr strtoul 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn atoi
-function conforms to
-.St -p1003.1-90 ,
-.St -isoC ,
-and
-.St -isoC-99 .
diff --git a/stdlib/atol-fbsd.c b/stdlib/atol-fbsd.c
deleted file mode 100644 (file)
index 5e52d95..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atol.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-
-long
-atol(str)
-       const char *str;
-{
-       return strtol_l(str, (char **)NULL, 10, __current_locale());
-}
-
-long
-atol_l(str, loc)
-       const char *str;
-       locale_t loc;
-{
-       /* no need to call NORMALIZE_LOCALE(loc) because strtol_l will */
-       return strtol_l(str, (char **)NULL, 10, loc);
-}
diff --git a/stdlib/atol.3 b/stdlib/atol.3
deleted file mode 100644 (file)
index 2c21151..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)atol.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/atol.3,v 1.16 2009/03/01 05:44:28 delphij Exp $
-.\"
-.Dd February 1, 2009
-.Dt ATOL 3
-.Os
-.Sh NAME
-.Nm atol , atoll ,
-.Nm atol_l , atoll_l
-.Nd convert
-.Tn ASCII
-string to
-.Vt long
-or
-.Vt "long long"
-integer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft long
-.Fn atol "const char *str"
-.Ft "long long"
-.Fn atoll "const char *str"
-.In xlocale.h
-.Ft long
-.Fn atol_l "const char *str" "locale_t loc"
-.Ft "long long"
-.Fn atoll_l "const char *str" "locale_t loc"
-.Sh DESCRIPTION
-The
-.Fn atol
-function converts the initial portion of the string pointed to by
-.Fa str
-to
-.Vt long
-integer
-representation.
-.Pp
-It is equivalent to:
-.Pp
-.Dl "strtol(str, (char **)NULL, 10);"
-.Pp
-The
-.Fn atoll
-function converts the initial portion of the string pointed to by
-.Fa str
-to
-.Vt "long long"
-integer
-representation.
-.Pp
-It is equivalent to:
-.Pp
-.Dl "strtoll(str, (char **)NULL, 10);"
-.Pp
-While the
-.Fn atol
-and
-.Fn atoll
-functions use the current locale, the
-.Fn atol_l
-and
-.Fn atoll_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn atol ,
-.Fn atoll ,
-.Fn atol_l ,
-and
-.Fn atoll_l
-functions are thread-safe and async-cancel-safe.
-.Pp
-The
-.Fx
-implementations of the
-.Fn atol
-and
-.Fn atoll
-functions are thin wrappers around
-.Fn strtol
-and
-.Fn stroll
-respectively, so these functions will affect the value of
-.Va errno
-in the same way that the
-.Fn strtol
-and
-.Fn stroll
-functions are able to.
-This behavior of
-.Fn atol
-and
-.Fn atoll
-is not required by
-.St -isoC
-or
-.St -isoC-99 ,
-but it is allowed by all of
-.St -isoC , St -isoC-99
-and
-.St -p1003.1-2001 .
-.Sh ERRORS
-The functions
-.Fn atol
-and
-.Fn atoll
-may affect the value of
-.Va errno
-on an error.
-.Sh SEE ALSO
-.Xr atof 3 ,
-.Xr atoi 3 ,
-.Xr strtod 3 ,
-.Xr strtol 3 ,
-.Xr strtoul 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn atol
-function
-conforms to
-.St -isoC .
-The
-.Fn atoll
-function
-conforms to
-.St -isoC-99 .
diff --git a/stdlib/atoll-fbsd.c b/stdlib/atoll-fbsd.c
deleted file mode 100644 (file)
index c25a4da..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/atoll.c,v 1.5 2007/01/09 00:28:09 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-
-long long
-atoll(str)
-       const char *str;
-{
-       return strtoll_l(str, (char **)NULL, 10, __current_locale());
-}
-
-long long
-atoll_l(str, loc)
-       const char *str;
-       locale_t loc;
-{
-       /* no need to call NORMALIZE_LOCALE(loc) because strtoll_l will */
-       return strtoll_l(str, (char **)NULL, 10, loc);
-}
diff --git a/stdlib/bsearch-fbsd.c b/stdlib/bsearch-fbsd.c
deleted file mode 100644 (file)
index 6af4291..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bsearch.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/bsearch.c,v 1.4 2007/01/09 00:28:09 imp Exp $");
-
-#include <stddef.h>
-#include <stdlib.h>
-
-/*
- * Perform a binary search.
- *
- * The code below is a bit sneaky.  After a comparison fails, we
- * divide the work in half by moving either left or right. If lim
- * is odd, moving left simply involves halving lim: e.g., when lim
- * is 5 we look at item 2, so we change lim to 2 so that we will
- * look at items 0 & 1.  If lim is even, the same applies.  If lim
- * is odd, moving right again involes halving lim, this time moving
- * the base up one item past p: e.g., when lim is 5 we change base
- * to item 3 and make lim 2 so that we will look at items 3 and 4.
- * If lim is even, however, we have to shrink it by one before
- * halving: e.g., when lim is 4, we still looked at item 2, so we
- * have to make lim 3, then halve, obtaining 1, so that we will only
- * look at item 3.
- */
-void *
-bsearch(key, base0, nmemb, size, compar)
-       const void *key;
-       const void *base0;
-       size_t nmemb;
-       size_t size;
-       int (*compar)(const void *, const void *);
-{
-       const char *base = base0;
-       size_t lim;
-       int cmp;
-       const void *p;
-
-       for (lim = nmemb; lim != 0; lim >>= 1) {
-               p = base + (lim >> 1) * size;
-               cmp = (*compar)(key, p);
-               if (cmp == 0)
-                       return ((void *)p);
-               if (cmp > 0) {  /* key > p: move right */
-                       base = (char *)p + size;
-                       lim--;
-               }               /* else move left */
-       }
-       return (NULL);
-}
-
-#ifdef __BLOCKS__
-void *
-bsearch_b(key, base0, nmemb, size, compar)
-       const void *key;
-       const void *base0;
-       size_t nmemb;
-       size_t size;
-       int (^compar)(const void *, const void *);
-{
-       const char *base = base0;
-       size_t lim;
-       int cmp;
-       const void *p;
-
-       for (lim = nmemb; lim != 0; lim >>= 1) {
-               p = base + (lim >> 1) * size;
-               cmp = compar(key, p);
-               if (cmp == 0)
-                       return ((void *)p);
-               if (cmp > 0) {  /* key > p: move right */
-                       base = (char *)p + size;
-                       lim--;
-               }               /* else move left */
-       }
-       return (NULL);
-}
-#endif /* __BLOCKS__ */
diff --git a/stdlib/bsearch.3 b/stdlib/bsearch.3
deleted file mode 100644 (file)
index 857f800..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993, 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)bsearch.3  8.3 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/stdlib/bsearch.3,v 1.9 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd May 20, 2008
-.Dt BSEARCH 3
-.Os
-.Sh NAME
-#ifdef UNIFDEF_BLOCKS
-.Nm bsearch ,
-.Nm bsearch_b
-#else
-.Nm bsearch
-#endif
-.Nd binary search of a sorted table
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft void *
-.Fn bsearch "const void *key" "const void *base" "size_t nel" "size_t width" "int (*compar) (const void *, const void *)"
-#ifdef UNIFDEF_BLOCKS
-.Ft void *
-.Fn bsearch_b "const void *key" "const void *base" "size_t nel" "size_t width" "int (^compar) (const void *, const void *)"
-#endif
-.Sh DESCRIPTION
-The
-.Fn bsearch
-function searches an array of
-.Fa nel
-objects, the initial member of which is
-pointed to by
-.Fa base ,
-for a member that matches the object pointed to by
-.Fa key .
-The size (in bytes) of each member of the array is specified by
-.Fa width .
-.Pp
-The contents of the array should be in ascending sorted order according
-to the comparison function referenced by
-.Fa compar .
-The
-.Fa compar
-routine
-is expected to have
-two arguments which point to the
-.Fa key
-object and to an array member, in that order.
-It should return an integer which is
-less than, equal to, or greater than zero if the
-.Fa key
-object is found, respectively, to be less than, to match, or be
-greater than the array member.
-#ifdef UNIFDEF_BLOCKS
-.Pp
-The
-.Fn bsearch_b
-function is like
-.Fn bsearch
-except the callback
-.Fa compar
-is a block pointer instead of a function pointer.
-#endif
-.Sh RETURN VALUES
-The
-.Fn bsearch
-#ifdef UNIFDEF_BLOCKS
-and
-.Fn bsearch_b
-functions
-#else
-function
-#endif
-returns a pointer to a matching member of the array, or a null
-pointer if no match is found.
-If two members compare as equal, which member is matched is unspecified.
-.Sh SEE ALSO
-.Xr db 3 ,
-.Xr lsearch 3 ,
-.Xr qsort 3
-.\" .Xr tsearch 3
-.Sh STANDARDS
-The
-.Fn bsearch
-function conforms to
-.St -isoC .
diff --git a/stdlib/div-fbsd.c b/stdlib/div-fbsd.c
deleted file mode 120000 (symlink)
index 9fce9b8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./div.c
\ No newline at end of file
diff --git a/stdlib/div.3 b/stdlib/div.3
deleted file mode 100644 (file)
index 4a5bd35..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)div.3      8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/div.3,v 1.9 2007/01/09 00:28:09 imp Exp $
-.\"
-.Dd November 14, 2001
-.Dt DIV 3
-.Os
-.Sh NAME
-.Nm div
-.Nd return quotient and remainder from division
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft div_t
-.Fn div "int numer" "int denom"
-.Sh DESCRIPTION
-The
-.Fn div
-function
-computes the value
-.Fa numer/denom
-(numerator/denominator).
-It returns a structure named
-.Fa div_t
-that contains two
-.Vt int
-members named
-.Va quot
-(quotient) and
-.Va rem
-(remainder).
-.Sh SEE ALSO
-.Xr imaxdiv 3 ,
-.Xr ldiv 3 ,
-.Xr lldiv 3
-.Sh STANDARDS
-The
-.Fn div
-function
-conforms to
-.St -isoC-99 .
diff --git a/stdlib/ecvt-obsd.c b/stdlib/ecvt-obsd.c
deleted file mode 100644 (file)
index 869674e..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*     $OpenBSD: ecvt.c,v 1.7 2009/10/16 12:15:03 martynas Exp $       */
-
-/*
- * Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Sponsored in part by the Defense Advanced Research Projects
- * Agency (DARPA) and Air Force Research Laboratory, Air Force
- * Materiel Command, USAF, under agreement number F39502-99-1-0512.
- */
-
-#include <sys/cdefs.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-extern char *__dtoa(double, int, int, int *, int *, char **);
-extern void  __freedtoa(char *);
-static char *__cvt(double, int, int *, int *, int, int);
-
-static char *
-__cvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign, int fmode, int pad)
-{
-       static char *s;
-       char *p, *rve, c;
-       size_t siz;
-
-       if (ndigit == 0) {
-               *sign = value < 0.0;
-               *decpt = 0;
-               return ("");
-       }
-
-       if (s) {
-               free(s);
-               s = NULL;
-       }
-
-       if (ndigit < 0)
-               siz = -ndigit + 1;
-       else
-               siz = ndigit + 1;
-
-
-       /* __dtoa() doesn't allocate space for 0 so we do it by hand */
-       if (value == 0.0) {
-               *decpt = 1 - fmode;     /* 1 for 'e', 0 for 'f' */
-               *sign = 0;
-               if ((rve = s = (char *)malloc(siz)) == NULL)
-                       return(NULL);
-               *rve++ = '0';
-               *rve = '\0';
-       } else {
-               p = __dtoa(value, fmode + 2, ndigit, decpt, sign, &rve);
-               if (p == NULL)
-                       return (NULL);
-               if (*decpt == 9999) {
-                       /* Infinity or Nan, convert to inf or nan like printf */
-                       *decpt = 0;
-                       c = *p;
-                       __freedtoa(p);
-                       return(c == 'I' ? "inf" : "nan");
-               }
-               /* Make a local copy and adjust rve to be in terms of s */
-               if (pad && fmode)
-                       siz += *decpt;
-               if ((s = (char *)malloc(siz)) == NULL) {
-                       __freedtoa(p);
-                       return(NULL);
-               }
-               (void) strlcpy(s, p, siz);
-               rve = s + (rve - p);
-               __freedtoa(p);
-       }
-
-       /* Add trailing zeros */
-       if (pad) {
-               siz -= rve - s;
-               while (--siz)
-                       *rve++ = '0';
-               *rve = '\0';
-       }
-
-       return(s);
-}
-
-char *
-ecvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
-{
-       return(__cvt(value, ndigit, decpt, sign, 0, 1));
-}
-
-char *
-fcvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
-{
-       return(__cvt(value, ndigit, decpt, sign, 1, 1));
-}
diff --git a/stdlib/ecvt.3 b/stdlib/ecvt.3
deleted file mode 100644 (file)
index d8d663e..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-.\" $OpenBSD: ecvt.3,v 1.8 2007/05/31 19:19:31 jmc Exp $
-.\"
-.\" Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.\" Sponsored in part by the Defense Advanced Research Projects
-.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
-.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
-.\"
-.Dd $Mdocdate: May 31 2007 $
-.Dt ECVT 3
-.Os
-.Sh NAME
-.Nm ecvt ,
-.Nm fcvt ,
-.Nm gcvt
-.Nd convert double to
-.Tn ASCII
-string
-.Sh SYNOPSIS
-.Fd #include <stdlib.h>
-.Ft char *
-.Fn ecvt "double value" "int ndigit" "int * restrict decpt" "int * restrict sign"
-.Ft char *
-.Fn fcvt "double value" "int ndigit" "int * restrict decpt" "int * restrict sign"
-.Ft char *
-.Fn gcvt "double value" "int ndigit" "char *buf"
-.Sh DESCRIPTION
-.Bf -symbolic
-These functions are provided for compatibility with legacy code.
-New code should use the
-.Xr snprintf 3
-function for improved safety and portability.
-.Ef
-.Pp
-The
-.Fn ecvt ,
-.Fn fcvt
-and
-.Fn gcvt
-functions convert the double precision floating-point number
-.Fa value
-to a NUL-terminated
-.Tn ASCII
-string.
-.Pp
-The
-.Fn ecvt
-function converts
-.Fa value
-to a NUL-terminated string of exactly
-.Fa ndigit
-digits and returns a pointer to that string.
-The result is padded with zeroes from left to right as needed.
-There are no leading zeroes unless
-.Fa value
-itself is 0.
-The least significant digit is rounded in an implementation-dependent manner.
-The position of the decimal point relative to the beginning of the string
-is stored in
-.Fa decpt .
-A negative value indicates that the decimal point is located
-to the left of the returned digits (this occurs when there is no
-whole number component to
-.Fa value ) .
-If
-.Fa value
-is zero, it is unspecified whether the integer pointed to by
-.Fa decpt
-will be 0 or 1.
-The decimal point itself is not included in the returned string.
-If the sign of the result is negative, the integer pointed to by
-.Fa sign
-is non-zero; otherwise, it is 0.
-.Pp
-If the converted value is out of range or is not representable,
-the contents of the returned string are unspecified.
-.Pp
-The
-.Fn fcvt
-function is identical to
-.Fn ecvt
-with the exception that
-.Fa ndigit
-specifies the number of digits after the decimal point (zero-padded as
-needed).
-.Pp
-The
-.Fn gcvt
-function converts
-.Fa value
-to a NUL-terminated string similar to the %g
-.Xr printf 3
-format specifier and stores the result in
-.Fa buf .
-It produces
-.Fa ndigit
-significant digits similar to the %f
-.Xr printf 3
-format specifier where possible.
-If
-.Fa ndigit
-does allow sufficient precision, the result is stored in
-exponential notation similar to the %e
-.Xr printf 3
-format specifier.
-If
-.Fa value
-is less than zero,
-.Fa buf
-will be prefixed with a minus sign.
-A decimal point is included in the returned string if
-.Fa value
-is not a whole number.
-Unlike the
-.Fn ecvt
-and
-.Fn fcvt
-functions,
-.Fa buf
-is not zero-padded.
-.Sh RETURN VALUES
-The
-.Fn ecvt ,
-.Fn fcvt
-and
-.Fn gcvt
-functions return a NUL-terminated string representation of
-.Fa value .
-.Sh WARNINGS
-The
-.Fn ecvt
-and
-.Fn fcvt
-functions return a pointer to internal storage space that will be
-overwritten by subsequent calls to either function.
-.Pp
-The maximum possible precision of the return value is limited by the
-precision of a double and may not be the same on all architectures.
-.Pp
-The
-.Xr snprintf 3
-function is preferred over these functions for new code.
-.Sh SEE ALSO
-.Xr printf 3 ,
-.Xr strtod 3
-.Sh STANDARDS
-The
-.Fn ecvt ,
-.Fn fcvt
-and
-.Fn gcvt
-functions conform to
-.St -p1003.1-2001 .
diff --git a/stdlib/exit-fbsd.c b/stdlib/exit-fbsd.c
deleted file mode 100644 (file)
index aa23703..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)exit.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/exit.c,v 1.9 2007/01/09 00:28:09 imp Exp $");
-
-#include "namespace.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "atexit.h"
-#include "libc_private.h"
-
-void (*__cleanup)(void);
-extern void __exit(int);
-
-/*
- * Exit, flushing stdio buffers if necessary.
- */
-void
-exit(status)
-       int status;
-{
-       __cxa_finalize(NULL);
-       if (__cleanup)
-               (*__cleanup)();
-       __exit(status);
-}
diff --git a/stdlib/exit.3 b/stdlib/exit.3
deleted file mode 120000 (symlink)
index 9110a44..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./exit.3
\ No newline at end of file
diff --git a/stdlib/gcvt-obsd.c b/stdlib/gcvt-obsd.c
deleted file mode 100644 (file)
index 703f783..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*     $OpenBSD: gcvt.c,v 1.11 2009/10/16 12:15:03 martynas Exp $      */
-
-/*
- * Copyright (c) 2002, 2003, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Sponsored in part by the Defense Advanced Research Projects
- * Agency (DARPA) and Air Force Research Laboratory, Air Force
- * Materiel Command, USAF, under agreement number F39502-99-1-0512.
- */
-
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-extern char *__dtoa(double, int, int, int *, int *, char **);
-extern void  __freedtoa(char *);
-
-char *
-gcvt(double value, int ndigit, char *buf)
-{
-       char *digits, *dst, *src;
-       int i, decpt, sign;
-       struct lconv *lconv;
-
-       lconv = localeconv();
-       if (ndigit == 0) {
-               buf[0] = '\0';
-               return (buf);
-       }
-
-       digits = __dtoa(value, 2, ndigit, &decpt, &sign, NULL);
-       if (digits == NULL)
-               return (NULL);
-       if (decpt == 9999) {
-               /*
-                * Infinity or NaN, convert to inf or nan with sign.
-                * We assume the buffer is at least ndigit long.
-                */
-               snprintf(buf, ndigit + 1, "%s%s", sign ? "-" : "",
-                   *digits == 'I' ? "inf" : "nan");
-               __freedtoa(digits);
-               return (buf);
-       }
-
-       dst = buf;
-       if (sign)
-               *dst++ = '-';
-
-       if (decpt < 0 || decpt > ndigit) {
-               /* exponential format (e.g. 1.2345e+13) */
-               if (--decpt < 0) {
-                       sign = 1;
-                       decpt = -decpt;
-               } else
-                       sign = 0;
-               src = digits;
-               *dst++ = *src++;
-               dst = stpcpy(dst, lconv->decimal_point);
-               while (*src != '\0')
-                       *dst++ = *src++;
-               *dst++ = 'e';
-               if (sign)
-                       *dst++ = '-';
-               else
-                       *dst++ = '+';
-               if (decpt < 10) {
-                       *dst++ = '0';
-                       *dst++ = '0' + decpt;
-                       *dst = '\0';
-               } else {
-                       /* XXX - optimize */
-                       for (sign = decpt, i = 0; (sign /= 10) != 0; i++)
-                               continue;
-                       dst[i + 1] = '\0';
-                       while (decpt != 0) {
-                               dst[i--] = '0' + decpt % 10;
-                               decpt /= 10;
-                       }
-               }
-       } else {
-               /* standard format */
-               for (i = 0, src = digits; i < decpt; i++) {
-                       if (*src != '\0')
-                               *dst++ = *src++;
-                       else
-                               *dst++ = '0';
-               }
-               if (*src != '\0') {
-                       if (src == digits)
-                               *dst++ = '0';   /* zero before decimal point */
-                       dst = stpcpy(dst, lconv->decimal_point);
-                       for (i = decpt; digits[i] != '\0'; i++) {
-                               *dst++ = digits[i];
-                       }
-               }
-               *dst = '\0';
-       }
-       __freedtoa(digits);
-       return (buf);
-}
diff --git a/stdlib/getenv-fbsd.c b/stdlib/getenv-fbsd.c
deleted file mode 100644 (file)
index 47b60df..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getenv.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.8 2007/05/01 16:02:41 ache Exp $");
-
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <crt_externs.h>
-
-__private_extern__ char *__findenv(const char *, int *, char **);
-
-/*
- * __findenv --
- *     Returns pointer to value associated with name, if any, else NULL.
- *     Sets offset to be the offset of the name/value combination in the
- *     environmental array, for use by setenv(3) and unsetenv(3).
- *     Explicitly removes '=' in argument name.
- *
- *     This routine *should* be a static; don't use it.
- */
-__private_extern__ char *
-__findenv(name, offset, environ)
-       const char *name;
-       int *offset;
-       char **environ;
-{
-       int len, i;
-       const char *np;
-       char **p, *cp;
-
-       if (name == NULL || environ == NULL)
-               return (NULL);
-       for (np = name; *np && *np != '='; ++np)
-               continue;
-       len = np - name;
-       for (p = environ; (cp = *p) != NULL; ++p) {
-               for (np = name, i = len; i && *cp; i--)
-                       if (*cp++ != *np++)
-                               break;
-               if (i == 0 && *cp++ == '=') {
-                       *offset = p - environ;
-                       return (cp);
-               }
-       }
-       return (NULL);
-}
-
-/*
- * _getenvp -- SPI using an arbitrary pointer to string array (the array must
- * have been created with malloc) and an env state, created by _allocenvstate().
- *     Returns ptr to value associated with name, if any, else NULL.
- */
-char *
-_getenvp(const char *name, char ***envp, void *state __unused)
-{
-       int offset;
-
-       return (__findenv(name, &offset, *envp));
-}
-
-/*
- * getenv --
- *     Returns ptr to value associated with name, if any, else NULL.
- */
-char *
-getenv(name)
-       const char *name;
-{
-       int offset;
-
-       return (__findenv(name, &offset, *_NSGetEnviron()));
-}
diff --git a/stdlib/getenv.3 b/stdlib/getenv.3
deleted file mode 100644 (file)
index 498a365..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-.\" Copyright (c) 1988, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)getenv.3   8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/stdlib/getenv.3,v 1.16 2004/07/07 19:57:13 ru Exp $
-.\"
-.Dd December 11, 1993
-.Dt GETENV 3
-.Os
-.Sh NAME
-.Nm getenv ,
-.Nm putenv ,
-.Nm setenv ,
-.Nm unsetenv
-.Nd environment variable functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft char *
-.Fo getenv
-.Fa "const char *name"
-.Fc
-.Ft int
-.Fo putenv
-.Fa "char *string"
-.Fc
-.Ft int
-.Fo setenv
-.Fa "const char *name"
-.Fa "const char *value"
-.Fa "int overwrite"
-.Fc
-.Ft int
-.Fo unsetenv
-.Fa "const char *name"
-.Fc
-.Sh DESCRIPTION
-These functions set, unset and fetch environment variables from the
-host
-.Em environment list .
-For compatibility with differing environment conventions,
-the given arguments
-.Fa name
-and
-.Fa value
-may be appended and prepended,
-respectively,
-with an equal sign
-.Dq Li \&= .
-.Pp
-The
-.Fn getenv
-function obtains the current value of the environment variable,
-.Fa name .
-.Pp
-The
-.Fn setenv
-function inserts or resets the environment variable
-.Fa name
-in the current environment list.
-If the variable
-.Fa name
-does not exist in the list,
-it is inserted with the given
-.Fa value .
-If the variable does exist, the argument
-.Fa overwrite
-is tested; if
-.Fa overwrite
-is
-zero, the
-variable is not reset, otherwise it is reset
-to the given
-.Fa value .
-.Pp
-The
-.Fn putenv
-function takes an argument of the form ``name=value'' and is
-equivalent to:
-.Bd -literal -offset indent
-setenv(name, value, 1);
-.Ed
-.Pp
-The string pointed to by
-.Fa string
-becomes part of the environment.
-A program should not alter or free the string,
-and should not use stack or other transient string variables
-as arguments to
-.Fn putenv .
-The
-.Fn setenv
-function is strongly preferred to
-.Fn putenv .
-.Pp
-The
-.Fn unsetenv
-function
-deletes all instances of the variable name pointed to by
-.Fa name
-from the list.
-Note that only the variable name (e.g., "NAME") should be given;
-"NAME=value" will not work.
-.Sh RETURN VALUES
-The
-.Fn getenv
-function returns the value of the environment variable as a
-.Dv NUL Ns
--terminated string.
-If the variable
-.Fa name
-is not in the current environment,
-.Dv NULL
-is returned.
-.Pp
-.Rv -std setenv putenv unsetenv
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The function
-.Fn unsetenv
-failed because
-.Fa name
-was not found in the environment list.
-.It Bq Er ENOMEM
-The function
-.Fn setenv
-or
-.Fn putenv
-failed because it was unable to allocate memory for the environment.
-.El
-.Sh LEGACY SYNOPSIS
-.Fd #include <stdlib.h>
-.Pp
-.Ft void
-.br
-.Fo unsetenv
-.Fa "const char *name"
-.Fc ;
-.Pp
-.Fn unsetenv
-doesn't return a value.
-.Sh COMPATIBILITY
-.Fn putenv
-no longer copies its input buffer.
-This often appears in crash logs as a crash in
-.Fn getenv .
-Avoid passing local buffers or freeing the memory
-that is passed to
-.Fn putenv .
-Use
-.Fn setenv ,  
-which still makes an internal copy of its buffers.
-.Pp
-.Fn unsetenv
-no longer parses the variable name;
-e.g., unsetenv ("FOO=BAR") no longer works.
-Use unsetenv("FOO").
-.Fn unsetenv
-also now returns a status value and will set
-.Va errno
-to EINVAL if
-.Fa name
-is not a defined environment variable.
-.Sh SEE ALSO
-.Xr csh 1 ,
-.Xr sh 1 ,
-.Xr execve 2 ,
-.Xr compat 5 ,
-.Xr environ 7
-.Sh STANDARDS
-The
-.Fn getenv
-function conforms to
-.St -isoC .
-.Sh BUGS
-Successive calls to
-.Fn setenv
-or
-.Fn putenv
-assigning a differently sized
-.Fa value
-to the same
-.Fa name
-will result in a memory leak.
-The
-.Fx
-semantics for these functions
-(namely, that the contents of
-.Fa value
-are copied and that old values remain accessible indefinitely) make this
-bug unavoidable.
-Future versions may eliminate one or both of these
-semantic guarantees in order to fix the bug.
-.Sh HISTORY
-The functions
-.Fn setenv
-and
-.Fn unsetenv
-appeared in
-.At v7 .
-The
-.Fn putenv
-function appeared in
-.Bx 4.3 Reno .
diff --git a/stdlib/getopt-fbsd.c b/stdlib/getopt-fbsd.c
deleted file mode 100644 (file)
index c45494c..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*     $NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $  */
-
-/*
- * Copyright (c) 1987, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getopt.c   8.3 (Berkeley) 4/27/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/getopt.c,v 1.8 2007/01/09 00:28:10 imp Exp $");
-
-#include "namespace.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-
-#ifndef BUILDING_VARIANT
-int    opterr = 1,             /* if error message should be printed */
-       optind = 1,             /* index into parent argv vector */
-       optopt,                 /* character checked for validity */
-       optreset;               /* reset getopt */
-char   *optarg;                /* argument associated with option */
-#endif /* !BUILDING_VARIANT */
-
-#define        BADCH   (int)'?'
-#define        BADARG  (int)':'
-#define        EMSG    ""
-
-#if __DARWIN_UNIX03
-#define PROGNAME nargv[0]
-#else
-#define PROGNAME _getprogname()
-#endif
-
-/*
- * getopt --
- *     Parse argc/argv argument vector.
- */
-int
-getopt(nargc, nargv, ostr)
-       int nargc;
-       char * const nargv[];
-       const char *ostr;
-{
-       static char *place = EMSG;              /* option letter processing */
-       char *oli;                              /* option letter list index */
-
-       if (optreset || *place == 0) {          /* update scanning pointer */
-               optreset = 0;
-               place = nargv[optind];
-               if (optind >= nargc || *place++ != '-') {
-                       /* Argument is absent or is not an option */
-                       place = EMSG;
-                       return (-1);
-               }
-               optopt = *place++;
-               if (optopt == '-' && *place == 0) {
-                       /* "--" => end of options */
-                       ++optind;
-                       place = EMSG;
-                       return (-1);
-               }
-               if (optopt == 0) {
-                       /* Solitary '-', treat as a '-' option
-                          if the program (eg su) is looking for it. */
-                       place = EMSG;
-                       if (strchr(ostr, '-') == NULL)
-                               return (-1);
-                       optopt = '-';
-               }
-       } else
-               optopt = *place++;
-
-       /* See if option letter is one the caller wanted... */
-       if (optopt == ':' || (oli = strchr(ostr, optopt)) == NULL) {
-               if (*place == 0)
-                       ++optind;
-               if (opterr && *ostr != ':')
-                       (void)fprintf(stderr,
-                           "%s: illegal option -- %c\n",
-                           PROGNAME, optopt);
-               return (BADCH);
-       }
-
-       /* Does this option need an argument? */
-       if (oli[1] != ':') {
-               /* don't need argument */
-               optarg = NULL;
-               if (*place == 0)
-                       ++optind;
-       } else {
-               /* Option-argument is either the rest of this argument or the
-                  entire next argument. */
-               if (*place)
-                       optarg = place;
-               else if (nargc > ++optind)
-                       optarg = nargv[optind];
-               else {
-                       /* option-argument absent */
-#if __DARWIN_UNIX03
-                       /* Yes, the standard will put optind past the last
-                          argument */
-                       ++optind;
-                       optarg = NULL;
-#endif /* __DARWIN_UNIX03 */
-                       place = EMSG;
-                       if (*ostr == ':')
-                               return (BADARG);
-                       if (opterr)
-                               (void)fprintf(stderr,
-                                   "%s: option requires an argument -- %c\n",
-                                   PROGNAME, optopt);
-                       return (BADCH);
-               }
-               place = EMSG;
-               ++optind;
-       }
-       return (optopt);                        /* return option letter */
-}
diff --git a/stdlib/getopt.3 b/stdlib/getopt.3
deleted file mode 120000 (symlink)
index 67219ac..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getopt.3
\ No newline at end of file
diff --git a/stdlib/getopt_long-fbsd.c b/stdlib/getopt_long-fbsd.c
deleted file mode 120000 (symlink)
index efa4ec8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getopt_long.c
\ No newline at end of file
diff --git a/stdlib/getopt_long.3 b/stdlib/getopt_long.3
deleted file mode 120000 (symlink)
index 4cab876..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getopt_long.3
\ No newline at end of file
diff --git a/stdlib/getsubopt-fbsd.c b/stdlib/getsubopt-fbsd.c
deleted file mode 120000 (symlink)
index 96dc064..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./getsubopt.c
\ No newline at end of file
diff --git a/stdlib/getsubopt.3 b/stdlib/getsubopt.3
deleted file mode 100644 (file)
index c1ddee2..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)getsubopt.3        8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/stdlib/getsubopt.3,v 1.11 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd June 9, 1993
-.Dt GETSUBOPT 3
-.Os
-.Sh NAME
-.Nm getsubopt
-.Nd get sub options from an argument
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Vt extern char *suboptarg ;
-.Ft int
-.Fo getsubopt
-.Fa "char **optionp"
-.Fa "char *const *keylistp"
-.Fa "char **valuep"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn getsubopt
-function
-parses a string containing tokens that are delimited
-by one or more tab, space, or comma
-.Pq Ql \&,
-characters.
-It is intended for use in parsing groups of option arguments
-that are provided as part of a utility command line.
-.Pp
-The argument
-.Fa optionp
-is a pointer to a pointer to the string.
-The argument
-.Fa keylistp
-is a pointer to a
-.Dv NULL Ns -terminated
-array of pointers to strings.
-.Pp
-The
-.Fn getsubopt
-function
-returns the zero-based offset of the pointer in the
-.Fa keylistp
-array, referencing a string which matches the first token in the string
- or \-1 if the string contains no tokens or
-.Fa keylistp
-does not contain a matching string.
-.Pp
-If the token is of the form ``name=value'', the location referenced by
-.Fa valuep
-will be set to point to the start of the ``value'' portion of the token.
-.Pp
-On return from
-.Fn getsubopt ,
-.Fa optionp
-will be set to point to the start of the next token in the string,
-or the null at the end of the string if no more tokens are present.
-The external variable
-.Fa suboptarg
-will be set to point to the start of the current token, or
-.Dv NULL
-if no
-tokens were present.
-The argument
-.Fa valuep
-will be set to point to the ``value'' portion of the token, or
-.Dv NULL
-if no ``value'' portion was present.
-.Sh EXAMPLES
-.Bd -literal -compact
-char *keylistp[] = {
-       #define ONE     0
-               "one",
-       #define TWO     1
-               "two",
-       NULL
-};
-
-\&...
-
-extern char *optarg, *suboptarg;
-char *options, *value;
-
-while ((ch = getopt(argc, argv, "ab:")) != \-1) {
-       switch(ch) {
-       case 'a':
-               /* process ``a'' option */
-               break;
-       case 'b':
-               options = optarg;
-               while (*options) {
-                       switch(getsubopt(&options, keylistp, &value)) {
-                       case ONE:
-                               /* process ``one'' sub option */
-                               break;
-                       case TWO:
-                               /* process ``two'' sub option */
-                               if (!value)
-                                       error("no value for two");
-                               i = atoi(value);
-                               break;
-                       case \-1:
-                               if (suboptarg)
-                                       error("illegal sub option %s",
-                                         suboptarg);
-                               else
-                                       error("missing sub option");
-                               break;
-               }
-               break;
-       }
-.Ed
-.Sh SEE ALSO
-.Xr getopt 3 ,
-.Xr strsep 3
-.Sh HISTORY
-The
-.Fn getsubopt
-function first appeared in
-.Bx 4.4 .
diff --git a/stdlib/hcreate-fbsd.c b/stdlib/hcreate-fbsd.c
deleted file mode 120000 (symlink)
index b06b592..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./hcreate.c
\ No newline at end of file
diff --git a/stdlib/hcreate.3 b/stdlib/hcreate.3
deleted file mode 120000 (symlink)
index 94586da..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./hcreate.3
\ No newline at end of file
diff --git a/stdlib/heapsort-fbsd.c b/stdlib/heapsort-fbsd.c
deleted file mode 120000 (symlink)
index a549564..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./heapsort.c
\ No newline at end of file
diff --git a/stdlib/heapsort_b-fbsd.c b/stdlib/heapsort_b-fbsd.c
deleted file mode 100644 (file)
index b424604..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)heapsort.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/heapsort.c,v 1.6 2008/01/13 02:11:10 das Exp $");
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-/*
- * Swap two areas of size number of bytes.  Although qsort(3) permits random
- * blocks of memory to be sorted, sorting pointers is almost certainly the
- * common case (and, were it not, could easily be made so).  Regardless, it
- * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
- * arithmetic gets lost in the time required for comparison function calls.
- */
-#define        SWAP(a, b, count, size, tmp) { \
-       count = size; \
-       do { \
-               tmp = *a; \
-               *a++ = *b; \
-               *b++ = tmp; \
-       } while (--count); \
-}
-
-/* Copy one block of size size to another. */
-#define COPY(a, b, count, size, tmp1, tmp2) { \
-       count = size; \
-       tmp1 = a; \
-       tmp2 = b; \
-       do { \
-               *tmp1++ = *tmp2++; \
-       } while (--count); \
-}
-
-/*
- * Build the list into a heap, where a heap is defined such that for
- * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
- *
- * There two cases.  If j == nmemb, select largest of Ki and Kj.  If
- * j < nmemb, select largest of Ki, Kj and Kj+1.
- */
-#define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \
-       for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
-           par_i = child_i) { \
-               child = base + child_i * size; \
-               if (child_i < nmemb && compar(child, child + size) < 0) { \
-                       child += size; \
-                       ++child_i; \
-               } \
-               par = base + par_i * size; \
-               if (compar(child, par) <= 0) \
-                       break; \
-               SWAP(par, child, count, size, tmp); \
-       } \
-}
-
-/*
- * Select the top of the heap and 'heapify'.  Since by far the most expensive
- * action is the call to the compar function, a considerable optimization
- * in the average case can be achieved due to the fact that k, the displaced
- * elememt, is ususally quite small, so it would be preferable to first
- * heapify, always maintaining the invariant that the larger child is copied
- * over its parent's record.
- *
- * Then, starting from the *bottom* of the heap, finding k's correct place,
- * again maintianing the invariant.  As a result of the invariant no element
- * is 'lost' when k is assigned its correct place in the heap.
- *
- * The time savings from this optimization are on the order of 15-20% for the
- * average case. See Knuth, Vol. 3, page 158, problem 18.
- *
- * XXX Don't break the #define SELECT line, below.  Reiser cpp gets upset.
- */
-#define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
-       for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
-               child = base + child_i * size; \
-               if (child_i < nmemb && compar(child, child + size) < 0) { \
-                       child += size; \
-                       ++child_i; \
-               } \
-               par = base + par_i * size; \
-               COPY(par, child, count, size, tmp1, tmp2); \
-       } \
-       for (;;) { \
-               child_i = par_i; \
-               par_i = child_i / 2; \
-               child = base + child_i * size; \
-               par = base + par_i * size; \
-               if (child_i == 1 || compar(k, par) < 0) { \
-                       COPY(child, k, count, size, tmp1, tmp2); \
-                       break; \
-               } \
-               COPY(child, par, count, size, tmp1, tmp2); \
-       } \
-}
-
-/*
- * Heapsort -- Knuth, Vol. 3, page 145.  Runs in O (N lg N), both average
- * and worst.  While heapsort is faster than the worst case of quicksort,
- * the BSD quicksort does median selection so that the chance of finding
- * a data set that will trigger the worst case is nonexistent.  Heapsort's
- * only advantage over quicksort is that it requires little additional memory.
- */
-int
-heapsort_b(vbase, nmemb, size, compar)
-       void *vbase;
-       size_t nmemb, size;
-       int (^compar)(const void *, const void *);
-{
-       size_t cnt, i, j, l;
-       char tmp, *tmp1, *tmp2;
-       char *base, *k, *p, *t;
-
-       if (nmemb <= 1)
-               return (0);
-
-       if (!size) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       if ((k = malloc(size)) == NULL)
-               return (-1);
-
-       /*
-        * Items are numbered from 1 to nmemb, so offset from size bytes
-        * below the starting address.
-        */
-       base = (char *)vbase - size;
-
-       for (l = nmemb / 2 + 1; --l;)
-               CREATE(l, nmemb, i, j, t, p, size, cnt, tmp);
-
-       /*
-        * For each element of the heap, save the largest element into its
-        * final slot, save the displaced element (k), then recreate the
-        * heap.
-        */
-       while (nmemb > 1) {
-               COPY(k, base + nmemb * size, cnt, size, tmp1, tmp2);
-               COPY(base + nmemb * size, base + size, cnt, size, tmp1, tmp2);
-               --nmemb;
-               SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2);
-       }
-       free(k);
-       return (0);
-}
diff --git a/stdlib/heapsort_r-fbsd.c b/stdlib/heapsort_r-fbsd.c
deleted file mode 100644 (file)
index 2f0b26f..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)heapsort.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/heapsort.c,v 1.6 2008/01/13 02:11:10 das Exp $");
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-/*
- * Swap two areas of size number of bytes.  Although qsort(3) permits random
- * blocks of memory to be sorted, sorting pointers is almost certainly the
- * common case (and, were it not, could easily be made so).  Regardless, it
- * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer
- * arithmetic gets lost in the time required for comparison function calls.
- */
-#define        SWAP(a, b, count, size, tmp) { \
-       count = size; \
-       do { \
-               tmp = *a; \
-               *a++ = *b; \
-               *b++ = tmp; \
-       } while (--count); \
-}
-
-/* Copy one block of size size to another. */
-#define COPY(a, b, count, size, tmp1, tmp2) { \
-       count = size; \
-       tmp1 = a; \
-       tmp2 = b; \
-       do { \
-               *tmp1++ = *tmp2++; \
-       } while (--count); \
-}
-
-/*
- * Build the list into a heap, where a heap is defined such that for
- * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
- *
- * There two cases.  If j == nmemb, select largest of Ki and Kj.  If
- * j < nmemb, select largest of Ki, Kj and Kj+1.
- */
-#define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \
-       for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
-           par_i = child_i) { \
-               child = base + child_i * size; \
-               if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
-                       child += size; \
-                       ++child_i; \
-               } \
-               par = base + par_i * size; \
-               if (compar(thunk, child, par) <= 0) \
-                       break; \
-               SWAP(par, child, count, size, tmp); \
-       } \
-}
-
-/*
- * Select the top of the heap and 'heapify'.  Since by far the most expensive
- * action is the call to the compar function, a considerable optimization
- * in the average case can be achieved due to the fact that k, the displaced
- * elememt, is ususally quite small, so it would be preferable to first
- * heapify, always maintaining the invariant that the larger child is copied
- * over its parent's record.
- *
- * Then, starting from the *bottom* of the heap, finding k's correct place,
- * again maintianing the invariant.  As a result of the invariant no element
- * is 'lost' when k is assigned its correct place in the heap.
- *
- * The time savings from this optimization are on the order of 15-20% for the
- * average case. See Knuth, Vol. 3, page 158, problem 18.
- *
- * XXX Don't break the #define SELECT line, below.  Reiser cpp gets upset.
- */
-#define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
-       for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
-               child = base + child_i * size; \
-               if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
-                       child += size; \
-                       ++child_i; \
-               } \
-               par = base + par_i * size; \
-               COPY(par, child, count, size, tmp1, tmp2); \
-       } \
-       for (;;) { \
-               child_i = par_i; \
-               par_i = child_i / 2; \
-               child = base + child_i * size; \
-               par = base + par_i * size; \
-               if (child_i == 1 || compar(thunk, k, par) < 0) { \
-                       COPY(child, k, count, size, tmp1, tmp2); \
-                       break; \
-               } \
-               COPY(child, par, count, size, tmp1, tmp2); \
-       } \
-}
-
-/*
- * Heapsort -- Knuth, Vol. 3, page 145.  Runs in O (N lg N), both average
- * and worst.  While heapsort is faster than the worst case of quicksort,
- * the BSD quicksort does median selection so that the chance of finding
- * a data set that will trigger the worst case is nonexistent.  Heapsort's
- * only advantage over quicksort is that it requires little additional memory.
- */
-__private_extern__ int
-__heapsort_r(vbase, nmemb, size, thunk, compar)
-       void *vbase;
-       size_t nmemb, size;
-       void *thunk;
-       int (*compar)(void *, const void *, const void *);
-{
-       size_t cnt, i, j, l;
-       char tmp, *tmp1, *tmp2;
-       char *base, *k, *p, *t;
-
-       if (nmemb <= 1)
-               return (0);
-
-       if (!size) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       if ((k = malloc(size)) == NULL)
-               return (-1);
-
-       /*
-        * Items are numbered from 1 to nmemb, so offset from size bytes
-        * below the starting address.
-        */
-       base = (char *)vbase - size;
-
-       for (l = nmemb / 2 + 1; --l;)
-               CREATE(l, nmemb, i, j, t, p, size, cnt, tmp);
-
-       /*
-        * For each element of the heap, save the largest element into its
-        * final slot, save the displaced element (k), then recreate the
-        * heap.
-        */
-       while (nmemb > 1) {
-               COPY(k, base + nmemb * size, cnt, size, tmp1, tmp2);
-               COPY(base + nmemb * size, base + size, cnt, size, tmp1, tmp2);
-               --nmemb;
-               SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2);
-       }
-       free(k);
-       return (0);
-}
diff --git a/stdlib/imaxabs-fbsd.c b/stdlib/imaxabs-fbsd.c
deleted file mode 120000 (symlink)
index 2ec179f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./imaxabs.c
\ No newline at end of file
diff --git a/stdlib/imaxabs.3 b/stdlib/imaxabs.3
deleted file mode 120000 (symlink)
index da7c29d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./imaxabs.3
\ No newline at end of file
diff --git a/stdlib/imaxdiv-fbsd.c b/stdlib/imaxdiv-fbsd.c
deleted file mode 120000 (symlink)
index e8331e0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./imaxdiv.c
\ No newline at end of file
diff --git a/stdlib/imaxdiv.3 b/stdlib/imaxdiv.3
deleted file mode 100644 (file)
index a9f5e12..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-.\" Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/stdlib/imaxdiv.3,v 1.2 2001/11/21 16:19:50 ru Exp $
-.\"
-.Dd November 14, 2001
-.Dt IMAXDIV 3
-.Os
-.Sh NAME
-.Nm imaxdiv
-.Nd returns quotient and remainder
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In inttypes.h
-.Ft imaxdiv_t
-.Fn imaxdiv "intmax_t numer" "intmax_t denom"
-.Sh DESCRIPTION
-The
-.Fn imaxdiv
-function computes the value of
-.Fa numer ,
-divided by
-.Fa denom .
-The stored result is returned in the form of the
-.Vt imaxdiv_t
-type.
-.Pp
-The
-.Vt imaxdiv_t
-type is defined as:
-.Bd -literal -offset indent
-typedef struct {
-       intmax_t quot; /* Quotient.  */
-       intmax_t rem;  /* Remainder. */
-} imaxdiv_t;
-.Ed
-.Sh SEE ALSO
-.Xr div 3 ,
-.Xr ldiv 3 ,
-.Xr lldiv 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn imaxdiv
-function conforms to
-.St -isoC-99 .
-.Sh HISTORY
-The
-.Fn imaxdiv
-function first appeared in
-.Fx 5.0 .
diff --git a/stdlib/insque-fbsd.c b/stdlib/insque-fbsd.c
deleted file mode 120000 (symlink)
index 86c8bff..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./insque.c
\ No newline at end of file
diff --git a/stdlib/insque.3 b/stdlib/insque.3
deleted file mode 100644 (file)
index b1d47d6..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-.\"
-.\" Initial implementation:
-.\" Copyright (c) 2002 Robert Drehmel
-.\" All rights reserved.
-.\"
-.\" As long as the above copyright statement and this notice remain
-.\" unchanged, you can do what ever you want with this file.
-.\"
-.\" $FreeBSD: src/lib/libc/stdlib/insque.3,v 1.3 2003/02/25 21:59:36 robert Exp $
-.\"
-.Dd October 10, 2002
-.Dt INSQUE 3
-.Os
-.Sh NAME
-.Nm insque ,
-.Nm remque
-.Nd doubly-linked list management
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In search.h
-.Ft void
-.Fn insque "void *element" "void *pred"
-.Ft void
-.Fn remque "void *element"
-.Sh DESCRIPTION
-The
-.Fn insque
-and
-.Fn remque
-functions encapsulate the ever-repeating task of doing insertion and
-removal operations on doubly linked lists.
-The functions expect their
-arguments to point to a structure whose first and second members are
-pointers to the next and previous element, respectively.
-The
-.Fn insque
-function also allows the
-.Fa pred
-argument to be a
-.Dv NULL
-pointer for the initialization of a new list's
-head element.
-.Sh STANDARDS
-The
-.Fn insque
-and
-.Fn remque
-functions conform to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn insque
-and
-.Fn remque
-functions appeared in
-.Bx 4.2 .
-In
-.Fx 5.0 ,
-they reappeared conforming to
-.St -p1003.1-2001 .
diff --git a/stdlib/labs-fbsd.c b/stdlib/labs-fbsd.c
deleted file mode 120000 (symlink)
index 8c4a475..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./labs.c
\ No newline at end of file
diff --git a/stdlib/labs.3 b/stdlib/labs.3
deleted file mode 100644 (file)
index b000955..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)labs.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/labs.3,v 1.10 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd November 14, 2001
-.Dt LABS 3
-.Os
-.Sh NAME
-.Nm labs
-.Nd return the absolute value of a long integer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft long
-.Fn labs "long i"
-.Sh DESCRIPTION
-The
-.Fn labs
-function
-returns the absolute value of the long integer
-.Fa i .
-.Sh SEE ALSO
-.Xr abs 3 ,
-.Xr cabs 3 ,
-.Xr floor 3 ,
-.Xr imaxabs 3 ,
-.Xr llabs 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn labs
-function
-conforms to
-.St -isoC .
-.Sh BUGS
-The absolute value of the most negative integer remains negative.
diff --git a/stdlib/ldiv-fbsd.c b/stdlib/ldiv-fbsd.c
deleted file mode 120000 (symlink)
index 0b50c5d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ldiv.c
\ No newline at end of file
diff --git a/stdlib/ldiv.3 b/stdlib/ldiv.3
deleted file mode 100644 (file)
index 904f0d5..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ldiv.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/ldiv.3,v 1.10 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd November 14, 2001
-.Dt LDIV 3
-.Os
-.Sh NAME
-.Nm ldiv
-.Nd return quotient and remainder from division
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft ldiv_t
-.Fn ldiv "long numer" "long denom"
-.Sh DESCRIPTION
-The
-.Fn ldiv
-function
-computes the value
-.Fa numer Ns / Ns Fa denom
-(numerator/denominator).
-Ir returns the quotient and remainder in a structure named
-.Vt ldiv_t
-that contains two
-.Vt long
-members named
-.Va quot
-and
-.Va rem .
-.Sh SEE ALSO
-.Xr div 3 ,
-.Xr imaxdiv 3 ,
-.Xr lldiv 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn ldiv
-function
-conforms to
-.St -isoC-99 .
diff --git a/stdlib/llabs-fbsd.c b/stdlib/llabs-fbsd.c
deleted file mode 120000 (symlink)
index 1eabe54..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./llabs.c
\ No newline at end of file
diff --git a/stdlib/llabs.3 b/stdlib/llabs.3
deleted file mode 100644 (file)
index 96b104f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/stdlib/llabs.3,v 1.2 2001/11/21 16:19:50 ru Exp $
-.\"
-.Dd November 14, 2001
-.Dt LLABS 3
-.Os
-.Sh NAME
-.Nm llabs
-.Nd returns absolute value
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft "long long"
-.Fn llabs "long long i"
-.Sh DESCRIPTION
-The
-.Fn llabs
-function returns the absolute value of
-.Fa i .
-.Sh SEE ALSO
-.Xr abs 3 ,
-.Xr fabs 3 ,
-.Xr hypot 3 ,
-.Xr imaxabs 3 ,
-.Xr labs 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn llabs
-function conforms to
-.St -isoC-99 .
-.Sh HISTORY
-The
-.Fn llabs
-function first appeared in
-.Fx 5.0 .
-.Sh BUGS
-The absolute value of the most negative integer remains negative.
diff --git a/stdlib/lldiv-fbsd.c b/stdlib/lldiv-fbsd.c
deleted file mode 120000 (symlink)
index 266ebc0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./lldiv.c
\ No newline at end of file
diff --git a/stdlib/lldiv.3 b/stdlib/lldiv.3
deleted file mode 100644 (file)
index 98f4813..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-.\" Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/stdlib/lldiv.3,v 1.2 2001/11/21 16:19:50 ru Exp $
-.\"
-.Dd November 14, 2001
-.Dt LLDIV 3
-.Os
-.Sh NAME
-.Nm lldiv
-.Nd returns quotient and remainder
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft lldiv_t
-.Fn lldiv "long long numer" "long long denom"
-.Sh DESCRIPTION
-The
-.Fn lldiv
-function computes the value of
-.Fa numer ,
-divided by
-.Fa denom .
-It returns the stored result in the form of the
-.Vt lldiv_t
-type.
-.Pp
-The
-.Vt lldiv_t
-type is defined as:
-.Bd -literal -offset indent
-typedef struct {
-       long long quot; /* Quotient.  */
-       long long rem;  /* Remainder. */
-} lldiv_t;
-.Ed
-.Sh SEE ALSO
-.Xr div 3 ,
-.Xr imaxdiv 3 ,
-.Xr ldiv 3 ,
-.Xr math 3
-.Sh STANDARDS
-The
-.Fn lldiv
-function conforms to
-.St -isoC-99 .
-.Sh HISTORY
-The
-.Fn lldiv
-function first appeared in
-.Fx 5.0 .
diff --git a/stdlib/lsearch-fbsd.c b/stdlib/lsearch-fbsd.c
deleted file mode 120000 (symlink)
index 739569c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./lsearch.c
\ No newline at end of file
diff --git a/stdlib/lsearch.3 b/stdlib/lsearch.3
deleted file mode 100644 (file)
index 5be997c..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-.\"
-.\" Initial implementation:
-.\" Copyright (c) 2002 Robert Drehmel
-.\" All rights reserved.
-.\"
-.\" As long as the above copyright statement and this notice remain
-.\" unchanged, you can do what ever you want with this file.
-.\"
-.\" $FreeBSD: src/lib/libc/stdlib/lsearch.3,v 1.5 2005/01/20 09:17:04 ru Exp $
-.\"
-.Dd October 11, 2002
-.Dt LSEARCH 3
-.Os
-.Sh NAME
-.Nm lfind ,
-.Nm lsearch
-.Nd linear search and append
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In search.h
-.Ft "void *"
-.Fo lfind
-.Fa "const void *key" "const void *base" "size_t *nelp" "size_t width"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-.Ft "void *"
-.Fo lsearch
-.Fa "const void *key" "void *base" "size_t *nelp" "size_t width"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn lsearch
-and
-.Fn lfind
-functions walk linearly through an array, comparing each element with
-the one to be sought, by means of a supplied comparison function.
-.Pp
-The
-.Fa key
-argument
-points to an element that matches the one that is searched.
-The array's address in memory is denoted by the
-.Fa base
-argument.
-The width of one element (i.e., the size as returned by
-.Fn sizeof )
-is passed as the
-.Fa width
-argument.
-The number of valid elements contained in the array (not the number of
-elements the array has space reserved for) is given in the integer pointed
-to by
-.Fa nelp .
-The
-.Fa compar
-argument points to a function which compares its two arguments and returns
-zero if they are matching, and non-zero otherwise.
-.Pp
-If no matching element was found in the array,
-.Fn lsearch
-copies
-.Fa key
-into the position after the last element and increments the
-integer pointed to by
-.Fa nelp .
-.Sh RETURN VALUES
-The
-.Fn lsearch
-and
-.Fn lfind
-functions
-return a pointer to the first element found.
-If no element was found,
-.Fn lsearch
-returns a pointer to the newly added element, whereas
-.Fn lfind
-returns
-.Dv NULL .
-Both functions return
-.Dv NULL
-if an error occurs.
-.Sh SEE ALSO
-.Xr bsearch 3 ,
-.Xr hsearch 3 ,
-.Xr tsearch 3
-.Sh STANDARDS
-The
-.Fn lsearch
-and
-.Fn lfind
-functions conform to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn lsearch
-and
-.Fn lfind
-functions appeared in
-.Bx 4.2 .
-In
-.Fx 5.0 ,
-they reappeared conforming to
-.St -p1003.1-2001 .
diff --git a/stdlib/memory.3 b/stdlib/memory.3
deleted file mode 100644 (file)
index 96cef24..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memory.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/memory.3,v 1.12 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt MEMORY 3
-.Os
-.Sh NAME
-.Nm alloca ,
-.Nm calloc ,
-.Nm free ,
-.Nm malloc ,
-.Nm mmap ,
-.Nm realloc
-.Nd general memory allocation operations
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft void *
-.Fo alloca
-.Fa "size_t size"
-.Fc
-.Ft void *
-.Fo calloc
-.Fa "size_t nelem"
-.Fa "size_t elsize"
-.Fc
-.Ft void
-.Fo free
-.Fa "void *ptr"
-.Fc
-.Ft void *
-.Fo malloc
-.Fa "size_t size"
-.Fc
-.Ft void *
-.Fo realloc
-.Fa "void *ptr"
-.Fa "size_t size"
-.Fc
-.In sys/mman.h
-.Ft void *
-.Fo mmap
-.Fa "void * addr"
-.Fa "size_t len"
-.Fa "int prot"
-.Fa "int flags"
-.Fa "int fildes"
-.Fa "off_t off"
-.Fc
-.Sh DESCRIPTION
-These functions allocate and free memory for the calling process.
-They are described in the
-individual manual pages.
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/mman.h>
-.Pp
-.Ft void *
-.br
-.Fo mmap
-.Fa "void * addr"
-.Fa "size_t len"
-.Fa "int prot"
-.Fa "int flags"
-.Fa "int fildes"
-.Fa "off_t off"
-.Fc ;
-.Pp
-The include file
-.In sys/types.h
-is needed for this function.
-.Sh COMPATIBILITY
-.Fn mmap
-now returns with
-.Va errno
-set to EINVAL in places that historically succeeded.
-The rules have changed as follows:
-.Bl -bullet
-.It
-The
-.Fa flags
-parameter must specify either MAP_PRIVATE or MAP_SHARED.
-.It
-The
-.Fa size
-parameter must not be 0.
-.It
-The
-.Fa off
-parameter must be a multiple of pagesize,
-as returned by
-.Fn sysconf .
-.El
-.Sh SEE ALSO
-.Xr mmap 2 ,
-.Xr alloca 3 ,
-.Xr calloc 3 ,
-.Xr free 3 ,
-.Xr malloc 3 ,
-.Xr realloc 3 ,
-.Xr compat 5
-.Sh STANDARDS
-These functions, with the exception of
-.Fn alloca
-and
-.Fn mmap
-conform to
-.St -isoC .
diff --git a/stdlib/merge-fbsd.c b/stdlib/merge-fbsd.c
deleted file mode 100644 (file)
index 319f307..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/merge.c,v 1.8 2007/01/09 00:28:10 imp Exp $");
-
-/*
- * Hybrid exponential search/linear search merge sort with hybrid
- * natural/pairwise first pass.  Requires about .3% more comparisons
- * for random data than LSMS with pairwise first pass alone.
- * It works for objects as small as two bytes.
- */
-
-#define NATURAL
-#define THRESHOLD 16   /* Best choice for natural merge cut-off. */
-
-/* #define NATURAL to get hybrid natural merge.
- * (The default is pairwise merging.)
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-static void setup(u_char *, u_char *, size_t, size_t,
-    int (*)(const void *, const void *));
-static void insertionsort(u_char *, size_t, size_t,
-    int (*)(const void *, const void *));
-
-#define ISIZE sizeof(int)
-#define PSIZE sizeof(u_char *)
-#define ICOPY_LIST(src, dst, last)                             \
-       do                                                      \
-       *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE;    \
-       while(src < last)
-#define ICOPY_ELT(src, dst, i)                                 \
-       do                                                      \
-       *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE;  \
-       while (i -= ISIZE)
-
-#define CCOPY_LIST(src, dst, last)             \
-       do                                      \
-               *dst++ = *src++;                \
-       while (src < last)
-#define CCOPY_ELT(src, dst, i)                 \
-       do                                      \
-               *dst++ = *src++;                \
-       while (i -= 1)
-
-/*
- * Find the next possible pointer head.  (Trickery for forcing an array
- * to do double duty as a linked list when objects do not align with word
- * boundaries.
- */
-/* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **)                                            \
-       ((u_char *)0 +                                                  \
-           (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
-
-/*
- * Arguments are as for qsort.
- */
-int
-mergesort(base, nmemb, size, cmp)
-       void *base;
-       size_t nmemb;
-       size_t size;
-       int (*cmp)(const void *, const void *);
-{
-       size_t i;
-       int sense;
-       int big, iflag;
-       u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
-       u_char *list2, *list1, *p2, *p, *last, **p1;
-
-       if (size < PSIZE / 2) {         /* Pointers must fit into 2 * size. */
-               errno = EINVAL;
-               return (-1);
-       }
-
-       if (nmemb == 0)
-               return (0);
-
-       /*
-        * XXX
-        * Stupid subtraction for the Cray.
-        */
-       iflag = 0;
-       if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
-               iflag = 1;
-
-       if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
-               return (-1);
-
-       list1 = base;
-       setup(list1, list2, nmemb, size, cmp);
-       last = list2 + nmemb * size;
-       i = big = 0;
-       while (*EVAL(list2) != last) {
-           l2 = list1;
-           p1 = EVAL(list1);
-           for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
-               p2 = *EVAL(p2);
-               f1 = l2;
-               f2 = l1 = list1 + (p2 - list2);
-               if (p2 != last)
-                       p2 = *EVAL(p2);
-               l2 = list1 + (p2 - list2);
-               while (f1 < l1 && f2 < l2) {
-                       if ((*cmp)(f1, f2) <= 0) {
-                               q = f2;
-                               b = f1, t = l1;
-                               sense = -1;
-                       } else {
-                               q = f1;
-                               b = f2, t = l2;
-                               sense = 0;
-                       }
-                       if (!big) {     /* here i = 0 */
-                               while ((b += size) < t && cmp(q, b) >sense)
-                                       if (++i == 6) {
-                                               big = 1;
-                                               goto EXPONENTIAL;
-                                       }
-                       } else {
-EXPONENTIAL:                   for (i = size; ; i <<= 1)
-                                       if ((p = (b + i)) >= t) {
-                                               if ((p = t - size) > b &&
-                                                   (*cmp)(q, p) <= sense)
-                                                       t = p;
-                                               else
-                                                       b = p;
-                                               break;
-                                       } else if ((*cmp)(q, p) <= sense) {
-                                               t = p;
-                                               if (i == size)
-                                                       big = 0;
-                                               goto FASTCASE;
-                                       } else
-                                               b = p;
-                               while (t > b+size) {
-                                       i = (((t - b) / size) >> 1) * size;
-                                       if ((*cmp)(q, p = b + i) <= sense)
-                                               t = p;
-                                       else
-                                               b = p;
-                               }
-                               goto COPY;
-FASTCASE:                      while (i > size)
-                                       if ((*cmp)(q,
-                                               p = b + (i >>= 1)) <= sense)
-                                               t = p;
-                                       else
-                                               b = p;
-COPY:                          b = t;
-                       }
-                       i = size;
-                       if (q == f1) {
-                               if (iflag) {
-                                       ICOPY_LIST(f2, tp2, b);
-                                       ICOPY_ELT(f1, tp2, i);
-                               } else {
-                                       CCOPY_LIST(f2, tp2, b);
-                                       CCOPY_ELT(f1, tp2, i);
-                               }
-                       } else {
-                               if (iflag) {
-                                       ICOPY_LIST(f1, tp2, b);
-                                       ICOPY_ELT(f2, tp2, i);
-                               } else {
-                                       CCOPY_LIST(f1, tp2, b);
-                                       CCOPY_ELT(f2, tp2, i);
-                               }
-                       }
-               }
-               if (f2 < l2) {
-                       if (iflag)
-                               ICOPY_LIST(f2, tp2, l2);
-                       else
-                               CCOPY_LIST(f2, tp2, l2);
-               } else if (f1 < l1) {
-                       if (iflag)
-                               ICOPY_LIST(f1, tp2, l1);
-                       else
-                               CCOPY_LIST(f1, tp2, l1);
-               }
-               *p1 = l2;
-           }
-           tp2 = list1;        /* swap list1, list2 */
-           list1 = list2;
-           list2 = tp2;
-           last = list2 + nmemb*size;
-       }
-       if (base == list2) {
-               memmove(list2, list1, nmemb*size);
-               list2 = list1;
-       }
-       free(list2);
-       return (0);
-}
-
-#define        swap(a, b) {                                    \
-               s = b;                                  \
-               i = size;                               \
-               do {                                    \
-                       tmp = *a; *a++ = *s; *s++ = tmp; \
-               } while (--i);                          \
-               a -= size;                              \
-       }
-#define reverse(bot, top) {                            \
-       s = top;                                        \
-       do {                                            \
-               i = size;                               \
-               do {                                    \
-                       tmp = *bot; *bot++ = *s; *s++ = tmp; \
-               } while (--i);                          \
-               s -= size2;                             \
-       } while(bot < s);                               \
-}
-
-/*
- * Optional hybrid natural/pairwise first pass.  Eats up list1 in runs of
- * increasing order, list2 in a corresponding linked list.  Checks for runs
- * when THRESHOLD/2 pairs compare with same sense.  (Only used when NATURAL
- * is defined.  Otherwise simple pairwise merging is used.)
- */
-void
-setup(list1, list2, n, size, cmp)
-       size_t n, size;
-       int (*cmp)(const void *, const void *);
-       u_char *list1, *list2;
-{
-       size_t i, size2;
-       int length, tmp, sense;
-       u_char *f1, *f2, *s, *l2, *last, *p2;
-
-       size2 = size*2;
-       if (n <= 5) {
-               insertionsort(list1, n, size, cmp);
-               *EVAL(list2) = (u_char*) list2 + n*size;
-               return;
-       }
-       /*
-        * Avoid running pointers out of bounds; limit n to evens
-        * for simplicity.
-        */
-       i = 4 + (n & 1);
-       insertionsort(list1 + (n - i) * size, i, size, cmp);
-       last = list1 + size * (n - i);
-       *EVAL(list2 + (last - list1)) = list2 + n * size;
-
-#ifdef NATURAL
-       p2 = list2;
-       f1 = list1;
-       sense = (cmp(f1, f1 + size) > 0);
-       for (; f1 < last; sense = !sense) {
-               length = 2;
-                                       /* Find pairs with same sense. */
-               for (f2 = f1 + size2; f2 < last; f2 += size2) {
-                       if ((cmp(f2, f2+ size) > 0) != sense)
-                               break;
-                       length += 2;
-               }
-               if (length < THRESHOLD) {               /* Pairwise merge */
-                       do {
-                               p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
-                               if (sense > 0)
-                                       swap (f1, f1 + size);
-                       } while ((f1 += size2) < f2);
-               } else {                                /* Natural merge */
-                       l2 = f2;
-                       for (f2 = f1 + size2; f2 < l2; f2 += size2) {
-                               if ((cmp(f2-size, f2) > 0) != sense) {
-                                       p2 = *EVAL(p2) = f2 - list1 + list2;
-                                       if (sense > 0)
-                                               reverse(f1, f2-size);
-                                       f1 = f2;
-                               }
-                       }
-                       if (sense > 0)
-                               reverse (f1, f2-size);
-                       f1 = f2;
-                       if (f2 < last || cmp(f2 - size, f2) > 0)
-                               p2 = *EVAL(p2) = f2 - list1 + list2;
-                       else
-                               p2 = *EVAL(p2) = list2 + n*size;
-               }
-       }
-#else          /* pairwise merge only. */
-       for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
-               p2 = *EVAL(p2) = p2 + size2;
-               if (cmp (f1, f1 + size) > 0)
-                       swap(f1, f1 + size);
-       }
-#endif /* NATURAL */
-}
-
-/*
- * This is to avoid out-of-bounds addresses in sorting the
- * last 4 elements.
- */
-static void
-insertionsort(a, n, size, cmp)
-       u_char *a;
-       size_t n, size;
-       int (*cmp)(const void *, const void *);
-{
-       u_char *ai, *s, *t, *u, tmp;
-       int i;
-
-       for (ai = a+size; --n >= 1; ai += size)
-               for (t = ai; t > a; t -= size) {
-                       u = t - size;
-                       if (cmp(u, t) <= 0)
-                               break;
-                       swap(u, t);
-               }
-}
diff --git a/stdlib/merge_b-fbsd.c b/stdlib/merge_b-fbsd.c
deleted file mode 100644 (file)
index 6caebaa..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c    8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/merge.c,v 1.8 2007/01/09 00:28:10 imp Exp $");
-
-/*
- * Hybrid exponential search/linear search merge sort with hybrid
- * natural/pairwise first pass.  Requires about .3% more comparisons
- * for random data than LSMS with pairwise first pass alone.
- * It works for objects as small as two bytes.
- */
-
-#define NATURAL
-#define THRESHOLD 16   /* Best choice for natural merge cut-off. */
-
-/* #define NATURAL to get hybrid natural merge.
- * (The default is pairwise merging.)
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-static void setup(u_char *, u_char *, size_t, size_t,
-    int (^)(const void *, const void *));
-static void insertionsort(u_char *, size_t, size_t,
-    int (^)(const void *, const void *));
-
-#define ISIZE sizeof(int)
-#define PSIZE sizeof(u_char *)
-#define ICOPY_LIST(src, dst, last)                             \
-       do                                                      \
-       *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE;    \
-       while(src < last)
-#define ICOPY_ELT(src, dst, i)                                 \
-       do                                                      \
-       *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE;  \
-       while (i -= ISIZE)
-
-#define CCOPY_LIST(src, dst, last)             \
-       do                                      \
-               *dst++ = *src++;                \
-       while (src < last)
-#define CCOPY_ELT(src, dst, i)                 \
-       do                                      \
-               *dst++ = *src++;                \
-       while (i -= 1)
-
-/*
- * Find the next possible pointer head.  (Trickery for forcing an array
- * to do double duty as a linked list when objects do not align with word
- * boundaries.
- */
-/* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **)                                            \
-       ((u_char *)0 +                                                  \
-           (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
-
-/*
- * Arguments are as for qsort.
- */
-int
-mergesort_b(base, nmemb, size, cmp)
-       void *base;
-       size_t nmemb;
-       size_t size;
-       int (^cmp)(const void *, const void *);
-{
-       size_t i;
-       int sense;
-       int big, iflag;
-       u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
-       u_char *list2, *list1, *p2, *p, *last, **p1;
-
-       if (size < PSIZE / 2) {         /* Pointers must fit into 2 * size. */
-               errno = EINVAL;
-               return (-1);
-       }
-
-       if (nmemb == 0)
-               return (0);
-
-       /*
-        * XXX
-        * Stupid subtraction for the Cray.
-        */
-       iflag = 0;
-       if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
-               iflag = 1;
-
-       if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
-               return (-1);
-
-       list1 = base;
-       setup(list1, list2, nmemb, size, cmp);
-       last = list2 + nmemb * size;
-       i = big = 0;
-       while (*EVAL(list2) != last) {
-           l2 = list1;
-           p1 = EVAL(list1);
-           for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
-               p2 = *EVAL(p2);
-               f1 = l2;
-               f2 = l1 = list1 + (p2 - list2);
-               if (p2 != last)
-                       p2 = *EVAL(p2);
-               l2 = list1 + (p2 - list2);
-               while (f1 < l1 && f2 < l2) {
-                       if (cmp(f1, f2) <= 0) {
-                               q = f2;
-                               b = f1, t = l1;
-                               sense = -1;
-                       } else {
-                               q = f1;
-                               b = f2, t = l2;
-                               sense = 0;
-                       }
-                       if (!big) {     /* here i = 0 */
-                               while ((b += size) < t && cmp(q, b) >sense)
-                                       if (++i == 6) {
-                                               big = 1;
-                                               goto EXPONENTIAL;
-                                       }
-                       } else {
-EXPONENTIAL:                   for (i = size; ; i <<= 1)
-                                       if ((p = (b + i)) >= t) {
-                                               if ((p = t - size) > b &&
-                                                   cmp(q, p) <= sense)
-                                                       t = p;
-                                               else
-                                                       b = p;
-                                               break;
-                                       } else if (cmp(q, p) <= sense) {
-                                               t = p;
-                                               if (i == size)
-                                                       big = 0;
-                                               goto FASTCASE;
-                                       } else
-                                               b = p;
-                               while (t > b+size) {
-                                       i = (((t - b) / size) >> 1) * size;
-                                       if (cmp(q, p = b + i) <= sense)
-                                               t = p;
-                                       else
-                                               b = p;
-                               }
-                               goto COPY;
-FASTCASE:                      while (i > size)
-                                       if (cmp(q,
-                                               p = b + (i >>= 1)) <= sense)
-                                               t = p;
-                                       else
-                                               b = p;
-COPY:                          b = t;
-                       }
-                       i = size;
-                       if (q == f1) {
-                               if (iflag) {
-                                       ICOPY_LIST(f2, tp2, b);
-                                       ICOPY_ELT(f1, tp2, i);
-                               } else {
-                                       CCOPY_LIST(f2, tp2, b);
-                                       CCOPY_ELT(f1, tp2, i);
-                               }
-                       } else {
-                               if (iflag) {
-                                       ICOPY_LIST(f1, tp2, b);
-                                       ICOPY_ELT(f2, tp2, i);
-                               } else {
-                                       CCOPY_LIST(f1, tp2, b);
-                                       CCOPY_ELT(f2, tp2, i);
-                               }
-                       }
-               }
-               if (f2 < l2) {
-                       if (iflag)
-                               ICOPY_LIST(f2, tp2, l2);
-                       else
-                               CCOPY_LIST(f2, tp2, l2);
-               } else if (f1 < l1) {
-                       if (iflag)
-                               ICOPY_LIST(f1, tp2, l1);
-                       else
-                               CCOPY_LIST(f1, tp2, l1);
-               }
-               *p1 = l2;
-           }
-           tp2 = list1;        /* swap list1, list2 */
-           list1 = list2;
-           list2 = tp2;
-           last = list2 + nmemb*size;
-       }
-       if (base == list2) {
-               memmove(list2, list1, nmemb*size);
-               list2 = list1;
-       }
-       free(list2);
-       return (0);
-}
-
-#define        swap(a, b) {                                    \
-               s = b;                                  \
-               i = size;                               \
-               do {                                    \
-                       tmp = *a; *a++ = *s; *s++ = tmp; \
-               } while (--i);                          \
-               a -= size;                              \
-       }
-#define reverse(bot, top) {                            \
-       s = top;                                        \
-       do {                                            \
-               i = size;                               \
-               do {                                    \
-                       tmp = *bot; *bot++ = *s; *s++ = tmp; \
-               } while (--i);                          \
-               s -= size2;                             \
-       } while(bot < s);                               \
-}
-
-/*
- * Optional hybrid natural/pairwise first pass.  Eats up list1 in runs of
- * increasing order, list2 in a corresponding linked list.  Checks for runs
- * when THRESHOLD/2 pairs compare with same sense.  (Only used when NATURAL
- * is defined.  Otherwise simple pairwise merging is used.)
- */
-void
-setup(list1, list2, n, size, cmp)
-       size_t n, size;
-       int (^cmp)(const void *, const void *);
-       u_char *list1, *list2;
-{
-       size_t i, size2;
-       int length, tmp, sense;
-       u_char *f1, *f2, *s, *l2, *last, *p2;
-
-       size2 = size*2;
-       if (n <= 5) {
-               insertionsort(list1, n, size, cmp);
-               *EVAL(list2) = (u_char*) list2 + n*size;
-               return;
-       }
-       /*
-        * Avoid running pointers out of bounds; limit n to evens
-        * for simplicity.
-        */
-       i = 4 + (n & 1);
-       insertionsort(list1 + (n - i) * size, i, size, cmp);
-       last = list1 + size * (n - i);
-       *EVAL(list2 + (last - list1)) = list2 + n * size;
-
-#ifdef NATURAL
-       p2 = list2;
-       f1 = list1;
-       sense = (cmp(f1, f1 + size) > 0);
-       for (; f1 < last; sense = !sense) {
-               length = 2;
-                                       /* Find pairs with same sense. */
-               for (f2 = f1 + size2; f2 < last; f2 += size2) {
-                       if ((cmp(f2, f2+ size) > 0) != sense)
-                               break;
-                       length += 2;
-               }
-               if (length < THRESHOLD) {               /* Pairwise merge */
-                       do {
-                               p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
-                               if (sense > 0)
-                                       swap (f1, f1 + size);
-                       } while ((f1 += size2) < f2);
-               } else {                                /* Natural merge */
-                       l2 = f2;
-                       for (f2 = f1 + size2; f2 < l2; f2 += size2) {
-                               if ((cmp(f2-size, f2) > 0) != sense) {
-                                       p2 = *EVAL(p2) = f2 - list1 + list2;
-                                       if (sense > 0)
-                                               reverse(f1, f2-size);
-                                       f1 = f2;
-                               }
-                       }
-                       if (sense > 0)
-                               reverse (f1, f2-size);
-                       f1 = f2;
-                       if (f2 < last || cmp(f2 - size, f2) > 0)
-                               p2 = *EVAL(p2) = f2 - list1 + list2;
-                       else
-                               p2 = *EVAL(p2) = list2 + n*size;
-               }
-       }
-#else          /* pairwise merge only. */
-       for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
-               p2 = *EVAL(p2) = p2 + size2;
-               if (cmp (f1, f1 + size) > 0)
-                       swap(f1, f1 + size);
-       }
-#endif /* NATURAL */
-}
-
-/*
- * This is to avoid out-of-bounds addresses in sorting the
- * last 4 elements.
- */
-static void
-insertionsort(a, n, size, cmp)
-       u_char *a;
-       size_t n, size;
-       int (^cmp)(const void *, const void *);
-{
-       u_char *ai, *s, *t, *u, tmp;
-       int i;
-
-       for (ai = a+size; --n >= 1; ai += size)
-               for (t = ai; t > a; t -= size) {
-                       u = t - size;
-                       if (cmp(u, t) <= 0)
-                               break;
-                       swap(u, t);
-               }
-}
diff --git a/stdlib/psort-fbsd.c b/stdlib/psort-fbsd.c
deleted file mode 100644 (file)
index a95ce60..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-/****************************************************************************/
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qsort.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <dispatch/dispatch.h>
-#include <stddef.h>
-#include <string.h>
-#include <libkern/OSAtomic.h>
-#include <sys/mman.h>
-#include <errno.h>
-#define __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-
-#ifdef I_AM_PSORT_R
-typedef int             cmp_t(void *, const void *, const void *);
-#else
-typedef int             cmp_t(const void *, const void *);
-#endif
-#ifdef I_AM_PSORT_B
-static inline char     *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
-#else
-static inline char     *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
-#endif
-static inline void      swapfunc(char *, char *, int, int) __attribute__((always_inline));
-
-#define min(a, b)      (a) < (b) ? a : b
-
-#define NARGS                  ((PAGESIZE - offsetof(struct page, args)) / sizeof(union args))
-#define PAGESIZE               4096
-#define PARALLEL_MIN_SIZE      2000    /* determine heuristically */
-
-struct shared; /* forward reference */
-union args {
-    union args *next;
-    struct {
-       struct shared *shared;
-       void *a;
-       size_t n;
-       int depth_limit;
-    } /* anonymous */;
-};
-
-struct page {
-    struct page *next;
-    union args args[0];
-};
-
-struct shared {
-    char *who;
-    union args *freelist;
-    struct page *pagelist;
-#ifdef I_AM_PSORT_R
-    void *thunk;
-#endif
-#ifdef I_AM_PSORT_B
-    cmp_t ^cmp;
-#else
-    cmp_t *cmp;
-#endif
-    size_t es;
-    size_t turnoff;
-    dispatch_queue_t queue;
-    pthread_cond_t cond;
-    pthread_mutex_t mutex;
-    OSSpinLock sharedlock;
-    int count;
-};
-
-static union args *
-getargs(struct shared *shared)
-{
-    union args *args;
-
-    OSSpinLockLock(&shared->sharedlock);
-    if(!shared->freelist) {
-       struct page *page;
-       union args *prev;
-       int i;
-       if((page = (struct page *)mmap(NULL, PAGESIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == NULL)
-           return NULL;
-       page->next = shared->pagelist;
-       shared->pagelist = page;
-       prev = NULL;
-       for(args = page->args, i = NARGS; i > 0; args++, i--) {
-           args->next = prev;
-           prev = args;
-       }
-       shared->freelist = prev;
-    }
-    args = shared->freelist;
-    shared->freelist = args->next;
-    OSSpinLockUnlock(&shared->sharedlock);
-    return args;
-}
-
-static void
-returnargs(struct shared *shared, union args *args)
-{
-    OSSpinLockLock(&shared->sharedlock);
-    args->next = shared->freelist;
-    shared->freelist = args;
-    OSSpinLockUnlock(&shared->sharedlock);
-}
-
-/*
- * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
- */
-#define swapcode(TYPE, parmi, parmj, n) {              \
-       long i = (n) / sizeof (TYPE);                   \
-       TYPE *pi = (TYPE *) (parmi);            \
-       TYPE *pj = (TYPE *) (parmj);            \
-       do {                                            \
-               TYPE    t = *pi;                \
-               *pi++ = *pj;                            \
-               *pj++ = t;                              \
-        } while (--i > 0);                             \
-}
-
-#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
-       es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
-
-static inline void
-swapfunc(a, b, n, swaptype)
-       char *a, *b;
-       int n, swaptype;
-{
-       if(swaptype <= 1)
-               swapcode(long, a, b, n)
-       else
-               swapcode(char, a, b, n)
-}
-
-#define swap(a, b)                                     \
-       if (swaptype == 0) {                            \
-               long t = *(long *)(a);                  \
-               *(long *)(a) = *(long *)(b);            \
-               *(long *)(b) = t;                       \
-       } else                                          \
-               swapfunc(a, b, es, swaptype)
-
-#define vecswap(a, b, n)       if ((n) > 0) swapfunc(a, b, n, swaptype)
-
-#ifdef I_AM_PSORT_R
-#define        CMP(t, x, y) (cmp((t), (x), (y)))
-#else
-#define        CMP(t, x, y) (cmp((x), (y)))
-#endif
-
-static inline char *
-med3(char *a, char *b, char *c,
-#ifdef I_AM_PSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-void *thunk
-#ifndef I_AM_PSORT_R
-__unused
-#endif
-)
-{
-       return CMP(thunk, a, b) < 0 ?
-              (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
-              :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
-}
-
-#ifdef __LP64__
-#define DEPTH(x)       (2 * (flsl((long)(x)) - 1))
-#else /* !__LP64__ */
-#define DEPTH(x)       (2 * (fls((int)(x)) - 1))
-#endif /* __LP64__ */
-
-#ifdef I_AM_PSORT_R
-int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
-#endif
-
-static void _psort_parallel(void *x);
-
-static void
-_psort(void *a, size_t n, size_t es,
-#ifdef I_AM_PSORT_R
-void *thunk,
-#else
-#define thunk  NULL
-#endif
-#ifdef I_AM_PSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-int depth_limit, struct shared *shared)
-{
-       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
-       size_t d, r;
-       int cmp_result;
-       int swaptype, swap_cnt;
-
-loop:
-       if (depth_limit-- <= 0) {
-#ifdef I_AM_PSORT_B
-               heapsort_b(a, n, es, cmp);
-#elif defined(I_AM_PSORT_R)
-               __heapsort_r(a, n, es, thunk, cmp);
-#else
-               heapsort(a, n, es, cmp);
-#endif
-               return;
-       }
-       SWAPINIT(a, es);
-       swap_cnt = 0;
-       if (n < 7) {
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es)
-                               swap(pl, pl - es);
-               return;
-       }
-       pm = (char *)a + (n / 2) * es;
-       if (n > 7) {
-               pl = a;
-               pn = (char *)a + (n - 1) * es;
-               if (n > 40) {
-                       d = (n / 8) * es;
-                       pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
-                       pm = med3(pm - d, pm, pm + d, cmp, thunk);
-                       pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
-               }
-               pm = med3(pl, pm, pn, cmp, thunk);
-       }
-       swap(a, pm);
-       pa = pb = (char *)a + es;
-
-       pc = pd = (char *)a + (n - 1) * es;
-       for (;;) {
-               while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pa, pb);
-                               pa += es;
-                       }
-                       pb += es;
-               }
-               while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pc, pd);
-                               pd -= es;
-                       }
-                       pc -= es;
-               }
-               if (pb > pc)
-                       break;
-               swap(pb, pc);
-               swap_cnt = 1;
-               pb += es;
-               pc -= es;
-       }
-
-       pn = (char *)a + n * es;
-       r = min(pa - (char *)a, pb - pa);
-       vecswap(a, pb - r, r);
-       r = min(pd - pc, pn - pd - es);
-       vecswap(pb, pn - r, r);
-
-       if (swap_cnt == 0) {  /* Switch to insertion sort */
-               r = 1 + n / 4; /* n >= 7, so r >= 2 */
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es) {
-                               swap(pl, pl - es);
-                               if (++swap_cnt > r) goto nevermind;
-                       }
-               return;
-       }
-
-nevermind:
-       if ((r = pb - pa) > es) {
-               r /= es;
-               if (shared && r > shared->turnoff) {
-                       union args *args = getargs(shared);
-
-                       if (args == NULL)
-                               LIBC_ABORT("%s: getargs: %s", shared->who, strerror(errno));
-                       args->shared = shared;
-                       args->a = a;
-                       args->n = r;
-                       args->depth_limit = depth_limit;
-                       OSAtomicIncrement32(&shared->count);
-                       dispatch_async_f(shared->queue, args, _psort_parallel);
-               } else {
-#ifdef I_AM_PSORT_R
-                       _psort(a, r, es, thunk, cmp, depth_limit, NULL);
-#else
-                       _psort(a, r, es, cmp, depth_limit, NULL);
-#endif
-               }
-       }
-       if ((r = pd - pc) > es) {
-               /* Iterate rather than recurse to save stack space */
-               a = pn - r;
-               n = r / es;
-               goto loop;
-       }
-/*             psort(pn - r, r / es, es, cmp);*/
-}
-
-static void
-_psort_parallel(void *x)
-{
-       union args *args = (union args *)x;
-       struct shared *shared = args->shared;
-
-       _psort(args->a, args->n, shared->es,
-#ifdef I_AM_PSORT_R
-               shared->thunk,
-#endif
-               shared->cmp, args->depth_limit, shared);
-       returnargs(shared, args);
-       if(OSAtomicDecrement32(&shared->count) <= 0) {
-               pthread_mutex_lock(&shared->mutex);
-               pthread_cond_signal(&shared->cond);
-               pthread_mutex_unlock(&shared->mutex);
-       }
-}
-
-/* fast, approximate integer square root */
-static size_t
-isqrt(size_t x)
-{
-    size_t s = 1L << (flsl(x) / 2);
-    return (s + x / s) / 2;
-}
-
-void
-#ifdef I_AM_PSORT_R
-psort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-#elif defined(I_AM_PSORT_B)
-psort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
-#else
-psort(void *a, size_t n, size_t es, cmp_t *cmp)
-#endif
-{
-       if (n >= PARALLEL_MIN_SIZE && _NumCPUs() > 1) {
-               struct shared shared;
-               union args *args;
-
-               bzero(&shared, sizeof(shared));
-               shared.sharedlock = OS_SPINLOCK_INIT;
-               if ((args = getargs(&shared)) != NULL) {
-                       struct page *p, *pp;
-#ifdef I_AM_PSORT_R
-                       shared.who = "psort_r";
-                       shared.thunk = thunk;
-#elif defined(I_AM_PSORT_B)
-                       shared.who = "psort_b";
-#else
-                       shared.who = "psort";
-#endif
-                       shared.cmp = cmp;
-                       shared.es = es;
-                       shared.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-                       shared.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
-                       shared.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
-                       args->a = a;
-                       args->n = n;
-                       args->depth_limit = DEPTH(n);
-                       args->shared = &shared;
-                       /*
-                        * The turnoff value is the size of a partition that,
-                        * below which, we stop doing in parallel, and just do
-                        * in the current thread.  The value of sqrt(n) was
-                        * determined heuristically.  There is a smaller
-                        * dependence on the slowness of the comparison
-                        * function, and there might be a dependence on the
-                        * number of processors, but the algorithm has not been
-                        * determined.  Because the sensitivity to the turnoff
-                        * value is relatively low, we use a fast, approximate
-                        * integer square root routine that is good enough for
-                        * this purpose.
-                        */
-                       shared.turnoff = isqrt(n);
-                       OSAtomicIncrement32(&shared.count);
-                       _psort_parallel(args);
-
-                       /* wait for queue to drain */
-                       pthread_mutex_lock(&shared.mutex);
-                       while(shared.count > 0)
-                               pthread_cond_wait(&shared.cond, &shared.mutex);
-
-                       pthread_mutex_unlock(&shared.mutex);
-                       pthread_mutex_destroy(&shared.mutex);
-                       pthread_cond_destroy(&shared.cond);
-                       for(p = shared.pagelist; p; p = pp) {
-                               pp = p->next;
-                               munmap(p, PAGESIZE);
-                       }
-                       return;
-               }
-       }
-       /* Just call qsort */
-#ifdef I_AM_PSORT_R
-       qsort_r(a, n, es, thunk, cmp);
-#elif defined(I_AM_PSORT_B)
-       qsort_b(a, n, es, cmp);
-#else
-       qsort(a, n, es, cmp);
-#endif
-}
diff --git a/stdlib/psort.3 b/stdlib/psort.3
deleted file mode 100644 (file)
index e5572fc..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)qsort.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/qsort.3,v 1.17 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd Nov 25, 2008
-.Dt PSORT 3
-.Os "Mac OS X"
-.Sh NAME
-.Nm psort ,
-#ifdef UNIFDEF_BLOCKS
-.Nm psort_b ,
-#endif
-.Nm psort_r
-.Nd parallel sort functions
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft void
-.Fo psort
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#ifdef UNIFDEF_BLOCKS
-.Ft void
-.Fo psort_b
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#endif
-.Ft void
-.Fo psort_r
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "void *thunk"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
-.Fc
-.Sh DESCRIPTION
-The
-#ifdef UNIFDEF_BLOCKS
-.Fn psort ,
-.Fn psort_b ,
-#else
-.Fn psort
-#endif
-and
-.Fn psort_r
-functions are parallel sort routines that are drop-in compatible with the
-corresponding
-.Fn qsort
-function (see
-.Xr qsort 3
-for a description of the arguments).
-On multiprocessor machines, multiple threads may be created to simultaneously
-perform the sort calculations, resulting in an overall faster sort result.
-Overhead in managing the threads limits the maximum speed improvement to
-somewhat less that the number of processors available.
-For example, on a 4-processor machine, a typical sort on a large array might
-result in 3.2 times faster sorting than a regular
-.Fn qsort .
-.Sh RESTRICTIONS
-Because of the multi-threaded nature of the sort, the comparison function
-is expected to perform its own synchronization that might be required for
-data physically
-.Em outside
-the two objects passed to the comparison function.
-However, no synchronization is required for the two
-object themselves, unless some third party is also accessing those objects.
-.Pp
-Additional memory is temporary allocated to deal with the parallel nature
-of the computation.
-.Pp
-Because of the overhead of maintaining multiple threads, the
-.Fn psort
-family of routines may choose to just call
-.Xr qsort 3
-when there is no advantage to parallelizing (for example, when the number of
-objects in the array is too small, or only one processor is available).
-.Pp
-Like
-.Xr qsort 3 ,
-the sort is not stable.
-.Sh RETURN VALUES
-The
-#ifdef UNIFDEF_BLOCKS
-.Fn psort ,
-.Fn psort_b
-#else
-.Fn psort
-#endif
-and
-.Fn psort_r
-functions
-return no value.
-.Sh SEE ALSO
-.Xr qsort 3
-.Sh SEE ALSO
-.Xr sort 1 ,
-.Xr radixsort 3
-.Rs
-.%A Hoare, C.A.R.
-.%D 1962
-.%T "Quicksort"
-.%J "The Computer Journal"
-.%V 5:1
-.%P pp. 10-15
-.Re
-.Rs
-.%A Williams, J.W.J
-.%D 1964
-.%T "Heapsort"
-.%J "Communications of the ACM"
-.%V 7:1
-.%P pp. 347-348
-.Re
-.Rs
-.%A Knuth, D.E.
-.%D 1968
-.%B "The Art of Computer Programming"
-.%V Vol. 3
-.%T "Sorting and Searching"
-.%P pp. 114-123, 145-149
-.Re
-.Rs
-.%A McIlroy, P.M.
-.%T "Optimistic Sorting and Information Theoretic Complexity"
-.%J "Fourth Annual ACM-SIAM Symposium on Discrete Algorithms"
-.%V January 1992
-.Re
-.Rs
-.%A Bentley, J.L.
-.%A McIlroy, M.D.
-.%T "Engineering a Sort Function"
-.%J "Software--Practice and Experience"
-.%V Vol. 23(11)
-.%P pp. 1249-1265
-.%D November\ 1993
-.Re
-.Sh STANDARDS
-The
-.Fn qsort
-function
-conforms to
-.St -isoC .
diff --git a/stdlib/psort.3.patch b/stdlib/psort.3.patch
deleted file mode 100644 (file)
index 77aea36..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
---- psort.3.orig       2010-10-07 21:34:52.000000000 -0700
-+++ psort.3    2010-10-07 21:45:11.000000000 -0700
-@@ -32,60 +32,20 @@
- .\"     @(#)qsort.3   8.1 (Berkeley) 6/4/93
- .\" $FreeBSD: src/lib/libc/stdlib/qsort.3,v 1.17 2007/01/09 00:28:10 imp Exp $
- .\"
--.Dd September 30, 2003
--.Dt QSORT 3
--.Os
-+.Dd Nov 25, 2008
-+.Dt PSORT 3
-+.Os "Mac OS X"
- .Sh NAME
--.Nm heapsort ,
-+.Nm psort ,
- #ifdef UNIFDEF_BLOCKS
--.Nm heapsort_b ,
-+.Nm psort_b ,
- #endif
--.Nm mergesort ,
--#ifdef UNIFDEF_BLOCKS
--.Nm mergesort_b ,
--#endif
--.Nm qsort ,
--#ifdef UNIFDEF_BLOCKS
--.Nm qsort_b ,
--#endif
--.Nm qsort_r
--.Nd sort functions
-+.Nm psort_r
-+.Nd parallel sort functions
- .Sh SYNOPSIS
- .In stdlib.h
--.Ft int
--.Fo heapsort
--.Fa "void *base"
--.Fa "size_t nel"
--.Fa "size_t width"
--.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
--.Fc
--#ifdef UNIFDEF_BLOCKS
--.Ft int
--.Fo heapsort_b
--.Fa "void *base"
--.Fa "size_t nel"
--.Fa "size_t width"
--.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
--.Fc
--#endif
--.Ft int
--.Fo mergesort
--.Fa "void *base"
--.Fa "size_t nel"
--.Fa "size_t width"
--.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
--.Fc
--#ifdef UNIFDEF_BLOCKS
--.Ft int
--.Fo mergesort_b
--.Fa "void *base"
--.Fa "size_t nel"
--.Fa "size_t width"
--.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
--.Fc
--#endif
- .Ft void
--.Fo qsort
-+.Fo psort
- .Fa "void *base"
- .Fa "size_t nel"
- .Fa "size_t width"
-@@ -93,7 +53,7 @@
- .Fc
- #ifdef UNIFDEF_BLOCKS
- .Ft void
--.Fo qsort_b
-+.Fo psort_b
- .Fa "void *base"
- .Fa "size_t nel"
- .Fa "size_t width"
-@@ -101,7 +61,7 @@
- .Fc
- #endif
- .Ft void
--.Fo qsort_r
-+.Fo psort_r
- .Fa "void *base"
- .Fa "size_t nel"
- .Fa "size_t width"
-@@ -110,210 +70,63 @@
- .Fc
- .Sh DESCRIPTION
- The
--.Fn qsort
--function is a modified partition-exchange sort, or quicksort.
--The
--.Fn heapsort
--function is a modified selection sort.
--The
--.Fn mergesort
--function is a modified merge sort with exponential search,
--intended for sorting data with pre-existing order.
--.Pp
--The
--.Fn qsort
--and
--.Fn heapsort
--functions sort an array of
--.Fa nel
--objects, the initial member of which is pointed to by
--.Fa base .
--The size of each object is specified by
--.Fa width .
--The
--.Fn mergesort
--function
--behaves similarly, but
--.Em requires
--that
--.Fa width
--be greater than or equal to
--.Dq "sizeof(void *) / 2" .
--.Pp
--The contents of the array
--.Fa base
--are sorted in ascending order according to
--a comparison function pointed to by
--.Fa compar ,
--which requires two arguments pointing to the objects being
--compared.
--.Pp
--The comparison function must return an integer less than, equal to, or
--greater than zero if the first argument is considered to be respectively
--less than, equal to, or greater than the second.
--.Pp
--The
--.Fn qsort_r
--function behaves identically to
--.Fn qsort ,
--except that it takes an additional argument,
--.Fa thunk ,
--which is passed unchanged as the first argument to function pointed to
--.Fa compar .
--This allows the comparison function to access additional
--data without using global variables, and thus
--.Fn qsort_r
--is suitable for use in functions which must be reentrant.
--.Pp
--The algorithms implemented by
--.Fn qsort ,
--.Fn qsort_r ,
--and
--.Fn heapsort
--are
--.Em not
--stable; that is, if two members compare as equal, their order in
--the sorted array is undefined.
--The
--.Fn mergesort
--algorithm is stable.
--.Pp
--The
--.Fn qsort
--and
--.Fn qsort_r
--functions are an implementation of C.A.R.
--Hoare's
--.Dq quicksort
--algorithm,
--a variant of partition-exchange sorting; in particular, see
--.An D.E. Knuth Ns 's
--.%T "Algorithm Q" .
--.Sy Quicksort
--takes O N lg N average time.
--This implementation uses median selection to avoid its
--O N**2 worst-case behavior.
--.Pp
--The
--.Fn heapsort
--function is an implementation of
--.An "J.W.J. William" Ns 's
--.Dq heapsort
--algorithm,
--a variant of selection sorting; in particular, see
--.An "D.E. Knuth" Ns 's
--.%T "Algorithm H" .
--.Sy Heapsort
--takes O N lg N worst-case time.
--Its
--.Em only
--advantage over
--.Fn qsort
--is that it uses almost no additional memory; while
--.Fn qsort
--does not allocate memory, it is implemented using recursion.
--.Pp
--The function
--.Fn mergesort
--requires additional memory of size
--.Fa nel *
--.Fa width
--bytes; it should be used only when space is not at a premium.
--The
--.Fn mergesort
--function
--is optimized for data with pre-existing order; its worst case
--time is O N lg N; its best case is O N.
--.Pp
--Normally,
--.Fn qsort
--is faster than
--.Fn mergesort
--which is faster than
--.Fn heapsort .
--Memory availability and pre-existing order in the data can make this
--untrue.
- #ifdef UNIFDEF_BLOCKS
--.Pp
--The
--.Fn heapsort_b ,
--.Fn mergesort_b ,
--and
--.Fn qsort_b
--routines are like the corresponding routines without the _b suffix, expect
--that the
--.Fa compar
--callback is a block pointer instead of a function pointer.
-+.Fn psort ,
-+.Fn psort_b ,
-+#else
-+.Fn psort
- #endif
-+and
-+.Fn psort_r
-+functions are parallel sort routines that are drop-in compatible with the
-+corresponding
-+.Fn qsort
-+function (see
-+.Xr qsort 3
-+for a description of the arguments).
-+On multiprocessor machines, multiple threads may be created to simultaneously
-+perform the sort calculations, resulting in an overall faster sort result.
-+Overhead in managing the threads limits the maximum speed improvement to
-+somewhat less that the number of processors available.
-+For example, on a 4-processor machine, a typical sort on a large array might
-+result in 3.2 times faster sorting than a regular
-+.Fn qsort .
-+.Sh RESTRICTIONS
-+Because of the multi-threaded nature of the sort, the comparison function
-+is expected to perform its own synchronization that might be required for
-+data physically
-+.Em outside
-+the two objects passed to the comparison function.
-+However, no synchronization is required for the two
-+object themselves, unless some third party is also accessing those objects.
-+.Pp
-+Additional memory is temporary allocated to deal with the parallel nature
-+of the computation.
-+.Pp
-+Because of the overhead of maintaining multiple threads, the
-+.Fn psort
-+family of routines may choose to just call
-+.Xr qsort 3
-+when there is no advantage to parallelizing (for example, when the number of
-+objects in the array is too small, or only one processor is available).
-+.Pp
-+Like
-+.Xr qsort 3 ,
-+the sort is not stable.
- .Sh RETURN VALUES
- The
- #ifdef UNIFDEF_BLOCKS
--.Fn qsort ,
--.Fn qsort_b
-+.Fn psort ,
-+.Fn psort_b
- #else
--.Fn qsort
-+.Fn psort
- #endif
- and
--.Fn qsort_r
-+.Fn psort_r
- functions
- return no value.
--.Pp
--#ifdef UNIFDEF_BLOCKS
--.ds HEAPSORT_B heapsort_b
--.ds MERGESORT_B mergesort_b
--#endif
--.Rv -std heapsort \*[HEAPSORT_B] mergesort \*[MERGESORT_B]
--.Sh COMPATIBILITY
--Previous versions of
--.Fn qsort
--did not permit the comparison routine itself to call
--.Fn qsort 3 .
--This is no longer true.
--.Sh ERRORS
--The
--#ifdef UNIFDEF_BLOCKS
--.Fn heapsort ,
--.Fn heapsort_b ,
--.Fn mergesort ,
--and
--.Fn mergesort_b
--#else
--.Fn heapsort
--and
--.Fn mergesort
--#endif
--functions succeed unless:
--.Bl -tag -width Er
--.It Bq Er EINVAL
--The
--.Fa width
--argument is zero, or,
--the
--.Fa width
--argument to
--.Fn mergesort
--#ifdef UNIFDEF_BLOCKS
--or
--.Fn mergesort_b
--#endif
--is less than
--.Dq "sizeof(void *) / 2" .
--.It Bq Er ENOMEM
--The
--#ifdef UNIFDEF_BLOCKS
--.Fn heapsort ,
--.Fn heapsort_b ,
--.Fn mergesort ,
--or
--.Fn mergesort_b
--#else
--.Fn heapsort
--or
--.Fn mergesort
--#endif
--functions
--were unable to allocate memory.
--.El
-+.Sh SEE ALSO
-+.Xr qsort 3
- .Sh SEE ALSO
- .Xr sort 1 ,
- .Xr radixsort 3
diff --git a/stdlib/psort.c.patch b/stdlib/psort.c.patch
deleted file mode 100644 (file)
index b718226..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
---- psort.c.orig       2008-11-24 17:01:07.000000000 -0800
-+++ psort.c    2008-11-24 22:02:57.000000000 -0800
-@@ -1,3 +1,4 @@
-+/****************************************************************************/
- /*-
-  * Copyright (c) 1992, 1993
-  *    The Regents of the University of California.  All rights reserved.
-@@ -34,14 +35,22 @@ static char sccsid[] = "@(#)qsort.c        8.1 
- __FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
- #include <stdlib.h>
-+#include <pthread.h>
-+#include <dispatch/dispatch.h>
-+#include <stddef.h>
- #include <string.h>
-+#include <libkern/OSAtomic.h>
-+#include <sys/mman.h>
-+#include <errno.h>
-+#define __APPLE_API_PRIVATE
-+#include <machine/cpu_capabilities.h>
--#ifdef I_AM_QSORT_R
-+#ifdef I_AM_PSORT_R
- typedef int            cmp_t(void *, const void *, const void *);
- #else
- typedef int            cmp_t(const void *, const void *);
- #endif
--#ifdef I_AM_QSORT_B
-+#ifdef I_AM_PSORT_B
- static inline char    *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
- #else
- static inline char    *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
-@@ -50,6 +59,83 @@ static inline void   swapfunc(char *, cha
- #define min(a, b)     (a) < (b) ? a : b
-+#define NARGS                 ((PAGESIZE - offsetof(struct page, args)) / sizeof(union args))
-+#define PAGESIZE              4096
-+#define PARALLEL_MIN_SIZE     2000    /* determine heuristically */
-+
-+struct shared; /* forward reference */
-+union args {
-+    union args *next;
-+    struct {
-+      struct shared *shared;
-+      void *a;
-+      size_t n;
-+      int depth_limit;
-+    } /* anonymous */;
-+};
-+
-+struct page {
-+    struct page *next;
-+    union args args[0];
-+};
-+
-+struct shared {
-+    char *who;
-+    union args *freelist;
-+    struct page *pagelist;
-+#ifdef I_AM_PSORT_R
-+    void *thunk;
-+#endif
-+#ifdef I_AM_PSORT_B
-+    cmp_t ^cmp;
-+#else
-+    cmp_t *cmp;
-+#endif
-+    size_t es;
-+    size_t turnoff;
-+    dispatch_queue_t queue;
-+    pthread_cond_t cond;
-+    pthread_mutex_t mutex;
-+    OSSpinLock sharedlock;
-+    int count;
-+};
-+
-+static union args *
-+getargs(struct shared *shared)
-+{
-+    union args *args;
-+
-+    OSSpinLockLock(&shared->sharedlock);
-+    if(!shared->freelist) {
-+      struct page *page;
-+      union args *prev;
-+      int i;
-+      if((page = (struct page *)mmap(NULL, PAGESIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == NULL)
-+          return NULL;
-+      page->next = shared->pagelist;
-+      shared->pagelist = page;
-+      prev = NULL;
-+      for(args = page->args, i = NARGS; i > 0; args++, i--) {
-+          args->next = prev;
-+          prev = args;
-+      }
-+      shared->freelist = prev;
-+    }
-+    args = shared->freelist;
-+    shared->freelist = args->next;
-+    OSSpinLockUnlock(&shared->sharedlock);
-+    return args;
-+}
-+
-+static void
-+returnargs(struct shared *shared, union args *args)
-+{
-+    OSSpinLockLock(&shared->sharedlock);
-+    args->next = shared->freelist;
-+    shared->freelist = args;
-+    OSSpinLockUnlock(&shared->sharedlock);
-+}
-+
- /*
-  * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
-  */
-@@ -88,7 +174,7 @@ swapfunc(a, b, n, swaptype)
- #define vecswap(a, b, n)      if ((n) > 0) swapfunc(a, b, n, swaptype)
--#ifdef I_AM_QSORT_R
-+#ifdef I_AM_PSORT_R
- #define       CMP(t, x, y) (cmp((t), (x), (y)))
- #else
- #define       CMP(t, x, y) (cmp((x), (y)))
-@@ -96,13 +182,13 @@ swapfunc(a, b, n, swaptype)
- static inline char *
- med3(char *a, char *b, char *c,
--#ifdef I_AM_QSORT_B
-+#ifdef I_AM_PSORT_B
- cmp_t ^cmp,
- #else
- cmp_t *cmp,
- #endif
- void *thunk
--#ifndef I_AM_QSORT_R
-+#ifndef I_AM_PSORT_R
- __unused
- #endif
- )
-@@ -118,23 +204,25 @@ __unused
- #define DEPTH(x)      (2 * (fls((int)(x)) - 1))
- #endif /* __LP64__ */
--#ifdef I_AM_QSORT_R
-+#ifdef I_AM_PSORT_R
- int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
- #endif
-+static void _psort_parallel(void *x);
-+
- static void
--_qsort(void *a, size_t n, size_t es,
--#ifdef I_AM_QSORT_R
-+_psort(void *a, size_t n, size_t es,
-+#ifdef I_AM_PSORT_R
- void *thunk,
- #else
- #define thunk NULL
- #endif
--#ifdef I_AM_QSORT_B
-+#ifdef I_AM_PSORT_B
- cmp_t ^cmp,
- #else
- cmp_t *cmp,
- #endif
--int depth_limit)
-+int depth_limit, struct shared *shared)
- {
-       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
-       size_t d, r;
-@@ -143,9 +231,9 @@ int depth_limit)
- loop:
-       if (depth_limit-- <= 0) {
--#ifdef I_AM_QSORT_B
-+#ifdef I_AM_PSORT_B
-               heapsort_b(a, n, es, cmp);
--#elif defined(I_AM_QSORT_R)
-+#elif defined(I_AM_PSORT_R)
-               __heapsort_r(a, n, es, thunk, cmp);
- #else
-               heapsort(a, n, es, cmp);
-@@ -222,33 +310,135 @@ loop:
-       }
- nevermind:
--      if ((r = pb - pa) > es)
--#ifdef I_AM_QSORT_R
--              _qsort(a, r / es, es, thunk, cmp, depth_limit);
-+      if ((r = pb - pa) > es) {
-+              r /= es;
-+              if (shared && r > shared->turnoff) {
-+                      union args *args = getargs(shared);
-+
-+                      if (args == NULL)
-+                              LIBC_ABORT("%s: getargs: %s", shared->who, strerror(errno));
-+                      args->shared = shared;
-+                      args->a = a;
-+                      args->n = r;
-+                      args->depth_limit = depth_limit;
-+                      OSAtomicIncrement32(&shared->count);
-+                      dispatch_async_f(shared->queue, args, _psort_parallel);
-+              } else {
-+#ifdef I_AM_PSORT_R
-+                      _psort(a, r, es, thunk, cmp, depth_limit, NULL);
- #else
--              _qsort(a, r / es, es, cmp, depth_limit);
-+                      _psort(a, r, es, cmp, depth_limit, NULL);
- #endif
-+              }
-+      }
-       if ((r = pd - pc) > es) {
-               /* Iterate rather than recurse to save stack space */
-               a = pn - r;
-               n = r / es;
-               goto loop;
-       }
--/*            qsort(pn - r, r / es, es, cmp);*/
-+/*            psort(pn - r, r / es, es, cmp);*/
-+}
-+
-+static void
-+_psort_parallel(void *x)
-+{
-+      union args *args = (union args *)x;
-+      struct shared *shared = args->shared;
-+
-+      _psort(args->a, args->n, shared->es,
-+#ifdef I_AM_PSORT_R
-+              shared->thunk,
-+#endif
-+              shared->cmp, args->depth_limit, shared);
-+      returnargs(shared, args);
-+      if(OSAtomicDecrement32(&shared->count) <= 0) {
-+              pthread_mutex_lock(&shared->mutex);
-+              pthread_cond_signal(&shared->cond);
-+              pthread_mutex_unlock(&shared->mutex);
-+      }
-+}
-+
-+/* fast, approximate integer square root */
-+static size_t
-+isqrt(size_t x)
-+{
-+    size_t s = 1L << (flsl(x) / 2);
-+    return (s + x / s) / 2;
- }
- void
--#ifdef I_AM_QSORT_R
--qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
--#elif defined(I_AM_QSORT_B)
--qsort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
-+#ifdef I_AM_PSORT_R
-+psort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-+#elif defined(I_AM_PSORT_B)
-+psort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
- #else
--qsort(void *a, size_t n, size_t es, cmp_t *cmp)
-+psort(void *a, size_t n, size_t es, cmp_t *cmp)
- #endif
- {
--      _qsort(a, n, es,
--#ifdef I_AM_QSORT_R
--              thunk,
-+      if (n >= PARALLEL_MIN_SIZE && _NumCPUs() > 1) {
-+              struct shared shared;
-+              union args *args;
-+
-+              bzero(&shared, sizeof(shared));
-+              shared.sharedlock = OS_SPINLOCK_INIT;
-+              if ((args = getargs(&shared)) != NULL) {
-+                      struct page *p, *pp;
-+#ifdef I_AM_PSORT_R
-+                      shared.who = "psort_r";
-+                      shared.thunk = thunk;
-+#elif defined(I_AM_PSORT_B)
-+                      shared.who = "psort_b";
-+#else
-+                      shared.who = "psort";
-+#endif
-+                      shared.cmp = cmp;
-+                      shared.es = es;
-+                      shared.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-+                      shared.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
-+                      shared.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
-+                      args->a = a;
-+                      args->n = n;
-+                      args->depth_limit = DEPTH(n);
-+                      args->shared = &shared;
-+                      /*
-+                       * The turnoff value is the size of a partition that,
-+                       * below which, we stop doing in parallel, and just do
-+                       * in the current thread.  The value of sqrt(n) was
-+                       * determined heuristically.  There is a smaller
-+                       * dependence on the slowness of the comparison
-+                       * function, and there might be a dependence on the
-+                       * number of processors, but the algorithm has not been
-+                       * determined.  Because the sensitivity to the turnoff
-+                       * value is relatively low, we use a fast, approximate
-+                       * integer square root routine that is good enough for
-+                       * this purpose.
-+                       */
-+                      shared.turnoff = isqrt(n);
-+                      OSAtomicIncrement32(&shared.count);
-+                      _psort_parallel(args);
-+
-+                      /* wait for queue to drain */
-+                      pthread_mutex_lock(&shared.mutex);
-+                      while(shared.count > 0)
-+                              pthread_cond_wait(&shared.cond, &shared.mutex);
-+
-+                      pthread_mutex_unlock(&shared.mutex);
-+                      pthread_mutex_destroy(&shared.mutex);
-+                      pthread_cond_destroy(&shared.cond);
-+                      for(p = shared.pagelist; p; p = pp) {
-+                              pp = p->next;
-+                              munmap(p, PAGESIZE);
-+                      }
-+                      return;
-+              }
-+      }
-+      /* Just call qsort */
-+#ifdef I_AM_PSORT_R
-+      qsort_r(a, n, es, thunk, cmp);
-+#elif defined(I_AM_PSORT_B)
-+      qsort_b(a, n, es, cmp);
-+#else
-+      qsort(a, n, es, cmp);
- #endif
--              cmp, DEPTH(n));
- }
diff --git a/stdlib/psort_b-fbsd.c b/stdlib/psort_b-fbsd.c
deleted file mode 100644 (file)
index a95ce60..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-/****************************************************************************/
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qsort.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <dispatch/dispatch.h>
-#include <stddef.h>
-#include <string.h>
-#include <libkern/OSAtomic.h>
-#include <sys/mman.h>
-#include <errno.h>
-#define __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-
-#ifdef I_AM_PSORT_R
-typedef int             cmp_t(void *, const void *, const void *);
-#else
-typedef int             cmp_t(const void *, const void *);
-#endif
-#ifdef I_AM_PSORT_B
-static inline char     *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
-#else
-static inline char     *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
-#endif
-static inline void      swapfunc(char *, char *, int, int) __attribute__((always_inline));
-
-#define min(a, b)      (a) < (b) ? a : b
-
-#define NARGS                  ((PAGESIZE - offsetof(struct page, args)) / sizeof(union args))
-#define PAGESIZE               4096
-#define PARALLEL_MIN_SIZE      2000    /* determine heuristically */
-
-struct shared; /* forward reference */
-union args {
-    union args *next;
-    struct {
-       struct shared *shared;
-       void *a;
-       size_t n;
-       int depth_limit;
-    } /* anonymous */;
-};
-
-struct page {
-    struct page *next;
-    union args args[0];
-};
-
-struct shared {
-    char *who;
-    union args *freelist;
-    struct page *pagelist;
-#ifdef I_AM_PSORT_R
-    void *thunk;
-#endif
-#ifdef I_AM_PSORT_B
-    cmp_t ^cmp;
-#else
-    cmp_t *cmp;
-#endif
-    size_t es;
-    size_t turnoff;
-    dispatch_queue_t queue;
-    pthread_cond_t cond;
-    pthread_mutex_t mutex;
-    OSSpinLock sharedlock;
-    int count;
-};
-
-static union args *
-getargs(struct shared *shared)
-{
-    union args *args;
-
-    OSSpinLockLock(&shared->sharedlock);
-    if(!shared->freelist) {
-       struct page *page;
-       union args *prev;
-       int i;
-       if((page = (struct page *)mmap(NULL, PAGESIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == NULL)
-           return NULL;
-       page->next = shared->pagelist;
-       shared->pagelist = page;
-       prev = NULL;
-       for(args = page->args, i = NARGS; i > 0; args++, i--) {
-           args->next = prev;
-           prev = args;
-       }
-       shared->freelist = prev;
-    }
-    args = shared->freelist;
-    shared->freelist = args->next;
-    OSSpinLockUnlock(&shared->sharedlock);
-    return args;
-}
-
-static void
-returnargs(struct shared *shared, union args *args)
-{
-    OSSpinLockLock(&shared->sharedlock);
-    args->next = shared->freelist;
-    shared->freelist = args;
-    OSSpinLockUnlock(&shared->sharedlock);
-}
-
-/*
- * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
- */
-#define swapcode(TYPE, parmi, parmj, n) {              \
-       long i = (n) / sizeof (TYPE);                   \
-       TYPE *pi = (TYPE *) (parmi);            \
-       TYPE *pj = (TYPE *) (parmj);            \
-       do {                                            \
-               TYPE    t = *pi;                \
-               *pi++ = *pj;                            \
-               *pj++ = t;                              \
-        } while (--i > 0);                             \
-}
-
-#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
-       es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
-
-static inline void
-swapfunc(a, b, n, swaptype)
-       char *a, *b;
-       int n, swaptype;
-{
-       if(swaptype <= 1)
-               swapcode(long, a, b, n)
-       else
-               swapcode(char, a, b, n)
-}
-
-#define swap(a, b)                                     \
-       if (swaptype == 0) {                            \
-               long t = *(long *)(a);                  \
-               *(long *)(a) = *(long *)(b);            \
-               *(long *)(b) = t;                       \
-       } else                                          \
-               swapfunc(a, b, es, swaptype)
-
-#define vecswap(a, b, n)       if ((n) > 0) swapfunc(a, b, n, swaptype)
-
-#ifdef I_AM_PSORT_R
-#define        CMP(t, x, y) (cmp((t), (x), (y)))
-#else
-#define        CMP(t, x, y) (cmp((x), (y)))
-#endif
-
-static inline char *
-med3(char *a, char *b, char *c,
-#ifdef I_AM_PSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-void *thunk
-#ifndef I_AM_PSORT_R
-__unused
-#endif
-)
-{
-       return CMP(thunk, a, b) < 0 ?
-              (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
-              :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
-}
-
-#ifdef __LP64__
-#define DEPTH(x)       (2 * (flsl((long)(x)) - 1))
-#else /* !__LP64__ */
-#define DEPTH(x)       (2 * (fls((int)(x)) - 1))
-#endif /* __LP64__ */
-
-#ifdef I_AM_PSORT_R
-int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
-#endif
-
-static void _psort_parallel(void *x);
-
-static void
-_psort(void *a, size_t n, size_t es,
-#ifdef I_AM_PSORT_R
-void *thunk,
-#else
-#define thunk  NULL
-#endif
-#ifdef I_AM_PSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-int depth_limit, struct shared *shared)
-{
-       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
-       size_t d, r;
-       int cmp_result;
-       int swaptype, swap_cnt;
-
-loop:
-       if (depth_limit-- <= 0) {
-#ifdef I_AM_PSORT_B
-               heapsort_b(a, n, es, cmp);
-#elif defined(I_AM_PSORT_R)
-               __heapsort_r(a, n, es, thunk, cmp);
-#else
-               heapsort(a, n, es, cmp);
-#endif
-               return;
-       }
-       SWAPINIT(a, es);
-       swap_cnt = 0;
-       if (n < 7) {
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es)
-                               swap(pl, pl - es);
-               return;
-       }
-       pm = (char *)a + (n / 2) * es;
-       if (n > 7) {
-               pl = a;
-               pn = (char *)a + (n - 1) * es;
-               if (n > 40) {
-                       d = (n / 8) * es;
-                       pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
-                       pm = med3(pm - d, pm, pm + d, cmp, thunk);
-                       pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
-               }
-               pm = med3(pl, pm, pn, cmp, thunk);
-       }
-       swap(a, pm);
-       pa = pb = (char *)a + es;
-
-       pc = pd = (char *)a + (n - 1) * es;
-       for (;;) {
-               while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pa, pb);
-                               pa += es;
-                       }
-                       pb += es;
-               }
-               while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pc, pd);
-                               pd -= es;
-                       }
-                       pc -= es;
-               }
-               if (pb > pc)
-                       break;
-               swap(pb, pc);
-               swap_cnt = 1;
-               pb += es;
-               pc -= es;
-       }
-
-       pn = (char *)a + n * es;
-       r = min(pa - (char *)a, pb - pa);
-       vecswap(a, pb - r, r);
-       r = min(pd - pc, pn - pd - es);
-       vecswap(pb, pn - r, r);
-
-       if (swap_cnt == 0) {  /* Switch to insertion sort */
-               r = 1 + n / 4; /* n >= 7, so r >= 2 */
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es) {
-                               swap(pl, pl - es);
-                               if (++swap_cnt > r) goto nevermind;
-                       }
-               return;
-       }
-
-nevermind:
-       if ((r = pb - pa) > es) {
-               r /= es;
-               if (shared && r > shared->turnoff) {
-                       union args *args = getargs(shared);
-
-                       if (args == NULL)
-                               LIBC_ABORT("%s: getargs: %s", shared->who, strerror(errno));
-                       args->shared = shared;
-                       args->a = a;
-                       args->n = r;
-                       args->depth_limit = depth_limit;
-                       OSAtomicIncrement32(&shared->count);
-                       dispatch_async_f(shared->queue, args, _psort_parallel);
-               } else {
-#ifdef I_AM_PSORT_R
-                       _psort(a, r, es, thunk, cmp, depth_limit, NULL);
-#else
-                       _psort(a, r, es, cmp, depth_limit, NULL);
-#endif
-               }
-       }
-       if ((r = pd - pc) > es) {
-               /* Iterate rather than recurse to save stack space */
-               a = pn - r;
-               n = r / es;
-               goto loop;
-       }
-/*             psort(pn - r, r / es, es, cmp);*/
-}
-
-static void
-_psort_parallel(void *x)
-{
-       union args *args = (union args *)x;
-       struct shared *shared = args->shared;
-
-       _psort(args->a, args->n, shared->es,
-#ifdef I_AM_PSORT_R
-               shared->thunk,
-#endif
-               shared->cmp, args->depth_limit, shared);
-       returnargs(shared, args);
-       if(OSAtomicDecrement32(&shared->count) <= 0) {
-               pthread_mutex_lock(&shared->mutex);
-               pthread_cond_signal(&shared->cond);
-               pthread_mutex_unlock(&shared->mutex);
-       }
-}
-
-/* fast, approximate integer square root */
-static size_t
-isqrt(size_t x)
-{
-    size_t s = 1L << (flsl(x) / 2);
-    return (s + x / s) / 2;
-}
-
-void
-#ifdef I_AM_PSORT_R
-psort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-#elif defined(I_AM_PSORT_B)
-psort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
-#else
-psort(void *a, size_t n, size_t es, cmp_t *cmp)
-#endif
-{
-       if (n >= PARALLEL_MIN_SIZE && _NumCPUs() > 1) {
-               struct shared shared;
-               union args *args;
-
-               bzero(&shared, sizeof(shared));
-               shared.sharedlock = OS_SPINLOCK_INIT;
-               if ((args = getargs(&shared)) != NULL) {
-                       struct page *p, *pp;
-#ifdef I_AM_PSORT_R
-                       shared.who = "psort_r";
-                       shared.thunk = thunk;
-#elif defined(I_AM_PSORT_B)
-                       shared.who = "psort_b";
-#else
-                       shared.who = "psort";
-#endif
-                       shared.cmp = cmp;
-                       shared.es = es;
-                       shared.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-                       shared.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
-                       shared.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
-                       args->a = a;
-                       args->n = n;
-                       args->depth_limit = DEPTH(n);
-                       args->shared = &shared;
-                       /*
-                        * The turnoff value is the size of a partition that,
-                        * below which, we stop doing in parallel, and just do
-                        * in the current thread.  The value of sqrt(n) was
-                        * determined heuristically.  There is a smaller
-                        * dependence on the slowness of the comparison
-                        * function, and there might be a dependence on the
-                        * number of processors, but the algorithm has not been
-                        * determined.  Because the sensitivity to the turnoff
-                        * value is relatively low, we use a fast, approximate
-                        * integer square root routine that is good enough for
-                        * this purpose.
-                        */
-                       shared.turnoff = isqrt(n);
-                       OSAtomicIncrement32(&shared.count);
-                       _psort_parallel(args);
-
-                       /* wait for queue to drain */
-                       pthread_mutex_lock(&shared.mutex);
-                       while(shared.count > 0)
-                               pthread_cond_wait(&shared.cond, &shared.mutex);
-
-                       pthread_mutex_unlock(&shared.mutex);
-                       pthread_mutex_destroy(&shared.mutex);
-                       pthread_cond_destroy(&shared.cond);
-                       for(p = shared.pagelist; p; p = pp) {
-                               pp = p->next;
-                               munmap(p, PAGESIZE);
-                       }
-                       return;
-               }
-       }
-       /* Just call qsort */
-#ifdef I_AM_PSORT_R
-       qsort_r(a, n, es, thunk, cmp);
-#elif defined(I_AM_PSORT_B)
-       qsort_b(a, n, es, cmp);
-#else
-       qsort(a, n, es, cmp);
-#endif
-}
diff --git a/stdlib/psort_r-fbsd.c b/stdlib/psort_r-fbsd.c
deleted file mode 100644 (file)
index a95ce60..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-/****************************************************************************/
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qsort.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <dispatch/dispatch.h>
-#include <stddef.h>
-#include <string.h>
-#include <libkern/OSAtomic.h>
-#include <sys/mman.h>
-#include <errno.h>
-#define __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-
-#ifdef I_AM_PSORT_R
-typedef int             cmp_t(void *, const void *, const void *);
-#else
-typedef int             cmp_t(const void *, const void *);
-#endif
-#ifdef I_AM_PSORT_B
-static inline char     *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
-#else
-static inline char     *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
-#endif
-static inline void      swapfunc(char *, char *, int, int) __attribute__((always_inline));
-
-#define min(a, b)      (a) < (b) ? a : b
-
-#define NARGS                  ((PAGESIZE - offsetof(struct page, args)) / sizeof(union args))
-#define PAGESIZE               4096
-#define PARALLEL_MIN_SIZE      2000    /* determine heuristically */
-
-struct shared; /* forward reference */
-union args {
-    union args *next;
-    struct {
-       struct shared *shared;
-       void *a;
-       size_t n;
-       int depth_limit;
-    } /* anonymous */;
-};
-
-struct page {
-    struct page *next;
-    union args args[0];
-};
-
-struct shared {
-    char *who;
-    union args *freelist;
-    struct page *pagelist;
-#ifdef I_AM_PSORT_R
-    void *thunk;
-#endif
-#ifdef I_AM_PSORT_B
-    cmp_t ^cmp;
-#else
-    cmp_t *cmp;
-#endif
-    size_t es;
-    size_t turnoff;
-    dispatch_queue_t queue;
-    pthread_cond_t cond;
-    pthread_mutex_t mutex;
-    OSSpinLock sharedlock;
-    int count;
-};
-
-static union args *
-getargs(struct shared *shared)
-{
-    union args *args;
-
-    OSSpinLockLock(&shared->sharedlock);
-    if(!shared->freelist) {
-       struct page *page;
-       union args *prev;
-       int i;
-       if((page = (struct page *)mmap(NULL, PAGESIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0)) == NULL)
-           return NULL;
-       page->next = shared->pagelist;
-       shared->pagelist = page;
-       prev = NULL;
-       for(args = page->args, i = NARGS; i > 0; args++, i--) {
-           args->next = prev;
-           prev = args;
-       }
-       shared->freelist = prev;
-    }
-    args = shared->freelist;
-    shared->freelist = args->next;
-    OSSpinLockUnlock(&shared->sharedlock);
-    return args;
-}
-
-static void
-returnargs(struct shared *shared, union args *args)
-{
-    OSSpinLockLock(&shared->sharedlock);
-    args->next = shared->freelist;
-    shared->freelist = args;
-    OSSpinLockUnlock(&shared->sharedlock);
-}
-
-/*
- * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
- */
-#define swapcode(TYPE, parmi, parmj, n) {              \
-       long i = (n) / sizeof (TYPE);                   \
-       TYPE *pi = (TYPE *) (parmi);            \
-       TYPE *pj = (TYPE *) (parmj);            \
-       do {                                            \
-               TYPE    t = *pi;                \
-               *pi++ = *pj;                            \
-               *pj++ = t;                              \
-        } while (--i > 0);                             \
-}
-
-#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
-       es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
-
-static inline void
-swapfunc(a, b, n, swaptype)
-       char *a, *b;
-       int n, swaptype;
-{
-       if(swaptype <= 1)
-               swapcode(long, a, b, n)
-       else
-               swapcode(char, a, b, n)
-}
-
-#define swap(a, b)                                     \
-       if (swaptype == 0) {                            \
-               long t = *(long *)(a);                  \
-               *(long *)(a) = *(long *)(b);            \
-               *(long *)(b) = t;                       \
-       } else                                          \
-               swapfunc(a, b, es, swaptype)
-
-#define vecswap(a, b, n)       if ((n) > 0) swapfunc(a, b, n, swaptype)
-
-#ifdef I_AM_PSORT_R
-#define        CMP(t, x, y) (cmp((t), (x), (y)))
-#else
-#define        CMP(t, x, y) (cmp((x), (y)))
-#endif
-
-static inline char *
-med3(char *a, char *b, char *c,
-#ifdef I_AM_PSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-void *thunk
-#ifndef I_AM_PSORT_R
-__unused
-#endif
-)
-{
-       return CMP(thunk, a, b) < 0 ?
-              (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
-              :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
-}
-
-#ifdef __LP64__
-#define DEPTH(x)       (2 * (flsl((long)(x)) - 1))
-#else /* !__LP64__ */
-#define DEPTH(x)       (2 * (fls((int)(x)) - 1))
-#endif /* __LP64__ */
-
-#ifdef I_AM_PSORT_R
-int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
-#endif
-
-static void _psort_parallel(void *x);
-
-static void
-_psort(void *a, size_t n, size_t es,
-#ifdef I_AM_PSORT_R
-void *thunk,
-#else
-#define thunk  NULL
-#endif
-#ifdef I_AM_PSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-int depth_limit, struct shared *shared)
-{
-       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
-       size_t d, r;
-       int cmp_result;
-       int swaptype, swap_cnt;
-
-loop:
-       if (depth_limit-- <= 0) {
-#ifdef I_AM_PSORT_B
-               heapsort_b(a, n, es, cmp);
-#elif defined(I_AM_PSORT_R)
-               __heapsort_r(a, n, es, thunk, cmp);
-#else
-               heapsort(a, n, es, cmp);
-#endif
-               return;
-       }
-       SWAPINIT(a, es);
-       swap_cnt = 0;
-       if (n < 7) {
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es)
-                               swap(pl, pl - es);
-               return;
-       }
-       pm = (char *)a + (n / 2) * es;
-       if (n > 7) {
-               pl = a;
-               pn = (char *)a + (n - 1) * es;
-               if (n > 40) {
-                       d = (n / 8) * es;
-                       pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
-                       pm = med3(pm - d, pm, pm + d, cmp, thunk);
-                       pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
-               }
-               pm = med3(pl, pm, pn, cmp, thunk);
-       }
-       swap(a, pm);
-       pa = pb = (char *)a + es;
-
-       pc = pd = (char *)a + (n - 1) * es;
-       for (;;) {
-               while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pa, pb);
-                               pa += es;
-                       }
-                       pb += es;
-               }
-               while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pc, pd);
-                               pd -= es;
-                       }
-                       pc -= es;
-               }
-               if (pb > pc)
-                       break;
-               swap(pb, pc);
-               swap_cnt = 1;
-               pb += es;
-               pc -= es;
-       }
-
-       pn = (char *)a + n * es;
-       r = min(pa - (char *)a, pb - pa);
-       vecswap(a, pb - r, r);
-       r = min(pd - pc, pn - pd - es);
-       vecswap(pb, pn - r, r);
-
-       if (swap_cnt == 0) {  /* Switch to insertion sort */
-               r = 1 + n / 4; /* n >= 7, so r >= 2 */
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es) {
-                               swap(pl, pl - es);
-                               if (++swap_cnt > r) goto nevermind;
-                       }
-               return;
-       }
-
-nevermind:
-       if ((r = pb - pa) > es) {
-               r /= es;
-               if (shared && r > shared->turnoff) {
-                       union args *args = getargs(shared);
-
-                       if (args == NULL)
-                               LIBC_ABORT("%s: getargs: %s", shared->who, strerror(errno));
-                       args->shared = shared;
-                       args->a = a;
-                       args->n = r;
-                       args->depth_limit = depth_limit;
-                       OSAtomicIncrement32(&shared->count);
-                       dispatch_async_f(shared->queue, args, _psort_parallel);
-               } else {
-#ifdef I_AM_PSORT_R
-                       _psort(a, r, es, thunk, cmp, depth_limit, NULL);
-#else
-                       _psort(a, r, es, cmp, depth_limit, NULL);
-#endif
-               }
-       }
-       if ((r = pd - pc) > es) {
-               /* Iterate rather than recurse to save stack space */
-               a = pn - r;
-               n = r / es;
-               goto loop;
-       }
-/*             psort(pn - r, r / es, es, cmp);*/
-}
-
-static void
-_psort_parallel(void *x)
-{
-       union args *args = (union args *)x;
-       struct shared *shared = args->shared;
-
-       _psort(args->a, args->n, shared->es,
-#ifdef I_AM_PSORT_R
-               shared->thunk,
-#endif
-               shared->cmp, args->depth_limit, shared);
-       returnargs(shared, args);
-       if(OSAtomicDecrement32(&shared->count) <= 0) {
-               pthread_mutex_lock(&shared->mutex);
-               pthread_cond_signal(&shared->cond);
-               pthread_mutex_unlock(&shared->mutex);
-       }
-}
-
-/* fast, approximate integer square root */
-static size_t
-isqrt(size_t x)
-{
-    size_t s = 1L << (flsl(x) / 2);
-    return (s + x / s) / 2;
-}
-
-void
-#ifdef I_AM_PSORT_R
-psort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-#elif defined(I_AM_PSORT_B)
-psort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
-#else
-psort(void *a, size_t n, size_t es, cmp_t *cmp)
-#endif
-{
-       if (n >= PARALLEL_MIN_SIZE && _NumCPUs() > 1) {
-               struct shared shared;
-               union args *args;
-
-               bzero(&shared, sizeof(shared));
-               shared.sharedlock = OS_SPINLOCK_INIT;
-               if ((args = getargs(&shared)) != NULL) {
-                       struct page *p, *pp;
-#ifdef I_AM_PSORT_R
-                       shared.who = "psort_r";
-                       shared.thunk = thunk;
-#elif defined(I_AM_PSORT_B)
-                       shared.who = "psort_b";
-#else
-                       shared.who = "psort";
-#endif
-                       shared.cmp = cmp;
-                       shared.es = es;
-                       shared.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
-                       shared.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
-                       shared.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
-                       args->a = a;
-                       args->n = n;
-                       args->depth_limit = DEPTH(n);
-                       args->shared = &shared;
-                       /*
-                        * The turnoff value is the size of a partition that,
-                        * below which, we stop doing in parallel, and just do
-                        * in the current thread.  The value of sqrt(n) was
-                        * determined heuristically.  There is a smaller
-                        * dependence on the slowness of the comparison
-                        * function, and there might be a dependence on the
-                        * number of processors, but the algorithm has not been
-                        * determined.  Because the sensitivity to the turnoff
-                        * value is relatively low, we use a fast, approximate
-                        * integer square root routine that is good enough for
-                        * this purpose.
-                        */
-                       shared.turnoff = isqrt(n);
-                       OSAtomicIncrement32(&shared.count);
-                       _psort_parallel(args);
-
-                       /* wait for queue to drain */
-                       pthread_mutex_lock(&shared.mutex);
-                       while(shared.count > 0)
-                               pthread_cond_wait(&shared.cond, &shared.mutex);
-
-                       pthread_mutex_unlock(&shared.mutex);
-                       pthread_mutex_destroy(&shared.mutex);
-                       pthread_cond_destroy(&shared.cond);
-                       for(p = shared.pagelist; p; p = pp) {
-                               pp = p->next;
-                               munmap(p, PAGESIZE);
-                       }
-                       return;
-               }
-       }
-       /* Just call qsort */
-#ifdef I_AM_PSORT_R
-       qsort_r(a, n, es, thunk, cmp);
-#elif defined(I_AM_PSORT_B)
-       qsort_b(a, n, es, cmp);
-#else
-       qsort(a, n, es, cmp);
-#endif
-}
diff --git a/stdlib/putenv-fbsd.c b/stdlib/putenv-fbsd.c
deleted file mode 100644 (file)
index 55ce0c1..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*-
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)putenv.c   8.2 (Berkeley) 3/27/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/putenv.c,v 1.6 2007/05/01 16:02:41 ache Exp $");
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <db.h>
-#include <crt_externs.h>
-#include <malloc/malloc.h>
-#include <errno.h> 
-
-extern malloc_zone_t *__zone0;
-#ifdef LEGACY_CRT1_ENVIRON
-extern char **_saved_environ;
-#endif /* LEGACY_CRT1_ENVIRON */
-
-extern void __malloc_check_env_name(const char *);
-__private_extern__ int __setenv(const char *, const char *, int, int, char ***, malloc_zone_t *);
-
-#ifndef BUILDING_VARIANT
-/*
- * _putenvp -- SPI using an arbitrary pointer to string array (the array must
- * have been created with malloc) and an env state, created by _allocenvstate().
- *     Returns ptr to value associated with name, if any, else NULL.
- */
-int
-_putenvp(char *str, char ***envp, void *state)
-{
-       /* insure __zone0 is set up */
-       if (!__zone0) {
-           __zone0 = malloc_create_zone(0, 0);
-           if (!__zone0) {
-                   errno = ENOMEM;
-                   return (-1);
-           }
-       }
-       return (__setenv(str, NULL, 1, 0, envp, (state ? (malloc_zone_t *)state : __zone0)));
-}
-#endif /* BUILDING_VARIANT */
-
-int
-putenv(str)
-       char *str;
-{
-#ifdef LEGACY_CRT1_ENVIRON
-       int ret;
-#endif /* LEGACY_CRT1_ENVIRON */
-
-#if __DARWIN_UNIX03
-       if (str == NULL || *str == 0 || index(str, '=') == NULL) {
-               errno = EINVAL;
-               return (-1);
-       }
-#else /* !__DARWIN_UNIX03 */
-       if (index(str, '=') == NULL)
-               return (-1);
-#endif /* __DARWIN_UNIX03 */
-       /* insure __zone0 is set up before calling __malloc_check_env_name */
-       if (!__zone0) {
-           __zone0 = malloc_create_zone(0, 0);
-           if (!__zone0) {
-                   errno = ENOMEM;
-                   return (-1);
-           }
-       }
-       __malloc_check_env_name(str); /* see if we are changing a malloc environment variable */
-#ifdef LEGACY_CRT1_ENVIRON
-       ret =
-#else /* !LEGACY_CRT1_ENVIRON */
-       return
-#endif /* !LEGACY_CRT1_ENVIRON */
-           __setenv(str, NULL, 1,
-#if __DARWIN_UNIX03
-               0,
-#else /* !__DARWIN_UNIX03 */
-               -1,
-#endif /* __DARWIN_UNIX03 */
-               _NSGetEnviron(), __zone0);
-#ifdef LEGACY_CRT1_ENVIRON
-       _saved_environ = *_NSGetEnviron();
-       return ret;
-#endif /* LEGACY_CRT1_ENVIRON */
-}
diff --git a/stdlib/qsort-fbsd.c b/stdlib/qsort-fbsd.c
deleted file mode 100644 (file)
index 1d0e3c5..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qsort.c    8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $");
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef I_AM_QSORT_R
-typedef int             cmp_t(void *, const void *, const void *);
-#else
-typedef int             cmp_t(const void *, const void *);
-#endif
-#ifdef I_AM_QSORT_B
-static inline char     *med3(char *, char *, char *, cmp_t ^, void *) __attribute__((always_inline));
-#else
-static inline char     *med3(char *, char *, char *, cmp_t *, void *) __attribute__((always_inline));
-#endif
-static inline void      swapfunc(char *, char *, int, int) __attribute__((always_inline));
-
-#define min(a, b)      (a) < (b) ? a : b
-
-/*
- * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
- */
-#define swapcode(TYPE, parmi, parmj, n) {              \
-       long i = (n) / sizeof (TYPE);                   \
-       TYPE *pi = (TYPE *) (parmi);            \
-       TYPE *pj = (TYPE *) (parmj);            \
-       do {                                            \
-               TYPE    t = *pi;                \
-               *pi++ = *pj;                            \
-               *pj++ = t;                              \
-        } while (--i > 0);                             \
-}
-
-#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \
-       es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
-
-static inline void
-swapfunc(a, b, n, swaptype)
-       char *a, *b;
-       int n, swaptype;
-{
-       if(swaptype <= 1)
-               swapcode(long, a, b, n)
-       else
-               swapcode(char, a, b, n)
-}
-
-#define swap(a, b)                                     \
-       if (swaptype == 0) {                            \
-               long t = *(long *)(a);                  \
-               *(long *)(a) = *(long *)(b);            \
-               *(long *)(b) = t;                       \
-       } else                                          \
-               swapfunc(a, b, es, swaptype)
-
-#define vecswap(a, b, n)       if ((n) > 0) swapfunc(a, b, n, swaptype)
-
-#ifdef I_AM_QSORT_R
-#define        CMP(t, x, y) (cmp((t), (x), (y)))
-#else
-#define        CMP(t, x, y) (cmp((x), (y)))
-#endif
-
-static inline char *
-med3(char *a, char *b, char *c,
-#ifdef I_AM_QSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-void *thunk
-#ifndef I_AM_QSORT_R
-__unused
-#endif
-)
-{
-       return CMP(thunk, a, b) < 0 ?
-              (CMP(thunk, b, c) < 0 ? b : (CMP(thunk, a, c) < 0 ? c : a ))
-              :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
-}
-
-#ifdef __LP64__
-#define DEPTH(x)       (2 * (flsl((long)(x)) - 1))
-#else /* !__LP64__ */
-#define DEPTH(x)       (2 * (fls((int)(x)) - 1))
-#endif /* __LP64__ */
-
-#ifdef I_AM_QSORT_R
-int __heapsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *));
-#endif
-
-static void
-_qsort(void *a, size_t n, size_t es,
-#ifdef I_AM_QSORT_R
-void *thunk,
-#else
-#define thunk  NULL
-#endif
-#ifdef I_AM_QSORT_B
-cmp_t ^cmp,
-#else
-cmp_t *cmp,
-#endif
-int depth_limit)
-{
-       char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
-       size_t d, r;
-       int cmp_result;
-       int swaptype, swap_cnt;
-
-loop:
-       if (depth_limit-- <= 0) {
-#ifdef I_AM_QSORT_B
-               heapsort_b(a, n, es, cmp);
-#elif defined(I_AM_QSORT_R)
-               __heapsort_r(a, n, es, thunk, cmp);
-#else
-               heapsort(a, n, es, cmp);
-#endif
-               return;
-       }
-       SWAPINIT(a, es);
-       swap_cnt = 0;
-       if (n < 7) {
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es)
-                               swap(pl, pl - es);
-               return;
-       }
-       pm = (char *)a + (n / 2) * es;
-       if (n > 7) {
-               pl = a;
-               pn = (char *)a + (n - 1) * es;
-               if (n > 40) {
-                       d = (n / 8) * es;
-                       pl = med3(pl, pl + d, pl + 2 * d, cmp, thunk);
-                       pm = med3(pm - d, pm, pm + d, cmp, thunk);
-                       pn = med3(pn - 2 * d, pn - d, pn, cmp, thunk);
-               }
-               pm = med3(pl, pm, pn, cmp, thunk);
-       }
-       swap(a, pm);
-       pa = pb = (char *)a + es;
-
-       pc = pd = (char *)a + (n - 1) * es;
-       for (;;) {
-               while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pa, pb);
-                               pa += es;
-                       }
-                       pb += es;
-               }
-               while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
-                       if (cmp_result == 0) {
-                               swap_cnt = 1;
-                               swap(pc, pd);
-                               pd -= es;
-                       }
-                       pc -= es;
-               }
-               if (pb > pc)
-                       break;
-               swap(pb, pc);
-               swap_cnt = 1;
-               pb += es;
-               pc -= es;
-       }
-
-       pn = (char *)a + n * es;
-       r = min(pa - (char *)a, pb - pa);
-       vecswap(a, pb - r, r);
-       r = min(pd - pc, pn - pd - es);
-       vecswap(pb, pn - r, r);
-
-       if (swap_cnt == 0) {  /* Switch to insertion sort */
-               r = 1 + n / 4; /* n >= 7, so r >= 2 */
-               for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
-                       for (pl = pm; 
-                            pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
-                            pl -= es) {
-                               swap(pl, pl - es);
-                               if (++swap_cnt > r) goto nevermind;
-                       }
-               return;
-       }
-
-nevermind:
-       if ((r = pb - pa) > es)
-#ifdef I_AM_QSORT_R
-               _qsort(a, r / es, es, thunk, cmp, depth_limit);
-#else
-               _qsort(a, r / es, es, cmp, depth_limit);
-#endif
-       if ((r = pd - pc) > es) {
-               /* Iterate rather than recurse to save stack space */
-               a = pn - r;
-               n = r / es;
-               goto loop;
-       }
-/*             qsort(pn - r, r / es, es, cmp);*/
-}
-
-void
-#ifdef I_AM_QSORT_R
-qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
-#elif defined(I_AM_QSORT_B)
-qsort_b(void *a, size_t n, size_t es, cmp_t ^cmp)
-#else
-qsort(void *a, size_t n, size_t es, cmp_t *cmp)
-#endif
-{
-       _qsort(a, n, es,
-#ifdef I_AM_QSORT_R
-               thunk,
-#endif
-               cmp, DEPTH(n));
-}
diff --git a/stdlib/qsort.3 b/stdlib/qsort.3
deleted file mode 100644 (file)
index f137a8d..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)qsort.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/qsort.3,v 1.17 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd September 30, 2003
-.Dt QSORT 3
-.Os
-.Sh NAME
-.Nm heapsort ,
-#ifdef UNIFDEF_BLOCKS
-.Nm heapsort_b ,
-#endif
-.Nm mergesort ,
-#ifdef UNIFDEF_BLOCKS
-.Nm mergesort_b ,
-#endif
-.Nm qsort ,
-#ifdef UNIFDEF_BLOCKS
-.Nm qsort_b ,
-#endif
-.Nm qsort_r
-.Nd sort functions
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fo heapsort
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#ifdef UNIFDEF_BLOCKS
-.Ft int
-.Fo heapsort_b
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#endif
-.Ft int
-.Fo mergesort
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#ifdef UNIFDEF_BLOCKS
-.Ft int
-.Fo mergesort_b
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#endif
-.Ft void
-.Fo qsort
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#ifdef UNIFDEF_BLOCKS
-.Ft void
-.Fo qsort_b
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
-.Fc
-#endif
-.Ft void
-.Fo qsort_r
-.Fa "void *base"
-.Fa "size_t nel"
-.Fa "size_t width"
-.Fa "void *thunk"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn qsort
-function is a modified partition-exchange sort, or quicksort.
-The
-.Fn heapsort
-function is a modified selection sort.
-The
-.Fn mergesort
-function is a modified merge sort with exponential search,
-intended for sorting data with pre-existing order.
-.Pp
-The
-.Fn qsort
-and
-.Fn heapsort
-functions sort an array of
-.Fa nel
-objects, the initial member of which is pointed to by
-.Fa base .
-The size of each object is specified by
-.Fa width .
-The
-.Fn mergesort
-function
-behaves similarly, but
-.Em requires
-that
-.Fa width
-be greater than or equal to
-.Dq "sizeof(void *) / 2" .
-.Pp
-The contents of the array
-.Fa base
-are sorted in ascending order according to
-a comparison function pointed to by
-.Fa compar ,
-which requires two arguments pointing to the objects being
-compared.
-.Pp
-The comparison function must return an integer less than, equal to, or
-greater than zero if the first argument is considered to be respectively
-less than, equal to, or greater than the second.
-.Pp
-The
-.Fn qsort_r
-function behaves identically to
-.Fn qsort ,
-except that it takes an additional argument,
-.Fa thunk ,
-which is passed unchanged as the first argument to function pointed to
-.Fa compar .
-This allows the comparison function to access additional
-data without using global variables, and thus
-.Fn qsort_r
-is suitable for use in functions which must be reentrant.
-.Pp
-The algorithms implemented by
-.Fn qsort ,
-.Fn qsort_r ,
-and
-.Fn heapsort
-are
-.Em not
-stable; that is, if two members compare as equal, their order in
-the sorted array is undefined.
-The
-.Fn mergesort
-algorithm is stable.
-.Pp
-The
-.Fn qsort
-and
-.Fn qsort_r
-functions are an implementation of C.A.R.
-Hoare's
-.Dq quicksort
-algorithm,
-a variant of partition-exchange sorting; in particular, see
-.An D.E. Knuth Ns 's
-.%T "Algorithm Q" .
-.Sy Quicksort
-takes O N lg N average time.
-This implementation uses median selection to avoid its
-O N**2 worst-case behavior.
-.Pp
-The
-.Fn heapsort
-function is an implementation of
-.An "J.W.J. William" Ns 's
-.Dq heapsort
-algorithm,
-a variant of selection sorting; in particular, see
-.An "D.E. Knuth" Ns 's
-.%T "Algorithm H" .
-.Sy Heapsort
-takes O N lg N worst-case time.
-Its
-.Em only
-advantage over
-.Fn qsort
-is that it uses almost no additional memory; while
-.Fn qsort
-does not allocate memory, it is implemented using recursion.
-.Pp
-The function
-.Fn mergesort
-requires additional memory of size
-.Fa nel *
-.Fa width
-bytes; it should be used only when space is not at a premium.
-The
-.Fn mergesort
-function
-is optimized for data with pre-existing order; its worst case
-time is O N lg N; its best case is O N.
-.Pp
-Normally,
-.Fn qsort
-is faster than
-.Fn mergesort
-which is faster than
-.Fn heapsort .
-Memory availability and pre-existing order in the data can make this
-untrue.
-#ifdef UNIFDEF_BLOCKS
-.Pp
-The
-.Fn heapsort_b ,
-.Fn mergesort_b ,
-and
-.Fn qsort_b
-routines are like the corresponding routines without the _b suffix, expect
-that the
-.Fa compar
-callback is a block pointer instead of a function pointer.
-#endif
-.Sh RETURN VALUES
-The
-#ifdef UNIFDEF_BLOCKS
-.Fn qsort ,
-.Fn qsort_b
-#else
-.Fn qsort
-#endif
-and
-.Fn qsort_r
-functions
-return no value.
-.Pp
-#ifdef UNIFDEF_BLOCKS
-.ds HEAPSORT_B heapsort_b
-.ds MERGESORT_B mergesort_b
-#endif
-.Rv -std heapsort \*[HEAPSORT_B] mergesort \*[MERGESORT_B]
-.Sh COMPATIBILITY
-Previous versions of
-.Fn qsort
-did not permit the comparison routine itself to call
-.Fn qsort 3 .
-This is no longer true.
-.Sh ERRORS
-The
-#ifdef UNIFDEF_BLOCKS
-.Fn heapsort ,
-.Fn heapsort_b ,
-.Fn mergesort ,
-and
-.Fn mergesort_b
-#else
-.Fn heapsort
-and
-.Fn mergesort
-#endif
-functions succeed unless:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa width
-argument is zero, or,
-the
-.Fa width
-argument to
-.Fn mergesort
-#ifdef UNIFDEF_BLOCKS
-or
-.Fn mergesort_b
-#endif
-is less than
-.Dq "sizeof(void *) / 2" .
-.It Bq Er ENOMEM
-The
-#ifdef UNIFDEF_BLOCKS
-.Fn heapsort ,
-.Fn heapsort_b ,
-.Fn mergesort ,
-or
-.Fn mergesort_b
-#else
-.Fn heapsort
-or
-.Fn mergesort
-#endif
-functions
-were unable to allocate memory.
-.El
-.Sh SEE ALSO
-.Xr sort 1 ,
-.Xr radixsort 3
-.Rs
-.%A Hoare, C.A.R.
-.%D 1962
-.%T "Quicksort"
-.%J "The Computer Journal"
-.%V 5:1
-.%P pp. 10-15
-.Re
-.Rs
-.%A Williams, J.W.J
-.%D 1964
-.%T "Heapsort"
-.%J "Communications of the ACM"
-.%V 7:1
-.%P pp. 347-348
-.Re
-.Rs
-.%A Knuth, D.E.
-.%D 1968
-.%B "The Art of Computer Programming"
-.%V Vol. 3
-.%T "Sorting and Searching"
-.%P pp. 114-123, 145-149
-.Re
-.Rs
-.%A McIlroy, P.M.
-.%T "Optimistic Sorting and Information Theoretic Complexity"
-.%J "Fourth Annual ACM-SIAM Symposium on Discrete Algorithms"
-.%V January 1992
-.Re
-.Rs
-.%A Bentley, J.L.
-.%A McIlroy, M.D.
-.%T "Engineering a Sort Function"
-.%J "Software--Practice and Experience"
-.%V Vol. 23(11)
-.%P pp. 1249-1265
-.%D November\ 1993
-.Re
-.Sh STANDARDS
-The
-.Fn qsort
-function
-conforms to
-.St -isoC .
index 81e27a9393107809473994696641219ba523c883..17c0c5055f129281069aaa55c0ed090105e1066f 100644 (file)
@@ -5,4 +5,4 @@
  * $FreeBSD: src/lib/libc/stdlib/qsort_r.c,v 1.1 2002/09/10 02:04:49 wollman Exp $
  */
 #define I_AM_QSORT_B
-#include "qsort-fbsd.c"
+#include "FreeBSD/qsort.c"
diff --git a/stdlib/qsort_r-fbsd.c b/stdlib/qsort_r-fbsd.c
deleted file mode 100644 (file)
index 684d15c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * This file is in the public domain.  Originally written by Garrett
- * A. Wollman.
- *
- * $FreeBSD: src/lib/libc/stdlib/qsort_r.c,v 1.1 2002/09/10 02:04:49 wollman Exp $
- */
-#define I_AM_QSORT_R
-#include "qsort-fbsd.c"
diff --git a/stdlib/radixsort-fbsd.c b/stdlib/radixsort-fbsd.c
deleted file mode 100644 (file)
index 5208ce9..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy and by Dan Bernstein at New York University,
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)radixsort.c        8.2 (Berkeley) 4/28/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/radixsort.c,v 1.8 2007/01/09 00:28:10 imp Exp $");
-
-/*
- * Radixsort routines.
- *
- * Program r_sort_a() is unstable but uses O(logN) extra memory for a stack.
- * Use radixsort(a, n, trace, endchar) for this case.
- *
- * For stable sorting (using N extra pointers) use sradixsort(), which calls
- * r_sort_b().
- *
- * For a description of this code, see D. McIlroy, P. McIlroy, K. Bostic,
- * "Engineering Radix Sort".
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <pthread.h>
-
-typedef struct {
-       const u_char **sa;
-       int sn, si;
-} stack;
-
-static inline void simplesort
-(const u_char **, int, int, const u_char *, u_int) __attribute__((always_inline));
-static void r_sort_a(const u_char **, int, int, const u_char *, u_int);
-static void r_sort_b(const u_char **, const u_char **, int, int,
-    const u_char *, u_int);
-
-static int *r_sort_a_count;
-static int *r_sort_b_count;
-
-static void r_sort_count_allocate(void);
-static pthread_once_t r_sort_count_control = PTHREAD_ONCE_INIT;
-
-#define        THRESHOLD       20              /* Divert to simplesort(). */
-#define        SIZE            512             /* Default stack size. */
-
-#define SETUP {                                                                \
-       if (tab == NULL) {                                              \
-               tr = tr0;                                               \
-               for (c = 0; c < endch; c++)                             \
-                       tr0[c] = c + 1;                                 \
-               tr0[c] = 0;                                             \
-               for (c++; c < 256; c++)                                 \
-                       tr0[c] = c;                                     \
-               endch = 0;                                              \
-       } else {                                                        \
-               endch = tab[endch];                                     \
-               tr = tab;                                               \
-               if (endch != 0 && endch != 255) {                       \
-                       errno = EINVAL;                                 \
-                       return (-1);                                    \
-               }                                                       \
-       }                                                               \
-}
-
-int
-radixsort(a, n, tab, endch)
-       const u_char **a, *tab;
-       int n;
-       u_int endch;
-{
-       const u_char *tr;
-       int c;
-       u_char tr0[256];
-
-       SETUP;
-       r_sort_a(a, n, 0, tr, endch);
-       return (0);
-}
-
-int
-sradixsort(a, n, tab, endch)
-       const u_char **a, *tab;
-       int n;
-       u_int endch;
-{
-       const u_char *tr, **ta;
-       int c;
-       u_char tr0[256];
-
-       SETUP;
-       if (n < THRESHOLD)
-               simplesort(a, n, 0, tr, endch);
-       else {
-               if ((ta = malloc(n * sizeof(a))) == NULL)
-                       return (-1);
-               r_sort_b(a, ta, n, 0, tr, endch);
-               free(ta);
-       }
-       return (0);
-}
-
-static void r_sort_count_allocate(void)
-{
-       r_sort_a_count = calloc(256, sizeof(int));
-       r_sort_b_count = calloc(256, sizeof(int));
-}
-
-#define empty(s)       (s >= sp)
-#define pop(a, n, i)   a = (--sp)->sa, n = sp->sn, i = sp->si
-#define push(a, n, i)  sp->sa = a, sp->sn = n, (sp++)->si = i
-#define swap(a, b, t)  t = a, a = b, b = t
-
-/* Unstable, in-place sort. */
-static void
-r_sort_a(a, n, i, tr, endch)
-       const u_char **a;
-       int n, i;
-       const u_char *tr;
-       u_int endch;
-{
-       static int *count, nc, bmin;
-       int c;
-       const u_char **ak, *r;
-       stack s[SIZE], *sp, *sp0, *sp1, temp;
-       int *cp, bigc;
-       const u_char **an, *t, **aj, **top[256];
-
-       if (pthread_once(&r_sort_count_control, r_sort_count_allocate)) {
-               return;
-       }
-
-       count = r_sort_a_count;
-
-       /* Set up stack. */
-       sp = s;
-       push(a, n, i);
-       while (!empty(s)) {
-               pop(a, n, i);
-               if (n < THRESHOLD) {
-                       simplesort(a, n, i, tr, endch);
-                       continue;
-               }
-               an = a + n;
-
-               /* Make character histogram. */
-               if (nc == 0) {
-                       bmin = 255;     /* First occupied bin, excluding eos. */
-                       for (ak = a; ak < an;) {
-                               c = tr[(*ak++)[i]];
-                               if (++count[c] == 1 && c != endch) {
-                                       if (c < bmin)
-                                               bmin = c;
-                                       nc++;
-                               }
-                       }
-                       if (sp + nc > s + SIZE) {       /* Get more stack. */
-                               r_sort_a(a, n, i, tr, endch);
-                               continue;
-                       }
-               }
-
-               /*
-                * Special case: if all strings have the same
-                * character at position i, move on to the next
-                * character.
-                */
-               if (nc == 1 && count[bmin] == n) {
-                       push(a, n, i+1);
-                       nc = count[bmin] = 0;
-                       continue;
-               }
-
-               /*
-                * Set top[]; push incompletely sorted bins onto stack.
-                * top[] = pointers to last out-of-place element in bins.
-                * count[] = counts of elements in bins.
-                * Before permuting: top[c-1] + count[c] = top[c];
-                * during deal: top[c] counts down to top[c-1].
-                */
-               sp0 = sp1 = sp;         /* Stack position of biggest bin. */
-               bigc = 2;               /* Size of biggest bin. */
-               if (endch == 0)         /* Special case: set top[eos]. */
-                       top[0] = ak = a + count[0];
-               else {
-                       ak = a;
-                       top[255] = an;
-               }
-               for (cp = count + bmin; nc > 0; cp++) {
-                       while (*cp == 0)        /* Find next non-empty pile. */
-                               cp++;
-                       if (*cp > 1) {
-                               if (*cp > bigc) {
-                                       bigc = *cp;
-                                       sp1 = sp;
-                               }
-                               push(ak, *cp, i+1);
-                       }
-                       top[cp-count] = ak += *cp;
-                       nc--;
-               }
-               swap(*sp0, *sp1, temp); /* Play it safe -- biggest bin last. */
-
-               /*
-                * Permute misplacements home.  Already home: everything
-                * before aj, and in bin[c], items from top[c] on.
-                * Inner loop:
-                *      r = next element to put in place;
-                *      ak = top[r[i]] = location to put the next element.
-                *      aj = bottom of 1st disordered bin.
-                * Outer loop:
-                *      Once the 1st disordered bin is done, ie. aj >= ak,
-                *      aj<-aj + count[c] connects the bins in a linked list;
-                *      reset count[c].
-                */
-               for (aj = a; aj < an;  *aj = r, aj += count[c], count[c] = 0)
-                       for (r = *aj;  aj < (ak = --top[c = tr[r[i]]]);)
-                               swap(*ak, r, t);
-       }
-}
-
-/* Stable sort, requiring additional memory. */
-static void
-r_sort_b(a, ta, n, i, tr, endch)
-       const u_char **a, **ta;
-       int n, i;
-       const u_char *tr;
-       u_int endch;
-{
-       static int *count, nc, bmin;
-       int c;
-       const u_char **ak, **ai;
-       stack s[512], *sp, *sp0, *sp1, temp;
-       const u_char **top[256];
-       int *cp, bigc;
-
-       if (pthread_once(&r_sort_count_control, r_sort_count_allocate)) {
-               return;
-       }
-
-       count = r_sort_b_count;
-
-       sp = s;
-       push(a, n, i);
-       while (!empty(s)) {
-               pop(a, n, i);
-               if (n < THRESHOLD) {
-                       simplesort(a, n, i, tr, endch);
-                       continue;
-               }
-
-               if (nc == 0) {
-                       bmin = 255;
-                       for (ak = a + n; --ak >= a;) {
-                               c = tr[(*ak)[i]];
-                               if (++count[c] == 1 && c != endch) {
-                                       if (c < bmin)
-                                               bmin = c;
-                                       nc++;
-                               }
-                       }
-                       if (sp + nc > s + SIZE) {
-                               r_sort_b(a, ta, n, i, tr, endch);
-                               continue;
-                       }
-               }
-
-               sp0 = sp1 = sp;
-               bigc = 2;
-               if (endch == 0) {
-                       top[0] = ak = a + count[0];
-                       count[0] = 0;
-               } else {
-                       ak = a;
-                       top[255] = a + n;
-                       count[255] = 0;
-               }
-               for (cp = count + bmin; nc > 0; cp++) {
-                       while (*cp == 0)
-                               cp++;
-                       if ((c = *cp) > 1) {
-                               if (c > bigc) {
-                                       bigc = c;
-                                       sp1 = sp;
-                               }
-                               push(ak, c, i+1);
-                       }
-                       top[cp-count] = ak += c;
-                       *cp = 0;                        /* Reset count[]. */
-                       nc--;
-               }
-               swap(*sp0, *sp1, temp);
-
-               for (ak = ta + n, ai = a+n; ak > ta;)   /* Copy to temp. */
-                       *--ak = *--ai;
-               for (ak = ta+n; --ak >= ta;)            /* Deal to piles. */
-                       *--top[tr[(*ak)[i]]] = *ak;
-       }
-}
-
-static inline void
-simplesort(a, n, b, tr, endch) /* insertion sort */
-       const u_char **a;
-       int n, b;
-       const u_char *tr;
-       u_int endch;
-{
-       u_char ch;
-       const u_char  **ak, **ai, *s, *t;
-
-       for (ak = a+1; --n >= 1; ak++)
-               for (ai = ak; ai > a; ai--) {
-                       for (s = ai[0] + b, t = ai[-1] + b;
-                           (ch = tr[*s]) != endch; s++, t++)
-                               if (ch != tr[*t])
-                                       break;
-                       if (ch >= tr[*t])
-                               break;
-                       swap(ai[0], ai[-1], s);
-               }
-}
diff --git a/stdlib/radixsort.3 b/stdlib/radixsort.3
deleted file mode 120000 (symlink)
index d5e498c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./radixsort.3
\ No newline at end of file
diff --git a/stdlib/rand-fbsd.c b/stdlib/rand-fbsd.c
deleted file mode 120000 (symlink)
index a77f59d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rand.c
\ No newline at end of file
diff --git a/stdlib/rand.3 b/stdlib/rand.3
deleted file mode 100644 (file)
index fec6ac6..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)rand.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/rand.3,v 1.16 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd May 25, 1999
-.Dt RAND 3
-.Os
-.Sh NAME
-.Nm rand ,
-.Nm rand_r ,
-.Nm srand ,
-.Nm sranddev
-.Nd bad random number generator
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fo rand
-.Fa void
-.Fc
-.Ft int
-.Fo rand_r
-.Fa "unsigned *seed"
-.Fc
-.Ft void
-.Fo srand
-.Fa "unsigned seed"
-.Fc
-.Ft void
-.Fo sranddev
-.Fa void
-.Fc
-.Sh DESCRIPTION
-.Bf -symbolic
-These interfaces are obsoleted by
-.Xr random 3 .
-.Ef
-.Pp
-The
-.Fn rand
-function computes a sequence of pseudo-random integers in the range
-of 0 to
-.Dv RAND_MAX
-(as defined by the header file
-.In stdlib.h ) .
-.Pp
-The
-.Fn srand
-function sets its argument
-.Fa seed
-as the seed for a new sequence of
-pseudo-random numbers to be returned by
-.Fn rand .
-These sequences are repeatable by calling
-.Fn srand
-with the same seed value.
-.Pp
-If no
-.Fa seed
-value is provided, the functions are automatically
-seeded with a value of 1.
-.Pp
-The
-.Fn sranddev
-function initializes a seed, using the
-.Xr random 4
-random number device which returns good random numbers.
-However, the
-.Fn rand
-function still remains unsuitable for cryptographic use.
-.Pp
-The
-.Fn rand_r
-function
-provides the same functionality as
-.Fn rand .
-A pointer to the context value
-.Fa seed
-must be supplied by the caller.
-.Sh SEE ALSO
-.Xr random 3 ,
-.Xr random 4
-.Sh STANDARDS
-The
-.Fn rand
-and
-.Fn srand
-functions
-conform to
-.St -isoC .
-.Pp
-The
-.Fn rand_r
-function is as proposed in the POSIX.4a Draft #6 document.
diff --git a/stdlib/random-fbsd.c b/stdlib/random-fbsd.c
deleted file mode 100644 (file)
index 15db640..0000000
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)random.c   8.2 (Berkeley) 5/19/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/random.c,v 1.25 2007/01/09 00:28:10 imp Exp $");
-
-/*
- * We always compile with __DARWIN_UNIX03 set to one, relying on the fact that
- * (for non-LP64) sizeof(int) == sizeof(long) == sizeof(size_t), so that we
- * don't have to have two different versions of the prototypes.  For LP64,
- * we only support the POSIX-compatible prototypes.
- */
-#undef         __DARWIN_UNIX03
-#define        __DARWIN_UNIX03 1
-#include "namespace.h"
-#include <sys/time.h>          /* for srandomdev() */
-#include <fcntl.h>             /* for srandomdev() */
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>            /* for srandomdev() */
-#include "un-namespace.h"
-
-/*
- * random.c:
- *
- * An improved random number generation package.  In addition to the standard
- * rand()/srand() like interface, this package also has a special state info
- * interface.  The initstate() routine is called with a seed, an array of
- * bytes, and a count of how many bytes are being passed in; this array is
- * then initialized to contain information for random number generation with
- * that much state information.  Good sizes for the amount of state
- * information are 32, 64, 128, and 256 bytes.  The state can be switched by
- * calling the setstate() routine with the same array as was initiallized
- * with initstate().  By default, the package runs with 128 bytes of state
- * information and generates far better random numbers than a linear
- * congruential generator.  If the amount of state information is less than
- * 32 bytes, a simple linear congruential R.N.G. is used.
- *
- * Internally, the state information is treated as an array of uint32_t's; the
- * zeroeth element of the array is the type of R.N.G. being used (small
- * integer); the remainder of the array is the state information for the
- * R.N.G.  Thus, 32 bytes of state information will give 7 ints worth of
- * state information, which will allow a degree seven polynomial.  (Note:
- * the zeroeth word of state information also has some other information
- * stored in it -- see setstate() for details).
- *
- * The random number generation technique is a linear feedback shift register
- * approach, employing trinomials (since there are fewer terms to sum up that
- * way).  In this approach, the least significant bit of all the numbers in
- * the state table will act as a linear feedback shift register, and will
- * have period 2^deg - 1 (where deg is the degree of the polynomial being
- * used, assuming that the polynomial is irreducible and primitive).  The
- * higher order bits will have longer periods, since their values are also
- * influenced by pseudo-random carries out of the lower bits.  The total
- * period of the generator is approximately deg*(2**deg - 1); thus doubling
- * the amount of state information has a vast influence on the period of the
- * generator.  Note: the deg*(2**deg - 1) is an approximation only good for
- * large deg, when the period of the shift is the dominant factor.
- * With deg equal to seven, the period is actually much longer than the
- * 7*(2**7 - 1) predicted by this formula.
- *
- * Modified 28 December 1994 by Jacob S. Rosenberg.
- * The following changes have been made:
- * All references to the type u_int have been changed to unsigned long.
- * All references to type int have been changed to type long.  Other
- * cleanups have been made as well.  A warning for both initstate and
- * setstate has been inserted to the effect that on Sparc platforms
- * the 'arg_state' variable must be forced to begin on word boundaries.
- * This can be easily done by casting a long integer array to char *.
- * The overall logic has been left STRICTLY alone.  This software was
- * tested on both a VAX and Sun SpacsStation with exactly the same
- * results.  The new version and the original give IDENTICAL results.
- * The new version is somewhat faster than the original.  As the
- * documentation says:  "By default, the package runs with 128 bytes of
- * state information and generates far better random numbers than a linear
- * congruential generator.  If the amount of state information is less than
- * 32 bytes, a simple linear congruential R.N.G. is used."  For a buffer of
- * 128 bytes, this new version runs about 19 percent faster and for a 16
- * byte buffer it is about 5 percent faster.
- */
-
-/*
- * For each of the currently supported random number generators, we have a
- * break value on the amount of state information (you need at least this
- * many bytes of state info to support this random number generator), a degree
- * for the polynomial (actually a trinomial) that the R.N.G. is based on, and
- * the separation between the two lower order coefficients of the trinomial.
- */
-#define        TYPE_0          0               /* linear congruential */
-#define        BREAK_0         8
-#define        DEG_0           0
-#define        SEP_0           0
-
-#define        TYPE_1          1               /* x**7 + x**3 + 1 */
-#define        BREAK_1         32
-#define        DEG_1           7
-#define        SEP_1           3
-
-#define        TYPE_2          2               /* x**15 + x + 1 */
-#define        BREAK_2         64
-#define        DEG_2           15
-#define        SEP_2           1
-
-#define        TYPE_3          3               /* x**31 + x**3 + 1 */
-#define        BREAK_3         128
-#define        DEG_3           31
-#define        SEP_3           3
-
-#define        TYPE_4          4               /* x**63 + x + 1 */
-#define        BREAK_4         256
-#define        DEG_4           63
-#define        SEP_4           1
-
-/*
- * Array versions of the above information to make code run faster --
- * relies on fact that TYPE_i == i.
- */
-#define        MAX_TYPES       5               /* max number of types above */
-
-#ifdef  USE_WEAK_SEEDING
-#define NSHUFF 0
-#else   /* !USE_WEAK_SEEDING */
-#define NSHUFF 50       /* to drop some "seed -> 1st value" linearity */
-#endif  /* !USE_WEAK_SEEDING */
-
-static const int degrees[MAX_TYPES] =  { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
-static const int seps [MAX_TYPES] =    { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
-
-/*
- * Initially, everything is set up as if from:
- *
- *     initstate(1, randtbl, 128);
- *
- * Note that this initialization takes advantage of the fact that srandom()
- * advances the front and rear pointers 10*rand_deg times, and hence the
- * rear pointer which starts at 0 will also end up at zero; thus the zeroeth
- * element of the state information, which contains info about the current
- * position of the rear pointer is just
- *
- *     MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3.
- */
-
-static uint32_t randtbl[DEG_3 + 1] = {
-       TYPE_3,
-#ifdef  USE_WEAK_SEEDING
-/* Historic implementation compatibility */
-/* The random sequences do not vary much with the seed */
-       0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5,
-       0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
-       0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88,
-       0xe369735d, 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
-       0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, 0x8999220b,
-       0x27fb47b9,
-#else   /* !USE_WEAK_SEEDING */
-       0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05,
-       0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454,
-       0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471,
-       0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1,
-       0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41,
-       0xf3bec5da
-#endif  /* !USE_WEAK_SEEDING */
-};
-
-/*
- * fptr and rptr are two pointers into the state info, a front and a rear
- * pointer.  These two pointers are always rand_sep places aparts, as they
- * cycle cyclically through the state information.  (Yes, this does mean we
- * could get away with just one pointer, but the code for random() is more
- * efficient this way).  The pointers are left positioned as they would be
- * from the call
- *
- *     initstate(1, randtbl, 128);
- *
- * (The position of the rear pointer, rptr, is really 0 (as explained above
- * in the initialization of randtbl) because the state table pointer is set
- * to point to randtbl[1] (as explained below).
- */
-static uint32_t *fptr = &randtbl[SEP_3 + 1];
-static uint32_t *rptr = &randtbl[1];
-
-/*
- * The following things are the pointer to the state information table, the
- * type of the current generator, the degree of the current polynomial being
- * used, and the separation between the two pointers.  Note that for efficiency
- * of random(), we remember the first location of the state information, not
- * the zeroeth.  Hence it is valid to access state[-1], which is used to
- * store the type of the R.N.G.  Also, we remember the last location, since
- * this is more efficient than indexing every time to find the address of
- * the last element to see if the front and rear pointers have wrapped.
- */
-static uint32_t *state = &randtbl[1];
-static int rand_type = TYPE_3;
-static int rand_deg = DEG_3;
-static int rand_sep = SEP_3;
-static uint32_t *end_ptr = &randtbl[DEG_3 + 1];
-
-static inline uint32_t good_rand(int32_t) __attribute__((always_inline));
-
-static inline uint32_t good_rand (x)
-       int32_t x;
-{
-#ifdef  USE_WEAK_SEEDING
-/*
- * Historic implementation compatibility.
- * The random sequences do not vary much with the seed,
- * even with overflowing.
- */
-       return (1103515245 * x + 12345);
-#else   /* !USE_WEAK_SEEDING */
-/*
- * Compute x = (7^5 * x) mod (2^31 - 1)
- * wihout overflowing 31 bits:
- *      (2^31 - 1) = 127773 * (7^5) + 2836
- * From "Random number generators: good ones are hard to find",
- * Park and Miller, Communications of the ACM, vol. 31, no. 10,
- * October 1988, p. 1195.
- */
-       int32_t hi, lo;
-
-       /* Can't be initialized with 0, so use another value. */
-       if (x == 0)
-               x = 123459876;
-       hi = x / 127773;
-       lo = x % 127773;
-       x = 16807 * lo - 2836 * hi;
-       if (x < 0)
-               x += 0x7fffffff;
-       return (x);
-#endif  /* !USE_WEAK_SEEDING */
-}
-
-/*
- * srandom:
- *
- * Initialize the random number generator based on the given seed.  If the
- * type is the trivial no-state-information type, just remember the seed.
- * Otherwise, initializes state[] based on the given "seed" via a linear
- * congruential generator.  Then, the pointers are set to known locations
- * that are exactly rand_sep places apart.  Lastly, it cycles the state
- * information a given number of times to get rid of any initial dependencies
- * introduced by the L.C.R.N.G.  Note that the initialization of randtbl[]
- * for default usage relies on values produced by this routine.
- */
-void
-srandom(x)
-       unsigned x;
-{
-       int i, lim;
-
-       state[0] = (uint32_t)x;
-       if (rand_type == TYPE_0)
-               lim = NSHUFF;
-       else {
-               for (i = 1; i < rand_deg; i++)
-                       state[i] = good_rand(state[i - 1]);
-               fptr = &state[rand_sep];
-               rptr = &state[0];
-               lim = 10 * rand_deg;
-       }
-       for (i = 0; i < lim; i++)
-               (void)random();
-}
-
-/*
- * srandomdev:
- *
- * Many programs choose the seed value in a totally predictable manner.
- * This often causes problems.  We seed the generator using the much more
- * secure random(4) interface.  Note that this particular seeding
- * procedure can generate states which are impossible to reproduce by
- * calling srandom() with any value, since the succeeding terms in the
- * state buffer are no longer derived from the LC algorithm applied to
- * a fixed seed.
- */
-void
-srandomdev()
-{
-       int fd, done;
-       size_t len;
-
-       if (rand_type == TYPE_0)
-               len = sizeof state[0];
-       else
-               len = rand_deg * sizeof state[0];
-
-       done = 0;
-       fd = _open("/dev/random", O_RDONLY, 0);
-       if (fd >= 0) {
-               if (_read(fd, (void *) state, len) == (ssize_t) len)
-                       done = 1;
-               _close(fd);
-       }
-
-       if (!done) {
-               struct timeval tv;
-               unsigned long junk;
-
-               gettimeofday(&tv, NULL);
-               srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
-               return;
-       }
-
-       if (rand_type != TYPE_0) {
-               fptr = &state[rand_sep];
-               rptr = &state[0];
-       }
-}
-
-/*
- * initstate:
- *
- * Initialize the state information in the given array of n bytes for future
- * random number generation.  Based on the number of bytes we are given, and
- * the break values for the different R.N.G.'s, we choose the best (largest)
- * one we can and set things up for it.  srandom() is then called to
- * initialize the state information.
- *
- * Note that on return from srandom(), we set state[-1] to be the type
- * multiplexed with the current value of the rear pointer; this is so
- * successive calls to initstate() won't lose this information and will be
- * able to restart with setstate().
- *
- * Note: the first thing we do is save the current state, if any, just like
- * setstate() so that it doesn't matter when initstate is called.
- *
- * Returns a pointer to the old state.
- *
- * Note: The Sparc platform requires that arg_state begin on an int
- * word boundary; otherwise a bus error will occur. Even so, lint will
- * complain about mis-alignment, but you should disregard these messages.
- */
-char *
-initstate(seed, arg_state, n)
-       unsigned seed;          /* seed for R.N.G. */
-       char *arg_state;                /* pointer to state array */
-       size_t n;                               /* # bytes of state info */
-{
-       char *ostate = (char *)(&state[-1]);
-       uint32_t *int_arg_state = (uint32_t *)arg_state;
-
-       if (rand_type == TYPE_0)
-               state[-1] = rand_type;
-       else
-               state[-1] = MAX_TYPES * (rptr - state) + rand_type;
-       if (n < BREAK_0) {
-               (void)fprintf(stderr,
-                   "random: not enough state (%ld bytes); ignored.\n", n);
-               return(0);
-       }
-       if (n < BREAK_1) {
-               rand_type = TYPE_0;
-               rand_deg = DEG_0;
-               rand_sep = SEP_0;
-       } else if (n < BREAK_2) {
-               rand_type = TYPE_1;
-               rand_deg = DEG_1;
-               rand_sep = SEP_1;
-       } else if (n < BREAK_3) {
-               rand_type = TYPE_2;
-               rand_deg = DEG_2;
-               rand_sep = SEP_2;
-       } else if (n < BREAK_4) {
-               rand_type = TYPE_3;
-               rand_deg = DEG_3;
-               rand_sep = SEP_3;
-       } else {
-               rand_type = TYPE_4;
-               rand_deg = DEG_4;
-               rand_sep = SEP_4;
-       }
-       state = int_arg_state + 1; /* first location */
-       end_ptr = &state[rand_deg];     /* must set end_ptr before srandom */
-       srandom(seed);
-       if (rand_type == TYPE_0)
-               int_arg_state[0] = rand_type;
-       else
-               int_arg_state[0] = MAX_TYPES * (rptr - state) + rand_type;
-       return(ostate);
-}
-
-/*
- * setstate:
- *
- * Restore the state from the given state array.
- *
- * Note: it is important that we also remember the locations of the pointers
- * in the current state information, and restore the locations of the pointers
- * from the old state information.  This is done by multiplexing the pointer
- * location into the zeroeth word of the state information.
- *
- * Note that due to the order in which things are done, it is OK to call
- * setstate() with the same state as the current state.
- *
- * Returns a pointer to the old state information.
- *
- * Note: The Sparc platform requires that arg_state begin on an int
- * word boundary; otherwise a bus error will occur. Even so, lint will
- * complain about mis-alignment, but you should disregard these messages.
- */
-char *
-setstate(arg_state)
-       const char *arg_state;          /* pointer to state array */
-{
-       uint32_t *new_state = (uint32_t *)arg_state;
-       uint32_t type = new_state[0] % MAX_TYPES;
-       uint32_t rear = new_state[0] / MAX_TYPES;
-       char *ostate = (char *)(&state[-1]);
-
-       if (rand_type == TYPE_0)
-               state[-1] = rand_type;
-       else
-               state[-1] = MAX_TYPES * (rptr - state) + rand_type;
-       switch(type) {
-       case TYPE_0:
-       case TYPE_1:
-       case TYPE_2:
-       case TYPE_3:
-       case TYPE_4:
-               rand_type = type;
-               rand_deg = degrees[type];
-               rand_sep = seps[type];
-               break;
-       default:
-               (void)fprintf(stderr,
-                   "random: state info corrupted; not changed.\n");
-       }
-       state = new_state + 1;
-       if (rand_type != TYPE_0) {
-               rptr = &state[rear];
-               fptr = &state[(rear + rand_sep) % rand_deg];
-       }
-       end_ptr = &state[rand_deg];             /* set end_ptr too */
-       return(ostate);
-}
-
-/*
- * random:
- *
- * If we are using the trivial TYPE_0 R.N.G., just do the old linear
- * congruential bit.  Otherwise, we do our fancy trinomial stuff, which is
- * the same in all the other cases due to all the global variables that have
- * been set up.  The basic operation is to add the number at the rear pointer
- * into the one at the front pointer.  Then both pointers are advanced to
- * the next location cyclically in the table.  The value returned is the sum
- * generated, reduced to 31 bits by throwing away the "least random" low bit.
- *
- * Note: the code takes advantage of the fact that both the front and
- * rear pointers can't wrap on the same call by not testing the rear
- * pointer if the front one has wrapped.
- *
- * Returns a 31-bit random number.
- */
-long
-random()
-{
-       uint32_t i;
-       uint32_t *f, *r;
-
-       if (rand_type == TYPE_0) {
-               i = state[0];
-               state[0] = i = (good_rand(i)) & 0x7fffffff;
-       } else {
-               /*
-                * Use local variables rather than static variables for speed.
-                */
-               f = fptr; r = rptr;
-               *f += *r;
-               i = (*f >> 1) & 0x7fffffff;     /* chucking least random bit */
-               if (++f >= end_ptr) {
-                       f = state;
-                       ++r;
-               }
-               else if (++r >= end_ptr) {
-                       r = state;
-               }
-
-               fptr = f; rptr = r;
-       }
-       return((long)i);
-}
diff --git a/stdlib/random.3 b/stdlib/random.3
deleted file mode 100644 (file)
index 84c8755..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)random.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/random.3,v 1.22 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt RANDOM 3
-.Os
-.Sh NAME
-.Nm initstate ,
-.Nm random ,
-.Nm setstate ,
-.Nm srandom ,
-.Nm srandomdev
-.Nd better random number generator; routines for changing generators
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft char *
-.Fo initstate
-.Fa "unsigned seed"
-.Fa "char *state"
-.Fa "size_t size"
-.Fc
-.Ft long
-.Fo random
-.Fa void
-.Fc
-.Ft char *
-.Fo setstate
-.Fa "const char *state"
-.Fc
-.Ft void
-.Fo srandom
-.Fa "unsigned seed"
-.Fc
-.Ft void
-.Fo srandomdev
-.Fa void
-.Fc
-.Sh DESCRIPTION
-The
-.Fn random
-function
-uses a non-linear, additive feedback, random number generator, employing a
-default table of size 31 long integers.
-It returns successive pseudo-random
-numbers in the range from 0 to
-.if t 2\u\s731\s10\d\(mi1.
-.if n (2**31)\(mi1.
-The period of this random number generator is very large, approximately
-.if t 16\(mu(2\u\s731\s10\d\(mi1).
-.if n 16*((2**31)\(mi1).
-.Pp
-The
-.Fn random
-and
-.Fn srandom
-functions have (almost) the same calling sequence and initialization properties as the
-.Xr rand 3
-and
-.Xr srand 3
-functions.
-The difference is that
-.Xr rand 3
-produces a much less random sequence \(em in fact, the low dozen bits
-generated by rand go through a cyclic pattern.
-All of the bits generated by
-.Fn random
-are usable.
-For example,
-.Sq Li random()&01
-will produce a random binary
-value.
-.Pp
-Like
-.Xr srand 3 ,
-.Fn srandom
-sets the initial seed value for future calls to
-.Fn random .
-Like
-.Xr rand 3 ,
-.Fn random
-will by default produce a sequence of numbers that can be duplicated
-by calling
-.Fn srandom
-with the same seed.
-.Pp
-The
-.Fn srandomdev
-routine initializes a state array, using the
-.Xr random 4
-random number device which returns good random numbers,
-suitable for cryptographic use.
-Note that this particular seeding
-procedure can generate states which are impossible to reproduce by
-calling
-.Fn srandom
-with any value, since the succeeding terms in the
-state buffer are no longer derived from the LC algorithm applied to
-a fixed seed.
-.Pp
-The
-.Fn initstate
-routine allows a state array, passed in as an argument, to be initialized
-for future use.
-The size of the state array (in bytes) is used by
-.Fn initstate
-to decide how sophisticated a random number generator it should use \(em the
-more state, the better the random numbers will be.
-(Current "optimal" values for the amount of state information are
-8, 32, 64, 128, and 256 bytes; other amounts will be rounded down to
-the nearest known amount.
-Using less than 8 bytes will cause an error.)
-The seed for the initialization (which specifies a starting point for
-the random number sequence and provides for restarting at the same
-point) is also an argument.
-The
-.Fn initstate
-function
-returns a pointer to the previous state information array.
-.Pp
-Once a state has been initialized, the
-.Fn setstate
-routine provides for rapid switching between states.
-The
-.Fn setstate
-function
-returns a pointer to the previous state array; its
-argument state array is used for further random number generation
-until the next call to
-.Fn initstate
-or
-.Fn setstate .
-.Pp
-Once a state array has been initialized, it may be restarted at a
-different point either by calling
-.Fn initstate
-(with the desired seed, the state array, and its size) or by calling
-both
-.Fn setstate
-(with the state array) and
-.Fn srandom
-(with the desired seed).
-The advantage of calling both
-.Fn setstate
-and
-.Fn srandom
-is that the size of the state array does not have to be remembered after
-it is initialized.
-.Pp
-With 256 bytes of state information, the period of the random number
-generator is greater than
-.if t 2\u\s769\s10\d,
-.if n 2**69 ,
-which should be sufficient for most purposes.
-.Sh DIAGNOSTICS
-If
-.Fn initstate
-is called with less than 8 bytes of state information, or if
-.Fn setstate
-detects that the state information has been garbled, error
-messages are printed on the standard error output.
-.Sh LEGACY SYNOPSIS
-.Fd #include <stdlib.h>
-.Pp
-.Ft char *
-.br
-.Fo initstate
-.Fa "unsigned long seed"
-.Fa "char *state"
-.Fa "long size"
-.Fc ;
-.Pp
-.Ft char *
-.br
-.Fo setstate
-.Fa "char *state"
-.Fc ;
-.Pp
-.Ft void
-.br
-.Fo srandom
-.Fa "unsigned long seed"
-.Fc ;
-.Pp
-The type of each parameter is different in the legacy version.
-.Sh SEE ALSO
-.Xr arc4random 3 ,
-.Xr rand 3 ,
-.Xr srand 3 ,
-.Xr random 4 ,
-.Xr compat 5
-.Sh HISTORY
-These
-functions appeared in
-.Bx 4.2 .
-.Sh AUTHORS
-.An Earl T. Cohen
-.Sh BUGS
-About 2/3 the speed of
-.Xr rand 3 .
-.Pp
-The historical implementation used to have a very weak seeding; the
-random sequence did not vary much with the seed.
-The current implementation employs a better pseudo-random number
-generator for the initial state calculation.
-.Pp
-Applications requiring cryptographic quality randomness should use
-.Xr arc4random 3 .
diff --git a/stdlib/reallocf-fbsd.c b/stdlib/reallocf-fbsd.c
deleted file mode 120000 (symlink)
index 001360c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./reallocf.c
\ No newline at end of file
diff --git a/stdlib/realpath-fbsd.c b/stdlib/realpath-fbsd.c
deleted file mode 100644 (file)
index 234bce9..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The names of the authors may not be used to endorse or promote
- *    products derived from this software without specific prior written
- *    permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/realpath.c,v 1.20 2003/05/28 08:23:01 fjoe Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/attr.h>
-#include <sys/vnode.h>
-#include "un-namespace.h"
-
-struct attrs {
-       u_int32_t len;
-       attrreference_t name;
-       dev_t dev;
-       fsobj_type_t type;
-       fsobj_id_t id;
-       char buf[PATH_MAX];
-};
-
-#ifndef BUILDING_VARIANT
-__private_extern__ struct attrlist _rp_alist = {
-       ATTR_BIT_MAP_COUNT,
-       0,
-       ATTR_CMN_NAME | ATTR_CMN_DEVID | ATTR_CMN_OBJTYPE | ATTR_CMN_OBJID,
-       0,
-       0,
-       0,
-       0,
-};
-#else /* BUILDING_VARIANT */
-__private_extern__ struct attrlist _rp_alist;
-#endif /* BUILDING_VARIANT */
-
-extern char * __private_getcwd(char *, size_t, int);
-
-/*
- * char *realpath(const char *path, char resolved[PATH_MAX]);
- *
- * Find the real name of path, by removing all ".", ".." and symlink
- * components.  Returns (resolved) on success, or (NULL) on failure,
- * in which case the path which caused trouble is left in (resolved).
- */
-char *
-realpath(const char *path, char inresolved[PATH_MAX])
-{
-       struct attrs attrs;
-       struct stat sb;
-       char *p, *q, *s;
-       size_t left_len, resolved_len, save_resolved_len;
-       unsigned symlinks;
-       int serrno, slen, useattrs, islink;
-       char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
-       dev_t dev, lastdev;
-       struct statfs sfs;
-       static dev_t rootdev;
-       static int rootdev_inited = 0;
-       ino_t inode;
-       char *resolved;
-
-       if (path == NULL) {
-               errno = EINVAL;
-               return (NULL);
-       }
-#if __DARWIN_UNIX03
-       if (*path == 0) {
-               errno = ENOENT;
-               return (NULL);
-       }
-#endif /* __DARWIN_UNIX03 */
-       /*
-        * Extension to the standard; if inresolved == NULL, allocate memory
-        */
-       if (!inresolved) {
-           if ((resolved = malloc(PATH_MAX)) == NULL) return (NULL);
-       } else {
-           resolved = inresolved;
-       }
-       if (!rootdev_inited) {
-               rootdev_inited = 1;
-               if (stat("/", &sb) < 0) {
-error_return:
-                       if (!inresolved) {
-                               int e = errno;
-                               free(resolved);
-                               errno = e;
-                       }
-                       return (NULL);
-               }
-               rootdev = sb.st_dev;
-       }
-       serrno = errno;
-       symlinks = 0;
-       if (path[0] == '/') {
-               resolved[0] = '/';
-               resolved[1] = '\0';
-               if (path[1] == '\0') {
-                       return (resolved);
-               }
-               resolved_len = 1;
-               left_len = strlcpy(left, path + 1, sizeof(left));
-       } else {
-#if !defined(VARIANT_DARWINEXTSN) && __DARWIN_UNIX03
-               /* 4447159: don't use GETPATH, so this will fail if */
-               /* if parent directories are not readable, as per POSIX */
-               if (__private_getcwd(resolved, PATH_MAX, 0) == NULL)
-#else /* VARIANT_DARWINEXTSN || !__DARWIN_UNIX03 */
-               if (__private_getcwd(resolved, PATH_MAX, 1) == NULL)
-#endif /* !VARIANT_DARWINEXTSN && __DARWIN_UNIX03 */
-               {
-                       strlcpy(resolved, ".", PATH_MAX);
-                       goto error_return;
-               }
-               resolved_len = strlen(resolved);
-               left_len = strlcpy(left, path, sizeof(left));
-       }
-       if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
-               errno = ENAMETOOLONG;
-               goto error_return;
-       }
-       if (resolved_len > 1) {
-               if (stat(resolved, &sb) < 0) {
-                       goto error_return;
-               }
-               lastdev = sb.st_dev;
-       } else
-               lastdev = rootdev;
-
-       /*
-        * Iterate over path components in `left'.
-        */
-       while (left_len != 0) {
-               /*
-                * Extract the next path component and adjust `left'
-                * and its length.
-                */
-               p = strchr(left, '/');
-               s = p ? p : left + left_len;
-               if (s - left >= sizeof(next_token)) {
-                       errno = ENAMETOOLONG;
-                       goto error_return;
-               }
-               memcpy(next_token, left, s - left);
-               next_token[s - left] = '\0';
-               left_len -= s - left;
-               if (p != NULL)
-                       memmove(left, s + 1, left_len + 1);
-               if (resolved[resolved_len - 1] != '/') {
-                       if (resolved_len + 1 >= PATH_MAX) {
-                               errno = ENAMETOOLONG;
-                               goto error_return;
-                       }
-                       resolved[resolved_len++] = '/';
-                       resolved[resolved_len] = '\0';
-               }
-               if (next_token[0] == '\0')
-                       continue;
-               else if (strcmp(next_token, ".") == 0)
-                       continue;
-               else if (strcmp(next_token, "..") == 0) {
-                       /*
-                        * Strip the last path component except when we have
-                        * single "/"
-                        */
-                       if (resolved_len > 1) {
-                               resolved[resolved_len - 1] = '\0';
-                               q = strrchr(resolved, '/') + 1;
-                               *q = '\0';
-                               resolved_len = q - resolved;
-                       }
-                       continue;
-               }
-
-               /*
-                * Save resolved_len, so that we can later null out
-                * the the appended next_token, and replace with the
-                * real name (matters on case-insensitive filesystems).
-                */
-               save_resolved_len = resolved_len;
-
-               /*
-                * Append the next path component and lstat() it. If
-                * lstat() fails we still can return successfully if
-                * there are no more path components left.
-                */
-               resolved_len = strlcat(resolved, next_token, PATH_MAX);
-               if (resolved_len >= PATH_MAX) {
-                       errno = ENAMETOOLONG;
-                       goto error_return;
-               }
-               if (getattrlist(resolved, &_rp_alist, &attrs, sizeof(attrs), FSOPT_NOFOLLOW) == 0) {
-                       useattrs = 1;
-                       islink = (attrs.type == VLNK);
-                       dev = attrs.dev;
-                       inode = attrs.id.fid_objno;
-               } else if (errno == ENOTSUP || errno == EINVAL) {
-                       if ((useattrs = lstat(resolved, &sb)) == 0) {
-                               islink = S_ISLNK(sb.st_mode);
-                               dev = sb.st_dev;
-                               inode = sb.st_ino;
-                       }
-               } else
-                       useattrs = -1;
-               if (useattrs < 0) {
-#if !__DARWIN_UNIX03
-                       if (errno == ENOENT && p == NULL) {
-                               errno = serrno;
-                               return (resolved);
-                       }
-#endif /* !__DARWIN_UNIX03 */
-                       goto error_return;
-               }
-               if (dev != lastdev) {
-                       /*
-                        * We have crossed a mountpoint.  For volumes like UDF
-                        * the getattrlist name may not match the actual
-                        * mountpoint, so we just copy the mountpoint directly.
-                        * (3703138).  However, the mountpoint may not be
-                        * accessible, as when chroot-ed, so check first.
-                        * There may be a file on the chroot-ed volume with
-                        * the same name as the mountpoint, so compare device
-                        * and inode numbers.
-                        */
-                       lastdev = dev;
-                       if (statfs(resolved, &sfs) == 0 && lstat(sfs.f_mntonname, &sb) == 0 && dev == sb.st_dev && inode == sb.st_ino) {
-                               /*
-                                * However, it's possible that the mountpoint
-                                * path matches, even though it isn't the real
-                                * path in the chroot-ed environment, so check
-                                * that each component of the mountpoint
-                                * is a directory (and not a symlink)
-                                */
-                               char temp[sizeof(sfs.f_mntonname)];
-                               char *cp;
-                               int ok = 1;
-
-                               strcpy(temp, sfs.f_mntonname);
-                               for(;;) {
-                                       if ((cp = strrchr(temp, '/')) == NULL) {
-                                               ok = 0;
-                                               break;
-                                       }
-                                       if (cp <= temp)
-                                               break;
-                                       *cp = 0;
-                                       if (lstat(temp, &sb) < 0 || (sb.st_mode & S_IFMT) != S_IFDIR) {
-                                               ok = 0;
-                                               break;
-                                       }
-                               }
-                               if (ok) {
-                                       resolved_len = strlcpy(resolved, sfs.f_mntonname, PATH_MAX);
-                                       continue;
-                               }
-                       }
-                       /* if we fail, use the other methods. */
-               }
-               if (islink) {
-                       if (symlinks++ > MAXSYMLINKS) {
-                               errno = ELOOP;
-                               goto error_return;
-                       }
-                       slen = readlink(resolved, symlink, sizeof(symlink) - 1);
-                       if (slen < 0) {
-                               goto error_return;
-                       }
-                       symlink[slen] = '\0';
-                       if (symlink[0] == '/') {
-                               resolved[1] = 0;
-                               resolved_len = 1;
-                               lastdev = rootdev;
-                       } else if (resolved_len > 1) {
-                               /* Strip the last path component. */
-                               resolved[resolved_len - 1] = '\0';
-                               q = strrchr(resolved, '/') + 1;
-                               *q = '\0';
-                               resolved_len = q - resolved;
-                       }
-
-                       /*
-                        * If there are any path components left, then
-                        * append them to symlink. The result is placed
-                        * in `left'.
-                        */
-                       if (p != NULL) {
-                               if (symlink[slen - 1] != '/') {
-                                       if (slen + 1 >= sizeof(symlink)) {
-                                               errno = ENAMETOOLONG;
-                                               goto error_return;
-                                       }
-                                       symlink[slen] = '/';
-                                       symlink[slen + 1] = 0;
-                               }
-                               left_len = strlcat(symlink, left, sizeof(left));
-                               if (left_len >= sizeof(left)) {
-                                       errno = ENAMETOOLONG;
-                                       goto error_return;
-                               }
-                       }
-                       left_len = strlcpy(left, symlink, sizeof(left));
-               } else if (useattrs) {
-                       /*
-                        * attrs already has the real name.
-                        */
-
-                       resolved[save_resolved_len] = '\0';
-                       resolved_len = strlcat(resolved, (const char *)&attrs.name + attrs.name.attr_dataoffset, PATH_MAX);
-                       if (resolved_len >= PATH_MAX) {
-                               errno = ENAMETOOLONG;
-                               goto error_return;
-                       }
-               }
-               /*
-                * For the case of useattrs == 0, we could scan the directory
-                * and try to match the inode.  There are many problems with
-                * this: (1) the directory may not be readable, (2) for multiple
-                * hard links, we would find the first, but not necessarily
-                * the one specified in the path, (3) we can't try to do
-                * a case-insensitive search to match the right one in (2),
-                * because the underlying filesystem may do things like
-                * decompose composed characters.  For most cases, doing
-                * nothing is the right thing when useattrs == 0, so we punt
-                * for now.
-                */
-       }
-
-       /*
-        * Remove trailing slash except when the resolved pathname
-        * is a single "/".
-        */
-       if (resolved_len > 1 && resolved[resolved_len - 1] == '/')
-               resolved[resolved_len - 1] = '\0';
-       return (resolved);
-}
diff --git a/stdlib/realpath.3 b/stdlib/realpath.3
deleted file mode 100644 (file)
index 3ffdf9c..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-.\" Copyright (c) 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Jan-Simon Pendry.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)realpath.3 8.2 (Berkeley) 2/16/94
-.\" $FreeBSD: src/lib/libc/stdlib/realpath.3,v 1.14 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd April 5, 2008
-.Dt REALPATH 3
-.Os
-.Sh NAME
-.Nm realpath
-.Nd returns the canonicalized absolute pathname
-.\" .Sh LIBRARY
-.\" .Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft "char *"
-.Fo realpath
-.Fa "const char *restrict file_name"
-.Fa "char *restrict resolved_name"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn realpath
-function resolves all symbolic links, extra
-.Dq /
-characters, and references to
-.Pa /./
-and
-.Pa /../
-in
-.Fa file_name .
-If the
-.Fa resolved_name
-argument
-is non-NULL, the resulting absolute pathname is copied there (it
-.Em must
-refer to a buffer capable of storing at least
-.Dv PATH_MAX
-characters).
-.Pp
-As a permitted extension to the standard, if
-.Fa resolved_name
-is NULL, 
-memory is allocated for the resulting absolute pathname, and is returned by
-.Fn realpath .
-This memory should be freed by a call to
-.Xr free 3
-when no longer needed.
-.Pp
-The
-.Fn realpath
-function will resolve both absolute and relative paths
-and return the absolute pathname corresponding to
-.Fa file_name .
-All components of
-.Fa file_name
-must exist when
-.Fn realpath
-is called.
-.Sh "RETURN VALUES"
-On success, the
-.Fn realpath
-function returns the address of the resulting absolute pathname, which is
-.Fa resolved_name
-if it was non-NULL, or the address of newly allocated memory.
-If an error occurs,
-.Fn realpath
-returns
-.Dv NULL .
-If
-.Fa resolved_name
-was non-NULL, it will
-contains the pathname which caused the problem.
-.Sh ERRORS
-The function
-.Fn realpath
-may fail and set the external variable
-.Va errno
-for any of the errors specified for the library functions
-.Xr alloca 3 ,
-.Xr getattrlist 2 ,
-.Xr getcwd 3 ,
-.Xr lstat 2 ,
-.Xr readlink 2 ,
-.Xr stat 2 ,
-and
-.Xr strdup 3 .
-.\" .Sh CAVEATS
-.\" This implementation of
-.\" .Fn realpath
-.\" differs slightly from the Solaris implementation.
-.\" The
-.\" .Bx 4.4
-.\" version always returns absolute pathnames,
-.\" whereas the Solaris implementation will,
-.\" under certain circumstances, return a relative
-.\" .Fa resolved_name
-.\" when given a relative
-.\" .Fa file_name .
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/param.h>
-.Fd #include <stdlib.h>
-.Pp
-The include file
-.In sys/param.h
-is necessary.
-.Sh LEGACY DESCRIPTION
-In legacy mode,
-the last component of
-.Fa file_name
-does not need to exist when
-.Fn realpath
-is called.
-.Sh "SEE ALSO"
-.Xr free 3 ,
-.Xr getcwd 3 ,
-.Xr compat 5
-.Sh HISTORY
-The
-.Fn realpath
-function first appeared in
-.Bx 4.4 .
diff --git a/stdlib/remque-fbsd.c b/stdlib/remque-fbsd.c
deleted file mode 120000 (symlink)
index f8680b9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./remque.c
\ No newline at end of file
diff --git a/stdlib/setenv-fbsd.c b/stdlib/setenv-fbsd.c
deleted file mode 100644 (file)
index 8965a6a..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setenv.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/setenv.c,v 1.14 2007/05/01 16:02:41 ache Exp $");
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <crt_externs.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <malloc/malloc.h>
-
-#define        ZONE_OWNS_PTR(zone, ptr)        (malloc_zone_from_ptr((ptr)) == zone)
-
-extern malloc_zone_t *__zone0;
-extern void __malloc_check_env_name(const char *);
-
-__private_extern__ char *__findenv(const char *, int *, char **);
-__private_extern__ int __setenv(const char *, const char *, int, int, char ***, malloc_zone_t *);
-__private_extern__ void __unsetenv(const char *, char **, malloc_zone_t *);
-__private_extern__ int init__zone0(int);
-
-/*
- * _cthread_init_routine used to be called from crt1.o to initialize threads.
- * This is no longer needed, as initialization happens in dylib initializers,
- * but is provided to maintain backwards compatibility.  Normally, for 10.5
- * or greater, _cthread_init_routine does nothing.
- *
- * Before 10.5, the _start routine in crt1.o clobbers environ with the original
- * stack value, which effectively undoes any environment changes made in
- * initializers.  When LEGACY_CRT1_ENVIRON is defined, we replace the
- * do-nothing routine with one that attempts to restore the environ value.
- * But this only works if the setenv (and family) routines were used
- * exclusively, (no direct manipulation of environ).  Note that according to
- * SUSv3, direct manipulation of environ may result in undefined behavior in
- * setenv and family, so we don't support that (on less than 10.5).
- */
-#ifdef BUILDING_VARIANT
-#  ifdef LEGACY_CRT1_ENVIRON
-extern char **_saved_environ;
-#  endif /* LEGACY_CRT1_ENVIRON */
-#else /* !BUILDING_VARIANT */
-#  ifdef LEGACY_CRT1_ENVIRON
-__private_extern__ char **_saved_environ = NULL;
-
-static int
-_legacy_crt1_environ(void)
-{
-       if (_saved_environ) *_NSGetEnviron() = _saved_environ;
-       return 0;
-}
-int (*_cthread_init_routine)(void) = _legacy_crt1_environ;
-
-#  else /* !LEGACY_CRT1_ENVIRON */
-static int _do_nothing(void) { return 0; }
-int (*_cthread_init_routine)(void) = _do_nothing;
-#  endif /* !LEGACY_CRT1_ENVIRON */
-
-/*
- * Create the environment malloc zone and give it a recognizable name.
- */
-__private_extern__ int
-init__zone0(int should_set_errno)
-{
-       if (__zone0) return (0);
-
-       __zone0 = malloc_create_zone(0, 0);
-       if (!__zone0) {
-               if (should_set_errno) {
-                       errno = ENOMEM;
-               }
-               return (-1);
-       }
-       malloc_set_zone_name(__zone0, "environ");
-       return (0);
-}
-
-/*
- * The copy flag may have 3 values:
- *  1 - make a copy of the name/value pair
- *  0 - take the name as a user-supplied name=value string
- * -1 - like 0, except we copy of the name=value string in name
- */
-__private_extern__ int
-__setenv(name, value, rewrite, copy, environp, envz)
-       const char *name;
-       const char *value;
-       int rewrite, copy;
-       char ***environp;
-       malloc_zone_t *envz;
-{
-       char *c;
-       int offset;
-
-       if ((c = __findenv(name, &offset, *environp))) { /* find if already exists */
-               char *e;
-               if (!rewrite)
-                       return (0);
-               /*
-                * In UNIX03, we can overwrite only if we allocated the
-                * string.  Then we can realloc it if it is too small.
-                */
-               e = (*environp)[offset];
-               if (copy > 0 && ZONE_OWNS_PTR(envz, e)) {
-                       size_t l_value = strlen(value);
-                       if (strlen(c) < l_value) {      /* old smaller; resize*/
-                               char *r;
-                               size_t len = c - e;
-                               if ((r = realloc(e, l_value + len + 1)) == NULL)
-                                       return (-1);
-                               if (r != e) {
-                                       (*environp)[offset] = r;
-                                       c = r + len;
-                               }
-                       }
-                       while ( (*c++ = *value++) );
-                       return (0);
-               }
-       } else {                                        /* create new slot */
-               int cnt;
-               char **p;
-
-               for (p = *environp, cnt = 0; *p; ++p, ++cnt);
-               if (ZONE_OWNS_PTR(envz, *environp)) {   /* just increase size */
-                       p = (char **)realloc((char *)*environp,
-                           (size_t)(sizeof(char *) * (cnt + 2)));
-                       if (!p)
-                               return (-1);
-                       *environp = p;
-               }
-               else {                          /* get new space */
-                                               /* copy old entries into it */
-                       p = malloc_zone_malloc(envz, (size_t)(sizeof(char *) * (cnt + 2)));
-                       if (!p)
-                               return (-1);
-                       bcopy(*environp, p, cnt * sizeof(char *));
-                       *environp = p;
-               }
-               (*environp)[cnt + 1] = NULL;
-               offset = cnt;
-       }
-       /* For non Unix03, or UnixO3 setenv(), we make a copy of the user's
-        * strings.  For Unix03 putenv(), we put the string directly in
-        * the environment. */
-       if (copy > 0) {
-               for (c = (char *)name; *c && *c != '='; ++c);   /* no `=' in name */
-               if (!((*environp)[offset] =                     /* name + `=' + value */
-                   malloc_zone_malloc(envz, (size_t)((int)(c - name) + strlen(value) + 2))))
-                       return (-1);
-               for (c = (*environp)[offset]; (*c = *name++) && *c != '='; ++c);
-               for (*c++ = '='; (*c++ = *value++); );
-       } else {
-               /* the legacy behavior copies the string */
-               if (copy < 0) {
-                       size_t len = strlen(name);
-                       if((c = malloc_zone_malloc(envz, len + 1)) == NULL)
-                               return (-1);
-                       memcpy(c, name, len + 1);
-                       name = c;
-               }
-               /* if we malloc-ed the previous value, free it first */
-               if ((*environp)[offset] != NULL && ZONE_OWNS_PTR(envz, (*environp)[offset]))
-                       free((*environp)[offset]);
-               (*environp)[offset] = (char *)name;
-       }
-       return (0);
-}
-
-__private_extern__ void
-__unsetenv(const char *name, char **environ, malloc_zone_t *envz)
-{
-       char **p;
-       int offset;
-
-       while (__findenv(name, &offset, environ)) { /* if set multiple times */
-               /* if we malloc-ed it, free it first */
-               if (ZONE_OWNS_PTR(envz, environ[offset]))
-                       free(environ[offset]);
-               for (p = &environ[offset];; ++p)
-                       if (!(*p = *(p + 1)))
-                               break;
-       }
-}
-
-/****************************************************************************/
-/*
- * _allocenvstate -- SPI that creates a new state (opaque)
- */
-void *
-_allocenvstate(void)
-{
-       malloc_zone_t *zone;
-       zone = malloc_create_zone(1000 /* unused */, 0 /* unused */);
-       if (zone) {
-               malloc_set_zone_name(zone, "environ");
-       }
-       return (void *)zone;
-}
-
-/*
- * _copyenv -- SPI that copies a NULL-tereminated char * array in a newly
- * allocated buffer, compatible with the other SPI env routines.  If env
- * is NULL, a char * array composed of a single NULL is returned.  NULL
- * is returned on error.  (This isn't needed anymore, as __setenv will
- * automatically make a copy in the zone.)
- */
-char **
-_copyenv(char **env)
-{
-       char **p;
-       int cnt = 1;
-
-       if (env)
-               for (p = env; *p; ++p, ++cnt);
-       p = (char **)malloc((size_t)(sizeof(char *) * cnt));
-       if (!p)
-               return (NULL);
-       if (env)
-               bcopy(env, p, cnt * sizeof(char *));
-       else
-               *p = NULL;
-       return p;
-}
-
-/*
- * _deallocenvstate -- SPI that frees all the memory associated with the state
- * and all allocated strings, including the environment array itself if it
- * was copied.
- */
-int
-_deallocenvstate(void *state)
-{
-       malloc_zone_t *envz;
-
-       if (!(envz = (malloc_zone_t *)state) || envz == __zone0) {
-               errno = EINVAL;
-               return -1;
-       }
-       malloc_destroy_zone(envz);
-       return 0;
-}
-
-/*
- * setenvp -- SPI using an arbitrary pointer to string array and an env state,
- * created by _allocenvstate().  Initial checking is not done.
- *
- *     Set the value of the environmental variable "name" to be
- *     "value".  If rewrite is set, replace any current value.
- */
-int
-_setenvp(const char *name, const char *value, int rewrite, char ***envp, void *state)
-{
-       if (init__zone0(1)) return (-1);
-       return (__setenv(name, value, rewrite, 1, envp, (state ? (malloc_zone_t *)state : __zone0)));
-}
-
-/*
- * unsetenv(name) -- SPI using an arbitrary pointer to string array and an env
- * state, created by _allocenvstate().  Initial checking is not done.
- *
- *     Delete environmental variable "name".
- */
-int
-_unsetenvp(const char *name, char ***envp, void *state)
-{
-       if (init__zone0(1)) return (-1);
-       __unsetenv(name, *envp, (state ? (malloc_zone_t *)state : __zone0));
-       return 0;
-}
-
-#endif /* !BUILD_VARIANT */
-
-/*
- * setenv --
- *     Set the value of the environmental variable "name" to be
- *     "value".  If rewrite is set, replace any current value.
- */
-int
-setenv(name, value, rewrite)
-       const char *name;
-       const char *value;
-       int rewrite;
-{
-#ifdef LEGACY_CRT1_ENVIRON
-       int ret;
-#endif /* LEGACY_CRT1_ENVIRON */
-
-       /* no null ptr or empty str */
-       if(name == NULL || *name == 0) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-#if __DARWIN_UNIX03
-       /* no '=' in name */
-       if (strchr(name, '=')) {
-               errno = EINVAL;
-               return (-1);
-       }
-#endif /* __DARWIN_UNIX03 */
-
-       if (*value == '=')                      /* no `=' in value */
-               ++value;
-       /* insure __zone0 is set up before calling __malloc_check_env_name */
-       if (init__zone0(1)) return (-1);
-       __malloc_check_env_name(name); /* see if we are changing a malloc environment variable */
-#ifdef LEGACY_CRT1_ENVIRON
-       ret = __setenv(name, value, rewrite, 1, _NSGetEnviron(), __zone0);
-       _saved_environ = *_NSGetEnviron();
-       return ret;
-#else /* !LEGACY_CRT1_ENVIRON */
-       return (__setenv(name, value, rewrite, 1, _NSGetEnviron(), __zone0));
-#endif /* !LEGACY_CRT1_ENVIRON */
-}
-
-/*
- * unsetenv(name) --
- *     Delete environmental variable "name".
- */
-#if __DARWIN_UNIX03
-int
-#else /* !__DARWIN_UNIX03 */
-void
-#endif /* __DARWIN_UNIX03 */
-unsetenv(name)
-       const char *name;
-{
-#if __DARWIN_UNIX03
-       /* no null ptr or empty str */
-       if(name == NULL || *name == 0) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       /* no '=' in name */
-       if (strchr(name, '=')) {
-               errno = EINVAL;
-               return (-1);
-       }
-       /* insure __zone0 is set up before calling __malloc_check_env_name */
-       if (init__zone0(1)) return (-1);
-#else /* !__DARWIN_UNIX03 */
-       /* no null ptr or empty str */
-       if(name == NULL || *name == 0)
-               return;
-       /* insure __zone0 is set up before calling __malloc_check_env_name */
-       if (init__zone0(0)) return;
-#endif /* __DARWIN_UNIX03 */
-       __malloc_check_env_name(name); /* see if we are changing a malloc environment variable */
-       __unsetenv(name, *_NSGetEnviron(), __zone0);
-#if __DARWIN_UNIX03
-       return 0;
-#endif /* __DARWIN_UNIX03 */
-}
diff --git a/stdlib/strfmon-nbsd.c b/stdlib/strfmon-nbsd.c
deleted file mode 100644 (file)
index 2afa835..0000000
+++ /dev/null
@@ -1,659 +0,0 @@
-/*     $NetBSD: strfmon.c,v 1.7 2009/01/30 23:46:03 lukem Exp $        */
-
-/*-
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strfmon.c,v 1.14 2003/03/20 08:18:55 ache Exp $");
-#else
-__RCSID("$NetBSD: strfmon.c,v 1.7 2009/01/30 23:46:03 lukem Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#if defined(__NetBSD__)
-#include "namespace.h"
-#include <monetary.h>
-#endif
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <locale.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-
-/* internal flags */
-#define        NEED_GROUPING           0x01    /* print digits grouped (default) */
-#define        SIGN_POSN_USED          0x02    /* '+' or '(' usage flag */
-#define        LOCALE_POSN             0x04    /* use locale defined +/- (default) */
-#define        PARENTH_POSN            0x08    /* enclose negative amount in () */
-#define        SUPRESS_CURR_SYMBOL     0x10    /* supress the currency from output */
-#define        LEFT_JUSTIFY            0x20    /* left justify */
-#define        USE_INTL_CURRENCY       0x40    /* use international currency symbol */
-#define IS_NEGATIVE            0x80    /* is argument value negative ? */
-
-/* internal macros */
-#define PRINT(CH) do {                                         \
-       if (dst >= s + maxsize)                                 \
-               goto e2big_error;                               \
-       *dst++ = CH;                                            \
-} while (/* CONSTCOND */ 0)
-
-#define PRINTS(STR) do {                                       \
-       const char *tmps = STR;                                 \
-       while (*tmps != '\0')                                   \
-               PRINT(*tmps++);                                 \
-} while (/* CONSTCOND */ 0)
-
-#define GET_NUMBER(VAR,LOC)    do {                            \
-       VAR = 0;                                                \
-       while (isdigit_l((unsigned char)*fmt, (LOC))) {                 \
-               VAR *= 10;                                      \
-               VAR += *fmt - '0';                              \
-               if (VAR > 0x00ffffff)                           \
-                       goto e2big_error;                       \
-               fmt++;                                          \
-       }                                                       \
-} while (/* CONSTCOND */ 0)
-
-#define GRPCPY(howmany) do {                                   \
-       int i = howmany;                                        \
-       while (i-- > 0) {                                       \
-               avalue_size--;                                  \
-               *--bufend = *(avalue+avalue_size+padded);       \
-       }                                                       \
-} while (/* CONSTCOND */ 0)
-
-#define GRPSEP do {                                            \
-       *--bufend = thousands_sep;                              \
-       groups++;                                               \
-} while (/* CONSTCOND */ 0)
-
-static void __setup_vars(int, char *, char *, char *, const char **, struct lconv *);
-static int __calc_left_pad(int, char *, struct lconv *);
-static char *__format_grouped_double(double, int *, int, int, int, struct lconv *, locale_t);
-
-static ssize_t
-_strfmon(char * __restrict s, size_t maxsize, locale_t loc, const char * __restrict format, va_list ap)
-{
-       char            *dst;           /* output destination pointer */
-       const char      *fmt;           /* current format poistion pointer */
-       struct lconv    *lc;            /* pointer to lconv structure */
-       char            *asciivalue;    /* formatted double pointer */
-
-       int             flags;          /* formatting options */
-       int             pad_char;       /* padding character */
-       int             pad_size;       /* pad size */
-       int             width;          /* field width */
-       int             left_prec;      /* left precision */
-       int             right_prec;     /* right precision */
-       double          value;          /* just value */
-       char            space_char = ' '; /* space after currency */
-
-       char            cs_precedes,    /* values gathered from struct lconv */
-                       sep_by_space,
-                       sign_posn,
-                       *currency_symbol;
-       const char      *signstr;
-
-       char            *tmpptr;        /* temporary vars */
-       int             sverrno;
-
-       lc = localeconv_l(loc);
-       dst = s;
-       fmt = format;
-       asciivalue = NULL;
-       currency_symbol = NULL;
-       pad_size = 0;
-
-       while (*fmt) {
-               /* pass nonformating characters AS IS */
-               if (*fmt != '%')
-                       goto literal;
-
-               /* '%' found ! */
-
-               /* "%%" mean just '%' */
-               if (*(fmt+1) == '%') {
-                       fmt++;
-       literal:
-                       PRINT(*fmt++);
-                       continue;
-               }
-
-               /* set up initial values */
-               flags = (NEED_GROUPING|LOCALE_POSN);
-               pad_char = ' ';         /* padding character is "space" */
-               left_prec = -1;         /* no left precision specified */
-               right_prec = -1;        /* no right precision specified */
-               width = -1;             /* no width specified */
-               value = 0;              /* we have no value to print now */
-
-               /* Flags */
-               while (/* CONSTCOND */ 1) {
-                       switch (*++fmt) {
-                               case '=':       /* fill character */
-                                       pad_char = *++fmt;
-                                       if (pad_char == '\0')
-                                               goto format_error;
-                                       continue;
-                               case '^':       /* not group currency  */
-                                       flags &= ~(NEED_GROUPING);
-                                       continue;
-                               case '+':       /* use locale defined signs */
-                                       if (flags & SIGN_POSN_USED)
-                                               goto format_error;
-                                       flags |= (SIGN_POSN_USED|LOCALE_POSN);
-                                       continue;
-                               case '(':       /* enclose negatives with () */
-                                       if (flags & SIGN_POSN_USED)
-                                               goto format_error;
-                                       flags |= (SIGN_POSN_USED|PARENTH_POSN);
-                                       continue;
-                               case '!':       /* suppress currency symbol */
-                                       flags |= SUPRESS_CURR_SYMBOL;
-                                       continue;
-                               case '-':       /* alignment (left)  */
-                                       flags |= LEFT_JUSTIFY;
-                                       continue;
-                               default:
-                                       break;
-                       }
-                       break;
-               }
-
-               /* field Width */
-               if (isdigit_l((unsigned char)*fmt, loc)) {
-                       ptrdiff_t d = dst - s;
-                       GET_NUMBER(width, loc);
-                       /* Do we have enough space to put number with
-                        * required width ?
-                        */
-
-                       if ((size_t)(d + width) >= maxsize)
-                               goto e2big_error;
-               }
-
-               /* Left precision */
-               if (*fmt == '#') {
-                       if (!isdigit_l((unsigned char)*++fmt, loc))
-                               goto format_error;
-                       GET_NUMBER(left_prec, loc);
-               }
-
-               /* Right precision */
-               if (*fmt == '.') {
-                       if (!isdigit_l((unsigned char)*++fmt, loc))
-                               goto format_error;
-                       GET_NUMBER(right_prec, loc);
-               }
-
-               /* Conversion Characters */
-               switch (*fmt++) {
-                       case 'i':       /* use internaltion currency format */
-                               flags |= USE_INTL_CURRENCY;
-                               break;
-                       case 'n':       /* use national currency format */
-                               flags &= ~(USE_INTL_CURRENCY);
-                               break;
-                       default:        /* required character is missing or
-                                          premature EOS */
-                               goto format_error;
-               }
-
-               if (currency_symbol)
-                       free(currency_symbol);
-               if (flags & USE_INTL_CURRENCY) {
-                       currency_symbol = strdup(lc->int_curr_symbol);
-                       if (currency_symbol != NULL) {
-                               space_char = *(currency_symbol+3);
-                               currency_symbol[3] = '\0';
-                       }
-               } else
-                       currency_symbol = strdup(lc->currency_symbol);
-
-               if (currency_symbol == NULL)
-                       goto end_error;                 /* ENOMEM. */
-
-               /* value itself */
-               value = va_arg(ap, double);
-
-               /* detect sign */
-               if (value < 0) {
-                       flags |= IS_NEGATIVE;
-                       value = -value;
-               }
-
-               /* fill left_prec with amount of padding chars */
-               if (left_prec >= 0) {
-                       pad_size = __calc_left_pad((flags ^ IS_NEGATIVE),
-                                                       currency_symbol, lc) -
-                                  __calc_left_pad(flags, currency_symbol, lc);
-                       if (pad_size < 0)
-                               pad_size = 0;
-               }
-
-               asciivalue = __format_grouped_double(value, &flags,
-                               left_prec, right_prec, pad_char, lc, loc);
-               if (asciivalue == NULL)
-                       goto end_error;         /* errno already set     */
-                                               /* to ENOMEM by malloc() */
-
-               /* set some variables for later use */
-               __setup_vars(flags, &cs_precedes, &sep_by_space,
-                               &sign_posn, &signstr, lc);
-
-               /*
-                * Description of some LC_MONETARY's values:
-                *
-                * p_cs_precedes & n_cs_precedes
-                *
-                * = 1 - $currency_symbol precedes the value
-                *       for a monetary quantity with a non-negative value
-                * = 0 - symbol succeeds the value
-                *
-                * p_sep_by_space & n_sep_by_space
-                 *
-                * = 0 - no space separates $currency_symbol
-                *       from the value for a monetary quantity with a
-                *       non-negative value
-                * = 1 - space separates the symbol from the value
-                * = 2 - space separates the symbol and the sign string,
-                *       if adjacent.
-                 *
-                * p_sign_posn & n_sign_posn
-                 *
-                * = 0 - parentheses enclose the quantity and the
-                *       $currency_symbol
-                * = 1 - the sign string precedes the quantity and the 
-                *       $currency_symbol
-                * = 2 - the sign string succeeds the quantity and the 
-                *       $currency_symbol
-                * = 3 - the sign string precedes the $currency_symbol
-                * = 4 - the sign string succeeds the $currency_symbol
-                 *
-                */
-
-               tmpptr = dst;
-
-               while (pad_size-- > 0)
-                       PRINT(' ');
-
-               if (sign_posn == 0 && (flags & IS_NEGATIVE))
-                       PRINT('(');
-
-               if (cs_precedes == 1) {
-                       if (sign_posn == 1 || sign_posn == 3) {
-                               PRINTS(signstr);
-                               if (sep_by_space == 2)          /* XXX: ? */
-                                       PRINT(' ');
-                       }
-
-                       if (!(flags & SUPRESS_CURR_SYMBOL)) {
-                               PRINTS(currency_symbol);
-
-                               if (sign_posn == 4) {
-                                       if (sep_by_space == 2)
-                                               PRINT(space_char);
-                                       PRINTS(signstr);
-                                       if (sep_by_space == 1)
-                                               PRINT(' ');
-                               } else if (sep_by_space == 1)
-                                       PRINT(space_char);
-                       }
-               } else if (sign_posn == 1) {
-                       PRINTS(signstr);
-                       if (sep_by_space == 2)
-                               PRINT(' ');
-               }
-
-               PRINTS(asciivalue);
-
-               if (cs_precedes == 0) {
-                       if (sign_posn == 3) {
-                               if (sep_by_space == 1)
-                                       PRINT(' ');
-                               PRINTS(signstr);
-                       }
-
-                       if (!(flags & SUPRESS_CURR_SYMBOL)) {
-                               if ((sign_posn == 3 && sep_by_space == 2)
-                                   || (sep_by_space == 1
-                                   && (sign_posn == 0
-                                   || sign_posn == 1
-                                   || sign_posn == 2
-                                   || sign_posn == 4)))
-                                       PRINT(space_char);
-                               PRINTS(currency_symbol); /* XXX: len */
-                               if (sign_posn == 4) {
-                                       if (sep_by_space == 2)
-                                               PRINT(' ');
-                                       PRINTS(signstr);
-                               }
-                       }
-               }
-
-               if (sign_posn == 2) {
-                       if (sep_by_space == 2)
-                               PRINT(' ');
-                       PRINTS(signstr);
-               }
-
-               if (sign_posn == 0) {
-                       if (flags & IS_NEGATIVE)
-                               PRINT(')');
-                       else if (left_prec >= 0)
-                               PRINT(' ');
-               }
-
-               if (dst - tmpptr < width) {
-                       if (flags & LEFT_JUSTIFY) {
-                               while (dst - tmpptr < width)
-                                       PRINT(' ');
-                       } else {
-                               pad_size = dst-tmpptr;
-                               memmove(tmpptr + width-pad_size, tmpptr,
-                                   (size_t) pad_size);
-                               memset(tmpptr, ' ', (size_t) width-pad_size);
-                               dst += width-pad_size;
-                       }
-               }
-       }
-
-       PRINT('\0');
-       free(asciivalue);
-       free(currency_symbol);
-       return (dst - s - 1);   /* return size of put data except trailing '\0' */
-
-e2big_error:
-       errno = E2BIG;
-       goto end_error;
-
-format_error:
-       errno = EINVAL;
-
-end_error:
-       sverrno = errno;
-       if (asciivalue != NULL)
-               free(asciivalue);
-       if (currency_symbol != NULL)
-               free(currency_symbol);
-       errno = sverrno;
-       return (-1);
-}
-
-static void
-__setup_vars(int flags, char *cs_precedes, char *sep_by_space,
-               char *sign_posn, const char **signstr, struct lconv *lc) {
-
-       if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
-               *cs_precedes = lc->int_n_cs_precedes;
-               *sep_by_space = lc->int_n_sep_by_space;
-               *sign_posn = (flags & PARENTH_POSN) ? 0 : lc->int_n_sign_posn;
-               *signstr = (lc->negative_sign == '\0') ? "-"
-                   : lc->negative_sign;
-       } else if (flags & USE_INTL_CURRENCY) {
-               *cs_precedes = lc->int_p_cs_precedes;
-               *sep_by_space = lc->int_p_sep_by_space;
-               *sign_posn = (flags & PARENTH_POSN) ? 0 : lc->int_p_sign_posn;
-               *signstr = lc->positive_sign;
-       } else if (flags & IS_NEGATIVE) {
-               *cs_precedes = lc->n_cs_precedes;
-               *sep_by_space = lc->n_sep_by_space;
-               *sign_posn = (flags & PARENTH_POSN) ? 0 : lc->n_sign_posn;
-               *signstr = (lc->negative_sign == '\0') ? "-"
-                   : lc->negative_sign;
-       } else {
-               *cs_precedes = lc->p_cs_precedes;
-               *sep_by_space = lc->p_sep_by_space;
-               *sign_posn = (flags & PARENTH_POSN) ? 0 : lc->p_sign_posn;
-               *signstr = lc->positive_sign;
-       }
-
-       /* Set defult values for unspecified information. */
-       if (*cs_precedes != 0)
-               *cs_precedes = 1;
-       if (*sep_by_space == CHAR_MAX)
-               *sep_by_space = 0;
-       if (*sign_posn == CHAR_MAX)
-               *sign_posn = 0;
-}
-
-static int
-__calc_left_pad(int flags, char *cur_symb, struct lconv *lc) {
-
-       char cs_precedes, sep_by_space, sign_posn;
-       const char *signstr;
-       int left_chars = 0;
-
-       __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr, lc);
-
-       if (cs_precedes != 0) {
-               left_chars += strlen(cur_symb);
-               if (sep_by_space != 0)
-                       left_chars++;
-       }
-
-       switch (sign_posn) {
-               case 0:
-                       if (flags & IS_NEGATIVE)
-                               left_chars++;
-                       break;
-               case 1:
-                       left_chars += strlen(signstr);
-                       break;
-               case 3:
-               case 4:
-                       if (cs_precedes != 0)
-                               left_chars += strlen(signstr);
-       }
-       return (left_chars);
-}
-
-static int
-get_groups(int size, char *grouping) {
-
-       int     chars = 0;
-
-       if (*grouping == CHAR_MAX || *grouping <= 0)    /* no grouping ? */
-               return (0);
-
-       while (size > (int)*grouping) {
-               chars++;
-               size -= (int)*grouping++;
-               /* no more grouping ? */
-               if (*grouping == CHAR_MAX)
-                       break;
-               /* rest grouping with same value ? */
-               if (*grouping == 0) {
-                       chars += (size - 1) / *(grouping - 1);
-                       break;
-               }
-       }
-       return (chars);
-}
-
-/* convert double to ASCII */
-__private_extern__ const char *__fix_nogrouping(const char *);
-
-static char *
-__format_grouped_double(double value, int *flags,
-                       int left_prec, int right_prec, int pad_char, struct lconv *lc, locale_t loc) {
-
-       char            *rslt;
-       char            *avalue;
-       int             avalue_size;
-       char            fmt[32];
-
-       size_t          bufsize;
-       char            *bufend;
-
-       int             padded;
-
-       char            *grouping;
-       char            decimal_point;
-       char            thousands_sep;
-
-       int groups = 0;
-
-       grouping = __fix_nogrouping(lc->mon_grouping);
-       decimal_point = *lc->mon_decimal_point;
-       if (decimal_point == '\0')
-               decimal_point = *lc->decimal_point;
-       thousands_sep = *lc->mon_thousands_sep;
-       if (thousands_sep == '\0')
-               thousands_sep = *lc->thousands_sep;
-
-       /* fill left_prec with default value */
-       if (left_prec == -1)
-               left_prec = 0;
-
-       /* fill right_prec with default value */
-       if (right_prec == -1) {
-                if (*flags & USE_INTL_CURRENCY)
-                        right_prec = lc->int_frac_digits;
-                else
-                        right_prec = lc->frac_digits;
-
-               if (right_prec == CHAR_MAX)     /* POSIX locale ? */
-                       right_prec = 2;
-       }
-
-       if (*flags & NEED_GROUPING)
-               left_prec += get_groups(left_prec, grouping);
-
-       /* convert to string */
-       snprintf_l(fmt, sizeof(fmt), loc, "%%%d.%df", left_prec + right_prec + 1,
-           right_prec);
-       avalue_size = asprintf_l(&avalue, loc, fmt, value);
-       if (avalue_size < 0)
-               return (NULL);
-
-       /* make sure that we've enough space for result string */
-       bufsize = strlen(avalue)*2+1;
-       rslt = malloc(bufsize);
-       if (rslt == NULL) {
-               free(avalue);
-               return (NULL);
-       }
-       memset(rslt, 0, bufsize);
-       bufend = rslt + bufsize - 1;    /* reserve space for trailing '\0' */
-
-       /* skip spaces at beggining */
-       padded = 0;
-       while (avalue[padded] == ' ') {
-               padded++;
-               avalue_size--;
-       }
-
-       if (right_prec > 0) {
-               bufend -= right_prec;
-               memcpy(bufend, avalue + avalue_size+padded-right_prec,
-                   (size_t) right_prec);
-               *--bufend = decimal_point;
-               avalue_size -= (right_prec + 1);
-       }
-
-       if ((*flags & NEED_GROUPING) &&
-           thousands_sep != '\0' &&    /* XXX: need investigation */
-           *grouping != CHAR_MAX &&
-           *grouping > 0) {
-               while (avalue_size > (int)*grouping) {
-                       GRPCPY(*grouping);
-                       GRPSEP;
-                       grouping++;
-
-                       /* no more grouping ? */
-                       if (*grouping == CHAR_MAX)
-                               break;
-
-                       /* rest grouping with same value ? */
-                       if (*grouping == 0) {
-                               grouping--;
-                               while (avalue_size > *grouping) {
-                                       GRPCPY(*grouping);
-                                       GRPSEP;
-                               }
-                       }
-               }
-               if (avalue_size != 0)
-                       GRPCPY(avalue_size);
-               padded -= groups;
-
-       } else {
-               bufend -= avalue_size;
-               memcpy(bufend, avalue+padded, (size_t) avalue_size);
-               if (right_prec == 0)
-                       padded--;       /* decrease assumed $decimal_point */
-       }
-
-       /* do padding with pad_char */
-       if (padded > 0) {
-               bufend -= padded;
-               memset(bufend, pad_char, (size_t) padded);
-       }
-
-       bufsize = bufsize - (bufend - rslt) + 1;
-       memmove(rslt, bufend, bufsize);
-       free(avalue);
-       return (rslt);
-}
-
-ssize_t
-strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
-    ...)
-{
-       ssize_t         ret;
-       va_list         ap;
-
-       va_start(ap, format);
-       ret = _strfmon(s, maxsize, __current_locale(), format, ap);
-       va_end(ap);
-       return ret;
-}
-
-ssize_t
-strfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
-    const char * __restrict format, ...)
-{
-       ssize_t         ret;
-       va_list         ap;
-
-       NORMALIZE_LOCALE(loc);
-       va_start(ap, format);
-       ret = _strfmon(s, maxsize, loc, format, ap);
-       va_end(ap);
-       return ret;
-}
diff --git a/stdlib/strfmon.3 b/stdlib/strfmon.3
deleted file mode 100644 (file)
index 6b6976f..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-.\"    $NetBSD: strfmon.3,v 1.3 2005/04/04 08:19:00 wiz Exp $
-.\"
-.\" Copyright (c) 2001 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    From: FreeBSD: Id: strfmon.3,v 1.7 2003/01/06 06:21:25 tjr Exp
-.\"
-.Dd October 12, 2002
-.Dt STRFMON 3
-.Os
-.Sh NAME
-.Nm strfmon ,
-.Nm strfmon_l
-.Nd convert monetary value to string
-.\" .Sh LIBRARY
-.\" .Lb libc
-.Sh SYNOPSIS
-.In monetary.h
-.Ft ssize_t
-.Fo strfmon
-.Fa "char *restrict s"
-.Fa "size_t maxsize"
-.Fa "const char *restrict format"
-.Fa "..."
-.Fc
-.In monetary.h
-.In xlocale.h
-.Ft ssize_t
-.Fo strfmon_l
-.Fa "char *restrict s"
-.Fa "size_t maxsize"
-.Fa "locale_t loc"
-.Fa "const char *restrict format"
-.Fa "..."
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strfmon
-function places characters into the array pointed to by
-.Fa s ,
-as controlled by the string pointed to by
-.Fa format .
-No more than
-.Fa maxsize
-bytes are placed into the array.
-.Pp
-While the
-.Fn strfmon
-function uses the current locale, the
-.Fn strfmon_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Pp
-The format string is composed of zero or more directives:
-ordinary characters (not
-.Cm % ) ,
-which are copied unchanged to the output stream; and conversion
-specifications, each of which results in fetching zero or more subsequent
-arguments.
-Each conversion specification is introduced by the
-.Cm %
-character.
-After the
-.Cm % ,
-the following appear in sequence:
-.Bl -bullet
-.It
-Zero or more of the following flags:
-.Bl -tag -width "XXX"
-.It Cm = Ns Ar f
-A
-.Sq Cm =
-character followed by another character
-.Ar f
-which is used as the numeric fill character.
-.It Cm ^
-Do not use grouping characters, regardless of the current locale default.
-.It Cm +
-Represent positive values by prefixing them with a positive sign,
-and negative values by prefixing them with a negative sign.
-This is the default.
-.It Cm \&(
-Enclose negative values in parentheses.
-.It Cm \&!
-Do not include a currency symbol in the output.
-.It Cm \-
-Left justify the result.
-Only valid when a field width is specified.
-.El
-.It
-An optional minimum field width as a decimal number.
-By default, there is no minimum width.
-.It
-A
-.Sq Cm #
-sign followed by a decimal number specifying the maximum
-expected number of digits after the radix character.
-.It
-A
-.Sq Cm \&.
-character followed by a decimal number specifying the number
-of digits after the radix character.
-.It
-One of the following conversion specifiers:
-.Bl -tag -width "XXX"
-.It Cm i
-The
-.Vt double
-argument is formatted as an international monetary amount.
-.It Cm n
-The
-.Vt double
-argument is formatted as a national monetary amount.
-.It Cm %
-A
-.Sq Li %
-character is written.
-.El
-.El
-.Sh RETURN VALUES
-If the total number of resulting bytes, including the terminating
-.Dv NULL
-byte, is not more than
-.Fa maxsize ,
-.Fn strfmon
-returns the number of bytes placed into the array pointed to by
-.Fa s ,
-not including the terminating
-.Dv NULL
-byte.
-Otherwise, \-1 is returned,
-the contents of the array are indeterminate,
-and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn strfmon
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er E2BIG
-Conversion stopped due to lack of space in the buffer.
-.It Bq Er EINVAL
-The format string is invalid.
-.It Bq Er ENOMEM
-Not enough memory for temporary buffers.
-.El
-.Sh EXAMPLE
-.Bd -literal -offset indent -compact
-  #include <stdio.h>
-  #include <monetary.h>
-  #include <locale.h>
-
-  int main() {
-          char buf[200];
-          setlocale(LC_ALL, "en_US");
-          (void)strfmon (buf, sizeof(buf)-1, "%n" , 123456.78);
-          printf("%s\n", buf);
-  }
-.Ed
-.Pp
-.Sh SEE ALSO
-.Xr localeconv 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn strfmon
-function
-conforms to
-.St -p1003.1-2001 .
-.Sh AUTHORS
-.An -nosplit
-The
-.Fn strfmon
-function was implemented by
-.An Alexey Zelkin Aq phantom@FreeBSD.org .
-.Pp
-This manual page was written by
-.An Jeroen Ruigrok van der Werven Aq asmodai@FreeBSD.org
-based on the standard's text.
-.Sh BUGS
-The
-.Fn strfmon
-function does not correctly handle multibyte characters in the
-.Fa format
-argument.
diff --git a/stdlib/strhash-fbsd.c b/stdlib/strhash-fbsd.c
deleted file mode 100644 (file)
index 60cacbd..0000000
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- *
- *                      Copyright 1990
- *               Terry Jones & Jordan Hubbard
- *
- *               PCS Computer Systeme, GmbH.
- *                  Munich, West Germany
- *
- *
- *  All rights reserved.
- *
- *  This is unsupported software and is subject to change without notice.
- *  the author makes no representations about the suitability of this software
- *  for any purpose. It is supplied "as is" without express or implied
- *  warranty.
- *
- *  Permission to use, copy, modify, and distribute this software and its
- *  documentation for any purpose and without fee is hereby granted, provided
- *  that the above copyright notice appear in all copies and that both that
- *  copyright notice and this permission notice appear in supporting
- *  documentation, and that the name of the author not be used in
- *  advertising or publicity pertaining to distribution of the software
- *  without specific, written prior permission.
- *
- */
-
-/*
- * This is a fairly simple open addressing hash scheme.
- * Terry did all the code, I just did the spec.
- * Thanks again, you crazy Aussie..
- *
- */
-
-/*
- * $Log: strhash.c,v $
- * Revision 2.0  90/03/26  01:44:26  jkh
- * pre-beta check-in
- *
- * Revision 1.8  90/03/09  19:22:35  jkh
- * Fixed bogus comment.
- *
- * Revision 1.7  90/03/09  19:01:08  jkh
- * Added comments, GPL.
- *
- * Revision 1.6  90/03/08  17:55:58  terry
- * Rearranged hash_purge to be a tiny bit more efficient.
- * Added verbose option to hash_stats.
- *
- * Revision 1.5  90/03/08  17:19:54  terry
- * Added hash_purge. Added arg to hash_traverse. Changed all
- * void * to Generic.
- *
- * Revision 1.4  90/03/08  12:02:35  terry
- * Fixed problems with allocation that I screwed up last night.
- * Changed bucket lists to be singly linked. Thanks to JKH, my hero.
- *
- * Revision 1.3  90/03/07  21:33:33  terry
- * Cleaned up a few decls to keep gcc -Wall quiet.
- *
- * Revision 1.2  90/03/07  21:14:53  terry
- * Comments. Added HASH_STATS define. Removed hash_find()
- * and new_node().
- *
- * Revision 1.1  90/03/07  20:49:45  terry
- * Initial revision
- *
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strhash.c,v 1.10 2002/03/22 21:53:10 obrien Exp $");
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <strhash.h>
-
-#define HASH_NULL    (hash_table *)0
-#define NODE_NULL    (hash_node *)0
-#define GENERIC_NULL (void *)0
-
-#define HASH_SZ 97
-
-
-static int _hash(int size, char *key);
-static hash_node *list_find(caddr_t key, hash_node *head);
-static int assign_key(char *key, hash_node *node);
-
-
-/*
- * hash_create()
- *
- * Malloc room for a new hash table and then room for its
- * bucket pointers. Then set all the buckets to
- * point to 0. Return the address of the new table.
- */
-hash_table *
-hash_create(int size)
-{
-    int i;
-    hash_table *new = (hash_table *)malloc(sizeof(hash_table));
-
-    if (!new || size < 0){
-       return HASH_NULL;
-    }
-
-    if (size == 0){
-       size = HASH_SZ;
-    }
-
-    if (!(new->buckets = (hash_node **)malloc(size * sizeof(hash_node *)))){
-       return HASH_NULL;
-    }
-
-    for (i = 0; i < size; i++){
-       new->buckets[i] = NODE_NULL;
-    }
-    new->size = size;
-
-    return new;
-}
-
-
-/*
- * list_find()
- *
- * Find the key in the linked list pointed to by head.
- */
-static hash_node *
-list_find(caddr_t key, hash_node *head)
-{
-    while (head){
-       if (!strcmp(head->key, key)){
-           return head;
-       }
-       head = head->next;
-    }
-    return NODE_NULL;
-}
-
-
-/*
- * _hash()
- *
- * Compute the hash value for the given key.
- */
-static int
-_hash(int size, char *key)
-{
-    unsigned int h = 0x0;
-
-    while (*key){
-       h = (h << 1) ^ (h ^ (unsigned char) *key++);
-    }
-
-    h %= size;
-    return h;
-}
-
-/*
- * hash_destroy()
- *
- * Find the key and (if it's there) remove it entirely.
- * The function (*nukefunc)() is in charge of disposing
- * of the storage help by the data associated with the node.
- */
-void
-hash_destroy(hash_table *table, char *key, void (*nukefunc)())
-{
-    int bucket = _hash(table->size, key);
-    hash_node *found = table->buckets[bucket];
-    hash_node *to_free = NODE_NULL;
-
-    if (!found) {
-       return;
-    }
-
-    if (!strcmp(found->key, key)) {
-       /*
-        * It was the head of the list.
-        */
-       table->buckets[bucket] = found->next;
-       to_free = found;
-    }
-    else {
-       /*
-        * Walk the list, looking one ahead.
-        */
-       while (found->next) {
-           if (!strcmp(found->next->key, key)) {
-               to_free = found->next;
-               found->next = found->next->next;
-               break;
-           }
-           found = found->next;
-       }
-
-       if (!to_free){
-           return;
-       }
-    }
-
-    if (nukefunc)
-       (*nukefunc)(to_free->key, to_free->data);
-    free(to_free);
-    return;
-}
-
-
-/*
- * hash_search()
- *
- * Search the table for the given key. Then:
- *
- * 1) If you find it and there is no replacement function, just
- *    return what you found. (This is a simple search).
- * 2) If you find it and there is a replacement function, run
- *    the function on the data you found, and replace the old
- *    data with whatever is passed in datum. Return 0.
- * 3) If you don't find it and there is some datum, insert a
- *    new item into the table. Insertions go at the front of
- *    the bucket. Return 0.
- * 4) Otherwise just return 0.
- *
- */
-void *
-hash_search(hash_table *table, caddr_t key, void *datum,
-           void (*replace_func)())
-{
-    int bucket = _hash(table->size, key);
-    hash_node *found = list_find(key, table->buckets[bucket]);
-
-    if (found){
-       if (!replace_func){
-           return found->data;
-       }
-       else{
-           (*replace_func)(found->data);
-           found->data = datum;
-       }
-    }
-    else{
-       if (datum){
-
-           hash_node *new = (hash_node *)malloc(sizeof(hash_node));
-
-           if (!new || !assign_key(key, new)){
-               return GENERIC_NULL;
-           }
-           new->data = datum;
-           new->next = table->buckets[bucket];
-           table->buckets[bucket] = new;
-           return new;
-       }
-    }
-    return GENERIC_NULL;
-}
-
-
-/*
- * assign_key()
- *
- * Set the key value of a node to be 'key'. Get some space from
- * malloc and copy it in etc. Return 1 if all is well, 0 otherwise.
- */
-static int
-assign_key(char *key, hash_node *node)
-{
-    if (!node || !key){
-       return 0;
-    }
-
-    if (!(node->key = (char *)malloc(strlen(key) + 1))){
-       return 0;
-    }
-
-    node->key[0] = '\0';
-    strcat(node->key, key);
-    return 1;
-}
-
-/*
- * hash_traverse()
- *
- * Traverse the hash table and run the function func on the
- * data found at each node and the argument we're passed for it.
- */
-void
-hash_traverse(hash_table *table, int (*func)(), void *arg)
-{
-    int i;
-    int size = table->size;
-
-    if (!func)
-       return;
-
-    for (i = 0; i < size; i++) {
-       hash_node *n = table->buckets[i];
-       while (n) {
-           if ((*func)(n->key, n->data, arg) == 0)
-               return;
-           n = n->next;
-       }
-    }
-    return;
-}
-
-/*
- * hash_purge()
- *
- * Run through the entire hash table. Call purge_func
- * on the data found at each node, and then free the node.
- * Set all the bucket pointers to 0.
- */
-void
-hash_purge(hash_table *table, void (*purge_func)(char *p1, void *p2))
-{
-    int i;
-    int size = table->size;
-
-    for (i = 0; i < size; i++) {
-       hash_node *n = table->buckets[i];
-       if (n) {
-           do {
-               hash_node *to_free = n;
-               if (purge_func) {
-                   (*purge_func)(n->key, n->data);
-               }
-               n = n->next;
-               free(to_free);
-           } while (n);
-           table->buckets[i] = NODE_NULL;
-       }
-    }
-}
-
-#undef min
-#define min(a, b) (a) < (b) ? (a) : (b)
-
-/*
- * hash_stats()
- *
- * Print statistics about the current table allocation to stdout.
- */
-void
-hash_stats(hash_table *table, int verbose)
-{
-    int i;
-    int total_elements = 0;
-    int non_empty_buckets = 0;
-    int max_count = 0;
-    int max_repeats = 0;
-    int *counts;
-    int size = table->size;
-
-    if (!(counts = (int *)malloc(size * sizeof(int)))){
-       fprintf(stderr, "malloc returns 0\n");
-       exit(1);
-    }
-
-    for (i = 0; i < size; i++){
-       int x = 0;
-       hash_node *n = table->buckets[i];
-       counts[i] = 0;
-       while (n){
-           if (!x){
-               x = 1;
-               non_empty_buckets++;
-               if (verbose){
-                   printf("bucket %2d: ", i);
-               }
-           }
-           if (verbose){
-               printf(" %s", n->key);
-           }
-           counts[i]++;
-           n = n->next;
-       }
-
-       total_elements += counts[i];
-       if (counts[i] > max_count){
-           max_count = counts[i];
-           max_repeats = 1;
-       }
-       else if (counts[i] == max_count){
-           max_repeats++;
-       }
-
-       if (counts[i] && verbose){
-           printf(" (%d)\n", counts[i]);
-       }
-    }
-
-    printf("\n");
-    printf("%d element%s in storage.\n", total_elements, total_elements == 1 ? "" : "s");
-
-    if (total_elements){
-       printf("%d of %d (%.2f%%) buckets are in use\n", non_empty_buckets, size,
-              (double)100 * (double)non_empty_buckets / (double)(size));
-       printf("the maximum number of elements in a bucket is %d (%d times)\n", max_count, max_repeats);
-       printf("average per bucket is %f\n", (double)total_elements / (double)non_empty_buckets);
-       printf("optimal would be %f\n", (double)total_elements / (double)(min(size, total_elements)));
-    }
-    return;
-}
diff --git a/stdlib/strtod.3 b/stdlib/strtod.3
deleted file mode 100644 (file)
index 463553d..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strtod.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/strtod.3,v 1.22 2007/12/16 21:19:28 das Exp $
-.\"
-.Dd March 2, 2003
-.Dt STRTOD 3
-.Os
-.Sh NAME
-.Nm strtod , strtof , strtold
-.Nd convert
-.Tn ASCII
-string to floating point
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft double
-.Fo strtod
-.Fa "const char *restrict nptr"
-.Fa "char **restrict endptr"
-.Fc
-.Ft float
-.Fo strtof
-.Fa "const char *restrict nptr"
-.Fa "char **restrict endptr"
-.Fc
-.Ft "long double"
-.Fo strtold
-.Fa "const char *restrict nptr"
-.Fa "char **restrict endptr"
-.Fc
-.Sh DESCRIPTION
-These conversion
-functions convert the initial portion of the string
-pointed to by
-.Fa nptr
-to
-.Vt double ,
-.Vt float ,
-and
-.Vt "long double"
-representation, respectively.
-.Pp
-The expected form of the string
-is an optional plus (``+'') or minus (``\-'') sign,
-followed by either:
-.Bl -bullet
-.It
-a decimal significand, consisting of a sequence of decimal digits
-(optionally containing a decimal-point character) or
-.It
-a hexadecimal significand, consisting of a ``0X'' or ``0x'' followed
-by a sequence of hexadecimal digits
-(optionally containing a decimal-point character).
-.El
-.Pp
-In both cases, the significand may be optionally followed by an
-exponent.
-An exponent consists of an ``E'' or ``e'' (for decimal
-constants) or a ``P'' or ``p'' (for hexadecimal constants),
-followed by an optional plus or minus sign, followed by a
-sequence of decimal digits.
-For decimal constants, the exponent indicates the power of 10 by
-which the significand should be scaled.
-For hexadecimal constants, the scaling is instead done by powers
-of 2.
-.Pp
-Alternatively, if the portion of the string following the optional
-plus or minus sign begins with
-.Dq INFINITY
-or
-.Dq NAN ,
-ignoring case, it is interpreted as an infinity or a quiet \*(Na,
-respectively.
-The syntax
-.Dq Xo Pf NAN( Ar "s" ) Xc ,
-where
-.Ar s
-is an alphanumeric string, produces the same value as the call
-.Fo nan
-.Qq Ar s Ns
-.Fc
-(respectively,
-.Fo nanf
-.Qq Ar s Ns
-.Fc
-and
-.Fo nanl
-.Qq Ar s Ns
-.Fc . )
-.Pp
-In any of the above cases, leading white-space characters in the
-string (as defined by the
-.Xr isspace 3
-function) are skipped.
-The decimal point
-character is defined in the program's locale (category
-.Dv LC_NUMERIC ) .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr strtod_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn strtod ,
-.Fn strtof ,
-and
-.Fn strtold
-functions return the converted value, if any.
-.Pp
-If
-.Fa endptr
-is not
-.Dv NULL ,
-a pointer to the character after the last character used
-in the conversion is stored in the location referenced by
-.Fa endptr .
-.Pp
-If no conversion is performed, zero is returned and the value of
-.Fa nptr
-is stored in the location referenced by
-.Fa endptr .
-.Pp
-If the correct value would cause overflow, plus or minus
-.Dv HUGE_VAL ,
-.Dv HUGE_VALF ,
-or
-.Dv HUGE_VALL
-is returned (according to the sign and type of the return value), and
-.Er ERANGE
-is stored in
-.Va errno .
-If the correct value would cause underflow, zero is
-returned and
-.Er ERANGE
-is stored in
-.Va errno .
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er ERANGE
-Overflow or underflow occurred.
-.El
-.Sh SEE ALSO
-.Xr atof 3 ,
-.Xr atoi 3 ,
-.Xr atol 3 ,
-.Xr nan 3 ,
-.Xr strtod_l 3 ,
-.Xr strtol 3 ,
-.Xr strtoul 3 ,
-.Xr wcstod 3
-.Sh STANDARDS
-The
-.Fn strtod
-function
-conforms to
-.St -isoC-99 .
-.Sh AUTHORS
-The author of this software is
-.An David M. Gay .
-.Pp
-.Bd -literal
-Copyright (c) 1998 by Lucent Technologies
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the name of Lucent or any of its entities
-not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior
-permission.
-
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-THIS SOFTWARE.
-.Ed
diff --git a/stdlib/strtoimax-fbsd.c b/stdlib/strtoimax-fbsd.c
deleted file mode 100644 (file)
index 0c4c994..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtol.c      8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-/*
- * Convert a string to an intmax_t integer.
- *
- * Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-intmax_t
-strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-    locale_t loc)
-{
-       const char *s;
-       uintmax_t acc;
-       char c;
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * Skip white space and pick up leading +/- sign if any.
-        * If base is 0, allow 0x for hex and 0 for octal, else
-        * assume decimal; if base is already 16, allow 0x.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == '+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X') &&
-           ((s[1] >= '0' && s[1] <= '9') ||
-           (s[1] >= 'A' && s[1] <= 'F') ||
-           (s[1] >= 'a' && s[1] <= 'f'))) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       /*
-        * Compute the cutoff value between legal numbers and illegal
-        * numbers.  That is the largest legal value, divided by the
-        * base.  An input number that is greater than this value, if
-        * followed by a legal input character, is too big.  One that
-        * is equal to this value may be valid or not; the limit
-        * between valid and invalid numbers is then based on the last
-        * digit.  For instance, if the range for intmax_t is
-        * [-9223372036854775808..9223372036854775807] and the input base
-        * is 10, cutoff will be set to 922337203685477580 and cutlim to
-        * either 7 (neg==0) or 8 (neg==1), meaning that if we have
-        * accumulated a value > 922337203685477580, or equal but the
-        * next digit is > 7 (or 8), the number is too big, and we will
-        * return a range error.
-        *
-        * Set 'any' if any `digits' consumed; make it negative to indicate
-        * overflow.
-        */
-       cutoff = neg ? (uintmax_t)-(INTMAX_MIN + INTMAX_MAX) + INTMAX_MAX
-           : INTMAX_MAX;
-       cutlim = cutoff % base;
-       cutoff /= base;
-       for ( ; ; c = *s++) {
-               if (c >= '0' && c <= '9')
-                       c -= '0';
-               else if (c >= 'A' && c <= 'Z')
-                       c -= 'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = neg ? INTMAX_MIN : INTMAX_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-intmax_t
-strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-       return strtoimax_l(nptr, endptr, base, __current_locale());
-}
diff --git a/stdlib/strtol-fbsd.c b/stdlib/strtol-fbsd.c
deleted file mode 100644 (file)
index cac93b2..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-
-
-/*
- * Convert a string to a long integer.
- *
- * Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-long
-strtol_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-    locale_t loc)
-{
-       const char *s;
-       unsigned long acc;
-       char c;
-       unsigned long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * Skip white space and pick up leading +/- sign if any.
-        * If base is 0, allow 0x for hex and 0 for octal, else
-        * assume decimal; if base is already 16, allow 0x.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == '+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X') &&
-           ((s[1] >= '0' && s[1] <= '9') ||
-           (s[1] >= 'A' && s[1] <= 'F') ||
-           (s[1] >= 'a' && s[1] <= 'f'))) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       /*
-        * Compute the cutoff value between legal numbers and illegal
-        * numbers.  That is the largest legal value, divided by the
-        * base.  An input number that is greater than this value, if
-        * followed by a legal input character, is too big.  One that
-        * is equal to this value may be valid or not; the limit
-        * between valid and invalid numbers is then based on the last
-        * digit.  For instance, if the range for longs is
-        * [-2147483648..2147483647] and the input base is 10,
-        * cutoff will be set to 214748364 and cutlim to either
-        * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
-        * a value > 214748364, or equal but the next digit is > 7 (or 8),
-        * the number is too big, and we will return a range error.
-        *
-        * Set 'any' if any `digits' consumed; make it negative to indicate
-        * overflow.
-        */
-       cutoff = neg ? (unsigned long)-(LONG_MIN + LONG_MAX) + LONG_MAX
-           : LONG_MAX;
-       cutlim = cutoff % base;
-       cutoff /= base;
-       for ( ; ; c = *s++) {
-               if (c >= '0' && c <= '9')
-                       c -= '0';
-               else if (c >= 'A' && c <= 'Z')
-                       c -= 'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = neg ? LONG_MIN : LONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-long
-strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-       return strtol_l(nptr, endptr, base, __current_locale());
-}
diff --git a/stdlib/strtol.3 b/stdlib/strtol.3
deleted file mode 100644 (file)
index 6a6c99e..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strtol.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/strtol.3,v 1.23 2007/04/10 11:17:00 ru Exp $
-.\"
-.Dd November 28, 2001
-.Dt STRTOL 3
-.Os
-.Sh NAME
-.Nm strtoimax ,
-.Nm strtol ,
-.Nm strtoll ,
-.Nm strtoq
-.Nd "convert a string value to a"
-.Vt long , "long long" , intmax_t
-or
-.Vt quad_t
-integer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In inttypes.h
-.Ft intmax_t
-.Fo strtoimax
-.Fa "const char *restrict str"
-.Fa "char **restrict endptr"
-.Fa "int base"
-.Fc
-.In stdlib.h
-.Ft long
-.Fo strtol
-.Fa "const char *restrict str"
-.Fa "char **restrict endptr"
-.Fa "int base"
-.Fc
-.Ft long long
-.Fo strtoll
-.Fa "const char *restrict str"
-.Fa "char **restrict endptr"
-.Fa "int base"
-.Fc
-.In sys/types.h
-.In stdlib.h
-.In limits.h
-.Ft quad_t
-.Fo strtoq
-.Fa "const char *str"
-.Fa "char **endptr"
-.Fa "int base"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strtol
-function
-converts the string in
-.Fa str
-to a
-.Vt long
-value.
-The
-.Fn strtoll
-function
-converts the string in
-.Fa str
-to a
-.Vt "long long"
-value.
-The
-.Fn strtoimax
-function
-converts the string in
-.Fa str
-to an
-.Vt intmax_t
-value.
-The
-.Fn strtoq
-function
-converts the string in
-.Fa str
-to a
-.Vt quad_t
-value.
-The conversion is done according to the given
-.Fa base ,
-which must be between 2 and 36 inclusive,
-or be the special value 0.
-.Pp
-The string may begin with an arbitrary amount of white space
-(as determined by
-.Xr isspace 3 )
-followed by a single optional
-.Ql +
-or
-.Ql -
-sign.
-If
-.Fa base
-is zero or 16,
-the string may then include a
-.Dq Li 0x
-prefix,
-and the number will be read in base 16; otherwise, a zero
-.Fa base
-is taken as 10 (decimal) unless the next character is
-.Ql 0 ,
-in which case it is taken as 8 (octal).
-.Pp
-The remainder of the string is converted to a
-.Vt long , "long long" , intmax_t
-or
-.Vt quad_t
-value in the obvious manner,
-stopping at the first character which is not a valid digit
-in the given base.
-(In bases above 10, the letter
-.Ql A
-in either upper or lower case
-represents 10,
-.Ql B
-represents 11, and so forth, with
-.Ql Z
-representing 35.)
-.Pp
-If
-.Fa endptr
-is not
-.Dv NULL ,
-.Fn strtol
-stores the address of the first invalid character in
-.Fa *endptr .
-If there were no digits at all, however,
-.Fn strtol
-stores the original value of
-.Fa str
-in
-.Fa *endptr .
-(Thus, if
-.Fa *str
-is not
-.Ql \e0
-but
-.Fa **endptr
-is
-.Ql \e0
-on return, the entire string was valid.)
-.Pp
-Extended locale versions of these functions are documented in
-.Xr strtol_l 3 .
-See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn strtol ,
-.Fn strtoll ,
-.Fn strtoimax ,
-and
-.Fn strtoq
-functions
-return the result of the conversion,
-unless the value would underflow or overflow.
-If no conversion could be performed, 0 is returned and
-the global variable
-.Va errno
-is set to
-.Er EINVAL
-(the last feature is not portable across all platforms).
-If an overflow or underflow occurs,
-.Va errno
-is set to
-.Er ERANGE
-and the function return value is clamped according
-to the following table.
-.Bl -column -offset indent ".Fn strtoimax" ".Dv INTMAX_MIN" ".Dv INTMAX_MAX"
-.It Sy Function Ta Sy underflow Ta Sy overflow
-.It Fn strtol Ta Dv LONG_MIN Ta Dv LONG_MAX
-.It Fn strtoll Ta Dv LLONG_MIN Ta Dv LLONG_MAX
-.It Fn strtoimax Ta Dv INTMAX_MIN Ta Dv INTMAX_MAX
-.It Fn strtoq Ta Dv LLONG_MIN Ta Dv LLONG_MAX
-.El
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of
-.Fa base
-is not supported or
-no conversion could be performed
-(the last feature is not portable across all platforms).
-.It Bq Er ERANGE
-The given string was out of range; the value converted has been clamped.
-.El
-.Sh LEGACY SYNOPSIS
-.Fd #include <stdlib.h>
-.Fd #include <limits.h>
-.Pp
-.In limits.h
-is necessary for the
-.Fn strtol
-and
-.Fn strtoll
-functions.
-.Sh SEE ALSO
-.Xr atof 3 ,
-.Xr atoi 3 ,
-.Xr atol 3 ,
-.Xr strtod 3 ,
-.Xr strtol_l 3 ,
-.Xr strtoul 3 ,
-.Xr wcstol 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn strtol
-function
-conforms to
-.St -isoC .
-The
-.Fn strtoll
-and
-.Fn strtoimax
-functions
-conform to
-.St -isoC-99 .
-The
-.Bx
-.Fn strtoq
-function is deprecated.
diff --git a/stdlib/strtoll-fbsd.c b/stdlib/strtoll-fbsd.c
deleted file mode 100644 (file)
index f7e11f3..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <errno.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-/*
- * Convert a string to a long long integer.
- *
- * Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-long long
-strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-    locale_t loc)
-{
-       const char *s;
-       unsigned long long acc;
-       char c;
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * Skip white space and pick up leading +/- sign if any.
-        * If base is 0, allow 0x for hex and 0 for octal, else
-        * assume decimal; if base is already 16, allow 0x.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == '+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X') &&
-           ((s[1] >= '0' && s[1] <= '9') ||
-           (s[1] >= 'A' && s[1] <= 'F') ||
-           (s[1] >= 'a' && s[1] <= 'f'))) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       /*
-        * Compute the cutoff value between legal numbers and illegal
-        * numbers.  That is the largest legal value, divided by the
-        * base.  An input number that is greater than this value, if
-        * followed by a legal input character, is too big.  One that
-        * is equal to this value may be valid or not; the limit
-        * between valid and invalid numbers is then based on the last
-        * digit.  For instance, if the range for quads is
-        * [-9223372036854775808..9223372036854775807] and the input base
-        * is 10, cutoff will be set to 922337203685477580 and cutlim to
-        * either 7 (neg==0) or 8 (neg==1), meaning that if we have
-        * accumulated a value > 922337203685477580, or equal but the
-        * next digit is > 7 (or 8), the number is too big, and we will
-        * return a range error.
-        *
-        * Set 'any' if any `digits' consumed; make it negative to indicate
-        * overflow.
-        */
-       cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX
-           : LLONG_MAX;
-       cutlim = cutoff % base;
-       cutoff /= base;
-       for ( ; ; c = *s++) {
-               if (c >= '0' && c <= '9')
-                       c -= '0';
-               else if (c >= 'A' && c <= 'Z')
-                       c -= 'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = neg ? LLONG_MIN : LLONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-long long
-strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-       return strtoll_l(nptr, endptr, base, __current_locale());
-}
diff --git a/stdlib/strtoq-fbsd.c b/stdlib/strtoq-fbsd.c
deleted file mode 100644 (file)
index 9dd03e2..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoq.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-
-#include <stdlib.h>
-
-/*
- * Convert a string to a quad integer.
- */
-quad_t
-strtoq(const char *nptr, char **endptr, int base)
-{
-
-       return strtoll_l(nptr, endptr, base, __current_locale());
-}
-
-quad_t
-strtoq_l(const char *nptr, char **endptr, int base, locale_t loc)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because strtoll_l will */
-       return strtoll_l(nptr, endptr, base, loc);
-}
diff --git a/stdlib/strtoul-fbsd.c b/stdlib/strtoul-fbsd.c
deleted file mode 100644 (file)
index c7b5967..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoul.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/*
- * Convert a string to an unsigned long integer.
- *
- * Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-unsigned long
-strtoul_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-    locale_t loc)
-{
-       const char *s;
-       unsigned long acc;
-       char c;
-       unsigned long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtol for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == '+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X') &&
-           ((s[1] >= '0' && s[1] <= '9') ||
-           (s[1] >= 'A' && s[1] <= 'F') ||
-           (s[1] >= 'a' && s[1] <= 'f'))) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = ULONG_MAX / base;
-       cutlim = ULONG_MAX % base;
-       for ( ; ; c = *s++) {
-               if (c >= '0' && c <= '9')
-                       c -= '0';
-               else if (c >= 'A' && c <= 'Z')
-                       c -= 'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = ULONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-unsigned long
-strtoul(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-       return strtoul_l(nptr, endptr, base, __current_locale());
-}
diff --git a/stdlib/strtoul.3 b/stdlib/strtoul.3
deleted file mode 100644 (file)
index 91c759e..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strtoul.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/strtoul.3,v 1.23 2007/01/09 00:28:10 imp Exp $
-.\"
-.Dd November 28, 2001
-.Dt STRTOUL 3
-.Os
-.Sh NAME
-.Nm strtoul ,
-.Nm strtoull ,
-.Nm strtoumax ,
-.Nm strtouq
-.Nd "convert a string to an"
-.Vt "unsigned long" , "unsigned long long" , uintmax_t ,
-or
-.Vt u_quad_t
-integer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft "unsigned long"
-.Fo strtoul
-.Fa "const char *restrict str"
-.Fa "char **restrict endptr"
-.Fa "int base"
-.Fc
-.Ft "unsigned long long"
-.Fo strtoull
-.Fa "const char *restrict str"
-.Fa "char **restrict endptr"
-.Fa "int base"
-.Fc
-.In inttypes.h
-.Ft uintmax_t
-.Fo strtoumax
-.Fa "const char *restrict str"
-.Fa "char **restrict endptr"
-.Fa "int base"
-.Fc
-.In sys/types.h
-.In stdlib.h
-.In limits.h
-.Ft u_quad_t
-.Fo strtouq
-.Fa "const char *str"
-.Fa "char **endptr"
-.Fa "int base"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strtoul
-function
-converts the string in
-.Fa str
-to an
-.Vt "unsigned long"
-value.
-The
-.Fn strtoull
-function
-converts the string in
-.Fa str
-to an
-.Vt "unsigned long long"
-value.
-The
-.Fn strtoumax
-function
-converts the string in
-.Fa str
-to an
-.Vt uintmax_t
-value.
-The
-.Fn strtouq
-function
-converts the string in
-.Fa str
-to a
-.Vt u_quad_t
-value.
-The conversion is done according to the given
-.Fa base ,
-which must be between 2 and 36 inclusive,
-or be the special value 0.
-.Pp
-The string may begin with an arbitrary amount of white space
-(as determined by
-.Xr isspace 3 )
-followed by a single optional
-.Ql +
-or
-.Ql -
-sign.
-If
-.Fa base
-is zero or 16,
-the string may then include a
-.Dq Li 0x
-prefix,
-and the number will be read in base 16; otherwise, a zero
-.Fa base
-is taken as 10 (decimal) unless the next character is
-.Ql 0 ,
-in which case it is taken as 8 (octal).
-.Pp
-The remainder of the string is converted to an
-.Vt "unsigned long"
-value in the obvious manner,
-stopping at the end of the string
-or at the first character that does not produce a valid digit
-in the given base.
-(In bases above 10, the letter
-.Ql A
-in either upper or lower case
-represents 10,
-.Ql B
-represents 11, and so forth, with
-.Ql Z
-representing 35.)
-.Pp
-If
-.Fa endptr
-is not
-.Dv NULL ,
-.Fn strtoul
-stores the address of the first invalid character in
-.Fa *endptr .
-If there were no digits at all, however,
-.Fn strtoul
-stores the original value of
-.Fa str
-in
-.Fa *endptr .
-(Thus, if
-.Fa *str
-is not
-.Ql \e0
-but
-.Fa **endptr
-is
-.Ql \e0
-on return, the entire string was valid.)
-.Sh RETURN VALUES
-The
-.Fn strtoul ,
-.Fn strtoull ,
-.Fn strtoumax
-and
-.Fn strtouq
-functions
-return either the result of the conversion
-or, if there was a leading minus sign,
-the negation of the result of the conversion,
-unless the original (non-negated) value would overflow;
-in the latter case,
-.Fn strtoul
-returns
-.Dv ULONG_MAX ,
-.Fn strtoull
-returns
-.Dv ULLONG_MAX ,
-.Fn strtoumax
-returns
-.Dv UINTMAX_MAX ,
-and
-.Fn strtouq
-returns
-.Dv ULLONG_MAX .
-In all cases,
-.Va errno
-is set to
-.Er ERANGE .
-If no conversion could be performed, 0 is returned and
-the global variable
-.Va errno
-is set to
-.Er EINVAL
-(the last feature is not portable across all platforms).
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of
-.Fa base
-is not supported or
-no conversion could be performed
-(the last feature is not portable across all platforms).
-.It Bq Er ERANGE
-The given string was out of range; the value converted has been clamped.
-.El
-.Sh LEGACY SYNOPSIS
-.Fd #include <stdlib.h>
-.Fd #include <limits.h>
-.Pp
-.In limits.h
-is necessary for the
-.Fn strtoul
-and
-.Fn strtoull
-functions.
-.Sh SEE ALSO
-.Xr strtol 3 ,
-.Xr strtol_l 3 ,
-.Xr strtonum 3 ,
-.Xr wcstoul 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The
-.Fn strtoul
-function
-conforms to
-.St -isoC .
-The
-.Fn strtoull
-and
-.Fn strtoumax
-functions
-conform to
-.St -isoC-99 .
-The
-.Bx
-.Fn strtouq
-function is deprecated.
diff --git a/stdlib/strtoull-fbsd.c b/stdlib/strtoull-fbsd.c
deleted file mode 100644 (file)
index 8f2fd94..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <limits.h>
-#include <errno.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-/*
- * Convert a string to an unsigned long long integer.
- *
- * Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-unsigned long long
-strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-    locale_t loc)
-{
-       const char *s;
-       unsigned long long acc;
-       char c;
-       unsigned long long cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoq for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == '+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X') &&
-           ((s[1] >= '0' && s[1] <= '9') ||
-           (s[1] >= 'A' && s[1] <= 'F') ||
-           (s[1] >= 'a' && s[1] <= 'f'))) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = ULLONG_MAX / base;
-       cutlim = ULLONG_MAX % base;
-       for ( ; ; c = *s++) {
-               if (c >= '0' && c <= '9')
-                       c -= '0';
-               else if (c >= 'A' && c <= 'Z')
-                       c -= 'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = ULLONG_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-unsigned long long
-strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-       return strtoull_l(nptr, endptr, base, __current_locale());
-}
diff --git a/stdlib/strtoumax-fbsd.c b/stdlib/strtoumax-fbsd.c
deleted file mode 100644 (file)
index 22400a5..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtoul.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-/*
- * Convert a string to a uintmax_t integer.
- *
- * Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-uintmax_t
-strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
-    locale_t loc)
-{
-       const char *s;
-       uintmax_t acc;
-       char c;
-       uintmax_t cutoff;
-       int neg, any, cutlim;
-
-       NORMALIZE_LOCALE(loc);
-       /*
-        * See strtoimax for comments as to the logic used.
-        */
-       s = nptr;
-       do {
-               c = *s++;
-       } while (isspace_l((unsigned char)c, loc));
-       if (c == '-') {
-               neg = 1;
-               c = *s++;
-       } else {
-               neg = 0;
-               if (c == '+')
-                       c = *s++;
-       }
-       if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X') &&
-           ((s[1] >= '0' && s[1] <= '9') ||
-           (s[1] >= 'A' && s[1] <= 'F') ||
-           (s[1] >= 'a' && s[1] <= 'f'))) {
-               c = s[1];
-               s += 2;
-               base = 16;
-       }
-       if (base == 0)
-               base = c == '0' ? 8 : 10;
-       acc = any = 0;
-       if (base < 2 || base > 36)
-               goto noconv;
-
-       cutoff = UINTMAX_MAX / base;
-       cutlim = UINTMAX_MAX % base;
-       for ( ; ; c = *s++) {
-               if (c >= '0' && c <= '9')
-                       c -= '0';
-               else if (c >= 'A' && c <= 'Z')
-                       c -= 'A' - 10;
-               else if (c >= 'a' && c <= 'z')
-                       c -= 'a' - 10;
-               else
-                       break;
-               if (c >= base)
-                       break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
-                       any = -1;
-               else {
-                       any = 1;
-                       acc *= base;
-                       acc += c;
-               }
-       }
-       if (any < 0) {
-               acc = UINTMAX_MAX;
-               errno = ERANGE;
-       } else if (!any) {
-noconv:
-               errno = EINVAL;
-       } else if (neg)
-               acc = -acc;
-       if (endptr != NULL)
-               *endptr = (char *)(any ? s - 1 : nptr);
-       return (acc);
-}
-
-uintmax_t
-strtoumax(const char * __restrict nptr, char ** __restrict endptr, int base)
-{
-       return strtoumax_l(nptr, endptr, base, __current_locale());
-}
diff --git a/stdlib/strtouq-fbsd.c b/stdlib/strtouq-fbsd.c
deleted file mode 100644 (file)
index 29f0f13..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtouq.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <sys/types.h>
-
-#include <stdlib.h>
-
-/*
- * Convert a string to an unsigned quad integer.
- */
-u_quad_t
-strtouq(const char *nptr, char **endptr, int base)
-{
-
-       return strtoull_l(nptr, endptr, base, __current_locale());
-}
-
-u_quad_t
-strtouq_l(const char *nptr, char **endptr, int base, locale_t loc)
-{
-
-       /* no need to call NORMALIZE_LOCALE(loc) because strtoull_l will */
-       return strtoull_l(nptr, endptr, base, loc);
-}
diff --git a/stdlib/system-fbsd.c b/stdlib/system-fbsd.c
deleted file mode 100644 (file)
index c2a56c7..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)system.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/system.c,v 1.11 2007/01/09 00:28:10 imp Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <spawn.h>
-#include <paths.h>
-#include <errno.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-
-#if __DARWIN_UNIX03
-#include <pthread.h>
-
-static pthread_mutex_t __systemfn_mutex = PTHREAD_MUTEX_INITIALIZER;
-extern int __unix_conforming;
-#ifdef VARIANT_CANCELABLE
-extern void _pthread_testcancel(pthread_t thread, int isconforming);
-#endif /* VARIANT_CANCELABLE */
-#endif /* __DARWIN_UNIX03 */
-
-int
-__system(command)
-       const char *command;
-{
-       pid_t pid, savedpid;
-       int pstat, err;
-       struct sigaction ign, intact, quitact;
-       sigset_t newsigblock, oldsigblock, defaultsig;
-       posix_spawnattr_t attr;
-       short flags = POSIX_SPAWN_SETSIGMASK;
-       const char *argv[] = {"sh", "-c", command, NULL};
-
-#if __DARWIN_UNIX03
-       if (__unix_conforming == 0)
-               __unix_conforming = 1;
-#ifdef VARIANT_CANCELABLE
-       _pthread_testcancel(pthread_self(), 1);
-#endif /* VARIANT_CANCELABLE */
-#endif /* __DARWIN_UNIX03 */
-
-       if (!command) {         /* just checking... */
-               if (access(_PATH_BSHELL, F_OK) == -1)   /* if no sh or no access */
-                       return(0);
-               else
-                       return(1);
-       }
-
-       if ((err = posix_spawnattr_init(&attr)) != 0) {
-               errno = err;
-               return -1;
-       }
-       (void)sigemptyset(&defaultsig);
-
-#if __DARWIN_UNIX03
-       pthread_mutex_lock(&__systemfn_mutex);
-#endif /* __DARWIN_UNIX03 */
-       /*
-        * Ignore SIGINT and SIGQUIT, block SIGCHLD. Remember to save
-        * existing signal dispositions.
-        */
-       ign.sa_handler = SIG_IGN;
-       (void)sigemptyset(&ign.sa_mask);
-       ign.sa_flags = 0;
-       (void)_sigaction(SIGINT, &ign, &intact);
-       if (intact.sa_handler != SIG_IGN) {
-               sigaddset(&defaultsig, SIGINT);
-               flags |= POSIX_SPAWN_SETSIGDEF;
-       }
-       (void)_sigaction(SIGQUIT, &ign, &quitact);
-       if (quitact.sa_handler != SIG_IGN) {
-               sigaddset(&defaultsig, SIGQUIT);
-               flags |= POSIX_SPAWN_SETSIGDEF;
-       }
-       (void)sigemptyset(&newsigblock);
-       (void)sigaddset(&newsigblock, SIGCHLD);
-       (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
-       (void)posix_spawnattr_setsigmask(&attr, &oldsigblock);
-       if (flags & POSIX_SPAWN_SETSIGDEF) {
-               (void)posix_spawnattr_setsigdefault(&attr, &defaultsig);
-       }
-       (void)posix_spawnattr_setflags(&attr, flags);
-
-       err = posix_spawn(&pid, _PATH_BSHELL, NULL, &attr, (char *const *)argv, environ);
-       (void)posix_spawnattr_destroy(&attr);
-       if (err == 0) {
-               savedpid = pid;
-               do {
-                       pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
-               } while (pid == -1 && errno == EINTR);
-               if (pid == -1) pstat = -1;
-       } else if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */
-               pstat = -1;
-       } else {
-               pstat = W_EXITCODE(127, 0); /* couldn't exec shell */
-       }
-
-       (void)_sigaction(SIGINT, &intact, NULL);
-       (void)_sigaction(SIGQUIT,  &quitact, NULL);
-       (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
-#if __DARWIN_UNIX03
-       pthread_mutex_unlock(&__systemfn_mutex);
-#endif /* __DARWIN_UNIX03 */
-       return(pstat);
-}
-
-__weak_reference(__system, system);
-__weak_reference(__system, _system);
diff --git a/stdlib/system.3 b/stdlib/system.3
deleted file mode 100644 (file)
index 72bc6cb..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)system.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdlib/system.3,v 1.13 2008/06/26 08:24:59 danger Exp $
-.\"
-.Dd June 4, 1993
-.Dt SYSTEM 3
-.Os
-.Sh NAME
-.Nm system
-.Nd pass a command to the shell
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft int
-.Fn system "const char *command"
-.Sh DESCRIPTION
-The
-.Fn system
-function
-hands the argument
-.Fa command
-to the command interpreter
-.Xr sh 1 .
-The calling process waits for the shell
-to finish executing the command,
-ignoring
-.Dv SIGINT
-and
-.Dv SIGQUIT ,
-and blocking
-.Dv SIGCHLD .
-.Pp
-If
-.Fa command
-is a
-.Dv NULL
-pointer,
-.Fn system
-will return non-zero if the command interpreter
-.Xr sh 1
-is available, and zero if it is not.
-.Sh RETURN VALUES
-The
-.Fn system
-function
-returns the exit status of the shell as returned by
-.Xr waitpid 2 ,
-or \-1 if an error occurred when invoking
-.Xr fork 2
-or
-.Xr waitpid 2 .
-A return value of 127 means the execution of the shell
-failed.
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr execve 2 ,
-.Xr fork 2 ,
-.Xr waitpid 2 ,
-.Xr popen 3
-.Sh STANDARDS
-The
-.Fn system
-function
-conforms to
-.St -isoC
-and is expected to be
-.St -p1003.2
-compatible.
diff --git a/stdlib/tdelete-fbsd.c b/stdlib/tdelete-fbsd.c
deleted file mode 120000 (symlink)
index 780001f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./tdelete.c
\ No newline at end of file
diff --git a/stdlib/tfind-fbsd.c b/stdlib/tfind-fbsd.c
deleted file mode 120000 (symlink)
index a6149c5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./tfind.c
\ No newline at end of file
diff --git a/stdlib/tsearch-fbsd.c b/stdlib/tsearch-fbsd.c
deleted file mode 120000 (symlink)
index 9a316ad..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./tsearch.c
\ No newline at end of file
diff --git a/stdlib/tsearch.3 b/stdlib/tsearch.3
deleted file mode 100644 (file)
index 9d7a863..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-.\" $NetBSD$
-.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\"    derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
-.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\"    OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp
-.\" $FreeBSD: src/lib/libc/stdlib/tsearch.3,v 1.15 2006/06/23 13:36:33 keramida Exp $
-.\"
-.Dd June 15, 1997
-.Dt TSEARCH 3
-.Os
-.Sh NAME
-.Nm tdelete ,
-.Nm tfind ,
-.Nm tsearch ,
-.Nm twalk
-.Nd manipulate binary search trees
-.Sh SYNOPSIS
-.In search.h
-.Ft void *
-.Fo tdelete
-.Fa "const void *restrict key"
-.Fa "void **restrict rootp"
-.Fa "int (*compar) (const void *key1, const void *key2)"
-.Fc
-.Ft void *
-.Fo tfind
-.Fa "const void *key"
-.Fa "void *const *rootp"
-.Fa "int (*compar) (const void *key1, const void *key2)"
-.Fc
-.Ft void *
-.Fo tsearch
-.Fa "const void *key"
-.Fa "void **rootp"
-.Fa "int (*compar) (const void *key1, const void *key2)"
-.Fc
-.Ft void
-.Fo twalk
-.Fa "const void *root"
-.Fa "void (*action) (const void *node, VISIT order, int level)"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn tdelete ,
-.Fn tfind ,
-.Fn tsearch ,
-and
-.Fn twalk
-functions manage binary search trees, based on algorithms T and D
-from Knuth (6.2.2).
-The comparison function passed in by
-the user takes two arguments, each of which is a key
-pointer.
-This function has the same style of return values as
-.Xr strcmp 3 .
-.Pp
-The
-.Fn tfind
-function
-searches for a node whose key matches the argument
-.Fa key
-in the binary tree rooted at
-.Fa rootp ,
-returning a pointer to the node if it is found and NULL
-if it is not.
-.Pp
-Note that a node is itself a pointer to the key of the node.
-Thus, you should generally cast this result to a
-double pointer to the data type stored in the tree, for example
-(struct myType **), and use double indirection to retrieve the
-original key value.
-.Pp
-The
-.Fn tsearch
-function is identical to
-.Fn tfind
-except that, if no match is found,
-it inserts a new node for the
-.Fa key
-into the tree and returns a pointer to the node.
-If
-.Fa rootp
-points to a NULL value, a new binary search tree is created.
-.Pp
-The
-.Fn tdelete
-function deletes a node from the specified binary search tree
-and returns a pointer to the parent of the node that was deleted.
-It takes the same arguments as
-.Fn tfind
-and
-.Fn tsearch .
-If the node to be deleted is the root of the binary search tree,
-.Fa rootp
-will be adjusted.
-.Pp
-The
-.Fn twalk
-function walks the binary search tree rooted in
-.Fa root
-and calls the function
-.Fa action
-on each node.
-The
-.Fa action
-function is called with three arguments: a pointer to the current node,
-a value from the enum
-.Sy "typedef enum { preorder, postorder, endorder, leaf } VISIT;"
-specifying the traversal type, and a node level (where level
-zero is the root of the tree).
-.Pp
-As
-.Fn twalk
-traverses the tree, it calls the
-.Fa action
-function with the traversal type "preorder"
-before visiting the left subtree of the
-.Fa node ,
-with the
-traversal type "postorder" before visiting the right subtree
-of the
-.Fa node ,
-and with the traversal type "endorder" after
-visiting the right subtree of the
-.Fa node .
-.Pp.
-The
-.Fa action
-function is called only once for a leaf-node, with the
-traversal type "leaf."
-.Pp
-Note: the names for the traversal types differ somewhat from
-common parlance.  The traversal type "postorder" corresponds
-to what would typically be referred to as in-order, and the
-traversal type "endorder" corresponds to what would typically
-be referred to as post-order.
-.Sh RETURN VALUES
-The
-.Fn tsearch
-function returns NULL if allocation of a new node fails (usually
-due to a lack of free memory).
-.Pp
-The
-.Fn tfind ,
-.Fn tsearch ,
-and
-.Fn tdelete
-functions
-return NULL if
-.Fa rootp
-is NULL or the node cannot be found.
-.Pp
-The
-.Fn twalk
-function returns no value.
-.Sh SEE ALSO
-.Xr bsearch 3 ,
-.Xr hsearch 3 ,
-.Xr lsearch 3
diff --git a/stdlib/twalk-fbsd.c b/stdlib/twalk-fbsd.c
deleted file mode 120000 (symlink)
index eef8457..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./twalk.c
\ No newline at end of file
index 0a291df297fa7c0ae00859e35b29f83a79771ada..89804ab956691fc1b373fe420c2d08f4d67e4d1b 100644 (file)
@@ -79,9 +79,7 @@ static char   buf_asctime[MAX_ASCTIME_BUF_SIZE];
 */
 
 char *
-asctime_r(timeptr, buf)
-const struct tm *      timeptr;
-char *                 buf;
+asctime_r(const struct tm * __restrict timeptr, char * __restrict buf)
 {
        static const char       wday_name[][3] = {
                "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
diff --git a/stdtime/FreeBSD/asctime.c.patch b/stdtime/FreeBSD/asctime.c.patch
deleted file mode 100644 (file)
index 07e8113..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- asctime.c.bsdnew   2009-11-14 13:55:43.000000000 -0800
-+++ asctime.c  2009-11-14 14:04:38.000000000 -0800
-@@ -79,9 +79,7 @@ static char  buf_asctime[MAX_ASCTIME_BUF_
- */
- char *
--asctime_r(timeptr, buf)
--const struct tm *     timeptr;
--char *                        buf;
-+asctime_r(const struct tm * __restrict timeptr, char * __restrict buf)
- {
-       static const char       wday_name[][3] = {
-               "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
index 5e7f3b7899a47671c61dc3bd641d8d84087ac487..7bcc80b98f278048bda2d98d039684b5da2e7305 100644 (file)
 .In time.h
 .Vt extern char *tzname[2] ;
 .Ft char *
+.Fn asctime "const struct tm *timeptr"
+.Ft char *
+.Fn asctime_r "const struct tm *restrict timeptr" "char *restrict buf"
+.Ft char *
 .Fn ctime "const time_t *clock"
+.Ft char *
+.Fn ctime_r "const time_t *clock" "char *buf"
 .Ft double
 .Fn difftime "time_t time1" "time_t time0"
-.Ft char *
-.Fn asctime "const struct tm *tm"
+.Ft struct tm *
+.Fn gmtime "const time_t *clock"
+.Ft struct tm *
+.Fn gmtime_r "const time_t *clock" "struct tm *result"
 .Ft struct tm *
 .Fn localtime "const time_t *clock"
 .Ft struct tm *
-.Fn gmtime "const time_t *clock"
+.Fn localtime_r "const time_t *clock" "struct tm *result"
 .Ft time_t
-.Fn mktime "struct tm *tm"
+.Fn mktime "struct tm *timeptr"
 .Ft time_t
-.Fn timegm "struct tm *tm"
-.Ft char *
-.Fn ctime_r "const time_t *clock" "char *buf"
-.Ft struct tm *
-.Fn localtime_r "const time_t *clock" "struct tm *result"
-.Ft struct tm *
-.Fn gmtime_r "const time_t *clock" "struct tm *result"
-.Ft char *
-.Fn asctime_r "const struct tm *tm" "char *buf"
+.Fn timegm "struct tm *timeptr"
 .Sh DESCRIPTION
 The functions
 .Fn ctime ,
-.Fn gmtime
+.Fn gmtime ,
 and
 .Fn localtime
 all take as an argument a time value representing the time in seconds since
@@ -88,10 +88,10 @@ January 1, 1970; see
 The function
 .Fn localtime
 converts the time value pointed at by
-.Fa clock ,
-and returns a pointer to a
+.Fa clock .
+It returns a pointer to a
 .Dq Fa struct tm
-(described below) which contains
+(described below), which contains
 the broken-out time information for the value after adjusting for the current
 time zone (and any other factors such as Daylight Saving Time).
 Time zone adjustments are performed as specified by the
@@ -102,7 +102,7 @@ The function
 .Fn localtime
 uses
 .Xr tzset 3
-to initialize time conversion information if
+to initialize time conversion information, if
 .Xr tzset 3
 has not already been called by the process.
 .Pp
@@ -114,36 +114,36 @@ element of
 .Fa tzname
 to a pointer to an
 .Tn ASCII
-string that is the time zone abbreviation to be
+string containing the time zone abbreviation to be
 used with
 .Fn localtime Ns 's
 return value.
 .Pp
 The function
 .Fn gmtime
-similarly converts the time value, but without any time zone adjustment,
-and returns a pointer to a tm structure (described below).
+also converts the time value, but makes no time zone adjustment.
+It returns a pointer to a tm structure (described below).
 .Pp
 The
 .Fn ctime
 function
-adjusts the time value for the current time zone in the same manner as
-.Fn localtime ,
-and returns a pointer to a 26-character string of the form:
+adjusts the time value for the current time zone, in the same manner as
+.Fn localtime .
+It returns a pointer to a 26-character string of the form:
 .Bd -literal -offset indent
 Thu Nov 24 18:22:48 1986\en\e0
 .Ed
 .Pp
-All the fields have constant width.
+All of the fields have constant width.
 .Pp
 The
 .Fn ctime_r
 function
 provides the same functionality as
-.Fn ctime
-except the caller must provide the output buffer
+.Fn ctime ,
+except that the caller must provide the output buffer
 .Fa buf
-to store the result, which must be at least 26 characters long.
+(which must be at least 26 characters long) to store the result.
 The
 .Fn localtime_r
 and
@@ -152,17 +152,17 @@ functions
 provide the same functionality as
 .Fn localtime
 and
-.Fn gmtime
+.Fn gmtime ,
 respectively, except the caller must provide the output buffer
 .Fa result .
 .Pp
 The
 .Fn asctime
 function
-converts the broken down time in the structure
+converts the broken-out time in the structure
 .Fa tm
-pointed at by
-.Fa *tm
+(pointed at by
+.Fa *timeptr )
 to the form
 shown in the example above.
 .Pp
@@ -170,17 +170,19 @@ The
 .Fn asctime_r
 function
 provides the same functionality as
-.Fn asctime
-except the caller provide the output buffer
+.Fn asctime ,
+except that the caller provides the output buffer
 .Fa buf
-to store the result, which must be at least 26 characters long.
+(which must be at least 26 characters long) to store the result.
 .Pp
 The functions
 .Fn mktime
 and
 .Fn timegm
-convert the broken-down time in the structure
-pointed to by tm into a time value with the same encoding as that of the
+convert the broken-out time
+(in the structure pointed to by
+.Fa *timeptr )
+into a time value with the same encoding as that of the
 values returned by the
 .Xr time 3
 function (that is, seconds from the Epoch,
@@ -193,17 +195,17 @@ interprets the input structure according to the current timezone setting
 .Xr tzset 3 ) .
 The
 .Fn timegm
-function
-interprets the input structure as representing Universal Coordinated Time
+function interprets the input structure
+as representing Universal Coordinated Time
 .Pq Tn UTC .
 .Pp
 The original values of the
 .Fa tm_wday
 and
 .Fa tm_yday
-components of the structure are ignored, and the original values of the
-other components are not restricted to their normal ranges, and will be
-normalized if needed.
+components of the structure are ignored. The original values of the
+other components are not restricted to their normal ranges and will be
+normalized, if need be.
 For example,
 October 40 is changed into November 9,
 a
@@ -219,7 +221,7 @@ of \-2 means 2 months before January of
 causes
 .Fn mktime
 to presume initially that summer time (for example, Daylight Saving Time)
-is or is not in effect for the specified time, respectively.
+is or is not (respectively) in effect for the specified time.
 A negative value for
 .Fa tm_isdst
 causes the
@@ -261,7 +263,8 @@ returns the difference between two calendar times,
 .Fa time0 ) ,
 expressed in seconds.
 .Pp
-External declarations as well as the tm structure definition are in the
+External declarations, as well as the tm structure definition,
+are contained in the
 .In time.h
 include file.
 The tm structure includes at least the following fields:
@@ -282,14 +285,14 @@ long tm_gmtoff;   /\(** offset from UTC in seconds \(**/
 The
 field
 .Fa tm_isdst
-is non-zero if summer time is in effect.
+is non-zero if summer (i.e., Daylight Saving) time is in effect.
 .Pp
 The field
 .Fa tm_gmtoff
 is the offset (in seconds) of the time represented from
 .Tn UTC ,
 with positive
-values indicating east of the Prime Meridian.
+values indicating locations east of the Prime Meridian.
 .Sh SEE ALSO
 .Xr date 1 ,
 .Xr gettimeofday 2 ,
diff --git a/stdtime/FreeBSD/ctime.3.patch b/stdtime/FreeBSD/ctime.3.patch
deleted file mode 100644 (file)
index b91ccb4..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
---- ctime.3.bsdnew     2009-11-14 13:55:43.000000000 -0800
-+++ ctime.3    2009-11-14 14:01:29.000000000 -0800
-@@ -52,31 +52,31 @@
- .In time.h
- .Vt extern char *tzname[2] ;
- .Ft char *
-+.Fn asctime "const struct tm *timeptr"
-+.Ft char *
-+.Fn asctime_r "const struct tm *restrict timeptr" "char *restrict buf"
-+.Ft char *
- .Fn ctime "const time_t *clock"
-+.Ft char *
-+.Fn ctime_r "const time_t *clock" "char *buf"
- .Ft double
- .Fn difftime "time_t time1" "time_t time0"
--.Ft char *
--.Fn asctime "const struct tm *tm"
-+.Ft struct tm *
-+.Fn gmtime "const time_t *clock"
-+.Ft struct tm *
-+.Fn gmtime_r "const time_t *clock" "struct tm *result"
- .Ft struct tm *
- .Fn localtime "const time_t *clock"
- .Ft struct tm *
--.Fn gmtime "const time_t *clock"
-+.Fn localtime_r "const time_t *clock" "struct tm *result"
- .Ft time_t
--.Fn mktime "struct tm *tm"
-+.Fn mktime "struct tm *timeptr"
- .Ft time_t
--.Fn timegm "struct tm *tm"
--.Ft char *
--.Fn ctime_r "const time_t *clock" "char *buf"
--.Ft struct tm *
--.Fn localtime_r "const time_t *clock" "struct tm *result"
--.Ft struct tm *
--.Fn gmtime_r "const time_t *clock" "struct tm *result"
--.Ft char *
--.Fn asctime_r "const struct tm *tm" "char *buf"
-+.Fn timegm "struct tm *timeptr"
- .Sh DESCRIPTION
- The functions
- .Fn ctime ,
--.Fn gmtime
-+.Fn gmtime ,
- and
- .Fn localtime
- all take as an argument a time value representing the time in seconds since
-@@ -88,10 +88,10 @@ January 1, 1970; see
- The function
- .Fn localtime
- converts the time value pointed at by
--.Fa clock ,
--and returns a pointer to a
-+.Fa clock .
-+It returns a pointer to a
- .Dq Fa struct tm
--(described below) which contains
-+(described below), which contains
- the broken-out time information for the value after adjusting for the current
- time zone (and any other factors such as Daylight Saving Time).
- Time zone adjustments are performed as specified by the
-@@ -102,7 +102,7 @@ The function
- .Fn localtime
- uses
- .Xr tzset 3
--to initialize time conversion information if
-+to initialize time conversion information, if
- .Xr tzset 3
- has not already been called by the process.
- .Pp
-@@ -114,36 +114,36 @@ element of
- .Fa tzname
- to a pointer to an
- .Tn ASCII
--string that is the time zone abbreviation to be
-+string containing the time zone abbreviation to be
- used with
- .Fn localtime Ns 's
- return value.
- .Pp
- The function
- .Fn gmtime
--similarly converts the time value, but without any time zone adjustment,
--and returns a pointer to a tm structure (described below).
-+also converts the time value, but makes no time zone adjustment.
-+It returns a pointer to a tm structure (described below).
- .Pp
- The
- .Fn ctime
- function
--adjusts the time value for the current time zone in the same manner as
--.Fn localtime ,
--and returns a pointer to a 26-character string of the form:
-+adjusts the time value for the current time zone, in the same manner as
-+.Fn localtime .
-+It returns a pointer to a 26-character string of the form:
- .Bd -literal -offset indent
- Thu Nov 24 18:22:48 1986\en\e0
- .Ed
- .Pp
--All the fields have constant width.
-+All of the fields have constant width.
- .Pp
- The
- .Fn ctime_r
- function
- provides the same functionality as
--.Fn ctime
--except the caller must provide the output buffer
-+.Fn ctime ,
-+except that the caller must provide the output buffer
- .Fa buf
--to store the result, which must be at least 26 characters long.
-+(which must be at least 26 characters long) to store the result.
- The
- .Fn localtime_r
- and
-@@ -152,17 +152,17 @@ functions
- provide the same functionality as
- .Fn localtime
- and
--.Fn gmtime
-+.Fn gmtime ,
- respectively, except the caller must provide the output buffer
- .Fa result .
- .Pp
- The
- .Fn asctime
- function
--converts the broken down time in the structure
-+converts the broken-out time in the structure
- .Fa tm
--pointed at by
--.Fa *tm
-+(pointed at by
-+.Fa *timeptr )
- to the form
- shown in the example above.
- .Pp
-@@ -170,17 +170,19 @@ The
- .Fn asctime_r
- function
- provides the same functionality as
--.Fn asctime
--except the caller provide the output buffer
-+.Fn asctime ,
-+except that the caller provides the output buffer
- .Fa buf
--to store the result, which must be at least 26 characters long.
-+(which must be at least 26 characters long) to store the result.
- .Pp
- The functions
- .Fn mktime
- and
- .Fn timegm
--convert the broken-down time in the structure
--pointed to by tm into a time value with the same encoding as that of the
-+convert the broken-out time
-+(in the structure pointed to by
-+.Fa *timeptr )
-+into a time value with the same encoding as that of the
- values returned by the
- .Xr time 3
- function (that is, seconds from the Epoch,
-@@ -193,17 +195,17 @@ interprets the input structure according
- .Xr tzset 3 ) .
- The
- .Fn timegm
--function
--interprets the input structure as representing Universal Coordinated Time
-+function interprets the input structure
-+as representing Universal Coordinated Time
- .Pq Tn UTC .
- .Pp
- The original values of the
- .Fa tm_wday
- and
- .Fa tm_yday
--components of the structure are ignored, and the original values of the
--other components are not restricted to their normal ranges, and will be
--normalized if needed.
-+components of the structure are ignored. The original values of the
-+other components are not restricted to their normal ranges and will be
-+normalized, if need be.
- For example,
- October 40 is changed into November 9,
- a
-@@ -219,7 +221,7 @@ of \-2 means 2 months before January of
- causes
- .Fn mktime
- to presume initially that summer time (for example, Daylight Saving Time)
--is or is not in effect for the specified time, respectively.
-+is or is not (respectively) in effect for the specified time.
- A negative value for
- .Fa tm_isdst
- causes the
-@@ -261,7 +263,8 @@ returns the difference between two calen
- .Fa time0 ) ,
- expressed in seconds.
- .Pp
--External declarations as well as the tm structure definition are in the
-+External declarations, as well as the tm structure definition,
-+are contained in the
- .In time.h
- include file.
- The tm structure includes at least the following fields:
-@@ -282,14 +285,14 @@ long tm_gmtoff;  /\(** offset from UTC in
- The
- field
- .Fa tm_isdst
--is non-zero if summer time is in effect.
-+is non-zero if summer (i.e., Daylight Saving) time is in effect.
- .Pp
- The field
- .Fa tm_gmtoff
- is the offset (in seconds) of the time represented from
- .Tn UTC ,
- with positive
--values indicating east of the Prime Meridian.
-+values indicating locations east of the Prime Meridian.
- .Sh SEE ALSO
- .Xr date 1 ,
- .Xr gettimeofday 2 ,
index 7cee2becb93856a0f82a6e94292d50e8eb6f9804..4676bd8e27cc2b83340beadfb9179281fc8840cd 100644 (file)
 .Sh NAME
 .Nm ftime
 .Nd get date and time
-.Sh LIBRARY
-.Lb libcompat
 .Sh SYNOPSIS
-.In sys/types.h
 .In sys/timeb.h
 .Ft int
-.Fn ftime "struct timeb *tp"
+.Fo ftime
+.Fa "struct timeb *tp"
+.Fc
 .Sh DESCRIPTION
 .Bf -symbolic
 This interface is obsoleted by
@@ -69,16 +68,24 @@ struct timeb
 };
 .Ed
 .Pp
-The structure contains the time since the epoch in seconds,
-up to 1000 milliseconds of more-precise interval,
-the local time zone (measured in minutes of time westward from Greenwich),
+The structure contains the time since the epoch, in seconds;
+up to 1000 milliseconds of more-precise interval;
+the local time zone (measured in minutes of time westward from Greenwich);
 and a flag that, if nonzero, indicates that
 Daylight Saving time applies locally during the appropriate part of the year.
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/timeb.h>
+.Pp
+The include file
+.In sys/types.h
+is necessary.
 .Sh SEE ALSO
 .Xr gettimeofday 2 ,
 .Xr settimeofday 2 ,
 .Xr ctime 3 ,
-.Xr time 3
+.Xr time 3 ,
+.Xr compat 5
 .Sh HISTORY
 The
 .Nm
diff --git a/stdtime/FreeBSD/ftime.3.patch b/stdtime/FreeBSD/ftime.3.patch
deleted file mode 100644 (file)
index 0f04f6c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- ftime.3    2004-04-15 16:20:14.000000000 -0700
-+++ ftime.3.edit       2006-07-12 11:19:27.000000000 -0700
-@@ -38,13 +38,12 @@
- .Sh NAME
- .Nm ftime
- .Nd get date and time
--.Sh LIBRARY
--.Lb libcompat
- .Sh SYNOPSIS
--.In sys/types.h
- .In sys/timeb.h
- .Ft int
--.Fn ftime "struct timeb *tp"
-+.Fo ftime
-+.Fa "struct timeb *tp"
-+.Fc
- .Sh DESCRIPTION
- .Bf -symbolic
- This interface is obsoleted by
-@@ -69,16 +68,24 @@
- };
- .Ed
- .Pp
--The structure contains the time since the epoch in seconds,
--up to 1000 milliseconds of more-precise interval,
--the local time zone (measured in minutes of time westward from Greenwich),
-+The structure contains the time since the epoch, in seconds;
-+up to 1000 milliseconds of more-precise interval;
-+the local time zone (measured in minutes of time westward from Greenwich);
- and a flag that, if nonzero, indicates that
- Daylight Saving time applies locally during the appropriate part of the year.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <sys/types.h>
-+.Fd #include <sys/timeb.h>
-+.Pp
-+The include file
-+.In sys/types.h
-+is necessary.
- .Sh SEE ALSO
- .Xr gettimeofday 2 ,
- .Xr settimeofday 2 ,
- .Xr ctime 3 ,
--.Xr time 3
-+.Xr time 3 ,
-+.Xr compat 5
- .Sh HISTORY
- The
- .Nm
index 97b022c337a32ba0913faa94d60acd3e728bcead..7e3cd2a02ccdf6f9f6cd4085687a426de98ec1b1 100644 (file)
@@ -22,8 +22,22 @@ __FBSDID("$FreeBSD: src/lib/libc/stdtime/localtime.c,v 1.43 2008/04/01 06:56:11
 #include "namespace.h"
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include <errno.h>
+#ifdef NOTIFY_TZ
+//#define NOTIFY_TZ_DEBUG
+//#define NOTIFY_TZ_DEBUG_FILE "/var/log/localtime.debug"
+//#define NOTIFY_TZ_LOG        "/var/log/localtime.log"
+/* force ALL_STATE if NOTIFY_TZ is set */
+#ifndef ALL_STATE
+#define ALL_STATE
+#endif /* ALL_STATE */
+#include <mach/mach_init.h>
+#include <notify.h>
+#include <alloca.h>
+#endif /* NOTIFY_TZ */
 #include "private.h"
 #include "un-namespace.h"
 
@@ -150,40 +164,94 @@ struct rule {
 #define DAY_OF_YEAR            1       /* n - day of year */
 #define MONTH_NTH_DAY_OF_WEEK  2       /* Mm.n.d - month, week, day of week */
 
+#ifdef NOTIFY_TZ
+typedef struct {
+       int token;
+       int notify_was_off;
+       int is_set;
+} notify_tz_t;
+
+#define NOTIFY_TZ_NAME         "com.apple.system.timezone"
+#endif /* NOTIFY_TZ */
+
 /*
 ** Prototypes for static functions.
 */
+#define        localsub        _st_localsub
+#define        time1           _st_time1
+#define        tzset_basic     _st_tzset_basic
+__private_extern__
+#ifdef __LP64__
+struct tm *            localsub(const time_t * timep, long offset,
+                               struct tm * tmp);
+#else /* !__LP64__ */
+void                   localsub(const time_t * timep, long offset,
+                               struct tm * tmp);
+#endif /* __LP64__ */
+__private_extern__
+time_t                 time1(struct tm * tmp,
+#ifdef __LP64__
+                               struct tm *(*funcp) (const time_t *,
+                               long, struct tm *),
+#else /* !__LP64__ */
+                               void(*funcp) (const time_t *,
+                               long, struct tm *),
+#endif /* __LP64__ */
+                               long offset,
+                               int unix03);
+__private_extern__
+void                   tzset_basic(int);
 
+#if !BUILDING_VARIANT
 static long            detzcode(const char * codep);
-static const char *    getzname(const char * strp);
+static const char *    getzname(const char * strp, char **name, size_t *len);
 static const char *    getnum(const char * strp, int * nump, int min,
                                int max);
 static const char *    getsecs(const char * strp, long * secsp);
 static const char *    getoffset(const char * strp, long * offsetp);
 static const char *    getrule(const char * strp, struct rule * rulep);
 static void            gmtload(struct state * sp);
-static void            gmtsub(const time_t * timep, long offset,
+#ifdef __LP64__
+static struct tm *     gmtsub(const time_t * timep, long offset,
                                struct tm * tmp);
-static void            localsub(const time_t * timep, long offset,
+#else /* !__LP64__ */
+static void            gmtsub(const time_t * timep, long offset,
                                struct tm * tmp);
+#endif /* __LP64__ */
 static int             increment_overflow(int * number, int delta);
 static int             normalize_overflow(int * tensptr, int * unitsptr,
                                int base);
+#ifdef NOTIFY_TZ
+static void            notify_check_tz(notify_tz_t *p);
+static void            notify_register_tz(char *file, notify_tz_t *p);
+#endif /* NOTIFY_TZ */
 static void            settzname(void);
-static time_t          time1(struct tm * tmp,
-                               void(*funcp) (const time_t *,
-                               long, struct tm *),
-                               long offset);
 static time_t          time2(struct tm *tmp,
+#ifdef __LP64__
+                               struct tm *(*funcp) (const time_t *,
+                               long, struct tm*),
+#else /* !__LP64__ */
                                void(*funcp) (const time_t *,
                                long, struct tm*),
-                               long offset, int * okayp);
+#endif /* __LP64__ */
+                               long offset, int * okayp, int unix03);
 static time_t          time2sub(struct tm *tmp,
+#ifdef __LP64__
+                               struct tm *(*funcp) (const time_t *,
+                               long, struct tm*),
+#else /* !__LP64__ */
                                void(*funcp) (const time_t *,
                                long, struct tm*),
-                               long offset, int * okayp, int do_norm_secs);
+#endif /* __LP64__ */
+                               long offset, int * okayp, int do_norm_secs,
+                               int unix03);
+#ifdef __LP64__
+static struct tm *     timesub(const time_t * timep, long offset,
+                               const struct state * sp, struct tm * tmp);
+#else /* !__LP64__ */
 static void            timesub(const time_t * timep, long offset,
                                const struct state * sp, struct tm * tmp);
+#endif /* __LP64__ */
 static int             tmcomp(const struct tm * atmp,
                                const struct tm * btmp);
 static time_t          transtime(time_t janfirst, int year,
@@ -209,9 +277,14 @@ static struct state        gmtmem;
 #endif /* !defined TZ_STRLEN_MAX */
 
 static char            lcl_TZname[TZ_STRLEN_MAX + 1];
+#ifdef NOTIFY_TZ
+#define lcl_is_set    (lcl_notify.is_set)
+#define gmt_is_set    (gmt_notify.is_set)
+#else /* ! NOTIFY_TZ */
 static int             lcl_is_set;
 static int             gmt_is_set;
-static pthread_rwlock_t        lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
+#endif /* NOTIFY_TZ */
+__private_extern__ pthread_rwlock_t    lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
 static pthread_mutex_t gmt_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 char *                 tzname[2] = {
@@ -229,15 +302,62 @@ char *                    tzname[2] = {
 
 static struct tm       tm;
 
+#define USG_COMPAT
+#define ALTZONE
 #ifdef USG_COMPAT
-time_t                 timezone = 0;
 int                    daylight = 0;
+__private_extern__ void _st_set_timezone(long);
 #endif /* defined USG_COMPAT */
 
 #ifdef ALTZONE
-time_t                 altzone = 0;
+__private_extern__ long                __darwin_altzone = 0;
+#define altzone __darwin_altzone
 #endif /* defined ALTZONE */
 
+#ifdef NOTIFY_TZ
+#ifdef NOTIFY_TZ_DEBUG
+#ifdef NOTIFY_TZ_DEBUG_FILE
+#define NOTIFY_TZ_PRINTF(fmt, args...) \
+{ \
+       FILE *_notify_tz_fp_; \
+       if((_notify_tz_fp_ = fopen(NOTIFY_TZ_DEBUG_FILE, "a")) != NULL) { \
+               fprintf(_notify_tz_fp_, "%d: " fmt, getpid(), ## args); \
+               fclose(_notify_tz_fp_); \
+       } \
+}
+#else /* ! NOTIFY_TZ_DEBUG_FILE */
+#define NOTIFY_TZ_PRINTF(args...)      fprintf(stdout, ## args)
+#endif /* NOTIFY_TZ_DEBUG_FILE */
+#endif /* NOTIFY_TZ_DEBUG */
+#ifdef NOTIFY_TZ_LOG
+#define NOTIFY_LOG(fmt, args...)       \
+{ \
+       FILE *_notify_log_fp_; \
+       if((_notify_log_fp_ = fopen(NOTIFY_TZ_LOG, "a")) != NULL) { \
+               fprintf(_notify_log_fp_, "%d: " fmt, getpid(), ## args); \
+               fclose(_notify_log_fp_); \
+       } \
+}
+#endif /* NOTIFY_TZ_LOG */
+/*--------------------------------------------------------------------
+ * __notify_78945668_info__ is a global variable (defined in Libnotify)
+ * that can be used to disable the notify mechanism.  Set to a negative
+ * value to disable.  It can then be set back to zero to re-enable.
+ *-------------------------------------------------------------------- */
+extern int             __notify_78945668_info__;
+
+/*--------------------------------------------------------------------
+ * fullname is used to pass the actual path of the timezone file to the
+ * notify routines.  If it is a nil string, that means no timezone file
+ * is being used.
+ *-------------------------------------------------------------------- */
+static char *          fullname = NULL;
+
+static notify_tz_t     gmt_notify = {-1, 0, 0};
+static notify_tz_t     lcl_notify = {-1, 0, 0};
+static char            notify_tz_name[] = NOTIFY_TZ_NAME;
+#endif /* NOTIFY_TZ */
+
 static long
 detzcode(codep)
 const char * const     codep;
@@ -255,51 +375,203 @@ static void
 settzname(void)
 {
        struct state *  sp = lclptr;
-       int                     i;
+       int                     i, need;
+       unsigned char * types;
+#define NEED_STD       1
+#define NEED_DST       2
+#define NEED_DAYLIGHT  4
+#define NEED_ALL       (NEED_STD | NEED_DST | NEED_DAYLIGHT)
 
        tzname[0] = wildabbr;
        tzname[1] = wildabbr;
 #ifdef USG_COMPAT
        daylight = 0;
-       timezone = 0;
+       _st_set_timezone(0);
 #endif /* defined USG_COMPAT */
 #ifdef ALTZONE
        altzone = 0;
 #endif /* defined ALTZONE */
 #ifdef ALL_STATE
        if (sp == NULL) {
-               tzname[0] = tzname[1] = gmt;
+               tzname[0] = tzname[1] = (char *)gmt;
                return;
        }
 #endif /* defined ALL_STATE */
-       for (i = 0; i < sp->typecnt; ++i) {
-               const struct ttinfo * const     ttisp = &sp->ttis[i];
+       /*
+        * PR-3765457: The original settzname went sequentially through the ttis
+        * array, rather than correctly indexing via the types array, to get
+        * the real order of the timezone changes.  In addition, as a speed up,
+        * we start at the end of the changes, and work back, so that most of
+        * the time, we don't have to look through the entire array.
+        */
+       if (sp->timecnt == 0 && sp->typecnt == 1) {
+               /*
+                * Unfortunately, there is an edge case when typecnt == 1 and
+                * timecnt == 0, which would cause the loop to never run.  So
+                * in that case, we fudge things up so that it is as if
+                * timecnt == 1.
+                */
+               i = 0;
+               types = (unsigned char *)""; /* we use the null as index */
+       } else {
+               /* the usual case */
+               i = sp->timecnt - 1;
+               types = sp->types;
+       }
+       need = NEED_ALL;
+       for (; i >= 0 && need; --i) {
+               const struct ttinfo * const     ttisp = &sp->ttis[types[i]];
 
-               tzname[ttisp->tt_isdst] =
-                       &sp->chars[ttisp->tt_abbrind];
 #ifdef USG_COMPAT
-               if (ttisp->tt_isdst)
+               if ((need & NEED_DAYLIGHT) && ttisp->tt_isdst) {
+                       need &= ~NEED_DAYLIGHT;
                        daylight = 1;
-               if (i == 0 || !ttisp->tt_isdst)
-                       timezone = -(ttisp->tt_gmtoff);
+               }
 #endif /* defined USG_COMPAT */
+               if (ttisp->tt_isdst) {
+                       if (need & NEED_DST) {
+                               need &= ~NEED_DST;
+                               tzname[1] = &sp->chars[ttisp->tt_abbrind];
 #ifdef ALTZONE
-               if (i == 0 || ttisp->tt_isdst)
-                       altzone = -(ttisp->tt_gmtoff);
+                               altzone = -(ttisp->tt_gmtoff);
 #endif /* defined ALTZONE */
+                       }
+               } else if (need & NEED_STD) {
+                       need &= ~NEED_STD;
+                       tzname[0] = &sp->chars[ttisp->tt_abbrind];
+#ifdef USG_COMPAT
+                       _st_set_timezone(-(ttisp->tt_gmtoff));
+#endif /* defined USG_COMPAT */
+               }
+#if defined(ALTZONE) || defined(USG_COMPAT)
+               if (i == 0) {
+#endif /* defined(ALTZONE) || defined(USG_COMPAT) */
+#ifdef ALTZONE
+                       if (need & NEED_DST)
+                               altzone = -(ttisp->tt_gmtoff);
+#endif /* defined ALTZONE */
+#ifdef USG_COMPAT
+                       if (need & NEED_STD)
+                               _st_set_timezone(-(ttisp->tt_gmtoff));
+#endif /* defined USG_COMPAT */
+#if defined(ALTZONE) || defined(USG_COMPAT)
+               }
+#endif /* defined(ALTZONE) || defined(USG_COMPAT) */
        }
-       /*
-       ** And to get the latest zone names into tzname. . .
-       */
-       for (i = 0; i < sp->timecnt; ++i) {
-               const struct ttinfo * const     ttisp =
-                                                       &sp->ttis[
-                                                               sp->types[i]];
+}
+
+#ifdef NOTIFY_TZ
+static void
+notify_check_tz(notify_tz_t *p)
+{
+       unsigned int nstat;
+       int ncheck;
+
+       if (__notify_78945668_info__ < 0) {
+#ifdef NOTIFY_TZ_DEBUG
+               if(!p->notify_was_off) NOTIFY_TZ_PRINTF("notify_check_tz: setting %s_notify->notify_was_off\n", (p == &lcl_notify ? "lcl" : "gmt"));
+#endif /* NOTIFY_TZ_DEBUG */
+               p->notify_was_off = 1;
+               return;
+       }
+       /* force rereading the timezone file if notify was off */
+       if (p->notify_was_off) {
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("notify_check_tz: saw %s_notify->notify_was_off\n", (p == &lcl_notify ? "lcl" : "gmt"));
+#endif /* NOTIFY_TZ_DEBUG */
+               p->is_set = 0;
+               p->notify_was_off = 0;
+               return;
+       }
+       if (p->token < 0)
+               return;
+       nstat = notify_check(p->token, &ncheck);
+       if (nstat || ncheck) {
+               p->is_set = 0;
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("notify_check_tz: %s changed\n", (p == &lcl_notify) ? "lcl" : "gmt");
+#endif /* NOTIFY_TZ_DEBUG */
+       }
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("notify_check_tz: %s unchanged\n", (p == &lcl_notify) ? "lcl" : "gmt");
+#endif /* NOTIFY_TZ_DEBUG */
+}
+
+extern uint32_t notify_monitor_file(int token, char *path, int flags);
+
+static void
+notify_register_tz(char *file, notify_tz_t *p)
+{
+       char *name;
+       unsigned int nstat;
+       int ncheck;
 
-               tzname[ttisp->tt_isdst] =
-                       &sp->chars[ttisp->tt_abbrind];
+       if (__notify_78945668_info__ < 0)
+               return;
+       /*----------------------------------------------------------------
+        * Since we don't record the last time zone filename, just cancel
+        * (which should remove the file monitor) and setup from scratch
+        *----------------------------------------------------------------*/
+       if (p->token >= 0)
+               notify_cancel(p->token);
+       if (!file || *file == 0) {
+               /* no time zone file to monitor */
+               p->token = -1;
+               return;
        }
+       /*----------------------------------------------------------------
+        * Just use com.apple.system.timezone if the path is /etc/localtime.
+        * Otherwise use com.apple.system.timezone.<fullpath>
+        *----------------------------------------------------------------*/
+       if (TZDEFAULT && strcmp(file, TZDEFAULT) == 0)
+               name = notify_tz_name;
+       else {
+               name = alloca(sizeof(notify_tz_name) + strlen(file) + 1);
+               if (name == NULL) {
+                       p->token = -1;
+                       return;
+               }
+               strcpy(name, notify_tz_name);
+               strcat(name, ".");
+               strcat(name, file);
+       }
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("notify_register_tz: file=%s name=%s\n", file, name);
+#endif /* NOTIFY_TZ_DEBUG */
+       nstat = notify_register_check(name, &p->token);
+       if (nstat != 0) {
+               p->token = -1;
+               p->is_set = 0;
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("***notify_register_tz: notify_register_check failed: %u\n", nstat);
+#endif /* NOTIFY_TZ_DEBUG */
+#ifdef NOTIFY_TZ_LOG
+               NOTIFY_LOG("notify_register_check(%s) failed: %u\n", name, nstat);
+#endif /* NOTIFY_TZ_LOG */
+               return;
+       }
+       /* don't need to request monitoring /etc/localtime */
+       if (name != notify_tz_name) {
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("notify_register_tz: monitor %s\n", file);
+#endif /* NOTIFY_TZ_DEBUG */
+               nstat = notify_monitor_file(p->token, file, 0);
+               if (nstat != 0) {
+                       notify_cancel(p->token);
+                       p->token = -1;
+                       p->is_set = 0;
+#ifdef NOTIFY_TZ_DEBUG
+                       NOTIFY_TZ_PRINTF("***notify_register_tz: notify_monitor_file failed: %u\n", nstat);
+#endif /* NOTIFY_TZ_DEBUG */
+#ifdef NOTIFY_TZ_LOG
+                       NOTIFY_LOG("notify_monitor_file(%s) failed: %u\n", file, nstat);
+#endif /* NOTIFY_TZ_LOG */
+                       return;
+               }
+       }
+       notify_check(p->token, &ncheck);        /* this always returns true */
 }
+#endif /* NOTIFY_TZ */
 
 static int
 tzload(name, sp)
@@ -310,6 +582,9 @@ struct state * const        sp;
        int             i;
        int             fid;
 
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("tzload: name=%s\n", name);
+#endif /* NOTIFY_TZ_DEBUG */
        /* XXX The following is from OpenBSD, and I'm not sure it is correct */
        if (name != NULL && issetugid() != 0)
                if ((name[0] == ':' && name[1] == '/') || 
@@ -327,7 +602,15 @@ struct state * const       sp;
                ** to hold the longest file name string that the implementation
                ** guarantees can be opened."
                */
+#ifdef NOTIFY_TZ
+               if (!fullname) {
+                       fullname = malloc(FILENAME_MAX + 1);
+                       if (!fullname)
+                               return -1;
+               }
+#else /* ! NOTIFY_TZ */
                char            fullname[FILENAME_MAX + 1];
+#endif /* NOTIFY_TZ */
 
                if (name[0] == ':')
                        ++name;
@@ -335,7 +618,11 @@ struct state * const       sp;
                if (!doaccess) {
                        if ((p = TZDIR) == NULL)
                                return -1;
+#ifdef NOTIFY_TZ
+                       if ((strlen(p) + 1 + strlen(name) + 1) >= (FILENAME_MAX + 1))
+#else /* ! NOTIFY_TZ */
                        if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname)
+#endif /* NOTIFY_TZ */
                                return -1;
                        (void) strcpy(fullname, p);
                        (void) strcat(fullname, "/");
@@ -347,6 +634,10 @@ struct state * const       sp;
                                doaccess = TRUE;
                        name = fullname;
                }
+#ifdef NOTIFY_TZ
+               else
+                       strcpy(fullname, name);
+#endif /* NOTIFY_TZ */
                if (doaccess && access(name, R_OK) != 0)
                        return -1;
                if ((fid = _open(name, OPEN_MODE)) == -1)
@@ -365,6 +656,9 @@ struct state * const        sp;
                int             ttisstdcnt;
                int             ttisgmtcnt;
 
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("tzload: reading %s\n", name);
+#endif /* NOTIFY_TZ_DEBUG */
                i = _read(fid, u.buf, sizeof u.buf);
                if (_close(fid) != 0)
                        return -1;
@@ -471,14 +765,24 @@ static const int  year_lengths[2] = {
 */
 
 static const char *
-getzname(strp)
+getzname(strp, name, len)
 const char *   strp;
+char **                name;
+size_t *       len;
 {
        char    c;
+       char *  ket;
 
+       if (*strp == '<' && (ket = strchr(strp, '>')) != NULL) {
+               *name = (char *)(strp + 1);
+               *len = ket - strp - 1;
+               return ket + 1;
+       }
+       *name = (char *)strp;
        while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
                c != '+')
                        ++strp;
+       *len = strp - *name;
        return strp;
 }
 
@@ -758,16 +1062,15 @@ const int                        lastditch;
        int                     load_result;
 
        INITIALIZE(dstname);
-       stdname = name;
        if (lastditch) {
+               stdname = name;
                stdlen = strlen(name);  /* length of standard zone name */
                name += stdlen;
                if (stdlen >= sizeof sp->chars)
                        stdlen = (sizeof sp->chars) - 1;
                stdoffset = 0;
        } else {
-               name = getzname(name);
-               stdlen = name - stdname;
+               name = getzname(name, (char **)&stdname, &stdlen);
                if (stdlen < 3)
                        return -1;
                if (*name == '\0')
@@ -779,12 +1082,14 @@ const int                        lastditch;
                }
        }
        load_result = tzload(TZDEFRULES, sp);
+#ifdef NOTIFY_TZ
+       *fullname = 0;                          /* mark fullname as invalid */
+#endif /* NOTIFY_TZ */
        if (load_result != 0)
                sp->leapcnt = 0;                /* so, we're off a little */
        if (*name != '\0') {
                dstname = name;
-               name = getzname(name);
-               dstlen = name - dstname;        /* length of DST zone name */
+               name = getzname(name, (char **)&dstname, &dstlen);
                if (dstlen < 3)
                        return -1;
                if (*name != '\0' && *name != ',' && *name != ';') {
@@ -966,13 +1271,37 @@ struct state * const     sp;
 static void
 tzsetwall_basic(int rdlocked)
 {
+#ifdef NOTIFY_TZ
+       notify_check_tz(&lcl_notify);
+#else
+    if (TZDEFAULT) {
+        static struct timespec last_mtimespec = {0, 0};
+        struct stat statbuf;
+
+        if (lstat(TZDEFAULT, &statbuf) == 0) {
+            if (statbuf.st_mtimespec.tv_sec > last_mtimespec.tv_sec ||
+                (statbuf.st_mtimespec.tv_sec == last_mtimespec.tv_sec &&
+                 statbuf.st_mtimespec.tv_nsec > last_mtimespec.tv_nsec)) {
+               /* Trigger resetting the local TZ */
+                    lcl_is_set = 0;
+            }
+            last_mtimespec = statbuf.st_mtimespec;
+        }
+    }
+#endif /* NOTIFY_TZ */
        if (!rdlocked)
                _RWLOCK_RDLOCK(&lcl_rwlock);
        if (lcl_is_set < 0) {
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("tzsetwall_basic lcl_is_set < 0\n");
+#endif
                if (!rdlocked)
                        _RWLOCK_UNLOCK(&lcl_rwlock);
                return;
        }
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("tzsetwall_basic not set\n");
+#endif
        _RWLOCK_UNLOCK(&lcl_rwlock);
 
        _RWLOCK_WRLOCK(&lcl_rwlock);
@@ -992,6 +1321,9 @@ tzsetwall_basic(int rdlocked)
 #endif /* defined ALL_STATE */
        if (tzload((char *) NULL, lclptr) != 0)
                gmtload(lclptr);
+#ifdef NOTIFY_TZ
+       notify_register_tz(fullname, &lcl_notify);
+#endif /* NOTIFY_TZ */
        settzname();
        _RWLOCK_UNLOCK(&lcl_rwlock);
 
@@ -1002,10 +1334,13 @@ tzsetwall_basic(int rdlocked)
 void
 tzsetwall(void)
 {
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("tzsetwall called\n");
+#endif /* NOTIFY_TZ_DEBUG */
        tzsetwall_basic(0);
 }
 
-static void
+__private_extern__ void
 tzset_basic(int rdlocked)
 {
        const char *    name;
@@ -1016,11 +1351,17 @@ tzset_basic(int rdlocked)
                return;
        }
 
+#ifdef NOTIFY_TZ
+       notify_check_tz(&lcl_notify);
+#endif /* NOTIFY_TZ */
        if (!rdlocked)
                _RWLOCK_RDLOCK(&lcl_rwlock);
        if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) {
                if (!rdlocked)
                        _RWLOCK_UNLOCK(&lcl_rwlock);
+#ifdef NOTIFY_TZ_DEBUG
+               NOTIFY_TZ_PRINTF("tzset_basic matched %s\n", lcl_TZname);
+#endif
                return;
        }
        _RWLOCK_UNLOCK(&lcl_rwlock);
@@ -1053,9 +1394,16 @@ tzset_basic(int rdlocked)
                lclptr->ttis[0].tt_gmtoff = 0;
                lclptr->ttis[0].tt_abbrind = 0;
                (void) strcpy(lclptr->chars, gmt);
+#ifdef NOTIFY_TZ
+               if (fullname)
+                       *fullname = 0;
+#endif /* NOTIFY_TZ */
        } else if (tzload(name, lclptr) != 0)
                if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
                        (void) gmtload(lclptr);
+#ifdef NOTIFY_TZ
+       notify_register_tz(fullname, &lcl_notify);
+#endif /* NOTIFY_TZ */
        settzname();
        _RWLOCK_UNLOCK(&lcl_rwlock);
 
@@ -1066,6 +1414,9 @@ tzset_basic(int rdlocked)
 void
 tzset(void)
 {
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("tzset called TZ=%s\n", getenv("TZ"));
+#endif /* NOTIFY_TZ_DEBUG */
        tzset_basic(0);
 }
 
@@ -1079,7 +1430,11 @@ tzset(void)
 */
 
 /*ARGSUSED*/
-static void
+#ifdef __LP64__
+__private_extern__ struct tm *
+#else /* !__LP64__ */
+__private_extern__ void
+#endif /* __LP64__ */
 localsub(timep, offset, tmp)
 const time_t * const   timep;
 const long             offset;
@@ -1090,11 +1445,18 @@ struct tm * const       tmp;
        int                     i;
        const time_t                    t = *timep;
 
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("localsub called\n");
+#endif /* NOTIFY_TZ_DEBUG */
        sp = lclptr;
 #ifdef ALL_STATE
        if (sp == NULL) {
+#ifdef __LP64__
+               return gmtsub(timep, offset, tmp);
+#else /* !__LP64__ */
                gmtsub(timep, offset, tmp);
                return;
+#endif /* __LP64__ */
        }
 #endif /* defined ALL_STATE */
        if (sp->timecnt == 0 || t < sp->ats[0]) {
@@ -1117,12 +1479,20 @@ struct tm * const       tmp;
        **      t += ttisp->tt_gmtoff;
        **      timesub(&t, 0L, sp, tmp);
        */
+#ifdef __LP64__
+       if (timesub(&t, ttisp->tt_gmtoff, sp, tmp) == NULL)
+               return NULL;
+#else /* !__LP64__ */
        timesub(&t, ttisp->tt_gmtoff, sp, tmp);
+#endif /* __LP64__ */
        tmp->tm_isdst = ttisp->tt_isdst;
        tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
 #ifdef TM_ZONE
        tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
 #endif /* defined TM_ZONE */
+#ifdef __LP64__
+       return tmp;
+#endif /* __LP64__ */
 }
 
 struct tm *
@@ -1134,10 +1504,11 @@ const time_t * const    timep;
        struct tm *p_tm;
 
        if (__isthreaded != 0) {
-               if (localtime_key < 0) {
+               if (localtime_key == (pthread_key_t)-1) {
                        _pthread_mutex_lock(&localtime_mutex);
-                       if (localtime_key < 0) {
-                               if (_pthread_key_create(&localtime_key, free) < 0) {
+                       if (localtime_key == (pthread_key_t)-1) {
+                               localtime_key = __LIBC_PTHREAD_KEY_LOCALTIME;
+                               if (pthread_key_init_np(localtime_key, free) < 0) {
                                        _pthread_mutex_unlock(&localtime_mutex);
                                        return(NULL);
                                }
@@ -1153,13 +1524,21 @@ const time_t * const    timep;
                }
                _RWLOCK_RDLOCK(&lcl_rwlock);
                tzset_basic(1);
+#ifdef __LP64__
+               p_tm = localsub(timep, 0L, p_tm);
+#else /* !__LP64__ */
                localsub(timep, 0L, p_tm);
+#endif /* __LP64__ */
                _RWLOCK_UNLOCK(&lcl_rwlock);
                return(p_tm);
        } else {
                tzset_basic(0);
+#ifdef __LP64__
+               return localsub(timep, 0L, &tm);
+#else /* !__LP64__ */
                localsub(timep, 0L, &tm);
                return(&tm);
+#endif /* __LP64__ */
        }
 }
 
@@ -1168,13 +1547,15 @@ const time_t * const    timep;
 */
 
 struct tm *
-localtime_r(timep, tm)
-const time_t * const   timep;
-struct tm *            tm;
+localtime_r(const time_t * const __restrict timep, struct tm * __restrict tm)
 {
        _RWLOCK_RDLOCK(&lcl_rwlock);
        tzset_basic(1);
+#ifdef __LP64__
+       tm = localsub(timep, 0L, tm);
+#else /* !__LP64__ */
        localsub(timep, 0L, tm);
+#endif /* __LP64__ */
        _RWLOCK_UNLOCK(&lcl_rwlock);
        return tm;
 }
@@ -1183,25 +1564,52 @@ struct tm *             tm;
 ** gmtsub is to gmtime as localsub is to localtime.
 */
 
+#ifdef __LP64__
+static struct tm *
+#else /* !__LP64__ */
 static void
+#endif /* __LP64__ */
 gmtsub(timep, offset, tmp)
 const time_t * const   timep;
 const long             offset;
 struct tm * const      tmp;
 {
+#ifdef NOTIFY_TZ_DEBUG
+       NOTIFY_TZ_PRINTF("gmtsub called\n");
+#endif /* NOTIFY_TZ_DEBUG */
+#ifdef NOTIFY_TZ
+       notify_check_tz(&gmt_notify);
+#endif /* NOTIFY_TZ */
        if (!gmt_is_set) {
                _MUTEX_LOCK(&gmt_mutex);
                if (!gmt_is_set) {
 #ifdef ALL_STATE
-                       gmtptr = (struct state *) malloc(sizeof *gmtptr);
+#ifdef NOTIFY_TZ
+                       if (gmtptr == NULL)
+#endif /* NOTIFY_TZ */
+                               gmtptr = (struct state *) malloc(sizeof *gmtptr);
                        if (gmtptr != NULL)
+#ifdef NOTIFY_TZ
+                       {
+#endif /* NOTIFY_TZ */
 #endif /* defined ALL_STATE */
                                gmtload(gmtptr);
+#ifdef NOTIFY_TZ
+                               notify_register_tz(fullname, &gmt_notify);
+#ifdef ALL_STATE
+                       }
+#endif
+#endif /* NOTIFY_TZ */
                        gmt_is_set = TRUE;
                }
                _MUTEX_UNLOCK(&gmt_mutex);
        }
+#ifdef __LP64__
+       if(timesub(timep, offset, gmtptr, tmp) == NULL)
+               return NULL;
+#else /* !__LP64__ */
        timesub(timep, offset, gmtptr, tmp);
+#endif /* __LP64__ */
 #ifdef TM_ZONE
        /*
        ** Could get fancy here and deliver something such as
@@ -1213,7 +1621,7 @@ struct tm * const tmp;
        else {
 #ifdef ALL_STATE
                if (gmtptr == NULL)
-                       tmp->TM_ZONE = gmt;
+                       tmp->TM_ZONE = (char *)gmt;
                else    tmp->TM_ZONE = gmtptr->chars;
 #endif /* defined ALL_STATE */
 #ifndef ALL_STATE
@@ -1221,6 +1629,9 @@ struct tm * const tmp;
 #endif /* State Farm */
        }
 #endif /* defined TM_ZONE */
+#ifdef __LP64__
+       return tmp;
+#endif /* __LP64__ */
 }
 
 struct tm *
@@ -1232,10 +1643,11 @@ const time_t * const    timep;
        struct tm *p_tm;
 
        if (__isthreaded != 0) {
-               if (gmtime_key < 0) {
+               if (gmtime_key == (pthread_key_t)-1) {
                        _pthread_mutex_lock(&gmtime_mutex);
-                       if (gmtime_key < 0) {
-                               if (_pthread_key_create(&gmtime_key, free) < 0) {
+                       if (gmtime_key == (pthread_key_t)-1) {
+                               gmtime_key = __LIBC_PTHREAD_KEY_GMTIME;
+                               if (pthread_key_init_np(gmtime_key, free) < 0) {
                                        _pthread_mutex_unlock(&gmtime_mutex);
                                        return(NULL);
                                }
@@ -1253,12 +1665,20 @@ const time_t * const    timep;
                        }
                        _pthread_setspecific(gmtime_key, p_tm);
                }
+#ifdef __LP64__
+               return gmtsub(timep, 0L, p_tm);
+#else /* !__LP64__ */
                gmtsub(timep, 0L, p_tm);
                return(p_tm);
+#endif /* __LP64__ */
        }
        else {
+#ifdef __LP64__
+               return gmtsub(timep, 0L, &tm);
+#else /* !__LP64__ */
                gmtsub(timep, 0L, &tm);
                return(&tm);
+#endif /* __LP64__ */
        }
 }
 
@@ -1271,8 +1691,13 @@ gmtime_r(timep, tm)
 const time_t * const   timep;
 struct tm *            tm;
 {
+
+#ifdef __LP64__
+       return gmtsub(timep, 0L, tm);
+#else /* !__LP64__ */
        gmtsub(timep, 0L, tm);
        return tm;
+#endif /* __LP64__ */
 }
 
 #ifdef STD_INSPIRED
@@ -1282,13 +1707,21 @@ offtime(timep, offset)
 const time_t * const   timep;
 const long             offset;
 {
+#ifdef __LP64__
+       return gmtsub(timep, offset, &tm);
+#else /* !__LP64__ */
        gmtsub(timep, offset, &tm);
        return &tm;
+#endif /* __LP64__ */
 }
 
 #endif /* defined STD_INSPIRED */
 
+#ifdef __LP64__
+static struct tm *
+#else /* !__LP64__ */
 static void
+#endif /* __LP64__ */
 timesub(timep, offset, sp, tmp)
 const time_t * const                   timep;
 const long                             offset;
@@ -1365,7 +1798,12 @@ struct tm * const                tmp;
        if (tmp->tm_wday < 0)
                tmp->tm_wday += DAYSPERWEEK;
        y = EPOCH_YEAR;
-#define LEAPS_THRU_END_OF(y)   ((y) / 4 - (y) / 100 + (y) / 400)
+#define _LEAPS_THRU_END_OF(y)  ((y) / 4 - (y) / 100 + (y) / 400)
+#ifdef __LP64__
+#define LEAPS_THRU_END_OF(y)   ((y) >= 0 ? _LEAPS_THRU_END_OF(y) : _LEAPS_THRU_END_OF((y) + 1) - 1)
+#else /* !__LP64__ */
+#define LEAPS_THRU_END_OF(y)   _LEAPS_THRU_END_OF(y)
+#endif /* __LP64__ */
        while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) {
                long    newy;
 
@@ -1377,7 +1815,16 @@ struct tm * const                tmp;
                        LEAPS_THRU_END_OF(y - 1);
                y = newy;
        }
+#ifdef __LP64__
+       y -= TM_YEAR_BASE;
+       if (y < INT_MIN || y > INT_MAX) {
+               errno = EOVERFLOW;
+               return NULL;
+       }
+       tmp->tm_year = y;
+#else /* !__LP64__ */
        tmp->tm_year = y - TM_YEAR_BASE;
+#endif /* __LP64__ */
        tmp->tm_yday = (int) days;
        ip = mon_lengths[yleap];
        for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
@@ -1387,6 +1834,9 @@ struct tm * const         tmp;
 #ifdef TM_GMTOFF
        tmp->TM_GMTOFF = offset;
 #endif /* defined TM_GMTOFF */
+#ifdef __LP64__
+       return tmp;
+#endif /* __LP64__ */
 }
 
 char *
@@ -1399,7 +1849,20 @@ const time_t * const     timep;
 **     to local time in the form of a string.  It is equivalent to
 **             asctime(localtime(timer))
 */
+#ifdef __LP64__
+       /*
+        * In 64-bit, the timep value may produce a time value with a year
+        * that exceeds 32-bits in size (won't fit in struct tm), so localtime
+        * will return NULL.
+        */
+       struct tm *tm = localtime(timep);
+
+       if (tm == NULL)
+               return NULL;
+       return asctime(tm);
+#else /* !__LP64__ */
        return asctime(localtime(timep));
+#endif /* __LP64__ */
 }
 
 char *
@@ -1409,7 +1872,18 @@ char *                   buf;
 {
        struct tm       tm;
 
+#ifdef __LP64__
+       /*
+        * In 64-bit, the timep value may produce a time value with a year
+        * that exceeds 32-bits in size (won't fit in struct tm), so localtime_r
+        * will return NULL.
+        */
+       if (localtime_r(timep, &tm) == NULL)
+               return NULL;
+       return asctime_r(&tm, buf);
+#else /* !__LP64__ */
        return asctime_r(localtime_r(timep, &tm), buf);
+#endif /* __LP64__ */
 }
 
 /*
@@ -1464,8 +1938,14 @@ const struct tm * const btmp;
 {
        int     result;
 
-       if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
-               (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
+       /*
+        * Assume that atmp and btmp point to normalized tm strutures.
+        * So only arithmetic with tm_year could overflow in 64-bit.
+        */
+       if (atmp->tm_year != btmp->tm_year) {
+               return (atmp->tm_year > btmp->tm_year ? 1 : -1);
+       }
+       if ((result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
                (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
                (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
                (result = (atmp->tm_min - btmp->tm_min)) == 0)
@@ -1474,12 +1954,17 @@ const struct tm * const btmp;
 }
 
 static time_t
-time2sub(tmp, funcp, offset, okayp, do_norm_secs)
+time2sub(tmp, funcp, offset, okayp, do_norm_secs, unix03)
 struct tm * const      tmp;
+#ifdef __LP64__
+struct tm *(* const    funcp)(const time_t*, long, struct tm*);
+#else /* !__LP64__ */
 void (* const          funcp)(const time_t*, long, struct tm*);
+#endif /* __LP64__ */
 const long             offset;
 int * const            okayp;
 const int              do_norm_secs;
+int                    unix03;
 {
        const struct state *    sp;
        int                     dir;
@@ -1489,6 +1974,9 @@ const int         do_norm_secs;
        time_t                          newt;
        time_t                          t;
        struct tm                       yourtm, mytm;
+#ifdef __LP64__
+       long                            year, il;
+#endif /* __LP64__ */
 
        *okayp = FALSE;
        yourtm = *tmp;
@@ -1507,33 +1995,64 @@ const int               do_norm_secs;
        ** Turn yourtm.tm_year into an actual year number for now.
        ** It is converted back to an offset from TM_YEAR_BASE later.
        */
+#ifdef __LP64__
+       year = (long)yourtm.tm_year + TM_YEAR_BASE;
+#else /* !__LP64__ */
        if (increment_overflow(&yourtm.tm_year, TM_YEAR_BASE))
                return WRONG;
+#endif /* __LP64__ */
        while (yourtm.tm_mday <= 0) {
+#ifdef __LP64__
+               year--;
+               il = year + (1 < yourtm.tm_mon);
+               yourtm.tm_mday += year_lengths[isleap(il)];
+#else /* !__LP64__ */
                if (increment_overflow(&yourtm.tm_year, -1))
                        return WRONG;
                i = yourtm.tm_year + (1 < yourtm.tm_mon);
                yourtm.tm_mday += year_lengths[isleap(i)];
+#endif /* __LP64__ */
        }
        while (yourtm.tm_mday > DAYSPERLYEAR) {
+#ifdef __LP64__
+               il = year + (1 < yourtm.tm_mon);
+               yourtm.tm_mday -= year_lengths[isleap(il)];
+               year++;
+#else /* !__LP64__ */
                i = yourtm.tm_year + (1 < yourtm.tm_mon);
                yourtm.tm_mday -= year_lengths[isleap(i)];
                if (increment_overflow(&yourtm.tm_year, 1))
                        return WRONG;
+#endif /* __LP64__ */
        }
        for ( ; ; ) {
+#ifdef __LP64__
+               i = mon_lengths[isleap(year)][yourtm.tm_mon];
+#else /* !__LP64__ */
                i = mon_lengths[isleap(yourtm.tm_year)][yourtm.tm_mon];
+#endif /* __LP64__ */
                if (yourtm.tm_mday <= i)
                        break;
                yourtm.tm_mday -= i;
                if (++yourtm.tm_mon >= MONSPERYEAR) {
                        yourtm.tm_mon = 0;
+#ifdef __LP64__
+                       year++;
+#else /* !__LP64__ */
                        if (increment_overflow(&yourtm.tm_year, 1))
                                return WRONG;
+#endif /* __LP64__ */
                }
        }
+#ifdef __LP64__
+       year -= TM_YEAR_BASE;
+       if (year > INT_MAX || year < INT_MIN)
+               return WRONG;
+       yourtm.tm_year = year;
+#else /* !__LP64__ */
        if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE))
                return WRONG;
+#endif /* __LP64__ */
        /* Don't go below 1900 for POLA */
        if (yourtm.tm_year < 0)
                return WRONG;
@@ -1560,13 +2079,21 @@ const int               do_norm_secs;
        ** Divide the search space in half
        ** (this works whether time_t is signed or unsigned).
        */
+#ifdef __LP64__
+       /* optimization: see if the value is 31-bit (signed) */
+       t = (((time_t) 1) << (TYPE_BIT(int) - 1)) - 1;
+       bits = ((*funcp)(&t, offset, &mytm) == NULL || tmcomp(&mytm, &yourtm) < 0) ? TYPE_BIT(time_t) - 1 : TYPE_BIT(int) - 1;
+#else /* !__LP64__ */
        bits = TYPE_BIT(time_t) - 1;
+#endif /* __LP64__ */
        /*
-       ** If we have more than this, we will overflow tm_year for tmcomp().
-       ** We should really return an error if we cannot represent it.
+       ** In 64-bit, we now return an error if we cannot represent the
+       ** struct tm value in a time_t.  And tmcomp() is fixed to avoid
+       ** overflow in tm_year.  So we only put a cap on bits because time_t
+       ** can't be larger that 56 bit (when tm_year == INT_MAX).
        */
-       if (bits > 48)
-               bits = 48;
+       if (bits > 56)
+               bits = 56;
        /*
        ** If time_t is signed, then 0 is just above the median,
        ** assuming two's complement arithmetic.
@@ -1574,8 +2101,19 @@ const int                do_norm_secs;
        */
        t = TYPE_SIGNED(time_t) ? 0 : (((time_t) 1) << bits);
        for ( ; ; ) {
+#ifdef __LP64__
+               if ((*funcp)(&t, offset, &mytm) == NULL) {
+                   /* we overflowed, so t is too big */
+                   dir = 1;
+                   goto skip_tmcomp;
+               }
+#else /* !__LP64__ */
                (*funcp)(&t, offset, &mytm);
+#endif /* __LP64__ */
                dir = tmcomp(&mytm, &yourtm);
+#ifdef __LP64__
+skip_tmcomp:
+#endif /* __LP64__ */
                if (dir != 0) {
                        if (bits-- < 0)
                                return WRONG;
@@ -1586,6 +2124,9 @@ const int         do_norm_secs;
                        else    t += ((time_t) 1) << bits;
                        continue;
                }
+               sp = (funcp == localsub) ? lclptr : gmtptr;
+               if (unix03 && sp->typecnt == 1 && yourtm.tm_isdst > 0) 
+                       yourtm.tm_isdst = 0; /* alternative time does not apply */
                if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
                        break;
                /*
@@ -1594,7 +2135,6 @@ const int         do_norm_secs;
                ** It's okay to guess wrong since the guess
                ** gets checked.
                */
-               sp = (funcp == localsub) ? lclptr : gmtptr;
 #ifdef ALL_STATE
                if (sp == NULL)
                        return WRONG;
@@ -1607,7 +2147,12 @@ const int                do_norm_secs;
                                        continue;
                                newt = t + sp->ttis[j].tt_gmtoff -
                                        sp->ttis[i].tt_gmtoff;
+#ifdef __LP64__
+                               if ((*funcp)(&newt, offset, &mytm) == NULL)
+                                       return WRONG;
+#else /* !__LP64__ */
                                (*funcp)(&newt, offset, &mytm);
+#endif /* __LP64__ */
                                if (tmcomp(&mytm, &yourtm) != 0)
                                        continue;
                                if (mytm.tm_isdst != yourtm.tm_isdst)
@@ -1626,17 +2171,27 @@ label:
        if ((newt < t) != (saved_seconds < 0))
                return WRONG;
        t = newt;
+#ifdef __LP64__
+       if ((*funcp)(&t, offset, tmp) == NULL)
+               return WRONG;
+#else /* !__LP64__ */
        (*funcp)(&t, offset, tmp);
+#endif /* __LP64__ */
        *okayp = TRUE;
        return t;
 }
 
 static time_t
-time2(tmp, funcp, offset, okayp)
+time2(tmp, funcp, offset, okayp, unix03)
 struct tm * const      tmp;
+#ifdef __LP64__
+struct tm *(* const    funcp)(const time_t*, long, struct tm*);
+#else /* !__LP64__ */
 void (* const          funcp)(const time_t*, long, struct tm*);
+#endif /* __LP64__ */
 const long             offset;
 int * const            okayp;
+int                    unix03;
 {
        time_t  t;
 
@@ -1645,15 +2200,20 @@ int * const             okayp;
        ** (in case tm_sec contains a value associated with a leap second).
        ** If that fails, try with normalization of seconds.
        */
-       t = time2sub(tmp, funcp, offset, okayp, FALSE);
-       return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
+       t = time2sub(tmp, funcp, offset, okayp, FALSE, unix03);
+       return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE, unix03);
 }
 
-static time_t
-time1(tmp, funcp, offset)
+__private_extern__ time_t
+time1(tmp, funcp, offset, unix03)
 struct tm * const      tmp;
+#ifdef __LP64__
+struct tm *(* const    funcp)(const time_t *, long, struct tm *);
+#else /* !__LP64__ */
 void (* const          funcp)(const time_t *, long, struct tm *);
+#endif /* __LP64__ */
 const long             offset;
+int                    unix03;
 {
        time_t                  t;
        const struct state *    sp;
@@ -1667,7 +2227,7 @@ const long                offset;
 
        if (tmp->tm_isdst > 1)
                tmp->tm_isdst = 1;
-       t = time2(tmp, funcp, offset, &okay);
+       t = time2(tmp, funcp, offset, &okay, unix03);
 #ifdef PCTS
        /*
        ** PCTS code courtesy Grant Sullivan (grant@osf.org).
@@ -1711,7 +2271,7 @@ const long                offset;
                        tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
                                        sp->ttis[samei].tt_gmtoff;
                        tmp->tm_isdst = !tmp->tm_isdst;
-                       t = time2(tmp, funcp, offset, &okay);
+                       t = time2(tmp, funcp, offset, &okay, unix03);
                        if (okay)
                                return t;
                        tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
@@ -1721,19 +2281,25 @@ const long              offset;
        }
        return WRONG;
 }
+#else  /* BUILDING_VARIANT */
+__private_extern__ pthread_rwlock_t    lcl_rwlock;
+#endif /* BUILDING_VARIANT */
 
 time_t
 mktime(tmp)
 struct tm * const      tmp;
 {
        time_t mktime_return_value;
+       int serrno = errno;
        _RWLOCK_RDLOCK(&lcl_rwlock);
        tzset_basic(1);
-       mktime_return_value = time1(tmp, localsub, 0L);
+       mktime_return_value = time1(tmp, localsub, 0L, __DARWIN_UNIX03);
        _RWLOCK_UNLOCK(&lcl_rwlock);
+       errno = serrno;
        return(mktime_return_value);
 }
 
+#if !BUILDING_VARIANT
 #ifdef STD_INSPIRED
 
 time_t
@@ -1749,7 +2315,7 @@ timegm(tmp)
 struct tm * const      tmp;
 {
        tmp->tm_isdst = 0;
-       return time1(tmp, gmtsub, 0L);
+       return time1(tmp, gmtsub, 0L, __DARWIN_UNIX03);
 }
 
 time_t
@@ -1758,7 +2324,7 @@ struct tm * const tmp;
 const long             offset;
 {
        tmp->tm_isdst = 0;
-       return time1(tmp, gmtsub, offset);
+       return time1(tmp, gmtsub, offset, __DARWIN_UNIX03);
 }
 
 #endif /* defined STD_INSPIRED */
@@ -1858,3 +2424,4 @@ time_t    t;
 }
 
 #endif /* defined STD_INSPIRED */
+#endif /* !BUILDING_VARIANT */
diff --git a/stdtime/FreeBSD/localtime.c.patch b/stdtime/FreeBSD/localtime.c.patch
deleted file mode 100644 (file)
index 67e338f..0000000
+++ /dev/null
@@ -1,1309 +0,0 @@
---- localtime.c.orig   2011-05-02 23:14:13.000000000 -0700
-+++ localtime.c        2011-05-03 17:12:02.000000000 -0700
-@@ -22,8 +22,22 @@ __FBSDID("$FreeBSD: src/lib/libc/stdtime
- #include "namespace.h"
- #include <sys/types.h>
- #include <sys/stat.h>
-+#include <time.h>
- #include <fcntl.h>
- #include <pthread.h>
-+#include <errno.h>
-+#ifdef NOTIFY_TZ
-+//#define NOTIFY_TZ_DEBUG
-+//#define NOTIFY_TZ_DEBUG_FILE        "/var/log/localtime.debug"
-+//#define NOTIFY_TZ_LOG       "/var/log/localtime.log"
-+/* force ALL_STATE if NOTIFY_TZ is set */
-+#ifndef ALL_STATE
-+#define ALL_STATE
-+#endif /* ALL_STATE */
-+#include <mach/mach_init.h>
-+#include <notify.h>
-+#include <alloca.h>
-+#endif /* NOTIFY_TZ */
- #include "private.h"
- #include "un-namespace.h"
-@@ -150,40 +164,94 @@ struct rule {
- #define DAY_OF_YEAR           1       /* n - day of year */
- #define MONTH_NTH_DAY_OF_WEEK 2       /* Mm.n.d - month, week, day of week */
-+#ifdef NOTIFY_TZ
-+typedef struct {
-+      int token;
-+      int notify_was_off;
-+      int is_set;
-+} notify_tz_t;
-+
-+#define NOTIFY_TZ_NAME                "com.apple.system.timezone"
-+#endif /* NOTIFY_TZ */
-+
- /*
- ** Prototypes for static functions.
- */
-+#define       localsub        _st_localsub
-+#define       time1           _st_time1
-+#define       tzset_basic     _st_tzset_basic
-+__private_extern__
-+#ifdef __LP64__
-+struct tm *           localsub(const time_t * timep, long offset,
-+                              struct tm * tmp);
-+#else /* !__LP64__ */
-+void                  localsub(const time_t * timep, long offset,
-+                              struct tm * tmp);
-+#endif /* __LP64__ */
-+__private_extern__
-+time_t                        time1(struct tm * tmp,
-+#ifdef __LP64__
-+                              struct tm *(*funcp) (const time_t *,
-+                              long, struct tm *),
-+#else /* !__LP64__ */
-+                              void(*funcp) (const time_t *,
-+                              long, struct tm *),
-+#endif /* __LP64__ */
-+                              long offset,
-+                              int unix03);
-+__private_extern__
-+void                  tzset_basic(int);
-+#if !BUILDING_VARIANT
- static long           detzcode(const char * codep);
--static const char *   getzname(const char * strp);
-+static const char *   getzname(const char * strp, char **name, size_t *len);
- static const char *   getnum(const char * strp, int * nump, int min,
-                               int max);
- static const char *   getsecs(const char * strp, long * secsp);
- static const char *   getoffset(const char * strp, long * offsetp);
- static const char *   getrule(const char * strp, struct rule * rulep);
- static void           gmtload(struct state * sp);
--static void           gmtsub(const time_t * timep, long offset,
-+#ifdef __LP64__
-+static struct tm *    gmtsub(const time_t * timep, long offset,
-                               struct tm * tmp);
--static void           localsub(const time_t * timep, long offset,
-+#else /* !__LP64__ */
-+static void           gmtsub(const time_t * timep, long offset,
-                               struct tm * tmp);
-+#endif /* __LP64__ */
- static int            increment_overflow(int * number, int delta);
- static int            normalize_overflow(int * tensptr, int * unitsptr,
-                               int base);
-+#ifdef NOTIFY_TZ
-+static void           notify_check_tz(notify_tz_t *p);
-+static void           notify_register_tz(char *file, notify_tz_t *p);
-+#endif /* NOTIFY_TZ */
- static void           settzname(void);
--static time_t         time1(struct tm * tmp,
--                              void(*funcp) (const time_t *,
--                              long, struct tm *),
--                              long offset);
- static time_t         time2(struct tm *tmp,
-+#ifdef __LP64__
-+                              struct tm *(*funcp) (const time_t *,
-+                              long, struct tm*),
-+#else /* !__LP64__ */
-                               void(*funcp) (const time_t *,
-                               long, struct tm*),
--                              long offset, int * okayp);
-+#endif /* __LP64__ */
-+                              long offset, int * okayp, int unix03);
- static time_t         time2sub(struct tm *tmp,
-+#ifdef __LP64__
-+                              struct tm *(*funcp) (const time_t *,
-+                              long, struct tm*),
-+#else /* !__LP64__ */
-                               void(*funcp) (const time_t *,
-                               long, struct tm*),
--                              long offset, int * okayp, int do_norm_secs);
-+#endif /* __LP64__ */
-+                              long offset, int * okayp, int do_norm_secs,
-+                              int unix03);
-+#ifdef __LP64__
-+static struct tm *    timesub(const time_t * timep, long offset,
-+                              const struct state * sp, struct tm * tmp);
-+#else /* !__LP64__ */
- static void           timesub(const time_t * timep, long offset,
-                               const struct state * sp, struct tm * tmp);
-+#endif /* __LP64__ */
- static int            tmcomp(const struct tm * atmp,
-                               const struct tm * btmp);
- static time_t         transtime(time_t janfirst, int year,
-@@ -209,9 +277,14 @@ static struct state       gmtmem;
- #endif /* !defined TZ_STRLEN_MAX */
- static char           lcl_TZname[TZ_STRLEN_MAX + 1];
-+#ifdef NOTIFY_TZ
-+#define lcl_is_set    (lcl_notify.is_set)
-+#define gmt_is_set    (gmt_notify.is_set)
-+#else /* ! NOTIFY_TZ */
- static int            lcl_is_set;
- static int            gmt_is_set;
--static pthread_rwlock_t       lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
-+#endif /* NOTIFY_TZ */
-+__private_extern__ pthread_rwlock_t   lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
- static pthread_mutex_t        gmt_mutex = PTHREAD_MUTEX_INITIALIZER;
- char *                        tzname[2] = {
-@@ -229,15 +302,62 @@ char *                   tzname[2] = {
- static struct tm      tm;
-+#define USG_COMPAT
-+#define ALTZONE
- #ifdef USG_COMPAT
--time_t                        timezone = 0;
- int                   daylight = 0;
-+__private_extern__ void _st_set_timezone(long);
- #endif /* defined USG_COMPAT */
- #ifdef ALTZONE
--time_t                        altzone = 0;
-+__private_extern__ long               __darwin_altzone = 0;
-+#define altzone __darwin_altzone
- #endif /* defined ALTZONE */
-+#ifdef NOTIFY_TZ
-+#ifdef NOTIFY_TZ_DEBUG
-+#ifdef NOTIFY_TZ_DEBUG_FILE
-+#define NOTIFY_TZ_PRINTF(fmt, args...)        \
-+{ \
-+      FILE *_notify_tz_fp_; \
-+      if((_notify_tz_fp_ = fopen(NOTIFY_TZ_DEBUG_FILE, "a")) != NULL) { \
-+              fprintf(_notify_tz_fp_, "%d: " fmt, getpid(), ## args); \
-+              fclose(_notify_tz_fp_); \
-+      } \
-+}
-+#else /* ! NOTIFY_TZ_DEBUG_FILE */
-+#define NOTIFY_TZ_PRINTF(args...)     fprintf(stdout, ## args)
-+#endif /* NOTIFY_TZ_DEBUG_FILE */
-+#endif /* NOTIFY_TZ_DEBUG */
-+#ifdef NOTIFY_TZ_LOG
-+#define NOTIFY_LOG(fmt, args...)      \
-+{ \
-+      FILE *_notify_log_fp_; \
-+      if((_notify_log_fp_ = fopen(NOTIFY_TZ_LOG, "a")) != NULL) { \
-+              fprintf(_notify_log_fp_, "%d: " fmt, getpid(), ## args); \
-+              fclose(_notify_log_fp_); \
-+      } \
-+}
-+#endif /* NOTIFY_TZ_LOG */
-+/*--------------------------------------------------------------------
-+ * __notify_78945668_info__ is a global variable (defined in Libnotify)
-+ * that can be used to disable the notify mechanism.  Set to a negative
-+ * value to disable.  It can then be set back to zero to re-enable.
-+ *-------------------------------------------------------------------- */
-+extern int            __notify_78945668_info__;
-+
-+/*--------------------------------------------------------------------
-+ * fullname is used to pass the actual path of the timezone file to the
-+ * notify routines.  If it is a nil string, that means no timezone file
-+ * is being used.
-+ *-------------------------------------------------------------------- */
-+static char *         fullname = NULL;
-+
-+static notify_tz_t    gmt_notify = {-1, 0, 0};
-+static notify_tz_t    lcl_notify = {-1, 0, 0};
-+static char           notify_tz_name[] = NOTIFY_TZ_NAME;
-+#endif /* NOTIFY_TZ */
-+
- static long
- detzcode(codep)
- const char * const    codep;
-@@ -255,51 +375,203 @@ static void
- settzname(void)
- {
-       struct state *  sp = lclptr;
--      int                     i;
-+      int                     i, need;
-+      unsigned char * types;
-+#define NEED_STD      1
-+#define NEED_DST      2
-+#define NEED_DAYLIGHT 4
-+#define NEED_ALL      (NEED_STD | NEED_DST | NEED_DAYLIGHT)
-       tzname[0] = wildabbr;
-       tzname[1] = wildabbr;
- #ifdef USG_COMPAT
-       daylight = 0;
--      timezone = 0;
-+      _st_set_timezone(0);
- #endif /* defined USG_COMPAT */
- #ifdef ALTZONE
-       altzone = 0;
- #endif /* defined ALTZONE */
- #ifdef ALL_STATE
-       if (sp == NULL) {
--              tzname[0] = tzname[1] = gmt;
-+              tzname[0] = tzname[1] = (char *)gmt;
-               return;
-       }
- #endif /* defined ALL_STATE */
--      for (i = 0; i < sp->typecnt; ++i) {
--              const struct ttinfo * const     ttisp = &sp->ttis[i];
-+      /*
-+       * PR-3765457: The original settzname went sequentially through the ttis
-+       * array, rather than correctly indexing via the types array, to get
-+       * the real order of the timezone changes.  In addition, as a speed up,
-+       * we start at the end of the changes, and work back, so that most of
-+       * the time, we don't have to look through the entire array.
-+       */
-+      if (sp->timecnt == 0 && sp->typecnt == 1) {
-+              /*
-+               * Unfortunately, there is an edge case when typecnt == 1 and
-+               * timecnt == 0, which would cause the loop to never run.  So
-+               * in that case, we fudge things up so that it is as if
-+               * timecnt == 1.
-+               */
-+              i = 0;
-+              types = (unsigned char *)""; /* we use the null as index */
-+      } else {
-+              /* the usual case */
-+              i = sp->timecnt - 1;
-+              types = sp->types;
-+      }
-+      need = NEED_ALL;
-+      for (; i >= 0 && need; --i) {
-+              const struct ttinfo * const     ttisp = &sp->ttis[types[i]];
--              tzname[ttisp->tt_isdst] =
--                      &sp->chars[ttisp->tt_abbrind];
- #ifdef USG_COMPAT
--              if (ttisp->tt_isdst)
-+              if ((need & NEED_DAYLIGHT) && ttisp->tt_isdst) {
-+                      need &= ~NEED_DAYLIGHT;
-                       daylight = 1;
--              if (i == 0 || !ttisp->tt_isdst)
--                      timezone = -(ttisp->tt_gmtoff);
-+              }
- #endif /* defined USG_COMPAT */
-+              if (ttisp->tt_isdst) {
-+                      if (need & NEED_DST) {
-+                              need &= ~NEED_DST;
-+                              tzname[1] = &sp->chars[ttisp->tt_abbrind];
- #ifdef ALTZONE
--              if (i == 0 || ttisp->tt_isdst)
--                      altzone = -(ttisp->tt_gmtoff);
-+                              altzone = -(ttisp->tt_gmtoff);
- #endif /* defined ALTZONE */
-+                      }
-+              } else if (need & NEED_STD) {
-+                      need &= ~NEED_STD;
-+                      tzname[0] = &sp->chars[ttisp->tt_abbrind];
-+#ifdef USG_COMPAT
-+                      _st_set_timezone(-(ttisp->tt_gmtoff));
-+#endif /* defined USG_COMPAT */
-+              }
-+#if defined(ALTZONE) || defined(USG_COMPAT)
-+              if (i == 0) {
-+#endif /* defined(ALTZONE) || defined(USG_COMPAT) */
-+#ifdef ALTZONE
-+                      if (need & NEED_DST)
-+                              altzone = -(ttisp->tt_gmtoff);
-+#endif /* defined ALTZONE */
-+#ifdef USG_COMPAT
-+                      if (need & NEED_STD)
-+                              _st_set_timezone(-(ttisp->tt_gmtoff));
-+#endif /* defined USG_COMPAT */
-+#if defined(ALTZONE) || defined(USG_COMPAT)
-+              }
-+#endif /* defined(ALTZONE) || defined(USG_COMPAT) */
-       }
--      /*
--      ** And to get the latest zone names into tzname. . .
--      */
--      for (i = 0; i < sp->timecnt; ++i) {
--              const struct ttinfo * const     ttisp =
--                                                      &sp->ttis[
--                                                              sp->types[i]];
-+}
-+
-+#ifdef NOTIFY_TZ
-+static void
-+notify_check_tz(notify_tz_t *p)
-+{
-+      unsigned int nstat;
-+      int ncheck;
-+
-+      if (__notify_78945668_info__ < 0) {
-+#ifdef NOTIFY_TZ_DEBUG
-+              if(!p->notify_was_off) NOTIFY_TZ_PRINTF("notify_check_tz: setting %s_notify->notify_was_off\n", (p == &lcl_notify ? "lcl" : "gmt"));
-+#endif /* NOTIFY_TZ_DEBUG */
-+              p->notify_was_off = 1;
-+              return;
-+      }
-+      /* force rereading the timezone file if notify was off */
-+      if (p->notify_was_off) {
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("notify_check_tz: saw %s_notify->notify_was_off\n", (p == &lcl_notify ? "lcl" : "gmt"));
-+#endif /* NOTIFY_TZ_DEBUG */
-+              p->is_set = 0;
-+              p->notify_was_off = 0;
-+              return;
-+      }
-+      if (p->token < 0)
-+              return;
-+      nstat = notify_check(p->token, &ncheck);
-+      if (nstat || ncheck) {
-+              p->is_set = 0;
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("notify_check_tz: %s changed\n", (p == &lcl_notify) ? "lcl" : "gmt");
-+#endif /* NOTIFY_TZ_DEBUG */
-+      }
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("notify_check_tz: %s unchanged\n", (p == &lcl_notify) ? "lcl" : "gmt");
-+#endif /* NOTIFY_TZ_DEBUG */
-+}
-+
-+extern uint32_t notify_monitor_file(int token, char *path, int flags);
-+
-+static void
-+notify_register_tz(char *file, notify_tz_t *p)
-+{
-+      char *name;
-+      unsigned int nstat;
-+      int ncheck;
--              tzname[ttisp->tt_isdst] =
--                      &sp->chars[ttisp->tt_abbrind];
-+      if (__notify_78945668_info__ < 0)
-+              return;
-+      /*----------------------------------------------------------------
-+       * Since we don't record the last time zone filename, just cancel
-+       * (which should remove the file monitor) and setup from scratch
-+       *----------------------------------------------------------------*/
-+      if (p->token >= 0)
-+              notify_cancel(p->token);
-+      if (!file || *file == 0) {
-+              /* no time zone file to monitor */
-+              p->token = -1;
-+              return;
-+      }
-+      /*----------------------------------------------------------------
-+       * Just use com.apple.system.timezone if the path is /etc/localtime.
-+       * Otherwise use com.apple.system.timezone.<fullpath>
-+       *----------------------------------------------------------------*/
-+      if (TZDEFAULT && strcmp(file, TZDEFAULT) == 0)
-+              name = notify_tz_name;
-+      else {
-+              name = alloca(sizeof(notify_tz_name) + strlen(file) + 1);
-+              if (name == NULL) {
-+                      p->token = -1;
-+                      return;
-+              }
-+              strcpy(name, notify_tz_name);
-+              strcat(name, ".");
-+              strcat(name, file);
-+      }
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("notify_register_tz: file=%s name=%s\n", file, name);
-+#endif /* NOTIFY_TZ_DEBUG */
-+      nstat = notify_register_check(name, &p->token);
-+      if (nstat != 0) {
-+              p->token = -1;
-+              p->is_set = 0;
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("***notify_register_tz: notify_register_check failed: %u\n", nstat);
-+#endif /* NOTIFY_TZ_DEBUG */
-+#ifdef NOTIFY_TZ_LOG
-+              NOTIFY_LOG("notify_register_check(%s) failed: %u\n", name, nstat);
-+#endif /* NOTIFY_TZ_LOG */
-+              return;
-+      }
-+      /* don't need to request monitoring /etc/localtime */
-+      if (name != notify_tz_name) {
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("notify_register_tz: monitor %s\n", file);
-+#endif /* NOTIFY_TZ_DEBUG */
-+              nstat = notify_monitor_file(p->token, file, 0);
-+              if (nstat != 0) {
-+                      notify_cancel(p->token);
-+                      p->token = -1;
-+                      p->is_set = 0;
-+#ifdef NOTIFY_TZ_DEBUG
-+                      NOTIFY_TZ_PRINTF("***notify_register_tz: notify_monitor_file failed: %u\n", nstat);
-+#endif /* NOTIFY_TZ_DEBUG */
-+#ifdef NOTIFY_TZ_LOG
-+                      NOTIFY_LOG("notify_monitor_file(%s) failed: %u\n", file, nstat);
-+#endif /* NOTIFY_TZ_LOG */
-+                      return;
-+              }
-       }
-+      notify_check(p->token, &ncheck);        /* this always returns true */
- }
-+#endif /* NOTIFY_TZ */
- static int
- tzload(name, sp)
-@@ -310,6 +582,9 @@ struct state * const       sp;
-       int             i;
-       int             fid;
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("tzload: name=%s\n", name);
-+#endif /* NOTIFY_TZ_DEBUG */
-       /* XXX The following is from OpenBSD, and I'm not sure it is correct */
-       if (name != NULL && issetugid() != 0)
-               if ((name[0] == ':' && name[1] == '/') || 
-@@ -327,7 +602,15 @@ struct state * const      sp;
-               ** to hold the longest file name string that the implementation
-               ** guarantees can be opened."
-               */
-+#ifdef NOTIFY_TZ
-+              if (!fullname) {
-+                      fullname = malloc(FILENAME_MAX + 1);
-+                      if (!fullname)
-+                              return -1;
-+              }
-+#else /* ! NOTIFY_TZ */
-               char            fullname[FILENAME_MAX + 1];
-+#endif /* NOTIFY_TZ */
-               if (name[0] == ':')
-                       ++name;
-@@ -335,7 +618,11 @@ struct state * const      sp;
-               if (!doaccess) {
-                       if ((p = TZDIR) == NULL)
-                               return -1;
-+#ifdef NOTIFY_TZ
-+                      if ((strlen(p) + 1 + strlen(name) + 1) >= (FILENAME_MAX + 1))
-+#else /* ! NOTIFY_TZ */
-                       if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname)
-+#endif /* NOTIFY_TZ */
-                               return -1;
-                       (void) strcpy(fullname, p);
-                       (void) strcat(fullname, "/");
-@@ -347,6 +634,10 @@ struct state * const      sp;
-                               doaccess = TRUE;
-                       name = fullname;
-               }
-+#ifdef NOTIFY_TZ
-+              else
-+                      strcpy(fullname, name);
-+#endif /* NOTIFY_TZ */
-               if (doaccess && access(name, R_OK) != 0)
-                       return -1;
-               if ((fid = _open(name, OPEN_MODE)) == -1)
-@@ -365,6 +656,9 @@ struct state * const       sp;
-               int             ttisstdcnt;
-               int             ttisgmtcnt;
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("tzload: reading %s\n", name);
-+#endif /* NOTIFY_TZ_DEBUG */
-               i = _read(fid, u.buf, sizeof u.buf);
-               if (_close(fid) != 0)
-                       return -1;
-@@ -471,14 +765,24 @@ static const int year_lengths[2] = {
- */
- static const char *
--getzname(strp)
-+getzname(strp, name, len)
- const char *  strp;
-+char **               name;
-+size_t *      len;
- {
-       char    c;
-+      char *  ket;
-+      if (*strp == '<' && (ket = strchr(strp, '>')) != NULL) {
-+              *name = (char *)(strp + 1);
-+              *len = ket - strp - 1;
-+              return ket + 1;
-+      }
-+      *name = (char *)strp;
-       while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
-               c != '+')
-                       ++strp;
-+      *len = strp - *name;
-       return strp;
- }
-@@ -758,16 +1062,15 @@ const int                       lastditch;
-       int                     load_result;
-       INITIALIZE(dstname);
--      stdname = name;
-       if (lastditch) {
-+              stdname = name;
-               stdlen = strlen(name);  /* length of standard zone name */
-               name += stdlen;
-               if (stdlen >= sizeof sp->chars)
-                       stdlen = (sizeof sp->chars) - 1;
-               stdoffset = 0;
-       } else {
--              name = getzname(name);
--              stdlen = name - stdname;
-+              name = getzname(name, (char **)&stdname, &stdlen);
-               if (stdlen < 3)
-                       return -1;
-               if (*name == '\0')
-@@ -779,12 +1082,14 @@ const int                       lastditch;
-               }
-       }
-       load_result = tzload(TZDEFRULES, sp);
-+#ifdef NOTIFY_TZ
-+      *fullname = 0;                          /* mark fullname as invalid */
-+#endif /* NOTIFY_TZ */
-       if (load_result != 0)
-               sp->leapcnt = 0;                /* so, we're off a little */
-       if (*name != '\0') {
-               dstname = name;
--              name = getzname(name);
--              dstlen = name - dstname;        /* length of DST zone name */
-+              name = getzname(name, (char **)&dstname, &dstlen);
-               if (dstlen < 3)
-                       return -1;
-               if (*name != '\0' && *name != ',' && *name != ';') {
-@@ -966,13 +1271,37 @@ struct state * const    sp;
- static void
- tzsetwall_basic(int rdlocked)
- {
-+#ifdef NOTIFY_TZ
-+      notify_check_tz(&lcl_notify);
-+#else
-+    if (TZDEFAULT) {
-+        static struct timespec last_mtimespec = {0, 0};
-+        struct stat statbuf;
-+
-+        if (lstat(TZDEFAULT, &statbuf) == 0) {
-+            if (statbuf.st_mtimespec.tv_sec > last_mtimespec.tv_sec ||
-+                (statbuf.st_mtimespec.tv_sec == last_mtimespec.tv_sec &&
-+                 statbuf.st_mtimespec.tv_nsec > last_mtimespec.tv_nsec)) {
-+               /* Trigger resetting the local TZ */
-+                    lcl_is_set = 0;
-+            }
-+            last_mtimespec = statbuf.st_mtimespec;
-+        }
-+    }
-+#endif /* NOTIFY_TZ */
-       if (!rdlocked)
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-       if (lcl_is_set < 0) {
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("tzsetwall_basic lcl_is_set < 0\n");
-+#endif
-               if (!rdlocked)
-                       _RWLOCK_UNLOCK(&lcl_rwlock);
-               return;
-       }
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("tzsetwall_basic not set\n");
-+#endif
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-       _RWLOCK_WRLOCK(&lcl_rwlock);
-@@ -992,6 +1321,9 @@ tzsetwall_basic(int rdlocked)
- #endif /* defined ALL_STATE */
-       if (tzload((char *) NULL, lclptr) != 0)
-               gmtload(lclptr);
-+#ifdef NOTIFY_TZ
-+      notify_register_tz(fullname, &lcl_notify);
-+#endif /* NOTIFY_TZ */
-       settzname();
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-@@ -1002,10 +1334,13 @@ tzsetwall_basic(int rdlocked)
- void
- tzsetwall(void)
- {
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("tzsetwall called\n");
-+#endif /* NOTIFY_TZ_DEBUG */
-       tzsetwall_basic(0);
- }
--static void
-+__private_extern__ void
- tzset_basic(int rdlocked)
- {
-       const char *    name;
-@@ -1016,11 +1351,17 @@ tzset_basic(int rdlocked)
-               return;
-       }
-+#ifdef NOTIFY_TZ
-+      notify_check_tz(&lcl_notify);
-+#endif /* NOTIFY_TZ */
-       if (!rdlocked)
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-       if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) {
-               if (!rdlocked)
-                       _RWLOCK_UNLOCK(&lcl_rwlock);
-+#ifdef NOTIFY_TZ_DEBUG
-+              NOTIFY_TZ_PRINTF("tzset_basic matched %s\n", lcl_TZname);
-+#endif
-               return;
-       }
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-@@ -1053,9 +1394,16 @@ tzset_basic(int rdlocked)
-               lclptr->ttis[0].tt_gmtoff = 0;
-               lclptr->ttis[0].tt_abbrind = 0;
-               (void) strcpy(lclptr->chars, gmt);
-+#ifdef NOTIFY_TZ
-+              if (fullname)
-+                      *fullname = 0;
-+#endif /* NOTIFY_TZ */
-       } else if (tzload(name, lclptr) != 0)
-               if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
-                       (void) gmtload(lclptr);
-+#ifdef NOTIFY_TZ
-+      notify_register_tz(fullname, &lcl_notify);
-+#endif /* NOTIFY_TZ */
-       settzname();
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-@@ -1066,6 +1414,9 @@ tzset_basic(int rdlocked)
- void
- tzset(void)
- {
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("tzset called TZ=%s\n", getenv("TZ"));
-+#endif /* NOTIFY_TZ_DEBUG */
-       tzset_basic(0);
- }
-@@ -1079,7 +1430,11 @@ tzset(void)
- */
- /*ARGSUSED*/
--static void
-+#ifdef __LP64__
-+__private_extern__ struct tm *
-+#else /* !__LP64__ */
-+__private_extern__ void
-+#endif /* __LP64__ */
- localsub(timep, offset, tmp)
- const time_t * const  timep;
- const long            offset;
-@@ -1090,11 +1445,18 @@ struct tm * const      tmp;
-       int                     i;
-       const time_t                    t = *timep;
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("localsub called\n");
-+#endif /* NOTIFY_TZ_DEBUG */
-       sp = lclptr;
- #ifdef ALL_STATE
-       if (sp == NULL) {
-+#ifdef __LP64__
-+              return gmtsub(timep, offset, tmp);
-+#else /* !__LP64__ */
-               gmtsub(timep, offset, tmp);
-               return;
-+#endif /* __LP64__ */
-       }
- #endif /* defined ALL_STATE */
-       if (sp->timecnt == 0 || t < sp->ats[0]) {
-@@ -1117,12 +1479,20 @@ struct tm * const      tmp;
-       **      t += ttisp->tt_gmtoff;
-       **      timesub(&t, 0L, sp, tmp);
-       */
-+#ifdef __LP64__
-+      if (timesub(&t, ttisp->tt_gmtoff, sp, tmp) == NULL)
-+              return NULL;
-+#else /* !__LP64__ */
-       timesub(&t, ttisp->tt_gmtoff, sp, tmp);
-+#endif /* __LP64__ */
-       tmp->tm_isdst = ttisp->tt_isdst;
-       tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
- #ifdef TM_ZONE
-       tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
- #endif /* defined TM_ZONE */
-+#ifdef __LP64__
-+      return tmp;
-+#endif /* __LP64__ */
- }
- struct tm *
-@@ -1134,10 +1504,11 @@ const time_t * const   timep;
-       struct tm *p_tm;
-       if (__isthreaded != 0) {
--              if (localtime_key < 0) {
-+              if (localtime_key == (pthread_key_t)-1) {
-                       _pthread_mutex_lock(&localtime_mutex);
--                      if (localtime_key < 0) {
--                              if (_pthread_key_create(&localtime_key, free) < 0) {
-+                      if (localtime_key == (pthread_key_t)-1) {
-+                              localtime_key = __LIBC_PTHREAD_KEY_LOCALTIME;
-+                              if (pthread_key_init_np(localtime_key, free) < 0) {
-                                       _pthread_mutex_unlock(&localtime_mutex);
-                                       return(NULL);
-                               }
-@@ -1153,13 +1524,21 @@ const time_t * const   timep;
-               }
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-               tzset_basic(1);
-+#ifdef __LP64__
-+              p_tm = localsub(timep, 0L, p_tm);
-+#else /* !__LP64__ */
-               localsub(timep, 0L, p_tm);
-+#endif /* __LP64__ */
-               _RWLOCK_UNLOCK(&lcl_rwlock);
-               return(p_tm);
-       } else {
-               tzset_basic(0);
-+#ifdef __LP64__
-+              return localsub(timep, 0L, &tm);
-+#else /* !__LP64__ */
-               localsub(timep, 0L, &tm);
-               return(&tm);
-+#endif /* __LP64__ */
-       }
- }
-@@ -1168,13 +1547,15 @@ const time_t * const   timep;
- */
- struct tm *
--localtime_r(timep, tm)
--const time_t * const  timep;
--struct tm *           tm;
-+localtime_r(const time_t * const __restrict timep, struct tm * __restrict tm)
- {
-       _RWLOCK_RDLOCK(&lcl_rwlock);
-       tzset_basic(1);
-+#ifdef __LP64__
-+      tm = localsub(timep, 0L, tm);
-+#else /* !__LP64__ */
-       localsub(timep, 0L, tm);
-+#endif /* __LP64__ */
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-       return tm;
- }
-@@ -1183,25 +1564,52 @@ struct tm *            tm;
- ** gmtsub is to gmtime as localsub is to localtime.
- */
-+#ifdef __LP64__
-+static struct tm *
-+#else /* !__LP64__ */
- static void
-+#endif /* __LP64__ */
- gmtsub(timep, offset, tmp)
- const time_t * const  timep;
- const long            offset;
- struct tm * const     tmp;
- {
-+#ifdef NOTIFY_TZ_DEBUG
-+      NOTIFY_TZ_PRINTF("gmtsub called\n");
-+#endif /* NOTIFY_TZ_DEBUG */
-+#ifdef NOTIFY_TZ
-+      notify_check_tz(&gmt_notify);
-+#endif /* NOTIFY_TZ */
-       if (!gmt_is_set) {
-               _MUTEX_LOCK(&gmt_mutex);
-               if (!gmt_is_set) {
- #ifdef ALL_STATE
--                      gmtptr = (struct state *) malloc(sizeof *gmtptr);
-+#ifdef NOTIFY_TZ
-+                      if (gmtptr == NULL)
-+#endif /* NOTIFY_TZ */
-+                              gmtptr = (struct state *) malloc(sizeof *gmtptr);
-                       if (gmtptr != NULL)
-+#ifdef NOTIFY_TZ
-+                      {
-+#endif /* NOTIFY_TZ */
- #endif /* defined ALL_STATE */
-                               gmtload(gmtptr);
-+#ifdef NOTIFY_TZ
-+                              notify_register_tz(fullname, &gmt_notify);
-+#ifdef ALL_STATE
-+                      }
-+#endif
-+#endif /* NOTIFY_TZ */
-                       gmt_is_set = TRUE;
-               }
-               _MUTEX_UNLOCK(&gmt_mutex);
-       }
-+#ifdef __LP64__
-+      if(timesub(timep, offset, gmtptr, tmp) == NULL)
-+              return NULL;
-+#else /* !__LP64__ */
-       timesub(timep, offset, gmtptr, tmp);
-+#endif /* __LP64__ */
- #ifdef TM_ZONE
-       /*
-       ** Could get fancy here and deliver something such as
-@@ -1213,7 +1621,7 @@ struct tm * const        tmp;
-       else {
- #ifdef ALL_STATE
-               if (gmtptr == NULL)
--                      tmp->TM_ZONE = gmt;
-+                      tmp->TM_ZONE = (char *)gmt;
-               else    tmp->TM_ZONE = gmtptr->chars;
- #endif /* defined ALL_STATE */
- #ifndef ALL_STATE
-@@ -1221,6 +1629,9 @@ struct tm * const        tmp;
- #endif /* State Farm */
-       }
- #endif /* defined TM_ZONE */
-+#ifdef __LP64__
-+      return tmp;
-+#endif /* __LP64__ */
- }
- struct tm *
-@@ -1232,10 +1643,11 @@ const time_t * const   timep;
-       struct tm *p_tm;
-       if (__isthreaded != 0) {
--              if (gmtime_key < 0) {
-+              if (gmtime_key == (pthread_key_t)-1) {
-                       _pthread_mutex_lock(&gmtime_mutex);
--                      if (gmtime_key < 0) {
--                              if (_pthread_key_create(&gmtime_key, free) < 0) {
-+                      if (gmtime_key == (pthread_key_t)-1) {
-+                              gmtime_key = __LIBC_PTHREAD_KEY_GMTIME;
-+                              if (pthread_key_init_np(gmtime_key, free) < 0) {
-                                       _pthread_mutex_unlock(&gmtime_mutex);
-                                       return(NULL);
-                               }
-@@ -1253,12 +1665,20 @@ const time_t * const   timep;
-                       }
-                       _pthread_setspecific(gmtime_key, p_tm);
-               }
-+#ifdef __LP64__
-+              return gmtsub(timep, 0L, p_tm);
-+#else /* !__LP64__ */
-               gmtsub(timep, 0L, p_tm);
-               return(p_tm);
-+#endif /* __LP64__ */
-       }
-       else {
-+#ifdef __LP64__
-+              return gmtsub(timep, 0L, &tm);
-+#else /* !__LP64__ */
-               gmtsub(timep, 0L, &tm);
-               return(&tm);
-+#endif /* __LP64__ */
-       }
- }
-@@ -1271,8 +1691,13 @@ gmtime_r(timep, tm)
- const time_t * const  timep;
- struct tm *           tm;
- {
-+
-+#ifdef __LP64__
-+      return gmtsub(timep, 0L, tm);
-+#else /* !__LP64__ */
-       gmtsub(timep, 0L, tm);
-       return tm;
-+#endif /* __LP64__ */
- }
- #ifdef STD_INSPIRED
-@@ -1282,13 +1707,21 @@ offtime(timep, offset)
- const time_t * const  timep;
- const long            offset;
- {
-+#ifdef __LP64__
-+      return gmtsub(timep, offset, &tm);
-+#else /* !__LP64__ */
-       gmtsub(timep, offset, &tm);
-       return &tm;
-+#endif /* __LP64__ */
- }
- #endif /* defined STD_INSPIRED */
-+#ifdef __LP64__
-+static struct tm *
-+#else /* !__LP64__ */
- static void
-+#endif /* __LP64__ */
- timesub(timep, offset, sp, tmp)
- const time_t * const                  timep;
- const long                            offset;
-@@ -1365,7 +1798,12 @@ struct tm * const               tmp;
-       if (tmp->tm_wday < 0)
-               tmp->tm_wday += DAYSPERWEEK;
-       y = EPOCH_YEAR;
--#define LEAPS_THRU_END_OF(y)  ((y) / 4 - (y) / 100 + (y) / 400)
-+#define _LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400)
-+#ifdef __LP64__
-+#define LEAPS_THRU_END_OF(y)  ((y) >= 0 ? _LEAPS_THRU_END_OF(y) : _LEAPS_THRU_END_OF((y) + 1) - 1)
-+#else /* !__LP64__ */
-+#define LEAPS_THRU_END_OF(y)  _LEAPS_THRU_END_OF(y)
-+#endif /* __LP64__ */
-       while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) {
-               long    newy;
-@@ -1377,7 +1815,16 @@ struct tm * const               tmp;
-                       LEAPS_THRU_END_OF(y - 1);
-               y = newy;
-       }
-+#ifdef __LP64__
-+      y -= TM_YEAR_BASE;
-+      if (y < INT_MIN || y > INT_MAX) {
-+              errno = EOVERFLOW;
-+              return NULL;
-+      }
-+      tmp->tm_year = y;
-+#else /* !__LP64__ */
-       tmp->tm_year = y - TM_YEAR_BASE;
-+#endif /* __LP64__ */
-       tmp->tm_yday = (int) days;
-       ip = mon_lengths[yleap];
-       for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
-@@ -1387,6 +1834,9 @@ struct tm * const                tmp;
- #ifdef TM_GMTOFF
-       tmp->TM_GMTOFF = offset;
- #endif /* defined TM_GMTOFF */
-+#ifdef __LP64__
-+      return tmp;
-+#endif /* __LP64__ */
- }
- char *
-@@ -1399,7 +1849,20 @@ const time_t * const    timep;
- **    to local time in the form of a string.  It is equivalent to
- **            asctime(localtime(timer))
- */
-+#ifdef __LP64__
-+      /*
-+       * In 64-bit, the timep value may produce a time value with a year
-+       * that exceeds 32-bits in size (won't fit in struct tm), so localtime
-+       * will return NULL.
-+       */
-+      struct tm *tm = localtime(timep);
-+
-+      if (tm == NULL)
-+              return NULL;
-+      return asctime(tm);
-+#else /* !__LP64__ */
-       return asctime(localtime(timep));
-+#endif /* __LP64__ */
- }
- char *
-@@ -1409,7 +1872,18 @@ char *                  buf;
- {
-       struct tm       tm;
-+#ifdef __LP64__
-+      /*
-+       * In 64-bit, the timep value may produce a time value with a year
-+       * that exceeds 32-bits in size (won't fit in struct tm), so localtime_r
-+       * will return NULL.
-+       */
-+      if (localtime_r(timep, &tm) == NULL)
-+              return NULL;
-+      return asctime_r(&tm, buf);
-+#else /* !__LP64__ */
-       return asctime_r(localtime_r(timep, &tm), buf);
-+#endif /* __LP64__ */
- }
- /*
-@@ -1464,8 +1938,14 @@ const struct tm * const btmp;
- {
-       int     result;
--      if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
--              (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
-+      /*
-+       * Assume that atmp and btmp point to normalized tm strutures.
-+       * So only arithmetic with tm_year could overflow in 64-bit.
-+       */
-+      if (atmp->tm_year != btmp->tm_year) {
-+              return (atmp->tm_year > btmp->tm_year ? 1 : -1);
-+      }
-+      if ((result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
-               (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
-               (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
-               (result = (atmp->tm_min - btmp->tm_min)) == 0)
-@@ -1474,12 +1954,17 @@ const struct tm * const btmp;
- }
- static time_t
--time2sub(tmp, funcp, offset, okayp, do_norm_secs)
-+time2sub(tmp, funcp, offset, okayp, do_norm_secs, unix03)
- struct tm * const     tmp;
-+#ifdef __LP64__
-+struct tm *(* const   funcp)(const time_t*, long, struct tm*);
-+#else /* !__LP64__ */
- void (* const         funcp)(const time_t*, long, struct tm*);
-+#endif /* __LP64__ */
- const long            offset;
- int * const           okayp;
- const int             do_norm_secs;
-+int                   unix03;
- {
-       const struct state *    sp;
-       int                     dir;
-@@ -1489,6 +1974,9 @@ const int                do_norm_secs;
-       time_t                          newt;
-       time_t                          t;
-       struct tm                       yourtm, mytm;
-+#ifdef __LP64__
-+      long                            year, il;
-+#endif /* __LP64__ */
-       *okayp = FALSE;
-       yourtm = *tmp;
-@@ -1507,33 +1995,64 @@ const int              do_norm_secs;
-       ** Turn yourtm.tm_year into an actual year number for now.
-       ** It is converted back to an offset from TM_YEAR_BASE later.
-       */
-+#ifdef __LP64__
-+      year = (long)yourtm.tm_year + TM_YEAR_BASE;
-+#else /* !__LP64__ */
-       if (increment_overflow(&yourtm.tm_year, TM_YEAR_BASE))
-               return WRONG;
-+#endif /* __LP64__ */
-       while (yourtm.tm_mday <= 0) {
-+#ifdef __LP64__
-+              year--;
-+              il = year + (1 < yourtm.tm_mon);
-+              yourtm.tm_mday += year_lengths[isleap(il)];
-+#else /* !__LP64__ */
-               if (increment_overflow(&yourtm.tm_year, -1))
-                       return WRONG;
-               i = yourtm.tm_year + (1 < yourtm.tm_mon);
-               yourtm.tm_mday += year_lengths[isleap(i)];
-+#endif /* __LP64__ */
-       }
-       while (yourtm.tm_mday > DAYSPERLYEAR) {
-+#ifdef __LP64__
-+              il = year + (1 < yourtm.tm_mon);
-+              yourtm.tm_mday -= year_lengths[isleap(il)];
-+              year++;
-+#else /* !__LP64__ */
-               i = yourtm.tm_year + (1 < yourtm.tm_mon);
-               yourtm.tm_mday -= year_lengths[isleap(i)];
-               if (increment_overflow(&yourtm.tm_year, 1))
-                       return WRONG;
-+#endif /* __LP64__ */
-       }
-       for ( ; ; ) {
-+#ifdef __LP64__
-+              i = mon_lengths[isleap(year)][yourtm.tm_mon];
-+#else /* !__LP64__ */
-               i = mon_lengths[isleap(yourtm.tm_year)][yourtm.tm_mon];
-+#endif /* __LP64__ */
-               if (yourtm.tm_mday <= i)
-                       break;
-               yourtm.tm_mday -= i;
-               if (++yourtm.tm_mon >= MONSPERYEAR) {
-                       yourtm.tm_mon = 0;
-+#ifdef __LP64__
-+                      year++;
-+#else /* !__LP64__ */
-                       if (increment_overflow(&yourtm.tm_year, 1))
-                               return WRONG;
-+#endif /* __LP64__ */
-               }
-       }
-+#ifdef __LP64__
-+      year -= TM_YEAR_BASE;
-+      if (year > INT_MAX || year < INT_MIN)
-+              return WRONG;
-+      yourtm.tm_year = year;
-+#else /* !__LP64__ */
-       if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE))
-               return WRONG;
-+#endif /* __LP64__ */
-       /* Don't go below 1900 for POLA */
-       if (yourtm.tm_year < 0)
-               return WRONG;
-@@ -1560,13 +2079,21 @@ const int              do_norm_secs;
-       ** Divide the search space in half
-       ** (this works whether time_t is signed or unsigned).
-       */
-+#ifdef __LP64__
-+      /* optimization: see if the value is 31-bit (signed) */
-+      t = (((time_t) 1) << (TYPE_BIT(int) - 1)) - 1;
-+      bits = ((*funcp)(&t, offset, &mytm) == NULL || tmcomp(&mytm, &yourtm) < 0) ? TYPE_BIT(time_t) - 1 : TYPE_BIT(int) - 1;
-+#else /* !__LP64__ */
-       bits = TYPE_BIT(time_t) - 1;
-+#endif /* __LP64__ */
-       /*
--      ** If we have more than this, we will overflow tm_year for tmcomp().
--      ** We should really return an error if we cannot represent it.
-+      ** In 64-bit, we now return an error if we cannot represent the
-+      ** struct tm value in a time_t.  And tmcomp() is fixed to avoid
-+      ** overflow in tm_year.  So we only put a cap on bits because time_t
-+      ** can't be larger that 56 bit (when tm_year == INT_MAX).
-       */
--      if (bits > 48)
--              bits = 48;
-+      if (bits > 56)
-+              bits = 56;
-       /*
-       ** If time_t is signed, then 0 is just above the median,
-       ** assuming two's complement arithmetic.
-@@ -1574,8 +2101,19 @@ const int               do_norm_secs;
-       */
-       t = TYPE_SIGNED(time_t) ? 0 : (((time_t) 1) << bits);
-       for ( ; ; ) {
-+#ifdef __LP64__
-+              if ((*funcp)(&t, offset, &mytm) == NULL) {
-+                  /* we overflowed, so t is too big */
-+                  dir = 1;
-+                  goto skip_tmcomp;
-+              }
-+#else /* !__LP64__ */
-               (*funcp)(&t, offset, &mytm);
-+#endif /* __LP64__ */
-               dir = tmcomp(&mytm, &yourtm);
-+#ifdef __LP64__
-+skip_tmcomp:
-+#endif /* __LP64__ */
-               if (dir != 0) {
-                       if (bits-- < 0)
-                               return WRONG;
-@@ -1586,6 +2124,9 @@ const int                do_norm_secs;
-                       else    t += ((time_t) 1) << bits;
-                       continue;
-               }
-+              sp = (funcp == localsub) ? lclptr : gmtptr;
-+              if (unix03 && sp->typecnt == 1 && yourtm.tm_isdst > 0) 
-+                      yourtm.tm_isdst = 0; /* alternative time does not apply */
-               if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
-                       break;
-               /*
-@@ -1594,7 +2135,6 @@ const int                do_norm_secs;
-               ** It's okay to guess wrong since the guess
-               ** gets checked.
-               */
--              sp = (funcp == localsub) ? lclptr : gmtptr;
- #ifdef ALL_STATE
-               if (sp == NULL)
-                       return WRONG;
-@@ -1607,7 +2147,12 @@ const int               do_norm_secs;
-                                       continue;
-                               newt = t + sp->ttis[j].tt_gmtoff -
-                                       sp->ttis[i].tt_gmtoff;
-+#ifdef __LP64__
-+                              if ((*funcp)(&newt, offset, &mytm) == NULL)
-+                                      return WRONG;
-+#else /* !__LP64__ */
-                               (*funcp)(&newt, offset, &mytm);
-+#endif /* __LP64__ */
-                               if (tmcomp(&mytm, &yourtm) != 0)
-                                       continue;
-                               if (mytm.tm_isdst != yourtm.tm_isdst)
-@@ -1626,17 +2171,27 @@ label:
-       if ((newt < t) != (saved_seconds < 0))
-               return WRONG;
-       t = newt;
-+#ifdef __LP64__
-+      if ((*funcp)(&t, offset, tmp) == NULL)
-+              return WRONG;
-+#else /* !__LP64__ */
-       (*funcp)(&t, offset, tmp);
-+#endif /* __LP64__ */
-       *okayp = TRUE;
-       return t;
- }
- static time_t
--time2(tmp, funcp, offset, okayp)
-+time2(tmp, funcp, offset, okayp, unix03)
- struct tm * const     tmp;
-+#ifdef __LP64__
-+struct tm *(* const   funcp)(const time_t*, long, struct tm*);
-+#else /* !__LP64__ */
- void (* const         funcp)(const time_t*, long, struct tm*);
-+#endif /* __LP64__ */
- const long            offset;
- int * const           okayp;
-+int                   unix03;
- {
-       time_t  t;
-@@ -1645,15 +2200,20 @@ int * const            okayp;
-       ** (in case tm_sec contains a value associated with a leap second).
-       ** If that fails, try with normalization of seconds.
-       */
--      t = time2sub(tmp, funcp, offset, okayp, FALSE);
--      return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
-+      t = time2sub(tmp, funcp, offset, okayp, FALSE, unix03);
-+      return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE, unix03);
- }
--static time_t
--time1(tmp, funcp, offset)
-+__private_extern__ time_t
-+time1(tmp, funcp, offset, unix03)
- struct tm * const     tmp;
-+#ifdef __LP64__
-+struct tm *(* const   funcp)(const time_t *, long, struct tm *);
-+#else /* !__LP64__ */
- void (* const         funcp)(const time_t *, long, struct tm *);
-+#endif /* __LP64__ */
- const long            offset;
-+int                   unix03;
- {
-       time_t                  t;
-       const struct state *    sp;
-@@ -1667,7 +2227,7 @@ const long               offset;
-       if (tmp->tm_isdst > 1)
-               tmp->tm_isdst = 1;
--      t = time2(tmp, funcp, offset, &okay);
-+      t = time2(tmp, funcp, offset, &okay, unix03);
- #ifdef PCTS
-       /*
-       ** PCTS code courtesy Grant Sullivan (grant@osf.org).
-@@ -1711,7 +2271,7 @@ const long               offset;
-                       tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
-                                       sp->ttis[samei].tt_gmtoff;
-                       tmp->tm_isdst = !tmp->tm_isdst;
--                      t = time2(tmp, funcp, offset, &okay);
-+                      t = time2(tmp, funcp, offset, &okay, unix03);
-                       if (okay)
-                               return t;
-                       tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
-@@ -1721,19 +2281,25 @@ const long             offset;
-       }
-       return WRONG;
- }
-+#else  /* BUILDING_VARIANT */
-+__private_extern__ pthread_rwlock_t   lcl_rwlock;
-+#endif /* BUILDING_VARIANT */
- time_t
- mktime(tmp)
- struct tm * const     tmp;
- {
-       time_t mktime_return_value;
-+      int serrno = errno;
-       _RWLOCK_RDLOCK(&lcl_rwlock);
-       tzset_basic(1);
--      mktime_return_value = time1(tmp, localsub, 0L);
-+      mktime_return_value = time1(tmp, localsub, 0L, __DARWIN_UNIX03);
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-+      errno = serrno;
-       return(mktime_return_value);
- }
-+#if !BUILDING_VARIANT
- #ifdef STD_INSPIRED
- time_t
-@@ -1749,7 +2315,7 @@ timegm(tmp)
- struct tm * const     tmp;
- {
-       tmp->tm_isdst = 0;
--      return time1(tmp, gmtsub, 0L);
-+      return time1(tmp, gmtsub, 0L, __DARWIN_UNIX03);
- }
- time_t
-@@ -1758,7 +2324,7 @@ struct tm * const        tmp;
- const long            offset;
- {
-       tmp->tm_isdst = 0;
--      return time1(tmp, gmtsub, offset);
-+      return time1(tmp, gmtsub, offset, __DARWIN_UNIX03);
- }
- #endif /* defined STD_INSPIRED */
-@@ -1858,3 +2424,4 @@ time_t   t;
- }
- #endif /* defined STD_INSPIRED */
-+#endif /* !BUILDING_VARIANT */
index 1a8c9e754d08cbfb85b2dbd7d49297a455cec9cf..5454a074c19e5d714e96fd05639e84590cdc8cab 100644 (file)
@@ -36,7 +36,8 @@
 .Dt STRFTIME 3
 .Os
 .Sh NAME
-.Nm strftime
+.Nm strftime ,
+.Nm strftime_l
 .Nd format date and time
 .Sh LIBRARY
 .Lb libc
 .In time.h
 .Ft size_t
 .Fo strftime
-.Fa "char * restrict buf"
+.Fa "char *restrict s"
 .Fa "size_t maxsize"
-.Fa "const char * restrict format"
-.Fa "const struct tm * restrict timeptr"
+.Fa "const char *restrict format"
+.Fa "const struct tm *restrict timeptr"
+.Fc
+.In time.h
+.In xlocale.h
+.Ft size_t
+.Fo strftime_l
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "const char *restrict format"
+.Fa "const struct tm *restrict timeptr"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
@@ -55,7 +66,7 @@ The
 function formats the information from
 .Fa timeptr
 into the buffer
-.Fa buf
+.Fa s ,
 according to the string pointed to by
 .Fa format .
 .Pp
@@ -79,6 +90,14 @@ returns the number of characters in the array, not counting the
 terminating NUL.
 Otherwise, zero is returned and the buffer contents are indeterminate.
 .Pp
+Although the
+.Fn strftime
+function uses the current locale, the
+.Fn strftime_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
+.Pp
 The conversion specifications are copied to the buffer after expansion
 as follows:-
 .Bl -tag -width "xxxx"
@@ -233,7 +252,8 @@ is replaced by
 .Xr ctime 3 ,
 .Xr printf 3 ,
 .Xr strptime 3 ,
-.Xr wcsftime 3
+.Xr wcsftime 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strftime
@@ -260,11 +280,12 @@ with a lot of extensions including
 .Ql %u ,
 .Ql \&%V ,
 .Ql %z ,
+and
 .Ql %+ .
 .Pp
 The peculiar week number and year in the replacements of
 .Ql %G ,
-.Ql %g
+.Ql %g ,
 and
 .Ql \&%V
 are defined in ISO 8601: 1988.
diff --git a/stdtime/FreeBSD/strftime.3.patch b/stdtime/FreeBSD/strftime.3.patch
deleted file mode 100644 (file)
index 837ad75..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
---- strftime.3.bsdnew  2009-11-14 13:55:44.000000000 -0800
-+++ strftime.3 2009-11-14 13:55:44.000000000 -0800
-@@ -36,7 +36,8 @@
- .Dt STRFTIME 3
- .Os
- .Sh NAME
--.Nm strftime
-+.Nm strftime ,
-+.Nm strftime_l
- .Nd format date and time
- .Sh LIBRARY
- .Lb libc
-@@ -44,10 +45,20 @@
- .In time.h
- .Ft size_t
- .Fo strftime
--.Fa "char * restrict buf"
-+.Fa "char *restrict s"
- .Fa "size_t maxsize"
--.Fa "const char * restrict format"
--.Fa "const struct tm * restrict timeptr"
-+.Fa "const char *restrict format"
-+.Fa "const struct tm *restrict timeptr"
-+.Fc
-+.In time.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo strftime_l
-+.Fa "char *restrict s"
-+.Fa "size_t maxsize"
-+.Fa "const char *restrict format"
-+.Fa "const struct tm *restrict timeptr"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
-@@ -55,7 +66,7 @@ The
- function formats the information from
- .Fa timeptr
- into the buffer
--.Fa buf
-+.Fa s ,
- according to the string pointed to by
- .Fa format .
- .Pp
-@@ -79,6 +90,14 @@ returns the number of characters in the 
- terminating NUL.
- Otherwise, zero is returned and the buffer contents are indeterminate.
- .Pp
-+Although the
-+.Fn strftime
-+function uses the current locale, the
-+.Fn strftime_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
-+.Pp
- The conversion specifications are copied to the buffer after expansion
- as follows:-
- .Bl -tag -width "xxxx"
-@@ -233,7 +252,8 @@ is replaced by
- .Xr ctime 3 ,
- .Xr printf 3 ,
- .Xr strptime 3 ,
--.Xr wcsftime 3
-+.Xr wcsftime 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn strftime
-@@ -260,11 +280,12 @@ with a lot of extensions including
- .Ql %u ,
- .Ql \&%V ,
- .Ql %z ,
-+and
- .Ql %+ .
- .Pp
- The peculiar week number and year in the replacements of
- .Ql %G ,
--.Ql %g
-+.Ql %g ,
- and
- .Ql \&%V
- are defined in ISO 8601: 1988.
index 197f1e9d11d719a8475f7d92360e3d2b494542e4..0f0e524fda2892a742d750efe06c3a45b8323f55 100644 (file)
@@ -25,6 +25,8 @@ static const char     elsieid[] = "@(#)strftime.3     8.3";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include "private.h"
 
@@ -35,18 +37,25 @@ static const char   sccsid[] = "@(#)strftime.c      5.4 (Berkeley) 3/14/89";
 __FBSDID("$FreeBSD: src/lib/libc/stdtime/strftime.c,v 1.44 2009/06/09 09:02:58 delphij Exp $");
 
 #include "tzfile.h"
+#include <time.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include "un-namespace.h"
 #include "timelocal.h"
 
+#if !BUILDING_VARIANT
 static char *  _add(const char *, char *, const char *);
-static char *  _conv(int, const char *, char *, const char *);
-static char *  _fmt(const char *, const struct tm *, char *, const char *,
-                       int *);
-static char *  _yconv(int, int, int, int, char *, const char *);
+static char *  _conv(int, const char *, char *, const char *, locale_t);
+static char *  _yconv(int, int, int, int, char *, const char *, locale_t);
+#endif
+#define        _fmt    _st_fmt
+__private_extern__ char *      _fmt(const char *, const struct tm *, char *, const char *,
+                       int *, struct lc_time_T *, locale_t);
 
 extern char *  tzname[];
+__private_extern__ long __darwin_altzone;              /* DST timezone offset */
+#define altzone __darwin_altzone
+__private_extern__ long _st_get_timezone(void);
 
 #ifndef YEAR_2000_NAME
 #define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
@@ -62,6 +71,7 @@ extern char * tzname[];
 #define PAD_SPACE      2
 #define PAD_ZERO       3
 
+#ifndef BUILDING_VARIANT
 static const char* fmt_padding[][4] = {
        /* DEFAULT,     LESS,   SPACE,  ZERO */
 #define PAD_FMT_MONTHDAY       0
@@ -80,31 +90,36 @@ static const char* fmt_padding[][4] = {
 #define PAD_FMT_YEAR           3
        { "%04d",       "%d",   "%4d",  "%04d" }
 };
+#endif
+
+#define USG_COMPAT
+#define ALTZONE
 
 size_t
-strftime(char * __restrict s, size_t maxsize, const char * __restrict format,
-    const struct tm * __restrict t)
+strftime_l(char * __restrict s, size_t maxsize, const char * __restrict format,
+    const struct tm * __restrict t, locale_t loc)
 {
        char *  p;
        int     warn;
 
+       NORMALIZE_LOCALE(loc);
        tzset();
        warn = IN_NONE;
-       p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
+       p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, __get_current_time_locale(loc), loc);
 #ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
        if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
-               (void) fprintf(stderr, "\n");
+               (void) fputs("\n", stderr);
                if (format == NULL)
-                       (void) fprintf(stderr, "NULL strftime format ");
-               else    (void) fprintf(stderr, "strftime format \"%s\" ",
+                       (void) fputs("NULL strftime format ", stderr);
+               else    (void) fprintf_l(stderr, loc, "strftime format \"%s\" ",
                                format);
-               (void) fprintf(stderr, "yields only two digits of years in ");
+               (void) fputs("yields only two digits of years in ", stderr);
                if (warn == IN_SOME)
-                       (void) fprintf(stderr, "some locales");
+                       (void) fputs("some locales", stderr);
                else if (warn == IN_THIS)
-                       (void) fprintf(stderr, "the current locale");
-               else    (void) fprintf(stderr, "all locales");
-               (void) fprintf(stderr, "\n");
+                       (void) fputs("the current locale", stderr);
+               else    (void) fputs("all locales", stderr);
+               (void) fputs("\n", stderr);
        }
 #endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
        if (p == s + maxsize)
@@ -113,16 +128,25 @@ strftime(char * __restrict s, size_t maxsize, const char * __restrict format,
        return p - s;
 }
 
-static char *
-_fmt(format, t, pt, ptlim, warnp)
+size_t
+strftime(char * __restrict s, size_t maxsize, const char * __restrict format,
+    const struct tm * __restrict t)
+{
+       return strftime_l(s, maxsize, format, t, __current_locale());
+}
+
+#ifndef BUILDING_VARIANT
+__private_extern__ char *
+_fmt(format, t, pt, ptlim, warnp, tptr, loc)
 const char *           format;
 const struct tm * const        t;
 char *                 pt;
 const char * const     ptlim;
 int *                  warnp;
+struct lc_time_T *     tptr;
+locale_t               loc;
 {
        int Ealternative, Oalternative, PadIndex;
-       struct lc_time_T *tptr = __get_current_time_locale();
 
        for ( ; *format; ++format) {
                if (*format == '%') {
@@ -163,19 +187,19 @@ label:
                        case 'C':
                                /*
                                ** %C used to do a...
-                               **      _fmt("%a %b %e %X %Y", t);
+                               **      _fmt("%a %b %e %X %Y", t, tptr, loc);
                                ** ...whereas now POSIX 1003.2 calls for
                                ** something completely different.
                                ** (ado, 1993-05-24)
                                */
                                pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 'c':
                                {
                                int warn2 = IN_SOME;
 
-                               pt = _fmt(tptr->c_fmt, t, pt, ptlim, &warn2);
+                               pt = _fmt(tptr->c_fmt, t, pt, ptlim, &warn2, tptr, loc);
                                if (warn2 == IN_ALL)
                                        warn2 = IN_THIS;
                                if (warn2 > *warnp)
@@ -183,11 +207,11 @@ label:
                                }
                                continue;
                        case 'D':
-                               pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp);
+                               pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, tptr, loc);
                                continue;
                        case 'd':
                                pt = _conv(t->tm_mday, fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex],
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 'E':
                                if (Ealternative || Oalternative)
@@ -213,29 +237,29 @@ label:
                                goto label;
                        case 'e':
                                pt = _conv(t->tm_mday,
-                                       fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'F':
-                               pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
+                               pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, tptr, loc);
                                continue;
                        case 'H':
                                pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_HMS][PadIndex],
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 'I':
                                pt = _conv((t->tm_hour % 12) ?
                                        (t->tm_hour % 12) : 12,
-                                       fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'j':
                                pt = _conv(t->tm_yday + 1,
-                                       fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'k':
                                /*
                                ** This used to be...
                                **      _conv(t->tm_hour % 12 ?
-                               **              t->tm_hour % 12 : 12, 2, ' ');
+                               **              t->tm_hour % 12 : 12, 2, ' ', loc);
                                ** ...and has been changed to the below to
                                ** match SunOS 4.1.1 and Arnold Robbins'
                                ** strftime version 3.0. That is, "%k" and
@@ -243,7 +267,7 @@ label:
                                ** (ado, 1993-05-24)
                                */
                                pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_SHMS][PadIndex],
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
 #ifdef KITCHEN_SINK
                        case 'K':
@@ -265,15 +289,15 @@ label:
                                */
                                pt = _conv((t->tm_hour % 12) ?
                                        (t->tm_hour % 12) : 12,
-                                       fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'M':
                                pt = _conv(t->tm_min, fmt_padding[PAD_FMT_HMS][PadIndex],
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 'm':
                                pt = _conv(t->tm_mon + 1,
-                                       fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'n':
                                pt = _add("\n", pt, ptlim);
@@ -285,15 +309,15 @@ label:
                                        pt, ptlim);
                                continue;
                        case 'R':
-                               pt = _fmt("%H:%M", t, pt, ptlim, warnp);
+                               pt = _fmt("%H:%M", t, pt, ptlim, warnp, tptr, loc);
                                continue;
                        case 'r':
                                pt = _fmt(tptr->ampm_fmt, t, pt, ptlim,
-                                       warnp);
+                                       warnp, tptr, loc);
                                continue;
                        case 'S':
                                pt = _conv(t->tm_sec, fmt_padding[PAD_FMT_HMS][PadIndex],
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 's':
                                {
@@ -305,15 +329,15 @@ label:
                                        tm = *t;
                                        mkt = mktime(&tm);
                                        if (TYPE_SIGNED(time_t))
-                                               (void) sprintf(buf, "%ld",
+                                               (void) sprintf_l(buf, loc, "%ld",
                                                        (long) mkt);
-                                       else    (void) sprintf(buf, "%lu",
+                                       else    (void) sprintf_l(buf, loc, "%lu",
                                                        (unsigned long) mkt);
                                        pt = _add(buf, pt, ptlim);
                                }
                                continue;
                        case 'T':
-                               pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp);
+                               pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp, tptr, loc);
                                continue;
                        case 't':
                                pt = _add("\t", pt, ptlim);
@@ -321,7 +345,7 @@ label:
                        case 'U':
                                pt = _conv((t->tm_yday + DAYSPERWEEK -
                                        t->tm_wday) / DAYSPERWEEK,
-                                       fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'u':
                                /*
@@ -332,7 +356,7 @@ label:
                                */
                                pt = _conv((t->tm_wday == 0) ?
                                        DAYSPERWEEK : t->tm_wday,
-                                       "%d", pt, ptlim);
+                                       "%d", pt, ptlim, loc);
                                continue;
                        case 'V':       /* ISO 8601 week number */
                        case 'G':       /* ISO 8601 year (four digits) */
@@ -413,13 +437,13 @@ label:
 #endif /* defined XPG4_1994_04_09 */
                                        if (*format == 'V')
                                                pt = _conv(w, fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex],
-                                                       pt, ptlim);
+                                                       pt, ptlim, loc);
                                        else if (*format == 'g') {
                                                *warnp = IN_ALL;
                                                pt = _yconv(year, base, 0, 1,
-                                                       pt, ptlim);
+                                                       pt, ptlim, loc);
                                        } else  pt = _yconv(year, base, 1, 1,
-                                                       pt, ptlim);
+                                                       pt, ptlim, loc);
                                }
                                continue;
                        case 'v':
@@ -428,26 +452,26 @@ label:
                                ** "date as dd-bbb-YYYY"
                                ** (ado, 1993-05-24)
                                */
-                               pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
+                               pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, tptr, loc);
                                continue;
                        case 'W':
                                pt = _conv((t->tm_yday + DAYSPERWEEK -
                                        (t->tm_wday ?
                                        (t->tm_wday - 1) :
                                        (DAYSPERWEEK - 1))) / DAYSPERWEEK,
-                                       fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim, loc);
                                continue;
                        case 'w':
-                               pt = _conv(t->tm_wday, "%d", pt, ptlim);
+                               pt = _conv(t->tm_wday, "%d", pt, ptlim, loc);
                                continue;
                        case 'X':
-                               pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp);
+                               pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp, tptr, loc);
                                continue;
                        case 'x':
                                {
                                int     warn2 = IN_SOME;
 
-                               pt = _fmt(tptr->x_fmt, t, pt, ptlim, &warn2);
+                               pt = _fmt(tptr->x_fmt, t, pt, ptlim, &warn2, tptr, loc);
                                if (warn2 == IN_ALL)
                                        warn2 = IN_THIS;
                                if (warn2 > *warnp)
@@ -457,11 +481,11 @@ label:
                        case 'y':
                                *warnp = IN_ALL;
                                pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 'Y':
                                pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
-                                       pt, ptlim);
+                                       pt, ptlim, loc);
                                continue;
                        case 'Z':
 #ifdef TM_ZONE
@@ -485,9 +509,9 @@ label:
 
                                if (t->tm_isdst < 0)
                                        continue;
-#ifdef TM_GMTOFF
+#if defined(TM_GMTOFF) && !__DARWIN_UNIX03
                                diff = t->TM_GMTOFF;
-#else /* !defined TM_GMTOFF */
+#else /* !defined TM_GMTOFF || __DARWIN_UNIX03 */
                                /*
                                ** C99 says that the UTC offset must
                                ** be computed by looking only at
@@ -509,7 +533,7 @@ label:
                                */
                                if (t->tm_isdst == 0)
 #ifdef USG_COMPAT
-                                       diff = -timezone;
+                                       diff = -_st_get_timezone();
 #else /* !defined USG_COMPAT */
                                        continue;
 #endif /* !defined USG_COMPAT */
@@ -519,7 +543,7 @@ label:
 #else /* !defined ALTZONE */
                                        continue;
 #endif /* !defined ALTZONE */
-#endif /* !defined TM_GMTOFF */
+#endif /* !defined TM_GMTOFF || __DARWIN_UNIX03 */
                                if (diff < 0) {
                                        sign = "-";
                                        diff = -diff;
@@ -529,12 +553,12 @@ label:
                                diff = (diff / MINSPERHOUR) * 100 +
                                        (diff % MINSPERHOUR);
                                pt = _conv(diff,
-                                       fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim);
+                                       fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim, loc);
                                }
                                continue;
                        case '+':
                                pt = _fmt(tptr->date_fmt, t, pt, ptlim,
-                                       warnp);
+                                       warnp, tptr, loc);
                                continue;
                        case '-':
                                if (PadIndex != PAD_DEFAULT)
@@ -569,15 +593,16 @@ label:
 }
 
 static char *
-_conv(n, format, pt, ptlim)
+_conv(n, format, pt, ptlim, loc)
 const int              n;
 const char * const     format;
 char * const           pt;
 const char * const     ptlim;
+locale_t               loc;
 {
        char    buf[INT_STRLEN_MAXIMUM(int) + 1];
 
-       (void) sprintf(buf, format, n);
+       (void) sprintf_l(buf, loc, format, n);
        return _add(buf, pt, ptlim);
 }
 
@@ -601,13 +626,14 @@ const char * const        ptlim;
 */
 
 static char *
-_yconv(a, b, convert_top, convert_yy, pt, ptlim)
+_yconv(a, b, convert_top, convert_yy, pt, ptlim, loc)
 const int              a;
 const int              b;
 const int              convert_top;
 const int              convert_yy;
 char *                 pt;
 const char * const     ptlim;
+locale_t               loc;
 {
        register int    lead;
        register int    trail;
@@ -626,9 +652,10 @@ const char * const ptlim;
        if (convert_top) {
                if (lead == 0 && trail < 0)
                        pt = _add("-0", pt, ptlim);
-               else    pt = _conv(lead, "%02d", pt, ptlim);
+               else    pt = _conv(lead, "%02d", pt, ptlim, loc);
        }
        if (convert_yy)
-               pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
+               pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim, loc);
        return pt;
 }
+#endif /* !BUILDING_VARIANT */
diff --git a/stdtime/FreeBSD/strftime.c.patch b/stdtime/FreeBSD/strftime.c.patch
deleted file mode 100644 (file)
index cef5022..0000000
+++ /dev/null
@@ -1,439 +0,0 @@
---- strftime.c.orig    2010-06-24 01:11:42.000000000 -0700
-+++ strftime.c 2010-06-24 11:29:51.000000000 -0700
-@@ -25,6 +25,8 @@ static const char    elsieid[] = "@(#)strft
- #endif /* !defined NOID */
- #endif /* !defined lint */
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include "private.h"
-@@ -35,18 +37,25 @@ static const char  sccsid[] = "@(#)strfti
- __FBSDID("$FreeBSD: src/lib/libc/stdtime/strftime.c,v 1.44 2009/06/09 09:02:58 delphij Exp $");
- #include "tzfile.h"
-+#include <time.h>
- #include <fcntl.h>
- #include <sys/stat.h>
- #include "un-namespace.h"
- #include "timelocal.h"
-+#if !BUILDING_VARIANT
- static char * _add(const char *, char *, const char *);
--static char * _conv(int, const char *, char *, const char *);
--static char * _fmt(const char *, const struct tm *, char *, const char *,
--                      int *);
--static char * _yconv(int, int, int, int, char *, const char *);
-+static char * _conv(int, const char *, char *, const char *, locale_t);
-+static char * _yconv(int, int, int, int, char *, const char *, locale_t);
-+#endif
-+#define       _fmt    _st_fmt
-+__private_extern__ char *     _fmt(const char *, const struct tm *, char *, const char *,
-+                      int *, struct lc_time_T *, locale_t);
- extern char * tzname[];
-+__private_extern__ long __darwin_altzone;             /* DST timezone offset */
-+#define altzone __darwin_altzone
-+__private_extern__ long _st_get_timezone(void);
- #ifndef YEAR_2000_NAME
- #define YEAR_2000_NAME        "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
-@@ -62,6 +71,7 @@ extern char *        tzname[];
- #define PAD_SPACE     2
- #define PAD_ZERO      3
-+#ifndef BUILDING_VARIANT
- static const char* fmt_padding[][4] = {
-       /* DEFAULT,     LESS,   SPACE,  ZERO */
- #define PAD_FMT_MONTHDAY      0
-@@ -80,31 +90,36 @@ static const char* fmt_padding[][4] = {
- #define PAD_FMT_YEAR          3
-       { "%04d",       "%d",   "%4d",  "%04d" }
- };
-+#endif
-+
-+#define USG_COMPAT
-+#define ALTZONE
- size_t
--strftime(char * __restrict s, size_t maxsize, const char * __restrict format,
--    const struct tm * __restrict t)
-+strftime_l(char * __restrict s, size_t maxsize, const char * __restrict format,
-+    const struct tm * __restrict t, locale_t loc)
- {
-       char *  p;
-       int     warn;
-+      NORMALIZE_LOCALE(loc);
-       tzset();
-       warn = IN_NONE;
--      p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
-+      p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, __get_current_time_locale(loc), loc);
- #ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
-       if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
--              (void) fprintf(stderr, "\n");
-+              (void) fputs("\n", stderr);
-               if (format == NULL)
--                      (void) fprintf(stderr, "NULL strftime format ");
--              else    (void) fprintf(stderr, "strftime format \"%s\" ",
-+                      (void) fputs("NULL strftime format ", stderr);
-+              else    (void) fprintf_l(stderr, loc, "strftime format \"%s\" ",
-                               format);
--              (void) fprintf(stderr, "yields only two digits of years in ");
-+              (void) fputs("yields only two digits of years in ", stderr);
-               if (warn == IN_SOME)
--                      (void) fprintf(stderr, "some locales");
-+                      (void) fputs("some locales", stderr);
-               else if (warn == IN_THIS)
--                      (void) fprintf(stderr, "the current locale");
--              else    (void) fprintf(stderr, "all locales");
--              (void) fprintf(stderr, "\n");
-+                      (void) fputs("the current locale", stderr);
-+              else    (void) fputs("all locales", stderr);
-+              (void) fputs("\n", stderr);
-       }
- #endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
-       if (p == s + maxsize)
-@@ -113,16 +128,25 @@ strftime(char * __restrict s, size_t max
-       return p - s;
- }
--static char *
--_fmt(format, t, pt, ptlim, warnp)
-+size_t
-+strftime(char * __restrict s, size_t maxsize, const char * __restrict format,
-+    const struct tm * __restrict t)
-+{
-+      return strftime_l(s, maxsize, format, t, __current_locale());
-+}
-+
-+#ifndef BUILDING_VARIANT
-+__private_extern__ char *
-+_fmt(format, t, pt, ptlim, warnp, tptr, loc)
- const char *          format;
- const struct tm * const       t;
- char *                        pt;
- const char * const    ptlim;
- int *                 warnp;
-+struct lc_time_T *    tptr;
-+locale_t              loc;
- {
-       int Ealternative, Oalternative, PadIndex;
--      struct lc_time_T *tptr = __get_current_time_locale();
-       for ( ; *format; ++format) {
-               if (*format == '%') {
-@@ -163,19 +187,19 @@ label:
-                       case 'C':
-                               /*
-                               ** %C used to do a...
--                              **      _fmt("%a %b %e %X %Y", t);
-+                              **      _fmt("%a %b %e %X %Y", t, tptr, loc);
-                               ** ...whereas now POSIX 1003.2 calls for
-                               ** something completely different.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 'c':
-                               {
-                               int warn2 = IN_SOME;
--                              pt = _fmt(tptr->c_fmt, t, pt, ptlim, &warn2);
-+                              pt = _fmt(tptr->c_fmt, t, pt, ptlim, &warn2, tptr, loc);
-                               if (warn2 == IN_ALL)
-                                       warn2 = IN_THIS;
-                               if (warn2 > *warnp)
-@@ -183,11 +207,11 @@ label:
-                               }
-                               continue;
-                       case 'D':
--                              pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp);
-+                              pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'd':
-                               pt = _conv(t->tm_mday, fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex],
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 'E':
-                               if (Ealternative || Oalternative)
-@@ -213,29 +237,29 @@ label:
-                               goto label;
-                       case 'e':
-                               pt = _conv(t->tm_mday,
--                                      fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'F':
--                              pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
-+                              pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'H':
-                               pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_HMS][PadIndex],
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 'I':
-                               pt = _conv((t->tm_hour % 12) ?
-                                       (t->tm_hour % 12) : 12,
--                                      fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'j':
-                               pt = _conv(t->tm_yday + 1,
--                                      fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'k':
-                               /*
-                               ** This used to be...
-                               **      _conv(t->tm_hour % 12 ?
--                              **              t->tm_hour % 12 : 12, 2, ' ');
-+                              **              t->tm_hour % 12 : 12, 2, ' ', loc);
-                               ** ...and has been changed to the below to
-                               ** match SunOS 4.1.1 and Arnold Robbins'
-                               ** strftime version 3.0. That is, "%k" and
-@@ -243,7 +267,7 @@ label:
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_SHMS][PadIndex],
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
- #ifdef KITCHEN_SINK
-                       case 'K':
-@@ -265,15 +289,15 @@ label:
-                               */
-                               pt = _conv((t->tm_hour % 12) ?
-                                       (t->tm_hour % 12) : 12,
--                                      fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'M':
-                               pt = _conv(t->tm_min, fmt_padding[PAD_FMT_HMS][PadIndex],
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 'm':
-                               pt = _conv(t->tm_mon + 1,
--                                      fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'n':
-                               pt = _add("\n", pt, ptlim);
-@@ -285,15 +309,15 @@ label:
-                                       pt, ptlim);
-                               continue;
-                       case 'R':
--                              pt = _fmt("%H:%M", t, pt, ptlim, warnp);
-+                              pt = _fmt("%H:%M", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'r':
-                               pt = _fmt(tptr->ampm_fmt, t, pt, ptlim,
--                                      warnp);
-+                                      warnp, tptr, loc);
-                               continue;
-                       case 'S':
-                               pt = _conv(t->tm_sec, fmt_padding[PAD_FMT_HMS][PadIndex],
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 's':
-                               {
-@@ -305,15 +329,15 @@ label:
-                                       tm = *t;
-                                       mkt = mktime(&tm);
-                                       if (TYPE_SIGNED(time_t))
--                                              (void) sprintf(buf, "%ld",
-+                                              (void) sprintf_l(buf, loc, "%ld",
-                                                       (long) mkt);
--                                      else    (void) sprintf(buf, "%lu",
-+                                      else    (void) sprintf_l(buf, loc, "%lu",
-                                                       (unsigned long) mkt);
-                                       pt = _add(buf, pt, ptlim);
-                               }
-                               continue;
-                       case 'T':
--                              pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp);
-+                              pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 't':
-                               pt = _add("\t", pt, ptlim);
-@@ -321,7 +345,7 @@ label:
-                       case 'U':
-                               pt = _conv((t->tm_yday + DAYSPERWEEK -
-                                       t->tm_wday) / DAYSPERWEEK,
--                                      fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'u':
-                               /*
-@@ -332,7 +356,7 @@ label:
-                               */
-                               pt = _conv((t->tm_wday == 0) ?
-                                       DAYSPERWEEK : t->tm_wday,
--                                      "%d", pt, ptlim);
-+                                      "%d", pt, ptlim, loc);
-                               continue;
-                       case 'V':       /* ISO 8601 week number */
-                       case 'G':       /* ISO 8601 year (four digits) */
-@@ -413,13 +437,13 @@ label:
- #endif /* defined XPG4_1994_04_09 */
-                                       if (*format == 'V')
-                                               pt = _conv(w, fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex],
--                                                      pt, ptlim);
-+                                                      pt, ptlim, loc);
-                                       else if (*format == 'g') {
-                                               *warnp = IN_ALL;
-                                               pt = _yconv(year, base, 0, 1,
--                                                      pt, ptlim);
-+                                                      pt, ptlim, loc);
-                                       } else  pt = _yconv(year, base, 1, 1,
--                                                      pt, ptlim);
-+                                                      pt, ptlim, loc);
-                               }
-                               continue;
-                       case 'v':
-@@ -428,26 +452,26 @@ label:
-                               ** "date as dd-bbb-YYYY"
-                               ** (ado, 1993-05-24)
-                               */
--                              pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
-+                              pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'W':
-                               pt = _conv((t->tm_yday + DAYSPERWEEK -
-                                       (t->tm_wday ?
-                                       (t->tm_wday - 1) :
-                                       (DAYSPERWEEK - 1))) / DAYSPERWEEK,
--                                      fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'w':
--                              pt = _conv(t->tm_wday, "%d", pt, ptlim);
-+                              pt = _conv(t->tm_wday, "%d", pt, ptlim, loc);
-                               continue;
-                       case 'X':
--                              pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp);
-+                              pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'x':
-                               {
-                               int     warn2 = IN_SOME;
--                              pt = _fmt(tptr->x_fmt, t, pt, ptlim, &warn2);
-+                              pt = _fmt(tptr->x_fmt, t, pt, ptlim, &warn2, tptr, loc);
-                               if (warn2 == IN_ALL)
-                                       warn2 = IN_THIS;
-                               if (warn2 > *warnp)
-@@ -457,11 +481,11 @@ label:
-                       case 'y':
-                               *warnp = IN_ALL;
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 'Y':
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
--                                      pt, ptlim);
-+                                      pt, ptlim, loc);
-                               continue;
-                       case 'Z':
- #ifdef TM_ZONE
-@@ -485,9 +509,9 @@ label:
-                               if (t->tm_isdst < 0)
-                                       continue;
--#ifdef TM_GMTOFF
-+#if defined(TM_GMTOFF) && !__DARWIN_UNIX03
-                               diff = t->TM_GMTOFF;
--#else /* !defined TM_GMTOFF */
-+#else /* !defined TM_GMTOFF || __DARWIN_UNIX03 */
-                               /*
-                               ** C99 says that the UTC offset must
-                               ** be computed by looking only at
-@@ -509,7 +533,7 @@ label:
-                               */
-                               if (t->tm_isdst == 0)
- #ifdef USG_COMPAT
--                                      diff = -timezone;
-+                                      diff = -_st_get_timezone();
- #else /* !defined USG_COMPAT */
-                                       continue;
- #endif /* !defined USG_COMPAT */
-@@ -519,7 +543,7 @@ label:
- #else /* !defined ALTZONE */
-                                       continue;
- #endif /* !defined ALTZONE */
--#endif /* !defined TM_GMTOFF */
-+#endif /* !defined TM_GMTOFF || __DARWIN_UNIX03 */
-                               if (diff < 0) {
-                                       sign = "-";
-                                       diff = -diff;
-@@ -529,12 +553,12 @@ label:
-                               diff = (diff / MINSPERHOUR) * 100 +
-                                       (diff % MINSPERHOUR);
-                               pt = _conv(diff,
--                                      fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim);
-+                                      fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim, loc);
-                               }
-                               continue;
-                       case '+':
-                               pt = _fmt(tptr->date_fmt, t, pt, ptlim,
--                                      warnp);
-+                                      warnp, tptr, loc);
-                               continue;
-                       case '-':
-                               if (PadIndex != PAD_DEFAULT)
-@@ -569,15 +593,16 @@ label:
- }
- static char *
--_conv(n, format, pt, ptlim)
-+_conv(n, format, pt, ptlim, loc)
- const int             n;
- const char * const    format;
- char * const          pt;
- const char * const    ptlim;
-+locale_t              loc;
- {
-       char    buf[INT_STRLEN_MAXIMUM(int) + 1];
--      (void) sprintf(buf, format, n);
-+      (void) sprintf_l(buf, loc, format, n);
-       return _add(buf, pt, ptlim);
- }
-@@ -601,13 +626,14 @@ const char * const       ptlim;
- */
- static char *
--_yconv(a, b, convert_top, convert_yy, pt, ptlim)
-+_yconv(a, b, convert_top, convert_yy, pt, ptlim, loc)
- const int             a;
- const int             b;
- const int             convert_top;
- const int             convert_yy;
- char *                        pt;
- const char * const    ptlim;
-+locale_t              loc;
- {
-       register int    lead;
-       register int    trail;
-@@ -626,9 +652,10 @@ const char * const        ptlim;
-       if (convert_top) {
-               if (lead == 0 && trail < 0)
-                       pt = _add("-0", pt, ptlim);
--              else    pt = _conv(lead, "%02d", pt, ptlim);
-+              else    pt = _conv(lead, "%02d", pt, ptlim, loc);
-       }
-       if (convert_yy)
--              pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
-+              pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim, loc);
-       return pt;
- }
-+#endif /* !BUILDING_VARIANT */
index 00e6b57932c921b065fb1cd64091424ff2ba1569..a9c25f98db7c9c121e47ab60b680221b15b35ab3 100644 (file)
@@ -29,7 +29,8 @@
 .Dt STRPTIME 3
 .Os
 .Sh NAME
-.Nm strptime
+.Nm strptime ,
+.Nm strptime_l
 .Nd parse date and time string
 .Sh LIBRARY
 .Lb libc
 .In time.h
 .Ft char *
 .Fo strptime
-.Fa "const char * restrict buf"
-.Fa "const char * restrict format"
-.Fa "struct tm * restrict timeptr"
+.Fa "const char *restrict buf"
+.Fa "const char *restrict format"
+.Fa "struct tm *restrict tm"
+.Fc
+.In time.h
+.In xlocale.h
+.Ft char *
+.Fo strptime_l
+.Fa "const char *restrict buf"
+.Fa "const char *restrict format"
+.Fa "struct tm *restrict tm"
+.Fa "locale_t loc"
 .Fc
 .Sh DESCRIPTION
 The
 .Fn strptime
 function parses the string in the buffer
-.Fa buf
+.Fa buf ,
 according to the string pointed to by
 .Fa format ,
 and fills in the elements of the structure pointed to by
-.Fa timeptr .
+.Fa tm .
 The resulting values will be relative to the local time zone.
 Thus, it can be considered the reverse operation of
 .Xr strftime 3 .
@@ -78,7 +88,7 @@ string does not contain enough conversion specifications to completely
 specify the resulting
 .Vt struct tm ,
 the unspecified members of
-.Va timeptr
+.Va tm
 are left untouched.
 For example, if
 .Fa format
@@ -91,9 +101,17 @@ and
 .Va tm_min
 will be modified.
 If time relative to today is desired, initialize the
-.Fa timeptr
+.Fa tm
 structure with today's date before passing it to
 .Fn strptime .
+.Pp
+While the
+.Fn strptime
+function uses the current locale, the
+.Fn strptime_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn strptime
@@ -104,10 +122,16 @@ that has not been required to satisfy the specified conversions in
 It returns
 .Dv NULL
 if one of the conversions failed.
+.Sh LEGACY DESCRIPTION
+In legacy mode, the
+.Fa %Y
+format specifier expects exactly 4 digits (leaving any trailing digits for the
+next specifier).
 .Sh SEE ALSO
 .Xr date 1 ,
 .Xr scanf 3 ,
-.Xr strftime 3
+.Xr strftime 3 ,
+.Xr xlocale 3
 .Sh HISTORY
 The
 .Fn strptime
diff --git a/stdtime/FreeBSD/strptime.3.patch b/stdtime/FreeBSD/strptime.3.patch
deleted file mode 100644 (file)
index 026d9d0..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
---- strptime.3.bsdnew  2009-11-14 13:55:44.000000000 -0800
-+++ strptime.3 2009-11-14 14:00:22.000000000 -0800
-@@ -29,7 +29,8 @@
- .Dt STRPTIME 3
- .Os
- .Sh NAME
--.Nm strptime
-+.Nm strptime ,
-+.Nm strptime_l
- .Nd parse date and time string
- .Sh LIBRARY
- .Lb libc
-@@ -37,19 +38,28 @@
- .In time.h
- .Ft char *
- .Fo strptime
--.Fa "const char * restrict buf"
--.Fa "const char * restrict format"
--.Fa "struct tm * restrict timeptr"
-+.Fa "const char *restrict buf"
-+.Fa "const char *restrict format"
-+.Fa "struct tm *restrict tm"
-+.Fc
-+.In time.h
-+.In xlocale.h
-+.Ft char *
-+.Fo strptime_l
-+.Fa "const char *restrict buf"
-+.Fa "const char *restrict format"
-+.Fa "struct tm *restrict tm"
-+.Fa "locale_t loc"
- .Fc
- .Sh DESCRIPTION
- The
- .Fn strptime
- function parses the string in the buffer
--.Fa buf
-+.Fa buf ,
- according to the string pointed to by
- .Fa format ,
- and fills in the elements of the structure pointed to by
--.Fa timeptr .
-+.Fa tm .
- The resulting values will be relative to the local time zone.
- Thus, it can be considered the reverse operation of
- .Xr strftime 3 .
-@@ -78,7 +88,7 @@ string does not contain enough conversio
- specify the resulting
- .Vt struct tm ,
- the unspecified members of
--.Va timeptr
-+.Va tm
- are left untouched.
- For example, if
- .Fa format
-@@ -91,9 +101,17 @@ and
- .Va tm_min
- will be modified.
- If time relative to today is desired, initialize the
--.Fa timeptr
-+.Fa tm
- structure with today's date before passing it to
- .Fn strptime .
-+.Pp
-+While the
-+.Fn strptime
-+function uses the current locale, the
-+.Fn strptime_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- Upon successful completion,
- .Fn strptime
-@@ -104,10 +122,16 @@ that has not been required to satisfy th
- It returns
- .Dv NULL
- if one of the conversions failed.
-+.Sh LEGACY DESCRIPTION
-+In legacy mode, the
-+.Fa %Y
-+format specifier expects exactly 4 digits (leaving any trailing digits for the
-+next specifier).
- .Sh SEE ALSO
- .Xr date 1 ,
- .Xr scanf 3 ,
--.Xr strftime 3
-+.Xr strftime 3 ,
-+.Xr xlocale 3
- .Sh HISTORY
- The
- .Fn strptime
index f1503f88e24b5f61fe072bdfe0349d1f3f0ecf74..963410b0e5172b5f8f847609a4ff5921bf4d23d0 100644 (file)
@@ -61,41 +61,55 @@ static char sccsid[] __unused = "@(#)strptime.c     0.1 (Powerdog) 94/03/27";
 #endif /* not lint */
 __FBSDID("$FreeBSD: src/lib/libc/stdtime/strptime.c,v 1.37 2009/09/02 04:56:30 ache Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <time.h>
 #include <ctype.h>
 #include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
+#include <stdint.h>
+#include <limits.h>
 #include "un-namespace.h"
 #include "libc_private.h"
 #include "timelocal.h"
 
-static char * _strptime(const char *, const char *, struct tm *, int *);
+time_t _mktime(struct tm *, const char *);
 
 #define asizeof(a)     (sizeof (a) / sizeof ((a)[0]))
 
+enum {CONVERT_NONE, CONVERT_GMT, CONVERT_ZONE};
+
+#define _strptime(b,f,t,c,l)   _strptime0(b,f,t,c,l,-1,0,-1)
+
 static char *
-_strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp)
+_strptime0(const char *buf, const char *fmt, struct tm *tm, int *convp, locale_t loc, int year, int yday, int wday)
 {
        char    c;
        const char *ptr;
        int     i,
                len;
        int Ealternative, Oalternative;
-       struct lc_time_T *tptr = __get_current_time_locale();
+       struct lc_time_T *tptr = __get_current_time_locale(loc);
 
        ptr = fmt;
        while (*ptr != 0) {
-               if (*buf == 0)
-                       break;
+               if (*buf == 0) {
+                       fmt = ptr;
+                       while (isspace_l((unsigned char)*ptr, loc)) {
+                               ptr++;
+                       }
+                       return ((*ptr)==0) ? (char *)fmt : 0; /* trailing whitespace is ok */
+               }
 
                c = *ptr++;
 
                if (c != '%') {
-                       if (isspace((unsigned char)c))
-                               while (*buf != 0 && isspace((unsigned char)*buf))
+                       if (isspace_l((unsigned char)c, loc))
+                               while (*buf != 0 && isspace_l((unsigned char)*buf, loc))
                                        buf++;
                        else if (c != *buf++)
                                return 0;
@@ -114,18 +128,18 @@ label:
                        break;
 
                case '+':
-                       buf = _strptime(buf, tptr->date_fmt, tm, GMTp);
+                       buf = _strptime(buf, tptr->date_fmt, tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'C':
-                       if (!isdigit((unsigned char)*buf))
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        /* XXX This will break for 3-digit centuries. */
                        len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -133,17 +147,21 @@ label:
                        if (i < 19)
                                return 0;
 
+                       if (year != -1)
+                               tm->tm_year = (year % 100) + i * 100 - 1900;
+                       else
                        tm->tm_year = i * 100 - 1900;
+                       year = tm->tm_year;
                        break;
 
                case 'c':
-                       buf = _strptime(buf, tptr->c_fmt, tm, GMTp);
+                       buf = _strptime(buf, tptr->c_fmt, tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'D':
-                       buf = _strptime(buf, "%m/%d/%y", tm, GMTp);
+                       buf = _strptime(buf, "%m/%d/%y", tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
@@ -161,47 +179,55 @@ label:
                        goto label;
 
                case 'F':
-                       buf = _strptime(buf, "%Y-%m-%d", tm, GMTp);
+                       buf = _strptime(buf, "%Y-%m-%d", tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'R':
-                       buf = _strptime(buf, "%H:%M", tm, GMTp);
+                       buf = _strptime(buf, "%H:%M", tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'r':
-                       buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp);
+                       buf = _strptime(buf, tptr->ampm_fmt, tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
+               case 'n':
+               case 't':
+                       if (!isspace((unsigned char)*buf))
+                               return 0;
+                       while (isspace((unsigned char)*buf))
+                               buf++;
+                       break;
+
                case 'T':
-                       buf = _strptime(buf, "%H:%M:%S", tm, GMTp);
+                       buf = _strptime(buf, "%H:%M:%S", tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'X':
-                       buf = _strptime(buf, tptr->X_fmt, tm, GMTp);
+                       buf = _strptime(buf, tptr->X_fmt, tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'x':
-                       buf = _strptime(buf, tptr->x_fmt, tm, GMTp);
+                       buf = _strptime(buf, tptr->x_fmt, tm, convp, loc);
                        if (buf == 0)
                                return 0;
                        break;
 
                case 'j':
-                       if (!isdigit((unsigned char)*buf))
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        len = 3;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -209,19 +235,19 @@ label:
                        if (i < 1 || i > 366)
                                return 0;
 
-                       tm->tm_yday = i - 1;
+                       tm->tm_yday = yday = i - 1;
                        break;
 
                case 'M':
                case 'S':
-                       if (*buf == 0 || isspace((unsigned char)*buf))
+                       if (*buf == 0 || isspace_l((unsigned char)*buf, loc))
                                break;
 
-                       if (!isdigit((unsigned char)*buf))
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -237,8 +263,8 @@ label:
                                tm->tm_sec = i;
                        }
 
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
@@ -254,11 +280,11 @@ label:
                         * XXX The %l specifier may gobble one too many
                         * digits if used incorrectly.
                         */
-                       if (!isdigit((unsigned char)*buf))
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -271,8 +297,8 @@ label:
 
                        tm->tm_hour = i;
 
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
@@ -282,7 +308,7 @@ label:
                         * specifiers.
                         */
                        len = strlen(tptr->am);
-                       if (strncasecmp(buf, tptr->am, len) == 0) {
+                       if (strncasecmp_l(buf, tptr->am, len, loc) == 0) {
                                if (tm->tm_hour > 12)
                                        return 0;
                                if (tm->tm_hour == 12)
@@ -292,7 +318,7 @@ label:
                        }
 
                        len = strlen(tptr->pm);
-                       if (strncasecmp(buf, tptr->pm, len) == 0) {
+                       if (strncasecmp_l(buf, tptr->pm, len, loc) == 0) {
                                if (tm->tm_hour > 12)
                                        return 0;
                                if (tm->tm_hour != 12)
@@ -307,34 +333,28 @@ label:
                case 'a':
                        for (i = 0; i < asizeof(tptr->weekday); i++) {
                                len = strlen(tptr->weekday[i]);
-                               if (strncasecmp(buf, tptr->weekday[i],
-                                               len) == 0)
+                               if (strncasecmp_l(buf, tptr->weekday[i],
+                                               len, loc) == 0)
                                        break;
                                len = strlen(tptr->wday[i]);
-                               if (strncasecmp(buf, tptr->wday[i],
-                                               len) == 0)
+                               if (strncasecmp_l(buf, tptr->wday[i],
+                                               len, loc) == 0)
                                        break;
                        }
                        if (i == asizeof(tptr->weekday))
                                return 0;
 
-                       tm->tm_wday = i;
+                       tm->tm_wday = wday = i;
                        buf += len;
                        break;
 
-               case 'U':
-               case 'W':
-                       /*
-                        * XXX This is bogus, as we can not assume any valid
-                        * information present in the tm structure at this
-                        * point to calculate a real value, so just check the
-                        * range for now.
-                        */
-                       if (!isdigit((unsigned char)*buf))
+               case 'U':       /* Sunday week */
+               case 'W':       /* Monday week */
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -342,23 +362,46 @@ label:
                        if (i > 53)
                                return 0;
 
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       /* Calculate yday if we have enough data */
+                       if ((year != -1) && (wday != -1)) {
+                               struct tm mktm;
+                               mktm.tm_year = year;
+                               mktm.tm_mon = 0;
+                               mktm.tm_mday = 1;
+                               mktm.tm_sec = 1;
+                               mktm.tm_min = mktm.tm_hour = 0;
+                               mktm.tm_isdst = 0;
+                               mktm.tm_gmtoff = 0;
+                               if (mktime(&mktm) != -1) {
+                                       /* yday0 == Jan 1 == mktm.tm_wday */
+                                       int delta = wday - mktm.tm_wday;
+                                       if (!wday && c =='W')
+                                               i++; /* Sunday is part of the following week */
+                                       yday = 7 * i + delta;
+                                       if (yday < 0)
+                                               yday += 7;
+                                       tm->tm_yday = yday;
+                               }
+                       }
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
-               case 'w':
-                       if (!isdigit((unsigned char)*buf))
+               case 'u':       /* [1,7] */
+               case 'w':       /* [0,6] */
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        i = *buf - '0';
-                       if (i > 6)
+                       if (i > 6 + (c == 'u'))
                                return 0;
-
-                       tm->tm_wday = i;
-
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       if (i == 7)
+                               i = 0;
+                       tm->tm_wday = wday = i;
+                       buf++;
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
@@ -372,11 +415,18 @@ label:
                         * XXX The %e specifier may gobble one too many
                         * digits if used incorrectly.
                         */
-                       if (!isdigit((unsigned char)*buf))
+                       /* Leading space is ok if date is single digit */
+                       len = 2;
+                       if (isspace_l((unsigned char)buf[0], loc) &&
+                           isdigit_l((unsigned char)buf[1], loc) &&
+                           !isdigit_l((unsigned char)buf[2], loc)) {
+                               len = 1;
+                               buf++;
+                       }
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
-                       len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -386,8 +436,8 @@ label:
 
                        tm->tm_mday = i;
 
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
@@ -398,19 +448,19 @@ label:
                                if (Oalternative) {
                                        if (c == 'B') {
                                                len = strlen(tptr->alt_month[i]);
-                                               if (strncasecmp(buf,
+                                               if (strncasecmp_l(buf,
                                                                tptr->alt_month[i],
-                                                               len) == 0)
+                                                               len, loc) == 0)
                                                        break;
                                        }
                                } else {
                                        len = strlen(tptr->month[i]);
-                                       if (strncasecmp(buf, tptr->month[i],
-                                                       len) == 0)
+                                       if (strncasecmp_l(buf, tptr->month[i],
+                                                       len, loc) == 0)
                                                break;
                                        len = strlen(tptr->mon[i]);
-                                       if (strncasecmp(buf, tptr->mon[i],
-                                                       len) == 0)
+                                       if (strncasecmp_l(buf, tptr->mon[i],
+                                                       len, loc) == 0)
                                                break;
                                }
                        }
@@ -422,11 +472,11 @@ label:
                        break;
 
                case 'm':
-                       if (!isdigit((unsigned char)*buf))
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
                        len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
@@ -436,8 +486,8 @@ label:
 
                        tm->tm_mon = i - 1;
 
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
@@ -450,7 +500,7 @@ label:
 
                        sverrno = errno;
                        errno = 0;
-                       n = strtol(buf, &cp, 10);
+                       n = strtol_l(buf, &cp, 10, loc);
                        if (errno == ERANGE || (long)(t = n) != n) {
                                errno = sverrno;
                                return 0;
@@ -458,24 +508,82 @@ label:
                        errno = sverrno;
                        buf = cp;
                        gmtime_r(&t, tm);
-                       *GMTp = 1;
+                       *convp = CONVERT_GMT;
                        }
                        break;
 
                case 'Y':
                case 'y':
-                       if (*buf == 0 || isspace((unsigned char)*buf))
+                       if (*buf == 0 || isspace_l((unsigned char)*buf, loc))
                                break;
 
-                       if (!isdigit((unsigned char)*buf))
+                       if (!isdigit_l((unsigned char)*buf, loc))
                                return 0;
 
+#if __DARWIN_UNIX03
+                       if (c == 'Y') {
+                               int savei = 0;
+                               const char *savebuf = buf;
+                               int64_t i64 = 0;
+                               int overflow = 0;
+
+                               for (len = 0; *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
+                                       i64 *= 10;
+                                       i64 += *buf - '0';
+                                       if (++len <= 4) {
+                                               savei = i64;
+                                               savebuf = buf + 1;
+                                       }
+                                       if (i64 > INT_MAX) {
+                                               overflow++;
+                                               break;
+                                       }
+                               }
+                               /*
+                                * Conformance requires %Y to be more then 4
+                                * digits.  However, there are several cases
+                                * where %Y is immediately followed by other
+                                * digits values.  So we do the conformance
+                                * case first (as many digits as possible),
+                                * and if we fail, we backup and try just 4
+                                * digits for %Y.
+                                */
+                               if (len > 4 && !overflow) {
+                                       struct tm savetm = *tm;
+                                       int saveconv = *convp;
+                                       const char *saveptr = ptr;
+                                       char *ret;
+
+                                       if (i64 < 1900)
+                                               return 0;
+
+                                       tm->tm_year = i64 - 1900;
+
+                                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
+                                                       ptr++;
+                                       ret = _strptime0(buf, ptr, tm, convp, loc, tm->tm_year, yday, wday);
+                                       if (ret) return ret;
+                                       /* Failed, so try 4-digit year */
+                                       *tm = savetm;
+                                       *convp = saveconv;
+                                       ptr = saveptr;
+                               }
+                               buf = savebuf;
+                               i = savei;
+                       } else {
+                               len = 2;
+#else /* !__DARWIN_UNIX03 */
                        len = (c == 'Y') ? 4 : 2;
-                       for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
+#endif /* __DARWIN_UNIX03 */
+                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
                                i *= 10;
                                i += *buf - '0';
                                len--;
                        }
+#if __DARWIN_UNIX03
+                       }
+#endif /* __DARWIN_UNIX03 */
                        if (c == 'Y')
                                i -= 1900;
                        if (c == 'y' && i < 69)
@@ -483,37 +591,40 @@ label:
                        if (i < 0)
                                return 0;
 
-                       tm->tm_year = i;
+                       tm->tm_year = year = i;
 
-                       if (*buf != 0 && isspace((unsigned char)*buf))
-                               while (*ptr != 0 && !isspace((unsigned char)*ptr))
+                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
+                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
                                        ptr++;
                        break;
 
                case 'Z':
                        {
                        const char *cp;
-                       char *zonestr;
+                       size_t tzlen, len;
 
                        for (cp = buf; *cp && isupper((unsigned char)*cp); ++cp) {/*empty*/}
-                       if (cp - buf) {
-                               zonestr = alloca(cp - buf + 1);
-                               strncpy(zonestr, buf, cp - buf);
-                               zonestr[cp - buf] = '\0';
-                               tzset();
-                               if (0 == strcmp(zonestr, "GMT")) {
-                                   *GMTp = 1;
-                               } else if (0 == strcmp(zonestr, tzname[0])) {
-                                   tm->tm_isdst = 0;
-                               } else if (0 == strcmp(zonestr, tzname[1])) {
-                                   tm->tm_isdst = 1;
-                               } else {
-                                   return 0;
-                               }
-                               buf += cp - buf;
+                       len = cp - buf;
+                       if (len == 3 && strncmp(buf, "GMT", 3) == 0) {
+                               *convp = CONVERT_GMT;
+                               buf += len;
+                               break;
                        }
+                       tzset();
+                       tzlen = strlen(tzname[0]);
+                       if (len == tzlen && strncmp(buf, tzname[0], tzlen) == 0) {
+                               tm->tm_isdst = 0;
+                               buf += len;
+                               break;
+                       }
+                       tzlen = strlen(tzname[1]);
+                       if (len == tzlen && strncmp(buf, tzname[1], tzlen) == 0) {
+                               tm->tm_isdst = 1;
+                               buf += len;
+                               break;
+                       }
+                       return 0;
                        }
-                       break;
 
                case 'z':
                        {
@@ -529,7 +640,7 @@ label:
                        buf++;
                        i = 0;
                        for (len = 4; len > 0; len--) {
-                               if (isdigit((unsigned char)*buf)) {
+                               if (isdigit_l((unsigned char)*buf, loc)) {
                                        i *= 10;
                                        i += *buf - '0';
                                        buf++;
@@ -539,7 +650,7 @@ label:
 
                        tm->tm_hour -= sign * (i / 100);
                        tm->tm_min  -= sign * (i % 100);
-                       *GMTp = 1;
+                       *convp = CONVERT_GMT;
                        }
                        break;
                }
@@ -552,14 +663,39 @@ char *
 strptime(const char * __restrict buf, const char * __restrict fmt,
     struct tm * __restrict tm)
 {
-       char *ret;
-       int gmt;
+       return strptime_l(buf, fmt, tm, __current_locale());
+}
+
+extern time_t timeoff(struct tm *, long);
 
-       gmt = 0;
-       ret = _strptime(buf, fmt, tm, &gmt);
-       if (ret && gmt) {
-               time_t t = timegm(tm);
-               localtime_r(&t, tm);
+char *
+strptime_l(const char * __restrict buf, const char * __restrict fmt,
+    struct tm * __restrict tm, locale_t loc)
+{
+       char *ret;
+       int conv;
+
+       NORMALIZE_LOCALE(loc);
+       conv = CONVERT_NONE;
+       tm->tm_zone = NULL;
+       ret = _strptime(buf, fmt, tm, &conv, loc);
+       if (ret) {
+               time_t t;
+
+               switch(conv) {
+               case CONVERT_GMT:
+                       t = timegm(tm);
+                       localtime_r(&t, tm);
+                       break;
+               case CONVERT_ZONE:
+                   {
+                       long offset = tm->tm_gmtoff;
+                       tm->tm_gmtoff = 0;
+                       t = timeoff(tm, offset);
+                       localtime_r(&t, tm);
+                       break;
+                   }
+               }
        }
 
        return (ret);
diff --git a/stdtime/FreeBSD/strptime.c.patch b/stdtime/FreeBSD/strptime.c.patch
deleted file mode 100644 (file)
index 5bce7e0..0000000
+++ /dev/null
@@ -1,659 +0,0 @@
---- strptime.c.orig    2009-11-14 13:55:44.000000000 -0800
-+++ strptime.c 2009-11-18 16:56:27.000000000 -0800
-@@ -61,41 +61,55 @@ static char sccsid[] __unused = "@(#)str
- #endif /* not lint */
- __FBSDID("$FreeBSD: src/lib/libc/stdtime/strptime.c,v 1.37 2009/09/02 04:56:30 ache Exp $");
-+#include "xlocale_private.h"
-+
- #include "namespace.h"
- #include <time.h>
- #include <ctype.h>
- #include <errno.h>
-+#include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <pthread.h>
-+#include <stdint.h>
-+#include <limits.h>
- #include "un-namespace.h"
- #include "libc_private.h"
- #include "timelocal.h"
--static char * _strptime(const char *, const char *, struct tm *, int *);
-+time_t _mktime(struct tm *, const char *);
- #define asizeof(a)    (sizeof (a) / sizeof ((a)[0]))
-+enum {CONVERT_NONE, CONVERT_GMT, CONVERT_ZONE};
-+
-+#define _strptime(b,f,t,c,l)  _strptime0(b,f,t,c,l,-1,0,-1)
-+
- static char *
--_strptime(const char *buf, const char *fmt, struct tm *tm, int *GMTp)
-+_strptime0(const char *buf, const char *fmt, struct tm *tm, int *convp, locale_t loc, int year, int yday, int wday)
- {
-       char    c;
-       const char *ptr;
-       int     i,
-               len;
-       int Ealternative, Oalternative;
--      struct lc_time_T *tptr = __get_current_time_locale();
-+      struct lc_time_T *tptr = __get_current_time_locale(loc);
-       ptr = fmt;
-       while (*ptr != 0) {
--              if (*buf == 0)
--                      break;
-+              if (*buf == 0) {
-+                      fmt = ptr;
-+                      while (isspace_l((unsigned char)*ptr, loc)) {
-+                              ptr++;
-+                      }
-+                      return ((*ptr)==0) ? (char *)fmt : 0; /* trailing whitespace is ok */
-+              }
-               c = *ptr++;
-               if (c != '%') {
--                      if (isspace((unsigned char)c))
--                              while (*buf != 0 && isspace((unsigned char)*buf))
-+                      if (isspace_l((unsigned char)c, loc))
-+                              while (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                                       buf++;
-                       else if (c != *buf++)
-                               return 0;
-@@ -114,18 +128,18 @@ label:
-                       break;
-               case '+':
--                      buf = _strptime(buf, tptr->date_fmt, tm, GMTp);
-+                      buf = _strptime(buf, tptr->date_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'C':
--                      if (!isdigit((unsigned char)*buf))
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       /* XXX This will break for 3-digit centuries. */
-                       len = 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -133,17 +147,21 @@ label:
-                       if (i < 19)
-                               return 0;
-+                      if (year != -1)
-+                              tm->tm_year = (year % 100) + i * 100 - 1900;
-+                      else
-                       tm->tm_year = i * 100 - 1900;
-+                      year = tm->tm_year;
-                       break;
-               case 'c':
--                      buf = _strptime(buf, tptr->c_fmt, tm, GMTp);
-+                      buf = _strptime(buf, tptr->c_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'D':
--                      buf = _strptime(buf, "%m/%d/%y", tm, GMTp);
-+                      buf = _strptime(buf, "%m/%d/%y", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-@@ -161,47 +179,55 @@ label:
-                       goto label;
-               case 'F':
--                      buf = _strptime(buf, "%Y-%m-%d", tm, GMTp);
-+                      buf = _strptime(buf, "%Y-%m-%d", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'R':
--                      buf = _strptime(buf, "%H:%M", tm, GMTp);
-+                      buf = _strptime(buf, "%H:%M", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'r':
--                      buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp);
-+                      buf = _strptime(buf, tptr->ampm_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-+              case 'n':
-+              case 't':
-+                      if (!isspace((unsigned char)*buf))
-+                              return 0;
-+                      while (isspace((unsigned char)*buf))
-+                              buf++;
-+                      break;
-+
-               case 'T':
--                      buf = _strptime(buf, "%H:%M:%S", tm, GMTp);
-+                      buf = _strptime(buf, "%H:%M:%S", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'X':
--                      buf = _strptime(buf, tptr->X_fmt, tm, GMTp);
-+                      buf = _strptime(buf, tptr->X_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'x':
--                      buf = _strptime(buf, tptr->x_fmt, tm, GMTp);
-+                      buf = _strptime(buf, tptr->x_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-               case 'j':
--                      if (!isdigit((unsigned char)*buf))
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       len = 3;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -209,19 +235,19 @@ label:
-                       if (i < 1 || i > 366)
-                               return 0;
--                      tm->tm_yday = i - 1;
-+                      tm->tm_yday = yday = i - 1;
-                       break;
-               case 'M':
-               case 'S':
--                      if (*buf == 0 || isspace((unsigned char)*buf))
-+                      if (*buf == 0 || isspace_l((unsigned char)*buf, loc))
-                               break;
--                      if (!isdigit((unsigned char)*buf))
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       len = 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -237,8 +263,8 @@ label:
-                               tm->tm_sec = i;
-                       }
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-@@ -254,11 +280,11 @@ label:
-                        * XXX The %l specifier may gobble one too many
-                        * digits if used incorrectly.
-                        */
--                      if (!isdigit((unsigned char)*buf))
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       len = 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -271,8 +297,8 @@ label:
-                       tm->tm_hour = i;
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-@@ -282,7 +308,7 @@ label:
-                        * specifiers.
-                        */
-                       len = strlen(tptr->am);
--                      if (strncasecmp(buf, tptr->am, len) == 0) {
-+                      if (strncasecmp_l(buf, tptr->am, len, loc) == 0) {
-                               if (tm->tm_hour > 12)
-                                       return 0;
-                               if (tm->tm_hour == 12)
-@@ -292,7 +318,7 @@ label:
-                       }
-                       len = strlen(tptr->pm);
--                      if (strncasecmp(buf, tptr->pm, len) == 0) {
-+                      if (strncasecmp_l(buf, tptr->pm, len, loc) == 0) {
-                               if (tm->tm_hour > 12)
-                                       return 0;
-                               if (tm->tm_hour != 12)
-@@ -307,34 +333,28 @@ label:
-               case 'a':
-                       for (i = 0; i < asizeof(tptr->weekday); i++) {
-                               len = strlen(tptr->weekday[i]);
--                              if (strncasecmp(buf, tptr->weekday[i],
--                                              len) == 0)
-+                              if (strncasecmp_l(buf, tptr->weekday[i],
-+                                              len, loc) == 0)
-                                       break;
-                               len = strlen(tptr->wday[i]);
--                              if (strncasecmp(buf, tptr->wday[i],
--                                              len) == 0)
-+                              if (strncasecmp_l(buf, tptr->wday[i],
-+                                              len, loc) == 0)
-                                       break;
-                       }
-                       if (i == asizeof(tptr->weekday))
-                               return 0;
--                      tm->tm_wday = i;
-+                      tm->tm_wday = wday = i;
-                       buf += len;
-                       break;
--              case 'U':
--              case 'W':
--                      /*
--                       * XXX This is bogus, as we can not assume any valid
--                       * information present in the tm structure at this
--                       * point to calculate a real value, so just check the
--                       * range for now.
--                       */
--                      if (!isdigit((unsigned char)*buf))
-+              case 'U':       /* Sunday week */
-+              case 'W':       /* Monday week */
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       len = 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -342,23 +362,46 @@ label:
-                       if (i > 53)
-                               return 0;
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      /* Calculate yday if we have enough data */
-+                      if ((year != -1) && (wday != -1)) {
-+                              struct tm mktm;
-+                              mktm.tm_year = year;
-+                              mktm.tm_mon = 0;
-+                              mktm.tm_mday = 1;
-+                              mktm.tm_sec = 1;
-+                              mktm.tm_min = mktm.tm_hour = 0;
-+                              mktm.tm_isdst = 0;
-+                              mktm.tm_gmtoff = 0;
-+                              if (mktime(&mktm) != -1) {
-+                                      /* yday0 == Jan 1 == mktm.tm_wday */
-+                                      int delta = wday - mktm.tm_wday;
-+                                      if (!wday && c =='W')
-+                                              i++; /* Sunday is part of the following week */
-+                                      yday = 7 * i + delta;
-+                                      if (yday < 0)
-+                                              yday += 7;
-+                                      tm->tm_yday = yday;
-+                              }
-+                      }
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
--              case 'w':
--                      if (!isdigit((unsigned char)*buf))
-+              case 'u':       /* [1,7] */
-+              case 'w':       /* [0,6] */
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       i = *buf - '0';
--                      if (i > 6)
-+                      if (i > 6 + (c == 'u'))
-                               return 0;
--
--                      tm->tm_wday = i;
--
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      if (i == 7)
-+                              i = 0;
-+                      tm->tm_wday = wday = i;
-+                      buf++;
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-@@ -372,11 +415,18 @@ label:
-                        * XXX The %e specifier may gobble one too many
-                        * digits if used incorrectly.
-                        */
--                      if (!isdigit((unsigned char)*buf))
-+                      /* Leading space is ok if date is single digit */
-+                      len = 2;
-+                      if (isspace_l((unsigned char)buf[0], loc) &&
-+                          isdigit_l((unsigned char)buf[1], loc) &&
-+                          !isdigit_l((unsigned char)buf[2], loc)) {
-+                              len = 1;
-+                              buf++;
-+                      }
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
--                      len = 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -386,8 +436,8 @@ label:
-                       tm->tm_mday = i;
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-@@ -398,19 +448,19 @@ label:
-                               if (Oalternative) {
-                                       if (c == 'B') {
-                                               len = strlen(tptr->alt_month[i]);
--                                              if (strncasecmp(buf,
-+                                              if (strncasecmp_l(buf,
-                                                               tptr->alt_month[i],
--                                                              len) == 0)
-+                                                              len, loc) == 0)
-                                                       break;
-                                       }
-                               } else {
-                                       len = strlen(tptr->month[i]);
--                                      if (strncasecmp(buf, tptr->month[i],
--                                                      len) == 0)
-+                                      if (strncasecmp_l(buf, tptr->month[i],
-+                                                      len, loc) == 0)
-                                               break;
-                                       len = strlen(tptr->mon[i]);
--                                      if (strncasecmp(buf, tptr->mon[i],
--                                                      len) == 0)
-+                                      if (strncasecmp_l(buf, tptr->mon[i],
-+                                                      len, loc) == 0)
-                                               break;
-                               }
-                       }
-@@ -422,11 +472,11 @@ label:
-                       break;
-               case 'm':
--                      if (!isdigit((unsigned char)*buf))
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-                       len = 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-@@ -436,8 +486,8 @@ label:
-                       tm->tm_mon = i - 1;
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-@@ -450,7 +500,7 @@ label:
-                       sverrno = errno;
-                       errno = 0;
--                      n = strtol(buf, &cp, 10);
-+                      n = strtol_l(buf, &cp, 10, loc);
-                       if (errno == ERANGE || (long)(t = n) != n) {
-                               errno = sverrno;
-                               return 0;
-@@ -458,24 +508,82 @@ label:
-                       errno = sverrno;
-                       buf = cp;
-                       gmtime_r(&t, tm);
--                      *GMTp = 1;
-+                      *convp = CONVERT_GMT;
-                       }
-                       break;
-               case 'Y':
-               case 'y':
--                      if (*buf == 0 || isspace((unsigned char)*buf))
-+                      if (*buf == 0 || isspace_l((unsigned char)*buf, loc))
-                               break;
--                      if (!isdigit((unsigned char)*buf))
-+                      if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-+#if __DARWIN_UNIX03
-+                      if (c == 'Y') {
-+                              int savei = 0;
-+                              const char *savebuf = buf;
-+                              int64_t i64 = 0;
-+                              int overflow = 0;
-+
-+                              for (len = 0; *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-+                                      i64 *= 10;
-+                                      i64 += *buf - '0';
-+                                      if (++len <= 4) {
-+                                              savei = i64;
-+                                              savebuf = buf + 1;
-+                                      }
-+                                      if (i64 > INT_MAX) {
-+                                              overflow++;
-+                                              break;
-+                                      }
-+                              }
-+                              /*
-+                               * Conformance requires %Y to be more then 4
-+                               * digits.  However, there are several cases
-+                               * where %Y is immediately followed by other
-+                               * digits values.  So we do the conformance
-+                               * case first (as many digits as possible),
-+                               * and if we fail, we backup and try just 4
-+                               * digits for %Y.
-+                               */
-+                              if (len > 4 && !overflow) {
-+                                      struct tm savetm = *tm;
-+                                      int saveconv = *convp;
-+                                      const char *saveptr = ptr;
-+                                      char *ret;
-+
-+                                      if (i64 < 1900)
-+                                              return 0;
-+
-+                                      tm->tm_year = i64 - 1900;
-+
-+                                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-+                                                      ptr++;
-+                                      ret = _strptime0(buf, ptr, tm, convp, loc, tm->tm_year, yday, wday);
-+                                      if (ret) return ret;
-+                                      /* Failed, so try 4-digit year */
-+                                      *tm = savetm;
-+                                      *convp = saveconv;
-+                                      ptr = saveptr;
-+                              }
-+                              buf = savebuf;
-+                              i = savei;
-+                      } else {
-+                              len = 2;
-+#else /* !__DARWIN_UNIX03 */
-                       len = (c == 'Y') ? 4 : 2;
--                      for (i = 0; len && *buf != 0 && isdigit((unsigned char)*buf); buf++) {
-+#endif /* __DARWIN_UNIX03 */
-+                      for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-+#if __DARWIN_UNIX03
-+                      }
-+#endif /* __DARWIN_UNIX03 */
-                       if (c == 'Y')
-                               i -= 1900;
-                       if (c == 'y' && i < 69)
-@@ -483,37 +591,40 @@ label:
-                       if (i < 0)
-                               return 0;
--                      tm->tm_year = i;
-+                      tm->tm_year = year = i;
--                      if (*buf != 0 && isspace((unsigned char)*buf))
--                              while (*ptr != 0 && !isspace((unsigned char)*ptr))
-+                      if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-+                              while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-               case 'Z':
-                       {
-                       const char *cp;
--                      char *zonestr;
-+                      size_t tzlen, len;
-                       for (cp = buf; *cp && isupper((unsigned char)*cp); ++cp) {/*empty*/}
--                      if (cp - buf) {
--                              zonestr = alloca(cp - buf + 1);
--                              strncpy(zonestr, buf, cp - buf);
--                              zonestr[cp - buf] = '\0';
--                              tzset();
--                              if (0 == strcmp(zonestr, "GMT")) {
--                                  *GMTp = 1;
--                              } else if (0 == strcmp(zonestr, tzname[0])) {
--                                  tm->tm_isdst = 0;
--                              } else if (0 == strcmp(zonestr, tzname[1])) {
--                                  tm->tm_isdst = 1;
--                              } else {
--                                  return 0;
--                              }
--                              buf += cp - buf;
-+                      len = cp - buf;
-+                      if (len == 3 && strncmp(buf, "GMT", 3) == 0) {
-+                              *convp = CONVERT_GMT;
-+                              buf += len;
-+                              break;
-                       }
-+                      tzset();
-+                      tzlen = strlen(tzname[0]);
-+                      if (len == tzlen && strncmp(buf, tzname[0], tzlen) == 0) {
-+                              tm->tm_isdst = 0;
-+                              buf += len;
-+                              break;
-+                      }
-+                      tzlen = strlen(tzname[1]);
-+                      if (len == tzlen && strncmp(buf, tzname[1], tzlen) == 0) {
-+                              tm->tm_isdst = 1;
-+                              buf += len;
-+                              break;
-+                      }
-+                      return 0;
-                       }
--                      break;
-               case 'z':
-                       {
-@@ -529,7 +640,7 @@ label:
-                       buf++;
-                       i = 0;
-                       for (len = 4; len > 0; len--) {
--                              if (isdigit((unsigned char)*buf)) {
-+                              if (isdigit_l((unsigned char)*buf, loc)) {
-                                       i *= 10;
-                                       i += *buf - '0';
-                                       buf++;
-@@ -539,7 +650,7 @@ label:
-                       tm->tm_hour -= sign * (i / 100);
-                       tm->tm_min  -= sign * (i % 100);
--                      *GMTp = 1;
-+                      *convp = CONVERT_GMT;
-                       }
-                       break;
-               }
-@@ -552,14 +663,39 @@ char *
- strptime(const char * __restrict buf, const char * __restrict fmt,
-     struct tm * __restrict tm)
- {
-+      return strptime_l(buf, fmt, tm, __current_locale());
-+}
-+
-+extern time_t timeoff(struct tm *, long);
-+
-+char *
-+strptime_l(const char * __restrict buf, const char * __restrict fmt,
-+    struct tm * __restrict tm, locale_t loc)
-+{
-       char *ret;
--      int gmt;
-+      int conv;
--      gmt = 0;
--      ret = _strptime(buf, fmt, tm, &gmt);
--      if (ret && gmt) {
--              time_t t = timegm(tm);
--              localtime_r(&t, tm);
-+      NORMALIZE_LOCALE(loc);
-+      conv = CONVERT_NONE;
-+      tm->tm_zone = NULL;
-+      ret = _strptime(buf, fmt, tm, &conv, loc);
-+      if (ret) {
-+              time_t t;
-+
-+              switch(conv) {
-+              case CONVERT_GMT:
-+                      t = timegm(tm);
-+                      localtime_r(&t, tm);
-+                      break;
-+              case CONVERT_ZONE:
-+                  {
-+                      long offset = tm->tm_gmtoff;
-+                      tm->tm_gmtoff = 0;
-+                      t = timeoff(tm, offset);
-+                      localtime_r(&t, tm);
-+                      break;
-+                  }
-+              }
-       }
-       return (ret);
index 2aba03c58ae921d84271b663138906a6ce020b75..e3673be09a8157fdcd439cec527ea4c1ab883b65 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.25 2003/06/13 00:14:07 jkh Exp $");
 
+#include "xlocale_private.h"
+
 #include <stddef.h>
+#include <string.h>
 
 #include "ldpart.h"
 #include "timelocal.h"
 
-static struct lc_time_T _time_locale;
-static int _time_using_locale;
-static char *time_locale_buf;
-
 #define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
 
 static const struct lc_time_T  _C_time_locale = {
@@ -99,19 +98,57 @@ static const struct lc_time_T       _C_time_locale = {
        "%I:%M:%S %p"
 };
 
-struct lc_time_T *
-__get_current_time_locale(void)
+__private_extern__ struct lc_time_T *
+__get_current_time_locale(locale_t loc)
 {
-       return (_time_using_locale
-               ? &_time_locale
+       return (loc->_time_using_locale
+               ? &loc->__lc_time->_time_locale
                : (struct lc_time_T *)&_C_time_locale);
 }
 
-int
-__time_load_locale(const char *name)
+__private_extern__ int
+__time_load_locale(const char *name, locale_t loc)
 {
-       return (__part_load_locale(name, &_time_using_locale,
-                       &time_locale_buf, "LC_TIME",
+       int ret;
+       struct __xlocale_st_time *xp;
+       static struct __xlocale_st_time *cache = NULL;
+
+       /* 'name' must be already checked. */
+       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+               loc->_time_using_locale = 0;
+               XL_RELEASE(loc->__lc_time);
+               loc->__lc_time = NULL;
+               return (_LDP_CACHE);
+       }
+
+       /*
+        * If the locale name is the same as our cache, use the cache.
+        */
+       if (cache && cache->_time_locale_buf && strcmp(name, cache->_time_locale_buf) == 0) {
+               loc->_time_using_locale = 1;
+               XL_RELEASE(loc->__lc_time);
+               loc->__lc_time = cache;
+               XL_RETAIN(loc->__lc_time);
+               return (_LDP_CACHE);
+       }
+       if ((xp = (struct __xlocale_st_time *)malloc(sizeof(*xp))) == NULL)
+               return _LDP_ERROR;
+       xp->__refcount = 1;
+       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
+       xp->_time_locale_buf = NULL;
+
+       ret = __part_load_locale(name, &loc->_time_using_locale,
+                       &xp->_time_locale_buf, "LC_TIME",
                        LCTIME_SIZE, LCTIME_SIZE,
-                       (const char **)&_time_locale));
+                       (const char **)&xp->_time_locale);
+       if (ret == _LDP_LOADED) {
+               XL_RELEASE(loc->__lc_time);
+               loc->__lc_time = xp;
+               XL_RELEASE(cache);
+               cache = xp;
+               XL_RETAIN(cache);
+       } else if (ret == _LDP_ERROR)
+               free(xp);
+
+       return (ret);
 }
diff --git a/stdtime/FreeBSD/timelocal.c.patch b/stdtime/FreeBSD/timelocal.c.patch
deleted file mode 100644 (file)
index fa75095..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
---- timelocal.c.orig   2004-11-25 11:38:45.000000000 -0800
-+++ timelocal.c        2005-02-17 10:08:04.000000000 -0800
-@@ -28,15 +28,14 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.25 2003/06/13 00:14:07 jkh Exp $");
-+#include "xlocale_private.h"
-+
- #include <stddef.h>
-+#include <string.h>
- #include "ldpart.h"
- #include "timelocal.h"
--static struct lc_time_T _time_locale;
--static int _time_using_locale;
--static char *time_locale_buf;
--
- #define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
- static const struct lc_time_T _C_time_locale = {
-@@ -99,19 +98,57 @@
-       "%I:%M:%S %p"
- };
--struct lc_time_T *
--__get_current_time_locale(void)
-+__private_extern__ struct lc_time_T *
-+__get_current_time_locale(locale_t loc)
- {
--      return (_time_using_locale
--              ? &_time_locale
-+      return (loc->_time_using_locale
-+              ? &loc->__lc_time->_time_locale
-               : (struct lc_time_T *)&_C_time_locale);
- }
--int
--__time_load_locale(const char *name)
-+__private_extern__ int
-+__time_load_locale(const char *name, locale_t loc)
- {
--      return (__part_load_locale(name, &_time_using_locale,
--                      &time_locale_buf, "LC_TIME",
-+      int ret;
-+      struct __xlocale_st_time *xp;
-+      static struct __xlocale_st_time *cache = NULL;
-+
-+      /* 'name' must be already checked. */
-+      if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-+              loc->_time_using_locale = 0;
-+              XL_RELEASE(loc->__lc_time);
-+              loc->__lc_time = NULL;
-+              return (_LDP_CACHE);
-+      }
-+
-+      /*
-+       * If the locale name is the same as our cache, use the cache.
-+       */
-+      if (cache && cache->_time_locale_buf && strcmp(name, cache->_time_locale_buf) == 0) {
-+              loc->_time_using_locale = 1;
-+              XL_RELEASE(loc->__lc_time);
-+              loc->__lc_time = cache;
-+              XL_RETAIN(loc->__lc_time);
-+              return (_LDP_CACHE);
-+      }
-+      if ((xp = (struct __xlocale_st_time *)malloc(sizeof(*xp))) == NULL)
-+              return _LDP_ERROR;
-+      xp->__refcount = 1;
-+      xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-+      xp->_time_locale_buf = NULL;
-+
-+      ret = __part_load_locale(name, &loc->_time_using_locale,
-+                      &xp->_time_locale_buf, "LC_TIME",
-                       LCTIME_SIZE, LCTIME_SIZE,
--                      (const char **)&_time_locale));
-+                      (const char **)&xp->_time_locale);
-+      if (ret == _LDP_LOADED) {
-+              XL_RELEASE(loc->__lc_time);
-+              loc->__lc_time = xp;
-+              XL_RELEASE(cache);
-+              cache = xp;
-+              XL_RETAIN(cache);
-+      } else if (ret == _LDP_ERROR)
-+              free(xp);
-+
-+      return (ret);
- }
index 0b0a59a483d4c00f4677e6f0c67ad9d1d5953d6d..02806e8a31378318860f6d4f6f0fe2349791f19b 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef _TIMELOCAL_H_
 #define        _TIMELOCAL_H_
 
+#include <xlocale.h>
+
 /*
  * Private header file for the strftime and strptime localization
  * stuff.
@@ -49,7 +51,7 @@ struct lc_time_T {
        const char      *ampm_fmt;
 };
 
-struct lc_time_T *__get_current_time_locale(void);
-int    __time_load_locale(const char *);
+struct lc_time_T *__get_current_time_locale(locale_t);
+int    __time_load_locale(const char *, locale_t);
 
 #endif /* !_TIMELOCAL_H_ */
diff --git a/stdtime/FreeBSD/timelocal.h.patch b/stdtime/FreeBSD/timelocal.h.patch
deleted file mode 100644 (file)
index 7aa22dd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- timelocal.h.orig   2003-05-20 15:23:48.000000000 -0700
-+++ timelocal.h        2005-02-19 14:49:09.000000000 -0800
-@@ -29,6 +29,8 @@
- #ifndef _TIMELOCAL_H_
- #define       _TIMELOCAL_H_
-+#include <xlocale.h>
-+
- /*
-  * Private header file for the strftime and strptime localization
-  * stuff.
-@@ -49,7 +51,7 @@
-       const char      *ampm_fmt;
- };
--struct lc_time_T *__get_current_time_locale(void);
--int   __time_load_locale(const char *);
-+struct lc_time_T *__get_current_time_locale(locale_t);
-+int   __time_load_locale(const char *, locale_t);
- #endif /* !_TIMELOCAL_H_ */
index 04ecce86136d870068677773a8f65ee6379e7676..6dcbc27490368f34acc26f943ed1eac3f7025d33 100644 (file)
@@ -6,7 +6,7 @@
 .Nm tzfile
 .Nd timezone information
 .Sh SYNOPSIS
-.Fd #include \&"/usr/src/lib/libc/stdtime/tzfile.h\&"
+.In tzfile.h
 .Sh DESCRIPTION
 The time zone information files used by
 .Xr tzset 3
diff --git a/stdtime/FreeBSD/tzfile.5.patch b/stdtime/FreeBSD/tzfile.5.patch
deleted file mode 100644 (file)
index 7545cfc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- tzfile.5.orig      2006-02-03 12:54:23.000000000 -0800
-+++ tzfile.5   2006-02-03 12:54:44.000000000 -0800
-@@ -6,7 +6,7 @@
- .Nm tzfile
- .Nd timezone information
- .Sh SYNOPSIS
--.Fd #include \&"/usr/src/lib/libc/stdtime/tzfile.h\&"
-+.In tzfile.h
- .Sh DESCRIPTION
- The time zone information files used by
- .Xr tzset 3
index 378d7ae606c6c04c8e00a3dd20d7b95a33829490..efa8416e9dc632e89c3e1ed540fb7df6c5847230 100644 (file)
@@ -38,7 +38,11 @@ static char  tzfilehid[] = "@(#)tzfile.h     7.14";
 #endif /* !defined TZDIR */
 
 #ifndef TZDEFAULT
+#ifdef UNIFDEF_MOVE_LOCALTIME
+#define TZDEFAULT      "/var/db/timezone/localtime"
+#else /* !UNIFDEF_MOVE_LOCALTIME */
 #define TZDEFAULT      "/etc/localtime"
+#endif /* UNIFDEF_MOVE_LOCALTIME */
 #endif /* !defined TZDEFAULT */
 
 #ifndef TZDEFRULES
@@ -167,6 +171,20 @@ struct tzhead {
 
 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
 
+/*
+** Since everything in isleap is modulo 400 (or a factor of 400), we know that
+**     isleap(y) == isleap(y % 400)
+** and so
+**     isleap(a + b) == isleap((a + b) % 400)
+** or
+**     isleap(a + b) == isleap(a % 400 + b % 400)
+** This is true even if % means modulo rather than Fortran remainder
+** (which is allowed by C89 but not C99).
+** We use this to avoid addition overflow problems.
+*/
+
+#define isleap_sum(a, b)       isleap((a) % 400 + (b) % 400)
+
 #ifndef USG
 
 /*
diff --git a/stdtime/FreeBSD/tzfile.h.patch b/stdtime/FreeBSD/tzfile.h.patch
deleted file mode 100644 (file)
index 4b7a18c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- tzfile.h.orig      2010-01-15 00:06:58.000000000 -0800
-+++ tzfile.h   2010-01-15 00:07:28.000000000 -0800
-@@ -38,7 +38,11 @@ static char tzfilehid[] = "@(#)tzfile.h     
- #endif /* !defined TZDIR */
- #ifndef TZDEFAULT
-+#ifdef UNIFDEF_MOVE_LOCALTIME
-+#define TZDEFAULT     "/var/db/timezone/localtime"
-+#else /* !UNIFDEF_MOVE_LOCALTIME */
- #define TZDEFAULT     "/etc/localtime"
-+#endif /* UNIFDEF_MOVE_LOCALTIME */
- #endif /* !defined TZDEFAULT */
- #ifndef TZDEFRULES
-@@ -167,6 +171,20 @@ struct tzhead {
- #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-+/*
-+** Since everything in isleap is modulo 400 (or a factor of 400), we know that
-+**    isleap(y) == isleap(y % 400)
-+** and so
-+**    isleap(a + b) == isleap((a + b) % 400)
-+** or
-+**    isleap(a + b) == isleap(a % 400 + b % 400)
-+** This is true even if % means modulo rather than Fortran remainder
-+** (which is allowed by C89 but not C99).
-+** We use this to avoid addition overflow problems.
-+*/
-+
-+#define isleap_sum(a, b)      isleap((a) % 400 + (b) % 400)
-+
- #ifndef USG
- /*
diff --git a/stdtime/Makefile.inc b/stdtime/Makefile.inc
deleted file mode 100644 (file)
index be72644..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#      Makefile.inc,v 1.2 1994/09/13 21:26:01 wollman Exp
-# $FreeBSD: src/lib/libc/stdtime/Makefile.inc,v 1.14 2002/11/18 09:50:56 ru Exp $
-
-.PATH: ${.CURDIR}/stdtime
-CWD := ${.CURDIR}/stdtime
-
-CFLAGS += -I${.CURDIR}/stdtime
-
-LEGACYSRCS += localtime.c strftime.c strptime.c
-
-MISRCS += getdate.c timezone_unix03.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-getdate.c += -D_DARWIN_UNLIMITED_STREAMS
-CFLAGS-localtime-fbsd.c += -DLIBC_ALIAS_MKTIME
-CFLAGS-strftime-fbsd.c += -DLIBC_ALIAS_STRFTIME -DLIBC_ALIAS_STRFTIME_L
-CFLAGS-strptime-fbsd.c += -DLIBC_ALIAS_STRPTIME -DLIBC_ALIAS_STRPTIME_L
-
-.include "Makefile.fbsd_begin"
-FBSDMISRCS= asctime.c difftime.c ftime.c localtime.c \
-       strftime.c strptime.c timelocal.c time32.c
-FBSDHDRS= private.h timelocal.h tzfile.h
-.include "Makefile.fbsd_end"
-INSTHDRS += ${.CURDIR}/stdtime/tzfile.h
-
-.if ${LIB} == "c"
-.include "Makefile.fbsd_begin"
-FBSDMAN3= ctime.3 ftime.3 strftime.3 strptime.3 time2posix.3
-FBSDMAN5= tzfile.5
-.include "Makefile.fbsd_end"
-
-MAN3   += getdate.3 timegm.3
-MLINKS += timegm.3 timelocal.3
-
-MLINKS+=ctime.3 asctime.3 ctime.3 difftime.3 ctime.3 gmtime.3 \
-       ctime.3 localtime.3 ctime.3 mktime.3 \
-       ctime.3 ctime_r.3 ctime.3 localtime_r.3 ctime.3 gmtime_r.3 \
-       ctime.3 asctime_r.3
-MLINKS+=time2posix.3 posix2time.3
-MLINKS+=strftime.3 strftime_l.3
-MLINKS+=strptime.3 strptime_l.3
-.endif
diff --git a/stdtime/asctime-fbsd.c b/stdtime/asctime-fbsd.c
deleted file mode 100644 (file)
index 89804ab..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson.
-*/
-
-/*
-** Avoid the temptation to punt entirely to strftime;
-** the output of strftime is supposed to be locale specific
-** whereas the output of asctime is supposed to be constant.
-*/
-
-#include <sys/cdefs.h>
-#ifndef lint
-#ifndef NOID
-static char    elsieid[] __unused = "@(#)asctime.c     8.2";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-__FBSDID("$FreeBSD: src/lib/libc/stdtime/asctime.c,v 1.13 2009/05/23 06:31:50 edwin Exp $");
-
-/*LINTLIBRARY*/
-
-#include "namespace.h"
-#include "private.h"
-#include "un-namespace.h"
-#include "tzfile.h"
-
-/*
-** Some systems only handle "%.2d"; others only handle "%02d";
-** "%02.2d" makes (most) everybody happy.
-** At least some versions of gcc warn about the %02.2d;
-** we conditionalize below to avoid the warning.
-*/
-/*
-** All years associated with 32-bit time_t values are exactly four digits long;
-** some years associated with 64-bit time_t values are not.
-** Vintage programs are coded for years that are always four digits long
-** and may assume that the newline always lands in the same place.
-** For years that are less than four digits, we pad the output with
-** leading zeroes to get the newline in the traditional place.
-** The -4 ensures that we get four characters of output even if
-** we call a strftime variant that produces fewer characters for some years.
-** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year,
-** but many implementations pad anyway; most likely the standards are buggy.
-*/
-#ifdef __GNUC__
-#define ASCTIME_FMT    "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n"
-#else /* !defined __GNUC__ */
-#define ASCTIME_FMT    "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n"
-#endif /* !defined __GNUC__ */
-/*
-** For years that are more than four digits we put extra spaces before the year
-** so that code trying to overwrite the newline won't end up overwriting
-** a digit within a year and truncating the year (operating on the assumption
-** that no output is better than wrong output).
-*/
-#ifdef __GNUC__
-#define ASCTIME_FMT_B  "%.3s %.3s%3d %2.2d:%2.2d:%2.2d     %s\n"
-#else /* !defined __GNUC__ */
-#define ASCTIME_FMT_B  "%.3s %.3s%3d %02.2d:%02.2d:%02.2d     %s\n"
-#endif /* !defined __GNUC__ */
-
-#define STD_ASCTIME_BUF_SIZE   26
-/*
-** Big enough for something such as
-** ??? ???-2147483648 -2147483648:-2147483648:-2147483648     -2147483648\n
-** (two three-character abbreviations, five strings denoting integers,
-** seven explicit spaces, two explicit colons, a newline,
-** and a trailing ASCII nul).
-** The values above are for systems where an int is 32 bits and are provided
-** as an example; the define below calculates the maximum for the system at
-** hand.
-*/
-#define MAX_ASCTIME_BUF_SIZE   (2*3+5*INT_STRLEN_MAXIMUM(int)+7+2+1+1)
-
-static char    buf_asctime[MAX_ASCTIME_BUF_SIZE];
-
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
-*/
-
-char *
-asctime_r(const struct tm * __restrict timeptr, char * __restrict buf)
-{
-       static const char       wday_name[][3] = {
-               "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-       };
-       static const char       mon_name[][3] = {
-               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-       };
-       const char *    wn;
-       const char *    mn;
-       char                    year[INT_STRLEN_MAXIMUM(int) + 2];
-       char                    result[MAX_ASCTIME_BUF_SIZE];
-
-       if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
-               wn = "???";
-       else    wn = wday_name[timeptr->tm_wday];
-       if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
-               mn = "???";
-       else    mn = mon_name[timeptr->tm_mon];
-       /*
-       ** Use strftime's %Y to generate the year, to avoid overflow problems
-       ** when computing timeptr->tm_year + TM_YEAR_BASE.
-       ** Assume that strftime is unaffected by other out-of-range members
-       ** (e.g., timeptr->tm_mday) when processing "%Y".
-       */
-       (void) strftime(year, sizeof year, "%Y", timeptr);
-       /*
-       ** We avoid using snprintf since it's not available on all systems.
-       */
-       (void) sprintf(result,
-               ((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
-               wn, mn,
-               timeptr->tm_mday, timeptr->tm_hour,
-               timeptr->tm_min, timeptr->tm_sec,
-               year);
-       if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) {
-               (void) strcpy(buf, result);
-               return buf;
-       } else {
-#ifdef EOVERFLOW
-               errno = EOVERFLOW;
-#else /* !defined EOVERFLOW */
-               errno = EINVAL;
-#endif /* !defined EOVERFLOW */
-               return NULL;
-       }
-}
-
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
-*/
-
-char *
-asctime(timeptr)
-const struct tm *      timeptr;
-{
-       return asctime_r(timeptr, buf_asctime);
-}
diff --git a/stdtime/ctime.3 b/stdtime/ctime.3
deleted file mode 100644 (file)
index 7bcc80b..0000000
+++ /dev/null
@@ -1,377 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Arthur Olson.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     From: @(#)ctime.3      8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdtime/ctime.3,v 1.24 2007/01/09 00:28:11 imp Exp $
-.\"
-.Dd January 2, 1999
-.Dt CTIME 3
-.Os
-.Sh NAME
-.Nm asctime ,
-.Nm asctime_r ,
-.Nm ctime ,
-.Nm ctime_r ,
-.Nm difftime ,
-.Nm gmtime ,
-.Nm gmtime_r ,
-.Nm localtime ,
-.Nm localtime_r ,
-.Nm mktime ,
-.Nm timegm
-.Nd transform binary date and time values
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In time.h
-.Vt extern char *tzname[2] ;
-.Ft char *
-.Fn asctime "const struct tm *timeptr"
-.Ft char *
-.Fn asctime_r "const struct tm *restrict timeptr" "char *restrict buf"
-.Ft char *
-.Fn ctime "const time_t *clock"
-.Ft char *
-.Fn ctime_r "const time_t *clock" "char *buf"
-.Ft double
-.Fn difftime "time_t time1" "time_t time0"
-.Ft struct tm *
-.Fn gmtime "const time_t *clock"
-.Ft struct tm *
-.Fn gmtime_r "const time_t *clock" "struct tm *result"
-.Ft struct tm *
-.Fn localtime "const time_t *clock"
-.Ft struct tm *
-.Fn localtime_r "const time_t *clock" "struct tm *result"
-.Ft time_t
-.Fn mktime "struct tm *timeptr"
-.Ft time_t
-.Fn timegm "struct tm *timeptr"
-.Sh DESCRIPTION
-The functions
-.Fn ctime ,
-.Fn gmtime ,
-and
-.Fn localtime
-all take as an argument a time value representing the time in seconds since
-the Epoch (00:00:00
-.Tn UTC ,
-January 1, 1970; see
-.Xr time 3 ) .
-.Pp
-The function
-.Fn localtime
-converts the time value pointed at by
-.Fa clock .
-It returns a pointer to a
-.Dq Fa struct tm
-(described below), which contains
-the broken-out time information for the value after adjusting for the current
-time zone (and any other factors such as Daylight Saving Time).
-Time zone adjustments are performed as specified by the
-.Ev TZ
-environment variable (see
-.Xr tzset 3 ) .
-The function
-.Fn localtime
-uses
-.Xr tzset 3
-to initialize time conversion information, if
-.Xr tzset 3
-has not already been called by the process.
-.Pp
-After filling in the tm structure,
-.Fn localtime
-sets the
-.Fa tm_isdst Ns 'th
-element of
-.Fa tzname
-to a pointer to an
-.Tn ASCII
-string containing the time zone abbreviation to be
-used with
-.Fn localtime Ns 's
-return value.
-.Pp
-The function
-.Fn gmtime
-also converts the time value, but makes no time zone adjustment.
-It returns a pointer to a tm structure (described below).
-.Pp
-The
-.Fn ctime
-function
-adjusts the time value for the current time zone, in the same manner as
-.Fn localtime .
-It returns a pointer to a 26-character string of the form:
-.Bd -literal -offset indent
-Thu Nov 24 18:22:48 1986\en\e0
-.Ed
-.Pp
-All of the fields have constant width.
-.Pp
-The
-.Fn ctime_r
-function
-provides the same functionality as
-.Fn ctime ,
-except that the caller must provide the output buffer
-.Fa buf
-(which must be at least 26 characters long) to store the result.
-The
-.Fn localtime_r
-and
-.Fn gmtime_r
-functions
-provide the same functionality as
-.Fn localtime
-and
-.Fn gmtime ,
-respectively, except the caller must provide the output buffer
-.Fa result .
-.Pp
-The
-.Fn asctime
-function
-converts the broken-out time in the structure
-.Fa tm
-(pointed at by
-.Fa *timeptr )
-to the form
-shown in the example above.
-.Pp
-The
-.Fn asctime_r
-function
-provides the same functionality as
-.Fn asctime ,
-except that the caller provides the output buffer
-.Fa buf
-(which must be at least 26 characters long) to store the result.
-.Pp
-The functions
-.Fn mktime
-and
-.Fn timegm
-convert the broken-out time
-(in the structure pointed to by
-.Fa *timeptr )
-into a time value with the same encoding as that of the
-values returned by the
-.Xr time 3
-function (that is, seconds from the Epoch,
-.Tn UTC ) .
-The
-.Fn mktime
-function
-interprets the input structure according to the current timezone setting
-(see
-.Xr tzset 3 ) .
-The
-.Fn timegm
-function interprets the input structure
-as representing Universal Coordinated Time
-.Pq Tn UTC .
-.Pp
-The original values of the
-.Fa tm_wday
-and
-.Fa tm_yday
-components of the structure are ignored. The original values of the
-other components are not restricted to their normal ranges and will be
-normalized, if need be.
-For example,
-October 40 is changed into November 9,
-a
-.Fa tm_hour
-of \-1 means 1 hour before midnight,
-.Fa tm_mday
-of 0 means the day preceding the current month, and
-.Fa tm_mon
-of \-2 means 2 months before January of
-.Fa tm_year .
-(A positive or zero value for
-.Fa tm_isdst
-causes
-.Fn mktime
-to presume initially that summer time (for example, Daylight Saving Time)
-is or is not (respectively) in effect for the specified time.
-A negative value for
-.Fa tm_isdst
-causes the
-.Fn mktime
-function to attempt to divine whether summer time is in effect for the
-specified time.
-The
-.Fa tm_isdst
-and
-.Fa tm_gmtoff
-members are forced to zero by
-.Fn timegm . )
-.Pp
-On successful completion, the values of the
-.Fa tm_wday
-and
-.Fa tm_yday
-components of the structure are set appropriately, and the other components
-are set to represent the specified calendar time, but with their values
-forced to their normal ranges; the final value of
-.Fa tm_mday
-is not set until
-.Fa tm_mon
-and
-.Fa tm_year
-are determined.
-The
-.Fn mktime
-function
-returns the specified calendar time; if the calendar time cannot be
-represented, it returns \-1;
-.Pp
-The
-.Fn difftime
-function
-returns the difference between two calendar times,
-.Pf ( Fa time1
--
-.Fa time0 ) ,
-expressed in seconds.
-.Pp
-External declarations, as well as the tm structure definition,
-are contained in the
-.In time.h
-include file.
-The tm structure includes at least the following fields:
-.Bd -literal -offset indent
-int tm_sec;    /\(** seconds (0 - 60) \(**/
-int tm_min;    /\(** minutes (0 - 59) \(**/
-int tm_hour;   /\(** hours (0 - 23) \(**/
-int tm_mday;   /\(** day of month (1 - 31) \(**/
-int tm_mon;    /\(** month of year (0 - 11) \(**/
-int tm_year;   /\(** year \- 1900 \(**/
-int tm_wday;   /\(** day of week (Sunday = 0) \(**/
-int tm_yday;   /\(** day of year (0 - 365) \(**/
-int tm_isdst;  /\(** is summer time in effect? \(**/
-char \(**tm_zone;      /\(** abbreviation of timezone name \(**/
-long tm_gmtoff;        /\(** offset from UTC in seconds \(**/
-.Ed
-.Pp
-The
-field
-.Fa tm_isdst
-is non-zero if summer (i.e., Daylight Saving) time is in effect.
-.Pp
-The field
-.Fa tm_gmtoff
-is the offset (in seconds) of the time represented from
-.Tn UTC ,
-with positive
-values indicating locations east of the Prime Meridian.
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr gettimeofday 2 ,
-.Xr getenv 3 ,
-.Xr time 3 ,
-.Xr tzset 3 ,
-.Xr tzfile 5
-.Sh STANDARDS
-The
-.Fn asctime ,
-.Fn ctime ,
-.Fn difftime ,
-.Fn gmtime ,
-.Fn localtime ,
-and
-.Fn mktime
-functions conform to
-.St -isoC ,
-and conform to
-.St -p1003.1-96
-provided the selected local timezone does not contain a leap-second table
-(see
-.Xr zic 8 ) .
-.Pp
-The
-.Fn asctime_r ,
-.Fn ctime_r ,
-.Fn gmtime_r ,
-and
-.Fn localtime_r
-functions are expected to conform to
-.St -p1003.1-96
-(again provided the selected local timezone does not contain a leap-second
-table).
-.Pp
-The
-.Fn timegm
-function is not specified by any standard; its function cannot be
-completely emulated using the standard functions described above.
-.Sh HISTORY
-This manual page is derived from
-the time package contributed to Berkeley by
-.An Arthur Olson
-and which appeared in
-.Bx 4.3 .
-.Sh BUGS
-Except for
-.Fn difftime ,
-.Fn mktime ,
-and the
-.Fn \&_r
-variants of the other functions,
-these functions leaves their result in an internal static object and return
-a pointer to that object.
-Subsequent calls to these
-function will modify the same object.
-.Pp
-The C Standard provides no mechanism for a program to modify its current
-local timezone setting, and the
-.Tn POSIX Ns No \&-standard
-method is not reentrant.
-(However, thread-safe implementations are provided
-in the
-.Tn POSIX
-threaded environment.)
-.Pp
-The
-.Va tm_zone
-field of a returned
-.Vt tm
-structure points to a static array of characters,
-which will also be overwritten by any subsequent calls (as well as by
-subsequent calls to
-.Xr tzset 3
-and
-.Xr tzsetwall 3 ) .
-.Pp
-Use of the external variable
-.Fa tzname
-is discouraged; the
-.Fa tm_zone
-entry in the tm structure is preferred.
diff --git a/stdtime/difftime-fbsd.c b/stdtime/difftime-fbsd.c
deleted file mode 120000 (symlink)
index 64af329..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./difftime.c
\ No newline at end of file
diff --git a/stdtime/ftime-fbsd.c b/stdtime/ftime-fbsd.c
deleted file mode 120000 (symlink)
index cdda967..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ftime.c
\ No newline at end of file
diff --git a/stdtime/ftime.3 b/stdtime/ftime.3
deleted file mode 100644 (file)
index 4676bd8..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ftime.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: /repoman/r/ncvs/src/lib/libcompat/4.1/ftime.3,v 1.11 2001/10/01 16:09:14 ru Exp $
-.\"
-.Dd June 4, 1993
-.Dt FTIME 3
-.Os
-.Sh NAME
-.Nm ftime
-.Nd get date and time
-.Sh SYNOPSIS
-.In sys/timeb.h
-.Ft int
-.Fo ftime
-.Fa "struct timeb *tp"
-.Fc
-.Sh DESCRIPTION
-.Bf -symbolic
-This interface is obsoleted by
-.Xr gettimeofday 2 .
-.Ef
-.Pp
-The
-.Fn ftime
-routine fills in a structure pointed to by its argument,
-as defined by
-.Aq Pa sys/timeb.h :
-.Bd -literal -offset indent
-/*
- * Structure returned by ftime system call
- */
-struct timeb
-{
-         time_t  time;
-         unsigned short millitm;
-         short   timezone;
-         short   dstflag;
-};
-.Ed
-.Pp
-The structure contains the time since the epoch, in seconds;
-up to 1000 milliseconds of more-precise interval;
-the local time zone (measured in minutes of time westward from Greenwich);
-and a flag that, if nonzero, indicates that
-Daylight Saving time applies locally during the appropriate part of the year.
-.Sh LEGACY SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/timeb.h>
-.Pp
-The include file
-.In sys/types.h
-is necessary.
-.Sh SEE ALSO
-.Xr gettimeofday 2 ,
-.Xr settimeofday 2 ,
-.Xr ctime 3 ,
-.Xr time 3 ,
-.Xr compat 5
-.Sh HISTORY
-The
-.Nm
-function appeared in
-.Bx 4.2 .
diff --git a/stdtime/localtime-fbsd.c b/stdtime/localtime-fbsd.c
deleted file mode 100644 (file)
index 7e3cd2a..0000000
+++ /dev/null
@@ -1,2427 +0,0 @@
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
-*/
-
-#include <sys/cdefs.h>
-#ifndef lint
-#ifndef NOID
-static char    elsieid[] __unused = "@(#)localtime.c   7.78";
-#endif /* !defined NOID */
-#endif /* !defined lint */
-__FBSDID("$FreeBSD: src/lib/libc/stdtime/localtime.c,v 1.43 2008/04/01 06:56:11 davidxu Exp $");
-
-/*
-** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu).
-** POSIX-style TZ environment variable handling from Guy Harris
-** (guy@auspex.com).
-*/
-
-/*LINTLIBRARY*/
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <errno.h>
-#ifdef NOTIFY_TZ
-//#define NOTIFY_TZ_DEBUG
-//#define NOTIFY_TZ_DEBUG_FILE "/var/log/localtime.debug"
-//#define NOTIFY_TZ_LOG        "/var/log/localtime.log"
-/* force ALL_STATE if NOTIFY_TZ is set */
-#ifndef ALL_STATE
-#define ALL_STATE
-#endif /* ALL_STATE */
-#include <mach/mach_init.h>
-#include <notify.h>
-#include <alloca.h>
-#endif /* NOTIFY_TZ */
-#include "private.h"
-#include "un-namespace.h"
-
-#include "tzfile.h"
-
-#include "libc_private.h"
-
-#define        _MUTEX_LOCK(x)          if (__isthreaded) _pthread_mutex_lock(x)
-#define        _MUTEX_UNLOCK(x)        if (__isthreaded) _pthread_mutex_unlock(x)
-
-#define _RWLOCK_RDLOCK(x)                                              \
-               do {                                                    \
-                       if (__isthreaded) _pthread_rwlock_rdlock(x);    \
-               } while (0)
-
-#define _RWLOCK_WRLOCK(x)                                              \
-               do {                                                    \
-                       if (__isthreaded) _pthread_rwlock_wrlock(x);    \
-               } while (0)
-
-#define _RWLOCK_UNLOCK(x)                                              \
-               do {                                                    \
-                       if (__isthreaded) _pthread_rwlock_unlock(x);    \
-               } while (0)
-
-/*
-** SunOS 4.1.1 headers lack O_BINARY.
-*/
-
-#ifdef O_BINARY
-#define OPEN_MODE      (O_RDONLY | O_BINARY)
-#endif /* defined O_BINARY */
-#ifndef O_BINARY
-#define OPEN_MODE      O_RDONLY
-#endif /* !defined O_BINARY */
-
-#ifndef WILDABBR
-/*
-** Someone might make incorrect use of a time zone abbreviation:
-**     1.      They might reference tzname[0] before calling tzset (explicitly
-**             or implicitly).
-**     2.      They might reference tzname[1] before calling tzset (explicitly
-**             or implicitly).
-**     3.      They might reference tzname[1] after setting to a time zone
-**             in which Daylight Saving Time is never observed.
-**     4.      They might reference tzname[0] after setting to a time zone
-**             in which Standard Time is never observed.
-**     5.      They might reference tm.TM_ZONE after calling offtime.
-** What's best to do in the above cases is open to debate;
-** for now, we just set things up so that in any of the five cases
-** WILDABBR is used.  Another possibility:  initialize tzname[0] to the
-** string "tzname[0] used before set", and similarly for the other cases.
-** And another:  initialize tzname[0] to "ERA", with an explanation in the
-** manual page of what this "time zone abbreviation" means (doing this so
-** that tzname[0] has the "normal" length of three characters).
-*/
-#define WILDABBR       "   "
-#endif /* !defined WILDABBR */
-
-static char            wildabbr[] = "WILDABBR";
-
-/*
- * In June 2004 it was decided UTC was a more appropriate default time
- * zone than GMT.
- */
-
-static const char      gmt[] = "UTC";
-
-/*
-** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
-** We default to US rules as of 1999-08-17.
-** POSIX 1003.1 section 8.1.1 says that the default DST rules are
-** implementation dependent; for historical reasons, US rules are a
-** common default.
-*/
-#ifndef TZDEFRULESTRING
-#define TZDEFRULESTRING ",M4.1.0,M10.5.0"
-#endif /* !defined TZDEFDST */
-
-struct ttinfo {                                /* time type information */
-       long            tt_gmtoff;      /* UTC offset in seconds */
-       int             tt_isdst;       /* used to set tm_isdst */
-       int             tt_abbrind;     /* abbreviation list index */
-       int             tt_ttisstd;     /* TRUE if transition is std time */
-       int             tt_ttisgmt;     /* TRUE if transition is UTC */
-};
-
-struct lsinfo {                                /* leap second information */
-       time_t          ls_trans;       /* transition time */
-       long            ls_corr;        /* correction to apply */
-};
-
-#define BIGGEST(a, b)  (((a) > (b)) ? (a) : (b))
-
-#ifdef TZNAME_MAX
-#define MY_TZNAME_MAX  TZNAME_MAX
-#endif /* defined TZNAME_MAX */
-#ifndef TZNAME_MAX
-#define MY_TZNAME_MAX  255
-#endif /* !defined TZNAME_MAX */
-
-struct state {
-       int             leapcnt;
-       int             timecnt;
-       int             typecnt;
-       int             charcnt;
-       time_t          ats[TZ_MAX_TIMES];
-       unsigned char   types[TZ_MAX_TIMES];
-       struct ttinfo   ttis[TZ_MAX_TYPES];
-       char            chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
-                               (2 * (MY_TZNAME_MAX + 1)))];
-       struct lsinfo   lsis[TZ_MAX_LEAPS];
-};
-
-struct rule {
-       int             r_type;         /* type of rule--see below */
-       int             r_day;          /* day number of rule */
-       int             r_week;         /* week number of rule */
-       int             r_mon;          /* month number of rule */
-       long            r_time;         /* transition time of rule */
-};
-
-#define JULIAN_DAY             0       /* Jn - Julian day */
-#define DAY_OF_YEAR            1       /* n - day of year */
-#define MONTH_NTH_DAY_OF_WEEK  2       /* Mm.n.d - month, week, day of week */
-
-#ifdef NOTIFY_TZ
-typedef struct {
-       int token;
-       int notify_was_off;
-       int is_set;
-} notify_tz_t;
-
-#define NOTIFY_TZ_NAME         "com.apple.system.timezone"
-#endif /* NOTIFY_TZ */
-
-/*
-** Prototypes for static functions.
-*/
-#define        localsub        _st_localsub
-#define        time1           _st_time1
-#define        tzset_basic     _st_tzset_basic
-__private_extern__
-#ifdef __LP64__
-struct tm *            localsub(const time_t * timep, long offset,
-                               struct tm * tmp);
-#else /* !__LP64__ */
-void                   localsub(const time_t * timep, long offset,
-                               struct tm * tmp);
-#endif /* __LP64__ */
-__private_extern__
-time_t                 time1(struct tm * tmp,
-#ifdef __LP64__
-                               struct tm *(*funcp) (const time_t *,
-                               long, struct tm *),
-#else /* !__LP64__ */
-                               void(*funcp) (const time_t *,
-                               long, struct tm *),
-#endif /* __LP64__ */
-                               long offset,
-                               int unix03);
-__private_extern__
-void                   tzset_basic(int);
-
-#if !BUILDING_VARIANT
-static long            detzcode(const char * codep);
-static const char *    getzname(const char * strp, char **name, size_t *len);
-static const char *    getnum(const char * strp, int * nump, int min,
-                               int max);
-static const char *    getsecs(const char * strp, long * secsp);
-static const char *    getoffset(const char * strp, long * offsetp);
-static const char *    getrule(const char * strp, struct rule * rulep);
-static void            gmtload(struct state * sp);
-#ifdef __LP64__
-static struct tm *     gmtsub(const time_t * timep, long offset,
-                               struct tm * tmp);
-#else /* !__LP64__ */
-static void            gmtsub(const time_t * timep, long offset,
-                               struct tm * tmp);
-#endif /* __LP64__ */
-static int             increment_overflow(int * number, int delta);
-static int             normalize_overflow(int * tensptr, int * unitsptr,
-                               int base);
-#ifdef NOTIFY_TZ
-static void            notify_check_tz(notify_tz_t *p);
-static void            notify_register_tz(char *file, notify_tz_t *p);
-#endif /* NOTIFY_TZ */
-static void            settzname(void);
-static time_t          time2(struct tm *tmp,
-#ifdef __LP64__
-                               struct tm *(*funcp) (const time_t *,
-                               long, struct tm*),
-#else /* !__LP64__ */
-                               void(*funcp) (const time_t *,
-                               long, struct tm*),
-#endif /* __LP64__ */
-                               long offset, int * okayp, int unix03);
-static time_t          time2sub(struct tm *tmp,
-#ifdef __LP64__
-                               struct tm *(*funcp) (const time_t *,
-                               long, struct tm*),
-#else /* !__LP64__ */
-                               void(*funcp) (const time_t *,
-                               long, struct tm*),
-#endif /* __LP64__ */
-                               long offset, int * okayp, int do_norm_secs,
-                               int unix03);
-#ifdef __LP64__
-static struct tm *     timesub(const time_t * timep, long offset,
-                               const struct state * sp, struct tm * tmp);
-#else /* !__LP64__ */
-static void            timesub(const time_t * timep, long offset,
-                               const struct state * sp, struct tm * tmp);
-#endif /* __LP64__ */
-static int             tmcomp(const struct tm * atmp,
-                               const struct tm * btmp);
-static time_t          transtime(time_t janfirst, int year,
-                               const struct rule * rulep, long offset);
-static int             tzload(const char * name, struct state * sp);
-static int             tzparse(const char * name, struct state * sp,
-                               int lastditch);
-
-#ifdef ALL_STATE
-static struct state *  lclptr;
-static struct state *  gmtptr;
-#endif /* defined ALL_STATE */
-
-#ifndef ALL_STATE
-static struct state    lclmem;
-static struct state    gmtmem;
-#define lclptr         (&lclmem)
-#define gmtptr         (&gmtmem)
-#endif /* State Farm */
-
-#ifndef TZ_STRLEN_MAX
-#define TZ_STRLEN_MAX 255
-#endif /* !defined TZ_STRLEN_MAX */
-
-static char            lcl_TZname[TZ_STRLEN_MAX + 1];
-#ifdef NOTIFY_TZ
-#define lcl_is_set    (lcl_notify.is_set)
-#define gmt_is_set    (gmt_notify.is_set)
-#else /* ! NOTIFY_TZ */
-static int             lcl_is_set;
-static int             gmt_is_set;
-#endif /* NOTIFY_TZ */
-__private_extern__ pthread_rwlock_t    lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
-static pthread_mutex_t gmt_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-char *                 tzname[2] = {
-       wildabbr,
-       wildabbr
-};
-
-/*
-** Section 4.12.3 of X3.159-1989 requires that
-**     Except for the strftime function, these functions [asctime,
-**     ctime, gmtime, localtime] return values in one of two static
-**     objects: a broken-down time structure and an array of char.
-** Thanks to Paul Eggert (eggert@twinsun.com) for noting this.
-*/
-
-static struct tm       tm;
-
-#define USG_COMPAT
-#define ALTZONE
-#ifdef USG_COMPAT
-int                    daylight = 0;
-__private_extern__ void _st_set_timezone(long);
-#endif /* defined USG_COMPAT */
-
-#ifdef ALTZONE
-__private_extern__ long                __darwin_altzone = 0;
-#define altzone __darwin_altzone
-#endif /* defined ALTZONE */
-
-#ifdef NOTIFY_TZ
-#ifdef NOTIFY_TZ_DEBUG
-#ifdef NOTIFY_TZ_DEBUG_FILE
-#define NOTIFY_TZ_PRINTF(fmt, args...) \
-{ \
-       FILE *_notify_tz_fp_; \
-       if((_notify_tz_fp_ = fopen(NOTIFY_TZ_DEBUG_FILE, "a")) != NULL) { \
-               fprintf(_notify_tz_fp_, "%d: " fmt, getpid(), ## args); \
-               fclose(_notify_tz_fp_); \
-       } \
-}
-#else /* ! NOTIFY_TZ_DEBUG_FILE */
-#define NOTIFY_TZ_PRINTF(args...)      fprintf(stdout, ## args)
-#endif /* NOTIFY_TZ_DEBUG_FILE */
-#endif /* NOTIFY_TZ_DEBUG */
-#ifdef NOTIFY_TZ_LOG
-#define NOTIFY_LOG(fmt, args...)       \
-{ \
-       FILE *_notify_log_fp_; \
-       if((_notify_log_fp_ = fopen(NOTIFY_TZ_LOG, "a")) != NULL) { \
-               fprintf(_notify_log_fp_, "%d: " fmt, getpid(), ## args); \
-               fclose(_notify_log_fp_); \
-       } \
-}
-#endif /* NOTIFY_TZ_LOG */
-/*--------------------------------------------------------------------
- * __notify_78945668_info__ is a global variable (defined in Libnotify)
- * that can be used to disable the notify mechanism.  Set to a negative
- * value to disable.  It can then be set back to zero to re-enable.
- *-------------------------------------------------------------------- */
-extern int             __notify_78945668_info__;
-
-/*--------------------------------------------------------------------
- * fullname is used to pass the actual path of the timezone file to the
- * notify routines.  If it is a nil string, that means no timezone file
- * is being used.
- *-------------------------------------------------------------------- */
-static char *          fullname = NULL;
-
-static notify_tz_t     gmt_notify = {-1, 0, 0};
-static notify_tz_t     lcl_notify = {-1, 0, 0};
-static char            notify_tz_name[] = NOTIFY_TZ_NAME;
-#endif /* NOTIFY_TZ */
-
-static long
-detzcode(codep)
-const char * const     codep;
-{
-       long    result;
-       int     i;
-
-       result = (codep[0] & 0x80) ? ~0L : 0L;
-       for (i = 0; i < 4; ++i)
-               result = (result << 8) | (codep[i] & 0xff);
-       return result;
-}
-
-static void
-settzname(void)
-{
-       struct state *  sp = lclptr;
-       int                     i, need;
-       unsigned char * types;
-#define NEED_STD       1
-#define NEED_DST       2
-#define NEED_DAYLIGHT  4
-#define NEED_ALL       (NEED_STD | NEED_DST | NEED_DAYLIGHT)
-
-       tzname[0] = wildabbr;
-       tzname[1] = wildabbr;
-#ifdef USG_COMPAT
-       daylight = 0;
-       _st_set_timezone(0);
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
-       altzone = 0;
-#endif /* defined ALTZONE */
-#ifdef ALL_STATE
-       if (sp == NULL) {
-               tzname[0] = tzname[1] = (char *)gmt;
-               return;
-       }
-#endif /* defined ALL_STATE */
-       /*
-        * PR-3765457: The original settzname went sequentially through the ttis
-        * array, rather than correctly indexing via the types array, to get
-        * the real order of the timezone changes.  In addition, as a speed up,
-        * we start at the end of the changes, and work back, so that most of
-        * the time, we don't have to look through the entire array.
-        */
-       if (sp->timecnt == 0 && sp->typecnt == 1) {
-               /*
-                * Unfortunately, there is an edge case when typecnt == 1 and
-                * timecnt == 0, which would cause the loop to never run.  So
-                * in that case, we fudge things up so that it is as if
-                * timecnt == 1.
-                */
-               i = 0;
-               types = (unsigned char *)""; /* we use the null as index */
-       } else {
-               /* the usual case */
-               i = sp->timecnt - 1;
-               types = sp->types;
-       }
-       need = NEED_ALL;
-       for (; i >= 0 && need; --i) {
-               const struct ttinfo * const     ttisp = &sp->ttis[types[i]];
-
-#ifdef USG_COMPAT
-               if ((need & NEED_DAYLIGHT) && ttisp->tt_isdst) {
-                       need &= ~NEED_DAYLIGHT;
-                       daylight = 1;
-               }
-#endif /* defined USG_COMPAT */
-               if (ttisp->tt_isdst) {
-                       if (need & NEED_DST) {
-                               need &= ~NEED_DST;
-                               tzname[1] = &sp->chars[ttisp->tt_abbrind];
-#ifdef ALTZONE
-                               altzone = -(ttisp->tt_gmtoff);
-#endif /* defined ALTZONE */
-                       }
-               } else if (need & NEED_STD) {
-                       need &= ~NEED_STD;
-                       tzname[0] = &sp->chars[ttisp->tt_abbrind];
-#ifdef USG_COMPAT
-                       _st_set_timezone(-(ttisp->tt_gmtoff));
-#endif /* defined USG_COMPAT */
-               }
-#if defined(ALTZONE) || defined(USG_COMPAT)
-               if (i == 0) {
-#endif /* defined(ALTZONE) || defined(USG_COMPAT) */
-#ifdef ALTZONE
-                       if (need & NEED_DST)
-                               altzone = -(ttisp->tt_gmtoff);
-#endif /* defined ALTZONE */
-#ifdef USG_COMPAT
-                       if (need & NEED_STD)
-                               _st_set_timezone(-(ttisp->tt_gmtoff));
-#endif /* defined USG_COMPAT */
-#if defined(ALTZONE) || defined(USG_COMPAT)
-               }
-#endif /* defined(ALTZONE) || defined(USG_COMPAT) */
-       }
-}
-
-#ifdef NOTIFY_TZ
-static void
-notify_check_tz(notify_tz_t *p)
-{
-       unsigned int nstat;
-       int ncheck;
-
-       if (__notify_78945668_info__ < 0) {
-#ifdef NOTIFY_TZ_DEBUG
-               if(!p->notify_was_off) NOTIFY_TZ_PRINTF("notify_check_tz: setting %s_notify->notify_was_off\n", (p == &lcl_notify ? "lcl" : "gmt"));
-#endif /* NOTIFY_TZ_DEBUG */
-               p->notify_was_off = 1;
-               return;
-       }
-       /* force rereading the timezone file if notify was off */
-       if (p->notify_was_off) {
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("notify_check_tz: saw %s_notify->notify_was_off\n", (p == &lcl_notify ? "lcl" : "gmt"));
-#endif /* NOTIFY_TZ_DEBUG */
-               p->is_set = 0;
-               p->notify_was_off = 0;
-               return;
-       }
-       if (p->token < 0)
-               return;
-       nstat = notify_check(p->token, &ncheck);
-       if (nstat || ncheck) {
-               p->is_set = 0;
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("notify_check_tz: %s changed\n", (p == &lcl_notify) ? "lcl" : "gmt");
-#endif /* NOTIFY_TZ_DEBUG */
-       }
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("notify_check_tz: %s unchanged\n", (p == &lcl_notify) ? "lcl" : "gmt");
-#endif /* NOTIFY_TZ_DEBUG */
-}
-
-extern uint32_t notify_monitor_file(int token, char *path, int flags);
-
-static void
-notify_register_tz(char *file, notify_tz_t *p)
-{
-       char *name;
-       unsigned int nstat;
-       int ncheck;
-
-       if (__notify_78945668_info__ < 0)
-               return;
-       /*----------------------------------------------------------------
-        * Since we don't record the last time zone filename, just cancel
-        * (which should remove the file monitor) and setup from scratch
-        *----------------------------------------------------------------*/
-       if (p->token >= 0)
-               notify_cancel(p->token);
-       if (!file || *file == 0) {
-               /* no time zone file to monitor */
-               p->token = -1;
-               return;
-       }
-       /*----------------------------------------------------------------
-        * Just use com.apple.system.timezone if the path is /etc/localtime.
-        * Otherwise use com.apple.system.timezone.<fullpath>
-        *----------------------------------------------------------------*/
-       if (TZDEFAULT && strcmp(file, TZDEFAULT) == 0)
-               name = notify_tz_name;
-       else {
-               name = alloca(sizeof(notify_tz_name) + strlen(file) + 1);
-               if (name == NULL) {
-                       p->token = -1;
-                       return;
-               }
-               strcpy(name, notify_tz_name);
-               strcat(name, ".");
-               strcat(name, file);
-       }
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("notify_register_tz: file=%s name=%s\n", file, name);
-#endif /* NOTIFY_TZ_DEBUG */
-       nstat = notify_register_check(name, &p->token);
-       if (nstat != 0) {
-               p->token = -1;
-               p->is_set = 0;
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("***notify_register_tz: notify_register_check failed: %u\n", nstat);
-#endif /* NOTIFY_TZ_DEBUG */
-#ifdef NOTIFY_TZ_LOG
-               NOTIFY_LOG("notify_register_check(%s) failed: %u\n", name, nstat);
-#endif /* NOTIFY_TZ_LOG */
-               return;
-       }
-       /* don't need to request monitoring /etc/localtime */
-       if (name != notify_tz_name) {
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("notify_register_tz: monitor %s\n", file);
-#endif /* NOTIFY_TZ_DEBUG */
-               nstat = notify_monitor_file(p->token, file, 0);
-               if (nstat != 0) {
-                       notify_cancel(p->token);
-                       p->token = -1;
-                       p->is_set = 0;
-#ifdef NOTIFY_TZ_DEBUG
-                       NOTIFY_TZ_PRINTF("***notify_register_tz: notify_monitor_file failed: %u\n", nstat);
-#endif /* NOTIFY_TZ_DEBUG */
-#ifdef NOTIFY_TZ_LOG
-                       NOTIFY_LOG("notify_monitor_file(%s) failed: %u\n", file, nstat);
-#endif /* NOTIFY_TZ_LOG */
-                       return;
-               }
-       }
-       notify_check(p->token, &ncheck);        /* this always returns true */
-}
-#endif /* NOTIFY_TZ */
-
-static int
-tzload(name, sp)
-const char *           name;
-struct state * const   sp;
-{
-       const char *    p;
-       int             i;
-       int             fid;
-
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("tzload: name=%s\n", name);
-#endif /* NOTIFY_TZ_DEBUG */
-       /* XXX The following is from OpenBSD, and I'm not sure it is correct */
-       if (name != NULL && issetugid() != 0)
-               if ((name[0] == ':' && name[1] == '/') || 
-                   name[0] == '/' || strchr(name, '.'))
-                       name = NULL;
-       if (name == NULL && (name = TZDEFAULT) == NULL)
-               return -1;
-       {
-               int     doaccess;
-               struct stat     stab;
-               /*
-               ** Section 4.9.1 of the C standard says that
-               ** "FILENAME_MAX expands to an integral constant expression
-               ** that is the size needed for an array of char large enough
-               ** to hold the longest file name string that the implementation
-               ** guarantees can be opened."
-               */
-#ifdef NOTIFY_TZ
-               if (!fullname) {
-                       fullname = malloc(FILENAME_MAX + 1);
-                       if (!fullname)
-                               return -1;
-               }
-#else /* ! NOTIFY_TZ */
-               char            fullname[FILENAME_MAX + 1];
-#endif /* NOTIFY_TZ */
-
-               if (name[0] == ':')
-                       ++name;
-               doaccess = name[0] == '/';
-               if (!doaccess) {
-                       if ((p = TZDIR) == NULL)
-                               return -1;
-#ifdef NOTIFY_TZ
-                       if ((strlen(p) + 1 + strlen(name) + 1) >= (FILENAME_MAX + 1))
-#else /* ! NOTIFY_TZ */
-                       if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname)
-#endif /* NOTIFY_TZ */
-                               return -1;
-                       (void) strcpy(fullname, p);
-                       (void) strcat(fullname, "/");
-                       (void) strcat(fullname, name);
-                       /*
-                       ** Set doaccess if '.' (as in "../") shows up in name.
-                       */
-                       if (strchr(name, '.') != NULL)
-                               doaccess = TRUE;
-                       name = fullname;
-               }
-#ifdef NOTIFY_TZ
-               else
-                       strcpy(fullname, name);
-#endif /* NOTIFY_TZ */
-               if (doaccess && access(name, R_OK) != 0)
-                       return -1;
-               if ((fid = _open(name, OPEN_MODE)) == -1)
-                       return -1;
-               if ((_fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) {
-                       _close(fid);
-                       return -1;
-               }
-       }
-       {
-               struct tzhead * tzhp;
-               union {
-                       struct tzhead   tzhead;
-                       char            buf[sizeof *sp + sizeof *tzhp];
-               } u;
-               int             ttisstdcnt;
-               int             ttisgmtcnt;
-
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("tzload: reading %s\n", name);
-#endif /* NOTIFY_TZ_DEBUG */
-               i = _read(fid, u.buf, sizeof u.buf);
-               if (_close(fid) != 0)
-                       return -1;
-               ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
-               ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
-               sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
-               sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
-               sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
-               sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
-               p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
-               if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
-                       sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
-                       sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
-                       sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
-                       (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
-                       (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
-                               return -1;
-               if (i - (p - u.buf) < sp->timecnt * 4 + /* ats */
-                       sp->timecnt +                   /* types */
-                       sp->typecnt * (4 + 2) +         /* ttinfos */
-                       sp->charcnt +                   /* chars */
-                       sp->leapcnt * (4 + 4) +         /* lsinfos */
-                       ttisstdcnt +                    /* ttisstds */
-                       ttisgmtcnt)                     /* ttisgmts */
-                               return -1;
-               for (i = 0; i < sp->timecnt; ++i) {
-                       sp->ats[i] = detzcode(p);
-                       p += 4;
-               }
-               for (i = 0; i < sp->timecnt; ++i) {
-                       sp->types[i] = (unsigned char) *p++;
-                       if (sp->types[i] >= sp->typecnt)
-                               return -1;
-               }
-               for (i = 0; i < sp->typecnt; ++i) {
-                       struct ttinfo * ttisp;
-
-                       ttisp = &sp->ttis[i];
-                       ttisp->tt_gmtoff = detzcode(p);
-                       p += 4;
-                       ttisp->tt_isdst = (unsigned char) *p++;
-                       if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
-                               return -1;
-                       ttisp->tt_abbrind = (unsigned char) *p++;
-                       if (ttisp->tt_abbrind < 0 ||
-                               ttisp->tt_abbrind > sp->charcnt)
-                                       return -1;
-               }
-               for (i = 0; i < sp->charcnt; ++i)
-                       sp->chars[i] = *p++;
-               sp->chars[i] = '\0';    /* ensure '\0' at end */
-               for (i = 0; i < sp->leapcnt; ++i) {
-                       struct lsinfo * lsisp;
-
-                       lsisp = &sp->lsis[i];
-                       lsisp->ls_trans = detzcode(p);
-                       p += 4;
-                       lsisp->ls_corr = detzcode(p);
-                       p += 4;
-               }
-               for (i = 0; i < sp->typecnt; ++i) {
-                       struct ttinfo * ttisp;
-
-                       ttisp = &sp->ttis[i];
-                       if (ttisstdcnt == 0)
-                               ttisp->tt_ttisstd = FALSE;
-                       else {
-                               ttisp->tt_ttisstd = *p++;
-                               if (ttisp->tt_ttisstd != TRUE &&
-                                       ttisp->tt_ttisstd != FALSE)
-                                               return -1;
-                       }
-               }
-               for (i = 0; i < sp->typecnt; ++i) {
-                       struct ttinfo * ttisp;
-
-                       ttisp = &sp->ttis[i];
-                       if (ttisgmtcnt == 0)
-                               ttisp->tt_ttisgmt = FALSE;
-                       else {
-                               ttisp->tt_ttisgmt = *p++;
-                               if (ttisp->tt_ttisgmt != TRUE &&
-                                       ttisp->tt_ttisgmt != FALSE)
-                                               return -1;
-                       }
-               }
-       }
-       return 0;
-}
-
-static const int       mon_lengths[2][MONSPERYEAR] = {
-       { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-       { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-static const int       year_lengths[2] = {
-       DAYSPERNYEAR, DAYSPERLYEAR
-};
-
-/*
-** Given a pointer into a time zone string, scan until a character that is not
-** a valid character in a zone name is found.  Return a pointer to that
-** character.
-*/
-
-static const char *
-getzname(strp, name, len)
-const char *   strp;
-char **                name;
-size_t *       len;
-{
-       char    c;
-       char *  ket;
-
-       if (*strp == '<' && (ket = strchr(strp, '>')) != NULL) {
-               *name = (char *)(strp + 1);
-               *len = ket - strp - 1;
-               return ket + 1;
-       }
-       *name = (char *)strp;
-       while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
-               c != '+')
-                       ++strp;
-       *len = strp - *name;
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number from that string.
-** Check that the number is within a specified range; if it is not, return
-** NULL.
-** Otherwise, return a pointer to the first character not part of the number.
-*/
-
-static const char *
-getnum(strp, nump, min, max)
-const char *   strp;
-int * const            nump;
-const int              min;
-const int              max;
-{
-       char    c;
-       int     num;
-
-       if (strp == NULL || !is_digit(c = *strp))
-               return NULL;
-       num = 0;
-       do {
-               num = num * 10 + (c - '0');
-               if (num > max)
-                       return NULL;    /* illegal value */
-               c = *++strp;
-       } while (is_digit(c));
-       if (num < min)
-               return NULL;            /* illegal value */
-       *nump = num;
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number of seconds,
-** in hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the number
-** of seconds.
-*/
-
-static const char *
-getsecs(strp, secsp)
-const char *   strp;
-long * const           secsp;
-{
-       int     num;
-
-       /*
-       ** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
-       ** "M10.4.6/26", which does not conform to Posix,
-       ** but which specifies the equivalent of
-       ** ``02:00 on the first Sunday on or after 23 Oct''.
-       */
-       strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
-       if (strp == NULL)
-               return NULL;
-       *secsp = num * (long) SECSPERHOUR;
-       if (*strp == ':') {
-               ++strp;
-               strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
-               if (strp == NULL)
-                       return NULL;
-               *secsp += num * SECSPERMIN;
-               if (*strp == ':') {
-                       ++strp;
-                       /* `SECSPERMIN' allows for leap seconds.  */
-                       strp = getnum(strp, &num, 0, SECSPERMIN);
-                       if (strp == NULL)
-                               return NULL;
-                       *secsp += num;
-               }
-       }
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract an offset, in
-** [+-]hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the time.
-*/
-
-static const char *
-getoffset(strp, offsetp)
-const char *   strp;
-long * const           offsetp;
-{
-       int     neg = 0;
-
-       if (*strp == '-') {
-               neg = 1;
-               ++strp;
-       } else if (*strp == '+')
-               ++strp;
-       strp = getsecs(strp, offsetp);
-       if (strp == NULL)
-               return NULL;            /* illegal time */
-       if (neg)
-               *offsetp = -*offsetp;
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a rule in the form
-** date[/time].  See POSIX section 8 for the format of "date" and "time".
-** If a valid rule is not found, return NULL.
-** Otherwise, return a pointer to the first character not part of the rule.
-*/
-
-static const char *
-getrule(strp, rulep)
-const char *                   strp;
-struct rule * const    rulep;
-{
-       if (*strp == 'J') {
-               /*
-               ** Julian day.
-               */
-               rulep->r_type = JULIAN_DAY;
-               ++strp;
-               strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
-       } else if (*strp == 'M') {
-               /*
-               ** Month, week, day.
-               */
-               rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
-               ++strp;
-               strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
-               if (strp == NULL)
-                       return NULL;
-               if (*strp++ != '.')
-                       return NULL;
-               strp = getnum(strp, &rulep->r_week, 1, 5);
-               if (strp == NULL)
-                       return NULL;
-               if (*strp++ != '.')
-                       return NULL;
-               strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
-       } else if (is_digit(*strp)) {
-               /*
-               ** Day of year.
-               */
-               rulep->r_type = DAY_OF_YEAR;
-               strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
-       } else  return NULL;            /* invalid format */
-       if (strp == NULL)
-               return NULL;
-       if (*strp == '/') {
-               /*
-               ** Time specified.
-               */
-               ++strp;
-               strp = getsecs(strp, &rulep->r_time);
-       } else  rulep->r_time = 2 * SECSPERHOUR;        /* default = 2:00:00 */
-       return strp;
-}
-
-/*
-** Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the
-** year, a rule, and the offset from UTC at the time that rule takes effect,
-** calculate the Epoch-relative time that rule takes effect.
-*/
-
-static time_t
-transtime(janfirst, year, rulep, offset)
-const time_t                           janfirst;
-const int                              year;
-const struct rule * const      rulep;
-const long                             offset;
-{
-       int     leapyear;
-       time_t  value;
-       int     i;
-       int             d, m1, yy0, yy1, yy2, dow;
-
-       INITIALIZE(value);
-       leapyear = isleap(year);
-       switch (rulep->r_type) {
-
-       case JULIAN_DAY:
-               /*
-               ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
-               ** years.
-               ** In non-leap years, or if the day number is 59 or less, just
-               ** add SECSPERDAY times the day number-1 to the time of
-               ** January 1, midnight, to get the day.
-               */
-               value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
-               if (leapyear && rulep->r_day >= 60)
-                       value += SECSPERDAY;
-               break;
-
-       case DAY_OF_YEAR:
-               /*
-               ** n - day of year.
-               ** Just add SECSPERDAY times the day number to the time of
-               ** January 1, midnight, to get the day.
-               */
-               value = janfirst + rulep->r_day * SECSPERDAY;
-               break;
-
-       case MONTH_NTH_DAY_OF_WEEK:
-               /*
-               ** Mm.n.d - nth "dth day" of month m.
-               */
-               value = janfirst;
-               for (i = 0; i < rulep->r_mon - 1; ++i)
-                       value += mon_lengths[leapyear][i] * SECSPERDAY;
-
-               /*
-               ** Use Zeller's Congruence to get day-of-week of first day of
-               ** month.
-               */
-               m1 = (rulep->r_mon + 9) % 12 + 1;
-               yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
-               yy1 = yy0 / 100;
-               yy2 = yy0 % 100;
-               dow = ((26 * m1 - 2) / 10 +
-                       1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
-               if (dow < 0)
-                       dow += DAYSPERWEEK;
-
-               /*
-               ** "dow" is the day-of-week of the first day of the month.  Get
-               ** the day-of-month (zero-origin) of the first "dow" day of the
-               ** month.
-               */
-               d = rulep->r_day - dow;
-               if (d < 0)
-                       d += DAYSPERWEEK;
-               for (i = 1; i < rulep->r_week; ++i) {
-                       if (d + DAYSPERWEEK >=
-                               mon_lengths[leapyear][rulep->r_mon - 1])
-                                       break;
-                       d += DAYSPERWEEK;
-               }
-
-               /*
-               ** "d" is the day-of-month (zero-origin) of the day we want.
-               */
-               value += d * SECSPERDAY;
-               break;
-       }
-
-       /*
-       ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
-       ** question.  To get the Epoch-relative time of the specified local
-       ** time on that day, add the transition time and the current offset
-       ** from UTC.
-       */
-       return value + rulep->r_time + offset;
-}
-
-/*
-** Given a POSIX section 8-style TZ string, fill in the rule tables as
-** appropriate.
-*/
-
-static int
-tzparse(name, sp, lastditch)
-const char *                   name;
-struct state * const   sp;
-const int                      lastditch;
-{
-       const char *                    stdname;
-       const char *                    dstname;
-       size_t                          stdlen;
-       size_t                          dstlen;
-       long                            stdoffset;
-       long                            dstoffset;
-       time_t *                atp;
-       unsigned char * typep;
-       char *                  cp;
-       int                     load_result;
-
-       INITIALIZE(dstname);
-       if (lastditch) {
-               stdname = name;
-               stdlen = strlen(name);  /* length of standard zone name */
-               name += stdlen;
-               if (stdlen >= sizeof sp->chars)
-                       stdlen = (sizeof sp->chars) - 1;
-               stdoffset = 0;
-       } else {
-               name = getzname(name, (char **)&stdname, &stdlen);
-               if (stdlen < 3)
-                       return -1;
-               if (*name == '\0')
-                       return -1;      /* was "stdoffset = 0;" */
-               else {
-                       name = getoffset(name, &stdoffset);
-                       if (name == NULL)
-                               return -1;
-               }
-       }
-       load_result = tzload(TZDEFRULES, sp);
-#ifdef NOTIFY_TZ
-       *fullname = 0;                          /* mark fullname as invalid */
-#endif /* NOTIFY_TZ */
-       if (load_result != 0)
-               sp->leapcnt = 0;                /* so, we're off a little */
-       if (*name != '\0') {
-               dstname = name;
-               name = getzname(name, (char **)&dstname, &dstlen);
-               if (dstlen < 3)
-                       return -1;
-               if (*name != '\0' && *name != ',' && *name != ';') {
-                       name = getoffset(name, &dstoffset);
-                       if (name == NULL)
-                               return -1;
-               } else  dstoffset = stdoffset - SECSPERHOUR;
-               if (*name == '\0' && load_result != 0)
-                       name = TZDEFRULESTRING;
-               if (*name == ',' || *name == ';') {
-                       struct rule     start;
-                       struct rule     end;
-                       int     year;
-                       time_t  janfirst;
-                       time_t          starttime;
-                       time_t          endtime;
-
-                       ++name;
-                       if ((name = getrule(name, &start)) == NULL)
-                               return -1;
-                       if (*name++ != ',')
-                               return -1;
-                       if ((name = getrule(name, &end)) == NULL)
-                               return -1;
-                       if (*name != '\0')
-                               return -1;
-                       sp->typecnt = 2;        /* standard time and DST */
-                       /*
-                       ** Two transitions per year, from EPOCH_YEAR to 2037.
-                       */
-                       sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1);
-                       if (sp->timecnt > TZ_MAX_TIMES)
-                               return -1;
-                       sp->ttis[0].tt_gmtoff = -dstoffset;
-                       sp->ttis[0].tt_isdst = 1;
-                       sp->ttis[0].tt_abbrind = stdlen + 1;
-                       sp->ttis[1].tt_gmtoff = -stdoffset;
-                       sp->ttis[1].tt_isdst = 0;
-                       sp->ttis[1].tt_abbrind = 0;
-                       atp = sp->ats;
-                       typep = sp->types;
-                       janfirst = 0;
-                       for (year = EPOCH_YEAR; year <= 2037; ++year) {
-                               starttime = transtime(janfirst, year, &start,
-                                       stdoffset);
-                               endtime = transtime(janfirst, year, &end,
-                                       dstoffset);
-                               if (starttime > endtime) {
-                                       *atp++ = endtime;
-                                       *typep++ = 1;   /* DST ends */
-                                       *atp++ = starttime;
-                                       *typep++ = 0;   /* DST begins */
-                               } else {
-                                       *atp++ = starttime;
-                                       *typep++ = 0;   /* DST begins */
-                                       *atp++ = endtime;
-                                       *typep++ = 1;   /* DST ends */
-                               }
-                               janfirst += year_lengths[isleap(year)] *
-                                       SECSPERDAY;
-                       }
-               } else {
-                       long    theirstdoffset;
-                       long    theirdstoffset;
-                       long    theiroffset;
-                       int     isdst;
-                       int     i;
-                       int     j;
-
-                       if (*name != '\0')
-                               return -1;
-                       /*
-                       ** Initial values of theirstdoffset and theirdstoffset.
-                       */
-                       theirstdoffset = 0;
-                       for (i = 0; i < sp->timecnt; ++i) {
-                               j = sp->types[i];
-                               if (!sp->ttis[j].tt_isdst) {
-                                       theirstdoffset =
-                                               -sp->ttis[j].tt_gmtoff;
-                                       break;
-                               }
-                       }
-                       theirdstoffset = 0;
-                       for (i = 0; i < sp->timecnt; ++i) {
-                               j = sp->types[i];
-                               if (sp->ttis[j].tt_isdst) {
-                                       theirdstoffset =
-                                               -sp->ttis[j].tt_gmtoff;
-                                       break;
-                               }
-                       }
-                       /*
-                       ** Initially we're assumed to be in standard time.
-                       */
-                       isdst = FALSE;
-                       theiroffset = theirstdoffset;
-                       /*
-                       ** Now juggle transition times and types
-                       ** tracking offsets as you do.
-                       */
-                       for (i = 0; i < sp->timecnt; ++i) {
-                               j = sp->types[i];
-                               sp->types[i] = sp->ttis[j].tt_isdst;
-                               if (sp->ttis[j].tt_ttisgmt) {
-                                       /* No adjustment to transition time */
-                               } else {
-                                       /*
-                                       ** If summer time is in effect, and the
-                                       ** transition time was not specified as
-                                       ** standard time, add the summer time
-                                       ** offset to the transition time;
-                                       ** otherwise, add the standard time
-                                       ** offset to the transition time.
-                                       */
-                                       /*
-                                       ** Transitions from DST to DDST
-                                       ** will effectively disappear since
-                                       ** POSIX provides for only one DST
-                                       ** offset.
-                                       */
-                                       if (isdst && !sp->ttis[j].tt_ttisstd) {
-                                               sp->ats[i] += dstoffset -
-                                                       theirdstoffset;
-                                       } else {
-                                               sp->ats[i] += stdoffset -
-                                                       theirstdoffset;
-                                       }
-                               }
-                               theiroffset = -sp->ttis[j].tt_gmtoff;
-                               if (sp->ttis[j].tt_isdst)
-                                       theirdstoffset = theiroffset;
-                               else    theirstdoffset = theiroffset;
-                       }
-                       /*
-                       ** Finally, fill in ttis.
-                       ** ttisstd and ttisgmt need not be handled.
-                       */
-                       sp->ttis[0].tt_gmtoff = -stdoffset;
-                       sp->ttis[0].tt_isdst = FALSE;
-                       sp->ttis[0].tt_abbrind = 0;
-                       sp->ttis[1].tt_gmtoff = -dstoffset;
-                       sp->ttis[1].tt_isdst = TRUE;
-                       sp->ttis[1].tt_abbrind = stdlen + 1;
-                       sp->typecnt = 2;
-               }
-       } else {
-               dstlen = 0;
-               sp->typecnt = 1;                /* only standard time */
-               sp->timecnt = 0;
-               sp->ttis[0].tt_gmtoff = -stdoffset;
-               sp->ttis[0].tt_isdst = 0;
-               sp->ttis[0].tt_abbrind = 0;
-       }
-       sp->charcnt = stdlen + 1;
-       if (dstlen != 0)
-               sp->charcnt += dstlen + 1;
-       if ((size_t) sp->charcnt > sizeof sp->chars)
-               return -1;
-       cp = sp->chars;
-       (void) strncpy(cp, stdname, stdlen);
-       cp += stdlen;
-       *cp++ = '\0';
-       if (dstlen != 0) {
-               (void) strncpy(cp, dstname, dstlen);
-               *(cp + dstlen) = '\0';
-       }
-       return 0;
-}
-
-static void
-gmtload(sp)
-struct state * const   sp;
-{
-       if (tzload(gmt, sp) != 0)
-               (void) tzparse(gmt, sp, TRUE);
-}
-
-static void
-tzsetwall_basic(int rdlocked)
-{
-#ifdef NOTIFY_TZ
-       notify_check_tz(&lcl_notify);
-#else
-    if (TZDEFAULT) {
-        static struct timespec last_mtimespec = {0, 0};
-        struct stat statbuf;
-
-        if (lstat(TZDEFAULT, &statbuf) == 0) {
-            if (statbuf.st_mtimespec.tv_sec > last_mtimespec.tv_sec ||
-                (statbuf.st_mtimespec.tv_sec == last_mtimespec.tv_sec &&
-                 statbuf.st_mtimespec.tv_nsec > last_mtimespec.tv_nsec)) {
-               /* Trigger resetting the local TZ */
-                    lcl_is_set = 0;
-            }
-            last_mtimespec = statbuf.st_mtimespec;
-        }
-    }
-#endif /* NOTIFY_TZ */
-       if (!rdlocked)
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-       if (lcl_is_set < 0) {
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("tzsetwall_basic lcl_is_set < 0\n");
-#endif
-               if (!rdlocked)
-                       _RWLOCK_UNLOCK(&lcl_rwlock);
-               return;
-       }
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("tzsetwall_basic not set\n");
-#endif
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-
-       _RWLOCK_WRLOCK(&lcl_rwlock);
-       lcl_is_set = -1;
-
-#ifdef ALL_STATE
-       if (lclptr == NULL) {
-               lclptr = (struct state *) malloc(sizeof *lclptr);
-               if (lclptr == NULL) {
-                       settzname();    /* all we can do */
-                       _RWLOCK_UNLOCK(&lcl_rwlock);
-                       if (rdlocked)
-                               _RWLOCK_RDLOCK(&lcl_rwlock);
-                       return;
-               }
-       }
-#endif /* defined ALL_STATE */
-       if (tzload((char *) NULL, lclptr) != 0)
-               gmtload(lclptr);
-#ifdef NOTIFY_TZ
-       notify_register_tz(fullname, &lcl_notify);
-#endif /* NOTIFY_TZ */
-       settzname();
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-
-       if (rdlocked)
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-}
-
-void
-tzsetwall(void)
-{
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("tzsetwall called\n");
-#endif /* NOTIFY_TZ_DEBUG */
-       tzsetwall_basic(0);
-}
-
-__private_extern__ void
-tzset_basic(int rdlocked)
-{
-       const char *    name;
-
-       name = getenv("TZ");
-       if (name == NULL) {
-               tzsetwall_basic(rdlocked);
-               return;
-       }
-
-#ifdef NOTIFY_TZ
-       notify_check_tz(&lcl_notify);
-#endif /* NOTIFY_TZ */
-       if (!rdlocked)
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-       if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) {
-               if (!rdlocked)
-                       _RWLOCK_UNLOCK(&lcl_rwlock);
-#ifdef NOTIFY_TZ_DEBUG
-               NOTIFY_TZ_PRINTF("tzset_basic matched %s\n", lcl_TZname);
-#endif
-               return;
-       }
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-
-       _RWLOCK_WRLOCK(&lcl_rwlock);
-       lcl_is_set = strlen(name) < sizeof lcl_TZname;
-       if (lcl_is_set)
-               (void) strcpy(lcl_TZname, name);
-
-#ifdef ALL_STATE
-       if (lclptr == NULL) {
-               lclptr = (struct state *) malloc(sizeof *lclptr);
-               if (lclptr == NULL) {
-                       settzname();    /* all we can do */
-                       _RWLOCK_UNLOCK(&lcl_rwlock);
-                       if (rdlocked)
-                               _RWLOCK_RDLOCK(&lcl_rwlock);
-                       return;
-               }
-       }
-#endif /* defined ALL_STATE */
-       if (*name == '\0') {
-               /*
-               ** User wants it fast rather than right.
-               */
-               lclptr->leapcnt = 0;            /* so, we're off a little */
-               lclptr->timecnt = 0;
-               lclptr->typecnt = 0;
-               lclptr->ttis[0].tt_isdst = 0;
-               lclptr->ttis[0].tt_gmtoff = 0;
-               lclptr->ttis[0].tt_abbrind = 0;
-               (void) strcpy(lclptr->chars, gmt);
-#ifdef NOTIFY_TZ
-               if (fullname)
-                       *fullname = 0;
-#endif /* NOTIFY_TZ */
-       } else if (tzload(name, lclptr) != 0)
-               if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
-                       (void) gmtload(lclptr);
-#ifdef NOTIFY_TZ
-       notify_register_tz(fullname, &lcl_notify);
-#endif /* NOTIFY_TZ */
-       settzname();
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-
-       if (rdlocked)
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-}
-
-void
-tzset(void)
-{
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("tzset called TZ=%s\n", getenv("TZ"));
-#endif /* NOTIFY_TZ_DEBUG */
-       tzset_basic(0);
-}
-
-/*
-** The easy way to behave "as if no library function calls" localtime
-** is to not call it--so we drop its guts into "localsub", which can be
-** freely called.  (And no, the PANS doesn't require the above behavior--
-** but it *is* desirable.)
-**
-** The unused offset argument is for the benefit of mktime variants.
-*/
-
-/*ARGSUSED*/
-#ifdef __LP64__
-__private_extern__ struct tm *
-#else /* !__LP64__ */
-__private_extern__ void
-#endif /* __LP64__ */
-localsub(timep, offset, tmp)
-const time_t * const   timep;
-const long             offset;
-struct tm * const      tmp;
-{
-       struct state *          sp;
-       const struct ttinfo *   ttisp;
-       int                     i;
-       const time_t                    t = *timep;
-
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("localsub called\n");
-#endif /* NOTIFY_TZ_DEBUG */
-       sp = lclptr;
-#ifdef ALL_STATE
-       if (sp == NULL) {
-#ifdef __LP64__
-               return gmtsub(timep, offset, tmp);
-#else /* !__LP64__ */
-               gmtsub(timep, offset, tmp);
-               return;
-#endif /* __LP64__ */
-       }
-#endif /* defined ALL_STATE */
-       if (sp->timecnt == 0 || t < sp->ats[0]) {
-               i = 0;
-               while (sp->ttis[i].tt_isdst)
-                       if (++i >= sp->typecnt) {
-                               i = 0;
-                               break;
-                       }
-       } else {
-               for (i = 1; i < sp->timecnt; ++i)
-                       if (t < sp->ats[i])
-                               break;
-               i = sp->types[i - 1];
-       }
-       ttisp = &sp->ttis[i];
-       /*
-       ** To get (wrong) behavior that's compatible with System V Release 2.0
-       ** you'd replace the statement below with
-       **      t += ttisp->tt_gmtoff;
-       **      timesub(&t, 0L, sp, tmp);
-       */
-#ifdef __LP64__
-       if (timesub(&t, ttisp->tt_gmtoff, sp, tmp) == NULL)
-               return NULL;
-#else /* !__LP64__ */
-       timesub(&t, ttisp->tt_gmtoff, sp, tmp);
-#endif /* __LP64__ */
-       tmp->tm_isdst = ttisp->tt_isdst;
-       tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
-#ifdef TM_ZONE
-       tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
-#endif /* defined TM_ZONE */
-#ifdef __LP64__
-       return tmp;
-#endif /* __LP64__ */
-}
-
-struct tm *
-localtime(timep)
-const time_t * const   timep;
-{
-       static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER;
-       static pthread_key_t localtime_key = -1;
-       struct tm *p_tm;
-
-       if (__isthreaded != 0) {
-               if (localtime_key == (pthread_key_t)-1) {
-                       _pthread_mutex_lock(&localtime_mutex);
-                       if (localtime_key == (pthread_key_t)-1) {
-                               localtime_key = __LIBC_PTHREAD_KEY_LOCALTIME;
-                               if (pthread_key_init_np(localtime_key, free) < 0) {
-                                       _pthread_mutex_unlock(&localtime_mutex);
-                                       return(NULL);
-                               }
-                       }
-                       _pthread_mutex_unlock(&localtime_mutex);
-               }
-               p_tm = _pthread_getspecific(localtime_key);
-               if (p_tm == NULL) {
-                       if ((p_tm = (struct tm *)malloc(sizeof(struct tm)))
-                           == NULL)
-                               return(NULL);
-                       _pthread_setspecific(localtime_key, p_tm);
-               }
-               _RWLOCK_RDLOCK(&lcl_rwlock);
-               tzset_basic(1);
-#ifdef __LP64__
-               p_tm = localsub(timep, 0L, p_tm);
-#else /* !__LP64__ */
-               localsub(timep, 0L, p_tm);
-#endif /* __LP64__ */
-               _RWLOCK_UNLOCK(&lcl_rwlock);
-               return(p_tm);
-       } else {
-               tzset_basic(0);
-#ifdef __LP64__
-               return localsub(timep, 0L, &tm);
-#else /* !__LP64__ */
-               localsub(timep, 0L, &tm);
-               return(&tm);
-#endif /* __LP64__ */
-       }
-}
-
-/*
-** Re-entrant version of localtime.
-*/
-
-struct tm *
-localtime_r(const time_t * const __restrict timep, struct tm * __restrict tm)
-{
-       _RWLOCK_RDLOCK(&lcl_rwlock);
-       tzset_basic(1);
-#ifdef __LP64__
-       tm = localsub(timep, 0L, tm);
-#else /* !__LP64__ */
-       localsub(timep, 0L, tm);
-#endif /* __LP64__ */
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-       return tm;
-}
-
-/*
-** gmtsub is to gmtime as localsub is to localtime.
-*/
-
-#ifdef __LP64__
-static struct tm *
-#else /* !__LP64__ */
-static void
-#endif /* __LP64__ */
-gmtsub(timep, offset, tmp)
-const time_t * const   timep;
-const long             offset;
-struct tm * const      tmp;
-{
-#ifdef NOTIFY_TZ_DEBUG
-       NOTIFY_TZ_PRINTF("gmtsub called\n");
-#endif /* NOTIFY_TZ_DEBUG */
-#ifdef NOTIFY_TZ
-       notify_check_tz(&gmt_notify);
-#endif /* NOTIFY_TZ */
-       if (!gmt_is_set) {
-               _MUTEX_LOCK(&gmt_mutex);
-               if (!gmt_is_set) {
-#ifdef ALL_STATE
-#ifdef NOTIFY_TZ
-                       if (gmtptr == NULL)
-#endif /* NOTIFY_TZ */
-                               gmtptr = (struct state *) malloc(sizeof *gmtptr);
-                       if (gmtptr != NULL)
-#ifdef NOTIFY_TZ
-                       {
-#endif /* NOTIFY_TZ */
-#endif /* defined ALL_STATE */
-                               gmtload(gmtptr);
-#ifdef NOTIFY_TZ
-                               notify_register_tz(fullname, &gmt_notify);
-#ifdef ALL_STATE
-                       }
-#endif
-#endif /* NOTIFY_TZ */
-                       gmt_is_set = TRUE;
-               }
-               _MUTEX_UNLOCK(&gmt_mutex);
-       }
-#ifdef __LP64__
-       if(timesub(timep, offset, gmtptr, tmp) == NULL)
-               return NULL;
-#else /* !__LP64__ */
-       timesub(timep, offset, gmtptr, tmp);
-#endif /* __LP64__ */
-#ifdef TM_ZONE
-       /*
-       ** Could get fancy here and deliver something such as
-       ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
-       ** but this is no time for a treasure hunt.
-       */
-       if (offset != 0)
-               tmp->TM_ZONE = wildabbr;
-       else {
-#ifdef ALL_STATE
-               if (gmtptr == NULL)
-                       tmp->TM_ZONE = (char *)gmt;
-               else    tmp->TM_ZONE = gmtptr->chars;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
-               tmp->TM_ZONE = gmtptr->chars;
-#endif /* State Farm */
-       }
-#endif /* defined TM_ZONE */
-#ifdef __LP64__
-       return tmp;
-#endif /* __LP64__ */
-}
-
-struct tm *
-gmtime(timep)
-const time_t * const   timep;
-{
-       static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER;
-       static pthread_key_t gmtime_key = -1;
-       struct tm *p_tm;
-
-       if (__isthreaded != 0) {
-               if (gmtime_key == (pthread_key_t)-1) {
-                       _pthread_mutex_lock(&gmtime_mutex);
-                       if (gmtime_key == (pthread_key_t)-1) {
-                               gmtime_key = __LIBC_PTHREAD_KEY_GMTIME;
-                               if (pthread_key_init_np(gmtime_key, free) < 0) {
-                                       _pthread_mutex_unlock(&gmtime_mutex);
-                                       return(NULL);
-                               }
-                       }
-                       _pthread_mutex_unlock(&gmtime_mutex);
-               }
-               /*
-                * Changed to follow POSIX.1 threads standard, which
-                * is what BSD currently has.
-                */
-               if ((p_tm = _pthread_getspecific(gmtime_key)) == NULL) {
-                       if ((p_tm = (struct tm *)malloc(sizeof(struct tm)))
-                           == NULL) {
-                               return(NULL);
-                       }
-                       _pthread_setspecific(gmtime_key, p_tm);
-               }
-#ifdef __LP64__
-               return gmtsub(timep, 0L, p_tm);
-#else /* !__LP64__ */
-               gmtsub(timep, 0L, p_tm);
-               return(p_tm);
-#endif /* __LP64__ */
-       }
-       else {
-#ifdef __LP64__
-               return gmtsub(timep, 0L, &tm);
-#else /* !__LP64__ */
-               gmtsub(timep, 0L, &tm);
-               return(&tm);
-#endif /* __LP64__ */
-       }
-}
-
-/*
-* Re-entrant version of gmtime.
-*/
-
-struct tm *
-gmtime_r(timep, tm)
-const time_t * const   timep;
-struct tm *            tm;
-{
-
-#ifdef __LP64__
-       return gmtsub(timep, 0L, tm);
-#else /* !__LP64__ */
-       gmtsub(timep, 0L, tm);
-       return tm;
-#endif /* __LP64__ */
-}
-
-#ifdef STD_INSPIRED
-
-struct tm *
-offtime(timep, offset)
-const time_t * const   timep;
-const long             offset;
-{
-#ifdef __LP64__
-       return gmtsub(timep, offset, &tm);
-#else /* !__LP64__ */
-       gmtsub(timep, offset, &tm);
-       return &tm;
-#endif /* __LP64__ */
-}
-
-#endif /* defined STD_INSPIRED */
-
-#ifdef __LP64__
-static struct tm *
-#else /* !__LP64__ */
-static void
-#endif /* __LP64__ */
-timesub(timep, offset, sp, tmp)
-const time_t * const                   timep;
-const long                             offset;
-const struct state * const     sp;
-struct tm * const              tmp;
-{
-       const struct lsinfo *   lp;
-       long                    days;
-       long                    rem;
-       long                    y;
-       int                     yleap;
-       const int *             ip;
-       long                    corr;
-       int                     hit;
-       int                     i;
-
-       corr = 0;
-       hit = 0;
-#ifdef ALL_STATE
-       i = (sp == NULL) ? 0 : sp->leapcnt;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
-       i = sp->leapcnt;
-#endif /* State Farm */
-       while (--i >= 0) {
-               lp = &sp->lsis[i];
-               if (*timep >= lp->ls_trans) {
-                       if (*timep == lp->ls_trans) {
-                               hit = ((i == 0 && lp->ls_corr > 0) ||
-                                       lp->ls_corr > sp->lsis[i - 1].ls_corr);
-                               if (hit)
-                                       while (i > 0 &&
-                                               sp->lsis[i].ls_trans ==
-                                               sp->lsis[i - 1].ls_trans + 1 &&
-                                               sp->lsis[i].ls_corr ==
-                                               sp->lsis[i - 1].ls_corr + 1) {
-                                                       ++hit;
-                                                       --i;
-                                       }
-                       }
-                       corr = lp->ls_corr;
-                       break;
-               }
-       }
-       days = *timep / SECSPERDAY;
-       rem = *timep % SECSPERDAY;
-#ifdef mc68k
-       if (*timep == 0x80000000) {
-               /*
-               ** A 3B1 muffs the division on the most negative number.
-               */
-               days = -24855;
-               rem = -11648;
-       }
-#endif /* defined mc68k */
-       rem += (offset - corr);
-       while (rem < 0) {
-               rem += SECSPERDAY;
-               --days;
-       }
-       while (rem >= SECSPERDAY) {
-               rem -= SECSPERDAY;
-               ++days;
-       }
-       tmp->tm_hour = (int) (rem / SECSPERHOUR);
-       rem = rem % SECSPERHOUR;
-       tmp->tm_min = (int) (rem / SECSPERMIN);
-       /*
-       ** A positive leap second requires a special
-       ** representation.  This uses "... ??:59:60" et seq.
-       */
-       tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
-       tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK);
-       if (tmp->tm_wday < 0)
-               tmp->tm_wday += DAYSPERWEEK;
-       y = EPOCH_YEAR;
-#define _LEAPS_THRU_END_OF(y)  ((y) / 4 - (y) / 100 + (y) / 400)
-#ifdef __LP64__
-#define LEAPS_THRU_END_OF(y)   ((y) >= 0 ? _LEAPS_THRU_END_OF(y) : _LEAPS_THRU_END_OF((y) + 1) - 1)
-#else /* !__LP64__ */
-#define LEAPS_THRU_END_OF(y)   _LEAPS_THRU_END_OF(y)
-#endif /* __LP64__ */
-       while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) {
-               long    newy;
-
-               newy = y + days / DAYSPERNYEAR;
-               if (days < 0)
-                       --newy;
-               days -= (newy - y) * DAYSPERNYEAR +
-                       LEAPS_THRU_END_OF(newy - 1) -
-                       LEAPS_THRU_END_OF(y - 1);
-               y = newy;
-       }
-#ifdef __LP64__
-       y -= TM_YEAR_BASE;
-       if (y < INT_MIN || y > INT_MAX) {
-               errno = EOVERFLOW;
-               return NULL;
-       }
-       tmp->tm_year = y;
-#else /* !__LP64__ */
-       tmp->tm_year = y - TM_YEAR_BASE;
-#endif /* __LP64__ */
-       tmp->tm_yday = (int) days;
-       ip = mon_lengths[yleap];
-       for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon))
-               days = days - (long) ip[tmp->tm_mon];
-       tmp->tm_mday = (int) (days + 1);
-       tmp->tm_isdst = 0;
-#ifdef TM_GMTOFF
-       tmp->TM_GMTOFF = offset;
-#endif /* defined TM_GMTOFF */
-#ifdef __LP64__
-       return tmp;
-#endif /* __LP64__ */
-}
-
-char *
-ctime(timep)
-const time_t * const   timep;
-{
-/*
-** Section 4.12.3.2 of X3.159-1989 requires that
-**     The ctime function converts the calendar time pointed to by timer
-**     to local time in the form of a string.  It is equivalent to
-**             asctime(localtime(timer))
-*/
-#ifdef __LP64__
-       /*
-        * In 64-bit, the timep value may produce a time value with a year
-        * that exceeds 32-bits in size (won't fit in struct tm), so localtime
-        * will return NULL.
-        */
-       struct tm *tm = localtime(timep);
-
-       if (tm == NULL)
-               return NULL;
-       return asctime(tm);
-#else /* !__LP64__ */
-       return asctime(localtime(timep));
-#endif /* __LP64__ */
-}
-
-char *
-ctime_r(timep, buf)
-const time_t * const   timep;
-char *                 buf;
-{
-       struct tm       tm;
-
-#ifdef __LP64__
-       /*
-        * In 64-bit, the timep value may produce a time value with a year
-        * that exceeds 32-bits in size (won't fit in struct tm), so localtime_r
-        * will return NULL.
-        */
-       if (localtime_r(timep, &tm) == NULL)
-               return NULL;
-       return asctime_r(&tm, buf);
-#else /* !__LP64__ */
-       return asctime_r(localtime_r(timep, &tm), buf);
-#endif /* __LP64__ */
-}
-
-/*
-** Adapted from code provided by Robert Elz, who writes:
-**     The "best" way to do mktime I think is based on an idea of Bob
-**     Kridle's (so its said...) from a long time ago.
-**     [kridle@xinet.com as of 1996-01-16.]
-**     It does a binary search of the time_t space.  Since time_t's are
-**     just 32 bits, its a max of 32 iterations (even at 64 bits it
-**     would still be very reasonable).
-*/
-
-#ifndef WRONG
-#define WRONG  (-1)
-#endif /* !defined WRONG */
-
-/*
-** Simplified normalize logic courtesy Paul Eggert (eggert@twinsun.com).
-*/
-
-static int
-increment_overflow(number, delta)
-int *  number;
-int    delta;
-{
-       int     number0;
-
-       number0 = *number;
-       *number += delta;
-       return (*number < number0) != (delta < 0);
-}
-
-static int
-normalize_overflow(tensptr, unitsptr, base)
-int * const    tensptr;
-int * const    unitsptr;
-const int      base;
-{
-       int     tensdelta;
-
-       tensdelta = (*unitsptr >= 0) ?
-               (*unitsptr / base) :
-               (-1 - (-1 - *unitsptr) / base);
-       *unitsptr -= tensdelta * base;
-       return increment_overflow(tensptr, tensdelta);
-}
-
-static int
-tmcomp(atmp, btmp)
-const struct tm * const atmp;
-const struct tm * const btmp;
-{
-       int     result;
-
-       /*
-        * Assume that atmp and btmp point to normalized tm strutures.
-        * So only arithmetic with tm_year could overflow in 64-bit.
-        */
-       if (atmp->tm_year != btmp->tm_year) {
-               return (atmp->tm_year > btmp->tm_year ? 1 : -1);
-       }
-       if ((result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
-               (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
-               (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
-               (result = (atmp->tm_min - btmp->tm_min)) == 0)
-                       result = atmp->tm_sec - btmp->tm_sec;
-       return result;
-}
-
-static time_t
-time2sub(tmp, funcp, offset, okayp, do_norm_secs, unix03)
-struct tm * const      tmp;
-#ifdef __LP64__
-struct tm *(* const    funcp)(const time_t*, long, struct tm*);
-#else /* !__LP64__ */
-void (* const          funcp)(const time_t*, long, struct tm*);
-#endif /* __LP64__ */
-const long             offset;
-int * const            okayp;
-const int              do_norm_secs;
-int                    unix03;
-{
-       const struct state *    sp;
-       int                     dir;
-       int                     bits;
-       int                     i, j ;
-       int                     saved_seconds;
-       time_t                          newt;
-       time_t                          t;
-       struct tm                       yourtm, mytm;
-#ifdef __LP64__
-       long                            year, il;
-#endif /* __LP64__ */
-
-       *okayp = FALSE;
-       yourtm = *tmp;
-       if (do_norm_secs) {
-               if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
-                       SECSPERMIN))
-                               return WRONG;
-       }
-       if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR))
-               return WRONG;
-       if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
-               return WRONG;
-       if (normalize_overflow(&yourtm.tm_year, &yourtm.tm_mon, MONSPERYEAR))
-               return WRONG;
-       /*
-       ** Turn yourtm.tm_year into an actual year number for now.
-       ** It is converted back to an offset from TM_YEAR_BASE later.
-       */
-#ifdef __LP64__
-       year = (long)yourtm.tm_year + TM_YEAR_BASE;
-#else /* !__LP64__ */
-       if (increment_overflow(&yourtm.tm_year, TM_YEAR_BASE))
-               return WRONG;
-#endif /* __LP64__ */
-       while (yourtm.tm_mday <= 0) {
-#ifdef __LP64__
-               year--;
-               il = year + (1 < yourtm.tm_mon);
-               yourtm.tm_mday += year_lengths[isleap(il)];
-#else /* !__LP64__ */
-               if (increment_overflow(&yourtm.tm_year, -1))
-                       return WRONG;
-               i = yourtm.tm_year + (1 < yourtm.tm_mon);
-               yourtm.tm_mday += year_lengths[isleap(i)];
-#endif /* __LP64__ */
-       }
-       while (yourtm.tm_mday > DAYSPERLYEAR) {
-#ifdef __LP64__
-               il = year + (1 < yourtm.tm_mon);
-               yourtm.tm_mday -= year_lengths[isleap(il)];
-               year++;
-#else /* !__LP64__ */
-               i = yourtm.tm_year + (1 < yourtm.tm_mon);
-               yourtm.tm_mday -= year_lengths[isleap(i)];
-               if (increment_overflow(&yourtm.tm_year, 1))
-                       return WRONG;
-#endif /* __LP64__ */
-       }
-       for ( ; ; ) {
-#ifdef __LP64__
-               i = mon_lengths[isleap(year)][yourtm.tm_mon];
-#else /* !__LP64__ */
-               i = mon_lengths[isleap(yourtm.tm_year)][yourtm.tm_mon];
-#endif /* __LP64__ */
-               if (yourtm.tm_mday <= i)
-                       break;
-               yourtm.tm_mday -= i;
-               if (++yourtm.tm_mon >= MONSPERYEAR) {
-                       yourtm.tm_mon = 0;
-#ifdef __LP64__
-                       year++;
-#else /* !__LP64__ */
-                       if (increment_overflow(&yourtm.tm_year, 1))
-                               return WRONG;
-#endif /* __LP64__ */
-               }
-       }
-#ifdef __LP64__
-       year -= TM_YEAR_BASE;
-       if (year > INT_MAX || year < INT_MIN)
-               return WRONG;
-       yourtm.tm_year = year;
-#else /* !__LP64__ */
-       if (increment_overflow(&yourtm.tm_year, -TM_YEAR_BASE))
-               return WRONG;
-#endif /* __LP64__ */
-       /* Don't go below 1900 for POLA */
-       if (yourtm.tm_year < 0)
-               return WRONG;
-       if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN)
-               saved_seconds = 0;
-       else if (yourtm.tm_year + TM_YEAR_BASE < EPOCH_YEAR) {
-               /*
-               ** We can't set tm_sec to 0, because that might push the
-               ** time below the minimum representable time.
-               ** Set tm_sec to 59 instead.
-               ** This assumes that the minimum representable time is
-               ** not in the same minute that a leap second was deleted from,
-               ** which is a safer assumption than using 58 would be.
-               */
-               if (increment_overflow(&yourtm.tm_sec, 1 - SECSPERMIN))
-                       return WRONG;
-               saved_seconds = yourtm.tm_sec;
-               yourtm.tm_sec = SECSPERMIN - 1;
-       } else {
-               saved_seconds = yourtm.tm_sec;
-               yourtm.tm_sec = 0;
-       }
-       /*
-       ** Divide the search space in half
-       ** (this works whether time_t is signed or unsigned).
-       */
-#ifdef __LP64__
-       /* optimization: see if the value is 31-bit (signed) */
-       t = (((time_t) 1) << (TYPE_BIT(int) - 1)) - 1;
-       bits = ((*funcp)(&t, offset, &mytm) == NULL || tmcomp(&mytm, &yourtm) < 0) ? TYPE_BIT(time_t) - 1 : TYPE_BIT(int) - 1;
-#else /* !__LP64__ */
-       bits = TYPE_BIT(time_t) - 1;
-#endif /* __LP64__ */
-       /*
-       ** In 64-bit, we now return an error if we cannot represent the
-       ** struct tm value in a time_t.  And tmcomp() is fixed to avoid
-       ** overflow in tm_year.  So we only put a cap on bits because time_t
-       ** can't be larger that 56 bit (when tm_year == INT_MAX).
-       */
-       if (bits > 56)
-               bits = 56;
-       /*
-       ** If time_t is signed, then 0 is just above the median,
-       ** assuming two's complement arithmetic.
-       ** If time_t is unsigned, then (1 << bits) is just above the median.
-       */
-       t = TYPE_SIGNED(time_t) ? 0 : (((time_t) 1) << bits);
-       for ( ; ; ) {
-#ifdef __LP64__
-               if ((*funcp)(&t, offset, &mytm) == NULL) {
-                   /* we overflowed, so t is too big */
-                   dir = 1;
-                   goto skip_tmcomp;
-               }
-#else /* !__LP64__ */
-               (*funcp)(&t, offset, &mytm);
-#endif /* __LP64__ */
-               dir = tmcomp(&mytm, &yourtm);
-#ifdef __LP64__
-skip_tmcomp:
-#endif /* __LP64__ */
-               if (dir != 0) {
-                       if (bits-- < 0)
-                               return WRONG;
-                       if (bits < 0)
-                               --t; /* may be needed if new t is minimal */
-                       else if (dir > 0)
-                               t -= ((time_t) 1) << bits;
-                       else    t += ((time_t) 1) << bits;
-                       continue;
-               }
-               sp = (funcp == localsub) ? lclptr : gmtptr;
-               if (unix03 && sp->typecnt == 1 && yourtm.tm_isdst > 0) 
-                       yourtm.tm_isdst = 0; /* alternative time does not apply */
-               if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
-                       break;
-               /*
-               ** Right time, wrong type.
-               ** Hunt for right time, right type.
-               ** It's okay to guess wrong since the guess
-               ** gets checked.
-               */
-#ifdef ALL_STATE
-               if (sp == NULL)
-                       return WRONG;
-#endif /* defined ALL_STATE */
-               for (i = sp->typecnt - 1; i >= 0; --i) {
-                       if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
-                               continue;
-                       for (j = sp->typecnt - 1; j >= 0; --j) {
-                               if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
-                                       continue;
-                               newt = t + sp->ttis[j].tt_gmtoff -
-                                       sp->ttis[i].tt_gmtoff;
-#ifdef __LP64__
-                               if ((*funcp)(&newt, offset, &mytm) == NULL)
-                                       return WRONG;
-#else /* !__LP64__ */
-                               (*funcp)(&newt, offset, &mytm);
-#endif /* __LP64__ */
-                               if (tmcomp(&mytm, &yourtm) != 0)
-                                       continue;
-                               if (mytm.tm_isdst != yourtm.tm_isdst)
-                                       continue;
-                               /*
-                               ** We have a match.
-                               */
-                               t = newt;
-                               goto label;
-                       }
-               }
-               return WRONG;
-       }
-label:
-       newt = t + saved_seconds;
-       if ((newt < t) != (saved_seconds < 0))
-               return WRONG;
-       t = newt;
-#ifdef __LP64__
-       if ((*funcp)(&t, offset, tmp) == NULL)
-               return WRONG;
-#else /* !__LP64__ */
-       (*funcp)(&t, offset, tmp);
-#endif /* __LP64__ */
-       *okayp = TRUE;
-       return t;
-}
-
-static time_t
-time2(tmp, funcp, offset, okayp, unix03)
-struct tm * const      tmp;
-#ifdef __LP64__
-struct tm *(* const    funcp)(const time_t*, long, struct tm*);
-#else /* !__LP64__ */
-void (* const          funcp)(const time_t*, long, struct tm*);
-#endif /* __LP64__ */
-const long             offset;
-int * const            okayp;
-int                    unix03;
-{
-       time_t  t;
-
-       /*
-       ** First try without normalization of seconds
-       ** (in case tm_sec contains a value associated with a leap second).
-       ** If that fails, try with normalization of seconds.
-       */
-       t = time2sub(tmp, funcp, offset, okayp, FALSE, unix03);
-       return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE, unix03);
-}
-
-__private_extern__ time_t
-time1(tmp, funcp, offset, unix03)
-struct tm * const      tmp;
-#ifdef __LP64__
-struct tm *(* const    funcp)(const time_t *, long, struct tm *);
-#else /* !__LP64__ */
-void (* const          funcp)(const time_t *, long, struct tm *);
-#endif /* __LP64__ */
-const long             offset;
-int                    unix03;
-{
-       time_t                  t;
-       const struct state *    sp;
-       int                     samei, otheri;
-       int                     sameind, otherind;
-       int                     i;
-       int                     nseen;
-       int                             seen[TZ_MAX_TYPES];
-       int                             types[TZ_MAX_TYPES];
-       int                             okay;
-
-       if (tmp->tm_isdst > 1)
-               tmp->tm_isdst = 1;
-       t = time2(tmp, funcp, offset, &okay, unix03);
-#ifdef PCTS
-       /*
-       ** PCTS code courtesy Grant Sullivan (grant@osf.org).
-       */
-       if (okay)
-               return t;
-       if (tmp->tm_isdst < 0)
-               tmp->tm_isdst = 0;      /* reset to std and try again */
-#endif /* defined PCTS */
-#ifndef PCTS
-       if (okay || tmp->tm_isdst < 0)
-               return t;
-#endif /* !defined PCTS */
-       /*
-       ** We're supposed to assume that somebody took a time of one type
-       ** and did some math on it that yielded a "struct tm" that's bad.
-       ** We try to divine the type they started from and adjust to the
-       ** type they need.
-       */
-       sp = (funcp == localsub) ? lclptr : gmtptr;
-#ifdef ALL_STATE
-       if (sp == NULL)
-               return WRONG;
-#endif /* defined ALL_STATE */
-       for (i = 0; i < sp->typecnt; ++i)
-               seen[i] = FALSE;
-       nseen = 0;
-       for (i = sp->timecnt - 1; i >= 0; --i)
-               if (!seen[sp->types[i]]) {
-                       seen[sp->types[i]] = TRUE;
-                       types[nseen++] = sp->types[i];
-               }
-       for (sameind = 0; sameind < nseen; ++sameind) {
-               samei = types[sameind];
-               if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
-                       continue;
-               for (otherind = 0; otherind < nseen; ++otherind) {
-                       otheri = types[otherind];
-                       if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
-                               continue;
-                       tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
-                                       sp->ttis[samei].tt_gmtoff;
-                       tmp->tm_isdst = !tmp->tm_isdst;
-                       t = time2(tmp, funcp, offset, &okay, unix03);
-                       if (okay)
-                               return t;
-                       tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
-                                       sp->ttis[samei].tt_gmtoff;
-                       tmp->tm_isdst = !tmp->tm_isdst;
-               }
-       }
-       return WRONG;
-}
-#else  /* BUILDING_VARIANT */
-__private_extern__ pthread_rwlock_t    lcl_rwlock;
-#endif /* BUILDING_VARIANT */
-
-time_t
-mktime(tmp)
-struct tm * const      tmp;
-{
-       time_t mktime_return_value;
-       int serrno = errno;
-       _RWLOCK_RDLOCK(&lcl_rwlock);
-       tzset_basic(1);
-       mktime_return_value = time1(tmp, localsub, 0L, __DARWIN_UNIX03);
-       _RWLOCK_UNLOCK(&lcl_rwlock);
-       errno = serrno;
-       return(mktime_return_value);
-}
-
-#if !BUILDING_VARIANT
-#ifdef STD_INSPIRED
-
-time_t
-timelocal(tmp)
-struct tm * const      tmp;
-{
-       tmp->tm_isdst = -1;     /* in case it wasn't initialized */
-       return mktime(tmp);
-}
-
-time_t
-timegm(tmp)
-struct tm * const      tmp;
-{
-       tmp->tm_isdst = 0;
-       return time1(tmp, gmtsub, 0L, __DARWIN_UNIX03);
-}
-
-time_t
-timeoff(tmp, offset)
-struct tm * const      tmp;
-const long             offset;
-{
-       tmp->tm_isdst = 0;
-       return time1(tmp, gmtsub, offset, __DARWIN_UNIX03);
-}
-
-#endif /* defined STD_INSPIRED */
-
-#ifdef CMUCS
-
-/*
-** The following is supplied for compatibility with
-** previous versions of the CMUCS runtime library.
-*/
-
-long
-gtime(tmp)
-struct tm * const      tmp;
-{
-       const time_t    t = mktime(tmp);
-
-       if (t == WRONG)
-               return -1;
-       return t;
-}
-
-#endif /* defined CMUCS */
-
-/*
-** XXX--is the below the right way to conditionalize??
-*/
-
-#ifdef STD_INSPIRED
-
-/*
-** IEEE Std 1003.1-1988 (POSIX) legislates that 536457599
-** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
-** is not the case if we are accounting for leap seconds.
-** So, we provide the following conversion routines for use
-** when exchanging timestamps with POSIX conforming systems.
-*/
-
-static long
-leapcorr(timep)
-time_t *       timep;
-{
-       struct state *          sp;
-       struct lsinfo * lp;
-       int                     i;
-
-       sp = lclptr;
-       i = sp->leapcnt;
-       while (--i >= 0) {
-               lp = &sp->lsis[i];
-               if (*timep >= lp->ls_trans)
-                       return lp->ls_corr;
-       }
-       return 0;
-}
-
-time_t
-time2posix(t)
-time_t t;
-{
-       tzset();
-       return t - leapcorr(&t);
-}
-
-time_t
-posix2time(t)
-time_t t;
-{
-       time_t  x;
-       time_t  y;
-
-       tzset();
-       /*
-       ** For a positive leap second hit, the result
-       ** is not unique.  For a negative leap second
-       ** hit, the corresponding time doesn't exist,
-       ** so we return an adjacent second.
-       */
-       x = t + leapcorr(&t);
-       y = x - leapcorr(&x);
-       if (y < t) {
-               do {
-                       x++;
-                       y = x - leapcorr(&x);
-               } while (y < t);
-               if (t != y)
-                       return x - 1;
-       } else if (y > t) {
-               do {
-                       --x;
-                       y = x - leapcorr(&x);
-               } while (y > t);
-               if (t != y)
-                       return x + 1;
-       }
-       return x;
-}
-
-#endif /* defined STD_INSPIRED */
-#endif /* !BUILDING_VARIANT */
diff --git a/stdtime/private.h b/stdtime/private.h
deleted file mode 120000 (symlink)
index af6f8e0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./private.h
\ No newline at end of file
diff --git a/stdtime/strftime-fbsd.c b/stdtime/strftime-fbsd.c
deleted file mode 100644 (file)
index 0f0e524..0000000
+++ /dev/null
@@ -1,661 +0,0 @@
-/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef lint
-#ifndef NOID
-static const char      elsieid[] = "@(#)strftime.3     8.3";
-/*
-** Based on the UCB version with the ID appearing below.
-** This is ANSIish only when "multibyte character == plain character".
-*/
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include "private.h"
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char      sccsid[] = "@(#)strftime.c      5.4 (Berkeley) 3/14/89";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdtime/strftime.c,v 1.44 2009/06/09 09:02:58 delphij Exp $");
-
-#include "tzfile.h"
-#include <time.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include "un-namespace.h"
-#include "timelocal.h"
-
-#if !BUILDING_VARIANT
-static char *  _add(const char *, char *, const char *);
-static char *  _conv(int, const char *, char *, const char *, locale_t);
-static char *  _yconv(int, int, int, int, char *, const char *, locale_t);
-#endif
-#define        _fmt    _st_fmt
-__private_extern__ char *      _fmt(const char *, const struct tm *, char *, const char *,
-                       int *, struct lc_time_T *, locale_t);
-
-extern char *  tzname[];
-__private_extern__ long __darwin_altzone;              /* DST timezone offset */
-#define altzone __darwin_altzone
-__private_extern__ long _st_get_timezone(void);
-
-#ifndef YEAR_2000_NAME
-#define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
-#endif /* !defined YEAR_2000_NAME */
-
-#define IN_NONE        0
-#define IN_SOME        1
-#define IN_THIS        2
-#define IN_ALL 3
-
-#define PAD_DEFAULT    0
-#define PAD_LESS       1
-#define PAD_SPACE      2
-#define PAD_ZERO       3
-
-#ifndef BUILDING_VARIANT
-static const char* fmt_padding[][4] = {
-       /* DEFAULT,     LESS,   SPACE,  ZERO */
-#define PAD_FMT_MONTHDAY       0
-#define PAD_FMT_HMS            0
-#define PAD_FMT_CENTURY                0
-#define PAD_FMT_SHORTYEAR      0
-#define PAD_FMT_MONTH          0
-#define PAD_FMT_WEEKOFYEAR     0
-#define PAD_FMT_DAYOFMONTH     0
-       { "%02d",       "%d",   "%2d",  "%02d" },
-#define PAD_FMT_SDAYOFMONTH    1
-#define PAD_FMT_SHMS           1
-       { "%2d",        "%d",   "%2d",  "%02d" },
-#define        PAD_FMT_DAYOFYEAR       2
-       { "%03d",       "%d",   "%3d",  "%03d" },
-#define PAD_FMT_YEAR           3
-       { "%04d",       "%d",   "%4d",  "%04d" }
-};
-#endif
-
-#define USG_COMPAT
-#define ALTZONE
-
-size_t
-strftime_l(char * __restrict s, size_t maxsize, const char * __restrict format,
-    const struct tm * __restrict t, locale_t loc)
-{
-       char *  p;
-       int     warn;
-
-       NORMALIZE_LOCALE(loc);
-       tzset();
-       warn = IN_NONE;
-       p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, __get_current_time_locale(loc), loc);
-#ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
-       if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
-               (void) fputs("\n", stderr);
-               if (format == NULL)
-                       (void) fputs("NULL strftime format ", stderr);
-               else    (void) fprintf_l(stderr, loc, "strftime format \"%s\" ",
-                               format);
-               (void) fputs("yields only two digits of years in ", stderr);
-               if (warn == IN_SOME)
-                       (void) fputs("some locales", stderr);
-               else if (warn == IN_THIS)
-                       (void) fputs("the current locale", stderr);
-               else    (void) fputs("all locales", stderr);
-               (void) fputs("\n", stderr);
-       }
-#endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
-       if (p == s + maxsize)
-               return 0;
-       *p = '\0';
-       return p - s;
-}
-
-size_t
-strftime(char * __restrict s, size_t maxsize, const char * __restrict format,
-    const struct tm * __restrict t)
-{
-       return strftime_l(s, maxsize, format, t, __current_locale());
-}
-
-#ifndef BUILDING_VARIANT
-__private_extern__ char *
-_fmt(format, t, pt, ptlim, warnp, tptr, loc)
-const char *           format;
-const struct tm * const        t;
-char *                 pt;
-const char * const     ptlim;
-int *                  warnp;
-struct lc_time_T *     tptr;
-locale_t               loc;
-{
-       int Ealternative, Oalternative, PadIndex;
-
-       for ( ; *format; ++format) {
-               if (*format == '%') {
-                       Ealternative = 0;
-                       Oalternative = 0;
-                       PadIndex         = PAD_DEFAULT;
-label:
-                       switch (*++format) {
-                       case '\0':
-                               --format;
-                               break;
-                       case 'A':
-                               pt = _add((t->tm_wday < 0 ||
-                                       t->tm_wday >= DAYSPERWEEK) ?
-                                       "?" : tptr->weekday[t->tm_wday],
-                                       pt, ptlim);
-                               continue;
-                       case 'a':
-                               pt = _add((t->tm_wday < 0 ||
-                                       t->tm_wday >= DAYSPERWEEK) ?
-                                       "?" : tptr->wday[t->tm_wday],
-                                       pt, ptlim);
-                               continue;
-                       case 'B':
-                               pt = _add((t->tm_mon < 0 ||
-                                       t->tm_mon >= MONSPERYEAR) ?
-                                       "?" : (Oalternative ? tptr->alt_month :
-                                       tptr->month)[t->tm_mon],
-                                       pt, ptlim);
-                               continue;
-                       case 'b':
-                       case 'h':
-                               pt = _add((t->tm_mon < 0 ||
-                                       t->tm_mon >= MONSPERYEAR) ?
-                                       "?" : tptr->mon[t->tm_mon],
-                                       pt, ptlim);
-                               continue;
-                       case 'C':
-                               /*
-                               ** %C used to do a...
-                               **      _fmt("%a %b %e %X %Y", t, tptr, loc);
-                               ** ...whereas now POSIX 1003.2 calls for
-                               ** something completely different.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
-                                       pt, ptlim, loc);
-                               continue;
-                       case 'c':
-                               {
-                               int warn2 = IN_SOME;
-
-                               pt = _fmt(tptr->c_fmt, t, pt, ptlim, &warn2, tptr, loc);
-                               if (warn2 == IN_ALL)
-                                       warn2 = IN_THIS;
-                               if (warn2 > *warnp)
-                                       *warnp = warn2;
-                               }
-                               continue;
-                       case 'D':
-                               pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'd':
-                               pt = _conv(t->tm_mday, fmt_padding[PAD_FMT_DAYOFMONTH][PadIndex],
-                                       pt, ptlim, loc);
-                               continue;
-                       case 'E':
-                               if (Ealternative || Oalternative)
-                                       break;
-                               Ealternative++;
-                               goto label;
-                       case 'O':
-                               /*
-                               ** C99 locale modifiers.
-                               ** The sequences
-                               **      %Ec %EC %Ex %EX %Ey %EY
-                               **      %Od %oe %OH %OI %Om %OM
-                               **      %OS %Ou %OU %OV %Ow %OW %Oy
-                               ** are supposed to provide alternate
-                               ** representations.
-                               **
-                               ** FreeBSD extension
-                               **      %OB
-                               */
-                               if (Ealternative || Oalternative)
-                                       break;
-                               Oalternative++;
-                               goto label;
-                       case 'e':
-                               pt = _conv(t->tm_mday,
-                                       fmt_padding[PAD_FMT_SDAYOFMONTH][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'F':
-                               pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'H':
-                               pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_HMS][PadIndex],
-                                       pt, ptlim, loc);
-                               continue;
-                       case 'I':
-                               pt = _conv((t->tm_hour % 12) ?
-                                       (t->tm_hour % 12) : 12,
-                                       fmt_padding[PAD_FMT_HMS][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'j':
-                               pt = _conv(t->tm_yday + 1,
-                                       fmt_padding[PAD_FMT_DAYOFYEAR][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'k':
-                               /*
-                               ** This used to be...
-                               **      _conv(t->tm_hour % 12 ?
-                               **              t->tm_hour % 12 : 12, 2, ' ', loc);
-                               ** ...and has been changed to the below to
-                               ** match SunOS 4.1.1 and Arnold Robbins'
-                               ** strftime version 3.0. That is, "%k" and
-                               ** "%l" have been swapped.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv(t->tm_hour, fmt_padding[PAD_FMT_SHMS][PadIndex],
-                                       pt, ptlim, loc);
-                               continue;
-#ifdef KITCHEN_SINK
-                       case 'K':
-                               /*
-                               ** After all this time, still unclaimed!
-                               */
-                               pt = _add("kitchen sink", pt, ptlim);
-                               continue;
-#endif /* defined KITCHEN_SINK */
-                       case 'l':
-                               /*
-                               ** This used to be...
-                               **      _conv(t->tm_hour, 2, ' ');
-                               ** ...and has been changed to the below to
-                               ** match SunOS 4.1.1 and Arnold Robbin's
-                               ** strftime version 3.0. That is, "%k" and
-                               ** "%l" have been swapped.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv((t->tm_hour % 12) ?
-                                       (t->tm_hour % 12) : 12,
-                                       fmt_padding[PAD_FMT_SHMS][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'M':
-                               pt = _conv(t->tm_min, fmt_padding[PAD_FMT_HMS][PadIndex],
-                                       pt, ptlim, loc);
-                               continue;
-                       case 'm':
-                               pt = _conv(t->tm_mon + 1,
-                                       fmt_padding[PAD_FMT_MONTH][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'n':
-                               pt = _add("\n", pt, ptlim);
-                               continue;
-                       case 'p':
-                               pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
-                                       tptr->pm :
-                                       tptr->am,
-                                       pt, ptlim);
-                               continue;
-                       case 'R':
-                               pt = _fmt("%H:%M", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'r':
-                               pt = _fmt(tptr->ampm_fmt, t, pt, ptlim,
-                                       warnp, tptr, loc);
-                               continue;
-                       case 'S':
-                               pt = _conv(t->tm_sec, fmt_padding[PAD_FMT_HMS][PadIndex],
-                                       pt, ptlim, loc);
-                               continue;
-                       case 's':
-                               {
-                                       struct tm       tm;
-                                       char            buf[INT_STRLEN_MAXIMUM(
-                                                               time_t) + 1];
-                                       time_t          mkt;
-
-                                       tm = *t;
-                                       mkt = mktime(&tm);
-                                       if (TYPE_SIGNED(time_t))
-                                               (void) sprintf_l(buf, loc, "%ld",
-                                                       (long) mkt);
-                                       else    (void) sprintf_l(buf, loc, "%lu",
-                                                       (unsigned long) mkt);
-                                       pt = _add(buf, pt, ptlim);
-                               }
-                               continue;
-                       case 'T':
-                               pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 't':
-                               pt = _add("\t", pt, ptlim);
-                               continue;
-                       case 'U':
-                               pt = _conv((t->tm_yday + DAYSPERWEEK -
-                                       t->tm_wday) / DAYSPERWEEK,
-                                       fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'u':
-                               /*
-                               ** From Arnold Robbins' strftime version 3.0:
-                               ** "ISO 8601: Weekday as a decimal number
-                               ** [1 (Monday) - 7]"
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv((t->tm_wday == 0) ?
-                                       DAYSPERWEEK : t->tm_wday,
-                                       "%d", pt, ptlim, loc);
-                               continue;
-                       case 'V':       /* ISO 8601 week number */
-                       case 'G':       /* ISO 8601 year (four digits) */
-                       case 'g':       /* ISO 8601 year (two digits) */
-/*
-** From Arnold Robbins' strftime version 3.0: "the week number of the
-** year (the first Monday as the first day of week 1) as a decimal number
-** (01-53)."
-** (ado, 1993-05-24)
-**
-** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn:
-** "Week 01 of a year is per definition the first week which has the
-** Thursday in this year, which is equivalent to the week which contains
-** the fourth day of January. In other words, the first week of a new year
-** is the week which has the majority of its days in the new year. Week 01
-** might also contain days from the previous year and the week before week
-** 01 of a year is the last week (52 or 53) of the previous year even if
-** it contains days from the new year. A week starts with Monday (day 1)
-** and ends with Sunday (day 7). For example, the first week of the year
-** 1997 lasts from 1996-12-30 to 1997-01-05..."
-** (ado, 1996-01-02)
-*/
-                               {
-                                       int     year;
-                                       int     base;
-                                       int     yday;
-                                       int     wday;
-                                       int     w;
-
-                                       year = t->tm_year;
-                                       base = TM_YEAR_BASE;
-                                       yday = t->tm_yday;
-                                       wday = t->tm_wday;
-                                       for ( ; ; ) {
-                                               int     len;
-                                               int     bot;
-                                               int     top;
-
-                                               len = isleap_sum(year, base) ?
-                                                       DAYSPERLYEAR :
-                                                       DAYSPERNYEAR;
-                                               /*
-                                               ** What yday (-3 ... 3) does
-                                               ** the ISO year begin on?
-                                               */
-                                               bot = ((yday + 11 - wday) %
-                                                       DAYSPERWEEK) - 3;
-                                               /*
-                                               ** What yday does the NEXT
-                                               ** ISO year begin on?
-                                               */
-                                               top = bot -
-                                                       (len % DAYSPERWEEK);
-                                               if (top < -3)
-                                                       top += DAYSPERWEEK;
-                                               top += len;
-                                               if (yday >= top) {
-                                                       ++base;
-                                                       w = 1;
-                                                       break;
-                                               }
-                                               if (yday >= bot) {
-                                                       w = 1 + ((yday - bot) /
-                                                               DAYSPERWEEK);
-                                                       break;
-                                               }
-                                               --base;
-                                               yday += isleap_sum(year, base) ?
-                                                       DAYSPERLYEAR :
-                                                       DAYSPERNYEAR;
-                                       }
-#ifdef XPG4_1994_04_09
-                                       if ((w == 52 &&
-                                               t->tm_mon == TM_JANUARY) ||
-                                               (w == 1 &&
-                                               t->tm_mon == TM_DECEMBER))
-                                                       w = 53;
-#endif /* defined XPG4_1994_04_09 */
-                                       if (*format == 'V')
-                                               pt = _conv(w, fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex],
-                                                       pt, ptlim, loc);
-                                       else if (*format == 'g') {
-                                               *warnp = IN_ALL;
-                                               pt = _yconv(year, base, 0, 1,
-                                                       pt, ptlim, loc);
-                                       } else  pt = _yconv(year, base, 1, 1,
-                                                       pt, ptlim, loc);
-                               }
-                               continue;
-                       case 'v':
-                               /*
-                               ** From Arnold Robbins' strftime version 3.0:
-                               ** "date as dd-bbb-YYYY"
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'W':
-                               pt = _conv((t->tm_yday + DAYSPERWEEK -
-                                       (t->tm_wday ?
-                                       (t->tm_wday - 1) :
-                                       (DAYSPERWEEK - 1))) / DAYSPERWEEK,
-                                       fmt_padding[PAD_FMT_WEEKOFYEAR][PadIndex], pt, ptlim, loc);
-                               continue;
-                       case 'w':
-                               pt = _conv(t->tm_wday, "%d", pt, ptlim, loc);
-                               continue;
-                       case 'X':
-                               pt = _fmt(tptr->X_fmt, t, pt, ptlim, warnp, tptr, loc);
-                               continue;
-                       case 'x':
-                               {
-                               int     warn2 = IN_SOME;
-
-                               pt = _fmt(tptr->x_fmt, t, pt, ptlim, &warn2, tptr, loc);
-                               if (warn2 == IN_ALL)
-                                       warn2 = IN_THIS;
-                               if (warn2 > *warnp)
-                                       *warnp = warn2;
-                               }
-                               continue;
-                       case 'y':
-                               *warnp = IN_ALL;
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
-                                       pt, ptlim, loc);
-                               continue;
-                       case 'Y':
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
-                                       pt, ptlim, loc);
-                               continue;
-                       case 'Z':
-#ifdef TM_ZONE
-                               if (t->TM_ZONE != NULL)
-                                       pt = _add(t->TM_ZONE, pt, ptlim);
-                               else
-#endif /* defined TM_ZONE */
-                               if (t->tm_isdst >= 0)
-                                       pt = _add(tzname[t->tm_isdst != 0],
-                                               pt, ptlim);
-                               /*
-                               ** C99 says that %Z must be replaced by the
-                               ** empty string if the time zone is not
-                               ** determinable.
-                               */
-                               continue;
-                       case 'z':
-                               {
-                               int             diff;
-                               char const *    sign;
-
-                               if (t->tm_isdst < 0)
-                                       continue;
-#if defined(TM_GMTOFF) && !__DARWIN_UNIX03
-                               diff = t->TM_GMTOFF;
-#else /* !defined TM_GMTOFF || __DARWIN_UNIX03 */
-                               /*
-                               ** C99 says that the UTC offset must
-                               ** be computed by looking only at
-                               ** tm_isdst. This requirement is
-                               ** incorrect, since it means the code
-                               ** must rely on magic (in this case
-                               ** altzone and timezone), and the
-                               ** magic might not have the correct
-                               ** offset. Doing things correctly is
-                               ** tricky and requires disobeying C99;
-                               ** see GNU C strftime for details.
-                               ** For now, punt and conform to the
-                               ** standard, even though it's incorrect.
-                               **
-                               ** C99 says that %z must be replaced by the
-                               ** empty string if the time zone is not
-                               ** determinable, so output nothing if the
-                               ** appropriate variables are not available.
-                               */
-                               if (t->tm_isdst == 0)
-#ifdef USG_COMPAT
-                                       diff = -_st_get_timezone();
-#else /* !defined USG_COMPAT */
-                                       continue;
-#endif /* !defined USG_COMPAT */
-                               else
-#ifdef ALTZONE
-                                       diff = -altzone;
-#else /* !defined ALTZONE */
-                                       continue;
-#endif /* !defined ALTZONE */
-#endif /* !defined TM_GMTOFF || __DARWIN_UNIX03 */
-                               if (diff < 0) {
-                                       sign = "-";
-                                       diff = -diff;
-                               } else  sign = "+";
-                               pt = _add(sign, pt, ptlim);
-                               diff /= SECSPERMIN;
-                               diff = (diff / MINSPERHOUR) * 100 +
-                                       (diff % MINSPERHOUR);
-                               pt = _conv(diff,
-                                       fmt_padding[PAD_FMT_YEAR][PadIndex], pt, ptlim, loc);
-                               }
-                               continue;
-                       case '+':
-                               pt = _fmt(tptr->date_fmt, t, pt, ptlim,
-                                       warnp, tptr, loc);
-                               continue;
-                       case '-':
-                               if (PadIndex != PAD_DEFAULT)
-                                       break;
-                               PadIndex = PAD_LESS;
-                               goto label;
-                       case '_':
-                               if (PadIndex != PAD_DEFAULT)
-                                       break;
-                               PadIndex = PAD_SPACE;
-                               goto label;
-                       case '0':
-                               if (PadIndex != PAD_DEFAULT)
-                                       break;
-                               PadIndex = PAD_ZERO;
-                               goto label;
-                       case '%':
-                       /*
-                       ** X311J/88-090 (4.12.3.5): if conversion char is
-                       ** undefined, behavior is undefined. Print out the
-                       ** character itself as printf(3) also does.
-                       */
-                       default:
-                               break;
-                       }
-               }
-               if (pt == ptlim)
-                       break;
-               *pt++ = *format;
-       }
-       return pt;
-}
-
-static char *
-_conv(n, format, pt, ptlim, loc)
-const int              n;
-const char * const     format;
-char * const           pt;
-const char * const     ptlim;
-locale_t               loc;
-{
-       char    buf[INT_STRLEN_MAXIMUM(int) + 1];
-
-       (void) sprintf_l(buf, loc, format, n);
-       return _add(buf, pt, ptlim);
-}
-
-static char *
-_add(str, pt, ptlim)
-const char *           str;
-char *                 pt;
-const char * const     ptlim;
-{
-       while (pt < ptlim && (*pt = *str++) != '\0')
-               ++pt;
-       return pt;
-}
-
-/*
-** POSIX and the C Standard are unclear or inconsistent about
-** what %C and %y do if the year is negative or exceeds 9999.
-** Use the convention that %C concatenated with %y yields the
-** same output as %Y, and that %Y contains at least 4 bytes,
-** with more only if necessary.
-*/
-
-static char *
-_yconv(a, b, convert_top, convert_yy, pt, ptlim, loc)
-const int              a;
-const int              b;
-const int              convert_top;
-const int              convert_yy;
-char *                 pt;
-const char * const     ptlim;
-locale_t               loc;
-{
-       register int    lead;
-       register int    trail;
-
-#define DIVISOR        100
-       trail = a % DIVISOR + b % DIVISOR;
-       lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR;
-       trail %= DIVISOR;
-       if (trail < 0 && lead > 0) {
-               trail += DIVISOR;
-               --lead;
-       } else if (lead < 0 && trail > 0) {
-               trail -= DIVISOR;
-               ++lead;
-       }
-       if (convert_top) {
-               if (lead == 0 && trail < 0)
-                       pt = _add("-0", pt, ptlim);
-               else    pt = _conv(lead, "%02d", pt, ptlim, loc);
-       }
-       if (convert_yy)
-               pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim, loc);
-       return pt;
-}
-#endif /* !BUILDING_VARIANT */
diff --git a/stdtime/strftime.3 b/stdtime/strftime.3
deleted file mode 100644 (file)
index 5454a07..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strftime.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdtime/strftime.3,v 1.40 2008/05/16 04:33:04 grog Exp $
-.\"
-.Dd November 4, 2004
-.Dt STRFTIME 3
-.Os
-.Sh NAME
-.Nm strftime ,
-.Nm strftime_l
-.Nd format date and time
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In time.h
-.Ft size_t
-.Fo strftime
-.Fa "char *restrict s"
-.Fa "size_t maxsize"
-.Fa "const char *restrict format"
-.Fa "const struct tm *restrict timeptr"
-.Fc
-.In time.h
-.In xlocale.h
-.Ft size_t
-.Fo strftime_l
-.Fa "char *restrict s"
-.Fa "size_t maxsize"
-.Fa "const char *restrict format"
-.Fa "const struct tm *restrict timeptr"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strftime
-function formats the information from
-.Fa timeptr
-into the buffer
-.Fa s ,
-according to the string pointed to by
-.Fa format .
-.Pp
-The
-.Fa format
-string consists of zero or more conversion specifications and
-ordinary characters.
-All ordinary characters are copied directly into the buffer.
-A conversion specification consists of a percent sign
-.Dq Ql %
-and one other character.
-.Pp
-No more than
-.Fa maxsize
-characters will be placed into the array.
-If the total number of resulting characters, including the terminating
-NUL character, is not more than
-.Fa maxsize ,
-.Fn strftime
-returns the number of characters in the array, not counting the
-terminating NUL.
-Otherwise, zero is returned and the buffer contents are indeterminate.
-.Pp
-Although the
-.Fn strftime
-function uses the current locale, the
-.Fn strftime_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Pp
-The conversion specifications are copied to the buffer after expansion
-as follows:-
-.Bl -tag -width "xxxx"
-.It Cm \&%A
-is replaced by national representation of the full weekday name.
-.It Cm %a
-is replaced by national representation of
-the abbreviated weekday name.
-.It Cm \&%B
-is replaced by national representation of the full month name.
-.It Cm %b
-is replaced by national representation of
-the abbreviated month name.
-.It Cm \&%C
-is replaced by (year / 100) as decimal number; single
-digits are preceded by a zero.
-.It Cm %c
-is replaced by national representation of time and date.
-.It Cm \&%D
-is equivalent to
-.Dq Li %m/%d/%y .
-.It Cm %d
-is replaced by the day of the month as a decimal number (01-31).
-.It Cm %E* %O*
-POSIX locale extensions.
-The sequences
-%Ec %EC %Ex %EX %Ey %EY
-%Od %Oe %OH %OI %Om %OM
-%OS %Ou %OU %OV %Ow %OW %Oy
-are supposed to provide alternate
-representations.
-.Pp
-Additionally %OB implemented
-to represent alternative months names
-(used standalone, without day mentioned).
-.It Cm %e
-is replaced by the day of the month as a decimal number (1-31); single
-digits are preceded by a blank.
-.It Cm \&%F
-is equivalent to
-.Dq Li %Y-%m-%d .
-.It Cm \&%G
-is replaced by a year as a decimal number with century.
-This year is the one that contains the greater part of
-the week (Monday as the first day of the week).
-.It Cm %g
-is replaced by the same year as in
-.Dq Li %G ,
-but as a decimal number without century (00-99).
-.It Cm \&%H
-is replaced by the hour (24-hour clock) as a decimal number (00-23).
-.It Cm %h
-the same as
-.Cm %b .
-.It Cm \&%I
-is replaced by the hour (12-hour clock) as a decimal number (01-12).
-.It Cm %j
-is replaced by the day of the year as a decimal number (001-366).
-.It Cm %k
-is replaced by the hour (24-hour clock) as a decimal number (0-23);
-single digits are preceded by a blank.
-.It Cm %l
-is replaced by the hour (12-hour clock) as a decimal number (1-12);
-single digits are preceded by a blank.
-.It Cm \&%M
-is replaced by the minute as a decimal number (00-59).
-.It Cm %m
-is replaced by the month as a decimal number (01-12).
-.It Cm %n
-is replaced by a newline.
-.It Cm %O*
-the same as
-.Cm %E* .
-.It Cm %p
-is replaced by national representation of either
-"ante meridiem" (a.m.)
-or
-"post meridiem" (p.m.)
-as appropriate.
-.It Cm \&%R
-is equivalent to
-.Dq Li %H:%M .
-.It Cm %r
-is equivalent to
-.Dq Li %I:%M:%S %p .
-.It Cm \&%S
-is replaced by the second as a decimal number (00-60).
-.It Cm %s
-is replaced by the number of seconds since the Epoch, UTC (see
-.Xr mktime 3 ) .
-.It Cm \&%T
-is equivalent to
-.Dq Li %H:%M:%S .
-.It Cm %t
-is replaced by a tab.
-.It Cm \&%U
-is replaced by the week number of the year (Sunday as the first day of
-the week) as a decimal number (00-53).
-.It Cm %u
-is replaced by the weekday (Monday as the first day of the week)
-as a decimal number (1-7).
-.It Cm \&%V
-is replaced by the week number of the year (Monday as the first day of
-the week) as a decimal number (01-53).
-If the week containing January
-1 has four or more days in the new year, then it is week 1; otherwise
-it is the last week of the previous year, and the next week is week 1.
-.It Cm %v
-is equivalent to
-.Dq Li %e-%b-%Y .
-.It Cm \&%W
-is replaced by the week number of the year (Monday as the first day of
-the week) as a decimal number (00-53).
-.It Cm %w
-is replaced by the weekday (Sunday as the first day of the week)
-as a decimal number (0-6).
-.It Cm \&%X
-is replaced by national representation of the time.
-.It Cm %x
-is replaced by national representation of the date.
-.It Cm \&%Y
-is replaced by the year with century as a decimal number.
-.It Cm %y
-is replaced by the year without century as a decimal number (00-99).
-.It Cm \&%Z
-is replaced by the time zone name.
-.It Cm %z
-is replaced by the time zone offset from UTC; a leading plus sign stands for
-east of UTC, a minus sign for west of UTC, hours and minutes follow
-with two digits each and no delimiter between them (common form for
-RFC 822 date headers).
-.It Cm %+
-is replaced by national representation of the date and time
-(the format is similar to that produced by
-.Xr date 1 ) .
-.It Cm %-*
-GNU libc extension.
-Do not do any padding when performing numerical outputs.
-.It Cm %_*
-GNU libc extension.
-Explicitly specify space for padding.
-.It Cm %0*
-GNU libc extension.
-Explicitly specify zero for padding.
-.It Cm %%
-is replaced by
-.Ql % .
-.El
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr printf 1 ,
-.Xr ctime 3 ,
-.Xr printf 3 ,
-.Xr strptime 3 ,
-.Xr wcsftime 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn strftime
-function
-conforms to
-.St -isoC
-with a lot of extensions including
-.Ql %C ,
-.Ql \&%D ,
-.Ql %E* ,
-.Ql %e ,
-.Ql %G ,
-.Ql %g ,
-.Ql %h ,
-.Ql %k ,
-.Ql %l ,
-.Ql %n ,
-.Ql %O* ,
-.Ql \&%R ,
-.Ql %r ,
-.Ql %s ,
-.Ql \&%T ,
-.Ql %t ,
-.Ql %u ,
-.Ql \&%V ,
-.Ql %z ,
-and
-.Ql %+ .
-.Pp
-The peculiar week number and year in the replacements of
-.Ql %G ,
-.Ql %g ,
-and
-.Ql \&%V
-are defined in ISO 8601: 1988.
-.Sh BUGS
-There is no conversion specification for the phase of the moon.
-.Pp
-The
-.Fn strftime
-function does not correctly handle multibyte characters in the
-.Fa format
-argument.
diff --git a/stdtime/strptime-fbsd.c b/stdtime/strptime-fbsd.c
deleted file mode 100644 (file)
index 963410b..0000000
+++ /dev/null
@@ -1,702 +0,0 @@
-/*
- * Powerdog Industries kindly requests feedback from anyone modifying
- * this function:
- *
- * Date: Thu, 05 Jun 1997 23:17:17 -0400  
- * From: Kevin Ruddy <kevin.ruddy@powerdog.com>
- * To: James FitzGibbon <james@nexis.net>
- * Subject: Re: Use of your strptime(3) code (fwd)
- * 
- * The reason for the "no mod" clause was so that modifications would
- * come back and we could integrate them and reissue so that a wider 
- * audience could use it (thereby spreading the wealth).  This has   
- * made it possible to get strptime to work on many operating systems.
- * I'm not sure why that's "plain unacceptable" to the FreeBSD team.
- * 
- * Anyway, you can change it to "with or without modification" as
- * you see fit.  Enjoy.                                          
- * 
- * Kevin Ruddy
- * Powerdog Industries, Inc.
- */
-/*
- * Copyright (c) 1994 Powerdog Industries.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer
- *    in the documentation and/or other materials provided with the
- *    distribution.
- * 3. All advertising materials mentioning features or use of this
- *    software must display the following acknowledgement:
- *      This product includes software developed by Powerdog Industries.
- * 4. The name of Powerdog Industries may not be used to endorse or
- *    promote products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY POWERDOG INDUSTRIES ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE POWERDOG INDUSTRIES BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-#ifndef NOID
-static char copyright[] __unused =
-"@(#) Copyright (c) 1994 Powerdog Industries.  All rights reserved.";
-static char sccsid[] __unused = "@(#)strptime.c        0.1 (Powerdog) 94/03/27";
-#endif /* !defined NOID */
-#endif /* not lint */
-__FBSDID("$FreeBSD: src/lib/libc/stdtime/strptime.c,v 1.37 2009/09/02 04:56:30 ache Exp $");
-
-#include "xlocale_private.h"
-
-#include "namespace.h"
-#include <time.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-#include <stdint.h>
-#include <limits.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "timelocal.h"
-
-time_t _mktime(struct tm *, const char *);
-
-#define asizeof(a)     (sizeof (a) / sizeof ((a)[0]))
-
-enum {CONVERT_NONE, CONVERT_GMT, CONVERT_ZONE};
-
-#define _strptime(b,f,t,c,l)   _strptime0(b,f,t,c,l,-1,0,-1)
-
-static char *
-_strptime0(const char *buf, const char *fmt, struct tm *tm, int *convp, locale_t loc, int year, int yday, int wday)
-{
-       char    c;
-       const char *ptr;
-       int     i,
-               len;
-       int Ealternative, Oalternative;
-       struct lc_time_T *tptr = __get_current_time_locale(loc);
-
-       ptr = fmt;
-       while (*ptr != 0) {
-               if (*buf == 0) {
-                       fmt = ptr;
-                       while (isspace_l((unsigned char)*ptr, loc)) {
-                               ptr++;
-                       }
-                       return ((*ptr)==0) ? (char *)fmt : 0; /* trailing whitespace is ok */
-               }
-
-               c = *ptr++;
-
-               if (c != '%') {
-                       if (isspace_l((unsigned char)c, loc))
-                               while (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                                       buf++;
-                       else if (c != *buf++)
-                               return 0;
-                       continue;
-               }
-
-               Ealternative = 0;
-               Oalternative = 0;
-label:
-               c = *ptr++;
-               switch (c) {
-               case 0:
-               case '%':
-                       if (*buf++ != '%')
-                               return 0;
-                       break;
-
-               case '+':
-                       buf = _strptime(buf, tptr->date_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'C':
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       /* XXX This will break for 3-digit centuries. */
-                       len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-                       if (i < 19)
-                               return 0;
-
-                       if (year != -1)
-                               tm->tm_year = (year % 100) + i * 100 - 1900;
-                       else
-                       tm->tm_year = i * 100 - 1900;
-                       year = tm->tm_year;
-                       break;
-
-               case 'c':
-                       buf = _strptime(buf, tptr->c_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'D':
-                       buf = _strptime(buf, "%m/%d/%y", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'E':
-                       if (Ealternative || Oalternative)
-                               break;
-                       Ealternative++;
-                       goto label;
-
-               case 'O':
-                       if (Ealternative || Oalternative)
-                               break;
-                       Oalternative++;
-                       goto label;
-
-               case 'F':
-                       buf = _strptime(buf, "%Y-%m-%d", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'R':
-                       buf = _strptime(buf, "%H:%M", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'r':
-                       buf = _strptime(buf, tptr->ampm_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'n':
-               case 't':
-                       if (!isspace((unsigned char)*buf))
-                               return 0;
-                       while (isspace((unsigned char)*buf))
-                               buf++;
-                       break;
-
-               case 'T':
-                       buf = _strptime(buf, "%H:%M:%S", tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'X':
-                       buf = _strptime(buf, tptr->X_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'x':
-                       buf = _strptime(buf, tptr->x_fmt, tm, convp, loc);
-                       if (buf == 0)
-                               return 0;
-                       break;
-
-               case 'j':
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       len = 3;
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-                       if (i < 1 || i > 366)
-                               return 0;
-
-                       tm->tm_yday = yday = i - 1;
-                       break;
-
-               case 'M':
-               case 'S':
-                       if (*buf == 0 || isspace_l((unsigned char)*buf, loc))
-                               break;
-
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-
-                       if (c == 'M') {
-                               if (i > 59)
-                                       return 0;
-                               tm->tm_min = i;
-                       } else {
-                               if (i > 60)
-                                       return 0;
-                               tm->tm_sec = i;
-                       }
-
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 'H':
-               case 'I':
-               case 'k':
-               case 'l':
-                       /*
-                        * Of these, %l is the only specifier explicitly
-                        * documented as not being zero-padded.  However,
-                        * there is no harm in allowing zero-padding.
-                        *
-                        * XXX The %l specifier may gobble one too many
-                        * digits if used incorrectly.
-                        */
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-                       if (c == 'H' || c == 'k') {
-                               if (i > 23)
-                                       return 0;
-                       } else if (i > 12)
-                               return 0;
-
-                       tm->tm_hour = i;
-
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 'p':
-                       /*
-                        * XXX This is bogus if parsed before hour-related
-                        * specifiers.
-                        */
-                       len = strlen(tptr->am);
-                       if (strncasecmp_l(buf, tptr->am, len, loc) == 0) {
-                               if (tm->tm_hour > 12)
-                                       return 0;
-                               if (tm->tm_hour == 12)
-                                       tm->tm_hour = 0;
-                               buf += len;
-                               break;
-                       }
-
-                       len = strlen(tptr->pm);
-                       if (strncasecmp_l(buf, tptr->pm, len, loc) == 0) {
-                               if (tm->tm_hour > 12)
-                                       return 0;
-                               if (tm->tm_hour != 12)
-                                       tm->tm_hour += 12;
-                               buf += len;
-                               break;
-                       }
-
-                       return 0;
-
-               case 'A':
-               case 'a':
-                       for (i = 0; i < asizeof(tptr->weekday); i++) {
-                               len = strlen(tptr->weekday[i]);
-                               if (strncasecmp_l(buf, tptr->weekday[i],
-                                               len, loc) == 0)
-                                       break;
-                               len = strlen(tptr->wday[i]);
-                               if (strncasecmp_l(buf, tptr->wday[i],
-                                               len, loc) == 0)
-                                       break;
-                       }
-                       if (i == asizeof(tptr->weekday))
-                               return 0;
-
-                       tm->tm_wday = wday = i;
-                       buf += len;
-                       break;
-
-               case 'U':       /* Sunday week */
-               case 'W':       /* Monday week */
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-                       if (i > 53)
-                               return 0;
-
-                       /* Calculate yday if we have enough data */
-                       if ((year != -1) && (wday != -1)) {
-                               struct tm mktm;
-                               mktm.tm_year = year;
-                               mktm.tm_mon = 0;
-                               mktm.tm_mday = 1;
-                               mktm.tm_sec = 1;
-                               mktm.tm_min = mktm.tm_hour = 0;
-                               mktm.tm_isdst = 0;
-                               mktm.tm_gmtoff = 0;
-                               if (mktime(&mktm) != -1) {
-                                       /* yday0 == Jan 1 == mktm.tm_wday */
-                                       int delta = wday - mktm.tm_wday;
-                                       if (!wday && c =='W')
-                                               i++; /* Sunday is part of the following week */
-                                       yday = 7 * i + delta;
-                                       if (yday < 0)
-                                               yday += 7;
-                                       tm->tm_yday = yday;
-                               }
-                       }
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 'u':       /* [1,7] */
-               case 'w':       /* [0,6] */
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       i = *buf - '0';
-                       if (i > 6 + (c == 'u'))
-                               return 0;
-                       if (i == 7)
-                               i = 0;
-                       tm->tm_wday = wday = i;
-                       buf++;
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 'd':
-               case 'e':
-                       /*
-                        * The %e specifier is explicitly documented as not
-                        * being zero-padded but there is no harm in allowing
-                        * such padding.
-                        *
-                        * XXX The %e specifier may gobble one too many
-                        * digits if used incorrectly.
-                        */
-                       /* Leading space is ok if date is single digit */
-                       len = 2;
-                       if (isspace_l((unsigned char)buf[0], loc) &&
-                           isdigit_l((unsigned char)buf[1], loc) &&
-                           !isdigit_l((unsigned char)buf[2], loc)) {
-                               len = 1;
-                               buf++;
-                       }
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-                       if (i > 31)
-                               return 0;
-
-                       tm->tm_mday = i;
-
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 'B':
-               case 'b':
-               case 'h':
-                       for (i = 0; i < asizeof(tptr->month); i++) {
-                               if (Oalternative) {
-                                       if (c == 'B') {
-                                               len = strlen(tptr->alt_month[i]);
-                                               if (strncasecmp_l(buf,
-                                                               tptr->alt_month[i],
-                                                               len, loc) == 0)
-                                                       break;
-                                       }
-                               } else {
-                                       len = strlen(tptr->month[i]);
-                                       if (strncasecmp_l(buf, tptr->month[i],
-                                                       len, loc) == 0)
-                                               break;
-                                       len = strlen(tptr->mon[i]);
-                                       if (strncasecmp_l(buf, tptr->mon[i],
-                                                       len, loc) == 0)
-                                               break;
-                               }
-                       }
-                       if (i == asizeof(tptr->month))
-                               return 0;
-
-                       tm->tm_mon = i;
-                       buf += len;
-                       break;
-
-               case 'm':
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-                       len = 2;
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-                       if (i < 1 || i > 12)
-                               return 0;
-
-                       tm->tm_mon = i - 1;
-
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 's':
-                       {
-                       char *cp;
-                       int sverrno;
-                       long n;
-                       time_t t;
-
-                       sverrno = errno;
-                       errno = 0;
-                       n = strtol_l(buf, &cp, 10, loc);
-                       if (errno == ERANGE || (long)(t = n) != n) {
-                               errno = sverrno;
-                               return 0;
-                       }
-                       errno = sverrno;
-                       buf = cp;
-                       gmtime_r(&t, tm);
-                       *convp = CONVERT_GMT;
-                       }
-                       break;
-
-               case 'Y':
-               case 'y':
-                       if (*buf == 0 || isspace_l((unsigned char)*buf, loc))
-                               break;
-
-                       if (!isdigit_l((unsigned char)*buf, loc))
-                               return 0;
-
-#if __DARWIN_UNIX03
-                       if (c == 'Y') {
-                               int savei = 0;
-                               const char *savebuf = buf;
-                               int64_t i64 = 0;
-                               int overflow = 0;
-
-                               for (len = 0; *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                                       i64 *= 10;
-                                       i64 += *buf - '0';
-                                       if (++len <= 4) {
-                                               savei = i64;
-                                               savebuf = buf + 1;
-                                       }
-                                       if (i64 > INT_MAX) {
-                                               overflow++;
-                                               break;
-                                       }
-                               }
-                               /*
-                                * Conformance requires %Y to be more then 4
-                                * digits.  However, there are several cases
-                                * where %Y is immediately followed by other
-                                * digits values.  So we do the conformance
-                                * case first (as many digits as possible),
-                                * and if we fail, we backup and try just 4
-                                * digits for %Y.
-                                */
-                               if (len > 4 && !overflow) {
-                                       struct tm savetm = *tm;
-                                       int saveconv = *convp;
-                                       const char *saveptr = ptr;
-                                       char *ret;
-
-                                       if (i64 < 1900)
-                                               return 0;
-
-                                       tm->tm_year = i64 - 1900;
-
-                                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                                       ptr++;
-                                       ret = _strptime0(buf, ptr, tm, convp, loc, tm->tm_year, yday, wday);
-                                       if (ret) return ret;
-                                       /* Failed, so try 4-digit year */
-                                       *tm = savetm;
-                                       *convp = saveconv;
-                                       ptr = saveptr;
-                               }
-                               buf = savebuf;
-                               i = savei;
-                       } else {
-                               len = 2;
-#else /* !__DARWIN_UNIX03 */
-                       len = (c == 'Y') ? 4 : 2;
-#endif /* __DARWIN_UNIX03 */
-                       for (i = 0; len && *buf != 0 && isdigit_l((unsigned char)*buf, loc); buf++) {
-                               i *= 10;
-                               i += *buf - '0';
-                               len--;
-                       }
-#if __DARWIN_UNIX03
-                       }
-#endif /* __DARWIN_UNIX03 */
-                       if (c == 'Y')
-                               i -= 1900;
-                       if (c == 'y' && i < 69)
-                               i += 100;
-                       if (i < 0)
-                               return 0;
-
-                       tm->tm_year = year = i;
-
-                       if (*buf != 0 && isspace_l((unsigned char)*buf, loc))
-                               while (*ptr != 0 && !isspace_l((unsigned char)*ptr, loc) && *ptr != '%')
-                                       ptr++;
-                       break;
-
-               case 'Z':
-                       {
-                       const char *cp;
-                       size_t tzlen, len;
-
-                       for (cp = buf; *cp && isupper((unsigned char)*cp); ++cp) {/*empty*/}
-                       len = cp - buf;
-                       if (len == 3 && strncmp(buf, "GMT", 3) == 0) {
-                               *convp = CONVERT_GMT;
-                               buf += len;
-                               break;
-                       }
-                       tzset();
-                       tzlen = strlen(tzname[0]);
-                       if (len == tzlen && strncmp(buf, tzname[0], tzlen) == 0) {
-                               tm->tm_isdst = 0;
-                               buf += len;
-                               break;
-                       }
-                       tzlen = strlen(tzname[1]);
-                       if (len == tzlen && strncmp(buf, tzname[1], tzlen) == 0) {
-                               tm->tm_isdst = 1;
-                               buf += len;
-                               break;
-                       }
-                       return 0;
-                       }
-
-               case 'z':
-                       {
-                       int sign = 1;
-
-                       if (*buf != '+') {
-                               if (*buf == '-')
-                                       sign = -1;
-                               else
-                                       return 0;
-                       }
-
-                       buf++;
-                       i = 0;
-                       for (len = 4; len > 0; len--) {
-                               if (isdigit_l((unsigned char)*buf, loc)) {
-                                       i *= 10;
-                                       i += *buf - '0';
-                                       buf++;
-                               } else
-                                       return 0;
-                       }
-
-                       tm->tm_hour -= sign * (i / 100);
-                       tm->tm_min  -= sign * (i % 100);
-                       *convp = CONVERT_GMT;
-                       }
-                       break;
-               }
-       }
-       return (char *)buf;
-}
-
-
-char *
-strptime(const char * __restrict buf, const char * __restrict fmt,
-    struct tm * __restrict tm)
-{
-       return strptime_l(buf, fmt, tm, __current_locale());
-}
-
-extern time_t timeoff(struct tm *, long);
-
-char *
-strptime_l(const char * __restrict buf, const char * __restrict fmt,
-    struct tm * __restrict tm, locale_t loc)
-{
-       char *ret;
-       int conv;
-
-       NORMALIZE_LOCALE(loc);
-       conv = CONVERT_NONE;
-       tm->tm_zone = NULL;
-       ret = _strptime(buf, fmt, tm, &conv, loc);
-       if (ret) {
-               time_t t;
-
-               switch(conv) {
-               case CONVERT_GMT:
-                       t = timegm(tm);
-                       localtime_r(&t, tm);
-                       break;
-               case CONVERT_ZONE:
-                   {
-                       long offset = tm->tm_gmtoff;
-                       tm->tm_gmtoff = 0;
-                       t = timeoff(tm, offset);
-                       localtime_r(&t, tm);
-                       break;
-                   }
-               }
-       }
-
-       return (ret);
-}
diff --git a/stdtime/strptime.3 b/stdtime/strptime.3
deleted file mode 100644 (file)
index a9c25f9..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-.\"
-.\" Copyright (c) 1997 Joerg Wunsch
-.\"
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/stdtime/strptime.3,v 1.24 2005/01/20 09:17:04 ru Exp $
-.\" "
-.Dd January 4, 2003
-.Dt STRPTIME 3
-.Os
-.Sh NAME
-.Nm strptime ,
-.Nm strptime_l
-.Nd parse date and time string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In time.h
-.Ft char *
-.Fo strptime
-.Fa "const char *restrict buf"
-.Fa "const char *restrict format"
-.Fa "struct tm *restrict tm"
-.Fc
-.In time.h
-.In xlocale.h
-.Ft char *
-.Fo strptime_l
-.Fa "const char *restrict buf"
-.Fa "const char *restrict format"
-.Fa "struct tm *restrict tm"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strptime
-function parses the string in the buffer
-.Fa buf ,
-according to the string pointed to by
-.Fa format ,
-and fills in the elements of the structure pointed to by
-.Fa tm .
-The resulting values will be relative to the local time zone.
-Thus, it can be considered the reverse operation of
-.Xr strftime 3 .
-.Pp
-The
-.Fa format
-string consists of zero or more conversion specifications and
-ordinary characters.
-All ordinary characters are matched exactly with the buffer, where
-white space in the format string will match any amount of white space
-in the buffer.
-All conversion specifications are identical to those described in
-.Xr strftime 3 .
-.Pp
-Two-digit year values, including formats
-.Fa %y
-and
-.Fa \&%D ,
-are now interpreted as beginning at 1969 per POSIX requirements.
-Years 69-00 are interpreted in the 20th century (1969-2000), years
-01-68 in the 21st century (2001-2068).
-.Pp
-If the
-.Fa format
-string does not contain enough conversion specifications to completely
-specify the resulting
-.Vt struct tm ,
-the unspecified members of
-.Va tm
-are left untouched.
-For example, if
-.Fa format
-is
-.Dq Li "%H:%M:%S" ,
-only
-.Va tm_hour ,
-.Va tm_sec
-and
-.Va tm_min
-will be modified.
-If time relative to today is desired, initialize the
-.Fa tm
-structure with today's date before passing it to
-.Fn strptime .
-.Pp
-While the
-.Fn strptime
-function uses the current locale, the
-.Fn strptime_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn strptime
-returns the pointer to the first character in
-.Fa buf
-that has not been required to satisfy the specified conversions in
-.Fa format .
-It returns
-.Dv NULL
-if one of the conversions failed.
-.Sh LEGACY DESCRIPTION
-In legacy mode, the
-.Fa %Y
-format specifier expects exactly 4 digits (leaving any trailing digits for the
-next specifier).
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr scanf 3 ,
-.Xr strftime 3 ,
-.Xr xlocale 3
-.Sh HISTORY
-The
-.Fn strptime
-function appeared in
-.Fx 3.0 .
-.Sh AUTHORS
-The
-.Fn strptime
-function has been contributed by Powerdog Industries.
-.Pp
-This man page was written by
-.An J\(:org Wunsch .
-.Sh BUGS
-Both the
-.Fa %e
-and
-.Fa %l
-format specifiers may incorrectly scan one too many digits
-if the intended values comprise only a single digit
-and that digit is followed immediately by another digit.
-Both specifiers accept zero-padded values,
-even though they are both defined as taking unpadded values.
-.Pp
-The
-.Fa %p
-format specifier has no effect unless it is parsed
-.Em after
-hour-related specifiers.
-Specifying
-.Fa %l
-without
-.Fa %p
-will produce undefined results.
-Note that 12AM
-(ante meridiem)
-is taken as midnight
-and 12PM
-(post meridiem)
-is taken as noon.
-.Pp
-The
-.Fa %U
-and
-.Fa %W
-format specifiers accept any value within the range 00 to 53
-without validating against other values supplied (like month
-or day of the year, for example).
-.Pp
-The
-.Fa %Z
-format specifier only accepts time zone abbreviations of the local time zone,
-or the value "GMT".
-This limitation is because of ambiguity due to of the over loading of time
-zone abbreviations.
-One such example is
-.Fa EST
-which is both Eastern Standard Time and Eastern Australia Summer Time.
-.Pp
-The
-.Fn strptime
-function does not correctly handle multibyte characters in the
-.Fa format
-argument.
diff --git a/stdtime/time2posix.3 b/stdtime/time2posix.3
deleted file mode 120000 (symlink)
index 88a474d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./time2posix.3
\ No newline at end of file
diff --git a/stdtime/time32-fbsd.c b/stdtime/time32-fbsd.c
deleted file mode 120000 (symlink)
index 80a48d1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./time32.c
\ No newline at end of file
diff --git a/stdtime/timelocal-fbsd.c b/stdtime/timelocal-fbsd.c
deleted file mode 100644 (file)
index e3673be..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*-
- * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
- * Copyright (c) 1997 FreeBSD Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.25 2003/06/13 00:14:07 jkh Exp $");
-
-#include "xlocale_private.h"
-
-#include <stddef.h>
-#include <string.h>
-
-#include "ldpart.h"
-#include "timelocal.h"
-
-#define LCTIME_SIZE (sizeof(struct lc_time_T) / sizeof(char *))
-
-static const struct lc_time_T  _C_time_locale = {
-       {
-               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-       }, {
-               "January", "February", "March", "April", "May", "June",
-               "July", "August", "September", "October", "November", "December"
-       }, {
-               "Sun", "Mon", "Tue", "Wed",
-               "Thu", "Fri", "Sat"
-       }, {
-               "Sunday", "Monday", "Tuesday", "Wednesday",
-               "Thursday", "Friday", "Saturday"
-       },
-
-       /* X_fmt */
-       "%H:%M:%S",
-
-       /*
-        * x_fmt
-        * Since the C language standard calls for
-        * "date, using locale's date format," anything goes.
-        * Using just numbers (as here) makes Quakers happier;
-        * it's also compatible with SVR4.
-        */
-       "%m/%d/%y",
-
-       /*
-        * c_fmt
-        */
-       "%a %b %e %H:%M:%S %Y",
-
-       /* am */
-       "AM",
-
-       /* pm */
-       "PM",
-
-       /* date_fmt */
-       "%a %b %e %H:%M:%S %Z %Y",
-       
-       /* alt_month
-        * Standalone months forms for %OB
-        */
-       {
-               "January", "February", "March", "April", "May", "June",
-               "July", "August", "September", "October", "November", "December"
-       },
-
-       /* md_order
-        * Month / day order in dates
-        */
-       "md",
-
-       /* ampm_fmt
-        * To determine 12-hour clock format time (empty, if N/A)
-        */
-       "%I:%M:%S %p"
-};
-
-__private_extern__ struct lc_time_T *
-__get_current_time_locale(locale_t loc)
-{
-       return (loc->_time_using_locale
-               ? &loc->__lc_time->_time_locale
-               : (struct lc_time_T *)&_C_time_locale);
-}
-
-__private_extern__ int
-__time_load_locale(const char *name, locale_t loc)
-{
-       int ret;
-       struct __xlocale_st_time *xp;
-       static struct __xlocale_st_time *cache = NULL;
-
-       /* 'name' must be already checked. */
-       if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
-               loc->_time_using_locale = 0;
-               XL_RELEASE(loc->__lc_time);
-               loc->__lc_time = NULL;
-               return (_LDP_CACHE);
-       }
-
-       /*
-        * If the locale name is the same as our cache, use the cache.
-        */
-       if (cache && cache->_time_locale_buf && strcmp(name, cache->_time_locale_buf) == 0) {
-               loc->_time_using_locale = 1;
-               XL_RELEASE(loc->__lc_time);
-               loc->__lc_time = cache;
-               XL_RETAIN(loc->__lc_time);
-               return (_LDP_CACHE);
-       }
-       if ((xp = (struct __xlocale_st_time *)malloc(sizeof(*xp))) == NULL)
-               return _LDP_ERROR;
-       xp->__refcount = 1;
-       xp->__free_extra = (__free_extra_t)__ldpart_free_extra;
-       xp->_time_locale_buf = NULL;
-
-       ret = __part_load_locale(name, &loc->_time_using_locale,
-                       &xp->_time_locale_buf, "LC_TIME",
-                       LCTIME_SIZE, LCTIME_SIZE,
-                       (const char **)&xp->_time_locale);
-       if (ret == _LDP_LOADED) {
-               XL_RELEASE(loc->__lc_time);
-               loc->__lc_time = xp;
-               XL_RELEASE(cache);
-               cache = xp;
-               XL_RETAIN(cache);
-       } else if (ret == _LDP_ERROR)
-               free(xp);
-
-       return (ret);
-}
diff --git a/stdtime/timelocal.h b/stdtime/timelocal.h
deleted file mode 100644 (file)
index 02806e8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 1997-2002 FreeBSD Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libc/stdtime/timelocal.h,v 1.11 2002/01/24 15:07:44 phantom Exp $
- */
-
-#ifndef _TIMELOCAL_H_
-#define        _TIMELOCAL_H_
-
-#include <xlocale.h>
-
-/*
- * Private header file for the strftime and strptime localization
- * stuff.
- */
-struct lc_time_T {
-       const char      *mon[12];
-       const char      *month[12];
-       const char      *wday[7];
-       const char      *weekday[7];
-       const char      *X_fmt;
-       const char      *x_fmt;
-       const char      *c_fmt;
-       const char      *am;
-       const char      *pm;
-       const char      *date_fmt;
-       const char      *alt_month[12];
-       const char      *md_order;
-       const char      *ampm_fmt;
-};
-
-struct lc_time_T *__get_current_time_locale(locale_t);
-int    __time_load_locale(const char *, locale_t);
-
-#endif /* !_TIMELOCAL_H_ */
diff --git a/stdtime/tzfile.5 b/stdtime/tzfile.5
deleted file mode 100644 (file)
index 6dcbc27..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-.\" $FreeBSD: src/lib/libc/stdtime/tzfile.5,v 1.10 2001/07/10 13:41:23 ru Exp $
-.Dd September 13, 1994
-.Dt TZFILE 5
-.Os
-.Sh NAME
-.Nm tzfile
-.Nd timezone information
-.Sh SYNOPSIS
-.In tzfile.h
-.Sh DESCRIPTION
-The time zone information files used by
-.Xr tzset 3
-begin with the magic characters
-.Dq Li TZif
-to identify them as
-time zone information files,
-followed by sixteen bytes reserved for future use,
-followed by four four-byte values
-written in a ``standard'' byte order
-(the high-order byte of the value is written first).
-These values are,
-in order:
-.Pp
-.Bl -tag -compact -width tzh_ttisstdcnt
-.It Va tzh_ttisgmtcnt
-The number of UTC/local indicators stored in the file.
-.It Va tzh_ttisstdcnt
-The number of standard/wall indicators stored in the file.
-.It Va tzh_leapcnt
-The number of leap seconds for which data is stored in the file.
-.It Va tzh_timecnt
-The number of ``transition times'' for which data is stored
-in the file.
-.It Va tzh_typecnt
-The number of ``local time types'' for which data is stored
-in the file (must not be zero).
-.It Va tzh_charcnt
-The number of characters of ``time zone abbreviation strings''
-stored in the file.
-.El
-.Pp
-The above header is followed by
-.Va tzh_timecnt
-four-byte values of type
-.Fa long ,
-sorted in ascending order.
-These values are written in ``standard'' byte order.
-Each is used as a transition time (as returned by
-.Xr time 3 )
-at which the rules for computing local time change.
-Next come
-.Va tzh_timecnt
-one-byte values of type
-.Fa "unsigned char" ;
-each one tells which of the different types of ``local time'' types
-described in the file is associated with the same-indexed transition time.
-These values serve as indices into an array of
-.Fa ttinfo
-structures that appears next in the file;
-these structures are defined as follows:
-.Pp
-.Bd -literal -offset indent
-struct ttinfo {
-       long    tt_gmtoff;
-       int     tt_isdst;
-       unsigned int    tt_abbrind;
-};
-.Ed
-.Pp
-Each structure is written as a four-byte value for
-.Va tt_gmtoff
-of type
-.Fa long ,
-in a standard byte order, followed by a one-byte value for
-.Va tt_isdst
-and a one-byte value for
-.Va tt_abbrind .
-In each structure,
-.Va tt_gmtoff
-gives the number of seconds to be added to UTC,
-.Li tt_isdst
-tells whether
-.Li tm_isdst
-should be set by
-.Xr localtime 3
-and
-.Va tt_abbrind
-serves as an index into the array of time zone abbreviation characters
-that follow the
-.Li ttinfo
-structure(s) in the file.
-.Pp
-Then there are
-.Va tzh_leapcnt
-pairs of four-byte values, written in standard byte order;
-the first value of each pair gives the time
-(as returned by
-.Xr time 3 )
-at which a leap second occurs;
-the second gives the
-.Em total
-number of leap seconds to be applied after the given time.
-The pairs of values are sorted in ascending order by time.
-.Pp
-Then there are
-.Va tzh_ttisstdcnt
-standard/wall indicators, each stored as a one-byte value;
-they tell whether the transition times associated with local time types
-were specified as standard time or wall clock time,
-and are used when a time zone file is used in handling POSIX-style
-time zone environment variables.
-.Pp
-Finally there are
-.Va tzh_ttisgmtcnt
-UTC/local indicators, each stored as a one-byte value;
-they tell whether the transition times associated with local time types
-were specified as UTC or local time,
-and are used when a time zone file is used in handling POSIX-style
-time zone environment variables.
-.Pp
-.Nm localtime
-uses the first standard-time
-.Li ttinfo
-structure in the file
-(or simply the first
-.Li ttinfo
-structure in the absence of a standard-time structure)
-if either
-.Li tzh_timecnt
-is zero or the time argument is less than the first transition time recorded
-in the file.
-.Sh SEE ALSO
-.Xr ctime 3 ,
-.Xr time2posix 3 ,
-.Xr zic 8
-.\" @(#)tzfile.5       7.2
-.\" This file is in the public domain, so clarified as of
-.\" 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
diff --git a/stdtime/tzfile.h b/stdtime/tzfile.h
deleted file mode 100644 (file)
index efa8416..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-#ifndef TZFILE_H
-#define TZFILE_H
-
-
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
-**
-** $FreeBSD: src/lib/libc/stdtime/tzfile.h,v 1.8 2002/03/22 23:42:05 obrien Exp $
-*/
-
-/*
-** This header is for use ONLY with the time conversion code.
-** There is no guarantee that it will remain unchanged,
-** or that it will remain at all.
-** Do NOT copy it to any system include directory.
-** Thank you!
-*/
-
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-/*
-static char    tzfilehid[] = "@(#)tzfile.h     7.14";
-*/
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
-** Information about time zone files.
-*/
-
-#ifndef TZDIR
-#define TZDIR  "/usr/share/zoneinfo" /* Time zone object file directory */
-#endif /* !defined TZDIR */
-
-#ifndef TZDEFAULT
-#ifdef UNIFDEF_MOVE_LOCALTIME
-#define TZDEFAULT      "/var/db/timezone/localtime"
-#else /* !UNIFDEF_MOVE_LOCALTIME */
-#define TZDEFAULT      "/etc/localtime"
-#endif /* UNIFDEF_MOVE_LOCALTIME */
-#endif /* !defined TZDEFAULT */
-
-#ifndef TZDEFRULES
-#define TZDEFRULES     "posixrules"
-#endif /* !defined TZDEFRULES */
-
-/*
-** Each file begins with. . .
-*/
-
-#define        TZ_MAGIC        "TZif"
-
-struct tzhead {
-       char    tzh_magic[4];           /* TZ_MAGIC */
-       char    tzh_reserved[16];       /* reserved for future use */
-       char    tzh_ttisgmtcnt[4];      /* coded number of trans. time flags */
-       char    tzh_ttisstdcnt[4];      /* coded number of trans. time flags */
-       char    tzh_leapcnt[4];         /* coded number of leap seconds */
-       char    tzh_timecnt[4];         /* coded number of transition times */
-       char    tzh_typecnt[4];         /* coded number of local time types */
-       char    tzh_charcnt[4];         /* coded number of abbr. chars */
-};
-
-/*
-** . . .followed by. . .
-**
-**     tzh_timecnt (char [4])s         coded transition times a la time(2)
-**     tzh_timecnt (unsigned char)s    types of local time starting at above
-**     tzh_typecnt repetitions of
-**             one (char [4])          coded UTC offset in seconds
-**             one (unsigned char)     used to set tm_isdst
-**             one (unsigned char)     that's an abbreviation list index
-**     tzh_charcnt (char)s             '\0'-terminated zone abbreviations
-**     tzh_leapcnt repetitions of
-**             one (char [4])          coded leap second transition times
-**             one (char [4])          total correction after above
-**     tzh_ttisstdcnt (char)s          indexed by type; if TRUE, transition
-**                                     time is standard time, if FALSE,
-**                                     transition time is wall clock time
-**                                     if absent, transition times are
-**                                     assumed to be wall clock time
-**     tzh_ttisgmtcnt (char)s          indexed by type; if TRUE, transition
-**                                     time is UTC, if FALSE,
-**                                     transition time is local time
-**                                     if absent, transition times are
-**                                     assumed to be local time
-*/
-
-/*
-** In the current implementation, "tzset()" refuses to deal with files that
-** exceed any of the limits below.
-*/
-
-#ifndef TZ_MAX_TIMES
-/*
-** The TZ_MAX_TIMES value below is enough to handle a bit more than a
-** year's worth of solar time (corrected daily to the nearest second) or
-** 138 years of Pacific Presidential Election time
-** (where there are three time zone transitions every fourth year).
-*/
-#define TZ_MAX_TIMES   370
-#endif /* !defined TZ_MAX_TIMES */
-
-#ifndef TZ_MAX_TYPES
-#ifndef NOSOLAR
-#define TZ_MAX_TYPES   256 /* Limited by what (unsigned char)'s can hold */
-#endif /* !defined NOSOLAR */
-#ifdef NOSOLAR
-/*
-** Must be at least 14 for Europe/Riga as of Jan 12 1995,
-** as noted by Earl Chew <earl@hpato.aus.hp.com>.
-*/
-#define TZ_MAX_TYPES   20      /* Maximum number of local time types */
-#endif /* !defined NOSOLAR */
-#endif /* !defined TZ_MAX_TYPES */
-
-#ifndef TZ_MAX_CHARS
-#define TZ_MAX_CHARS   50      /* Maximum number of abbreviation characters */
-                               /* (limited by what unsigned chars can hold) */
-#endif /* !defined TZ_MAX_CHARS */
-
-#ifndef TZ_MAX_LEAPS
-#define TZ_MAX_LEAPS   50      /* Maximum number of leap second corrections */
-#endif /* !defined TZ_MAX_LEAPS */
-
-#define SECSPERMIN     60
-#define MINSPERHOUR    60
-#define HOURSPERDAY    24
-#define DAYSPERWEEK    7
-#define DAYSPERNYEAR   365
-#define DAYSPERLYEAR   366
-#define SECSPERHOUR    (SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY     ((long) SECSPERHOUR * HOURSPERDAY)
-#define MONSPERYEAR    12
-
-#define TM_SUNDAY      0
-#define TM_MONDAY      1
-#define TM_TUESDAY     2
-#define TM_WEDNESDAY   3
-#define TM_THURSDAY    4
-#define TM_FRIDAY      5
-#define TM_SATURDAY    6
-
-#define TM_JANUARY     0
-#define TM_FEBRUARY    1
-#define TM_MARCH       2
-#define TM_APRIL       3
-#define TM_MAY         4
-#define TM_JUNE                5
-#define TM_JULY                6
-#define TM_AUGUST      7
-#define TM_SEPTEMBER   8
-#define TM_OCTOBER     9
-#define TM_NOVEMBER    10
-#define TM_DECEMBER    11
-
-#define TM_YEAR_BASE   1900
-
-#define EPOCH_YEAR     1970
-#define EPOCH_WDAY     TM_THURSDAY
-
-/*
-** Accurate only for the past couple of centuries;
-** that will probably do.
-*/
-
-#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-
-/*
-** Since everything in isleap is modulo 400 (or a factor of 400), we know that
-**     isleap(y) == isleap(y % 400)
-** and so
-**     isleap(a + b) == isleap((a + b) % 400)
-** or
-**     isleap(a + b) == isleap(a % 400 + b % 400)
-** This is true even if % means modulo rather than Fortran remainder
-** (which is allowed by C89 but not C99).
-** We use this to avoid addition overflow problems.
-*/
-
-#define isleap_sum(a, b)       isleap((a) % 400 + (b) % 400)
-
-#ifndef USG
-
-/*
-** Use of the underscored variants may cause problems if you move your code to
-** certain System-V-based systems; for maximum portability, use the
-** underscore-free variants.  The underscored variants are provided for
-** backward compatibility only; they may disappear from future versions of
-** this file.
-*/
-
-#define SECS_PER_MIN   SECSPERMIN
-#define MINS_PER_HOUR  MINSPERHOUR
-#define HOURS_PER_DAY  HOURSPERDAY
-#define DAYS_PER_WEEK  DAYSPERWEEK
-#define DAYS_PER_NYEAR DAYSPERNYEAR
-#define DAYS_PER_LYEAR DAYSPERLYEAR
-#define SECS_PER_HOUR  SECSPERHOUR
-#define SECS_PER_DAY   SECSPERDAY
-#define MONS_PER_YEAR  MONSPERYEAR
-
-#endif /* !defined USG */
-
-#endif /* !defined TZFILE_H */
index cf68665ad26ae8d20caf78e586ca5bfffb2deff7..67f456b08944001a0f2b559f65ddca49283a0d24 100644 (file)
 .Sh SYNOPSIS
 .In strings.h
 .Ft int
-.Fn bcmp "const void *b1" "const void *b2" "size_t len"
+.Fn bcmp "const void *s1" "const void *s2" "size_t n"
 .Sh DESCRIPTION
 The
 .Fn bcmp
 function
 compares byte string
-.Fa b1
+.Fa s1
 against byte string
-.Fa b2 ,
+.Fa s2 ,
 returning zero if they are identical, non-zero otherwise.
 Both strings are assumed to be
-.Fa len
+.Fa n
 bytes long.
 Zero-length strings are always identical.
 .Pp
diff --git a/string/FreeBSD/bcmp.3.patch b/string/FreeBSD/bcmp.3.patch
deleted file mode 100644 (file)
index ca7df14..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- bcmp.3.bsdnew      2009-11-18 18:24:31.000000000 -0800
-+++ bcmp.3     2009-11-18 18:24:31.000000000 -0800
-@@ -41,18 +41,18 @@
- .Sh SYNOPSIS
- .In strings.h
- .Ft int
--.Fn bcmp "const void *b1" "const void *b2" "size_t len"
-+.Fn bcmp "const void *s1" "const void *s2" "size_t n"
- .Sh DESCRIPTION
- The
- .Fn bcmp
- function
- compares byte string
--.Fa b1
-+.Fa s1
- against byte string
--.Fa b2 ,
-+.Fa s2 ,
- returning zero if they are identical, non-zero otherwise.
- Both strings are assumed to be
--.Fa len
-+.Fa n
- bytes long.
- Zero-length strings are always identical.
- .Pp
index b7f511bcebbf67ee4a20acfc34d17752e2cc8877..e0371a4d181d7d583a0f3d00a3a061b23253df98 100644 (file)
 .Sh SYNOPSIS
 .In strings.h
 .Ft void
-.Fn bcopy "const void *src" "void *dst" "size_t len"
+.Fn bcopy "const void *s1" "void *s2" "size_t n"
 .Sh DESCRIPTION
 The
 .Fn bcopy
 function
 copies
-.Fa len
+.Fa n
 bytes from string
-.Fa src
+.Fa s1
 to string
-.Fa dst .
+.Fa s2 .
 The two strings may overlap.
 If
-.Fa len
+.Fa n
 is zero, no bytes are copied.
 .Sh SEE ALSO
 .Xr memccpy 3 ,
diff --git a/string/FreeBSD/bcopy.3.patch b/string/FreeBSD/bcopy.3.patch
deleted file mode 100644 (file)
index c6bb7b8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- bcopy.3.bsdnew     2009-11-18 18:24:32.000000000 -0800
-+++ bcopy.3    2009-11-18 18:24:32.000000000 -0800
-@@ -42,20 +42,20 @@
- .Sh SYNOPSIS
- .In strings.h
- .Ft void
--.Fn bcopy "const void *src" "void *dst" "size_t len"
-+.Fn bcopy "const void *s1" "void *s2" "size_t n"
- .Sh DESCRIPTION
- The
- .Fn bcopy
- function
- copies
--.Fa len
-+.Fa n
- bytes from string
--.Fa src
-+.Fa s1
- to string
--.Fa dst .
-+.Fa s2 .
- The two strings may overlap.
- If
--.Fa len
-+.Fa n
- is zero, no bytes are copied.
- .Sh SEE ALSO
- .Xr memccpy 3 ,
diff --git a/string/FreeBSD/bcopy.c b/string/FreeBSD/bcopy.c
new file mode 100644 (file)
index 0000000..f1cb0b5
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
index aa3f36199e583691fff58db41eed4aa768305ae4..4b3438762466a878bfde2cec8cd8560413656fea 100644 (file)
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In string.h
+.In strings.h
 .Ft int
-.Fn bcmp "const void *b1" "const void *b2" "size_t len"
+.Fo bcmp
+.Fa "const void *s1"
+.Fa "const void *s2"
+.Fa "size_t n"
+.Fc
 .Ft void
-.Fn bcopy "const void *src" "void *dst" "size_t len"
+.Fo bcopy
+.Fa "const void *s1"
+.Fa "void *s2"
+.Fa "size_t n"
+.Fc
 .Ft void
-.Fn bzero "void *b" "size_t len"
+.Fo bzero
+.Fa "void *s"
+.Fa "size_t n"
+.Fc
+.In string.h
 .Ft void *
-.Fn memchr "const void *b" "int c" "size_t len"
-.Ft int
-.Fn memcmp "const void *b1" "const void *b2" "size_t len"
+.Fo memccpy
+.Fa "void *restrict s1"
+.Fa "const void *restrict s2"
+.Fa "int c"
+.Fa "size_t n"
+.Fc
 .Ft void *
-.Fn memccpy "void *dst" "const void *src" "int c" "size_t len"
+.Fo memchr
+.Fa "const void *s"
+.Fa "int c"
+.Fa "size_t n"
+.Fc
+.Ft int
+.Fo memcmp
+.Fa "const void *s1"
+.Fa "const void *s2"
+.Fa "size_t n"
+.Fc
 .Ft void *
-.Fn memcpy "void *dst" "const void *src" "size_t len"
+.Fo memcpy
+.Fa "void *restrict s1"
+.Fa "const void *restrict s2"
+.Fa "size_t n"
+.Fc
 .Ft void *
-.Fn memmove "void *dst" "const void *src" "size_t len"
+.Fo memmove
+.Fa "void *s1"
+.Fa "const void *s2"
+.Fa "size_t n"
+.Fc
 .Ft void *
-.Fn memset "void *b" "int c" "size_t len"
+.Fo memset
+.Fa "void *s"
+.Fa "int c"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 These functions operate on variable length strings of bytes.
-They do not check for terminating null bytes as the routines
+They do not check for terminating null bytes, as the routines
 listed in
 .Xr string 3
 do.
 .Pp
 See the specific manual pages for more information.
+.Sh LEGACY SYNOPSIS
+.Fd #include <string.h>
+.Pp
+The include file
+.In string.h
+is necessary and sufficient for all functions.
 .Sh SEE ALSO
 .Xr bcmp 3 ,
 .Xr bcopy 3 ,
@@ -83,7 +126,8 @@ See the specific manual pages for more information.
 .Xr memcmp 3 ,
 .Xr memcpy 3 ,
 .Xr memmove 3 ,
-.Xr memset 3
+.Xr memset 3 ,
+.Xr compat 5
 .Sh STANDARDS
 The functions
 .Fn memchr ,
diff --git a/string/FreeBSD/bstring.3.patch b/string/FreeBSD/bstring.3.patch
deleted file mode 100644 (file)
index e2604c9..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
---- bstring.3.bsdnew   2009-11-18 18:24:32.000000000 -0800
-+++ bstring.3  2009-11-18 18:24:32.000000000 -0800
-@@ -47,33 +47,76 @@
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In string.h
-+.In strings.h
- .Ft int
--.Fn bcmp "const void *b1" "const void *b2" "size_t len"
-+.Fo bcmp
-+.Fa "const void *s1"
-+.Fa "const void *s2"
-+.Fa "size_t n"
-+.Fc
- .Ft void
--.Fn bcopy "const void *src" "void *dst" "size_t len"
-+.Fo bcopy
-+.Fa "const void *s1"
-+.Fa "void *s2"
-+.Fa "size_t n"
-+.Fc
- .Ft void
--.Fn bzero "void *b" "size_t len"
-+.Fo bzero
-+.Fa "void *s"
-+.Fa "size_t n"
-+.Fc
-+.In string.h
- .Ft void *
--.Fn memchr "const void *b" "int c" "size_t len"
--.Ft int
--.Fn memcmp "const void *b1" "const void *b2" "size_t len"
-+.Fo memccpy
-+.Fa "void *restrict s1"
-+.Fa "const void *restrict s2"
-+.Fa "int c"
-+.Fa "size_t n"
-+.Fc
- .Ft void *
--.Fn memccpy "void *dst" "const void *src" "int c" "size_t len"
-+.Fo memchr
-+.Fa "const void *s"
-+.Fa "int c"
-+.Fa "size_t n"
-+.Fc
-+.Ft int
-+.Fo memcmp
-+.Fa "const void *s1"
-+.Fa "const void *s2"
-+.Fa "size_t n"
-+.Fc
- .Ft void *
--.Fn memcpy "void *dst" "const void *src" "size_t len"
-+.Fo memcpy
-+.Fa "void *restrict s1"
-+.Fa "const void *restrict s2"
-+.Fa "size_t n"
-+.Fc
- .Ft void *
--.Fn memmove "void *dst" "const void *src" "size_t len"
-+.Fo memmove
-+.Fa "void *s1"
-+.Fa "const void *s2"
-+.Fa "size_t n"
-+.Fc
- .Ft void *
--.Fn memset "void *b" "int c" "size_t len"
-+.Fo memset
-+.Fa "void *s"
-+.Fa "int c"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- These functions operate on variable length strings of bytes.
--They do not check for terminating null bytes as the routines
-+They do not check for terminating null bytes, as the routines
- listed in
- .Xr string 3
- do.
- .Pp
- See the specific manual pages for more information.
-+.Sh LEGACY SYNOPSIS
-+.Fd #include <string.h>
-+.Pp
-+The include file
-+.In string.h
-+is necessary and sufficient for all functions.
- .Sh SEE ALSO
- .Xr bcmp 3 ,
- .Xr bcopy 3 ,
-@@ -83,7 +126,8 @@ See the specific manual pages for more i
- .Xr memcmp 3 ,
- .Xr memcpy 3 ,
- .Xr memmove 3 ,
--.Xr memset 3
-+.Xr memset 3 ,
-+.Xr compat 5
- .Sh STANDARDS
- The functions
- .Fn memchr ,
index 52d26843054c8ce5cbdc83844b88a384cc9b00a9..642b2f1b39c5aca44436501d2bed155ee414c043 100644 (file)
 .Sh SYNOPSIS
 .In strings.h
 .Ft void
-.Fn bzero "void *b" "size_t len"
+.Fn bzero "void *s" "size_t n"
 .Sh DESCRIPTION
 The
 .Fn bzero
 function
 writes
-.Fa len
-zero bytes to the string
-.Fa b .
+.Fa n
+zeroed bytes to the string
+.Fa s .
 If
-.Fa len
+.Fa n
 is zero,
 .Fn bzero
 does nothing.
diff --git a/string/FreeBSD/bzero.3.patch b/string/FreeBSD/bzero.3.patch
deleted file mode 100644 (file)
index 08ec1c7..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
---- bzero.3.bsdnew     2009-11-18 18:24:32.000000000 -0800
-+++ bzero.3    2009-11-18 18:24:32.000000000 -0800
-@@ -42,17 +42,17 @@
- .Sh SYNOPSIS
- .In strings.h
- .Ft void
--.Fn bzero "void *b" "size_t len"
-+.Fn bzero "void *s" "size_t n"
- .Sh DESCRIPTION
- The
- .Fn bzero
- function
- writes
--.Fa len
--zero bytes to the string
--.Fa b .
-+.Fa n
-+zeroed bytes to the string
-+.Fa s .
- If
--.Fa len
-+.Fa n
- is zero,
- .Fn bzero
- does nothing.
diff --git a/string/FreeBSD/bzero.c b/string/FreeBSD/bzero.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/string/FreeBSD/bzero.c.patch b/string/FreeBSD/bzero.c.patch
deleted file mode 100644 (file)
index 1f2956a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- bzero.c.orig       Fri Mar 22 13:53:19 2002
-+++ bzero.c    Sat May  3 14:33:50 2003
-@@ -2,4 +2,4 @@
- __FBSDID("$FreeBSD: src/lib/libc/string/bzero.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
- #define       BZERO
--#include "memset.c"
-+#include "memset-fbsd.c"
index 141b1be5a5a1630fe2a1351a991e980483e66e3f..d019b6d3e0fb378f3e696ddfa4b083072d26d816 100644 (file)
 .Sh NAME
 .Nm ffs ,
 .Nm ffsl ,
-.Nm ffsll ,
 .Nm fls ,
-.Nm flsl ,
-.Nm flsll
+.Nm flsl
 .Nd find first or last bit set in a bit string
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In strings.h
 .Ft int
-.Fn ffs "int value"
+.Fn ffs "int i"
 .Ft int
-.Fn ffsl "long value"
+.Fn ffsl "long i"
 .Ft int
+.Fn fls "int i"
 .Ft int
-.Fn ffsll "long long value"
-.Fn fls "int value"
-.Ft int
-.Fn flsl "long value"
-.Ft int
-.Fn flsll "long long value"
+.Fn flsl "long i"
 .Sh DESCRIPTION
 The
-.Fn ffs ,
-.Fn ffsl
+.Fn ffs
 and
-.Fn ffsll
+.Fn ffsl
 functions find the first bit set
 (beginning with the least significant bit)
 in
-.Fa value
+.Fa i
 and return the index of that bit.
 .Pp
 The
-.Fn fls ,
-.Fn flsl
+.Fn fls
 and
-.Fn flsll
+.Fn flsl
 functions find the last bit set in
-.Fa value
+.Fa i
 and return the index of that bit.
 .Pp
 Bits are numbered starting at 1 (the least significant bit).
@@ -98,14 +90,8 @@ compliance.
 .Pp
 The
 .Fn ffsl ,
-.Fn fls
+.Fn fls ,
 and
 .Fn flsl
 functions appeared in
 .Fx 5.3 .
-The
-.Fn ffsll
-and
-.Fn flsll
-functions appeared in
-.Fx 7.1 .
diff --git a/string/FreeBSD/ffs.3.patch b/string/FreeBSD/ffs.3.patch
deleted file mode 100644 (file)
index e5cd57d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
---- ffs.3.bsdnew       2009-11-30 13:52:21.000000000 -0800
-+++ ffs.3      2009-11-30 13:56:29.000000000 -0800
-@@ -36,46 +36,38 @@
- .Sh NAME
- .Nm ffs ,
- .Nm ffsl ,
--.Nm ffsll ,
- .Nm fls ,
--.Nm flsl ,
--.Nm flsll
-+.Nm flsl
- .Nd find first or last bit set in a bit string
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In strings.h
- .Ft int
--.Fn ffs "int value"
-+.Fn ffs "int i"
- .Ft int
--.Fn ffsl "long value"
-+.Fn ffsl "long i"
- .Ft int
-+.Fn fls "int i"
- .Ft int
--.Fn ffsll "long long value"
--.Fn fls "int value"
--.Ft int
--.Fn flsl "long value"
--.Ft int
--.Fn flsll "long long value"
-+.Fn flsl "long i"
- .Sh DESCRIPTION
- The
--.Fn ffs ,
--.Fn ffsl
-+.Fn ffs
- and
--.Fn ffsll
-+.Fn ffsl
- functions find the first bit set
- (beginning with the least significant bit)
- in
--.Fa value
-+.Fa i
- and return the index of that bit.
- .Pp
- The
--.Fn fls ,
--.Fn flsl
-+.Fn fls
- and
--.Fn flsll
-+.Fn flsl
- functions find the last bit set in
--.Fa value
-+.Fa i
- and return the index of that bit.
- .Pp
- Bits are numbered starting at 1 (the least significant bit).
-@@ -98,14 +90,8 @@ compliance.
- .Pp
- The
- .Fn ffsl ,
--.Fn fls
-+.Fn fls ,
- and
- .Fn flsl
- functions appeared in
- .Fx 5.3 .
--The
--.Fn ffsll
--and
--.Fn flsll
--functions appeared in
--.Fx 7.1 .
index 387b1eb21f21d20d1181bdcb28c84861b5b32e6a..ecbbb63b220395fdb79ec6881f0320eb29d918e9 100644 (file)
@@ -54,8 +54,8 @@ locates the first occurrence of
 .Vt char )
 in the string pointed to by
 .Fa s .
-The terminating null character is considered part of the string;
-therefore if
+The terminating null character is considered to be part of the string;
+therefore, if
 .Fa c
 is
 .Ql \e0 ,
@@ -66,7 +66,7 @@ The
 .Fn rindex
 function is identical to
 .Fn index ,
-except it locates the last occurrence of
+except that it locates the last occurrence of
 .Fa c .
 .Sh RETURN VALUES
 The functions
diff --git a/string/FreeBSD/index.3.patch b/string/FreeBSD/index.3.patch
deleted file mode 100644 (file)
index e015562..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
---- index.3.bsdnew     2009-11-18 18:24:32.000000000 -0800
-+++ index.3    2009-11-18 18:24:32.000000000 -0800
-@@ -54,8 +54,8 @@ locates the first occurrence of
- .Vt char )
- in the string pointed to by
- .Fa s .
--The terminating null character is considered part of the string;
--therefore if
-+The terminating null character is considered to be part of the string;
-+therefore, if
- .Fa c
- is
- .Ql \e0 ,
-@@ -66,7 +66,7 @@ The
- .Fn rindex
- function is identical to
- .Fn index ,
--except it locates the last occurrence of
-+except that it locates the last occurrence of
- .Fa c .
- .Sh RETURN VALUES
- The functions
index 416d0f8e2d9a32ee48ade6a18574359f8c42da92..02cfa37ea681b90e0c1ad5445756a562db7aed3f 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft void *
-.Fn memccpy "void *dst" "const void *src" "int c" "size_t len"
+.Fo memccpy
+.Fa "void *restrict s1"
+.Fa "const void *restrict s2"
+.Fa "int c"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn memccpy
 function
 copies bytes from string
-.Fa src
+.Fa s2
 to string
-.Fa dst .
+.Fa s1 .
 If the character
 .Fa c
 (as converted to an unsigned char) occurs in the string
-.Fa src ,
+.Fa s2 ,
 the copy stops and a pointer to the byte after the copy of
 .Fa c
 in the string
-.Fa dst
+.Fa s1
 is returned.
 Otherwise,
-.Fa len
+.Fa n
 bytes are copied, and a NULL pointer is returned.
+.Pp
+The source and destination strings should not overlap, as the
+behavior is undefined.
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memcpy 3 ,
diff --git a/string/FreeBSD/memccpy.3.patch b/string/FreeBSD/memccpy.3.patch
deleted file mode 100644 (file)
index cdbdd6e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
---- memccpy.3.bsdnew   2009-11-18 18:24:32.000000000 -0800
-+++ memccpy.3  2009-11-18 18:24:32.000000000 -0800
-@@ -39,27 +39,35 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft void *
--.Fn memccpy "void *dst" "const void *src" "int c" "size_t len"
-+.Fo memccpy
-+.Fa "void *restrict s1"
-+.Fa "const void *restrict s2"
-+.Fa "int c"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn memccpy
- function
- copies bytes from string
--.Fa src
-+.Fa s2
- to string
--.Fa dst .
-+.Fa s1 .
- If the character
- .Fa c
- (as converted to an unsigned char) occurs in the string
--.Fa src ,
-+.Fa s2 ,
- the copy stops and a pointer to the byte after the copy of
- .Fa c
- in the string
--.Fa dst
-+.Fa s1
- is returned.
- Otherwise,
--.Fa len
-+.Fa n
- bytes are copied, and a NULL pointer is returned.
-+.Pp
-+The source and destination strings should not overlap, as the
-+behavior is undefined.
- .Sh SEE ALSO
- .Xr bcopy 3 ,
- .Xr memcpy 3 ,
index 5581cccdd0bd3939062badd91f80f5febec04e86..430441bb66dc29b6516e741707f90949ce6686b3 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft void *
-.Fn memchr "const void *b" "int c" "size_t len"
-.Ft void *
-.Fn memrchr "const void *b" "int c" "size_t len"
+.Fo memchr
+.Fa "const void *s"
+.Fa "int c"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn memchr
@@ -54,28 +56,16 @@ locates the first occurrence of
 .Fa c
 (converted to an unsigned char)
 in string
-.Fa b .
-.Pp
-The
-.Fn memrchr
-function behaves like
-.Fn memchr ,
-except that it locates the last occurrence of
-.Fa c
-in string
-.Fa b .
+.Fa s .
 .Sh RETURN VALUES
 The
 .Fn memchr
-and
-.Fn memrchr
-functions
-return a pointer to the byte located,
+function
+returns a pointer to the byte located,
 or NULL if no such byte exists within
-.Fa len
+.Fa n
 bytes.
 .Sh SEE ALSO
-.Xr memmem 3 ,
 .Xr strchr 3 ,
 .Xr strcspn 3 ,
 .Xr strpbrk 3 ,
@@ -91,15 +81,3 @@ The
 function
 conforms to
 .St -isoC .
-.Pp
-The
-.Fn memrchr       
-function is a GNU extension and conforms to no standard.
-.Sh HISTORY
-The
-.Fn memrchr
-function first appeared in GNU libc 2.1.91, this implementation
-first appeared in
-.Fx 6.4 ,
-coming from
-.Ox 4.3 .
diff --git a/string/FreeBSD/memchr.3.patch b/string/FreeBSD/memchr.3.patch
deleted file mode 100644 (file)
index b0e9102..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
---- memchr.3.bsdnew    2009-11-30 13:52:21.000000000 -0800
-+++ memchr.3   2009-11-30 14:18:10.000000000 -0800
-@@ -43,9 +43,11 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft void *
--.Fn memchr "const void *b" "int c" "size_t len"
--.Ft void *
--.Fn memrchr "const void *b" "int c" "size_t len"
-+.Fo memchr
-+.Fa "const void *s"
-+.Fa "int c"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn memchr
-@@ -54,28 +56,16 @@ locates the first occurrence of
- .Fa c
- (converted to an unsigned char)
- in string
--.Fa b .
--.Pp
--The
--.Fn memrchr
--function behaves like
--.Fn memchr ,
--except that it locates the last occurrence of
--.Fa c
--in string
--.Fa b .
-+.Fa s .
- .Sh RETURN VALUES
- The
- .Fn memchr
--and
--.Fn memrchr
--functions
--return a pointer to the byte located,
-+function
-+returns a pointer to the byte located,
- or NULL if no such byte exists within
--.Fa len
-+.Fa n
- bytes.
- .Sh SEE ALSO
--.Xr memmem 3 ,
- .Xr strchr 3 ,
- .Xr strcspn 3 ,
- .Xr strpbrk 3 ,
-@@ -91,15 +81,3 @@ The
- function
- conforms to
- .St -isoC .
--.Pp
--The
--.Fn memrchr       
--function is a GNU extension and conforms to no standard.
--.Sh HISTORY
--The
--.Fn memrchr
--function first appeared in GNU libc 2.1.91, this implementation
--first appeared in
--.Fx 6.4 ,
--coming from
--.Ox 4.3 .
index 98d2b6ab96aec36b5f02bfca08d43a46be8303a4..f48f5d4c640ad24b2415b278651b7e6d501b4a91 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft int
-.Fn memcmp "const void *b1" "const void *b2" "size_t len"
+.Fo memcmp 
+.Fa "const void *s1"
+.Fa "const void *s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn memcmp
 function
 compares byte string
-.Fa b1
+.Fa s1
 against byte string
-.Fa b2 .
+.Fa s2 .
 Both strings are assumed to be
-.Fa len
+.Fa n
 bytes long.
 .Sh RETURN VALUES
 The
diff --git a/string/FreeBSD/memcmp.3.patch b/string/FreeBSD/memcmp.3.patch
deleted file mode 100644 (file)
index 277a31d..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- memcmp.3.bsdnew    2009-11-18 18:24:32.000000000 -0800
-+++ memcmp.3   2009-11-18 18:24:32.000000000 -0800
-@@ -43,17 +43,21 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft int
--.Fn memcmp "const void *b1" "const void *b2" "size_t len"
-+.Fo memcmp 
-+.Fa "const void *s1"
-+.Fa "const void *s2"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn memcmp
- function
- compares byte string
--.Fa b1
-+.Fa s1
- against byte string
--.Fa b2 .
-+.Fa s2 .
- Both strings are assumed to be
--.Fa len
-+.Fa n
- bytes long.
- .Sh RETURN VALUES
- The
index b34bc17a029c15d92918299f21f1177497ba2104..77bd719e7ae8128a580d805ffaf976a07f8f0ce5 100644 (file)
 .Os
 .Sh NAME
 .Nm memcpy
-.Nd copy byte string
+.Nd copy memory area
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
 .Ft void *
-.Fn memcpy "void *dst" "const void *src" "size_t len"
+.Fo memcpy
+.Fa "void *restrict s1"
+.Fa "const void *restrict s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn memcpy
 function
 copies
-.Fa len
-bytes from string
-.Fa src
-to string
-.Fa dst .
+.Fa n
+bytes from memory area
+.Fa s2
+to memory area
+.Fa s1 .
+If 
+.Fa s1
+and 
+.Fa s2
+overlap, behavior is undefined.
+Applications in which
+.Fa s1
+and 
+.Fa s2 
+might overlap should use
+.Xr memmove 3
+instead.
 .Sh RETURN VALUES
 The
 .Fn memcpy
 function
 returns the original value of
-.Fa dst .
+.Fa s1 .
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memccpy 3 ,
@@ -72,17 +88,3 @@ The
 function
 conforms to
 .St -isoC .
-.Sh BUGS
-In this implementation
-.Fn memcpy
-is implemented using
-.Xr bcopy 3 ,
-and therefore the strings may overlap.
-On other systems, copying overlapping strings may produce surprises.
-Programs intended to be portable should use
-.Xr memmove 3
-when
-.Fa src
-and
-.Fa dst
-may overlap.
diff --git a/string/FreeBSD/memcpy.3.patch b/string/FreeBSD/memcpy.3.patch
deleted file mode 100644 (file)
index 631b4d7..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
---- memcpy.3.bsdnew    2009-11-18 18:24:32.000000000 -0800
-+++ memcpy.3   2009-11-18 18:24:32.000000000 -0800
-@@ -37,29 +37,45 @@
- .Os
- .Sh NAME
- .Nm memcpy
--.Nd copy byte string
-+.Nd copy memory area
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In string.h
- .Ft void *
--.Fn memcpy "void *dst" "const void *src" "size_t len"
-+.Fo memcpy
-+.Fa "void *restrict s1"
-+.Fa "const void *restrict s2"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn memcpy
- function
- copies
--.Fa len
--bytes from string
--.Fa src
--to string
--.Fa dst .
-+.Fa n
-+bytes from memory area
-+.Fa s2
-+to memory area
-+.Fa s1 .
-+If 
-+.Fa s1
-+and 
-+.Fa s2
-+overlap, behavior is undefined.
-+Applications in which
-+.Fa s1
-+and 
-+.Fa s2 
-+might overlap should use
-+.Xr memmove 3
-+instead.
- .Sh RETURN VALUES
- The
- .Fn memcpy
- function
- returns the original value of
--.Fa dst .
-+.Fa s1 .
- .Sh SEE ALSO
- .Xr bcopy 3 ,
- .Xr memccpy 3 ,
-@@ -72,17 +88,3 @@ The
- function
- conforms to
- .St -isoC .
--.Sh BUGS
--In this implementation
--.Fn memcpy
--is implemented using
--.Xr bcopy 3 ,
--and therefore the strings may overlap.
--On other systems, copying overlapping strings may produce surprises.
--Programs intended to be portable should use
--.Xr memmove 3
--when
--.Fa src
--and
--.Fa dst
--may overlap.
diff --git a/string/FreeBSD/memcpy.c b/string/FreeBSD/memcpy.c
new file mode 100644 (file)
index 0000000..ed03856
--- /dev/null
@@ -0,0 +1,5 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define        MEMCOPY
+#include "bcopy.c"
diff --git a/string/FreeBSD/memcpy.c.patch b/string/FreeBSD/memcpy.c.patch
deleted file mode 100644 (file)
index 4e60f56..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- memcpy.c.orig      Fri Mar 22 13:53:19 2002
-+++ memcpy.c   Sat May  3 14:33:58 2003
-@@ -2,4 +2,4 @@
- __FBSDID("$FreeBSD: src/lib/libc/string/memcpy.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
- #define       MEMCOPY
--#include "bcopy.c"
-+#include "bcopy-fbsd.c"
index 6cac60464a71b7896bd878963dc238889bd248f8..64871c89235441114aa2f30dd3a8cf29002253f3 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft void *
-.Fn memmove "void *dst" "const void *src" "size_t len"
+.Fo memmove
+.Fa "void *s1"
+.Fa "const void *s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn memmove
 function
 copies
-.Fa len
+.Fa n
 bytes from string
-.Fa src
+.Fa s2
 to string
-.Fa dst .
+.Fa s1 .
 The two strings may overlap;
 the copy is always done in a non-destructive manner.
 .Sh RETURN VALUES
 The
 .Fn memmove
 function returns the original value of
-.Fa dst .
+.Fa s1 .
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memccpy 3 ,
diff --git a/string/FreeBSD/memmove.3.patch b/string/FreeBSD/memmove.3.patch
deleted file mode 100644 (file)
index a303997..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---- memmove.3.bsdnew   2009-11-18 18:24:33.000000000 -0800
-+++ memmove.3  2009-11-18 18:24:33.000000000 -0800
-@@ -43,24 +43,28 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft void *
--.Fn memmove "void *dst" "const void *src" "size_t len"
-+.Fo memmove
-+.Fa "void *s1"
-+.Fa "const void *s2"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn memmove
- function
- copies
--.Fa len
-+.Fa n
- bytes from string
--.Fa src
-+.Fa s2
- to string
--.Fa dst .
-+.Fa s1 .
- The two strings may overlap;
- the copy is always done in a non-destructive manner.
- .Sh RETURN VALUES
- The
- .Fn memmove
- function returns the original value of
--.Fa dst .
-+.Fa s1 .
- .Sh SEE ALSO
- .Xr bcopy 3 ,
- .Xr memccpy 3 ,
diff --git a/string/FreeBSD/memmove.c b/string/FreeBSD/memmove.c
new file mode 100644 (file)
index 0000000..05cf75a
--- /dev/null
@@ -0,0 +1,5 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define        MEMMOVE
+#include "bcopy.c"
diff --git a/string/FreeBSD/memmove.c.patch b/string/FreeBSD/memmove.c.patch
deleted file mode 100644 (file)
index 1478a89..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- memmove.c.orig     Fri Mar 22 13:53:19 2002
-+++ memmove.c  Sat May  3 14:34:06 2003
-@@ -2,4 +2,4 @@
- __FBSDID("$FreeBSD: src/lib/libc/string/memmove.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
- #define       MEMMOVE
--#include "bcopy.c"
-+#include "bcopy-fbsd.c"
index 73ffcec97b07c8d9e039fa4193015d628d1703dd..701d7392eeafb7da683fa09c3e473c7693a452d3 100644 (file)
@@ -37,7 +37,7 @@
 .Os
 .Sh NAME
 .Nm memset
-.Nd write a byte to byte string
+.Nd fill a byte string with a byte value
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -52,7 +52,7 @@ writes
 .Fa len
 bytes of value
 .Fa c
-(converted to an unsigned char) to the string
+(converted to an unsigned char) to the byte string
 .Fa b .
 .Sh RETURN VALUES
 The
@@ -60,6 +60,7 @@ The
 function returns its first argument.
 .Sh SEE ALSO
 .Xr bzero 3 ,
+.Xr memset_pattern 3 ,
 .Xr swab 3 ,
 .Xr wmemset 3
 .Sh STANDARDS
diff --git a/string/FreeBSD/memset.3.patch b/string/FreeBSD/memset.3.patch
deleted file mode 100644 (file)
index 2257b5b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
---- memset.3.bsdnew    2009-11-30 13:52:22.000000000 -0800
-+++ memset.3   2009-11-30 14:19:30.000000000 -0800
-@@ -37,7 +37,7 @@
- .Os
- .Sh NAME
- .Nm memset
--.Nd write a byte to byte string
-+.Nd fill a byte string with a byte value
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
-@@ -52,7 +52,7 @@ writes
- .Fa len
- bytes of value
- .Fa c
--(converted to an unsigned char) to the string
-+(converted to an unsigned char) to the byte string
- .Fa b .
- .Sh RETURN VALUES
- The
-@@ -60,6 +60,7 @@ The
- function returns its first argument.
- .Sh SEE ALSO
- .Xr bzero 3 ,
-+.Xr memset_pattern 3 ,
- .Xr swab 3 ,
- .Xr wmemset 3
- .Sh STANDARDS
index 2a2d1aaa5b411e2999d345a9aff7a6ed9f8d65d3..f1a80e19c338871c1f3d9890a962a0146434da28 100644 (file)
@@ -58,8 +58,8 @@ matching
 in the null-terminated string
 .Fa s .
 .Sh RETURN VALUES
-A pointer to the character is returned if it is found; otherwise
-NULL is returned.
+A pointer to the character is returned if it is found;
+otherwise, NULL is returned.
 If
 .Fa c
 is
diff --git a/string/FreeBSD/rindex.3.patch b/string/FreeBSD/rindex.3.patch
deleted file mode 100644 (file)
index 03b5fe5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
---- _SB/Libc/string/FreeBSD/rindex.3   2003-05-20 15:23:54.000000000 -0700
-+++ _SB/Libc/string/FreeBSD/rindex.3.edit      2006-06-28 16:55:53.000000000 -0700
-@@ -58,8 +58,8 @@
- in the null-terminated string
- .Fa s .
- .Sh RETURN VALUES
--A pointer to the character is returned if it is found; otherwise
--NULL is returned.
-+A pointer to the character is returned if it is found;
-+otherwise, NULL is returned.
- If
- .Fa c
- is
diff --git a/string/FreeBSD/stpcpy.c b/string/FreeBSD/stpcpy.c
deleted file mode 100644 (file)
index ffbc0a2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999
- *     David E. O'Brien
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcpy.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/stpcpy.c,v 1.2 2009/02/28 06:05:37 das Exp $");
-
-#include <string.h>
-
-char *
-stpcpy(char * __restrict to, const char * __restrict from)
-{
-
-       for (; (*to = *from); ++from, ++to);
-       return(to);
-}
diff --git a/string/FreeBSD/stpncpy.c b/string/FreeBSD/stpncpy.c
deleted file mode 100644 (file)
index 52f6149..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/stpncpy.c,v 1.1 2009/02/28 06:00:58 das Exp $");
-
-#include <string.h>
-
-char *
-stpncpy(char * __restrict dst, const char * __restrict src, size_t n)
-{
-
-       for (; n--; dst++, src++) {
-               if (!(*dst = *src)) {
-                       char *ret = dst;
-                       while (n--)
-                               *++dst = '\0';
-                       return (ret);
-               }
-       }
-       return (dst);
-}
index 004b081bbb01f32515a89541a1e94bc2c40d252d..0d686a6b17ac3287af4a239532dd63a5bc99fab5 100644 (file)
 .Os
 .Sh NAME
 .Nm strcasecmp ,
-.Nm strncasecmp
+.Nm strcasecmp_l ,
+.Nm strncasecmp ,
+.Nm strncasecmp_l
 .Nd compare strings, ignoring case
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In strings.h
 .Ft int
-.Fn strcasecmp "const char *s1" "const char *s2"
+.Fo strcasecmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft int
-.Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
+.Fo strncasecmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fc
+.In strings.h
+.In xlocale.h
+.Ft int
+.Fo strcasecmp_l
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "locale_t loc"
+.Fc
+.Ft int
+.Fo strncasecmp_l
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strcasecmp
@@ -59,8 +83,20 @@ and
 The
 .Fn strncasecmp
 compares at most
-.Fa len
+.Fa n
 characters.
+.Pp
+Although the
+.Fn strcasecmp
+and
+.Fn strncasecmp
+functions use the current locale, the
+.Fn strcasecmp_l
+and
+.Fn strncasecmp_l
+functions may be passed locales directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn strcasecmp
@@ -84,7 +120,7 @@ is greater than
 .Xr strcoll 3 ,
 .Xr strxfrm 3 ,
 .Xr tolower 3 ,
-.Xr wcscasecmp 3
+.Xr xlocale 3
 .Sh HISTORY
 The
 .Fn strcasecmp
diff --git a/string/FreeBSD/strcasecmp.3.patch b/string/FreeBSD/strcasecmp.3.patch
deleted file mode 100644 (file)
index c34f056..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
---- strcasecmp.3.orig  2009-11-30 13:52:22.000000000 -0800
-+++ strcasecmp.3       2009-11-30 15:12:56.000000000 -0800
-@@ -35,16 +35,40 @@
- .Os
- .Sh NAME
- .Nm strcasecmp ,
--.Nm strncasecmp
-+.Nm strcasecmp_l ,
-+.Nm strncasecmp ,
-+.Nm strncasecmp_l
- .Nd compare strings, ignoring case
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In strings.h
- .Ft int
--.Fn strcasecmp "const char *s1" "const char *s2"
-+.Fo strcasecmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Ft int
--.Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
-+.Fo strncasecmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "size_t n"
-+.Fc
-+.In strings.h
-+.In xlocale.h
-+.Ft int
-+.Fo strcasecmp_l
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "locale_t loc"
-+.Fc
-+.Ft int
-+.Fo strncasecmp_l
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strcasecmp
-@@ -59,8 +83,20 @@ and
- The
- .Fn strncasecmp
- compares at most
--.Fa len
-+.Fa n
- characters.
-+.Pp
-+Although the
-+.Fn strcasecmp
-+and
-+.Fn strncasecmp
-+functions use the current locale, the
-+.Fn strcasecmp_l
-+and
-+.Fn strncasecmp_l
-+functions may be passed locales directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn strcasecmp
-@@ -84,7 +120,7 @@ is greater than
- .Xr strcoll 3 ,
- .Xr strxfrm 3 ,
- .Xr tolower 3 ,
--.Xr wcscasecmp 3
-+.Xr xlocale 3
- .Sh HISTORY
- The
- .Fn strcasecmp
index 2e063bbea8c5ca4c251dc0aa489a393296dee399..8299c1652f96a7ff0ceafb1312d8eb58e9b5d916 100644 (file)
@@ -33,38 +33,59 @@ static char sccsid[] = "@(#)strcasecmp.c    8.1 (Berkeley) 6/4/93";
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $");
 
+#include "xlocale_private.h"
+
 #include <strings.h>
 #include <ctype.h>
 
 typedef unsigned char u_char;
 
 int
-strcasecmp(const char *s1, const char *s2)
+strcasecmp_l(s1, s2, loc)
+       const char *s1, *s2;
+       locale_t loc;
 {
        const u_char
                        *us1 = (const u_char *)s1,
                        *us2 = (const u_char *)s2;
 
-       while (tolower(*us1) == tolower(*us2++))
+       NORMALIZE_LOCALE(loc);
+       while (tolower_l(*us1, loc) == tolower_l(*us2++, loc))
                if (*us1++ == '\0')
                        return (0);
-       return (tolower(*us1) - tolower(*--us2));
+       return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
 }
 
 int
-strncasecmp(const char *s1, const char *s2, size_t n)
+strcasecmp(const char *s1, const char *s2)
 {
+       return strcasecmp_l(s1, s2, __current_locale());
+}
+
+int
+strncasecmp_l(s1, s2, n, loc)
+       const char *s1, *s2;
+       size_t n;
+       locale_t loc;
+{
+       NORMALIZE_LOCALE(loc);
        if (n != 0) {
                const u_char
                                *us1 = (const u_char *)s1,
                                *us2 = (const u_char *)s2;
 
                do {
-                       if (tolower(*us1) != tolower(*us2++))
-                               return (tolower(*us1) - tolower(*--us2));
+                       if (tolower_l(*us1, loc) != tolower_l(*us2++, loc))
+                               return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
                        if (*us1++ == '\0')
                                break;
                } while (--n != 0);
        }
        return (0);
 }
+
+int
+strncasecmp(const char *s1, const char *s2, size_t n)
+{
+       return strncasecmp_l(s1, s2, n, __current_locale());
+}
diff --git a/string/FreeBSD/strcasecmp.c.patch b/string/FreeBSD/strcasecmp.c.patch
deleted file mode 100644 (file)
index 22938eb..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
---- strcasecmp.c.bsdnew        2009-11-18 18:24:33.000000000 -0800
-+++ strcasecmp.c       2009-11-18 18:24:33.000000000 -0800
-@@ -33,38 +33,59 @@ static char sccsid[] = "@(#)strcasecmp.c
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $");
-+#include "xlocale_private.h"
-+
- #include <strings.h>
- #include <ctype.h>
- typedef unsigned char u_char;
- int
--strcasecmp(const char *s1, const char *s2)
-+strcasecmp_l(s1, s2, loc)
-+      const char *s1, *s2;
-+      locale_t loc;
- {
-       const u_char
-                       *us1 = (const u_char *)s1,
-                       *us2 = (const u_char *)s2;
--      while (tolower(*us1) == tolower(*us2++))
-+      NORMALIZE_LOCALE(loc);
-+      while (tolower_l(*us1, loc) == tolower_l(*us2++, loc))
-               if (*us1++ == '\0')
-                       return (0);
--      return (tolower(*us1) - tolower(*--us2));
-+      return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
- }
- int
--strncasecmp(const char *s1, const char *s2, size_t n)
-+strcasecmp(const char *s1, const char *s2)
- {
-+      return strcasecmp_l(s1, s2, __current_locale());
-+}
-+
-+int
-+strncasecmp_l(s1, s2, n, loc)
-+      const char *s1, *s2;
-+      size_t n;
-+      locale_t loc;
-+{
-+      NORMALIZE_LOCALE(loc);
-       if (n != 0) {
-               const u_char
-                               *us1 = (const u_char *)s1,
-                               *us2 = (const u_char *)s2;
-               do {
--                      if (tolower(*us1) != tolower(*us2++))
--                              return (tolower(*us1) - tolower(*--us2));
-+                      if (tolower_l(*us1, loc) != tolower_l(*us2++, loc))
-+                              return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
-                       if (*us1++ == '\0')
-                               break;
-               } while (--n != 0);
-       }
-       return (0);
- }
-+
-+int
-+strncasecmp(const char *s1, const char *s2, size_t n)
-+{
-+      return strncasecmp_l(s1, s2, n, __current_locale());
-+}
index 54c345b319b044d0c5b210034a96eac1cc835463..e8f576fe64d30ac8831c2cd9acae2ddf707ef5b0 100644 (file)
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $");
 
+#include "xlocale_private.h"
+
 #include <ctype.h>
 #include <string.h>
 
@@ -40,21 +42,30 @@ __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 d
  * Find the first occurrence of find in s, ignore case.
  */
 char *
-strcasestr(const char *s, const char *find)
+strcasestr_l(s, find, loc)
+       const char *s, *find;
+       locale_t loc;
 {
        char c, sc;
        size_t len;
 
+       NORMALIZE_LOCALE(loc);
        if ((c = *find++) != 0) {
-               c = tolower((unsigned char)c);
+               c = tolower_l((unsigned char)c, loc);
                len = strlen(find);
                do {
                        do {
                                if ((sc = *s++) == 0)
                                        return (NULL);
-                       } while ((char)tolower((unsigned char)sc) != c);
-               } while (strncasecmp(s, find, len) != 0);
+                       } while ((char)tolower_l((unsigned char)sc, loc) != c);
+               } while (strncasecmp_l(s, find, len, loc) != 0);
                s--;
        }
        return ((char *)s);
 }
+
+char *
+strcasestr(const char *s, const char *find)
+{
+       return strcasestr_l(s, find, __current_locale());
+}
diff --git a/string/FreeBSD/strcasestr.c.patch b/string/FreeBSD/strcasestr.c.patch
deleted file mode 100644 (file)
index 19818d7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
---- strcasestr.c.bsdnew        2009-11-18 18:24:33.000000000 -0800
-+++ strcasestr.c       2009-11-18 18:24:33.000000000 -0800
-@@ -33,6 +33,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $");
-+#include "xlocale_private.h"
-+
- #include <ctype.h>
- #include <string.h>
-@@ -40,21 +42,30 @@ __FBSDID("$FreeBSD: src/lib/libc/string/
-  * Find the first occurrence of find in s, ignore case.
-  */
- char *
--strcasestr(const char *s, const char *find)
-+strcasestr_l(s, find, loc)
-+      const char *s, *find;
-+      locale_t loc;
- {
-       char c, sc;
-       size_t len;
-+      NORMALIZE_LOCALE(loc);
-       if ((c = *find++) != 0) {
--              c = tolower((unsigned char)c);
-+              c = tolower_l((unsigned char)c, loc);
-               len = strlen(find);
-               do {
-                       do {
-                               if ((sc = *s++) == 0)
-                                       return (NULL);
--                      } while ((char)tolower((unsigned char)sc) != c);
--              } while (strncasecmp(s, find, len) != 0);
-+                      } while ((char)tolower_l((unsigned char)sc, loc) != c);
-+              } while (strncasecmp_l(s, find, len, loc) != 0);
-               s--;
-       }
-       return ((char *)s);
- }
-+
-+char *
-+strcasestr(const char *s, const char *find)
-+{
-+      return strcasestr_l(s, find, __current_locale());
-+}
index 00d07884386c75f2a3eed0946fcadf53c3aecef7..9eb86eccaf270599fe9a92fda1b1940badcfbf06 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn strcat "char * restrict s" "const char * restrict append"
+.Fo strcat
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fc
 .Ft char *
-.Fn strncat "char * restrict s" "const char * restrict append" "size_t count"
+.Fo strncat
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strcat
@@ -54,24 +61,27 @@ and
 .Fn strncat
 functions
 append a copy of the null-terminated string
-.Fa append
+.Fa s2
 to the end of the null-terminated string
-.Fa s ,
+.Fa s1 ,
 then add a terminating
 .Ql \e0 .
 The string
-.Fa s
+.Fa s1
 must have sufficient space to hold the result.
 .Pp
 The
 .Fn strncat
 function
 appends not more than
-.Fa count
+.Fa n
 characters from
-.Fa append ,
+.Fa s2 ,
 and then adds a terminating
 .Ql \e0 .
+.Pp
+The source and destination strings should not overlap, as the
+behavior is undefined.
 .Sh RETURN VALUES
 The
 .Fn strcat
@@ -79,7 +89,7 @@ and
 .Fn strncat
 functions
 return the pointer
-.Fa s .
+.Fa s1 .
 .Sh SECURITY CONSIDERATIONS
 The
 .Fn strcat
@@ -111,7 +121,7 @@ Example:
 void
 foo(const char *arbitrary_string)
 {
-       char onstack[8];
+       char onstack[8] = "";
 
 #if defined(BAD)
        /*
diff --git a/string/FreeBSD/strcat.3.patch b/string/FreeBSD/strcat.3.patch
deleted file mode 100644 (file)
index 2351d2e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
---- strcat.3.orig      2010-06-17 08:44:44.000000000 -0700
-+++ strcat.3   2010-06-17 08:46:22.000000000 -0700
-@@ -44,9 +44,16 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn strcat "char * restrict s" "const char * restrict append"
-+.Fo strcat
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fc
- .Ft char *
--.Fn strncat "char * restrict s" "const char * restrict append" "size_t count"
-+.Fo strncat
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strcat
-@@ -54,24 +61,27 @@ and
- .Fn strncat
- functions
- append a copy of the null-terminated string
--.Fa append
-+.Fa s2
- to the end of the null-terminated string
--.Fa s ,
-+.Fa s1 ,
- then add a terminating
- .Ql \e0 .
- The string
--.Fa s
-+.Fa s1
- must have sufficient space to hold the result.
- .Pp
- The
- .Fn strncat
- function
- appends not more than
--.Fa count
-+.Fa n
- characters from
--.Fa append ,
-+.Fa s2 ,
- and then adds a terminating
- .Ql \e0 .
-+.Pp
-+The source and destination strings should not overlap, as the
-+behavior is undefined.
- .Sh RETURN VALUES
- The
- .Fn strcat
-@@ -79,7 +89,7 @@ and
- .Fn strncat
- functions
- return the pointer
--.Fa s .
-+.Fa s1 .
- .Sh SECURITY CONSIDERATIONS
- The
- .Fn strcat
-@@ -111,7 +121,7 @@ Example:
- void
- foo(const char *arbitrary_string)
- {
--      char onstack[8];
-+      char onstack[8] = "";
- #if defined(BAD)
-       /*
diff --git a/string/FreeBSD/strcat.c b/string/FreeBSD/strcat.c
deleted file mode 100644 (file)
index 8ebcf1b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcat.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strcat.c,v 1.8 2007/01/09 00:28:12 imp Exp $");
-
-#include <string.h>
-
-char *
-strcat(char * __restrict s, const char * __restrict append)
-{
-       char *save = s;
-
-       for (; *s; ++s);
-       while ((*s++ = *append++));
-       return(save);
-}
index 278db74e8735407c460253e01b0e6ae68804ace8..512bc6f26bd9781bedff7a8eb50ec790fa95a1a2 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft "char *"
-.Fn strchr "const char *s" "int c"
+.Fo strchr
+.Fa "const char *s"
+.Fa "int c"
+.Fc
 .Ft "char *"
-.Fn strrchr "const char *s" "int c"
+.Fo strrchr
+.Fa "const char *s"
+.Fa "int c"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strchr
@@ -55,7 +61,7 @@ function locates the first occurrence of
 .Vt char )
 in the string pointed to by
 .Fa s .
-The terminating null character is considered part of the string;
+The terminating null character is considered to be part of the string;
 therefore if
 .Fa c
 is
@@ -66,7 +72,7 @@ the functions locate the terminating
 The
 .Fn strrchr
 function is identical to
-.Fn strchr
+.Fn strchr ,
 except it locates the last occurrence of
 .Fa c .
 .Sh RETURN VALUES
diff --git a/string/FreeBSD/strchr.3.patch b/string/FreeBSD/strchr.3.patch
deleted file mode 100644 (file)
index d5ff416..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
---- strchr.3.bsdnew    2009-11-18 18:24:33.000000000 -0800
-+++ strchr.3   2009-11-18 18:24:33.000000000 -0800
-@@ -43,9 +43,15 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft "char *"
--.Fn strchr "const char *s" "int c"
-+.Fo strchr
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
- .Ft "char *"
--.Fn strrchr "const char *s" "int c"
-+.Fo strrchr
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strchr
-@@ -55,7 +61,7 @@ function locates the first occurrence of
- .Vt char )
- in the string pointed to by
- .Fa s .
--The terminating null character is considered part of the string;
-+The terminating null character is considered to be part of the string;
- therefore if
- .Fa c
- is
-@@ -66,7 +72,7 @@ the functions locate the terminating
- The
- .Fn strrchr
- function is identical to
--.Fn strchr
-+.Fn strchr ,
- except it locates the last occurrence of
- .Fa c .
- .Sh RETURN VALUES
diff --git a/string/FreeBSD/strchr.c.patch b/string/FreeBSD/strchr.c.patch
deleted file mode 100644 (file)
index ed9a447..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- strchr.c.orig      Fri Mar 22 13:53:19 2002
-+++ strchr.c   Sat May  3 14:34:14 2003
-@@ -2,4 +2,4 @@
- __FBSDID("$FreeBSD: src/lib/libc/string/strchr.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
- #define       STRCHR
--#include "index.c"
-+#include "index-fbsd.c"
index 43acd331608d51b82d0d5e05680cbcb33e5c691c..e04b4ddd9275b53436bb043d2418e8f06b258699 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft int
-.Fn strcmp "const char *s1" "const char *s2"
+.Fo strcmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft int
-.Fn strncmp "const char *s1" "const char *s2" "size_t len"
+.Fo strncmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strcmp
@@ -62,7 +69,7 @@ The
 .Fn strncmp
 function
 compares not more than
-.Fa len
+.Fa n
 characters.
 Because
 .Fn strncmp
diff --git a/string/FreeBSD/strcmp.3.patch b/string/FreeBSD/strcmp.3.patch
deleted file mode 100644 (file)
index 1e3d6b4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
---- strcmp.3.bsdnew    2009-11-18 18:24:33.000000000 -0800
-+++ strcmp.3   2009-11-18 18:24:34.000000000 -0800
-@@ -44,9 +44,16 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft int
--.Fn strcmp "const char *s1" "const char *s2"
-+.Fo strcmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Ft int
--.Fn strncmp "const char *s1" "const char *s2" "size_t len"
-+.Fo strncmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strcmp
-@@ -62,7 +69,7 @@ The
- .Fn strncmp
- function
- compares not more than
--.Fa len
-+.Fa n
- characters.
- Because
- .Fn strncmp
diff --git a/string/FreeBSD/strcmp.c b/string/FreeBSD/strcmp.c
new file mode 100644 (file)
index 0000000..f1cb0b5
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
index 8c18f77eba571fab687f6c5e8db632ee16046550..fcbbbe1d663213f82767281a512a41bc9d8171a7 100644 (file)
 .Dt STRCOLL 3
 .Os
 .Sh NAME
-.Nm strcoll
-.Nd compare strings according to current collation
+.Nm strcoll ,
+.Nm strcoll_l
+.Nd compare strings, according to current collation
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
 .Ft int
-.Fn strcoll "const char *s1" "const char *s2"
+.Fo strcoll
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
+.In string.h
+.In xlocale.h
+.Ft int
+.Fo strcoll_l
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strcoll
@@ -62,11 +74,20 @@ If information about the current locale collation is not available,
 the value of
 .Fn strcmp s1 s2
 is returned.
+.Pp
+Although the
+.Fn strcoll
+function uses the current locale, the
+.Fn strcoll_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh SEE ALSO
 .Xr setlocale 3 ,
 .Xr strcmp 3 ,
 .Xr strxfrm 3 ,
-.Xr wcscoll 3
+.Xr wcscoll 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strcoll
diff --git a/string/FreeBSD/strcoll.3.patch b/string/FreeBSD/strcoll.3.patch
deleted file mode 100644 (file)
index fc46410..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
---- strcoll.3.bsdnew   2009-11-30 13:52:22.000000000 -0800
-+++ strcoll.3  2009-11-30 14:29:06.000000000 -0800
-@@ -36,14 +36,26 @@
- .Dt STRCOLL 3
- .Os
- .Sh NAME
--.Nm strcoll
--.Nd compare strings according to current collation
-+.Nm strcoll ,
-+.Nm strcoll_l
-+.Nd compare strings, according to current collation
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In string.h
- .Ft int
--.Fn strcoll "const char *s1" "const char *s2"
-+.Fo strcoll
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.In string.h
-+.In xlocale.h
-+.Ft int
-+.Fo strcoll_l
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strcoll
-@@ -62,11 +74,20 @@ If information about the current locale 
- the value of
- .Fn strcmp s1 s2
- is returned.
-+.Pp
-+Although the
-+.Fn strcoll
-+function uses the current locale, the
-+.Fn strcoll_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh SEE ALSO
- .Xr setlocale 3 ,
- .Xr strcmp 3 ,
- .Xr strxfrm 3 ,
--.Xr wcscoll 3
-+.Xr wcscoll 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn strcoll
index 65448df47b3fbe8187cff400262247486b97deb8..31282895fdcdf435bf794b0c6d0b2a0b014ae893 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <string.h>
+#include <wchar.h>
+#include <errno.h>
 #include "collate.h"
 
 int
-strcoll(const char *s, const char *s2)
+strcoll_l(const char *s, const char *s2, locale_t loc)
 {
-       int len, len2, prim, prim2, sec, sec2, ret, ret2;
-       const char *t, *t2;
-       char *tt, *tt2;
+       int ret;
+       const wchar_t *t = NULL, *t2 = NULL;
+       int sverrno;
 
-       if (__collate_load_error)
+       NORMALIZE_LOCALE(loc);
+       if (loc->__collate_load_error || (t = __collate_mbstowcs(s, loc)) == NULL || (t2 = __collate_mbstowcs(s2, loc)) == NULL) {
+               sverrno = errno;
+               free((void *)t);
+               free((void *)t2);
+               errno = sverrno;
                return strcmp(s, s2);
-
-       len = len2 = 1;
-       ret = ret2 = 0;
-       if (__collate_substitute_nontrivial) {
-               t = tt = __collate_substitute(s);
-               t2 = tt2 = __collate_substitute(s2);
-       } else {
-               tt = tt2 = NULL;
-               t = s;
-               t2 = s2;
        }
-       while(*t && *t2) {
-               prim = prim2 = 0;
-               while(*t && !prim) {
-                       __collate_lookup(t, &len, &prim, &sec);
-                       t += len;
-               }
-               while(*t2 && !prim2) {
-                       __collate_lookup(t2, &len2, &prim2, &sec2);
-                       t2 += len2;
-               }
-               if(!prim || !prim2)
-                       break;
-               if(prim != prim2) {
-                       ret = prim - prim2;
-                       goto end;
-               }
-               if(!ret2)
-                       ret2 = sec - sec2;
-       }
-       if(!*t && *t2)
-               ret = -(int)((u_char)*t2);
-       else if(*t && !*t2)
-               ret = (u_char)*t;
-       else if(!*t && !*t2)
-               ret = ret2;
-  end:
-       free(tt);
-       free(tt2);
+
+       ret = wcscoll_l(t, t2, loc);
+       sverrno = errno;
+       free((void *)t);
+       free((void *)t2);
+       errno = sverrno;
 
        return ret;
 }
+
+int
+strcoll(const char *s, const char *s2)
+{
+       return strcoll_l(s, s2, __current_locale());
+}
diff --git a/string/FreeBSD/strcoll.c.patch b/string/FreeBSD/strcoll.c.patch
deleted file mode 100644 (file)
index 58fc3c0..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
---- strcoll.c.bsdnew   2009-11-18 18:24:34.000000000 -0800
-+++ strcoll.c  2009-11-18 18:26:43.000000000 -0800
-@@ -28,58 +28,41 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <string.h>
-+#include <wchar.h>
-+#include <errno.h>
- #include "collate.h"
- int
--strcoll(const char *s, const char *s2)
-+strcoll_l(const char *s, const char *s2, locale_t loc)
- {
--      int len, len2, prim, prim2, sec, sec2, ret, ret2;
--      const char *t, *t2;
--      char *tt, *tt2;
-+      int ret;
-+      const wchar_t *t = NULL, *t2 = NULL;
-+      int sverrno;
--      if (__collate_load_error)
-+      NORMALIZE_LOCALE(loc);
-+      if (loc->__collate_load_error || (t = __collate_mbstowcs(s, loc)) == NULL || (t2 = __collate_mbstowcs(s2, loc)) == NULL) {
-+              sverrno = errno;
-+              free((void *)t);
-+              free((void *)t2);
-+              errno = sverrno;
-               return strcmp(s, s2);
--
--      len = len2 = 1;
--      ret = ret2 = 0;
--      if (__collate_substitute_nontrivial) {
--              t = tt = __collate_substitute(s);
--              t2 = tt2 = __collate_substitute(s2);
--      } else {
--              tt = tt2 = NULL;
--              t = s;
--              t2 = s2;
-       }
--      while(*t && *t2) {
--              prim = prim2 = 0;
--              while(*t && !prim) {
--                      __collate_lookup(t, &len, &prim, &sec);
--                      t += len;
--              }
--              while(*t2 && !prim2) {
--                      __collate_lookup(t2, &len2, &prim2, &sec2);
--                      t2 += len2;
--              }
--              if(!prim || !prim2)
--                      break;
--              if(prim != prim2) {
--                      ret = prim - prim2;
--                      goto end;
--              }
--              if(!ret2)
--                      ret2 = sec - sec2;
--      }
--      if(!*t && *t2)
--              ret = -(int)((u_char)*t2);
--      else if(*t && !*t2)
--              ret = (u_char)*t;
--      else if(!*t && !*t2)
--              ret = ret2;
--  end:
--      free(tt);
--      free(tt2);
-+
-+      ret = wcscoll_l(t, t2, loc);
-+      sverrno = errno;
-+      free((void *)t);
-+      free((void *)t2);
-+      errno = sverrno;
-       return ret;
- }
-+
-+int
-+strcoll(const char *s, const char *s2)
-+{
-+      return strcoll_l(s, s2, __current_locale());
-+}
index 4b719be9c56c3c91132554e46fb92cbd3260610b..e1fbdc1bbac76e29a82d43a2e0ad0d5afa480f9c 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn stpcpy "char * restrict dst" "const char * restrict src"
+.Fo stpcpy
+.Fa "char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn stpncpy "char * restrict dst" "const char * restrict src" "size_t len"
+.Fo stpncpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
 .Ft char *
-.Fn strcpy "char * restrict dst" "const char * restrict src"
+.Fo strcpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fc
 .Ft char *
-.Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
+.Fo strncpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn stpcpy
@@ -57,38 +71,41 @@ and
 .Fn strcpy
 functions
 copy the string
-.Fa src
+.Fa s2
 to
-.Fa dst
+.Fa s1
 (including the terminating
 .Ql \e0
-character.)
+character).
 .Pp
 The
 .Fn stpncpy
 and
 .Fn strncpy
 functions copy at most
-.Fa len
+.Fa n
 characters from
-.Fa src
+.Fa s2
 into
-.Fa dst .
+.Fa s1 .
 If
-.Fa src
+.Fa s2
 is less than
-.Fa len
+.Fa n
 characters long,
 the remainder of
-.Fa dst
+.Fa s1
 is filled with
 .Ql \e0
 characters.
 Otherwise,
-.Fa dst
+.Fa s1
 is
 .Em not
 terminated.
+.Pp
+The source and destination strings should not overlap, as the
+behavior is undefined.
 .Sh RETURN VALUES
 The
 .Fn strcpy
@@ -96,7 +113,7 @@ and
 .Fn strncpy
 functions
 return
-.Fa dst .
+.Fa s1 .
 The
 .Fn stpcpy
 and
@@ -104,15 +121,15 @@ and
 functions return a pointer to the terminating
 .Ql \e0
 character of
-.Fa dst .
+.Fa s1 .
 If
 .Fn stpncpy
 does not terminate
-.Fa dst
+.Fa s1
 with a
 .Dv NUL
 character, it instead returns a pointer to
-.Li dst[n]
+.Li s1[n]
 (which does not necessarily refer to a valid memory location.)
 .Sh EXAMPLES
 The following sets
@@ -139,7 +156,7 @@ Note that it does
 .Em not
 .Tn NUL
 terminate
-.Va chararray
+.Va chararray ,
 because the length of the source string is greater than or equal
 to the length argument.
 .Pp
@@ -169,21 +186,26 @@ This could be better achieved using
 as shown in the following example:
 .Pp
 .Dl "(void)strlcpy(buf, input, sizeof(buf));"
-.Pp
-Note that because
-.Xr strlcpy 3
-is not defined in any standards, it should
-only be used when portability is not a concern.
 .Sh SECURITY CONSIDERATIONS
 The
-.Fn strcpy
-function is easily misused in a manner which enables malicious users
+.Fn strcpy ,
+.Fn strncpy ,
+.Fn stpcpy ,
+and
+.Fn stpncpy
+functions are easily misused in a manner which enables malicious users
 to arbitrarily change a running program's functionality through a
 buffer overflow attack.
 (See
 the FSA
 and
 .Sx EXAMPLES . )
+.Pp
+It is recommended that
+.Xr strlcpy 3
+be used instead as a way to avoid such problems.
+.Xr strlcpy 3
+is not defined in any standards, but it has been adopted by most major libc implementations.
 .Sh SEE ALSO
 .Xr bcopy 3 ,
 .Xr memccpy 3 ,
diff --git a/string/FreeBSD/strcpy.3.patch b/string/FreeBSD/strcpy.3.patch
deleted file mode 100644 (file)
index d29e550..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
---- strcpy.3.orig      2010-04-28 23:38:50.000000000 -0700
-+++ strcpy.3   2010-04-29 09:37:17.000000000 -0700
-@@ -43,13 +43,27 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn stpcpy "char * restrict dst" "const char * restrict src"
-+.Fo stpcpy
-+.Fa "char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Ft char *
--.Fn stpncpy "char * restrict dst" "const char * restrict src" "size_t len"
-+.Fo stpncpy
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fc
- .Ft char *
--.Fn strcpy "char * restrict dst" "const char * restrict src"
-+.Fo strcpy
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fc
- .Ft char *
--.Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
-+.Fo strncpy
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn stpcpy
-@@ -57,38 +71,41 @@ and
- .Fn strcpy
- functions
- copy the string
--.Fa src
-+.Fa s2
- to
--.Fa dst
-+.Fa s1
- (including the terminating
- .Ql \e0
--character.)
-+character).
- .Pp
- The
- .Fn stpncpy
- and
- .Fn strncpy
- functions copy at most
--.Fa len
-+.Fa n
- characters from
--.Fa src
-+.Fa s2
- into
--.Fa dst .
-+.Fa s1 .
- If
--.Fa src
-+.Fa s2
- is less than
--.Fa len
-+.Fa n
- characters long,
- the remainder of
--.Fa dst
-+.Fa s1
- is filled with
- .Ql \e0
- characters.
- Otherwise,
--.Fa dst
-+.Fa s1
- is
- .Em not
- terminated.
-+.Pp
-+The source and destination strings should not overlap, as the
-+behavior is undefined.
- .Sh RETURN VALUES
- The
- .Fn strcpy
-@@ -96,7 +113,7 @@ and
- .Fn strncpy
- functions
- return
--.Fa dst .
-+.Fa s1 .
- The
- .Fn stpcpy
- and
-@@ -104,15 +121,15 @@ and
- functions return a pointer to the terminating
- .Ql \e0
- character of
--.Fa dst .
-+.Fa s1 .
- If
- .Fn stpncpy
- does not terminate
--.Fa dst
-+.Fa s1
- with a
- .Dv NUL
- character, it instead returns a pointer to
--.Li dst[n]
-+.Li s1[n]
- (which does not necessarily refer to a valid memory location.)
- .Sh EXAMPLES
- The following sets
-@@ -139,7 +156,7 @@ Note that it does
- .Em not
- .Tn NUL
- terminate
--.Va chararray
-+.Va chararray ,
- because the length of the source string is greater than or equal
- to the length argument.
- .Pp
-@@ -169,21 +186,26 @@ This could be better achieved using
- as shown in the following example:
- .Pp
- .Dl "(void)strlcpy(buf, input, sizeof(buf));"
--.Pp
--Note that because
--.Xr strlcpy 3
--is not defined in any standards, it should
--only be used when portability is not a concern.
- .Sh SECURITY CONSIDERATIONS
- The
--.Fn strcpy
--function is easily misused in a manner which enables malicious users
-+.Fn strcpy ,
-+.Fn strncpy ,
-+.Fn stpcpy ,
-+and
-+.Fn stpncpy
-+functions are easily misused in a manner which enables malicious users
- to arbitrarily change a running program's functionality through a
- buffer overflow attack.
- (See
- the FSA
- and
- .Sx EXAMPLES . )
-+.Pp
-+It is recommended that
-+.Xr strlcpy 3
-+be used instead as a way to avoid such problems.
-+.Xr strlcpy 3
-+is not defined in any standards, but it has been adopted by most major libc implementations.
- .Sh SEE ALSO
- .Xr bcopy 3 ,
- .Xr memccpy 3 ,
diff --git a/string/FreeBSD/strcpy.c b/string/FreeBSD/strcpy.c
deleted file mode 100644 (file)
index 7489997..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcpy.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strcpy.c,v 1.8 2007/01/09 00:28:12 imp Exp $");
-
-#include <string.h>
-
-char *
-strcpy(char * __restrict to, const char * __restrict from)
-{
-       char *save = to;
-
-       for (; (*to = *from); ++from, ++to);
-       return(save);
-}
index dc57aa1c28b7be1350bbb2f67711d33820899385..938f80b415fcac11fd1d9d0b341b0aff76710100 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft size_t
-.Fn strcspn "const char *s" "const char *charset"
+.Fo strcspn
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strcspn
 function
 spans the initial part of the null-terminated string
-.Fa s
+.Fa s1 ,
 as long as the characters from
-.Fa s
+.Fa s1
 do not occur in string
-.Fa charset
+.Fa s2
 (it
 spans the
 .Em complement
 of
-.Fa charset ) .
+.Fa s2 ) .
 In other words, it computes the string array index in
-.Fa s
+.Fa s1
 of the first character of
-.Fa s
+.Fa s1
 which is also in
-.Fa charset ,
+.Fa s2 ,
 else the index of the first null character.
 .Sh RETURN VALUES
 The
diff --git a/string/FreeBSD/strcspn.3.patch b/string/FreeBSD/strcspn.3.patch
deleted file mode 100644 (file)
index 22519f0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
---- strcspn.3.orig     2009-11-30 13:52:23.000000000 -0800
-+++ strcspn.3  2009-11-30 14:57:01.000000000 -0800
-@@ -43,28 +43,31 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft size_t
--.Fn strcspn "const char *s" "const char *charset"
-+.Fo strcspn
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strcspn
- function
- spans the initial part of the null-terminated string
--.Fa s
-+.Fa s1 ,
- as long as the characters from
--.Fa s
-+.Fa s1
- do not occur in string
--.Fa charset
-+.Fa s2
- (it
- spans the
- .Em complement
- of
--.Fa charset ) .
-+.Fa s2 ) .
- In other words, it computes the string array index in
--.Fa s
-+.Fa s1
- of the first character of
--.Fa s
-+.Fa s1
- which is also in
--.Fa charset ,
-+.Fa s2 ,
- else the index of the first null character.
- .Sh RETURN VALUES
- The
index b9bf40c81e1ffcd441eda4a658f9c9a3cfa1958d..688d3176594ab7d1a5e12eec24f9e5d7961fc075 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn strdup "const char *str"
+.Fo strdup
+.Fa "const char *s1"
+.Fc
 .Ft char *
-.Fn strndup "const char *str" "size_t len"
+.Fo strndup
+.Fa "const char *s1"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strdup
 function
 allocates sufficient memory for a copy
 of the string
-.Fa str ,
+.Fa s1 ,
 does the copy, and returns a pointer to it.
 The pointer may subsequently be used as an
 argument to the function
@@ -63,16 +68,15 @@ is set to
 The
 .Fn strndup
 function copies at most
-.Fa len
+.Fa n
 characters from the string
-.Fa str
+.Fa s1
 always
 .Dv NUL
 terminating the copied string.
 .Sh SEE ALSO
 .Xr free 3 ,
-.Xr malloc 3 ,
-.Xr wcsdup 3
+.Xr malloc 3
 .Sh HISTORY
 The
 .Fn strdup
diff --git a/string/FreeBSD/strdup.3.patch b/string/FreeBSD/strdup.3.patch
deleted file mode 100644 (file)
index 5ef2029..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
---- strdup.3.orig      2009-11-30 13:52:20.000000000 -0800
-+++ strdup.3   2009-11-30 15:13:21.000000000 -0800
-@@ -40,16 +40,21 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn strdup "const char *str"
-+.Fo strdup
-+.Fa "const char *s1"
-+.Fc
- .Ft char *
--.Fn strndup "const char *str" "size_t len"
-+.Fo strndup
-+.Fa "const char *s1"
-+.Fa "size_t n"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strdup
- function
- allocates sufficient memory for a copy
- of the string
--.Fa str ,
-+.Fa s1 ,
- does the copy, and returns a pointer to it.
- The pointer may subsequently be used as an
- argument to the function
-@@ -63,16 +68,15 @@ is set to
- The
- .Fn strndup
- function copies at most
--.Fa len
-+.Fa n
- characters from the string
--.Fa str
-+.Fa s1
- always
- .Dv NUL
- terminating the copied string.
- .Sh SEE ALSO
- .Xr free 3 ,
--.Xr malloc 3 ,
--.Xr wcsdup 3
-+.Xr malloc 3
- .Sh HISTORY
- The
- .Fn strdup
index b8223d20dc3c75db2dd9320df9a9027535c174f0..f6f7510d64bf0abe539d22eafb1ff8f956c9baa7 100644 (file)
 .Sh SYNOPSIS
 .In stdio.h
 .Ft void
-.Fn perror "const char *string"
+.Fo perror
+.Fa "const char *s"
+.Fc
 .Vt extern const char * const sys_errlist[] ;
 .Vt extern const int sys_nerr ;
 .In string.h
 .Ft "char *"
-.Fn strerror "int errnum"
+.Fo strerror
+.Fa "int errnum"
+.Fc
 .Ft int
-.Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen"
+.Fo strerror_r
+.Fa "int errnum"
+.Fa "char *strerrbuf"
+.Fa "size_t buflen"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strerror ,
-.Fn strerror_r
+.Fn strerror_r ,
 and
 .Fn perror
 functions look up the error message string corresponding to an
@@ -88,7 +96,7 @@ value of the global variable
 and writes it, followed by a newline, to the
 standard error file descriptor.
 If the argument
-.Fa string
+.Fa s
 is
 .Pf non- Dv NULL
 and does not point to the null character,
@@ -110,7 +118,7 @@ functions return
 .Er EINVAL
 as a warning.
 Error numbers recognized by this implementation fall in
-the range 0 <
+the range 0 <=
 .Fa errnum
 <
 .Fa sys_nerr .
diff --git a/string/FreeBSD/strerror.3.patch b/string/FreeBSD/strerror.3.patch
deleted file mode 100644 (file)
index 3f34cd9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
---- strerror.3.orig    2010-10-07 16:06:39.000000000 -0700
-+++ strerror.3 2010-10-07 16:32:34.000000000 -0700
-@@ -47,18 +47,26 @@
- .Sh SYNOPSIS
- .In stdio.h
- .Ft void
--.Fn perror "const char *string"
-+.Fo perror
-+.Fa "const char *s"
-+.Fc
- .Vt extern const char * const sys_errlist[] ;
- .Vt extern const int sys_nerr ;
- .In string.h
- .Ft "char *"
--.Fn strerror "int errnum"
-+.Fo strerror
-+.Fa "int errnum"
-+.Fc
- .Ft int
--.Fn strerror_r "int errnum" "char *strerrbuf" "size_t buflen"
-+.Fo strerror_r
-+.Fa "int errnum"
-+.Fa "char *strerrbuf"
-+.Fa "size_t buflen"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strerror ,
--.Fn strerror_r
-+.Fn strerror_r ,
- and
- .Fn perror
- functions look up the error message string corresponding to an
-@@ -88,7 +96,7 @@
- and writes it, followed by a newline, to the
- standard error file descriptor.
- If the argument
--.Fa string
-+.Fa s
- is
- .Pf non- Dv NULL
- and does not point to the null character,
-@@ -110,7 +118,7 @@
- .Er EINVAL
- as a warning.
- Error numbers recognized by this implementation fall in
--the range 0 <
-+the range 0 <=
- .Fa errnum
- <
- .Fa sys_nerr .
index 7da979614eaaf3de5b8fb91e638609ead9857099..63e81019947f0f37873fedbbc145c34c20e50c4b 100644 (file)
@@ -52,12 +52,13 @@ __FBSDID("$FreeBSD: src/lib/libc/string/strerror.c,v 1.16 2007/01/09 00:28:12 im
  */
 #define        EBUFSIZE        (20 + 2 + sizeof(UPREFIX))
 
+#ifndef BUILDING_VARIANT
 /*
  * Doing this by hand instead of linking with stdio(3) avoids bloat for
  * statically linked binaries.
  */
-static void
-errstr(int num, char *uprefix, char *buf, size_t len)
+__private_extern__ void
+__errstr(int num, char *uprefix, char *buf, size_t len)
 {
        char *t;
        unsigned int uerr;
@@ -87,8 +88,8 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen)
        catd = catopen("libc", NL_CAT_LOCALE);
 #endif
 
-       if (errnum < 1 || errnum >= sys_nerr) {
-               errstr(errnum,
+       if (errnum < 0 || errnum >= sys_nerr) {
+               __errstr(errnum,
 #if defined(NLS)
                        catgets(catd, 1, 0xffff, UPREFIX),
 #else
@@ -114,13 +115,20 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen)
 
        return (retval);
 }
+#else /* BUILDING_VARIANT */
+__private_extern__ void __errstr(int, char *, size_t);
+#endif /* !BUILDING_VARIANT */
 
 char *
 strerror(int num)
 {
        static char ebuf[NL_TEXTMAX];
 
+#if !__DARWIN_UNIX03
        if (strerror_r(num, ebuf, sizeof(ebuf)) != 0)
        errno = EINVAL;
+#else
+       (void)strerror_r(num, ebuf, sizeof(ebuf));
+#endif
        return (ebuf);
 }
diff --git a/string/FreeBSD/strerror.c.patch b/string/FreeBSD/strerror.c.patch
deleted file mode 100644 (file)
index 0b88960..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
---- strerror.c.orig    2010-10-07 16:06:39.000000000 -0700
-+++ strerror.c 2010-10-07 16:17:59.000000000 -0700
-@@ -52,12 +52,13 @@ __FBSDID("$FreeBSD: src/lib/libc/string/
-  */
- #define       EBUFSIZE        (20 + 2 + sizeof(UPREFIX))
-+#ifndef BUILDING_VARIANT
- /*
-  * Doing this by hand instead of linking with stdio(3) avoids bloat for
-  * statically linked binaries.
-  */
--static void
--errstr(int num, char *uprefix, char *buf, size_t len)
-+__private_extern__ void
-+__errstr(int num, char *uprefix, char *buf, size_t len)
- {
-       char *t;
-       unsigned int uerr;
-@@ -87,8 +88,8 @@ strerror_r(int errnum, char *strerrbuf, 
-       catd = catopen("libc", NL_CAT_LOCALE);
- #endif
--      if (errnum < 1 || errnum >= sys_nerr) {
--              errstr(errnum,
-+      if (errnum < 0 || errnum >= sys_nerr) {
-+              __errstr(errnum,
- #if defined(NLS)
-                       catgets(catd, 1, 0xffff, UPREFIX),
- #else
-@@ -114,13 +115,20 @@ strerror_r(int errnum, char *strerrbuf, 
-       return (retval);
- }
-+#else /* BUILDING_VARIANT */
-+__private_extern__ void __errstr(int, char *, size_t);
-+#endif /* !BUILDING_VARIANT */
- char *
- strerror(int num)
- {
-       static char ebuf[NL_TEXTMAX];
-+#if !__DARWIN_UNIX03
-       if (strerror_r(num, ebuf, sizeof(ebuf)) != 0)
-       errno = EINVAL;
-+#else
-+      (void)strerror_r(num, ebuf, sizeof(ebuf));
-+#endif
-       return (ebuf);
- }
index 05f92f229b8554961d37fa151823c8e98a8bd6db..7f8f9ad5f551d2e298d54fc2863016d881ab7c1a 100644 (file)
 .Dt STRING 3
 .Os
 .Sh NAME
+.Nm index ,
+.Nm rindex ,
 .Nm stpcpy ,
+.Nm strcasecmp ,
 .Nm strcat ,
-.Nm strncat ,
 .Nm strchr ,
-.Nm strrchr ,
 .Nm strcmp ,
-.Nm strncmp ,
-.Nm strcasecmp ,
-.Nm strncasecmp ,
 .Nm strcpy ,
-.Nm strncpy ,
+.Nm strcspn ,
 .Nm strerror ,
 .Nm strlen ,
+.Nm strncasecmp ,
+.Nm strncat ,
+.Nm strncmp ,
+.Nm strncpy ,
 .Nm strpbrk ,
+.Nm strrchr ,
 .Nm strsep ,
 .Nm strspn ,
-.Nm strcspn ,
 .Nm strstr ,
-.Nm strtok ,
-.Nm index ,
-.Nm rindex
+.Nm strtok
 .Nd string specific functions
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In string.h
+.In strings.h
 .Ft char *
-.Fn stpcpy "char *dst" "const char *src"
+.Fo index
+.Fa "const char *s"
+.Fa "int c"
+.Fc
 .Ft char *
-.Fn strcat "char *s" "const char * append"
+.Fo rindex
+.Fa "const char *s"
+.Fa "int c"
+.Fc
+.Ft int
+.Fo strcasecmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
+.Ft int
+.Fo strncasecmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fc
+.In string.h
 .Ft char *
-.Fn strncat "char *s" "const char *append" "size_t count"
+.Fo stpcpy
+.Fa "char *dst"
+.Fa "const char *src"
+.Fc
 .Ft char *
-.Fn strchr "const char *s" "int c"
+.Fo strcat
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fc
 .Ft char *
-.Fn strrchr "const char *s" "int c"
-.Ft int
-.Fn strcmp "const char *s1" "const char *s2"
-.Ft int
-.Fn strncmp "const char *s1" "const char *s2" "size_t count"
-.Ft int
-.Fn strcasecmp "const char *s1" "const char *s2"
+.Fo strchr
+.Fa "const char *s"
+.Fa "int c"
+.Fc
 .Ft int
-.Fn strncasecmp "const char *s1" "const char *s2" "size_t count"
+.Fo strcmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn strcpy "char *dst" "const char *src"
-.Ft char *
-.Fn strncpy "char *dst" "const char *src" "size_t count"
+.Fo strcpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fc
+.Ft size_t
+.Fo strcspn
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn strerror "int errno"
+.Fo strerror
+.Fa "int errnum"
+.Fc
 .Ft size_t
-.Fn strlen "const char *s"
+.Fo strlen
+.Fa "const char *s"
+.Fc
 .Ft char *
-.Fn strpbrk "const char *s" "const char *charset"
+.Fo strncat
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
+.Ft int
+.Fo strncmp
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fc
 .Ft char *
-.Fn strsep "char **stringp" "const char *delim"
-.Ft size_t
-.Fn strspn "const char *s" "const char *charset"
-.Ft size_t
-.Fn strcspn "const char *s" "const char *charset"
+.Fo strncpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
+.Ft char *
+.Fo strpbrk
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn strstr "const char *big" "const char *little"
+.Fo strrchr
+.Fa "const char *s"
+.Fa "int c"
+.Fc
 .Ft char *
-.Fn strtok "char *s" "const char *delim"
+.Fo strsep
+.Fa "char **stringp"
+.Fa "const char *delim"
+.Fc
+.Ft size_t
+.Fo strspn
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn index "const char *s" "int c"
+.Fo strstr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn rindex "const char *s" "int c"
+.Fo strtok
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fc
 .Sh DESCRIPTION
 The string
-functions manipulate strings terminated by a
+functions manipulate strings that are terminated by a
 null byte.
 .Pp
 See the specific manual pages for more information.
diff --git a/string/FreeBSD/string.3.patch b/string/FreeBSD/string.3.patch
deleted file mode 100644 (file)
index ca6f33d..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
---- string.3.bsdnew    2009-11-18 18:24:34.000000000 -0800
-+++ string.3   2009-11-18 18:24:34.000000000 -0800
-@@ -34,77 +34,143 @@
- .Dt STRING 3
- .Os
- .Sh NAME
-+.Nm index ,
-+.Nm rindex ,
- .Nm stpcpy ,
-+.Nm strcasecmp ,
- .Nm strcat ,
--.Nm strncat ,
- .Nm strchr ,
--.Nm strrchr ,
- .Nm strcmp ,
--.Nm strncmp ,
--.Nm strcasecmp ,
--.Nm strncasecmp ,
- .Nm strcpy ,
--.Nm strncpy ,
-+.Nm strcspn ,
- .Nm strerror ,
- .Nm strlen ,
-+.Nm strncasecmp ,
-+.Nm strncat ,
-+.Nm strncmp ,
-+.Nm strncpy ,
- .Nm strpbrk ,
-+.Nm strrchr ,
- .Nm strsep ,
- .Nm strspn ,
--.Nm strcspn ,
- .Nm strstr ,
--.Nm strtok ,
--.Nm index ,
--.Nm rindex
-+.Nm strtok
- .Nd string specific functions
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
--.In string.h
-+.In strings.h
- .Ft char *
--.Fn stpcpy "char *dst" "const char *src"
--.Ft char *
--.Fn strcat "char *s" "const char * append"
--.Ft char *
--.Fn strncat "char *s" "const char *append" "size_t count"
--.Ft char *
--.Fn strchr "const char *s" "int c"
--.Ft char *
--.Fn strrchr "const char *s" "int c"
--.Ft int
--.Fn strcmp "const char *s1" "const char *s2"
-+.Fo index
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
-+.Ft char *
-+.Fo rindex
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
- .Ft int
--.Fn strncmp "const char *s1" "const char *s2" "size_t count"
-+.Fo strcasecmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Ft int
--.Fn strcasecmp "const char *s1" "const char *s2"
--.Ft int
--.Fn strncasecmp "const char *s1" "const char *s2" "size_t count"
--.Ft char *
--.Fn strcpy "char *dst" "const char *src"
--.Ft char *
--.Fn strncpy "char *dst" "const char *src" "size_t count"
-+.Fo strncasecmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "size_t n"
-+.Fc
-+.In string.h
- .Ft char *
--.Fn strerror "int errno"
-+.Fo stpcpy
-+.Fa "char *dst"
-+.Fa "const char *src"
-+.Fc
-+.Ft char *
-+.Fo strcat
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fc
-+.Ft char *
-+.Fo strchr
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
-+.Ft int
-+.Fo strcmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.Ft char *
-+.Fo strcpy
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fc
- .Ft size_t
--.Fn strlen "const char *s"
--.Ft char *
--.Fn strpbrk "const char *s" "const char *charset"
--.Ft char *
--.Fn strsep "char **stringp" "const char *delim"
-+.Fo strcspn
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.Ft char *
-+.Fo strerror
-+.Fa "int errnum"
-+.Fc
- .Ft size_t
--.Fn strspn "const char *s" "const char *charset"
-+.Fo strlen
-+.Fa "const char *s"
-+.Fc
-+.Ft char *
-+.Fo strncat
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fc
-+.Ft int
-+.Fo strncmp
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "size_t n"
-+.Fc
-+.Ft char *
-+.Fo strncpy
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fc
-+.Ft char *
-+.Fo strpbrk
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.Ft char *
-+.Fo strrchr
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
-+.Ft char *
-+.Fo strsep
-+.Fa "char **stringp"
-+.Fa "const char *delim"
-+.Fc
- .Ft size_t
--.Fn strcspn "const char *s" "const char *charset"
--.Ft char *
--.Fn strstr "const char *big" "const char *little"
--.Ft char *
--.Fn strtok "char *s" "const char *delim"
--.Ft char *
--.Fn index "const char *s" "int c"
--.Ft char *
--.Fn rindex "const char *s" "int c"
-+.Fo strspn
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.Ft char *
-+.Fo strstr
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.Ft char *
-+.Fo strtok
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fc
- .Sh DESCRIPTION
- The string
--functions manipulate strings terminated by a
-+functions manipulate strings that are terminated by a
- null byte.
- .Pp
- See the specific manual pages for more information.
diff --git a/string/FreeBSD/strlcat.c b/string/FreeBSD/strlcat.c
deleted file mode 100644 (file)
index deec7d7..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*     $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $      */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strlcat.c,v 1.12 2009/02/28 05:15:02 das Exp $");
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left).  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
- * If retval >= siz, truncation occurred.
- */
-size_t
-strlcat(char * __restrict dst, const char * __restrict src, size_t siz)
-{
-       char *d = dst;
-       const char *s = src;
-       size_t n = siz;
-       size_t dlen;
-
-       /* Find the end of dst and adjust bytes left but don't go past end */
-       while (n-- != 0 && *d != '\0')
-               d++;
-       dlen = d - dst;
-       n = siz - dlen;
-
-       if (n == 0)
-               return(dlen + strlen(s));
-       while (*s != '\0') {
-               if (n != 1) {
-                       *d++ = *s;
-                       n--;
-               }
-               s++;
-       }
-       *d = '\0';
-
-       return(dlen + (s - src));       /* count does not include NUL */
-}
index 1afd8d81032f0839a49b89f33376edfb6331ec29..3cf8bc203f0d8b518d650e2b0ed220fbcada0c8e 100644 (file)
@@ -103,6 +103,9 @@ to the end of
 It will append at most
 .Fa size
 - strlen(dst) - 1 bytes, NUL-terminating the result.
+.Pp
+The source and destination strings should not overlap, as the
+behavior is undefined.
 .Sh RETURN VALUES
 The
 .Fn strlcpy
diff --git a/string/FreeBSD/strlcpy.3.patch b/string/FreeBSD/strlcpy.3.patch
deleted file mode 100644 (file)
index e008fc6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- strlcpy.3.bsdnew   2009-11-18 18:24:34.000000000 -0800
-+++ strlcpy.3  2009-11-18 18:24:34.000000000 -0800
-@@ -103,6 +103,9 @@ to the end of
- It will append at most
- .Fa size
- - strlen(dst) - 1 bytes, NUL-terminating the result.
-+.Pp
-+The source and destination strings should not overlap, as the
-+behavior is undefined.
- .Sh RETURN VALUES
- The
- .Fn strlcpy
diff --git a/string/FreeBSD/strlcpy.c b/string/FreeBSD/strlcpy.c
deleted file mode 100644 (file)
index 082ea3f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*     $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $    */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strlcpy.c,v 1.11 2009/02/28 05:15:02 das Exp $");
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz.  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t
-strlcpy(char * __restrict dst, const char * __restrict src, size_t siz)
-{
-       char *d = dst;
-       const char *s = src;
-       size_t n = siz;
-
-       /* Copy as many bytes as will fit */
-       if (n != 0) {
-               while (--n != 0) {
-                       if ((*d++ = *s++) == '\0')
-                               break;
-               }
-       }
-
-       /* Not enough room in dst, add NUL and traverse rest of src */
-       if (n == 0) {
-               if (siz != 0)
-                       *d = '\0';              /* NUL-terminate dst */
-               while (*s++)
-                       ;
-       }
-
-       return(s - src - 1);    /* count does not include NUL */
-}
index 81269a2c25ac712205f0ed5e35b749cc5d512842..66c9c6cb8e5189d7215492e151420c14a2bb23ca 100644 (file)
@@ -27,7 +27,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/strlen.c,v 1.7 2009/01/26 07:31:28 delphij Exp $");
 
-#include <sys/limits.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <string.h>
 
index 4537bc9f5b68e9aed79f0f89d4882d6000480e01..704224ee88d5221556c8ff0d72fcfe1ee9adfded 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft void
-.Fn strmode "mode_t mode" "char *bp"
+.Fo strmode
+.Fa "int mode"
+.Fa "char *bp"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strmode
diff --git a/string/FreeBSD/strmode.3.patch b/string/FreeBSD/strmode.3.patch
deleted file mode 100644 (file)
index 889c378..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- strmode.3.bsdnew   2009-11-18 18:24:34.000000000 -0800
-+++ strmode.3  2009-11-18 18:24:35.000000000 -0800
-@@ -39,7 +39,10 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft void
--.Fn strmode "mode_t mode" "char *bp"
-+.Fo strmode
-+.Fa "int mode"
-+.Fa "char *bp"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strmode
diff --git a/string/FreeBSD/strncat.c b/string/FreeBSD/strncat.c
deleted file mode 100644 (file)
index a9b5d7c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncat.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strncat.c,v 1.7 2007/01/09 00:28:12 imp Exp $");
-
-#include <string.h>
-
-/*
- * Concatenate src on the end of dst.  At most strlen(dst)+n+1 bytes
- * are written at dst (at most n+1 bytes being appended).  Return dst.
- */
-char *
-strncat(char * __restrict dst, const char * __restrict src, size_t n)
-{
-       if (n != 0) {
-               char *d = dst;
-               const char *s = src;
-
-               while (*d != 0)
-                       d++;
-               do {
-                       if ((*d = *s++) == 0)
-                               break;
-                       d++;
-               } while (--n != 0);
-               *d = 0;
-       }
-       return (dst);
-}
diff --git a/string/FreeBSD/strncpy.c b/string/FreeBSD/strncpy.c
deleted file mode 100644 (file)
index c2e11f9..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncpy.c  8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strncpy.c,v 1.8 2009/02/03 17:58:20 danger Exp $");
-
-#include <string.h>
-
-/*
- * Copy src to dst, truncating or null-padding to always copy n bytes.
- * Return dst.
- */
-char *
-strncpy(char * __restrict dst, const char * __restrict src, size_t n)
-{
-       if (n != 0) {
-               char *d = dst;
-               const char *s = src;
-
-               do {
-                       if ((*d++ = *s++) == '\0') {
-                               /* NUL pad the remaining n-1 bytes */
-                               while (--n != 0)
-                                       *d++ = '\0';
-                               break;
-                       }
-               } while (--n != 0);
-       }
-       return (dst);
-}
index 105febe0e6d5e1f5ac56f01195752462731cf05a..30db8c21dff57c44153d9cda2876de58f23b55e4 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn strpbrk "const char *s" "const char *charset"
+.Fo strpbrk
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strpbrk
 function
 locates in the null-terminated string
-.Fa s
+.Fa s1
 the first occurrence of any character in the string
-.Fa charset
-and returns a pointer to this character.
+.Fa s2 ,
+returning a pointer to this character.
 If no characters from
-.Fa charset
+.Fa s2
 occur anywhere in
-.Fa s
+.Fa s1 ,
 .Fn strpbrk
 returns NULL.
 .Sh SEE ALSO
diff --git a/string/FreeBSD/strpbrk.3.patch b/string/FreeBSD/strpbrk.3.patch
deleted file mode 100644 (file)
index cd2c7b6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- strpbrk.3.bsdnew   2009-11-18 18:24:36.000000000 -0800
-+++ strpbrk.3  2009-11-18 18:24:36.000000000 -0800
-@@ -43,20 +43,23 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn strpbrk "const char *s" "const char *charset"
-+.Fo strpbrk
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strpbrk
- function
- locates in the null-terminated string
--.Fa s
-+.Fa s1
- the first occurrence of any character in the string
--.Fa charset
--and returns a pointer to this character.
-+.Fa s2 ,
-+returning a pointer to this character.
- If no characters from
--.Fa charset
-+.Fa s2
- occur anywhere in
--.Fa s
-+.Fa s1 ,
- .Fn strpbrk
- returns NULL.
- .Sh SEE ALSO
diff --git a/string/FreeBSD/strrchr.3 b/string/FreeBSD/strrchr.3
deleted file mode 100644 (file)
index 785cbbf..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strrchr.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strrchr.3,v 1.9 2001/10/01 16:09:00 ru Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRRCHR 3
-.Os
-.Sh NAME
-.Nm strrchr
-.Nd locate character in string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fn strrchr "const char *s" "int c"
-.Sh DESCRIPTION
-The
-.Fn strrchr
-function
-locates the last occurrence of
-.Fa c
-(converted to a char)
-in the string
-.Fa s .
-If
-.Fa c
-is
-.Ql \e0 ,
-.Fn strrchr
-locates the terminating
-.Ql \e0 .
-.Sh RETURN VALUES
-The
-.Fn strrchr
-function
-returns a pointer to the character,
-or a null
-pointer if
-.Fa c
-does not occur anywhere in
-.Fa s .
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh STANDARDS
-The
-.Fn strrchr
-function
-conforms to
-.St -isoC .
diff --git a/string/FreeBSD/strrchr.3.patch b/string/FreeBSD/strrchr.3.patch
deleted file mode 100644 (file)
index 2e8fe81..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- _SB/Libc/string/FreeBSD/strrchr.3  2003-05-20 15:23:55.000000000 -0700
-+++ _SB/Libc/string/FreeBSD/strrchr.3.edit     2006-06-28 16:55:53.000000000 -0700
-@@ -47,7 +47,10 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn strrchr "const char *s" "int c"
-+.Fo strrchr
-+.Fa "const char *s"
-+.Fa "int c"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strrchr
diff --git a/string/FreeBSD/strrchr.c.patch b/string/FreeBSD/strrchr.c.patch
deleted file mode 100644 (file)
index d31740f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---- strrchr.c.orig     Fri Mar 22 13:53:19 2002
-+++ strrchr.c  Sat May  3 14:34:24 2003
-@@ -2,4 +2,4 @@
- __FBSDID("$FreeBSD: src/lib/libc/string/strrchr.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
- #define       STRRCHR
--#include "rindex.c"
-+#include "rindex-fbsd.c"
index b5453a1130dd6c23304a0e0fecc9833a2df1a0d9..7806d63b35456e8e41fbc8748ecc3b69650ff5e5 100644 (file)
@@ -47,8 +47,6 @@ __FBSDID("$FreeBSD: src/lib/libc/string/strsignal.c,v 1.9 2010/01/24 10:35:26 um
 
 #define        UPREFIX         "Unknown signal"
 
-static char            sig_ebuf[NL_TEXTMAX];
-static char            sig_ebuf_err[NL_TEXTMAX];
 static once_t          sig_init_once = ONCE_INITIALIZER;
 static thread_key_t    sig_key;
 static int             sig_keycreated = 0;
@@ -64,25 +62,19 @@ sig_tlsalloc(void)
 {
        char *ebuf = NULL;
 
-       if (thr_main() != 0)
-               ebuf = sig_ebuf;
-       else {
-               if (thr_once(&sig_init_once, sig_keycreate) != 0 ||
-                   !sig_keycreated)
+       if (thr_once(&sig_init_once, sig_keycreate) != 0 ||
+           !sig_keycreated)
+               goto thr_err;
+       if ((ebuf = thr_getspecific(sig_key)) == NULL) {
+               if ((ebuf = malloc(NL_TEXTMAX * sizeof(char))) == NULL)
+                       goto thr_err;
+               if (thr_setspecific(sig_key, ebuf) != 0) {
+                       free(ebuf);
+                       ebuf = NULL;
                        goto thr_err;
-               if ((ebuf = thr_getspecific(sig_key)) == NULL) {
-                       if ((ebuf = malloc(sizeof(sig_ebuf))) == NULL)
-                               goto thr_err;
-                       if (thr_setspecific(sig_key, ebuf) != 0) {
-                               free(ebuf);
-                               ebuf = NULL;
-                               goto thr_err;
-                       }
                }
        }
 thr_err:
-       if (ebuf == NULL)
-               ebuf = sig_ebuf_err;
        return (ebuf);
 }
 
@@ -103,15 +95,19 @@ strsignal(int num)
 #endif
 
        ebuf = sig_tlsalloc();
+       if(ebuf == NULL) {
+               errno = ENOMEM;
+               return NULL;
+       }
 
-       if (num > 0 && num < sys_nsig) {
+       if (num > 0 && num < NSIG) {
                n = strlcpy(ebuf,
 #if defined(NLS)
                        catgets(catd, 2, num, sys_siglist[num]),
 #else
                        sys_siglist[num],
 #endif
-                       sizeof(sig_ebuf));
+                       NL_TEXTMAX * sizeof(char));
        } else {
                n = strlcpy(ebuf,
 #if defined(NLS)
@@ -119,7 +115,7 @@ strsignal(int num)
 #else
                        UPREFIX,
 #endif
-                       sizeof(sig_ebuf));
+                       NL_TEXTMAX * sizeof(char));
        }
 
        signum = num;
diff --git a/string/FreeBSD/strsignal.c.patch b/string/FreeBSD/strsignal.c.patch
deleted file mode 100644 (file)
index 4df57ad..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
---- strsignal.c.orig   2010-01-24 02:35:26.000000000 -0800
-+++ strsignal.c        2010-05-06 12:29:53.000000000 -0700
-@@ -47,8 +47,6 @@ __FBSDID("$FreeBSD: src/lib/libc/string/
- #define       UPREFIX         "Unknown signal"
--static char           sig_ebuf[NL_TEXTMAX];
--static char           sig_ebuf_err[NL_TEXTMAX];
- static once_t         sig_init_once = ONCE_INITIALIZER;
- static thread_key_t   sig_key;
- static int            sig_keycreated = 0;
-@@ -64,25 +62,19 @@ sig_tlsalloc(void)
- {
-       char *ebuf = NULL;
--      if (thr_main() != 0)
--              ebuf = sig_ebuf;
--      else {
--              if (thr_once(&sig_init_once, sig_keycreate) != 0 ||
--                  !sig_keycreated)
-+      if (thr_once(&sig_init_once, sig_keycreate) != 0 ||
-+          !sig_keycreated)
-+              goto thr_err;
-+      if ((ebuf = thr_getspecific(sig_key)) == NULL) {
-+              if ((ebuf = malloc(NL_TEXTMAX * sizeof(char))) == NULL)
-+                      goto thr_err;
-+              if (thr_setspecific(sig_key, ebuf) != 0) {
-+                      free(ebuf);
-+                      ebuf = NULL;
-                       goto thr_err;
--              if ((ebuf = thr_getspecific(sig_key)) == NULL) {
--                      if ((ebuf = malloc(sizeof(sig_ebuf))) == NULL)
--                              goto thr_err;
--                      if (thr_setspecific(sig_key, ebuf) != 0) {
--                              free(ebuf);
--                              ebuf = NULL;
--                              goto thr_err;
--                      }
-               }
-       }
- thr_err:
--      if (ebuf == NULL)
--              ebuf = sig_ebuf_err;
-       return (ebuf);
- }
-@@ -103,15 +95,19 @@ strsignal(int num)
- #endif
-       ebuf = sig_tlsalloc();
-+      if(ebuf == NULL) {
-+              errno = ENOMEM;
-+              return NULL;
-+      }
--      if (num > 0 && num < sys_nsig) {
-+      if (num > 0 && num < NSIG) {
-               n = strlcpy(ebuf,
- #if defined(NLS)
-                       catgets(catd, 2, num, sys_siglist[num]),
- #else
-                       sys_siglist[num],
- #endif
--                      sizeof(sig_ebuf));
-+                      NL_TEXTMAX * sizeof(char));
-       } else {
-               n = strlcpy(ebuf,
- #if defined(NLS)
-@@ -119,7 +115,7 @@ strsignal(int num)
- #else
-                       UPREFIX,
- #endif
--                      sizeof(sig_ebuf));
-+                      NL_TEXTMAX * sizeof(char));
-       }
-       signum = num;
index a976bf9f9352dfef1d74823998391819292e4e9f..fcd199c1f1eacb069a8bacdb58879a50e113fe93 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft size_t
-.Fn strspn "const char *s" "const char *charset"
+.Fo strspn
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strspn
 function
 spans the initial part of the null-terminated string
-.Fa s
+.Fa s1 ,
 as long as the characters from
-.Fa s
+.Fa s1
 occur in the null-terminated string
-.Fa charset .
+.Fa s2 .
 In other words, it computes the string array index in
-.Fa s
+.Fa s1
 of the first character of
-.Fa s
+.Fa s1
 which is not in
-.Fa charset ,
+.Fa s2 ,
 else the index of the first null character.
 .Sh RETURN VALUES
 The
diff --git a/string/FreeBSD/strspn.3.patch b/string/FreeBSD/strspn.3.patch
deleted file mode 100644 (file)
index a161f12..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---- strspn.3.bsdnew    2009-11-30 13:52:24.000000000 -0800
-+++ strspn.3   2009-11-30 14:55:45.000000000 -0800
-@@ -43,23 +43,26 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft size_t
--.Fn strspn "const char *s" "const char *charset"
-+.Fo strspn
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strspn
- function
- spans the initial part of the null-terminated string
--.Fa s
-+.Fa s1 ,
- as long as the characters from
--.Fa s
-+.Fa s1
- occur in the null-terminated string
--.Fa charset .
-+.Fa s2 .
- In other words, it computes the string array index in
--.Fa s
-+.Fa s1
- of the first character of
--.Fa s
-+.Fa s1
- which is not in
--.Fa charset ,
-+.Fa s2 ,
- else the index of the first null character.
- .Sh RETURN VALUES
- The
index 80b383ea6b8d8c710f37c453990da0cd94157b2f..70fbda4db58b3baa6f3a3af1ad388698cc0fa184 100644 (file)
 .Dt STRSTR 3
 .Os
 .Sh NAME
-.Nm strstr , strcasestr , strnstr
+.Nm strcasestr ,
+.Nm strcasestr_l ,
+.Nm strnstr ,
+.Nm strstr
 .Nd locate a substring in a string
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn strstr "const char *big" "const char *little"
+.Fo strcasestr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn strcasestr "const char *big" "const char *little"
+.Fo strnstr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fc
 .Ft char *
-.Fn strnstr "const char *big" "const char *little" "size_t len"
+.Fo strstr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
+.In string.h
+.In xlocale.h
+.Ft char *
+.Fo strcasestr_l
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strstr
 function
 locates the first occurrence of the null-terminated string
-.Fa little
+.Fa s2
 in the null-terminated string
-.Fa big .
+.Fa s1 .
 .Pp
 The
 .Fn strcasestr
@@ -68,11 +89,11 @@ The
 .Fn strnstr
 function
 locates the first occurrence of the null-terminated string
-.Fa little
+.Fa s2
 in the string
-.Fa big ,
+.Fa s1 ,
 where not more than
-.Fa len
+.Fa n
 characters are searched.
 Characters that appear after a
 .Ql \e0
@@ -82,20 +103,28 @@ Since the
 function is a
 .Fx
 specific API, it should only be used when portability is not a concern.
+.Pp
+While the
+.Fn strcasestr
+function uses the current locale, the
+.Fn strcasestr_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If
-.Fa little
+.Fa s2
 is an empty string,
-.Fa big
+.Fa s1
 is returned;
 if
-.Fa little
+.Fa s2
 occurs nowhere in
-.Fa big ,
+.Fa s1 ,
 .Dv NULL
 is returned;
 otherwise a pointer to the first character of the first occurrence of
-.Fa little
+.Fa s2
 is returned.
 .Sh EXAMPLES
 The following sets the pointer
@@ -128,7 +157,6 @@ ptr = strnstr(largestring, smallstring, 4);
 .Ed
 .Sh SEE ALSO
 .Xr memchr 3 ,
-.Xr memmem 3 ,
 .Xr strchr 3 ,
 .Xr strcspn 3 ,
 .Xr strpbrk 3 ,
@@ -136,7 +164,8 @@ ptr = strnstr(largestring, smallstring, 4);
 .Xr strsep 3 ,
 .Xr strspn 3 ,
 .Xr strtok 3 ,
-.Xr wcsstr 3
+.Xr wcsstr 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strstr
diff --git a/string/FreeBSD/strstr.3.patch b/string/FreeBSD/strstr.3.patch
deleted file mode 100644 (file)
index ff2b12f..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
---- strstr.3.bsdnew    2009-11-30 13:52:24.000000000 -0800
-+++ strstr.3   2009-11-30 14:58:48.000000000 -0800
-@@ -37,26 +37,47 @@
- .Dt STRSTR 3
- .Os
- .Sh NAME
--.Nm strstr , strcasestr , strnstr
-+.Nm strcasestr ,
-+.Nm strcasestr_l ,
-+.Nm strnstr ,
-+.Nm strstr
- .Nd locate a substring in a string
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn strstr "const char *big" "const char *little"
-+.Fo strcasestr
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
- .Ft char *
--.Fn strcasestr "const char *big" "const char *little"
-+.Fo strnstr
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "size_t n"
-+.Fc
- .Ft char *
--.Fn strnstr "const char *big" "const char *little" "size_t len"
-+.Fo strstr
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fc
-+.In string.h
-+.In xlocale.h
-+.Ft char *
-+.Fo strcasestr_l
-+.Fa "const char *s1"
-+.Fa "const char *s2"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strstr
- function
- locates the first occurrence of the null-terminated string
--.Fa little
-+.Fa s2
- in the null-terminated string
--.Fa big .
-+.Fa s1 .
- .Pp
- The
- .Fn strcasestr
-@@ -68,11 +89,11 @@ The
- .Fn strnstr
- function
- locates the first occurrence of the null-terminated string
--.Fa little
-+.Fa s2
- in the string
--.Fa big ,
-+.Fa s1 ,
- where not more than
--.Fa len
-+.Fa n
- characters are searched.
- Characters that appear after a
- .Ql \e0
-@@ -82,20 +103,28 @@ Since the
- function is a
- .Fx
- specific API, it should only be used when portability is not a concern.
-+.Pp
-+While the
-+.Fn strcasestr
-+function uses the current locale, the
-+.Fn strcasestr_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- If
--.Fa little
-+.Fa s2
- is an empty string,
--.Fa big
-+.Fa s1
- is returned;
- if
--.Fa little
-+.Fa s2
- occurs nowhere in
--.Fa big ,
-+.Fa s1 ,
- .Dv NULL
- is returned;
- otherwise a pointer to the first character of the first occurrence of
--.Fa little
-+.Fa s2
- is returned.
- .Sh EXAMPLES
- The following sets the pointer
-@@ -128,7 +157,6 @@ ptr = strnstr(largestring, smallstring, 
- .Ed
- .Sh SEE ALSO
- .Xr memchr 3 ,
--.Xr memmem 3 ,
- .Xr strchr 3 ,
- .Xr strcspn 3 ,
- .Xr strpbrk 3 ,
-@@ -136,7 +164,8 @@ ptr = strnstr(largestring, smallstring, 
- .Xr strsep 3 ,
- .Xr strspn 3 ,
- .Xr strtok 3 ,
--.Xr wcsstr 3
-+.Xr wcsstr 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn strstr
index fff792e2834540ef2e60ec40eae5e6bc51ae12f0..25b9179be126c31a75564d9fa85c3dad3f1f4d9a 100644 (file)
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn strtok "char *str" "const char *sep"
+.Fo strtok
+.Fa "char *restrict str"
+.Fa "const char *restrict sep"
+.Fc
 .Ft char *
-.Fn strtok_r "char *str" "const char *sep" "char **last"
+.Fo strtok_r
+.Fa "char *restrict str"
+.Fa "const char *restrict sep"
+.Fa "char **restrict lasts"
+.Fc
 .Sh DESCRIPTION
 .Bf -symbolic
 This interface is obsoleted by
diff --git a/string/FreeBSD/strtok.3.patch b/string/FreeBSD/strtok.3.patch
deleted file mode 100644 (file)
index cf057c6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
---- strtok.3.bsdnew    2009-11-18 18:24:37.000000000 -0800
-+++ strtok.3   2009-11-18 18:24:37.000000000 -0800
-@@ -55,9 +55,16 @@
- .Sh SYNOPSIS
- .In string.h
- .Ft char *
--.Fn strtok "char *str" "const char *sep"
-+.Fo strtok
-+.Fa "char *restrict str"
-+.Fa "const char *restrict sep"
-+.Fc
- .Ft char *
--.Fn strtok_r "char *str" "const char *sep" "char **last"
-+.Fo strtok_r
-+.Fa "char *restrict str"
-+.Fa "const char *restrict sep"
-+.Fa "char **restrict lasts"
-+.Fc
- .Sh DESCRIPTION
- .Bf -symbolic
- This interface is obsoleted by
index c32ea5cebec6f35369d60f9275cdfb11e7c1fc97..d6ded5b87252f0d3eeb23fdb44a378baded8ffb0 100644 (file)
 .Dt STRXFRM 3
 .Os
 .Sh NAME
-.Nm strxfrm
+.Nm strxfrm ,
+.Nm strxfrm_l
 .Nd transform a string under locale
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
 .Ft size_t
-.Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n"
+.Fo strxfrm
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
+.In string.h
+.In xlocale.h
+.Ft size_t
+.Fo strxfrm_l
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strxfrm
 function transforms a null-terminated string pointed to by
-.Fa src
+.Fa s2
 according to the current locale collation if any,
 then copies the transformed string
 into
-.Fa dst .
+.Fa s1 .
 Not more than
 .Fa n
 characters are copied into
-.Fa dst ,
+.Fa s1 ,
 including the terminating null character added.
 If
 .Fa n
 is set to 0
 (it helps to determine an actual size needed
 for transformation),
-.Fa dst
+.Fa s1
 is permitted to be a NULL pointer.
 .Pp
 Comparing two strings using
@@ -73,6 +87,14 @@ after
 is equal to comparing
 two original strings with
 .Fn strcoll .
+.Pp
+Although the
+.Fn strxfrm
+function uses the current locale, the
+.Fn strxfrm_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn strxfrm
@@ -81,13 +103,14 @@ the terminating null character.
 If this value is
 .Fa n
 or more, the contents of
-.Fa dst
+.Fa s1
 are indeterminate.
 .Sh SEE ALSO
 .Xr setlocale 3 ,
 .Xr strcmp 3 ,
 .Xr strcoll 3 ,
-.Xr wcsxfrm 3
+.Xr wcsxfrm 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strxfrm
diff --git a/string/FreeBSD/strxfrm.3.patch b/string/FreeBSD/strxfrm.3.patch
deleted file mode 100644 (file)
index 5dce9b9..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
---- strxfrm.3.bsdnew   2009-11-18 18:24:38.000000000 -0800
-+++ strxfrm.3  2009-11-18 18:24:38.000000000 -0800
-@@ -36,34 +36,48 @@
- .Dt STRXFRM 3
- .Os
- .Sh NAME
--.Nm strxfrm
-+.Nm strxfrm ,
-+.Nm strxfrm_l
- .Nd transform a string under locale
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In string.h
- .Ft size_t
--.Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n"
-+.Fo strxfrm
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fc
-+.In string.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo strxfrm_l
-+.Fa "char *restrict s1"
-+.Fa "const char *restrict s2"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn strxfrm
- function transforms a null-terminated string pointed to by
--.Fa src
-+.Fa s2
- according to the current locale collation if any,
- then copies the transformed string
- into
--.Fa dst .
-+.Fa s1 .
- Not more than
- .Fa n
- characters are copied into
--.Fa dst ,
-+.Fa s1 ,
- including the terminating null character added.
- If
- .Fa n
- is set to 0
- (it helps to determine an actual size needed
- for transformation),
--.Fa dst
-+.Fa s1
- is permitted to be a NULL pointer.
- .Pp
- Comparing two strings using
-@@ -73,6 +87,14 @@ after
- is equal to comparing
- two original strings with
- .Fn strcoll .
-+.Pp
-+Although the
-+.Fn strxfrm
-+function uses the current locale, the
-+.Fn strxfrm_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- Upon successful completion,
- .Fn strxfrm
-@@ -81,13 +103,14 @@ the terminating null character.
- If this value is
- .Fa n
- or more, the contents of
--.Fa dst
-+.Fa s1
- are indeterminate.
- .Sh SEE ALSO
- .Xr setlocale 3 ,
- .Xr strcmp 3 ,
- .Xr strcoll 3 ,
--.Xr wcsxfrm 3
-+.Xr wcsxfrm 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn strxfrm
index 9ef2e8739bc31c27526163e6405703cb43c8d98e..b1a70ddddb93424423e5bcd419664f5d617fd699 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/strxfrm.c,v 1.17 2008/10/19 09:10:44 delphij Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <string.h>
+#include <wchar.h>
+#include <errno.h>
 #include "collate.h"
 
+/*
+ * In the non-POSIX case, we transform each character into a string of
+ * characters representing the character's priority.  Since char is usually
+ * signed, we are limited by 7 bits per byte.  To avoid zero, we need to add
+ * XFRM_OFFSET, so we can't use a full 7 bits.  For simplicity, we choose 6
+ * bits per byte.  We choose 4 bytes per character as a good compromise
+ * between maximum coverage and minimum size.  This gives 24 bits, or 16M
+ * priorities.  So we choose COLLATE_MAX_PRIORITY to be (2^24 - 1).  This
+ * this can be increased if more is needed.
+ */
+
+#define        XFRM_BYTES      4
+#define        XFRM_OFFSET     ('0')   /* make all printable characters */
+#define        XFRM_SHIFT      6
+#define        XFRM_MASK       ((1 << XFRM_SHIFT) - 1)
+
+static void
+xfrm(unsigned char *p, int pri)
+{
+
+       p[3] = (pri & XFRM_MASK) + XFRM_OFFSET;
+       pri >>= XFRM_SHIFT;
+       p[2] = (pri & XFRM_MASK) + XFRM_OFFSET;
+       pri >>= XFRM_SHIFT;
+       p[1] = (pri & XFRM_MASK) + XFRM_OFFSET;
+       pri >>= XFRM_SHIFT;
+       p[0] = (pri & XFRM_MASK) + XFRM_OFFSET;
+}
+
 size_t
-strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
+strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len,
+    locale_t loc)
 {
-       int prim, sec, l;
        size_t slen;
-       char *s, *ss;
+       wchar_t *wcs, *xf[2];
+       int sverrno;
 
-       if (!*src) {
+       if (!*src && dest) {
                if (len > 0)
                        *dest = '\0';
                return 0;
        }
 
-       if (__collate_load_error)
+       NORMALIZE_LOCALE(loc);
+       if (loc->__collate_load_error || (wcs = __collate_mbstowcs(src, loc)) == NULL)
                return strlcpy(dest, src, len);
 
-       slen = 0;
-       prim = sec = 0;
-       ss = s = __collate_substitute(src);
-       while (*s) {
-               while (*s && !prim) {
-                       __collate_lookup(s, &l, &prim, &sec);
-                       s += l;
+       __collate_xfrm(wcs, xf, loc);
+
+       slen = wcslen(xf[0]) * XFRM_BYTES;
+       if (xf[1])
+               slen += (wcslen(xf[1]) + 1) * XFRM_BYTES;
+       if (len > 0) {
+               wchar_t *w = xf[0];
+               int b = 0;
+               unsigned char buf[XFRM_BYTES];
+               unsigned char *bp;
+               while (len > 1) {
+                       if (!b) {
+                               if (!*w)
+                                       break;
+                               xfrm(bp = buf, *w++);
+                               b = XFRM_BYTES;
+                       }
+                       *dest++ = *(char *)bp++;
+                       b--;
+                       len--;
                }
-               if (prim) {
-                       if (len > 1) {
-                               *dest++ = (char)prim;
+               if ((w = xf[1]) != NULL) {
+                       xfrm(bp = buf, 0);
+                       b = XFRM_BYTES;
+                       while (len > 1) {
+                               if (!b)
+                                       break;
+                               *dest++ = *(char *)bp++;
+                               b--;
+                               len--;
+                       }
+                       b = 0;
+                       while (len > 1) {
+                               if (!b) {
+                                       if (!*w)
+                                               break;
+                                       xfrm(bp = buf, *w++);
+                                       b = XFRM_BYTES;
+                               }
+                               *dest++ = *(char *)bp++;
+                               b--;
                                len--;
                        }
-                       slen++;
-                       prim = 0;
                }
-       }
-       free(ss);
-       if (len > 0)
-               *dest = '\0';
+               *dest = 0;
+       }
+       sverrno = errno;
+       free(wcs);
+       free(xf[0]);
+       free(xf[1]);
+       errno = sverrno;
 
        return slen;
 }
+
+size_t
+strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
+{
+       return strxfrm_l(dest, src, len, __current_locale());
+}
diff --git a/string/FreeBSD/strxfrm.c.patch b/string/FreeBSD/strxfrm.c.patch
deleted file mode 100644 (file)
index 5178604..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
---- strxfrm.c.bsdnew   2009-11-18 18:24:38.000000000 -0800
-+++ strxfrm.c  2009-11-18 18:38:07.000000000 -0800
-@@ -28,46 +28,118 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/strxfrm.c,v 1.17 2008/10/19 09:10:44 delphij Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <string.h>
-+#include <wchar.h>
-+#include <errno.h>
- #include "collate.h"
-+/*
-+ * In the non-POSIX case, we transform each character into a string of
-+ * characters representing the character's priority.  Since char is usually
-+ * signed, we are limited by 7 bits per byte.  To avoid zero, we need to add
-+ * XFRM_OFFSET, so we can't use a full 7 bits.  For simplicity, we choose 6
-+ * bits per byte.  We choose 4 bytes per character as a good compromise
-+ * between maximum coverage and minimum size.  This gives 24 bits, or 16M
-+ * priorities.  So we choose COLLATE_MAX_PRIORITY to be (2^24 - 1).  This
-+ * this can be increased if more is needed.
-+ */
-+
-+#define       XFRM_BYTES      4
-+#define       XFRM_OFFSET     ('0')   /* make all printable characters */
-+#define       XFRM_SHIFT      6
-+#define       XFRM_MASK       ((1 << XFRM_SHIFT) - 1)
-+
-+static void
-+xfrm(unsigned char *p, int pri)
-+{
-+
-+      p[3] = (pri & XFRM_MASK) + XFRM_OFFSET;
-+      pri >>= XFRM_SHIFT;
-+      p[2] = (pri & XFRM_MASK) + XFRM_OFFSET;
-+      pri >>= XFRM_SHIFT;
-+      p[1] = (pri & XFRM_MASK) + XFRM_OFFSET;
-+      pri >>= XFRM_SHIFT;
-+      p[0] = (pri & XFRM_MASK) + XFRM_OFFSET;
-+}
-+
- size_t
--strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
-+strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len,
-+    locale_t loc)
- {
--      int prim, sec, l;
-       size_t slen;
--      char *s, *ss;
-+      wchar_t *wcs, *xf[2];
-+      int sverrno;
--      if (!*src) {
-+      if (!*src && dest) {
-               if (len > 0)
-                       *dest = '\0';
-               return 0;
-       }
--      if (__collate_load_error)
-+      NORMALIZE_LOCALE(loc);
-+      if (loc->__collate_load_error || (wcs = __collate_mbstowcs(src, loc)) == NULL)
-               return strlcpy(dest, src, len);
--      slen = 0;
--      prim = sec = 0;
--      ss = s = __collate_substitute(src);
--      while (*s) {
--              while (*s && !prim) {
--                      __collate_lookup(s, &l, &prim, &sec);
--                      s += l;
-+      __collate_xfrm(wcs, xf, loc);
-+
-+      slen = wcslen(xf[0]) * XFRM_BYTES;
-+      if (xf[1])
-+              slen += (wcslen(xf[1]) + 1) * XFRM_BYTES;
-+      if (len > 0) {
-+              wchar_t *w = xf[0];
-+              int b = 0;
-+              unsigned char buf[XFRM_BYTES];
-+              unsigned char *bp;
-+              while (len > 1) {
-+                      if (!b) {
-+                              if (!*w)
-+                                      break;
-+                              xfrm(bp = buf, *w++);
-+                              b = XFRM_BYTES;
-+                      }
-+                      *dest++ = *(char *)bp++;
-+                      b--;
-+                      len--;
-               }
--              if (prim) {
--                      if (len > 1) {
--                              *dest++ = (char)prim;
-+              if ((w = xf[1]) != NULL) {
-+                      xfrm(bp = buf, 0);
-+                      b = XFRM_BYTES;
-+                      while (len > 1) {
-+                              if (!b)
-+                                      break;
-+                              *dest++ = *(char *)bp++;
-+                              b--;
-+                              len--;
-+                      }
-+                      b = 0;
-+                      while (len > 1) {
-+                              if (!b) {
-+                                      if (!*w)
-+                                              break;
-+                                      xfrm(bp = buf, *w++);
-+                                      b = XFRM_BYTES;
-+                              }
-+                              *dest++ = *(char *)bp++;
-+                              b--;
-                               len--;
-                       }
--                      slen++;
--                      prim = 0;
-               }
--      }
--      free(ss);
--      if (len > 0)
--              *dest = '\0';
-+              *dest = 0;
-+      }
-+      sverrno = errno;
-+      free(wcs);
-+      free(xf[0]);
-+      free(xf[1]);
-+      errno = sverrno;
-       return slen;
- }
-+
-+size_t
-+strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
-+{
-+      return strxfrm_l(dest, src, len, __current_locale());
-+}
index d42143d283398dd4766360ca0ed6ad2bb8075669..82468db7d4c3de217a0fdac4f92c3068cb655b25 100644 (file)
@@ -28,7 +28,7 @@
 .\"     @(#)swab.3     8.1 (Berkeley) 6/4/93
 .\" $FreeBSD: src/lib/libc/string/swab.3,v 1.10 2007/01/09 00:28:12 imp Exp $
 .\"
-.Dd December 10, 2004
+.Dd February 24, 2010
 .Dt SWAB 3
 .Os
 .Sh NAME
 .Sh SYNOPSIS
 .In unistd.h
 .Ft void
-.Fn swab "const void * restrict src" "void * restrict dst" "ssize_t len"
+.Fo swab
+.Fa "const void *restrict src"
+.Fa "void *restrict dest"
+.Fa "ssize_t nbytes"
+.Fc
 .Sh DESCRIPTION
 The function
 .Fn swab
 copies
-.Fa len
+.Fa nbytes
 bytes from the location referenced by
 .Fa src
 to the location referenced by
-.Fa dst ,
+.Fa dest ,
 swapping adjacent bytes.
 .Pp
 The argument
-.Fa len
-must be an even number.
+.Fa nbytes
+should be an even number.  If
+.Fa nbytes
+is odd,
+.Fn swab
+copies and exchanges
+.Fa nbytes
+-1 bytes and the disposition of the last byte is unspecified.
+If copying takes place between objects that overlap,
+the behavior is undefined. If
+.Fa nbytes
+is negative,
+.Fn swab
+does nothing.
 .Sh SEE ALSO
 .Xr bzero 3 ,
-.Xr memset 3
+.Xr memset 3 ,
+.Xr compat 5
 .Sh HISTORY
 A
 .Fn swab
diff --git a/string/FreeBSD/swab.3.patch b/string/FreeBSD/swab.3.patch
deleted file mode 100644 (file)
index f85ec9c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
---- swab.3.orig        2010-02-24 20:50:11.000000000 -0800
-+++ swab.3     2010-02-24 21:17:49.000000000 -0800
-@@ -28,7 +28,7 @@
- .\"     @(#)swab.3    8.1 (Berkeley) 6/4/93
- .\" $FreeBSD: src/lib/libc/string/swab.3,v 1.10 2007/01/09 00:28:12 imp Exp $
- .\"
--.Dd December 10, 2004
-+.Dd February 24, 2010
- .Dt SWAB 3
- .Os
- .Sh NAME
-@@ -39,24 +39,41 @@
- .Sh SYNOPSIS
- .In unistd.h
- .Ft void
--.Fn swab "const void * restrict src" "void * restrict dst" "ssize_t len"
-+.Fo swab
-+.Fa "const void *restrict src"
-+.Fa "void *restrict dest"
-+.Fa "ssize_t nbytes"
-+.Fc
- .Sh DESCRIPTION
- The function
- .Fn swab
- copies
--.Fa len
-+.Fa nbytes
- bytes from the location referenced by
- .Fa src
- to the location referenced by
--.Fa dst ,
-+.Fa dest ,
- swapping adjacent bytes.
- .Pp
- The argument
--.Fa len
--must be an even number.
-+.Fa nbytes
-+should be an even number.  If
-+.Fa nbytes
-+is odd,
-+.Fn swab
-+copies and exchanges
-+.Fa nbytes
-+-1 bytes and the disposition of the last byte is unspecified.
-+If copying takes place between objects that overlap,
-+the behavior is undefined. If
-+.Fa nbytes
-+is negative,
-+.Fn swab
-+does nothing.
- .Sh SEE ALSO
- .Xr bzero 3 ,
--.Xr memset 3
-+.Xr memset 3 ,
-+.Xr compat 5
- .Sh HISTORY
- A
- .Fn swab
index fae6e563230e7179caea7193a373af6da8ad686a..1d55327c35c55da03e12d292615dc7b8a8234797 100644 (file)
@@ -45,6 +45,8 @@ swab(const void * __restrict from, void * __restrict to, ssize_t len)
        int n;
        char *fp, *tp;
 
+       if (len <= 0)
+               return;
        n = len >> 1;
        fp = (char *)from;
        tp = (char *)to;
diff --git a/string/FreeBSD/swab.c.patch b/string/FreeBSD/swab.c.patch
deleted file mode 100644 (file)
index 5565deb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- swab.c.bsdnew      2009-11-18 18:24:38.000000000 -0800
-+++ swab.c     2009-11-18 18:40:17.000000000 -0800
-@@ -45,6 +45,8 @@ swab(const void * __restrict from, void 
-       int n;
-       char *fp, *tp;
-+      if (len <= 0)
-+              return;
-       n = len >> 1;
-       fp = (char *)from;
-       tp = (char *)to;
index 8618c50e2e48c07ce9b36718aec1aea33485e707..f158b1418bf8c67db3e8d6eb234c451cb48e4acd 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/wcscasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 #include <wctype.h>
 
 int
-wcscasecmp(const wchar_t *s1, const wchar_t *s2)
+wcscasecmp_l(const wchar_t *s1, const wchar_t *s2, locale_t loc)
 {
        wchar_t c1, c2;
 
        for (; *s1; s1++, s2++) {
-               c1 = towlower(*s1);
-               c2 = towlower(*s2);
+               c1 = towlower_l(*s1, loc);
+               c2 = towlower_l(*s2, loc);
                if (c1 != c2)
                        return ((int)c1 - c2);
        }
        return (-*s2);
 }
+
+int
+wcscasecmp(const wchar_t *s1, const wchar_t *s2) {
+       return wcscasecmp_l(s1, s2, __current_locale());
+}
+
diff --git a/string/FreeBSD/wcscasecmp.c.patch b/string/FreeBSD/wcscasecmp.c.patch
deleted file mode 100644 (file)
index aa62f56..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
---- wcscasecmp.c.orig  2009-12-16 12:51:30.000000000 -0800
-+++ wcscasecmp.c       2009-12-16 12:59:33.000000000 -0800
-@@ -27,19 +27,27 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/wcscasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #include <wctype.h>
- int
--wcscasecmp(const wchar_t *s1, const wchar_t *s2)
-+wcscasecmp_l(const wchar_t *s1, const wchar_t *s2, locale_t loc)
- {
-       wchar_t c1, c2;
-       for (; *s1; s1++, s2++) {
--              c1 = towlower(*s1);
--              c2 = towlower(*s2);
-+              c1 = towlower_l(*s1, loc);
-+              c2 = towlower_l(*s2, loc);
-               if (c1 != c2)
-                       return ((int)c1 - c2);
-       }
-       return (-*s2);
- }
-+
-+int
-+wcscasecmp(const wchar_t *s1, const wchar_t *s2) {
-+      return wcscasecmp_l(s1, s2, __current_locale());
-+}
-+
index 819ae8767aae24afac30731d84d71b8089e5410d..df534cbc13b40e3401d2a49f6cbe8edf1e24286a 100644 (file)
 .Dt WCSCOLL 3
 .Os
 .Sh NAME
-.Nm wcscoll
+.Nm wcscoll ,
+.Nm wcscoll_l
 .Nd compare wide strings according to current collation
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft int
-.Fn wcscoll "const wchar_t *s1" "const wchar_t *s2"
+.Fo wcscoll
+.Fa "const wchar_t *ws1"
+.Fa "const wchar_t *ws2"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft int
+.Fo wcscoll_l
+.Fa "const wchar_t *ws1"
+.Fa "const wchar_t *ws2"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcscoll
 function compares the null-terminated strings
-.Fa s1
+.Fa ws1
 and
-.Fa s2
-according to the current locale collation order.
+.Fa ws2 ,
+according to the current locale's collation order.
 In the
 .Dq Li C
 locale,
 .Fn wcscoll
 is equivalent to
 .Fn wcscmp .
+.Pp
+Although the
+.Fn wcscoll
+function uses the current locale, the
+.Fn wcscoll_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn wcscoll
 function
 returns an integer greater than, equal to, or less than 0,
 if
-.Fa s1
+.Fa ws1
 is greater than, equal to, or less than
-.Fa s2 .
+.Fa ws2 .
 .Pp
 No return value is reserved to indicate errors;
 callers should set
@@ -91,7 +111,8 @@ Cannot allocate enough memory for temporary buffers.
 .Xr setlocale 3 ,
 .Xr strcoll 3 ,
 .Xr wcscmp 3 ,
-.Xr wcsxfrm 3
+.Xr wcsxfrm 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcscoll
diff --git a/string/FreeBSD/wcscoll.3.patch b/string/FreeBSD/wcscoll.3.patch
deleted file mode 100644 (file)
index 50a59cc..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
---- wcscoll.3.bsdnew   2009-11-18 18:24:39.000000000 -0800
-+++ wcscoll.3  2009-11-18 18:24:39.000000000 -0800
-@@ -37,37 +37,57 @@
- .Dt WCSCOLL 3
- .Os
- .Sh NAME
--.Nm wcscoll
-+.Nm wcscoll ,
-+.Nm wcscoll_l
- .Nd compare wide strings according to current collation
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft int
--.Fn wcscoll "const wchar_t *s1" "const wchar_t *s2"
-+.Fo wcscoll
-+.Fa "const wchar_t *ws1"
-+.Fa "const wchar_t *ws2"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft int
-+.Fo wcscoll_l
-+.Fa "const wchar_t *ws1"
-+.Fa "const wchar_t *ws2"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcscoll
- function compares the null-terminated strings
--.Fa s1
-+.Fa ws1
- and
--.Fa s2
--according to the current locale collation order.
-+.Fa ws2 ,
-+according to the current locale's collation order.
- In the
- .Dq Li C
- locale,
- .Fn wcscoll
- is equivalent to
- .Fn wcscmp .
-+.Pp
-+Although the
-+.Fn wcscoll
-+function uses the current locale, the
-+.Fn wcscoll_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn wcscoll
- function
- returns an integer greater than, equal to, or less than 0,
- if
--.Fa s1
-+.Fa ws1
- is greater than, equal to, or less than
--.Fa s2 .
-+.Fa ws2 .
- .Pp
- No return value is reserved to indicate errors;
- callers should set
-@@ -91,7 +111,8 @@ Cannot allocate enough memory for tempor
- .Xr setlocale 3 ,
- .Xr strcoll 3 ,
- .Xr wcscmp 3 ,
--.Xr wcsxfrm 3
-+.Xr wcsxfrm 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcscoll
index 5095158efaf4990e78c5d1ba837e623a4880f7b8..ce09e41fd9d2f68518e58d6326f1c1c435d8c31a 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/wcscoll.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
 #include "collate.h"
 
-static char *__mbsdup(const wchar_t *);
+#define NOTFORWARD     (DIRECTIVE_BACKWARD | DIRECTIVE_POSITION)
 
-/*
- * Placeholder implementation of wcscoll(). Attempts to use the single-byte
- * collation ordering where possible, and falls back on wcscmp() in locales
- * with extended character sets.
- */
 int
-wcscoll(const wchar_t *ws1, const wchar_t *ws2)
+wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t loc)
 {
-       char *mbs1, *mbs2;
-       int diff, sverrno;
+       int sverrno;
+       int len, len2, prim, prim2, sec, sec2, ret, ret2;
+       const wchar_t *t, *t2;
+       wchar_t *tt = NULL, *tt2 = NULL;
+       wchar_t *tr = NULL, *tr2 = NULL;
+       wchar_t w, w2;
+       struct __collate_st_info *info;
 
-       if (__collate_load_error || MB_CUR_MAX > 1)
+       NORMALIZE_LOCALE(loc);
+       if (loc->__collate_load_error)
                /*
-                * Locale has no special collating order, could not be
-                * loaded, or has an extended character set; do a fast binary
-                * comparison.
+                * Locale has no special collating order or could not be
+                * loaded, do a fast binary comparison.
                 */
                return (wcscmp(ws1, ws2));
 
-       if ((mbs1 = __mbsdup(ws1)) == NULL || (mbs2 = __mbsdup(ws2)) == NULL) {
-               /*
-                * Out of memory or illegal wide chars; fall back to wcscmp()
-                * but leave errno indicating the error. Callers that don't
-                * check for error will get a reasonable but often slightly
-                * incorrect result.
-                */
-               sverrno = errno;
-               free(mbs1);
-               errno = sverrno;
-               return (wcscmp(ws1, ws2));
+       info = &loc->__lc_collate->__info;
+       len = len2 = 1;
+       ret = ret2 = 0;
+
+       if ((info->directive[0] & NOTFORWARD) ||
+           (info->directive[1] & NOTFORWARD) ||
+           (!(info->flags && COLLATE_SUBST_DUP) &&
+           (info->subst_count[0] > 0 || info->subst_count[1] > 0))) {
+               int direc, pass;
+               for(pass = 0; pass < info->directive_count; pass++) {
+                       direc = info->directive[pass];
+                       if (pass == 0 || !(info->flags & COLLATE_SUBST_DUP)) {
+                               free(tt);
+                               tt = __collate_substitute(ws1, pass, loc);
+                               free(tt2);
+                               tt2 = tt ? __collate_substitute(ws2, pass, loc) : NULL;
+                       }
+                       if (direc & DIRECTIVE_BACKWARD) {
+                               wchar_t *bp, *fp, c;
+                               tr = __collate_wcsdup(tt ? tt : ws1);
+                               bp = tr;
+                               fp = tr + wcslen(tr) - 1;
+                               while(bp < fp) {
+                                       c = *bp;
+                                       *bp++ = *fp;
+                                       *fp-- = c;
+                               }
+                               tr2 = __collate_wcsdup(tt2 ? tt2 : ws2);
+                               bp = tr2;
+                               fp = tr2 + wcslen(tr2) - 1;
+                               while(bp < fp) {
+                                       c = *bp;
+                                       *bp++ = *fp;
+                                       *fp-- = c;
+                               }
+                               t = (const wchar_t *)tr;
+                               t2 = (const wchar_t *)tr2;
+                       } else if (tt) {
+                               t = (const wchar_t *)tt;
+                               t2 = (const wchar_t *)tt2;
+                       } else {
+                               t = (const wchar_t *)ws1;
+                               t2 = (const wchar_t *)ws2;
+                       }
+                       if(direc & DIRECTIVE_POSITION) {
+                               while(*t && *t2) {
+                                       prim = prim2 = 0;
+                                       __collate_lookup_which(t, &len, &prim, pass, loc);
+                                       if (prim <= 0) {
+                                               if (prim < 0) {
+                                                       errno = EINVAL;
+                                                       ret = -1;
+                                                       goto end;
+                                               }
+                                               prim = COLLATE_MAX_PRIORITY;
+                                       }
+                                       __collate_lookup_which(t2, &len2, &prim2, pass, loc);
+                                       if (prim2 <= 0) {
+                                               if (prim2 < 0) {
+                                                       errno = EINVAL;
+                                                       ret = -1;
+                                                       goto end;
+                                               }
+                                               prim2 = COLLATE_MAX_PRIORITY;
+                                       }
+                                       if(prim != prim2) {
+                                               ret = prim - prim2;
+                                               goto end;
+                                       }
+                                       t += len;
+                                       t2 += len2;
+                               }
+                       } else {
+                               while(*t && *t2) {
+                                       prim = prim2 = 0;
+                                       while(*t) {
+                                               __collate_lookup_which(t, &len, &prim, pass, loc);
+                                               if(prim > 0)
+                                                       break;
+                                               if (prim < 0) {
+                                                       errno = EINVAL;
+                                                       ret = -1;
+                                                       goto end;
+                                               }
+                                               t += len;
+                                       }
+                                       while(*t2) {
+                                               __collate_lookup_which(t2, &len2, &prim2, pass, loc);
+                                               if(prim2 > 0)
+                                                       break;
+                                               if (prim2 < 0) {
+                                                       errno = EINVAL;
+                                                       ret = -1;
+                                                       goto end;
+                                               }
+                                               t2 += len2;
+                                       }
+                                       if(!prim || !prim2)
+                                               break;
+                                       if(prim != prim2) {
+                                               ret = prim - prim2;
+                                               goto end;
+                                       }
+                                       t += len;
+                                       t2 += len2;
+                               }
+                       }
+                       if(!*t) {
+                               if(*t2) {
+                                       ret = -(int)*t2;
+                                       goto end;
+                               }
+                       } else {
+                               ret = *t;
+                               goto end;
+                       }
+               }
+               ret = 0;
+               goto end;
        }
 
-       diff = strcoll(mbs1, mbs2);
+       /* optimized common case: order_start forward;forward and duplicate
+        * (or no) substitute tables */
+       tt = __collate_substitute(ws1, 0, loc);
+       if (tt == NULL) {
+               tt2 = NULL;
+               t = (const wchar_t *)ws1;
+               t2 = (const wchar_t *)ws2;
+       } else {
+               tt2 = __collate_substitute(ws2, 0, loc);
+               t = (const wchar_t *)tt;
+               t2 = (const wchar_t *)tt2;
+       }
+       while(*t && *t2) {
+               prim = prim2 = 0;
+               while(*t) {
+                       __collate_lookup_l(t, &len, &prim, &sec, loc);
+                       if (prim > 0)
+                               break;
+                       if (prim < 0) {
+                               errno = EINVAL;
+                               ret = -1;
+                               goto end;
+                       }
+                       t += len;
+               }
+               while(*t2) {
+                       __collate_lookup_l(t2, &len2, &prim2, &sec2, loc);
+                       if (prim2 > 0)
+                               break;
+                       if (prim2 < 0) {
+                               errno = EINVAL;
+                               ret = -1;
+                               goto end;
+                       }
+                       t2 += len2;
+               }
+               if(!prim || !prim2)
+                       break;
+               if(prim != prim2) {
+                       ret = prim - prim2;
+                       goto end;
+               }
+               if(!ret2)
+                       ret2 = sec - sec2;
+               t += len;
+               t2 += len2;
+       }
+       if(!*t && *t2)
+               ret = -(int)*t2;
+       else if(*t && !*t2)
+               ret = *t;
+       else if(!*t && !*t2)
+               ret = ret2;
+  end:
        sverrno = errno;
-       free(mbs1);
-       free(mbs2);
+       free(tt);
+       free(tt2);
+       free(tr);
+       free(tr2);
        errno = sverrno;
 
-       return (diff);
+       return ret;
 }
 
-static char *
-__mbsdup(const wchar_t *ws)
+int
+wcscoll(const wchar_t *ws1, const wchar_t *ws2)
 {
-       static const mbstate_t initial;
-       mbstate_t st;
-       const wchar_t *wcp;
-       size_t len;
-       char *mbs;
-
-       wcp = ws;
-       st = initial;
-       if ((len = wcsrtombs(NULL, &wcp, 0, &st)) == (size_t)-1)
-               return (NULL);
-       if ((mbs = malloc(len + 1)) == NULL)
-               return (NULL);
-       st = initial;
-       wcsrtombs(mbs, &ws, len + 1, &st);
-
-       return (mbs);
+       return wcscoll_l(ws1, ws2, __current_locale());
 }
diff --git a/string/FreeBSD/wcscoll.c.patch b/string/FreeBSD/wcscoll.c.patch
deleted file mode 100644 (file)
index 5f0d2e9..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
---- wcscoll.c.orig     2004-11-25 11:38:47.000000000 -0800
-+++ wcscoll.c  2005-04-11 15:44:35.000000000 -0700
-@@ -27,72 +27,222 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/wcscoll.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <errno.h>
- #include <stdlib.h>
- #include <string.h>
- #include <wchar.h>
- #include "collate.h"
--static char *__mbsdup(const wchar_t *);
-+#define NOTFORWARD    (DIRECTIVE_BACKWARD | DIRECTIVE_POSITION)
--/*
-- * Placeholder implementation of wcscoll(). Attempts to use the single-byte
-- * collation ordering where possible, and falls back on wcscmp() in locales
-- * with extended character sets.
-- */
- int
--wcscoll(const wchar_t *ws1, const wchar_t *ws2)
-+wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t loc)
- {
--      char *mbs1, *mbs2;
--      int diff, sverrno;
-+      int sverrno;
-+      int len, len2, prim, prim2, sec, sec2, ret, ret2;
-+      const wchar_t *t, *t2;
-+      wchar_t *tt = NULL, *tt2 = NULL;
-+      wchar_t *tr = NULL, *tr2 = NULL;
-+      wchar_t w, w2;
-+      struct __collate_st_info *info;
--      if (__collate_load_error || MB_CUR_MAX > 1)
-+      NORMALIZE_LOCALE(loc);
-+      if (loc->__collate_load_error)
-               /*
--               * Locale has no special collating order, could not be
--               * loaded, or has an extended character set; do a fast binary
--               * comparison.
-+               * Locale has no special collating order or could not be
-+               * loaded, do a fast binary comparison.
-                */
-               return (wcscmp(ws1, ws2));
--      if ((mbs1 = __mbsdup(ws1)) == NULL || (mbs2 = __mbsdup(ws2)) == NULL) {
--              /*
--               * Out of memory or illegal wide chars; fall back to wcscmp()
--               * but leave errno indicating the error. Callers that don't
--               * check for error will get a reasonable but often slightly
--               * incorrect result.
--               */
--              sverrno = errno;
--              free(mbs1);
--              errno = sverrno;
--              return (wcscmp(ws1, ws2));
-+      info = &loc->__lc_collate->__info;
-+      len = len2 = 1;
-+      ret = ret2 = 0;
-+
-+      if ((info->directive[0] & NOTFORWARD) ||
-+          (info->directive[1] & NOTFORWARD) ||
-+          (!(info->flags && COLLATE_SUBST_DUP) &&
-+          (info->subst_count[0] > 0 || info->subst_count[1] > 0))) {
-+              int direc, pass;
-+              for(pass = 0; pass < info->directive_count; pass++) {
-+                      direc = info->directive[pass];
-+                      if (pass == 0 || !(info->flags & COLLATE_SUBST_DUP)) {
-+                              free(tt);
-+                              tt = __collate_substitute(ws1, pass, loc);
-+                              free(tt2);
-+                              tt2 = tt ? __collate_substitute(ws2, pass, loc) : NULL;
-+                      }
-+                      if (direc & DIRECTIVE_BACKWARD) {
-+                              wchar_t *bp, *fp, c;
-+                              tr = __collate_wcsdup(tt ? tt : ws1);
-+                              bp = tr;
-+                              fp = tr + wcslen(tr) - 1;
-+                              while(bp < fp) {
-+                                      c = *bp;
-+                                      *bp++ = *fp;
-+                                      *fp-- = c;
-+                              }
-+                              tr2 = __collate_wcsdup(tt2 ? tt2 : ws2);
-+                              bp = tr2;
-+                              fp = tr2 + wcslen(tr2) - 1;
-+                              while(bp < fp) {
-+                                      c = *bp;
-+                                      *bp++ = *fp;
-+                                      *fp-- = c;
-+                              }
-+                              t = (const wchar_t *)tr;
-+                              t2 = (const wchar_t *)tr2;
-+                      } else if (tt) {
-+                              t = (const wchar_t *)tt;
-+                              t2 = (const wchar_t *)tt2;
-+                      } else {
-+                              t = (const wchar_t *)ws1;
-+                              t2 = (const wchar_t *)ws2;
-+                      }
-+                      if(direc & DIRECTIVE_POSITION) {
-+                              while(*t && *t2) {
-+                                      prim = prim2 = 0;
-+                                      __collate_lookup_which(t, &len, &prim, pass, loc);
-+                                      if (prim <= 0) {
-+                                              if (prim < 0) {
-+                                                      errno = EINVAL;
-+                                                      ret = -1;
-+                                                      goto end;
-+                                              }
-+                                              prim = COLLATE_MAX_PRIORITY;
-+                                      }
-+                                      __collate_lookup_which(t2, &len2, &prim2, pass, loc);
-+                                      if (prim2 <= 0) {
-+                                              if (prim2 < 0) {
-+                                                      errno = EINVAL;
-+                                                      ret = -1;
-+                                                      goto end;
-+                                              }
-+                                              prim2 = COLLATE_MAX_PRIORITY;
-+                                      }
-+                                      if(prim != prim2) {
-+                                              ret = prim - prim2;
-+                                              goto end;
-+                                      }
-+                                      t += len;
-+                                      t2 += len2;
-+                              }
-+                      } else {
-+                              while(*t && *t2) {
-+                                      prim = prim2 = 0;
-+                                      while(*t) {
-+                                              __collate_lookup_which(t, &len, &prim, pass, loc);
-+                                              if(prim > 0)
-+                                                      break;
-+                                              if (prim < 0) {
-+                                                      errno = EINVAL;
-+                                                      ret = -1;
-+                                                      goto end;
-+                                              }
-+                                              t += len;
-+                                      }
-+                                      while(*t2) {
-+                                              __collate_lookup_which(t2, &len2, &prim2, pass, loc);
-+                                              if(prim2 > 0)
-+                                                      break;
-+                                              if (prim2 < 0) {
-+                                                      errno = EINVAL;
-+                                                      ret = -1;
-+                                                      goto end;
-+                                              }
-+                                              t2 += len2;
-+                                      }
-+                                      if(!prim || !prim2)
-+                                              break;
-+                                      if(prim != prim2) {
-+                                              ret = prim - prim2;
-+                                              goto end;
-+                                      }
-+                                      t += len;
-+                                      t2 += len2;
-+                              }
-+                      }
-+                      if(!*t) {
-+                              if(*t2) {
-+                                      ret = -(int)*t2;
-+                                      goto end;
-+                              }
-+                      } else {
-+                              ret = *t;
-+                              goto end;
-+                      }
-+              }
-+              ret = 0;
-+              goto end;
-       }
--      diff = strcoll(mbs1, mbs2);
-+      /* optimized common case: order_start forward;forward and duplicate
-+       * (or no) substitute tables */
-+      tt = __collate_substitute(ws1, 0, loc);
-+      if (tt == NULL) {
-+              tt2 = NULL;
-+              t = (const wchar_t *)ws1;
-+              t2 = (const wchar_t *)ws2;
-+      } else {
-+              tt2 = __collate_substitute(ws2, 0, loc);
-+              t = (const wchar_t *)tt;
-+              t2 = (const wchar_t *)tt2;
-+      }
-+      while(*t && *t2) {
-+              prim = prim2 = 0;
-+              while(*t) {
-+                      __collate_lookup_l(t, &len, &prim, &sec, loc);
-+                      if (prim > 0)
-+                              break;
-+                      if (prim < 0) {
-+                              errno = EINVAL;
-+                              ret = -1;
-+                              goto end;
-+                      }
-+                      t += len;
-+              }
-+              while(*t2) {
-+                      __collate_lookup_l(t2, &len2, &prim2, &sec2, loc);
-+                      if (prim2 > 0)
-+                              break;
-+                      if (prim2 < 0) {
-+                              errno = EINVAL;
-+                              ret = -1;
-+                              goto end;
-+                      }
-+                      t2 += len2;
-+              }
-+              if(!prim || !prim2)
-+                      break;
-+              if(prim != prim2) {
-+                      ret = prim - prim2;
-+                      goto end;
-+              }
-+              if(!ret2)
-+                      ret2 = sec - sec2;
-+              t += len;
-+              t2 += len2;
-+      }
-+      if(!*t && *t2)
-+              ret = -(int)*t2;
-+      else if(*t && !*t2)
-+              ret = *t;
-+      else if(!*t && !*t2)
-+              ret = ret2;
-+  end:
-       sverrno = errno;
--      free(mbs1);
--      free(mbs2);
-+      free(tt);
-+      free(tt2);
-+      free(tr);
-+      free(tr2);
-       errno = sverrno;
--      return (diff);
-+      return ret;
- }
--static char *
--__mbsdup(const wchar_t *ws)
-+int
-+wcscoll(const wchar_t *ws1, const wchar_t *ws2)
- {
--      static const mbstate_t initial;
--      mbstate_t st;
--      const wchar_t *wcp;
--      size_t len;
--      char *mbs;
--
--      wcp = ws;
--      st = initial;
--      if ((len = wcsrtombs(NULL, &wcp, 0, &st)) == (size_t)-1)
--              return (NULL);
--      if ((mbs = malloc(len + 1)) == NULL)
--              return (NULL);
--      st = initial;
--      wcsrtombs(mbs, &ws, len + 1, &st);
--
--      return (mbs);
-+      return wcscoll_l(ws1, ws2, __current_locale());
- }
index 436a324dfd41109860cb7623bab48d4bbb1172e6..167fac15a888db0a1312136df3510267bc10e4d3 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 #include <wctype.h>
 
 int
-wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+wcsncasecmp_l(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)
 {
        wchar_t c1, c2;
 
        if (n == 0)
                return (0);
        for (; *s1; s1++, s2++) {
-               c1 = towlower(*s1);
-               c2 = towlower(*s2);
+               c1 = towlower_l(*s1, loc);
+               c2 = towlower_l(*s2, loc);
                if (c1 != c2)
                        return ((int)c1 - c2);
                if (--n == 0)
@@ -47,3 +49,9 @@ wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
        }
        return (-*s2);
 }
+
+int
+wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) {
+       return wcsncasecmp_l(s1, s2, n, __current_locale());
+}
+
diff --git a/string/FreeBSD/wcsncasecmp.c.patch b/string/FreeBSD/wcsncasecmp.c.patch
deleted file mode 100644 (file)
index d1d04e6..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
---- wcsncasecmp.c.orig 2009-12-16 12:51:30.000000000 -0800
-+++ wcsncasecmp.c      2009-12-16 13:02:55.000000000 -0800
-@@ -27,19 +27,21 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- #include <wctype.h>
- int
--wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-+wcsncasecmp_l(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)
- {
-       wchar_t c1, c2;
-       if (n == 0)
-               return (0);
-       for (; *s1; s1++, s2++) {
--              c1 = towlower(*s1);
--              c2 = towlower(*s2);
-+              c1 = towlower_l(*s1, loc);
-+              c2 = towlower_l(*s2, loc);
-               if (c1 != c2)
-                       return ((int)c1 - c2);
-               if (--n == 0)
-@@ -47,3 +49,9 @@ wcsncasecmp(const wchar_t *s1, const wch
-       }
-       return (-*s2);
- }
-+
-+int
-+wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) {
-+      return wcsncasecmp_l(s1, s2, n, __current_locale());
-+}
-+
index 4ddfb040e09de019954380712673cbebb60639f7..2b8de3f50b0d6f3b593008f7197eb3aa337ec3c5 100644 (file)
 .Sh SYNOPSIS
 .In wchar.h
 .Ft wchar_t *
-.Fn wcstok "wchar_t * restrict str" "const wchar_t * restrict sep" "wchar_t ** restrict last"
+.Fo wcstok
+.Fa "wchar_t *restrict ws1"
+.Fa "const wchar_t *restrict ws2"
+.Fa "wchar_t **restrict ptr"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcstok
 function
 is used to isolate sequential tokens in a null-terminated wide character
 string,
-.Fa str .
+.Fa ws1 .
 These tokens are separated in the string by at least one of the
 characters in
-.Fa sep .
+.Fa ws2 .
 The first time that
 .Fn wcstok
 is called,
-.Fa str
+.Fa ws1
 should be specified; subsequent calls, wishing to obtain further tokens
 from the same string, should pass a null pointer instead.
 The separator string,
-.Fa sep ,
+.Fa ws2 ,
 must be supplied each time, and may change between calls.
-The context pointer
-.Fa last
+The context pointer,
+.Fa ptr ,
 must be provided on each call.
 .Pp
 The
@@ -99,8 +103,8 @@ When no more tokens remain, a null pointer is returned.
 .Sh EXAMPLES
 The following code fragment splits a wide character string on
 .Tn ASCII
-space, tab and newline characters and writes the tokens to
-standard output:
+space, tab, and newline characters,
+writing the resulting tokens to standard output:
 .Bd -literal -offset indent
 const wchar_t *seps = L" \et\en";
 wchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree  \en";
@@ -114,7 +118,7 @@ Some early implementations of
 .Fn wcstok
 omit the
 context pointer argument,
-.Fa last ,
+.Fa ptr ,
 and maintain state across calls in a static variable like
 .Fn strtok
 does.
diff --git a/string/FreeBSD/wcstok.3.patch b/string/FreeBSD/wcstok.3.patch
deleted file mode 100644 (file)
index 233597e..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
---- _SB/Libc/string/FreeBSD/wcstok.3   2003-05-20 15:23:56.000000000 -0700
-+++ _SB/Libc/string/FreeBSD/wcstok.3.edit      2006-06-28 16:55:53.000000000 -0700
-@@ -60,28 +60,32 @@
- .Sh SYNOPSIS
- .In wchar.h
- .Ft wchar_t *
--.Fn wcstok "wchar_t * restrict str" "const wchar_t * restrict sep" "wchar_t ** restrict last"
-+.Fo wcstok
-+.Fa "wchar_t *restrict ws1"
-+.Fa "const wchar_t *restrict ws2"
-+.Fa "wchar_t **restrict ptr"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcstok
- function
- is used to isolate sequential tokens in a null-terminated wide character
- string,
--.Fa str .
-+.Fa ws1 .
- These tokens are separated in the string by at least one of the
- characters in
--.Fa sep .
-+.Fa ws2 .
- The first time that
- .Fn wcstok
- is called,
--.Fa str
-+.Fa ws1
- should be specified; subsequent calls, wishing to obtain further tokens
- from the same string, should pass a null pointer instead.
- The separator string,
--.Fa sep ,
-+.Fa ws2 ,
- must be supplied each time, and may change between calls.
--The context pointer
--.Fa last
-+The context pointer,
-+.Fa ptr ,
- must be provided on each call.
- .Pp
- The
-@@ -99,8 +103,8 @@
- .Sh EXAMPLES
- The following code fragment splits a wide character string on
- .Tn ASCII
--space, tab and newline characters and writes the tokens to
--standard output:
-+space, tab, and newline characters,
-+writing the resulting tokens to standard output:
- .Bd -literal -offset indent
- const wchar_t *seps = L" \et\en";
- wchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree  \en";
-@@ -114,7 +118,7 @@
- .Fn wcstok
- omit the
- context pointer argument,
--.Fa last ,
-+.Fa ptr ,
- and maintain state across calls in a static variable like
- .Fn strtok
- does.
index 973bfe067bedc1dc636eea13a5f0369b0d5d3dfb..07eb05819e116342336f799147044c32dfce8946 100644 (file)
 .Dt WCSWIDTH 3
 .Os
 .Sh NAME
-.Nm wcswidth
+.Nm wcswidth ,
+.Nm wcswidth_l
 .Nd "number of column positions in wide-character string"
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft int
-.Fn wcswidth "const wchar_t *pwcs" "size_t n"
+.Fo wcswidth
+.Fa "const wchar_t *pwcs"
+.Fa "size_t n"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft int
+.Fo wcswidth_l
+.Fa "const wchar_t *pwcs"
+.Fa "size_t n"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcswidth
@@ -44,17 +56,26 @@ function determines the number of column positions required for the first
 characters of
 .Fa pwcs ,
 or until a null wide character (L'\e0') is encountered.
+.Pp
+Although the
+.Fn wcswidth
+function uses the current locale, the
+.Fn wcswidth_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 The
 .Fn wcswidth
 function returns 0 if
 .Fa pwcs
 is an empty string (L""),
-\-1 if a non-printing wide character is encountered,
-otherwise it returns the number of column positions occupied.
+\-1 if a non-printing wide character is encountered;
+otherwise, it returns the number of column positions occupied.
 .Sh SEE ALSO
 .Xr iswprint 3 ,
-.Xr wcwidth 3
+.Xr wcwidth 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcswidth
diff --git a/string/FreeBSD/wcswidth.3.patch b/string/FreeBSD/wcswidth.3.patch
deleted file mode 100644 (file)
index e679795..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
---- _SB/Libc/string/FreeBSD/wcswidth.3 2003-05-20 15:23:56.000000000 -0700
-+++ _SB/Libc/string/FreeBSD/wcswidth.3.edit    2006-06-28 16:55:53.000000000 -0700
-@@ -28,14 +28,26 @@
- .Dt WCSWIDTH 3
- .Os
- .Sh NAME
--.Nm wcswidth
-+.Nm wcswidth ,
-+.Nm wcswidth_l
- .Nd "number of column positions in wide-character string"
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft int
--.Fn wcswidth "const wchar_t *pwcs" "size_t n"
-+.Fo wcswidth
-+.Fa "const wchar_t *pwcs"
-+.Fa "size_t n"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft int
-+.Fo wcswidth_l
-+.Fa "const wchar_t *pwcs"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcswidth
-@@ -44,17 +56,26 @@
- characters of
- .Fa pwcs ,
- or until a null wide character (L'\e0') is encountered.
-+.Pp
-+Although the
-+.Fn wcswidth
-+function uses the current locale, the
-+.Fn wcswidth_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- The
- .Fn wcswidth
- function returns 0 if
- .Fa pwcs
- is an empty string (L""),
--\-1 if a non-printing wide character is encountered,
--otherwise it returns the number of column positions occupied.
-+\-1 if a non-printing wide character is encountered;
-+otherwise, it returns the number of column positions occupied.
- .Sh SEE ALSO
- .Xr iswprint 3 ,
--.Xr wcwidth 3
-+.Xr wcwidth 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcswidth
index 5a3801276f2fe8e8fb79a1d1baf66d5e6f4fae56..447c8e53e4358006447f6de733e63767fa918636 100644 (file)
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $");
 
+#include "xlocale_private.h"
+
 #include <wchar.h>
 
 int
-wcswidth(const wchar_t *pwcs, size_t n)
+wcswidth_l(const wchar_t *pwcs, size_t n, locale_t loc)
 {
        wchar_t wc;
        int len, l;
 
+       NORMALIZE_LOCALE(loc);
        len = 0;
        while (n-- > 0 && (wc = *pwcs++) != L'\0') {
-               if ((l = wcwidth(wc)) < 0)
+               if ((l = wcwidth_l(wc, loc)) < 0)
                        return (-1);
                len += l;
        }
        return (len);
 }
 
+
+int
+wcswidth(const wchar_t *pwcs, size_t n)
+{
+       return wcswidth_l(pwcs, n, __current_locale());
+}
+
diff --git a/string/FreeBSD/wcswidth.c.patch b/string/FreeBSD/wcswidth.c.patch
deleted file mode 100644 (file)
index e674206..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
---- wcswidth.c.bsdnew  2009-11-18 18:24:40.000000000 -0800
-+++ wcswidth.c 2009-11-18 18:24:41.000000000 -0800
-@@ -38,20 +38,30 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $");
-+#include "xlocale_private.h"
-+
- #include <wchar.h>
- int
--wcswidth(const wchar_t *pwcs, size_t n)
-+wcswidth_l(const wchar_t *pwcs, size_t n, locale_t loc)
- {
-       wchar_t wc;
-       int len, l;
-+      NORMALIZE_LOCALE(loc);
-       len = 0;
-       while (n-- > 0 && (wc = *pwcs++) != L'\0') {
--              if ((l = wcwidth(wc)) < 0)
-+              if ((l = wcwidth_l(wc, loc)) < 0)
-                       return (-1);
-               len += l;
-       }
-       return (len);
- }
-+
-+int
-+wcswidth(const wchar_t *pwcs, size_t n)
-+{
-+      return wcswidth_l(pwcs, n, __current_locale());
-+}
-+
index 16087fda6e7cc6de19958da0c534b28278ce2602..038c7c7dff7582bbbc7afb261620558f0c2f12d7 100644 (file)
 .Dt WCSXFRM 3
 .Os
 .Sh NAME
-.Nm wcsxfrm
+.Nm wcsxfrm ,
+.Nm wcsxfrm_l
 .Nd transform a wide string under locale
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft size_t
-.Fn wcsxfrm "wchar_t * restrict dst" "const wchar_t * restrict src" "size_t n"
+.Fo wcsxfrm
+.Fa "wchar_t *restrict ws1"
+.Fa "const wchar_t *restrict ws2"
+.Fa "size_t n"
+.Fc
+.In wchar.h
+.In xlocale.h
+.Ft size_t
+.Fo wcsxfrm_l
+.Fa "wchar_t *restrict ws1"
+.Fa "const wchar_t *restrict ws2"
+.Fa "size_t n"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn wcsxfrm
 function transforms a null-terminated wide character string pointed to by
-.Fa src
-according to the current locale collation order
-then copies the transformed string
-into
-.Fa dst .
+.Fa ws2 ,
+according to the current locale's collation order,
+then copies the transformed string into
+.Fa ws1 .
 No more than
 .Fa n
 wide characters are copied into
-.Fa dst ,
-including the terminating null character added.
+.Fa ws1 ,
+including the terminating null character.
 If
 .Fa n
 is set to 0
 (it helps to determine an actual size needed
 for transformation),
-.Fa dst
+.Fa ws1
 is permitted to be a
 .Dv NULL
 pointer.
@@ -76,6 +89,14 @@ after
 is equivalent to comparing
 two original strings with
 .Fn wcscoll .
+.Pp
+Although the
+.Fn wcsxfrm
+function uses the current locale, the
+.Fn wcsxfrm_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn wcsxfrm
@@ -84,13 +105,14 @@ the terminating null character.
 If this value is
 .Fa n
 or more, the contents of
-.Fa dst
+.Fa ws1
 are indeterminate.
 .Sh SEE ALSO
 .Xr setlocale 3 ,
 .Xr strxfrm 3 ,
 .Xr wcscmp 3 ,
-.Xr wcscoll 3
+.Xr wcscoll 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn wcsxfrm
@@ -116,7 +138,7 @@ always equivalent to comparison with
 .Fn wcscoll ;
 .Fn wcsxfrm
 only stores information about primary collation weights into
-.Fa dst ,
+.Fa ws1 ,
 whereas
 .Fn wcscoll
 compares characters using both primary and secondary weights.
diff --git a/string/FreeBSD/wcsxfrm.3.patch b/string/FreeBSD/wcsxfrm.3.patch
deleted file mode 100644 (file)
index f6bc4a1..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
---- wcsxfrm.3.bsdnew   2009-11-18 18:24:41.000000000 -0800
-+++ wcsxfrm.3  2009-11-18 18:24:41.000000000 -0800
-@@ -37,34 +37,47 @@
- .Dt WCSXFRM 3
- .Os
- .Sh NAME
--.Nm wcsxfrm
-+.Nm wcsxfrm ,
-+.Nm wcsxfrm_l
- .Nd transform a wide string under locale
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft size_t
--.Fn wcsxfrm "wchar_t * restrict dst" "const wchar_t * restrict src" "size_t n"
-+.Fo wcsxfrm
-+.Fa "wchar_t *restrict ws1"
-+.Fa "const wchar_t *restrict ws2"
-+.Fa "size_t n"
-+.Fc
-+.In wchar.h
-+.In xlocale.h
-+.Ft size_t
-+.Fo wcsxfrm_l
-+.Fa "wchar_t *restrict ws1"
-+.Fa "const wchar_t *restrict ws2"
-+.Fa "size_t n"
-+.Fa "locale_t loc"
-+.Fc
- .Sh DESCRIPTION
- The
- .Fn wcsxfrm
- function transforms a null-terminated wide character string pointed to by
--.Fa src
--according to the current locale collation order
--then copies the transformed string
--into
--.Fa dst .
-+.Fa ws2 ,
-+according to the current locale's collation order,
-+then copies the transformed string into
-+.Fa ws1 .
- No more than
- .Fa n
- wide characters are copied into
--.Fa dst ,
--including the terminating null character added.
-+.Fa ws1 ,
-+including the terminating null character.
- If
- .Fa n
- is set to 0
- (it helps to determine an actual size needed
- for transformation),
--.Fa dst
-+.Fa ws1
- is permitted to be a
- .Dv NULL
- pointer.
-@@ -76,6 +89,14 @@ after
- is equivalent to comparing
- two original strings with
- .Fn wcscoll .
-+.Pp
-+Although the
-+.Fn wcsxfrm
-+function uses the current locale, the
-+.Fn wcsxfrm_l
-+function may be passed a locale directly. See
-+.Xr xlocale 3
-+for more information.
- .Sh RETURN VALUES
- Upon successful completion,
- .Fn wcsxfrm
-@@ -84,13 +105,14 @@ the terminating null character.
- If this value is
- .Fa n
- or more, the contents of
--.Fa dst
-+.Fa ws1
- are indeterminate.
- .Sh SEE ALSO
- .Xr setlocale 3 ,
- .Xr strxfrm 3 ,
- .Xr wcscmp 3 ,
--.Xr wcscoll 3
-+.Xr wcscoll 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- The
- .Fn wcsxfrm
-@@ -116,7 +138,7 @@ always equivalent to comparison with
- .Fn wcscoll ;
- .Fn wcsxfrm
- only stores information about primary collation weights into
--.Fa dst ,
-+.Fa ws1 ,
- whereas
- .Fn wcscoll
- compares characters using both primary and secondary weights.
index 7aea3d13bf1f032b71476cae9089e94790488d61..eae9360170984b1b9164bfa316904ebcfceaf276 100644 (file)
@@ -31,23 +31,23 @@ __FBSDID("FreeBSD: src/lib/libc/string/strxfrm.c,v 1.15 2002/09/06 11:24:06 tjr
 #endif
 __FBSDID("$FreeBSD: src/lib/libc/string/wcsxfrm.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
 
+#include "xlocale_private.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
+#include <errno.h>
 #include "collate.h"
 
-static char *__mbsdup(const wchar_t *);
+#define WCS_XFRM_OFFSET        1
 
-/*
- * Placeholder wcsxfrm() implementation. See wcscoll.c for a description of
- * the logic used.
- */
 size_t
-wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
+wcsxfrm_l(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len,
+    locale_t loc)
 {
-       int prim, sec, l;
        size_t slen;
-       char *mbsrc, *s, *ss;
+       wchar_t *xf[2];
+       int sverrno;
 
        if (*src == L'\0') {
                if (len != 0)
@@ -55,7 +55,8 @@ wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
                return (0);
        }
 
-       if (__collate_load_error || MB_CUR_MAX > 1) {
+       NORMALIZE_LOCALE(loc);
+       if (loc->__collate_load_error) {
                slen = wcslen(src);
                if (len > 0) {
                        if (slen < len)
@@ -68,49 +69,41 @@ wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
                return (slen);
        }
 
-       mbsrc = __mbsdup(src);
-       slen = 0;
-       prim = sec = 0;
-       ss = s = __collate_substitute(mbsrc);
-       while (*s != '\0') {
-               while (*s != '\0' && prim == 0) {
-                       __collate_lookup(s, &l, &prim, &sec);
-                       s += l;
+       __collate_xfrm(src, xf, loc);
+
+       slen = wcslen(xf[0]);
+       if (xf[1])
+               slen += wcslen(xf[1]) + 1;
+       if (len > 0) {
+               wchar_t *w = xf[0];
+               while (len > 1) {
+                       if (!*w)
+                               break;
+                       *dest++ = *w++ + WCS_XFRM_OFFSET;
+                       len--;
                }
-               if (prim != 0) {
-                       if (len > 1) {
-                               *dest++ = (wchar_t)prim;
+               if ((w = xf[1]) != NULL) {
+                       if (len > 1)
+                               *dest++ = WCS_XFRM_OFFSET;
+                       while (len > 1) {
+                               if (!*w)
+                                       break;
+                               *dest++ = *w++ + WCS_XFRM_OFFSET;
                                len--;
                        }
-                       slen++;
-                       prim = 0;
                }
-       }
-       free(ss);
-       free(mbsrc);
-       if (len != 0)
-               *dest = L'\0';
-
+               *dest = 0;
+       }
+       sverrno = errno;
+       free(xf[0]);
+       free(xf[1]);
+       errno = sverrno;
        return (slen);
 }
 
-static char *
-__mbsdup(const wchar_t *ws)
+size_t
+wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
 {
-       static const mbstate_t initial;
-       mbstate_t st;
-       const wchar_t *wcp;
-       size_t len;
-       char *mbs;
-
-       wcp = ws;
-       st = initial;
-       if ((len = wcsrtombs(NULL, &wcp, 0, &st)) == (size_t)-1)
-               return (NULL);
-       if ((mbs = malloc(len + 1)) == NULL)
-               return (NULL);
-       st = initial;
-       wcsrtombs(mbs, &ws, len + 1, &st);
-
-       return (mbs);
+       return wcsxfrm_l(dest, src, len, __current_locale());
 }
diff --git a/string/FreeBSD/wcsxfrm.c.patch b/string/FreeBSD/wcsxfrm.c.patch
deleted file mode 100644 (file)
index a1a9e0c..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
---- wcsxfrm.c.orig     2004-11-25 11:38:47.000000000 -0800
-+++ wcsxfrm.c  2005-03-30 15:06:45.000000000 -0800
-@@ -31,23 +31,23 @@
- #endif
- __FBSDID("$FreeBSD: src/lib/libc/string/wcsxfrm.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
-+#include "xlocale_private.h"
-+
- #include <stdlib.h>
- #include <string.h>
- #include <wchar.h>
-+#include <errno.h>
- #include "collate.h"
--static char *__mbsdup(const wchar_t *);
-+#define WCS_XFRM_OFFSET       1
--/*
-- * Placeholder wcsxfrm() implementation. See wcscoll.c for a description of
-- * the logic used.
-- */
- size_t
--wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
-+wcsxfrm_l(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len,
-+    locale_t loc)
- {
--      int prim, sec, l;
-       size_t slen;
--      char *mbsrc, *s, *ss;
-+      wchar_t *xf[2];
-+      int sverrno;
-       if (*src == L'\0') {
-               if (len != 0)
-@@ -55,7 +55,8 @@
-               return (0);
-       }
--      if (__collate_load_error || MB_CUR_MAX > 1) {
-+      NORMALIZE_LOCALE(loc);
-+      if (loc->__collate_load_error) {
-               slen = wcslen(src);
-               if (len > 0) {
-                       if (slen < len)
-@@ -68,49 +69,41 @@
-               return (slen);
-       }
--      mbsrc = __mbsdup(src);
--      slen = 0;
--      prim = sec = 0;
--      ss = s = __collate_substitute(mbsrc);
--      while (*s != '\0') {
--              while (*s != '\0' && prim == 0) {
--                      __collate_lookup(s, &l, &prim, &sec);
--                      s += l;
-+      __collate_xfrm(src, xf, loc);
-+
-+      slen = wcslen(xf[0]);
-+      if (xf[1])
-+              slen += wcslen(xf[1]) + 1;
-+      if (len > 0) {
-+              wchar_t *w = xf[0];
-+              while (len > 1) {
-+                      if (!*w)
-+                              break;
-+                      *dest++ = *w++ + WCS_XFRM_OFFSET;
-+                      len--;
-               }
--              if (prim != 0) {
--                      if (len > 1) {
--                              *dest++ = (wchar_t)prim;
-+              if ((w = xf[1]) != NULL) {
-+                      if (len > 1)
-+                              *dest++ = WCS_XFRM_OFFSET;
-+                      while (len > 1) {
-+                              if (!*w)
-+                                      break;
-+                              *dest++ = *w++ + WCS_XFRM_OFFSET;
-                               len--;
-                       }
--                      slen++;
--                      prim = 0;
-               }
--      }
--      free(ss);
--      free(mbsrc);
--      if (len != 0)
--              *dest = L'\0';
--
-+              *dest = 0;
-+      }
-+      sverrno = errno;
-+      free(xf[0]);
-+      free(xf[1]);
-+      errno = sverrno;
-+ 
-       return (slen);
- }
--static char *
--__mbsdup(const wchar_t *ws)
-+size_t
-+wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
- {
--      static const mbstate_t initial;
--      mbstate_t st;
--      const wchar_t *wcp;
--      size_t len;
--      char *mbs;
--
--      wcp = ws;
--      st = initial;
--      if ((len = wcsrtombs(NULL, &wcp, 0, &st)) == (size_t)-1)
--              return (NULL);
--      if ((mbs = malloc(len + 1)) == NULL)
--              return (NULL);
--      st = initial;
--      wcsrtombs(mbs, &ws, len + 1, &st);
--
--      return (mbs);
-+      return wcsxfrm_l(dest, src, len, __current_locale());
- }
index 41b0ac0d1d5947797823e62d616e3e2bc1c6c070..2e1d3ecb0ecf705439b588f2c9b7fab6ce26482a 100644 (file)
 .Dt WMEMCHR 3
 .Os
 .Sh NAME
-.Nm wmemchr ,
-.Nm wmemcmp ,
-.Nm wmemcpy ,
-.Nm wmemmove ,
-.Nm wmemset ,
 .Nm wcpcpy ,
 .Nm wcpncpy ,
 .Nm wcscasecmp ,
 .Nm wcspbrk ,
 .Nm wcsrchr ,
 .Nm wcsspn ,
-.Nm wcsstr
+.Nm wcsstr ,
+.Nm wmemchr ,
+.Nm wmemcmp ,
+.Nm wmemcpy ,
+.Nm wmemmove ,
+.Nm wmemset
 .Nd wide character string manipulation operations
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In wchar.h
 .Ft wchar_t *
-.Fn wmemchr "const wchar_t *s" "wchar_t c" "size_t n"
-.Ft int
-.Fn wmemcmp "const wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft wchar_t *
-.Fn wmemcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
-.Ft wchar_t *
-.Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft wchar_t *
-.Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
-.Ft wchar_t *
 .Fn wcpcpy "wchar_t *s1" "wchar_t *s2"
 .Ft wchar_t *
 .Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n"
 .Fn wcsspn "const wchar_t *s1" "const wchar_t *s2"
 .Ft wchar_t *
 .Fn wcsstr "const wchar_t * restrict s1" "const wchar_t * restrict s2"
+.Ft wchar_t *
+.Fn wmemchr "const wchar_t *s" "wchar_t c" "size_t n"
+.Ft int
+.Fn wmemcmp "const wchar_t *s1" "const wchar_t *s2" "size_t n"
+.Ft wchar_t *
+.Fn wmemcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
+.Ft wchar_t *
+.Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n"
+.Ft wchar_t *
+.Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
+.In wchar.h
+.In xlocale.h
+.Ft int
+.Fn wcscasecmp_l "const wchar_t *s1" "const wchar_t *s2" "locale_t loc"
+.Ft int
+.Fn wcsncasecmp_l "const wchar_t *s1" "const wchar_t *s2" "size_t n" "locale_t loc"
 .Sh DESCRIPTION
 The functions implement string manipulation operations over wide character
 strings.
@@ -137,6 +143,7 @@ counterpart, such as
 .Xr stpcpy 3 ,
 .Xr stpncpy 3 ,
 .Xr strcasecmp 3 ,
+.Xr strcasecmp_l 3 ,
 .Xr strcat 3 ,
 .Xr strchr 3 ,
 .Xr strcmp 3 ,
@@ -146,6 +153,8 @@ counterpart, such as
 .Xr strlcat 3 ,
 .Xr strlcpy 3 ,
 .Xr strlen 3 ,
+.Xr strncasecmp 3 ,
+.Xr strncasecmp_l 3 ,
 .Xr strncat 3 ,
 .Xr strncmp 3 ,
 .Xr strncpy 3 ,
@@ -153,7 +162,8 @@ counterpart, such as
 .Xr strpbrk 3 ,
 .Xr strrchr 3 ,
 .Xr strspn 3 ,
-.Xr strstr 3
+.Xr strstr 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 These functions conform to
 .St -isoC-99 ,
@@ -161,8 +171,10 @@ with the exception of
 .Fn wcpcpy ,
 .Fn wcpncpy ,
 .Fn wcscasecmp ,
+.Fn wcscasecmp_l ,
 .Fn wcsdup ,
 .Fn wcsncasecmp ,
+.Fn wcsncasecmp_l ,
 and
 .Fn wcsnlen ,
 which conform to
diff --git a/string/FreeBSD/wmemchr.3.patch b/string/FreeBSD/wmemchr.3.patch
deleted file mode 100644 (file)
index b2ba5da..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
---- wmemchr.3.orig     2009-12-16 13:19:24.000000000 -0800
-+++ wmemchr.3  2009-12-16 13:30:23.000000000 -0800
-@@ -39,11 +39,6 @@
- .Dt WMEMCHR 3
- .Os
- .Sh NAME
--.Nm wmemchr ,
--.Nm wmemcmp ,
--.Nm wmemcpy ,
--.Nm wmemmove ,
--.Nm wmemset ,
- .Nm wcpcpy ,
- .Nm wcpncpy ,
- .Nm wcscasecmp ,
-@@ -64,23 +59,18 @@
- .Nm wcspbrk ,
- .Nm wcsrchr ,
- .Nm wcsspn ,
--.Nm wcsstr
-+.Nm wcsstr ,
-+.Nm wmemchr ,
-+.Nm wmemcmp ,
-+.Nm wmemcpy ,
-+.Nm wmemmove ,
-+.Nm wmemset
- .Nd wide character string manipulation operations
- .Sh LIBRARY
- .Lb libc
- .Sh SYNOPSIS
- .In wchar.h
- .Ft wchar_t *
--.Fn wmemchr "const wchar_t *s" "wchar_t c" "size_t n"
--.Ft int
--.Fn wmemcmp "const wchar_t *s1" "const wchar_t *s2" "size_t n"
--.Ft wchar_t *
--.Fn wmemcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
--.Ft wchar_t *
--.Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n"
--.Ft wchar_t *
--.Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
--.Ft wchar_t *
- .Fn wcpcpy "wchar_t *s1" "wchar_t *s2"
- .Ft wchar_t *
- .Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n"
-@@ -122,6 +112,22 @@
- .Fn wcsspn "const wchar_t *s1" "const wchar_t *s2"
- .Ft wchar_t *
- .Fn wcsstr "const wchar_t * restrict s1" "const wchar_t * restrict s2"
-+.Ft wchar_t *
-+.Fn wmemchr "const wchar_t *s" "wchar_t c" "size_t n"
-+.Ft int
-+.Fn wmemcmp "const wchar_t *s1" "const wchar_t *s2" "size_t n"
-+.Ft wchar_t *
-+.Fn wmemcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
-+.Ft wchar_t *
-+.Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n"
-+.Ft wchar_t *
-+.Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
-+.In wchar.h
-+.In xlocale.h
-+.Ft int
-+.Fn wcscasecmp_l "const wchar_t *s1" "const wchar_t *s2" "locale_t loc"
-+.Ft int
-+.Fn wcsncasecmp_l "const wchar_t *s1" "const wchar_t *s2" "size_t n" "locale_t loc"
- .Sh DESCRIPTION
- The functions implement string manipulation operations over wide character
- strings.
-@@ -137,6 +143,7 @@ counterpart, such as
- .Xr stpcpy 3 ,
- .Xr stpncpy 3 ,
- .Xr strcasecmp 3 ,
-+.Xr strcasecmp_l 3 ,
- .Xr strcat 3 ,
- .Xr strchr 3 ,
- .Xr strcmp 3 ,
-@@ -146,6 +153,8 @@ counterpart, such as
- .Xr strlcat 3 ,
- .Xr strlcpy 3 ,
- .Xr strlen 3 ,
-+.Xr strncasecmp 3 ,
-+.Xr strncasecmp_l 3 ,
- .Xr strncat 3 ,
- .Xr strncmp 3 ,
- .Xr strncpy 3 ,
-@@ -153,7 +162,8 @@ counterpart, such as
- .Xr strpbrk 3 ,
- .Xr strrchr 3 ,
- .Xr strspn 3 ,
--.Xr strstr 3
-+.Xr strstr 3 ,
-+.Xr xlocale 3
- .Sh STANDARDS
- These functions conform to
- .St -isoC-99 ,
-@@ -161,8 +171,10 @@ with the exception of
- .Fn wcpcpy ,
- .Fn wcpncpy ,
- .Fn wcscasecmp ,
-+.Fn wcscasecmp_l ,
- .Fn wcsdup ,
- .Fn wcsncasecmp ,
-+.Fn wcsncasecmp_l ,
- and
- .Fn wcsnlen ,
- which conform to
diff --git a/string/Makefile.inc b/string/Makefile.inc
deleted file mode 100644 (file)
index 41191f6..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-#      @(#)Makefile.inc        8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/string/Makefile.inc,v 1.32 2002/11/18 09:50:56 ru Exp $
-
-# machine-dependent string sources
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/string/Makefile.inc"
-
-.PATH: ${.CURDIR}/string
-CWD := ${.CURDIR}/string
-
-CFLAGS+= -I${.CURDIR}/locale
-
-.include "Makefile.fbsd_begin"
-# machine-independent string sources
-FBSDMISRCS+=bcmp.c index.c memccpy.c memchr.c memcmp.c memmem.c \
-       memset.c rindex.c stpcpy.c stpncpy.c strcasecmp.c strcat.c \
-       strchr.c strcoll.c strcpy.c strcspn.c strdup.c strndup.c strerror.c \
-       strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c strncpy.c strnlen.c \
-       strcasestr.c strnstr.c \
-       strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \
-       strxfrm.c swab.c \
-       wcpcpy.c wcpncpy.c wcscasecmp.c wcsncasecmp.c \
-       wcscat.c wcschr.c wcscmp.c wcscoll.c wcscpy.c \
-       wcscspn.c wcsdup.c wcslcat.c wcslcpy.c \
-       wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcsnlen.c wcspbrk.c \
-       wcsrchr.c wcsspn.c wcsstr.c wcstok.c wcswidth.c wcsxfrm.c wmemchr.c \
-       wmemcmp.c \
-       wmemcpy.c wmemmove.c wmemset.c
-.include "Makefile.fbsd_end"
-
-DYLDSRCS += \
-       strcat.c  \
-       strchr.c  \
-       strcpy.c  \
-       strdup.c  \
-       strlcat.c \
-       strlcpy.c \
-       strncmp.c \
-       strncpy.c \
-       strrchr.c \
-       strstr.c
-
-LEGACYSRCS+= strerror.c
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-strerror-fbsd.c += -DLIBC_ALIAS_STRERROR
-
-.if ${LIB} == "c"
-.include "Makefile.fbsd_begin"
-FBSDMAN3= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
-       memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 rindex.3 strcasecmp.3 strcat.3 \
-       strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \
-       string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strrchr.3 strsep.3 \
-       strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \
-       wcswidth.3 wcsxfrm.3 wmemchr.3
-.include "Makefile.fbsd_end"
-
-MLINKS+= ffs.3 ffsl.3                          \
-         ffs.3 fls.3                           \
-         ffs.3 flsl.3
-
-MLINKS+= strcasecmp.3 strcasecmp_l.3           \
-         strcasecmp.3 strncasecmp.3            \
-         strcasecmp.3 strncasecmp_l.3
-
-MLINKS+= strcat.3 strncat.3
-
-MLINKS+= strcmp.3 strncmp.3
-
-MLINKS+= strcoll.3 strcoll_l.3
-
-MLINKS+= strcpy.3 stpcpy.3                     \
-         strcpy.3 stpncpy.3                    \
-         strcpy.3 strncpy.3
-
-MLINKS+= strdup.3 strndup.3
-
-MLINKS+= strlen.3 strnlen.3
-
-MLINKS+= strerror.3 perror.3                   \
-         strerror.3 strerror_r.3               \
-         strerror.3 sys_errlist.3              \
-         strerror.3 sys_nerr.3
-
-MLINKS+= strlcpy.3 strlcat.3
-
-MLINKS+= strtok.3 strtok_r.3
-
-MLINKS+= strstr.3 strcasestr.3                 \
-         strstr.3 strcasestr_l.3               \
-         strstr.3 strnstr.3
-
-MLINKS+= strxfrm.3 strxfrm_l.3
-
-MLINKS+= wcscoll.3 wcscoll_l.3
-
-MLINKS+= wcswidth.3 wcswidth_l.3
-
-MLINKS+= wcsxfrm.3 wcsxfrm_l.3
-
-MLINKS+= wmemchr.3 wmemcmp.3                   \
-         wmemchr.3 wmemcpy.3                   \
-         wmemchr.3 wmemmove.3                  \
-         wmemchr.3 wmemset.3                   \
-         wmemchr.3 wcpcpy.3                    \
-         wmemchr.3 wcpncpy.3                   \
-         wmemchr.3 wcsdup.3                    \
-         wmemchr.3 wcscasecmp.3                        \
-         wmemchr.3 wcscasecmp_l.3              \
-         wmemchr.3 wcscat.3                    \
-         wmemchr.3 wcschr.3                    \
-         wmemchr.3 wcscmp.3                    \
-         wmemchr.3 wcscpy.3                    \
-         wmemchr.3 wcscspn.3                   \
-         wmemchr.3 wcslcat.3                   \
-         wmemchr.3 wcslcpy.3                   \
-         wmemchr.3 wcslen.3                    \
-         wmemchr.3 wcsncasecmp.3               \
-         wmemchr.3 wcsncasecmp_l.3             \
-         wmemchr.3 wcsncat.3                   \
-         wmemchr.3 wcsncmp.3                   \
-         wmemchr.3 wcsncpy.3                   \
-         wmemchr.3 wcsnlen.3                   \
-         wmemchr.3 wcspbrk.3                   \
-         wmemchr.3 wcsrchr.3                   \
-         wmemchr.3 wcsspn.3                    \
-         wmemchr.3 wcsstr.3
-
-MAN3+= memset_pattern.3
-
-MLINKS+= memset_pattern.3 memset_pattern4.3    \
-         memset_pattern.3 memset_pattern8.3    \
-         memset_pattern.3 memset_pattern16.3
-
-.endif
diff --git a/string/bcmp-fbsd.c b/string/bcmp-fbsd.c
deleted file mode 120000 (symlink)
index 354ed88..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./bcmp.c
\ No newline at end of file
diff --git a/string/bcmp.3 b/string/bcmp.3
deleted file mode 100644 (file)
index 67f456b..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)bcmp.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/bcmp.3,v 1.11 2007/01/09 00:28:11 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt BCMP 3
-.Os
-.Sh NAME
-.Nm bcmp
-.Nd compare byte string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft int
-.Fn bcmp "const void *s1" "const void *s2" "size_t n"
-.Sh DESCRIPTION
-The
-.Fn bcmp
-function
-compares byte string
-.Fa s1
-against byte string
-.Fa s2 ,
-returning zero if they are identical, non-zero otherwise.
-Both strings are assumed to be
-.Fa n
-bytes long.
-Zero-length strings are always identical.
-.Pp
-The strings may overlap.
-.Sh SEE ALSO
-.Xr memcmp 3 ,
-.Xr strcasecmp 3 ,
-.Xr strcmp 3 ,
-.Xr strcoll 3 ,
-.Xr strxfrm 3
-.Sh HISTORY
-A
-.Fn bcmp
-function first appeared in
-.Bx 4.2 .
-Its prototype existed previously in
-.In string.h
-before it was moved to
-.In strings.h
-for
-.St -p1003.1-2001
-compliance.
diff --git a/string/bcopy.3 b/string/bcopy.3
deleted file mode 100644 (file)
index e0371a4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)bcopy.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/bcopy.3,v 1.10 2007/01/09 00:28:11 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt BCOPY 3
-.Os
-.Sh NAME
-.Nm bcopy
-.Nd copy byte string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft void
-.Fn bcopy "const void *s1" "void *s2" "size_t n"
-.Sh DESCRIPTION
-The
-.Fn bcopy
-function
-copies
-.Fa n
-bytes from string
-.Fa s1
-to string
-.Fa s2 .
-The two strings may overlap.
-If
-.Fa n
-is zero, no bytes are copied.
-.Sh SEE ALSO
-.Xr memccpy 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr strcpy 3 ,
-.Xr strncpy 3
-.Sh HISTORY
-A
-.Fn bcopy
-function appeared in
-.Bx 4.2 .
-Its prototype existed previously in
-.In string.h
-before it was moved to
-.In strings.h
-for
-.St -p1003.1-2001
-compliance.
diff --git a/string/bstring.3 b/string/bstring.3
deleted file mode 100644 (file)
index 4b34387..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)bstring.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/bstring.3,v 1.8 2007/01/09 00:28:11 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt BSTRING 3
-.Os
-.Sh NAME
-.Nm bcmp ,
-.Nm bcopy ,
-.Nm bzero ,
-.Nm memccpy ,
-.Nm memchr ,
-.Nm memcmp ,
-.Nm memcpy ,
-.Nm memmove ,
-.Nm memset
-.Nd byte string operations
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft int
-.Fo bcmp
-.Fa "const void *s1"
-.Fa "const void *s2"
-.Fa "size_t n"
-.Fc
-.Ft void
-.Fo bcopy
-.Fa "const void *s1"
-.Fa "void *s2"
-.Fa "size_t n"
-.Fc
-.Ft void
-.Fo bzero
-.Fa "void *s"
-.Fa "size_t n"
-.Fc
-.In string.h
-.Ft void *
-.Fo memccpy
-.Fa "void *restrict s1"
-.Fa "const void *restrict s2"
-.Fa "int c"
-.Fa "size_t n"
-.Fc
-.Ft void *
-.Fo memchr
-.Fa "const void *s"
-.Fa "int c"
-.Fa "size_t n"
-.Fc
-.Ft int
-.Fo memcmp
-.Fa "const void *s1"
-.Fa "const void *s2"
-.Fa "size_t n"
-.Fc
-.Ft void *
-.Fo memcpy
-.Fa "void *restrict s1"
-.Fa "const void *restrict s2"
-.Fa "size_t n"
-.Fc
-.Ft void *
-.Fo memmove
-.Fa "void *s1"
-.Fa "const void *s2"
-.Fa "size_t n"
-.Fc
-.Ft void *
-.Fo memset
-.Fa "void *s"
-.Fa "int c"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-These functions operate on variable length strings of bytes.
-They do not check for terminating null bytes, as the routines
-listed in
-.Xr string 3
-do.
-.Pp
-See the specific manual pages for more information.
-.Sh LEGACY SYNOPSIS
-.Fd #include <string.h>
-.Pp
-The include file
-.In string.h
-is necessary and sufficient for all functions.
-.Sh SEE ALSO
-.Xr bcmp 3 ,
-.Xr bcopy 3 ,
-.Xr bzero 3 ,
-.Xr memccpy 3 ,
-.Xr memchr 3 ,
-.Xr memcmp 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr memset 3 ,
-.Xr compat 5
-.Sh STANDARDS
-The functions
-.Fn memchr ,
-.Fn memcmp ,
-.Fn memcpy ,
-.Fn memmove ,
-and
-.Fn memset
-conform to
-.St -isoC .
-.Sh HISTORY
-The functions
-.Fn bzero
-and
-.Fn memccpy
-appeared in
-.Bx 4.3 ;
-the functions
-.Fn bcmp ,
-.Fn bcopy ,
-appeared in
-.Bx 4.2 .
diff --git a/string/bzero.3 b/string/bzero.3
deleted file mode 100644 (file)
index 642b2f1..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"    @(#)bzero.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/bzero.3,v 1.10 2007/01/09 00:28:11 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt BZERO 3
-.Os
-.Sh NAME
-.Nm bzero
-.Nd write zeroes to a byte string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft void
-.Fn bzero "void *s" "size_t n"
-.Sh DESCRIPTION
-The
-.Fn bzero
-function
-writes
-.Fa n
-zeroed bytes to the string
-.Fa s .
-If
-.Fa n
-is zero,
-.Fn bzero
-does nothing.
-.Sh SEE ALSO
-.Xr memset 3 ,
-.Xr swab 3
-.Sh HISTORY
-A
-.Fn bzero
-function
-appeared in
-.Bx 4.3 .
-Its prototype existed previously in
-.In string.h
-before it was moved to
-.In strings.h
-for
-.St -p1003.1-2001
-compliance.
diff --git a/string/ffs.3 b/string/ffs.3
deleted file mode 100644 (file)
index d019b6d..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)ffs.3      8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/string/ffs.3,v 1.13 2009/01/13 13:19:42 kib Exp $
-.\"
-.Dd October 26, 2008
-.Dt FFS 3
-.Os
-.Sh NAME
-.Nm ffs ,
-.Nm ffsl ,
-.Nm fls ,
-.Nm flsl
-.Nd find first or last bit set in a bit string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft int
-.Fn ffs "int i"
-.Ft int
-.Fn ffsl "long i"
-.Ft int
-.Fn fls "int i"
-.Ft int
-.Fn flsl "long i"
-.Sh DESCRIPTION
-The
-.Fn ffs
-and
-.Fn ffsl
-functions find the first bit set
-(beginning with the least significant bit)
-in
-.Fa i
-and return the index of that bit.
-.Pp
-The
-.Fn fls
-and
-.Fn flsl
-functions find the last bit set in
-.Fa i
-and return the index of that bit.
-.Pp
-Bits are numbered starting at 1 (the least significant bit).
-A return value of zero from any of these functions means that the
-argument was zero.
-.Sh SEE ALSO
-.Xr bitstring 3
-.Sh HISTORY
-The
-.Fn ffs
-function appeared in
-.Bx 4.3 .
-Its prototype existed previously in
-.In string.h
-before it was moved to
-.In strings.h
-for
-.St -p1003.1-2001
-compliance.
-.Pp
-The
-.Fn ffsl ,
-.Fn fls ,
-and
-.Fn flsl
-functions appeared in
-.Fx 5.3 .
diff --git a/string/index-fbsd.c b/string/index-fbsd.c
deleted file mode 120000 (symlink)
index d789f40..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./index.c
\ No newline at end of file
diff --git a/string/index.3 b/string/index.3
deleted file mode 100644 (file)
index ecbbb63..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)index.3    8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/index.3,v 1.12 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt INDEX 3
-.Os
-.Sh NAME
-.Nm index , rindex
-.Nd locate character in string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft "char *"
-.Fn index "const char *s" "int c"
-.Ft "char *"
-.Fn rindex "const char *s" "int c"
-.Sh DESCRIPTION
-The
-.Fn index
-function
-locates the first occurrence of
-.Fa c
-(converted to a
-.Vt char )
-in the string pointed to by
-.Fa s .
-The terminating null character is considered to be part of the string;
-therefore, if
-.Fa c
-is
-.Ql \e0 ,
-the functions locate the terminating
-.Ql \e0 .
-.Pp
-The
-.Fn rindex
-function is identical to
-.Fn index ,
-except that it locates the last occurrence of
-.Fa c .
-.Sh RETURN VALUES
-The functions
-.Fn index
-and
-.Fn rindex
-return a pointer to the located character, or
-.Dv NULL
-if the character does not appear in the string.
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh HISTORY
-The
-.Fn index
-and
-.Fn rindex
-functions appeared in
-.At v6 .
-Their prototypes existed previously in
-.In string.h
-before they were moved to
-.In strings.h
-for
-.St -p1003.1-2001
-compliance.
diff --git a/string/memccpy-fbsd.c b/string/memccpy-fbsd.c
deleted file mode 120000 (symlink)
index 44404f4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./memccpy.c
\ No newline at end of file
diff --git a/string/memccpy.3 b/string/memccpy.3
deleted file mode 100644 (file)
index 02cfa37..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memccpy.3  8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/string/memccpy.3,v 1.7 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd June 9, 1993
-.Dt MEMCCPY 3
-.Os
-.Sh NAME
-.Nm memccpy
-.Nd copy string until character found
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft void *
-.Fo memccpy
-.Fa "void *restrict s1"
-.Fa "const void *restrict s2"
-.Fa "int c"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn memccpy
-function
-copies bytes from string
-.Fa s2
-to string
-.Fa s1 .
-If the character
-.Fa c
-(as converted to an unsigned char) occurs in the string
-.Fa s2 ,
-the copy stops and a pointer to the byte after the copy of
-.Fa c
-in the string
-.Fa s1
-is returned.
-Otherwise,
-.Fa n
-bytes are copied, and a NULL pointer is returned.
-.Pp
-The source and destination strings should not overlap, as the
-behavior is undefined.
-.Sh SEE ALSO
-.Xr bcopy 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr strcpy 3
-.Sh HISTORY
-The
-.Fn memccpy
-function first appeared in
-.Bx 4.4 .
diff --git a/string/memchr-fbsd.c b/string/memchr-fbsd.c
deleted file mode 120000 (symlink)
index c6fcee6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./memchr.c
\ No newline at end of file
diff --git a/string/memchr.3 b/string/memchr.3
deleted file mode 100644 (file)
index 430441b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memchr.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/memchr.3,v 1.12 2009/04/23 08:37:56 brueffer Exp $
-.\"
-.Dd April 9, 2008
-.Dt MEMCHR 3
-.Os
-.Sh NAME
-.Nm memchr
-.Nd locate byte in byte string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft void *
-.Fo memchr
-.Fa "const void *s"
-.Fa "int c"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn memchr
-function
-locates the first occurrence of
-.Fa c
-(converted to an unsigned char)
-in string
-.Fa s .
-.Sh RETURN VALUES
-The
-.Fn memchr
-function
-returns a pointer to the byte located,
-or NULL if no such byte exists within
-.Fa n
-bytes.
-.Sh SEE ALSO
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3 ,
-.Xr wmemchr 3
-.Sh STANDARDS
-The
-.Fn memchr
-function
-conforms to
-.St -isoC .
diff --git a/string/memcmp-fbsd.c b/string/memcmp-fbsd.c
deleted file mode 120000 (symlink)
index d50831d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./memcmp.c
\ No newline at end of file
diff --git a/string/memcmp.3 b/string/memcmp.3
deleted file mode 100644 (file)
index f48f5d4..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memcmp.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/memcmp.3,v 1.10 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 4, 1993
-.Dt MEMCMP 3
-.Os
-.Sh NAME
-.Nm memcmp
-.Nd compare byte string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft int
-.Fo memcmp 
-.Fa "const void *s1"
-.Fa "const void *s2"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn memcmp
-function
-compares byte string
-.Fa s1
-against byte string
-.Fa s2 .
-Both strings are assumed to be
-.Fa n
-bytes long.
-.Sh RETURN VALUES
-The
-.Fn memcmp
-function
-returns zero if the two strings are identical,
-otherwise returns the difference between the first two differing bytes
-(treated as unsigned char values, so that
-.Sq Li \e200
-is greater than
-.Sq Li \&\e0 ,
-for example).
-Zero-length strings are always identical.
-.Sh SEE ALSO
-.Xr bcmp 3 ,
-.Xr strcasecmp 3 ,
-.Xr strcmp 3 ,
-.Xr strcoll 3 ,
-.Xr strxfrm 3 ,
-.Xr wmemcmp 3
-.Sh STANDARDS
-The
-.Fn memcmp
-function
-conforms to
-.St -isoC .
diff --git a/string/memcpy.3 b/string/memcpy.3
deleted file mode 100644 (file)
index 77bd719..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memcpy.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/memcpy.3,v 1.9 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 4, 1993
-.Dt MEMCPY 3
-.Os
-.Sh NAME
-.Nm memcpy
-.Nd copy memory area
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft void *
-.Fo memcpy
-.Fa "void *restrict s1"
-.Fa "const void *restrict s2"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn memcpy
-function
-copies
-.Fa n
-bytes from memory area
-.Fa s2
-to memory area
-.Fa s1 .
-If 
-.Fa s1
-and 
-.Fa s2
-overlap, behavior is undefined.
-Applications in which
-.Fa s1
-and 
-.Fa s2 
-might overlap should use
-.Xr memmove 3
-instead.
-.Sh RETURN VALUES
-The
-.Fn memcpy
-function
-returns the original value of
-.Fa s1 .
-.Sh SEE ALSO
-.Xr bcopy 3 ,
-.Xr memccpy 3 ,
-.Xr memmove 3 ,
-.Xr strcpy 3 ,
-.Xr wmemcpy 3
-.Sh STANDARDS
-The
-.Fn memcpy
-function
-conforms to
-.St -isoC .
diff --git a/string/memmem-fbsd.c b/string/memmem-fbsd.c
deleted file mode 120000 (symlink)
index 845d9f1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./memmem.c
\ No newline at end of file
diff --git a/string/memmem.3 b/string/memmem.3
deleted file mode 120000 (symlink)
index 9b3234e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./memmem.3
\ No newline at end of file
diff --git a/string/memmove.3 b/string/memmove.3
deleted file mode 100644 (file)
index 64871c8..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memmove.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/memmove.3,v 1.8 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 4, 1993
-.Dt MEMMOVE 3
-.Os
-.Sh NAME
-.Nm memmove
-.Nd copy byte string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft void *
-.Fo memmove
-.Fa "void *s1"
-.Fa "const void *s2"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn memmove
-function
-copies
-.Fa n
-bytes from string
-.Fa s2
-to string
-.Fa s1 .
-The two strings may overlap;
-the copy is always done in a non-destructive manner.
-.Sh RETURN VALUES
-The
-.Fn memmove
-function returns the original value of
-.Fa s1 .
-.Sh SEE ALSO
-.Xr bcopy 3 ,
-.Xr memccpy 3 ,
-.Xr memcpy 3 ,
-.Xr strcpy 3 ,
-.Xr wmemmove 3
-.Sh STANDARDS
-The
-.Fn memmove
-function
-conforms to
-.St -isoC .
diff --git a/string/memset-fbsd.c b/string/memset-fbsd.c
deleted file mode 120000 (symlink)
index 0ea82de..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./memset.c
\ No newline at end of file
diff --git a/string/memset.3 b/string/memset.3
deleted file mode 100644 (file)
index 701d739..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)memset.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/memset.3,v 1.9 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 4, 1993
-.Dt MEMSET 3
-.Os
-.Sh NAME
-.Nm memset
-.Nd fill a byte string with a byte value
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft void *
-.Fn memset "void *b" "int c" "size_t len"
-.Sh DESCRIPTION
-The
-.Fn memset
-function
-writes
-.Fa len
-bytes of value
-.Fa c
-(converted to an unsigned char) to the byte string
-.Fa b .
-.Sh RETURN VALUES
-The
-.Fn memset
-function returns its first argument.
-.Sh SEE ALSO
-.Xr bzero 3 ,
-.Xr memset_pattern 3 ,
-.Xr swab 3 ,
-.Xr wmemset 3
-.Sh STANDARDS
-The
-.Fn memset
-function
-conforms to
-.St -isoC .
diff --git a/string/memset_pattern.c b/string/memset_pattern.c
new file mode 100644 (file)
index 0000000..ebeb780
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+
+#include <stdio.h>
+
+void
+bcopy(const void *src0, void *dst0, size_t length);
+
+void
+memset_pattern4(void *b, const void *pattern4, size_t len)
+{
+       char * start = (char *)b;
+       char * p = (char *)b;
+       while ((start + len) - p >= 4) {
+               bcopy(pattern4, p, 4);
+               p += 4;
+       }
+       if ((start + len) - p != 0) {
+               bcopy(pattern4, p, (start + len) - p);
+       }
+}
+
+void
+memset_pattern8(void *b, const void *pattern8, size_t len)
+{
+       char * start = (char *)b;
+       char * p = (char *)b;
+       while ((start + len) - p >= 8) {
+               bcopy(pattern8, p, 8);
+               p += 8;
+       }
+       if ((start + len) - p != 0) {
+               bcopy(pattern8, p, (start + len) - p);
+       }
+
+}
+
+void
+memset_pattern16(void *b, const void *pattern16, size_t len)
+{
+       char * start = (char *)b;
+       char * p = (char *)b;
+       while ((start + len) - p >= 16) {
+               bcopy(pattern16, p, 16);
+               p += 16;
+       }
+       if ((start + len) - p != 0) {
+               bcopy(pattern16, p, (start + len) - p);
+       }
+}
diff --git a/string/rindex-fbsd.c b/string/rindex-fbsd.c
deleted file mode 120000 (symlink)
index 648088c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./rindex.c
\ No newline at end of file
diff --git a/string/rindex.3 b/string/rindex.3
deleted file mode 100644 (file)
index f1a80e1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)rindex.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/rindex.3,v 1.8 2002/12/18 13:33:03 ru Exp $
-.\"
-.Dd June 4, 1993
-.Dt RINDEX 3
-.Os
-.Sh NAME
-.Nm rindex
-.Nd locate character in string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft char *
-.Fn rindex "const char *s" "int c"
-.Sh DESCRIPTION
-The
-.Fn rindex
-function
-locates the last character
-matching
-.Fa c
-(converted to a
-.Vt char )
-in the null-terminated string
-.Fa s .
-.Sh RETURN VALUES
-A pointer to the character is returned if it is found;
-otherwise, NULL is returned.
-If
-.Fa c
-is
-.Ql \e0 ,
-.Fn rindex
-locates the terminating
-.Ql \e0 .
-.Sh SEE ALSO
-.Xr index 3 ,
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh HISTORY
-A
-.Fn rindex
-function appeared in
-.At v6 .
-Its prototype existed previously in
-.Aq Pa string.h
-before it was moved to
-.Aq Pa strings.h
-for
-.St -p1003.1-2001
-compliance.
diff --git a/string/stpcpy-fbsd.c b/string/stpcpy-fbsd.c
deleted file mode 120000 (symlink)
index 64749ca..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./stpcpy.c
\ No newline at end of file
diff --git a/string/stpcpy.c b/string/stpcpy.c
new file mode 100644 (file)
index 0000000..4e909ac
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+
+char *
+stpcpy(char * restrict dst, const char * restrict src) {
+       const size_t length = strlen(src);
+    //  The stpcpy() and strcpy() functions copy the string src to dst
+    //  (including the terminating '\0' character).
+    memcpy(dst, src, length + 1);
+    //  The stpcpy() and stpncpy() functions return a pointer to the
+    //  terminating '\0' character of dst.
+    return dst + length;
+}
diff --git a/string/stpncpy-fbsd.c b/string/stpncpy-fbsd.c
deleted file mode 120000 (symlink)
index 9e47db9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./stpncpy.c
\ No newline at end of file
diff --git a/string/stpncpy.c b/string/stpncpy.c
new file mode 100644 (file)
index 0000000..44c35bd
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+
+char *
+stpncpy(char * restrict dst, const char * restrict src, size_t maxlen) {
+    const size_t srclen = strnlen(src, maxlen);
+    if (srclen < maxlen) {
+        //  The stpncpy() and strncpy() functions copy at most maxlen
+        //  characters from src into dst.
+        memcpy(dst, src, srclen);
+        //  If src is less than maxlen characters long, the remainder
+        //  of dst is filled with '\0' characters.
+        memset(dst+srclen, 0, maxlen-srclen);
+        //  The stpcpy() and stpncpy() functions return a pointer to the
+        //  terminating '\0' character of dst.
+        return dst+srclen;
+    } else {
+        //  The stpncpy() and strncpy() functions copy at most maxlen
+        //  characters from src into dst.
+        memcpy(dst, src, maxlen);
+        //  If stpncpy() does not terminate dst with a NUL character, it
+        //  instead returns a pointer to src[maxlen] (which does not
+        //  necessarily refer to a valid memory location.)
+        return dst+maxlen;
+    }
+}
diff --git a/string/strcasecmp-fbsd.c b/string/strcasecmp-fbsd.c
deleted file mode 100644 (file)
index 8299c16..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1987, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c       8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $");
-
-#include "xlocale_private.h"
-
-#include <strings.h>
-#include <ctype.h>
-
-typedef unsigned char u_char;
-
-int
-strcasecmp_l(s1, s2, loc)
-       const char *s1, *s2;
-       locale_t loc;
-{
-       const u_char
-                       *us1 = (const u_char *)s1,
-                       *us2 = (const u_char *)s2;
-
-       NORMALIZE_LOCALE(loc);
-       while (tolower_l(*us1, loc) == tolower_l(*us2++, loc))
-               if (*us1++ == '\0')
-                       return (0);
-       return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
-}
-
-int
-strcasecmp(const char *s1, const char *s2)
-{
-       return strcasecmp_l(s1, s2, __current_locale());
-}
-
-int
-strncasecmp_l(s1, s2, n, loc)
-       const char *s1, *s2;
-       size_t n;
-       locale_t loc;
-{
-       NORMALIZE_LOCALE(loc);
-       if (n != 0) {
-               const u_char
-                               *us1 = (const u_char *)s1,
-                               *us2 = (const u_char *)s2;
-
-               do {
-                       if (tolower_l(*us1, loc) != tolower_l(*us2++, loc))
-                               return (tolower_l(*us1, loc) - tolower_l(*--us2, loc));
-                       if (*us1++ == '\0')
-                               break;
-               } while (--n != 0);
-       }
-       return (0);
-}
-
-int
-strncasecmp(const char *s1, const char *s2, size_t n)
-{
-       return strncasecmp_l(s1, s2, n, __current_locale());
-}
diff --git a/string/strcasecmp.3 b/string/strcasecmp.3
deleted file mode 100644 (file)
index 0d686a6..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcasecmp.3       8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/string/strcasecmp.3,v 1.13 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 9, 1993
-.Dt STRCASECMP 3
-.Os
-.Sh NAME
-.Nm strcasecmp ,
-.Nm strcasecmp_l ,
-.Nm strncasecmp ,
-.Nm strncasecmp_l
-.Nd compare strings, ignoring case
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft int
-.Fo strcasecmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft int
-.Fo strncasecmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "size_t n"
-.Fc
-.In strings.h
-.In xlocale.h
-.Ft int
-.Fo strcasecmp_l
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "locale_t loc"
-.Fc
-.Ft int
-.Fo strncasecmp_l
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strcasecmp
-and
-.Fn strncasecmp
-functions
-compare the null-terminated strings
-.Fa s1
-and
-.Fa s2 .
-.Pp
-The
-.Fn strncasecmp
-compares at most
-.Fa n
-characters.
-.Pp
-Although the
-.Fn strcasecmp
-and
-.Fn strncasecmp
-functions use the current locale, the
-.Fn strcasecmp_l
-and
-.Fn strncasecmp_l
-functions may be passed locales directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn strcasecmp
-and
-.Fn strncasecmp
-return an integer greater than, equal to, or less than 0,
-according as
-.Fa s1
-is lexicographically greater than, equal to, or less than
-.Fa s2
-after translation of each corresponding character to lower-case.
-The strings themselves are not modified.
-The comparison is done using unsigned characters, so that
-.Sq Li \e200
-is greater than
-.Ql \e0 .
-.Sh SEE ALSO
-.Xr bcmp 3 ,
-.Xr memcmp 3 ,
-.Xr strcmp 3 ,
-.Xr strcoll 3 ,
-.Xr strxfrm 3 ,
-.Xr tolower 3 ,
-.Xr xlocale 3
-.Sh HISTORY
-The
-.Fn strcasecmp
-and
-.Fn strncasecmp
-functions first appeared in
-.Bx 4.4 .
-Their prototypes existed previously in
-.In string.h
-before they were moved to
-.In strings.h
-for
-.St -p1003.1-2001
-compliance.
diff --git a/string/strcasestr-fbsd.c b/string/strcasestr-fbsd.c
deleted file mode 100644 (file)
index e8f576f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $");
-
-#include "xlocale_private.h"
-
-#include <ctype.h>
-#include <string.h>
-
-/*
- * Find the first occurrence of find in s, ignore case.
- */
-char *
-strcasestr_l(s, find, loc)
-       const char *s, *find;
-       locale_t loc;
-{
-       char c, sc;
-       size_t len;
-
-       NORMALIZE_LOCALE(loc);
-       if ((c = *find++) != 0) {
-               c = tolower_l((unsigned char)c, loc);
-               len = strlen(find);
-               do {
-                       do {
-                               if ((sc = *s++) == 0)
-                                       return (NULL);
-                       } while ((char)tolower_l((unsigned char)sc, loc) != c);
-               } while (strncasecmp_l(s, find, len, loc) != 0);
-               s--;
-       }
-       return ((char *)s);
-}
-
-char *
-strcasestr(const char *s, const char *find)
-{
-       return strcasestr_l(s, find, __current_locale());
-}
diff --git a/string/strcat-fbsd.c b/string/strcat-fbsd.c
deleted file mode 120000 (symlink)
index 6dc4b61..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strcat.c
\ No newline at end of file
diff --git a/string/strcat.3 b/string/strcat.3
deleted file mode 100644 (file)
index 9eb86ec..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcat.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strcat.3,v 1.17 2009/12/01 07:28:56 brueffer Exp $
-.\"
-.Dd December 1, 2009
-.Dt STRCAT 3
-.Os
-.Sh NAME
-.Nm strcat ,
-.Nm strncat
-.Nd concatenate strings
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo strcat
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fc
-.Ft char *
-.Fo strncat
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strcat
-and
-.Fn strncat
-functions
-append a copy of the null-terminated string
-.Fa s2
-to the end of the null-terminated string
-.Fa s1 ,
-then add a terminating
-.Ql \e0 .
-The string
-.Fa s1
-must have sufficient space to hold the result.
-.Pp
-The
-.Fn strncat
-function
-appends not more than
-.Fa n
-characters from
-.Fa s2 ,
-and then adds a terminating
-.Ql \e0 .
-.Pp
-The source and destination strings should not overlap, as the
-behavior is undefined.
-.Sh RETURN VALUES
-The
-.Fn strcat
-and
-.Fn strncat
-functions
-return the pointer
-.Fa s1 .
-.Sh SECURITY CONSIDERATIONS
-The
-.Fn strcat
-function is easily misused in a manner
-which enables malicious users to arbitrarily change
-a running program's functionality through a buffer overflow attack.
-(See
-the FSA.)
-.Pp
-Avoid using
-.Fn strcat .
-Instead, use
-.Fn strncat
-or
-.Fn strlcat
-and ensure that no more characters are copied to the destination buffer
-than it can hold.
-.Pp
-Note that
-.Fn strncat
-can also be problematic.
-It may be a security concern for a string to be truncated at all.
-Since the truncated string will not be as long as the original,
-it may refer to a completely different resource
-and usage of the truncated resource
-could result in very incorrect behavior.
-Example:
-.Bd -literal
-void
-foo(const char *arbitrary_string)
-{
-       char onstack[8] = "";
-
-#if defined(BAD)
-       /*
-        * This first strcat is bad behavior.  Do not use strcat!
-        */
-       (void)strcat(onstack, arbitrary_string);        /* BAD! */
-#elif defined(BETTER)
-       /*
-        * The following two lines demonstrate better use of
-        * strncat().
-        */
-       (void)strncat(onstack, arbitrary_string,
-           sizeof(onstack) - strlen(onstack) - 1);
-#elif defined(BEST)
-       /*
-        * These lines are even more robust due to testing for
-        * truncation.
-        */
-       if (strlen(arbitrary_string) + 1 >
-           sizeof(onstack) - strlen(onstack))
-               err(1, "onstack would be truncated");
-       (void)strncat(onstack, arbitrary_string,
-           sizeof(onstack) - strlen(onstack) - 1);
-#endif
-}
-.Ed
-.Sh SEE ALSO
-.Xr bcopy 3 ,
-.Xr memccpy 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr strcpy 3 ,
-.Xr strlcat 3 ,
-.Xr strlcpy 3 ,
-.Xr wcscat 3
-.Sh STANDARDS
-The
-.Fn strcat
-and
-.Fn strncat
-functions
-conform to
-.St -isoC .
diff --git a/string/strcat.c b/string/strcat.c
new file mode 100644 (file)
index 0000000..4933817
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+
+char *
+strcat(char *restrict dst, const char *restrict src) {
+    const size_t dstlen = strlen(dst);
+    const size_t srclen = strlen(src);
+    //  The strcat() and strncat() functions append a copy of the null-
+    //  terminated string src to the end of the null-terminated string dst,
+    //  then add a terminating '\0'.  The string dst must have sufficient
+    //  space to hold the result.
+    memcpy(dst+dstlen, src, srclen+1);
+    //  The strcat() and strncat() functions return dst.
+    return dst;
+}
diff --git a/string/strchr-fbsd.c b/string/strchr-fbsd.c
deleted file mode 100644 (file)
index 26433c0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strchr.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
-
-#define        STRCHR
-#include "index-fbsd.c"
diff --git a/string/strchr.3 b/string/strchr.3
deleted file mode 100644 (file)
index 512bc6f..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strchr.3   8.2 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/string/strchr.3,v 1.14 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd April 19, 1994
-.Dt STRCHR 3
-.Os
-.Sh NAME
-.Nm strchr , strrchr
-.Nd locate character in string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft "char *"
-.Fo strchr
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Ft "char *"
-.Fo strrchr
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strchr
-function locates the first occurrence of
-.Fa c
-(converted to a
-.Vt char )
-in the string pointed to by
-.Fa s .
-The terminating null character is considered to be part of the string;
-therefore if
-.Fa c
-is
-.Ql \e0 ,
-the functions locate the terminating
-.Ql \e0 .
-.Pp
-The
-.Fn strrchr
-function is identical to
-.Fn strchr ,
-except it locates the last occurrence of
-.Fa c .
-.Sh RETURN VALUES
-The functions
-.Fn strchr
-and
-.Fn strrchr
-return a pointer to the located character, or
-.Dv NULL
-if the character does not appear in the string.
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr memmem 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3 ,
-.Xr wcschr 3
-.Sh STANDARDS
-The functions
-.Fn strchr
-and
-.Fn strrchr
-conform to
-.St -isoC .
diff --git a/string/strcmp.3 b/string/strcmp.3
deleted file mode 100644 (file)
index e04b4dd..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcmp.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strcmp.3,v 1.13 2009/12/04 09:20:20 trhodes Exp $
-.\"
-.Dd October 11, 2001
-.Dt STRCMP 3
-.Os
-.Sh NAME
-.Nm strcmp ,
-.Nm strncmp
-.Nd compare strings
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft int
-.Fo strcmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft int
-.Fo strncmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strcmp
-and
-.Fn strncmp
-functions
-lexicographically compare the null-terminated strings
-.Fa s1
-and
-.Fa s2 .
-.Pp
-The
-.Fn strncmp
-function
-compares not more than
-.Fa n
-characters.
-Because
-.Fn strncmp
-is designed for comparing strings rather than binary data,
-characters that appear after a
-.Ql \e0
-character are not compared.
-.Sh RETURN VALUES
-The
-.Fn strcmp
-and
-.Fn strncmp
-functions return an integer greater than, equal to, or less than 0, according
-as the string
-.Fa s1
-is greater than, equal to, or less than the string
-.Fa s2 .
-The comparison is done using unsigned characters, so that
-.Ql \e200
-is greater than
-.Ql \e0 .
-.Sh SEE ALSO
-.Xr bcmp 3 ,
-.Xr memcmp 3 ,
-.Xr strcasecmp 3 ,
-.Xr strcoll 3 ,
-.Xr strxfrm 3 ,
-.Xr wcscmp 3
-.Sh STANDARDS
-The
-.Fn strcmp
-and
-.Fn strncmp
-functions
-conform to
-.St -isoC .
diff --git a/string/strcoll-fbsd.c b/string/strcoll-fbsd.c
deleted file mode 100644 (file)
index 3128289..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
- *             at Electronni Visti IA, Kiev, Ukraine.
- *                     All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <errno.h>
-#include "collate.h"
-
-int
-strcoll_l(const char *s, const char *s2, locale_t loc)
-{
-       int ret;
-       const wchar_t *t = NULL, *t2 = NULL;
-       int sverrno;
-
-       NORMALIZE_LOCALE(loc);
-       if (loc->__collate_load_error || (t = __collate_mbstowcs(s, loc)) == NULL || (t2 = __collate_mbstowcs(s2, loc)) == NULL) {
-               sverrno = errno;
-               free((void *)t);
-               free((void *)t2);
-               errno = sverrno;
-               return strcmp(s, s2);
-       }
-
-       ret = wcscoll_l(t, t2, loc);
-       sverrno = errno;
-       free((void *)t);
-       free((void *)t2);
-       errno = sverrno;
-
-       return ret;
-}
-
-int
-strcoll(const char *s, const char *s2)
-{
-       return strcoll_l(s, s2, __current_locale());
-}
diff --git a/string/strcoll.3 b/string/strcoll.3
deleted file mode 100644 (file)
index fcbbbe1..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcoll.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strcoll.3,v 1.14 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRCOLL 3
-.Os
-.Sh NAME
-.Nm strcoll ,
-.Nm strcoll_l
-.Nd compare strings, according to current collation
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft int
-.Fo strcoll
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.In string.h
-.In xlocale.h
-.Ft int
-.Fo strcoll_l
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strcoll
-function
-lexicographically compares the null-terminated strings
-.Fa s1
-and
-.Fa s2
-according to the current locale collation
-and returns an integer greater than, equal to, or less than 0,
-according as
-.Fa s1
-is greater than, equal to, or less than
-.Fa s2 .
-If information about the current locale collation is not available,
-the value of
-.Fn strcmp s1 s2
-is returned.
-.Pp
-Although the
-.Fn strcoll
-function uses the current locale, the
-.Fn strcoll_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh SEE ALSO
-.Xr setlocale 3 ,
-.Xr strcmp 3 ,
-.Xr strxfrm 3 ,
-.Xr wcscoll 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn strcoll
-function
-conforms to
-.St -isoC .
diff --git a/string/strcpy-fbsd.c b/string/strcpy-fbsd.c
deleted file mode 120000 (symlink)
index 39cf6f7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strcpy.c
\ No newline at end of file
diff --git a/string/strcpy.3 b/string/strcpy.3
deleted file mode 100644 (file)
index e1fbdc1..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcpy.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strcpy.3,v 1.28 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd February 28, 2009
-.Dt STRCPY 3
-.Os
-.Sh NAME
-.Nm stpcpy, stpncpy, strcpy , strncpy
-.Nd copy strings
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo stpcpy
-.Fa "char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo stpncpy
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fc
-.Ft char *
-.Fo strcpy
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fc
-.Ft char *
-.Fo strncpy
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn stpcpy
-and
-.Fn strcpy
-functions
-copy the string
-.Fa s2
-to
-.Fa s1
-(including the terminating
-.Ql \e0
-character).
-.Pp
-The
-.Fn stpncpy
-and
-.Fn strncpy
-functions copy at most
-.Fa n
-characters from
-.Fa s2
-into
-.Fa s1 .
-If
-.Fa s2
-is less than
-.Fa n
-characters long,
-the remainder of
-.Fa s1
-is filled with
-.Ql \e0
-characters.
-Otherwise,
-.Fa s1
-is
-.Em not
-terminated.
-.Pp
-The source and destination strings should not overlap, as the
-behavior is undefined.
-.Sh RETURN VALUES
-The
-.Fn strcpy
-and
-.Fn strncpy
-functions
-return
-.Fa s1 .
-The
-.Fn stpcpy
-and
-.Fn stpncpy
-functions return a pointer to the terminating
-.Ql \e0
-character of
-.Fa s1 .
-If
-.Fn stpncpy
-does not terminate
-.Fa s1
-with a
-.Dv NUL
-character, it instead returns a pointer to
-.Li s1[n]
-(which does not necessarily refer to a valid memory location.)
-.Sh EXAMPLES
-The following sets
-.Va chararray
-to
-.Dq Li abc\e0\e0\e0 :
-.Bd -literal -offset indent
-char chararray[6];
-
-(void)strncpy(chararray, "abc", sizeof(chararray));
-.Ed
-.Pp
-The following sets
-.Va chararray
-to
-.Dq Li abcdef :
-.Bd -literal -offset indent
-char chararray[6];
-
-(void)strncpy(chararray, "abcdefgh", sizeof(chararray));
-.Ed
-.Pp
-Note that it does
-.Em not
-.Tn NUL
-terminate
-.Va chararray ,
-because the length of the source string is greater than or equal
-to the length argument.
-.Pp
-The following copies as many characters from
-.Va input
-to
-.Va buf
-as will fit and
-.Tn NUL
-terminates the result.
-Because
-.Fn strncpy
-does
-.Em not
-guarantee to
-.Tn NUL
-terminate the string itself, this must be done explicitly.
-.Bd -literal -offset indent
-char buf[1024];
-
-(void)strncpy(buf, input, sizeof(buf) - 1);
-buf[sizeof(buf) - 1] = '\e0';
-.Ed
-.Pp
-This could be better achieved using
-.Xr strlcpy 3 ,
-as shown in the following example:
-.Pp
-.Dl "(void)strlcpy(buf, input, sizeof(buf));"
-.Sh SECURITY CONSIDERATIONS
-The
-.Fn strcpy ,
-.Fn strncpy ,
-.Fn stpcpy ,
-and
-.Fn stpncpy
-functions are easily misused in a manner which enables malicious users
-to arbitrarily change a running program's functionality through a
-buffer overflow attack.
-(See
-the FSA
-and
-.Sx EXAMPLES . )
-.Pp
-It is recommended that
-.Xr strlcpy 3
-be used instead as a way to avoid such problems.
-.Xr strlcpy 3
-is not defined in any standards, but it has been adopted by most major libc implementations.
-.Sh SEE ALSO
-.Xr bcopy 3 ,
-.Xr memccpy 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr strlcpy 3 ,
-.Xr wcscpy 3
-.Sh STANDARDS
-The
-.Fn strcpy
-and
-.Fn strncpy
-functions
-conform to
-.St -isoC .
-The
-.Fn stpcpy
-and
-.Fn stpncpy
-functions conform to
-.St -p1003.1-2008 .
-.Sh HISTORY
-The
-.Fn stpcpy
-function first appeared in
-.Fx 4.4 ,
-and
-.Fn stpncpy
-was added in
-.Fx 8.0 .
diff --git a/string/strcpy.c b/string/strcpy.c
new file mode 100644 (file)
index 0000000..dda3813
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+
+char *
+strcpy(char * restrict dst, const char * restrict src) {
+       const size_t length = strlen(src);
+    //  The stpcpy() and strcpy() functions copy the string src to dst
+    //  (including the terminating '\0' character).
+    memcpy(dst, src, length+1);
+    //  The strcpy() and strncpy() functions return dst.
+    return dst;
+}
diff --git a/string/strcspn-fbsd.c b/string/strcspn-fbsd.c
deleted file mode 120000 (symlink)
index c86ab8c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strcspn.c
\ No newline at end of file
diff --git a/string/strcspn.3 b/string/strcspn.3
deleted file mode 100644 (file)
index 938f80b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcspn.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strcspn.3,v 1.9 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRCSPN 3
-.Os
-.Sh NAME
-.Nm strcspn
-.Nd span the complement of a string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft size_t
-.Fo strcspn
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strcspn
-function
-spans the initial part of the null-terminated string
-.Fa s1 ,
-as long as the characters from
-.Fa s1
-do not occur in string
-.Fa s2
-(it
-spans the
-.Em complement
-of
-.Fa s2 ) .
-In other words, it computes the string array index in
-.Fa s1
-of the first character of
-.Fa s1
-which is also in
-.Fa s2 ,
-else the index of the first null character.
-.Sh RETURN VALUES
-The
-.Fn strcspn
-function
-returns the number of characters spanned.
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh STANDARDS
-The
-.Fn strcspn
-function
-conforms to
-.St -isoC .
diff --git a/string/strdup-fbsd.c b/string/strdup-fbsd.c
deleted file mode 120000 (symlink)
index e2aeecc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strdup.c
\ No newline at end of file
diff --git a/string/strdup.3 b/string/strdup.3
deleted file mode 100644 (file)
index 688d317..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strdup.3   8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/string/strdup.3,v 1.15 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd December 5, 2008
-.Dt STRDUP 3
-.Os
-.Sh NAME
-.Nm strdup ,
-.Nm strndup
-.Nd save a copy of a string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo strdup
-.Fa "const char *s1"
-.Fc
-.Ft char *
-.Fo strndup
-.Fa "const char *s1"
-.Fa "size_t n"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strdup
-function
-allocates sufficient memory for a copy
-of the string
-.Fa s1 ,
-does the copy, and returns a pointer to it.
-The pointer may subsequently be used as an
-argument to the function
-.Xr free 3 .
-.Pp
-If insufficient memory is available, NULL is returned and
-.Va errno
-is set to
-.Er ENOMEM .
-.Pp
-The
-.Fn strndup
-function copies at most
-.Fa n
-characters from the string
-.Fa s1
-always
-.Dv NUL
-terminating the copied string.
-.Sh SEE ALSO
-.Xr free 3 ,
-.Xr malloc 3
-.Sh HISTORY
-The
-.Fn strdup
-function first appeared in
-.Bx 4.4 .
-The
-.Fn strndup
-function was added in
-.Fx 7.2 .
diff --git a/string/strerror-fbsd.c b/string/strerror-fbsd.c
deleted file mode 100644 (file)
index 63e8101..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strerror.c,v 1.16 2007/01/09 00:28:12 imp Exp $");
-
-#if defined(NLS)
-#include <nl_types.h>
-#endif
-
-#include <limits.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#define        UPREFIX         "Unknown error"
-
-/*
- * Define a buffer size big enough to describe a 64-bit signed integer
- * converted to ASCII decimal (19 bytes), with an optional leading sign
- * (1 byte); finally, we get the prefix, delimiter (": ") and a trailing
- * NUL from UPREFIX.
- */
-#define        EBUFSIZE        (20 + 2 + sizeof(UPREFIX))
-
-#ifndef BUILDING_VARIANT
-/*
- * Doing this by hand instead of linking with stdio(3) avoids bloat for
- * statically linked binaries.
- */
-__private_extern__ void
-__errstr(int num, char *uprefix, char *buf, size_t len)
-{
-       char *t;
-       unsigned int uerr;
-       char tmp[EBUFSIZE];
-
-       t = tmp + sizeof(tmp);
-       *--t = '\0';
-       uerr = (num >= 0) ? num : -num;
-       do {
-               *--t = "0123456789"[uerr % 10];
-       } while (uerr /= 10);
-       if (num < 0)
-               *--t = '-';
-       *--t = ' ';
-       *--t = ':';
-       strlcpy(buf, uprefix, len);
-       strlcat(buf, t, len);
-}
-
-int
-strerror_r(int errnum, char *strerrbuf, size_t buflen)
-{
-       int retval = 0;
-#if defined(NLS)
-       int saved_errno = errno;
-       nl_catd catd;
-       catd = catopen("libc", NL_CAT_LOCALE);
-#endif
-
-       if (errnum < 0 || errnum >= sys_nerr) {
-               __errstr(errnum,
-#if defined(NLS)
-                       catgets(catd, 1, 0xffff, UPREFIX),
-#else
-                       UPREFIX,
-#endif
-                       strerrbuf, buflen);
-               retval = EINVAL;
-       } else {
-               if (strlcpy(strerrbuf,
-#if defined(NLS)
-                       catgets(catd, 1, errnum, sys_errlist[errnum]),
-#else
-                       sys_errlist[errnum],
-#endif
-                       buflen) >= buflen)
-               retval = ERANGE;
-       }
-
-#if defined(NLS)
-       catclose(catd);
-       errno = saved_errno;
-#endif
-
-       return (retval);
-}
-#else /* BUILDING_VARIANT */
-__private_extern__ void __errstr(int, char *, size_t);
-#endif /* !BUILDING_VARIANT */
-
-char *
-strerror(int num)
-{
-       static char ebuf[NL_TEXTMAX];
-
-#if !__DARWIN_UNIX03
-       if (strerror_r(num, ebuf, sizeof(ebuf)) != 0)
-       errno = EINVAL;
-#else
-       (void)strerror_r(num, ebuf, sizeof(ebuf));
-#endif
-       return (ebuf);
-}
diff --git a/string/strerror.3 b/string/strerror.3
deleted file mode 100644 (file)
index f6f7510..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strerror.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/string/strerror.3,v 1.24 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd October 12, 2004
-.Dt STRERROR 3
-.Os
-.Sh NAME
-.Nm perror ,
-.Nm strerror ,
-.Nm strerror_r ,
-.Nm sys_errlist ,
-.Nm sys_nerr
-.Nd system error messages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft void
-.Fo perror
-.Fa "const char *s"
-.Fc
-.Vt extern const char * const sys_errlist[] ;
-.Vt extern const int sys_nerr ;
-.In string.h
-.Ft "char *"
-.Fo strerror
-.Fa "int errnum"
-.Fc
-.Ft int
-.Fo strerror_r
-.Fa "int errnum"
-.Fa "char *strerrbuf"
-.Fa "size_t buflen"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strerror ,
-.Fn strerror_r ,
-and
-.Fn perror
-functions look up the error message string corresponding to an
-error number.
-.Pp
-The
-.Fn strerror
-function accepts an error number argument
-.Fa errnum
-and returns a pointer to the corresponding
-message string.
-.Pp
-The
-.Fn strerror_r
-function renders the same result into
-.Fa strerrbuf
-for a maximum of
-.Fa buflen
-characters and returns 0 upon success.
-.Pp
-The
-.Fn perror
-function finds the error message corresponding to the current
-value of the global variable
-.Va errno
-.Pq Xr intro 2
-and writes it, followed by a newline, to the
-standard error file descriptor.
-If the argument
-.Fa s
-is
-.Pf non- Dv NULL
-and does not point to the null character,
-this string is prepended to the message
-string and separated from it by
-a colon and space
-.Pq Dq Li ":\ " ;
-otherwise, only the error message string is printed.
-.Pp
-If the error number is not recognized, these functions return an error message
-string containing
-.Dq Li "Unknown error:\ "
-followed by the error number in decimal.
-The
-.Fn strerror
-and
-.Fn strerror_r
-functions return
-.Er EINVAL
-as a warning.
-Error numbers recognized by this implementation fall in
-the range 0 <=
-.Fa errnum
-<
-.Fa sys_nerr .
-.Pp
-If insufficient storage is provided in
-.Fa strerrbuf
-(as specified in
-.Fa buflen )
-to contain the error string,
-.Fn strerror_r
-returns
-.Er ERANGE
-and
-.Fa strerrbuf
-will contain an error message that has been truncated and
-.Dv NUL
-terminated to fit the length specified by
-.Fa buflen .
-.Pp
-The message strings can be accessed directly using the external
-array
-.Va sys_errlist .
-The external value
-.Va sys_nerr
-contains a count of the messages in
-.Va sys_errlist .
-The use of these variables is deprecated;
-.Fn strerror
-or
-.Fn strerror_r
-should be used instead.
-.Sh SEE ALSO
-.Xr intro 2 ,
-.Xr psignal 3
-.Sh STANDARDS
-The
-.Fn perror
-and
-.Fn strerror
-functions conform to
-.St -isoC-99 .
-The
-.Fn strerror_r
-function conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn strerror
-and
-.Fn perror
-functions first appeared in
-.Bx 4.4 .
-The
-.Fn strerror_r
-function was implemented in
-.Fx 4.4
-by
-.An Wes Peters Aq wes@FreeBSD.org .
-.Sh BUGS
-For unknown error numbers, the
-.Fn strerror
-function will return its result in a static buffer which
-may be overwritten by subsequent calls.
-.Pp
-The return type for
-.Fn strerror
-is missing a type-qualifier; it should actually be
-.Vt const char * .
-.Pp
-Programs that use the deprecated
-.Va sys_errlist
-variable often fail to compile because they declare it
-inconsistently.
diff --git a/string/string.3 b/string/string.3
deleted file mode 100644 (file)
index 7f8f9ad..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)string.3   8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/lib/libc/string/string.3,v 1.14 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd December 11, 1993
-.Dt STRING 3
-.Os
-.Sh NAME
-.Nm index ,
-.Nm rindex ,
-.Nm stpcpy ,
-.Nm strcasecmp ,
-.Nm strcat ,
-.Nm strchr ,
-.Nm strcmp ,
-.Nm strcpy ,
-.Nm strcspn ,
-.Nm strerror ,
-.Nm strlen ,
-.Nm strncasecmp ,
-.Nm strncat ,
-.Nm strncmp ,
-.Nm strncpy ,
-.Nm strpbrk ,
-.Nm strrchr ,
-.Nm strsep ,
-.Nm strspn ,
-.Nm strstr ,
-.Nm strtok
-.Nd string specific functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In strings.h
-.Ft char *
-.Fo index
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Ft char *
-.Fo rindex
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Ft int
-.Fo strcasecmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft int
-.Fo strncasecmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "size_t n"
-.Fc
-.In string.h
-.Ft char *
-.Fo stpcpy
-.Fa "char *dst"
-.Fa "const char *src"
-.Fc
-.Ft char *
-.Fo strcat
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fc
-.Ft char *
-.Fo strchr
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Ft int
-.Fo strcmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo strcpy
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fc
-.Ft size_t
-.Fo strcspn
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo strerror
-.Fa "int errnum"
-.Fc
-.Ft size_t
-.Fo strlen
-.Fa "const char *s"
-.Fc
-.Ft char *
-.Fo strncat
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fc
-.Ft int
-.Fo strncmp
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "size_t n"
-.Fc
-.Ft char *
-.Fo strncpy
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fc
-.Ft char *
-.Fo strpbrk
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo strrchr
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Ft char *
-.Fo strsep
-.Fa "char **stringp"
-.Fa "const char *delim"
-.Fc
-.Ft size_t
-.Fo strspn
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo strstr
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo strtok
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fc
-.Sh DESCRIPTION
-The string
-functions manipulate strings that are terminated by a
-null byte.
-.Pp
-See the specific manual pages for more information.
-For manipulating variable length generic objects as byte
-strings (without the null byte check), see
-.Xr bstring 3 .
-.Pp
-Except as noted in their specific manual pages,
-the string functions do not test the destination
-for size limitations.
-.Sh SEE ALSO
-.Xr bstring 3 ,
-.Xr index 3 ,
-.Xr rindex 3 ,
-.Xr stpcpy 3 ,
-.Xr strcasecmp 3 ,
-.Xr strcat 3 ,
-.Xr strchr 3 ,
-.Xr strcmp 3 ,
-.Xr strcpy 3 ,
-.Xr strcspn 3 ,
-.Xr strerror 3 ,
-.Xr strlen 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh STANDARDS
-The
-.Fn strcat ,
-.Fn strncat ,
-.Fn strchr ,
-.Fn strrchr ,
-.Fn strcmp ,
-.Fn strncmp ,
-.Fn strcpy ,
-.Fn strncpy ,
-.Fn strerror ,
-.Fn strlen ,
-.Fn strpbrk ,
-.Fn strspn ,
-.Fn strcspn ,
-.Fn strstr ,
-and
-.Fn strtok
-functions
-conform to
-.St -isoC .
diff --git a/string/strlcat-fbsd.c b/string/strlcat-fbsd.c
deleted file mode 120000 (symlink)
index 8828d3f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strlcat.c
\ No newline at end of file
diff --git a/string/strlcat.c b/string/strlcat.c
new file mode 100644 (file)
index 0000000..ac44163
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <strings.h>
+
+size_t
+strlcat(char * restrict dst, const char * restrict src, size_t maxlen) {
+    const size_t srclen = strlen(src);
+    const size_t dstlen = strnlen(dst, maxlen);
+    if (dstlen == maxlen) return maxlen+srclen;
+    if (srclen < maxlen-dstlen) {
+        memcpy(dst+dstlen, src, srclen+1);
+    } else {
+        memcpy(dst+dstlen, src, maxlen-1);
+        dst[dstlen+maxlen-1] = '\0';
+    }
+    return dstlen + srclen;
+}
diff --git a/string/strlcpy-fbsd.c b/string/strlcpy-fbsd.c
deleted file mode 120000 (symlink)
index f63c48d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strlcpy.c
\ No newline at end of file
diff --git a/string/strlcpy.3 b/string/strlcpy.3
deleted file mode 100644 (file)
index 3cf8bc2..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-.\" $OpenBSD: strlcpy.3,v 1.19 2007/05/31 19:19:32 jmc Exp $
-.\"
-.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
-.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/string/strlcpy.3,v 1.16 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 22, 1998
-.Dt STRLCPY 3
-.Os
-.Sh NAME
-.Nm strlcpy ,
-.Nm strlcat
-.Nd size-bounded string copying and concatenation
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft size_t
-.Fn strlcpy "char * restrict dst" "const char * restrict src" "size_t size"
-.Ft size_t
-.Fn strlcat "char * restrict dst" "const char * restrict src" "size_t size"
-.Sh DESCRIPTION
-The
-.Fn strlcpy
-and
-.Fn strlcat
-functions copy and concatenate strings respectively.
-They are designed
-to be safer, more consistent, and less error prone replacements for
-.Xr strncpy 3
-and
-.Xr strncat 3 .
-Unlike those functions,
-.Fn strlcpy
-and
-.Fn strlcat
-take the full size of the buffer (not just the length) and guarantee to
-NUL-terminate the result (as long as
-.Fa size
-is larger than 0 or, in the case of
-.Fn strlcat ,
-as long as there is at least one byte free in
-.Fa dst ) .
-Note that a byte for the NUL should be included in
-.Fa size .
-Also note that
-.Fn strlcpy
-and
-.Fn strlcat
-only operate on true
-.Dq C
-strings.
-This means that for
-.Fn strlcpy
-.Fa src
-must be NUL-terminated and for
-.Fn strlcat
-both
-.Fa src
-and
-.Fa dst
-must be NUL-terminated.
-.Pp
-The
-.Fn strlcpy
-function copies up to
-.Fa size
-- 1 characters from the NUL-terminated string
-.Fa src
-to
-.Fa dst ,
-NUL-terminating the result.
-.Pp
-The
-.Fn strlcat
-function appends the NUL-terminated string
-.Fa src
-to the end of
-.Fa dst .
-It will append at most
-.Fa size
-- strlen(dst) - 1 bytes, NUL-terminating the result.
-.Pp
-The source and destination strings should not overlap, as the
-behavior is undefined.
-.Sh RETURN VALUES
-The
-.Fn strlcpy
-and
-.Fn strlcat
-functions return the total length of the string they tried to
-create.
-For
-.Fn strlcpy
-that means the length of
-.Fa src .
-For
-.Fn strlcat
-that means the initial length of
-.Fa dst
-plus
-the length of
-.Fa src .
-While this may seem somewhat confusing, it was done to make
-truncation detection simple.
-.Pp
-Note however, that if
-.Fn strlcat
-traverses
-.Fa size
-characters without finding a NUL, the length of the string is considered
-to be
-.Fa size
-and the destination string will not be NUL-terminated (since there was
-no space for the NUL).
-This keeps
-.Fn strlcat
-from running off the end of a string.
-In practice this should not happen (as it means that either
-.Fa size
-is incorrect or that
-.Fa dst
-is not a proper
-.Dq C
-string).
-The check exists to prevent potential security problems in incorrect code.
-.Sh EXAMPLES
-The following code fragment illustrates the simple case:
-.Bd -literal -offset indent
-char *s, *p, buf[BUFSIZ];
-
-\&...
-
-(void)strlcpy(buf, s, sizeof(buf));
-(void)strlcat(buf, p, sizeof(buf));
-.Ed
-.Pp
-To detect truncation, perhaps while building a pathname, something
-like the following might be used:
-.Bd -literal -offset indent
-char *dir, *file, pname[MAXPATHLEN];
-
-\&...
-
-if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname))
-       goto toolong;
-if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname))
-       goto toolong;
-.Ed
-.Pp
-Since it is known how many characters were copied the first time, things
-can be sped up a bit by using a copy instead of an append
-.Bd -literal -offset indent
-char *dir, *file, pname[MAXPATHLEN];
-size_t n;
-
-\&...
-
-n = strlcpy(pname, dir, sizeof(pname));
-if (n >= sizeof(pname))
-       goto toolong;
-if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n)
-       goto toolong;
-.Ed
-.Pp
-However, one may question the validity of such optimizations, as they
-defeat the whole purpose of
-.Fn strlcpy
-and
-.Fn strlcat .
-As a matter of fact, the first version of this manual page got it wrong.
-.Sh SEE ALSO
-.Xr snprintf 3 ,
-.Xr strncat 3 ,
-.Xr strncpy 3 ,
-.Xr wcslcpy 3
-.Sh HISTORY
-The
-.Fn strlcpy
-and
-.Fn strlcat
-functions first appeared in
-.Ox 2.4 ,
-and made their appearance in
-.Fx 3.3 .
diff --git a/string/strlcpy.c b/string/strlcpy.c
new file mode 100644 (file)
index 0000000..763d309
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <strings.h>
+
+size_t
+strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) {
+    const size_t srclen = strlen(src);
+    if (srclen < maxlen) {
+        memcpy(dst, src, srclen+1);
+    } else if (maxlen != 0) {
+        memcpy(dst, src, maxlen-1);
+        dst[maxlen-1] = '\0';
+    }
+    return srclen;
+}
diff --git a/string/strlen-fbsd.c b/string/strlen-fbsd.c
deleted file mode 120000 (symlink)
index 2261013..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strlen.c
\ No newline at end of file
diff --git a/string/strlen.3 b/string/strlen.3
deleted file mode 120000 (symlink)
index de61b5f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strlen.3
\ No newline at end of file
diff --git a/string/strmode-fbsd.c b/string/strmode-fbsd.c
deleted file mode 120000 (symlink)
index baa76fd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strmode.c
\ No newline at end of file
diff --git a/string/strmode.3 b/string/strmode.3
deleted file mode 100644 (file)
index 704224e..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strmode.3  8.3 (Berkeley) 7/28/94
-.\" $FreeBSD: src/lib/libc/string/strmode.3,v 1.11 2009/04/14 11:39:56 trasz Exp $
-.\"
-.Dd July 28, 1994
-.Dt STRMODE 3
-.Os
-.Sh NAME
-.Nm strmode
-.Nd convert inode status information into a symbolic string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft void
-.Fo strmode
-.Fa "int mode"
-.Fa "char *bp"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strmode
-function
-converts a file
-.Fa mode
-(the type and permission information associated with an inode, see
-.Xr stat 2 )
-into a symbolic string which is stored in the location referenced by
-.Fa bp .
-This stored string is eleven characters in length plus a trailing
-.Dv NUL .
-.Pp
-The first character is the inode type, and will be one of the following:
-.Pp
-.Bl -tag -width flag -offset indent -compact
-.It \-
-regular file
-.It b
-block special
-.It c
-character special
-.It d
-directory
-.It l
-symbolic link
-.It p
-fifo
-.It s
-socket
-.It w
-whiteout
-.It ?
-unknown inode type
-.El
-.Pp
-The next nine characters encode three sets of permissions, in three
-characters each.
-The first three characters are the permissions for the owner of the
-file, the second three for the group the file belongs to, and the
-third for the ``other'', or default, set of users.
-.Pp
-Permission checking is done as specifically as possible.
-If read permission is denied to the owner of a file in the first set
-of permissions, the owner of the file will not be able to read the file.
-This is true even if the owner is in the file's group and the group
-permissions allow reading or the ``other'' permissions allow reading.
-.Pp
-If the first character of the three character set is an ``r'', the file is
-readable for that set of users; if a dash ``\-'', it is not readable.
-.Pp
-If the second character of the three character set is a ``w'', the file is
-writable for that set of users; if a dash ``\-'', it is not writable.
-.Pp
-The third character is the first of the following characters that apply:
-.Bl -tag -width xxxx
-.It S
-If the character is part of the owner permissions and the file is not
-executable or the directory is not searchable by the owner, and the
-set-user-id bit is set.
-.It S
-If the character is part of the group permissions and the file is not
-executable or the directory is not searchable by the group, and the
-set-group-id bit is set.
-.It T
-If the character is part of the other permissions and the file is not
-executable or the directory is not searchable by others, and the ``sticky''
-.Pq Dv S_ISVTX
-bit is set.
-.It s
-If the character is part of the owner permissions and the file is
-executable or the directory searchable by the owner, and the set-user-id
-bit is set.
-.It s
-If the character is part of the group permissions and the file is
-executable or the directory searchable by the group, and the set-group-id
-bit is set.
-.It t
-If the character is part of the other permissions and the file is
-executable or the directory searchable by others, and the ``sticky''
-.Pq Dv S_ISVTX
-bit is set.
-.It x
-The file is executable or the directory is searchable.
-.It \-
-None of the above apply.
-.El
-.Pp
-The last character will always be a space.
-.Sh SEE ALSO
-.Xr chmod 1 ,
-.Xr find 1 ,
-.Xr stat 2 ,
-.Xr getmode 3 ,
-.Xr setmode 3
-.Sh HISTORY
-The
-.Fn strmode
-function first appeared in
-.Bx 4.4 .
diff --git a/string/strncat-fbsd.c b/string/strncat-fbsd.c
deleted file mode 120000 (symlink)
index b375d5e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strncat.c
\ No newline at end of file
diff --git a/string/strncat.c b/string/strncat.c
new file mode 100644 (file)
index 0000000..ed88ee6
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+
+char *
+strncat(char *restrict dst, const char *restrict src, size_t maxlen) {
+       const size_t dstlen = strlen(dst);
+       const size_t srclen = strnlen(src, maxlen);
+    //  The strcat() and strncat() functions append a copy of the null-
+    //  terminated string src to the end of the null-terminated string dst,
+    //  then add a terminating '\0'.  The string dst must have sufficient
+    //  space to hold the result.
+    //
+    //  The strncat() function appends not more than maxlen characters
+    //  from src, and then adds a terminating '\0'.
+    const size_t cpylen = srclen < maxlen ? srclen : maxlen;
+    memcpy(dst+dstlen, src, cpylen);
+    dst[dstlen+cpylen] = '\0';
+    //  The strcat() and strncat() functions return dst.
+    return dst;
+}
diff --git a/string/strncmp-fbsd.c b/string/strncmp-fbsd.c
deleted file mode 120000 (symlink)
index 7816922..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strncmp.c
\ No newline at end of file
diff --git a/string/strncpy-fbsd.c b/string/strncpy-fbsd.c
deleted file mode 120000 (symlink)
index 1b81656..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strncpy.c
\ No newline at end of file
diff --git a/string/strncpy.c b/string/strncpy.c
new file mode 100644 (file)
index 0000000..5db7554
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2011 Apple, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <string.h>
+
+char *
+strncpy(char * restrict dst, const char * restrict src, size_t maxlen) {
+    const size_t srclen = strnlen(src, maxlen);
+    if (srclen < maxlen) {
+        //  The stpncpy() and strncpy() functions copy at most maxlen
+        //  characters from src into dst.
+        memcpy(dst, src, srclen);
+        //  If src is less than maxlen characters long, the remainder
+        //  of dst is filled with '\0' characters.
+        memset(dst+srclen, 0, maxlen-srclen);
+    } else {
+        //  Otherwise, dst is not terminated.
+        memcpy(dst, src, maxlen);
+    }
+    //  The strcpy() and strncpy() functions return dst.
+    return dst;
+}
diff --git a/string/strndup-fbsd.c b/string/strndup-fbsd.c
deleted file mode 120000 (symlink)
index 2d7b8d4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strndup.c
\ No newline at end of file
diff --git a/string/strnlen-fbsd.c b/string/strnlen-fbsd.c
deleted file mode 120000 (symlink)
index e1a5577..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strnlen.c
\ No newline at end of file
diff --git a/string/strnstr-fbsd.c b/string/strnstr-fbsd.c
deleted file mode 120000 (symlink)
index 98aea3e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strnstr.c
\ No newline at end of file
diff --git a/string/strpbrk-fbsd.c b/string/strpbrk-fbsd.c
deleted file mode 120000 (symlink)
index d21223d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strpbrk.c
\ No newline at end of file
diff --git a/string/strpbrk.3 b/string/strpbrk.3
deleted file mode 100644 (file)
index 30db8c2..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strpbrk.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strpbrk.3,v 1.9 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRPBRK 3
-.Os
-.Sh NAME
-.Nm strpbrk
-.Nd locate multiple characters in string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo strpbrk
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strpbrk
-function
-locates in the null-terminated string
-.Fa s1
-the first occurrence of any character in the string
-.Fa s2 ,
-returning a pointer to this character.
-If no characters from
-.Fa s2
-occur anywhere in
-.Fa s1 ,
-.Fn strpbrk
-returns NULL.
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3 ,
-.Xr wcspbrk 3
-.Sh STANDARDS
-The
-.Fn strpbrk
-function
-conforms to
-.St -isoC .
diff --git a/string/strrchr-fbsd.c b/string/strrchr-fbsd.c
deleted file mode 100644 (file)
index bdf8f06..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strrchr.c,v 1.2 2002/03/22 21:53:19 obrien Exp $");
-
-#define        STRRCHR
-#include "rindex-fbsd.c"
diff --git a/string/strrchr.3 b/string/strrchr.3
deleted file mode 100644 (file)
index ef14451..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strrchr.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strrchr.3,v 1.9 2001/10/01 16:09:00 ru Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRRCHR 3
-.Os
-.Sh NAME
-.Nm strrchr
-.Nd locate character in string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo strrchr
-.Fa "const char *s"
-.Fa "int c"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strrchr
-function
-locates the last occurrence of
-.Fa c
-(converted to a char)
-in the string
-.Fa s .
-If
-.Fa c
-is
-.Ql \e0 ,
-.Fn strrchr
-locates the terminating
-.Ql \e0 .
-.Sh RETURN VALUES
-The
-.Fn strrchr
-function
-returns a pointer to the character,
-or a null
-pointer if
-.Fa c
-does not occur anywhere in
-.Fa s .
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3
-.Sh STANDARDS
-The
-.Fn strrchr
-function
-conforms to
-.St -isoC .
diff --git a/string/strsep-fbsd.c b/string/strsep-fbsd.c
deleted file mode 120000 (symlink)
index acbe4c2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strsep.c
\ No newline at end of file
diff --git a/string/strsep.3 b/string/strsep.3
deleted file mode 120000 (symlink)
index 5d61434..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strsep.3
\ No newline at end of file
diff --git a/string/strsignal-fbsd.c b/string/strsignal-fbsd.c
deleted file mode 100644 (file)
index 7806d63..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strsignal.c,v 1.9 2010/01/24 10:35:26 ume Exp $");
-
-#include "namespace.h"
-#if defined(NLS)
-#include <nl_types.h>
-#endif
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include "reentrant.h"
-#include "un-namespace.h"
-
-#define        UPREFIX         "Unknown signal"
-
-static once_t          sig_init_once = ONCE_INITIALIZER;
-static thread_key_t    sig_key;
-static int             sig_keycreated = 0;
-
-static void
-sig_keycreate(void)
-{
-       sig_keycreated = (thr_keycreate(&sig_key, free) == 0);
-}
-
-static char *
-sig_tlsalloc(void)
-{
-       char *ebuf = NULL;
-
-       if (thr_once(&sig_init_once, sig_keycreate) != 0 ||
-           !sig_keycreated)
-               goto thr_err;
-       if ((ebuf = thr_getspecific(sig_key)) == NULL) {
-               if ((ebuf = malloc(NL_TEXTMAX * sizeof(char))) == NULL)
-                       goto thr_err;
-               if (thr_setspecific(sig_key, ebuf) != 0) {
-                       free(ebuf);
-                       ebuf = NULL;
-                       goto thr_err;
-               }
-       }
-thr_err:
-       return (ebuf);
-}
-
-/* XXX: negative 'num' ? (REGR) */
-char *
-strsignal(int num)
-{
-       char *ebuf;
-       char tmp[20];
-       size_t n;
-       int signum;
-       char *t, *p;
-
-#if defined(NLS)
-       int saved_errno = errno;
-       nl_catd catd;
-       catd = catopen("libc", NL_CAT_LOCALE);
-#endif
-
-       ebuf = sig_tlsalloc();
-       if(ebuf == NULL) {
-               errno = ENOMEM;
-               return NULL;
-       }
-
-       if (num > 0 && num < NSIG) {
-               n = strlcpy(ebuf,
-#if defined(NLS)
-                       catgets(catd, 2, num, sys_siglist[num]),
-#else
-                       sys_siglist[num],
-#endif
-                       NL_TEXTMAX * sizeof(char));
-       } else {
-               n = strlcpy(ebuf,
-#if defined(NLS)
-                       catgets(catd, 2, 0xffff, UPREFIX),
-#else
-                       UPREFIX,
-#endif
-                       NL_TEXTMAX * sizeof(char));
-       }
-
-       signum = num;
-       if (num < 0)
-               signum = -signum;
-
-       t = tmp;
-       do {
-               *t++ = "0123456789"[signum % 10];
-       } while (signum /= 10);
-       if (num < 0)
-               *t++ = '-';
-
-       p = (ebuf + n);
-       *p++ = ':';
-       *p++ = ' ';
-
-       for (;;) {
-               *p++ = *--t;
-               if (t <= tmp)
-                       break;
-       }
-       *p = '\0';
-
-#if defined(NLS)
-       catclose(catd);
-       errno = saved_errno;
-#endif
-       return (ebuf);
-}
diff --git a/string/strspn-fbsd.c b/string/strspn-fbsd.c
deleted file mode 120000 (symlink)
index 2b2b2b8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strspn.c
\ No newline at end of file
diff --git a/string/strspn.3 b/string/strspn.3
deleted file mode 100644 (file)
index fcd199c..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strspn.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strspn.3,v 1.11 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRSPN 3
-.Os
-.Sh NAME
-.Nm strspn
-.Nd span a string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft size_t
-.Fo strspn
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strspn
-function
-spans the initial part of the null-terminated string
-.Fa s1 ,
-as long as the characters from
-.Fa s1
-occur in the null-terminated string
-.Fa s2 .
-In other words, it computes the string array index in
-.Fa s1
-of the first character of
-.Fa s1
-which is not in
-.Fa s2 ,
-else the index of the first null character.
-.Sh RETURN VALUES
-The
-.Fn strspn
-function
-returns the number of characters spanned.
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strstr 3 ,
-.Xr strtok 3 ,
-.Xr wcsspn 3
-.Sh STANDARDS
-The
-.Fn strspn
-function
-conforms to
-.St -isoC .
diff --git a/string/strstr-fbsd.c b/string/strstr-fbsd.c
deleted file mode 120000 (symlink)
index ec3a758..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strstr.c
\ No newline at end of file
diff --git a/string/strstr.3 b/string/strstr.3
deleted file mode 100644 (file)
index 70fbda4..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-.\" Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strstr.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strstr.3,v 1.15 2009/04/07 13:42:53 trasz Exp $
-.\"
-.Dd October 11, 2001
-.Dt STRSTR 3
-.Os
-.Sh NAME
-.Nm strcasestr ,
-.Nm strcasestr_l ,
-.Nm strnstr ,
-.Nm strstr
-.Nd locate a substring in a string
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo strcasestr
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.Ft char *
-.Fo strnstr
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "size_t n"
-.Fc
-.Ft char *
-.Fo strstr
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fc
-.In string.h
-.In xlocale.h
-.Ft char *
-.Fo strcasestr_l
-.Fa "const char *s1"
-.Fa "const char *s2"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strstr
-function
-locates the first occurrence of the null-terminated string
-.Fa s2
-in the null-terminated string
-.Fa s1 .
-.Pp
-The
-.Fn strcasestr
-function is similar to
-.Fn strstr ,
-but ignores the case of both strings.
-.Pp
-The
-.Fn strnstr
-function
-locates the first occurrence of the null-terminated string
-.Fa s2
-in the string
-.Fa s1 ,
-where not more than
-.Fa n
-characters are searched.
-Characters that appear after a
-.Ql \e0
-character are not searched.
-Since the
-.Fn strnstr
-function is a
-.Fx
-specific API, it should only be used when portability is not a concern.
-.Pp
-While the
-.Fn strcasestr
-function uses the current locale, the
-.Fn strcasestr_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-If
-.Fa s2
-is an empty string,
-.Fa s1
-is returned;
-if
-.Fa s2
-occurs nowhere in
-.Fa s1 ,
-.Dv NULL
-is returned;
-otherwise a pointer to the first character of the first occurrence of
-.Fa s2
-is returned.
-.Sh EXAMPLES
-The following sets the pointer
-.Va ptr
-to the
-.Qq Li Bar Baz
-portion of
-.Va largestring :
-.Bd -literal -offset indent
-const char *largestring = "Foo Bar Baz";
-const char *smallstring = "Bar";
-char *ptr;
-
-ptr = strstr(largestring, smallstring);
-.Ed
-.Pp
-The following sets the pointer
-.Va ptr
-to
-.Dv NULL ,
-because only the first 4 characters of
-.Va largestring
-are searched:
-.Bd -literal -offset indent
-const char *largestring = "Foo Bar Baz";
-const char *smallstring = "Bar";
-char *ptr;
-
-ptr = strnstr(largestring, smallstring, 4);
-.Ed
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strtok 3 ,
-.Xr wcsstr 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn strstr
-function
-conforms to
-.St -isoC .
diff --git a/string/strtok-fbsd.c b/string/strtok-fbsd.c
deleted file mode 120000 (symlink)
index 48d8517..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./strtok.c
\ No newline at end of file
diff --git a/string/strtok.3 b/string/strtok.3
deleted file mode 100644 (file)
index 25b9179..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-.\" Copyright (c) 1998 Softweyr LLC.  All rights reserved.
-.\"
-.\" strtok_r, from Berkeley strtok
-.\" Oct 13, 1998 by Wes Peters <wes@softweyr.com>
-.\"
-.\" Copyright (c) 1988, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\"
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notices, this list of conditions and the following disclaimer.
-.\"
-.\" 2. Redistributions in binary form must reproduce the above
-.\"    copyright notices, this list of conditions and the following
-.\"    disclaimer in the documentation and/or other materials provided
-.\"    with the distribution.
-.\"
-.\" 4. Neither the name of Softweyr LLC, the University nor the names
-.\"    of its contributors may be used to endorse or promote products
-.\"    derived from this software without specific prior written
-.\"    permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND
-.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-.\" DISCLAIMED.  IN NO EVENT SHALL SOFTWEYR LLC, THE REGENTS, OR
-.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strtok.3   8.2 (Berkeley) 2/3/94
-.\" $FreeBSD: src/lib/libc/string/strtok.3,v 1.26 2007/12/12 18:33:06 wes Exp $
-.\"
-.Dd November 27, 1998
-.Dt STRTOK 3
-.Os
-.Sh NAME
-.Nm strtok , strtok_r
-.Nd string tokens
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft char *
-.Fo strtok
-.Fa "char *restrict str"
-.Fa "const char *restrict sep"
-.Fc
-.Ft char *
-.Fo strtok_r
-.Fa "char *restrict str"
-.Fa "const char *restrict sep"
-.Fa "char **restrict lasts"
-.Fc
-.Sh DESCRIPTION
-.Bf -symbolic
-This interface is obsoleted by
-.Xr strsep 3 .
-.Ef
-.Pp
-The
-.Fn strtok
-function
-is used to isolate sequential tokens in a null-terminated string,
-.Fa str .
-These tokens are separated in the string by at least one of the
-characters in
-.Fa sep .
-The first time that
-.Fn strtok
-is called,
-.Fa str
-should be specified; subsequent calls, wishing to obtain further tokens
-from the same string, should pass a null pointer instead.
-The separator string,
-.Fa sep ,
-must be supplied each time, and may change between calls.
-.Pp
-The implementation will behave as if no library function calls
-.Fn strtok .
-.Pp
-The
-.Fn strtok_r
-function is a reentrant version of
-.Fn strtok .
-The context pointer
-.Fa last
-must be provided on each call.
-The
-.Fn strtok_r
-function
-may also be used to nest two parsing loops within one another, as
-long as separate context pointers are used.
-.Pp
-The
-.Fn strtok
-and
-.Fn strtok_r
-functions
-return a pointer to the beginning of each subsequent token in the string,
-after replacing the token itself with a
-.Dv NUL
-character.
-When no more tokens remain, a null pointer is returned.
-.Sh EXAMPLES
-The following uses
-.Fn strtok_r
-to parse two strings using separate contexts:
-.Bd -literal
-char test[80], blah[80];
-char *sep = "\e\e/:;=-";
-char *word, *phrase, *brkt, *brkb;
-
-strcpy(test, "This;is.a:test:of=the/string\e\etokenizer-function.");
-
-for (word = strtok_r(test, sep, &brkt);
-     word;
-     word = strtok_r(NULL, sep, &brkt))
-{
-    strcpy(blah, "blah:blat:blab:blag");
-
-    for (phrase = strtok_r(blah, sep, &brkb);
-         phrase;
-         phrase = strtok_r(NULL, sep, &brkb))
-    {
-        printf("So far we're at %s:%s\en", word, phrase);
-    }
-}
-.Ed
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr strchr 3 ,
-.Xr strcspn 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strsep 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr wcstok 3
-.Sh STANDARDS
-The
-.Fn strtok
-function
-conforms to
-.St -isoC .
-.Sh AUTHORS
-.An Wes Peters ,
-Softweyr LLC:
-.Aq wes@softweyr.com
-.Pp
-Based on the
-.Fx 3.0
-implementation.
-.Sh BUGS
-The System V
-.Fn strtok ,
-if handed a string containing only delimiter characters,
-will not alter the next starting point, so that a call to
-.Fn strtok
-with a different (or empty) delimiter string
-may return a
-.Pf non- Dv NULL
-value.
-Since this implementation always alters the next starting point,
-such a sequence of calls would always return
-.Dv NULL .
diff --git a/string/strxfrm-fbsd.c b/string/strxfrm-fbsd.c
deleted file mode 100644 (file)
index b1a70dd..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
- *             at Electronni Visti IA, Kiev, Ukraine.
- *                     All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/strxfrm.c,v 1.17 2008/10/19 09:10:44 delphij Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <errno.h>
-#include "collate.h"
-
-/*
- * In the non-POSIX case, we transform each character into a string of
- * characters representing the character's priority.  Since char is usually
- * signed, we are limited by 7 bits per byte.  To avoid zero, we need to add
- * XFRM_OFFSET, so we can't use a full 7 bits.  For simplicity, we choose 6
- * bits per byte.  We choose 4 bytes per character as a good compromise
- * between maximum coverage and minimum size.  This gives 24 bits, or 16M
- * priorities.  So we choose COLLATE_MAX_PRIORITY to be (2^24 - 1).  This
- * this can be increased if more is needed.
- */
-
-#define        XFRM_BYTES      4
-#define        XFRM_OFFSET     ('0')   /* make all printable characters */
-#define        XFRM_SHIFT      6
-#define        XFRM_MASK       ((1 << XFRM_SHIFT) - 1)
-
-static void
-xfrm(unsigned char *p, int pri)
-{
-
-       p[3] = (pri & XFRM_MASK) + XFRM_OFFSET;
-       pri >>= XFRM_SHIFT;
-       p[2] = (pri & XFRM_MASK) + XFRM_OFFSET;
-       pri >>= XFRM_SHIFT;
-       p[1] = (pri & XFRM_MASK) + XFRM_OFFSET;
-       pri >>= XFRM_SHIFT;
-       p[0] = (pri & XFRM_MASK) + XFRM_OFFSET;
-}
-
-size_t
-strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len,
-    locale_t loc)
-{
-       size_t slen;
-       wchar_t *wcs, *xf[2];
-       int sverrno;
-
-       if (!*src && dest) {
-               if (len > 0)
-                       *dest = '\0';
-               return 0;
-       }
-
-       NORMALIZE_LOCALE(loc);
-       if (loc->__collate_load_error || (wcs = __collate_mbstowcs(src, loc)) == NULL)
-               return strlcpy(dest, src, len);
-
-       __collate_xfrm(wcs, xf, loc);
-
-       slen = wcslen(xf[0]) * XFRM_BYTES;
-       if (xf[1])
-               slen += (wcslen(xf[1]) + 1) * XFRM_BYTES;
-       if (len > 0) {
-               wchar_t *w = xf[0];
-               int b = 0;
-               unsigned char buf[XFRM_BYTES];
-               unsigned char *bp;
-               while (len > 1) {
-                       if (!b) {
-                               if (!*w)
-                                       break;
-                               xfrm(bp = buf, *w++);
-                               b = XFRM_BYTES;
-                       }
-                       *dest++ = *(char *)bp++;
-                       b--;
-                       len--;
-               }
-               if ((w = xf[1]) != NULL) {
-                       xfrm(bp = buf, 0);
-                       b = XFRM_BYTES;
-                       while (len > 1) {
-                               if (!b)
-                                       break;
-                               *dest++ = *(char *)bp++;
-                               b--;
-                               len--;
-                       }
-                       b = 0;
-                       while (len > 1) {
-                               if (!b) {
-                                       if (!*w)
-                                               break;
-                                       xfrm(bp = buf, *w++);
-                                       b = XFRM_BYTES;
-                               }
-                               *dest++ = *(char *)bp++;
-                               b--;
-                               len--;
-                       }
-               }
-               *dest = 0;
-       }
-       sverrno = errno;
-       free(wcs);
-       free(xf[0]);
-       free(xf[1]);
-       errno = sverrno;
-
-       return slen;
-}
-
-size_t
-strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
-{
-       return strxfrm_l(dest, src, len, __current_locale());
-}
diff --git a/string/strxfrm.3 b/string/strxfrm.3
deleted file mode 100644 (file)
index d6ded5b..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strxfrm.3  8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strxfrm.3,v 1.18 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd June 4, 1993
-.Dt STRXFRM 3
-.Os
-.Sh NAME
-.Nm strxfrm ,
-.Nm strxfrm_l
-.Nd transform a string under locale
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In string.h
-.Ft size_t
-.Fo strxfrm
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fc
-.In string.h
-.In xlocale.h
-.Ft size_t
-.Fo strxfrm_l
-.Fa "char *restrict s1"
-.Fa "const char *restrict s2"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn strxfrm
-function transforms a null-terminated string pointed to by
-.Fa s2
-according to the current locale collation if any,
-then copies the transformed string
-into
-.Fa s1 .
-Not more than
-.Fa n
-characters are copied into
-.Fa s1 ,
-including the terminating null character added.
-If
-.Fa n
-is set to 0
-(it helps to determine an actual size needed
-for transformation),
-.Fa s1
-is permitted to be a NULL pointer.
-.Pp
-Comparing two strings using
-.Fn strcmp
-after
-.Fn strxfrm
-is equal to comparing
-two original strings with
-.Fn strcoll .
-.Pp
-Although the
-.Fn strxfrm
-function uses the current locale, the
-.Fn strxfrm_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn strxfrm
-returns the length of the transformed string not including
-the terminating null character.
-If this value is
-.Fa n
-or more, the contents of
-.Fa s1
-are indeterminate.
-.Sh SEE ALSO
-.Xr setlocale 3 ,
-.Xr strcmp 3 ,
-.Xr strcoll 3 ,
-.Xr wcsxfrm 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn strxfrm
-function
-conforms to
-.St -isoC .
diff --git a/string/swab-fbsd.c b/string/swab-fbsd.c
deleted file mode 100644 (file)
index 1d55327..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jeffrey Mogul.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)swab.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/swab.c,v 1.7 2007/01/09 00:28:12 imp Exp $");
-
-#include <unistd.h>
-
-void
-swab(const void * __restrict from, void * __restrict to, ssize_t len)
-{
-       unsigned long temp;
-       int n;
-       char *fp, *tp;
-
-       if (len <= 0)
-               return;
-       n = len >> 1;
-       fp = (char *)from;
-       tp = (char *)to;
-#define        STEP    temp = *fp++,*tp++ = *fp++,*tp++ = temp
-       /* round to multiple of 8 */
-       for (; n & 0x7; --n)
-               STEP;
-       for (n >>= 3; n > 0; --n) {
-               STEP; STEP; STEP; STEP;
-               STEP; STEP; STEP; STEP;
-       }
-}
diff --git a/string/swab.3 b/string/swab.3
deleted file mode 100644 (file)
index 82468db..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)swab.3     8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/swab.3,v 1.10 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd February 24, 2010
-.Dt SWAB 3
-.Os
-.Sh NAME
-.Nm swab
-.Nd swap adjacent bytes
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft void
-.Fo swab
-.Fa "const void *restrict src"
-.Fa "void *restrict dest"
-.Fa "ssize_t nbytes"
-.Fc
-.Sh DESCRIPTION
-The function
-.Fn swab
-copies
-.Fa nbytes
-bytes from the location referenced by
-.Fa src
-to the location referenced by
-.Fa dest ,
-swapping adjacent bytes.
-.Pp
-The argument
-.Fa nbytes
-should be an even number.  If
-.Fa nbytes
-is odd,
-.Fn swab
-copies and exchanges
-.Fa nbytes
--1 bytes and the disposition of the last byte is unspecified.
-If copying takes place between objects that overlap,
-the behavior is undefined. If
-.Fa nbytes
-is negative,
-.Fn swab
-does nothing.
-.Sh SEE ALSO
-.Xr bzero 3 ,
-.Xr memset 3 ,
-.Xr compat 5
-.Sh HISTORY
-A
-.Fn swab
-function appeared in
-.At v7 .
diff --git a/string/wcpcpy-fbsd.c b/string/wcpcpy-fbsd.c
deleted file mode 120000 (symlink)
index e189c60..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcpcpy.c
\ No newline at end of file
diff --git a/string/wcpncpy-fbsd.c b/string/wcpncpy-fbsd.c
deleted file mode 120000 (symlink)
index 7ca173a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcpncpy.c
\ No newline at end of file
diff --git a/string/wcscasecmp-fbsd.c b/string/wcscasecmp-fbsd.c
deleted file mode 100644 (file)
index f158b14..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/wcscasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-#include <wctype.h>
-
-int
-wcscasecmp_l(const wchar_t *s1, const wchar_t *s2, locale_t loc)
-{
-       wchar_t c1, c2;
-
-       for (; *s1; s1++, s2++) {
-               c1 = towlower_l(*s1, loc);
-               c2 = towlower_l(*s2, loc);
-               if (c1 != c2)
-                       return ((int)c1 - c2);
-       }
-       return (-*s2);
-}
-
-int
-wcscasecmp(const wchar_t *s1, const wchar_t *s2) {
-       return wcscasecmp_l(s1, s2, __current_locale());
-}
-
diff --git a/string/wcscat-fbsd.c b/string/wcscat-fbsd.c
deleted file mode 120000 (symlink)
index 530f0a9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcscat.c
\ No newline at end of file
diff --git a/string/wcschr-fbsd.c b/string/wcschr-fbsd.c
deleted file mode 120000 (symlink)
index 4d19f9f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcschr.c
\ No newline at end of file
diff --git a/string/wcscmp-fbsd.c b/string/wcscmp-fbsd.c
deleted file mode 120000 (symlink)
index 825a844..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcscmp.c
\ No newline at end of file
diff --git a/string/wcscoll-fbsd.c b/string/wcscoll-fbsd.c
deleted file mode 100644 (file)
index ce09e41..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/wcscoll.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include "collate.h"
-
-#define NOTFORWARD     (DIRECTIVE_BACKWARD | DIRECTIVE_POSITION)
-
-int
-wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t loc)
-{
-       int sverrno;
-       int len, len2, prim, prim2, sec, sec2, ret, ret2;
-       const wchar_t *t, *t2;
-       wchar_t *tt = NULL, *tt2 = NULL;
-       wchar_t *tr = NULL, *tr2 = NULL;
-       wchar_t w, w2;
-       struct __collate_st_info *info;
-
-       NORMALIZE_LOCALE(loc);
-       if (loc->__collate_load_error)
-               /*
-                * Locale has no special collating order or could not be
-                * loaded, do a fast binary comparison.
-                */
-               return (wcscmp(ws1, ws2));
-
-       info = &loc->__lc_collate->__info;
-       len = len2 = 1;
-       ret = ret2 = 0;
-
-       if ((info->directive[0] & NOTFORWARD) ||
-           (info->directive[1] & NOTFORWARD) ||
-           (!(info->flags && COLLATE_SUBST_DUP) &&
-           (info->subst_count[0] > 0 || info->subst_count[1] > 0))) {
-               int direc, pass;
-               for(pass = 0; pass < info->directive_count; pass++) {
-                       direc = info->directive[pass];
-                       if (pass == 0 || !(info->flags & COLLATE_SUBST_DUP)) {
-                               free(tt);
-                               tt = __collate_substitute(ws1, pass, loc);
-                               free(tt2);
-                               tt2 = tt ? __collate_substitute(ws2, pass, loc) : NULL;
-                       }
-                       if (direc & DIRECTIVE_BACKWARD) {
-                               wchar_t *bp, *fp, c;
-                               tr = __collate_wcsdup(tt ? tt : ws1);
-                               bp = tr;
-                               fp = tr + wcslen(tr) - 1;
-                               while(bp < fp) {
-                                       c = *bp;
-                                       *bp++ = *fp;
-                                       *fp-- = c;
-                               }
-                               tr2 = __collate_wcsdup(tt2 ? tt2 : ws2);
-                               bp = tr2;
-                               fp = tr2 + wcslen(tr2) - 1;
-                               while(bp < fp) {
-                                       c = *bp;
-                                       *bp++ = *fp;
-                                       *fp-- = c;
-                               }
-                               t = (const wchar_t *)tr;
-                               t2 = (const wchar_t *)tr2;
-                       } else if (tt) {
-                               t = (const wchar_t *)tt;
-                               t2 = (const wchar_t *)tt2;
-                       } else {
-                               t = (const wchar_t *)ws1;
-                               t2 = (const wchar_t *)ws2;
-                       }
-                       if(direc & DIRECTIVE_POSITION) {
-                               while(*t && *t2) {
-                                       prim = prim2 = 0;
-                                       __collate_lookup_which(t, &len, &prim, pass, loc);
-                                       if (prim <= 0) {
-                                               if (prim < 0) {
-                                                       errno = EINVAL;
-                                                       ret = -1;
-                                                       goto end;
-                                               }
-                                               prim = COLLATE_MAX_PRIORITY;
-                                       }
-                                       __collate_lookup_which(t2, &len2, &prim2, pass, loc);
-                                       if (prim2 <= 0) {
-                                               if (prim2 < 0) {
-                                                       errno = EINVAL;
-                                                       ret = -1;
-                                                       goto end;
-                                               }
-                                               prim2 = COLLATE_MAX_PRIORITY;
-                                       }
-                                       if(prim != prim2) {
-                                               ret = prim - prim2;
-                                               goto end;
-                                       }
-                                       t += len;
-                                       t2 += len2;
-                               }
-                       } else {
-                               while(*t && *t2) {
-                                       prim = prim2 = 0;
-                                       while(*t) {
-                                               __collate_lookup_which(t, &len, &prim, pass, loc);
-                                               if(prim > 0)
-                                                       break;
-                                               if (prim < 0) {
-                                                       errno = EINVAL;
-                                                       ret = -1;
-                                                       goto end;
-                                               }
-                                               t += len;
-                                       }
-                                       while(*t2) {
-                                               __collate_lookup_which(t2, &len2, &prim2, pass, loc);
-                                               if(prim2 > 0)
-                                                       break;
-                                               if (prim2 < 0) {
-                                                       errno = EINVAL;
-                                                       ret = -1;
-                                                       goto end;
-                                               }
-                                               t2 += len2;
-                                       }
-                                       if(!prim || !prim2)
-                                               break;
-                                       if(prim != prim2) {
-                                               ret = prim - prim2;
-                                               goto end;
-                                       }
-                                       t += len;
-                                       t2 += len2;
-                               }
-                       }
-                       if(!*t) {
-                               if(*t2) {
-                                       ret = -(int)*t2;
-                                       goto end;
-                               }
-                       } else {
-                               ret = *t;
-                               goto end;
-                       }
-               }
-               ret = 0;
-               goto end;
-       }
-
-       /* optimized common case: order_start forward;forward and duplicate
-        * (or no) substitute tables */
-       tt = __collate_substitute(ws1, 0, loc);
-       if (tt == NULL) {
-               tt2 = NULL;
-               t = (const wchar_t *)ws1;
-               t2 = (const wchar_t *)ws2;
-       } else {
-               tt2 = __collate_substitute(ws2, 0, loc);
-               t = (const wchar_t *)tt;
-               t2 = (const wchar_t *)tt2;
-       }
-       while(*t && *t2) {
-               prim = prim2 = 0;
-               while(*t) {
-                       __collate_lookup_l(t, &len, &prim, &sec, loc);
-                       if (prim > 0)
-                               break;
-                       if (prim < 0) {
-                               errno = EINVAL;
-                               ret = -1;
-                               goto end;
-                       }
-                       t += len;
-               }
-               while(*t2) {
-                       __collate_lookup_l(t2, &len2, &prim2, &sec2, loc);
-                       if (prim2 > 0)
-                               break;
-                       if (prim2 < 0) {
-                               errno = EINVAL;
-                               ret = -1;
-                               goto end;
-                       }
-                       t2 += len2;
-               }
-               if(!prim || !prim2)
-                       break;
-               if(prim != prim2) {
-                       ret = prim - prim2;
-                       goto end;
-               }
-               if(!ret2)
-                       ret2 = sec - sec2;
-               t += len;
-               t2 += len2;
-       }
-       if(!*t && *t2)
-               ret = -(int)*t2;
-       else if(*t && !*t2)
-               ret = *t;
-       else if(!*t && !*t2)
-               ret = ret2;
-  end:
-       sverrno = errno;
-       free(tt);
-       free(tt2);
-       free(tr);
-       free(tr2);
-       errno = sverrno;
-
-       return ret;
-}
-
-int
-wcscoll(const wchar_t *ws1, const wchar_t *ws2)
-{
-       return wcscoll_l(ws1, ws2, __current_locale());
-}
diff --git a/string/wcscoll.3 b/string/wcscoll.3
deleted file mode 100644 (file)
index df534cb..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strcoll.3  8.1 (Berkeley) 6/4/93
-.\" FreeBSD: src/lib/libc/string/strcoll.3,v 1.11 2001/10/01 16:09:00 ru Exp
-.\" $FreeBSD: src/lib/libc/string/wcscoll.3,v 1.3 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd October 4, 2002
-.Dt WCSCOLL 3
-.Os
-.Sh NAME
-.Nm wcscoll ,
-.Nm wcscoll_l
-.Nd compare wide strings according to current collation
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft int
-.Fo wcscoll
-.Fa "const wchar_t *ws1"
-.Fa "const wchar_t *ws2"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft int
-.Fo wcscoll_l
-.Fa "const wchar_t *ws1"
-.Fa "const wchar_t *ws2"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcscoll
-function compares the null-terminated strings
-.Fa ws1
-and
-.Fa ws2 ,
-according to the current locale's collation order.
-In the
-.Dq Li C
-locale,
-.Fn wcscoll
-is equivalent to
-.Fn wcscmp .
-.Pp
-Although the
-.Fn wcscoll
-function uses the current locale, the
-.Fn wcscoll_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn wcscoll
-function
-returns an integer greater than, equal to, or less than 0,
-if
-.Fa ws1
-is greater than, equal to, or less than
-.Fa ws2 .
-.Pp
-No return value is reserved to indicate errors;
-callers should set
-.Va errno
-to 0 before calling
-.Fn wcscoll .
-If it is non-zero upon return from
-.Fn wcscoll ,
-an error has occurred.
-.Sh ERRORS
-The
-.Fn wcscoll
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EILSEQ
-An invalid wide character code was specified.
-.It Bq Er ENOMEM
-Cannot allocate enough memory for temporary buffers.
-.El
-.Sh SEE ALSO
-.Xr setlocale 3 ,
-.Xr strcoll 3 ,
-.Xr wcscmp 3 ,
-.Xr wcsxfrm 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcscoll
-function
-conforms to
-.St -isoC-99 .
-.Sh BUGS
-The current implementation of
-.Fn wcscoll
-only works in single-byte
-.Dv LC_CTYPE
-locales, and falls back to using
-.Fn wcscmp
-in locales with extended character sets.
diff --git a/string/wcscpy-fbsd.c b/string/wcscpy-fbsd.c
deleted file mode 120000 (symlink)
index c966e09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcscpy.c
\ No newline at end of file
diff --git a/string/wcscspn-fbsd.c b/string/wcscspn-fbsd.c
deleted file mode 120000 (symlink)
index 2ba3b34..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcscspn.c
\ No newline at end of file
diff --git a/string/wcsdup-fbsd.c b/string/wcsdup-fbsd.c
deleted file mode 120000 (symlink)
index 9cb882c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsdup.c
\ No newline at end of file
diff --git a/string/wcslcat-fbsd.c b/string/wcslcat-fbsd.c
deleted file mode 120000 (symlink)
index 171476e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcslcat.c
\ No newline at end of file
diff --git a/string/wcslcpy-fbsd.c b/string/wcslcpy-fbsd.c
deleted file mode 120000 (symlink)
index 680dfea..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcslcpy.c
\ No newline at end of file
diff --git a/string/wcslen-fbsd.c b/string/wcslen-fbsd.c
deleted file mode 120000 (symlink)
index 168686a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcslen.c
\ No newline at end of file
diff --git a/string/wcsncasecmp-fbsd.c b/string/wcsncasecmp-fbsd.c
deleted file mode 100644 (file)
index 167fac1..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-#include <wctype.h>
-
-int
-wcsncasecmp_l(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)
-{
-       wchar_t c1, c2;
-
-       if (n == 0)
-               return (0);
-       for (; *s1; s1++, s2++) {
-               c1 = towlower_l(*s1, loc);
-               c2 = towlower_l(*s2, loc);
-               if (c1 != c2)
-                       return ((int)c1 - c2);
-               if (--n == 0)
-                       return (0);
-       }
-       return (-*s2);
-}
-
-int
-wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n) {
-       return wcsncasecmp_l(s1, s2, n, __current_locale());
-}
-
diff --git a/string/wcsncat-fbsd.c b/string/wcsncat-fbsd.c
deleted file mode 120000 (symlink)
index 581b079..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsncat.c
\ No newline at end of file
diff --git a/string/wcsncmp-fbsd.c b/string/wcsncmp-fbsd.c
deleted file mode 120000 (symlink)
index aa426db..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsncmp.c
\ No newline at end of file
diff --git a/string/wcsncpy-fbsd.c b/string/wcsncpy-fbsd.c
deleted file mode 120000 (symlink)
index 94dc751..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsncpy.c
\ No newline at end of file
diff --git a/string/wcsnlen-fbsd.c b/string/wcsnlen-fbsd.c
deleted file mode 120000 (symlink)
index a87c777..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsnlen.c
\ No newline at end of file
diff --git a/string/wcspbrk-fbsd.c b/string/wcspbrk-fbsd.c
deleted file mode 120000 (symlink)
index 2e91288..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcspbrk.c
\ No newline at end of file
diff --git a/string/wcsrchr-fbsd.c b/string/wcsrchr-fbsd.c
deleted file mode 120000 (symlink)
index 1514a72..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsrchr.c
\ No newline at end of file
diff --git a/string/wcsspn-fbsd.c b/string/wcsspn-fbsd.c
deleted file mode 120000 (symlink)
index d161daa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsspn.c
\ No newline at end of file
diff --git a/string/wcsstr-fbsd.c b/string/wcsstr-fbsd.c
deleted file mode 120000 (symlink)
index bd7adb3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcsstr.c
\ No newline at end of file
diff --git a/string/wcstok-fbsd.c b/string/wcstok-fbsd.c
deleted file mode 120000 (symlink)
index 256c17d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wcstok.c
\ No newline at end of file
diff --git a/string/wcstok.3 b/string/wcstok.3
deleted file mode 100644 (file)
index 2b8de3f..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-.\" Copyright (c) 1998 Softweyr LLC.  All rights reserved.
-.\"
-.\" strtok_r, from Berkeley strtok
-.\" Oct 13, 1998 by Wes Peters <wes@softweyr.com>
-.\"
-.\" Copyright (c) 1988, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the American National Standards Committee X3, on Information
-.\" Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\"
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notices, this list of conditions and the following disclaimer.
-.\"
-.\" 2. Redistributions in binary form must reproduce the above
-.\"    copyright notices, this list of conditions and the following
-.\"    disclaimer in the documentation and/or other materials provided
-.\"    with the distribution.
-.\"
-.\" 3. All advertising materials mentioning features or use of this
-.\"    software must display the following acknowledgement:
-.\"
-.\"    This product includes software developed by Softweyr LLC, the
-.\"      University of California, Berkeley, and its contributors.
-.\"
-.\" 4. Neither the name of Softweyr LLC, the University nor the names
-.\"    of its contributors may be used to endorse or promote products
-.\"    derived from this software without specific prior written
-.\"    permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND
-.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-.\" DISCLAIMED.  IN NO EVENT SHALL SOFTWEYR LLC, THE REGENTS, OR
-.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/string/wcstok.3,v 1.4 2002/10/15 09:49:54 tjr Exp $
-.\"
-.Dd October 3, 2002
-.Dt WCSTOK 3
-.Os
-.Sh NAME
-.Nm wcstok
-.Nd split wide-character string into tokens
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft wchar_t *
-.Fo wcstok
-.Fa "wchar_t *restrict ws1"
-.Fa "const wchar_t *restrict ws2"
-.Fa "wchar_t **restrict ptr"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcstok
-function
-is used to isolate sequential tokens in a null-terminated wide character
-string,
-.Fa ws1 .
-These tokens are separated in the string by at least one of the
-characters in
-.Fa ws2 .
-The first time that
-.Fn wcstok
-is called,
-.Fa ws1
-should be specified; subsequent calls, wishing to obtain further tokens
-from the same string, should pass a null pointer instead.
-The separator string,
-.Fa ws2 ,
-must be supplied each time, and may change between calls.
-The context pointer,
-.Fa ptr ,
-must be provided on each call.
-.Pp
-The
-.Fn wcstok
-function is the wide character counterpart of the
-.Fn strtok_r
-function.
-.Sh RETURN VALUES
-The
-.Fn wcstok
-function
-returns a pointer to the beginning of each subsequent token in the string,
-after replacing the token itself with a null wide character (L'\e0').
-When no more tokens remain, a null pointer is returned.
-.Sh EXAMPLES
-The following code fragment splits a wide character string on
-.Tn ASCII
-space, tab, and newline characters,
-writing the resulting tokens to standard output:
-.Bd -literal -offset indent
-const wchar_t *seps = L" \et\en";
-wchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree  \en";
-
-for (tok = wcstok(text, seps, &last); tok != NULL;
-    tok = wcstok(NULL, seps, &last))
-       wprintf(L"%ls\en", tok);
-.Ed
-.Sh COMPATIBILITY
-Some early implementations of
-.Fn wcstok
-omit the
-context pointer argument,
-.Fa ptr ,
-and maintain state across calls in a static variable like
-.Fn strtok
-does.
-.Sh SEE ALSO
-.Xr strtok 3 ,
-.Xr wcschr 3 ,
-.Xr wcscspn 3 ,
-.Xr wcspbrk 3 ,
-.Xr wcsrchr 3 ,
-.Xr wcsspn 3
-.Sh STANDARDS
-The
-.Fn wcstok
-function
-conforms to
-.St -isoC-99 .
diff --git a/string/wcswidth-fbsd.c b/string/wcswidth-fbsd.c
deleted file mode 100644 (file)
index 447c8e5..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * This code is derived from software contributed to Berkeley by
- * Paul Borman at Krystal Technologies.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $");
-
-#include "xlocale_private.h"
-
-#include <wchar.h>
-
-int
-wcswidth_l(const wchar_t *pwcs, size_t n, locale_t loc)
-{
-       wchar_t wc;
-       int len, l;
-
-       NORMALIZE_LOCALE(loc);
-       len = 0;
-       while (n-- > 0 && (wc = *pwcs++) != L'\0') {
-               if ((l = wcwidth_l(wc, loc)) < 0)
-                       return (-1);
-               len += l;
-       }
-       return (len);
-}
-
-
-int
-wcswidth(const wchar_t *pwcs, size_t n)
-{
-       return wcswidth_l(pwcs, n, __current_locale());
-}
-
diff --git a/string/wcswidth.3 b/string/wcswidth.3
deleted file mode 100644 (file)
index 07eb058..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-.\" Copyright (c) 2002 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libc/string/wcswidth.3,v 1.2 2002/12/09 14:04:05 ru Exp $
-.\"
-.Dd August 20, 2002
-.Dt WCSWIDTH 3
-.Os
-.Sh NAME
-.Nm wcswidth ,
-.Nm wcswidth_l
-.Nd "number of column positions in wide-character string"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft int
-.Fo wcswidth
-.Fa "const wchar_t *pwcs"
-.Fa "size_t n"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft int
-.Fo wcswidth_l
-.Fa "const wchar_t *pwcs"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcswidth
-function determines the number of column positions required for the first
-.Fa n
-characters of
-.Fa pwcs ,
-or until a null wide character (L'\e0') is encountered.
-.Pp
-Although the
-.Fn wcswidth
-function uses the current locale, the
-.Fn wcswidth_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-The
-.Fn wcswidth
-function returns 0 if
-.Fa pwcs
-is an empty string (L""),
-\-1 if a non-printing wide character is encountered;
-otherwise, it returns the number of column positions occupied.
-.Sh SEE ALSO
-.Xr iswprint 3 ,
-.Xr wcwidth 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcswidth
-function conforms to
-.St -p1003.1-2001 .
diff --git a/string/wcsxfrm-fbsd.c b/string/wcsxfrm-fbsd.c
deleted file mode 100644 (file)
index eae9360..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
- *             at Electronni Visti IA, Kiev, Ukraine.
- *                     All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#if 0
-__FBSDID("FreeBSD: src/lib/libc/string/strxfrm.c,v 1.15 2002/09/06 11:24:06 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD: src/lib/libc/string/wcsxfrm.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
-
-#include "xlocale_private.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <wchar.h>
-#include <errno.h>
-#include "collate.h"
-
-#define WCS_XFRM_OFFSET        1
-
-size_t
-wcsxfrm_l(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len,
-    locale_t loc)
-{
-       size_t slen;
-       wchar_t *xf[2];
-       int sverrno;
-
-       if (*src == L'\0') {
-               if (len != 0)
-                       *dest = L'\0';
-               return (0);
-       }
-
-       NORMALIZE_LOCALE(loc);
-       if (loc->__collate_load_error) {
-               slen = wcslen(src);
-               if (len > 0) {
-                       if (slen < len)
-                               wcscpy(dest, src);
-                       else {
-                               wcsncpy(dest, src, len - 1);
-                               dest[len - 1] = L'\0';
-                       }
-               }
-               return (slen);
-       }
-
-       __collate_xfrm(src, xf, loc);
-
-       slen = wcslen(xf[0]);
-       if (xf[1])
-               slen += wcslen(xf[1]) + 1;
-       if (len > 0) {
-               wchar_t *w = xf[0];
-               while (len > 1) {
-                       if (!*w)
-                               break;
-                       *dest++ = *w++ + WCS_XFRM_OFFSET;
-                       len--;
-               }
-               if ((w = xf[1]) != NULL) {
-                       if (len > 1)
-                               *dest++ = WCS_XFRM_OFFSET;
-                       while (len > 1) {
-                               if (!*w)
-                                       break;
-                               *dest++ = *w++ + WCS_XFRM_OFFSET;
-                               len--;
-                       }
-               }
-               *dest = 0;
-       }
-       sverrno = errno;
-       free(xf[0]);
-       free(xf[1]);
-       errno = sverrno;
-       return (slen);
-}
-
-size_t
-wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
-{
-       return wcsxfrm_l(dest, src, len, __current_locale());
-}
diff --git a/string/wcsxfrm.3 b/string/wcsxfrm.3
deleted file mode 100644 (file)
index 038c7c7..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strxfrm.3  8.1 (Berkeley) 6/4/93
-.\" FreeBSD: src/lib/libc/string/strxfrm.3,v 1.16 2002/09/06 11:24:06 tjr Exp
-.\" $FreeBSD: src/lib/libc/string/wcsxfrm.3,v 1.3 2007/01/09 00:28:12 imp Exp $
-.\"
-.Dd October 4, 2002
-.Dt WCSXFRM 3
-.Os
-.Sh NAME
-.Nm wcsxfrm ,
-.Nm wcsxfrm_l
-.Nd transform a wide string under locale
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft size_t
-.Fo wcsxfrm
-.Fa "wchar_t *restrict ws1"
-.Fa "const wchar_t *restrict ws2"
-.Fa "size_t n"
-.Fc
-.In wchar.h
-.In xlocale.h
-.Ft size_t
-.Fo wcsxfrm_l
-.Fa "wchar_t *restrict ws1"
-.Fa "const wchar_t *restrict ws2"
-.Fa "size_t n"
-.Fa "locale_t loc"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wcsxfrm
-function transforms a null-terminated wide character string pointed to by
-.Fa ws2 ,
-according to the current locale's collation order,
-then copies the transformed string into
-.Fa ws1 .
-No more than
-.Fa n
-wide characters are copied into
-.Fa ws1 ,
-including the terminating null character.
-If
-.Fa n
-is set to 0
-(it helps to determine an actual size needed
-for transformation),
-.Fa ws1
-is permitted to be a
-.Dv NULL
-pointer.
-.Pp
-Comparing two strings using
-.Fn wcscmp
-after
-.Fn wcsxfrm
-is equivalent to comparing
-two original strings with
-.Fn wcscoll .
-.Pp
-Although the
-.Fn wcsxfrm
-function uses the current locale, the
-.Fn wcsxfrm_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn wcsxfrm
-returns the length of the transformed string not including
-the terminating null character.
-If this value is
-.Fa n
-or more, the contents of
-.Fa ws1
-are indeterminate.
-.Sh SEE ALSO
-.Xr setlocale 3 ,
-.Xr strxfrm 3 ,
-.Xr wcscmp 3 ,
-.Xr wcscoll 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-The
-.Fn wcsxfrm
-function
-conforms to
-.St -isoC-99 .
-.Sh BUGS
-The current implementation of
-.Fn wcsxfrm
-only works in single-byte
-.Dv LC_CTYPE
-locales, and falls back to using
-.Fn wcsncpy
-in locales with extended character sets.
-.Pp
-Comparing two strings using
-.Fn wcscmp
-after
-.Fn wcsxfrm
-is
-.Em not
-always equivalent to comparison with
-.Fn wcscoll ;
-.Fn wcsxfrm
-only stores information about primary collation weights into
-.Fa ws1 ,
-whereas
-.Fn wcscoll
-compares characters using both primary and secondary weights.
diff --git a/string/wmemchr-fbsd.c b/string/wmemchr-fbsd.c
deleted file mode 120000 (symlink)
index 0ad0f50..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wmemchr.c
\ No newline at end of file
diff --git a/string/wmemchr.3 b/string/wmemchr.3
deleted file mode 100644 (file)
index 2e1d3ec..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-.\"    $NetBSD: wmemchr.3,v 1.4 2001/01/02 11:26:23 itojun Exp $
-.\"
-.\" Copyright (c) 1990, 1991, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek and the American National Standards Committee X3,
-.\" on Information Processing Systems.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     from: @(#)strcpy.3     8.1 (Berkeley) 6/4/93
-.\"
-.\" $FreeBSD: src/lib/libc/string/wmemchr.3,v 1.10 2009/03/04 06:01:27 das Exp $
-.\"
-.Dd March 4, 2009
-.Dt WMEMCHR 3
-.Os
-.Sh NAME
-.Nm wcpcpy ,
-.Nm wcpncpy ,
-.Nm wcscasecmp ,
-.Nm wcscat ,
-.Nm wcschr ,
-.Nm wcscmp ,
-.Nm wcscpy ,
-.Nm wcscspn ,
-.Nm wcsdup ,
-.Nm wcslcat ,
-.Nm wcslcpy ,
-.Nm wcslen ,
-.Nm wcsncasecmp ,
-.Nm wcsncat ,
-.Nm wcsncmp ,
-.Nm wcsncpy ,
-.Nm wcsnlen ,
-.Nm wcspbrk ,
-.Nm wcsrchr ,
-.Nm wcsspn ,
-.Nm wcsstr ,
-.Nm wmemchr ,
-.Nm wmemcmp ,
-.Nm wmemcpy ,
-.Nm wmemmove ,
-.Nm wmemset
-.Nd wide character string manipulation operations
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In wchar.h
-.Ft wchar_t *
-.Fn wcpcpy "wchar_t *s1" "wchar_t *s2"
-.Ft wchar_t *
-.Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n"
-.Ft int
-.Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2"
-.Ft wchar_t *
-.Fn wcscat "wchar_t * restrict s1" "const wchar_t * restrict s2"
-.Ft wchar_t *
-.Fn wcschr "const wchar_t *s" "wchar_t c"
-.Ft int
-.Fn wcscmp "const wchar_t *s1" "const wchar_t *s2"
-.Ft wchar_t *
-.Fn wcscpy "wchar_t * restrict s1" "const wchar_t * restrict s2"
-.Ft size_t
-.Fn wcscspn "const wchar_t *s1" "const wchar_t *s2"
-.Ft wchar_t *
-.Fn wcsdup "const wchar_t *s"
-.Ft size_t
-.Fn wcslcat "wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft size_t
-.Fn wcslcpy "wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft size_t
-.Fn wcslen "const wchar_t *s"
-.Ft int
-.Fn wcsncasecmp "const wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft wchar_t *
-.Fn wcsncat "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
-.Ft int
-.Fn wcsncmp "const wchar_t *s1" "const wchar_t * s2" "size_t n"
-.Ft wchar_t *
-.Fn wcsncpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
-.Ft size_t
-.Fn wcsnlen "const wchar_t *s" "size_t maxlen"
-.Ft wchar_t *
-.Fn wcspbrk "const wchar_t *s1" "const wchar_t *s2"
-.Ft wchar_t *
-.Fn wcsrchr "const wchar_t *s" "wchar_t c"
-.Ft size_t
-.Fn wcsspn "const wchar_t *s1" "const wchar_t *s2"
-.Ft wchar_t *
-.Fn wcsstr "const wchar_t * restrict s1" "const wchar_t * restrict s2"
-.Ft wchar_t *
-.Fn wmemchr "const wchar_t *s" "wchar_t c" "size_t n"
-.Ft int
-.Fn wmemcmp "const wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft wchar_t *
-.Fn wmemcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
-.Ft wchar_t *
-.Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n"
-.Ft wchar_t *
-.Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
-.In wchar.h
-.In xlocale.h
-.Ft int
-.Fn wcscasecmp_l "const wchar_t *s1" "const wchar_t *s2" "locale_t loc"
-.Ft int
-.Fn wcsncasecmp_l "const wchar_t *s1" "const wchar_t *s2" "size_t n" "locale_t loc"
-.Sh DESCRIPTION
-The functions implement string manipulation operations over wide character
-strings.
-For a detailed description, refer to documents for the respective single-byte
-counterpart, such as
-.Xr memchr 3 .
-.Sh SEE ALSO
-.Xr memchr 3 ,
-.Xr memcmp 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr memset 3 ,
-.Xr stpcpy 3 ,
-.Xr stpncpy 3 ,
-.Xr strcasecmp 3 ,
-.Xr strcasecmp_l 3 ,
-.Xr strcat 3 ,
-.Xr strchr 3 ,
-.Xr strcmp 3 ,
-.Xr strcpy 3 ,
-.Xr strcspn 3 ,
-.Xr strdup 3 ,
-.Xr strlcat 3 ,
-.Xr strlcpy 3 ,
-.Xr strlen 3 ,
-.Xr strncasecmp 3 ,
-.Xr strncasecmp_l 3 ,
-.Xr strncat 3 ,
-.Xr strncmp 3 ,
-.Xr strncpy 3 ,
-.Xr strnlen 3 ,
-.Xr strpbrk 3 ,
-.Xr strrchr 3 ,
-.Xr strspn 3 ,
-.Xr strstr 3 ,
-.Xr xlocale 3
-.Sh STANDARDS
-These functions conform to
-.St -isoC-99 ,
-with the exception of
-.Fn wcpcpy ,
-.Fn wcpncpy ,
-.Fn wcscasecmp ,
-.Fn wcscasecmp_l ,
-.Fn wcsdup ,
-.Fn wcsncasecmp ,
-.Fn wcsncasecmp_l ,
-and
-.Fn wcsnlen ,
-which conform to
-.St -p1003.1-2008 ;
-and
-.Fn wcslcat
-and
-.Fn wcslcpy ,
-which are extensions.
diff --git a/string/wmemcmp-fbsd.c b/string/wmemcmp-fbsd.c
deleted file mode 120000 (symlink)
index e0c5393..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wmemcmp.c
\ No newline at end of file
diff --git a/string/wmemcpy-fbsd.c b/string/wmemcpy-fbsd.c
deleted file mode 120000 (symlink)
index 0518204..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wmemcpy.c
\ No newline at end of file
diff --git a/string/wmemmove-fbsd.c b/string/wmemmove-fbsd.c
deleted file mode 120000 (symlink)
index 39fcfbe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wmemmove.c
\ No newline at end of file
diff --git a/string/wmemset-fbsd.c b/string/wmemset-fbsd.c
deleted file mode 120000 (symlink)
index 60f8a54..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wmemset.c
\ No newline at end of file
diff --git a/strip-header.ed b/strip-header.ed
deleted file mode 100644 (file)
index a7d7aa8..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-g/^\/\/Begin-Libc$/.,/^\/\/End-Libc$/d
-w
diff --git a/sys/Makefile.inc b/sys/Makefile.inc
deleted file mode 100644 (file)
index 5036958..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-#      @(#)Makefile.inc        8.3 (Berkeley) 10/24/94
-# $FreeBSD: src/lsys/Makefile.inc,v 1.91 2001/09/21 21:35:22 rwatson Exp $
-
-# Include machine dependent definitions.
-#
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/sys/Makefile.inc"
-
-# sys sources
-.PATH: ${.CURDIR}/sys
-CWD := ${.CURDIR}/sys
-
-# Sources common to both syscall interfaces:
-
-MISRCS += chmodx_np.c crt_externs.c \
-       errno.c fork.c \
-       getiopolicy_np.c gettimeofday.c \
-       __libc_init.c _libc_fork_child.c \
-       openx_np.c \
-       posix_spawn.c \
-       settimeofday.c \
-       sigaction.c sigcatch.c \
-       sigtramp.c slot_name.c statx_np.c \
-       umaskx_np.c
-
-.ifdef FEATURE_MEM_THERM_NOTIFICATION_APIS
-MISRCS += OSMemoryNotification.c OSThermalNotification.c
-.endif
-
-.if (${MACHINE_ARCH} != ppc)
-.if (${MACHINE_ARCH} != i386)
-.if (${MACHINE_ARCH} != x86_64)
-MISRCS+= context-stubs.c
-.endif
-.endif
-.endif
-
-.include "Makefile.obsd_begin"
-OBSDMISRCS= stack_protector.c
-.include "Makefile.obsd_end"
-
-DARWINEXTSNSRCS += getgroups.c
-
-INODE32SRCS += statx_np.c
-
-DYLDSRCS += errno.c
-
-LEGACYSRCS += msgctl.c \
-       semctl.c \
-       shmctl.c
-
-.for _src in msgctl.c semctl.c shmctl.c
-CFLAGS-${_src} += -DKERNEL
-.endfor
-
-# sigtramp.c can only compile with __DARWIN_UNIX03=0 (for ppc64) because
-# the structure field names are renamed with __ prefix when __DARWIN_UNIX03=1.
-# If sigtramp.c ever needs to build variant, this will have to be fix properly
-CFLAGS-sigtramp.c = -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0
-
-# set the LIBC_ALIAS_* macros so we can decorate the symbol independent
-# of other macro settings
-CFLAGS-accept.c += -DLIBC_ALIAS_ACCEPT
-#CFLAGS-aio_suspend.c += -DLIBC_ALIAS_AIO_SUSPEND
-CFLAGS-bind.c += -DLIBC_ALIAS_BIND
-CFLAGS-chmod.c += -DLIBC_ALIAS_CHMOD
-#CFLAGS-close.c += -DLIBC_ALIAS_CLOSE
-CFLAGS-connect.c += -DLIBC_ALIAS_CONNECT
-CFLAGS-fchmod.c += -DLIBC_ALIAS_FCHMOD
-#CFLAGS-fsync.c += -DLIBC_ALIAS_FSYNC
-CFLAGS-getattrlist.c += -DLIBC_ALIAS_GETATTRLIST
-CFLAGS-getpeername.c += -DLIBC_ALIAS_GETPEERNAME
-CFLAGS-getsockname.c += -DLIBC_ALIAS_GETSOCKNAME
-CFLAGS-lchmod.c += -DLIBC_ALIAS_LCHMOD
-CFLAGS-lchown.c += -DLIBC_ALIAS_LCHOWN
-CFLAGS-listen.c += -DLIBC_ALIAS_LISTEN
-CFLAGS-msgctl.c += -DLIBC_ALIAS_MSGCTL
-#CFLAGS-msgrcv.c += -DLIBC_ALIAS_MSGRCV
-#CFLAGS-msgsnd.c += -DLIBC_ALIAS_MSGSND
-#CFLAGS-poll.c += -DLIBC_ALIAS_POLL
-#CFLAGS-pread.c += -DLIBC_ALIAS_PREAD
-#CFLAGS-pwrite.c += -DLIBC_ALIAS_PWRITE
-#CFLAGS-read.c += -DLIBC_ALIAS_READ
-#CFLAGS-readv.c += -DLIBC_ALIAS_READV
-CFLAGS-recvfrom.c += -DLIBC_ALIAS_RECVFROM
-CFLAGS-recvmsg.c += -DLIBC_ALIAS_RECVMSG
-#CFLAGS-sem_wait.c += -DLIBC_ALIAS_SEM_WAIT
-CFLAGS-semctl.c += -DLIBC_ALIAS_SEMCTL
-CFLAGS-sendmsg.c += -DLIBC_ALIAS_SENDMSG
-CFLAGS-sendto.c += -DLIBC_ALIAS_SENDTO
-CFLAGS-setattrlist.c += -DLIBC_ALIAS_SETATTRLIST
-CFLAGS-shmctl.c += -DLIBC_ALIAS_SHMCTL
-CFLAGS-socketpair.c += -DLIBC_ALIAS_SOCKETPAIR
-CFLAGS-stack_protector-obsd.c += -fno-stack-protector
-#CFLAGS-waitid.c += -DLIBC_ALIAS_WAITID
-#CFLAGS-write.c += -DLIBC_ALIAS_WRITE
-#CFLAGS-writev.c += -DLIBC_ALIAS_WRITEV
-
-.if ${LIB} == "c"
-MAN2+= pthread_kill.2 pthread_sigmask.2 \
-       sigwait.2 nanosleep.2
-MAN3+= atomic.3 barrier.3 getiopolicy_np.3 spinlock.3 cache.3
-MLINKS+= atomic.3 OSAtomicAdd32.3
-MLINKS+= atomic.3 OSAtomicAdd32Barrier.3
-MLINKS+= atomic.3 OSAtomicAdd64.3
-MLINKS+= atomic.3 OSAtomicAdd64Barrier.3
-MLINKS+= atomic.3 OSAtomicAnd32.3
-MLINKS+= atomic.3 OSAtomicAnd32Barrier.3
-MLINKS+= atomic.3 OSAtomicAnd32Orig.3
-MLINKS+= atomic.3 OSAtomicAnd32OrigBarrier.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwap32.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwap32Barrier.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwap64.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwap64Barrier.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwapInt.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwapIntBarrier.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwapLong.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwapLongBarrier.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwapPtr.3
-MLINKS+= atomic.3 OSAtomicCompareAndSwapPtrBarrier.3
-MLINKS+= atomic.3 OSAtomicDecrement32.3
-MLINKS+= atomic.3 OSAtomicDecrement32Barrier.3
-MLINKS+= atomic.3 OSAtomicDecrement64.3
-MLINKS+= atomic.3 OSAtomicDecrement64Barrier.3
-MLINKS+= atomic.3 OSAtomicDequeue.3
-MLINKS+= atomic.3 OSAtomicEnqueue.3
-MLINKS+= atomic.3 OSAtomicIncrement32.3
-MLINKS+= atomic.3 OSAtomicIncrement32Barrier.3
-MLINKS+= atomic.3 OSAtomicIncrement64.3
-MLINKS+= atomic.3 OSAtomicIncrement64Barrier.3
-MLINKS+= atomic.3 OSAtomicOr32.3
-MLINKS+= atomic.3 OSAtomicOr32Barrier.3
-MLINKS+= atomic.3 OSAtomicOr32Orig.3
-MLINKS+= atomic.3 OSAtomicOr32OrigBarrier.3
-MLINKS+= atomic.3 OSAtomicTestAndClear.3
-MLINKS+= atomic.3 OSAtomicTestAndClearBarrier.3
-MLINKS+= atomic.3 OSAtomicTestAndSet.3
-MLINKS+= atomic.3 OSAtomicTestAndSetBarrier.3
-MLINKS+= atomic.3 OSAtomicXor32.3
-MLINKS+= atomic.3 OSAtomicXor32Barrier.3
-MLINKS+= atomic.3 OSAtomicXor32Orig.3
-MLINKS+= atomic.3 OSAtomicXor32OrigBarrier.3
-MLINKS+= barrier.3 OSMemoryBarrier.3
-
-MLINKS+= getiopolicy_np.3 setiopolicy_np.3
-
-MLINKS+= cache.3 sys_cache_control.3
-MLINKS+= cache.3 sys_icache_invalidate.3
-MLINKS+= cache.3 sys_dcache_flush.3
-
-MLINKS+= spinlock.3 OSSpinLockLock.3                   \
-         spinlock.3 OSSpinLockTry.3                    \
-         spinlock.3 OSSpinLockUnlock.3
-
-#MAN+= _exit.2 accept.2 access.2 acct.2 adjtime.2 \
-#      aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \
-#      aio_suspend.2 aio_waitcomplete.2 aio_write.2 \
-#      bind.2 brk.2 chdir.2 chflags.2 \
-#      chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 \
-#      connect.2 dup.2 execve.2 extattr_get_file.2 \
-#      fcntl.2 fhopen.2 flock.2 fork.2 fsync.2 \
-#      getdirentries.2 getdtablesize.2 \
-#      getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \
-#      getpeername.2 getpgrp.2 getpid.2 getpriority.2 \
-#      getrusage.2 getsid.2 getsockname.2 \
-#      getsockopt.2 gettimeofday.2 getuid.2 \
-#      intro.2 ioctl.2 issetugid.2 jail.2 \
-#      kldfind.2 kldfirstmod.2 kldload.2 kldnext.2 kldstat.2 kldsym.2 \
-#      kldunload.2 kqueue.2 link.2 listen.2 lseek.2 \
-#      madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 \
-#      modfind.2 modnext.2 modstat.2 \
-#      mount.2 nanosleep.2 \
-#      nfssvc.2 pathconf.2 pipe.2 poll.2 profil.2 ptrace.2 quotactl.2 \
-#      read.2 readlink.2 reboot.2 recv.2 revoke.2 rfork.2 \
-#      rtprio.2 semctl.2 semget.2 semop.2 send.2 sendfile.2 \
-#      setgroups.2 setpgid.2 setregid.2 setresuid.2 setreuid.2 setsid.2 \
-#      setuid.2 shmat.2 shmctl.2 shmget.2 shutdown.2 \
-#      sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 sigreturn.2 \
-#      sigstack.2 socket.2 socketpair.2 stat.2 statfs.2 \
-#      swapon.2 symlink.2 sync.2 sysarch.2 syscall.2 \
-#      truncate.2 umask.2 undelete.2 \
-#      utimes.2 vfork.2 wait.2 write.2
-#.if !defined(NO_P1003_1B)
-#MAN+= sched_get_priority_max.2 sched_setparam.2 \
-#      sched_setscheduler.2 sched_yield.2
-#.endif
-
-#MLINKS+=access.2 eaccess.2
-#MLINKS+=brk.2 sbrk.2
-#MLINKS+=chdir.2 fchdir.2
-#MLINKS+=chflags.2 fchflags.2
-#MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2
-#MLINKS+=chown.2 fchown.2 chown.2 lchown.2
-#MLINKS+=clock_gettime.2 clock_getres.2 clock_gettime.2 clock_settime.2
-#MLINKS+=dup.2 dup2.2
-#MLINKS+=extattr_get_file.2 extattr_set_file.2 \
-#      extattr_get_file.2 extattr_delete_file.2 \
-#      extattr_get_file.2 extattr_get_fd.2 \
-#      extattr_get_file.2 extattr_set_fd.2 \
-#      extattr_get_file.2 extattr_delete_fd.2 \
-#      extattr_get_file.2 extattr.2
-#MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
-#MLINKS+=getdirentries.2 getdents.2
-#MLINKS+=getgid.2 getegid.2
-#MLINKS+=getitimer.2 setitimer.2
-#MLINKS+=getlogin.2 getlogin_r.3
-#MLINKS+=getlogin.2 setlogin.2
-#MLINKS+=getpgrp.2 getpgid.2
-#MLINKS+=getpid.2 getppid.2
-#MLINKS+=getpriority.2 setpriority.2
-#MLINKS+=getsockopt.2 setsockopt.2
-#MLINKS+=gettimeofday.2 settimeofday.2
-#MLINKS+=getuid.2 geteuid.2
-#MLINKS+=intro.2 errno.2
-#MLINKS+=kqueue.2 kevent.2
-#MLINKS+=mlock.2 munlock.2
-#MLINKS+=modnext.2 modfnext.2
-#MLINKS+=mount.2 unmount.2
-#MLINKS+=pathconf.2 fpathconf.2
-#MLINKS+=read.2 pread.2 read.2 readv.2
-#MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
-#MLINKS+=send.2 sendmsg.2 send.2 sendto.2
-#MLINKS+=setpgid.2 setpgrp.2
-#MLINKS+=setresuid.2 setresgid.2 setresuid.2 getresuid.2 setresuid.2 getresgid.2
-#MLINKS+=setuid.2 setegid.2 setuid.2 seteuid.2 setuid.2 setgid.2
-#MLINKS+=shmat.2 shmdt.2
-#MLINKS+=stat.2 fstat.2 stat.2 lstat.2
-#MLINKS+=statfs.2 fstatfs.2
-#MLINKS+=syscall.2 __syscall.2
-#MLINKS+=truncate.2 ftruncate.2
-#MLINKS+=utimes.2 futimes.2 utimes.2 lutimes.2
-#MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2
-#MLINKS+=write.2 pwrite.2 write.2 writev.2
-#.if !defined(NO_P1003_1B)
-#MLINKS+=sched_get_priority_max.2 sched_get_priority_min.2 \
-#      sched_get_priority_max.2 sched_rr_get_interval.2
-#MLINKS+=sched_setparam.2 sched_getparam.2
-#MLINKS+=sched_setscheduler.2 sched_getscheduler.2
-#.endif
-.endif
index b0f1ae484bd353e14979f52f903d0047acd84600..897b9ac33e20435742b5421e99d80b7a992c1e16 100644 (file)
@@ -27,6 +27,8 @@
 #include <notify.h>
 #include <stdlib.h>
 #include <sys/time.h>
+#include <dispatch/dispatch.h>
+#include <dispatch/private.h>
 
 const char *kOSMemoryNotificationName = "com.apple.system.memorystatus";
 
@@ -69,7 +71,6 @@ OSMemoryNotificationDestroy(OSMemoryNotificationRef note)
 int
 OSMemoryNotificationWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level)
 {
-
        return OSMemoryNotificationTimedWait(note, level, NULL);
 }
 
@@ -95,49 +96,40 @@ abs_to_timeout(const struct timeval *abstime)
 int
 OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime)
 {
-       mach_msg_empty_rcv_t msg = {{0}};
-       mach_msg_return_t ret;
-       uint64_t val;
-
-       if (abstime) {
-               mach_msg_timeout_t timeout = abs_to_timeout(abstime);
-
-               if (0 == timeout)
-                       return ETIMEDOUT;
-
-               ret = mach_msg(&msg.header, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0, sizeof msg, note->port, timeout, MACH_PORT_NULL);
-
-               if (MACH_RCV_TIMED_OUT == ret) {
-                       return ETIMEDOUT;
-               } 
-       } else {
-               ret = mach_msg(&msg.header, MACH_RCV_MSG, 0, sizeof msg, note->port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
-       }
-
-       if (MACH_MSG_SUCCESS != ret)
-               return EINVAL;
-
-       if (NOTIFY_STATUS_OK != notify_get_state(note->token, &val))
-               return EINVAL;
-
-       *level = (OSMemoryNotificationLevel)val;
-
-       return 0;
+    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
+    dispatch_retain(sema);
+    
+    dispatch_source_t memoryNotificationSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_VM, 0, DISPATCH_VM_PRESSURE, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
+    dispatch_source_set_event_handler(memoryNotificationSource, ^{
+        dispatch_semaphore_signal(sema);
+        dispatch_release(sema);
+    });
+
+    dispatch_resume(memoryNotificationSource);
+    
+    dispatch_time_t waitTime = DISPATCH_TIME_FOREVER;
+    if (abstime) {
+        mach_msg_timeout_t timeout = abs_to_timeout(abstime);
+        waitTime = dispatch_time(DISPATCH_TIME_NOW, timeout * 1e6);
+    }
+    
+    long ret = dispatch_semaphore_wait(sema, waitTime);
+
+    dispatch_release(sema);
+    dispatch_release(memoryNotificationSource);
+
+    if (ret != 0) {
+        return ETIMEDOUT;
+    }
+    
+    if (level) {
+        *level = OSMemoryNotificationLevelUrgent;
+    }
+    
+    return 0;
 }
 
 OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void)
 {
-       uint64_t val;
-       int token;
-
-       if (NOTIFY_STATUS_OK != notify_register_check(kOSMemoryNotificationName, &token))
-               return OSMemoryNotificationLevelAny;
-
-       if (NOTIFY_STATUS_OK != notify_get_state(token, &val))
-               return OSMemoryNotificationLevelAny;
-
-       if (NOTIFY_STATUS_OK != notify_cancel(token))
-               return OSMemoryNotificationLevelAny;
-
-       return (OSMemoryNotificationLevel)val;
+       return OSMemoryNotificationLevelNormal;
 }
index 618bf58ef787079b5cae2b2a137536bbbdccdaa8..772490f41d91f68bf85dcb8be7b5971602de11df 100644 (file)
@@ -39,18 +39,20 @@ static const char * const kOSThermalMitigationNames[kOSThermalMitigationCount] =
        "com.apple.system.thermalmitigation.25percentbacklight",
        "com.apple.system.thermalmitigation.disablemapshalo",
        "com.apple.system.thermalmitigation.appterminate",
-       "com.apple.system.thermalmitigation.devicerestart"
+       "com.apple.system.thermalmitigation.devicerestart",
+       "com.apple.system.thermalmitigation.thermaltableready"
 };
 
 static int tokens[kOSThermalMitigationCount];
 static dispatch_once_t predicates[kOSThermalMitigationCount];
+static bool thermalLevelsReady = false;
 
 OSThermalNotificationLevel _OSThermalNotificationLevelForBehavior(int behavior)
 {
        uint64_t val = OSThermalNotificationLevelAny;
        if (behavior >= 0 && behavior < kOSThermalMitigationCount) {
                dispatch_once(&predicates[behavior], ^{
-                               (void)notify_register_check(kOSThermalMitigationNames[behavior], &tokens[behavior]);
+                       (void)notify_register_check(kOSThermalMitigationNames[behavior], &tokens[behavior]);
                });
                (void)notify_get_state(tokens[behavior], &val);
        }
@@ -62,14 +64,47 @@ void _OSThermalNotificationSetLevelForBehavior(int level, int behavior)
        uint64_t val = (uint64_t)level;
        if (behavior >= 0 && behavior < kOSThermalMitigationCount) {
                dispatch_once(&predicates[behavior], ^{
-                               (void)notify_register_check(kOSThermalMitigationNames[behavior], &tokens[behavior]);
+                       (void)notify_register_check(kOSThermalMitigationNames[behavior], &tokens[behavior]);
                });
                (void)notify_set_state(tokens[behavior], val);
+
+               // Note:  
+               // - We are ready when we program in the appterminate value. 
+               // - Assumes that user programs kOSThermalMitigationNone level less than 
+               //   kOSThermalMitigationAppTerminate & kOSThermalMitigationDeviceRestart  
+               if (behavior == kOSThermalMitigationAppTerminate) {
+                       dispatch_once(&predicates[kOSThermalMitigationThermalTableReady], ^{
+                               (void)notify_register_check(kOSThermalMitigationNames[kOSThermalMitigationThermalTableReady], &tokens[kOSThermalMitigationThermalTableReady]);
+                       });
+                       (void)notify_set_state(tokens[kOSThermalMitigationThermalTableReady], kOSThermalMitigationCount);
+               }
        }
 }
 
 
 OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void)
 {
-       return _OSThermalNotificationLevelForBehavior(kOSThermalMitigationNone);
+       if (thermalLevelsReady) {
+               return _OSThermalNotificationLevelForBehavior(kOSThermalMitigationNone);
+       }
+
+       uint64_t tableReady = 0;
+
+       dispatch_once(&predicates[kOSThermalMitigationThermalTableReady], ^{
+               (void)notify_register_check(kOSThermalMitigationNames[kOSThermalMitigationThermalTableReady], &tokens[kOSThermalMitigationThermalTableReady]);
+       });
+       (void)notify_get_state(tokens[kOSThermalMitigationThermalTableReady], &tableReady);
+
+       // If we are ready then optimize this so we don't call dispatch everytime.
+       if (tableReady == kOSThermalMitigationCount) {
+               thermalLevelsReady = true;
+               return _OSThermalNotificationLevelForBehavior(kOSThermalMitigationNone); 
+       }
+       else {
+               // Allow reset so we can dynamically change the table without thermal trap screen appearing. 
+               thermalLevelsReady = false;
+       }
+
+       // Not ready returns -1, which should not be equal or greater than any other thermal state. 
+       return OSThermalNotificationLevelAny;
 }
index 7b9653255f0f2efee0c3f094a067084bf96ce669..74976f631bbb5e97a461abb7ce941abb32987d6a 100644 (file)
  */
 
 #include <sys/param.h>
-#include <sys/sysctl.h>
 #include <signal.h>
 #include <string.h>
-#include <syslog.h>
+#include <stdlib.h>
+#include <asl.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include "CrashReporterClient.h"
+#include "libproc.h"
+#include "_simple.h"
 
-extern int __sysctl(int *, u_int, void *, size_t *, void *, size_t);
-
-long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
-static void __guard_setup(void) __attribute__ ((constructor));
-void __stack_smash_handler(char func[], int damaged __attribute__((unused)));
+#define        GUARD_MAX 8
+long __stack_chk_guard[GUARD_MAX] = {0, 0, 0, 0, 0, 0, 0, 0};
+void __abort(void) __dead2;
+void __guard_setup(const char *apple[]) __attribute__ ((visibility ("hidden")));
+void __stack_chk_fail(void);
 
 static void
-__guard_setup(void)
+__guard_from_kernel(const char *str)
 {
-       int mib[2];
-       size_t len;
+       unsigned long long val;
+       char tmp[20], *p;
+       int idx = 0;
 
-       if (__guard[0] != 0)
+       /* Skip over the 'stack_guard=' key to the list of values */
+       str = strchr(str, '=');
+       if (str == NULL)
                return;
+       str++;
 
-       mib[0] = CTL_KERN;
-       mib[1] = KERN_ARND;
-
-       len = sizeof(__guard);
-       if (__sysctl(mib, 2, __guard, &len, NULL, 0) == -1 ||
-           len != sizeof(__guard)) {
-               /* If sysctl was unsuccessful, use the "terminator canary". */
-               ((unsigned char *)__guard)[0] = 0;
-               ((unsigned char *)__guard)[1] = 0;
-               ((unsigned char *)__guard)[2] = '\n';
-               ((unsigned char *)__guard)[3] = 255;
+       while (str && idx < GUARD_MAX) {
+               /*
+                * Pull the next numeric string out of the list and convert it to
+                * a real number.
+                */
+               strlcpy(tmp, str, 20);
+               p = strchr(tmp, ',');
+               if (p)
+                       *p = '\0';
+               val = strtoull(tmp, NULL, 0);
+               __stack_chk_guard[idx] = (long)(val & ((unsigned long) -1));
+               idx++;
+               if ((str = strchr(str, ',')) != NULL)
+                       str++;
        }
 }
 
-/*ARGSUSED*/
 void
-__stack_smash_handler(char func[], int damaged)
+__guard_setup(const char *apple[])
 {
-       struct syslog_data sdata = SYSLOG_DATA_INIT;
-       const char message[] = "stack overflow in function %s";
-       struct sigaction sa;
-       sigset_t mask;
+       int fd;
+       size_t len;
+       const char **p;
 
-       /* Immediately block all signal handlers from running code */
-       sigfillset(&mask);
-       sigdelset(&mask, SIGABRT);
-       sigprocmask(SIG_BLOCK, &mask, NULL);
+       if (__stack_chk_guard[0] != 0)
+               return;
 
-       /* This may fail on a chroot jail... */
-       syslog_r(LOG_CRIT, &sdata, message, func);
+       for (p = apple; p && *p; p++) {
+               if (strstr(*p, "stack_guard") == *p) {
+                       __guard_from_kernel(*p);
+                       if (__stack_chk_guard[0] != 0)
+                               return;
+               }
+       }
+
+       fd = open ("/dev/urandom", 0);
+       if (fd != -1) {
+               len = read (fd, (char*)&__stack_chk_guard, sizeof(__stack_chk_guard));
+               close(fd);
+               if (len == sizeof(__stack_chk_guard) && 
+                    *__stack_chk_guard != 0)
+                       return;
+       }
+
+       /* If If a random generator can't be used, the protector switches the guard
+           to the "terminator canary" */
+       ((unsigned char *)__stack_chk_guard)[0] = 0;
+       ((unsigned char *)__stack_chk_guard)[1] = 0;
+       ((unsigned char *)__stack_chk_guard)[2] = '\n';
+       ((unsigned char *)__stack_chk_guard)[3] = 255;
+}
+
+#define STACKOVERFLOW  "] stack overflow"
 
-       bzero(&sa, sizeof(struct sigaction));
-       sigemptyset(&sa.sa_mask);
-       sa.sa_flags = 0;
-       sa.sa_handler = SIG_DFL;
-       sigaction(SIGABRT, &sa, NULL);
+void
+__stack_chk_fail()
+{
+       char n[16]; // bigger than will hold the digits in a pid_t
+       char *np;
+       int pid = getpid();
+       char message[sizeof(n) + sizeof(STACKOVERFLOW)] = "[";
+       char prog[2*MAXCOMLEN+1] = {0};
 
-       kill(getpid(), SIGABRT);
+       proc_name(pid, prog, 2*MAXCOMLEN);
+       prog[2*MAXCOMLEN] = 0;
+       np = n + sizeof(n);
+       *--np = 0;
+       while(pid > 0) {
+           *--np = (pid % 10) + '0';
+           pid /= 10;
+       }
+       strlcat(message, np, sizeof(message));
+       strlcat(message, STACKOVERFLOW, sizeof(message));
+       /* This may fail on a chroot jail... */
+       _simple_asl_log_prog(ASL_LEVEL_CRIT, "user", message, prog);
 
-       _exit(127);
+       CRSetCrashLogMessage(message);
+       __abort();
 }
diff --git a/sys/OpenBSD/stack_protector.c.patch b/sys/OpenBSD/stack_protector.c.patch
deleted file mode 100644 (file)
index 403b664..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
---- stack_protector.c.orig     2010-10-07 09:55:01.000000000 -0700
-+++ stack_protector.c  2010-10-07 09:55:30.000000000 -0700
-@@ -28,65 +28,112 @@
-  */
- #include <sys/param.h>
--#include <sys/sysctl.h>
- #include <signal.h>
- #include <string.h>
--#include <syslog.h>
-+#include <stdlib.h>
-+#include <asl.h>
- #include <unistd.h>
-+#include <sys/types.h>
-+#include <fcntl.h>
-+#include "CrashReporterClient.h"
-+#include "libproc.h"
-+#include "_simple.h"
-+
-+#define       GUARD_MAX 8
-+long __stack_chk_guard[GUARD_MAX] = {0, 0, 0, 0, 0, 0, 0, 0};
-+void __abort(void) __dead2;
-+void __guard_setup(const char *apple[]) __attribute__ ((visibility ("hidden")));
-+void __stack_chk_fail(void);
--extern int __sysctl(int *, u_int, void *, size_t *, void *, size_t);
-+static void
-+__guard_from_kernel(const char *str)
-+{
-+      unsigned long long val;
-+      char tmp[20], *p;
-+      int idx = 0;
-+
-+      /* Skip over the 'stack_guard=' key to the list of values */
-+      str = strchr(str, '=');
-+      if (str == NULL)
-+              return;
-+      str++;
--long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
--static void __guard_setup(void) __attribute__ ((constructor));
--void __stack_smash_handler(char func[], int damaged __attribute__((unused)));
-+      while (str && idx < GUARD_MAX) {
-+              /*
-+               * Pull the next numeric string out of the list and convert it to
-+               * a real number.
-+               */
-+              strlcpy(tmp, str, 20);
-+              p = strchr(tmp, ',');
-+              if (p)
-+                      *p = '\0';
-+              val = strtoull(tmp, NULL, 0);
-+              __stack_chk_guard[idx] = (long)(val & ((unsigned long) -1));
-+              idx++;
-+              if ((str = strchr(str, ',')) != NULL)
-+                      str++;
-+      }
-+}
--static void
--__guard_setup(void)
-+void
-+__guard_setup(const char *apple[])
- {
--      int mib[2];
-+      int fd;
-       size_t len;
-+      const char **p;
--      if (__guard[0] != 0)
-+      if (__stack_chk_guard[0] != 0)
-               return;
--      mib[0] = CTL_KERN;
--      mib[1] = KERN_ARND;
-+      for (p = apple; p && *p; p++) {
-+              if (strstr(*p, "stack_guard") == *p) {
-+                      __guard_from_kernel(*p);
-+                      if (__stack_chk_guard[0] != 0)
-+                              return;
-+              }
-+      }
--      len = sizeof(__guard);
--      if (__sysctl(mib, 2, __guard, &len, NULL, 0) == -1 ||
--          len != sizeof(__guard)) {
--              /* If sysctl was unsuccessful, use the "terminator canary". */
--              ((unsigned char *)__guard)[0] = 0;
--              ((unsigned char *)__guard)[1] = 0;
--              ((unsigned char *)__guard)[2] = '\n';
--              ((unsigned char *)__guard)[3] = 255;
-+      fd = open ("/dev/urandom", 0);
-+      if (fd != -1) {
-+              len = read (fd, (char*)&__stack_chk_guard, sizeof(__stack_chk_guard));
-+              close(fd);
-+              if (len == sizeof(__stack_chk_guard) && 
-+                    *__stack_chk_guard != 0)
-+                      return;
-       }
-+
-+      /* If If a random generator can't be used, the protector switches the guard
-+           to the "terminator canary" */
-+      ((unsigned char *)__stack_chk_guard)[0] = 0;
-+      ((unsigned char *)__stack_chk_guard)[1] = 0;
-+      ((unsigned char *)__stack_chk_guard)[2] = '\n';
-+      ((unsigned char *)__stack_chk_guard)[3] = 255;
- }
--/*ARGSUSED*/
-+#define STACKOVERFLOW "] stack overflow"
-+
- void
--__stack_smash_handler(char func[], int damaged)
-+__stack_chk_fail()
- {
--      struct syslog_data sdata = SYSLOG_DATA_INIT;
--      const char message[] = "stack overflow in function %s";
--      struct sigaction sa;
--      sigset_t mask;
--
--      /* Immediately block all signal handlers from running code */
--      sigfillset(&mask);
--      sigdelset(&mask, SIGABRT);
--      sigprocmask(SIG_BLOCK, &mask, NULL);
--
-+      char n[16]; // bigger than will hold the digits in a pid_t
-+      char *np;
-+      int pid = getpid();
-+      char message[sizeof(n) + sizeof(STACKOVERFLOW)] = "[";
-+      char prog[2*MAXCOMLEN+1] = {0};
-+
-+      proc_name(pid, prog, 2*MAXCOMLEN);
-+      prog[2*MAXCOMLEN] = 0;
-+      np = n + sizeof(n);
-+      *--np = 0;
-+      while(pid > 0) {
-+          *--np = (pid % 10) + '0';
-+          pid /= 10;
-+      }
-+      strlcat(message, np, sizeof(message));
-+      strlcat(message, STACKOVERFLOW, sizeof(message));
-       /* This may fail on a chroot jail... */
--      syslog_r(LOG_CRIT, &sdata, message, func);
--
--      bzero(&sa, sizeof(struct sigaction));
--      sigemptyset(&sa.sa_mask);
--      sa.sa_flags = 0;
--      sa.sa_handler = SIG_DFL;
--      sigaction(SIGABRT, &sa, NULL);
--
--      kill(getpid(), SIGABRT);
-+      _simple_asl_log_prog(ASL_LEVEL_CRIT, "user", message, prog);
--      _exit(127);
-+      CRSetCrashLogMessage(message);
-+      __abort();
- }
index 963fe1e14216b6e4f7db0c43f7fad9da61f0f445..72f0718712f16020e2902fb1cc1e7d5b66a49fe9 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdint.h>
 #include <pthread.h>
 #include <pthread_machdep.h>
+#include <machine/cpu_capabilities.h>
 
 struct ProgramVars; /* forward reference */
 
@@ -35,10 +36,13 @@ extern void _libc_fork_init(void (*prepare)(void), void (*parent)(void), void (*
 extern void _init_clock_port();
 extern pthread_lock_t _malloc_lock;
 extern void __xlocale_init(void);
+extern void __pthread_pfz_setup(const char *apple[]);
 extern void __guard_setup(const char *apple[]);
 extern void __malloc_entropy_setup(const char *apple[]);
 extern int usenew_impl;
 
+__private_extern__ uintptr_t commpage_pfz_base;
+
 #ifdef PR_5243343
 /* 5243343 - temporary hack to detect if we are running the conformance test */
 #include <stdlib.h>
@@ -47,6 +51,7 @@ __private_extern__ int PR_5243343_flag = 0;
 __private_extern__ int __pthread_lock_debug = 0;
 __private_extern__ int __pthread_lock_old = 0;
 
+
 void
 __libc_init(const struct ProgramVars *vars, void (*atfork_prepare)(void), void (*atfork_parent)(void), void (*atfork_child)(void), const char *apple[])
 {
@@ -56,6 +61,7 @@ __libc_init(const struct ProgramVars *vars, void (*atfork_prepare)(void), void (
        _init_clock_port();
        __xlocale_init();
        __guard_setup(apple);
+       __pthread_pfz_setup(apple);
        __malloc_entropy_setup(apple);
 
 
index 0e77798bf6be3e32c594bb4e512457ee35fac51b..fd801a886ca4c57e9803fe7ef7189c9f9a03568c 100644 (file)
@@ -64,6 +64,10 @@ occurs within a small time window (usually a fraction of a second) of another
 NORMAL I/O request, the thread that issues the THROTTLE I/O is forced to sleep
 for a certain interval. This slows down the thread that issues the THROTTLE I/O
 so that NORMAL I/Os can utilize most of the disk I/O bandwidth.
+Furthermore, a NORMAL I/O request may bypass a previously issued THROTTLE I/O
+request in kernel or driver queues and be sent to the device first.
+In some circumstances, very large THROTTLE I/O requests will be broken
+into smaller requests which are then issued serially.
 .It IOPOL_PASSIVE
 The PASSIVE I/Os are a special type of NORMAL I/O that are processed the same as
 NORMAL I/Os but are ignored by the THROTTLE I/Os so that the threads issuing
@@ -130,10 +134,51 @@ will fail if:
 .It Bq Er EINVAL
 Policy is not one of the values defined in this manual.
 .El
+.Sh NOTES
+The thread or process with THROTTLE I/O policy enabled will be generally
+prevented from having an adverse effect on the throughput or latency of
+the normal I/Os of other processes.
+However, there are a few considerations that users of the THROTTLE I/O policy should keep in mind:
+.Pp
+Consider using the
+.Dv F_NOCACHE
+.Xr fcntl 2
+command to prevent caching when using the THROTTLE I/O policy.
+This will reduce contention for available caches with NORMAL I/O.
+.Pp
+Large read requests will automatically be broken up into smaller requests
+to avoid stalling NORMAL I/O requests.
+However, due to the consistency guarantees provided to contiguous writes,
+this can not be done automatically for large writes.
+If a thread or process with THROTTLE I/O policy enabled will be issuing
+large writes, consider the use of the
+.Dv F_SINGLE_WRITER
+.Xr fcntl 2
+command.
+This will indicate to the system that there is only one thread writing to
+the file and allow automatic division of large writes.
+.Pp
+Write-heavy THROTTLE I/O workloads may fill a drive’s track (write) cache.
+Subsequent NORMAL I/O writes must then wait for enough of the track cache
+to be flushed before they can continue.
+If the writes issued as THROTTLE I/O are small and not contiguous, many
+seeks may be incurred before space is available for a subsequent NORMAL
+I/O write.
+Issuers of THROTTLE I/O should attempt to issue their writes sequentially
+or to locations in a single small area of the drive (i.e. different
+positions in the same file) to ensure good spacial locality.
+.Pp
+The
+.Dv F_FULLFSYNC
+.Xr fcntl 2
+command can cause very long system-wide IO stalls.
+Users of THROTTLE I/O should issue this command only if absolutely necessary.
 .Sh SEE ALSO
 .Xr nice 3 ,
 .Xr getpriority 2 ,
 .Xr setpriority 2 ,
+.Xr fcntl 2 ,
+.Xr open 2 ,
 .Xr renice 8
 .Sh HISTORY
 The
index 8475a6ea97eca7c4ea2da3620f83610ad9210545..146fdac6d93d21cb1559cce0eefacb171add4286 100644 (file)
@@ -56,38 +56,12 @@ getiopolicy_np(int iotype, int scope)
 int
 setiopolicy_np(int iotype, int scope, int policy)
 {
-       int error;
+       /* kernel validates the indiv values, no need to repeat it */
        struct _iopol_param_t iop_param;
        
-       if (iotype != IOPOL_TYPE_DISK ||
-               (scope != IOPOL_SCOPE_PROCESS && scope != IOPOL_SCOPE_THREAD)) {
-               errno = EINVAL;
-               error = -1;
-               goto exit;
-       }
-
-       switch (policy) {
-       case IOPOL_DEFAULT:
-       case IOPOL_NORMAL:
-       case IOPOL_THROTTLE:
-       case IOPOL_PASSIVE:
-               break;
-       default:
-               errno = EINVAL;
-               error = -1;
-               goto exit;
-       }
-
        iop_param.iop_scope = scope;
        iop_param.iop_iotype = iotype;
        iop_param.iop_policy = policy;
-       error = __iopolicysys(IOPOL_CMD_SET, &iop_param);
-       if (error != 0) {
-               errno = error;
-               error = -1;
-               goto exit;
-       }
 
-  exit:
-       return error;
+       return( __iopolicysys(IOPOL_CMD_SET, &iop_param));
 }
index d92ac840beef4720d300e15302b389a3d74c2497..ef1bfa94fd4678cbb85c6a7c8f8b681c6b6720ab 100644 (file)
@@ -39,6 +39,9 @@
 #include <mach/port.h>
 #include <mach/exception_types.h>
 
+#if TARGET_OS_EMBEDDED
+#include <sys/kern_memorystatus.h>
+#endif
 
 /*
  * posix_spawnattr_init
@@ -105,6 +108,23 @@ posix_spawnattr_init(posix_spawnattr_t *attr)
                 * process control on resource starvation
                 */
                (*psattrp)->psa_pcontrol = 0;
+
+               /*
+                * The default value of this attribute shall be an no
+                * process control on resource starvation
+                */
+               (*psattrp)->psa_apptype = 0;
+
+#if TARGET_OS_EMBEDDED
+               /* Jetsam related */
+               (*psattrp)->psa_jetsam_flags = 0;
+               (*psattrp)->psa_priority = DEFAULT_JETSAM_PRIORITY;
+               (*psattrp)->psa_high_water_mark = -1;
+#endif
+
+               /* Default is no CPU usage monitor active. */
+               (*psattrp)->psa_cpumonitor_percent = 0;
+               (*psattrp)->psa_cpumonitor_interval = 0;
        }
 
        return (err);
@@ -403,6 +423,41 @@ posix_spawnattr_getpcontrol_np(const posix_spawnattr_t * __restrict attr,
        return (0);
 }
 
+/*
+ * posix_spawnattr_getapptype_np
+ *
+ * Description:        Retrieve the  process specific behaviors and app launch typea
+ *             spawn attribute value referenced by 'attr' and place the
+ *             result into the memory containing the control  referenced by
+ *             'apptype'
+ *
+ * Parameters: attr                    The spawn attributes object whose
+ *                                     signal set for default signals is to
+ *                                     be retrieved
+ *             apptype                 A pointer to an int  to receive
+ *                                     the process control info
+ *
+ * Returns:    0                       Success
+ *
+ * Implicit Returns:
+ *             *pcontrol (modified)    The signal set of signals to default
+ *                                     from the spawn attributes object
+ */
+int
+posix_spawnattr_getapptype_np(const posix_spawnattr_t * __restrict attr,
+               int * __restrict apptype)
+{
+       _posix_spawnattr_t psattr;
+
+       if (attr == NULL || *attr == NULL)
+               return EINVAL;
+
+       psattr = *(_posix_spawnattr_t *)attr;
+       *apptype = psattr->psa_apptype;
+
+       return (0);
+}
+
 /*
  * posix_spawnattr_setsigdefault
  *
@@ -564,6 +619,37 @@ posix_spawnattr_setpcontrol_np(posix_spawnattr_t * __restrict attr,
 
        return (0);
 }
+
+
+/*
+ * posix_spawnattr_setapptype_np
+ *
+ * Description:        Set the process specific behaviors and app launch type
+ *             attribute value referenced by 'attr' from the memory
+ *             containing the int value 'apptype'
+ *
+ * Parameters: attr                    The spawn attributes object whose
+ *                                     signal set for default signals is to
+ *                                     be set
+ *             apptype                 An int value of the apptype info
+ *
+ * Returns:    0                       Success
+ */
+int
+posix_spawnattr_setapptype_np(posix_spawnattr_t * __restrict attr,
+               const int apptype)
+{
+       _posix_spawnattr_t psattr;
+
+       if (attr == NULL || *attr == NULL)
+               return EINVAL;
+
+       psattr = *(_posix_spawnattr_t *)attr;
+       psattr->psa_apptype = apptype;
+
+       return (0);
+}
+
 /*
  * posix_spawn_createportactions_np
  * Description: create a new posix_spawn_port_actions struct and link
@@ -1170,6 +1256,73 @@ posix_spawn_file_actions_addinherit_np(posix_spawn_file_actions_t *file_actions,
        return (0);
 }
 
+int
+posix_spawnattr_setcpumonitor(posix_spawnattr_t * __restrict attr,
+               uint64_t percent, uint64_t interval)
+{
+       _posix_spawnattr_t psattr;
+
+       if (attr == NULL || *attr == NULL || percent == 0 || percent > 100)
+               return (EINVAL);
+
+       psattr = *(_posix_spawnattr_t *)attr;
+
+       psattr->psa_cpumonitor_percent = percent;
+       psattr->psa_cpumonitor_interval = interval;
+
+       return (0);                     
+}
+
+int
+posix_spawnattr_getcpumonitor(posix_spawnattr_t * __restrict attr,
+               uint64_t *percent, uint64_t *interval)
+{
+       _posix_spawnattr_t psattr;
+
+       if (attr == NULL || *attr == NULL)
+               return (EINVAL);
+
+       psattr = *(_posix_spawnattr_t *)attr;
+
+       *percent = psattr->psa_cpumonitor_percent;
+       *interval = psattr->psa_cpumonitor_interval;
+
+       return (0);
+}
+
+#if TARGET_OS_EMBEDDED
+/*
+ * posix_spawnattr_setjetsam
+ *
+ * Description:        Set jetsam attributes for the spawn attribute object
+ *             referred to by 'attr'.
+ *
+ * Parameters: flags                   The flags value to set
+ *             priority                Relative jetsam priority
+ *             high_water_mark         Value in pages; resident page
+ *                                     counts above this level can
+ *                                     result in termination
+ *
+ * Returns:    0                       Success
+ */
+int
+posix_spawnattr_setjetsam(posix_spawnattr_t * __restrict attr,
+               short flags, int priority, int high_water_mark)
+{
+       _posix_spawnattr_t psattr;
+
+       if (attr == NULL || *attr == NULL)
+               return EINVAL;
+
+       psattr = *(_posix_spawnattr_t *)attr;
+       
+       psattr->psa_jetsam_flags = flags;
+       psattr->psa_priority = priority;
+       psattr->psa_high_water_mark = high_water_mark;
+
+       return (0);
+}
+#endif
 
 /*
  * posix_spawnp
diff --git a/sys/stack_protector-obsd.c b/sys/stack_protector-obsd.c
deleted file mode 100644 (file)
index 74976f6..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*     $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $    */
-
-/*
- * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <signal.h>
-#include <string.h>
-#include <stdlib.h>
-#include <asl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include "CrashReporterClient.h"
-#include "libproc.h"
-#include "_simple.h"
-
-#define        GUARD_MAX 8
-long __stack_chk_guard[GUARD_MAX] = {0, 0, 0, 0, 0, 0, 0, 0};
-void __abort(void) __dead2;
-void __guard_setup(const char *apple[]) __attribute__ ((visibility ("hidden")));
-void __stack_chk_fail(void);
-
-static void
-__guard_from_kernel(const char *str)
-{
-       unsigned long long val;
-       char tmp[20], *p;
-       int idx = 0;
-
-       /* Skip over the 'stack_guard=' key to the list of values */
-       str = strchr(str, '=');
-       if (str == NULL)
-               return;
-       str++;
-
-       while (str && idx < GUARD_MAX) {
-               /*
-                * Pull the next numeric string out of the list and convert it to
-                * a real number.
-                */
-               strlcpy(tmp, str, 20);
-               p = strchr(tmp, ',');
-               if (p)
-                       *p = '\0';
-               val = strtoull(tmp, NULL, 0);
-               __stack_chk_guard[idx] = (long)(val & ((unsigned long) -1));
-               idx++;
-               if ((str = strchr(str, ',')) != NULL)
-                       str++;
-       }
-}
-
-void
-__guard_setup(const char *apple[])
-{
-       int fd;
-       size_t len;
-       const char **p;
-
-       if (__stack_chk_guard[0] != 0)
-               return;
-
-       for (p = apple; p && *p; p++) {
-               if (strstr(*p, "stack_guard") == *p) {
-                       __guard_from_kernel(*p);
-                       if (__stack_chk_guard[0] != 0)
-                               return;
-               }
-       }
-
-       fd = open ("/dev/urandom", 0);
-       if (fd != -1) {
-               len = read (fd, (char*)&__stack_chk_guard, sizeof(__stack_chk_guard));
-               close(fd);
-               if (len == sizeof(__stack_chk_guard) && 
-                    *__stack_chk_guard != 0)
-                       return;
-       }
-
-       /* If If a random generator can't be used, the protector switches the guard
-           to the "terminator canary" */
-       ((unsigned char *)__stack_chk_guard)[0] = 0;
-       ((unsigned char *)__stack_chk_guard)[1] = 0;
-       ((unsigned char *)__stack_chk_guard)[2] = '\n';
-       ((unsigned char *)__stack_chk_guard)[3] = 255;
-}
-
-#define STACKOVERFLOW  "] stack overflow"
-
-void
-__stack_chk_fail()
-{
-       char n[16]; // bigger than will hold the digits in a pid_t
-       char *np;
-       int pid = getpid();
-       char message[sizeof(n) + sizeof(STACKOVERFLOW)] = "[";
-       char prog[2*MAXCOMLEN+1] = {0};
-
-       proc_name(pid, prog, 2*MAXCOMLEN);
-       prog[2*MAXCOMLEN] = 0;
-       np = n + sizeof(n);
-       *--np = 0;
-       while(pid > 0) {
-           *--np = (pid % 10) + '0';
-           pid /= 10;
-       }
-       strlcat(message, np, sizeof(message));
-       strlcat(message, STACKOVERFLOW, sizeof(message));
-       /* This may fail on a chroot jail... */
-       _simple_asl_log_prog(ASL_LEVEL_CRIT, "user", message, prog);
-
-       CRSetCrashLogMessage(message);
-       __abort();
-}
diff --git a/threads/Makefile.inc b/threads/Makefile.inc
deleted file mode 100644 (file)
index ad93bed..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.PATH: ${.CURDIR}/${MACHINE_ARCH}/threads ${.CURDIR}/threads
-
-.sinclude "${.CURDIR}/${MACHINE_ARCH}/threads/Makefile.inc"
-
-MISRCS += cprocs.c       cthreads.c     mig_support.c
-
-DYLDSRCS += mig_support.c
index 71be8b97850176b990537bfad7f91744fb45c3e5..ffcad5873a816fac316761e04dc492449f06bd15 100644 (file)
@@ -140,23 +140,24 @@ extern int *__error(void);
 extern int __pthread_canceled(int);
 
 void
-cthread_set_errno_self(error)
-       int     error;
+cthread_set_errno_self(int error, int nocancel)
 {
        int *ep = __error();
        extern int __unix_conforming;
        pthread_t self = NULL;
+       int check_cancel = __unix_conforming && !nocancel;
 
-       if ((__unix_conforming) && ((error & 0xff) == EINTR) && (__pthread_canceled(0) == 0)) {
+       if (check_cancel && ((error & 0xff) == EINTR) && (__pthread_canceled(0) == 0)) {
                self = pthread_self();
                if (self != NULL)
                        self->cancel_error = error;
                pthread_exit(PTHREAD_CANCELED);
        }
 
-        if (ep != &errno)
-            *ep = error;
+       if (ep != &errno) {
+               *ep = error;
+       }
 
-        errno = error;
+       errno = error;
 }
 
index e5207b80d5600c36ff2c4392747499cbb92cd086..c4fa284da01e7d930d752d67777792c03d26bc8a 100644 (file)
@@ -245,7 +245,7 @@ extern int cthread_stack_mask;
 
 extern ur_cthread_t ur_cthread_self(void);
 #define cthread_thread(c)      (c->real_thread)
-extern void cthread_set_errno_self(int e);
+extern void cthread_set_errno_self(int e, int nocancel);
 extern int cthread_errno(void);
 #define        cthread_assoc(id, t)    (((ur_cthread_t) (id))->incarnation = (t))
 #define        cthread_self()          (ur_cthread_self()->incarnation)
diff --git a/util/Makefile.inc b/util/Makefile.inc
deleted file mode 100644 (file)
index 69f132e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-.PATH: ${.CURDIR}/${MACHINE_ARCH}/util ${.CURDIR}/util
-
-MISRCS += login_tty.c logwtmp.c pty.c fparseln.c opendev.c
-
-.ifdef FEATURE_LEGACY_UTMP_APIS
-MISRCS += login.c logout.c
-.endif
-
-.for _src in fparseln.c
-CFLAGS-${_src} += -D__FBSDID=__RCSID
-.endfor
-
-.if ${LIB} == "c"
-MAN3 += fparseln.3 opendev.3 openpty.3
-
-.ifdef FEATURE_LEGACY_UTMP_APIS
-MAN3 += login.3
-.endif
-
-MLINKS += openpty.3 forkpty.3
-MLINKS += openpty.3 login_tty.3
-.ifdef FEATURE_LEGACY_UTMP_APIS
-MLINKS += login.3 logwtmp.3
-MLINKS += login.3 logout.3
-.endif
-.endif
diff --git a/util/mkpath_np.3 b/util/mkpath_np.3
new file mode 100644 (file)
index 0000000..b5be64b
--- /dev/null
@@ -0,0 +1,80 @@
+.\" Copyright (c) 2011 Apple Inc. All rights reserved.
+.\" 
+.\" @APPLE_LICENSE_HEADER_START@
+.\" 
+.\" This file contains Original Code and/or Modifications of Original Code
+.\" as defined in and that are subject to the Apple Public Source License
+.\" Version 2.0 (the 'License'). You may not use this file except in
+.\" compliance with the License. Please obtain a copy of the License at
+.\" http://www.opensource.apple.com/apsl/ and read it before using this
+.\" file.
+.\" 
+.\" The Original Code and all software distributed under the License are
+.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+.\" Please see the License for the specific language governing rights and
+.\" limitations under the License.
+.\" 
+.\" @APPLE_LICENSE_HEADER_END@
+.\"
+.Dd July 13, 2011
+.Dt mkpath_np 3
+.Os "Mac OS X"
+.Sh NAME
+.Nm mkpath_np
+.Nd Auxiliary routine for efficiently creating paths
+.Sh SYNOPSIS
+.Fd #include <unistd.h>
+.\"
+.Ft int
+.Fo mkpath_np
+.Fa "const char * path"
+.Fa "mode_t omode"
+.Fc
+.Sh DESCRIPTION
+This routine allows the caller to create a path, including intermediate
+directories.  It is equivalent to calling
+.Xr mkdir 1
+with the -p command line argument.
+.Pp
+Intermediate directories are created with permission bits of rwxrwxrwx (0777)
+as modified by the current umask, plus write and search permission for the
+owner.
+.Pp
+The leaf directory is created with permission bits of
+.Fa omode
+as modified by the current umask.
+.Sh RETURN VALUES
+A 0 return value indicates success.  If an error occurs, the return value is a
+non-zero error code.  Note that EEXIST is returned iff the leaf directory
+already exists and is a directory, so under certain circumstances, this error
+value may not indicate a failure state.
+.Pp
+This routine does NOT modify errno.
+.Sh ERRORS
+Any error code that can be returned by
+.Xr mkdir 2
+can be returned by
+.Fn mkpath_np ,
+but
+.Fn mkpath_np
+will return the error code rather than setting errno.
+.Bl -tag -width Er
+.\" ==========
+.It Bq Er ENOTDIR
+A component of the path is not a directory (in contrast to
+.Xr mkdir 2
+which returns this based on the path prefix rather than the path).
+.\" ==========
+.It Bq Er EEXIST
+The path already exists and is a directory.
+.El
+.Sh HISTORY
+This function first appeared in
+iOS 5.0.
+.Sh SEE ALSO
+.Xr mkdir 1 ,
+.Xr chmod 2 ,
+.Xr mkdir 2
diff --git a/util/mkpath_np.c b/util/mkpath_np.c
new file mode 100644 (file)
index 0000000..453219a
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2011 Apple Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+/* This extended version of mkpath_np is provided to help NSFileManager
+ * maintain  binary compatibility.  If firstdir is not NULL, *firstdir will be
+ * set to the path of the first created directory, and it is the caller's
+ * responsibility to free the returned string.  This SPI is subject to removal
+ * once NSFileManager no longer has a need for it, and use in new code is
+ * highly discouraged.
+ *
+ * See: <rdar://problem/9888987>
+ */
+
+int
+_mkpath_np(const char *path, mode_t omode, const char ** firstdir)
+{
+       char *apath = NULL;
+       unsigned int depth = 0;
+       mode_t chmod_mode = 0;
+       int retval = 0;
+       int old_errno = errno;
+       struct stat sbuf;
+
+       /* Try the trivial case first. */
+       if (0 == mkdir(path, omode)) {
+               if (firstdir) {
+                       *firstdir = strdup(path);
+               }
+               goto mkpath_exit;
+       }
+
+       /* Anything other than an ENOENT, EEXIST, or EISDIR indicates an
+        * error that we need to send back to the caller.  ENOENT indicates
+        * that we need to try a lower level.
+        */
+       switch (errno) {
+               case ENOENT:
+                       break;
+               case EEXIST:
+                       if (stat(path, &sbuf) == 0 &&
+                           !S_ISDIR(sbuf.st_mode)) {
+                               retval = ENOTDIR;
+                       }
+                       goto mkpath_exit;
+               case EISDIR: /* <rdar://problem/10288022> */
+                       retval = EEXIST;
+                       goto mkpath_exit;
+               default:
+                       retval = errno;
+                       goto mkpath_exit;
+       }
+
+       apath = strdup(path);
+       if (apath == NULL) {
+               retval = ENOMEM;
+               goto mkpath_exit;
+       }
+
+       while (1) {
+               /* Increase our depth and try making that directory */
+               char *s = strrchr(apath, '/');
+               if (!s) {
+                       /* We should never hit this under normal circumstances,
+                        * but it can occur due to really unfortunate timing
+                        */
+                       retval = ENOENT;
+                       goto mkpath_exit;
+               }
+               *s = '\0';
+               depth++;
+
+               if (0 == mkdir(apath, S_IRWXU | S_IRWXG | S_IRWXO)) {
+                       /* Found our starting point */
+
+                       /* POSIX 1003.2:
+                        * For each dir operand that does not name an existing
+                        * directory, effects equivalent to those cased by the
+                        * following command shall occcur:
+                        *
+                        * mkdir -p -m $(umask -S),u+wx $(dirname dir) &&
+                        *    mkdir [-m mode] dir
+                        */
+
+                       struct stat dirstat;
+                       if (-1 == stat(apath, &dirstat)) {
+                               /* Really unfortunate timing ... */
+                               retval = ENOENT;
+                               goto mkpath_exit;
+                       }
+
+                       if ((dirstat.st_mode & (S_IWUSR | S_IXUSR)) != (S_IWUSR | S_IXUSR)) {
+                               chmod_mode = dirstat.st_mode | S_IWUSR | S_IXUSR;
+                               if (-1 == chmod(apath, chmod_mode)) {
+                                       /* Really unfortunate timing ... */
+                                       retval = ENOENT;
+                                       goto mkpath_exit;
+                               }
+                       }
+
+                       if (firstdir) {
+                               *firstdir = strdup(apath);
+                       }
+                       break;
+               } else if (errno == EEXIST) {
+                       /* Some other process won the race in creating this directory
+                        * before we did.  We will use this as our starting point.
+                        * See: <rdar://problem/10279893>
+                        */
+                       if (stat(apath, &sbuf) == 0 &&
+                           S_ISDIR(sbuf.st_mode)) {
+
+                               if (firstdir) {
+                                       *firstdir = strdup(apath);
+                               }
+                               break;
+                       }
+
+                       retval = ENOTDIR;
+                       goto mkpath_exit;
+               } else if (errno != ENOENT) {
+                       retval = errno;
+                       goto mkpath_exit;
+               }
+       }
+
+       while (depth > 1) {
+               /* Decrease our depth and make that directory */
+               char *s = strrchr(apath, '\0');
+               *s = '/';
+               depth--;
+
+               if (-1 == mkdir(apath, S_IRWXU | S_IRWXG | S_IRWXO)) {
+                       /* This handles "." and ".." added to the new section of path */
+                       if (errno == EEXIST)
+                               continue;
+                       retval = errno;
+                       goto mkpath_exit;
+               }
+
+               if (chmod_mode) {
+                       if (-1 == chmod(apath, chmod_mode)) {
+                               /* Really unfortunate timing ... */
+                               retval = ENOENT;
+                               goto mkpath_exit;
+                       }
+               }
+       }
+
+       if (-1 == mkdir(path, omode)) {
+               retval = errno;
+               if (errno == EEXIST &&
+                   stat(path, &sbuf) == 0 &&
+                   !S_ISDIR(sbuf.st_mode)) {
+                       retval = ENOTDIR;
+               }
+       }
+
+mkpath_exit:
+       free(apath);
+
+       errno = old_errno;
+       return retval;
+}
+
+int mkpath_np(const char *path, mode_t omode) {
+       return _mkpath_np(path, omode, NULL);
+}
diff --git a/uuid/Makefile.inc b/uuid/Makefile.inc
deleted file mode 100644 (file)
index ede65ae..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# uuid sources
-.PATH: ${.CURDIR}/uuid
-CWD := ${.CURDIR}/uuid
-
-# uuid/uuid.h is now installed by xnu
-
-UUIDSRCS = clear.c compare.c copy.c gen_uuid.c isnull.c pack.c parse.c \
-       unpack.c unparse.c
-UUIDHDRS = uuidP.h
-UUIDFROMMAN = libuuid.3.in
-UUIDTOMAN = uuid.3.in
-UUIDMAN3 = uuid_clear.3.in uuid_compare.3.in uuid_copy.3.in \
-           uuid_generate.3.in  uuid_is_null.3.in uuid_parse.3.in \
-           uuid_unparse.3.in
-PRIVUUID_INSTHDRS += ${.CURDIR}/uuid/namespace.h
-
-# This .for statement forces evaluation of ${CWD}
-.for _cwd in ${CWD}
-
-.for _src in ${UUIDSRCS}
-.ifmake autopatch
-${_cwd}/${_src:R}-uuid.${_src:E}: ${_cwd}/uuidsrc/${_src} _AUTOPATCH
-AUTOPATCHSRCS+= ${_cwd}/${_src:R}-uuid.${_src:E}
-.else # !autopatch
-MISRCS+= ${_src}
-.endif # autopatch
-.endfor
-
-.ifmake autopatch
-.for _src in ${UUIDHDRS}
-${_cwd}/${_src}: ${_cwd}/uuidsrc/${_src} _AUTOPATCH
-AUTOPATCHHDRS+= ${_cwd}/${_src}
-.endfor
-.endif # autopatch
-
-.for _src in ${UUIDMAN3}
-.ifmake autopatch
-${_cwd}/${_src:R}-uuid.${_src:E}: ${_cwd}/uuidsrc/${_src} _AUTOPATCH
-AUTOPATCHMAN+= ${_cwd}/${_src:R}
-.else # !autopatch
-MAN3+= ${_src:R}
-.endif # autopatch
-.endfor
-
-MLINKS+= uuid_generate.3 uuid_generate_random.3                \
-         uuid_generate.3 uuid_generate_time.3
-
-MLINKS+= uuid_unparse.3 uuid_unparse_lower.3           \
-         uuid_unparse.3 uuid_unparse_upper.3
-
-.ifmake autopatch
-${_cwd}/${UUIDTOMAN:R}-uuid.${UUIDTOMAN:E}: ${_cwd}/uuidsrc/${UUIDFROMMAN} _AUTOPATCH
-AUTOPATCHMAN+= ${_cwd}/${UUIDTOMAN:R}
-.else # !autopatch
-MAN3+= ${UUIDTOMAN:R}
-.endif # autopatch
-
-.endfor # _cwd
diff --git a/uuid/clear-uuid.c b/uuid/clear-uuid.c
deleted file mode 120000 (symlink)
index 77ad4f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./clear.c
\ No newline at end of file
diff --git a/uuid/compare-uuid.c b/uuid/compare-uuid.c
deleted file mode 120000 (symlink)
index 51b9486..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./compare.c
\ No newline at end of file
diff --git a/uuid/copy-uuid.c b/uuid/copy-uuid.c
deleted file mode 120000 (symlink)
index 4372f3f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./copy.c
\ No newline at end of file
diff --git a/uuid/gen_uuid-uuid.c b/uuid/gen_uuid-uuid.c
deleted file mode 100644 (file)
index 651ce93..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * gen_uuid.c --- generate a DCE-compatible uuid
- *
- * Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o.
- *
- * %Begin-Header%
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- * %End-Header%
- */
-
-/*
- * Force inclusion of SVID stuff since we need it if we're compiling in
- * gcc-wall wall mode
- */
-#define _SVID_SOURCE
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
-#endif
-#ifdef HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_NET_IF_DL_H
-#include <net/if_dl.h>
-#endif
-
-#include "uuidP.h"
-
-/*
- * Generate a series of random bytes, using arc4random
- */
-static void get_random_bytes(void *buf, int nbytes)
-{
-       unsigned char *cp = (unsigned char *) buf;
-       u_int32_t u;
-       int n = nbytes / sizeof(u);
-
-       while (n-- > 0) {
-               u = arc4random();
-               memcpy(cp, &u, sizeof(u));
-               cp += sizeof(u);
-       }
-       if ((n = nbytes % sizeof(u)) > 0) {
-               u = arc4random();
-               memcpy(cp, &u, n);
-       }
-       return;
-}
-
-/*
- * Get the ethernet hardware address, if we can find it...
- */
-static int get_node_id(unsigned char *node_id)
-{
-#ifdef HAVE_NET_IF_H
-       int             sd;
-       struct ifreq    ifr, *ifrp;
-       struct ifconf   ifc;
-       char buf[1024];
-       int             n, i;
-       unsigned char   *a;
-#ifdef AF_LINK
-       struct sockaddr_dl *sdlp;
-#endif
-
-/*
- * BSD 4.4 defines the size of an ifreq to be
- * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
- * However, under earlier systems, sa_len isn't present, so the size is 
- * just sizeof(struct ifreq)
- */
-#ifdef HAVE_SA_LEN
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#define ifreq_size(i) max(sizeof(struct ifreq),\
-     sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
-#else
-#define ifreq_size(i) sizeof(struct ifreq)
-#endif /* HAVE_SA_LEN*/
-
-       sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
-       if (sd < 0) {
-               return -1;
-       }
-       memset(buf, 0, sizeof(buf));
-       ifc.ifc_len = sizeof(buf);
-       ifc.ifc_buf = buf;
-       if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
-               close(sd);
-               return -1;
-       }
-       n = ifc.ifc_len;
-       for (i = 0; i < n; i+= ifreq_size(*ifrp) ) {
-               ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
-               strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);
-#ifdef SIOCGIFHWADDR
-               if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
-                       continue;
-               a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
-#else
-#ifdef SIOCGENADDR
-               if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
-                       continue;
-               a = (unsigned char *) ifr.ifr_enaddr;
-#else
-#ifdef AF_LINK
-               sdlp = (struct sockaddr_dl *) &ifrp->ifr_addr;
-               if ((sdlp->sdl_family != AF_LINK) || (sdlp->sdl_alen != 6))
-                       continue;
-               a = (unsigned char *) &sdlp->sdl_data[sdlp->sdl_nlen];
-#else
-               /*
-                * XXX we don't have a way of getting the hardware
-                * address
-                */
-               close(sd);
-               return 0;
-#endif /* AF_LINK */
-#endif /* SIOCGENADDR */
-#endif /* SIOCGIFHWADDR */
-               if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
-                       continue;
-               if (node_id) {
-                       memcpy(node_id, a, 6);
-                       close(sd);
-                       return 1;
-               }
-       }
-       close(sd);
-#endif
-       return 0;
-}
-
-/* Assume that the gettimeofday() has microsecond granularity */
-#define MAX_ADJUSTMENT 10
-
-static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_clock_seq)
-{
-       static int                      adjustment = 0;
-       static struct timeval           last = {0, 0};
-       static uint16_t                 clock_seq;
-       struct timeval                  tv;
-       unsigned long long              clock_reg;
-       
-try_again:
-       gettimeofday(&tv, 0);
-       if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
-               get_random_bytes(&clock_seq, sizeof(clock_seq));
-               clock_seq &= 0x3FFF;
-               last = tv;
-               last.tv_sec--;
-       }
-       if ((tv.tv_sec < last.tv_sec) ||
-           ((tv.tv_sec == last.tv_sec) &&
-            (tv.tv_usec < last.tv_usec))) {
-               clock_seq = (clock_seq+1) & 0x3FFF;
-               adjustment = 0;
-               last = tv;
-       } else if ((tv.tv_sec == last.tv_sec) &&
-           (tv.tv_usec == last.tv_usec)) {
-               if (adjustment >= MAX_ADJUSTMENT)
-                       goto try_again;
-               adjustment++;
-       } else {
-               adjustment = 0;
-               last = tv;
-       }
-               
-       clock_reg = tv.tv_usec*10 + adjustment;
-       clock_reg += ((unsigned long long) tv.tv_sec)*10000000;
-       clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;
-
-       *clock_high = clock_reg >> 32;
-       *clock_low = clock_reg;
-       *ret_clock_seq = clock_seq;
-       return 0;
-}
-
-void uuid_generate_time(uuid_t out)
-{
-       static unsigned char node_id[6];
-       static int has_init = 0;
-       struct uuid uu;
-       uint32_t        clock_mid;
-
-       if (!has_init) {
-               if (get_node_id(node_id) <= 0) {
-                       get_random_bytes(node_id, 6);
-                       /*
-                        * Set multicast bit, to prevent conflicts
-                        * with IEEE 802 addresses obtained from
-                        * network cards
-                        */
-                       node_id[0] |= 0x01;
-               }
-               has_init = 1;
-       }
-       get_clock(&clock_mid, &uu.time_low, &uu.clock_seq);
-       uu.clock_seq |= 0x8000;
-       uu.time_mid = (uint16_t) clock_mid;
-       uu.time_hi_and_version = ((clock_mid >> 16) & 0x0FFF) | 0x1000;
-       memcpy(uu.node, node_id, 6);
-       uuid_pack(&uu, out);
-}
-
-void uuid_generate_random(uuid_t out)
-{
-       uuid_t  buf;
-       struct uuid uu;
-
-       get_random_bytes(buf, sizeof(buf));
-       uuid_unpack(buf, &uu);
-
-       uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000;
-       uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000;
-       uuid_pack(&uu, out);
-}
-
-/*
- * This is the generic front-end
- */
-void uuid_generate(uuid_t out)
-{
-       uuid_generate_random(out);
-}
diff --git a/uuid/isnull-uuid.c b/uuid/isnull-uuid.c
deleted file mode 120000 (symlink)
index ba062b0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./isnull.c
\ No newline at end of file
diff --git a/uuid/pack-uuid.c b/uuid/pack-uuid.c
deleted file mode 120000 (symlink)
index 772b4f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./pack.c
\ No newline at end of file
diff --git a/uuid/parse-uuid.c b/uuid/parse-uuid.c
deleted file mode 120000 (symlink)
index 5f2e8d6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./parse.c
\ No newline at end of file
diff --git a/uuid/unpack-uuid.c b/uuid/unpack-uuid.c
deleted file mode 120000 (symlink)
index dd9411c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./unpack.c
\ No newline at end of file
diff --git a/uuid/unparse-uuid.c b/uuid/unparse-uuid.c
deleted file mode 100644 (file)
index dd7814a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * unparse.c -- convert a UUID to string
- * 
- * Copyright (C) 1996, 1997 Theodore Ts'o.
- *
- * %Begin-Header%
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- * %End-Header%
- */
-
-#include <stdio.h>
-
-#include "uuidP.h"
-
-static const char *fmt_lower = 
-       "0123456789abcdef";
-
-static const char *fmt_upper = 
-       "0123456789ABCDEF";
-
-#ifdef UUID_UNPARSE_DEFAULT_UPPER
-#define FMT_DEFAULT fmt_upper
-#else
-#define FMT_DEFAULT fmt_lower
-#endif
-
-static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt)
-{
-       const uint8_t *uuid_array = (const uint8_t *)uu;
-       int uuid_index;
-       
-       for ( uuid_index = 0; uuid_index < sizeof(uuid_t); ++uuid_index ) {
-               // insert '-' after the 4th, 6th, 8th, and 10th uuid byte
-               switch (uuid_index) {
-               case 4:
-               case 6:
-               case 8:
-               case 10:
-                       *out++ = '-';
-                       break;
-               }
-               // insert uuid byte as two hex characters
-               *out++ = fmt[*uuid_array >> 4];
-               *out++ = fmt[*uuid_array++ & 0xF];
-       }
-       *out = 0;
-}
-
-void uuid_unparse_lower(const uuid_t uu, char *out)
-{
-       uuid_unparse_x(uu, out, fmt_lower);
-}
-
-void uuid_unparse_upper(const uuid_t uu, char *out)
-{
-       uuid_unparse_x(uu, out, fmt_upper);
-}
-
-void uuid_unparse(const uuid_t uu, char *out)
-{
-       uuid_unparse_x(uu, out, FMT_DEFAULT);
-}
diff --git a/uuid/uuid.3 b/uuid/uuid.3
deleted file mode 100644 (file)
index 79e5b28..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID 3 "April 2004" "1.36"
-.SH NAME
-uuid \- DCE compatible Universally Unique Identifier library
-.SH SYNOPSIS
-.B #include <uuid/uuid.h>
-.SH DESCRIPTION
-The
-UUID
-library is used to generate unique identifiers for objects that may be
-accessible beyond the local system.  This library
-generates UUIDs compatible with those created by the Open Software
-Foundation (OSF) Distributed Computing Environment (DCE) utility 
-.BR uuidgen .
-.sp
-The UUIDs generated by this library can be reasonably expected to be
-unique within a system, and unique across all systems.  They could
-be used, for instance, to generate unique HTTP cookies across multiple
-web servers without communication between the servers, and without fear
-of a name clash.
-.SH "CONFORMING TO"
-OSF DCE 1.1
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid.3-uuid.in b/uuid/uuid.3-uuid.in
deleted file mode 120000 (symlink)
index 236dc3a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./libuuid.3.in
\ No newline at end of file
diff --git a/uuid/uuidP.h b/uuid/uuidP.h
deleted file mode 100644 (file)
index a75e45a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * uuid.h -- private header file for uuids
- * 
- * Copyright (C) 1996, 1997 Theodore Ts'o.
- *
- * %Begin-Header%
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- * %End-Header%
- */
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#else
-#include <uuid/uuid_types.h>
-#endif
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-#include <uuid/uuid.h>
-
-/*
- * Offset between 15-Oct-1582 and 1-Jan-70
- */
-#define TIME_OFFSET_HIGH 0x01B21DD2
-#define TIME_OFFSET_LOW  0x13814000
-
-struct uuid {
-       uint32_t        time_low;
-       uint16_t        time_mid;
-       uint16_t        time_hi_and_version;
-       uint16_t        clock_seq;
-       uint8_t node[6];
-};
-
-/* UUID Variant definitions */
-#define UUID_VARIANT_NCS       0
-#define UUID_VARIANT_DCE       1
-#define UUID_VARIANT_MICROSOFT 2
-#define UUID_VARIANT_OTHER     3
-
-/* UUID Type definitions */
-#define UUID_TYPE_DCE_TIME   1
-#define UUID_TYPE_DCE_RANDOM 4
-
-/*
- * prototypes
- */
-void uuid_pack(const struct uuid *uu, uuid_t ptr);
-void uuid_unpack(const uuid_t in, struct uuid *uu);
-
-time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
-int uuid_type(const uuid_t uu);
-int uuid_variant(const uuid_t uu);
diff --git a/uuid/uuid_clear.3 b/uuid/uuid_clear.3
deleted file mode 100644 (file)
index a90694e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_CLEAR 3 "April 2004" "1.36"
-.SH NAME
-uuid_clear \- reset value of UUID variable to the NULL value
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-.BI "void uuid_clear(uuid_t " uu );
-.fi
-.SH DESCRIPTION
-The
-.B uuid_clear
-function sets the value of the supplied uuid variable
-.I uu
-to the NULL value.
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid_clear.3-uuid.in b/uuid/uuid_clear.3-uuid.in
deleted file mode 120000 (symlink)
index 32ce86e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./uuid_clear.3.in
\ No newline at end of file
diff --git a/uuid/uuid_compare.3 b/uuid/uuid_compare.3
deleted file mode 100644 (file)
index 7dac2d1..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_COMPARE 3 "April 2004" "1.36"
-.SH NAME
-uuid_compare \- compare whether two UUIDs are the same
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-.BI "int uuid_compare(uuid_t " uu1 ", uuid_t " uu2)
-.fi
-.SH DESCRIPTION
-The
-.B uuid_compare
-function compares the two supplied uuid variables
-.IR uu1 " and " uu2
-to each other.
-.SH RETURN VALUE
-Returns an integer less than, equal to, or greater than zero if 
-.I uu1
-is found,  respectively, to be lexigraphically less than, equal, or 
-greater than 
-.IR uu2 .
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_clear (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid_compare.3-uuid.in b/uuid/uuid_compare.3-uuid.in
deleted file mode 120000 (symlink)
index cae5088..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./uuid_compare.3.in
\ No newline at end of file
diff --git a/uuid/uuid_copy.3 b/uuid/uuid_copy.3
deleted file mode 100644 (file)
index e0a3fbd..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_COPY 3 "April 2004" "1.36"
-.SH NAME
-uuid_copy \- copy a UUID value
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-.BI "void uuid_copy(uuid_t " dst ", uuid_t " src);
-.fi
-.SH DESCRIPTION
-The
-.B uuid_copy
-function copies the UUID variable
-.IR src " to " dst .
-.SH RETURN VALUE
-The copied UUID is returned in the location pointed to by
-.IR dst .
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid_copy.3-uuid.in b/uuid/uuid_copy.3-uuid.in
deleted file mode 120000 (symlink)
index bf39bbc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./uuid_copy.3.in
\ No newline at end of file
diff --git a/uuid/uuid_generate.3 b/uuid/uuid_generate.3
deleted file mode 100644 (file)
index c33fa5d..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_GENERATE 3 "April 2004" "1.36"
-.SH NAME
-uuid_generate, uuid_generate_random, uuid_generate_time \- create a new unique UUID value
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-.BI "void uuid_generate(uuid_t " out );
-.BI "void uuid_generate_random(uuid_t " out );
-.BI "void uuid_generate_time(uuid_t " out );
-.fi
-.SH DESCRIPTION
-The
-.B uuid_generate
-function creates a new universally unique identifier (UUID).  The uuid will
-be generated based on high-quality randomness from 
-.IR /dev/urandom , 
-if available.  If it is not available, then 
-.B uuid_generate 
-will use an alternative algorithm which uses the current time, the
-local ethernet MAC address (if available), and random data generated
-using a pseudo-random generator.
-.sp
-The 
-.B uuid_generate_random
-function forces the use of the all-random UUID format, even if
-a high-quality random number generator (i.e., 
-.IR /dev/urandom )
-is not available, in which case a pseudo-random
-generator will be subsituted.  Note that the use of a pseudo-random
-generator may compromise the uniqueness of UUID's
-generated in this fashion.
-.sp
-The
-.B uuid_generate_time 
-function forces the use of the alternative algorithm which uses the
-current time and the local ethernet MAC address (if available).
-This algorithm used to be the default one used to generate UUID, but
-because of the use of the ethernet MAC address, it can leak
-information about when and where the UUID was generated.  This can cause
-privacy problems in some applications, so the
-.B uuid_generate
-function only uses this algorithm if a high-quality source of
-randomness is not available.  
-.sp
-The UUID is 16 bytes (128 bits) long, which gives approximately 3.4x10^38
-unique values (there are approximately 10^80 elemntary particles in
-the universe according to Carl Sagan's
-.IR Cosmos ).
-The new UUID can reasonably be considered unique among all UUIDs created
-on the local system, and among UUIDs created on other systems in the past
-and in the future.
-.SH RETURN VALUE
-The newly created UUID is returned in the memory location pointed to by
-.IR out .
-.SH "CONFORMING TO"
-OSF DCE 1.1
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuidgen (1),
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid_generate.3-uuid.in b/uuid/uuid_generate.3-uuid.in
deleted file mode 120000 (symlink)
index 0c031b8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./uuid_generate.3.in
\ No newline at end of file
diff --git a/uuid/uuid_is_null.3 b/uuid/uuid_is_null.3
deleted file mode 100644 (file)
index cfd2169..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_IS_NULL 3 "April 2004" "1.36"
-.SH NAME
-uuid_is_null \- compare the value of the UUID to the NULL value
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-.BI "int uuid_is_null(uuid_t " uu );
-.fi
-.SH DESCRIPTION
-The
-.B uuid_is_null
-function compares the value of the supplied UUID variable
-.I uu
-to the NULL value.  If the value is equal to the NULL UUID, 1 is returned,
-otherwise 0 is returned.
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_parse (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid_is_null.3-uuid.in b/uuid/uuid_is_null.3-uuid.in
deleted file mode 120000 (symlink)
index 2694458..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./uuid_is_null.3.in
\ No newline at end of file
diff --git a/uuid/uuid_parse.3 b/uuid/uuid_parse.3
deleted file mode 100644 (file)
index 253a261..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_PARSE 3 "April 2004" "1.36"
-.SH NAME
-uuid_parse \- convert an input UUID string into binary representation
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-.BI "int uuid_parse( char *" in ", uuid_t " uu );
-.fi
-.SH DESCRIPTION
-The
-.B uuid_parse
-function converts the UUID string given by
-.I in
-into the binary representation.  The input UUID is a string of the form
-1b4e28ba\-2fa1\-11d2\-883f\-b9a761bde3fb (in
-.BR printf (3)
-format "%08x\-%04x\-%04x\-%04x\-%012x", 36 bytes plus the trailing '\\0').
-.SH RETURN VALUE
-Upon successfully parsing the input string, 0 is returned, and the UUID is
-stored in the location pointed to by
-.IR uu ,
-otherwise \-1 is returned.
-.SH "CONFORMING TO"
-OSF DCE 1.1
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_unparse (3)
diff --git a/uuid/uuid_parse.3-uuid.in b/uuid/uuid_parse.3-uuid.in
deleted file mode 120000 (symlink)
index 24e0f63..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./uuid_parse.3.in
\ No newline at end of file
diff --git a/uuid/uuid_unparse.3 b/uuid/uuid_unparse.3
deleted file mode 100644 (file)
index a4964db..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_UNPARSE 3 "April 2004" "1.36"
-.SH NAME
-uuid_unparse \- convert an UUID from binary representation to a string
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-\fIvoid\fP
-.br
-\fBuuid_unparse\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-.sp
-\fIvoid\fP
-.br
-\fBuuid_unparse_lower\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-.sp
-\fIvoid\fP
-.br
-\fBuuid_unparse_upper\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-.sp
-.fi
-.SH DESCRIPTION
-The
-.B uuid_unparse
-function converts the supplied UUID
-.I uu
-from the binary representation into a uuid_string_t (37\-byte string including tailing '\\0')
-of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a761bde3fb and stores this value in the
-character string pointed to by
-.IR out .  
-The case of the hex digits returned by 
-.B uuid_unparse
-may be upper or lower case, and is
-dependent on the system-dependent local default.  
-.PP
-If the case of the
-hex digits is important then the functions
-.B uuid_unparse_upper
-and 
-.B uuid_unparse_lower
-may be used.
-.SH "CONFORMING TO"
-OSF DCE 1.1
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3)
diff --git a/uuid/uuid_unparse.3-uuid.in b/uuid/uuid_unparse.3-uuid.in
deleted file mode 100644 (file)
index 70734fd..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" Copyright 1999 Andreas Dilger (adilger@enel.ucalgary.ca)
-.\"
-.\" %Begin-Header%
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, and the entire permission notice in its entirety,
-.\"    including the disclaimer of warranties.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote
-.\"    products derived from this software without specific prior
-.\"    written permission.
-.\" 
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
-.\" WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
-.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
-.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-.\" USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
-.\" DAMAGE.
-.\" %End-Header%
-.\" 
-.\" Created  Wed Mar 10 17:42:12 1999, Andreas Dilger
-.TH UUID_UNPARSE 3 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "@E2FSPROGS_VERSION@"
-.SH NAME
-uuid_unparse \- convert an UUID from binary representation to a string
-.SH SYNOPSIS
-.nf
-.B #include <uuid/uuid.h>
-.sp
-\fIvoid\fP
-.br
-\fBuuid_unparse\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-.sp
-\fIvoid\fP
-.br
-\fBuuid_unparse_lower\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-.sp
-\fIvoid\fP
-.br
-\fBuuid_unparse_upper\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-.sp
-.fi
-.SH DESCRIPTION
-The
-.B uuid_unparse
-function converts the supplied UUID
-.I uu
-from the binary representation into a uuid_string_t (37\-byte string including tailing '\\0')
-of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a761bde3fb and stores this value in the
-character string pointed to by
-.IR out .  
-The case of the hex digits returned by 
-.B uuid_unparse
-may be upper or lower case, and is
-dependent on the system-dependent local default.  
-.PP
-If the case of the
-hex digits is important then the functions
-.B uuid_unparse_upper
-and 
-.B uuid_unparse_lower
-may be used.
-.SH "CONFORMING TO"
-OSF DCE 1.1
-.SH AUTHOR
-Theodore Y. Ts'o
-.SH AVAILABILITY
-.UR http://e2fsprogs.sourceforge.net/
-http://e2fsprogs.sourceforge.net/
-.UE
-.SH "SEE ALSO"
-.BR uuid (3),
-.BR uuid_clear (3),
-.BR uuid_compare (3),
-.BR uuid_copy (3),
-.BR uuid_generate (3),
-.BR uuid_is_null (3),
-.BR uuid_parse (3)
index 30d6202e3b5712a3e4ae516b09e249e7abc75f08..cad4eb70d7bfbda21130dae072791b9ce63b159b 100644 (file)
 
 #include "uuidP.h"
 
-#ifdef HAVE_SRANDOM
-#define srand(x)       srandom(x)
-#define rand()                 random()
-#endif
-
-static int get_random_fd(void)
-{
-       struct timeval  tv;
-       static int      fd = -2;
-       int             i;
-
-       if (fd == -2) {
-               gettimeofday(&tv, 0);
-               fd = open("/dev/urandom", O_RDONLY);
-               if (fd == -1)
-                       fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
-               srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
-       }
-       /* Crank the random number generator a few times */
-       gettimeofday(&tv, 0);
-       for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--)
-               rand();
-       return fd;
-}
-
-
-/*
- * Generate a series of random bytes.  Use /dev/urandom if possible,
- * and if not, use srandom/random.
- */
-static void get_random_bytes(void *buf, int nbytes)
-{
-       int i, n = nbytes, fd = get_random_fd();
-       int lose_counter = 0;
-       unsigned char *cp = (unsigned char *) buf;
-
-       if (fd >= 0) {
-               while (n > 0) {
-                       i = read(fd, cp, n);
-                       if (i <= 0) {
-                               if (lose_counter++ > 16)
-                                       break;
-                               continue;
-                       }
-                       n -= i;
-                       cp += i;
-                       lose_counter = 0;
-               }
-       }
-       
-       /*
-        * We do this all the time, but this is the only source of
-        * randomness if /dev/random/urandom is out to lunch.
-        */
-       for (cp = buf, i = 0; i < nbytes; i++)
-               *cp++ ^= (rand() >> 7) & 0xFF;
-       return;
-}
+#define        get_random_bytes(a,b)   arc4random_buf((a),(b))
 
 /*
  * Get the ethernet hardware address, if we can find it...
@@ -302,15 +245,9 @@ void uuid_generate_random(uuid_t out)
 }
 
 /*
- * This is the generic front-end to uuid_generate_random and
- * uuid_generate_time.  It uses uuid_generate_random only if
- * /dev/urandom is available, since otherwise we won't have
- * high-quality randomness.
+ * This is the generic front-end
  */
 void uuid_generate(uuid_t out)
 {
-       if (get_random_fd() >= 0)
-               uuid_generate_random(out);
-       else
-               uuid_generate_time(out);
+       uuid_generate_random(out);
 }
diff --git a/uuid/uuidsrc/gen_uuid.c.patch b/uuid/uuidsrc/gen_uuid.c.patch
deleted file mode 100644 (file)
index ee2b833..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
---- gen_uuid.c.orig    2006-02-19 03:05:40.000000000 -0800
-+++ gen_uuid.c 2006-02-20 12:51:07.000000000 -0800
-@@ -72,62 +72,24 @@
- #include "uuidP.h"
--#ifdef HAVE_SRANDOM
--#define srand(x)      srandom(x)
--#define rand()                random()
--#endif
--
--static int get_random_fd(void)
--{
--      struct timeval  tv;
--      static int      fd = -2;
--      int             i;
--
--      if (fd == -2) {
--              gettimeofday(&tv, 0);
--              fd = open("/dev/urandom", O_RDONLY);
--              if (fd == -1)
--                      fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
--              srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
--      }
--      /* Crank the random number generator a few times */
--      gettimeofday(&tv, 0);
--      for (i = (tv.tv_sec ^ tv.tv_usec) & 0x1F; i > 0; i--)
--              rand();
--      return fd;
--}
--
--
- /*
-- * Generate a series of random bytes.  Use /dev/urandom if possible,
-- * and if not, use srandom/random.
-+ * Generate a series of random bytes, using arc4random
-  */
- static void get_random_bytes(void *buf, int nbytes)
- {
--      int i, n = nbytes, fd = get_random_fd();
--      int lose_counter = 0;
-       unsigned char *cp = (unsigned char *) buf;
-+      u_int32_t u;
-+      int n = nbytes / sizeof(u);
--      if (fd >= 0) {
--              while (n > 0) {
--                      i = read(fd, cp, n);
--                      if (i <= 0) {
--                              if (lose_counter++ > 16)
--                                      break;
--                              continue;
--                      }
--                      n -= i;
--                      cp += i;
--                      lose_counter = 0;
--              }
-+      while (n-- > 0) {
-+              u = arc4random();
-+              memcpy(cp, &u, sizeof(u));
-+              cp += sizeof(u);
-+      }
-+      if ((n = nbytes % sizeof(u)) > 0) {
-+              u = arc4random();
-+              memcpy(cp, &u, n);
-       }
--      
--      /*
--       * We do this all the time, but this is the only source of
--       * randomness if /dev/random/urandom is out to lunch.
--       */
--      for (cp = buf, i = 0; i < nbytes; i++)
--              *cp++ ^= (rand() >> 7) & 0xFF;
-       return;
- }
-@@ -302,15 +264,9 @@
- }
- /*
-- * This is the generic front-end to uuid_generate_random and
-- * uuid_generate_time.  It uses uuid_generate_random only if
-- * /dev/urandom is available, since otherwise we won't have
-- * high-quality randomness.
-+ * This is the generic front-end
-  */
- void uuid_generate(uuid_t out)
- {
--      if (get_random_fd() >= 0)
--              uuid_generate_random(out);
--      else
--              uuid_generate_time(out);
-+      uuid_generate_random(out);
- }
index c0e08ef495ac3574ff5b3adfef0842182411f5ae..dd7814a176c555a4c87cdb9fea41d8c64a48402c 100644 (file)
 #include "uuidP.h"
 
 static const char *fmt_lower = 
-       "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
+       "0123456789abcdef";
 
 static const char *fmt_upper = 
-       "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
+       "0123456789ABCDEF";
 
 #ifdef UUID_UNPARSE_DEFAULT_UPPER
 #define FMT_DEFAULT fmt_upper
@@ -50,14 +50,24 @@ static const char *fmt_upper =
 
 static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt)
 {
-       struct uuid uuid;
-
-       uuid_unpack(uu, &uuid);
-       sprintf(out, fmt,
-               uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
-               uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
-               uuid.node[0], uuid.node[1], uuid.node[2],
-               uuid.node[3], uuid.node[4], uuid.node[5]);
+       const uint8_t *uuid_array = (const uint8_t *)uu;
+       int uuid_index;
+       
+       for ( uuid_index = 0; uuid_index < sizeof(uuid_t); ++uuid_index ) {
+               // insert '-' after the 4th, 6th, 8th, and 10th uuid byte
+               switch (uuid_index) {
+               case 4:
+               case 6:
+               case 8:
+               case 10:
+                       *out++ = '-';
+                       break;
+               }
+               // insert uuid byte as two hex characters
+               *out++ = fmt[*uuid_array >> 4];
+               *out++ = fmt[*uuid_array++ & 0xF];
+       }
+       *out = 0;
 }
 
 void uuid_unparse_lower(const uuid_t uu, char *out)
diff --git a/uuid/uuidsrc/unparse.c.patch b/uuid/uuidsrc/unparse.c.patch
deleted file mode 100644 (file)
index 97a71eb..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- unparse.c.orig     2010-06-27 12:49:24.000000000 -0700
-+++ unparse.c  2010-06-27 13:06:53.000000000 -0700
-@@ -37,10 +37,10 @@
- #include "uuidP.h"
- static const char *fmt_lower = 
--      "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
-+      "0123456789abcdef";
- static const char *fmt_upper = 
--      "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
-+      "0123456789ABCDEF";
- #ifdef UUID_UNPARSE_DEFAULT_UPPER
- #define FMT_DEFAULT fmt_upper
-@@ -50,14 +50,24 @@ static const char *fmt_upper = 
- static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt)
- {
--      struct uuid uuid;
--
--      uuid_unpack(uu, &uuid);
--      sprintf(out, fmt,
--              uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
--              uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
--              uuid.node[0], uuid.node[1], uuid.node[2],
--              uuid.node[3], uuid.node[4], uuid.node[5]);
-+      const uint8_t *uuid_array = (const uint8_t *)uu;
-+      int uuid_index;
-+      
-+      for ( uuid_index = 0; uuid_index < sizeof(uuid_t); ++uuid_index ) {
-+              // insert '-' after the 4th, 6th, 8th, and 10th uuid byte
-+              switch (uuid_index) {
-+              case 4:
-+              case 6:
-+              case 8:
-+              case 10:
-+                      *out++ = '-';
-+                      break;
-+              }
-+              // insert uuid byte as two hex characters
-+              *out++ = fmt[*uuid_array >> 4];
-+              *out++ = fmt[*uuid_array++ & 0xF];
-+      }
-+      *out = 0;
- }
- void uuid_unparse_lower(const uuid_t uu, char *out)
index 21de6964967d24ac8351342e5ef56d9b63495c39..a75e45aa85ae8029c5ca9a00eb98e9607303d99b 100644 (file)
@@ -41,7 +41,7 @@
 #include <sys/time.h>
 #include <time.h>
 
-#include "uuid.h"
+#include <uuid/uuid.h>
 
 /*
  * Offset between 15-Oct-1582 and 1-Jan-70
diff --git a/uuid/uuidsrc/uuidP.h.patch b/uuid/uuidsrc/uuidP.h.patch
deleted file mode 100644 (file)
index ccf8c3c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- uuidP.h.orig       2004-04-29 15:33:29.000000000 -0700
-+++ uuidP.h    2004-11-03 16:38:52.000000000 -0800
-@@ -41,7 +41,7 @@
- #include <sys/time.h>
- #include <time.h>
--#include "uuid.h"
-+#include <uuid/uuid.h>
- /*
-  * Offset between 15-Oct-1582 and 1-Jan-70
index 8616da9120631212092c068b7fbd625f520cb4f3..70734fddb9dfb7eb7935aeba334fabc9f65914f3 100644 (file)
@@ -36,17 +36,26 @@ uuid_unparse \- convert an UUID from binary representation to a string
 .nf
 .B #include <uuid/uuid.h>
 .sp
-.BI "void uuid_unparse(uuid_t " uu ", char *" out );
-.BI "void uuid_unparse_upper(uuid_t " uu ", char *" out );
-.BI "void uuid_unparse_lower(uuid_t " uu ", char *" out );
+\fIvoid\fP
+.br
+\fBuuid_unparse\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
+.sp
+\fIvoid\fP
+.br
+\fBuuid_unparse_lower\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
+.sp
+\fIvoid\fP
+.br
+\fBuuid_unparse_upper\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
+.sp
 .fi
 .SH DESCRIPTION
 The
 .B uuid_unparse
 function converts the supplied UUID
 .I uu
-from the binary representation into a 36\-byte string (plus tailing '\\0')
-of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a76 and stores this value in the
+from the binary representation into a uuid_string_t (37\-byte string including tailing '\\0')
+of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a761bde3fb and stores this value in the
 character string pointed to by
 .IR out .  
 The case of the hex digits returned by 
diff --git a/uuid/uuidsrc/uuid_unparse.3.in.patch b/uuid/uuidsrc/uuid_unparse.3.in.patch
deleted file mode 100644 (file)
index 170f27b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
---- uuid_unparse.3.in.orig     2010-04-28 23:38:50.000000000 -0700
-+++ uuid_unparse.3.in  2010-04-28 23:53:36.000000000 -0700
-@@ -36,17 +36,26 @@ uuid_unparse \- convert an UUID from bin
- .nf
- .B #include <uuid/uuid.h>
- .sp
--.BI "void uuid_unparse(uuid_t " uu ", char *" out );
--.BI "void uuid_unparse_upper(uuid_t " uu ", char *" out );
--.BI "void uuid_unparse_lower(uuid_t " uu ", char *" out );
-+\fIvoid\fP
-+.br
-+\fBuuid_unparse\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-+.sp
-+\fIvoid\fP
-+.br
-+\fBuuid_unparse_lower\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-+.sp
-+\fIvoid\fP
-+.br
-+\fBuuid_unparse_upper\fP(\fIuuid_t uu\fP, \fIuuid_string_t out\fP);
-+.sp
- .fi
- .SH DESCRIPTION
- The
- .B uuid_unparse
- function converts the supplied UUID
- .I uu
--from the binary representation into a 36\-byte string (plus tailing '\\0')
--of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a76 and stores this value in the
-+from the binary representation into a uuid_string_t (37\-byte string including tailing '\\0')
-+of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a761bde3fb and stores this value in the
- character string pointed to by
- .IR out .  
- The case of the hex digits returned by 
diff --git a/x86_64/gen/Makefile.inc b/x86_64/gen/Makefile.inc
deleted file mode 100644 (file)
index ef0825d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# searching i386 directory as a fallback to avoid unnecessary code duplication
-.PATH: ${.CURDIR}/x86_64/gen ${.CURDIR}/i386/gen
-
-MDSRCS+= _ctx_start.S \
-       _setcontext.S \
-       getcontext.S \
-       getmcontext.c \
-       icacheinval.s \
-       makecontext.c \
-       mcount.s \
-       setcontext.c \
-       setjmperr.c \
-       swapcontext.c \
-       cpu_number.s
-
-.for _src in makecontext.c setcontext.c swapcontext.c
-CFLAGS-${_src} += -fomit-frame-pointer
-# -pg and -fomit-frame-pointer don't work together, so just use -g
-${_src:R}.po: ${_src} _STANDARD_DEBUG
-.endfor
index 864cdd64b0b92dd96d62e903341789e211e64357..c3994b82fbee8d25fc63c07f2a5136881e353be1 100644 (file)
@@ -43,8 +43,8 @@ LABEL(__setcontext)
 #if DEBUG
        movq  MCONTEXT_SS_RSI(%rdi),   %rsi
        movq  MCONTEXT_SS_RCX(%rdi),   %rcx
-       movq  MCONTEXT_SS_R8+00(%rdi), %r8
-       movq  MCONTEXT_SS_R8+08(%rdi), %r9
+       movq  MCONTEXT_SS_R8+0(%rdi),  %r8
+       movq  MCONTEXT_SS_R8+8(%rdi),  %r9
        movq  MCONTEXT_SS_R8+16(%rdi), %r10
        movq  MCONTEXT_SS_R8+24(%rdi), %r11
 #endif
diff --git a/x86_64/gen/setjmperr.c b/x86_64/gen/setjmperr.c
new file mode 100644 (file)
index 0000000..bf06595
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)setjmperr.c        5.4 (Berkeley) 6/27/88";
+#endif /* LIBC_SCCS and not lint */
+
+#include <unistd.h>
+
+/*
+ * This routine is called from longjmp() when an error occurs.
+ * Programs that wish to exit gracefully from this error may
+ * write their own versions.
+ * If this routine returns, the program is aborted.
+ */
+
+void
+longjmperror()
+{
+#define        ERRMSG  "longjmp botch\n"
+       write(2, ERRMSG, sizeof(ERRMSG) - 1);
+}
diff --git a/x86_64/pthreads/Makefile.inc b/x86_64/pthreads/Makefile.inc
deleted file mode 100644 (file)
index 49f1faa..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# searching i386 directory as a fallback to avoid unnecessary code duplication
-.PATH: ${.CURDIR}/x86_64/pthreads ${.CURDIR}/i386/pthreads
-
-MDSRCS += \
-       init_cpu_capabilities.c \
-       get_cpu_capabilities.s \
-       pthread_mutex_lock.s \
-       pthread_set_self.s \
-       pthread_self.s \
-       pthread_getspecific.s \
-       start_wqthread.s \
-       thread_start.s \
-       preempt.s
-
-DYLDSRCS += \
-       pthread_set_self.s \
-       pthread_self.s \
-       pthread_getspecific.s \
-       preempt.s
diff --git a/x86_64/pthreads/get_cpu_capabilities.s b/x86_64/pthreads/get_cpu_capabilities.s
deleted file mode 100644 (file)
index 15f37ff..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/* Get the cpu_capabilities bit vector out of the comm page */
-
-#define        __APPLE_API_PRIVATE
-#include <machine/cpu_capabilities.h>
-#undef __APPLE_API_PRIVATE
-
-.text
-.align 2, 0x90
-.private_extern __get_cpu_capabilities
-__get_cpu_capabilities:
-       movq    $(_COMM_PAGE_CPU_CAPABILITIES), %rax
-       movl    (%rax), %eax
-       ret
index b1ca841f054fc85f32efbb8d53f6f3a997a72b7d..b45887bb1b1690a01581871343587dc02a6707c3 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
+#include <architecture/i386/asm_help.h>
 
 #define        PTHRW_LVAL    0
 #define        PTHRW_UVAL    4
@@ -42,7 +43,8 @@ __commpage_pthread_mutex_lock:
        decl    %eax                // decrement max spin count
        jnz     1b                  // keep spinning
 2:
-       movq    $(_COMM_PAGE_PFZ_MUTEX_LOCK), %rcx
+       movq    _commpage_pfz_base(%rip),%rcx
+       addq    $(_COMM_TEXT_PFZ_MUTEX_LOCK_OFFSET), %rcx
        call    *%rcx
        testl   %ebx,%ebx           // pending preemption?
        jz      1f                  // no
diff --git a/x86_64/stdlib/gdtoa.mk b/x86_64/stdlib/gdtoa.mk
deleted file mode 100644 (file)
index 107fe30..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# Long double is 80 bits
-GDTOA_FBSDSRCS+=gdtoa-strtopx.c machdep_ldisx.c
diff --git a/x86_64/string/Makefile.inc b/x86_64/string/Makefile.inc
deleted file mode 100644 (file)
index a3c985a..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Version$
-#
-# x86-64-optimised string functions.
-#
-#
-#
-.PATH: ${.CURDIR}/x86_64/string
-
-MDSRCS += \
-       bcopy.c \
-       bcopy_sse3x.s \
-       bcopy_sse42.s \
-       bzero.c \
-       bzero_sse2.s \
-       bzero_sse42.s \
-       __bzero.s \
-       longcopy_sse3x.s \
-       memcpy.c \
-       memmove.c \
-       strlcat.s \
-       strlcpy.s \
-       strlen.s \
-       strcpy.s \
-       strcmp.s \
-       strncpy.s \
-       strncmp.s \
-       memcmp.s \
-       memset.s \
-       ffs.s
-
-SUPPRESSSRCS += bcmp.c
-
-DYLDSRCS += \
-       __bzero.s \
-       bcopy_sse3x.s \
-       bzero_sse2.s \
-       ffs.s \
-       longcopy_sse3x.s \
-       strcmp.s \
-       strlen.s
index 96fe199deb56701a29c22a0711bcd905041ea5e4..3187decbf3cf2d6cab396defd7e7454540fd6443 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 PLATFUNC_DESCRIPTOR_PROTOTYPE(bcopy, sse42)
 PLATFUNC_DESCRIPTOR_PROTOTYPE(bcopy, sse3x)
index 8556a10e4c8ca70e2571eeaf7559380a07dff461..0881b14007b2d2d399366aec9db8b4c95b92e74d 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 /*
  * The bcopy/memcpy loops, tuned for 64-bit Pentium-M class processors with 
index cfb1a28a1b553633ecdd089e2486be68989f368c..236e45494cabf351a059c535f344da89bfc5ac74 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 /*
  * The bcopy/memcpy loops, tuned for Nehalem.  This is the 64-bit version.
index 99e7cae0b95ca17fb3998232fe6ca1ad92524885..d5feed5758551bdd3e6fd692c64e6747fd110c71 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 PLATFUNC_DESCRIPTOR_PROTOTYPE(bzero, sse42)
 PLATFUNC_DESCRIPTOR_PROTOTYPE(bzero, sse2)
index 6b6effdefdcf997d807c0f410c7a27c30c97367a..3d7d596c915d8a1753131bc213cae1abc8bb8a07 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 /*
  * Bzero, tuned for Pentium-M class processors with SSE2
index 5b0358fb4acf6e29f3d78bb11fd2929b4c9c9b1b..415d8d473267792413c8670b99f93fff43d2908e 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 /*
  * Bzero, tuned for processors with SSE4.2 and 64-byte cache lines, ie Nehalem.
index 347d1852f07850115dbc7b1a74e7a58ad282a61b..7a98a4c79a63b1ebcc413513327f6d22ebde0192 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 PLATFUNC_DESCRIPTOR_PROTOTYPE(memcpy, sse42)
 PLATFUNC_DESCRIPTOR_PROTOTYPE(memcpy, sse3x)
index 6fe7d0797db277bc56dcd4b7e0d0a65124f92ed7..64764235d98d2d2316dafe7622a8dc8d448305fe 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 PLATFUNC_DESCRIPTOR_PROTOTYPE(memmove, sse42)
 PLATFUNC_DESCRIPTOR_PROTOTYPE(memmove, sse3x)
diff --git a/x86_64/sys/Makefile.inc b/x86_64/sys/Makefile.inc
deleted file mode 100644 (file)
index 0719fa2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-.PATH: ${.CURDIR}/x86_64/sys ${.CURDIR}/i386/sys
-
-AINC+= -I${.CURDIR}/x86_64/sys
-
-MDSRCS+= OSAtomic.s \
-       atomic.c \
-       spinlocks.c \
-       spinlocks_asm.s \
-       i386_gettimeofday_asm.s \
-       _setjmp.s \
-       setjmp.s \
-       _sigtramp.s \
-       nanotime.s
-
-DYLDSRCS += \
-       OSAtomic.s \
-       i386_gettimeofday_asm.s \
-       spinlocks_asm.s \
-       nanotime.s
index 2f18fb96a621d634dbbb4cfe08fd8f972a8fad6e..ed3262428a21545f18e58f78dc517ec4b84657ca 100644 (file)
@@ -23,7 +23,8 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
+#include <architecture/i386/asm_help.h>
 
 #define DECLARE(x)   \
        .align 2, 0x90      ; \
@@ -317,7 +318,8 @@ _OSAtomicDequeue:           // %rdi == list head, %rsi == offset
 _OSAtomicFifoEnqueue:
        pushq   %rbx
        xorl    %ebx,%ebx       // clear "preemption pending" flag
-       movq    $(_COMM_PAGE_PFZ_ENQUEUE), %rcx
+       movq    _commpage_pfz_base(%rip),%rcx
+       addq    $(_COMM_TEXT_PFZ_ENQUEUE_OFFSET), %rcx
        call    *%rcx
        testl   %ebx,%ebx       // pending preemption?
        jz      1f
@@ -333,8 +335,9 @@ _OSAtomicFifoEnqueue:
 _OSAtomicFifoDequeue:
        pushq   %rbx
        xorl    %ebx,%ebx       // clear "preemption pending" flag
+       movq    _commpage_pfz_base(%rip), %rcx
        movq    %rsi,%rdx       // move offset to %rdx to be like the Enqueue case
-       movq    $(_COMM_PAGE_PFZ_DEQUEUE), %rcx
+       addq    $(_COMM_TEXT_PFZ_DEQUEUE_OFFSET), %rcx
        call    *%rcx
        testl   %ebx,%ebx       // pending preemption?
        jz      1f
index 5c80116177674909ef726fe2e104cf6facc59a93..a528650e326487599a59b9bb780f67b7696b5cbf 100644 (file)
@@ -195,9 +195,9 @@ LASFDE1:
           Only integer registers are described at present.    */
 
        loc_expr_for_reg (0, MCONTEXT_SS_RAX)
-       loc_expr_for_reg (1, MCONTEXT_SS_RBX)
+       loc_expr_for_reg (1, MCONTEXT_SS_RDX)
        loc_expr_for_reg (2, MCONTEXT_SS_RCX)
-       loc_expr_for_reg (3, MCONTEXT_SS_RDX)
+       loc_expr_for_reg (3, MCONTEXT_SS_RBX)
        loc_expr_for_reg (4, MCONTEXT_SS_RSI)
        loc_expr_for_reg (5, MCONTEXT_SS_RDI)
        loc_expr_for_reg (6, MCONTEXT_SS_RBP)
index 8a2ee19374d6cdc6f348e8d86ed27d93a4bd301c..ca447f5d9a05a054af2460c3e7762ed64373110b 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 #define        RESOLVER_UP_MP(symbol)  \
        PLATFUNC_DESCRIPTOR(symbol, up, kUP, 0); \
index 42898ff78a45e58993df49666690d22baa78d452..28a3bd2f6a10d225b4037ac769147c12ef130fca 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <sys/appleapiopts.h>
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 #define NSEC_PER_SEC   1000*1000*1000
 #define NSEC_PER_USEC  1000
@@ -41,6 +41,7 @@ ___commpage_gettimeofday:
        pushq   %r12                    // push callee-saved registers we want to use
        pushq   %r13
        pushq   %r14
+       subq    $8, %rsp
        movq    %rsp,%rbp
        movq    %rdi,%r12               // save ptr to timeval
        movq    $(_COMM_PAGE_TIME_DATA_START),%r13
@@ -48,7 +49,7 @@ ___commpage_gettimeofday:
        movl    _GTOD_GENERATION(%r13),%r14d    // get generation (0 if disabled)
        testl   %r14d,%r14d             // disabled?
        jz      4f
-       
+
        call    _mach_absolute_time     // get %rax <- nanotime()
        
        movl    _GTOD_SEC_BASE(%r13),%r8d       // get _COMM_PAGE_TIMESTAMP
@@ -71,6 +72,7 @@ ___commpage_gettimeofday:
        movl    %eax,8(%r12)            // store 32-bit useconds into timeval
        xorl    %eax,%eax               // return 0 for success
 3:
+       addq    $8, %rsp
        popq    %r14
        popq    %r13
        popq    %r12
index 8bc85a8c5302c99fcc622b49d42b967f47b47315..95126799875529397f48b7fa28b27366e5fcea69 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
+#include "platfunc.h"
 
 #define        RESOLVER_UP_MP(symbol)  \
        PLATFUNC_DESCRIPTOR_PROTOTYPE(symbol, up); \
index 7bc0fbd27b1e2f66f132890ac87397ee5d69b145..746eb64166ca969967b76c2b580ba158281f58a5 100644 (file)
@@ -28,8 +28,8 @@
 
 #include <sys/appleapiopts.h>
 #include <machine/cpu_capabilities.h>
-#include <platfunc.h>
 #include <mach/i386/syscall_sw.h>
+#include "platfunc.h"
 
 PLATFUNC_FUNCTION_START(OSSpinLockTry, up, 64, 4)
 PLATFUNC_FUNCTION_START(_spin_lock_try, up, 64, 4)
diff --git a/xcodescripts/build_linklists.sh b/xcodescripts/build_linklists.sh
new file mode 100755 (executable)
index 0000000..097d6b7
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# build_linklists.sh
+# Libc
+
+# Skip script during installhdrs
+if [ "$ACTION" == installhdrs ]; then exit 0; fi
+
+ARCHIVES=(Platform Base FreeBSD FreeBSD_gcc NetBSD TRE vCancelable vDarwinExtsn vDarwinExtsnCancelable vPre1050 vLegacy vInode32)
+
+NORMAL_LIST="$BUILT_PRODUCTS_DIR/normal.linklist"
+DEBUG_LIST="$BUILT_PRODUCTS_DIR/debug.linklist"
+INTERPOSABLE_LIST="$DERIVED_FILES_DIR/interposable.list"
+
+rm -f $NORMAL_LIST
+rm -f $DEBUG_LIST
+rm -f $INTERPOSABLE_LIST
+
+for x in ${ARCHIVES[@]}; do
+       nm -AUamgf "$BUILT_PRODUCTS_DIR/lib${x}.a" 2>/dev/null | \
+               grep '__TEXT,__text' | \
+               grep -v '\[symbol resolver\]' | \
+               grep -vE '\$VARIANT\$(m|u)p' | \
+               awk '{ print $NF }' >> $INTERPOSABLE_LIST
+
+       echo "-l$x" >> $NORMAL_LIST
+       echo "-l${x}_debug" >> $DEBUG_LIST
+done
+
+touch "$BUILT_PRODUCTS_DIR/deps.c"
+
+exit 0
diff --git a/xcodescripts/clean_simulator.sh b/xcodescripts/clean_simulator.sh
new file mode 100644 (file)
index 0000000..39c4f38
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+# clean_simulator.sh
+if [ "$ACTION" = installhdrs ]; then exit 0; fi
+
+if [ "$PLATFORM_NAME" = iphonesimulator ]; then
+       rm -rf "${DSTROOT}"/usr/local/lib/dyld
+fi
diff --git a/xcodescripts/force_libc_to_build.sh b/xcodescripts/force_libc_to_build.sh
new file mode 100644 (file)
index 0000000..d4ed302
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  force_libc_to_build.sh
+#  Libc
+#
+#  Created by Matt Wright on 10/4/11.
+#  Copyright (c) 2011 None. All rights reserved.
+
+if [ "x$ACTION" == "xinstallhdrs" ]; then exit 0; fi
+
+DEPS_C="$BUILT_PRODUCTS_DIR/deps.c"
+
+[ -e $DEPS_C ] && rm -f $DEPS_C
diff --git a/xcodescripts/generate_features.pl b/xcodescripts/generate_features.pl
new file mode 100755 (executable)
index 0000000..ce710f4
--- /dev/null
@@ -0,0 +1,225 @@
+#!/usr/bin/perl
+
+if ($ENV{"ACTION"} eq "installhdrs") {
+       exit 0;
+}
+
+# Generates the libc-features.h files used to control #ifdef behaviour in Libc
+use warnings;
+use Data::Dumper;
+use File::Path qw(mkpath);
+
+#printf Dumper(\%ENV);
+
+my $unifdef = 0;
+my %unifdefs = ();
+my $bash = 0;
+if (scalar(@ARGV) > 0) {
+       $unifdef = 1 if $ARGV[0] =~ /--unifdef/;
+       $bash = 1 if $ARGV[0] =~ /--bash/;
+}
+
+for my $arch (split(/ /, $ENV{"ARCHS"}))
+{
+       # set ENV{"CURRENT_ARCH"} so we can predicate on it
+       $ENV{"CURRENT_ARCH"} = $arch;
+       
+       my $platformName = $ENV{"PLATFORM_NAME"};
+       $platformName = "iphoneos" if ($platformName eq "iphonesimulator");
+
+       my $platformPath = $ENV{"SRCROOT"} . "/Platforms/" . $platformName . "/Makefile.inc";
+       my $featuresHeaderDir = $ENV{"DERIVED_FILES_DIR"}."/".$arch;
+       my $featuresHeader = $featuresHeaderDir."/libc-features.h";
+
+       open FEATURESFILE, "<$platformPath" or die "Unable to open: $platformPath";
+
+       my %features = ();
+       my $skip = 0;
+       my $nested = 0;
+
+       while (<FEATURESFILE>) {
+               next if $_ =~ /\s*#/;
+               
+               if ($_ =~ /^.endif/) {
+                       $skip-- if $skip > 0;
+                       $nested--;
+               }
+
+               elsif ($_ =~ /^\.if\s+(\S+)\s+(\S+)/) {
+                       # an if statement, very rudimentary regex against envvar
+                       my $envvar = $1;
+                       my $regex = $2;
+                       
+                       $nested++;
+                       if ($ENV{$envvar} !~ /$regex/) {
+                               $skip += 1;
+                       }
+               }
+                       
+               elsif ($_ =~ /^\s*([^= ]+)\s*=\s*(\d)/) {
+                       if ($skip == 0) {
+                               if ($2 == 1) {
+                                       $features{$1} = $2;
+                               } elsif (defined($features{$1})) {
+                                       delete $features{$1};
+                               }
+                       }
+               }
+       }
+
+       close FEATURESFILE;
+       
+       if ($bash == 1) {
+               for my $f (keys %features) {
+                       print "$f=$features{$f} ";
+               }
+               printf "\n";
+               exit 0;
+       }
+
+       elsif ($unifdef == 1) {
+               # assume FEATURE_BLOCKS was on by default
+               $unifdefs{"UNIFDEF_BLOCKS"} = 1;
+               $unifdefs{"UNIFDEF_LEGACY_64_APIS"} = defined($features{"FEATURE_LEGACY_64_APIS"});
+               $unifdefs{"UNIFDEF_LEGACY_RUNE_APIS"} = defined($features{"FEATURE_LEGACY_RUNE_APIS"});
+               $unifdefs{"UNIFDEF_LEGACY_UTMP_APIS"} = defined($features{"FEATURE_LEGACY_UTMP_APIS"});
+               $unifdefs{"UNIFDEF_MOVE_LOCALTIME"} = defined($features{"FEATURE_MOVE_LOCALTIME"});
+               
+               my $output = "";
+               for my $d (keys %unifdefs) {
+                       $output .= " " . ($unifdefs{$d} == 1 ? "-D" : "-U") . $d;
+               }
+               
+               chomp $output;
+               print "$output\n";
+               exit 0;
+       }
+       
+       elsif ($unifdef == 0) {
+               # If we touch this file on every build, then every other iterative build in Xcode will rebuild *everything*
+               my $platform_mtime = (stat($platformPath))[9];
+               my $header_mtime = (stat($featuresHeader))[9];
+
+               if ($header_mtime > $platform_mtime) {
+                       exit 0;
+               }
+
+               printf $arch." features:\n";
+               printf Dumper(\%features);
+
+               if ($nested != 0) {
+                       die "Unbalanced .if/.endif directive";
+               }
+
+               # And the meat, new header options should go under here
+               if (! -d $featuresHeaderDir) {
+                       mkpath $featuresHeaderDir or die "Unable to mkdir: $featuresHeaderDir";
+               }
+               open HEADER, ">$featuresHeader" or die "Unable to open (for writing): $featuresHeader";
+
+               printf HEADER "#ifndef _LIBC_FEATURES_H_\n";
+               printf HEADER "#define _LIBC_FEATURES_H_\n\n";
+
+               my $shortarch = $arch;
+               $shortarch =~ s/armv\d+[a-z]?/arm/g;
+
+               printf HEADER "#if !defined(__".$shortarch."__)\n";
+               printf HEADER "#error Mismatched libc-features.h architecture\n";
+               printf HEADER "#endif\n\n";
+
+               if (defined($features{"FEATURE_LEGACY_RUNE_APIS"})) {
+                       printf HEADER "#define UNIFDEF_LEGACY_RUNE_APIS 1\n";
+               } else {
+                       printf HEADER "/* #undef UNIFDEF_LEGACY_RUNE_APIS */\n";
+               }
+
+               if (defined($features{"FEATURE_LEGACY_CRT1_ENVIRON"})) {
+                       printf HEADER "#define LEGACY_CRT1_ENVIRON 1\n";
+               } else {
+                       printf HEADER "/* #undef LEGACY_CRT1_ENVIRON */\n";
+               }
+
+               if (defined($features{"FEATURE_LEGACY_UTMP_APIS"})) {
+                       printf HEADER "#define UNIFDEF_LEGACY_UTMP_APIS 1\n";
+               } else {
+                       printf HEADER "/* #undef UNIFDEF_LEGACY_UTMP_APIS */\n";
+               }
+
+               if (defined($features{"FEATURE_MOVE_LOCALTIME"})) {
+                       printf HEADER "#define UNIFDEF_MOVE_LOCALTIME 1\n";
+               } else {
+                       printf HEADER "/* #undef UNIFDEF_MOVE_LOCALTIME */\n";
+               }
+
+               if (defined($features{"FEATURE_ONLY_1050_VARIANTS"})) {
+                       printf HEADER "#if !__DARWIN_ONLY_VERS_1050\n";
+                       printf HEADER "#  error Feature mismatch: __DARWIN_ONLY_VERS_1050 == 0\n";
+                       printf HEADER "#endif /* !__DARWIN_ONLY_VERS_1050 */\n";
+               } else {
+                       printf HEADER "#if __DARWIN_ONLY_VERS_1050\n";
+                       printf HEADER "#  error Feature mismatch: __DARWIN_ONLY_VERS_1050 == 1\n";
+                       printf HEADER "#endif /* __DARWIN_ONLY_VERS_1050 */\n";
+               }
+
+               if (defined($features{"FEATURE_ONLY_UNIX_CONFORMANCE"})) {
+                       printf HEADER "#if !__DARWIN_ONLY_UNIX_CONFORMANCE\n";
+                       printf HEADER "#  error Feature mismatch: __DARWIN_ONLY_UNIX_CONFORMANCE == 0\n";
+                       printf HEADER "#endif /* !__DARWIN_ONLY_UNIX_CONFORMANCE */\n";
+               } else {
+                       printf HEADER "#if __DARWIN_ONLY_UNIX_CONFORMANCE\n";
+                       printf HEADER "#  error Feature mismatch: __DARWIN_ONLY_UNIX_CONFORMANCE == 1\n";
+                       printf HEADER "#endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */\n";
+               }
+
+               if (defined($features{"FEATURE_ONLY_64_BIT_INO_T"})) {
+                       printf HEADER "#if !__DARWIN_ONLY_64_BIT_INO_T\n";
+                       printf HEADER "#  error Feature mismatch: __DARWIN_ONLY_64_BIT_INO_T == 0\n";
+                       printf HEADER "#endif /* !__DARWIN_ONLY_64_BIT_INO_T */\n";
+               } else {
+                       printf HEADER "#if __DARWIN_ONLY_64_BIT_INO_T\n";
+                       printf HEADER "#  error Feature mismatch: __DARWIN_ONLY_64_BIT_INO_T == 1\n";
+                       printf HEADER "#endif /* __DARWIN_ONLY_64_BIT_INO_T */\n";
+               }
+
+               if (defined($features{"FEATURE_PATCH_3417676"})) {
+                       printf HEADER "#define __APPLE_PR3417676_HACK__ 1\n";
+               } else {
+                       printf HEADER "/* #undef __APPLE_PR3417676_HACK__ */\n";
+               }
+
+               if (defined($features{"FEATURE_PATCH_5243343"})) {
+                       printf HEADER "#define PR_5243343 1\n";
+               } else {
+                       printf HEADER "/* #undef PR_5243343 */\n";
+               }
+
+               if (defined($features{"FEATURE_PLOCKSTAT"})) {
+                       printf HEADER "#define PLOCKSTAT 1\n";
+               } else {
+                       printf HEADER "/* #undef PLOCKSTAT */\n";
+               }
+
+               if (defined($features{"FEATURE_TIMEZONE_CHANGE_NOTIFICATION"})) {
+                       printf HEADER "#define NOTIFY_TZ 1\n";
+               } else {
+                       printf HEADER "/* #undef NOTIFY_TZ */\n";
+               }
+
+               if (defined($features{"FEATURE_NO_LIBCRASHREPORTERCLIENT"})) {
+                       printf HEADER "#define LIBC_NO_LIBCRASHREPORTERCLIENT 1\n";
+               } else {
+                       printf HEADER "/* #undef LIBC_NO_LIBCRASHREPORTERCLIENT */\n";
+               }
+
+               if (defined($features{"FEATURE_MEMORYSTATUS"})) {
+                       printf HEADER "#define CONFIG_MEMORYSTATUS 1\n";
+               } else {
+                       printf HEADER "/* #undef CONFIG_MEMORYSTATUS */\n";
+               }
+
+               printf HEADER "#endif // _LIBC_FEATURES_H_\n";
+               close HEADER;
+       }
+}
+       
+exit 0;
diff --git a/xcodescripts/headers.sh b/xcodescripts/headers.sh
new file mode 100644 (file)
index 0000000..47028ea
--- /dev/null
@@ -0,0 +1,182 @@
+#!/bin/bash
+set -x
+
+# Skip installing headers during Xcode build (buildit uses installhdrs+install)
+if [ "$ACTION" == build ]; then exit 0; fi
+
+# Installs Libc header files
+
+MKDIR="mkdir -p"
+INSTALL=install
+MV=mv
+ECHO=echo
+CHMOD=chmod
+CP=cp
+UNIFDEF=unifdef
+FIND=find
+RM=rm
+ED=ed
+XARGS=xargs
+GREP=grep
+FGREP=fgrep
+
+eval $(${SRCROOT}/xcodescripts/generate_features.pl --bash)
+UNIFDEFARGS=$(${SRCROOT}/xcodescripts/generate_features.pl --unifdef)
+
+INCDIR=${DSTROOT}/${PUBLIC_HEADERS_FOLDER_PATH}
+LOCINCDIR=${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH}
+SYSTEMFRAMEWORK=${DSTROOT}/System/Library/Frameworks/System.framework
+KERNELFRAMEWORK=${DSTROOT}/System/Library/Frameworks/Kernel.framework
+
+if [ "$PLATFORM_NAME" = iphonesimulator ]; then
+       SYSTEMFRAMEWORK=${DSTROOT}/${SDKROOT}/System/Library/Frameworks/System.framework
+       KERNELFRAMEWORK=${DSTROOT}/${SDKROOT}/System/Library/Frameworks/Kernel.framework
+fi
+
+PRIVHDRS=${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders
+PRIVKERNELHDRS=${KERNELFRAMEWORK}/Versions/A/PrivateHeaders
+INSTALLMODE=$([[ `id -u` -eq 0 ]] && echo 444 || echo 644)
+
+INSTHDRS=(
+       ${SRCROOT}/darwin/libproc.h
+       ${SRCROOT}/gen/get_compat.h
+       ${SRCROOT}/gen/execinfo.h
+)
+
+INC_INSTHDRS=(
+       NSSystemDirectories.h _locale.h _structs.h _types.h _wctype.h _xlocale.h aio.h alloca.h \
+       ar.h asl.h assert.h asm.h bitstring.h cpio.h crt_externs.h ctype.h db.h dirent.h disktab.h err.h \
+       errno.h fcntl.h fmtmsg.h fnmatch.h fsproperties.h fstab.h fts.h ftw.h getopt.h glob.h inttypes.h \
+       iso646.h langinfo.h libc.h libgen.h limits.h locale.h memory.h monetary.h monitor.h mpool.h ndbm.h \
+       nlist.h paths.h poll.h ranlib.h readpassphrase.h regex.h runetype.h search.h \
+       semaphore.h setjmp.h sgtty.h signal.h spawn.h stab.h standards.h stdbool.h stddef.h stdio.h stdint.h \
+       stdlib.h strhash.h string.h stringlist.h strings.h struct.h sysexits.h syslog.h tar.h termios.h time.h \
+       timeconv.h ttyent.h ucontext.h ulimit.h unistd.h util.h utime.h vis.h wchar.h wctype.h \
+       wordexp.h xlocale.h
+)
+if [ "x${FEATURE_LEGACY_RUNE_APIS}" == "x1" ]; then
+       INC_INSTHDRS=( "${INC_INSTHDRS[@]}" rune.h )
+fi
+if [ "x${FEATURE_LEGACY_UTMP_APIS}" == "x1" ]; then
+       INC_INSTHDRS=( "${INC_INSTHDRS[@]}" utmp.h )
+fi
+
+INC_INSTHDRS=( 
+       "${INC_INSTHDRS[@]/#/${SRCROOT}/include/}" 
+       ${SRCROOT}/include/FreeBSD/nl_types.h
+       ${SRCROOT}/include/NetBSD/utmpx.h
+       ${SRCROOT}/stdtime/FreeBSD/tzfile.h
+)
+INC_PTHREADHDRS=(
+       ${SRCROOT}/pthreads/pthread.h 
+       ${SRCROOT}/pthreads/pthread_spis.h 
+       ${SRCROOT}/pthreads/pthread_impl.h 
+       ${SRCROOT}/pthreads/sched.h
+)
+INSTHDRS=( "${INSTHDRS[@]}" "${INC_INSTHDRS[@]}" "${INC_PTHREADHDRS[@]}" )
+
+INC_ARPA_INSTHDRS=( ftp.h nameser_compat.h telnet.h tftp.h )
+ARPA_INSTHDRS=( "${INC_ARPA_INSTHDRS[@]/#/${SRCROOT}/include/arpa/}" )
+
+INC_LIBKERN_INSTHDRS=( OSAtomic.h OSCacheControl.h )
+if [ "x${FEATURE_MEM_THERM_NOTIFICATION_APIS}" == "x1" ]; then
+       INC_LIBKERN_INSTHDRS+=( OSMemoryNotification.h OSThermalNotification.h )
+fi
+LIBKERN_INSTHDRS=( "${INC_LIBKERN_INSTHDRS[@]/#/${SRCROOT}/include/libkern/}" )
+
+MALLOC_INSTHDRS=( ${SRCROOT}/include/malloc/malloc.h )
+
+INC_PROTO_INSTHDRS=(routed.h rwhod.h talkd.h timed.h )
+PROTO_INSTHDRS=( "${INC_PROTO_INSTHDRS[@]/#/${SRCROOT}/include/protocols/}" )
+
+INC_SECURE_INSTHDRS=( _common.h _string.h _stdio.h )
+SECURE_INSTHDRS=( "${INC_SECURE_INSTHDRS[@]/#/${SRCROOT}/include/secure/}" )
+
+SYS_INSTHDRS=( ${SRCROOT}/include/sys/acl.h ${SRCROOT}/include/sys/statvfs.h )
+
+INC_XLOCALE_INSTHDRS=(
+       __wctype.h _ctype.h _inttypes.h _langinfo.h _monetary.h _regex.h
+       _stdio.h _stdlib.h _string.h _time.h _wchar.h _wctype.h
+)
+XLOCALE_INSTHDRS=( "${INC_XLOCALE_INSTHDRS[@]/#/${SRCROOT}/include/xlocale/}" )
+
+LOCALHDRS=(
+       ${SRCROOT}/darwin/dirhelper.defs
+       ${SRCROOT}/darwin/dirhelper_priv.h
+       ${SRCROOT}/darwin/libproc.h
+       ${SRCROOT}/darwin/libproc_internal.h
+       ${SRCROOT}/gen/asl_core.h 
+       ${SRCROOT}/gen/asl_file.h 
+       ${SRCROOT}/gen/asl_ipc.defs 
+       ${SRCROOT}/gen/asl_legacy1.h 
+       ${SRCROOT}/gen/asl_msg.h 
+       ${SRCROOT}/gen/asl_private.h 
+       ${SRCROOT}/gen/asl_store.h 
+       ${SRCROOT}/gen/assumes.h 
+       ${SRCROOT}/gen/_simple.h 
+       ${SRCROOT}/gen/stack_logging.h 
+       ${SRCROOT}/gen/utmpx_thread.h
+       ${SRCROOT}/include/spawn_private.h
+       ${SRCROOT}/nls/FreeBSD/msgcat.h
+       ${SRCROOT}/pthreads/pthread_workqueue.h
+)
+
+PRIV_INSTHDRS=(
+       ${SRCROOT}/gen/stack_logging.h
+       ${SRCROOT}/pthreads/pthread_machdep.h
+       ${SRCROOT}/stdlib/FreeBSD/atexit.h
+)
+
+PRIV_BTREEHDRS=(
+       ${SRCROOT}/db/btree/FreeBSD/btree.h
+       ${SRCROOT}/db/btree/FreeBSD/bt_extern.h
+)
+
+SYS_INSTHDRS=( ${SRCROOT}/include/sys/acl.h ${SRCROOT}/include/sys/statvfs.h )
+PRIVUUID_INSTHDRS=( ${SRCROOT}/uuid/namespace.h )
+
+${MKDIR} ${INCDIR}/arpa
+${MKDIR} ${INCDIR}/libkern
+${MKDIR} ${INCDIR}/malloc
+${MKDIR} ${INCDIR}/protocols
+${MKDIR} ${INCDIR}/secure
+${MKDIR} ${INCDIR}/sys
+${MKDIR} ${INCDIR}/xlocale
+${INSTALL} -m ${INSTALLMODE} ${INSTHDRS[@]} ${INCDIR}
+${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS[@]} ${INCDIR}/arpa
+${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS[@]} ${INCDIR}/libkern
+${INSTALL} -m ${INSTALLMODE} ${MALLOC_INSTHDRS[@]} ${INCDIR}/malloc
+${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS[@]} ${INCDIR}/protocols
+${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS[@]} ${INCDIR}/secure
+${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${INCDIR}/sys
+${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS[@]} ${INCDIR}/xlocale
+${MKDIR} ${LOCINCDIR}
+${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS[@]} ${LOCINCDIR}
+${MKDIR} ${PRIVHDRS}/btree
+${MKDIR} ${PRIVHDRS}/machine
+${MKDIR} ${PRIVHDRS}/uuid
+${MKDIR} ${PRIVHDRS}/sys
+${MKDIR} ${PRIVKERNELHDRS}/uuid
+${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS[@]} ${PRIVHDRS}
+${INSTALL} -m ${INSTALLMODE} ${PRIV_BTREEHDRS[@]} ${PRIVHDRS}/btree
+${MV} ${INCDIR}/asm.h ${PRIVHDRS}/machine
+${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS[@]} ${PRIVHDRS}/sys
+${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVHDRS}/uuid
+${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS[@]} ${PRIVKERNELHDRS}/uuid
+
+for i in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do
+       ${CHMOD} u+w $i &&
+       ${ECHO} ${ED} - $i \< ${SRCROOT}/xcodescripts/strip-header.ed &&
+       ${ED} - $i < ${SRCROOT}/xcodescripts/strip-header.ed &&
+       ${CHMOD} u-w $i || exit 1;
+done
+for i in `${FIND} "${DSTROOT}" -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l UNIFDEF`; do
+       ${CHMOD} u+w $i &&
+       ${CP} $i $i.orig &&
+       ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $i.orig \> $i &&
+       { ${UNIFDEF} ${UNIFDEFARGS} $i.orig > $i || [ $? -ne 2 ]; } &&
+       ${RM} $i.orig &&
+       ${CHMOD} u-w $i || exit 1;
+done
+
+exit 0
diff --git a/xcodescripts/libc.xcconfig b/xcodescripts/libc.xcconfig
new file mode 100644 (file)
index 0000000..ac40d92
--- /dev/null
@@ -0,0 +1,107 @@
+#include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
+
+// Standard settings
+SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator
+SRCROOT_SEARCH_PATHS = $(SRCROOT)/include $(SRCROOT)/gen $(SRCROOT)/locale $(SRCROOT)/locale/FreeBSD $(SRCROOT)/pthreads $(SRCROOT)/stdtime/FreeBSD
+SYSTEM_FRAMEWORK_HEADERS = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
+HEADER_SEARCH_PATHS = $($(TARGET_NAME)_SEARCH_PATHS) $(DERIVED_FILES_DIR)/dtrace $(DERIVED_FILES_DIR)/$(CURRENT_ARCH) $(SRCROOT_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_HEADERS) $(SDKROOT)/usr/local/include $(inherited)
+ALWAYS_SEARCH_USER_PATHS = YES
+USE_HEADERMAP = NO
+BUILD_VARIANTS = normal
+GCC_OPTIMIZATION_LEVEL = s
+GCC_C_LANGUAGE_STANDARD = gnu99
+GCC_ENABLE_OBJC_EXCEPTIONS = YES
+GCC_SYMBOLS_PRIVATE_EXTERN = NO
+GCC_DYNAMIC_NO_PIC = NO
+GCC_THUMB_SUPPORT = YES
+COPY_PHASE_STRIP = NO
+SKIP_INSTALL = YES
+INSTALLHDRS_SCRIPT_PHASE = YES
+VERSIONING_SYSTEM =
+COPY_PHASE_STRIP = NO
+STRIP_INSTALLED_PRODUCT = NO
+LD_DYLIB_INSTALL_NAME = /usr/lib/system/$(EXECUTABLE_NAME)
+
+BUILD_VARIANTS = normal debug
+
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0
+GCC_VERSION[arch=armv6] = com.apple.compilers.llvmgcc42
+
+EXECUTABLE_PREFIX = libsystem_
+INSTALL_PATH = /usr/lib/system
+PUBLIC_HEADERS_FOLDER_PATH = /usr/include
+PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include
+
+// Simulator
+EXECUTABLE_PREFIX[sdk=iphonesimulator*] = libsystem_sim_
+PUBLIC_HEADERS_FOLDER_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/include
+PRIVATE_HEADERS_FOLDER_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/local/include
+INSTALL_PATH[sdk=iphonesimulator*] = $(SDKROOT)/usr/lib/system
+
+BASE_PREPROCESSOR_MACROS = __LIBC__ __DARWIN_UNIX03=1 __DARWIN_64_BIT_INO_T=1 __DARWIN_NON_CANCELABLE=1 __DARWIN_VERS_1050=1 _FORTIFY_SOURCE=0
+OTHER_CFLAGS = -fdollars-in-identifiers $($(TARGET_NAME)_CFLAGS) $(VARIANT_PREPROCESSOR_MACROS)
+OTHER_CFLAGS_debug = -fstack-protector -fno-inline -O0 -DDEBUG=1
+
+GCC_PREPROCESSOR_DEFINITIONS = $(BASE_PREPROCESSOR_MACROS)
+GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*] = $(BASE_PREPROCESSOR_MACROS) LIBC_NO_LIBCRASHREPORTERCLIENT=1
+GCC_PREPROCESSOR_DEFINITIONS[sdk=iphonesimulator*] = $(BASE_PREPROCESSOR_MACROS) LIBC_NO_LIBCRASHREPORTERCLIENT=1
+
+// libsystem_c.dylib linking
+CR_LDFLAGS[sdk=macosx*] = -lCrashReporterClient
+LIBCOMPILER_RT_LDFLAGS = -lcompiler_rt
+LIBSYSTEM_C_LDFLAGS = -all_load -nostdlib -L/usr/lib/system -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -umbrella System $(CR_LDFLAGS) -lSystem -lsystem_kernel $(LIBCOMPILER_RT_LDFLAGS) @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist
+LIBSYSTEM_C_LDFLAGS[sdk=iphonesimulator*] =
+
+// libPlatform.a architectures
+ARCH_FAMILY = $(ARCH_FAMILY_$(CURRENT_ARCH))
+ARCH_FAMILY_x86_64 = x86_64
+ARCH_FAMILY_i386 = i386
+ARCH_FAMILY_armv6 = arm
+ARCH_FAMILY_armv7 = arm
+ARCH_FAMILY_armv7f = arm
+ARCH_FAMILY_armv7k = arm
+
+// FreeBSD target
+FreeBSD_CFLAGS = -include $(SRCROOT)/fbsdcompat/_fbsd_compat_.h
+FreeBSD_SEARCH_PATHS = $(SRCROOT)/fbsdcompat $(SRCROOT)/gdtoa $(SRCROOT)/gdtoa/FreeBSD
+FreeBSD_EXCLUDED_SOURCE_GDTOA = gdtoa/FreeBSD/machdep* gdtoa-strtopx.c
+// Include the correct parts of gdtoa per-arch
+FreeBSD_INCLUDED_SOURCE_FILE_NAMES_x86_64 = gdtoa-strtopx.c machdep_ldisx.c
+FreeBSD_INCLUDED_SOURCE_FILE_NAMES_i386 = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_x86_64)
+FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7 = machdep_ldisd.c
+FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7k = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
+FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7f = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
+FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv6 = $(FreeBSD_INCLUDED_SOURCE_FILE_NAMES_armv7)
+
+// FreeBSD_gcc target
+FreeBSD_gcc_CFLAGS = -include $(SRCROOT)/fbsdcompat/_fbsd_compat_.h
+FreeBSD_gcc_SEARCH_PATHS = $(SRCROOT)/fbsdcompat $(SRCROOT)/gdtoa $(SRCROOT)/gdtoa/FreeBSD
+
+// NetBSD target
+NetBSD_CFLAGS = -include $(SRCROOT)/nbsdcompat/_nbsd_compat_.h
+NetBSD_SEARCH_PATHS = $(SRCROOT)/nbsdcompat
+
+// TRE target
+TRE_CFLAGS = -DHAVE_CONFIG_H
+TRE_SEARCH_PATHS = $(SRCROOT)/regex/TRE $(SRCROOT)/regex/FreeBSD
+
+// Files per architecture to exclude from the non-platform builds (because optimised versions exist in Platform)
+BASE_EXCLUDED_SOURCE_FILE_NAMES = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH)) $(BASE_EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME))
+BASE_EXCLUDED_SOURCE_FILE_NAMES_x86_64 = MKGetTimeBaseInfo.c bcmp.c context-stubs.c kvm.c memcmp.c memset.c memset_pattern.c nlist.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c strncpy.c
+BASE_EXCLUDED_SOURCE_FILE_NAMES_i386 = bcmp.c context-stubs.c memcmp.c memset.c memset_pattern.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c strncpy.c
+BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7 = bcmp.c memcmp.c memset.c memset_pattern.c strchr.c strlen.c strncmp.c strnlen.c strstr.c
+BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7k = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
+BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7f = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
+BASE_EXCLUDED_SOURCE_FILE_NAMES_armv6 = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7)
+
+// Rune support isn't included on iOS but there's no better way to exclude their complication
+BASE_EXCLUDED_SOURCE_FILE_NAMES_macosx = OSMemoryNotification.c OSThermalNotification.c
+BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos = frune.c login.c logout.c mbrune.c runedepreciated.c setinvalidrune.c getmntinfo64.c
+BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos)
+
+// <rdar://problem/9513665> - collate.c crashes llvm-gcc on armv6 with -Os + -gdwarf-2
+COLLATE_C_CFLAGS_macosx_armv6 = -O1
+
+// ARMv6 thumb doesn't support all the instructions needed for OSAtomics
+OSATOMIC_C_CFLAGS_macosx_armv6 = -mno-thumb
+OSATOMIC_C_CFLAGS_iphoneos_armv6 = -mno-thumb
diff --git a/xcodescripts/manpages.sh b/xcodescripts/manpages.sh
new file mode 100644 (file)
index 0000000..fa84889
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash -e
+
+if [ "$ACTION" = installhdrs ]; then exit 0; fi
+if [ "$PLATFORM_NAME" = iphoneos ]; then exit 0; fi
+if [ "$PLATFORM_NAME" = iphonesimulator ]; then exit 0; fi
+
+UNIFDEF_FLAGS=`${SRCROOT}/xcodescripts/generate_features.pl --unifdef`
+MANPAGES_LIST="${SRCROOT}/man/manpages.lst"
+FILES=$(find -E ${SRCROOT} -regex '.*/[^.]+\.[0-9]' -type f)
+
+cat ${MANPAGES_LIST} | grep -v -E '(^#|^\s*$)' | while read first solid rest; do
+       SOURCE=$(grep -E "/${first}$"<<EOF
+${FILES}
+EOF
+)
+       SECTION=$(echo ${first} | tail -c 2)
+
+       DESTDIR=${DSTROOT}/usr/share/man/man${SECTION}
+       DEST=${DESTDIR}/${solid}
+
+       mkdir -p ${DSTROOT}/usr/share/man/man${SECTION}
+
+       # cat is used to keep bash happy, unifdef returns non-zero in some success cases
+       cmd="unifdef -t ${UNIFDEF_FLAGS} < ${SOURCE} | cat > ${DEST}"
+       echo ${cmd}
+       eval ${cmd}
+
+       for link in ${rest}; do 
+               cmd="ln -sf ${first} ${DESTDIR}/${link}"
+               echo ${cmd}
+               eval ${cmd}
+       done
+done
+
+# grrr, uuid special case
+for page in libuuid.3 uuid_clear.3 uuid_compare.3 uuid_copy.3 uuid_generate.3 uuid_is_null.3 uuid_parse.3 uuid_unparse.3; do
+       SECTION=$(echo ${page} | tail -c 2)
+       DESTDIR=${DSTROOT}/usr/share/man/man${SECTION}
+       DEST=${DESTDIR}/${page}
+
+       # libuuid.3 -> uuid.3
+       [[ "${page}" == "libuuid.3" ]] && DEST=${DESTDIR}/uuid.3
+
+       sed -f ${SRCROOT}/uuid/uuidman.sed ${SRCROOT}/uuid/uuidsrc/${page}.in > ${DEST}
+done
+
+# and because uuid pages are special cased, so are the links
+for link in uuid_generate_random.3 uuid_generate_time.3; do
+       SECTION=$(echo ${link} | tail -c 2)
+       ln -sf uuid_generate.3 ${DSTROOT}/usr/share/man/man${SECTION}/${link}
+done
+
+for link in uuid_unparse_lower.3 uuid_unparse_upper.3; do
+       SECTION=$(echo ${link} | tail -c 2)
+       ln -sf uuid_unparse.3 ${DSTROOT}/usr/share/man/man${SECTION}/${link}
+done
diff --git a/xcodescripts/mig_headers.sh b/xcodescripts/mig_headers.sh
new file mode 100644 (file)
index 0000000..a017656
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -e
+
+export MIG=`xcrun -find mig`
+export MIGCC=`xcrun -find cc`
+
+BASE=`basename ${SCRIPT_INPUT_FILE_0} .defs`.h
+
+for a in ${ARCHS}; do
+       mkdir -p "${DERIVED_FILE_DIR}/${a}"
+       "${MIG}" -arch $a -header "${DERIVED_FILE_DIR}/${a}/${BASE}" \
+               -sheader /dev/null -user /dev/null \
+               -server /dev/null "${SCRIPT_INPUT_FILE_0}"
+done
diff --git a/xcodescripts/patch_headers_variants.pl b/xcodescripts/patch_headers_variants.pl
new file mode 100644 (file)
index 0000000..b404cbc
--- /dev/null
@@ -0,0 +1,121 @@
+#!/usr/bin/perl
+#
+# Copyright (c) 2006, 2007 Apple Inc. All rights reserved.
+#
+# @APPLE_LICENSE_HEADER_START@
+# 
+# This file contains Original Code and/or Modifications of Original Code
+# as defined in and that are subject to the Apple Public Source License
+# Version 2.0 (the 'License'). You may not use this file except in
+# compliance with the License. Please obtain a copy of the License at
+# http://www.opensource.apple.com/apsl/ and read it before using this
+# file.
+# 
+# The Original Code and all software distributed under the License are
+# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+# Please see the License for the specific language governing rights and
+# limitations under the License.
+# 
+# @APPLE_LICENSE_HEADER_END@
+#
+# patchheaders srcdir destdir
+#
+# The last path component of srcdir is replicated in destdir, with the
+# __DARWIN_ALIAS* and __DARWIN_EXTSN macro wrapped so that Libc can set
+# the symbol decoration independently:
+#
+#   #ifndef LIBC_ALIAS_FOO
+#   int foo(int) __DARWIN_ALIAS(foo);
+#   #else /* LIBC_ALIAS_FOO */
+#   int foo(int) LIBC_ALIAS(foo);
+#   #endif /* !LIBC_ALIAS_FOO */
+
+use strict;
+use IO::File;
+use File::Basename ();
+use File::Find ();
+use File::Path ();
+use File::Spec;
+
+my $MyName = File::Basename::basename($0);
+my $dest;
+
+sub process {
+    my($path, $file) = @_;
+    local $_;
+       if (-e $file) {
+               my $dest_mtime = (stat($file))[9];
+               my $src_mtime = (stat($path))[9];
+
+               if ($dest_mtime > $src_mtime) {
+                       return;
+               }
+       }
+
+    my $p = IO::File->new($path, 'r');
+    die "$MyName: Can't open $path: $!\n" unless defined($p);
+    my $f = IO::File->new($file, 'w');
+    die "$MyName: Can't open $file: $!\n" unless defined($f);
+    my @save;
+    while(<$p>) {
+               if(/^\S/ or /^\s*$/) {
+                       my $n = scalar(@save);
+                       my $sym;
+                       if($n > 0) {
+                               my($sym) = ($save[$n - 1] =~ /__DARWIN_(?:10\d+|ALIAS|EXTSN|INODE64)[^(]*\(([^)]*)\)/);
+                               if(defined($sym)) {
+                                       if(defined($path)) {
+                                               print "  $path\n";
+                                               undef($path);
+                                       }
+                                       $sym =~ s/^\s+//;
+                                       $sym =~ s/\s+$//;
+                                       $sym =~ tr/a-z/A-Z/;
+                                       $f->print("#ifndef LIBC_ALIAS_$sym\n");
+                               }
+                               $f->print(@save);
+                               if(defined($sym)) {
+                                       $save[$n - 1] =~ s/__DARWIN_(10\d+|ALIAS|EXTSN|INODE64)/LIBC_$1/;
+                                       $f->print("#else /* LIBC_ALIAS_$sym */\n");
+                                       $f->print(@save);
+                                       $f->print("#endif /* !LIBC_ALIAS_$sym */\n");
+                               }
+                       }
+                       if(/^#/) {
+                               $f->print($_);
+                       @save = ();
+           } else {
+                       @save = ($_);
+           }
+       } else {
+           push(@save, $_);
+       }
+}
+$f->print(@save);
+}
+
+sub usage {
+    die "Usage: $MyName srcdir dstdir\n";
+}
+
+sub wanted {
+    if(-d $File::Find::name) {
+               #print "DIR: $File::Find::name\n";
+               my $dir = File::Spec->join($dest, $File::Find::name);
+               File::Path::mkpath($dir, 0, 0755);
+    } else {
+               #print "FIL: $File::Find::name\n";
+               my $file = File::Spec->join($dest, $File::Find::name);
+               process($File::Find::name, $file);
+    }
+}
+
+usage() unless scalar(@ARGV) == 2;
+my $start = File::Basename::dirname($ARGV[0]);
+chdir($start) || die "$MyName: chdir($start): $!\n";
+$dest = $ARGV[1];
+File::Path::mkpath($dest, 0, 0755);
+File::Find::find({wanted => \&wanted, no_chdir => 1}, File::Basename::basename($ARGV[0]));
diff --git a/xcodescripts/sanitise_headers.sh b/xcodescripts/sanitise_headers.sh
new file mode 100644 (file)
index 0000000..41f4669
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+#
+# Copyright (c) 2010-2011 Apple Inc. All rights reserved.
+#
+# @APPLE_APACHE_LICENSE_HEADER_START@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# @APPLE_APACHE_LICENSE_HEADER_END@
+#
+
diff --git a/xcodescripts/strip-header.ed b/xcodescripts/strip-header.ed
new file mode 100644 (file)
index 0000000..a7d7aa8
--- /dev/null
@@ -0,0 +1,2 @@
+g/^\/\/Begin-Libc$/.,/^\/\/End-Libc$/d
+w
diff --git a/xcodescripts/variants.xcconfig b/xcodescripts/variants.xcconfig
new file mode 100644 (file)
index 0000000..fd3480f
--- /dev/null
@@ -0,0 +1,99 @@
+#include "libc.xcconfig"
+
+// Variants. All variants contain all source files but all excluded. Specific variants then include the files they need.
+VARIANT_EXCLUDED_SOURCE_FILE_NAMES = *
+VARIANT_INCLUDED_SOURCE_FILE_NAMES = forceLibcToBuild.c $(VARIANT_$(VARIANT)_INCLUDE)
+VARIANT_PREPROCESSOR_MACROS = -DBUILDING_VARIANT $(VARIANT_$(VARIANT)_MACROS)
+
+SYSTEM_FRAMEWORK_HEADERS = $(DERIVED_FILES_DIR)/System.framework/Versions/B/PrivateHeaders
+HEADER_SEARCH_PATHS = $(FreeBSD_SEARCH_PATHS) $(inherited)
+
+VARIANT_CANCELABLE_MACROS = -DVARIANT_CANCELABLE
+
+VARIANT_CANCELABLE_INCLUDE = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_pthreads) $(VARIANT_CANCELABLE_INCLUDE_sys)
+
+VARIANT_CANCELABLE_INCLUDE_compat = creat.c sigcompat.c
+VARIANT_CANCELABLE_INCLUDE_gen = lockf.c nanosleep.c pause.c pselect.c sleep.c termios.c usleep.c wait.c waitpid.c
+VARIANT_CANCELABLE_INCLUDE_net = recv.c send.c
+VARIANT_CANCELABLE_INCLUDE_pthreads = pthread_cancelable.c
+VARIANT_CANCELABLE_INCLUDE_sys = system.c
+
+// $DARWINEXTSN
+
+VARIANT_DARWINEXTSN_MACROS = -DVARIANT_DARWINEXTSN
+
+VARIANT_DARWINEXTSN_INCLUDE = $(VARIANT_DARWINEXTSN_INCLUDE_gen) $(VARIANT_DARWINEXTSN_INCLUDE_stdio) $(VARIANT_DARWINEXTSN_INCLUDE_stdlib) $(VARIANT_DARWINEXTSN_INCLUDE_sys)
+
+VARIANT_DARWINEXTSN_INCLUDE_gen = pselect.c popen.c
+VARIANT_DARWINEXTSN_INCLUDE_stdio = fdopen.c fopen.c
+VARIANT_DARWINEXTSN_INCLUDE_stdlib = realpath.c
+VARIANT_DARWINEXTSN_INCLUDE_sys = getgroups.c
+
+// $DARWINEXTSN + no cancel (everyone else is cancelable anyway)
+
+VARIANT_DARWINEXTSN_CANCELABLE_MACROS = -DVARIANT_CANCELABLE -DVARIANT_DARWINEXTSN
+VARIANT_DARWINEXTSN_CANCELABLE_INCLUDE = pselect.c
+
+// Pre-1050 symbols
+
+VARIANT_PRE1050_MACROS = $(VARIANT_PRE1050_MACROS_$(PLATFORM_NAME))
+VARIANT_PRE1050_MACROS_macosx = -U__DARWIN_VERS_1050 -D__DARWIN_VERS_1050=0 -DVARIANT_PRE1050
+VARIANT_PRE1050_INCLUDE = $(VARIANT_PRE1050_INCLUDE_$(PLATFORM_NAME))
+VARIANT_PRE1050_INCLUDE_macosx = daemon.c $(VARIANT_PRE1050_INCLUDE_$(PLATFORM_NAME)_$(CURRENT_ARCH))
+VARIANT_PRE1050_INCLUDE_macosx_x86_64 = pselect.c
+
+// Legacy symbols
+VARIANT_LEGACY_MACROS = -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0 -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_LEGACY
+
+VARIANT_LEGACY_INCLUDE = $(VARIANT_LEGACY_INCLUDE_$(CURRENT_ARCH))
+VARIANT_LEGACY_INCLUDE_i386 = $(VARIANT_LEGACY_INCLUDE_compat) $(VARIANT_LEGACY_INCLUDE_gdtoa) $(VARIANT_LEGACY_INCLUDE_gen) $(VARIANT_LEGACY_INCLUDE_locale) $(VARIANT_LEGACY_INCLUDE_net) $(VARIANT_LEGACY_INCLUDE_pthreads) $(VARIANT_LEGACY_INCLUDE_regex) $(VARIANT_LEGACY_INCLUDE_stdio) $(VARIANT_LEGACY_INCLUDE_stdlib) $(VARIANT_LEGACY_INCLUDE_stdtime) $(VARIANT_LEGACY_INCLUDE_string) $(VARIANT_LEGACY_INCLUDE_sys)
+
+VARIANT_LEGACY_INCLUDE_compat = creat.c setregid.c setreuid.c sigcompat.c killpg.c
+VARIANT_LEGACY_INCLUDE_gdtoa = gdtoa-strtof.c gdtoa-strtod.c gdtoa-strtodg.c
+VARIANT_LEGACY_INCLUDE_gen = clock.c closedir.c confstr.c crypt.c fnmatch.c lockf.c nanosleep.c nftw.c nice.c opendir.c pause.c popen.c pselect.c rewinddir.c seekdir.c setmode.c sleep.c telldir.c termios.c timezone.c ttyname.c usleep.c wait.c waitpid.c
+VARIANT_LEGACY_INCLUDE_locale = wcsftime.c
+VARIANT_LEGACY_INCLUDE_net = recv.c send.c
+VARIANT_LEGACY_INCLUDE_pthreads = pthread.c pthread_cancelable.c pthread_cond.c pthread_mutex.c pthread_rwlock.c
+VARIANT_LEGACY_INCLUDE_regex = regcomp.c
+VARIANT_LEGACY_INCLUDE_stdio = fdopen.c fopen.c fputs.c freopen.c fwrite.c tempnam.c
+VARIANT_LEGACY_INCLUDE_stdlib = getopt.c putenv.c realpath.c setenv.c system.c
+VARIANT_LEGACY_INCLUDE_stdtime = localtime.c strftime.c strptime.c
+VARIANT_LEGACY_INCLUDE_string = strerror.c
+VARIANT_LEGACY_INCLUDE_sys = msgctl.c semctl.c shmctl.c
+
+// INODE32 symbols
+
+VARIANT_INODE32_MACROS = -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_INODE32
+
+VARIANT_INODE32_INCLUDE = $(VARIANT_INODE32_INCLUDE_$(CURRENT_ARCH))
+VARIANT_INODE32_INCLUDE_i386 = $(VARIANT_INODE32_INCLUDE_gen) $(VARIANT_INODE32_INCLUDE_sys)
+VARIANT_INODE32_INCLUDE_x86_64 = $(VARIANT_INODE32_INCLUDE_gen) $(VARIANT_INODE32_INCLUDE_sys)
+
+VARIANT_INODE32_INCLUDE_gen = fts.c getmntinfo.c glob.c nftw.c opendir.c readdir.c rewinddir.c scandir.c seekdir.c telldir.c scandir_b.c
+VARIANT_INODE32_INCLUDE_sys = statx_np.c
+
+// DYLD (libc.a)
+
+VARIANT_DYLD_MACROS = -UBUILDING_VARIANT -DVARIANT_DYLD -DVARIANT_CANCELABLE -DVARIANT_DARWINEXTSN -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0
+
+VARIANT_DYLD_INCLUDE = $(VARIANT_DYLD_INCLUDE_generic) $(VARIANT_DYLD_INCLUDE_$(CURRENT_ARCH))
+
+VARIANT_DYLD_INCLUDE_generic = $(VARIANT_DYLD_INCLUDE_gen) $(VARIANT_DYLD_INCLUDE_pthreads) $(VARIANT_DYLD_INCLUDE_stdlib) $(VARIANT_DYLD_INCLUDE_string) $(VARIANT_DYLD_INCLUDE_sys) $(VARIANT_DYLD_INCLUDE_threads)
+VARIANT_DYLD_INCLUDE_gen = _simple.c arc4random.c closedir.c dirfd.c getcwd.c getpagesize.c nanosleep.c opendir.c readdir.c scandir.c sysctl.c sysctlbyname.c telldir.c usleep.c
+VARIANT_DYLD_INCLUDE_pthreads = pthread.c pthread_mutex.c pthread_tsd.c
+VARIANT_DYLD_INCLUDE_stdlib = atexit.c exit.c gettimeofday.c heapsort.c merge.c qsort.c reallocf.c realpath.c
+VARIANT_DYLD_INCLUDE_string = strcat.c strchr.c strcpy.c strdup.c strlcat.c strlcpy.c strncmp.c strnlen.c strrchr.c strstr.c
+VARIANT_DYLD_INCLUDE_sys = errno.c
+VARIANT_DYLD_INCLUDE_threads = mig_support.c
+
+VARIANT_DYLD_INCLUDE_x86_64 = x86_64/pthreads/pthread_set_self.s x86_64/pthreads/pthread_self.s x86_64/pthreads/pthread_getspecific.s x86_64/pthreads/preempt.s x86_64/string/__bzero.s x86_64/string/bcopy_sse3x.s x86_64/string/bzero_sse2.s x86_64/string/ffs.s x86_64/string/longcopy_sse3x.s x86_64/string/strcmp.s x86_64/string/strlen.s x86_64/string/strncpy.s x86_64/sys/OSAtomic.s x86_64/sys/i386_gettimeofday_asm.s x86_64/sys/spinlocks_asm.s x86_64/sys/nanotime.s
+
+VARIANT_DYLD_INCLUDE_i386 = i386/gen/icacheinval.s i386/gen/cpu_number.s i386/pthreads/preempt.s i386/pthreads/pthread_set_self.s i386/pthreads/pthread_self.s i386/pthreads/pthread_getspecific.s i386/string/__bzero.s i386/string/bcopy_scalar.s i386/string/bzero_scalar.s i386/string/ffs.s i386/string/memcmp.s i386/string/memset_pattern_sse2.s i386/string/strcmp.s i386/string/strlen.s i386/string/strncpy.s i386/sys/OSAtomic.s i386/sys/i386_gettimeofday_asm.s i386/sys/mach_absolute_time_asm.s i386/sys/spinlocks_asm.s
+
+VARIANT_DYLD_INCLUDE_armv7 = arm/gen/icacheinval.s arm/pthreads/pthread_getspecific.s arm/pthreads/pthread_self.s arm/pthreads/pthread_set_self.s arm/string/bcopy_Generic.s arm/string/bzero_Generic.s arm/string/ffs.s arm/string/strcmp.s arm/string/strlen.s arm/string/strnlen.s strncpy.c arm/sys/OSAtomic.c arm/sys/OSAtomicUP.c arm/sys/OSAtomic_resolvers.c arm/sys/Spinlocks.c arm/sys/SpinlocksUP.c arm/sys/SpinlocksWFE.c arm/sys/arm_commpage_gettimeofday.c arm/sys/mach_absolute_time.s
+
+VARIANT_DYLD_INCLUDE_armv7k = $(VARIANT_DYLD_INCLUDE_armv7)
+VARIANT_DYLD_INCLUDE_armv7f = $(VARIANT_DYLD_INCLUDE_armv7)
+
+VARIANT_DYLD_INCLUDE_armv6 = $(VARIANT_DYLD_INCLUDE_armv7) arm/sys/OSAtomic-v4.c
+